NDC – Clean Coders Hate What Happens to Your Code When You Use These Enterprise Programming Tricks

I have recently been listening to a few of the NDC talks from around the world and the one today that has caught my interest is this one, Clean Coders Hate What Happens to Your Code When You Use These Enterprise Programming Tricks by Kevlin Henney.

I particularly liked the inclusion of FizzBuzz Enterprise Edition. For those that don’t know FizzBuzz is a simple programming challenge, that used to be and still is in some organisations an interview question.

The problem is

For numbers 1 through 100,

if the number is divisible by 3 print Fizz;
if the number is divisible by 5 print Buzz;
if the number is divisible by 3 and 5 (15) print FizzBuzz;
else, print the number.

It is not a difficult problem, and it can be solved in a few simple lines of code.


def fizzbuzz(n):
if n % 15 == 0:
return 'FizzBuzz'
elif n % 3 == 0:
return 'Fizz'
elif n % 5 == 0:
return 'Buzz'
else:
return str(n)

there are even more concise versions of this code but this is simple to read and understand.

What FizzBuzz Enterprise Edition does is humorously take certain enterprise software design principles to their extreme.

That Awesome Time I Was Sued For Two Billion Dollars – Defcon

Well not me but, this is an amazing story from Jason Scott who runs Textfiles.com about a time he was sued (genuinely) for what at the end of the trial was Two Billion Dollars, let that settle in for a minute, no that is not a typo…. A hilarious and scary story, showing the hilarious lengths that people will go to, and the folly of greed.

Q&A video answers from the F-Secure Lab experts about Online Banking Security

This is really just a re-post of the videos in the F-Secure Forum, but if you have not watched them yet or really have any questions on Online Banking Security then you really should watch these. All of these videos are on F-Secure’s Youtube channel, though to be honest most of the stuff does seem to just be advertising and how to use their software, these videos however are genuinely interesting.

  • Video 1. How do I remember strong passwords

  • Video 2. Are ATM’s Secure?

  • Video 3. Online banking and shopping. Mikko and Sean tell what precautions they take.

  • Video 4. What happens if you get robbed by an online criminal?

  • Video 5. Mikko and Sean’s opinion on various online banks

  • Video 6. Credit card data in recipts

  • Video 7. How Common is online criminality?

  • Video 8. Is is safe to use a smartphone for online banking?

  • Video 9. I get a warning whenever I log onto my online bank…

  • Video 10. A question about the ATM skimmers and iTunes fraud…

New image slider for the site

I was wanting to display a slideshow if images in my blog posts for battle reports but kept hitting on the problem with most of them that you couldn’t have more than one on the page at the same time so I thought, “How difficult could it be?”. not too bad as it turned out.

I hit one snag when I was checking for the “currentslide” but setting the slide to “.currentslide” so it would only loop to one image and then another issue that seemed to cause the whole thing to just thunder through the images very quickly. In the end with some help from the wonderful people on stackoverflow.com, I got the problem solved.

The code is very simple and not a jquery plugin as some have suggested I write, but for a first version it works.

Dynamically Call A Method, Using a String with Method Name

I was trying to set up a dynamic setup of algorithms in server side code which return true if they succeed, but I wanted users to be able to choose from a database generated list as to which algorithm they wished to run, unfortunately I wanted to be able to update the list dynamically without having to rebuild all the code, only the algorithm static class that contains the algorithm and the database that contains the names of all the classes but not modify the presentation layer.

After having a quick look around I found this code on an old faithful website codeproject.com with the perfect article which contained a simple solution to my problem.

Dynamically Invoke A Method, Given Strings with Method Name and Class Name by Matt Perdeck.

The solution I had only required some minor modification to make it work for me,

and to call it

Ever noticed how certain CSS style colours sound like porn star names….

Was reading this tweet and I was amused enough to share it.

If you have ever been designing or coding html pages you will most likely have come across CSS and the color attribute. Now many of us will have been using the hex code for the value, feeling slightly dirty about using the named colour values, like black, red, and white. but now there is even more reason to feel dirty with names like these that sound like the sort of thing which would be associated with providers of specialist gentlemen’s literature.

Alice Blue
Rosy Brown
Burly Wood
Deep Pink
Golden Rod
Pale Golden Rod
Honey Dew
Hot Pink
Misty Rose
Peach Puff
Sandy Brown
Papaya Whip

What the hell?! The annoying dots that have appeared in Visual Studio

I know this will have happened to someone else before me, but when I code I don’t look at the keyboard, fairly standard. Yesterday however I went to hit [ctrl] + S and instead hit something else entirely, and this happened.

view spaces screenshot Following this, I now had dots everywhere, it didn’t take me very long to notice that they seemed to represent the spaces and tabs I had used to indent my code, but for the foggiest I did not know what I did to trigger it or how to fix it.

Enter trolling through the Visual studio toolbars before eventually coming across the setting and disabling it. Edit > Advanced >View White Space (ctrl E, S). Ahh that would explain it.

Another day, another jQuery problem solved

I had a problem, in the page I was working on, I have several sections, only one gets displayed at a time and they all have the same field at the top of each section called “Label”, when the user moved through the sections, if they have provided a Label it should automatically be populated in the new section. jQuery to the rescue with .filter(). Which allowed me to find only the label elements where the value was not empty and then easily copy it to a new section.

Not rocket science but useful.

A Tragic Story of Mat Honan’s Digital Life being destroyed….

Seriously read this article, and I mean the whole article “How Apple and Amazon Security Flaws Led to My Epic Hacking” and shudder as to how easily it could happen to you.

For those that do not know Mat Honan (@mat) he is a senior writer for the Wired.com magazine, and he recently had his digital life turned upside down, when someone, quite interestingly through linked Google, Amazon and iCloud accounts, destroyed his digital life.

First my Google account was taken over, then deleted. Next my Twitter account was compromised, and used as a platform to broadcast racist and homophobic messages. And worst of all, my AppleID account was broken into, and my hackers used it to remotely erase all of the data on my iPhone, iPad, and MacBook.

One of the people involved in the hack “Phobia” contacted him later to discuss the hack, what made this story more horrifying is when he explains how easy it was to do.

So how did he get this vital information? He began with the easy one. He got the billing address by doing a whois search on my personal web domain. If someone doesn’t have a domain, you can also look up his or her information on Spokeo, WhitePages, and PeopleSmart.

Getting a credit card number is tricker, but it also relies on taking advantage of a company’s back-end systems. Phobia says that a partner performed this part of the hack, but described the technique to us, which we were able to verify via our own tech support phone calls. It’s remarkably easy — so easy that Wired was able to duplicate the exploit twice in minutes.

First you call Amazon and tell them you are the account holder, and want to add a credit card number to the account. All you need is the name on the account, an associated e-mail address, and the billing address. Amazon then allows you to input a new credit card. (Wired used a bogus credit card number from a website that generates fake card numbers that conform with the industry’s published self-check algorithm.) Then you hang up.

Next you call back, and tell Amazon that you’ve lost access to your account. Upon providing a name, billing address, and the new credit card number you gave the company on the prior call, Amazon will allow you to add a new e-mail address to the account. From here, you go to the Amazon website, and send a password reset to the new e-mail account. This allows you to see all the credit cards on file for the account — not the complete numbers, just the last four digits. But, as we know, Apple only needs those last four digits.

And as he later correctly points out

If you have an AppleID, every time you call Pizza Hut, you’ve giving the 16-year-old on the other end of the line all he needs to take over your entire digital life.

The most tragic part is that he is kicking himself that he did not back up his data resulting in him permanently loosing the pictures of his daughter, maybe he, and everone else should have watched the master of commedy, John Cleese’s video Institute for Backup Trauma.

A silver lining to this story was the realization of my own vulnerability, and that I and I hope you too needed to take steps to rectify the problem.