Posted by Max Dunn
Mon, 21 Jan 2008 17:39:12 GMT | no comments
Several weeks ago, my Windows Media Center started having problems. TV playback would stutter and the CPU was pegged at 100%. After looking for solutions on the web, I deinstalled all codecs and then reinstalled NVidia PureVideo. Now TV and DVD’s wouldn’t play at all! Since I was tired of continually hassling with Media Center, I decided to finally give the Linux based MythTV a try.
Read more...
Posted in Tech Tips
Posted by Max Dunn
Fri, 02 Nov 2007 15:29:55 GMT | no comments
When choosing an email address, it is often tempting to use just your first name or last name like lisa@mycompany.com or smith@mycompany.com. Don’t do it!
The problem with these simple email addresses is that spammers often use directory harvest attacks to find new email addresses to send spam to. In these attacks, they try using all sorts of different email names to see if any go through. Here is an edited portion of my mail log file that records these attacks:
...
Oct 28 01:51:26 <barker@testcompany.com>... User unknown
Oct 28 01:51:27 <barnes@testcompany.com>... User unknown
Oct 28 01:51:28 <barnett@testcompany.com>... User unknown
Oct 28 01:51:29 <barrett@testcompany.com>... User unknown
Oct 28 01:51:30 <bates@testcompany.com>... User unknown
...
Read more...
Posted in Tech Tips
Posted by Max Dunn
Tue, 11 Sep 2007 20:30:14 GMT | no comments
There are three main issues to consider when designing web sites that will look good to the widest number of visitors: monitor size, OS/browser and colors.
Monitor Size
First, no-one uses 640×480 anymore, so this should not be considered. Next up only about 8% of users have 800×600 displays. The biggest group is 1024×768 which accounts for about 50% of user’s displays. At the 1280×1024, we have about 17% of the users. The rest, about 25% have higher resolution displays.
What this means is that to design for the widest group, web pages should be displayable on a 800×600 display, but can be optimized for best viewing on a 1024×768 display.
Keep in mind though, when thinking about the design is that it is hard to read long lines of text and that narrower web pages are often easier to read. Also, when users scan web pages, they look in an F-shaped pattern: first along the top and then the left side. So having a wide page with a lot of important information on the right side will likely not be effective.
Read more...
Posted in Tech Tips
Posted by Max Dunn
Sat, 28 Apr 2007 16:37:14 GMT | no comments
If you are using the SVN command line, here is a trick that makes it easier to import your files into Subversion. The problem with the usual method is that after importing your files, you have to check them out to a different directory, rather than continuing to work with them in the same location. This methods avoids that problem:
Read more...
Posted in Tech Tips
Posted by Max Dunn
Tue, 20 Mar 2007 15:49:44 GMT | 2 comments
It is interesting that Apache 2.2 doesn’t include a startup script that is compatible with the Linux ‘chkconfig’ command. Here is how you fix this:
First, add this information to the top of /usr/local/apache2/bin/apachectl:
# chkconfig: - 85 15
# description: Apache is a World Wide Web server. \
# It is used to serve HTML files and CGI.
Then change to /etc/init.d and do:
sudo ln -s /usr/local/apache2/bin/apachectl httpd
sudo /sbin/chkconfig --add httpd
sudo /sbin/chkconfig --level 2345 httpd on
That’s it! Now Apache will start when the computer starts up.
Posted in Tech Tips
Posted by Max Dunn
Mon, 05 Mar 2007 17:12:25 GMT | 1 comment
We had a bad crash yesterday on our MySQL 5.0.22 database. Our guess is that we ran out of hard disk space during a large transaction and the database somehow got corrupted. Worse, restarting MySQL didn’t clear the error, but continued to have the problem. Luckily, we could still read from the database so we were able to do a current backup which allowed us to recreate the database and re-import the data. Here are the steps we used:
- In my.conf use:
innodb_force_recovery = 6
(or lower) to bring the database up.
(See http://www.mysql.org/doc/refman/5.1/en/forcing-recovery.html)
- Dump the tables. For example. to dump the ‘maxwiki’ table use:
mysqldump -
mysqldump --database maxwiki -u (username) -p (password) > maxwiki.sql
Repeat for all other tables
- Shut down the database
- Move all files out of /usr/bin/mysql and put elsewhere
- Re-init with:
mysqld_safe --user=mysql
mysql_install_db --user=mysql
mysqladmin -u (username) password '(password)'
- Reload all the tables from the sql files
- Reset the users
Posted in Tech Tips
Posted by Max Dunn
Tue, 23 Jan 2007 17:51:17 GMT | no comments
I like Linux, I really do. That is one reason why I got a Mac last year and also why I host my web sites on Linux servers. However, for all the talk about Microsoft’s DLL Hell, it is nothing compared to Linux Dependency Version Hell. Those of you that have tried installing new versions of software on Linux know what I mean. Whenever you upgrade one piece it causes a cascading effect of having to upgrade lots of other pieces. And sometimes there is a problem with the latest version of a library so you have to use an older version. Now if you have something like apt-get, yum or urpmi, it can help a lot by installing all the needed dependencies for you. But once you venture outside the official versions, it will take a long time to get everything right.
Take for instance, what should be a straightforward task of getting Subversion 1.4 (SVN) working with Apache 2. Of course, you don’t have to have these working together because you can use svnserve by itself. But this only lets you set access control for the whole repository, rather than the finer grained access you get going through http, and you also need to add all svn users to Linux, which is problematic. So to get the advantage of having Subversion working through Apache using http, I spent a day figuring it out.
In the end, the procedure turned out to be fairly straightforward and to save others the pain I went through, here is the trick:
Use the Apache apr and apr-util libraries when making Subversion.
On a standard install, you will probably have libapr-1.so and libaprutil-1.so in both /usr/local/apache2/lib and /usr/local/apr/lib and maybe even /usr/lib. If you configure Subversion with the defaults, it will find the apr libraries in /usr/lib. And if they are not the exact same version as in /usr/local/apache2/lib, there won’t be any errors but when you try to access the repository, you will get error messages like:
Could not fetch resource information. [500, #0]
Could not open the requested SVN filesystem [500, #2]
Internal error: Can't open file '/var/svn/format': No such file or directory
So the best thing is to delete all the libapr* files everywhere but /usr/local/apache2/lib and then configure Subversion like this:
./configure --with-apxs=/usr/local/apache2/bin/apxs \
--with-apr=/usr/local/apache2/bin/apr-1-config \
--with-apr-util=/usr/local/apache2/bin/apu-1-config
After that, you should be able to follow the Subversion/Apache setup instructions with no problems.
Posted in Tech Tips
Posted by Max Dunn
Fri, 12 Jan 2007 23:08:34 GMT | 5 comments
This is probably obvious to people who know Apache well, but I just spent a half day struggling with the differences between RewriteRule in .htaccess and httpd.conf. I was assuming they would behave the same way, but there are slight differences:
Differences
httpd.conf
- The request URI will have a leading slash
- The leading slash needs to remain to find cached files
- When using -f or !-f, it needs to have the document root on front
.htaccess
- The request URI won’t have a leading slash
- Can’t have a leading slash to find cached files
- When using -f or !-f, don’t use the document root
Examples
Here is an example that looks in the public/cache directory for cached files:
httpd.conf
RewriteRule ^/$ /cache/index.html [QSA]
RewriteRule ^/([^.]+)$ /cache/$1.html [QSA]
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ dispatch.fcgi [QSA,L]
.htaccess
RewriteRule ^$ cache/index.html [QSA]
RewriteRule ^([^.]+)$ cache/$1.html [QSA]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ dispatch.fcgi [QSA,L]
Rails
Just to complete this example, add this line to a before_filter method in application.rb to have Rails cache files to this directory:
ApplicationController::page_cache_directory = "#{RAILS_ROOT}/public/cache"
Posted in Ruby on Rails, Tech Tips
Posted by Max Dunn
Wed, 13 Dec 2006 07:14:38 GMT | 7 comments
There are some problems installing the Ruby Gem MySQL on the Mac 10.4. When you do a:
sudo gem install mysql
you will likely get an error like:
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers. Check the mkmf.log file for more
details. You may need configuration options.
To fix this problem, run this:
sudo gem install mysql -- --with-mysql-dir=/usr/local/mysql
(Solution From How to Install on OSX)
Next, you will probably see this error:
mysql.c: In function 'Init_mysql':
mysql.c:2015: error: 'ulong' undeclared (first use in this function)
...
To fix this, change to /usr/local/lib/ruby/gems/1.8/gems/mysql-2.7 and edit “mysql.c” to add this to the top:
#define ulong unsigned long
(Solution from: I.NFECTIO.US)
Now recompile with:
sudo make
sudo make install
sudo make clean
That should do it!
Posted in Ruby on Rails, Tech Tips
Posted by Max Dunn
Tue, 12 Dec 2006 17:16:50 GMT | 3 comments
We use RubyForge to host MaxWiki. A few days ago, I started having problems connecting to our Subversion (SVN) repository on RubyForge. In Eclipse, I would get the message:
svn: Cannot connect to 'svn+ssh://maxdunn210@rubyforge.org/':
There was a problem while connecting to rubyforge.org:22
If I tried to use the SVN Repository Explorer in Eclipse, it would report something like:
Cannot find folder "
Running the svn command line would produce:
ssh_exchange_identification: Connection closed by remote host
svn: Connection closed unexpectedly
Since I had been struggling recently with some other SVN problems and had updated Eclipse to use the latest Subclipse version 1.1.9, I thought the problem had something to do with this upgrade. Also Wido had been struggling with problems connecting to the RubyForge SVN repository on his Windows box and finally got everything working fine when he setup a convoluted arrangement to use public key authentication. However, since these instructions didn’t apply to my Mac, and I knew that it worked before, I kept banging my head against the wall trying different things.
Finally this morning, I ran into a note on RubyForge that described this exact error.
It turns out that RubyForge uses a service called DenyHosts to to help thwart SSH server attacks. Somehow my IP got on this list, and that was what was causing this problem!
Since I use DSL with a dynamic IP, it is possible that the person that had this IP before me was trying to hack and got the IP on the blacklist. Or maybe it was just my futzing with the upgrade that triggered this. In any event, I just reset my DSL modem to get a new IP, and – voila – I can access RubyForge SVN again!
Probably if I setup Eclipse and SSH to use public key authentication, I wouldn’t have this problem, but that will have to wait until next time.
Posted in Tech Tips