Recently in Trash Category

Incorporated Places

| 46 Comments | No TrackBacks

America is incredibly diverse. When I was young (but not that long ago), I always thought it would be fascinating to take a deep look at four or five randomly-chosen Americans to contrast their lives. Recently, this thought resurfaced, and I wondered, “What if I chose a random American and visited their town?” “What if I made this a Google Maps screensaver?” was obviously the next question I had.

I didn’t know what the end result would look like, but after some tweaking, I present Incorporated Places. Check it out, full screen your browser, and get lost in America. From the README:

Incorporated Places randomly chooses an incorporated place weighted by its population, zooms in to it, and pans around the area. Approximately every 90 seconds, it chooses a new place and zooms to it and beings again. You can click to cycle through road, satellite, and hybrid map modes. Other than map mode, the viewer has no control over the experience.

It is intended to make the viewer appreciate the country’s geography, think about the people living in each place, and, most importantly, please viewers aesthetically.

The source and implementation details are available on Github. Hit ⌘⇧3 if you see anything interesting!

P.S.: Looks great if you set it up as a screensaver. Websaver seemed to be the easiest way to do this.

For those of you looking for a diff of the original vs. last night’s Super Bowl performance:

Oh, the things you learn from rap videos.

Innocently watching “Hard in Da Paint,” I was absolutely mystified by what happens at 2:43:

Due to the Los Angeles Gang Injunction, this production unit was shut down.

Yes, Waka Flocka Flame introduced me to the experiment in civil law that are gang injunctions.

A gang injunction is like a normal injunction: an order from a civil court for someone to stop doing something. In these cases, the complainants are “People of the State of California,” arguing that a gang constitutes a public nuisance for the neighborhood in which the gang operates. (Yes, the gang is the other party being sued.) If the judge decides in the People’s favor, an injunction is issued, prohibiting named suspected gang members from doing various legal and illegal activities within the proscribed area (“turf” normally measured in square blocks).

I couldn’t find gang injunction specifics on LAPD’s webpage, but San Francisco was on it. Reading further, I discovered that I live in a gang enjoined area (or, as the state puts it, the “Norteño Safety Zone”):

Norteño Safety Zone

I’m speculating as to the specifics of LA’s gang injunctions, but if they’re phrased similar to San Francisco’s, here are a few reasons the police could have stopped production of the music video (bold indicates otherwise legal behavior):

  • Using marijuana without a prescription
  • Knowingly remaining in the presence of someone using marijuana
  • Flashing gang signs
  • Wearing red clothing, hats, or accessories
  • Standing, sitting, walking, driving, gathering, or appearing anywhere in public view with any known gang member
  • Loitering with intent to commit a narcotics-related offense as proscribed in Health and Safety Code §11352
  • Blocking the passage of people or vehicles

Reading the filings tears me. Photographs of gang members at neighborhood landmarks are entered as evidence. Expert testimony from local cops detail incidents at familiar intersections. Of course I want my neighborhood to be safe, but not at the cost of fundamental rights violations. Yet, the court has spoken: the nuisance we incur from these affiliated individuals outweighs their freedoms. Actions legal for me to do in front of my house, they are prevented from doing next door. They get hit with contempt of court—I stroll past in my red Adidas.

I’m wary of civil remedies for criminal behavior, and I’m not alone. The ACLU of Northern California, working with the state, created the essential process by which a named gang member can petition to dissociate. Other jurisdictions (notably, New York) have simply found gang injunctions legally unworkable.

Suffix fix

| 1 TrackBack

My friend Ben tweeted the following:


These are sets of prefixes and suffixes that expand to English words (squalor, squalid, stupor, stupid…). Inspired and curious, I wrote a short script to generate more of these:

[adam@Adam-Hahns-MacBook:~]$ ./ or id /usr/share/dict/words 
[adam@Adam-Hahns-MacBook:~]$ !!|wc -c
./ or id /usr/share/dict/words|wc -c

Uh-oh, my script generated more than Ben’s grepping! Granted, not all of them would fit in a tweet, so I’ll have to forgive him. What other fun can we have?

[adam@Adam-Hahns-MacBook:~]$ ./ a e i o u /usr/share/dict/words 
[adam@Adam-Hahns-MacBook:~]$ ./ ly tty /usr/share/dict/words

Ben also informed me of a neat shell trick!

[adam@Adam-Hahns-MacBook:~]$ echo {be,unwi,co,pu,sca,wi,pa,po}{tty,ly}
betty bely unwitty unwily cotty coly putty puly scatty scaly witty wily patty paly potty poly

If you’re interested, here’s the source of

Don't Say Biz

| 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 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.


| 1 TrackBack

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:// and run ./ 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?”