Archive for September, 2005

Friday, September 30th, 2005

Ideas: what about a sort of pseudo-Norquist future where the government hasn’t exactly been ‘drowned in the bathtub’, just sort of put out to pasture? Wouldn’t it be funny if police departments didn’t have enough funding to operate vehicles, so the officers were all riding bicycles and taking public transit to the scene of the crime?

Introducing: the Bot-Net Architecture™ For Windows

Monday, September 26th, 2005

Every day, they’re out there. While you brush your teeth, while you drive to work, while you sleep soundly in your bed, hackers, script kiddies and other miscreants are waging global war on the internet. Viruses and worms exploit vulnerabilities in all sorts of systems and applications, turning ordinary computers into a world-wide ‘botnets’ to do the grunt work in the nefarious schemes of spammers, crackers, and identity thieves.

Isn’t it time you put them to some good use?

Introducing the Bot-Net Architecture™ For Windows, a multithreaded, object-oriented API capable of leveraging the exciting power of botnets in all the ways your imagination can dream of. Acquire resources, control systems, expand networks with the push of a button – it’s that easy. Since all the work is done on remote computers, Bot-Net™ requires virtually no CPU time or memory, keeping your hardware costs low. But just because they are remote systems doesn’t mean they have to act like remote systems – Bot-Net™ handles all the complexities of the network transparently and seamlessly: you make a local function call, and in a suburb of London, some yuppy sprays latte foam all over his 17″ PowerBook when Safari tells him that he’s just helped you steal $11 million from the Teamsters Union.

Bot-Net™: Who do you want to own today?

Sparks will fuck you up

Monday, September 26th, 2005

Just for the record, Sparks will F you the H up. No kidding. I was up til 4 AM Sunday. Keeroist.

Alliance is so terrible

Monday, September 26th, 2005

There’s a whole genre of posts dedicated to rah-rah team boosterism and ‘OMG WE OWNZ JOO NOOBS’. I hate shit like that; it’s stupid and doesn’t serve any purpose.

That being said, the Alliance is pathetic.

When I was with the Alliance on Kilrogg, I thought that maybe it was just a fluke of that server. After spending some time in Warsong Gulch, I became informally associated with some top-notch people who would send me invites when they didn’t have enough regulars to fill out the roster. All-in-all, I would say there were two such groups on Kilrogg, though they never really had official membership and sometimes shared members. The thing is, there were at least five groups on the Horde side of equal ability.

Anyway, I play on Crushridge and Kil’jaden now, both Horde, and I can now say, it’s not just Kilrogg. On Crushridge, I’m halfway to Honored with Warsong Gulch, and I have lost exactly TWO games. So that’s something like 48 wins, 2 losses. Some nights, we have deliberately let the Alliance score a flag cap just because we don’t want to demoralize them – after all, if they don’t get back in the queue, we’re screwed.

In world PvP (Crushridge and Kil’jaden are PvP servers), I’ve never lost a one-on-one fight to an Alliance player who was at or below my level. Of course, I’ve never been attacked one-on-one by an Alliance player who was at or below my level, either. Either they attack weaker players, or they gang up in giant gank squads. Always. At level 31, my hunter got ganked in Stranglethorn by a 34 rogue. I started using the ‘freeze trap->flare while you quest’ method to reverse gank him; after I killed him twice, he came back with a 36 (!) rogue and they killed me together. I teamed up with a 32 hunter, and the next time those rogues came, we shipped them back to Darnassus in a box. And again. And again. And then they come back with a level ?? rogue and wipe us out, with plenty of /spit to go around. Wow. What studs. The best part is, I can totally imagine them on /1 whining “waaaahh someone come help this f4gg0t asshole hunter is camping me”.

Kil’jaden works pretty much the same way. A five-man gank squad, levels 30-36, attacks my four-man party, levels 24-30, and we beat them. Freaking sad. And two minutes later, you guessed it, level ?? rogue is on us. And we even made her drink a potion before we died.

So why does the Alliance blow goats? Does the Alliance turn players into bad PvPers? Are bad PvPers naturally drawn to the Alliance? On servers where Horde outnumbers the Alliance, is it the other way around? I don’t know, but I am interested in finding out.

Some more reasons that Perl sucks

Monday, September 26th, 2005

So Tom did quite a bang-up job of explaining why the switch statement is so retarded in Perl. But there are other reasons that Perl sucks.

The scalar data type is an extremely leaky abstraction
As Joel Spolsky notes in the Law of Leaky Abstractions, you have to understand the theory that an abstraction is, well, abstracting, in order to use it properly because, for any abstraction, there are situations which cause the abstraction to ‘leak’ and reveal the underlying complexity. The better an abstraction is, the further it has to be pushed before it starts to leak.

Testing for equality should not be the kind of Xtr333m action that causes an abstraction to leak, but in Perl, that’s exactly what will happen.

my $foo = function_to_get_input();
if ($foo == 123) {
print "Wooha\n";
}

This seems like a pretty innocent snippet, right? Too bad it will fuck up your day – unless you spend far too much work patching the holes in the abstraction. If function_to_get_input() returned a number, everything’s fine. But if it returned a string, the comparison $foo == 123 will generate a warning, because == expects a number and $foo is a string. So clearly the abstraction is leaky: Perl only provides the scalar data type, because the user ‘doesn’t need to know’ whether the scalar is a number or a string. Unfortunately, the user DOES need to know, because the interpreter is making the user responsible for matching the data types.

Warnings aside, strings in perl also evaluate to 0 in a numeric context – unless they happen to represent a number. This means that == will tell you that 0, “0″, and “My lord, there is talk of cake” are all the same thing. C has NaNs. Perl is written in C. Why does Perl think 0 is a more accurate description of “Mary Poppins is the antichrist, I have proof” than Not a Number?

The string comparison operator, eq, is a bit more generous in its argument coersion; it will automatically convert a number to its string representation. Unfortunately you end up with the same ’smushing’ effect where 1 and ‘1′ are the same thing.

Most scripting languages will have functions like is_numeric() and is_string(), which return 1 if the object is of the listed type and 0 otherwise. But Perl doesn’t have anything like that; in order to get the true representation of a scalar, you’ve got to install a module, written in C, which violates the encapsulation of the scalar to read an internal variable.

The long and short of it is that writing a block like

my $foo = function_to_get_input();
if ($foo eq "Do it") {
print "Wooha\n";
} elsif ($foo == 1) {
print "Blarg\n";
} elsif ($foo eq "1") {
print "My eyes are bleeding help help I can't see\n";
}

ends up being an entirely non-trivial affair.

Input to regular expressions can fuck the interpreter
$foo =~ s/meh/bah/;
works just fine. But suppose we want to replace the right-hand side with the variable $gee. Let’s see what happens:
$foo =~ s/meh/$gee/;
Harmless, right? Sure it is – until $gee gets assigned the value “/” and, you guessed it, the interpreter throws an error and exits. You can solve this with the \Q and \E (start quotation, end quotation) metacharacters, but this will cause a problem – backreferences won’t work. That is to say, if $gee is assigned the value “\$1″ (a literal backslash followed by the numeral one), then the code

$foo = "I know kung fu";
$gee = "\$1";
$foo =~ s/know (.*)/\Q$gee\E/;
print "$foo\n";

will print the line “I $1″ instead of “I kung fu.”

Using evaluation of the right hand as code (adding an e after the regex) can solve this problem, sort of:

$foo = "I know kung fu";
$gee = "\$1";
$foo =~ s/know (.*)/$gee/e;
print "$foo\n";

That gets “I kung fu”. But
$foo = "I know kung fu";
$gee = "\$1";
$foo =~ s/know (.*)/think $gee is awesome/e;
print "$foo\n";

will explode, because the interpreter can evaluate “$1″ as a command, but can’t evaluate “think $1 is awesome” as a command. In order to do that, we’re going to need an extra level of indirection:

$foo = "I know kung fu";
$gee = "\$1";
$foo =~ s/know (.*)/"\"think $gee is awesome\""/ee;
print "$foo\n";

Notice the two e’s at the end of that regex; they tell Perl to evaluate the righthand side as code, then evaluate the output of that as code, then use that as the substitution pattern.

Perl sucks. And don’t tell me any crap about Perl 6; the Promised Land has been on the horizon for several years now, and PHP and Python and Ruby and a million other languages are way ahead of where Perl was supposed to be. I can’t believe I thought this language was awesome. What a noob.

Author’s note: the original version of this document contained some boneheaded errors. I fixed them. Perl still sucks.

Perl Switch considered painfully slow

Sunday, September 25th, 2005

The Switch perl modules is much slower than and if/elsif/else block. The below benchmark code puts it at about 40 times slower.

I used this program to generate some test data.
#!/usr/bin/perl

@options = ('a','b','c','d','e','f','g','h','i','j');

for($i=0; $i<1000000; $i++) {
print $options[int(rand($#options))] . "\n";
}

Then I timed these two:
#!/usr/bin/perl

my $a = 0;
while($line = <>) {
chomp $line;
if($line eq 'a') { $a = $a+1; }
elsif($line eq 'b') { $a = $a+2}
elsif($line eq 'c') { $a = $a+3; }
elsif($line eq 'd') { $a = $a+4; }
elsif($line eq 'e') { $a = $a+5; }
elsif($line eq 'f') { $a = $a+6; }
elsif($line eq 'g') { $a = $a+7; }
elsif($line eq 'h') { $a = $a+8; }
elsif($line eq 'i') { $a = $a+9; }
elsif($line eq 'j') { $a = $a+10; }
}

print $a . "\n";

And:
#!/usr/bin/perl

use Switch;

my $a = 0;
while($line = <>) {
chomp $line;
switch($line) {
case 'a' { $a = $a+1; }
case 'b' { $a = $a+2}
case 'c' { $a = $a+3; }
case 'd' { $a = $a+4; }
case 'e' { $a = $a+5; }
case 'f' { $a = $a+6; }
case 'g' { $a = $a+7; }
case 'h' { $a = $a+8; }
case 'i' { $a = $a+9; }
case 'j' { $a = $a+10; }
}
}

print $a . "\n";

The Mythical Sustainable Technological Advantage

Monday, September 19th, 2005

Everyone in software startups is looking for the sustainable technological advantage. Something they can do that will set them apart from everyone else. VCs definitely tell you this is something you must have. They say this is one of the main things they looks for in a startup.

Some say it is some radical new technology no one else would ever think of. Some say it is having the right team. That you may not completely know what you want, but with the right time you will discover it as you go along. And be agile enough to stay ahead of everyone.

However I believe it doesn’t exist for startups. I think anything you can do at a boot strap or seed funding level anyone else can do. Sure you may have some new idea but once you do implement the idea, it will not be very hard for someone else to copy it and there is no real protection against this. No patents don’t count. First they are generally easy to get around, and second you can’t afford to enforce it.

At first I thought maybe this just applied to software. The cheap reproduction of it meant that it was commoditized easily, like how no one pays for a compiler, operating system, web server, web browser, office suite, video editing software, enterprise CRM, etc. any more.

But this doesn’t only apply to software, … well my brialliant non-software anecdoctal example is escaping me now. But I still believe that the same applies to any industrial revolution process like the assembly line, bicycle, tractor, cotton gin, light bulb, telephone. They are pretty easy to make after someone already built it. And I don’t think that much is stopping someone from doing it.

However all is not lost. Software still sucks. Everyone is stuck in their ways. And no one has time to do anything. There is still plenty of room to add value.

Just don’t fool yourself into thinking no one else could ever do it, too. That’s just silly.

In fact this paper is probably at least half stolen from ideas I have overheard from other people at the office.

(I plan on revising this at some point. Just a quick rant right now.)

The only two places where I see people sustaining advantages are not in tech. They are in trendiness, being a fad, or having a critical mass, like Google. Or out powering people by sheer number of lines of code that is in your software, and having the software deployed to customers providing you feedback, in a sense critical mass, like Microsoft.

And even then it is fleeting fads pass. And while you are so attached to all the code you have already written and leveraging your existing codebase you miss out on new opportunities. Or something?

1.7 Patch Woes

Monday, September 19th, 2005

CrushRidge and my iMac have not gotten along well since the release of the 1.7 patch for WoW. My Connection is always laggy like 1-2seconds of lag.

Please help, Blizzard!

Newb’s Revenge

Monday, September 19th, 2005

WoW needs a trinket to fend off this ganking by high level characters of newbs like myself.

Based on ideas from discussing this around the office, I’ve decided there should be an item that has some chance of dealing 100 times the level difference between you and the attacking character (if difference greater than 10) every 3 seconds over 15 seconds.

Basically you get attacked and even if they kill you in one or two hits they should get hit with a big surprise.

So if any GM’s out there are reading this, [Newb’s Revenge] should be in the next revision.