Nov 2 2010

Since last Wednesday (my last regular blog post), it feels like a million years, it’s been so busy and we’ve done loads of stuff. Thursday I made some home made “schnitzel”. I say that in quotes as I suppose it wasn’t really schnitzel, it was just flat pork with breadcrumbs. It was yummy anyway, I should probably put the recipe up!

Anyway, my Aunt Juli and Uncle Kevin came down to see us (but mostly Freyja), and Sam and Collin and the children came over too and we had a nice afternoon of all 4 children making a mess (that’s Freyja, Finley, Amelie and Uncle Kevin…) of the living room. In the late afternoon after Sam and Collin left we went out for a lovely meal at Water Margin in Portsmouth which is always a winner in my book – I love Chinese food and “all you can eat” Chinese is even better. After we came back and put Freyja to bed I helped Uncle Kevin with his new site, which we managed to smash through his list in a couple of hours with a couple of drinks…

Sunday was nice, we went to the Tenth Hole with Leila, Pete and friends. Hannah absolutely loves this place, but I find it far too busy and I’m really not sure about it. The cakes are nice, but I don’t think they’re that amazing. Still, Hannah enjoyed it which is good, but Freyja does get irritable after a while there because she can’t really run around much.

Monday we were planning to go up to my Grandparents (a.k.a “the Gy Gys”), but alas this was massively delayed by a completely dead car battery. Thankfully a very helpful chap saved the day, first by helping us jump start the car (which failed), and then by taking me to the nearby garage to get a new battery. We are ever so thankful to him, and I doubt he reads this blog, but thank you for your help! Anyway, we made it to lovely Kingsbury Episcopi and had a lovely day and yummy scampi & chips there, and were sent home happy.

Tuesday Phil came over and we typically had Two for Tuesdays pizza night and watched Robin Hood on Sky box office (although not in HD as annoyingly it wasn’t on until 3:30am…?!). It’s not a bad film, but it wasn’t as good as I was hoping. Robin Hood: Prince of Thieves really set the bar high for me and I think I was hoping it would be as good as that, but it failed to deliver on my expectations. I suppose as an entirely separate film (which, in fairness it should be) it was good. Worth a watch, but maybe wait until it comes on regular Sky Movies HD if you haven’t seen it yet.

Wednesday I cooked a nice Sausage and Tomato sauce type meal – very simple to do (again, I should probably put the recipe up…) and it was very tasty so Freyja will be having that for dinner tonight – hopefully she’ll like that. I also ordered my new phone, an HTC Desire HD. Unfortunately Thursday morning I was informed it would be delayed… anger ensued… Anyway, Friday they said it was dispatched so I didn’t have to wait too long as it arrived on Saturday morning, woohoo! It’s very shiny.

Saturday, Hannah’s mum came down and I went to see a friend about a website for a bit then ended up in the pub until about 2am… urgh. I felt really hungover Sunday, and I’m not sure why, I didn’t even feel drunk and I had only had 4 pints… so I was pretty useless for the whole day, and really didn’t feel like going out that evening. However later, after a rather overly chillified Pumpkin and Chilli soup, I perked up a bit, and went out with 3 zombie girls who all looked fantastic in their makeup and everything. A fun night was had by all however, and I’m sure you’ll see the pictures on Hannah’s facebook.

Yesterday (Monday), was again knocked out by hangover pretty much and I spent most of the day playing Angry Birds, which I’m addicted to… however Hannah surprised me with a copy of Fallout: New Vegas when she came home from work so I got all excited and may have given it a hug and maybe more… So after I’ve done a bit more of my client’s site tonight I’ll be getting on with that and stealing the telly from Hannah. That brings me up to now, and I should really get some dinner on because I’m hungry.

Until next time my friends…

Feb 9 2010

So here’s a few useless usage statistics about this website I found using Google Analytics…

Browser Distribution

  • Firefox – 58.93%
  • Internet Explorer – 15.58%
  • Chrome – 10.33%
  • Safari – 9.64%
  • Mozilla – 2.92%

Flash Usage

  • 8.31% of visitors do not report to have Flash installed

Operating Systems

  • Windows – 55.95%
  • Linux – 29.54%
  • Mac – 8.61%
  • Android – 4.90%
  • iPhone – 0.31%
  • iPod – 0.17%
  • FreeBSD – 0.06%
  • Playstation 3 – 0.06%
  • Blackberry – 0.02%

Java Support

  • Yes – 76.80%
  • No – 23.20%

Top 10 Countries Ordered By Visits

  1. United States
  2. United Kingdom
  3. Spain
  4. Germany
  5. Canada
  6. Australia
  7. France
  8. Netherlands
  9. India
  10. Italy

Other Figures…

  • 1.23 average page views per visit
  • 59 seconds average time on site (yikes!)
  • 86.51% new visitors versus 13.49% returning visits

Dec 9 2009

When you write something that connects to a web server, what user agent do you use?

Far too often have I seen things like:

curl_setopt($c, CURLOPT_USERAGENT, "Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)");

In my opinion you should always use a nice descriptive user agent that explains to the server exactly what your client may be trying to achieve, or at least a unique identifier. Unless you’re trying to achieve some kind of web scraping client (which probably contravenes some terms of service agreement somewhere, so I certainly don’t advocate that!), there is no reason not to provide a useful and descriptive UA string.

A good UA string from a little-known client should provide some way of contacting you. When I say little-known, I mean something like your new web app that you’ve just made that queries Last.fm for user data. In this instance, I’d give a nice descriptive UA string with contact e-mail, e.g.:

curl_setopt($c, CURLOPT_USERAGENT, "MyLastFmClient (v0.1) myemail@address.com");

As your client becomes more used, or you already have a decent way of contacting you on your website, perhaps just put a URL:

curl_setopt($c, CURLOPT_USERAGENT, "MyLastFmClient (v1.2) www.address.com");

Of course, when you’re Google for example, everyone knows who you are, so for example the UA string “Mediapartners-Google” yields 200k-odd results, revealing that this is the AdSense content bot.

Why do I think this is important? It helps servers identify you and help you in most instances. If your client goes wrong and gets itself stuck in a loop because you forgot to increment $i for example, that server can see that MyLastFmClient for example is spamming the server with 1,000+ requests a minute. They can then see your UA string and contact you about it.

Another reason is that some servers might actually block access, or provide different content depending on the client. I know that Google serves up a completely different search results page if you’re on IE5 than in IE8 for example. Another server might block all known browsers for example from accessing a web service (e.g. with the message “this page cannot be accessed using a web browser”). I’m not saying this is good or bad practice as that is a WHOLE other kettle of fish – but I’m just saying it can happen, and that sort of thing can be pretty hard to track down.

Although this all might seem pretty trivial, it is useful, and I think any HTTP(S) client should identify itself properly using a clear and descriptive user agent string. It’s no harder to do and it just makes everyone’s lives easier!

Aug 11 2009

The news has spread quickly this morning (I first heard through @ryancarson) that Google have been working on a new revamped version of their Google Search Engine. To the untrained eye, it looks pretty much the same. However, it’s much quicker, and it’s all based on AJAX-style requests…

Looking at Firebug’s net monitoring, I thought “I wonder if Google will open up an API”? It would be quite cool to have an API to request search results from, and Google returns you a load of results in well under a second (Firebug reports the requests take around 300-400ms, which is nice!). At the moment I don’t think it’s a possibility – even me just playing around brought up Google’s human checker (a captcha) that is meant to stop automated search requests…

Makes ya think though, doesn’t it?

Jun 14 2009

One thing I ensure I do on all sites is to develop for two audiences at once. The first audience is of course the end user of the site. This user has CSS enabled, and can view all the prettyness of the site in all its original intended glory. But I also develop the site for text-based browsers, search engines and those with CSS disabled. The advantage of this is that the page is semantically correct. You have <h1> tags around the site title, <h2> around the page title and so on. Menus are in <ul> unordered lists, and so on. Semantically correct pages are instantly more SEO-effective. Working at Netbasic has shown me how important that is :) ! In addition, for the small population that use text-based browsers, it enables them to view the site without mess.

If you have a nice logo to display, and you don’t want to display a big bulky <h1> tag on your page, there’s a really easy way of doing that:

<div class="site-title">
<h1>Your Site Name</h1>
</div>

This markup is great for search engines. Search engines will see the <h1> tag and notice that “Your Site Name” is the page’s main title. Little things like this help search engines determine what your site actually contains, as opposed to the hugely ineffective method of repeating a load of words several thousand times in tiny text…

The way to make that neat semantic code look nice and pretty is with CSS, in order to hide that “Your Site Name” text but display your nice company logo instead…

div.site-title
{
background-image: url('/images/your-company-logo.png');
}
div.site-title h1
{
display: none;
}

As you can probably tell, what this CSS does is ask the browser to display your company’s logo as the background image to this div, and hide the <h1> text.

There’s another issue though – how do we make that lovely logo clickable to go to the home page? That’s easy too, and semantically.

<div class="site-title">
<h1>Your Site Name</h1>
<a href="/home/page/url"><span>Click here to go to the home page</span></a>
</div>

We modify the CSS as well to hide the text itself (in the <span>) but make the anchor (the <a>) tag into a block, which turns it into a link that covers the entire logo.

div.site-title
{
background-image: url('/images/your-company-logo.png');
}
div.site-title h1
{
display: none;
}
div.site-title a
{
display: block;
width: 300px;
height: 60px;
}
div.site-title a span
{
display: none;
}

We’ve used a similar trick here to hide the text that should only appear when CSS is turned off. As mentioned, we explicitly set the dimensions of the anchor tag to fill the dimensions of the logo image.

That’s all there is to it, and search engines will love that as opposed to just using something like this for your logo:

<a href="/home/page/path"><img src="/images/company-logo.png" title="Company logo" /></a>

The search engine or text-based user looking at your site will be able to see clearly what the page title is, and it will load really quickly as unless you’re applying the CSS styles, there will be no images to load, which makes it an all-round winner really!

I’m not saying this is the best way of doing it, but I’ve found it to be quite clever and I use it. If someone’s got some better ideas out there, why not add a comment with your idea :)