Prove you can program… Fizz-Buzz!
After reading “Imran on Tech > Using Fizz-Buzz to Find Developers who Grok Coding” I felt the urge to quickly doodle a Fizz-Buzz program or two.
For those who haven’t jumped on that link I’ll redact the article:
People with Computer Science degrees fail at simple Programming tests - which makes it a bitch to hire someone decent.
Separate the wheat from the chaff by asking them to program the childs game Fizz-Buzz for 1-100 on paper.
He says that it should take a couple of minutes, and that he’s seen senior coders take TEN to FIFTEEN minutes to do this. Personally I think this is a 1-minute task. So here goes…

1m 5s - not too bad, this is how I reckon it broke down
- 5s - double check the rules: fizz=3, buzz=5
- 15s - code the thing in my head
- 45s - grab my archaic quill and realise that pens are bloody slow
I think a better question might be “given 15 minutes” how many different ways could you write Fizz-Buzz…
My new Office, thanks to Ignite100
Working at home is a mix of awesome and loathsome.
On the plus side there is no commute, I can cook anything I like for lunch (a massive bonus for me), I have peace and quiet, my office toys (projector, sound-system, whiteboard etc) get to be my cinema and party-fodder and my actual toys (mostly nerf guns and puzzles) get to be my distraction while “compiling”…

Negatively speaking you find yourself cracking at the seams for want of good company, even for just a bit of lunchtime craic, there’s also the astronomical utility bills and the fact that my lunchtime would regularly drag on for 2 hours - “I started early this morning and will make up for it this evening, I can justify a couple of episodes of X-Files with my lunch.” Again.
I think it was this shitty extended winter that did it, but I decided to fire off a tweet for a desk to rent and received a very swift reply from Paul Smith - why yes, I would like to take the last remaining desk in an office full of people I know and admire.
The Ignite100 office is a splendid space in central Newcastle; it houses startup companies on their accelerator program. Successful companies are encouraged to stay in the area and rent space from Ignite. The end result is an ever growing community of likeminded, driven people. They also rent a few desks, boon to me!
Ignite100’s business model is simple and exciting, when the penny dropped I felt awed. By keeping hold of these successful businesses they are creating a sort of economical critical mass, and like any large body it will only serve to pull in more and more businesses. Good for their books, good for the region, and good for lonely nerds like me.
My weekend project - Molecule Match
I like games, but I rarely get the chance to play them. My favourite are games that are hard, like reeaally hard, that make you think, that make you hurt. In business terms it’s a terrible idea to ostracise your target audience to any degree, as such these games are a rare beast.
At the start of the year I found myself yearning to get back to my codey roots and have a tinker with games, I spent a lazy Sunday writing and doodling about the various half-baked ideas that I’ve had over the years and finally remembered a game that we played as kids called Chiral, man that game ticked all my boxes.
In the style of a man that has a 1001 things to do I started tinkering anyhow…
Thusfar I have created:
- A decoupled “grid engine” to power any number of games on grids
- A proof-of-concept implementation that presents a grid of atoms, each has a random valency and can be connected to create molecules.
- A simple scoring engine that rewards massive molecules
- Some intro levels that explain how to play the game (not shown in the video)
I plan to:
- Design some different game-modes; timed, clear the board, “match 3 style” (where more atoms drop down when cleared etc), puzzle
- Make the intro levels work really well
- Get some music made for it - probably by Brendan Ratliff, possibly in the style of You Are Listening to… Deep Thought
- Make some sexy visuals / animations - I find this quite daunting
- Reprogram it for Android (native) and iPhone (native) - it’s currently just Javascript
Oh yeah, and make it REALLY SWEARY. I don’t know why, but I like the idea of having the avatar being frustrated by the game and pouring out a constant torrent of abuse.
Molecule? Bollecule!
OOP - Method Bubbling in PHP
Contrary to my online handle “Object-Oriented David” I use Object-Oriented Programming very sparingly. I do however try to use the right tool for the job and take on as many of the concepts that I love about frameworks and libraries I admire.
In creating a “query builder” for the NexGen platform I ended up wanting to use syntax that I would associate with jQuery; chained and namespaced with a common bubbling of methods and properties. Thus I designed a very simple class (it’s simple, but it took me about 2 hours of experimentation to make!)
Here’s the code - with example
In my implementation you can run queries like these:
query->sql('SELECT TABLES')->execute()->debug();
query->select('*')->from('users')->join('avatar')->where('id', 1)->limit(1)->execute()->debug();
query->delete()->from('users')->where('id', 10)->limit(1)->execute()->debug();
query->upsert('users')->data(array( 'id'=>NULL, 'email'=>'david@oodavid.com' ))->return(TRUE)->execute()->debug();
As you can see, each use execute() and debug(), lets explain what happens:
execute()
- …is defined on the child objects sql, select, upsert and delete
- They each build a SQL variable and store it as a property on the parent query object.
- They also access the parents database handler and execute the query.
debug()
- …is NOT defined on any of the child objects, thus the method bubbles up to the parent query object.
- Since the child->execute() methods set the SQL property on the parent, this common method runs an analysis of the query showing timings, bottlenecks and other useful information
A Server Monitor that Doesn’t Suck - End Result
To follow on from the last post - on Friday I quickly cobbled together a simple server monitor that I’m proud to show off, it:
- Looks good full-screen
- Shows a single metric at a time
- Slowly fades between metrics
- Highlights the severity in a way I can see in my peripheral
- Works on mobile devices
While I’ve only 7 metrics up and running the basics are in place so I’ll slowly add in new metrics until I’ve got a complete view of the business.

running on my local machine and scanning my media disk

a useful business metric, these 2 people could represent money

click anywhere on the screen to drill down

there’s a few vanity metrics - to keep me happy and impress visitors
So there you have it, a server monitor that doesn’t suck.
A Server Monitor that doesn’t explode your eyeballs
I’ve been looking forward to the final item on my weekly todo, so much so that all other items have been completed with gusto! Time to:
“Write a server monitor that looks effing awesome”
The rationale behind this tangential quest is that while playing with nagios I can’t help but think that, while functionally useful it’s visually unappealing - viz. I will never look at it.

The Industry Standard - a bit ugly!
Y’see, I’m used to using things like conky.
Conky is lightweight linux program that renders an overlay on your desktop background image, mine’s configured to show system errors, new emails, CPU usage, network load and various system variables. It’s super handy because it’s just always there. LIVE Errors are most important, thus I make them really pop out at me:

Visually nicer, but limited in functionality
So my plan is to combine the functionality of nagios, the simplicity of conky with a few ideas I have rattling around… I want:
- A system monitor that is always visible - a wall-mounted display
- That requires no interaction - until I need to dig deeper
- That I can access from anywhere - on the www
- That is chunky and obvious from afar
- That is visually appealing
- That shows me everything I need to know - including business metrics
I already have a number of scripts and programs that help me get notified of errors / hiccups / statistics etc but they’re all so very disparate.
It is with these things in mind that I am dedicating the next few days to create a basic prototype that doesn’t suck.
In a nutshell:
“A chunky interface that cycles through core metrics and statistics, slowing down on views with errors.”
There’s going to be a lot of fun in making:
- A force-directed graph that represents my database
- A grid of recently processed images
- Topline database statistics
- Recent server errors - as chunky as all hell
- Inspired by something beautiful
Wish me luck!
When you *have* to install all the Internet Explorers, do it in a one-liner
You know how it is, you make something awesome for a company, they all use modern browsers, but their customers? Oh, they’re still rocking IE6 and 7. I quite honestly thought those days were long behind us.
Well, they may seem like dark dark days, but at least we’re not alone - with the advent and growing popularity of github and general open-sourcery I managed to find this GEM of a repository:
https://github.com/xdissent/ievms
Quite simply, if you have Orcale VirtualBox installed you can download and install all the IE’s in a command-line onner:
curl -s https://raw.github.com/xdissent/ievms/master/ievms.sh | bash
Isn’t it beautiful?
Inspired by MailChimp: No more social Logins
We’d been A-B testing a new “login with Facebook” and “login with Twitter” links alongside the regular email and password form.
- Group A - Half of our users see the normal register and login with email option
- Group B - This half also see the extra login / registration options
We noticed that Group B (those with three login choices) were having increased login failure.
After a little research we came across an astounding article from MailChimp covering this exact scenario, I’d be foolish to think I could express this problem nearly as well as these guys, suffice to say that we’ve came to the same conclusion… an excellent (if a little lengthy) read:
- blog.mailchimp.com/social-login-buttons-arent-worth-it
One awesome personal finances spreadsheet
Having been involved with a number of “bootstraps” (4 in a row!) I found myself struggling a little with my personal cashflow… cashflaw might be a more appropriate name TBH.
So anyhow; last year after a joyous debacle I decided that it was pertinent that I took the bull by the horns and really get to know just how these things work. Today I find myself more than comfortable with finances from the personal level all the way to large-company level (double-entry basics, debit, credit, invoices, credit-notes, credit-ratings, credit-insurers yada yada) and today I would like to share with you a pretty powerful spreadsheet that I use to analyse my personal bank account.
http://oodavid.com/finances/template.ods - designed for Open Office, sorry Excel users, but it probably doesn’t work! Feel free to port it :-)
It’s been tweaked and tinkered with and I think I’m finally happy with it. It’s designed to be a no-brainer to user:
- Paste in your bank statement at the end of each month
- Assign each transaction a category
- Magic happens
There are 14 tabs:
- About - this explains how it works and allows you to set some variables that affect the way the thing works
- Money - this is your balance sheet if you will, or a summary of your monthly spendings and earnings with opening balance, closing balance and a grouping of how you spend your cash
- April > February - this is where you paste your bank-statements then categorise each transaction, once you’ve done that the Money tab is automagically updated!
by selecting the category the transaction is added to the correct month / category cell on the Money tab (click for a bigger image)
So every month I paste in my statement, categorise each item (about 60 on average) and then I have a number of useful things in my possession:
- An exact breakdown of how much I’m spending and earning in different areas (groceries, clothes, electronics etc).
- An intimate knowledge of my money. Quite a handy thing when you want to budget etc.
- Proof. Just in-case the taxman or some other arsehole needs it.
Please download it and have a tinker, if I make your life a teeny tiny bit better just give me some love and we’re even :-)
1DayLater is evolving…
For the past year or so we have been working on building a new 1DayLater from the ground and I’m letting myself get excited about it; this blog post is clearly premature, but what the hey, I want to write a little about what we’re doing.
- http://new.1daylater.com/ - our holding page, isn’t it nice?

your 1DayLater is evolving…
Technology Wise
The easiest changes to describe are our technologies, almost every choice made in the original system has been reviewed and (mostly) found wanting. We’ve really matured the software with this new version and myself as a programmer too; I’m growing ever more comfortable with the iterative development process to the point that I consider a bad day as NOT pushing a new release live.
A lot of this has come from building the NexGen software with Lucion Environmental (more on this another time) suffice to say that when you support a diverse and growing company you see the fruits of your labour almost instantly. If the person in the room next door has a bug and they see it fixed instantly there’s gratitude aplenty!
I digress, here’s some of the changes we’ve made on the new 1DayLater… and why
- Version Control: Subversion > Git
once you get over the initial learning curve, git has many advantages - Deployment: FTP > Git Hooks
we can update the site with simply “git push” and all the right files will be in place - Hosting: Rackspace > Amazon Web Services
an excellent developer community and lower price makes this logical - Database: MyISAM > InnoDB
currently 1DayLater is non-relational, we now require a more logical relational structure - Markup: Handcoded > Twitter Bootstrap
frankly, I can’t afford to spend too much time pushing pixels - this makes it much quicker to knock up pages - Templating: Custom > Handlebars
I wrote my own templating engine and it was very patchy, we picked the most popular and active engine for the new system - PDF Printing: wkhtmltopdf > PrinceXML
once we go live we will (gulp) fork out the licence fee for a commercial printing program; after all this will be our new product
- http://new.1daylater.com/ - the holding page should explain it nicely, with pictures and all!
- Our Users can create Quotes to send to their clients
- Quotes are made up of Line-Items with an estimate tally
- Users can then Log their Activity against these Line-Items
- They can then convert their Activity into Invoices to send to their clients
- Tony the plasterer Quotes for a small Job
- It is made up of these Line-Items
- 3 Days on site at £250 / day
- 1 Disposable tarpaulin at £30 (estimated)
- 1 Day of Van hire at £60
- On site he logs his work against these activities, on the second day he notices his client has torn the tarpaulin so he gets another one and so logs two of that
- He can then draw up an Invoice
- Send Invoices and Quotes to his clients
- Get notified when his clients view his Invoices and Quotes
- Find the Quotes with outstanding work (ie money)
- See which Invoices are overdue
- Visualise his profitability
- When is the product valuable?
- When the client sends an Invoice
- we thought that the data, visuals, outstanding work etc were valuable, but that they’re also so intangible that would be difficult to describe and sell
- How much is an Invoice worth?
- ONE POUND
- We decided that it couldn’t impact on the value of the invoice but had to be a nice round number, a QUID seems decent. We’ll review this soon enough
- How can our users pay for it?
- On a subscription (Monthly or Yearly)
- Buy a set number of Invoices (Tokens)
