Archive

Archive for the ‘Uncategorized’ Category

In Demand Web Skills

July 12th, 2011 No comments

What is currently in demand is PHP5 that means OOP, any framework eg CakePHP/Zend or CodeIgniter and Jquery (Javascript) or good enough or on its own the serious Drupal experience.
If you’ve got these you are gold dust, if not you are … dust …

any comments?

Categories: Uncategorized Tags:

Activate Windows 7 Recent Documents

January 3rd, 2011 2 comments

Years ago Microsoft announced that Windows would be Data Driven rather than Application Driven. In your Start Menu you could see a list of recent documents worked on images, spreadsheets,databases. You just had to click on one of them to re-open it. Strangely hardly anyone used it, and Microsoft, as is their wont, forgot about it as well. It was however extremely useful, here is how to reenable it in Windows 7.

Right click the Start/Win button, select Properties
Click the Start Menu tab (it should be select as default)
Click the Customize button
Scroll down and check the Recent Items check box
Click Ok
Click Apply
Click Ok
You should now have a “Recent” option in the start menu.

How to Tell How long Since a PC has Been Restarted

July 13th, 2010 No comments

From A Dos Window

net statistics workstation

Categories: Uncategorized Tags:

Perl: Regexp to filter out/match just the price/floating point number ie digits and dots

April 15th, 2010 No comments

There are two ways:-

$price=~tr/0-9.//cd; # delete anything but 0-9 and a real dot

$row_array[6]=~s/[^0-9.]//g; # clean up price, remove pound/dollar sign etc

Categories: Uncategorized Tags: , , ,

Useful VIM Abbreviations for Debugging Perl

March 5th, 2010 No comments
iab perlb print “<p>debug ::: $_ :: $’ :: $` line “.__LINE__.”\n”;exit;
iab perlbb print “<p>debug ::: <C-R>a line “.__LINE__.”\n”;exit;
iab perlbd do{print “<p>debug :: <C-R>a line “.__LINE__.”\n”;exit} if $_ =~ /\w\w/i;
iab perld use Data::Dumper; print Dumper %ENV;

the <C-R>a automatically inserts whatever variable you had previously stored in register a

Categories: Uncategorized Tags:

Copying all but today’s files

February 25th, 2010 No comments

I’d put some new files into a folder before remembering to mothball all the old files:-

Here is a zsh solution:-

>mv *.*(^m-1)   ./old

Categories: Uncategorized Tags:

Viewing Remembered Password in Firefox

January 18th, 2010 No comments

You know the frustration of being able to log into a website because your browser has
remembered the password but you have forgotten it and so cannot login from another pc.
Well FireFox will show them to you

options->security->Saved Passwords then click Show Passwords

You may want to consider the security implications as well, to disable this feature while
retaining the ability of the browser to remember passwords

go to

options->security-set master password

I personally never let a browser remember say my PayPal password

Categories: Uncategorized Tags: , ,

copy a file while modifying a value inside it

January 14th, 2010 1 comment

The sed does the filtering, you should be able to see how to adapt this to your own requirements

So I want to duplicate init.php while changing the value of a flag inside it for each copy

cat init.php | sed s/flag=2/flag=3/ > dir3/init.php
cat init.php | sed s/flag=2/flag=4/ > dir4/init.php

If you see the first comment Bawdo suggests rightly that this is a UUOC

sed “s/flag=2/flag=4/”  init.php > dir4/init.php

I’ve always underused sed unfortunately

which then can written (zsh)

for i in {3,4}; sed s/flag=2/flag=$i/ init.php > dir$i/init.php

sed stands for stream editor and therefore cannot do an in place edit this is where perl thrives

perl -p -i -e ‘s/\surname\b/form_surname/g’    *.php

or safer

perl -p -i.bak -e ‘s/\b23\b/34/g’  fred.php  (creates a backup of each file eg fred.bak)

Categories: Uncategorized Tags:

Forgetting How You Solved a Problem the First Time

January 13th, 2010 No comments

Today I had to update a 12 year old Higgledy-piggledy Microsoft Access Database application to work with the year 2010 instead of 2009 amongst other things . The original designer had needlessly hard-coded the current year’s and previous year’s date anyway I had some notes from when I did it 12 months ago which described what values need changing, but could I find where those values were defined? My notes were not specific enough. The REAL PROBLEM was that last year I must have altered these values without too much of a sweat and so not taken much trouble to note down exactly.

Fortunately I remembered the wonderful stackoverflow.com website. I posed my question and got several useful pointers in a few minutes and these helped me find the solution which was to set the option search whole project.

This is actually a generic problem in life when we realize that we’ve been doing something automatically and been unconscious of how we did it.

Categories: Uncategorized Tags:

PHP : Read XML File with simplexml_load_file Test Script

December 16th, 2009 No comments


<?php
/* create test.xml from following lines
<?xml version="1.0" encoding="ISO-8859-1"?>
<note>
<to>Fred</to>
<from>Joe</from>
<heading>Reminder</heading>
<body>Meeting Tomorrow</body>
</note>
*/
error_reporting(E_ALL);
if (!function_exists('simplexml_load_file')) exit('<br>function does not exist');
if (file_exists('test.xml'))
{
$xml = @simplexml_load_file('test.xml');
echo "<pre>";var_dump($xml);
}
else { exit('<br>Error could not locate XML file'); }
?>

Categories: Uncategorized Tags: