Jon Aquino's Mental Garden

Engineering beautiful software jon aquino labs | personal blog

Monday, February 28, 2005

Father Tony's homily

Samaritan woman sharing the bucket of water with Jesus

"Worshipping neither on the mountain" = worshipping God no matter where we are

Father T's missionary days in rural Pakistan, when he was given dirty water to drink

Webology

Pam came up with an intriguing blanket term for delicious, Flickr, GMail, blogging, and the rest of Web 2.0: webology.

My mom had a couple of interesting names for this: internet guy, fanatico.

Update: I'm getting closer to a name for this space. It's what Barlow is talking about in his "Declaration of the Independence of Cyberspace": "Cyberspace consists of transactions, relationships, and thought itself, arrayed like a standing wave in the web of our communications." I don't like the term "cyberspace" -- it is fairly worn out these days. But Barlow's meaning is what I'm after. So what is a more up-to-date term for the utopia that Barlow is describing?

Internet? That's the foundation on which the city is built, not the city itself.

Web 2.0? Closer.

Internet culture? There are several different areas of interest on the internet, each with their own culture e.g. The geek culture, the online-dating culture, the gaming culture. I'm looking for an overarching term describing the whole.

The online lifestyle? Better, but it needs more precision.

Cyberspace?

The cyberspatial utopia?



Update: I've figured out a name: Personal IT.

Matthew Kelly on Sleep

"Sleep is intended to make us stronger, more vibrant, more productive, more loving, and more alert individuals. Sleep is important and should be given priority." (from The Rhythm of Life)

Sacred Heart Music with Bea

March 13
- Awake Awake
- You Are Near

Good Friday:
- no intro
- Ps
- GA
- Collection: O Sacred Head. Violin in C
- Veneration
- 435 Lift High The Cross
- Reproaches
- Were You There. Violin. 2 verses.
- When I Behold The Wondrous Cross

Easter Sunday
- Arise Your Light Has Come
- Bread of Life
- Finlandia. Violin.
- Jesus Christ Is Ris'n Today

Grounded: Millionaire John Gilmore stays close to home while making a point about privacy

I love this quote: "Computer programmers, the really good ones, combine an artistic temperament with a conviction that intuitive reasoning can lead to mathematical certainty."

Sunday, February 27, 2005

H. G. Wells

This is cool -- H. G. Wells' "The Man Who Could Work Miracles", which is #20 in the list of Top 100 Sci-Fi Short Stories, is available online: http://etext.library.adelaide.edu.au/w/wells/hg/w45mw/ Great before-bed reading.

Saturday, February 26, 2005

del.icio.us/popular -- List of the day's most popular new websites

I use the following website to keep my finger on the pulse of the internet. Basically, del.icio.us is a web bookmark manager used by tech-savvy netizens, and del.icio.us/popular shows which sites have been most frequently bookmarked by these people for the past day.

In short, it's very cool:

http://del.icio.us/popular

My first screencast

Inpired by Jon Udell's recent spate of screencasts, I've decided to try the medium. It will be found here, once it finishes being processed by the Internet Archive (24 hours). Many thanks to the Archive, which is offering to host unlimited audio and video content forever, with the simple proviso that it is licensed under the Creative Commons. (Could be a good free podcasting solutions, but then others have already thought of that).

BTW Windows users can create AVI or Flash screencasts using the free CamStudio software. (Be sure to get version 2.0, as newer versions are crippled unless you pay for it).

Mail2Blogger test

Update: AWESOME! It works now, after 6 weeks of not working. Sweet!

XEmacs features I frequently use

The XEmacs text editor is a dangerous yet powerful way to manipulate text. I looked back through my minibuffer history for the commands that I frequently use:

- all
- sort uniq
- count matches
- himark-regexp
- flush lines, all
- macros
- eshell
- dired, wdired
- sort-lines
- find-file-at-point
- replace regexp
- picture mode
- untabify
- downcase-region
- rectangle cut
- split screen
- minibuffer history

Ping - Jeremy Isaak


JeremyAtDesk.thumb
Originally uploaded by Jon_Aquino.

Jeremy Isaak - Haven't seen you in 6 years. Drop me a line! And you too, Mary-Ann Yoon!

These were my co-op buddies when I was working at OTI for a couple of summers. Good times.

this is an audio post - click to play

this is an audio post - click to play

this is an audio post - click to play

Friday, February 25, 2005

Blogs In Hand - free blogging app for Pocket PC

Hi Markus - Wow, I hadn't heard of Blogs in Hand! Actually I had stopped looking for Pocket PC blog software, because PocketBlog is quite slow and buggy. I will try Blogs in Hand!

In the meantime, I was just emailing my blog posts to Blogger via Flickr (using a dummy 1-pixel image). Blogger has Mail-To-Blogger, but it is currently not working :-(

I haven't tried Journalspace, TypePad, Livejournal, WordPress, B2, Movable Type, or Radio Userland. Some of these you have to pay for, and some of these you have to host on your own server. I like Blogger because (1) it is free to use, (2) it provides free hosting, and (3) zero-maintenance -- Blogger takes care of all the technical details. Unfortunately it is sometimes slow.

Jon

Using lynx to scrape 100 random company names from the web

Repeat this command 100 times to get a list of 100 company names e.g. for test data:

lynx -source "http://adactio.com/extras/newmediagenerator/" | grep h1 >> c:\junk3\g.txt

I learned the lynx/grep trick from one of my favourite books, "The Pragmatic Programmer". That book got me started on the wonderful world of Unix text tools (which are available for Windows in the Cygwin package). That book also turned me on to the XEmacs text editor, which is a dangerous yet powerful tool for manipulating text.

First Video Game Written In Ant

Presenting the world's first video game written in Ant. This is a cross-platform downhill skiing game in which you use the < and > keys to race down a dangerous ski slope. System requirements: Ant 1.6 and the Ant-Contrib library.

And yes, it's written in Ant.

How this came to be: Some co-workers and I were chatting today about some Ant features we learned about, in particular the very useful macrodef and import tags. Then it dawned on me that with the function-like behaviour that macrodef tags give us, we could do virtually anything. Heck, we could write a video game in Ant if we wanted to! My coworkers laughed at me.

Well, laugh no more, my friends. Below is a screenshot showing the first-ever Ant video game in action:



In the above screenshot, I have crashed into the trees on the right. As this is an Ant script, the bad news begins with "Build Failed".

Note: If you succeed in skiing through the entire course and arriving at the bottom of the mountain, there is a pretty end-game screen as your reward!

Simply copy the code below and fire up Ant using the command "ant -quiet". Note that you will need Ant 1.6 and the Ant-Contrib library.


<?xml version="1.0"?>
<!--
To start the game, type "ant -quiet". Requires Ant 1.6
and the Ant-Contrib Tasks [Jon Aquino 2005-02-24]
-->
<project name="ski" default="run" basedir=".">
<taskdef resource="net/sf/antcontrib/antcontrib.properties"/>
<taskdef name="for" classname="net.sf.antcontrib.logic.For"/>
<typedef name="isgreaterthan" classname="net.sf.antcontrib.logic.condition.IsGreaterThan"/>
<typedef name="islessthan" classname="net.sf.antcontrib.logic.condition.IsLessThan"/>
<var name="skiier-position" value="5"/>
<!-- Generated using random numbers from http://www.random.org.
Make your own course up! [Jon Aquino 2005-02-25] -->
<property name="course" value="1,0,1,2,1,2,3,2,3,4,3,4,5,4,3,4,3,2,3,4,3"/>
<property name="course-width" value="13"/>
<property name="skiier-width" value="7"/>
<target name="run">
<echo/>
<echo message="Use the &lt; and &gt; keys to move left and right."/>
<for list="${course}" param="tree-position">
<sequential>
<var name="tree-position" value="@{tree-position}"/>
<update-clearances/>
<check-crash/>
<paint/>
<get-input/>
</sequential>
</for>
<success/>
</target>
<macrodef name="paint">
<sequential>
<!-- Graphics from http://www.chris.com/ascii/ [Jon Aquino 2005-02-24] -->
<paint-line tree=" " skiier="+ + "/>
<paint-line tree=" /\ /\" skiier="\ O \ "/>
<paint-line tree=" / \\ /\ /\\\" skiier="\_/|\_\"/>
<paint-line tree="/ \\/ \\ / \\\" skiier=" \\ "/>
<paint-line tree="/ / \/ \\\" skiier="\/' "/>
<paint-line tree="/ / / \\\" skiier="\\_ "/>
<paint-line tree="/ / / \\\" skiier="- "/>
</sequential>
</macrodef>
<macrodef name="get-input">
<sequential>
<var name="input" unset="true"/>
<input addproperty="input"/>
<if><equals arg1="${input}" arg2=","/>
<then><subtract a="${skiier-position}" b="1" result="skiier-position"/></then>
<elseif><equals arg1="${input}" arg2="."/>
<then><add a="${skiier-position}" b="1" result="skiier-position"/></then></elseif></if>
</sequential>
</macrodef>
<macrodef name="update-clearances">
<sequential>
<subtract a="${skiier-position}" b="${tree-position}" result="left-clearance"/>
<add a="${tree-position}" b="${course-width}" result="right-clearance"/>
<subtract a="${right-clearance}" b="${skiier-position}" result="right-clearance"/>
<subtract a="${right-clearance}" b="${skiier-width}" result="right-clearance"/>
</sequential>
</macrodef>
<macrodef name="paint-line">
<attribute name="tree"/>
<attribute name="skiier"/>
<sequential>
<spaces n="${tree-position}" result="left-margin"/>
<spaces n="${left-clearance}" result="left-space"/>
<spaces n="${right-clearance}" result="right-space"/>
<echo message="${left-margin}@{tree}${left-space}@{skiier}${right-space}@{tree}"/>
</sequential>
</macrodef>
<macrodef name="spaces">
<attribute name="n"/>
<attribute name="result"/>
<sequential>
<math result="2n" operation="*" operand1="@{n}" operand2="2" datatype="int"/>
<var name="@{result}" unset="true"/>
<propertyregex
property="@{result}"
input=" "
regexp="( {${2n}}).*"
select="\1"/>
</sequential>
</macrodef>
<macrodef name="add">
<attribute name="a"/>
<attribute name="b"/>
<attribute name="result" default="result"/>
<sequential>
<math result="@{result}" operation="+" operand1="@{a}" operand2="@{b}" datatype="int"/>
</sequential>
</macrodef>
<macrodef name="subtract">
<attribute name="a"/>
<attribute name="b"/>
<attribute name="result" default="result"/>
<sequential>
<add a="@{a}" b="-@{b}" result="@{result}"/>
</sequential>
</macrodef>
<macrodef name="check-crash">
<sequential>
<if><islessthan arg1="${left-clearance}" arg2="0"/>
<then><die/></then></if>
<if><islessthan arg1="${right-clearance}" arg2="0"/>
<then><die/></then></if>
</sequential>
</macrodef>
<macrodef name="die">
<sequential>
<!-- Sound effects from http://collection.nlc-bnc.ca/100/200/300/ktaylor/kaboom-revised/bzzurkk.htm [Jon Aquino 2005-02-25] -->
<fail message=" *** BOINK! POINK! THUMP! You smashed into a tree and died. ***"/>
</sequential>
</macrodef>
<macrodef name="success">
<sequential>
<!-- Graphics from http://www.chris.com/ascii/ [Jon Aquino 2005-02-24] -->
<echo message="Hooray! Hooray! You are the champion! Congratulations!"/>
<echo message=" *"/>
<echo message=" XX"/>
<echo message=" MMMMM"/>
<echo message=" //(00 "/>
<echo message=" .:....."/>
<echo message=" .:::::::::"/>
<echo message=" :: %%%%%% ::."/>
<echo message=" :: :::::: :::::::I)"/>
<echo message=" (% ::::: |"/>
<echo message=" / | /______ |"/>
<echo message=" / |______ )) |"/>
<echo message=" / / // |"/>
<echo message=" / / // |"/>
<echo message=" / / // |"/>
<echo message="* ZZZZ *"/>
<echo message=" _________ZZZZZZ_________//_//"/>
</sequential>
</macrodef>
</project>


Here is a complete picture of a successful ski run:



And Ant gives us a nice report of the time it took to reach the bottom of the slope:

BUILD SUCCESSFUL
Total time: 17 seconds

Thursday, February 24, 2005

How long do you spend reading blogs each day?

OK, I'm going to try a little experiment. It's 7:33 PM, and it's time to start reading the feeds from my various information sources. Let's see when I finish - I expect it to be an hour.

7:56 PM. Just finished my first (and largest) information source -- Populicious, which is delicious/popular sliced a bit differently. In humanspeak it's a list of what websites are popular today. Next: the regular delicious/popular feed -- 69 posts.

8:03 PM. Meh -- a lot of 'em are the same as Populicious. Time to move on to CNet (40 posts), Slashdot (29 posts), and the rest of the goodies.

8:18 PM. Hm! Read an interesting article on Google's new movie search (keyword: movie). Look out, Rotten Tomatoes!

8:22 PM. Just getting into the tail end of my feeds now. Plus there are a dozen Firefox tabs that I've opened for the links I've come across - I'll be getting to those presently.

8:34 PM. OK, finished all my Bloglines feeds. And whaddya know, an hour and a minute, right on the money.

OK I have posted a photo for the Victoria Webloggers



OK I have posted a photo for the Victoria Webloggers. So what if it's the Toronto Webloggers and not really us? We gotta have a meeting first so we can take a photo that we can use for our group. Patience, people.

I chose this photo because the folks in it look friendly and unintimidating.

Wednesday, February 23, 2005

The Three Instruments

"The first instrument involves regular sleep. The second instrument deals with regular prayer and reflection. The third instrument delves in to the ancient tradition of the seventh day as a day of rest, reflection, and renewal." -- Matthew Kelly

Hm ... Is this Meetup going to work out?

I don't know, folks, I don't know. I have received one RSVP and it was a No - well, it was a kindly worded No from Ada: "Sorry, Wednesday nights are not good.". True, it's only been a day, and there's a few weeks yet. But I don't want to be the only one sitting in Starbucks under the big orange Blogger sign that I'm planning to make up.

Well fine. If none of you people want to show up, then I'll make sure to bring a book, and I shall read TS Eliot under the big orange Blogger sign, sipping my caramel macchiato all by myself.

I tried visiting a few of your blogs -- http://www.mentalwanderings.com, http://mavislog.blogspot.com, http://firemind2.blogspot.com, http://laura-jane.org, http://kflood.net -- but a bunch of you are out of town in Saskatoon or Las Vegas. And a whole bunch of you haven't posted your blog url's, so I couldn't check them out. Please do!!

Anyway, I hope somebody, SOMEBODY, will join me for a cuppa at Starbucks on Government on March 16. Oh and they have to know what blogging is.

Details: http://blog.meetup.com/192/

Victoria Weblogger Meetup, March 16

Folks, it's time for another gathering of the webloggers of beautiful Victoria BC. A bunch of Victoria bloggers are going to be getting together at Starbucks on 1301 Government St. I was careful to choose a venue that would be large enough to host all Victoria blogging enthusiasts.

So c'mon down!

Details here: http://blog.meetup.com/192/

Monday, February 21, 2005

this is an audio post - click to play


Here's a great way to add captions to your 4x6 photographs -- attach a 4"-wide index card to the side.

The completed captioned photograph. Fits in an envelope, ready to send to the relatives!


Happy cat.


Morris, King of the Cats


Aerial view of the Chinese biscuits that Raf and Katherine gave us. Yummy!


Delicious Chinese sweets given to us by Katherine & Rafael.


The person on the left totally looks like Fahreen Dossa. Fahreen, if you're reading this, drop me a line!

Rolling Your Own RSS Feed: Be Sure To Use pubDate And lastBuildDate!



Well, I'm pretty happy with the results of my first RSS feed created from scratch. It's called Masterpiece of the Day, and it showcases a new famous painting every day, from the archives of the ibiblio WebMuseum. I do want to share this technical tidbit however, for other people embarking on producing their own RSS feeds from scratch.

You must include the optional pubDate and lastBuildDate tags. If you don't, then the very popular RSS aggregator Bloglines will fail to pick up your new posts, and you will be very frustrated and you will curse RSS for several hours.

So be good to yourself. Be good to your heart. And include the pubDate and lastBuildDate in your RSS feed. Check out mine for an example.

BTW here is an updated Ruby script that gets run every day to generate the feed. It starts off with some code to enhance the Time class to format dates in RFC 822 format. I love how Ruby allows you to add methods to any class at runtime.


#Time code from http://www.ruby-doc.org/stdlib/libdoc/time/rdoc/classes/Time.html [Jon Aquino 2005-02-20]
RFC2822_DAY_NAME = [ 'Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat' ]
RFC2822_MONTH_NAME = [ 'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec' ]
class Time
def rfc2822
sprintf('%s, %02d %s %d %02d:%02d:%02d ',
RFC2822_DAY_NAME[wday],
day, RFC2822_MONTH_NAME[mon-1], year,
hour, min, sec) +
if utc?
'-0000'
else
off = utc_offset
sign = off < 0 ? '-' : '+'
sprintf('%s%02d%02d', sign, *(off.abs / 60).divmod(60))
end
end
end



urls = File.readlines("motd.txt")
url = urls[rand(urls.size)].strip
url =~ /.*\/auth\/(.*).jpg/
#Include the date in the title, to make the title unique,
#so that feedreaders won't think it is the same as an
#older item, if the painting has appeared before.
#[Jon Aquino 2005-02-21]
rss = "<?xml version='1.0'?>
<rss version='0.91'>
<channel>
<title>Masterpiece of the Day</title>
<link>http://jonaquino.blogspot.com/2005/02/masterpiece-of-day.html</link>
<description>A daily random masterwork painting from the ibiblio WebMuseum.</description>
<pubDate>#{Time.new.rfc2822}</pubDate>
<lastBuildDate>#{Time.new.rfc2822}</lastBuildDate>
<item>
<title>#{$1} #{sprintf('%s %d, %d', RFC2822_MONTH_NAME[Time.new.mon-1], Time.new.day, Time.new.year)}</title>
<link>#{url}</link>
<description>&lt;img src='#{url}'&gt;</description>
<pubDate>#{Time.new.rfc2822}</pubDate>
</item>
</channel>
</rss>"
File.open("motd.xml", "w") {|file|
file.write(rss)
}
puts rss
puts `ftp -i -n -s:"motd.ftp"`
#Hit the URL. Hopefully this will flush any caching going on
#on my ISP's server. Because I'm finding that Bloglines is not
#picking up new items. [Jon Aquino 2005-02-20]
puts `lynx -source -reload "http://members.shaw.ca/Jon_Aquino/motd.xml"`

Sunday, February 20, 2005

Using BeanShell to limit labels to one per street

Hi everyone,

I'm trying to show a label (name) of a street that is formed by many segments. When I enable this label, the name is repeated through the entire street (as shown in the attached image).

Is it possible to have only one label for each street? Is there any plugin that perform this fuctionality?

Thanks in advance,

Adriana

Hi Adriana: BeanShell to the rescue! The BeanShell script below
modifies the Label style to draw each street name once per screen.
This is a clever way to meet your requirement.

1. Click View > BeanShell. The BeanShell window will appear.
2. Copy the following code, then paste it into the BeanShell window
using Ctrl+V:

{
layerName = "Adriana's Street Layer";
streetNameAttribute = "STREETNAME";
import com.vividsolutions.jump.feature.Feature;
import com.vividsolutions.jump.workbench.model.Layer;
import com.vividsolutions.jump.workbench.ui.Viewport;
import com.vividsolutions.jump.workbench.ui.renderer.style.LabelStyle;
layer = wc.getLayerManager().getLayer(layerName);
oldLabelStyle = layer.getLabelStyle();
layer.addStyle(new LabelStyle() {
streetNamesDrawn = new HashSet();
public void initialize(Layer layer) {
streetNamesDrawn.clear();
super.initialize(layer);
}
streetName(feature) {
return feature.getAttribute(streetNameAttribute);
}
public void paint(Feature f, Graphics2D g, Viewport viewport) {
if (streetNamesDrawn.contains(streetName(f))) { return; }
streetNamesDrawn.add(streetName(f));
super.paint(f, g, viewport);
}
});
layer.removeStyle(oldLabelStyle);
layer.getLabelStyle().setEnabled(true);
layer.getLabelStyle().setAttribute(streetNameAttribute);
wc.getLayerViewPanel().repaint();
}

3. Now street names will be drawn once per screen!

this is an audio post - click to play

GTD - You gotta check it out!

Randy - I'm curious about whether you've had a chance to check out the popular Getting Things Done (GTD) methodology. I finally got around to reading your Time Management Talk from top to bottom, and I noticed that it shares a few points with GTD:

"Never break a promise, but re-negotiate them if need be."
"A good file system is essential."
"Find your dead time. Schedule meetings, phone calls, and mundane stuff during it."
"What am I doing that could be done by someone else."

In addition, GTD has some concepts that you might find intriguing:

- the power of the Next Action
- location-based todo lists
- the dreadful but powerful Weekly Review

GTD is a radically different/complementary approach to Covey, in that it is a bottom-up approach rather than top-down. But as it turns out, it is perfectly valid.

You gotta check it out!

Jon

1x1.jpg

1x1.jpg

Test post #2 using Flickr's Mail2Blog feature with a dummy 1-pixel jpeg. This is a stop-gap solution while Blogger's own mail-to-blog is out of commission.

Creating Your Own Resco Keyboard Skin





Originally Posted by Alex
Jonathan,
I stumbled upon your post on aximsite (http://www.aximsite.com/boards/showthread.php?t=64806) and wonder if you could share your expertise in how to retool the Resco keyboard for displaying the Fitaly layout. Would you be willing to send me the setup file and/or the skin that accomplishes the task? Truth be told, I do not have much aptitude nor time for fiddling with this thing myself... Notwithstanding, you've done a clever thing with Resco and I thank you in advance for sharing the fruits of your labor.
Regards,
Alex

Alex, I would be delighted to share with you how to create your own Resco Keyboard skin. There are two concepts: customizing the character mapping, and customizing the key shapes.


Customizing the Character Mapping

Open the Custom.map file in a text editor, and you will see something like this:


16 q Q 00E0 00C0
17 w W 00E1 00C1
18 e E 00E2 00C2
19 r R 00E3 00C3
20 t T 00E4 00C4
21 y Y 00E5 00C5
I don't know what the stuff in the last couple of columns are, but you can see that columns 2 and 3 are for the letter and the slide-up character. So you can see that to move letters around, all you have to do is edit this file.


Customizing the Key Shapes

Open the Default.png file in Microsoft Paint, and you will see that the keyboard is repeated 3 times:



The red keyboard on the left tells the Resco program what the key borders are. The middle keyboard is what you normally see. The right keyboard is what you see when you press a key.

Important Point: Every key has a slightly different shade of red on the left keyboard. So to move a key to a completely different place, you must also transport that particular shade of red. The shade of red tells Resco Keyboard which character to use from the Custom.map file mentioned earlier. The Eyedropper tool in Microsoft Paint proves useful here, as it captures any colour that you click on.

So you can see that to change the shape of a key, you must change the shape of that key on all three keyboards in the image file, taking care to maintain the key's shade of red on the left keyboard.



Hope that is useful to future Resco Keyboard skinners!

Father Tony's homily

Father Tony's homily

Abraham - trusted God
Transfiguration - like introducing his disciples to his Family. Am I moving in the forward direction, in preparation for that Meeting?

Saturday, February 19, 2005

Test showing how some spaces in pre-tags get dropped when posting to Blogger


There should be two spaces on the left
12345


Every time you edit and re-post, each line loses a space.

Those up and coming little scripting languages

There are some recent programming languages that have all sorts of syntax features to make a programmer's job easier: Ruby, Python, and Groovy are very cool. For instance, instead of having to type ...

Map personToTypeMap = new HashSet();
personToTypeMap.put("Fred", "ISTJ");
personToTypeMap.put("Mary", "ENFP");
personToTypeMap.put("Bob", "INTJ");
for (Iterator i = personToTypeMap.keySet(); i.hasNext(); ) {
String person = (String) i.next();
System.out.println(person + " is type " + personToTypeMap.get(person);
}

... you can do the following in Groovy ...

["Fred":"ISTJ", "Mary":"ENFP", "Bob":"INTJ"].each { person, type |
print(person + " is type " + type)
}

I think this conciseness is amazingly cool.

Java is OK -- a bit verbose (see above), but I'd take it over C++ any day since it takes care of memory management, and is just simpler overall.

Ruby for Object-Oriented Shell Scripts

Matz brilliantly included backticks (`) in Ruby as a low-profile way to integrate system commands into a Ruby script. This means that Ruby can be used to create powerful object-oriented shell scripts. Now you never have to write a batch file or bash script again!

Below is an example that queries Slashdot for its top 3 headlines every hour. Note the cool Ruby string substitution on the "count" parameter.

class Slashdot
def headlines(count)
`lynx -source "http://slashdot.org" | grep "</A>: " | sed "s#.*</A>: \\(.*\\)</B>.*#\\1#" | head --lines=#{count}`
end
end

while true
puts Slashdot.new.headlines(3)
`sleep 1h`
end

Masterpiece Of The Day



I have created an RSS feed called Masterpiece Of The Day, showcasing a daily random masterwork painting from the ibiblio WebMuseum. I did this primarily to learn about some of the great artworks of history, and also to learn how to create an RSS feed. (Paul Graham would be proud!)

So what are you waiting for? Subscribe to it today using your RSS feedreader of choice! Here's the link to the feed:

Geek Notes

I use the following Ruby script to create the XML file, which gets FTP'd to the web on a daily basis. I love languages like Ruby that allow multi-line strings:

urls = File.readlines("motd.txt")
url = urls[rand(urls.size)].strip
url =~ /.*\/auth\/(.*).jpg/
rss = "<?xml version='1.0'?>
<rss version='0.91'>
<channel>
<title>Masterpiece of the Day</title>
<link>http://jonaquino.blogspot.com/2005/02/masterpiece-of-day.html</link>
<description>A daily random masterwork painting from the ibiblio WebMuseum.</description>
<item>
<title>#{$1}</title>
<link>#{url}</link>
<description>&lt;img src='#{url}'&gt;</description>
</item>
</channel>
</rss>"
File.open("motd.xml", "w") {|file|
file.write(rss)
}
puts `ftp -i -n -s:"motd.ftp"`


This picture comes from a walk around the block with Dave Blasby, the creator of Spatial DB in a Box (how's that for a plug, Dave?). Dave was interested in the mountain of rebar that you can see in the background - very hair-like.

I was interested in this pile of crushed cars.

Hello

Hello

Hi Yasuhiro. Well, today is the 19th, meaning it is the anniversary of
your arrival in Canada. I hope you are well, and that you are
practicing jotatsu in your job. Remember, you have to send me a
picture of your room!


Heading out to Cosco with mom

On the way to Cosco

Yay, food!


Wonderful food that Mom made on my brother's birthday. Check out the size of those shrimps!

Art as something that provokes a response

In a recent podcast, Adam Curry mentioned that a certain thing was "art" because "it provoked a response". I think this is a useful working definition.

Anyone know of a free turnkey podcasting web service?

Anyone know of a free turnkey podcasting web service (like Blogger for blogging?). I was hoping to use the Internet Archive for free hosting, but ccPublisher gives me an error (which I've mentioned in an earlier post). Plus, I tried following the FTP instructions to add an mp3 to the Internet Archive, and it never made it onto the site: http://www.archive.org/audio/jontest

Friday, February 18, 2005

Weekly Review complete

It was a painful couple of hours, but yes ladies and gentlemen, I HAVE COMPLETED MY GTD WEEKLY REVIEW! SHAZAM!

Poor Man's Kinesis Keyboard

I've been finding recently that after a day of keyboarding, I sometimes get a sharp pain in my left wrist, especially when I try to rotate my hand counterclockwise. The most probable cause is that many software programs make frequent use of the Ctrl key (perhaps most notorious is the Emacs text editor -- there's even something called "Emacs Pinky Syndrome").

I didn't want to drop $600 on one of those luxurious Kinesis keyboards, and I didn't want to make my wrist worse, so in true Make Magazine spirit, I moved the keys around. There's a great free Windows utility called KeyTweak that lets me do this.

Before:
Before

After:
After

Now the Shift and Ctrl keys are nice and high, alleviating the unnatural twisting you'd normally need to do to do a Ctrl+A, for instance.

Update: To speed up the re-learning process, I have put some velcro on the Ctrl key to make it feel different.

Dang, Blogger and its image hosting service Hello are really slow these days. C'mon Google!


Before

After

Thursday, February 17, 2005

Hm - Blogger is emailing me these funny "no mail alias" error messages every couple of days. Anyone else seeing this?

Tuesday, February 15, 2005

Jon the Stylish, courtesy of New Clothes for my Birthday from Dave and Pam













Dave and Pam sent me some new clothes for my 28th birthday!

Sunday, February 13, 2005

Saturday, February 12, 2005

PocketBlog test post
This is a test post from Pocket Blog. Sitting in my mom's car at Save-On-Foods in Victoria BC Sat, Feb 12 2005 03:03:51 PM

Yay - My First Pocket PC Python Script


import os
import shutil

for file in filter(lambda x: x.endswith("lnk"), os.listdir("/Launcher")):
os.unlink("/Launcher/"+file)

for file in filter(lambda x: x.endswith("lnk"), os.listdir("/Windows/Start Menu\Programs")):
shutil.copy("/Windows/Start Menu/Programs/"+file, "/Launcher")


The Python script above copies the shortcuts in my Programs directory into my Launcher directory, thus updating the programs displayed in my Today-screen launcher (see below).



I'm using Scott Seligman's Launcher because it is simply configured using shortcuts in a directory, enabling me to do stuff like this script.

To run the script, you use the following command inside Pocket Python:

execfile("/My Documents/UpdateLauncher.py")

X

Ruby As Shell-Scripting Language (and del.icio.us as web-based AvantGo replacement)

The Ruby scripting language lets you execute system commands by simply enclosing them in backticks. This makes Ruby an excellent object-oriented replacement for shell scripts.

Here is a Ruby shell script that downloads your del.icio.us links (for a given tag) to a local directory for sync'ing to your PDA. del.icio.us is currently the hottest web-based bookmarking service -- super-easy-to-use and powerful (e.g. RSS feeds).


puts `del *.html`
puts `del "C:\\Documents and Settings\\Jon\\My Documents\\X30 Storage Card\\Delicious"\\*.html`
`lynx -source "http://del.icio.us/JonathanAquino/read-review-mobile?setcount=100" | grep delLink`.split("\n").each {|line|
line =~ /.*href="(.*)">(.*)<.a>.*/
puts "#{$2}\n#{$1}\n\n"
`lynx -source "#{$1}" > "#{$2.gsub(/[^A-Za-z0-9]/, " ").gsub(/ +/, " ")[0..30]+".html"}"`
}
puts `cp *.html "C:\\Documents and Settings\\Jon\\My Documents\\X30 Storage Card\\Delicious\\"`

Make your own Firefox sidebar

It's easy to make your own Firefox sidebar, and all you need to know is HTML!

For example, here's mine: http://members.shaw.ca/Jon_Aquino/Bookmarks.html
  1. Make an HTML page (a narrow one, mind you -- it is a sidebar after all).
  2. Bookmark it in Firefox
  3. Open the Properties for your bookmark and click the Load This Bookmark In The Sidebar checkbox
My sidebar is filled with bookmarklets. I prefer bookmarklets to plugins, as they keep my work and home browsers in sync; plus I can access them from any computer.

Friday, February 11, 2005

GTD Weekly Review complete! Hooray!

It's 11:42 PM on Friday, and I have finished my GTD Weekly Review! These are always painful, but they feel great when they're done.

I feel fulfilled when I do Quadrant II activities like this. In contrast, I feel guilty and anxious when I do Quadrant IV activities like reading comic books excessively or watching videos excessively (like more than one on a given day).

So for me part of living a fulfilling life and feeling joyful is doing Quadrant II activities -- things like spending quality time with my mom, praying, exercising, reading the wisdom literature; in short, growing emotionally, spiritually, physically, mentally.

Change to Sunday's music: we will do 17 instead of 10, as 10 was done last week.

On the Thought: Gosling on SWT

On the Thought: Gosling on SWT: "From memory, there were some OTI Smalltalkers 7-8 ago who did try to convince Sun they were going down the wrong path with AWT/Swing. Swing is very analogous to VisualWorks Smalltalk's approach of emulating the widget toolkit. OTI had been native UI toolkits in Smalltalk for many years and thought it was a better approach. A lot of those folks are responsible for SWT today. They thought emulated was the wrong way to go and they still do."

Go OTI Smalltalkers! I was one of them once.

Emacs wdired mode

The XEmacs text editor has this great plug-in called wdired mode that lets you treat a directory listing like a text file and edit it at will. Great when you have a lot of filenames to modify (just search-and-replace!).

Thursday, February 10, 2005

Dang, I was hacky sacking outside ...

... when Bam I feel this pain in my thigh.

The importance of stretching beforehand.

Wednesday, February 09, 2005

Jon Design #0209: Electric socks

Yes, electric socks. They would keep your feets toasty when the floor is cold.

Jon Design #0209: Electric socks

Yes, electric socks. They would keep your feets toasty when the floor is cold.

Tuesday, February 08, 2005

The Delphi language won't let me do guard clauses :-P

Monday, February 07, 2005

Another tweak to the modified Fitaly keyboard

Moved the Enter key to the traditional right-hand side.


Sunday, February 06, 2005

A practical way to gain wisdom from miserable experiences

You know how whenever you go through a rough time, someone will often say something like, "Well, it's a learning experience" or "Well, it makes you appreciate blah blah even more"? I've often thought that these words of consolation have always been pretty hollow and useless.

But today I learned a practical way to learn from miserable experiences. Suppose you want to learn about your ideal experiences in a given context, for example, the kinds of board games you like:
  1. Start by writing down your most miserable experiences in that context (a list of board games that you absolutely loathe).
  2. Prioritize those miserable experiences (rank the board games from most hated to least hated -- compare them two at a time if you desire a systematic prioritization scheme).
  3. Finally, determine the opposite experience to each of those miserable experiences (for each board game that you loathe, determine what it is that you love instead e.g. unlike Monopoly, my ideal board games are ones that offer you plenty of decisions to make).
You will end up with a list of positive statements of ideal experiences, already prioritized for you. You will, literally, learn positive things from miserable experiences. Neat!

More Fitaly Tweaks


Screen006
Originally uploaded by Jon_Aquino.

Tweaked this Resco Keyboard skin some more. There are now four oversized buttons, for what I think are four very frequently used keys: backspace, enter, comma, and period. Backspace in particular is quite important for people new to Fitaly ;-)

Anyone have any suggestions for other tweaks that would make the keyboard more comfortable? What other keys do you find yourself reaching for a lot?

More Fitaly Tweaks

Tweaked this Resco Keyboard skin some more. There are now four oversized buttons, for what I think are four very frequently used keys: backspace, enter, comma, and period. Backspace in particular is quite important for people new to Fitaly ;-)

Anyone have any suggestions for other tweaks that would make the keyboard more comfortable? What other keys do you find yourself reaching for a lot?


Flickr as workaround while Blogger's post-by-email is not working

I noticed that Blogger's post-by-email stopped working on January 27, 2005. When I try to use it, I don't get any error emails back; the emails simply do not show up on my blog. This really sucks.

Fortunately, there is a workaround. Flickr offers free post-by-email to several blogging services, including Blogger. Normally you attach an image file that gets posted to your blog also. But what if you just want to post a blog entry without a picture? My solution is simply to include a tiny picture, such as a 1-pixel jpg. If you do not include a picture, the post will fail. And if you use a large picture, you will reach your Flickr 10-MB/month quota pretty quickly (plus it would be pretty boring to see the same picture on your blog repeated over and over).

You might ask, "Why post-by-email to your blog anyway? Why not just submit a blog post via the web?" Well I'm often away from my computer and away from WiFi hotspots, so the easiest way for me to enter a blog post on my PDA is to write an email. It will be sent the next time I sync my PDA to my computer or connect to a hotspot. The important thing is that the idea gets captured immediately after it occurs, with no risk of being forgotten.

GIM - The GMail Instant Messenger

My friend was working on a computer that didn't have an IM installed, so we sent tiny emails back and forth to each other. We were both using GMail, and there is a wonderful (free) "GMail Notifier" that sounds a little bell and displays an excerpt whenever a new mail comes in. I couldn't help by notice the similarity between this modality of communication and instant messaging -- they're very close...

I'm going to coin a name for this kind of communication: EM (email messaging).

I wonder if EM can evolve into something really new. It's got a couple of good things going for it: the ubiquity and platform-independence of email, and (almost) the instant communication of IM (especially with good supporting tools in place like the GMail Notifier). Hmm . . .

Father Tony's homily

Father Tony's homily

"salt of the earth"

The story of the 61-year-old woman accepting death, with gratitude for her past life, and no regrets.

The story of the 78-year-old man who was brought back to the church by a woman who wanted him to sponsor her for the Rite of Christian Initiation (RCIA) program.

Saturday, February 05, 2005

Here is a custom Resco Keyboard skin that improves on Fitaly in a couple of subtle ways:



There is the great Fitaly layout on the left. But in addition, all common punctuation is accessible from this screen -- no need to hunt through hidden screens. Some punctuation requires a slide (e.g. sliding up on "7" to produce a "&") -- in these cases, a small visual cue is given (e.g. the small "&" icon).

Note also the functional use of colour to give the user a sense of the structure of the layout (e.g. the "." is highlighted in green).

I also want to share something I discovered about how the Resco skins work. If you open the image file for a Resco skin (named "Default.png"), you will notice an all-red version of the layout. It turns out that each key is assigned a slightly different shade of red. To change the shape and position of the keys, you change the shape and position of these red shapes (in an app like Paintbrush).

My favourite values

It would be a good life, if at its end people remembered me as one who:
  1. Impressed people with my creativity, knowledge, and going the second mile, in meeting their needs
  2. Was a guru in the fields in which I was fascinated
  3. Was always improving and perfecting things
  4. Influenced people, and gained a tremendous response
  5. Did work which brought more useful information into the world
  6. Was often inspired to develop or build something where there was nothing

Friday, February 04, 2005

Re: [RE]Hello

Re: [RE]Hello

Hi Ji-Hwan - thanks for the news. I am CC'ing mom. I looked at your
daily schedule. You study 6.5 hours a day for the TOEFL? I'm amazed.

Currently I am reviewing all of my to-do lists. It's a painful
process, but it's a good thing for me to do.

Attached is a photo of where you were on May 13, 2004 at 6:37 PM.

Thursday, February 03, 2005

My favourite interests (or Fields of Fascination)

Clipboard01

Here I am using a Ruby script to prioritize my favourite interests. Here are the results:

1. Free software and web services
2. Computer programming
3. Mobile technology
4. Time/life management
5. Board games
6. Catholicism, Christianity, spirituality
7. Graphic design

An Implementation of Blocks In Java (or Introducing #collect and #select)

Smalltalkers are used to having #collect and #select to transform and filter their Collections (there are similar functions in LISP, Python, and Groovy, to name a few other languages). Well, now Javaheads can have their own #collect and #select methods.

The key to making #collect and #select work is having blocks. A block (or closure) is just a chunk of code that you can pass around. "But Java doesn't have real blocks", you say. Well, we can get a good approximation by making our own Block class. This will allow us to do things like the following:


CollectionUtil.collect(collection, new Block() {
public Object yield(Object item) {
return "Hello, " + item;
}
});


Basically, #collect lets you do something to each item of a collection, resulting in a new collection. #select lets you filter out items that do not mach a certain criterion:


CollectionUtil.select(collection, new Block() {
public Object yield(Object item) {
return Boolean.valueOf(((Thing)item).isCool());
}
}


And Blocks open up all sorts of possibilities in addition to #collect and #select. A block is just a chunk of code that you can pass around, like a function pointer in C. Sure, you can create your own specialized class or interface every time you want to allow one party to plug custom logic into another, but why not save yourself the trouble and use Blocks!

The cool thing about this implementation of Block is that it can take 0, 1, or 2 arguments -- whichever is required. Check it out:


public abstract class Block {
public Object yield() {
throw new UnsupportedOperationException();
}
public Object yield(Object arg) {
throw new UnsupportedOperationException();
}
public Object yield(Object arg1, Object arg2) {
throw new UnsupportedOperationException();
}
}


OK, now that we have the implementation of Block, we can take the next step and build #collect and #select methods (and others):


public class CollectionUtil {

public static Collection collect(Collection collection, Block block) {
ArrayList result = new ArrayList();
for (Iterator i = collection.iterator(); i.hasNext();) {
Object item = i.next();
result.add(block.yield(item));
}
return result;
}

public static Collection select(Collection collection, Block block) {
ArrayList result = new ArrayList();
for (Iterator i = collection.iterator(); i.hasNext();) {
Object item = i.next();
if (Boolean.TRUE.equals(block.yield(item))) {
result.add(item);
}
}
return result;
}
}


I'm sure others will come up with other good uses for Java Blocks!

My favourite interests

"If you could talk about something with someone all day long, day after day, what would that subject or field of interest be?"

I wanted some right-brain way to trick my left-brain into sleeping so that I could properly answer the above question about what my favourite interests are. Then it struck me: my favourite interests are probably what I'm reading daily in my RSS reader.

Therefore, my favourite interests are:
  • free software and web services (del.icio.us/popular, Slashdot, CNet, Jeremy Zawodny's Blog, Jesse Ruderman, Jon's Radio, Robin Good's Latest News, Russell Beattie Notebook, Scobleizer: Microsoft Geek Blogger)
  • time/space/life management (GTD forums, Julie Morgenstern, Stephen Covey, 43 Folders, Working Smart)
  • mobile technology (Aximsite forums, jkOnTheRun, Pocket PC Addict, Pocket PC Magazine, Pocket PC Thoughts, pocketnow.com, Trusted Reviews)
  • board games (Skyhaven, BoardGameGeek - currently my interest in board games is low, however)
  • Catholicism, Christianity, spirituality (del.icio.us/tag/catholic; finally found an interesting Catholic author: Matthew Kelly)
  • computer programming (Vasanth Dharmaraj, Erik's Linkblog, James Strachan's Weblog, Joel on Software, Cedric's Weblog, Scratch Where It's Itching)
  • graphic design (Stylegala, Image*After)

Tuesday, February 01, 2005


Man, Google is the antithesis of most every other software company out there -- check out the snazzy little invite box that appeared at the lower-left corner of my GMail this evening. It is a marvel of functionality and elegant design. Compare to Hotmail's confusion of blinking lights and low horsepower.

Fleshing out my favourite skills a bit

1. Designing beautiful software
2. Writing code safely
3. Resourcefully extracting patterns from data
4. Designing outstanding graphics
5. Exhaustively evaluating alternative products
6. Enthusiastically writing for a large audience