October 25th, 2009
Here is how to restore your GRUB MBR after installing Windows 7 (or any version for that matter).
- Grab a boot CD of Ubuntu and boot it up
- Open the terminal
- > sudo grub
- If you have a none standard installation (multiple installations of linux or weird partition setup) then use:
> find /boot/grub/stage1
to discover where your root should be
- > root (hd0,0)
- > setup (hd0)
- > quit
- reboot
I personally have 2 different flavours of linux installed and my root happened to be 0,4 and 1,4 as I have 2 drives and each install was on a different partition of each drive. I would recommend choosing the one that you boot into most frequently - as when you install new Kernels etc via apt it will auto configure GRUB for you.
Posted in Linux | No Comments »
June 14th, 2009

Sold
Yup, I am finally getting myself a bigger and better abode in a nicer part of the village where I live. The house is a 3 bed detached and suitably nicer than my current 2 bed semi
All has gone fairly smoothly so far - we accepted a rather cheeky offer from our buyers and to balance things put in a cheeky offer ourselves, which basically meant that I sold and bought at a relative price based on what prices were in the peak a few years back.
This is the first time I have had to get a Home Improvement Pack, which is, in my opinion, a complete and total pointless rip off. Some bloke came and did a five minute ‘energy survey on my property and created a little booklet based on his (incorrect and somewhat random) findings. Our vendors have yet to look at this booklet, and we had some difficulty in requesting the HIP for the property we are buying. When we did receieve it finally it was the same pointless information that we really did not need to know. How the HELL this helps buyers making a choice to buy a house is beyond me.
If these HIPs had actually replaced surveys it would have made much more sense, but to just have a little energy survey in for around £300 is rather silly.
Anyway, it is a fast sale due to the people we are buying from being a company and demanding a 28 day timescale… so its all a tad stressful, but ultimately worth it
Posted in General | No Comments »
June 14th, 2009
I came across a neat method of replacing a string in loads ‘o’ files today.
Basically pipe the output of grep for your search string into sed doing a regex replace on the string.
grep -lre 'SEARCH_STRING' . | xargs -d'\n' sed -i "s/SEARCH_STRING/REPLACE_STRING/g"
Posted in Linux | 2 Comments »
February 24th, 2009
I found myself wanting to batch convert a load of psd files to jpegs today, so I went about looking for a way to do it via the command line.
The tool I chose was Imagemagick. At first I was going to use the tool ‘mogrify’ but it doesnt seem to support the -flatten parameter even though it says it does in the manual… hmmm. The flatten param is needed when converting a psd because of course the psd is multi layer so if you try convert to jpeg without flattening it will generate a jpeg for each layer.
I opted for the standard ‘convert’ command with a little bash magic. The following little script will process all psd files in a folder to jpeg files. You could easily change it to pass in more parameteres etc.
#!/bin/bash
if [ -z "$1" ]
then
echo “Usage: please specify a base directory”
exit $E_NOARGS
fi
for file in $1/*; do
/usr/bin/convert -quality 80 -flatten $file ${file/psd/jpg}
done
Posted in Linux | 1 Comment »
February 22nd, 2009
Today I finally got round to getting debugging working with PDT (2.0) and Xdebug 2.
It wasn’t as hard as I thought as it turned out, I had previously presumed that because I make heavy use of mod_rewrite to rewrite my urls - Xdebug would not know how to find the correct class etc to debug.
The solution was simply to create a server mapping which tells the main site url e.g http://www.mysite.com to point to /ProjectName/index.php (which is where all URLs get pointed to).
Here are the exact steps I took:
- First of all, you need to obviously install Xdebug, which on ubuntu is as simple as doing an apt-get install php5-xdebug.
- Configure your php xdebug conf file located at (for ubuntu) /etc/php5/conf.d/xdebug.ini
- Add the lines:
xdebug.remote_enable=1
xdebug.remote_host=”localhost”
xdebug.remote_port=9000
xdebug.remote_handler=”dbgp”
xdebug.remote_log=”/tmp/xdebug.log”
- Restart apache2… then check your phpinfo() shows the correct Xdebug settings you just added (and the same for the cli using php -i | grep -i xdebug).
- Now for the eclipse configuration… go to Window -> Preferences -> PHP -> Debug
- PHP Debugger - set to XDebug
- Server: Add a new server by clicking on the ‘PHP Servers’ link and point the URL of the document root to your Virtual Host as setup in Apache2 e.g. http://www.mysite.co.uk.
- IMPORTANT - if you use mod_rewrite - add a Path Mapping - Path on server should be your http://www.mysite.co.uk and path in workspace should be your main index.php (or whatever file you rewrite to).
- Set your PHP Executable to your php5 bin location (/usr/bin/php probably).
- You should now be golden. Go back to your project and use the Run -> Debug (F11) after selecting your index.php file in the project browser, and the debug perspective should open. Your script will be paused on the first line by default (you can change this in the debug prefs) so you can then step into your code and watch variables etc etc and other cool shit.
If you want to learn about mod_rewrite, then I suggest you RTFM :) Its a wonderful thang…
Posted in Linux, PHP | No Comments »
January 28th, 2009
Well… another year has passed… and how fast it has gone too.
Im getting through a bottle of half decent wine (for a change) to commemorate the occasion before the more elaborate celebration this weekend.
My main pressie was my phone (yes I got it slightly early) see the below post, and im still having fun tinkering with it
Posted in General | No Comments »
January 25th, 2009

Yay! Ive finally, after 8 years, managed to get round to investing in a new phone!
After some research, I opted for the LG Viewty, as it was a reasonable price (£136 with £20 ‘free’ credit from Tescos), was PAYG, and had all the features I was looking for.
Im personally not a huge user of mobile phones, thus the 8 years without upgrading, so I avoid contracts like the plague - as they are only of benefit for more intensive users.
I personally find deals like £35 a month for 18 months (a total of £630!) for a ‘free’ iPhone not that enticing. It seems a frikkin huge amount to pay out in the long term. On a PAYG Tesco tarrif when calling one of your five favourite numbers it costs 10p per minute which seems pretty reasonable to me.
So far, it seems to LG Viewty lives up to all the reviews I read… lets face it…. its basically a cheaper iPhone without the apple logo.
Its hard to know what to rave about feature wise cos im so out of touch but it has:
- Web surfing (ill probably not use it much due to cost… but… handy)
- 5MP camera (which seems ok quality so far)
- Video recording (not tried yet)
- MP3 /Radio Player
- Lots of Java apps/games available
- Connects directly to my PC via Bluetooth or USB (my old phone could only manage infrared!)
- Handwriting recognition for SMS/Email writing
- A full QWERTY keyboard mode for SMS/Email writing - GREAT!!!
I personally am loving the touch screen… its so much easier and faster to use than my old phone, and a damn site prettier too.
Now… I wonder if I can get a java ssh client on it
My only beefs so far is scrolling is a little tricky to get used to as the scrollbars are quite small (though you can use what they call the jog wheel), and ive been unsuccessful in unlocking it so far… but I shall persivere. If all fails Tesco will apparently do an unlock for free after 90 days of using their service…. or I can pay them £25 to do it whenever.
The geek inside of me says that ill find a way to unlock it myself or chew my arm off trying.
Posted in General | No Comments »
January 25th, 2009
I kept wondering why my motd file (/etc/motd) kept reverting on reboot… so I took a little looksy and noticed it symlinks to /var/run/motd, which is in turn populated by some lines in /etc/init.d/bootmisc.sh.
All you have to do to prevent that is to remove the symlink e.g rm -f /etc/motd and then create a ‘regular’ file with whatever fancy content you want
Personally im a fan of Network Science Ascii Generator for generating some pretty ascii text…
Posted in Linux | No Comments »
January 20th, 2009

This has gotta be the most amusing LolCat ever
It kinda reminds me of a collegue who is addicted to coke (the drink!) actually…
Posted in General | 1 Comment »
January 20th, 2009
So long, and thanks for all the (slightly pungent) fish.
Not that I know a great deal about American politics, but Im glad Obama got the ‘job’ over McCain and Palin… is it just me or does she seem really really scary? Anti gay, Anti Abortion… WTF?
As an atheist myself, im glad another religious nut didn’t get in to impede future scientific progress. Obama seems to be a nice modern forward thinking individual, which is just what the US needs as the <cough>’world leader’</cough>.
Lets face it, he can’t do much worse than Mr Bush…
Posted in General | 1 Comment »