Tuesday, July 24, 2007

V1agra Cheap!!! Teen Sluts

The last few posts have been delayed because Blogger thinks I may not be a real human being, but rather a sophisticated spambot sent back from the future to corrupt everybody's .emacs file.

Hill Country, NYC

The New York Times review on Hill Country—the new Texas-style barbecue joint in Chelsea—is correct in every particular. I would add that I found the fatty brisket too fatty (I'm not one to complain about fattiness in general) though still absolutely delicious, and that Hilleary and Stephen were terribly offended by the number of lines involved.

A Dubious Assertion

Being a conscientious software engineer, I try to be good about putting assert statements in my code. And being a verification guy, I find myself tempted to express fairly deep correctness properties in my assertions. And this fills me with such satisfaction, that I am such a wise and clever programmer, that I should do such things.

But then I'm trying to optimize some code so that it runs in something like an acceptable amount of time and for some reason I just can't shake this routine out of its stupor... What's going on here?

Don't add assertions that change the asymptotic complexity of your algorithm. That's just dumb. (Of course you can always compile your code with assertions turned off, but even in testing the difference between O(n) and O(1) can pinch.)

And now look at how much more wise and clever and self-satisfied I can be.

Monday, July 09, 2007

Changing your PATH in Emacs' compilation mode

[UPDATE: This is not really wrong, but not really right either. See below.]

I was a bit surprised at this problem, but I suppose most people use standard make or gcc to build... I want to build my project with a version of OMake that I have compiled and installed in my home directory. I have ~/tools/bin in my PATH, but for some reason M-x compile still gives me

/bin/bash: omake: command not found

The trick is that Emacs invokes the compile command in a non-interactive, non-login shell, which means that neither your .bash_profile nor your .bashrc (or any variations thereof) are going to get read.* The workaround is to set BASH_ENV to point to a script file that sets your PATHbash reads the file pointed-to by BASH_ENV in non-interactive mode. Here's my solution:

~/.bash_profile:
. ~/.bashrc

~/.bashrc:
export BASH_ENV=~/.bash_env
. "$BASH_ENV"

~/.bash_env:
export PATH=/home/chris/tools/bin:$PATH

There's probably a good reason why this is a bad idea, but it works.

* A quick refresher course: .bash_profile is for login shells; .bashrc is for interactive, non-login shells; BASH_ENV is for non-interactive, non-login shells (which, confusingly, will probably be a sub-process of an interactive and/or login shell, which is why the above example works).

[UPDATE] The compilation shell being non-interactive and non-login is a red herring. While this is certainly the case, a non-interactive, non-login shell will inherit the environment of it's parent process. So, for instance, if your PATH is properly set in your shell and you invoke Emacs from the command line, things should be fine.

What was really causing my problem is that I was invoking Emacs from the Gnome Panel. The environment that Emacs inherits in this case is Gnome's, not Bash's. How do you change the PATH in the Gnome environment? Um... Eh... gnome-session-properties? .gnomerc?

The solution I've settled on is to create a .xsession file as follows,
~/.xsession:
#! /usr/bin/bash

if [ -f ~/.bash_env ]; then
. ~/.bash_env
fi

exec gnome-session

where .bash_env is as above.

NOTE: If you leave off the last line, your X session will end before it begins. The .xsession script is the X process: when it ends, the X process ends. Execing gnome-session replaces the script process with the Gnome session process.

[UPDATE 2] Of course, another option is to just use setenv in your .emacs file. TMTOWTDI, in Emacs and Perl alike.

Saturday, July 07, 2007

Lessons in Vegetarian Cooking

Sautéing tofu dogs is a bad idea.

Tuesday, July 03, 2007

A very witty observation that could render my education worthless

"There is no silver bullet—but there are no werewolves."
From No Name: Just Notes on Software Reuse by Robert Biddle, Angela Martin, and James Noble. In response to Frederick Brooks.

The Post-CD Universe

I have recently finished ripping our entire CD collection to MP3. We now officially live in the post-CD universe. From now on, all of our music will be acquired in digital form (from eMusic, when possible). The final stats according to iTunes are: 16,804 songs, 42 days playing time, 77.04 GB (that's 60% of the usable space on my shiny new 400GB hard disk).

The project took me about a month of evenings and weekends, processing the 50-75% of our CDs that had never been ripped (or had been lost in one of the great iPod disasters of '04, '05, or '06 (Never again!)).

Over that month, I've heard the following objections expressed by multiple guilty parties.

Objection: "But I like CDs. I like the medium. I like the having them."

Response: You are a fool. You are a human being, not a magpie: you don't need a pile of shiny discs to validate your existence. Compact discs have no inherent value beyond the information that is encoded upon them.

Objection: "But the sound quality is not as good."

Response: You are talking to someone who cut his teeth listening to DIY 7" records, cassette demos, and entire albums recorded on boomboxes. I ripped everything, including the jazz and classical, at 192kbps/VBR (i.e., "near-CD quality"). And that is good enough for me. If you have a problem with that, you are a wanker. If you persist in this objection, I will ask you to leave. (This includes you, Hilleary.)

Remember When? (Summer Fruit Edition)

I just had a damn satisfying bowl of cereal with strawberries and blueberries in it, made all the more satisfying (but at the same time dismaying) by all my failed attempts to have this same bowl of cereal with strawberries and blueberries for the last several months. Apparently they are now actually in season and so they actually, you know, taste good. But even though they previously weren't in season and didn't taste good, the grocery store kept putting them out there for me to buy (at tantalizingly reasonable prices) anyway.

It's ironic, in this world where you can buy summer fruit in January and winter vegetables in August*, where global supply chains are devised to deliver to the consumer everything he wants when he wants it without respect for climate or geography, that we've actually lost a convenience that was intrinsic to the old order: the strawberries, blueberries, apples, peaches, plums, and nectarines only showed up at the grocery when they were good (or just a little bit before. And stayed around just a little bit after). You didn't have to be a student of agriculture with a sharp eye for quality to know when it was and was not OK to buy strawberries: it was OK to buy them for the 3-4 weeks that they were available in grocery stores. Now, it's just a constant exercise in mental discipline and delayed gratification. Ick.

Perhaps this is why I should do more shopping at the farmers' market.

POSTSCRIPT: Hilleary should not read anything in this post to confirm insane and inconvenient ideas developed while reading The Omnivore's Dilemma

* Who wants winter vegetables in August?

Sunday, July 01, 2007

Una Pizza Napoletana

Last night, H and I wandered pretty much randomly* into the latest pizza lovers' obsession, Una Pizza Napoletana. The menu is suicidal. There are exactly four food items, all pizzas. No appetizers, no sides, no desserts. The choices are: Margherita (plain), Marinara (no cheese), Bianco (no sauce), or Filetti (with cherry tomatoes instead of sauce). No slices, no toppings, no substitutions. A basically-individual 12-inch pie is $21 (ouch), any variety. There is a similarly limited and uniformly-priced list of wines and beers, which are served lukewarm in a plain drinking glass.

So the pizza better be pretty fucking good, right? Well... it is. Pretty fucking good. Perfect crust: crunchy, chewy, salty, etc. Nicely balanced sauce, nice cheese, fresh basil. Not my favorite pizza in the entire world, which is still either Di Fara in Midwood (a moment of silence...) or Vito's Pizza of Hamilton, NJ, which was for me like mother's milk. Still, damn good.

But... can we cut the crap? I've had una pizza Napoletana. In Napoli. And they have toppings. Nice toppings. Like arugula and prosciutto. Or artichokes. Or ricotta.

I mean, for fuck's sake, people, loosen up. You're doing good work. Now give me some ice cream.

* Momofuku had a wait and we were trying to catch a movie (Ratatouille, which was entertaining, as expected).