Wednesday, February 10, 2010

Use GIMP to edit EPS files on windows.

Install GIMP or GIMP Portable.

Go to the Ghostscript project page on Sourceforge http://sourceforge.net/projects/ghostscript/

Download one of the prepared Windows distributions, such as gs870w32.exe

Start the executable and follow the instructions for the installation procedure.

Right-click My Computer, and then click Properties.

Click the Advanced tab.

Click Environment variables

Set the GS_PROG environment variable to the full file name of the gswin32c binary (e.g. C:\gs\gsX.YY\bin\gswin32c.exe).

 

Open GIMP and open the EPS file.

 

Thursday, January 21, 2010

jquery blockUI bug with internet explorer

When using jquery plugin blockUI if the user doesn't move the mouse after the control returns the cursor will continue to spin.
This is documented on the following post:
Here is the fix.
Edit the jquery.blockUI.js file
After line 379 add the line below.
Line 379: els = $('.blockUI', el);
Add this line: els[1].style.cursor = 'default';

It depends on what version of blockUI.js you have, but here is what I ended up using around line 390.

 var els;
 if (full) // crazy selector to handle odd field errors in ie6/7
  els = $('body').children().filter('.blockUI').add('body > .blockUI');
 else
  els = $('.blockUI', el);
  if ($.browser.msie && els[1] !== undefined) {
   els[1].style.cursor = 'default';
  }

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;

}

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

Thursday, October 29, 2009

Jabra SP700 - How to enable pairing mode

In case of unsuccessful pairing, put the Jabra SP700 into pairing
mode manually:
- M ake sure the speakerphone is off.
- Press and hold the answer/end button until you hear the voice
announcement “Pairing Mode” and the Bluetooth Status Icon
will flash constantly

Monday, October 12, 2009

Frigidaire FEF365ASK Electronic control module


During normal cooking on bake we heard a loud pop from behind the
stove. The stove top still worked, but the bake and broil elements
will not get hot.

As can be seen below I had to purchase a new module to repair the stove.

Wednesday, August 26, 2009

How to fix: Windows cannot access the specified device, path, or file.


After some group policy changes I was getting this error upon trying to install various applications which I had copied from a network share.

But after clicking the Unblock button above the problem was resolved.


How to install RRDs module for RRDTool in perl on Win32

Install Activestate Perl: http://www.activestate.com/activeperl/

Direct link: http://downloads.activestate.com/ActivePerl/Windows/5.10/ActivePerl-5.10.1.1006-MSWin32-x86-291086.msi

Download the rrdtool zip file for windows

Find it here: http://oss.oetiker.ch/rrdtool/pub/?M=D

Direct link: http://oss.oetiker.ch/rrdtool/pub/rrdtool-1.2.30-win32-perl510.zip

Unzip to a temp folder

Open a command prompt and change to the following directory

C:\Temp\rrdtool-1.2.30-win32-perl510\data\rrd2\rrdtool-1.2.30\bindings\perl-shared>

Type ppm install RRDs.ppd

Good to go!

Tuesday, August 18, 2009

How to Create a dynamic DSN for Win32::ODBC database


#! c:\perl\bin\perl
use Win32::ODBC;

$DriverType = "Microsoft Access Driver (*.mdb)";
$DSN = "Win32 ODBC --MS_Access--";
$Dir = "c:\\perl";
$DBase = "myDB.mdb";

Win32::ODBC::ConfigDSN(ODBC_ADD_DSN, $DriverType,("DSN=$DSN", "Description=DSN for Perl", "DBQ=$Dir\\$DBase", "DEFAULTDIR=$Dir", "UID=", "PWD=")) or die "ConfigDSN(): Could not add temporary DSN" . Win32::ODBC::Error();
$db=new Win32::ODBC($DSN) or die "couldn't ODBC $DSN ", Win32::ODBC::Error(), "\n";
$query = "select * from table";
!$db->Sql($query) or die "query $query failed ", $db->Error(), "\n";

while($db->FetchRow())
{
my %Data = $db->DataHash();
foreach my $key(keys(%Data))
{
print $key," -> ",$Data{$key};
}
}

Win32::ODBC::ConfigDSN(ODBC_REMOVE_DSN, $DriverType, "DSN=$DSN") or die "ConfigDSN(): Could not remove temporary DSN ", Win32::ODBC::Error();

Monday, August 17, 2009

How to redeem iTunes app codes from an iPhone or iPod touch.



This one is real easy, but not obvious at first.
Open the app store, then under the featured apps scroll to the very
bottom.
Tap on the redeem app.
It will ask for your iTunes code and your apple account password.
It will install the app, have fun!

Sunday, August 16, 2009

How to fix blogger errors trying to add rss feed

I have a blog that I am trying to add as an RSS feed to google reader, however when I click the rss link it gives me this error: User does not have permission to read this blog.

Through some trial and error I found a fix for this problem.

It occurs when the blogger permissions tab is set to allow only authors to read the blog, I am an author, I'm the admin also, but I still cannot add the rss feed.
I believe this is a security concern and cannot be fixed, but as a workaround, temporarily set the Blog Readers permission to anybody, then add the rss feed to your rss reader, then reset the permissions to only authors.

Works great!

Automatically fill in a PDF form with a perl script

I am using perl version 5.10, and I installed CAM::PDF (version 1.52) by using ppm.


#!/usr/bin/perl
use strict;
use warnings;
use CAM::PDF;

my $infile = input.pdf';
my $outfile = output.pdf';
my $pdf = CAM::PDF->new($infile) or die 'error';
my @FIELDS = $pdf->getFormFieldList();

foreach my $field ( @FIELDS ) {
if ($field =~ /^c/) {
my $ff_obj = $pdf->getFormField($field);
$ff_obj->{value}->{value}->{AS}->{value} = 'Yes'; #This line sets a check in the checkbox fields
}

else {
$pdf->fillFormFields($field => $field); #This line sets the value of the field to the field name.
}
}
$pdf->cleanoutput($outfile);


It seems that on adobe 1.6 files with interactive forms some of the coding is lost and when the output file is opened there is an error stating “this document enabled extended features in adobe reader. the document has been changed”

This seems to be due to incompatibilities in the version of CAM::PDF.

It works fine under older versions of pdf files.