I got my hands on a Mac

I’ve done work on Macs before and always enjoyed it but I’ve managed to get my hands on a MacBook Pro which I’ll be doing lots of my work with.

Having read a couple of iPhone developer books I’m very keen to get stuck into a bit of app development and see what I can come up with.

The first evening was pretty much spent installing programs and typing into Google “mac short cut for ……” but after a few days of working on it I can highly recommend it. It’s lightning fast and opening up new programs is almost seamless. This really helps my workflow as I’m not getting distracted whilst the new program opens up.

Not to mention the excellent battery life, it’s really nice to have a laptop that can be used as one and not have to look for a power supply before even thinking about getting into some work.

Drupal 6 num_rows

I’ve been working on a site powered by Drupal and needed to find the number of rows a database query returned. Simple enough and quite common procedure. But, the Drupal database API no longer offers the db_num_rows() function.

I had a quick Google around and the answered seemed to be to run the query twice but the second time using a count query. Two calls to the database when only one is necessary? Not on my watch. The piece of code is to appear on the home page so it will be called upon frequently.

My solution was too loop through the results set and add the formatted HTML to an array. Then check if there are any items in the array, if so loop through it an output them if not display the message that there are currently no results.

I know it’s still doubling up but I think it is a slightly more elegant solution than the double database call.

Destroying CodeIgniter Sessions when closing the browser

I’m really enjoying using CodeIgniter, it’s an excellent framework and has a side benefit of helping to structure your files neatly.

I’ve been working on my first login form using it, and whilst there are lots of tutorials going through this common process I encountered a “problem” with the CodeIgniter sessions persisting when the user closed their browser.

A bit of searching around and I came up with a few recommendations.

The first is to set the $config[‘sess_expiration’] to 0

This however has the effect of creating a cookie which actually lasts 2 years due to code in the system/libraries/Session.php file

The next was to set the $config[‘sess_expiration’] to -1

This just didn’t work for me full stop. When I logged in it saved the session variable then when I went to the next page it had disappeared.

The solution I have used came from this page.


It’s pretty quick to implement the code and you can have control over the expiration time as well as choosing whether your cookie should be persistent.

And now it’s implemented I intend to copy the Session.php file into every project I create that requires sessions. I can handle having to paste in one line of code to the config file.

Google Maps

A lot of the sites we do in work involve using a Google map, some are simple and just allow the user to choose a spot which populates input fields for latitude and longitude. Others contain large data sets and information about the point, which is normally displayed in one of the Google map bubbles.

Using our standard library code for implementing a map and allowing the user to pick a latitude / longitude point IE6 was only displaying a grey background with the Google copyright.

My first line of attack was to go through the Javascript, but even displaying a basic map on the page was giving the same results.

So I started from a blank page and managed to get a basic map up and working. Then stepping through my real page I discovered that something in the style sheet was causing the error. I know that IE can throw a wobbly if you don’t declare the width and height of the map div, in particular the width. But both these values were declared in pixels.

I eventually got to the bottom of it and it was a png fix I have been using for IE6. I know it’s not practical to make sites look exactly the same across browsers but when you have a large portion of IE6 users it’s hard to tell them that they will receive a version of the site that doesn’t match up to what they were expecting.

Android Development

With the release of the Nexus One phone I decided to look into Android phones and development a little more last night. After reading a quick couple of tutorials I had a simple app that would allow you to update your Twitter status.

At first glance it seems to be simpler to construct Android apps over iPhone apps. I’ve also done a bit of work on iPhone apps and the entry to these seems a lot higher.

I don’t think Nexus One will topple the iPhone, there is still a very “cool” factor to owning an iPhone that I don’t think the Nexus One will be able to gain.

I’m due to get a new phone in a couple of months and I am considering an Android but even I’m still tempted by the iPhone. Then being in England where it could be a while till we get a decent tariff for the Nexus One could also be a barrier.

New Year New Blog

I’ve been meaning to set up a new blog for a while now and after a few friends had gone to the bother I decided it was time for me to get on board.

This is along with other things like updating the design and content of my portfolio website, learning new technologies and improving on old ones.

This blog will be a mixture of things from personal to professional and anything else I feel will benefit it.

Happy new year (decade)

Dr Nova Mieszkowska pages launched

Dr Nova Mieszkowska is a Fellow at the Marine Biological Association who specialises in Climate Change and Marine Biodiversity.

Her pages were created to reflect her studies based on a colour palette that was derived from Dr Mieszkowska’s own photography.

The site includes a jQuery lightbox plugin for images on information pages as well as the Galleria plugin for the gallery pages.