Nokia and Microsoft’s deal has been getting a lot of press in the last week. Nokia Plan B (which has now been revealed as a hoax) got a lot of attention on Hacker News and spawned a bunch of knock offs which I was taking a look through on my morning train ride. By the time I’d got to work I’d decided to contribute my own poor sense of humour to the mix and set off on the quickest web page launch I’d ever done. The result was Nokia Plan XP which was put together in the time it usually takes me to get my morning coffee. Read more.
I was playing with Mootools’ Class implementation today. It has a few nice features like mixins, easy inheritance and sane parent method calling. I did run into issues combining mixins (through the Implements keyword) with parent method calling. The following code fails with the message: The method “setOptions” has no parent. Read more.
Brightlabs, my employer, regularly publishes a web-focused newsletter for small businesses called enlighten. The latest edition contains and article I wrote detailing “Five trends that will change the web in 2011“.
My HTML periodic table has been getting a lot of attention on Twitter over the last few days. Because the page has a relatively short URL a lot of people have been tweeting the actual URL rather that using a URL shortening service. This has been good for me because shorteners remove the HTTP referrer and stop me from seeing where my Twitter traffic comes from.
A peek at my error logs did reveal one potential problem though. I’ve had well over a thousand hits to invalid URLs like http://joshduck.com/perio. These are obviously URLs which have run up against Twitter’s infamous 140 character limit and have been truncated. This results in wasted traffic for me and a waste of time for my visitors so I decided to push a quick fix. Read more.
Every time I’m working on CRUD applications it seems like a lot of boilerplate code goes towards displaying appropriate messages when lists can contain zero, one or more than one element. I put together a quick function to speed up the process.
The function takes a string with string fragments marked up inline as its main argument. It then formats the output based on the count passed into the function. Read more.
The static keyword is a core feature of PHP’s object oriented programming. Unfortunately, there doesn’t seem to be much in the way of easy introductions available online, so I’d like to give a brief overview of how the keyword functions, and how it should be used.
PHP actually has two distinct uses for the static keyword. The first and most common usage is related class method and property scoping, the second to variable scoping within in a single function. Read more.
Over the last week I’ve been working with a commercial PHP eCommerce package. Amongst some shockingly bad code one of the patterns that has stood out has been the use of includes a kind of pseudo-function. Dozens of files in the application are in the following format. Read more.
When I need to develop multiple sites at once I often find defining multiple Apache Vhosts and host files entries to be time consuming. Thankfully, with a little Apache magic it’s possible to automatically create a new subdomain for each project I start. Read more.
HTML tables receive a bit of a bad rap thanks to years of abuse in web design, however in reality they’re semantic as the next element. They do have their quirks though, one common problem is that instead of aligning themselves like the rigid
blocks we’re used to they tend to be a bit more fluid – expanding and contracting to fit their content.
This useful behaviour can become frustrating when a carefully laid-out table encounters abnormal input and suddenly decides to stop paying attention to the cell widths we’ve specified. Luckily there is a simple solution to this. All the major browsers implement an alternative
fixed table layout which is specified through the appropriately named
table-layout CSS property. Read more.
Redditor troelskn made an interesting observation about my recent blog post about Singletons, pointing out that static variables defined within a method behave completely differently to regular static properties. I use static method variables often but still found this behaviour surprising. I decided this was a good opportunity to find out exactly how static methods, properties and variables work in PHP. Read more.