Category Archives: Programming

Perl – Fork and Kill a System Process on Timeout

$pid = open(PIPE, “$command |”) or die $!; eval { local $SIG{ALRM} = sub { die “TIMEOUT” }; alarm($timeout); while (<PIPE>) { $data = $_; }; close(PIPE); alarm(0); }; if ($@) { die $@ unless $@ =~ /TIMEOUT/; kill 15, … Continue reading

Posted in Perl | Tagged , , | Leave a comment

JAVAC Compiler Error: cannot find symbol

Ensure your $CLASSPATH  is clear and try again! caught me out .. Always compile all files in a package at the same time; for example, in the directory Javadir/ListPkg type: javac *.java  

Posted in Java | Tagged , , , , | Leave a comment

Debugging PHP – Parse error: syntax error, unexpected $end

If you have are using the short form <?  for PHP instead of the long form <?php you might be faced with this parse error when running your script on different systems: Update all references to the long version <?php … Continue reading

Posted in PHP | Tagged , , , , , , | Leave a comment

Convert SVG to Raphael JS

Use this link to convert SVG to Raphael JS;; http://www.podciborski.co.uk/SVG2RaphaelJS/

Posted in Java | Tagged , , , | Leave a comment

2002 Cannot log in to the MySQL server – MAC

To fix In /etc/php.ini, replaced the three occurences of /var/mysql/mysql.sock with /tmp/mysql.sock prompt% sudo chmod u+w php.ini   <- had to give myself write permission to that file.. you may need to become root user to actually edit the file.. depends … Continue reading

Posted in PHP, SQL | Tagged , , , , , , | Leave a comment

VBA – Remove Blank Rows

as below: Sub DeleteBlankRows1() ‘Deletes the entire row within the selection if the ENTIRE row contains no data.   ‘We use Long in case they have over 32,767 rows selected. Dim i As Long       ‘We turn off calculation … Continue reading

Posted in Excel, Programming, VBA | Tagged , , , , , , | Leave a comment

HTML Pound/Dollar Symbol £$

HTML ISO-8859-1 Reference ISO-8859-1 ISO-8859-1 is the default character set in most browsers. The first 128 characters of ISO-8859-1 is the original ASCII character-set (the numbers from 0-9, the uppercase and lowercase English alphabet, and some special characters). The higher … Continue reading

Posted in Programming | Tagged , , , , , , , , , | 1 Comment

Open_basedir issues

Check /var/www/php-fcgi-scripts/web4/.php-fcgi-starter    

Posted in PHP | Tagged , , , , | Leave a comment

PHP Deprecated: Comments starting with ‘#’ are deprecated in /etc/php5/cli/conf.d/imagick.ini on line 1 in Unknown on line 0

PHP Deprecated: Comments starting with ‘#’ are deprecated in /etc/php5/cli/conf.d/imagick.ini on line 1 in Unknown on line 0   Just change the ‘#’ in the files to ‘;’ and this error will stop!

Posted in PHP | Tagged , , , , | Leave a comment

Unix find and replace text within all files within a directory

Trying to do a search on an entire directory, finding all the instances of the text “applicationX” and replacing all instances with the text “applicationY”. find /path/to/start/from/ -type f | xargs perl -pi -e ‘s/applicationX/applicationY/g’

Posted in Perl, UNIX | Tagged , , , , , , , | Leave a comment