Archive for April, 2009

Fublag has a Twitter

There are several reasons for this:

1. I use Facebook in a very Twitteresque way, and often about impersonal things I could say anonymously.
2. I have random ideas that don’t make it onto the site, and I’d hate to deprive my dozens of readers of the thoughts that occur to me at 1 in the morning.
3. Much like CNN, I figured I might as well see what the buzz is about.


April 22, 2009 at 8:07 am Leave a comment

The “Hello World” from Hell, with exponential backslashes!

print eval("\"He\"+eval(\"\\\"ll\\\"+eval(\\\"\\\\\\\"o \\\\\\\"+eval(\\\\\\\"\\\\\\\\\\\\\\\"Wo\\\\\\\\\\\\\\\"\\\\\\\")+\\\\\\\"r\\\\\\\"\\\")+\\\"l\\\"\")+\"d\"")

All those backslashes are escaping each other, in order to escape the “.

To explain: in Python, the eval() statement evaluates a string as source code. eval(“5”) returns 5. Of course, this leads to messiness when you nest eval()s. For example: eval(“[5, eval(\”4\”)]”) returns [5, 4].
Further reading: “Escape Artist” by our good friend xkcd.

But look at that code at the top of the post. Couldn’t we automate the process of typing up all those backslashes?

April 21, 2009 at 7:35 pm 1 comment

Doodlemaker: colorful random walk in Pygame

I should have posted this long ago. It was a big reason I got a blog.

Sample image:
purty colors :)

Source code:
This has much more documentation than most of my scripts, but still not enough, really. If you have any questions at all, feel free to ask here or via email.

You will need Python and Pygame for this to work.

Longer sample:

April 10, 2009 at 10:56 am 2 comments

“Tabula Rasa” got published!

The wonderful site 365 Tomorrows puts a new “flash fiction” (defined here as 600 words or less) sci-fi story up every day. Some are written by staff writers for the site, but many (like mine!) are taken from submissions. Please feel free to leave feedback either here or on the 365 Tomorrows forum.

Tabula Rasa

I look around, one last time, at the empty apartment and the packed bags.

One last time? Nicholas Jameson will see those old, beat-up duffels often, but I can’t think of him as being me. As being real. It isn’t my new face I see in the mirror, courtesy of Tabula Rasa’s plastic surgery, it is his. It isn’t my brand-new driver’s license in my pocket, it’s Jameson’s.

Still, I tell myself it was worth it as I begin to feel sleepy. “‘Tis better to have loved and lost…” Bullshit. What did Tennyson know about loss? Better a new life, a new person, than this wretched loser. I try to silence my doubts, but if life is so terrible without Her, how can I live without even her memory?

I won’t. Nicholas Jameson will. I’ll fall asleep, and the nanobots will go to work on my amygdala. Nicholas Jameson will wake up, happily ignorant of the breakup, the obsession, the thousand unsuccessful drinking binges…

As my eyes begin to droops, I look around desperately for a pen, for some way to tell this new person who he once was…

Nick Jameson woke up in the middle of leaving for a new apartment. Making a mental note to get more rest, he checked to make sure nothing was forgotten. The raise had come as a bit of a surprise, but Nick had always been a hard worker. He could hardly wait to make the spacious new apartment his home.

“Well, time for one last check,” he muttered, wandering into the small bedroom. He looked under the beds, on the bedside table, in the drawer–

Nick froze. His mouth was dry, and there was a ringing in his ears. What the hell? It was just a photograph, no doubt left by the previous occupants. Strange that he’d never noticed it. It was of a happy couple, holding hands and basking in love. It was a cheerful picture, so why did he feel so sad? It wasn’t jealousy… Meh. A mystery for another time.

Turning to leave, Nick Jameson suddenly grabbed the photo and shoved it into his pocket. No point in leaving it behind, after all.

April 9, 2009 at 6:27 am Leave a comment

“Hooke’s Revenge” ping-pong ball gun

Hooke's Revenge

Named after Hooke’s Law, which describes the force exerted by a stretched or compressed spring (for you non-physics-nerds out there).

You turn the wrench at the top of the image to rotate the bolt and pull back the spring with the wire. The other wrench, held to the board, ratchets to prevent the bolt from turning the other way. The pin can be pulled out with that red loop to allow the spring to release, launching the ping-pong ball (not shown) into the air. The ball sits in that V-shaped thing at the end of the spring.

Time to build: ~3 hours planning, 2 hours getting supplies, 4-5 hours building
Range: 15-20m maximum
Epicness: 1336.8 (there are some issues with keeping the spring straight while winding)

April 7, 2009 at 7:57 pm Leave a comment

Google Calculator via Python

(Wow, a month? Sorry, guys.)

Randall Munroe of xkcd (fantastic comic by the way) requested a command-line interface to Google Calculator (which is a fantastic tool if you don’t use it), and I delivered.

An example of Google Calculator:
(radius of Earth * 2 * pi) / the speed of light = 0.133675091 seconds

Of course, nobody wants to fire up a big, slow web browser just to do some calculations. The solution, thanks to my modest Python skillz:

The script will, by default, loop and repeatedly ask for input:
> 2+2
2 + 2 = 4
> 17 meters in microparsecs
17 meters = 5.50932003E-10 microParsecs

You can also ask it to evaluate a single input string:
C:\Python26\googcalc> "17 meters in microparsecs"
17 meters = 5.50932003E-10 microParsecs


It handles bad strings nicely:
C:\Python26\googcalc> "does not compute"
Google Calculator results not found.


4/8/09: I’ve created a few versions:
Original: (takes an argument string) 441441
Interactive: (repeatedly loops, asking for input) 441428
Hybrid: (takes an argument, defaults to loop if none given) 441432 (recommended)

Randall now has this aliased to “c” for easy access; this is effectively the xkcd Seal of Approval :)

April 7, 2009 at 7:47 pm 5 comments

Human Souls

wordpress visitor counter souls and counting...