Posted on May 07 2009
I installed vmware on another machine today to play around with a few things. Roughly the same setup as with my last set of keyboard woes but different problems this time.\r\n\r\nThe arrow keys didn\\\’t work as they should do at all. The keyboard mappings were obviously messed up as when I hit the up arrow in a terminal in the VM it decided that I wanted to take a screen shot. After checking the keyboard shortcuts defined in Gnome this showed that it had been somehow mapped to be the delete key.
A bit of googling and I found the following solution to the arrow key dilemma :
echo xkeymap.nokeycodeMap = t > ~/.vmware/config
This made the arrow keys function as expected (after a reboot of vmware). Back on to some real work now!
Posted on Sep 25 2008
I was writing a form a little while ago that requests a url from a user. Obviously it would be nice to validate the string the user input in some way. I am not a fan of writing a regex for something like this when I know that there are bound to be many examples of doing this knocking about already so to save time I once again headed over to google to look around.
I came across this link which has a nice little example of a regex to achieve a good validation.
Below is a copy and paste of building the regex string from that site with brief explanations of what each part achieves.
// SCHEME
$urlregex = "^(https?|ftp)\:\/\/";
// USER AND PASS (optional)
$urlregex .= "([a-z0-9+!*(),;?&=\$_.-]+(\:[a-z0-9+!*(),;?&=\$_.-]+)?@)?";
// HOSTNAME OR IP
$urlregex .= "[a-z0-9+\$_-]+(\.[a-z0-9+\$_-]+)*";
// PORT (optional)
$urlregex .= "(\:[0-9]{2,5})?";
// PATH (optional)
$urlregex .= "(\/([a-z0-9+\$_-]\.?)+)*\/?";// GET Query (optional)
$urlregex .= "(\?[a-z+&\$_.-][a-z0-9;:@/&%=+\$_.-]*)?";// ANCHOR (optional)
$urlregex .= "(#[a-z_.-][a-z0-9+\$_.-]*)?\$";
This builds a nice regex string which can be used with the eregi() function to validate a url string like so:
if (eregi($urlregex, $url))
{
echo "URL Valid";
}
else
{
echo "URL Invalid";
}
This regex will validate nearly all valid url’s and is handy to have knocking about.
Thanks to the original author, whoever that may be…..
Posted on Mar 18 2008
Another quick update on the state of this blog!
I have added a category system to the posts. All the posts are now sorted by category as well as the original tagging system. This enables quicker referencing when trying to look back through the old posts. Posts can be viewed by category by going here.
There is also now an RSS feed for new posts. This can be viewed by going here. Or paste the link into your favourite RSS reader.
That’s all for now.
Posted on Mar 14 2008
Just a quick entry to say that the tag system should now be functional. It is very basic but as I said in my previous posting hopefully I will get time to add more functionality eventually.
Posted on Mar 14 2008
Hi to anyone that happens to be reading this. This is my new blog to document my random ramblings and thoughts. This will mostly contain a lot of random thoughts of mine regarding computers, programming, scripting, the world in general etc etc.
Of course this blog was also an exercise to see if I could knock up a basic blogging PHP script in a few hours. No doubt there will be a few bugs but I will hopefully iron those out relatively quickly. Time will tell on that front I suppose. If you do happen to find any bugs feel free to use the contact link to email these through to me so I can sort them out.
The blog will be undergoing many updates in the near future. At the moment it is an extrememly simple script (and the tags don’t even do anything yet). Soon it will be a lot more functional with archiving etc to make it easier to navigate. Hopefully some of my ramblings will come in useful enough to some people to make this worthwhile 
Matt