Jon Aquino's Mental Garden

Engineering beautiful software jon aquino labs | personal blog

Saturday, August 29, 2009

Carbon-fiber violin, viola, and cello

Back in my school-orchestra days, it would have been nice to have a carbon-fiber volin. And $7500 with which to buy one.

Evidently the sound is superior to wooden violins of the same price (videos). Yo-Yo Ma likes them.

Friday, August 28, 2009

EULALyzer (Windows) - terms-of-service/license analyzer

I find EULALyzer handy. It’s a Windows program that lets you paste in any software license or terms-of-service text, and it flags suspicious-looking phrases that you may want to look at more closely.

Fli251

Saturday, August 22, 2009

Interesting Data Graphic: The Andex Chart

Andex Chart

The Andex Chart (US version, Canadian version) is a graphic that combines a ton of data from various sources for the past century: presidential terms, market indexes, world events (“IBM PC introduced in 1981”), interest rates, price of oil, inflation, etc. It’s intensely interesting.

js-kit for quickly adding comments / ratings to a website

I heart js-kit. To add a 5-star rating widget to Yubnub, I simply added the following to each page:
<div class="js-kit-rating" view="combo" path="(optional unique identifier goes here)"></div>
<script src="http://js-kit.com/ratings.js"></script>

Similarly, adding comments to each page was simply a matter of adding:
<div id="js-kit-comments" path="(optional unique identifier goes here)"></div>
<script src="http://js-kit.com/comments.js"></script>

Leave off the path="..." bit if you’re not going to use it.

Skull-and-crossbones jogging pants, circa 1988

Skull-and-crossbones jogging pants, circa 1988

I felt so cool that day in Grade 6 when I wore these skull-and-crossbones jogging pants,

that Friday when regular clothes were permitted,

when we leapt off our schooldesks in imitation of snowboarders…

Friday, August 21, 2009

3-min delay on outgoing email == git add

Putting a 3-minute delay on your outgoing email is like staging a commit in Git.

It allows you to do git reset --soft HEAD^ on your email.

Monday, August 17, 2009

New daily schedule

I was looking all forward to getting into this new, intense nightly routine

BUT

I failed today. It’s 11:50pm and I haven’t done any of the things I had scheduled for the evening. Boo.

Will try again tomorrow!

9:00am Pray, Shower, Breakfast
9:30am Work
. . . . . . . . . .
6:00pm Code reviews, unscheduled work
7:00pm Philosophy / Comp Sci
8:00pm Internet / Tasks
9:00pm Literature
10:00pm Exercise
10:15pm Divine Office, Meditation
11:15pm Snack with Mom / Tasks
11:45pm Calligraphy
12:00am Brush teeth
12:10am Night prayer
12:20am Read
1:00am Sleep

Do you have an intense nightly routine, or do you like to keep it mellow?

Iambic Birthday Greeting

I was reading this short poem, when suddenly I thought, wouldn’t this sort of thing make a good birthday greeting?
Of three in One and One in three
My narrow mind would doubting be
Till Beauty, Grace and Kindness met
And all at once were Juliet.
So if you’re stuck for what to write on a greeting card, try writing four lines of iambic tetrameter (da DUM da DUM da DUM da DUM). A rhyming dictionary can help.

Saturday, August 15, 2009

A Free Random Number Generator for Pocket PC

I was searching for a good random number generator for Pocket PC, but I couldn’t find any free ones. There’s a shareware one for $15, but it’s hard to believe that there isn’t anything out there for free.

Then I realized that one can easily create one using Pocket Excel, which comes standard on all Pocket PCs. Simply put the max in cell B1, then paste the following formula into a 10×10 grid: =TRUNC((RAND()*$B$1)+1, 0). This will create a 10×10 grid of random numbers, between 1 and the max.

Pocket Excel

Pocket Excel is actually pretty powerful, supporting a bunch of statistical, financial, and logical functions.

An Unobtrusive Alert Sound: 100 Submarine Pings

Last year I posted 5beeps.wav, a simple, unobtrusive alarm sound, useful for alerts and reminders.

That one only lasted a few seconds, so here’s something better: 100_sonar_pings.wav (3 minutes, 37 MB). It’s unobtrusive, yet insistent. Somewhat soothing, but also mildly grating. Perfect for an alert.

For a quick preview, check out the original single ping from Jilly’s Sample Pack (click the Repeat icon to repeat in a loop).

Good RSS Feed for PHP News

The following link was mentioned at work as a good source of important/useful PHP news (such as security exploits). It has an RSS feed.

http://planet-php.net

Friday, August 14, 2009

First Scala Program

One of my co-workers is big into the programming language Scala, and has inspired me to take a look. I’m slowly making my way through the free online book Programming Scala.

Here’s my first Scala program. It doesn’t do anything particularly Scala-ish—it just reads from stdin, sticking four spaces in front of every line that does not begin with “HTTP Method”, “Endpoint”, “Elapsed Seconds”, and a few other strings. So it’s a little formatting utility that’s useful at work.

var line = Console.readLine()
while(line != null) {
if (! line.matches("(HTTP Method|Endpoint|Elapsed Seconds|Request Headers|Response Code|Response Headers|Response Body).*")) { print(" ") }
println(line)
line = Console.readLine()
}


A cool thing is that my text editor jEdit lets me apply this script to the current buffer:

jEdit Text Filter plugin

Also note that jEdit lets you customize its toolbar with icons of unlimited size :-)

Thursday, August 13, 2009

Public and Private Methods in JavaScript

At Ning, here’s how we do public and private methods in JavaScript:

/**
* A scrollable list that can display large numbers of contacts.
*
* @param contacts contact objects
*/
xp.ContactSelector = function(args) {

/** Container for public functions. */
var self = {};

/** Container for private functions. */
var _ = {};

/**
* Initializes the object.
*/
_.initialize = function() {
if (!args.contacts) {
_.installSearchbox();
}
};

/**
* Adds a searchbox to the ContactSelector.
*/
_.installSearchbox = function() {
// This is a private method
};

/**
* Returns the contacts that the user has selected
*
* @return the selected contact objects
*/
self.getSelectedContacts = function() {
// This is a public method
};

. . . . . . . . . .

_.initialize();
return self;
};


Private methods begin with _., while public methods begin with self.. There are some interesting things about this setup:
  • Public methods are accessible on the object created by this function. Private methods are not accessible.
  • Public and private methods can be defined in any order, regardless of which calls which. This is because they are properties of self and _. If they were defined as standalone functions, then order would matter.
  • You can inherit from another object by adding the following to initialize(): self = xp.AbstractContactSelector(args);


The first point is similar to Douglas Crockford’s technique described in Private Members in JavaScript.

Tiny, Write-Only, Always-On-Top Windows

It can be useful to have tiny, write-only, always-on-top windows. Here’s an example:

Tiny, write-only, always-on-top window

This is a little command-line window that lets me enter commands on a remote server. The font is tiny—6-point Lucida Console—and is barely legible. But that’s OK. I don’t really need to read this window; I just need to be able to type stuff into it. It sits in the lower-right corner of my screen.

Tiny, write-only, always-on-top windows are useful in other contexts as well.

Monday, August 10, 2009

Mozy success story

I pay Mozy $5/month to back up some of my directories. I’ve heard both good things and bad things about this service. On the positive side, it’s garnered lots of good reviews. On the negative side, lots of users complain that backups take forever (which I’ve solved by splitting up my Outlook pst file into smaller, quarterly ones) and that it takes forever to do an online restore (and that sending away for a CD dump of the data is better).

Today I discovered that one of my Excel files went missing. I guess I accidentally deleted it. Anyway, I went into Mozy and restored it. A minute later, it was back.

So I’m going to keep on forking over my $5/month.

Saturday, August 08, 2009

Adding up all the numbers in the clipboard

Wouldn’t it be nifty to have a hotkey that will add up all the numbers in the clipboard? You could select a table on a webpage and instantly add up the values. Or if you wanted to add up a bunch of numbers, just type out the numbers, copy them to the clipboard, then hit the hotkey.

Scripting/automation tools make this pretty easy to do. Here’s such a script for AutoHotKey for Windows:

::sum::
Sum := 0
String := Clipboard
FoundPosition := 1
Loop
{
FoundPosition := RegExMatch(String, "[0-9.]+", Match, FoundPosition)
If FoundPosition = 0
{
Break
}
Sum := Sum + Match
FoundPosition := FoundPosition + StrLen(Match)
}
Send %Sum%
return

Typing sum [Tab] will output the sum of any numbers found in the clipboard.