Twit-twoo
Tig Tag Toe
Top

Tuesday
Aug062013

The Best Angular Toggle Thingy

So Angular JS is hard. But there are some clever peeps out there and when you're up against it with some tough UI work, GitHub and the Angular Toggle Slider is your friend.

So, if you need some funky iOS-style toggle switches on your Angular site, have a peek-a-bo at this: https://github.com/carolineBda/angular-toggle

Enjoy!

Monday
Oct292012

When Tekkit Nuclear Reactors Go Bad

I'm absolutely gutted. Over the course of the last two months or so, of an evening I've been quitely building a nuclear power plant in Tekkit.  Tekkit is a technical expansion to Minecraft - it's simply fantastic.  I spent ages learning how to wire monitoring systems, keep the reactor cold and work in redundancy so the reactor ran without me being there to watch it.

Unfortunately, tonight, I learnt the hard way what happens when reactors go bad.

I developed four reactors in a immensly deep pit.  At the bottom of the pit, I used wireless transmitters to transmit the reactor temperature back to a control room on the surface. It all worked brilliantly and I was most pleased with myself.  I decided to develop a lamp-based monitoring system so that in the control room, each reactor had 3 lamps, red, orange and green.  Green transmitted at 0 heat, orange at 200 heat and red at 1000. To test this, I had to load the reactor. I loaded up reactor one and turned on a single coolant ring. It was pumping vast quantities of ice and all was well - my reactor was chucking out huge quantities of energy and temperatures were peaking at 250 heat.

The reactor and monitoring system had been running for well over an hour and I was busying myself in another corner of the powerplant - when out of the corner of my eye I noticed the red lamp for reactor one was on...

Holy crap! I ran to the Industrial Information Panel, the temperature was at 4000 and jumped to 6000 in the seconds I spent looking at horror at it. I rushed as fast as I could toward the surface and the control room -- noticing that the coolant pipes were all without ice. Serious ut oh!

Then suddenly, Minecraft gave the half-second lag and I knew what had happened. Reactor one blew up. The blast destroyed all three other reactors -- all the tirelessly created wiring and monitoring equipment and great swatches of the protective shroud I'd carefully built.  The destruction was far greater than I imagined it could have been, taking out reinforced walls, windows, doors and complex pipework.  With no-way to go back to before the explosion - my plant is lost - I must start again.

The orange hole shows where reactor one once stood.

Tekkit - what a fantastic upgrade to what is already one of the best games I have ever played.

Saturday
Aug252012

Issymix

Unbeknowst to most, many moons ago I was a DJ.  A few months ago I created a quick mix, which I decided to upload to Soundcloud (which is excellent btw). So for those interested, feel free to take some time to listen:-

Issymix01 on Soundcloud

01 Whitney Houston - How Will I Know (Van Hooft & Forever Kid)
02 Bingo Players - Cry (Just A Little)
03 Freemasons - Love On My Mind
04 Armand van Helden - I Want Your Soul
05 Rihanna - We Found Love
06 David Guetta - Without You
07 Robin S - Show Me Love 2012
08 Dave Armstrong - Make Your Move
09 Eric Prydz - Call On Me
10 Red Carpet - Alright
11 Solu - Fade 2012
12 Fish Go Deep - The Cure & The Cause
13 Goodfellas - Soul Heaven
14 Audiostylists - Leg Before Wicket
15 Audiostylists - Love Boat 2005
16 Change - Glow of Love
17 Lionel Ritchie - All Night Long
18 Audiostylists - Give It Up 2005
19 Florrie - I Took A Little Something
20 Eric Prydz - Pjanoo
21 Avicii - Levels
22 Nalin & Kane - Beachball (Mello Mix) 

Unfortunately, SoundCloud removed some of the tracks from the listing due to copyright (pfft).

Thursday
May032012

Lego 747-400

Following my post about a year ago on my British Airways 747-400, I thought it was about time I got the .lxf file into the wilderness.  By far and away, the original post was my most popular content on my blog and I've had so many requests to release the file.  My intention was to finish the bird, but I'm just not finding as much time as I'd like these days.

Throughout the entire design, I've tried to balance aesthetics with function.  The latter is important because my intention was to build the plane at some point and it'd have to stand-up!  Naturally, it wouldn't stand without the other-half, but still, you get the idea.

The biggest problem I think the build would face would be the weight. Lego is heavy. Really heavy. And the 744 has enormous backside.  All the weight on the three flimsy wheels? What about those big flapping wings? Surely, they'd just rip away from the hull?  This shot of the undercarriage shows my attempt to 'pin' the wings in over the wheels:

The wing has been cantilevered on the wheels, with the two wheels supporting the main wing beam.  Do I think it'd hold with real Lego? No. I think LDD limits the true potential to pinning the wing into the hull.  All that being said though, I always attempted to make the plane structurally sound.  The wings have a 'cross-hatch' system where the weight of the wing (the sag), holds the wing rigid as the load is pushed down the blocks I've built:

 

Other areas I was completely stumped upon were doors, the cockpit and the very back of the plane.  I am releasing my .lxf file, which you'll find below to download, in the hope that someone with a little more enthusiasm can complete the beast!

She's currently running at just over 10,000 bricks and I guesstimated she weighs close to 15 kilos -- see I told you she was heavy!

So, download the file, take a spin around her in Lego Digital Designer and why not return to tell us how you got on? If any Lego enthuisiast wants to build her and has unlimited BrickLink funds to put her together, please let me know - I'd love to know how some of the major problems are solved!

A few shots of her before she heads out:-

The .lxf file is 565kb.

Enjoy!

 

Tuesday
Apr172012

How (not) To Hire A Programmer

Jeff Atwood over at Coding Horror recently posted 'How to Hire a Programmer' where he shared some techniques he's seen work when hiring developers in the past.  Most of the post got a thumbs-up from me, but his section 4, "Do a detailed, structured phone screen" was ludicrious:-

  1. A bit of on-the-fly coding. "Find the largest int value in an int array." or "Write a function to reverse a string." or "Write function to compute Nth fibonacci number." or "Print out the grade-school multiplication table up to 12x12.";
  2. Some basic design. "Design a representation to model HTML." or "Design a deck of cards that can be used for different card game applications. " or "Model the Animal kingdom as a class system, for use in a Virtual Zoo program. ";
  3. Scripting and regular expressions. "Last year my team had to remove all the phone numbers from 50,000 Amazon web page templates, since many of the numbers were no longer in service, and we also wanted to route all customer contacts through a single page.  Let's say you're on my team, and we have to identify the pages having probable U.S. phone numbers in them. To simplify the problem slightly, assume we have 50,000 HTML files in a Unix directory tree, under a directory called "/website". We have 2 days to get a list of file paths to the editorial staff. You need to give me a list of the .html files in this directory tree that appear to contain phone numbers in the following two formats: (xxx) xxx-xxxx and xxx-xxx-xxxx. How would you solve this problem? Keep in mind our team is on a short (2-day) timeline."
  4. Data structures. "When would you use a hashtable versus an array?" or "When would you use a linked list vs. a vector?" or "Can you implement a Map with a tree? What about with a list?" or "How do you print out the nodes of a tree in level-order (i.e. first level, then 2nd level, then 3rd level, etc.)";
  5. Bits and bytes. "Why do programmers think asking if Oct 31 and Dec 25 are the same day is funny?" or "Describe a function that takes an int value, and returns true if the bit pattern of that int value is the same if you reverse it (i.e. it's a palindrome); i.e. boolean isPalindrome(int x) "

The post incensed some of the Coding Horror readers and I must agree with a number of them.  When a bricklayer goes for a job with a bricklaying firm, is he asked to build a wall and describe the sand to cement mixture ratio? Doubtful.  I'm not overly adverse to some of the methods picked out by Jeff, but I am concerned about how employers may read his blog, misunderstand his point (as did many) and introduce these as their tests.  

When a prospective employer asks their candidate on the telephone that they wish to remove 50,000 telephone numbers from some static HTML pages, what's the candidate's preferred method, what are they expecting for an answer? Will regex or grep suffice? Do they want an example? "(\([0-9]{3}\)\s|[^0-9][0-9]{3}-)[0-9]{3}-[0-9]{4}\b"? Or do they want a clever candidate, one that thinks about the requirements?  Even as someone who knows the answer, there doesn't seem to be a correct answer!  Far too much is left to interpretation.

These questions aren't really testing a candidate and their programming ability at all. The test merely confirms if they are good or bad at telephone interviews and technical tests.  A programmer may not know that 2^16 is 65536 (despite it being an important number), but may know that:-

short x = z + y;

...will throw a compilation error because z + y evaluates to an int by default.  The correct way is to cast:-

short x = (short)(z + y);

Out of the two answers, which is the more useful to know?  When, whilst working on commercial projects, have you ever needed to know that 2^16 is 65536 anyway?

One of the comments to Jeff's posts by Jorge summed it up perfectly:-

"...The first couple of interviews I went to I did very badly in the technical test. The interviewer thought that I wouldn't be up to the standard they were after. The 3 or 4th I did much better. The 5th and 6th I blitzed and got some very nice job offers!

OK, I may have felt the pressure a bit after bombing on the first two, so I have been doing some extra study. Did my technical skills really develop so rapidly over the past 2 months, or did my interview skills develop? Did the first interviewers just miss a good opportunity... or were the later interviewers duped?

The fact is, it's easy to get good at interviews after a couple of times. You hear the same questions every time, so you can go away and cover the holes in your knowledge..."

The UK development job-market these days are Monday to Friday 9 to 5 dev slogs, working on mundane applications built on some crappy code-heap-of-a-platform that you'll be expected to deal with.  Often developing for a faceless, bland company with no sense of creativity or adventure. The majority of us don't get to work for Google, Stack Overflow or Facebook.  So, if these mediocre dev houses come knocking on my door and decide to make me jump through all these hoops, I don't want your job.

If I was running an interview, I wouldn't have a paper test or even a practical one. I'd have some basic questions where the answer wasn't important. I'd just want to see how the candidate goes through the process of the solving the problem.  Consider "ask the duck"...:-

Bob pointed into a corner of the office. "Over there," he said, "is a stuffed duck. I want you to ask that duck your question."

I looked at the duck. It was, in fact, stuffed, and very dead. Even if it had not been dead, it probably would not have been a good source of design information. I looked at Bob. Bob was dead serious. He was also my superior, and I wanted to keep my job.

I awkwardly went to stand next to the duck and bent my head, as if in prayer, to commune with this duck. "What," Bob demanded, "are you doing?"

"I'm asking my question of the duck," I said.

One of Bob's superintendants was in his office. He was grinning like a bastard around his toothpick. "Andy," Bob said, "I don't want you to pray to the duck. I want you to ASK THE DUCK YOUR QUESTION."

I licked my lips. "Out loud?" I said.

"Out loud," Bob said firmly.

I cleared my throat. "Duck," I began.

"Its name is Bob Junior," Bob's superintendant supplied. I shot him a dirty look.

"Duck," I continued, "I want to know, when you use a strap hanger, what keeps the sprinkler pipe from jumping out of the strap when the head discharges, causing the pipe to..."

In the middle of asking the duck my question, the answer hit me. The strap hanger is suspended from the structure above by a length of all-thread rod. If the pipe-fitter cuts the all-thread rod such that it butts up against the top of the pipe, it essentially will hold the pipe in the hanger and keep it from bucking. 

I turned to look at Bob. Bob was nodding. "You know, don't you," he said.

"You run the all-thread rod to the top of the pipe," I said.

"That's right," said Bob. "Next time you have a question, I want you to come in here and ask the duck, not me. Ask it out loud. If you still don't know the answer, then you can ask me."

"Okay," I said, and got back to work.

The very process of answering the question reveals the answer.  It is this "aloud thinking" you want to see from a candidate.  This implies an ability to problem solve themselves and at the same time, learn the answer and logic - thereby making better programmers.  

Some time ago I was asked to undertake a technical test for a role and the only convenient time for both parties happened to be on my commute.  I refused to undertake any technical test whilst driving, but would be happy to discuss technical subjects to show proficency. This was thoroughly frowned upon and questioned. I promptly decided the role wasn't for me, another mediocre dev shop who treat programmers like crap - do you need a programmer who can drive and program at the same time?

Technical tests in the interview process will find you candidates that are good at technical tests and interviews, not necessarily good programmers.