Category Archives: Web

Funpop.net launched

I am happy to announce the launch of funpop.net, my new site. Funpop.net is a place to find cool or fun stuff from around the web. A 5 minute distraction for your coffee break or a place to find something to do at lunch.

Funpop.net started as the funpop twitter stream, I created the site to provide an archive of the tweets, and other features not available on Twitter such as tags and comments.

Tech

The site is build on Ruby on Rails and uses a PostgreSQL database as the back-end. It’s integrated with Twitter and features a Twitter based publishing system allowing content to be added to the site from Twitter itself. The site has an XML API should you want to use the information for your own purposes.

There are still features that need to be added and improvements to make so suggestions are welcome!

Blocking Internet Explorer 5.5

IE 5.5 is dead. The number of people using it are tiny, at least according to the stats on the most popular sites I run. Here are the numbers.

Jokes-o-matic

Has a larger proportion of Firefox users than Internet Explorer users due to the high level of traffic from some social bookmarking sites, meaning a more web-savvy crowd who are more likely to be using alternative browsers:

jokes-o-matic.com browser breakdown

jokes-o-matic.com browser breakdown

The level of IE usage is still pretty high though, but even so only a single hit from IE 5.5 recently:

jokes-o-matic.com IE versions

jokes-o-matic.com IE versions

Recycling Group Finder

A much more broad and ‘average’ user base with Internet Explorer dominant:

Recycling Group Finder browser breakdown

Recycling Group Finder browser breakdown

Still, only 6 Internet Explorer hits recently, a tiny proportion of overall visits:

Recycling Group Finder IE versions

Recycling Group Finder IE versions

What does this mean?

Yahoo.com as seen in Internet Explorer 5.5

Yahoo.com as seen in Internet Explorer 5.5

These statistics, and others I have seen suggest that almost no-one uses Internet Explorer 5.5 or below any more. The small minority that do must be used to the internet breaking in unique and interesting ways due to the lack of support for more recent developments in CSS and really bad Javascript support (see right for yahoo.com as seen in Internet Explorer 5.5). I predict that a fair number of sites just don’t work in any usable way on anything less than Internet Explorer 6.

Time is money

Designing for multiple browsers takes time. The more browsers you need to support the more time you need to spend supporting them.

A recent project I worked on required a redesign of the site from the ground-up (aswell as a bunch of other stuff) and making the site work in any version of Internet Explorer lower than 6 just wasn’t worth the time, and therefore money, put into it. The return just wasn’t there and I decided that IE 5.5 was gone, dead, obsolete and I wasn’t going to try and mangle the design to work in it. Rather than just display a really crappy looking site to the user I decided I would let them know via a short and to-the-point message that their browser was not up to displaying the site and directing them to upgrade to a new version of their browser.

Give them the good news

IE 5.5 advice message

Message displayed to all users visiting project in anything below IE 6

But how to do this? The site was developed in Ruby on Rails and I’d heard of a neat gem called rack-noie6 that provides a piece of Rack middleware that blocks Internet Explorer 6 and below, but that isn’t going to work in most cases. Hard as it may be to make your site look good in Internet Explorer 6 you can see from the stats above there’s still a large proportion of users using it and to turn them away would be crazy, at least while the pool of IE 6 users out there is still so large.

So a quick fork and patch later (github we <3 you so much) and the new noie6 was accepting an option for a minimum version of Internet Explorer it should accept instead of just rigidly blocking version 6 and below. Configuration is really simple:

Now any users visiting the site in anything below Internet Explorer 6 gets the message above helpfully directing them to update their browser. Not bad for a two line config update.

Tagged , , ,

Google Groups now supported on the Recycling Group Finder

I have just pushed live the latest feature of the Recycling Group Finder, support for Google Groups!

It has taken a while to roll out, the changes to the code-base that runs the site were pretty fundamental as the site was originally only written to work with Yahoo based groups. As a result there may be some issues, let me know if you see any.

To get started just email me your Google Groups recycling group URL or head over to the group addition page.

Jokes site gets pounded, again

Every once in a while I get whole load of incoming links from stumbleupon.com to my jokes site and it’s happened again with over 70,000 page views yesterday:

jokes-o-matic traffic spike

jokes-o-matic.com traffic spike

It’s rails site and only running on one mongrel, but there’s some pretty heavy cacheing in there so it olds up just fine. It’s a great feeling when you put a site up on the internet and you can actually see people using it.

And I realise that i’m publishing a post about a jokes site on April 1st, but this isn’t a joke!

Tagged ,

Free Graze box

Update: Use the code 8YFYB8ZD for your free graze box, it lasts until April 7th I think!

I got my second graze box yesterday:

Graze box

I had completely forgotten about it so it was a really nice surprise and the timing couldn’t have been better, it turned up at 11:00 and I was just starting to get hungry.

Get a free graze box

I also got an email with a voucher code to give out. Just go to graze.com and enter T3RXJWYH into the relevant section and you will get your first box free and your second half price. Delivery is free too and there’s no obligation to get any boxes after the first one to it won’t cost you a thing to try it out. The offer is valid until April 1st (and no, it’s not a joke) so if you’ve missed it you can always use 1925CTC as the voucher code, this one has no expiry and will get you your first box for £1.

Ongoing

I’m not sure how long I am going to keep up the boxes after my offer period ends, it’s 50/50. The full-price boxes are a little too pricey for comfort (I get the olives that are 50 pence extra). They are nice though!

Tagged ,

Rewriting URL params in nginx

I came across this problem recently, a customer was moving to Ruby on Rails from another framework/language (.NET I think) and needed to re-write a bunch of URLs. Some needed the query parameters rewriting too. One example was rewriting the old search path, so the old URL:

http://somedomain.com/OldSearchPath.aspx?qry=things&page=4

would become:

http://somedomain.com/search?query=things&page=4

This should be fairly simple except for the qry parameter needed to be changed to query. A bit of googling didn’t turn up much but with some experimentation I came up with this using the pre-populated nginx $args variable:

location /OldSearchPath.aspx {
  if ($args ~* qry=(.+)) {
    set $args query=$1;
  }
}
rewrite ^.+$ /search redirect;

It even leaves the other parameters intact, so the pagination will still work.

Tagged ,

NWRUG February 2009 – Nanite talk

For the first time in quite a while we had a talk at NWRUG, it seemed to go well and the free Pizzas and Beer provided by Engine Yard were very popular. About 12 people turned up. I was the only speaker and did a 45 minute talk on Nanite with a brief introduction to cloud-computing as that’s the environment I see Nanite being most useful.

Thanks to everyone who turned up and Engine Yard for the sponsorship. I promised a blog post with links to some of the resources from the talk, and here it is!

Useful links from the talk

Nanite (of course)

Kestrel (a starling replacement)

Delayed Job

Warren (A wrapper around AMQP from brightbox)

Engine Yard Solo

As I mentioned in the talk you can probably get away with using third-party APIs and calling it ‘cloud-computing’, this set of slides is really interesting:

Web Hooks and the Programmable World of Tomorrow

Lastly the slides on SlideShare, though they don’t make as much sense as they do with the talk & my notes.

*update*

Pastie: control rabbitMQ using Nanite, controlling god using Nanite.

Next Month

More talks! Asa Calow has agreed to do a talk on Solr and I rather foolishley agreed to do another talk on Sphinx.

Tagged , , , , ,

My First Rails Plugin – asset-format

For the first time ever today I wrote a rails plugin! I googled around first to make sure no-one had solved the particular problem I needed fixing but no-one seemed to have done, so I had no choice but to jump into the rails core…

The problem

In RubyonRails using the asset link tag such as:

<%= stylesheet_link_tag "screen", :media=>"screen, projection" %>

results in something like this on your HTML:

<link href="/stylesheets/screen.css?1234174480" media="screen, projection" rel="stylesheet" type="text/css" />

(view source on the Recycling Group Finder for the original). The number after the question mark (‘?1234174480’) is the asset ID. The idea behind the asset ID is that you can configure your web-server to set an Expires headers for your static assets far into the future causing browsers to cache the asset, but by changing the number (Rails does this automatically) you indicate to the browser that a file has changed and that the browser should re-fetch it. It works most of the time, but there are some mis-configured proxies out there (and possibly browsers too) that will cache the asset even when the asset id changes.

There’s a good description of the problem over on the sproutcore blog.

The Solution

This is where my plugin comes in, altering the asset URL with the asset ID in the URL, eg:

/stylesheets/screen.css?1234174480

becomes:

/stylesheets/1234174480/screen.css

Placing the asset ID in the URL, not the query causes proxies and browsers to see a different asset and so to fetch what it sees as a completely new asset. It will then cache the asset and if you change the asset ID the same thing will happen, no more over-cached assets!

Installing it

Easy, just:

$ cd rails_project_base_dir && script/plugin install git://github.com/wjessop/asset-format.git

start up your app and your asset URLs will be magically transformed! You will need a rewrite in your web-server config to rewrite the request back to the asset, so:

/stylesheets/1234174480/screen.css -> /stylesheets/screen.css

an you are all set!

Whoooooosh – the Recycling Group Finder gets faster

This afternoon I implemented a CDN (Content Distribution Network)  for the Recycling Group Finder, it only took about an hour and has slashed page load times on the site.

Whilst working for Engine Yard today (yes, on a Saturday!) we got a ticket in asking for CDN recommendations. This got me thinking about the recently announced Amazon Cloudfront CDN, specifically how cool it would be to use it for the Recycling Group Finder (a personal project). It’s an internationally targeted site and would benefit from the faster page load times a CDN will bring.

Why Cloudfront?

Cloudfront is built on Amazon S3, a well-used and trusted technology and many of Engine Yard’s customers are already using it. The chances are if you’re already using S3 for storing assets Cloudfront will be dead-simple to get running. I wasn’t, though it didn’t take much extra effort.

It’s easy…

Really easy. There’s a really useful tutorial up that gets you most of the way there, the Firefox S3 plugin is amazing. All that was needed after that was a single line change to my environment.rb file in my RubyonRails project:

and my javascript and CSS files were being served super-fast from the Cloudfront CDN. Sweet! It took a bit more work (and a custom helper) to get some of the other assets served, but not much.

Very. Very. Fast.

The speedup is significant. The site seems snappier when visiting in a browser but I also ran some before and after speed tests using the Pingdom tools page. The results were impressive. The homepage went from a 16.1 second load time (including all assets) to 1.1 seconds:

Before (16.1 seconds):

Homepage for Recycling Group Finder served from server

After (1.1 seconds):

Homepage for Recycling Group Finder served from Cloudfront

The homepage saw the most impressive speed boost, but sub-page load times improved significantly too. This is the before and after tests for the San Francisco Freecycle page:

Before (5.6 seconds):

Recycling Group Finder sub-page served by the server

After (1.6 seconds):

Recycling Group Finder sub-page served by the Cloudfront CDN

Worth the effort

Hell yeah! It took a really short amount of time to get running (helped by RubyonRails built in support for asset hosts) and the site flies. Give it a go!

Tagged