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.

Wednesday, August 12, 2009

perl MIME::Lite sendmail Return-Path fix/override

I'm not sure this affects the newest version of MIME::Lite; however, if you find that you are having issues with your messages being rejected or marked as spam, due to an internal host being added to the Return-Path, the following fix might work for you.

Rather than using:
my $ml = MIME::Lite-new(
    From => ...
To => ...
...
);

$ml->send();

Use the following:
$ml->send_by_sendmail(SetSender => 1);

Thursday, August 6, 2009

Find page count in TIFF or PDF with perl

The perl module you'll want to install is called PerlMagick (Image::Magick) and rather than loading the image into memory you can just use the Ping method. The Ping method returns an array with 4 elements of information for each page of a multi-page TIFF/PDF. If we divide the number of elements by 4 we know how many pages there are in the TIFF/PDF.
use Image::Magick;

my $im = Image::Magick->new();

my @ping_info = $im->Ping('fax.tif');

## If we access an @rray in a scalar context we get the element count
my $count = @ping_info / 4;

print $count;

There you have it, good luck.

UPDATE:

The example above may or may not work properly with PDF's.  Even if it does work it appears that ImageMagick makes an external call to the ghostscript (gs) executable on the system to determine the properties of the pdf.  Here is an example that will work for PDFs:
use PDF::API2;

my $pdf = PDF::API2->open('2.pdf');
print $pdf->pages();

I'm guessing that eventually ImageMagick won't be "broken" but you can use the above in the meantime.

UPDATE:

We recently updated to Debian 6.0 and GhostScript seems to have problems with PDFs rendered by various software (it takes 5 minutes for it to get a page count on a 4 page document).  My first line of defense for checking page counts in a pdf is the following for PDFs:
open(FH, "$temp_file");
for my $line (<FH>) {
    if ($line =~ m/\/Count\s+(\d+)/) {
        $page_count = $1;
    }
}
close(FH);

Don't be tempted to stop searching for the Count after the first match. Some PDFs will list a count for every page (like a page number). You'll want to use whatever the last match is for your actual count. If this code doesn't produce a page count I do the Image::Magick Ping. That appears to cover all scenarios I've come across.

Saturday, July 18, 2009

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

You will never guess what happened?! It has been a couple weeks now since I fixed the motor relay. Well, the heat relay just went out this evening. Good thing I bought extra. :)

Tuesday, July 7, 2009

Updating bios and/or firmware on Dell servers running Debian or any unsupported OS

These instructions will help you update BIOS, BMC, PERC or any other system firmware on your Dell system running any supported or unsupported OS.

I finally got around to updating our servers to Debian Lenny. We have 1850's and 2850's. After lots of trial and error I figured out how to go about updating the bios and various device firmware without a Dell supported Linux environment installed on the server. You should note that instructions below still require basic Linux experience. Another note is that these instructions are OS agnostic and use a livecd which doesn't care what operating system you actually have installed on the machine itself.

The first step is running the Dell Content Manager to create a custom update repository for your severs. The fun part is actually getting your hands on the thing. You will need to download the Dell Systems Build and Update Utility. I should note that I wasn't able to get the download to work until I tried with a MS Windows desktop. When/If you are prompted for a Service Tag, just enter one for one of your own servers.

Once the ISO is downloaded you'll need to mount/copy or extract the 'contentmanager' directory onto your desktop. Assuming you are moving forward with the Windows desktop route you'll want to run the 'win\wincontent.exe' (there is also a 'lin\lincontent.tar' if you want to try that, I didn't). Now go find the new directory that was created. Edit the content.ini and change the 'ftp://' url to 'http://'. After you save that, run the 'contentmanager.exe'. Select 'Create Custom Server Update Utility' and 'Next.' Click 'Browse' and select a directory to dump this repository and click 'Next.' Wait for the program to download some meta-data and then un-check 'Windows' (leaving 'Linux' checked). Now control-click all the server models you need to upgrade and click 'Next.' Go get a soda and let it download everything. Once you've got your 'CustomRepository' go into the 'repository/sysman' directory and edit the .XML files in that directory with your favorite editor and look for the 'path=' attribute(s) (one for each system type). You'll see something like 'path="sysman\..."' change the slash to a '/' so it'll look like 'path="sysman/...". Save your changes and copy the contents (not the directory itself) of the 'CustomRepository' to the root of a FAT32 formatted usbkey.

Now you need to download the OpenManage Server Administrator. Burn it to a CD and then boot it in one of the servers you want to upgrade. Let it boot up all the way (this can take several minutes while network connectivity times out etc. and you answer a couple questions) and once you login as root you need to insert the usbkey. Mount it (you can check 'dmesg' output for the device and it'll be the first partition on there) with something like 'mkdir /media/disk; mount /dev/sdb1 /media/disk -o ro'. Change directory into '/media/disk' and run the following './suu -u'. Wait for it to analyze your system and update your system to the newest bios and firmwares. You'll probably see some notifications from snmpd and other stuff, they can be ignored. After you've completed all the updates type 'reboot'. Do not power down your system, some of the updates need the system to be rebooted to complete (such as BIOS updates).

You should now have up-to-date hardware bios/firmwares for your server. I should point out that under the Drivers section for your Service Tag on Dell's site you might also see something about 'SCSI Drives' firmware update. If you are using SCSI drives in your system you might want to get these out of the way as well. There is a Windows .exe you can download which will create a floppy or ISO image which you can boot in your server to update the drive firmware.

I hope this helps out, this was the simplest solution I could find given my environment (no DVD drives, no network connectivity, and the livecd not supporting X on the 1850's). Good luck! :)

Thursday, July 2, 2009

Kenmore / Whirlpool dryer won’t stay running or heat?

We've got a Kenmore "Elite" dryer (actually made by Whirlpool) that stopped running when you release (let up) on the start button.  After doing some research I found out that there is a $5 relay (every other place you try to buy it is going to be $35-50 each) that USUALLY fixes this problem.

Disclaimer: I take no responsibility for you spending $5 plus shipping on a part that doesn't fix the problem.

There are 2 of these relays in the control panel actually.  One is the motor relay and the other is the heat relay.  The motor relay was my problem.  Supposedly if your dryer isn't heating up then it is the heat relay. The part number for both relays is POTTER & BRUMFIELD/TYCO T9AP1D52-48-03 and the Kenmore part number is 3405281.   If you search around on the internet you'll come across a massive thread on Epinions dedicated to problems like this one.  Sears will happily send someone out and charge you $200 to fix this problem unless you have an extended warranty which they will sell you for $200 for a single year. Honestly, I can't believe there hasn't been a class action lawsuit against Sears for these relays.

Just fix this yourself!

Disclaimer: I take no responsibility if you break your dryer even more.

On the sides of the front of the control panel you'll see these plastic moldings.  Pull back on the top and remove them (they snap into place) exposing 2 screws on the bottom.  Remove the screws and lift up on the front lower edge of the control panel CAREFULLY/SLOWLY and let it hang back on the soft plastic hinges.  Make sure you don't snag on that resistor coming off the motherboard.  You'll see the two identical black relays matching the spares you purchased (I bought 3 of them total for future use).  The one on the right is for the Motor and on the left is for the Heat.  Replace which ever one is the problem (be sure to hook the wires back up to the correct contacts).  Put it back together and fire it up.  Now, go take the $190 you didn't spend on fixing your dryer and save it for buying a non-Kenmore (do some research and avoid any manuf. that produces products for Sears completely out of spite).