Stories
Slash Boxes
Comments
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

mdxi (4658)

mdxi
  (email not shown publicly)
http://mdxi.collapsar.net/

Journal of mdxi (4658)

Sunday May 22, 2005
09:52 AM

AntiLiveJournal

In one of those weird synchronicity things that happens now and again, several friends have recently complained at me that they'd like an online journal kind of thing, but don't want to use one of the big popular sites. Apparently livejournal's Whiney Emo Fucktard stigma is more widespread and mainstream than I thought.

Naturally all this planted the idea firmly in my head: I must help my friends by crafting a non-sucky, lightweight journalling platform. So that's what I'm doing this weekend, even though I hate web programming. Of course it's really simple (unlike the nightmare of forms processing that is kdict), so it doesn't hurt too badly so far.

In other news, K has decided that she wants an app similar to the One PIM To Rule Them All that I've been meaning to write for some yeard now, only she wants it as a Cocoa app, and while I find Xcode and Interface Builder to be completely awesome tools for GUI app building, I don't know ObjC and am fairly put-off by the brief glances I've taken at the docs for it. Maybe this Camelbones thing will hurry up and get done.

Wednesday May 18, 2005
11:23 PM

NOTHING

I did nothing today. Felt mildly crappy (so much snot coming out of my head) and just wanted to chill. Watched the Sony and Nintendo E3 press conferences. I'll talk about those later. Eventually went for a walk, then did some more nothing, then made some dinner. Now, I am thinking, sleep.

Tuesday May 17, 2005
10:31 AM

For Robert

1) Total number of books owned?

854, not counting periodicals, catalogs, or manuals

2) The last book I bought?

Omnibus edition of the Journal of the Association of Engineering Societies, volumes XIII and XIV (1894 and 1895)

3) The last book I read?

I think the last non-reference I actually completed reading was Mark Kurlansky's Salt.

4) Five books that mean a lot to me:

I hunted Arnold Roth's Crazy Book Of Science for years and read it a thousand times when I was younger, so it must mean something. The other four I'll have to think about.

Monday May 16, 2005
06:20 PM

Owwww

Last night my eyes were watering a bit due to allergy type stuff. I absently dabbed at the corners with a bit of tissue, and suddenly my left eyelid fluttered open and closed, trapping part of the tissue against my eyeball.

Once I quit freaking out (just a few seconds, I swear) I went and examined the situation in the bathroom mirror, pinning my eye open Clockwork Orange style with two fingers. The tissue had become saturated with tears and was plastered on the leftmost part of my left eye, with the very edge of it just visible on my iris. It was disgusting. And painful. And irritating. I tried rinsing it off and plucking it off like a contact lens, but it wasn't having it. After a while the suck subsided ever so slightly and I went to sleep.

This morning my left eye cracked open and stared out through a haze of god knows what. Some rapid blinking cleared things up somewhat, and my eye seemed to be bothered a bit less, but there was still clearly a lump of tissue crud affixed to it. I figured I'd have to go humiliate myself at an opthamologist's office, but within an hour it was obviously starting to feel better. Apparently it had pretty much broken down and was being slowly flushed out the outside corner of my eye as a slow, thick stream of gunk and crust.

By mid-afternoon it was gone. Currently my eyes just feel a bit tired and look like I've smoked a couple kilos of marijuana.

Sunday May 15, 2005
09:21 PM

Benchmarking

Started learning Haskell today. So far, it's neat and only minimally annoying (stupid types). Knowing Perl and Elisp make it not too brain-stretchy. Actually compiling code feels odd...it's been probably since my last C++ class in 1999 that I compiled something written by myself.

One of the early examples in the tutorial I'm working through (YAHT) involves -- surprise -- the Fibonacci series, implemented recursively. Out of curiosity I wrote an iterative version in Perl and started running them side-by-side. First the code:

--
-- This is Haskell...
--
module Main
    where

import IO

main = do
       hSetBuffering stdin LineBuffering
       putStrLn "Find which Fibonacci number?"
       num <- getLine
       putStrLn ("F[" ++ num ++ "] is " ++ show(fibo(read num)))

fibo 1 = 1
fibo 2 = 1
fibo n = fibo (n - 2) + fibo (n - 1)

#
# ...and this is Perl
#
$num = <>;
chomp $num;
$t1 = 1;
$t2 = 1;

for (1..$num) {
    if ($_ == 1 || $_ == 2) {
        $f = 1;
    } else {
        $f = $t1 + $t2;
        $t1 = $t2;
        $t2 = $f;
    }
}
print "F[$num] is $f\n";

The Haskell code was compiled with no special options using ghc. The perl was run under Perl, twice the first time, so that perl(1) would be buffered. Things didn't get interesting until around the 30th number in the series:

mdxi@fornax:~$ time ./haskell/fibo_hs
Find which Fibonacci number?
30
F[30] is 832040

real    0m0.672s
user    0m0.432s
sys     0m0.004s
mdxi@fornax:~$ time perl fibo.pl
30
F[30] is 832040

real    0m0.240s
user    0m0.002s
sys     0m0.002s

This is where you can finally start to see a difference between recursive and iterative implementations. By 40 the difference was staggering:

mdxi@fornax:~$ time ./haskell/fibo_hs
Find which Fibonacci number?
40
F[40] is 102334155

real    0m52.804s
user    0m52.541s
sys     0m0.024s
mdxi@fornax:~$ time perl fibo.pl
40
F[40] is 102334155

real    0m0.256s
user    0m0.002s
sys     0m0.003s

It took the recursive implementation 1m26s (162% longer) to find number 41 and 2m17s (147% longer than 41; 240% longer than 40) to find number 42.

Meanwhile the iterative implementation took 0.43 seconds to find the 100th number and the same amount of time to find the 500th. At this point I figured my typing lag was taking most of the time, so I rewrote the perl to use command-line arguments (I don't know how to handle that in Haskell). With this change, the iterative approach took 0.005s to find the 1000th number of the sequence, and (0.014, 0.111)s to tell me that perl(1) considers the (10,000; 100,000)th numbers equivalent to infinity.

What does this tell us? Other than that I am easilly amused, pretty much just that: the flip side to TMTOWTDI is that not every way is the right way for the job at hand. But we all knew that already, right?

09:07 PM

Console Wars

To borrow a metaphor...

Episode IV: Atari 2600 vs The World Winner: Atari 2600

Episode V: NES vs SMS Winner: NES

Episode VI: SNES vs Genesis Winner: SNES

Episode I: Saturn vs N64 vs PSX Winner: PSX

Episode II: Dreamcast vs PS2 vs Gamecube vs Xbox: Winner: PS2

E3 starts tuesday. This is when we finally get some idea of how Episode III may shape up.

Microsoft has finally come clean with some actual detail about their system, and it looks pretty good. They've realized that the best way to make a gaming console actually isn't to pretend that it's a really cheap PC (though they persist with their "vision" of a unified "media center"). The hardware is impressive. The idea of everyone getting online access would be a world-beater, but they only mean everyone gets chatting and downloadables, etc. You still have to pay for multiplayer stuffs. Gameplay on the few titles they've shown looks...well, it looks like you'd expect. Better. Smoother. The big question in my mind is: will the XBOX2 have any games worth playing? The original finally gained about 5 titles which weren't first-person shooters, fighters, or racing games; can this iteration do better? The controllers still look sucky though. Little tiny glossy buttons is still not the way to make a good controller, and making the gigantic logo in the middle light up doesn't change this.

Sony hasn't gone public with the PS3 yet. There's been rumors and conference whitepapers on its processors (note the non-use of "CPU"), but no hard data on the actual configuration of the system. There are screenshots of games coming out now, and they look...they look like renders. I've read several people's statements that screenshots no longer do games justice, and I believe it. I'm gonna need to see this stuff in motion. I'm not worried about games for the PS3 -- it has all the Japanese developers behind it, and with the runaway success of Katamari Damacy, I am hoping that more of them will be willing to release more of their "quirky" games to the North American market. I'm also sure that the PS3 will have built-in networking capabilities (any whitepaper on the Cell processor makes this clear) but no one knows what Sony is going to do with this. I'll also be pretty disappointed if there's no hard drive...memory cards suck balls, and you're gonna want to do something with that ethernet jack, right?

Nintendo isn't showing the Revolution at E3, and personally, I'm having a hard time caring. In recent years they've done nothing but take a "we know what you want better than you do" attitude and make promises which haven't even vaguely been kept. They're not showing the R because if they did "people wouls steal [their] ideas". You may remember that this is the reason Mario 128 didn't show at the LAST E3. Remember Mario 128? Remember how Mario Sunshine was a stopgap side-story and not the tru successor to Mario 64? Remember how Mario 128 would be out real soon now? In 2002? This behavior sounds strangely familiar somehow...can't quite put my finger on it...hmm. Anyhow, I'm really thinking Nintendo needs to be reborn as a software-only company, like Sega has. Then I won't need to buy a whole freakin' console just to play the next Zelda game.

Saturday May 14, 2005
04:40 PM

Undocumented Features

I was going to write myself a little Firefox extension just now. A teeny tiny textbook example of an extension to add a single item to the right-click menu. I wanted to be able to view an image in a new tab and others agreed this would be a sensical addition, so I started googling for HOWTOs and docs. It didn't take long to find pretty much exactly what I wanted because everyone seems to use this very action (menu modification) as the example of how to write an extension.

I grabbed a FF nightly, modified its registry to point to the unzipped versions of the chrome jars, and dug into the code. Finding the right starting point wasn't difficult, and I was just getting warmed up and about to make a first simple edit just to replicate the "View Image" entry and change its label, when I noticed this line in its stanza:

onclick="checkForMiddleClick(this, event);"

Why would a context menu entry be middle-click sensitive? The only thing middle-click does in Mozilla is...open...things in...new tabs. Hmm.

Right-click; middle-click; BING!

Dang, I was looking forward to writing that and learning something new.

01:54 AM

MCLOCK

Once upon a time (in high school, so, like 1992) Josh and I had the best idea ever: what if instead of, like, hours and crap, you just divided the day up into 1000 equal segments? Dude, that would be awesome. And completely unoriginal, but you think everything is your idea when you're an ignorant teenager.

Fast-forward a couple of years (1996). I'm working at TSYS, hating my life, and one night K and I are ambling down the walkway which goes along the Chattahoochee and was very nearly the only nice thing about that town. For some reason (was I already working on it???) I have my TI-85 with me, and I finish my first implementation of mclock, the metric timer.

PROGRAM:MCLOCK
ClLCD
Disp "-----m c l o c k-----"
Disp "Enter current time in"
Disp "24h format. Hint: add"
Disp "15s as a pad."
Disp "
Input "Current hours:",STDHOUR
Input "Current mins.:",STDMINS
Input "Current secs.:",STDSECS
(STDHOUR*60*60)+(STDMINS*60)+STDSECS-&gt;STDSECS
STDSECS/86.4- &gt;MTIME
ClLCD
Disp "Current metric time"
Disp "is below. Enter it at"
Disp "the prompts."
Fix 2
Outpt(3,14,MTIME)
Float
Input "Hundreds digit  :" Z4
Input "Tens digit      :" Z3
Input "Ones digit      :" Z2
Input "Tenths digit    :" Z1
Input "Hundredths digit:" Z0
ClLCD
Outpt(1,6,"**********")
Outpt(2,6,"* mclock *")
Outpt(3,6,"**********")
Outpt(4,6,"*    .   *")
Outpt(5,6,"**********")
Outpt(4,8,Z4)
Outpt(4,9,Z3)
Outpt(4,10,Z2)
Out pt(4,12,Z1)
Outpt(4,13,Z0)
Outpt(7,1,"   TI-85 ver. 0.3"
Outpt(8,1,"Press a key to quit."
While getKy==0
For(TIMR,0,339,1)
End
If Z0==9
Then
Z0=-1
If Z1==9
Then
Z1=-1
If Z2==9
Then
Z2=-1
If Z3==9
Then
Z3=-1
If Z4==9
Then
Z4=-1
End
Z4+1-&gt;Z4
Outpt(4,8,Z4)
End
Z3+1-&gt;Z3
Outpt(4,9 ,Z3)
End
Z2+1-&gt;Z2
Outpt(4,10,Z2)
End
Z1+1-&gt;Z1
Outpt(4,12,Z1)
End
Z 0+1-&gt;Z0
Outpt(4,13,Z0)
End
ClLCD

I also wrote the obligatory die roller, and apparently started on something called UNICON, whose abortive code bills itself as a "Programmer's Multi Function Converter". It seems to have wanted a decimal integer as input, and would have returned the number in hex and octal plus the ASCII and EBCDIC characters. What was I thinking? Was I seriously planning on embedding 2 whole character sets (I can only assume I was going to pick one of the EBCDICs) in a TI-85 program?

Oh, those were bad days.

Wednesday May 11, 2005
11:38 PM

God Doofus of Dune

23:56 <@bda> It's weird...
23:56 <@bda> Going from Children of Dune to God Emperor was kind of like...
23:56 <@bda> Going from Stormwind to Daranassas.
23:56 <@bda> ...
23:56 * bda sighs.
23:57 <@bda> brb, punching self in groin.
23:57 <@ejp> heh
23:57 < solios> the Second Half of Dune is only for the hardcore.
23:57 < solios> it's like the First Half of star wars. :P
23:57 < solios> all the gay, but you read it anyway because you liked the first half.
23:57 <@bda> According to to O'Donnell, Herbert wrote the first three books at once.
23:57 <@bda> Which makes sense.
23:57 < solios> they read like it.
23:57 < solios> more or less.
23:57 <@bda> Taken as a whole, they're Complete.
23:58 < solios> I mean, there's a HUGE paradigm shift after Dune.
23:58 <@bda> Paul bowing out from becoming The Mantrout.
23:58 < solios> so it stands more to reason that he wrote Dune, THEN wrote Messiah and Children.
23:58 <@bda> Yeah.
23:58 <@bda> Well.
23:58 < solios> but they're logical extrapolations of what's going on in Dune.
23:58 < solios> I mean, you KNOW that's where it GOES.
23:58 <@bda> Supposedly he had it all in his head and it was all written at once.
23:58 <@bda> Yeah.
23:58 <@bda> And then...
23:58 <@bda> THREE THOUSAND YEARS IN THE FUTAR
23:58 <@bda> DUM DUM DUM
23:58 <@bda> I dunno.
00:01 < mdxi> Duncan Idaho MCMLXVII strode with purpose into Leto's chamber, hand raised in the challenging gesture of a teacher to a familiar student. "Now look here," he said, "I'm getting pretty tired of living in 20 minute spurts. You've really got to..." His words were cut off as the transmogrified Leto, hearing Duncan's words through the spice haze and his degenerating humanity, bellowed with rage and rolled about the chamber, crushing his old mentor with his bulk.
00:01 < mdxi> "Well fuck," said the Tlilaxau, "back to work..."
00:02 * bda stares at mdxi.
00:02 <@bda> >_<
00:02 < solios> mdxi: dude, he'll be there in about six pages. Don't spoil any more of it for him.

Sunday May 08, 2005
06:59 PM

Good Day

We returned to the trail with the old quarry and hiked the full 2 miles of it. It was a beautiful, sunny, warm spring day. The tail end of the trail had a uphill section that was a little too long for comfort, but if you're comfortable you're not getting anything out of it. I really must return in a day or two with camera.

An article I wrote is up on Groklaw today. Hello, world. Some people seem to like it fine, and a few seem to be fixating on the intro PJ prepended to what I actually wrote and are busilly taking issue with that. I don't think I'll be posting any comments in the discussion; I'll just watch from over here. It's rather tension-inducing, knowing that something you wrote will be read by hundreds of thousands of people in the coming days.

One person has already taken exception to my characterization of FORTRAN as a "less well-known" language. Welcome to the twenty-first century, my friend -- I know it's there and you know it's there, but believe me, not many of the new crop coming up do.