casting runes, smith chart style

smithchart.png
(you’ll get a bigger image if you select the above image)

When I was a first year mechanical engineering student, I took a very obscure elective in (radio) transmission systems. I think the course was mislabelled, as the rest of the class was third year electrical engineering students, and I was the lone mech in the class.

This was a hard class. It had difficult sums and brutal coursework. The final exam was extremely easy, though.

One thing I remember from the course was the Smith Chart. It was some clever way of matching antenna characteristics. I don’t remember how to use one, but I’ve always thought they looked cool.

Scripting Radio Buttons

I use Perl’s HTML::Template module a lot. It allows you to write web pages that are dynamically modified by the controlling Perl CGI/mod_perl application.

Most of my applications fill in forms from values in a database. This is easy enough when you are filling text fields, but if you ever use radio buttons, things kind of fall down.

I’ve found a way around this. Let’s say you have a status field that can have three values:

  • active
  • blocked
  • retired

So in Perl I define three constants:

  use constant STATUS_ACTIVE => 'active';
  use constant STATUS_BLOCK => 'block';
  use constant STATUS_RETIRE => 'retire';

Then in the template, I have something like this:

  <input type="radio" name="status"
   <!-- TMPL_IF NAME=STATUS_ACTIVE -->
   checked="checked"
   <!-- /TMPL_IF -->
  value="active" />Active

  <input type="radio" name="status"
   <!-- TMPL_IF NAME=STATUS_BLOCK -->
   checked="checked"
   <!-- /TMPL_IF -->

  value="block" />Blocked

  <input type="radio" name="status"
   <!-- TMPL_IF NAME=STATUS_RETIRE -->
   checked="checked"
   <!-- /TMPL_IF -->
  value="retire" />Retired

If the status variable is $account->status, say, I’d use:

  $template->param(
   STATUS_ACTIVE => ($account->status eq STATUS_ACTIVE),
   STATUS_BLOCK =>  ($account->status eq STATUS_BLOCK),
   STATUS_RETIRE => ($account->status eq STATUS_RETIRE)
  );

and, magically, the template picks up the right value.

If the status variable isn’t set to one of the three predefined values, you get a radio group that none of the values is selected. You might wish to think about how you’d deal with that, perhaps setting a safe default.

freshmeat shilling for MS, via google

freshmeat supports open source. But what did I see in their google ad panel today?
evil opensource news
The link goes to http://www.microsoft.ca/getthefacts. I’m not sure I’d trust Microsoft to be objective about open source — would you?

$29.72/kg

I took 3.6kg of small change (quarters and smaller) to the CoinStar machine, and it netted approximately $107. I actually got back about $96, as the machine keeps about 10% as a sorting fee.

So, weight for weight, Canadian small change is equivalent in value to prime steak.

Glasgow Science Centre needs a Wind Turbine

Glasgow has a Science Centre. Glasgow Science Centre has a 150m tall tower that is supposed to turn with the wind. Unfortunately, its main bearing has been broken since 2002, and it has been closed to the public.

Glasgow is a windy city. I spent more than 30 years of my life there. You could put a wind turbine there, and not merely would it be attractive, it would be educational and would earn some revenue for the centre.

If WindShare can build urban wind turbines, so can Glasgow.

It’s not as cold as you’d think

I use Gnome Weather Report, an applet that shows the local temperature and weather conditions on my desktop. For the last few days, it’s been showing something really weird: celsius.png. It’s nothing like -17°C here; it’s nearer 0°C, according to Environment Canada.

Things become clearer when you change the view to Fahrenheit view: fahrenheit.png. It’s clear that the sensor or protocol is broken, but is being mis-interpreted as a zero signal.

As an avid RISKS reader, I know that confusing zero and null values is pretty much unforgivable. I’ve wired up enough 4-20mA current loop instruments to know that having a zero-value signal being the same as a no signal value is bad.

But there’s no real risk here. I mean, I could always go outside and find that it’s not 17°C. You don’t need a weatherman, as Bob said.

I vant to drink you-all’s blood

vert.carter.ap.jpg
Have you ever noticed that Jimmy Carter has pointy, pointy teeth? In the above photo (copyright AP, used without permission, taken from a CNN story about Georgia wanting to claim that evolution never happened [politeness prevents me cracking the obvious joke], don’t sue me) he’s kinda got that Transylvanian thing going on.

Don’t get me wrong, I’ve always liked Jimmy — he was the first US president that I was old enough to really remember what he did — but by the looks of this picture, I’d have the garlic handy if he ever came visiting.

Happy Runeberg Day

Finland’s national poet Johan Ludvig Runeberg was born 200 years ago today. If you can’t have a holiday, at least have one of Runeberg’s cupcakes. They sound yummy.

30 minutes of my life gone

… dealing with Mr Tramadol Hydrochloride Comment Spammer.

If you’re considering spamming this site, why not stop and consider doing something worthwhile?

Comment Spam

I’ve had to close comments because someone comment-spammed the site. Having to deal with this is a bit like dealing with something unpleasant you’ve trodden on in the street.

Attack of the Dodgy Duracells

My Palm gave up the ghost yesterday, less than a couple of weeks after fitting new batteries. I should have been suspicious of the remarkably cheap Duracell brand batteries I got from the corner shop. They are marked For Original Equipment ONLY.

A set of Duracell brand AAA batteries usually lasts me about two months. I wonder if these were some kind of pirated battery?

The Triplets of Belleville

Go and see this. Best animation I’ve seen in a long time; it’s edging out “Spirited Away” for me. Fabulous score, and many wonderful tips o’ the beret to C20th French popular culture.

The Belleville residents look like refugees from The Quigmans. The structural gangsters in their 2CV limos are both menacing and comic.

Oh yeah, and stay for the end of the credits.