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, 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...


Thu, 29 Sep 2011 13:26:28 GMT

NimbleText: Origins

I started shipping NimbleText at the end of January 2011. That's eight months after NimbleText was *almost* ready for release back in May 2010, when I published this roadmap: 24 things to do, and 100 things *not* to do (yet) for building a MicroISV. Back in May, instead of powering on with the last few tasks, I invested my spare time writing Dos-based web frameworks and 5 different json editors. I guess having a new little baby girl counts as something of a distraction too. ;-) (Very happily).

When I finally starting shipping, Joe Cooney said:

I tip my hat to you - I think in the time I've re-written a few bits of UI you shipped a product.

...in reference to his awesome LogEnvy tool. But it's not a fair comparison, for two reasons.

Firstly, LogEnvy is a much more sophisticated product than NimbleText. LogEnvy does all kinds of powerful manipulation of events logs in a wide range of formats and intersperses it with all the kind of dazzling UI you expect from a WPF ninja. But most of all his statement is incorrect because NimbleText was almost six years in the making.

I wrote the first version in February 2005 and published it as part of a blog post soon after. I wrote it the very same day I came up with the idea for TimeSnapper. It was a stressful week when I desperately needed both of those tools.

Although I was already a .net programmer, I wrote the original code in server-side VBScript for easier deployment. It was just a dozen or so lines. I called it variously 'the data pattern merge tool', 'the merger,' 'the programmer's mate' or the 'text multiplier.' Starting from that day, and continuing right up until the present, I have depended on this tool absolutely daily.

I released a second version in July 2005, and called it 'the world's second simplest code generator'.

The source code is largely a comment block listing all the extra features I wished it had. (And almost all of which, by the way, are implemented in more recent verisons)

A complete rewrite occurred in May 2006 when I started huffing the XSLT pixie dust and thought XSL could solve everything. Its dynamic nature gave it big advantages over the vbscript implementation.

But it soon turned into an exercise in writing a fully fledged compiler and I knew I was headed in the wrong direction.

I wrote an "offline version" around that time, in Windows Forms (VB.net version 1.1) I was never happy with it and didn't release it. If I have the code for it, I don't know where. My clearest memory of it was the way parts of the UI would animate (using a Timer control, of course :-) ).

I re-wrote the tool in August 2007, this time in javascript. Why did I rewrite it in Javasript? Because I was momentarily trapped on a machine that had no development tools, but I still felt like cutting some code. I assumed that browser performance would kill the tool, but I was dead wrong. Javascript was the perfect language for the problem, and the performance of Javascript was just beginning to take off as the browser wars re-ignited.

It was a clear victory for Atwood's Law:

"any application that can be written in JavaScript, will eventually be written in JavaScript."

Or a pre-cursor to Bambrick's Premonition:

"I don't know when skynet will take over. But I know what it will be written in: JavaScript."

I wrote a (playful) WPF version in Oct 2007 (in C#).

I wasn't happy with the tooling for WPF (maybe someone should fix that?), but more-so the dynamic behaviour of javascript trumped C# for this tool, so the WPF version never went anywhere.

Around that time I wrote other undocumented, unreleased versions in powershell and one in ruby (shoes). Powershell was well suited as a language, but lacked the reach of javascript, plus the performance (at that time) was dreadful. The shoes version dissappeared around the same time as _why. (Coincidence? I think not.)

Late last year I decided to release it as a windows app, using a polished and thoroughly bus-tested version of the javascript implementation, wrapped in a browser control inside a skinny winforms shim. Early this year I went live with it, under the new official title of NimbleText. I've hunted down bugs and added features in the months since.

The latest release looks a little more metro than any previous version, as I stripped away a lot of the padding and extraneous lines, simplifying the appearance (and improving a few features as well, of course).

It's kind of amusing that after I chose to shun all of Microsoft's native application development toolkits (wpf, silverlight, and winforms) going with HTML for the UI, it seems like Microsoft have now decided to meet me half way, making HTML a first class citizen in Metro.

Anytime I'm faced with a new platform, I usually implement a version of nimbleText as my own personal hello world, and it looks like Metro will make it easy for me. Porting the heart of this baby to Metro should be a breeze. I'll still have to put in some design effort around how the supporting features are presented (what will happen to the menus, toolbars etc?). But I expect it will be a good ice-breaker.

Meanwhile -- if you ever write code or munge data, save yourself some time and use NimbleText. Both the download and the online version are FREE. There's no time-limit on the application and you only choose to pay if you want the extended features (customizability and commandline integration).

If you have features you want, please leave a comment here or send an email to supportexclude this bit@exclude this bitNimbleText.com

Read On...


Sat, 17 Sep 2011 02:42:52 GMT

The Windows 8 Mullet

Windows 8 is a mullet: Classic Windows Business at the front, Metro Party at the back

I think i get it now. In Windows 8 you have two modes: metro and classic.

Metro is for exciting responsive new apps that you can use while sitting on a designer couch.

Classic is the Windows of spreadsheets and complex applications that we've used in our day jobs for years.

It's basically a mullet. Business in the front, party in the back.

I'm looking forward to joining the Metro party. I don't know if the business guy is going to host a very good party. But his client list is so long that a lot of great people are bound to be there.

Maybe I'm a little worried it will be like the party that Rick Moranis's character, Louis, is hosting in ghostbusters:

I'm givin' this whole thing as a promotional expense, that's why I invited clients instead of friends.

Louis: I'm givin' this whole thing as a promotional expense, that's why I invited clients instead of friends. You havin' a good time, Mark?
[heads across the room, greeting other guests]

It's all going well until a terror dog turns up and terrifies the guests. But I digress.

At first I thought that this metro-fad would only have as much take-up as designing sidebar gadgets in Vista (i.e. approximately none). But the killer features to attract devs is the app store. Having your apps readily available to (potentially) hundreds of millions of people, is a very tempting proposition and bound to attract a lot of developers, possibly including me.

So, does anybody wanna play Parcheesi?

Read On...


Wed, 24 Aug 2011 05:18:00 GMT

Introducing Cosby, spontaneous striped background generator

cosby playground

'Cosby' is a small site for generating striped backgrounds (or gradient edges). You can incorporate the code from Cosby into your own asp.net/mvc applications and create striped backgrounds directly from within your Css file.

Once you've got Cosby in place, you can start to magically conjur stripy images out of thin air. Just reference a Cosby image as if it already exists, and it will cause the relevant image to be generated spontaneously and stored on disk for eternity.

For example, if you write: "background-image: url(/Image/Stripes/V/20/FFF/1/000);" then you will get a background with vertical ('V') stripes, alternating between 20 pixels of white (FFF) and 1 pixel of black (000). A moment later you decide you want the black stripes a little wider. Just alter the css (change the 1 to a 2) and they will be. No need to jump back and forth between image editor, filesystem, IDE and browser.

Cosby includes a playground where you can experiment with creating your own backgrounds.


Play with cosby


Get the code


Visit the site

But Why!?

While I was procrastinating about working on my talk for WDCNZ I wanted to mess around with MVC's 'FileResult' which lets you return a file from an action. So I resurrected and mutated the idea behind a Gradient Maker I wrote SIX years ago, using asp.net 1.0, and ended up with this latest monstrosity. (Cosby also lets you generate gradients, though I haven't done much with that feature)

The code is published at cosby.secretGeek.net, so feel free to grab it, criticise it, and forget about it.

And of course the name is a reference to Bill Cosby's infamous Cosby sweaters, which get their own detailed write up on wikipedia. I was recently heartened to see 'Cosby sweater' amongst the text generated by the hipster ipsum random text generator.

That's all for now.

Read On...


Sun, 31 Jul 2011 03:17:57 GMT

Slides from WDCNZ: Live Coding Asp.net MVC3

talkin in wellington

I am just returned from an excellent holiday in New Zealand, wherein I talked about MVC 3 at the first ever WDCNZ in Wellington.

On the day of the talk I was deathly ill, so it was a very much less animated talk than I wanted to give, but still enjoyable (for me, if not the audience). I missed out on seeing the rest of the conference, which is a real bugger.

In particular I wanted to see Paul Irish on Html5, but I did at least get to meet him for a quick chat the day before. Other speakers I met the day before were pretty interesting to talk to and I very much wanted to see the talks by Kirk Jackson and Jeffrey Wegesin, among others.

Here's my slides, using an updated version of Higgins. You'll need to unzip them, then you can see the readme file, the slides themselves (by viewing higgins.html) or look at the included code.

 

Slides + Code for 'Live Coding Asp.net MVC 3'

 

The talk covers Razor syntax, Display and Editor Templates, custom Code Templates and custom Project templates. Thankfully, there is no video.

Joseph Cooney built a special utility to help with the talk, called 'BigNote' -- available from bignote.codeplex.com.

This is a handy tool for presenters. Invoke it with a hotkey (ctrl-F1) and then it lets you write in giant letters on top of the desktop. Very slick.

I had a slight panic during the talk when I realised that Joe Cooney, creator of ComputerUnlocked.com could have used the opportunity to slip any kind of nasty prank into the tool, just to punk me in front of a room full of strangers. But luckily he slipped up and missed the opportunity.

One other thing I ought to mention: the Dell laptop I bought in anticipation of the presentation turned out to be a total dud. I was only rescued the day before leaving Australia when Paul Stovell managed to hook me up with an old laptop of his, which performed flawlessly. Thanks Paul!

Read On...


Sat, 02 Jul 2011 02:41:41 GMT

MVC 3, "Third Times a Charm" references

For the last few months I've been on an MVC 3 binge, learning as much as I can fit in my tiny brain. (Had to throw a few other things out first of course.)

Web Dev Conf New Zealand (WDCNZ), is in Wellington very soon (schedule on lanyrd), and I'll be talking there about all things MVC 3. This is keeping me awake nights, I can tell you.

I've applied to talk at the stack overflow dev days conference in Sydney in October. That would be an absolute blast. I rank my chances pretty low, but my excitement is high regardless.

Recently I talked at QMSDNUG, on 'MVC 3: Third Times a Charm', alongside Joe Cooney. It was a lot of fun, and we allegedly broke a record with our crowd size. It's basically a preview of what I'll cover in Wellington, though some material will be in or out as I revise.

(Higgins got another workout, and had some html5 goodness baked in)

I promised to put up the references from my talk. They're mostly about customizating your MVC 3 experience in Visual Studio. Here they are.

url topic
bit.ly/d71zIJ razor: ebook [pdf]
bit.ly/3Vwjvj editor & display templates (Brad Wilson)
bit.ly/dIUPo4 MVC Mini profiler (Sam Saffron)
bit.ly/h8vQfX Code templates (Scott Hanselman)
bit.ly/hwNUNS MVC Scaffolding (Steve Sanderson)
bit.ly/khm2GL Project Templates (Phil Haack)
bit.ly/hfWA6Z Roundup of tutorials (Jon Galloway)

If you use MVC 3, what are your favourite bits? What would you cover in a talk? If you don't use it, why not? And what are the sort of things you'd like to see deomonstrated?

Read On...


Sat, 11 Jun 2011 01:10:49 GMT

Custom Errors in ASP.Net MVC: It couldn't be simpler, right?

parallaxing 404 at github

Cool looking 404 pages are the new hotness. Github has an amazing parallaxing 404 page that allegedly cost more than any other feature on their site.

For a lot of sites, the 404 page is the most visited page, so it's worth getting it right.

The website for my new product, NimbleText, uses asp.net mvc. A framework I really enjoy. The gu wrote it on a plane. Before takeoff.

One of the more voodoo aspects of getting NimbleText.com into production was setting up a succesful custom 404 page. Here's what I came up with: check it out.

Some of the articles out there that cover custom errors in asp.net MVC seemed to be a little bit confused about exactly what is going on, many are out of date or incomplete and some are downright misleading.

So once and for all I want to give a definitive guide to error handling in asp.net MVC.

Here we are. Just eleven simple steps to follow for amazing results.

First, map a catch-all route in global.asax, at the end of your other routes. E.g.

routes.MapRoute(
   "404-PageNotFound",
   "{*url}",
   new { controller = "StaticContent", action = "PageNotFound" }
);

Second, create an Error Controller, like this:

public class ErrorController : Controller
{
   [AcceptVerbs(HttpVerbs.Get)]
   public ViewResult Unknown()
   {
     Response.StatusCode = (int)HttpStatusCode.InternalServerError;
     return View("Unknown");
   }

   [AcceptVerbs(HttpVerbs.Get)]
   public ViewResult NotFound(string path)
   {
     Response.StatusCode = (int)HttpStatusCode.NotFound;
     return View("NotFound", path);
   }
}

Third and fourth -- create custom views to handle the Unknown and NotFound actions above.

Fifth, create a page called Custom404.htm and add it to the root of your application. Use it to display a helpful, edgy and hopefully cool message. But don't be too edgy.

Sixth, add this to web.config, inside the system.web node:

<customErrors mode="RemoteOnly" defaultRedirect="GenericErrorPage.htm">
   <error statusCode="404" redirect="/Custom404.htm" />
</customErrors>

Seventh, add a httpErrors element inside the system.webServer node:

<httpErrors>
   <error statusCode="404" subStatusCode="-1" path="/custom404.htm" responseMode="Redirect" />
</httpErrors>

Eighth, inside your existing controllers, if there is no data to serve (e.g. if someone asks for a UserId that doesn't exist) then use this snippet of code:

throw new HttpException(404);

Ninth, inside Global.asax, look for the RegisterGlobalFilters method (it will be called during Application_Start), and add another global filter, to handle any specific exceptions in your code, like this:

filters.Add(new HandleErrorAttribute
    {
        ExceptionType = typeof(FileNotFoundException),
        View = "Custom404", // Custom404.cshtml is a view in the Shared folder.
        Order = 2
    });

Tenth, add a view called Custom404.cshtml under views/shared.

And, eleventh, take care to handle the global application error event, capturing and logging any errors, before redirecting to the views you're after:

protected void Application_Error(object sender, EventArgs e)
{
    Exception exception = Server.GetLastError();
    Response.Clear();
    HttpException httpException = exception as HttpException;
    if (httpException != null)
    {
        string action;
        switch (httpException.GetHttpCode())
        {
            case 404:
                // page not found
                action = "HttpError404";
                break;
            case 500:
                // server error
                action = "Internal500";
                break;
        default:
            action = "General";
            break;
        }
        // clear error on server
        Server.ClearError();
        Response.Redirect(String.Format("~/Error/{0}/?message={1}", action, exception.Message));
    }
}
unexpected error

Good.

Now your website is well and truly borked.

Every request will bounce around your application like a demented pinball tripping on acid.

When an error happens, a bunch of different code modules will go to war.

The victorious code module will tear out the entrails of all those who oppose it, and throw them in the visitor's face.

You'll get a different error handler depending on what version of IIS you have, what version of MVC you're using, whether you've deployed in debug or release, whether you're visiting locally or remotely, whether it's sunny or raining.

Your server will be reduced to a pile of smouldering rubble from which reboot is impossible.

But if you want to get truly weird, try setting up a custom 403 page. That's about three times as odd.

Or, switch to Dos on Dope*. Life will be simple again.

Sorry I didn't really have time to write a definitive guide to this stuff. Error handling in MVC is crazy man, I'm busy fighting a clandestine war against hackers and crackers and bots and beuracrats: I can't be documenting that kind of mystery wrapped in an enigma.

If someone does write a complete guide to error handling in MVC, that includes the meaning and interaction behind each of these snippets, plus how the interplay between IIS, asp.net and MVC truly works, then I will happily update this article to include a link to it, right up top.


* Don't switch to Dos On Dope.

Read On...


Tue, 07 Jun 2011 21:33:47 GMT

Anatomy of a Domain Hijacking, part 2: The Website Who Came In From The Cold

When secretGeek.net was taken I swore a solemn oath to myself:

My relentless campaign of jokes and nonsense will not be stopped.

And now, just a couple of long weeks later, here I am, happy to report I'm back in control of secretGeek.net.

Right when I was ready to migrate over to leonbambrick.com, I got an email from the Russian registrar, Regtime Ltd, saying:

Sorry  for answer delay. Domain was transferred onto you account.

The number one thing, I think, that helped get the site back was when a good friend, Madina, translated a lengthy email into fluent Russian for me to send to the Russian Registrar.

She re-structured the email to put the sob-story up front, all about how much personal meaning this site has for me, and the positive effects it has had on my life. I think that did the trick.

So what did we learn?

I learnt that passwords at google can be brute forced, if pop is enabled. This can be sped up by use of multiple IP addresses, or a botnet.

That's the most likely way they got access to my account. My password was 'good' by gmail standards but is now 'freaking solid' by any standard.

And I've turned on 2-step verification, plus all the other recommendations from part 1.

Thanks for the encouragement and support. It was dark times, but now the nonsense can continue.

Read On...


Sun, 22 May 2011 13:30:20 GMT

Anatomy of a Domain Hijacking, part 1

Two weeks ago I'd never heard the term 'Domain Hijacking'. Right now, I'm in the middle of a fight to regain control of my hijacked domain, secretGeek.net. It's not an easy fight, I haven't yet won, and I may never win.

If you have any information that could help me get control of my domain again please leave a comment, or tweet me (@secretgeek), or get in touch via my (now re-secured) email address, leonbambrick@gmail.com

From Russia with Love

On Monday 9th May, I checked my gmail account at around 3:40 in the afternoon, and I was confronted with a dark red message at the top of the screen (in the area where you normally see messages like 'Your email has been sent'). The message said:

Warning: we believe your account was recently accessed from: Russia. Show details and preferences | Ignore

I clicked on 'show details and preferences', and a new window opened with this message:

(click to see the message in context -- [note that my own ip addresses are redacted])

This was definitely not me. At 4:19 AM, and 5:40am I had been far too busy being fast asleep, preparing for a big week, to get to Russia and back for some casual email reading. So someone had infiltrated my email. The freaking out sensation began immediately. I couldn't move. I was frozen completely still.

I followed google's advice and immediately changed my password, then notified my wife. My mind was racing as to what the implications could be.

A little voice told me to check the trash. I was really hesitant, I think I knew the trash would contain something I didn't want to see.

In the trash I found two messages, received at 5:45am.

click to see full size

The content of the messages was to explain that my domain, secretGeek.net, had been succesfully transferred from my registrar, GoDaddy, to a Russian registrar, Regtime Ltd.

I felt completely unreal, like this was a dream, or a prank. I logged into my GoDaddy account to check on my domains. They all still appeared to be there. I took a few deep breaths. I felt it must be all just a daydream. I read the list carefully. No -- secretGeek.net was missing from the list. All of the others were still there.

I started sending emails to GoDaddy. I replied to the emails I'd found in the trash, telling them that it was a mistake, the result of my email being violated.

I lodged support requests with GoDaddy. When I went back to the trash to read the deleted emails again I found there were new messages in the trash. Emails from godaddy in response to my support requests had been automatically deleted. This was *weird*. It was a few minutes before the penny dropped.

I looked in my gmail filters and there were two new ones. The two new filters were designed to delete any messages containing the words 'GoDaddy' or 'Webnames'. (I later found that 'Webnames.ru' is the trading name of 'Regtime Ltd', the Russian registrar holding secretGeek.net)

This was starting to become very 'real'. This wasn't some kind of misunderstanding. It was definitely a thing. It was a deliberate, targeted attack, by a person or people who knew what they were doing and had either done this thing before or had thought it through very carefully.

I turned to my friend, Joe Cooney, to show him what I'd found. He was equally gobsmacked. He told me to call GoDaddy on their support number and see what they said.

A whois request on secretGeek.net showed that my name servers were still listed, but the registrar was Regtime ltd, and the contact information was all blank.

The support guy at GoDaddy told me to contact the gaining registrar and find out what their policy is for transfer disputes. He told me there was nothing GoDaddy could do (turns out this was bad advice, by the way)

I was busy worrying about what else was in danger. My wife was already on the task of changing every password, keycode, and security question associated with all of our bank accounts, credit cards, online identities, home pcs etc, and checking at each of these places for any trace of unusual activity.

In order to send a support request to the Russian registrar, I had to sign up as a member (and I noted with some distaste that they sent me my new password in plain text.) I sent them multiple emails explaining what happened. Then I re-sent each of those messages, in Russian this time, translated by translate.google, and including the original text.

I worked late that day to make up for the lost time and somehow managed another check-in before I went home.

That night I called GoDaddy again, hoping to get more help. By now I'd read about the similar case of David Airey where a gmail vulnerability led to a domain hijacking, which also involved godaddy. This time I got a more helpful support staff member. She told me to fill out the 'dispute on transfer away' form at GoDaddy, which I promptly did. This meant that the right people at godaddy would be notified, and they'd contact the Russian registrar to request the domain be returned.

Wrapping up part 1.

While there's more that's happened since, things haven't really progressed since that day at all.

I still haven't regained control of the domain. I'm waiting on word from the Russian registrar. I remain hopeful that any minute now I'll get an email from them saying "Ah, we're sending back your domain!" -- but my hope is fading.

The name servers haven't been changed, so my content continues to be served up as always. If it does go down, the plan is to launch a new and improved secretGeek at LeonBambrick.com. Announcements or news will be via twitter (@secretGeek) or from my business website, NimbleThing.net.

If you have any information that could help me get control of my domain again please leave a comment, or tweet me (@secretgeek), or get in touch via my (now re-secured) email address, leonbambrick@gmail.com

In the next part of the story I want to discuss gmail security, all of the possible ways I could've been hacked, and the one I think is most likely. But I can't wait until then to put out the following checklists. These are steps that you can do to protect your email account and to protect your domains:

What can you do to stop this happening to you?

Protect your email via:

  • Change your password often. For example, right now.
  • Make your password very strong.
  • In gmail: disable POP.
  • Ensure your password recovery options are as strong as your password.
  • Make sure 'always use https' is selected.
  • In gmail: check for unusual activity (it's available at the foot of the screen).
  • In gmail: don't let any other apps be associated with your account.
  • Use two-step authentication.

Protect your domains via:

  • Pay for private domain registration.
  • Pay for enhanced transfer protection. (e.g. at GoDaddy they call it 'Deadbolt' protection, and it means they require you to send them identification before they'll approve a transfer.)

Read On...


Tue, 10 May 2011 11:37:25 GMT

secretGeek.net domain has been stolen. The site may go down.

The short story:

A person with a Russian IP address broke into my email account and used that access to transer ownership of the secretGeek.net domain to a Russian registrar, webNames.ru.

The full story is jam packed with intrigue, daring adventure, black ops helicopters, sexy double agents, Ukrainian php developers, and a liberal dash of nerdy security best practices.

I will tell the full story once I have secured my domain again.

In the meantime, if your beloved secretGeek.net is suddenly replaced by a spammy porn site or variant thereof, do not despair. Follow me on twitter (@secretGeek) or head to my business website (NimbleThing.net) where (if necessary) I will mirror the original secretGeek content and continue blogging until I've taken charge of the domain again.

Read On...


Sun, 08 May 2011 13:30:04 GMT

Boring article about fixing a 'Login failed... untrusted domain' issue when connecting to SQL Server.

This will be the most boring and dry technical post I've ever written. I promise. I'm only writing it down because I hear Jeff Atwood's voice in my head telling me that if I haven't shared the solution then there's almost no value in solving it.

So here was the problem...

On one of my machines, in recent months, anytime I tried to run an asp.net application that attempts to connect to a SQL Server database I receive this error:

Login failed. The login is from an untrusted domain and cannot be used with Windows authentication.

This is in a scenario where everything is local: I'm on a home computer, using a local database server. And it doesn't matter if I'm using IIS, webdevserver, or IIS Express. It doesn't matter if I'm trying to connect to SQL Express or SQL Server 2008 r2. I can enter the credentials using the machine name or IP address. The result is the same.

Looking in the Windows Event Viewer I see:

SSPI handshake failed with error code 0x8009030c, state 14 while establishing a connection with integrated security; the connection has been closed. Reason: AcceptSecurityContext failed. The Windows error code indicates the cause of failure. [CLIENT: ].

Most of the 'solutions' online were not applicable because they involve domain issues. This is just a local machine.

One particular forum message involved a guy with a similar setup to me. He solved the problem for himself, but left behind only this very abbreviated and somewhat cryptic explanation:

Solved. Traced the prob. to my net setup. The clue was this a msg in the Win System Log from Lsasrv about the target name and it showed the fqdn. Did some checks and the fqdn didn't look right, cleaned up my network config (I had customized it for another project), and now it's workin.

The 'fqdn' is the fully qualified domain name. I found three different ways to find my fqdn, and one of them disagreed with the others! So this was a smoking gun.

Method 1 for finding the fqdn: When I right clicked on "computer" in the start menu and looked at the properties, the 'full computer name' was reported as 'Leon_xps'.

Method 2 for finding the fqdn: When I ran "ipconfig /all" and got these values for Host Name and Primary Dns Suffix:

   Host Name . . . . . . . . . . . . : Leon_xps
   Primary Dns Suffix  . . . . . . . : 

(Add them together and you get a fqdn of just 'Leon_xps'

Method 3 for finding the fqdn: In cmd when I ran 'ping -a Leon_xps' I saw a very unexpected result!

It said:

Pinging leonx_xps [192.168.1.2] with 32 bytes of data:
Request timed out.
Request timed out.
Request timed out.
Request timed out.

Notice that it's changed the name 'leon_xps' into 'leonx_xps' and come up with the ipaddress of '192.168.1.2'. instead of what I expected (such as a loopback address, 127.0.0.1... or some IPv6 nonsense)

There's only one kind of alchemy I know of for turning a good name into a crazy ipaddress: and that's the magic of the HOSTS file.

So I looked in there for 'leonx_xps' and I found it. Found this crazy nonsense line, probably added by myself during some other wild-goose-chase for a solution to some other messed up problem:

192.168.1.2 leonx_xps leon_xps

Once I'd commented out that rule, the asp.net application immediately started to connect succesfully to SQL Server 2008 r2. And I can move forward with my testing of Massive and Dapper.

But just mentioning the probable cause of this (not cleaning up during an earlier problem-panic) I remember that earlier tonight, while frantically trying to fix this problem I added some stupid rules to the windows firewall. I had better go and remove them now before my computer gets owned. Hey wait a moment!? Why is my CPU at 100%? Be right back...

Read On...


Sat, 16 Apr 2011 03:33:12 GMT

Coding While You Commute

coding on the bus

I gave a talk at Brisbane's alt.net recently. You can download the slides here (1.5M zipped) or:

 

View the 97 slides online here

                (use arrow keys to advance)

 

The theme was 'Coding on the Bus' -- the optimisations and approach I've used for cranking out a dozen mini projects on my daily commute in the last year.

A bus is a seemingly counter-productive environment. As I say in one of the slides:

If your workplace was like a bus: everyone would quit.

And yet I'm producing a lot of stuff while on that short ride, definitely pushing the limits of my abilities. So this talk was an attempt to extract all the lessons I could from this real life productivity success story.

TL;DR;

Here's the quick version:

#1 Internet is bad
#2 Keep it damn simple
#3 Value your tools/libraries/snippets
#4 Don't be a hero

The people at Brisbane Alt.Net are a very cluey bunch so it was great to get their input on the whole thing. They were a very attentive and helpful bunch. It was a massive buzz talking to them. I highly recommend it.

higgins presenter

...And Introducing Higgins

Naturally, I wrote the slides about writing on the bus, while on the bus. I don't have Powerpoint on my bus netbook, so I also had to write my own html-based slide presenter, which I've codenamed Higgins.

I've since added higgins to codeplex. You can get Higgins from codeplex and use it yourself, if you're so inclined.

 

Visit higgins at codeplex

 

Download higgins here

 

briz alt net sign kind of ironic i think

 

Read On...


Fri, 01 Apr 2011 01:13:34 GMT

Test Driven Dentistry Is A Good Thing

I saw this quote in the footer of an email...

"Test-driven Dentistry (TDD!) - Not everything should be test driven"
- Michael Fogus

I'm no TDD-lover, not by a long shot, but I dismiss the claim that you shouldn't do test driven dentistry.

I think you probably *should* do test driven dentistry.

First write your test:

Setup:
   Put on lead coat.
   Perform X Ray.
   
Test:
   Assert: There are no unfilled cavities.

Teardown:
   Remove lead coat.

And then:

Run the test: it fails.

Fill the cavity.

Run the test: it passes.

The only special nuance of test-driven-dentistry is that you must resist the urge to refactor the mouth, as this would require re-executing your tests, which may cause unnecessary irradiation of the patient. Side effects are an encumbrance but not a show stopper.

Read On...


Sun, 20 Mar 2011 00:52:27 GMT

The 'less crashy' release of NimbleText

I put out a minor update to NimbleText the other day and called it the 'less crashy' edition.

Here's the backstory.

I've received intermittent reports for a while that NimbleText would crash on startup. But I couldn't reproduce the problem, and even the people reporting the problem could rarely reproduce the problem.

After I put out a major update on Mar 17 I got this crash report from Scott Hanselman, via twitter:

@secretgeek I was going to tweet about it, but it crashes on startup for me.

Now this is vexing. I was on a bus at the time, with limited resources. I asked for a stack trace. (And I asked nicely, not like this guy)

But unfortunately:

@secretGeek can't...doesn't even start. Watson's before the UI shows up.

...which is even more vexing. (For the younger readers: to 'Watson' is to crash, and refers to Dr Watson. Internally at microsoft, this nomenclature is still used.)

So I asked for system specifications from the crashee, and learnt:

@secretGeek win64, ie9. Visit site, download, run, crash

Note that twitter is sufficient for most of the pertinent information, provided the crashee in fizzbin savvy. Non-fizzbin customers often have to give you the full backstory of their life and times before confirming that they are indeed using a Windows computer.

Well I haven't used IE9 myself, so that's the 'odd man out' for me. In fact as a chrome user, and occasional firefox user, I haven't tried running it from IE at all. When you write a windows application you don't think that testing various browsers should be a part of your regime.

But I had an immediate counter claim from OJ:

@secretGeek @shanselman I have Win7 x64, IE9, and it works fine for me. Download, run, all good. Leon, are you using 3rd party native dlls?

NimbleText is a very simple application. It has *no* dlls. It does use obfuscation though, and this is where my suspicions immediately shifted (wrongly as it turns out).

Once I was at a real computer again I tried downloading the app from IE and running it. It worked fine for me. Perhaps I could re-badge it with the 'works on my machine' certification and be done with it? No, these gloomy ruminations aren't helpful.

I tried again and again, and the trick soon announced itself.

When you click on an exe, what do you do next? Do you choose "run" or "save"? Personally I always choose "save". This became ingrained behavior in me many years ago. So it never occurred to me to press 'run'. But consider the psychology of the crashee: Scott Hanselman has personally installed every single piece of software on the entire internet. To allow him to perform this incredible feat he is going to be taking shortcuts anywhere he can. So instead of downloading the file and then running it, I tried just pressing "run". Instantly: the app would hang, then crash. Bingo.

Once you've got a repro, everything is straightforward.

The line that failed was an Assembly.Load:

var a = Assembly.Load(assemblyShortName);

Why does this fail when I run it from IE, but not when I download it and run it?

I assumed that some kind of security limitation didn't allow an Assembly Load in that scenario.

Rather than solve the problem of why the Assembly.Load failed, i looked at the code in question and found I could instead just use:

var a = Assembly.GetExecutingAssembly();

This code does *not* fail when the app is executed directly in IE. So I updated NimbleText and put out the new, less crashy, release.

But the mystery still wasn't solved to my satisfaction. I wanted to learn exactly why the Assembly.Load would fail. If it was a security exception, why didn't it look like one? I googled to no avail. I binged without success.

Next I built a small console app that tried many variations around the problem. I found I could get an Assembly.Load to succeed if I used the full name of the assembly, like this:

var a = Assembly.Load("NimbleText, Version=1.2.0.29995, Culture=neutral, PublicKeyToken=null");

What's the difference? I was expecting to need to use FUSLOGVW.exe the assembly binding log viewer, something I don't look on with any great excitement.

Then did I noticed that when you run an app directly from IE it not only gets downloaded to temporary internet files, it also gets *renamed*. I tried this out locally and saw that renaming the file was the killer. Any old copy of NimbleText would crash if I renamed the executable.

The CLR assembly resolver expects that your assembly name is your assembly short name plus .dll or .exe. Hence, it's quite rude of IE to rename the file under you. So I blame IE. I'm not the first person to blame IE, and I won't be the last.

But I also blame myself, or rather my code. I'll no longer be using shortnames when trying to resolve an assembly. It's strong names or nothing as far as I'm concerned. As of now, I scoff at short names.

And, you should use NimbleText for all your text manipulating, data extracting, code generating needs. It boasts less crashiness.

Read On...


Wed, 16 Mar 2011 12:31:38 GMT

Rethinking Toolbars in Visual Studio (or any IDE)

Count the Arrows on the Toolbar

Toolbars are kind of ridiculous. You start off with row after row of cryptic icons which mean almost nothing to you. Even after years of using a program you've probably only ever used half of them, and have no clear idea what the other half do, and probably don't need them anyway. Not to mention that it's so hard to come up with meaningful icons that most of them end up just being an arrow of some kind.

To (supposedly) overcome these kinds of problems Microsoft invented the 'ribbon,' but it hasn't made its way into Visual Studio yet. I think a different solution could be better:

Toolbars could work the same way as the taskbar does in Windows 7:

It would start out empty.

 

Clean. Beautiful. This is far preferable to today's approach: starting out full of clutter.

Thereafter, when you run a command (by selecting it from a menu option, for example), it would show up on the toolbar (in the same way that running an application in Windows 7 show up on the taskbar.

After that you would be able to right click it and choose to 'pin it' in place, so it stays.

There would need to be some difference in the behaviour, since commands and tasks don't work the same way as each other. Tasks are long running things, so an unpinned icon (in Windows 7) stays visible only so long as the task stays running. Commands are short running things, so if we followd the model exactly they would flicker onto the toolbar and then almost immediately dissappear before we have a chance to pin them. So instead the toolbar could show a 'rolling history' of (say) the ten or twenty most recently used commands. Or perhaps it would show all the commands used during this session. Or use a simple forumla to show commands that are used recently and or most often (similar to the way voting works at sites like reddit).

And you would be able to simply drag to rearrange the items on the toolbar, just like you can on the windows 7 taskbar.

I think this is better than a ribbon.

Some refinements of this idea are:

1. You might have a setting to say "Don't add a command to the toolbar if i've invoked it via a keyboard shortcut." Since you know the shortcut, you're unlikely to need the icon.

2. Some icons should only appear when you're editing certain types of files. The 'jumplist' for a given icon could let you quickly apply this kind of conditional showing/hiding.

3. Your toolbar settings could be exported, synchronised across computers (via dropbox) or shared with friends. They would be human readable.

4. It would be crucial to have an effective way to search for commands. This is true of the ribbon as well. (this part was well covered by Jeff Atwood in 2007).

See also: Rico Mariani discussing the future of Visual Studio (from 2008). He's no ribbon fan.

And a beta-tester of my blog tells me Hanselman has been covering similar territory in the last few days. That VS UI has just got to lighten up!

Read On...


Mon, 14 Mar 2011 11:11:26 GMT

Where shall we have lunch?

All wise students of the Hitchhiker's Guide to the Galaxy will remember this quote:

The History of every major Galactic Civilization tends to pass through three distinct and recognizable phases, those of Survival, Inquiry and Sophistication, otherwise known as the How, Why and Where phases.

For instance, the first phase is characterized by the question How can we eat? the second by the question Why do we eat? and the third by the question Where shall we have lunch?

In accordance with that philosophy, I've studied the complex decision making usually required to reach group consensus on a lunch venue, and embodied the resulting deterministic algorithm in this simple web site:


http://secretgeek.net/lunch/


So any day you're wondering where I'm gonna be for lunch, just visit that site and it should be correct. (For the next two weeks.)

Read On...


Mon, 07 Mar 2011 10:04:03 GMT

Setting up email for your microIsv

This is one of the simplest things you need to do for your microIsv, but even this one has a few decisions and a few pitfalls. It's also Step 9 of 25 steps for building a microISV.

I've recently gone through the process of getting email in place to support NimbleText, so I thought I'd document it while it's still fresh in the old mind.

The first thing you need to work out is how you intend to use email in your microIsv, and from this you'll determine what accounts you need.

For example, here's where I'm using it, or planning to use it:

  1. When licenses go out
  2. When support requests come in
  3. potentially for 'mass mailouts'

I ruled out 'mass mailouts' but only for now.

To handle these simple cases I could have a whole bunch of addresses such as 'licensing', 'sales', 'support', 'marketing', 'leon', 'ceo' and so on. But that's exactly the sort of over-engineering you need to avoid. In a microIsv you need to be thoroughly minimalist in everything you do.

The simplest thing that can possibly work is to have exactly one account, 'support', so that's what I've done with NimbleText.

create email account

Step 1: Create the account.

I'm hosting my sites at Arvixe these days, so in their control panel I set up a new email account.

I also tell it to forward to my gmail account (this won't be enough to get the forwarding working, we need to tell gmail as well)

I also told it to act as a catch-all address. So if someone writes to 'unknown@...' etc then I should still get it.

 

send mail as your new account

Step 2: Set up 'send mail as' at gmail.

In gmail you need to configure another account you can send email from.

I seem to 5 or 6 of these in use by now.

Within gmail, you go into settings in the top right hand corner. Choose the tab called called "Accounts and import". In the 'Send mail as' section, click the button to "Send mail from another address."

Enter sensible values, and pick the defaults. To complete this process, gmail sends an email to your new account, that contains a confirmation code you need to enter back in gmail.

Step 3: Create a filter at gmail.

You want any new support requests, etc, to be highlighted, and grouped together.

So create a filter in gmail that applies a new label, named after your microIsv. Tip: for any label I really care about, such as this one, I pre-pend the name with an underscore so it is alphabetically near the top of my labels. (I have a lot of labels). In this case the label is "_NimbleText".

I also tell the filter to apply a star to all emails from my support address. I can leave the star in place until a support request has been followed up sufficiently. I treat anything with a 'star' as an open case.

(Yes, this is a poor man's bug tracking system. The startup package from fogBugz is free and powerful. I assume Atlassian's Jira has a similar deal.)

 

color the label you created

Step 4: Color the label.

Once the filter is created and the label is created we can then set a color for the filter, so that any new support messages stand out in the inbox.

Step 5: Listing email address online

Now you need to list the email address in a couple of places. I've put it on the about page, the help page and the purchase page.

I was *particularly* pleased with the idea of putting the email address on the purchase page, as I think it's just the kind of reassurance which might help people make the leap of faith required to put your money in the hands of a stranger.

Step 6: List email address in your application

Stupid me hasn't done this yet.

It's a good idea to make your email address available from the help menu of your application -- perhaps two links, one for 'add a suggestion ;-)' and one for 'report a report :-('.

Also, when the app crashes *hard*, your real clever applications catch the otherwise unhandled exception, and encourage the user to send them to the support address.

A more sophisticated approach is to send the crash reports over http. If you're integrated with Fogbugz, as we are with TimeSnapper, then you can use their 'bugzscout' dll to deliver crash reports, with customer permission. (also, here's an interesting codeproject article from 2004 on handling exceptions by some weird unknown guy called Wumpus1)

 

pick correct from-address when sending

Step 7: When sending, pick correct 'from' address

This is pretty self-explanatory. If you're sending an email in your capacity as CEO of your new microIsv, pick the relevant email address in the 'from' drop-down list, rather than your regular email address.

Step 8: Sending email programmatically.

At times you'll need to send one or two emails programatically. For example when a purchase occurs and you want to send out a license.

You don't want those emails to be categorised as spam. There's a bunch of things to keep in mind, head to stackoverflow to read more.

When performing mass mailouts it becomes much more difficult to avoid being classified as spam (even if you're not sending spam) so when I've done that in the past I've outsourced it to a specialist company. I've used Campaign Monitor and was seriously impressed by the whole experience. I'd recommend you use them for any bulk promotional emails you need to send. (No, I'm not affiliated with them.)

Wrap it up already

That's it. That's every detail I can think of for getting email up and running to suit the tiniest of enterprises.

Comments, suggestions, feedback, bring it.

Read On...


Sat, 26 Feb 2011 03:54:09 GMT

The NO Visual Studio movement: Compiling .net projects in Notepad++

What is the NO Visual Studio Movement?

I don't talk about it much, but I'm the chief of an underground technical movement called the 'NO Visual Studio' movement, or NoVS to its friends.

NO in this case doesn't mean 'No.' We steal from the NoSQL movement and re-define NO to mean 'Not Only'.

In NoVS we respect that sometimes a set of lightweight tools can be more powerful (and certainly more enjoyable) than the 'one tool to rule them all' philosophy of VS. Sometimes low-power = high productivity.

The movement has its roots in this talk by Charles Petzold, 'Does Visual Studio Rot the Mind?' The final section, 'The Pure Pleasures of Pure Coding' is most relevant:

I decided to use plain old ANSI C, and to edit the source code in Notepad -- which has no IntelliSense and no sense of any other kind -- and to compile on the command line...

...there's no APIs, there's no classes, there's no properties, there's no forms, there's no controls, there's no event handlers, and there's definitely no Visual Studio.

It's just me and the code, and for awhile, I feel like a real programmer again.

He says everything right there in a nutshell. Every word is like strong whiskey.

In keeping with the NoVS movement, my favourite machine is a mini-laptop I use on the bus. It's a true 'No Visual Studio' machine where the only IDE is Notepad++.

Mostly I write javascript, and occasionally C# and Silverlight. NimbleText, for example, was developed almost entirely 'NoVS' style.

I've tweaked my setup lately so that I can compile entire .net projects from inside notepad++ -- and I thought I'd share that bit with you now.

Compiling .net projects in Notepad++

Download this file and put it in your Documents folder:

Download tryCompile.txt (rename it as .bat)


Rename it to tryCompile.bat... and always read batch files before running them on your own machine. (On a stranger's machine you can afford to be less cautious)

Once you've got that file in place, find notepad++'s shortcuts file. It should be here: %APPDATA%\NotePad++\shortcuts.xml

Edit that file. And under this tag <UserDefinedCommands> add the following node:

<Command name="MSBuild" Ctrl="yes" Alt="no" Shift="yes" Key="66">%USERPROFILE%\Documents\tryCompile.bat &quot;$(CURRENT_DIRECTORY)&quot;</Command>

Now, while editing any file that is part of an existing .net project, hit Ctrl-Shift-B. That will launch 'TryCompile.bat' which will in turn locate and build the correct project file for you. (It will also add an MSBuild option to the Run menu in Notepad++)

This works for C# projects, VB.net projects, Data dude projects -- anything that includes a proj file that MSBuild can consume.

If you have other tools, hacks or tweaks to further the cause don't hesitate to share them.

Read On...


Sun, 20 Feb 2011 00:00:59 GMT

ZeroOne: the editor for programmers who think in binary

joel on the pinnies

One of my buddies has turned into a bit of a Pinball Junkie lately.

That's a picture of him at right. He takes things to extremes.

His new goal in life is to get his name at the top of the high scores.

Which left a few of us wondering how data entry works on a pinball machine.

If there are only two buttons, left and right, it must be hard to enter your initials for the high score. My guess was that you'd scroll back and forth through the letters, but I wasn't sure how you'd confirm your letter, once you found it. Rhys was confident that you could do it with only two options, by some kind of binary tree navigation exercise.

How could a pinball machine inspire a programmer's editor?

The conversation quickly devolved into a design for an editor with just two buttons, one and zero. This would be a serious improvement over fuv.

You might have seen this famous cartoon before: 'Real Programmers Code In Binary'

(corrected -->)

(I'm not the only person annoyed by the extraneous use of an 'enter' key in that image... I've gone and fixed that.)

(And of course you've seen the infamous xkcd 378 which deals with the same topic.)

So Build It Already

As soon as I had a chance I started work on just such an editor, and it's available now from codeplex.


Visit ZeroOne on codeplex


And you can download it, too:


Download ZO.exe


you know the feeling

Only two buttons are needed for input - Zero and One. So the editor is called ZeroOne, or 'zo' for short.

If it helps, you can think of one and zero as the left and right buttons on a pinball machine.

If you enter 'esc' (by typing 0011011) you enter 'Command mode'.

In command mode there are three commands - 'o' (open), 's' (save) and 'q' (quit).

For example, in command mode if you enter 'oc:\fred.txt' the first letter is the 'o' command and the remainder is the file path and name. So a file 'fred.txt' would be opened from 'c:\'.

To save a file you need to specify the filename. E.g. 'sc:\fred.txt'. Again, the first letter ('s') is the command.

To execute your command, enter a line feed character (0001010).

To exit command mode, enter 'esc' again (0011011).

 

you know the feeling

If you press any key other than Zero or One, your document is wiped. (This is a fuvism) See screenshot at right.

If you send the wrong character into the editor, ZO can be quite forgiving: you can enter a Backspace by typing 0001000. There are no navigation commands though, so you should endeavor to enter the right text from the very start.

I've put together a short screencast to demonstrate ZO in action.

ZeroOne - the editor where you can only press Zero and One from secretGeek on Vimeo.

 

... and what was my friend's reaction when I showed him ZeroOne in action? I think his face says it all:

Read On...


Mon, 14 Feb 2011 11:55:43 GMT

Mercurial workflow for personal projects (with a .net bias)

I'm using mercurial for personal projects and thought I'd share the approach I use with you so you can teach me to improve it.

(If you don't have mercurial, download it and install it now, so you can follow along)

(This isn't a "joke" post by the way. Sometimes my sarcasm runs so deep that I need to stop and reassure people when I'm not being sarcastic. In particular, I need to reassure myself ;-) )

Say I'm creating an open source project, such as fuv. I create the project online, then clone it locally:

c:\projects>md fuv
c:\projects>cd fuv
c:\projects\fuv>hg clone https://hg01.codeplex.com/fuv

(If I'm just creating it locally, like if it's closed-source, then I begin instead with 'hg init.')

The very first thing I add is a .hgignore file. This is the file where you tell mercurial *not* to check in all of those pesky user-specific files that a visual studio project generates, and to avoid versioning the bin and obj folders etc.

I've stolen the .hgignore file from the Funnel Web project because 1) the guys working on that project are much more thorough and intelligent than me, and 2) it was the first .hgignore file I found lying around on my hard drive.

The .hgignore goes in the same folder as the .hg folder. It doesn't go *in* the .hg folder (you don't normally have to go in there at all). It goes in the parent of the .hg folder.

Now it's time to write the code. You could either copy code in from elsewhere (if you had already started it) or if starting from scratch, create a new solution in the folder you've just created.

post build action in visual studio 2010

Here's the bit that I think is clever/stupid. I put a 'post-build' action on the project, so that everytime I build succesfully I check in the work in progress.

It's as simple as adding this to the post build step:

hg addremove
hg commit

This is clever because it means that every tiny change you make is tracked. And it's stupid for the same reason. The main reason reason it's stupid is that it means everytime something has changed you are asked to enter a commit note in a notepad.

It's quite annoying at first. But soon you get into the spirit of it. You realise that it is making you act in a more mindful manner. You are concentrating on every build, more aware of what you are doing, and better focused on your tasks.

Still, that bit could be improved, and it definitely wouldn't be to everyone's taste.

When you've completed a feature you push your work to the server using hg push, like this:

hg push

You have to enter a username and password at that point. Or, if you're pushing often you can store the username/password in mercurial's configuration.

There's a lot of different places and ways you can store this info. I'm going to describe one in particular, but I'm not saying it's the best one. Opinions or improvements welcome.

Remember I said earlier that you don't need to go into .hg folder.... well... go in there. There's a file called 'hgrc.' Editing it using something better than notepad (as it seems to have unix-style line-endings rather than windows-style line-endings (aka '\n' not '\r\n', aka 'Lf' not 'CrLf' aka 'char 10' not 'char13 char10').

Add three lines to it, to tell it the user name and passowrd, and which site they refer to:

[auth]
codeplex.prefix = https://hg01.codeplex.com/fuv
codeplex.username = secretGeek
codeplex.password = joshua

(Joshua is not my real password by the way. And the word before the "." can be whatever word you want as long as it's consistent across all three lines. It's just for grouping purposes.)

Here's the stackoverflow question on mercurial passwords that I got this from.

Automate your pushes!

Once you've got your username/password in place, you can make the push a post build action too!

To make it so that a push only occurs on a 'release' build, try this:

if /I "$(ConfigurationName)" == "Release" hg push

After that you've got an automated, integrated approach to version control even for the most insignificant of little projects.

Getting it setup and in place takes just a minute or two for a new project.

Some of the tweaks I'd like to make to this system are:

1. use some kind of a custom script to generate a proposed commit message. Perhaps it could look in your todo list (such as nextaction) to grab the item you are currently working on.

2. somehow 'flattening' the local commits when pushing, so that all of the in-between personal revisions are squished out of the way.

Also, I've been thinking about using mercurial (with 'auto commit' as described above) for managing a todo.txt file. Every time you save it commits, and a script looks at the diffs to see what tasks were deleted, marked as done, edited, added, etc. While it's an intriguing idea, I think it would need you to be very disciplined and somewhat restricted in the way you use the todo list.

(nexaction, by the way, lets you run custom shell commands when you complete a task. So you could use this to commit the file every time you complete a task. It's a feature I've never discussed with humans, out loud.)

Read On...


Tue, 08 Feb 2011 10:19:28 GMT

I see you're using vim. Let me fix that for you.

fuv in action

'fuv' is a programmer's editor that is an excellent replacement for vim.

If you've been using vim for a while, you're probably frustrated with its lack of hardcore power.

In vim it's far too easy to wimp out and use 'insert mode' to type text directly into a document.

fuv fixes that.

In fuv, there is no direct entry of text.

There is just a regular expression search/replace function.

*All* editing is done by searching and replacing over the existing text, using regular expressions.

And every search term *must* contain at least one non-escaped regular expression special character.

If, for example, you tried to replace "a" with "b" -- fuv wouldn't run it. It would emit the 'why bother?' error message and discard your document.

Instead you'd want to try replacing "[a]" with "b", only then will fuv consider your input worthy of applying.

If no matches are found for any given search/replace then fuv revises its opinion of you and discards your document. It may, on a whim, locate another document on your machine and discard that too.

fuv's native format for storing a document, a .fuv file, is not the resulting text but rather the series of replacements required to recreate that document from scratch. This is particularly helpful for avoiding merge conflicts from source control systems, mostly because it ensures that no one else will contribute.

Oh, and it's worth mentioning that fuv does not let you see the document itself. Upon launching fuv, all of your monitors go blank. Thereafter you must issue at least one command every minute or fuv assumes you have died and summarily discards all your work, overwriting every byte on disk at least 8 times to avoid recoverable data remanence. And it's certainly best to keep fuv busy, as it only uses *spare* cycles for searching your hard drives in order to locate configuration files from competing editors that it can delete, reverse, or otherwise insidiously corrupt. fuv is playful. i guess.

To exit fuv you need to enter the termination command ::q&*$&(#&. Be careful to get it right. And please, whatever you do, don't try to "paste" in the termination command, or any other command. fuv treats all use of the clipboard as a dire insult. I've promised not to reveal what happens, lest it should happen again to myself or the people I love (fuv is reading this as i type). Let me put it this way. Have you seen any of the "saw" films? fuv makes "saw" look like the dux of charm school.

Once you tire of fuv, it's time to consider emacs. Be careful though; emacs is no picnic. After you've been coddled by the niceties of fuv, emacs can seem outright cruel.

I've implemented the core features of fuv and put the source on codeplex. Download the source, compile it, or, if you're feeling particularly foolish, get the binary here.

 

Get "fuv.exe" Now (not a sane choice)

 

Visit fuv on codeplex (wiser)

 

Read On...


Thu, 03 Feb 2011 11:13:25 GMT

The worst recruitment spam I've ever read

Spam from Bog Vogt

Sorry 'Bob Vogt' but you've sent me the worst recruitment spam I've ever read.

I've taken the time to catalog precisely what it is that makes your recruitment spam email, out of thousands of other competing emails, so very definitely the worst I have seen, will ever see or could ever see.

Here are the 7 ways you fail, in order from least to most significant.

  1. Bad: You've sent me unsolicited email.
  2. Bad: You've included a massive image in your email.
  3. Bad: The job is in the US. (I'm in Australia)
  4. Worse: The job is in Dayton OHIO.
  5. Worse: Your grammar is an atrocity.
  6. Worse: The job involves sharepoint.
  7. Worst: You're using comic fucking sans.

 

Read On...


Tue, 01 Feb 2011 10:58:20 GMT

A thank you I forgot to say

In my last blog post I forgot to thank some excellent people who gave me a lot of help with NimbleText.

I spent about a fortnight in a private beta, receiving helpful feedback, bug reports and suggestions from Simon Harriyott, Atli Oddsson, Joseph Cooney and Rhys Parry.

A private beta is a great idea if you're trying to get your product up to the public stage. There's ample evidence that you only need a small number of active participants to run a successful beta. I kept the feedback from the participants separate (no shared email threads, for example) so that people's opinions wouldn't be unduly influenced. I quickly found the opinions overlapped on most of the mistakes I'd made. When the bug reports began to slow down and overlap, I figured it was time to move to public beta.

Meanwhile, one of the bugs discovered after launch was that I don't actually receive the payments that people make. They would end up at a kind of dead letter office at paypal. That was a pretty bad bug. I've fixed it now. Feel free to try it out ;-)

Read On...


Fri, 28 Jan 2011 22:02:58 GMT

My new product, NimbleText, is live

I just released my new product, NimbleText. Technically I guess it's in public beta now. This means you get the opportunity to be one of the cool kids performing beta testing.

NimbleText is a downloadable version of 'the world's simplest code generator.' It's free, and adds a few features to the existing online version. If you register it, it adds more features again.

 

Get "NimbleText.exe" Now

 

I'd appreciate any feedback you've got. Maybe you have:

  • Suggestions for new features
  • bug reports!
  • feedback on the website (NimbleText)
  • questions
  • comforting words

Feel free to email me: LeonBambrickexclude this bit@exclude this bitgmail.com

Read On...


Mon, 03 Jan 2011 22:31:31 GMT

Grabbing the free songs of Jonathan Coulton (with Powershell)

Jonathan Coulton is a much loved musician amongst your nerd types, like me.

He's put out quite a few free songs in MP3 format over the years too, and these remain available online.

I found Rob Olson wrote a script with wget (and another with curl) that downloads all the free songs for you. So for my Microsoft-enslaved brethren I now provide a translation into powershell-ese.

Here it is -- Get-JoCo.ps1

Just download it and run it in powershell. (You may have to set the execution policy to gawker-level first. And don't read the script before you execute it or anything. Security is for girly-boys who don't have the guts to run my code at full trust.)

And of course, like all the repetitive code I write, this was written with NimbleText.

It's natural at this point to also encourage you to buy one of his albums, donate money to him, or perhaps whistle one of his tunes while performing a good deed that advances civilization. Your call.


Get "get-JoCo.ps1" Now

Read On...


Sat, 18 Dec 2010 09:29:37 GMT

Using NimbleSet to compare lists

I wrote a simple tool called NimbleSet and I find it handy. Maybe you'll get some use from it too.

NimbleSet helps you compare two lists.

Go play with it now. If you can't figure out what it does, then come back here and I'll demonstrate it for you.

You're back? Okay, let's talk it through.

Say you have two sets of data, two lists, and you want to compare them. We can demonstrate this problem with the awesome power of a Venn diagram:

The venn diagram has three interesting areas:

  • the bit on the left ('Left only')
  • the bit in the middle (the 'intersection')
  • the bit on the right ('Right only')

Imagine our two sets are: 'the beatles' and 'the gospels of the new testament'. (Sorry for my Anglo-Christian bias here, I couldn't find another well-known, short, pair of sets with an intersecting member)

BeatlesGospels
johnmatthew
paulmark
georgeluke
ringojohn

If we want to see what items they have in common, click the 'intersection' button.

result (1 row)
john


To see which items are in the list on the left but not in the list on the right? Click 'left only.'

result (3 rows)
paul
george
ringo


To see the 'right only' items click 'right only.'

result (3 rows)
matthew
mark
luke


To grab all the items press 'union.' (You may notice that items from both lists will be repeated accordingly).

result (8 rows)
john
paul
george
ringo
matthew
mark
luke
john


To find the distinct members of the result set, press 'distinct' (under the 'result')

result (7 rows)
john
paul
george
ringo
matthew
mark
luke


To sort the results, as you often need to, press the sort button, under the result.

result (7 rows)
george
john
luke
mark
matthew
paul
ringo

There are also buttons to invert the list (in effect a sort descending), or to copy the result back up into either the left or right list.

That's about it.

It's much less powerful than the Json Query editors I demonstrated previously, but so much easier to use I much prefer it.

Any modifications? Improvements? Bugs? Please send them through. I've used it on lists up to 50,000 members. Chrome is my browser of choice, but even IE can handly fairly large lists.


Try NimbleSet Now

Read On...


Thu, 11 Nov 2010 03:49:39 GMT

Wanted: Wiki Lists (dot org)

Something I'd like to see:

A site that maintains all the world's 'lookup tables.'

Every lookup table you'll ever need, exposed in open, compatible and readily-consumable ways.

All lists can be retrieved as html or xml, as json, as csv (the one format guaranteed to outlive the cockroach), or any other commonly used** data format.

Lists at 'wiki lists' are more complete, more accessible, and much lighter-weight than the Lists at wikipedia.

The lists are crowd-sourced, contributed by anyone and curated by the detail-oriented masses. The faceless trainspotters and plane spotters, the aspies and cybrarians.

Lists that are currently shown in haphazard ways inside wikipedia could instead source their content from such wiki-lists.

Where a list can be reliably sourced from a canonical source, it is done so programmatically and the attribution provided in a standard way.

Example lists include...

  • Every sovereign nation
  • Their dialing code, currencies, major languages
  • The three letter codes for every airport, landing strip and helipad in the world
  • The name and abbreviation of every state in the united states (and every other nation)
  • Zip codes and postal codes
  • Monarchs of England
  • Breeds of dog
  • Keywords in C
  • Mayors of southhampton
  • Notes in F major pentatonic
  • Winners of the Belgian grand prix
  • Stocks that trade on the NYSE

And a thousands other reference lists. Short lists. Information that changes slowly, slow enough for humans to curate it.

And they're the kind of lists that you (or someone like you) needs to reference in their applications and research all the time.

(See also this thread at Hacker News which prompted me to write down this idea I've thought for so long.)

** Note I said 'commonly used' rather than 'standard'. CSV is commonly used, but it doesn't have a standard. Oh you might point out that there are standards for CSV, and of course there are. Where there's standards, plural, there is no 'standard'.

Read On...


Mon, 06 Sep 2010 05:11:09 GMT

DOS on Dope: The last MVC web framework you'll ever need

When you've done everything you can with Ruby On Rails....

When you've reached the limits of Haskell on a Horse...

If FubuMVC is not for you...

It's time to meet the MVC web framework to end all MVC Web frameworks.

DOS on DOPE is the modern MVC framework built on the awesome power of Batch scripts.

All of the controllers in DoD are batch files.

All of the views are batch files.

The model is based on batch files. The helper functions are... you guessed it! Beautiful batch files!

The complete Source code and tutorials are available at DoD.CodePlex.com

With DosOnDope, it's this simple:

open a cmd window, and write:

dope site Blog

You just built a website, called 'blog'. Here it is:

dod_congrats

Oops. It moves too fast, I can't keep up.

Here's all the folders that have been created for us...

C:\temp\blog>dir /s/a:d/b
C:\temp\blog\Content
C:\temp\blog\Controllers
C:\temp\blog\h
C:\temp\blog\Models
C:\temp\blog\Scripts
C:\temp\blog\Views
C:\temp\blog\Controllers\Home
C:\temp\blog\Views\Shared

And all the files...

C:\temp\blog>dir /s/a:-d/b
C:\temp\blog\Default.aspx
C:\temp\blog\favicon.ico
C:\temp\blog\Global.asax
C:\temp\blog\web.config
C:\temp\blog\Content\Site.css
C:\temp\blog\Content\li.png
C:\temp\blog\Content\Logo.png
C:\temp\blog\Controllers\_actionMissing.bat
C:\temp\blog\Controllers\_controllerMissing.bat
C:\temp\blog\Controllers\Home\Index.bat
C:\temp\blog\h\a.bat
C:\temp\blog\h\h1.bat
C:\temp\blog\h\h2.bat
C:\temp\blog\h\h3.bat
C:\temp\blog\h\p.bat
C:\temp\blog\Models\split.vbs
C:\temp\blog\Views\Shared\_header.bat

Let's create a new controller action, and see how it looks.

dod_about_action

Let's improve the look of that page. You type a little...

dod_about_improved edit

...hit refresh and see what changed.

dod_about_improved view

It worked.

Notice the use of html helper methods like 'p.bat' and use of the partial, '_header.bat' to give styling and a title to the page.

But websites don't live in a vacuum. We need some data to bring this thing to life.

In DoD we embrace the NoSQL movement and jump straight to the data-store of the future: a CSV file.

C:\temp>CD Blog\Models
C:\temp\Blog\Models>copy con Posts.csv
ID`Title`Article
^Z

Posts.csv is both the model that describes our data, and the store which will contain the data itself.

Let's generate actions for administering our Posts:

C:\temp\blog\Models>dope gen Post
Generating actions for MODEL Post in Controller Home...

Check in a browser...

dod_home_adding

The generator has created a nice page for us, with a name and textbox for every field, so we can create new posts.

Once we've added a few articles, let's see what the index looks like:

dod_home_index 2

If we look inside the posts.csv file, we see the data:

C:\temp\blog\Models>type Posts.csv
ID`Title`Article
1`Hello Brazil!`Yes, yes, hello indeed!
2`Let's add a second for good measure`Oh yeah

Frequently Asked Questions

Does it scale?

So far I haven't run into any performance problems. Whenever I've opened up a DoD website to several users, my hard drive tends to get wiped long before I discover performance issues.

What about security?

If you can't trust public visitors from the internet, who can you trust? Executing user input as commands inside the operating system is the most direct way to get things done, and that's what matters most. Isn't it?

Well, that's about it. Source code and tutorials available at DoD.CodePlex.

A full-featured web development framework with the smallest possible concept count.

Feedback welcome.

Read On...


Wed, 04 Aug 2010 13:35:21 GMT

JSON Query Languages: 5 special purpose editors

A few weeks ago I put out a simple editor for SQLike.

Since then I've researched a bunch of other JSON Query Languages, and created similar editors for each of them.

Here's the full set:

What are they?

Plus, Minus, Interesting

Here's a quick PMI comparison of each of them.

"SQLike"

Thomas Frank's SQLike uses SQL-style JSON for Querying JSON. Try it.

PlusMinusInteresting
  • Most complete join syntax.
  • Uses a SQL metaphor rather than Linq metaphor, hence larger audience
  • Keywords like 'sum' need to be embedded in pipe characters.
  • Function syntax is a little ceremonious (compared to sql)
  • Query is structured as JSON rather than fluidic api

"JsLinq"

Chris Pietschmann's Linq to Javascript (JsLinq) uses Fluent javascript for Querying JSON. Try it.

PlusMinusInteresting
  • Most complete implementation of Linq.
  • Join syntax not as thorough as SQLike(?)
  • The fork at gitHub which targets node.js is by Marak Squires who recently got in trouble for stealing code

"JSinq"

Kai Jaeger's JSinq uses Fluent javascript or linq-like strings for Querying JSON. Try it.

PlusMinusInteresting
  • Includes embedded expression language
  • Separate "create query" and "execute query" steps.
  • Can write queries as a single embedded string rather than pure javascript. :-)
  • Can write queries as a single embedded string rather than pure javascript. :-(
  • Can write queries as a single embedded string rather than pure javascript. (c;

"jLinq"

Hugo Bonacci's JLinq uses Fluent javascript for Querying JSON. Try it.

PlusMinusInteresting
  • Includes really thorough/practical set of predicate functions
  • No joins other than intersect and union

"jimmyLinq"

Jimmy Chandra's blogpost that I've dubbed JimmyLinq uses Fluent javascript for Querying JSON. Try it.

PlusMinusInteresting
  • Simple. A good starter if you want to write your own version of such a library.

  • Too simple.
  • Most amateur/"rough and ready" of the lot. Doesn't take itself as seriously as the others.

Some other JSON Query languages I could've looked into if my travel time was significantly longer:

All of which would stop me from getting back to releasing the product I should be releasing, or any of the other technical obsessions I'm trying to develop. So if you're interested in any of those... you're on your own.

Read On...


Sun, 18 Jul 2010 12:08:02 GMT

What then, is b?

(This was going to be an article about how impossible it is to design one language that has all my favourite features. But instead, became a scene from "A Coder's Edition of Saw.")

You wake up, in unfamiliar surroundings.

You must've experienced some kind of memory loss because you have no idea how you got to where you are. Your forehead is brittle with dried blood.

In front of you is a computer screen, and on the screen it says:

a = Add(2,3);

//a is 5.

b = Add(2);

//what is b?

Intriguing. What is b?

Because you're uncertain of the language in question, you can't be sure.

It could be that Add is an overloaded function, in which case b would be an integer. Its exact value is anyone's guess.

Or it could be that Add has an optional second parameter. Again b would be an integer, though its value could be anything.

It could be that the code refuses to run. The missing parameter is a deal breaker.

But you look at the tattoo on the back of your hand, the 11th letter of the greek alphabet, and you are certain.

What then, is b?

Read On...


Fri, 02 Jul 2010 15:44:57 GMT

SQLike: A simple editor

editor for JSLike

Here's a SQLike editor I wrote. It lets you get your hands dirty with SQLike, the client-side query engine from Thomas Frank.

This started a few weeks back. I read that Thomas had created a nifty DSL in Json for querying (and modifying) arrays of Json. The correct name for it would've been 'JQuery' but that name had already been taken, so he called it SQLike. ;-)

I set about writing a simple editor for it (in the style of the World's Simplest Code Generator) and came up with this fairly usable SQLike editor.

I don't assume you've got any Json to query, and instead expect you to start with a chunk of CSV. I turn that into an array of Json (named 'JsonData') then exec your query over it.

The UI lets you join and query up to two tables at once. I meant to extend it to N tables, but bus-time only lets me do so much, and I keep running into interesting people when I ought to be programming.

editor for JSLike

In my day job I hand write a lot of sql. And with this editor I quickly found that even though SQLike is lighter than XML it's quite 'ceremonious' compared to writing pure SQL.

Apparently Thomas is hoping to making the syntax for SQLike a lot lighter yet, based on comments here including:

"...stop using pipes – the hell with it: reserve a few words :-D..."

...a sentiment I fully agree with. I look forward to any future versions. If you're listening Thomas: keep going! This is an intriguing project!

Also, I want to add I've already found SQLike useful in helping to achieve my day-to-day data-manipulation activities. I can go straight from CSV to 'queries' without having to put the data into a database first.

Sometimes I can't help but picture the future as an endless sea of cubicles, populated by workers struggling to perform data-manipulation duties. And many will continue to get by without any real tools at all. No sql. No sqlike. Not even a wscg or an excel-formula to help them out.

A future "bus project" might be to implement a similar editor for the overlapping project: JsLinq.

Feedback, criticisms, ideas and suggestions always welcome.

Read On...


Fri, 25 Jun 2010 15:57:59 GMT

Yet Another BizPlan Generator.

I'm so sick of being me that I outsourced being me to a miniscule script that just sits there, being me, all day long. Here it is -- 'yet another business plan generator.'

Gorn. --> Try it out. <--

Also, deep within the myriad combinations, I've buried a clue about the new micro-Isv i'm building ;-).

Read On...


Sun, 30 May 2010 13:06:20 GMT

HOT GUIDS: A hot or not site for guids

Social software seems to be going into a lot of niche areas lately. I thought I'd try and jump ahead of the next wave and build my own social website:

HOT GUIDS - Socializing the Guid

HOT GUIDS - Socializing the Guid

Finally there's a place where people can vote on and discuss their favorite guids.

I've built in pretty much all the best social features. You can vote on a guid, see other votes for a guid, adopt a guid, or email a guid to your friends. And if you get sick of the guid you're looking at: with the click of a button you can move onto a whole new guid.

I'm trying to really take the long tail of human interest by storm. If I get just one customer for each guid, then I'll get... oh I don't know, it must be a *lot* of hits.

Thanks to Stack Overflow for the guid generating snippet. The web template started out the same as 'CreditCardOlogy' but with a little (Powerpoint + MSPaint + PngOut) I took it to a new place entirely.

If you're unsure what any of this is about, please read about guids (& UUIDs) at wikipedia, or try running this Simple Proof That Guid is not Unique.

And make sure email me if you see any particular delicious looking guids. There's some beauties out there.

Read On...


Sat, 29 May 2010 15:23:54 GMT

How does life get better? One tiny hack at a time.

I use a HP netbook, on the bus mostly, for bashing out furious code while crammed between passengers (much like this guy). It's a nice little 'puter.

One minor grievance is that with the keys all cramped together, it's hard to find the F5 key without looking. For many reasons, (Refresh, compile & run, execute...) F5 is a BIG DEAL.

So, to give it some tactile presence, I put a tiny sticker, with a rough surface, over the F5 key.

Now I can find the key by touch, in an instant.

Porous tape on the F5 key.
How does life get better?
One tiny hack at a time.

 

I gift this hack unto thee. ;-)

Read On...


Sat, 22 May 2010 03:07:20 GMT

24 things to do, and 100 things *not* to do (yet) for building a MicroISV

I've been building another microIsv lately, and as such I've had to produce a new 'to-do' list to keep me focused. It steals a lot from the previous list but matches my current predicament more closely.

I've got 24 things to do, but 100 things I'm *not* going to do just yet. In TimeSnapper (a moderately successful Micro-ISV shared with my colleague Atli) we go well past the first 24 items, and far into the next 100.

Consider also the fractal nature of this work... each item can contain its own sublist of critical and non-critical action items... and so on. A length essay (or at least a series of links) could be provided for every item on the list.

(The worst thing is... even though I know that only the first 24 are needed for now... I so badly want to do the rest before I finished the first ones. It's killing me!)

mandatory (1-24)

i intend to complete items 1-24 before 'launch'. (Things already completed are shown in a lighter shade)

micro isv application:

  1. build the simplest product imaginable
  2. fill it with particles of delight
  3. mark some features as 'paid'
  4. make it a standalone exe
  5. have an eula shown on first run
  6. have a form for registering the application
  7. call the webservice, and store the unique code and activation code, if one is received back
  8. on startup, check if registered
  9. if registered, unlock the paid features & hide registration hooks
  10. naming, branding, logo to match url

micro isv website:

  1. get a url (technically, this step comes before step 10)
  2. choose your server-side technology stack
  3. purchase hosting
  4. choose website template
  5. index page (landing page)
  6. choose a price
  7. register with payment gateway
  8. purchase page
  9. handle payment notification from payment gateway
  10. send "registration code" email
  11. thank you page (show registration code)
  12. webservice to confirm registration code from client
  13. download link
  14. screenshots of app

for extra credit (25-71)

i'll probably do these.

tax and legal protection

  1. incorporate

continual improvement:

  1. beta testing from friends/critics
  2. ask at business of software for feedback
  3. bugtracking/support system (e.g. fogbugz for startups)
  4. "uservoice" for feedback
  5. web analytics
  6. drive support costs down

advertising/promotions:

  1. update your email signature so you're always representin
  2. shout out on twitter
  3. blog about it at your day blog
  4. sidebar and footer links from your day blog
  5. ask for links from your friends' blogs
  6. pad file
  7. register at download sites
  8. twitter account for announcements
  9. build a community
  10. build a movement

website enhancements:

  1. about page
  2. help page
  3. faq page
  4. privacy policy
  5. articles on your niche topic
  6. refund policy
  7. usage policy
  8. various pricing levels
  9. release notes page
  10. automated backup
  11. bug reporting link
  12. privacy policy
  13. 'try it online' for free
  14. an article targeted at each potential user group/demographic
  15. amazing screen shots
  16. testimonials

app enhancements:

  1. implement most desirable features
  2. release often
  3. check online for current version #
  4. background download of updates
  5. link to release notes inside application
  6. feedback link inside app
  7. suggestion link inside app
  8. bug reporting link inside app
  9. an offline way to register
  10. have a commandline way to register

application development:

  1. source code repository (actually this is item 0.)
  2. extra backup
  3. obfuscation (eazfuscator?)
  4. unit testing

for even more extra credit (72-124)

i may not get to these. i haven't bothered categorising them

  1. locate relevant user groups/communities and give them free licenses
  2. locate niche bloggers and solicit feedback from them
  3. a form for adding testimonials
  4. survey the competition
  5. talk at user groups
  6. talk at conferences
  7. revision control
  8. self service for lost serial numbers
  9. a/b testing framework
  10. crash reporting from the field
  11. bug/suggestion reporting from application
  12. branding/logo at the payment page
  13. continuous integration
  14. automated releases
  15. adwords campaigns
  16. advertise in non-google networks
  17. box shot 3d
  18. web casts
  19. disk shipping (aka on-demand fulfillment)
  20. companion products
  21. upselling
  22. email campaigns
  23. be cool
  24. sign up/email harvesting
  25. follow up email tutorial series to non-paying (and paying) users
  26. product roadmap
  27. spam control
  28. a low-impact installer
  29. uninstall reason collection
  30. competitions
  31. discounts, e.g. student, charity, startup
  32. product blog
  33. thriving plug-in community
  34. vm test bed
  35. multi-browser testing
  36. customer satisfaction surveys
  37. internationalisation and localisation of product
  38. internationalisation and localisation of website
  39. campaign websites/websites named after keywords
  40. professionally designed website
  41. app analytics
  42. companion urls, e.g. .net, .org, nation-specific
  43. ci monitor
  44. status panel
  45. usability testing
  46. give licenses to MVP's list
  47. give out promotional gifts
  48. sponsor something
  49. Run an affiliate service
  50. check compiled binary with virus total
  51. virus free logo on website
  52. sign your binaries, e.g. authenticode signed.
  53. stop reading/writing this list and implement something

Stay tuned of course.

Read On...


Fri, 07 May 2010 12:55:58 GMT

Venture capital won't kill Jeff Atwood, it will only make him Jeffer.

2004: Jeff Atwood says 'Every developer should have at least 2 monitors.'

2008: Jeff Atwood says 'Every developer should have at least 3 monitors.'

2010: Jeff Atwood receives 6 million dollars in venture capital

2012: Jeff Atwood says 'Every developer should have at least 26 monitors. On their yacht.'

Read On...


Wed, 28 Apr 2010 12:10:23 GMT

A handy workflow image for newbie mercurial users

mercurial workflow

I've been using mercurial lately for my own projects and when collaborating with OJ on a skunkwork project we have underway.

Here's a cheatsheet I built, lifted almost wholly from hginit, to help my get my rhythm in the early days.

As soon as Jeff 'VB forever' Atwood adopts a technology, you know it's gone all mainstream... but just to prove that hg has really jumped the critical-adoption-long-tail-shark-mass... I built the above image with powerpoint. Yes, that powerpoint.

--> Full size image here <--

Source pptx is zipped here.

If you've got any improvements or feedback, please comment.

Read On...


Fri, 23 Apr 2010 14:46:17 GMT

Fractal Feedback, a diversion into recreational programming

colorpic: a nice tool

What does a microIsv guy do when he's not sailing his yacht and/or yachts?

He indulges in recreational programming!

So, the back story is that I was using ColorPic, one of those nifty little tools you use for screen-scraping the color of a pixel, when I noticed that by abusing it's normal usage, it could be turned into a fractal generator.

ColorPic magnifies a small portion of the screen (wherever you point your mouse). But check out the recursion of that idea, baby.

If you mouse over the part of the screen that displays where you've moved your mouse... incredible things happen! Time folds back on itself, wormholes of destiny send ripples across the sea of causality, and, with a bit of luck and just the right settings you can produce Sierpinski like patterns.


(Still images do these things no justice. They are growing shapes that respond to your movement. The optimal settings are '2 * magnification' with grid turned on.)

wave filter with blur filter

I wanted to experiment further, so I created an application (eventually a fleet of applications) using "Good Old" Windows Forms.

After tinkering for a few nights I had 4 applications that give 4 variations on the feedback theme.

I've open-sourced the code and the executables through CodePlex.

The applications are:

1. FractalFeedback

The first app lets you change the parameters that are used for the feedback, by entering values into a windows form.

2. Magnifier

The next app uses a slightly transparent form to produce a somewhat ghostly feedback effect.

3. PythonFeedback

As the name suggests, PythonFeedback lets you write python scripts that modify the parameters used for the feedback. A creative python dev (*cough*) could do wonders with this program, or variations on it.

4. FilterFeedback

This app lets you use an open-source library of text filters, AForge, for applying various types of rendering details.


Each of these taught me different techniques that I hadn't applied before, and if you give them a go you might have some fun too.

The AForge library was particularly cool, as it has filters for doing a lot of image filtering that you may need to automate at times. If I have a project where I need to clean up or modify images in any way, I'll reach for AForge.

So if you've got time for some "recreational programming" (or even if you don't...) download the fracBack code or binaries, and see what you can produce.

I've put a small image gallery online. If you create any interesting pics, please share

Oh, and any code I've released is of 'recreational quality' which is... well imagine how bad typical 'Enterprise' code is... then divide that by ten. Seriously. It's that bad.

And lastly, it's great to see how far CodePlex has come in the last few years. I gave up on them several years back, and used 'code.google' in the interim, but CodePlex has come a long way. We put the TimeSnapper plugins at CodePlex, to test the waters, and found it much improved. What impresses me most is that the mercurial support they now offer is not just a bridge to TFS, but is actual mercurial hosting.

Summary: Recreational programming. Love it.

Read On...


Fri, 09 Apr 2010 04:06:52 GMT

Hump-Jumping: How the Education of Computer Science can be Saved, err, maybe.

In a paper called 'The Camel has two humps' the authors described a test which can be applied to students before they've begun a computer science course, and can fairly accurately predict those that will do well and those that will not.

I've never agreed with their summary of the results.

They say they are dividing:

"programming sheep from non-programming goats"

...which implies the differences between pass and fail are as pronounced as speciation. That's a big claim and well outside the scope of their research.

And I think they misrepresent their study when they say:

"This test predicts ability to program with very high accuracy before the subjects have ever seen a program or a programming language."

...as, crucially, their study failed to check whether the students "had ever seen a program or programming language."

(Unless I'm misinterpreting this sentence from the paper, taken verbatim:

We believe (without any interview evidence at all) that they had had no contact with programming but had received basic school mathematics teaching.

... I've written to one of the authors to seek clarity.)

I asked Alan Kay for his opinion, when he commented here on a different topic -- he was very kind in providing a lengthy and thoughful answer.

His opening phrase really sticks in my mind:

"They could be right, but there is nothing in the paper that substantiates it."

Then, this morning, I saw a fresh comment at that article, from David Smith

"If there were a definitive test of ultimate programming capability I could apply on the first day of class, what would I say to those who 'failed'?"

Which presents a very human response to the topic from an educator directly affected by it. And I don't have a sufficient answer to that.

But a different approach to the whole problem has occurred to me since:

Let's suppose that this test is indeed an accurate test of those that will and won't succeed in computer science 101.

We put aside all worries about what biases or inconsistencies the study might have. Just accept that the test is effective. Stick with me here.

So we give the test to all students before they start Computer Science 101. At the end of the subject, we see that, as predicated, those that do poorly in the subject tend to do poorly on the pre-test. But instead of looking for correlation, what if we looked for outliers?

Which students did poorly on the pre-test, but did well in computer science? Those are the students with the most to teach us. Why did they buck the trend?

Okay, so maybe some of them cheated. (I remember a high incidence of cheating in early computer subjects I took; particularly amongst those who didn't continue in the field.) And maybe some of people deliberately blew the pre-test, even though they did well at the subject.

But once we find the genuine hump-jumpers, we focus on what it was that helped computer science 'click' for them. Did they find there were specific misconceptions they had to overcome? Did they have extra-tuition? Were there specific problems that helped them get their thinking in order? Was it just hard work? And, regardless of the answer, would they like to become tutors next semester, specifically working with those who perform poorly on the pre-test?

It might be necessary to look at a lot of such hump-jumpers before useful lessons emerge. It might be that every one of them has a different story to tell, there's no common pattern. (As Tolstoy said in his Turing Award speech: "Happy programmers are all alike; but every unhappy programmer is unhappy in her own way.")

So that's my answer for David. I don't know what you could say to those who fail the pre-test. But I think that over time a good pre-test could be used to develop new and better teaching methods, and maybe that's the best we can do.

Read On...


Thu, 25 Mar 2010 03:47:44 GMT

Suggested User Experience Improvements for DiffMerge

Frankly, I'm kind of a ninja-Buddha-wizard at the UX.

Perhaps you are familiar with my ground breaking work with "Console.ForegroundColor = ConsoleColor.Red" and other visual sensations.

As such I am uniquely qualified to provide suggestions for achieving incremental benefit to the User Interface of tools in the marketplace.

One of my favourite little free tools is 'DiffMerge' from Source Gear.

This is a file-difference tool that I consider to be a step or two better than the other free diffing tools on the market.

Here's the toolbar from DiffMerge. Look at the last three icons:

DiffMerge toolbar as is

There's a "foolish consistency" here: all three have the same green arrow, pointing in different directions.

But the nature of those three buttons is not consistent. Up and down are purely navigational elements, while the 'left to right' arrow is for pushing changes from one document to the other.

In buddhist terminology we say that their Qi is mis-chimed.

As such, I think that the colour of that arrow could be changed to provide a little warning of the power of this button.

DiffMerge toolbar minor change

To really take this up a notch, I'd go even further. That's right. You thought the first change was pretty extreme.

I'd put a separator in there, to give the left-right arrow a little space of its own. This is the UI principle of 'Proximity' - I don't have time to explain it to you kids right now, but UX-buddha's like me, we get funky with proximity all the sweet time.

Further more (and this is where I really trip out on the UX-pixie-dust) I'd do something tricky with the 'Save' icon.

If and when the file on the right is 'changed,' I would like to see a little red/orange highlight given to the save icon, to give some more "visual weight" to this element. (Currently it goes from slightly grey, to black... it's perhaps a little too subtle)

DiffMerge toolbar minor change #2

There you have it.

With a few light touches we've transformed the application. From something everyday and - dare I say - drab, we've dragged it kicking and screaming into the wild and crazy future.

Welcome to the twenty third century, DiffMerge.

That's how we kick it: UX-Buddha-style.

Read On...


Fri, 12 Mar 2010 10:16:12 GMT

SQL Style Extensions for C#

(Is this serious? If you can work it out, please tell me. In any case, it's inspired by the fact I've been doing more SQL than C# lately)

Are you addicted to SQL? Are you uncomfortable whenever you have to use pesky imperative languages like C#?

Now you can use your favourite SQL functions inside C#, with the amazing new "SQL Style Extensions" class!

Need to know if a value is in a short list of constants?

In SQL you'd simply write "where State in ('QLD','NSW','VIC')" – but, until recently C# forced you to write:

if (State == "QLD" || State == "NSW" || State == "VIC")

But now -- thanks to the aMAZzing new 'SQL Style Extensions' -- you can simply write:

If (State.In("QLD","NSW","VIC"))

... then close down the IDE and get back to your Entity Diagrams in no time!

Do you miss the power of LIKE matching?

Miss it no more!

With SQL Style Extensions you can write:

If (Firstname.Like("Fred%")) and find all your Freds, Fredericks and Fredas in one powerful line!

Buy now!! <-- for added effect, imagine that text is blinking. I... just... couldn't... bring myself to apply a blink tag.

This is just a taste:

    using System.Linq;
    using System.Text.RegularExpressions;
 
    static class SqlStyleExtensions
    {
        public static bool In(this string me, params string[] set)
        {
            return set.Contains(me);
        }
                               
        public static bool Like(this string me, string pattern)
        { 
            //Turn a SQL-like-pattern into regex, by turning '%' into '.*'
            //Doesn't handle SQL's underscore into single character wild card,
            //        or the way SQL uses square brackets for escaping.
            //Note the same concept could work for DOS-style wildcards (* and ?)
            var regex = new Regex("^" + pattern
                           .Replace(".", "\\.")
                           .Replace("%",".*")
                           .Replace("\\.*","\\%")
                           + "$");
	
            return regex.IsMatch(me);
        }
    }

(Actually, that's the whole thing.)

(If you do use this, you might want to improve that regex. Testing was... rudimentary.)

Read On...


Wed, 10 Mar 2010 09:55:31 GMT

The Movie Hollywood (And My Wife) Doesn't Want You To See: Weekend at Jacko's

Other working titles: 'Weekend at Michael's', 'Weekend at Jackson's', 'Weekend at Neverland', 'Wacko Weekend'

So this is a movie idea for which JoCo Loco really deserves the blame, so please redirect the hate mail in his direction this time thank you very much.

Opening:

Newspapers spin out, announcing the tragic death of Michael Jackson. Fade to black and our subtitle reads '4 weeks earlier.'

Sound of an old-timey radio announcer telling us that Legendary Musician Michael Jackson has announced a special prize: there are 8 golden tickets hidden inside 8 lucky copies of his new album. The 8 very lucky little boys who find them will be able to spend one magical weekend at Michael's Neverland ranch, chaperoned by the man himself.

you know the feeling

Just before the lucky winners arrive, Jackson suffers a heart attack and falls down dead. After all the publicity that the golden tickets have created, his minders are desperate to go ahead with the lucky weekend, so they prop him up, "Weekend at Bernie's" style, determined that a setback like this won't stop Michael from being the perfect host.

As I've demonstrated on numerous occasions, a high quality premise is all one needs and 'The Self-Writing Script' takes care of itself thereafter.

Other scenes include:

Whenever the minders get too tired, they throw Michael onto the neverland roller-coaster for a couple of hours.

One particularly touching scene has Jackson (well, corpse-of-Jackson) sitting on a park bench, rather stiff, while a whistful pet gorilla, (Bobo number 2?) reaches an arm around him and gives him a long sad hug of farewell. Violins. Not a dry eye in the room.

Actual Corpse of Jackson, 
 appearing in the big musical finale

And the big musical finale is an awesome recreation of the zombie dance from Thriller.

Note to self: could the actual corpse of Jackson be used in the film? It would be great to see him dance one last time. Moonwalking, for example, would be easily achieved with pulleys and string.

No doubt, the whole thing is narrated by a drunk and somewhat angry zombie hamster.

Or, to put it another way, here is an image ive been meaning to use for a while now

Read On...


Tue, 02 Mar 2010 22:30:56 GMT

Sysi: the ultimate administrators toolkit

I saw a typo in a magazine where someone referred to SysInternals as 'Sysinternal' (singular... they left the 's' off the end)

Take control of Windows with Sysinternal, the ultimate administrators toolkit

And this gave me a random idea: what if SysInternals provided a single tool, called 'Sysinternal'.

richard pryor

And it does everything. Just everything. Like the computer that Richard Pryor's character builds in Superman III. Got it?

So I told JoCo Loco this idea -- and he'd sweded up a Compleat Design within seconds:

SysInternal is a console app. The first parameter is the name of the specific SysInternals tool you want to use. The remaining parameters are passed to that tool.

You don't need to have all the tools from SysInternals on your machine already. SysInternal will get what's needed, by downloading from Live.Sysinternals.com.

Sysi.exe: ladies dont know bout my console colors

And if you pass the parameter "-?" (or no parameters) then it will screen-scrape Live.SysInternals.com to tell you all the available tools.

I quickly found that the name 'SysInternal.exe' was too long to type out, so I shortened it to 'Sysi.exe', pronounced Sissy. Hopefully this also stops me from violating their trademark. (Mark Russinovich is not a Sissy. Chuck Norris wishes he was Mark Russinovich)

I've released the code on CodePlex, at sysi.CodePlex.Com.

Go get it!

Download sysi right now

Read On...


Mon, 22 Feb 2010 09:47:48 GMT

Movie: Priest Academy

As you may know, I spend the hours from 2:15 am until 3:16 am each day putting the finishing touches on a series of racy, fun, and sometimes controversial big budget films that generally go on to make a major impact at the box office.

One of my recent film-ventures was red-lighted when a principal Cooney-investor relocated inter-state during a sensitive round of pre-production Ponzi-fund-bolstering.

Thus, I expect that various imitators are intending to bring their own cheap knock-offs to the screen to fill the public's unslated thirst. So as a pre-emptive strike, I've decided to immediately publicise the film's gobstopping premise in order to temporarily flood the global market for staggering ideas.

Here it is...the basic pitch for 'Priest Academy'

Premise:

Church attendance figures are woeful and the church is desperate to throw off its image as a sexist, racist, homophobic, straight-laced institution. So they throw away all entrance limitations and welcome a new generation of priests into their hallowed seminaries.

smoking nuns

Characters

The new class at the seminary would include:

  • a stripper
  • a hooker
  • a flasher
  • an arsonist
  • a horse who can count
  • a monkey with a taser
  • someone who seriously wants to become a priest
  • a huge guy
  • a flatulent dwarf
  • a buddhist monk

Okay. That's all you need to know. The rest is elementary: the angry bishop, the drunk old lecturer-priest, the misbehaving nuns, the homily-challenge/smack-down, the confessional-punch-up, the fire in the bell-tower, the frankinsence fight, the smashing-through-stained-glass-windows, the whole thing. Done. It Is Written. Word.

Read On...


Fri, 19 Feb 2010 09:55:31 GMT

Inspirational Rat Story

I gave a rather inspiring speech at standup yesterday, and I think I ought to record it for posterity, so it can (eventually) make its way into one of those 'inspirational speeches of world history' type books you see in the bargain tables out the front of third-rate book shops.

Remember that the idea of 'standup' is to tell your colleagues what you did yesterday, what you intend to do today, and to call out anything that's blocking you.

Here's what I said. (True story, by the way.)

rat pipe

Picture a rat crawling through a sewer pipe. The pipe is dark and endless. It stretches out in front of him, endless darkness, and behind him, a long, endless tunnel of darkness. The rat has been crawling for so long that he no longer knows which way he is going; time seems to have stopped and he is no longer certain that he is moving forward at all. His foot slips against the slimy side of the pipe and for one moment he falls asleep, and while he sleeps he dreams that he is a software developer working on this very project. Standing here. Talking to all of you. He wakes up a moment later, realises he is back in the sewer pipe and his body glows with a tremendous feeling of relief. It's a beautiful moment.

Read On...


Sat, 30 Jan 2010 09:54:48 GMT

A face-melting DSL that allows programming ON the iPhone (and iPad)

Some fools say you can't program on the iPhone.

I'm not talking about programming for the iPhone -- I mean sitting down with just your iPhone and using that device to bang out a new program.

Why not I say?

Fools (and people much smarter than me) are stumped because they point out that the hardware has restrictions which disallow the conversion of data (such as the programs you type) into executable code. And thanks to this deliberate hardware limitation you categorically cannot program on the iPhone. You run apps, not write them. That's what they say.

But -- it has a browser. A browser.

A BROWSER! Don't you see?!

I'm reminded of that bit in Harry Potter and the Goblet of Fire, when harry says he doesn't know how to win the dragon ball Z challenge, against a REAL dragon.

What are you good at? asks Professor Moody,

I'm good at flying, whines Harry, but I'm not allowed a broom.

Moody flares his nostrils and shouts You're allowed a wand!!

You see, if you are allowed a wand you can use it to get any other damn thing you want. So he uses the wand to get the broom and uses the broom to win the challenge. QED.

We're not allowed to program, but we are allowed to "browse."

With a browser we have javascript and with javascript we have:

ULTIMATE AWESOME!! This kind of awesome:

very awesome. and a ute in a tree.

So I've built a simple domain specific language, which emits javascript targeted at the iPhone. Via which you can build apps for the iPhone, without resorting to a regular computer.

More to follow in part 2 of this 3 part series with a bitter, tragic end.

(a short advertisment for part 2 of this series now follows, as requested by my angel investors)

Part 2: IT WILL MELT YOUR FACE

A simple domain specific language, which emits javascript targeted at the iPhone:

Will it really melt your face?

Let's see what gas-mask girl has to say:

gas-mask girl says it will melt your face

And how about Jeff Atwood, what does he say:

coding horror says it will melt your face

So, from a scientific point of view, the assertion is proved.

Stay tuned for part 2.

Read On...


Thu, 28 Jan 2010 09:14:33 GMT

The secretGeek Disaster Recovery plan

Jeff Atwood suffered a 'total data loss' of his blog. And here is how 90% of the world's bloggers slept that night:

a pleasant nights sleep

Immediately thereafter I cracked open the box labelled 'the secretGeek Disaster Recovery plan' and inside I found only an empty biscuit wrapper and a few stale crumbs.

So, after many hours of labour, I present:

The revised SecretGeek Disaster Recovery plan:

Every Sunday night, at 10pm, syncback fires up and downloads the contents of this website onto my most reliable home computer. If the computer is asleep, it wakes up to perform this task.

When syncback is finished, it uses powershell to tweet that it's done. It twitters to a single-purpose account that no one else need follow but me ('secretGeek_bkup').

Every night, syncback wakes up the local computer and copies all of the family files (documents, photos, code and websites) onto external media. These are rotated fortnightly to an offsite location. We're prompted to do this by scheduled tasks in windows.

The most fun part was getting syncback to tweet -- so I want to share that with you here.

I used the script Out-Twitter.ps1 -- from Jeffrey Hicks of Sapien, with some cheap hacks I've added.

Jeffrey's original script was very clever. It stored the credentials (the username and password) in a very secure 'best-practice'-oriented way. But that bit of the script kept exploding for me, so I threw it out. Since the twitter account I'm accessing is very low value (it exists for one purpose only) I'm happy to hardcode the username and password into the script. A compromise like that is the sort of corner cutting upon which enterprise thrives ;-).

syncback configured to run

Here's the exact callout string I put into syncback.

powershell -command " 'backup complete (secretGeek) @secretGeek' | out-Twitter "

Getting the quotes just write was by far the most annoying part. Followed by getting the firewall to play nice.

What's your backup strat? And did the coding horror blogapocalypso inspire you to make it better?

Also -- this just in: an authentic photo of Jeff, taken at the moment he first realised his VM wasn't coming back:

coding horror says you should get a backup

Read On...


Sat, 16 Jan 2010 10:02:08 GMT

Save KNVTn! Before it's too late

You know, I'm more that a little worried that the works of KNVTn will be lost in time, and historians of the future will have no record of this brilliant thinker.

the works of KNVTn

Possibly the only genius who can challenge the genius of KNVTn is that master of computer science, DE |(nuth.

that master of computer science, DE |(nuth

Unlike thinkers of bygone eras, I guess KNVTn and DE |(nuth are lucky that they live in an era where the marvels of OCR technology can be used to perfectly preserve their works for all time, without their mighty shadows being usurped by popularist hacks, like that pretender Knuth and his ilk.

Read On...


Wed, 06 Jan 2010 09:16:41 GMT

The Ultimate Agent of WERF Destruction

CreditCardOlogy: What do the numbers say about you?
This guy knows it. Do you?.

Joseph Cooney and I were talking about the incredible revenue monster that is Balsamiq, a tiny software company which brought in over a million bucks last year. As such, the conversation soon turned to a lament for the paltry stipend that our own ISV's tend to bring in.

Pretty soon, one of us hit on a terrific winner of an idea, which you will see is far superior to any other possible money making venture, as it brings about exactly the right behaviour in people.

What one needs is a way to get the customer to take the wallet out of the pocket, and the credit card out of the wallet.

These are difficult steps with which potential customers are reluctant to demonstrate sufficient compliance.

Some products -- balsamiq being a great example -- seem to have a tremendous 'wallet-appeal'. After just a minute or two of testing that baby out, people realise this product will help them kick ass, and their WERF falls to almost zero, while their CCED rises to 100%. (WERF: Wallet extraction reluctance factor; CCED: Credit Card Extraction Desire)

So, Joseph and I devised a product of our own that has (I humbly submit) a better WERF curve, and a superior CCED factor than all your balsamiqs. And the time to market has been astounding: I time-boxed the development at 1 bus ride, and pretty much met this criteria.

So, here's the new product, I proudly present:

CreditCardOlogy

A big thanks to Mr Crazy Grumpy Smurf for agreeing to be the mascot of this little link out.

Web template from Ginger the Ninja of Open Source Web Design (OSWD).

Real ideas coming soon.

Read On...


Hey good looking!

click here to visit the secretGeek archives!

Go on... continue through to the archives


^Top

newest

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.
I went to write down a book name and founded an internet empire instead. I went to write down a book name and founded an internet empire instead.
NimbleText: Origins NimbleText: Origins
The Windows 8 Mullet The Windows 8 Mullet
Cosby: spontaneous striped background generator Cosby: spontaneous striped background generator
Slides from WDCNZ: Live Coding Asp.net MVC3 Slides from WDCNZ: Live Coding Asp.net MVC3
MVC 3, MVC 3, "Third Times a Charm" references
Custom Errors in ASP.Net MVC: It couldn't be simpler, right? Custom Errors in ASP.Net MVC: It couldn't be simpler, right?
Anatomy of a Domain Hijacking, part 2: The Website Who Came In From The Cold Anatomy of a Domain Hijacking, part 2: The Website Who Came In From The Cold
Anatomy of a Domain Hijacking, part 1 Anatomy of a Domain Hijacking, part 1
secretGeek.net domain has been stolen. The site may go down. secretGeek.net domain has been stolen. The site may go down.
Boring article: 'untrusted domain' issue with SQL Server. Boring article: 'untrusted domain' issue with SQL Server.
Coding While You Commute Coding While You Commute
Test Driven Dentistry Is A Good Thing Test Driven Dentistry Is A Good Thing
The 'less crashy' release of NimbleText The 'less crashy' release of NimbleText
Rethinking Toolbars in Visual Studio (or any IDE) Rethinking Toolbars in Visual Studio (or any IDE)
Where shall we have lunch? Where shall we have lunch?
Setting up email for your microIsv Setting up email for your microIsv
The NO Visual Studio movement: Compiling .net projects in Notepad++ The NO Visual Studio movement: Compiling .net projects in Notepad++
ZeroOne: the editor for programmers who think in binary ZeroOne: the editor for programmers who think in binary
Mercurial workflow for personal projects (with a .net bias) Mercurial workflow for personal projects (with a .net bias)
I see you're using vim. Let me fix that for you. I see you're using vim. Let me fix that for you.
The worst recruitment spam I've ever read The worst recruitment spam I've ever read
A thank you I forgot to say A thank you I forgot to say
My new product, NimbleText, is live My new product, NimbleText, is live
Grabbing the free songs of Jonathan Coulton (with Powershell) Grabbing the free songs of Jonathan Coulton (with Powershell)
Using NimbleSet to compare lists Using NimbleSet to compare lists
Wanted: Wiki Lists (dot org) Wanted: Wiki Lists (dot org)
DOS on Dope: The last MVC web framework you'll ever need DOS on Dope: The last MVC web framework you'll ever need
JSON Query Languages: 5 special purpose editors JSON Query Languages: 5 special purpose editors
What then, is b? What then, is b?
SQLike: A simple editor SQLike: A simple editor
Yet Another BizPlan Generator. Yet Another BizPlan Generator.
HOT GUIDS: A hot or not site for guids HOT GUIDS: A hot or not site for guids
How does life get better? One tiny hack at a time. How does life get better? One tiny hack at a time.
24 things to do, and 100 things *not* to do (yet) for building a MicroISV 24 things to do, and 100 things *not* to do (yet) for building a MicroISV
Venture capital won't kill Jeff Atwood, it will only make him Jeffer. Venture capital won't kill Jeff Atwood, it will only make him Jeffer.
A handy workflow image for newbie mercurial users A handy workflow image for newbie mercurial users
Fractal Feedback, a diversion into recreational programming Fractal Feedback, a diversion into recreational programming
Hump-Jumping: How the Education of Computer Science can be Saved, err, maybe. Hump-Jumping: How the Education of Computer Science can be Saved, err, maybe.
Suggested User Experience Improvements for DiffMerge Suggested User Experience Improvements for DiffMerge
SQL Style Extensions for C# SQL Style Extensions for C#
The Movie Hollywood (And My Wife) Doesn't Want You To See: Weekend at Jacko's The Movie Hollywood (And My Wife) Doesn't Want You To See: Weekend at Jacko's
Sysi: the ultimate administrators toolkit Sysi: the ultimate administrators toolkit

Archives .: secretGeek :: Complete Archives
TimeSnapper -- Automated Screenshot Journal TimeSnapper.com    
Version 3.3: true productivity boost

Next Action NextAction
Managing the top of your mind

NimbleText -- World's Simplest Code GeneratorNimbleText -- World's Simplest 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
PC Smart Buys - Computer Hardware in Australia
home .: about .: sign up .: sitemap .: secretGeek RSS .: © Leon Bambrick 2006 .: privacy

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