Thursday, April 7, 2011

Checking URL HTTP response codes from the command line.

I was recently looking for a good way to check a specific url for response codes using curl. I came across the following blog post. Kudos to the author for posting the solution.

Monday, February 7, 2011

FOLLOW UP AGAIN: Kenmore / Whirlpool dryer won’t stay running or heat?

It's been over a year and a half since the last issue we've had with this hunk of junk dryer. This time it popped a circuit and fried the main board. I ended up having to get the extended warranty (you can get a $200 1 year extended warranty for any sears appliance that is less than 10 years old) to have it be replaced (I didn't know what the exact issue was and I wasn't going to pay to replace part after part until it was fixed). AVOID THESE PRODUCTS.

Converting from mbox to Maildir with Postfix and Dovecot on Debian

This is the procedure I used for converting from mbox to Maildir with Postfix and Dovecot running Debain 5.x. This assumes that you have individual system accounts for each mail user and that the mbox files are currently in /var/spool/mail/USER and /home/USER/mail/FOLDERS.

All the following commands/edits will need to be done as root:

Install mb2md:

aptitude install mb2md

Stop the mail servers:

/etc/init.d/postfix stop
/etc/init.d/dovecot stop


Edt the /etc/posfix/main.cf:

home_mailbox = Maildir/

Edit the /etc/procmailrc (if you are using procmail for local delivery/filtering):

ORGMAIL=$HOME/Maildir/
MAILDIR=$ORGMAIL
DEFAULT=$ORGMAIL


Edit the /etc/dovecot/dovecot.conf:

mail_location = maildir:~/Maildir

At this point I'd backup the user accounts just in case there is an issue.

Create a bash script with the following and execute it:

for i in $( ls -1 /home ); do
su -l -c 'mb2md -m' $i; ## convert /var/spool/mail/USER
su -l -c 'mb2md -s mail -R' $i;
done


At this point you will need to restart the mail servers:

/etc/init.d/dovecot start
/etc/init.d/postfix start

Friday, October 8, 2010

HTML::Template CACHE LOAD, HIT and MISS

If you are sure you have mod_perl running and are using cache_debug to diagnose issues with repeated cache LOAD and cache MISS with HTML::Template then the following information might be useful.

Digging through the HTML::Template source I discovered the following:

my @key = ($options->{filepath});
push(@key, @{$options->{path}});
push(@key, $options->{search_path_on_include} || 0);
push(@key, $options->{loop_context_vars} || 0);
push(@key, $options->{global_vars} || 0);


The key under which the cached template is stored is a md5_hex of the previous values passed to the HTML::Template->new() method.  If you are pre-loading your templates in your startup with one set of any of these parameters but are later loading the same template with another set then you will see another CACHE LOAD.

For example if you pre-cache in your startup with:

HTML::Template->new( filename => '/my/path/templates/t.html', cache => 1);

and later in a Registry cgi you create a template object with:

my $tmpl = HTML::Template->new( filename => '/my/path/templates/t.html',  cache => 1, global_vars => 1);

you will see a CACHE LOAD rather than a CACHE HIT when /my/path/templates/t.html is loaded.  The end result is that you maybe loading and caching multiple copies of the same template unnecessarily and wasting memory.

Tuesday, January 26, 2010

Correct way to install Firefox 3.6 on Ubuntu 9.10 Karmic Koala

First close all your current firefox windows. Then open a Terminal with Applications > Accessories > Terminal. At the $ prompt enter the following:

sudo add-apt-repository ppa:mozillateam/firefox-stable

When prompted for your password enter it and enter the following commands one on each line:

sudo apt-get update
sudo apt-get install firefox-3.6

Enjoy.

Friday, November 13, 2009

Can't log in to youtube with android app?

I was only able to get this to work by logging in using my google user/address and password which had been previously associated with my youtube username.

Wednesday, September 2, 2009

Finding perl packages with APT

If you are attempting to satisfy dependencies for perl software that was NOT available via your favourite repository (this is sometimes unavoidable in enterprise environments) you should AT LEAST attempt to satisfy those dependencies using said repository. The easiest solution is to install 'apt-file' from your repo and for any perl modules you can simply call:
apt-file search "LWP::UserAgent"

This will return the following list on Debian Lenny:
liblwp-useragent-determined-perl: /usr/share/man/man3/LWP::UserAgent::Determined.3pm.gz
libtest-mock-lwp-perl: /usr/share/man/man3/Test::Mock::LWP::UserAgent.3pm.gz
libwww-perl: /usr/share/man/man3/LWP::UserAgent.3pm.gz

Now you know that in order to satisfy a dependency on "LWP::UserAgent" you would need to install the 'libwww-perl' module from the repo.

If the module is not available via the repo you should next consider installing the package into a custom perl lib directory specifically for the software (and/or user account) in question. To do this read the documentation for the local::lib module in CPAN.

Ultimately your goal should be to not install non-packaged software to /usr/local and by doing so increase the maintainability of your systems.