Jon Aquino's Mental Garden

Engineering beautiful software jon aquino labs | personal blog

Sunday, July 31, 2005

Things to do with your new Swiss Army Knife

Now that I have a SAK, I really wish I had things to do with it. I have actually used it a few times:
  • using the screwdriver to remove the elbow supports from my swivel chair
  • using the knife to cut open a milk carton so that it takes up less space in the garbage
What have you used your Swiss Army Knife (or other multitool) for?

Thursday, July 28, 2005

The Java Mixin Pattern, or Faking Multiple Inheritance

Unlike C++, Java supports single inheritance only -- it does not support multiple inheritance. Same with Ruby -- but Ruby has the concept of "Mixins", which are "partial classes" that you can bolt onto your class, giving you something very like multiple inheritance.

You can fake mixins in Java. They're great when you want to refactor common functionality from two classes having different superclasses. Just make a new class called FooMixin to hold the common functionality -- the magic of inner classes handles the rest. Here's a real-world example from the OpenJUMP open-source GIS project:

public class LoadDatasetFromFilePlugIn extends AbstractLoadDatasetPlugIn {
protected void setSelectedFormat(String format) {
loadSaveDatasetFileMixin.setSelectedFormat(format);
}
protected String getSelectedFormat() {
return loadSaveDatasetFileMixin.getSelectedFormat();
}
protected Collection showDialog(WorkbenchContext context) {
final JFileChooser fileChooser = GUIUtil
.createJFileChooserWithExistenceChecking();
fileChooser.setDialogType(JFileChooser.OPEN_DIALOG);
fileChooser.setMultiSelectionEnabled(true);
return loadSaveDatasetFileMixin.showDialog(fileChooser,
LoadFileDataSourceQueryChooser.class, context);
}
private LoadSaveDatasetFileMixin loadSaveDatasetFileMixin = new LoadSaveDatasetFileMixin() {
protected String getName() {
return LoadDatasetFromFilePlugIn.this.getName();
}
protected String getLastDirectoryKey() {
return LoadDatasetFromFilePlugIn.this.getLastDirectoryKey();
}
public boolean isAddingExtensionIfRequested() { return false; }
public File initiallySelectedFile(File currentDirectory) { return null; }
};
}
Note that the LoadSaveDatasetFileMixin has access to the main class (via template methods like #getName, #getLastDirectoryKey), and the main class of course has access to the mixin (via #setSelectedFormat, #getSelectedFormat). Beautiful.

Saturday, July 23, 2005

Online timer to remind you to take breaks

There's a great web-based timer that's wonderful for reminding you to take regular breaks from the computer (to prevent problems like carpal-tunnel syndrome). When the time has elapsed, it pops up a dialog, and depending on your operating system, your task bar may start flashing too.

I have also created a YubNub command for this -- just type "timer" into YubNub.

Friday, July 22, 2005

Ferrazzi quote

"In my initial conversation with someone I'm just getting to know, whether it's a new mentee or simply a new business contact, I try to find out what motivations drive that person. It often comes down to one of three things: making money, finding love, or changing the world." [Keith Ferrazzi, Never Eat Alone]

Wednesday, July 20, 2005

Including the size of your inbox in your signature

To give people a rough indication of when they might hear back from me, I am now including in my email signature the number of emails in my Inbox. I'm just doing it manually.

--
Jon Aquino (Victoria BC Canada)
http://jonathanaquino.com Emails in Inbox: 109
ICQ: 334568010 MSN/Yahoo: Jonathan_Aquino

This is a useful technique because it let's people know that you're not ignoring their mail.

Hopefully with what I have learned from the Getting Things Done methodology, that number will soon be 0.

Friday, July 15, 2005

Inbox: 87 emails

Hoo boy. Gtd help me.

How many emails are in your inbox?

Lifehack: Hacky Sack -- The Perfect Exercise For Geeks?

Footbag (or "hacky sack") could be the perfect form of exercise for tech geeks.
  • more fun than running or lifting weights
  • a sport that works whether or not other players are present
  • can be played indoors or outdoors, barefoot or shod, in large or small spaces (walls help!)
  • looks kind of cool when you get good at it (impressive Quicktime movie)
Note: Be sure to get a sand-filled footbag, rather than those leather or crocheted pellet ones. Sand-filleds give you way more control.

Swiss Army Knife vs. Leatherman Wave

Well, with the ThinkGeek gift certificate I won for YubNub (thanks to Thijs Van Der Vossen), I bought a Swiss Army Knife (Cybertool 41) and a Leatherman Wave multi-tool:

53938-cybertool-41-ruby leatherman_wave

They're competing products. The Swiss Army has more stuff, whereas the Leatherman just feels like quality (love how the tools are easy to pull out and solidly snap in and out).

But neither fits me well. The Cybertool is geared towards hardware enthusiasts and outdoor enthusiasts, whereas the Leatherman is more for mechanically-oriented people. What about software geeks?

Hey Swiss Army -- here's what you'd put in a real cybertool Swiss Army knife. Call it the Cybrtool 2.0
  • tape measure in inches, centimetres, and pixels (an approximation, of course)
  • scissors
  • nail cutter
  • stapler
  • pen or pencil
  • 1 GB USB drive (yeah I know you already have this)
  • mini dice (for randomness junkies)
  • knife (of course)
  • mini screwdriver, for glasses, both - and + heads
  • various screwdriver bits (Swiss Army does a good job with this)
  • pliers (Leatherman does a good job with this)
Do you have a multitool, and if so, do you find it useful?

Sunday, July 10, 2005

A Timeless Lifehack: Remembering the Shortness of Life

A reminder to keep things in perspective -- you don't have to be religious to appreciate it:

"There is nothing more precious than time; but there is nothing less esteemed and more despised by men of the world. This is what St. Bernard deplores when he says: "Nothing is more precious than time, but nothing is regarded more cheaply." The same saint adds: "The days of salvation pass away, and no one reflects that day which has passed away from him can never return." You will see a gambler spend nights and days in play. If you ask him what he is doing, his answer is: I am passing the time. You will see others standing several hours in the street, looking at those who pass by, and speaking on obscene or useless subjects. If you ask them what they are doing, they will say: We are passing the time. Poor blind sinners! who lose so many days; but days which never return.

"O time despised during life! you will be ardently desired by worldlings at the hour of death. They will then wish for another year, another month, another day; but they will not obtain it: they will then be told that time shall be no longer. How much would they then pay for another week, or another day, to settle the accounts of their conscience? To obtain a single hour, they would, says St. Laurence Justinian, give all their wealth and worldly possessions. But this hour shall not be given."

(St. Alphonsus De Liguori, 1758)

Great free translator for instant messenging

Do you IM people who speak a different language? You'll like this free tool: IM Translator. Basically you select any text, hit a hotkey, and a window appears showing the translation:



(To turn off the banner ads, click the "Compact Mode" button). A cool thing about it is that it uses the PROMT engine, which is evidently a little better than Babelfish (but not by much). Compare the following:
Original: una vez le di una respuesta ,por supuesto que ayudado por el google traslate

PROMPT: once I gave him a response, surely helped by the google traslate

Babelfish: once I gave an answer him, of course that helped by google traslate
Windows only. Works with any IM program.

Saturday, July 09, 2005

Improved Kinesis keyboard remapping

The Kinesis keyboard (shown below) is helpful to many people like myself with wrist problems, because it moves several frequently used keys from the pinky fingers to the more powerful thumbs (like Ctrl and Alt).

contoured-keyboard

However I still find myself using my left pinky quite a bit to hit the Tab and Shift keys (highlighted in yellow below):

highlighted

Fortunately the keyboard lets you remap keys. I would like to share the following remapping, which seems to be working better for me (less wrist pain). Basically I have remapped Tab and Shift to the thumb keys:

remapped

I love how Page Up, Page Down, Home, and End still make sense in their new positions.

Hope this is helpful to others.

Update: Actually it may be better to put Tab on the left thumb rather than the right, because you're used to having it on the left side.