The random rantings of a concerned programmer.

Archive for September, 2008

(Untitled)

September 29th, 2008 | Category: Random

I’m working on an expressive workflow language at work, and have hit a bit of a design standstill (in a couple of places, really). The place that I realized I hadn’t come to a conclusion was lexical vs. dynamic scoping. My language is pure (no destructive assignments are allowed, period) and I think that helps outline the problem more clearly.

In a lexically scoped language, an if block introduces a new level of scope (from which the old is also visible). For example –

if ( bampu ) {
    int pantsu = 1;
}
printf( "%d\n", pantsu );

Is a semantic error in C (because pantsu isn’t in scope outside the if block), but works fine in a dynamically scoped language (Ruby, Python, PHP…). The obvious way to “get it working” in C is to declare pantsu in a higher scope –

int pantsu;
if ( bampu ) {
    pantsu = 1;
}
printf( "%d\n", pantsu );

And it works fine.

The problem here (and the reason why I’m banging my head on lexical scoping) is because this just introduced a destructive assignment (on the bolded line), something my language outlaws for performance reasons. With these constraints (both lexical scoping and no destructive assignments) the programs get a lot more functional in feel — rather than operating on stuff procedurally, you’d branch to a different function which took pantsu as an argument or something. This is a shit example for illustrating what I mean and I cbf’d to write out a better one.

Dynamic scoping isn’t the solution, either, I think. With dynamic scoping, static analysis of a program gets shot to hell.

Realistically though, I’m the only one who’s ever going to use this, so it doesn’t make much of a difference. I should just get the goddamn thing done and call it a week.

4 comments

(Untitled)

September 28th, 2008 | Category: Random

Got a deadline at work, have 8 more days to get a functional production prototype of my workflow engine (the version written in C as an application running from my Apache SOAP module). Wrote the new lexer/parser last night with lex+yacc (the old compiler used a PEG written in Ruby). Still need to write both the compiler backend and the actual interpreter; I’m stalled because I’m fluttering back and forth on whether I should serialize persistent state (workflow processes can run for months/years at a time) to flat files or an RDBMS (or, if both, what data goes where). I don’t really want to introduce the extra complexity of an RDBMS, but I think I’m going to have to.

But enough of that boring shit.

With yet another major bank teetering on the edge of financial collapse (and with no end in sight), I’ve basically come to the conclusion that our economy is just plain fucked. I’ve decided that when the social order breaks down, I don’t want to be a fatass. I want to be a fatass with a gun. Myself and a couple of friends have been talking offhandedly about buying a couple AK-47s (the price ranges from $250-800 depending on the quality; a case of 1000 rounds costs $200) and a good amount of ammunition. I’ve got a couple grand saved up (and sitting in a bank…) which might be well-spent on a new form of entertainment, though I still need to find a good range around here.

I’d post on /k/ asking for advice, but I know better. inb4 conspiracyfag, it’s mostly for the lulz.

EDIT: Though really, at $200/1000 rounds, it’s a terrible idea. It’d be much smarter to get a .22 of some sort so I could actually afford to practice with the thing. There’s a range a couple miles from my house apparently, and they offer training and shit so I’ll probably check that out one day (they have loaner guns hooray). Should be a fun thing to do one weekend.

4 comments

copypasta

September 24th, 2008 | Category: Random

Goddamn this post was fucking epic –

And then there’s Haskell…

Haskell is like “that girl.” You know the one…

You never really went steady, but you’d run into her from time to
time while knocking around in disreputable joints, usually late at
night, every several months or so. She looked so hot, so sleek, so
sexy, so expressive, so exotic. You’d end up back at her place and
the night would just… take off. A complete blur of hot, sweaty,
feverish, delirious, fumbling passion. You’d do things to each
other… you’d do things to her, she’d do things to you… things
that you’re not even sure have names, that you’re pretty sure are
illegal almost anywhere. Even her kinks have kinks — and after one
of these nights, you’d realize that you yourself had a lot more kinks
than you. And it wasn’t just physical, it was — cerebral.
Ethereal. Transcendent. But it would all whiz by in a blur, and by
morning you’d find yourself lightheaded, a bit confused, and
stumbling homeward to your regular gal.

Over the next few days and weeks you’d find yourself occasionally
drifting away, thinking about her. Haskell. You’d be there, banging
away at your regular girl, and find yourself thinking “you know, if I
was with Haskell, I’d be doing this completely differently.” You’d
think “I could be doing so much bigger and better stuff with
Haskell.” Now, your regular girl, she’s not as exotic as Haskell.
Pretty, maybe, if you’re lucky. (Perhaps your regular girlfriend’s
name is Python. ;-) But not nearly as — weird. Wild. Cool.
Exciting. Don’t get me wrong — your girl, she’s wonderful. You’ve
got a wonderful relationship. She’s — comfortable. You can bang
away at her all day and night. She’s accommodating. Easy going.
You work well together. But — confidentially — she’s, well,
maybe just a little bit boring. You’d catch yourself thinking these
things, and the guilty pangs would get to you… You’d quash the
thoughts, buckle down, and get back to banging away. Comfortable…
there’s a lot to be said for that, ya know? Comfortable… just
keep telling yourself that.

Months would go by. Late some night you’d find yourself out,
disreputable places again. Maybe that hacker bar, LtU. Somebody’d
slip you an URL for some renegade paper, you know, one of *those*
papers. You’d run into Haskell again. And the whole thing starts over.

Eventually, you’re going to get the ultimatum. Haskell’s ultimately
just like any other girl on some level; she needs commitment.
Eventually, after one night of wild, feverish, kinky, abstract
passion, she’s going to say to you: “All these times, and you don’t
understand me at all! You know, you’re going to have to get serious,
mister! I’ve got needs, too. You’re going to have to get serious
about my monads, or that’s the last time you’re going to play with
them! Got it?”

…and then, you’ve got to make The Choice.

Chances are, you’re going to go back to your regular gal. Haskell’s
just too much for any one man, probably. She leaves a trail of
broken, brainy, embittered PhDs and former programmers behind her.
She ruins you for the RealWorld. You can ride a while, but you
probably can’t go the distance with her. Go back to your regular gal
and try not to think too much about what you’ve seen. Done. Felt.
Thought.

Maybe you can salvage a little happiness; but it’ll be hard. After
all… you’ve tasted Haskell.

She’s not like anything else.

3 comments

(Untitled)

September 22nd, 2008 | Category: Random

I fucking hate my fucking cuntlicking job holy fuck. Our “production environment” for the project I’m supposed to be working on looks like this –

  1. JAVA. Never written a single fucking line of Java in my life, and hope to keep it that way.
  2. TOMCAT. A “web server” which can rape itself in the face for all I care. I’ve never seen anyone who could set it up in a way that it didn’t crash every 6 hours (and it crashes in such a way that it brings down the entire server). Not to mention the configuration files alone are larger than most reasonable projects I work on and entirely in XML.
  3. FEDORA CORE 9. That’s right. A goddamn DESKTOP LINUX DISTRIBUTION on our PRODUCTION servers. If that weren’t enough, it uses a fucking RPM-based fucking package system such that you can’t fucking install Apache without dicking around, you have to jump through a fuckton of goddamn hoops to get Sun’s JVM installed (because all other JVMs are broken) and neither version of Tomcat available (5 or 6) works out of the box.

I’m either going to get fired or kill myself. I suspect most of this is just coming out because of the fucking cold meds I’m on to lessen the chances of drowning in my own snot (fucking pharmaceuticals cost ten fucking bucks raptor jesus what kind of sick fucking world do we live in) and they’re not even really working because now I’m just coughing up blood instead of blood and phlegm.

It’s a shame this box says “DO NOT MIX WITH ALCOHOL” otherwise I’d be fucking drunk right now. Given how little this shit is doing I think alcohol might have been the better choice in the long run. Fucking dammit!

5 comments

4scrape Scalability?

September 20th, 2008 | Category: Random

I guess it was last night or the day before, but 4scrape has already gobbled up 200,000 posts from /w/ and /wg/. That’s a shitload of posts — Suigintou’s MySQL database now weighs in at 213MB and I’m not sure when she’s going to crack.

Maybe it’s just my internet connection (lol wireless) but it seems like searches are starting to take a second or two to process. It’s not that big of a deal because search results are cached, so it only actually hits the database when you first do the search (and not when you view additional pages from the results), and the cache gets flushed after the scraper finishes up every day. Eventually the database is going to bottleneck, but I still haven’t revived my Windows machine (cbf’d to buy a real license) and it’s a monster with 5GB of RAM that’s just begging to have a nice large database sitting in memory.

Another problem that’s probably more relevant is keeping the indexed data coherent. Say, for example you wanted to search for Rider from Fate/Stay Night (pic related). Your first search would turn up some desired pics, but you’d also hit shit that’s not Rider. If you then did a post search you might notice that the unrelated images are shit from Ghost Rider and Kamen Rider, so you might refine your query to “rider -kamen -ghost”.

Very few people, I think, go this far and it’s a bit of a problem. The metadata is completely valid (sometimes?) — it would be incorrect to make “rider” not turn up hits for “ghost rider” and “kamen rider”. At the same time, it would be nice if the system could say “hey did you mean Rider from Fate/Stay night? or Ghost Rider?”, but there’s not really a way to have it autonomously do that.

And I really don’t want to open the gates to non-autonomous metadata generation — as soon as I start indexing on user-generated values and shit it’s going to turn into an administrative shitfest, I think. Bleh.

4 comments

Next Page »