Undo, redo, predo, preundo

Undo and redo are nice, but what i'd like to see is: Predo.

Undo provides a way to reverse what you've just done.

Redo is a way to unreverse what you've just undone.

Predo will be a way to do what you've not yet done.

And preundo would be a way to avoid doing what you've not yet done.

 

A little "bit" of programming therapy

I have a new habit that I enjoy, even though I am certain it is getting on the nerves of my colleagues.

Whenever I find a bug in a piece of logic I've written -- whenever I find I've used || instead of && or left out a !, I shake my fist at the sky and shout, at the top of lungs, "Damn you George Boole!"

Try it. Very therapeutic.

(actually I kind of whisper it under my breath most of the time)

 

Behavior Driven Development: As Human As Possible

I've been intrigued with everything I've read about "Behavior Driven Development" -- which is essentially a friendlier face on Test Driven Development.

For beginners like me I think the most obvious concept is that BDD = Test Driven Development Plus "natural sentence style test naming" as JP Boodhoo calls it.

For example, David Laribee gives examples where Tests and test fixtures are simply renamed according to a strict pattern, like this:

namespace Specs_for_TransactionElection
{
[TestFixture]
public class When_an_election_is_started : Spec
{
private ITransaction _stubTransaction;
private TransactionElection _election;

[Test]
public void The_result_should_be_in_progress()
{

Assert.AreEqual(_election.Result, TransactionElectionResult.InProgress);
}
}

The upshot of this is that the tests in the code runner read like a restricted-subset of plain English:

Behavior Driven Development example from Resharper

Some people, including David Laribee and Ryan LaNeve have said that the output of these stories could be improved to present a more human-readable form.

What i'd like to see is a better looking code runner.

The treeview control itself should present a "Friendlier" form of those names -- underscores could be converted into spaces. Larger fonts could be used for sub-headings. And the larger headings should be in lower contrast colour, so you can fade them out when you want to.

Here's a dodgy mockup:

Specifications for Transaction Election passed When votes are cast: passed A single no vote should rollback the transaction.passed A no vote will leave the election with a finished and voted no status. passed Unanimous yes votes will commit the underlying transaction.

The point here is that I'm not talking about improving the output of the unit test tool -- for example the 'Dox report generated by the MbUnit GUI runner' (as Ryan LaNeve has demonstrated)-- I'm talking about changing the runner itself so that it directly cleans up the names of the tests and fixtures for presentation.

It could even report on "Convention Breakers". (Squiggly red underline perhaps).

(side note: matt calla provides a macro for doing the exact opposite of this.)

(Other side note: is this similar to Donald Knuth's idea of literate programming?)

 

What To (Really) Do If You Find Out Your Parents Are Using Vista (redux)

I probably owe Vista an apology for that previous slurring. I started out wanting to say something else altogether, but once that idea had occurred to me, I found it irresistable ;-)

So here's the real story: My Parents Bought Vista. Shocking, yes. But it's not the end of the world. I'm here to tell you there is Life On Vista.

Here are practical tips for how to deal with Parental Vista Use.

  1. Remove OEM Junk
  2. Good children don't let parents run as admin
  3. Set their hard drive free!
  4. A digital Camera without a backup strategy is a loaded handgun without a safety switch
  5. No Aero for You!

Remove OEM Junk

First thing to do is to identify any OEM crap that the vendor will have bundled on there. I had to delete a bunch of Compaq nonsense and then kill a trial-copy of Norton Anti Virus (NAV).

Norton Anti Virus: just say no.

If you want to run anti-virus software, you want AVG.

But also... maybe you noticed that Vista has a very heavy-handed security model of its own, nothing like the "run anything" hey day of windows in previous eras. So maybe it occurred to you that anti-virus software is not such a necessity on Vista as it was on previous Windows Operating Systems.

In a way, using anti-virus software and UAC (User Account Control) at the same time, reminds me of the old saw about the Irishman who wore two condoms: "to be sure, to be sure."

So I think you ought to choose: UAC or AVG.

But the dumbest choice is NAV plus UAC.

While you're at it, check for any unwanted startup programs (run "msconfig") and see what services are set to start automatically.

Good children don't let parents run as admin

Remember the crazy times back at the turn of the millennium? The default SA password for SQL Server was [blank] -- and every man and his hound ran as admin?

Those days are gone, Jack, and it's time to reel your parents in. They ain't admins. They are guests on their own machine and they will treat it with respect, dammit.

If they have software that demands they run as admin... you'll stick that b*tch in a VM and tell it to shut the hell up. Capisco?

Should they need to elevate to admin to install some software... they will beg for help, explain their crazy predicament, apologise for their tom-foolery, and you will vnc onto their machine (with Fog Creek CoPilot, TeamViewer or some other remote assistance tool) and do the necessary.

Set their hard drives free!

Two tips here:

  1. Turn off Indexing
  2. Enable advanced performance (on SATA drives)

Indexing is turned on by default... and it's a heavy tax your parents don't need. In some crazy scramble to catch up to google, and to make up for their past failures in hard drive searching, they want to bring your hard drive to its knees permanently, so that the one time you search for something, there will be a plethora of irrelevant results presented imeediately and without pause. Turn off indexing. Really. Your mother don't need it.

She doesn't even need indexing on her email. If she does have a big pst file that she wants to search, she will operate differently to you and I. She'll carefully craft her search, and then, while the search is running she'll make a nice hot cup of tea. Time is different for each generation.

If they have a SATA disk in their Vista machine... the setting Enable write caching on the disk is enabled by default on SATA disks in Windows Vista, but the second setting Enable advanced performance is not enabled by defaultEnable Advanced Performance

  1. Click Start, right-click on "Computer" and click "Manage" (you may get a UAC prompt here)
  2. Select "Device Manager", and expand the node for "Disk drives"
  3. Right-click on their primary hard drive, and select "Properties"
  4. Go to the "Policies" tab, and make sure "Enable write caching" on the disk and "Enable advanced performance" are both selected.
  5. Hit OK, close Computer Management

This can allegedly allow you to lose data if the power goes out suddenly. Yet some people have used it for years without incident. I consider it safe enough. You be the judge.

A Digital Camera without a backup strategy is a loaded handgun without a safety switch

Say it with me, say it loud:

A digital camera without a backup strategy is a loaded handgun without a safety switch

But what have digital cameras got to do with helping parents use Vista?

Because the same parents who go out and buy themselves Vista without understanding the repercussions are the exact kind of people who purchase a digital camera on a whim.

So generally a child who has one of these problems also has the other. I think.

So for this one, I urge you to read Scott Hanselman's excellent article, On Losing Data and a Family Backup Strategy.

No Aero Glass for You!

There's nothing for you to do in this step, just something to be aware of.

Vista Home Basic doesn't support the Vista Aero theme. Maybe you knew that already, but it had slipped by me, and I was baffled why it wasn't available, wasting time to trying to work out what was so bad about their machine that it didn't give Aero as an option.

Turned out that their hardware was plenty good enough. But the stingy buggers in the shop had pulled a swift one on the poor dears and given them the criminally downscale poor cousin of vista -- the Suburban Ghetto edition.

Apparently it's an easy registry tweak to get around -- but I haven't tried it as yet.

The history of why this version exists is a kind of unholy alliance between sellers of substandard hardware and mercenary-cannibals from the camels and rubber duckies sect of capitalism. There's a lawsuit in the US.

But I digress.

There is life after a Vista install.

You don't need to upgrade to XP.

And there are even some features of Vista I like. ([Alt]+[Up arrow] to move up a directory in explorer, amongst others)

 

What To Do If You Find Out Your Parents Are Using Vista

Look at it. Recognize it. Your parents wellbeing could depend on it!

First, take a deep breath...

You're not a failure as a child. You're not helpless. And you're not alone.

If you think you're a failure, consider this: There are many parents with neglectful kids, who never use Vista. There are also parents with seemingly model children who do use Vista.

As a child, it is your job to look after your parent's technological well being. But even the most responsible child cannot monitor their parents 24 hours of every day. A loving child will gives their parent as much freedom as possible.

Unfortunately, there are many pushers out there, just waiting to get your parents habituated to Vista. These people have infiltrated our computer shops. The sad truth is that many computers available on the market today are already spiked with deadly Vista. Parents are being lured with tales of Aero Glass and Safer computing. Too many of them are incapable of seeing beyond the lurid and gratuitous sales pitch. Before long they are waking up to reality, with a Vista Home Basic installation, and a raging does of other OEM tricks, like Norton Anti Virus and Microsoft Works.

So the first thing to accept is that Vista, while indeed dangerous, is an unavoidable problem for your parents to deal with. And they'll do it better and faster if you're aware, involved and don't stick your head in the sand.

THE AWARE CHILD HAS THE SAFEST PARENT

Part of awareness and a major deterrent to experimentation is to talk to your parents about Vista.

But even with a lot of your involvement, there are no guarantees. So it's important to know the symptoms of Vista use and to take action if you see your parent displaying them.

They may develop chronic constipation
or diarrhea, and just seem tired
and lethargic all the time. They may
have trouble remembering things and
forget something you told them
just a few minutes earlier.

THE WARNING SIGNS

There are no symptoms that are absolutely reliable. But there are clues.

Most of these symptoms tend to be gradual which is why your awareness is so important.

Don't jump to conclusions, but do investigate any suspicions you have as fully as possible. Trust your intuition.

Many of the warning signs for Vista use are the same as those for depression or for the ups and downs of being an ageing parent in a world gone technological. There's also the possibility it's a physical or emotional problem.

But whatever the problem, we're talking about a parent who needs help. Right now.

START WITHIN THE FAMILY - BUT DON'T WAIT TO GET HELP IF THERE IS A PROBLEM.

Nothing beats the power of love and family support. That has to start with frank discussion.

Don't make it an attack. And don't try to talk with your parent if he or she seems under the influence.

Wait for a calm moment and then explain that you're worried about a certain operating system (be specific) and give your parent every opportunity to explain. That means really listening, not doing all the clicking.

Use "I" messages -- sentences that start with "I" -- explaining how your parent's Vista use affects you and your community.

At the same time, it's important to speak frankly about the possibility of Vista. And it's particularly important to talk about your values and why you're dead set against Vista for them at this time.

If your parent seems evasive or if his or her explanations are not convincing, you should consult your doctor or a professional operating system abuse counselor to rule out illness and to ask for advice.

In addition, you may also want to have your parent visit a mental health professional to see if there are emotional problems that either underlie or are caused by their Vista usage.

FURTHER ACTION IS PROBABLY NECESSARY.

Even if your parent seems non-responsive or belligerent, if you suspect Vista is involved, immediate action is vital.

First, you'll need an evaluation from a health professional skilled in diagnosing parents with operating system or office application problems. You may want to get involved with an intervention program to learn techniques that will help convince a Vista user to accept help. For the user, there are self-help, outpatient, day care, residency, and 24-hour hospitalization programs.

The right program depends entirely on the circumstances and the degree of Vista involvement. Here, you'll need professional help to make an informed choice.

Another point: If a program is to succeed, the family needs to be part of it. This can mean personal or family counseling. It may also involve participating in a support group where you learn about co-dependency and how not to play into the problems that might prompt further Vista use.

If you don't know about Vista reduction programs in your area, call your family doctor, local hospital or county mental health society or retirement village counselor for a referral. You can also call the national helpline for advice and a referral or investigate twelve step programs in your local capital city.

WHATEVER YOU DO, DON'T GIVE UP

That parent who upsets you so much today is the same dear parent who, only yesterday, raised you and looked after you. They're in way over their heads, and they never needed you quite as much as they need you now.

No matter what they say.

(This cautionary tale owes a debt of gratitude to 'what to do if you think your child is on drugs')

 

Sample Code From Text-Adventure Game Platforms

I'm using the occasional snippet of spare time I don't have to write a 'platform' for constructing Wiki-based Adventure Games (more). It's a kind of -- and I shiver in horror at the term -- a Domain Specific Language.

So, when you're inventing a Domain Specific Language for writing Wiki-based Adventure Games... I guess it's a good idea to acknowledge:

a) You're gonna suck at it and

b) it's been done before.

So, I guess it's time to consult the classics.

Thanks to a post from _why, i've learnt about Scumm, the Script Creation Utility for Maniac Mansion.

Here's a snippet of ScummC provided by _why:

object carolObj {
name = "Indigenous lifeform";
verb(int vrb,int objA,int objB) {
case TalkTo:
zobTalkToCarol();
return;
case LookAt:
if( ! knowsCarol ) {
egoSay("A large carbon based mammal, it seems.");
waitForMessage();
}
else {
egoSay("It is Carol, one of the local lifeforms.");
waitForMessage();
}
return;
case Smell:
egoSay("This creature has an overwhelming pungent smell.");
return;
case Move:
egoSay("The lifeform is surprisingly sturdy, I don't believe I can use force.");
return;
}
}

Well that's very nice.

Sierra

Now, how about that megalith of adventure games from the 1980s, Sierra Online?

Sierra used an interpreter called AGI (adventure game interpreter) to make such classics as Leisure Suit Larry and King's Quest.

(Leisure Suit Larry is a kind-of formative game for my entire character and personality. In case you didn't realise this, I thought I'd spell it out now.)

Here's a code snippet:

if (said("look","door")) {
if (posn(ego,0,120,159,167)) {
print("These doors are strongly built
to keep out unwanted visitors.");
}
else {
print("You can't see them from
here.");
}
}

(example from: Making adventure games with AGI)

GrimE

GrimE is a game engine written in scripting language LUA, touted as "the successor to SCUMM, preserving some of that engine's features" (according to the big 'pedia.)

I haven't found a sample or a good starting resource -- so if you find one, please send it along.

Agast

Also under the wikipedia category of Adventure Game Engines, I found AGAST

Here's a morsel of agast scripting...

"For example, here's an event that is triggered when the player looks at his goldenmop:

event Lookat <> GoldenMop
{
EGO:
"It's my trusty golden mop."
"I got that years ago for saving the galaxy."
}

(later)

var TalkedToGiantLizard;

event Talkto -> GiantLizard
{
if TalkedToGiantLizard {
"Since he won't talk to me, I won't talk to him either."
}
else {
"Hi up there, Gozira!"
delay 10;
"He probably can't hear me, or he doesn't speak English."
TalkedToGiantLizard = true;
}
}

Wintermute

Wintermute (from dead-code) -- how awesome.

Here's an example of scripting for wintermute, (taken from here)

on "first"
{
Game.Msg("Do something after the first choice.");
}

on "second"
{
Game.Msg("Do something after the second choice.");
}

on "third"
{
Game.Msg("Do something after the third choice.");
dlgObject.removeIcon("second");
}

ZIL

Zil? Zork Implementation Language of course! What else would you implement Zork in?

And it's time for lisp-like languages to bring a close to this article ;-)

Here's what the definition of the Living Room from Zork I looks like:

<ROOM LIVING-ROOM
(LOC ROOMS)
(DESC "Living Room")
(EAST TO KITCHEN)
(WEST TO STRANGE-PASSAGE IF CYCLOPS-FLED ELSE
"The wooden door is nailed shut.")
(DOWN PER TRAP-DOOR-EXIT)
(ACTION LIVING ROOM-F)
(FLAGS RLANDBIT ONBIT SACREDBIT)
(GLOBAL STAIRS)
(THINGS <> NAILS NAILS-PSEUDO)>

(from 'Zil [pdf]')

(And how's this for an intriguing name for a pdf [from the ZIL entry at wikipedia] "How to Fit a Large Program Into a Small Machine")

Okay. That's about all I wanted to share. I think the similarities and differences are telling. You see common concepts like "ego" and character manipulation. You see different styles.

I'd like to make some pompous over-reaching statement that text adventure games encompass every deep complex issue of software engineering. That a platform that allows efficient construction of games would need to be a shining example of superb software craftsmanship, with all the right buzzword compliance to drag our industry into a new era of productivity.

But I think Douglas Crockford (inventor of Json) distills the soul of a great computer game, in his very entertaining article 'The Expurgation of Maniac Mansion, :

  1. meet people,
  2. kill people,
  3. take their money,
  4. buy more weapons.

And, indeed, This is the chief pattern I want to enable with my wiki adventure game. Mercenary. Ruthless. Vile. And most of all: good clean fun.

My head is sore. I must lie down now.

 

TimeSnapper 3.0 -- an interactive, bubbling cauldron of possibilities

TimeSnapper 3.0 out now! This is the activity cloud

While the googles and microsofts have been touting their clouds and their meshes, we've been enhancifying the cloud capabilities of TimeSnapper. (And by "we" I mean my dilligent colleague Atli, who is the driving force on this one.)

TimeSnapper life analysis system

The TimeSnapper 'life analysis system' has finally reached version 3.0.

(Wondering what TimeSnapper is? Overview here)

This was a pretty solid overhaul, with many improvements under the covers (see release notes if you're detail oriented).

On the surface, the most important change is that the "activity cloud" (one of our reports) is now far more interactive.

Previously the 'activity cloud' was just a static word cloud, giving you an instant visual clue about what you've been up to.

Now it is an interactive, bubbling cauldron of possibilities. A self-organising mind map of your life.

Click on a word in the activity cloud to see a more detailed activity cloud, specific to that word.

click on a word to see extra detail...

(In the little screenshots at right, i've clicked on the word fogBugz, to see more detail about what i've been doing there, for example)

But here's what I like: the different ways to view your life are now converging into one seamless experience.

TimeSnapper has three main ways of viewing your life:

There's the day browser, where you watch a movie of your computing life. There's the reports, where you get a high level breakdown (including the activity cloud). And there's the 'activity grid' where you can search with more fine-grained criteria, and explore the results in a hierarchical grid.

Those three places are more integrated together than previously. You can travel through them, zooming in, ping-ponging back and forth. Learning what's really going on in your life.

click on a word to see extra detail...

Now you can view the word cloud report to get quick overview. Zoom into the word you're interested in. Click the 'View activity' link to open the activity grid, and see a listing, line by line of what you've done in relation to that word. Then double-click on any one of those lines to see the screenshots that were taken at the time (in the day browser).

(And if needed, right-click on that image, and extract the text from it, using OCR.)

You probably have to to try it to get it. For example, when Atli and I were reviewing these features, we shared a few screenshots during our discussions. And he immediately asked, "Oh, are you buying a Mazda?" Bingo. Your life in cloud form.

But don't be scared by this kind of power. You can password protect your data. And you can make it record only the apps you want. It's your life, just a better informed one.

 

 

Be warned: the laptop compubody sock is out there

wait until the wearer is clearly absorbed in their laptop activities before you approach.

If you see someone wearing this garment in a public place, my advice to you is simple:

Act swiftly. Move in silently and with great stealth. Bludgeon the wearer to death with a baseball bat. Step away, slowly.

You will be doing the human gene pool a tremendous favour.





(...alright, i ought to admit i'm not really a genocidal maniac, and the people at instructables are probably creative geniuses, DaVincis of the knitting world etc, who deserve some praise to accompany that ridicule.)

 

Everything that's bad for you is suddenly good for you!

In IT it seems that everything your lecturers once told you is bad and useless, turns out to be good and fruitful.

It's a reversal of the Woody Allen quote:

"Everything that our parents told us was good for us, turned out to be bad.

The sun. Milk. Red meat. College. Catholic girls."

(I'm deliberately paraphrasing)

For example...

We were once taught that dynamic sql is the path to poor performance and woeful security. And yet we now see that this is nonsense -- dynamic ORMs bring about increased performance and richer security models. Damn it!

We were once taught that permissive typing is bad and leads to buggy software. And yet we now see, with the rise of Ruby, Python and modern dynamic programming, the opposite is true. Permissive is expressive. Dynamic is productive.

We were once taught that significant whitespace is a relic of punch cards and poor computers, which all modern languages must eschew. Yet we now see that modern and future languages will support significant white space with a vengeance!

But most shocking of all!!

We were once taught that flat, wide, single-tabled denormalised data structures are the road to death, pain and -- worst of all -- slow, inconsistent data. Yet we now (maybe) see with google BigTable that in fact this is the future: this is faster and actually, sorry Jenkins, your rdbms is dead.

I'd love to be a stickler and a stalwart... but screw it. History is bunk. Bring out the learn!

And thus I'm left wondering... What else appears taboo and verboten? What else did our 'teachers' claim was 'bad' ?

Well - one thing was certainly frowned upon: the use of GOTO!

So....

I'M BRINGING HER BACK! WELCOME THE GOTO!

You may consider me a touch behind the times. But wiser heads will see me as preceding the curve.

What is a try...catch but a glorified JMP? (aka goto) Where would a switch be without an implicit goto, hey zooba?

What else do you see that's been besmirched too long? What other versatilities in IT have been marginalised far too long?

Bring out your dead.