« April 2007 | Main | February 2007 »

Well, we're back after a bit of technological noncooperation, which is a long, boring story for a later post. Quite likely, that post will be the very next post, which you are of course welcome to skip as it will contain lots of code and error messages, both of which tend to cause people's eyes to glaze over and/or roll back in their heads, followed by unconsciousness. That could have been why the issue took a week to get around to fixing, but actually I finally found a new job, which requires me to work customary business hours, which means I now shouldn't mustn't be up at 1:45 AM futzing around on my computer. Regardless, I'd really like to get back into posting more often, ideally once per day as I was in November.

Oh, and because of the soon-to-be explained electronic blooper, the commenting system seems to have gone a little off-kilter. Don't be alarmed if you seem to be posting non-sequitur comments to posts you don't recall reading, it's just that Haloscan's database no longer matches the website. Hopefully that can be sorted out without much more pain or effort.

posted on Sunday, March 04, 2007 at 7:48 PM
Categories: news
| | Permalink

Okay, dear readers, here's the scoop. As you will see to the right someplace, I use Thingamablog to publish The Electronic Replicant. It's a Java program that stores your blog entries in a local database, then publishes them via FTP as static HTML files. This means that the resulting site is portable and universal, making it easy to move from server to server (which I plan to do soon, but that's another story.) I also happen to like it since, as it's a Java program, I can put it on a FAT32 partition on my PC and use it in both Windows and Linux. And if I share that partition, I can also use Thingamablog on my notebook elsewhere in the house, such as on the couch in front of the TV.

That's where my trouble began. I don't know exactly what happened, but after completing and uploading last Sunday's post, I closed Thingamablog and told Windows to disconnect the mapped drive. Windows gave a warning about files being open, but since Thingamablog-- and all other programs, for that matter-- were closed, I assumed that Windows was simply being overprotective, and so I clicked OK. Later that night, I reopened Thingamablog on my PC, only to receive this nastygram:

Error Details...
java.lang.Exception
Unable to connect to database
net.sf.thingamablog.backend.HSQLDatabaseBackend.connectToDB(Unknown Source)
net.sf.thingamablog.gui.app.ThingamablogFrame$2.construct(Unknown Source)
net.sf.thingamablog.SwingWorker$2.run(Unknown Source)
java.lang.Thread.run(Unknown Source)

Apparently, that means the database is toast. I was faced with the tedious task of copying text from my previously-uploaded pages, pasting said text into the TAMB editor, and backdating the replacement posts to approximately the correct date and time. That is a job for a computer, not a human! And, since Thingamablog can import and export all of a blog's posts via RSS, I decided to write a Perl script to munge my archives into an RSS feed. I am presenting this script here in its entirety, in the hope that it may be even a little bit useful to someone else in this position.

use File::Find;
use XML::RSS;
use Date::Manip;
&Date_Init("TZ=PST");
# Where are my files?
my $archive_dir = "c:\\erik\\archives";
my $rss_file = "c:\\erik\\rss.xml";
my $tempfile = "c:\\erik\\temp.txt";
# create an RSS 2.0 file
my $rss = new XML::RSS (version => '2.0');
$rss->channel(title => 'recovered blog', description => 'recovered blog' );
# enter directory containing downloaded archive folders
chdir ($archive_dir);
my @files_found = <*>;
my @search_dirs = ();
# make a list of the "year" folders
foreach $file (@files_found)
{
print $file . "\n";
if ($file =~ /\d{4}/)
{
push (@search_dirs, $file);
}
}
# Now process the files in there
find(\&wanted, @search_dirs);
# save RSS to a file
$rss->save($rss_file);
die("End");

sub wanted {
if ($_ =~ /html$/i)
{
my $file = $_;
print "opening $file . \n";

# How to find the data...
# Publication date be found within <h2 class="date">...<h2> and in the <div class="posted"> after at.
my $pubdate = "01-01-1980";
my $pubdate_open = "<h2 class=\"date\">";
my $pubdate_close = "</h2>";
# Title will be found within <h3 class="title">...</h3>
my $title = "default_title";
my $title_open = "<h3 class=\"title\">";
my $title_close = "</h3>";
# Description: everything after <h3 class="title">...</h3> and before <div class="posted">
my $description = "";
my $description_close = "<div class=\"posted\">";
# Category will be found within <div class="posted"> after Categories: inside <a href...>...</a>
my $category = "default_category";
my $permalink = "";

# Convert the raw HTML into something a little easier to parse
open (INFILE, $file);
open (OUTFILE, ">" . $tempfile);
while (<INFILE>)
{
#go thru file converting all whitespace characters to ' '
chomp;
s/\s+/ /g;
#if a '<' is encountered, print an "\n" then '<' then continue
s/</\n</g;
#if a '>' is encountered, print '<' then an "\n" then continue
s/>/>\n/g;
print OUTFILE $_;
}
close OUTFILE;
close INFILE;

#now go thru easy-to-read temp file searching for desired tags, which will be on individual lines
open (INFILE, $tempfile);

# get date
print "getting date... ";
do {$input = <INFILE>;}
until ((eof) or (uc($input) eq uc($pubdate_open) . "\n"));
$pubdate = <INFILE>;
print "$pubdate \n";
do {$input = <INFILE>; }
until ((eof) or (uc($input) eq uc($pubdate_close) . "\n"));

# get title
print "getting title... ";
do {$input = <INFILE>; }
until ((eof) or (uc($input) eq uc($title_open) . "\n"));
$title = <INFILE>;
print "$title \n";
do {$input = <INFILE>; }
until ((eof) or (uc($input) eq uc($title_close) . "\n"));

#get description
print "getting description...";
$input = "";
until ((eof) or (uc($input) eq uc($description_close) . "\n"))
{
$description .= $input;
$input = <INFILE>;
print ".";
}
print "\n";

#Get time
print "getting time...";
do {$input = <INFILE>; }
until ((eof) or (uc($input) eq uc(" Posted By ") . "\n"));
do {$input = <INFILE>; }
until ((eof) or (uc($input) eq uc("</a>") . "\n"));
$pubdate .= <INFILE>;
$date = ParseDate($pubdate);
#Put date/time into this format: Wed, 21 Feb 2007 24:57:14 -0800
$pubdate = UnixDate ($date, "%g");
print $pubdate . "\n";

#Get Category
print "getting category...";
do {$input = <INFILE>; }
until ((eof) or ($input =~ /Categories/i));
#discard href
$input = <infile>;
$category = <infile>;

print "\n";
close (INFILE);
$rss->add_item(title => $title, permaLink => $permalink, description => $description, pubDate=>$pubdate, $category=>$category);
}
}

I'm sure the real Perl wizards will scoff at this script, but at least it did work well enough for me to get my posts back. For some reason, it wouldn't pull in the category, but I didn't mind, since I'd been meaning to recategorize everything anyway. So I did. The next thing I had to do was to edit the default layout templates to resemble the ones I'd had before, but I didn't mind that either, as I'd been wanting to make a few changes here and there.

Finally, since I now really wanted to make sure that I would never have to go through any of this again, I wrote a batch file that will launch Thingamablog, and then automatically back up the database afterward:

@ECHO OFF
set zip="c:\program files\7-zip\7z.exe"
set tambdir="c:\erik\tamb2\"
set archivedir="c:\erik\archive\"
set options=a -r -tzip -mx9
set thingamablog="c:\program files\thingamablog1\thingamablog.jar"

java -jar %thingamablog%

for /f "tokens=1-3 delims=/ " %%a in ("%DATE%") do (
set dd=%%a
set mm=%%b
set yyyy=%%c)
set filename=%dd%%mm%%yyyy%.zip

cd %archivedir%
%zip% %options% %filename% %tambdir%

posted on Sunday, March 04, 2007 at 8:03 PM
Categories: computer science
| | Permalink

I'm a Reserved Inventor...

I'm an easy-riding, back-to-basics, worker-bee love bug!

And apparently, I'm so 1990's...

You are C++. You are very popular and open to suggestions.  Many have tried to be like you, but haven't been successful
Which Programming Language are You?

You are Windows 98.  You're a bit flaky, but well-liked.  You don't have a great memory, but everyone seems to know you.  A great person to hang out with and play some games.
Which OS are You?

Gee, thanks.

posted on Friday, March 09, 2007 at 8:55 PM
Categories: amusement, link-o-rama
| | Permalink

I went to see a movie but found a new shorthand reference for "inappropriately intimate conversation loudly taking place in public."

It all started on the way to the theater. A friend of mine invited me to see the movie 300. We parked in the parking structure, which I was sure was on the wrong side of the mall. No problem, he told me, we'll just take a shortcut through one of the department stores and be there in no time. We then made our way past racks of purses and pantsuits, and were then negotiating the maze of the perfume department, when suddenly, out of nowhere, a tremendously loud voice trumpeted to all nearby, "Oh, my God, the walls of my uterus are so thin..."

This resulted in the following conversation with my friend.
HIM: WTF
ME: TMI (LOL)
HIM: TMFI
ME: ROFL
HIM: OK, STFU
ME: At least now I have something to blog about.

As for 300, I'm afraid to say that I was rather bored. It seemed to be a two-hour-long slow-motion blood splatter, puncutated by bare breasts and a thirty-second decapitation scene. So by certain standards, this would be a great movie. Visually, though, it looked like a grimy painting, which I suppose could set the appropriate atmosphere for the telling of a legend. And in that context, the existence of a bottomless pit in the middle of town makes perfect sense.

Disclaimer: Although the author finds the subject of uteri to be inappropriate for the shopping mall, the author recognizes the right of shoppers to discuss whatever topics they please. The author also recognizes that uterine disorders are a serious matter and means no disrespect to anybody suffering uterine disorders. However, the author reserves the right to utter "Well, my uterus..." or some variation thereof when the author feels that an individual is disclosing inappropriately detailed personal information, whether or not uterine disorders are involved. The author acknowledges that he does not, to his knowledge, possess a uterus. That's what makes it funny.

posted on Sunday, March 11, 2007 at 10:03 PM
Edited on: Friday, March 16, 2007 9:16 PM
Categories: misc
| | Permalink

posted on Monday, March 12, 2007 at 10:27 PM
Categories: now reading
| | Permalink

Today's question is from Jared in San Diego.

Q. My boss wanted me to also ask you if there was something particular that we have to do to make the clock on the server and on our individual computers to update to the time change. I tried to update but it will change back to the hour before.

Just so you know we have a Windows 2000 domain controller and Windows XP workstations.

A. Ah yes, the after-effects of the Energy Policy Act of 2005. Will it save lots of energy? I don't know! Will it get people to buy new appliances-- answering machines, time card clocks, sprinker timers, video recorders, etc? Probably!

Anyway, you are not the only person who has had to deal with this issue. You'll be happy to know that Microsoft has rolled out an update for Windows Server 2003 and XP, but unfortunately, Windows 2000 is too old to be bothered with. You'll just have to pay your licensing fees and step onto the upgrade treadmill with the rest of us.

Okay, okay, there are a couple of things you can try first. If your XP workstations are current on their updates, it may be that your sever is feeding them the wrong time, as all systems in a domain need to be synchronized for numerous boring reasons.

So to update the server, see the following link and look at "Method 2, Update The Time On A Single Computer" at about 3/4 of the way from the bottom. Basically, you will run the tzedit program on the server, and change the beginning and ending dates of Pacific Daylight Time. Once you have done that, temporarily change to another time zone to cause the server's clock to update.

Unfortunately, that may not solve all of your problems, as computers often compare time in terms of UTC rather than in terms of the local time zone. So your workstations may still display the local time incorrectly. In that case, try downloading the Update For Windows XP and applying it to the workstations.

posted on Thursday, March 15, 2007 at 11:34 PM
Categories: computer science, q+=a
| | Permalink

Since there seems to be no obvious way to resynchronize Haloscan and my site, I've gone and pushed the Big Red Button in order to restore, well, order. Don't fret over their fate. They are presently being mummified, shrink-wrapped, and vacuum-sealed for display in the soon-to-be-opened Hall of Commenty Horrors.
posted on Friday, March 16, 2007 at 7:15 PM
Categories: news
| | Permalink

I admit it, I often go to Starbucks for a treat now and then. When I do, I sometimes wonder about the people sitting there clicking away at their portable computers. I like to imagine that they're maximizing their time, stopping on the way from point A to point B, to have a snack and put the finishing touches on an important report. On the other hand, perhaps their homes are such distracting environments that a busy coffee shop is the only place to get any work done. I can certainly sympathize with that. It's also probable that some of these people may simply be amusing themselves while awaiting the arrival of friends. Then again, some people might just have nothing better to do than monopolize the Big Comfy Chairs while composing blog entries.

There's nothing wrong with blogging from a coffee shop, or from a Big Comfy Chair, for that matter. (I've got one I'm quite fond of, but it's next to my TV, which is a bit distracting.) However, might I suggest that the tragic, meaningful, gritty and/or realistic experience could be enhanced by visiting an independent coffee shop? Although the experience won't be quite as mediated-- the Big Comfy Chair may be neither big nor comfy-- they might have better coffee.

posted on Friday, March 16, 2007 at 8:21 PM
Categories: link-o-rama, misc
| | Permalink

Q. I am a beginner. How can I build a working robot out of things found around the house?

A. Well. That all depends on three factors.

1. How much of a beginner are you?

If you know next-to-nothing about mechanical engineering, electronics, soldering, wiring, programming, or any of the other skills needed to build a robot, then you may want to start by visiting your nearest library and finding yourself a copy of something like Robot Building for Beginners, Absolute Beginner's Guide to Building Robots, or 123 Robotics Experiments for the Evil Genius. All these books will talk you through the construction of a simple robot, although quite a bit of shopping may be involved, depending on...

2. What sorts of things can be found around your house?

You can build robots from just about anything, depending on what you expect them to do. Your imagination's the limit. Well, the laws of physics are really the limit. But you don't need to use stainless steel or brushed aluminum if you can't find any. You can make perfectly nice robots from wood, various kinds of plastic, stiff wire, old lunchboxes, even papier-mâché. Motorized toys in particular often make good bases for robots. Of course, it also depends on...

3. What's your definition of a robot?

Everybody has a favorite definition of robot, be it worker, mechanical man, programmable mobile machine, electronic gladiator, humanoid automaton, or kinetic sculpture. Sirius Cybernetics even defines a robot as "your plastic pal that's fun to be with." Fun being in the eye of the beholder, that definition could even encompass a doll or action figure. You probably envision something that moves on its own, such as this draw bot. I consider it to be more of a kinetic sculpture than a true robot. However, it can quickly be made from common household items-- if you can steal a motor from something that won't be missed, such as an old toy car.

If you're feeling a bit more ambitious, are comfortable with a soldering iron, and have access to a good supply of spare parts-- from a broken cassette player, say-- you might be interested in building a BEAM robot, such as a solaroller. The philosophy of BEAM-- Biology, Electronics, Aesthertics and Mechanics-- is to build simple robots from simple components that exhbit complex behaviours. Rather than trying unsuccessfully to build artificial humans-- or even artificial chipmunks-- BEAM builders successfully produce what might be thought of as artificial plankton.

Happy roboting!
posted on Monday, March 19, 2007 at 11:21 PM
Categories: q+=a, robotics
| | Permalink

Don't be alarmed if you should happen to encounter a strange man singing, "She-Ra, She-Ra! Nanner nanner nanner nar..." It's probably just me. Or, if you watch this montage of Eighties cartoon introductions, it might be you! Mwa ha ha!

Although admitting this will show my age, and perhaps a few other things, I could have easily recited along with the narrator for most of those clips. There was one notable exception, and that was Bravestarr, the only show I'd never seen or heard of. Apparently he's a space sheriff that rides into town on some kind of were-horse. A were-horse that then assumes humanoid form and supplies him with a rather flamboyant wink. Just what kind of town is this, anyway? And why are you looking at me like that?

posted on Tuesday, March 20, 2007 at 11:13 PM
Categories: link-o-rama
| | Permalink

For a change, I did something interesting today. The FIRST Robotics Competition was being held at the Sports Arena, and admission was free, so I went and took a look. High schools all over the state put together teams to build robots for this competition. It wasn't a combat competition, instead, the robots worked in teams to pick up inflatable rings and hang them on a goal structure. Although I wouldn't have minded seeing a few sparks fly, I think this goal required the students to put a bit more thought into their designs than a robot brawl would have. Why didn't they have this way back when I was in school? (Probably because computers were an altogether more seductive subject then.) Anyway, here are a few pictures...

robot 585  robot 368  robot  robot guts  robot 1704

posted on Saturday, March 24, 2007 at 11:43 PM
Edited on: Saturday, March 24, 2007 11:45 PM
Categories: robotics
| | Permalink

After hearing this tale of a drowned keyboard, I thought back to my many colorful coworkers' not entirely efficient (or effective) schemes for dealing with finger grime and other keyboard cooties. I knew one girl who went through canned air as though it were soda pop. I knew another woman who swabbed daintily at the edges of her keys with rubbing alcohol. Although these methods dealt with some of the dirt, they couldn't deal with all of it.

So, as a public service announcement, and since I've nothing better to post about, I'll answer the question nobody seems to ask but everybody needs to know: how do I clean my keyboard?

The first step is to gently pry off your key caps with a butter knife, flat-blade screwdriver, or similar implement. Give your tool a twist and your key caps should pop right out of their holders with no harm done.
pop  see

Be careful with the larger keys, such as shift, enter, and the spacebar. Usually, large keys will have a bracing wire clipped to the keycap that fits beneath a set of tabs on the keyboard. It is all too easy to break the tabs on the keyboard or the clips on the key. Doing so won't necessarily render your keyboard inoperative, but it might just make these keys a wee bit wobbly.

Throw all the keys into a bucket, bowl, or other such vessel, along with a generous helping of the detergent of your choice. Add enough warm water to submerge the caps, then stir briskly for a few minutes, or until the keys look clean or the water looks dirty. Then rinse. Repeat as needed.

grody  swirl  rinse

Pat the keys dry in a towel, then set them aside to dry completely. Meanwhile, using a nice stiff brush, sweep away whatever crumbs or other debris may be left on the keyboard. Then, use a rag dampened slightly with all-purpose cleaner to remove any remaining dirt. Avoid getting any solution into the key holes, as this can corrode or short the contacts therein. And then last, but not least, reattach your keycaps.

better  keys_clean

posted on Tuesday, March 27, 2007 at 11:06 PM
Edited on: Tuesday, March 27, 2007 11:09 PM
Categories: q+=a
| | Permalink

My shift key is sticking. I wonder if that has anything to do with the washing of the keys? Nah. Anyway, here's a questionnaire I found somewhere.

1. If you could suddenly speak one language fluently (that you don't currently speak) what would it be?
Japanese, of course. When watching anime with friends, I could make myself into even more of a pompous windbag by telling them when the subtitles aren't technically accurate.
2. If you were to suggest a foreign film, that you really enjoyed, what one would you suggest?
Gosh, there are so many. It would really depend on who had asked for the recommendation and what sorts of movies they prefer. Night Watch comes to mind, as does Spirited Away.
3. If you had to call another country home (other than the one you currently live in) what one would you choose?
Assuming I don't suddenly speak another language fluently, then for purely practical reasons, I suppose I'd choose Britian or Australia so that I wouldn't have to learn another language.
4. If you went out to buy an import music CD, what one would you buy?
Probably something from Nobuo Uematsu.
5. If you were to chose an ethnic dinner, what would it be?
Right now? Hmm... Chinese, I think.
posted on Friday, March 30, 2007 at 5:47 PM
Categories: amusement
| | Permalink

« April 2007 | Main | February 2007 »