Satya's blog - 2005/03/

Mar 29 2005 23:25 Web site working hours?
Please note that the Online Tax Records Search is not available from 10pm to 6am (EST) Monday-Thursday and 6pm to 6am Friday, as well as 9am to 5pm on the third Saturday of each month.
Er? This is a *web* site, yes? (The Charleston County web site-- look it up yourself; apparently we're stuck in the 1980s.)
Mar 24 2005 23:08 Moving Cars
I'm trying to write a train game in python and SDL and pygame.

So far I can move a single car along a single track, in one direction. The nice thing about object-oriented programming (it's possible without objects, just more complicated) is that once this car class is done, it's done and the hardest part should be over. Yaright.

I still need a track class, and then I can get the car object to follow the track object, and change to a different track object. Then I need a train class, which will just link several car objects together. Of course, it's not that simple.

I've done about 7% of what's needed :)
Mar 24 2005 22:42 Wireless phone providers suck
I found out last weekend that I'm no longer on the 2-year contract with Suncom. Huzzah. After trying to switch, Suncom's Unplan still looked attractive price-wise, despite being locked in for another 2 years. I say, okay, fine, since current plan costs us about $amt=~/^\$\d\d\d$/ per month.

Suncom rep for the place where I work (TPWIW) says okay, call custserv and sign up to the new plan, will cost about $amt-30ish. Get and activate handsets. Call him so he can apply TPWIW discount, and it will be something like $amt-40ish.

Okay, call custserv. SWMBO says "Hi, we want to switch from the Unplan to the Unplan" "You already have Unplan" "Yes I know" "*hold*" ::Satya takes over and gets angry after 2 minutes of "Hi, I'm Harry Dipnick Junior" and hangs up::

Call again, SWMBO more calmly explains Unplan.oldandexpensiveTMDA[0] -> Unplan->newandimprovedsowe'llgouge.GSM[0] switch. They say, okay, and we'll ship the phones to you in about 5 days. SWMBO says nuh-uh, need them tomorrow because offer ends Saturday. Retail store? Okay, there are like, 3 within 5 miles. They're outflanking the Starbucks franchises.

Now why do these people have "Suncom stores" when the only place you can buy a new handset is in the "retail store" or whatever 8 miles away? And why does it take 40 minutes to buy and activate 2 handsets, and switch a plan?

TPWIW representative was helpful but couldn't really do anything. I guess I don't really blame the people involved, just the sheer babu-level bureaucracy.

I wonder how much Nokia 6010 will suck.

[0] "We'll switch you from the old system to the new system" I'm not scared of the letters "TMDA" and "GSM"! Just tell me! Once! Don't repeat the same thing every time I try to clear my confusion over your Unplan-but-not-really scheme! And they call this Truth in Wireless(TM, no doubt).
Mar 22 2005 17:15 Python!
Between yesterday and today, I've started learning Python. Primary purpose is game programming with the SDL libraries, and secondary purpose is to learn Python itself. So far I have a little app that displays a little rectangle, which with a lot of imagination becomes a car that you can drive around on the boring gray background.

The "car" was created using vim to edit an XPM file I had lying around. Then I went from XPM to PPM to JPEG. Voila.
Mar 21 2005 18:31 Doctor Who
Dr. Who would rock as anime or manga!

And my blog automatically makes wikilinks :-) but how do I escape sequences of 2 square brackets? :-(

Last updated: Mar 21 2005 18:53

Mar 21 2005 15:35 Stupid UPS tricks
What would happen if you connected two UPSen in series? Like, plug one into the mains, plug the second into the first. Then when you lose mains, the first should keep the second going for a while, then the second goes to battery. I think it depends a lot on the VA ratings.

Now what about connecting UPA A to UPS B, and B to A? Would they run off each other? Infinite supply of energy? Blow up? I think, depending on the VA rating, they'd just discharge -- even if nothing else is connected. At what rate? Dunno.
Mar 19 2005 23:32 Satyamag says:
Satya is provocative, entertaining, and intelligent reading. If every town had a Satya, New York would lose another aspect of its "specialness". You don't have to be an activist to pick Satya up

Update: They're not talking about me.

Last updated: Mar 20 2005 08:58

Mar 19 2005 22:16 Image to CSS
After seeing bluesmoon's attempt at rendering an image as text, I remembered something about rendering an image with CSS -- not ASCII art like bluesmoon, premshree, et al, but a real image. And in perl, because let's face it I'm a perl weenie. After struggling a couple of hours, I came up with this:
use GD;

my $img = GD::Image->newFromJpeg($ARGV[0]);
my($w,$h) = $img->getBounds();

print STDERR "height=$h width=$w\n";

<html> <head> <style>
.image td { width: 1px; height: 1px; }
</style> </head> <body>
<div class="image">
<table cellspacing="0" cellpadding="0">

for(my $y=0; $y<$h; $y++) {
    print "<tr>";
    for(my $x=0; $x<$w; $x++) {
        if($prevpixel ne $pixel) {
            if($prevpixel ne '') {
                if($count>1) {
                    print ";width=$count\" colspan=\"$count";
                print '"/>';
            print "<td style=\"background-color: \#$pixel";
        else {
    if($count>1) {
        print ";width=$count\" colspan=\"$count";
    print '"/>';
    print "</tr>\n";

</table> </div> </body> </html>

(sorry, LJ users, no cut tags here) which on my 2425 byte test image

(test image)

produced this page which weighs in at 353591 bytes (17533 bytes gzipped). That makes this whole exercise an academic because-I-can thing. That's why there's no use strict; and use warnings; and why I use $ARGV[0] directly.

Last updated: Mar 19 2005 22:43

Mar 15 2005 21:16 FAT32 resize
So it finally happened yesterday. Ran out of disk space on Windows XP system drive, mostly due to windows updates and a lack of planning (and disk space) when I first partitioned the drive. C: contains ME, D: contains XP; E, F, and G are more partitions. H and I are CD and DVD drives, J onwards are on the other hard drive. (How did the CD/DVD drives, hdc and hdd, get on H and I? WinXP is crazy.)

So anyway, D was full yesterday, so I moved everything from EFG to J:\edrive, etc. (yes, in their own directories) and copied the vital data files (thankfully in 1 location) to a separate machine (that's part of my regular backup strategy anyway). I also (later, between Knoppix reboots) exported the entire registry so maybe I can edit stuff like filepaths with a regex (search and replace) and re-import select bits of it.

Then I downloaded Knoppix and burned it to CD, booted it. Took a backup of the MBR with dd if=/dev/hda of=/mnt/hdb5/mbr.txt bs=512 count=1 but I'm not sure that that's right, because I didn't have to use it. Saved a partition table list with fdisk -l > file, but didn't have to use that either.

Finally used GNU parted (partition editor) to delete EFG. Then I resized D to start at the same place, and end where G was shown to end earlier. Rebooted, brought everything up perfectly.

Final twist. XP let me keep the same drive letters I had before. (Older things like ME, DOS, etc. used to name the drives by partition order, so I'd have ended up with something like CDEFGH, and I and J for the CD/DVD drives.) Now I had stuff installed on the EFG drives, so WinXP couldn't find it any more since those had disappeared. I did have the same file structure under J:\edrive, so all I had to do was add shortcuts in the Startup group for the command subst e: j:\edrive and so on, and boom everything's back to normal. D: started with 3.76 gigs total, and full; now has about 14 gigs total and 11 free.

Now these are all FAT32 partitions. If they were NTFS, I'd have used ntfsresize on Knoppix. I maybe could have been able to make one logical partition out of 2 or more, I don't know.
Mar 12 2005 22:16 Email on linode
I bought an account at, installed Debian, Apache, firewall, and then spent all evening getting Courier IMAP to work. The secret is to use maildirmake and not get too fancy.

Found this useful, although some of it is a little infantile, but this was the key: mailbox_command = /usr/bin/maildrop. Screw and mailbox_transport!

Getting punchy, must shut up before I say something stupid.
Mar 12 2005 22:15 Bhakri
Accidentally discovered bhakri: take whole wheat pastry flour (from Whole Foods), make like a chapati, voila! And then take dahi (plain yoghurt), mix in wada pav masala -- the red dry masala made from onions(?) and garlic -- and eat. Yum!
Mar 07 2005 18:59 MSDOS and UNIX
(MSDOS is probably a trademark of Microsoft, and UNIX is a trademark of AT&T or Bell Labs or something.)

In Andrew Tanenbaum's _Modern Operating Systems_, he says that MSDOS and UNIX are somewhat similar -- I suppose they were, back in the day. He also says that MS was once a distributor of UNIX. WTF?

Two unrelated facts, found on widely-separated pages of a dusty old book, kept on the back shelves on a dark floor of an obscure library, in... The Twilight Zone.

(How's my Rod Serling impression?)

Update: While on that subject, he was talking about system calls for creating and terminating processes, requesting memory, releasing memory, waiting for a process to terminate, and overlaying a program with another one. I realised I know the calls he's talking about -- in C terms, they are: fork(?), kill(?), *alloc, free, waitpid, and exec.

Last updated: Mar 07 2005 19:12

Mar 05 2005 21:44 Secret of Monkey Island
So I'm playing Secret of Monkey Island (2?) again, and I notice a lot of Star Wars (and I'm sure other) references, like LeChuck is Guybrush's... well, never mind. They're hilarious. It's a good thing Lucasarts owns all that stuff, otherwise the usage(?) fees would be astronomical.
Mar 05 2005 15:41 Releases
mySitemaker 4.5 is out, Saccs 0.4 is out, and I think it's time to release my Yet Another Blog script. Before that, I think the F18 stuff should go under it's own blog category. Let's see how this works.

Update: 1. Saccs still needs the 'community' feature. 2. YABS (Yet Another Blog by Satya) generates leaf nodes in both chron and reverse chron order. Whee! Twice the size!

Last updated: Mar 05 2005 15:49