Saturday, August 25, 2007

EXE permissions

Error message "Windows cannot access the device, path, or file. You may not have the appropriate permissions to access the item". Whenever I try to run a program.

The unit has Trend Micro PC-Cillin 2007 installed, and one of the services was stuck in "starting". Removal and reinstallation of PC-Cillin solved the problem.

If you do get this error message, try disabling your anti-virus/spyware/firewall software first.

Monday, August 6, 2007

No Mixer Device in Windows XP

A client computer came in with no sound. The drivers were installed properly. Trying to load volume control gave an error that there was no mixer devices installed.

It was a Realtek AC'97 Audio device on board in a Cmopaq Presario computer.

Solution:
Enable the "Windows Audio" Service.

Right-click "My Computer" and select "Manage"
Open "Services"
Open "Windows Audio Service"
Change to "Automatic"
Apply changes
Click "Start"

Problem solved!

Tuesday, July 31, 2007

Website Backup

We manage our website through FTP. I wrote a script using Perl to back up the site every day. This allows me to "undo" changes by going back to older versions of a file.

I realize that this could be written in pure Perl, without relying on wget, but why reinvent the wheel?


#!/usr/bin/perl
use warnings;

$datedir=`date +%F`;
chomp $datedir;
$rootdir="/var/backup/web/".$datedir;
$ftpsite="ftp.website.com";
$credentials="/root/ftp.txt"; #text file, one line: username:password


mkdir ("$rootdir", 0755) unless (-d "$rootdir");

open (UPASS, $credentials) or die;
$creds = <UPASS>;
close (UPASS);

($username,$password) = split (/:/,$creds);

$username=~s/\s+//; #strip whitespace characters - just in case
$password=~s/\s+//;

chdir($rootdir);

$result=`wget ftp://$ftpsite/Web --user=$username --password=$password -nH -m --cut-dirs=1`;

open (LOGFILE,"> backup.log");
print LOGFILE "$result";
close (LOGFILE);

Monday, July 30, 2007

Automatic Picture Sorting

I have an IP camera which FTPs pictures up to my server whenever it detects motion. In order to keep the pictures organized, I wrote this script to automatically sort the pictures into folders based on date.

The pictures have randomly generated names starting with "video" such as "videotrg0494333888.jpg" so I use a regex to match the string "video" and move all files which match into a subdirectory which is formatted YEAR-MM-DD

I have cron run this script every 5 minutes.

-----

#!/usr/bin/perl
use warnings;
use File::Copy;

$datedir=`date +%F`;
chomp $datedir;
$rootdir="/var/camera";

mkdir ("$rootdir/$datedir", 0755) unless (-d "$rootdir/$datedir");

opendir(CAMERA, "$rootdir");
while (defined ($picture = readdir(CAMERA))) {
if ($picture=~/video/) {
move("$rootdir/$picture","$rootdir/$datedir");
}
}

Thursday, July 26, 2007

Windows XP Reboots on Shutdown

The system was an Intel, based on the MSI 945GM4 motherboard.

When told to "Shut Down" from either explorer or the login window, it would immediately reboot. This would happen even when "restart on system failure" option was disabled.

I disabled all of the "wake on" settings, including PCI devices. Nonetheless, the problem persisted.

Removing the PCI modem solved the problem.

It was a Creative Modem Blaster Di3635-1/5655

Since the client doesn't use dial up any more, we left it out.