November 6th, 2005

belize

TCP and wireless

Typical TCP retransmission algorithms absolutely blow with wireless. I'll miss a packet doing some ssh, type another 5 or 6 keys before I notice, and then my ssh is hung for 30 seconds even though I can still browse the web.

I thought I recalled Linux now having pluggable congestion control algorithms that can be switched on the fly.... does a Wifi-optimized one exist, so I can auto-switch to it when my wifi interface comes up?

I'm not the only one pissed about this it seems.... citeseer and other places list a bunch of papers on this. I'm too lazy to read them... I want something I can use now. Anybody know?
belize

Overloaded operators

A lot of languages have these magical types that internally have a type (number vs. string) but don't really act like it. If the language is designed well, you should never have to know about this little detail.

Of course, it always shines through when you have polymorphic overloaded operators. Perl's good for the most part since it has number vs. string operators (concatenate is ".", not "+", "lt" not "<", etc...)

But Perl still has one fault.... the bitwise operators. Which are bitwise numeric operators when either are numbers, but a bitwise string operator when both are strings. Which is pretty much the most useless operation ever, and the one you get almost all the time, since Perl numbers tend to be string internally when you get them from a user, database, etc.

So whenever you want to do a bitwise operation, your Perl looks like this:

my $bitwise = ($foo + 0) & ($bar + 0);

Just to cast those bitches internally into actual numbers and to be sure you're getting the right operator.

I can live with that in Perl. It's just one operator, and one you don't tend to use that often.

But in JavaScript it's a dozen times worse, since there are no "cmp", "lt", "gt", ".", etc operators for strings, so JavaScript is always guessing what the fuck operator you actually want.

Particularly bad is the "+" operator which either means concatenate or add, both common operations! So you end up sprinkling all your code with stuff like:

var sum = (foo - 0) + (bar - 0);
or:
var sum = (foo * 1) + (bar * 1);

What's worse, it seems that functions in the standard JavaScript library (Math.*, etc) are inconsistent between browsers with regard to shortcuts they take to return early, passing back copies of your original variable without the internal "I'm a string!" flag changed to "I'm a number!".

So it's possible to get back strings variables from Math functions sometimes? (???)

So frustrating, that you can't write a simple numeric algorithm that work in a bunch of browsers without "cleaning" your variables all over the place to make sure they're actually numbers.

I think some of this is fixed in JavaScript 2.0, albeit with a horrid syntax.

Update: had wrong Perl operator as example. brainfart. also s/polymorphic/overloaded/. i should know better.
belize

Laptop: click, click, dead.

Thinkpad started to click a lot.

Tried to image its hard-drive before it totally bit it, but didn't make it in time. I'd recently bought a 3.5"/2.5" harddrive to USB 2.0 cable, so took out harddrive, plugged it into a computer, saw laptop disk show up, with all ~9 partitions, realized not enough free disk space on host, plugged in to another computer, device didn't show up. Hm, bad USB on second host I thought. Moved it back to the laptop, and now it won't boot.

Did I kill it, or was it really that close to death?

I'm always paranoid-safe about static electricity, more so than most computer vendors. Bleh.

Normally I don't care when laptop disks bite it, but there was one small Perl module I'd worked on in Iowa and in the plane to/from Iowa that I'd totally forgotten about and never copied over. I usually never work on the laptop so much as use them as dumb terminals to ssh and browse from, so I have no backup regiment when it comes to laptops at all.

Oh well. It was a small project, and I can probably redo it better the second time.

More of a bummer is that I have no Windows/IE/Opera to test with for a while.