September 2008

$ fortune eric-raymond

Here’s a separate file with rules of the “Unix philosophy”, extracted from The Art of Unix Programming by Eric S. Raymond. You can randomly select between these and the Ruby class descriptions with:

$ fortune eric-raymond ruby

EricRaymondFortune

general

Comments (0)

Permalink

$ fortune ruby

More often than I’d like, I have to open the Pickaxe to look up a core class or module that I can’t quite remember the methods on. I wanted to put some reminders in a place I could review them daily, yet was unobtrusive.

Enter the Phosphor screensaver for X-Windows; it scrolls text from a file or command by the screen. I pulled the classes and modules I wanted from the “ri” utility, made them into a “fortune cookie file” (run “man fortune” for details on fortune), and then piped fortune’s output through the screensaver.

I’ve attached the files I made. Unzip and drop them in /usr/share/games/fortune (or wherever fortune cookie files go on your system) and you’ll be able to type “fortune ruby” at a command prompt. Only core classes are included, but I’ll make a separate one for Rails on request. You can set up Phosphor (or other text-display screensavers like StarWars) from the xscreensaver control panel.

RubyFortuneCookies

Edit: On systems using gnome-screensaver, save this in your screensaver config folder, probably as /usr/share/applications/screensavers/xscreensaver-phosphor-ruby.desktop:

[Desktop Entry]
Encoding=UTF-8
Name=Phosphor - Ruby ri
Comment=Draws a simulation of an old terminal, with large pixels and long-sustain phosphor. On X11 systems, This program is also a fully-functional VT100 emulator! Written by Jamie Zawinski; 1999.
TryExec=phosphor
Exec=phosphor -root -scale 2 -ticks 5 -program 'fortune ruby'
StartupNotify=false
Type=Application
Categories=GNOME;Screensaver;

…then select “Phosphor - Ruby ri” in your Screensaver Preferences. This should also scale back the text so you can see the whole ri screen.

ri - StarWars

Ruby
development
linux

Comments (0)

Permalink

$ itunes –find “Prefuse 73 Preparations” –print-info “%t - %n - %r stars”

1 - From the East (intro) - 0 stars
2 - Beaten Thursdays - 4 stars
3 - Aborted Hugs - 3 stars
4 - Class of 73 Bells (feat. School of Seven Bells) - 3 stars
5 - Girlfriend Boyfriend - 4 stars
6 - Smoking Red (feat. John Stanier) - 3 stars
7 - Prog Version Slowly Crushed - 4 stars
8 - Noreaster Cheer - 4 stars
9 - Let It Ring - 4 stars
10 - 17 Seconds Interlude (feat. Tobias Lilja) - 0 stars
11 - I Knew You Were Gonna Go - 4 stars
12 - Pomade Suite Version One - 4 stars
13 - Spaced + Dissonant - 5 stars
14 - Preparation (outro version) - 3 stars

Sigh… Only one 5-star (at least, based on my initial listen)… Lot better than Security Screenings, though.

music

Comments (0)

Permalink

Android 1.0 API impressions…

What they’re describing here might be applicable not just to mobile apps, but maybe applications in general. Could this become the basis of an OS for a set-top box, game console, or desktop?

An Activity is a unit of action a user can initiate. Though an Activity can be used as an application, it isn’t the same concept; an Activity could be accessed from the menu of another Activity, for example.

The lifecycle of an activity is:

onCreate()
onRestart()
Called here after an application is stopped, not during its initial startup.
onStart()
Activity is becoming visible to user.
onResume()
Activity can interact with user.
onPause()
System is about to switch to another activity.
onStop()
Activity is no longer visible to user. May be followed by onRestart() or onDestroy().
onDestroy()
During this method, if isFinishing() returns true, user requested finish. Otherwise, system did.

This model is cool because it requires that an app be ready to save its state for later reloading at any time. An app that follows this setup properly will be ready for the user to switch activities, to reflect changes to the global config, or for the phone’s battery to run low.

Notifications: I’m imagining this to be like Growl or Enso notifications. Hope I’m right, but I haven’t read far enough to know yet.

Background processes!!! The inability of third-party apps to do this is my number one complaint about the iPhone. I want a daemon that can initiate different processes when I walk into work, home, or school, and I think it simply isn’t possible on iPhone.

development
mobile

Comments (0)

Permalink

Aquarium development with Alice…

Learned about Alice last night; it’s Carnegie-Mellon’s 3D cousin to MIT’s Scratch development environment. Alice is aimed at older students, and a bit more flexible.

I showed off the built-in library of objects to Diana, and the moment she saw the ocean-themed section, to my surprise, she all but elbowed me away from the keyboard. (She’s not a developer, but she is a fish nut.) Thirty minutes later, and with only occasional guidance from me, she had a school of fish robotically spinning, rolling, and moving about an ocean floor.

Drag-and-drop is definitely a good way for novices to get started programming. It’s all too easy for a beginner to give up when all they get is a blank screen due to a well-hidden typo. Mistake-resistant constructs you can scramble around and get instant feedback on keep a student moving forward.

development
family

Comments (0)

Permalink

Picasa Web Albums facial recognition - edge cases…

Finally! Picasa Web Albums rolled out its facial recognition feature. No equivalent for the desktop Picasa (yet), sadly.

It’s fast, and accurate. Some interesting bits:

-Most of the time, it has no trouble distinguishing between my pre-beard and post-beard face.
-It thinks my wife and my-wife-with-sunglasses are two separate people.
-It thinks my-wife-with-sunglasses and my-son-with-sunglasses are the same person. :)
-Pictures of a rapidly-growing kid (age 3-5) seem to make it uncertain, though its “most likely” match is usually correct.
-Based on only one picture of my brother at age 26, it just picked out a picture of him at age 11! (It wasn’t certain, but he was the most-likely match.)
-A fake sneer or frown tripped it up (though again, the most-likely match was correct).
-A subject losing (or gaining) a considerable amount of weight makes it uncertain.
-The lighting on a face has to be REALLY poor to trip it up.
-Most-likely match was right even on a face that was ~20% blocked.
-Good guess on a face viewed through smoke (from a yellow smoke bomb).
-Two different women with similar makeup, facial expression and pose were sorted next to each other. (And the second was mis-identified as the first, probably because she usually wears glasses and wasn’t in this shot.)
-The best guess is usually of the same sex, but when it’s tripped up, members of the opposite sex may outrank the actual subject for second- and third-best guesses.
-Subjects of the same (or similar) ethnicity tend to get grouped together.
-Sticking your tongue out is a good way to trip it up.
-Odd angles (like up from the floor) confuse it (badly). Profile-views aren’t as bad, though.
-(Obviously) cartoon faces occasionally find their way into the list.
-A short-lived goatee only throws it off once; after that the best guess is correct for further goatee pictures.
-Bangs partially covering the eyes throw it off.

I know some of these are “duh” items, but this has just made me appreciate what a hard problem facial recognition is. Especially in the area of photos, where you’re dealing with changes in age, weight, hair, expression, poor lighting, sensor noise, and a host of other problems.

Now, how can I sort the photos back on my hard drive, since Google and I have done all this work?

development
photography

Comments (0)

Permalink

Facebook is asking me, on behalf of Diana:

Do you think undefined undefined?

…Sometimes, yes.

general

Comments (0)

Permalink

Think our world is all SOA and web-service-enabled?

Think again. I just got an e-mail from a major travel industry vendor (one you’ve probably heard of), detailing changes to the procedure for manually downloading and unzipping the monthly data file they send us. This is the third vendor in the past year to pull something like this. (Actually the biggest one can’t seem to send us the same format month to month.)

“The future is already here - it is just unevenly distributed.”
–William Gibson

development

Comments (0)

Permalink

No parking ticket. (whew!) But this was amusing, since I was wearing my “Do Not Want!” shirt:

FAIL

general

Comments (0)

Permalink

More experiments with objects that do weird crap when placed in ordinary situations…

This one lets you wrap an object so that its apparent value changes over time.

class ValueProxy
	self.instance_methods.reject{|m| m.to_str == '__id__' or m.to_str == '__send__'}.each do |method|
		undef_method(method)
	end
	def initialize(value)
		@value = value
	end
	def method_missing(method, *arguments)
		value.send(method, *arguments)
	end
end

Then we subclass it to do various things with @value…

class ReverseProxy < ValueProxy
	def value
		@value.reverse
	end
end

And ordinary calls like this suddenly get weird.

string = ReverseProxy.new('foobar')
puts string
string2 = string + 'baz'
puts string2
puts ReverseProxy.new([1, 2, 3])

Output:

raboof
raboofbaz
3
2
1

Continue Reading »

Ruby
development

Comments (0)

Permalink