a weblog by Ed Eliot

Full of lovely web standards information and a large helping of PHP

This weblog is the online home of , a Senior Technical Manager at GCap Media living and working in London, United Kingdom.

Entries for October 2007

You are currently viewing posts from the archive. Click here to return to the latest posts.

  • Apple please let me buy a new power supply

    6 months, 22 days ago

    On Friday the cable of my MacBook Pro power supply melted near the MagSafe connector. It still works, just, but I'm sure it's going to go at any minute and it can't be good for the laptop.

    I had a really fustrating and unfruitful afternoon today. I visited pretty much every shop in London I thought might be able to sell me a new power supply. It seems I simply can't get one and worse still no one, not even the Apple Store on Regents Street, was able to tell me when they'd have them in stock again. The Apple web site quotes 3-4 weeks which doesn't sound promising.

    A member of staff in the Apple Store suggested I could use a MacBook power supply instead but their lower power output means that although they'll charge the battery you apparently can't use the laptop at the same time.

    Reading online a number of websites suggest that Apple has withdrawn them from sale in preparation for a new model. Really Apple? How stupid can you get? Preventing customers from using their laptops in this way can't make good business sense.

    If anyone has found somewhere that's still selling them in the UK please drop me a line. I'd really appreciate it.

  • Monitoring Dreamhost with Pingdom

    6 months, 28 days ago

    Recently I've had quite a few discussions with one or two colleagues about the reliability of Dreamhost. It seems that many people have very different experiences hosting their websites with them. Personally I've felt things have been pretty good so far particularly given the cost of the service. In fact I've made more money from referrals than I've had to pay in hosting so the service has been essentially free to date. I feel can't complain too much and that combined with the support team's good technical knowledge and willingness to cater for random random requests such as set up wildcard DNS and granting permission to install custom software has meant I've been reluctant to look elsewhere.

    Of course perhaps this flexibility contributes to instability and I wonder if one's experience varies depending on the web server your sites are located on. Perhaps the seemingly different experiences encountered simply reflect the activities of the other customers sharing the same server as you. In a shared hosting environment it only takes one person's poorly written or particularly intensive script to negatively impact the service provided to everyone else and this holds true no matter what provider you choose.

    I'm guessing not everyone needs the level of flexibility Dreamhost provide and I'm also guessing that not everyone requires rock solid uptime for every site they host either. What if they let you select the balance between flexibility and performance required for each new site added. Each site could then be configured on a server which most closely matched the profile you'd specified. Some servers would allow flexibility, others would be relatively locked down to limit the potential for problems - the best of both worlds, perhaps.

    I think the other thing that Dreamhost, and other shared hosting providers should do, is facilitate the availability of development environments. I wouldn't be surprised if many people develop their sites on Dreamhost in the absence of a local development environment. There's a number of reasons why this might be the case but I'm certain all that unfinished and potentially buggy code can't be helping the situation much.

    One of the things we've discussed is if one really knows the true availability of one's site. Being based in the UK with the time difference that entales means it's likely I'm asleep when Dreamhost, and therefore my site, encounters the most load. Out of curiousity I set up a trial account with Pingdom, a really cool server monitoring service, and have been monitoring the uptime of my site for the last 21 days. It attempts to connect to my site every 5 minutes from numerous locations around the world and records whether or not it sucessfully retrieved the site. So you can be sure it really has reached your site and not a server error you can specify a textual string it should check for once it's retrieved the page. The service keeps a detailed log, calculates the length of downtime encountered and provides detailed charts of percentage uptime and response times.

    Uptime for ejeliot.com

    Response time for ejeliot.com

    So far this month I've had 4 instances of downtime, the longest continuous outage recorded at just over 2 1/2 hours, with a total of just over 5 hours when my site was unavailable. This equates to 98.92% availability, not fantastic but not that bad either and inline with what I'd expect for such a service. Response times have varied from 764ms to nearly 2 seconds.

    It goes without saying that in reporting these figures I'm assuming that Pingdom's service is accurate. I've got no reason to believe it isn't but I'd be interested to hear about anyone else's experience.

    So there we have it, for now I'll be staying with Dreamhost. They've provided the best service of any shared hosting provider I've tried so far and unless I decide to make the move back to a (virtual) dedicated server or colocation I think I'm unlikely to find much better elsewhere.

  • Translation Library Updated

    7 months, 2 days ago

    I've updated the translation library I wrote about in Managing Translation Strings to include:

    • Improved parsing of translation key/value pairs - simplified to a single regular expression. This also means it's no longer necessary to escape literal equals (=) in translation key values although it is still necessary for literal hashes (#).
    • Named substitution variables (as well as numeric).
    • Inheritance of translation files.

    Named Substitution Variables

    You can now pass an associative array as the second parameter to the "Get" method which contains key/value pairs. This enables you to provide more context for people providing translations but will make your templates slightly more verbose.

    The following code shows how to reference a translation with named substitution variables.

    1. <?php
    2. $oTranslation->Get('results.paging', array(
    3. 'pageNum' => $iPageNum,
    4. 'numPages' => $iNumPages
    5. ));
    6. ?>

    The corresponding translation key/value pair might look like this:

    1. results.paging = Displaying page {pageNum} of {numPages}.

    Inheritance of Translation Files

    The library now supports an "inherits" directive to specify that a translation file inherits from another. Redefined keys override those present in the parent. The "inherits" directive must appear on the first line of the file and cannot be proceeded by comments. It takes a single parameter which contains the name of the file it inherits from (excluding the file extension).

    1. {inherits en}

    You might use this functionality to cater for the differences between, for example, British English and American English.

    Download

    » Download Library

    Credits

    Thanks to Brad and Mike for their input.