subscribe secretGeek RSS secretGeek .:dot Nuts about dot Net:.  

Q: Where am I?

A: You're sitting at a computer, reading Leon Bambrick's personal thoughts on programming.

Sat, 12 May 2012 02:59:08 GMT

Just Wally

The apocalypse came suddenly. Some kind of worm, virus, trojan -- some kind of Mark Russinovich doomsday scenario. It spread so fast no one had a chance to react. It lit up every computer screen, obliterating every computer user in the world. Every last worker was obliterated, right at their desk. All that remained was a tiny pile of ashes on every seat.

Only Wally was spared. While everyone else was at the desks working, Wally was wandering the halls, holding a coffee cup.

'Just Wally' is a cartoon that removes all the unneccessary elements from Dilbert, and leaves just the hero himself, Wally, wandering the empty building, holding meetings with himself, filling his loneliness with imagined interactions.

Wally has always been the truest character in Dilbert. I've met a few Dilberts in my time. I've met a few Pointed Haired Bosses. But just about everyone is at least part-Wally. And more than a few have been pure-Wally. You know who you are.

Some people theorise that the true story of 'Just Wally' is that Wally is the one who died. This is his limbo, wandering alone, unable to interact with the living.

Others say Wally has fallen into a coma. This is his extended delusion. He cannot tell dream from reality, sarcasm from seriousness. What exactly is a dream? What exactly is a joke?

The words of JD Salinger are relevant here, as always.

"It isn't just Wally. It could be a girl, for goodness' sake. I mean if he were a girl - somebody in my dorm, for example, - he'd have been painting scenery in some stock company all summer. Or bicycled through wales. Or taken an apartment in New York and worked for a magazine or an advertising company. It's everybody, I mean. Everything everybody does is so - I don't know, not wrong, or even mean, or even stupid, necessarily. But just so tiny and meaningless and - sad-making.

And the worst part is, if you go bohemian or something crazy like that, you're conforming just as much as everybody else, only in a different way."

Tiny and meaningless and sad-making.

Tiny and meaningless and sad-making. 'Just Wally' makes us stop and ponder the futility of everything we do, everything we think and everything we are.

In the style of Garfield minus Garfield, Just Wally plays upon the maxim of my old buddy Antoine de Saint-Exupery:

"Perfection is achieved not when there is nothing more to add, but when there is nothing left to take away"

Read On...


Tue, 08 May 2012 04:22:21 GMT

The Correct Order for a First Time Viewing of The Lord Of The Rings

After reading Scott Hanselman's post about introducing your younglings to Star Wars, I was intrigued by the suggested 'Machete order' (courtey of Rod Hilton)

  • 4 - Star Wars: A New Hope
  • 5 - Empire Strikes Back
  • 2 - Attack of The Clones
  • 3 - Revenge of the Sith
  • 6 - Return of the Jedi

Which lead to deep conversations with myself about which order I should use when introducing my daughers to 'The Lord of the Rings'.

The three films can be arranged into 6 possible non-repeating combinations:

  • Fellowship, Towers, King
  • Fellowship, King, Towers
  • Towers, Fellowship, King
  • Towers, King, Fellowship
  • King, Fellowship, Towers
  • King, Towers, Fellowship

All of which have their own pluses and minuses, but none of which would qualify as a true 'machete' reordering.

I finally settled on the following order, which you'll agree is the best possible version of events:

  • 1. The Two Towers -- A good story always starts in the midst of the action, and leaps past the boring parts.
  • 2. The Hobbit, An Unexpected Journey -- having established the story we now move learn the origin of the Ring and Gollum.
  • 3. How to Train your Dragon -- the loveable Toothless and Hiccup show us that not all dragons are nasty Smaugs.
  • 3a. Read all of the books -- that way you can complain bitterly about the missing 'Scourge of the Shire' segment during:
  • 4. Return of the King, Disc 2 -- 5 minutes of chucking a ring in a pit, a quick eagle ride, and two hours saying goodbye.
  • 5. Return of the King, Disc 1 -- Awesome battle scene. Best war ever.

I dub this the Chop-Suey Reordering, and in line with Oracle's copyright on the arrangement of the Java Api's, I claim ownership of this and all derivative reorderings of the LOTR franchise.

Read On...


Fri, 23 Mar 2012 12:37:13 GMT

A new era for Android.

Occasionally, marketers send me press releases in the hope I'll blog about them. Ordinarily I refuse to be manipulated by such a ploy, but I thought this one about android was worth a little discussion. I've always thought that android phones look interesting but only from the point of view of a tinkerer. This new direction seems to offer something more.

Here's a few relevant excerpts:

food phone

Android, the world's leading free, open source platform for everything beyond smart phones, and the world's most popular phone amongst Android software developers and Google employees, is proud to announce the discovery of their first Consumer.

The Android developer community first suspected the existence of the Consumer after finding non-Google IP addresses in the log file of an Android Developer Forum. The discovery was quickly escalated to Google management who sent a rapid response Privacy Intrusion Team to perform expanded analysis of his web searches, browser, email and telephone usage. They were thrilled to discover that the lurker was a genuine Android customer who was neither an Android software developer or a Google employee.

The potential existence of such a Consumer had been hotly debated on Android developer forums for years. But even the most optimistic Android enthusiasts had assumed that the debate was purely theoretical.

Google had previously spent millions of dollars placing 'Angry Birds' in their 'Google Play' app store, in the hope that it could potentially attract a Consumer to consider using the Android platform for Consumer Purposes. Google's Privacy Intrusion Team have revealed that analysis of the Consumer's correspondence offer no clear rationale for why he purchased an Android phone from a market place crowded with more suitable offerings. Skeptics have taken this as an indication that the Consumer's existence could be the result of Google Finland's controversial 'tag and release' program where members of the public were anaesthetised, given an Android phone, and released back into the population.

This new phase of the Android platform is an exciting time. Predicting an influx of Consumers, developers have quickly raced to make the phone more technically intimidating and to provide an even more fractured range of devices. Google employees remain unaware of anything that has happened to non-Google employees.

The Consumer is now considering getting into Android development, and has recently taken a job at Google.

Crazy times. Next they'll be announcing the discovery of a teenager who wants a Zune.

Read On...


Sat, 07 Jan 2012 10:57:31 GMT

Mind-boggling Demo of New Gaming Genre, aka Folder-Based Hangman, aka Fun with Recursion

I had a crazy idea recently for a new game - a game that defines an entire new *genre* of computer game, and a new style of programming computer games. Whether or not this idea will go on to change the way all computer games are written, I will let history decide.

It's such a simple idea that I don't know how it couldn't have possibly existed earlier. It doesn't require massive graphic capabilities, no CUDA NUMA GPGPGPU and the like -- it's an idea so profoundly simple that you'll be scraping your jaw off the floor with a spoon before you finish reading this blog post.

You run the 'game' and it sets up a directory structure to represent every possible state of the game. To play the game, you inspect the current folder, look at the currently available sub folders, and choose which one to navigate into. Each sub folder you see represents the next possible state of the game.

There is no executable program running when you are playing. The game is just your act of navigating the folder structure. It's a clever form of madness!

Here's some screenshots that show me playing the game, in a command prompt.

I've changed my prompt to just a 'greater than' sign, by typing 'prompt $g', to make it cleaner. Old-school DOS wizards do this kind of thing all the time. Hipster kids, try and keep up.

First I type 'dir /b' to get a clean view of the current folder.

There is only one folder, '__PLAY HANGMAN__' so I navigate into it by typing  'cd[TAB][Enter]'. The game has begun.


Looking in that folder I see the empty scaffold, three underscores (representing a 3 letter word) and the available letters listed down the left hand side. We're playing with a reduced alphabet to keep the number of permutations within a reasonable amount.


My first guess is the letter 'A'. To make this guess I type 'cd A[tab]'. When I type 'dir /b' to inspect the new state of the game I see that it was a good guess, as one of the letters of the word has been filled in. Also there is an 'x' next to the 'A' indicating that that letter has been guessed. That's all there is to it. Hear that pop? That was your cerebellum exploding through your temporal lobe.


If I try guessing 'A' again, all I find is a folder containing a file named 'You have already guessed that letter.' To undo my mistake I back out by typing 'cd ..' (You could, theoretically use this technique to undo any move, but that would be unsportsmanlike.)


A couple of moves later and I've guessed every letter:


The word is 'CAB'. There's no particular fanfare. Just the word 'WIN' declaring my victory.

Okay, now you've seen the whole thing I hope you're aching to not just download the game, but to write your own entry into this brave new genre. You could do for Gehtto-Folder-Games what John Carmack did for first person shooters!

I'd love to see an implementation of tic-tac-toe, aka, naughts and crosses. Also, hangman could be minified by using junctions (i.e. symbolic links) -- I'd love to see that implemented. The possibilities for new games are pretty much endless. Maybe six or seven.

Okay let me level with you. The mathematics of this idea were just ridiculous. For a full 26 character alphabet, I would've killed my little computer. (Care to accurately calculate how many folders are created for the given alphabet?) It's all based around N-factorial where N is the size of the alphabet. Factorial is not something you want to see in the real world.

I'm on holiday at the moment, so the only computer available to write it on was my dell mini, which doesn't have any serious coding environment. So rather than write it as a console app in visual studio (or even a powershell app) I wrote a javascript page that generates a batch file. It's very niche.

This also turned into an opportunity to learn the ins and outs of getting recursion wrong with javascript. The most common mistake you make with recursion in javascript, it turns out, is forgetting to declare a local variable. This means that the variable becomes global and your recursion goes nuts. Don't make that mistake. When your code is creating subfolders all over your hard drive it's a particularly painful mistake. It took me considerably less time to write the program than it did to debug it, and (considerably*considerably) less time to debug than the time to clean up all the folders left in unexpected places.

But the funnest bit was the ascii sprite code.

I had one array that showed the final hanged man:

var hangyPicture = [
'   _______   ',
'   I     I   ',
'   I     O   ',
'   I   --I-- ',
'   I    I I  ',
'   I         ',
'--===--      '];

(Side point... why wasn't my ascii art better than this? Because | and \ are not valid in folder names.)

And I had another array that showed how many misses were required before a given character of the hangyPicture was shown:

var hangyMask = [
'             ',
'             ',
'         1   ',
'       33233 ',
'        4 4  ',
'             ',
'             '];

Then, with those two arrays in place, I can work out the names of the folders to create. I walk through the mask, one character at a time, and compare the digit I find to the current number of missed guesses. If the digit I find is less than (or equal to) the current number of missed guesses, then I include that character in the folder name, otherwise I mask it out with a space. Ah, I give in -- it's easier to just show the code:

for (var h in hangyPicture) {
  // use hangyMask[h] and numberOfMisses to mask chars out of hangyPictures[h] 
  for(var i = 0; i < hangyMask[h].length; i++) {
    if (hangyMask[h][i] == ' ' || hangyMask[h][i] <= numberOfMisses) {
      folders[h] += hangyPicture[h][i];
    } else {
      folders[h] += ' ';
    }
  }
}

Okay. Now you've been enlightened with the future of ultra-ghetto folder-based gaming, go ahead and make your own. I can wait.


Here's the code


The accompanying program is a piece of javascript that creates a windows batch file. You run the batch file.

Read On...


Sun, 27 Nov 2011 03:07:28 GMT

Got CSV in your javascript? Use agnes.

The only things that will survive the forthcoming nuclear+zombie apocalypse are cockroaches, javascript and CSV.

So I've written an open source javascript library, agnes.js, that the cockroaches can use for dealing with CSV from javascript. And in the brief pre-apocalypse era you can use it too.


Download the zip


I've written before about how CSV starts off looking easy, but quickly descends into a world of insanity. So in javascript land, let agnes handle all the nasty quirks and edge cases (embedded delimiters, qualifiers, nulls and so on).

I wrote a bunch of unit tests to go with it, so you can tell exactly what it does with each weird bit of input you can throw at it.

You can download it from agnes.codeplex.com

This was a particularly fun little bus project, and what I like best about agnes is the content you get when you download her.

The readme file has executable examples, that work by having a chunk of code displayed in a div, which is the exact code that is grabbed and executed when you click 'Try it'.


Browse source code


I like the unit tests that come with it, and the little unit test runner. I could've gone really overboard with it, but I stopped myself before it went too far.

And I like the sample that performs Csv to Json conversion, back and forth, back and forth. My favourite part of that is using html entities in the button titles, for left and right arrows.


Try it out


Now that I've got agnes out of the way, hopefully I can focus on my new bilion dollar idea, youmustget.com

Read On...


Sat, 12 Nov 2011 00:39:08 GMT

I went to write down a book name and founded an internet empire instead.

tron motorcycle just 55K AT AT dog costume you must have

Yesterday Joel told me, 'hey you really should read "The Big Short" by Michael Lewis' -- and I thought, yes, I'll write that in my list of books I must get and when I have a chance I'll order it and all the other books in my list of books i must get.

Looking through my iphone I was shocked to find I don't even *have* a list of books I must get. I've got a list of which Woody Allen movies I haven't seen, and I have a list of which Jeeves and Wooster books I own (or own twice) so I don't accidentally buy them again (or again again), but no "Books I must get".

And I realised it's not just books that I keep forgetting. It's everything in our stupid materialist world. It's gadgets, music, movies, games, t-shirts, toys, gifts for my wife, baby stuff, apps, power tools -- a whole big fat materialist world full of stuff I must get, that, realistically i'll never get, but which my inner taxonomist wouldn't mind having a list of somewhere.

Suddenly, before I could stop them, my hands had rushed off and spent 9.95 to buy all of the following websites...

  • http://things.youmustget.com
  • http://books.youmustget.com
  • http://movies.youmustget.com
  • http://games.youmustget.com
  • http://gadgets.youmustget.com
  • http://apps.youmustget.com
  • http://stocks.youmustget.com
  • http://software.youmustget.com
  • http://dvds.youmustget.com
  • http://jokes.youmustget.com
  • http://vaccinations.youmustget.com
  • http://tattoos.youmustget.com
  • http://cars.youmustget.com
  • http://piercings.youmustget.com
  • http://hookers.youmustget.com
  • http://starewarsstuff.youmustget.com
  • http://drugs.youmustget.com
  • http://websites.youmustget.com
  • http://cakes.youmustget.com
  • http://clothes.youmustget.com
  • http://bikes.youmustget.com
  • http://girlfriends.youmustget.com
  • http://babystuff.youmustget.com
  • http://diseases.youmustget.com
  • http://travel.youmustget.com
  • http://tshirts.youmustget.com
  • http://shirts.youmustget.com
  • http://wines.youmustget.com
  • http://beers.youmustget.com

...and so on, because i bought 'youmustget.com'.

And now I have a slight dilemma. I already own too many urls that I'm not using (this brings my total internet empire to 11.5 sites) And I don't have time to execute on even the simplest ideas in my idea log.

So: how can I crank out a social recommendation/shopping app in under 5 bus trips!?

I want something that produces an output a little bit like this is why i'm broke dot com but where the recommendations come from people i respect, and with affiliate dollars flowing into my wallet on every recommended purchase. (And i'd like to come up with a less-sleazy way to monetize, if possible, but I do have to recoup that $9.95 somehow)

I've begun by creating a Trello board to capture all my ideas. I've got details for the home page, a products page, a user page, and a topic page. I've got a backlog of features that I won't implement at first, and I've got a list of ideas for what technology I'll use where. Next I'll put together some screen mockups and put them in front of my extended team of insult generators lunch buddies.

In the mean time I'll need to keep a cricket bat handy with which to repel the hordes of nodding VCs.

Thoughts?

Read On...


Hey good looking!

click here to visit the secretGeek archives!

Go on... continue through to the archives


^Top

newest

Just Wally Just Wally
The Correct Order for a First Time Viewing of The Lord Of The Rings The Correct Order for a First Time Viewing of The Lord Of The Rings
A new era for Android. A new era for Android.
Mind-boggling Demo of New Gaming Genre, aka Folder-Based Hangman, aka Fun with Recursion Mind-boggling Demo of New Gaming Genre, aka Folder-Based Hangman, aka Fun with Recursion
Got CSV in your javascript? Use agnes. Got CSV in your javascript? Use agnes.

Archives Complete secretGeek Archives

TimeSnapper -- Automated Screenshot Journal TimeSnapper: automatic screenshot journal
NimbleText -- World's Simplest Code Generator NimbleText: Code Generator, Text Manipulator, Data Extractor

25 steps for building a Micro-ISV 25 steps for building a Micro-ISV
3 minute guides -- babysteps in new technologies: powershell, JSON, watir, F# 3 Minute Guide Series
Universal Troubleshooting checklist Universal Troubleshooting Checklist
Top 10 SecretGeek articles Top 10 SecretGeek articles
ShinyPower (help with Powershell) ShinyPower
Now at CodePlex

Realtime CSS Editor, in a browser RealTime Online CSS Editor
Gradient Maker -- a tool for making background images that blend from one colour to another. Forget photoshop, this is the bomb. Gradient Maker


[powered by Google] 


How to be depressed How to be depressed
You are not inadequate.



Recommended Reading


the little schemer


The Best Software Writing I
The Business Of Software (Eric Sink)

Recommended blogs

Jeff Atwood
Joseph Cooney
Phil Haack
Scott Hanselman
Julia Lerman
Rhys Parry
Joel Pobar
Thomas White
OJ Reeves
Eric Sink

Aggregated Links

proggit
dzone
hacker news
dot net kicks

Human Link Machines

interesting finds
a continuous learner's weblog
arjan's world
weekly link post

LinkedIn profile
LogEnvy - event logs made sexy
Computer, Unlocked. A rapid computer customization resource
PhysioTec, Brisbane Specialist Physiotherapy & Pilates
home .: about .: sign up .: sitemap .: secretGeek RSS .: © Leon Bambrick 2006 .: privacy

home .: about .: sign up .: sitemap .: RSS .: © Leon Bambrick 2006 .: privacy