Category Archives: Uncategorized

Setting permanent environment variables on Windows via command line

Some of our internal tools at work require a number of environment variables to be set to a variety of different options, depending on the project. This can be done with set, but that only changes the value for the life of the command shell you run set in. If stand-alone apps require those environment variables, they need to be set for the system. I used to be resigned to doing this by going to the System settings (via Control Panel or a right-click on My Computer and selecting Properties), selecting Advanced Options and clicking the Environment Variables button. The variables can then either be edited one by one in a tedious multi-dialog process, or new ones added in an equally tedious process. This is especially irritating if, like me, you would prefer to use the keyboard for most tasks.

But now the drudgery has been lifted – I have found setenv.exe! This terrific little tool allows user and system env variables to be set at the command line – so setting or altering the variables now becomes a sequence of commands like

setenv.exe -m NAME VALUE

I have no idea who wrote this tool, but whoever you are, thank you, from the bottom of my heart.

EDIT: I know who wrote it now – many thanks to Vincent Fatica.

Leave a Comment

Filed under computing, Uncategorized, windows_tricks

The atmosphere was electric!

jerith, voyager42 (Voyager below), Jonathan McKeown and myself had the most pun-filled conversation that I’ve had in ages over Jabber IM recently: here it is in marked up glory. Everything is related to electricity, software or both – if you get all the puns you’re as sad as the four of us are 🙂

Kim: from a recent facebook posting from a friend:
Kim: FirstGuy wants to be a transformer
Kim: Comment from SecondGuy: "You'll have to step up"
Jerith: Wrap a bunch of wire around him and apply a large current?
Kim: What a shocking thing to say!
Jerith: Doesn't my suggestion charge your enthusiasm?
Kim: well, it certainly has potential
Jerith: I'm happy to field questions...
Kim: on the current topic only?
Jerith: I'm not resistant to other topics.
Kim: well then, let's conduct an interview
Kim: perhaps I can induce you to let on more than you should
Jerith: I was about to suggest an inductance process for new partners.
Voyager: Make sure they're not bi-polar
Kim: sounds great - I'm amped about this idea
Jonathan: This conversation is rapidly exceeding my capacitance for puns
Jerith: Jonathan: That makes you an impedance to our plans.
Jonathan: Right that's it - I'm going ohm
Kim: Watt did we say?
Voyager: He hasn't the energy for this
Voyager: He should rather go home and re-charge
Jonathan: I'm going to do a volt-face and stay here
Jonathan: the atmosphere's dielectric
Voyager: Seems a bit static now
Kim: now you're alternating!
Jerith: Was that comment directed at me?
Voyager: That hertz
Kim: At least I only make such comments periodically
Voyager: Perhaps. It was a bit direct, currently
Kim: Imagine what RMS would have had to say
Jerith: Are we integrating him into this circuit now?
Kim: only discretely
Jonathan: he'd probably leave in a fit of pique-to-pique
Jerith: What LED to this decision?
Jerith: I'm sure we can rectify his errors...
Jerith: It should only require a half-wave on our part.
Voyager: Assuming he rates us highly.
Jerith: I thought diode more to his philosophical legacy than I actually do.
Jerith: So perhaps I should be insulated from that particular debate.
Jerith: Can you guys conduct it in my absence?
Kim: perhaps we should avoid such a debate - it can be quite polarising
Voyager: I understand. It may cut too close to the core for comfort.
Kim: little positive can come of it
Jerith: And certain parties have been known to oscillate wildly between viewpoints.
Kim: with remarkable frequency
Jerith: As has been made crystal clear already.
Jonathan: yes, not just two-faced but sometimes three-phased
Voyager: I prefer to be neutral in such situations.
Voyager: Apologies for the delay, my train of thought was just interrupted.
Jonathan: You should take the bus
Kim: that's often not on real-time though
Jonathan: Apparently it even has a bar - the bus-bar
Voyager: Not to worry, the Signal-to-Noise ratio is much better now.
Jerith: The power of public transport to damage schedules is unparalleled.
Voyager: Because it's all serial, not to mention last in first out.
Kim: at least the routes are fairly linear
Voyager: I will have to be excused...I'm getting an upgrade.
Jerith: And I must sadly return my energy to work matters. :-/
Kim: taking a break from this endless circuit?
Jerith: That was more pun than I've had in ages.
Jonathan: yes, you're all such live wires

1 Comment

Filed under geekery, humour, internet, punny, Uncategorized

Fame! (of an exceedingly moderate sort)

I have discovered that my poky little website ( hosts the top link in two related Google searches: “ack emacs” and “emacs ack”, both of which direct to a page listing the details of ack.el, which Voyager and I put together some time ago.

I’m just saddened that I didn’t put Google Ad Words or something like that onto it – I could have paid for most of a day of lunch at work (which is all of R8.50…)

More seriously, I didn’t have comments enabled, which I’ve now turned on – I wonder if I missed any kind of interesting discussion which may have ensued.

Leave a Comment

Filed under emacs, Uncategorized

Fixing the “loud channel” problem on a DSTV decoder

If you find some channels on your DSTV decoder have the volume set much higher (or lower) than the others, this might help you fix it:

Leave a Comment

Filed under Uncategorized

Fancy a chance to win some money for doing something charitable?

The North Durban Lions Club is launching a “100 Club” next month (July 2009) and participants are still eagerly accepted. For R25 per entry per month, your name goes into the draw for R1000 first prize, R300 second prize and R100 third prize. There is also a R100 prize winnable only by a participant present at the monthly draw, at 18.30 on the first Friday of the month. The other prizes do not however require attendance. All the proceeds go towards the club’s community service projects and charitable activities. Payment can preferably be made for 6 months up front (R150 if 1 number is taken) or monthly payments can be made.

Please contact me for details if desired.

UPDATE Sadly there were not enough takers to make the project economically viable, so it has been deferred to a later date.

Leave a Comment

Filed under Uncategorized

Next in the series of plaintive Delphi cries, one to (some of) the *users* of Delphi

To many of the Delphi developers I have encountered:

Please memorise the following: Format
Message := 'There are ' + IntToStr(numBunnies) + ' bunnies in the forest.' + #13 + 'That comes to ' + FloatToStrF(bunnyDensity, ffFixed, 4, 2) + 'bunnies per acre.';

Message := Format('There are %d bunnies in the forest.%cThat comes to %2.2f bunnies per acre.',[numBunnies, #13, bunnyDensity]);
See how much prettier that is? Please start using it. I beg of you.

Also, consider:
function FunctionNamedFoo: Boolean;
a function which returns a value. You can either place the return value of the function into the keyword variable Result or into the locally-scoped variable FunctionNamedFoo. As you write more and more functions, please decide on the style you prefer and stick to it. Please.

I personally prefer the FunctionNamedFoo approach, since it makes searching the source code much easier. My despair on this issue is however so great that I no longer care which you choose, as long as you choose but one.

Delphi developers I have encountered: Thank you for listening.
Everyone else: My apologies. I do feel better now though.


Filed under delphi, Uncategorized

A light morsel of advice

A word of advice: If you spend the weekend at a self-catering Drakensberg resort, you may decide to braai both your Friday and Saturday evening meals. If the braai stand is not lit, and you neglected to bring a torch, you may then decide to use your car’s headlights to illuminate the braai stand. You will then probably tell yourself to start and run your car for a few minutes the following day, to ensure the battery isn’t depleted if you use the headlights the following night.

If however you are really lethargic on the Saturday and you forget completely about starting your car, do not compound the error by forgetting that you forgot and using your headlights to again illuminate the braai stand on the Saturday evening. If you do this you may well find yourself sheepishly asking the reception if someone might be available to help you jumpstart your car, while your fiance tries very hard not to burst out laughing at you (with just cause).

This is of course entirely hypothetical, just a piece of advice I figured someone may need some day.


Filed under Uncategorized

A few nifty emacs features

I haven’t written anything in a while, and this isn’t a long piece of work either. I’ve been very busy at work, but I figured I’d share a few emacs tricks I discovered while being busy that helped make me a little less busy. I have hyperlinked various emacs functions for further information:

M-x fixup-whitespace

A very useful command that reduces the whitespace around point to a single space, or no space at all if that makes more sense contextually. I edit a lot of Delphi code, with emacs set to use spaces instead of tabs and provide pretty indenting. While this works beautifully, it does have the drawback that I’m left with heaps of whitespace if I turn a multi-line statement into a single-line one, which auto-indenting obviously can’t fix. fixup-whitespace does the trick with a single keypress – wish I’d thought to look for something like it long ago.

M-x count-matches

Return a count for the number of lines matching a regex. Simple, but useful for analysing logs, and something I was settling down to write in Python before I checked to see if such a thing existed.

Org Mode

Very useful for taking structured notes which can then be output in a variety of formats if desired. Can do way more than just note-taking – many people pretty much use it to organise their lives.

Batch mode

emacs can be run in batch mode, by passing the –batch switch. In batch mode emacs does not expect to have a display device to work with, making it ideal for using in batch files or scripts. Passing an argument after the –batch switch will open that argument in a buffer and subsequent actions will be taken on that buffer. The buffer will of course not be visible, but it remains a fully functional emacs buffer.

Batch mode therefore allows you to use emacs to do tasks it is very good at, without needing to interact directly with emacs – great for passing some heavy lifting to emacs in various scripts.

There are a few useful switches to use in conjunction with –batch:

  • -f ARG: Run elisp function ARG on the buffer
  • –eval ARG: Evaluate elisp snippet ARG

For example, the following line in a Windows batch file will use emacs to properly indent a Delphi source file:
emacs --batch %1 -f delphi-mode --eval "(indent-region (point-min) (point-max) nil)" -f save-buffer

Leave a Comment

Filed under emacs, Uncategorized

Fear not trembling citizen, MAKRO has a plan to survive the Simba shortage

Like tens of thousands if not hundreds of thousands of people, Vicki and I both have a MAKRO card. Yesterday we both received this sms:

While there's a short supply on Simba chips, Lays & Fritos - MAKRO has stocked up on alternate brands. We'll let you know when there's stock again.

What a relief! I’d been so worried about not being able to buy boxes of crisps! I can sleep again!

More seriously, neither of us has ever bought a box of crisps from MAKRO, so it’s not like they targeted customers who have a history of such purchases. I’m speculating, but they seem to have flung the message at all the numbers they have.

Is this issue so important that the cost of many thousands of messages is worth it? Even at say R0.01/sms, it adds up. I guess maybe it shows that boxes of crisps are a big seller and worth the expense of indiscriminate advertising.

Did anyone else receive this sms?


Filed under humour, Uncategorized

The answer to using SVN in your editor*

*(if emacs is your editor).

It’s fairly late at night, and I’m doing some desperately needed work coding. I’ve been using SVN to track my progress, as I do at work, and I’ve found myself using PSVN more and more. I’ve long had it installed, but never taken full advantage of it. It provides a central point within emacs to do just about anything you could want to do with an SVN-controlled directory, file or repo (or make new ones). It also hooks into ediff and various other bits of emacs magic. Rather than rehash things, here’s a link to an intro to it I found.

If you use emacs and SVN together even rarely, this is well worth a look.

Leave a Comment

Filed under emacs, Uncategorized