Skip to main content


Showing posts from 2009

Browser Highlighter Firefox extension / plug in

On my site we noticed that some of our users had some JavaScript problems which was affecting content editing. After a bit of nosing around we found the problem was a Firefox extension called The Browser Highlighter. This extension was created by eBay and it injects some JavaScript into the page which can affect the JS in your site. You can view this JavaScript in Firebug (it is in the script tag added just after the head tag) What follows is a means of detecting this extension so you can protect your code from it. Unfortunately, Mozilla Firefox does not provide an API into detecting browser extensions, but there is a work around. If the extension injects a graphic into the page (which this one does), it does so by referencing it from the chrome protocol. i.e. chrome://shim/content/compareLang-1/eBayCompareIcon_yellow.gif as opposed to the normal http protocol So all you have to do is reference this image and place an onload event on it. If the event fires then the extension is install


So the site I have been working on is now in public beta. VOO! can be many different things, but I like to basically think of it as a collaborative blog (where you and your friends can post stories and photos and play games). As always, this site is in beta so new features will be forever forthcoming. Probably the best place to start is the gallery.

jQuery: When does a library become a language?

jQuery is a great JavaScript library which allows web developers to write cross platform code, but some of its syntax looks like it is based more on Ruby than JavaScript. When does a library become a language? So first of all, what is the difference betwen a programming library and a programming language? A programming language is a means by which we (as humans) can give instructions to a computer to get it to do various tasks (algorithms, computations, etc...). They are largely artificial constructs created for human readability which then need to be compiled or interpreted into actual instructions which the computer can then carry out. A compiler turns a program into machine readable instructions ahead of time (compile time) where as an interpreter does so on the fly (runtime). Languages such as C and Java are generally compiled and JavaScript, Perl and Ruby are generally interpreted. While there is no real reason why this has to be the case, these factors normally affect the syntax

IE6 Update

Calling all web developers. The folks over at this site have done something wonderful. Basically, you include this code on your site, and all IE6 users see a drop down bar which looks like an ActiveX update and links to download IE8. This is such a brilliant idea. If MicroSoft won't force people to upgrade, then we, as a community, should.

CSS Hacks = Lying

There are many similarities between using CSS hacks and lying. First of all, what is a CSS hack? A CSS hack is a means by which you can get different browsers and browser versions to see and render your stylesheets differently so you can give them different directions (ironically though it's normally done to achieve pixel perfect cross platform web pages). They are also mostly done for Internet Explorer (which for some reason refused to implement standards based CSS until recently). CSS hacks mostly exploit bugs in a particular browser such as the Star HTML hack . This hack was used to get code to run in IE6 and lower in a different manner than other browsers. IE also introduced conditional comments which allow you to add an extra stylesheet to "fix" any CSS issues. This is not technically a hack, but it does require you to write and maintain extra CSS. There are also more subtle types of hacks to make up for some things that are missing in IE like the IE min-height hack

Getting Search Engines to read Flash Content

Ok, so I lied. While Google supposedly now does index Flash content, what this article is really about is a quick a dirty way to get search engines to index your pages which contain Flash without having to display that content to the user in the HTML. Basically this technique relies on swfobject ( ). One thing swfobject does in dynamic mode is allows you to specify alternative content in a div for non flash users which gets switched out via JavaScript once the page loads: <script type="text/javascript"> swfobject.embedSWF("myContent.swf", "myContent", "300", "120", "9.0.0"); </script> <div id="myContent"> <p>Alternative content</p> </div> So basically you can duplicate the content which goes into the Flash app in the Alternative content section. Search engine spiders index HTML, but don't run JavaScript so are none t

IE8 readiness

I know people have done in depth reviews etc..., but here is a quick a low down of what you need to do as a web developer to support IE8. I am going to assume that you have been a standards based web developer for the last couple of years and that you have not been doing too many hacks to support IE7. 1) Add the new metatag in the top of the to force IE8 to render in standards mode. <meta http-equiv="X-UA-Compatible" content="IE=8;FF=3;OtherUA=4" /> Without this tag a little button appears next to the location bar which allows the user to view the site in IE7 compatibility mode. You probably don't want to do this because you want people to view your nice standards compliant website and also the render mode is slightly different from real IE7 in any case. 2) If you were using conditional comments to catch IE and add some extra CSS, you will probably need to update the condition from <!--[if IE]> < link rel="stylesheet" type="tex

sudo = Stupid Utility, Distinct Overkill

I think XKCD said it best... "Make me a sandwich." "What? Make it yourself." "sudo make me a sandwich" "ok" The UNIX OS was originally designed to run on computers that many people would use and in those situations you don't want every Tom, Dick and Janie installing stuff that could break a shared computer. However, on desktop Linux (which one person normally uses) , sudo is kind of useless. Why not just prompt for the user password without sudo (if root access is needed to install or change modifications)? I guess sudo IS easier than logging out and then logging in again as root, but it's annoying (especially if you give your normal user permission to administer the system). It almost becomes a point of politeness (in which the word please would make much more sense). Instead of sudo apt-get install ruby you could just ask please install ruby . No wonder people think techies speak their own language. You are probably saying please

Life with Linux

I have been using Ubuntu Linux at home for the last month (courtesy of those folks over at Wubi ). Overall I think it is great. So much faster than MS Vista and it helps inject life back into old machines. However I have spent a fair amount of time configuring and re-configuring things (partly my own fault, and also partly because of the learning curve involved with any new OS). I even had to do one re-install (more on that later). Mostly though it worked out of the box. So here are a few good ground rules for newbies... 1) Make sure you have more than one Internet enabled computer in the house before you do anything. If for some reason you have a hardware conflict (as I did with the wireless card on my wife's laptop) you will need to look up how to fix it. 2) Most of what you need is available through Synaptic Package Manager or Applications > Add/Remove. If you need a program or driver search there first before the Internet. The only notable exceptions I can think of are Sky

On gambling and computer languages

Today's entry will be a bit more esoteric than most others, it's basically an broad analogy between gambling a choosing a software language to learn/specialize in. Basically as a programmer you have many choices in your career as to how which languages to learn and what level. The main 2 choices though are whether or not to become a specialist or a generalist. Take a roulette table, it's possible to make sure you will have a better chance of winning by spreading your money around it (being a generalist) but if you win, your win will be offset by your losses. If you put all your money on one square, if you will you will win big but your chances of winning are lower. Now look at specializing vs generalization in programming. Some of the people I know who earn the most money as programmers (at least per hour) tend to specialize in small areas. I know one who only really knows JavaScript (at an architect's level), another who writes add ons for Outlook, and another who spec