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.

 

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.

 

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.

 

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.

 

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 '.{1,1}',
            //        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.)

 

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
 

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
 

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.

 

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.

 

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.