Monday, November 30, 2009

How to save credentials for mapped network drives

I always forget the exact syntax for this, so I decided to post this to the blog.

net use z: \\server\share /savecred /persistent:yes

If needed this command will then prompt for the username and then the password.

Thursday, November 19, 2009

Vista Network Icon will not display - how to fix this problem

In order to restore the Network Icon, you must clear the tray icon history.
To do this, follow these steps:
run 'regedit.exe'
go to key 'HKEY_CURRENT_USER\Software\Classes\Local Settings\Software\Microsoft\Windows\CurrentVersion\TrayNotify'
delete keys 'IconStreams' & 'PastIconsStream'
start task manager, go to processes and kill explorer.exe
go to applications in the task manager, hit new task and type 'explorer.exe'
explorer will restart and your network icon should return.


Set the font size for the jquery datepicker widget

You can force the size change by modifying this line in your custom css file.

Replace the following line:

.ui-datepicker { width: 17em; padding: .2em .2em 0;}

With this:

.ui-datepicker { width: 17em; padding: .2em .2em 0; font-size: 12px !important;}

The "!important;" tag tells it to override the body tag.

Wednesday, November 18, 2009

Automatic File Copier

I needed a solution that would automatically copy all the images from my pentax camera to an external hard drive.
So I came up with this perl script.
I only wanted it to attempt to copy the files if both external devices were attached, so it uses the line if (-d $source_dir and –d $dest_dir) to check for this.
Once the files are copied, it waits for three minutes (180 seconds) and starts looping again.



#! /usr/local/bin/perl

use strict;

use warnings;

use File::Copy;



my $source_file;

my $source_dir='f:/dcim/100pentx';

my $dest_dir='g:/';

my $source;

my $dest;

my $status=0;





################# main_loop ####################

while (1)

{

&finddir;

print "status:$status:\n";

©files if $status == 1;

sleep 10 if $status == 0;

}



sub finddir

{

if (-d $source_dir and -d $dest_dir)

{

print "Found Directories\n";

$status=1;

}

else

{

print "Could not find source or destination";

$status=0;

}

}



sub copyfiles

{

opendir (DIR, "$source_dir") or warn "Couldn't open directory, $!";

while ($source_file = readdir DIR)

{

next if $source_file!~/\w/;

print "$source_file\n";

$source = "$source_dir/$source_file";

$dest = "$dest_dir/$source_file";

copy($source, $dest) or warn "File cannot be copied.";

}

closedir DIR;

sleep 180;

}

#################################################