My excuse for why I didn't blog much in March...

The goal from the beginning for this blog was to write a post a week, that's the incentive that kicks me each week nagging me to write a post even though sometimes I don't want to. I've seen a number of blogs simply fade into the past after a month or two once the initial novelty has worn off - writing informative well-versed (I hope!) posts is a difficult thing to do in one's free time.

I managed the grand total of one post in March but I did have a valid excuse: I had the "new job search" machine on full throttle and was spending every evening pouring over JobServe and various job blog sites. If I wasn't searching for jobs on the internet then I was either preparing for face-to-face interviews or being telephone interviewed and I just didn't have the bandwidth to blog as well.

I'm pleased to say that I accepted a new development position a few weeks ago and so I'm finally leaving the mobile telecoms industry after ten years (wow, I've only just realised that it's been that long!) and I'm moving into the financial services industry.

I'm still going to be doing Java web server-side stuff so I'm not out of my comfort zone but I'm really looking forward to learning a whole new dictionary of terminology as well as working with an excellent team of people...

Technorati Tags: , , , ,

Ever wanted to test your website on every version of Internet Explorer (IE)?

If you develop websites then you will be well aware of the browser incompatibilities that cause a whole world of pain when you are trying to get something to look the same in all browsers.

Normally you will be testing against IE 6 or 7, Firefox and Safari. Due to IE 7 introducing a load of new behaviour you would also want to test it on IE 6 but you can't have two different versions of IE installed on any one PC. You could turn to a number of virtualised Windows instances with different versions of IE installed but that sounds like a lot of work to me ;-)

What if you could install a simple program and then have the following versions of IE available?:

  • Internet Explorer 3.0
  • Internet Explorer 4.01
  • Internet Explorer 5.01
  • Internet Explorer 5.5
  • Internet Explorer 6.0
Here you go then: MultipleIEs

A blog post about installing multiple versions of IE on your PC by TredoSoft was the source of my information and it's got a lot more information about how it works and what doesn't.

Technorati Tags: , , , ,

How to control another PC without a KVM using Synergy

If you sometimes have your laptop next to your desktop PC you might find that you are hopping from one keyboard/mouse/trackpoint to the other. After a while this gets a little uncomfortable so wouldn't it be cool if you could use your desktop PC's mouse and keyboard on your laptop? Synergy is one such utility, this is how the Synergy team describe it:

Synergy lets you easily share a single mouse and keyboard between multiple computers with different operating systems without special hardware. It's intended for users with multiple computers on their desk since each system uses its own display.
Download Synergy from sourceforge and install it as normal on both you desktop PC (the server) and your laptop (the client). On your desktop PC, start Synergy (Start -> Programs -> Synergy -> Synergy) you will be presented with the following screen:



Click "Share this computer's keyboard and mouse (server)" then click "Configure..." to set up the layout of the screens. Your now presented with this screen:



The first thing you have to set up are the "Screens", these are the computer names that you have given to your desktop and laptop, in my case "cubik" is my desktop and "laptop" is my laptop (funny that!):



To select which PC you are controlling at any one time synergy lets you simply move your mouse to the edge of the screen in the direction of the other PC, your mouse pointer will then disappear from one screen and magically appear on the other! To enable this you need to set up the "Links".

Links are the descriptions of the layout of your machines, i.e. is your laptop on the left or right of your main screen - in my case I have my laptop to the left:



Once you have made your choices via the drop-down lists click the little "+" sign to add that link. You now need to set up the opposite of that link so that you can get control back to your desktop again:



Click "Ok" and then click "Start" to start the server (your desktop PC) listening for connections. Over on the other PC (your laptop) start Synergy and click "Use another computer's shared keyboard and mouse (client)" and type the name of the other PC in the box, in my case I enter "cubik" as that's the name of my desktop PC. Now click "Start" to attempt to connect to your server.

If everything is ok then you should be able to move your mouse over to the left-hand side of your desktop PC's screen and the mouse (and therefore the keyboard) will hop over onto your laptop's screen so that you can control that instead. If you want to return control back to your desktop PC then simply move the mouse pointer to the right-hand side of the laptop screen and the mouse will jump back again!

If you get stuck for any reason on the wrong PC, just right-click on the Synergy icon in the system tray and choose "Quit".

One added bonus is that your copy buffer transfers over to the other PC, try it out - select some text on one screen, then to copy it, mouse over onto the other screen and to paste it. This even works when switching from one screen running Windows to another screen running Linux!

Technorati Tags: , , ,

My all new Ruby Database Script Runner - now with Objects!

Back in December I blogged about how to access ActiveRecord & Migrations outside of Ruby on Rails. It was a little to scriptish for my liking so I've refactored it in a couple of classes instead.

Before you had to copy the code to a new file and add your database migration inside the Script.run method. I've now broken this up into a DatabaseScript class that extends ActiveRecord's Migration and has the guts of how and where to run any database commands and then any number of script classes that do the actual work.

The classes that you write on a day to day basis are now similar in style to the standard Rails Migrations:

require 'database_script'

class UniqueScriptName < DatabaseScript
def self.run
# your migration code goes here
end
end
For example I want to update my_table and set all the updated column for all rows to be true:
require 'database_script'

class UpdateMyTable < DatabaseScript
def self.run
execute('update my_table set updated = true')
end
end
If you want to use a specific database connection (rather than one of the standard Rails ones development, testing, production) then add the following method in the above class:
  def self.database_connection_details
<<-YAML
custom:
adapter: ????
database: ????
username: ????
password: ????
YAML
end
This is what the DatabaseScript class looks like:
require 'active_record'

class DatabaseScript < ActiveRecord::Migration; end

def self.script_name(script_file)
return *script_file.scan(/(.*).rb/).first
end

def script_class(script_name)
script_name.camelize.constantize
end

script_name = script_name($0)
require script_name
script_class = script_class(script_name)

# to run this within the context of a Rails app then pass your environment on the command line:
# ruby <script name>.rb development
database_type = ARGV[0]

if database_type.nil?
database_yaml = script_class.database_connection_details
else
# if you have a Rails project then place your scripts in db/script
database_yaml = IO.read('../../config/database.yml')
end

databases = YAML::load(database_yaml)

database_type = databases.keys[0] if database_type.nil?

ActiveRecord::Base.establish_connection(databases[database_type])
script_class.run
Technorati Tags: , , , ,