Using Session Variables in Javascript without Cookies

Until a fully implemented HTML5 spec comes along and solves everyone’s problems, there are still some tricky issues to be dealt with when trying to store data on the client side. And of course, html5 wont be of much help when you’re still developing for older browsers. For example, take IE7 and it’s userdata implementation. It’s baffling and can be quite difficult to explain/understand.

In a recent implementation, I also found that it wasn’t persisting data across an entire website but only for particular pages. So I started to look for an alternative and found this implementation of session variables without using cookies.

Cookies are never a good thing and should be reduced at all costs. Remember that they get sent for every request from the domain, even for images and other static files so that’s using up a lot of bandwidth. Anyways, back to this very clever javascript implementation. This small script allows you to use session variables by manipulating the window object in javascript. It’s not incredibly secure but it is a very useful means for storing arbitrary pieces of data and is really incredibly clever.

Posted in Web Development | Tagged , , , , | Leave a comment

Somerset Lake Point, Bangkok

Located about 5 minutes walk south of the Asoke BTS stop, this Somerset is the nicest hotel that i’ve stayed in on my recent visits to Bangkok. It’s a 4 star hotel, split into 2 separate buildings – tower A and B. We stayed in tower B.

Tower A contains the main lobby, a japanese-inspired restaraunt, a gym and more importantly, an amazing outdoor swimming pool. Tower B seems quieter in comparison. This lobby contains a tour desk where you can book any of the sightseeing tours that you might want to do in the city or in the greater bangkok area. There’s also a small restaurant, not sure what the name of it was, but the food was great. The menu had all the usual thai meals as well as some western meals. Tower B also contains a swimming pool but it’s indoors and nowhere near as nice as the pool on tower A. The gym in tower B seems bigger and better than its counterpart in tower A though, not that I actually went into any of them. It’s worth noting that even if your room is in tower A, you still have access to all the facilities in tower B and vice versa.

We were booked into a 2bdr apartment, which was an excellent decision. These rooms are much more spacious than general hotel rooms and make you feel more at home straight away. The master bedroom is ensuite, spacious and contains a decent sized tv, not a flat screen though. The room also has a balcony which gives you a great view of the spectacular milennium residence apartments. These apartments aren’t fully finished yet but they look stunning, 4 separate buildings and each one is about 50-60 stories high. If I could buy a place in Bangkok, it would be in one of these.

The living area is great, you get a kitchen complete with all modern appliances, a dining table with places for 4 and a living area with a 2 seater couch, armchair and a large screen tv, again not a flat screen though. There’s also a little desk area where you can take advantage of the free internet access if you have a laptop. If you don’t, there’s a small business center downstairs which also has free internet access. I’m not sure if the free internet was a promotion or if its free all the time, but it is a nice to have. More hotels should do this.

I only took advantage of the free breakfast buffet on one morning, i think it was the saturday when I was up at half 6 to go sightseeing out in kanchanaburi. From what I saw though, the setup was excellent and the food was great. Another plus for the Somerset Suites was that there was this small little shop right beside the corridor from tower A to tower B. It was open unitl 10pm and just sold small grocery items like drinks, sweets and cans of singha. It’s not a big thing but it saved us having to walk out into the un-airconditioned streets to get our beer and chocolate fix.

My only complaint was the walk to the hotel from the BTS at Asok was tiring after a full day shopping in Siam. Also, a taxi driver didnt know the hotel one night so I had a bit of difficulty explaining where it was to him. And the tv’s should be updated to flat screens :)

Overall, I loved my time at the Somerset and would gladly stay there again. I didn’t have any major issues with the place, it’s a wonderful hotel.

Posted in General, Hotels, Thailand, Travel | Tagged , , , , , , | Leave a comment

How to pass parameters to a PHP file in a cron job

This is just a quick tip but it annoyed the bejaysus out of me for about an hour. I was running the job in the following format:

00*** test_file.php?a=1&b=2&c=3

But an error was getting thrown saying that the input file, test_file.php?a=1&b=2&c=3, could not be found. With some help from the Google machine, I found that the correct format should be:

00*** test_file.php 1 2 3

And in your PHP file you can use the $argv variable to get at the paramter values

$a = argv[1];
$b = argv[2];
$c = argv[3];

And that should do the trick.

Posted in Web Development | Tagged , | Leave a comment

Binary Solo

Last week I bought the first season of the Flight Of The Conchords tv show on dvd. It’s hilarious and this song has been in my head for days. In fact, I’m just spending way too much time on youtube watching their live performances. I cant wait for season 2.

Posted in General, music | Tagged , , , , , | Leave a comment

The Gaslight Anthem

This is my new favourite band. I got their album, The 59 Sound, a few weeks ago after reading about them in a Q newsletter and have been listening to it constantly ever since. I usually can’t listen to an album in its entirety more than once a week but I listen to The 59 Sound around 3 times a day. I haven’t done that since The Killers Hot Fuss.

Posted in General, music | Tagged , , | Leave a comment

FOWA is coming to Dublin

The Future Of Web Apps conference is coming to Dublin for the first time in 2009 and they’re bringing some of the most talented people in the web industry with them. Speakers confirmed for the event so far include David Heinemeier Hansson from 37signals, Blaine Cook the former twitter developer and Mike Butcher from Techcrunch UK. FOWA always generates a lot of positive attention in the blogosphere and seems to have some very interesting topics up for debate in Dublin. The event will take place at Liberty Hall on Friday the 6th of March, and will be followed by a few drinks at the after party in the Dandelion!!

The first 200 tickets are on sale for €115. The normal cost is €175 so you’re better off to buy early.

Posted in Web Development | Tagged , , | 1 Comment

Yahoo Developer Network

I’ve never been Yahoo’s biggest fan in the past, but over the last few months I’ve been using their developer network almost on a daily basis. It’s full of great tips and guides for most of the main development languages as well as excelling in it’s guidelines for front-end performance optimisation. Any website that can implement even half of the suggested best practices would see noticeable gains immediately. And if you need proof, just install the Firebug and YSlow plugins for Firefox to see how some of the biggest websites out there use these guidelines to ensure exceptional performance for their users.

Posted in Web Development | Tagged , , , | Leave a comment

Blueprint CSS Framework

Lately it seems the word framework is being used all over the place, usually it’s in reference to a web development framework like Rails, CakePHP, CodeIgniter, Django or even the javascript frameworks like JQuery and MooTools. So I can’t say that I was too surprised to hear that CSS Frameworks are becoming more mainstream. Hopefully this might even see CSS getting a bit more recognition from back-end developers.

Frameworks

When creating websites, development frameworks are an ideal way for back-end developers to rid themselves of the repetitive tasks that are required on each and every occasion – tasks like building a user management system, handling database access and even the structural organisation of the files and code so that it is easily maintainable and consistent across projects. Rather than having to make these kinds of decisions for each website that you build, a framework can take care of them and leave you to focus on the new websites indiviual features and requirements. Essentially, you’re starting your project with 25% already completed rather than starting from scratch. And that just makes good sense.

CSS Frameworks can provide similar benefits to front-end developers. So rather than tackling the same tiresome display issues every time you create a website, you can just let the CSS Framework handle it for you. I took a look at a few of the options out there – YAML, Yahoo UI, 960 and decided on using the Blueprint CSS framework. It seems to have the best press associated with it and once I looked through the source code I realised that it’s not too different from the styles I usually like to use.

Blueprint

Blueprint contains seperate source files for each section of the typical CSS file – reset, grid, typography and forms. It also contains a compressed CSS file containing all the styles to save the amount of http requests your website has to make. Some of the frameworks main features are:

A mass reset of browser default styles.
Excellent defaults for typography using relative sizes, ensuring it will scale well in all browsers.
Easily understandable grid layouts. It only takes 2 minutes to mock up a simple html page with as many columns as you want.
An actual print stylesheet.
Easily modified to use your indiviual syles.

The main aspect of blueprint and most of the other CSS frameworks is its grid-building capabilities. By default, the grids.css file sets up a 950px wide grid of 24 columns. This grid is suitable for any website trying to fit into the typical 1024px width dimensions. It is customisable though so if you do want a larger/smaller grid then that isn’t an issue.

At this point it’s important to remember that all the elements can be modified. Blueprint is a set of base styles that any developer can use or update to realise the goals of the website. It should not be treated as the complete CSS solution for your project.

Conclusion

Many developers/designers will tell you that CSS frameworks aren’t neccessary, that talented individuals can write their own code. This is a fair argument, it was my first impression too but having tried Blueprint for a while I’ve been impressed by its capabilities and I will be using it in future projects. Its class naming system goes against some of the “semantic” guidelines that you’ll see elsewhere but I dont really rate this as an issue. If you think the styles are named incorrectly, then just change the names. The actual CSS code is excellent and cross browser compatible so it’s worth a look for developers of any level. It’s also an excellent resource for web designers trying to branch out into the CSS world. And maybe the next step for CSS frameworks is to get included in a web development framework like Rails or Cake. Wouldn’t that be nice.

Check it out: Blueprint

UPDATE: There’s a cheat sheet available at digitalart.net  – a reference page with all the important class names that you can print out and keep while you work.

Posted in Web Development | Tagged , , | Leave a comment

Home Sweet Home

I’m back. Roughly 3 years after departing for Australia I have arrived back in good ol’ Ireland. It feels a bit strange to not be travelling anymore but waking up in the morning and not having to worry about checking-out or dragging massive bags around the place is a huge bonus. I was absolutely wrecked in Thailand so it’s really great just to relax at home and recharge for a while. I’ve spent the last week stretched out on the couch watching dvds and eating 15 home-cooked meals a day. Excellent stuff.

Everyone keeps asking if I miss Australia and it’s difficult to give an acceptable answer. I spent 3 years there so of course I miss the place. I made good friends, had some great times, and yep even the Australian winter is probably better than the irish summer. But I’m also glad to be home. It feels good to be with my family again and meeting my friends down at the local pub swapping stories about the last few years is just priceless.

I do reckon that I’ve outgrown Kerry a little bit though. I think that I need the pace of the capital to keep me going for another bit so I will be moving to Dublin as soon as I can get a job sorted out. Which is pretty exciting as even though its the capital, I haven’t a clue about the place really.

Posted in General, Travel | Tagged , , , , , , | Leave a comment

Bangkok

The first time I was in Bangkok I thought it was the worst city I have ever been to. I only spent one night there so i was probably a bit harsh but i just thought that it was really crap and incredibly dirty. This time I went back for 4 nights and loved the place. I guess I had more time to experience the finer parts, like Siam, but I actually did nothing in Bangkok. Knowing that it was the last stop before heading home, all i wanted to do was relax and take it easy. I went to the Paragon in Siam, Central World and to some electronics outlet that was just amazing. But that was about it. I did go to see Get Smart in one of the cinemas which was quite entertaining. The weird thing was that they play some tribute to the king before the start of every movie and every ones has to stand up as if its the national anthem. Very annoying as I spilt half of my popcorn standing up. I stayed at the Lub D Hostel in Silom which was very similar to the WakeUp in Sydney and just as nice. An excellent place to stay in Bangkok and twice as good as some of the fancy hotels in the area.

Posted in Travel | Tagged , , | Leave a comment