Recently in Trash Category

Don't Say Biz

| No Comments | No TrackBacks

Find yourself forgetting the score to your beer die games?

Forget no more with Don’t Say Biz! Just tap a stat’s number when it happens. (Works great on iPhone, too!) Little markers show up indicating each event, positioned horizontally according to when it happened:

Red markers correspond to the right side (like phono jacks) and are animated using CSS3. And, yes, before you ask: it is HTMLBiz.

Literally quoting

| No Comments | No TrackBacks

A lot of these newfangled languages (Python, JavaScript, etc.) support (at least) two types of string literals: double-quoted and single-quoted. The two don’t mean anything different.

Why not use this distinction to your advantage? I follow this rule:

  • “Double quotes” for literals that are English, or, more specifically, you can change these strings without consequence: console.log("Hello, World!")
  • ‘Single quotes’ for literals that can’t be changed willy nilly—these guys are tied to some code: $('p').show('slow')

Tell your team and unify all those quotes! It creates consistency, and also gives a hint to future developers as to what’s going on.

dotfiles

| No Comments | No TrackBacks

Because it’s the cool thing to do, I’ve created a github account to track all my dotfiles: check it.

I’ve tried to make it painless to initialize on a fresh box; just check it out (git clone git://github.com/aphahn/dotfiles.git) and run ./create_symlinks.py. It won’t overwrite any dotfiles you have, and will symbolic link to the repo. Additionally .vimrc and .zshrc will source a .vimrclocal or .zshrclocal, respectively, if they exist. This is useful for having machine-specific customizations.

Finally, I have unified configurations across my machines! No more remembering what changes I made on my work box when I’m at home! No more emailing people copies of my .vimrc when they ask for a good starting point!

The second installment of “terms of art.”

context switch |ˈkɑntɛkst swɪtʃ| noun

The art

Computers can run more than one program at a time, yet many only have one CPU. Yet when I’m programming, I don’t have to include any logic about what to do if another program needs to take over for a while. How do modern computers manage this feat, then?

Whenever the operating system determines that a different process deserves some CPU time, it pauses the currently running program and resumes the other. This is called context switching. All of the registers on the CPU (encapsulating the entire state of the program) are saved in memory, and the other program’s registers are loaded into the CPU. Amazingly, this allows us to pause and resume programs as they’re running!

Saving and loading these registers takes substantially longer than a normal CPU operation, though. Despite this performance hit, context switches occur on the order of hundreds of times per second to maintain the illusion of multiple programs running simultaneously.

Out of context (no pun intended)

the cost associated with changing the task one is working on, usually referencing the time necessary to begin to be productive in the new task : after abruptly being pulled into the meeting, the engineer requested a few moments to context switch.

Slasher's got the goods

| 1 Comment | No TrackBacks

Whenever I see the trailer for “The Goods,” I get pissed off because all I see is a fictional remake of a documentary: “Slasher.”

“Slasher” follows a used car salesman who is called in to a dealership in emergency situations—he can move cars. He comes into town with an assistant salesman and a DJ, and, in a week, choreographs a sale by tantalizing the entire city to come out and search for “the $88 car.” The Slasher is charismatic, of course, but is also addicted to nicotine, alcohol, and his family. His sales buddies provide some great comic relief from The Slasher’s tirades (also funny) and despair (not funny, but very interesting).

From the trailer’s appearance, “The Goods” follows the same scenario. But why should I object to another filmmaker’s attempt to spin a story into something funny? I’m angry because people don’t know this character actually exists—he does. A non-fiction film is inherently more engaging (and humorous) because it’s a real guy you might see in your home town one day, hawking Cutlass Ciera’s with a megaphone. A real guy who isn’t just some writer’s idealization of sleaze, but has sleaze at his core. A real guy who loves his family.

At the very least, I hope the producers of “The Goods” had to pay someone for using this story.


While not an apples-to-apples comparison, here’s some footage from both movies for you to judge for yourself. (“The Goods” isn’t released yet, and “Slasher” doesn’t have a trailer, so I just uploaded the “making of” extra on the DVD, because Docurama can’t get their shit together on their website.)

When engineers speak, we sometimes have vocabulary diffusion from one situation to another. These slips of phrases aren’t arbitrary; they make sense, but only if you know where the term comes from originally.

In this series of posts, I’ll attempt to explain one phrase you may have heard an engineer say before. (Many of these terms may be computer science-related, but I’ve caught myself using all of them around non-technical people.)

For our first installment of “terms of art:”

orthogonal |ɔrˈθɑgənl| adjective

The art

a fancy word for perpendicular; extends to other technical fields beyond math : these two lines are orthogonal.

Out of context

  1. at odds with each other; incompatible : the company’s forceful slogan was orthogonal to its otherwise wholesome branding.
  2. fundamentally different : this bug is orthogonal to the first issue.

Agree or disagree in the comments. Feel free to also suggest future terms of art!

P.S.: Since “orthogonal” means “right-angled,” does that mean an “orthogon” is a fancy word for “rectangle?”

Parallels

| No Comments | 1 TrackBack

I love finding examples of the world paralleling concepts I learn about from computers.

Lanes

Here’s one I just realized while driving the other day: lanes are great illustrations of abstraction at work. Yes, it’s possibly more efficient to let cars run freely and pack in as many cars will fit on the road, but someone realized a while ago that it’s a lot easier if we just demarcate lanes for cars to be in. We’ve abstracted away a lot of what each individual driver has to worry about. Now they just have to drive straight in their lane, and to move laterally, just see if there’s an opening in the lane next to them.

(Speaking of parallels: just like we discovered computing before discovering OOP, it also took us a while to discover lane markings after we had automobiles.)

Last Mile

Another interesting parallel has to do with the last mile problem. CDNs have figured out that they can actually beat the “regular” internet by shipping packets through their “first-class” channels, taking advantage of their already existing infrastructure. For the final leg of the delivery, they just dump the data back onto the regular network and it go from there.

FedEx has also figured this out and calls it SmartPost. By skipping over the USPS’s intermediate nodes, FedEx can get your package delivered quickly without having to burden their last mile resources.

Lens

Of course, I’m approaching all this a little backward. It’s probably just a cosmic truth that these are universally good design principles (the “last mile” Wikipedia article cites a ton of examples in nature) and I’m just viewing this through a computer scientist’s lens because that’s what I’ve been doing the last few years of my life. And I’m OK with that.

While you paged through the Tivo Live TV Guide, area man and friend of yours, Adam Hahn, resisted the compulsion to tell you about how “there was this one Onion article that made fun of the Strong Man competition” when you unknowingly flipped past the ESPN2 offering.

With mouth open, Hahn cut himself off, crucially realizing that, based on previous Onion references, the retelling of the satire would only elicit an empathetic “ha” from you. He then sunk back onto the couch wordlessly.

When asked what he would do with the time he saved fruitlessly explaining humor that must be read to be appreciated, Hahn replied, “Eh, I’ll probably write some stupid blog post or something.”

I-Search

| 2 Comments | No TrackBacks

Speaking of the USPS, I just revived an old paper I wrote back in high school. The assignment was to write about the one thing we’d always wanted to learn about, but never had the chance to explore. Being nerdy, it didn’t take me long to know I wanted to look at the post office.

Digitally remastered (i.e., I converted it to LaTeX because it was easy and fun), I present to you my I-Search paper.

It’s not great, but I still enjoy it. While I was re-reading it, I remembered that I promised to email the final version to those I interviewed. I’m sure postal employees don’t get much in the way of fan mail, so I felt compelled to follow through. I still had the USPS employee’s business card (miraculously), and shot off an email.

A second later, I received the following email:

This is an automatically generated Delivery Status Notification.

Delivery to the following recipients failed.

   jahlgren@usps.gov

Aw, he wasn’t there anymore… Well, Jim Ahlgren, if you ever google for your name, here’s hoping this comes up.

But that wasn’t the best part: the email came from—yes, you guessed it—postmaster@usps.gov!

Googling to see if others had been hit by this awesomeness, I found that the IETF beat me to it:

The objection is that by using the Postmaster token for something special, one removes that token for anyone. Thus, the Postmaster General of the United States, for example, cannot have the mail address Postmaster@usps.gov. However, one may debate whether this is a significant limitation.


P.S.: For all my LaTeX peeps, definitely check out the microtype package. One simple \usepackage{microtype} in the preamble of your document really spruces it up. Check the documentation for all it does for you. N.B.: This only works for pdfTeX, but you are already using that, right?

Fornicator Out!

| 3 Comments | No TrackBacks

A while ago, I was in San Francisco with my mom when I saw this guy on Market:

Striking, no? It seems to have caught the eyes of others, too. I love the characters because each (save ‘I’) fits into its own rectangle, but manages to do a lot with the constraint. Creative use of negative space (‘Q’, ‘M’, ‘W’, ‘B’) make the words feel like they’re chiseled out of a chunk of stone.

The colors and typeface are so great, I decided to pay homage to the man’s creativity and create a font so we can all be as loud as him. I downloaded FontForge, and after a few hours came up with this:

Much like a software application, I realized that you don’t appreciate all a nice font does until you have to make one yourself. My font (which I’ve dubbed “Fornicator Out”) only defines the characters A-Z!,, i.e., only the characters displayed on the poster. If you aren’t typing in caps, you aren’t loud enough for this font (also, FontForge’s copy/paste feature wasn’t working, so I couldn’t remap a-z to reference their counterparts).

Give it a spin. It’s a TrueType font, so it works on both Mac and Windows. If you decide to use it, just give me (and Market Street guy who probably doesn’t like my fornicating) some credit: FornicatorOut.ttf.

And now, some copy to whet your appetite for hating on “unlawful sex.”

The standard:

Let’s get into this repenting…

Of course, the real fun starts when you add color: