Monday, January 28, 2013

Word games, part two

Sometimes I wake up in the morning, and manage to get back to sleep. Other times, my brain starts ticking over, and there's no point shouting at it to go back to sleep. This morning was an example of the latter.

Specifically, I started trying to work out the nine-letter word from the Sunday Age, from memory. From there, I started thinking about this earlier bit of hackery, and how I really should have tried to solve the problem properly. So I came up with this:


my $DICT="/etc/dictionaries-common/words";
my $WORD=shift();

my $LC_WORD=lc($WORD);
my $SORTED_WORD=(join '', sort { $a cmp $b } split(//, $LC_WORD));
my $LENGTH=length($SORTED_WORD);

open FILE, $DICT or die $!;

while(<FILE>) {
        $CANDIDATE=(join '', sort { $a cmp $b } split(//, lc($_) ));
        next if (length($CANDIDATE) ne $LENGTH);
        print ("FOUND: $_\n") if($CANDIDATE eq $SORTED_WORD);

close FILE;
exit 0;

Perl is definitely not my favourite language (too many magic variables for my liking!) but it's quick, and it works.

Of course, plenty of other people have already solved this issue (and gone well beyond too, in this case) but that's not the point - it was an interesting exercise. My wife did ask "isn't that cheating?" but I kinda think if you write a program to solve the problem, it's arguable not really cheating. Right?

Friday, January 11, 2013

Radio scanners

In a diversion from the usual nerdy stuff, let's talk about radio scanners. Um, well maybe not a complete diversion, but it's not strictly a computer, so you see what I'm saying...

We live in a high fire danger area. The CFA website, fire ready app, ABC news radio... they're all good, but the information is not always timely, and there have been cases where they haven't coped under the high load of a high fire danger day. When you really want to know what's happening nearby, the CFA radio communications give you the best picture. Messages between VicFire (the dispatch centre) and the crews on the ground tell you a great deal about what's happening.

Currently we use an analog scanner - a Uniden Bearcat UBC93XLT, which has served us very well. We replaced the stock aerial with a ScanDucky and it's been terrific. Our scanner came from Dick Smith, but they don't list it anymore. They still list the 92 - similar, but without the rechargeable batteries (I always regarded the extra few dollars for the 93 well worth it - the scanner stays attached to the charger in the kitchen, and when we go mobile it's ready to rock). It looks like Dick Smith and (of all places!) OfficeWorks offer what looks like the "small" version of our scanner - this might be a good "for now" analog scanner (note: I haven't tried one of these, but some casual googling indicates this should do roughly what the 93 does - but caveat emptor - don't buy this assuming it will pick up CFA radio based on my non-recommendation - check that it supports the CFA frequencies). Our scanner's limited keypad was cryptic enough that I was forced to read the manual (I know! I hope they don't cancel my nerd badge for reading the manual... it just wasn't intuitive) so don't expect to open the box and use a scanner straight away.

Eventually CFA VicFire channels will go digital. At this stage the project is implementing digital for country areas, with outer metro to follow "eventually". Check which region you're in here. I'm told the fireground channels will stay on analog (these are the channels used for communication between the trucks working on the same incident, I can generally hear these if the incident is nearby). Anyhoo, digital: it gives the users the option to encrypt their conversations (as Police channels in metro areas already do) but I have been told by CFA sources that the digital channels will remain unencrypted, meaning we can still listen with our scanners. So I plan to upgrade to the Bearcat Digital 396 XT or similar. I assume that it will also receive the analog transmissions (needed for fireground channels) but please note that I cannot confirm this until I have one in my hot little hands. This guy has lots of useful information about these units. If it supports analog, we may have a UBC93XLT for sale... if not, we'll hang on to it.