Thursday, February 23

Mad!

Wednesday, February 22

2005 In Retrospect: Technology

These are the top 5 'technologies' that impressed me and/or saved my butt last year:

  • Scriptaculous, Rico, AjaxTags - AJAX made easy (the latest version of AjaxTags uses Scriptaculous).
  • Python - always reminding me why I chose computer science in the first place.
  • Ruby On Rails - very promising. I've only gone through their 15 minutes demo and wrote 1-2 small prototypes for myself, but I am impressed.
  • Spring rules. 2005 was 'The year of AOP' for me, and Spring made it a wonderful, productive experience.
  • iBatis - I've spent so much time with Hibernate doing things behind the curtains for me that I forgot how nice it is to manage SQL by myself at times.
Related post: 2005 In Retrospect: Music

Tuesday, February 21

Tomcat HTTP/1.1 GZip compression

I found out about Tomcat 5's built-in HTTP/1.1 GZip compression on this comment. This feature is off by default.
Having this feature off by default causes confusion and encourages people to reinvent the wheel, multiple times, with different flavors.
Bless.

Saturday, February 18

Celebrity match

The face recognition algorithm of MyHeritage matches this photo of mine (age 6?) with these celebrities [click on photo to enlarge]:


Yes, some are a bit disturbing, like John Woo?? Try yours at MyHeritage

Fearless: the music video is a great trailer

Thursday, February 16

"Found is the new search"


Cool (and not so cool) things about mag.nolia:

  • Great domain name.
  • Superb tag line (the title of this post).
  • Saved Copies of Web Pages - I've bookmarked many pages that now return 404's. This feature alone might be worth a business model.
  • Private bookmarks - Though why would a community oriented service encourage private stuff?
  • Bookmark rating system - We all love our lists, right?
  • Terrific design and they're rightfully proud of it.
  • Network with some well-known names - Ted Allen is there, Zeldman is there too.
They certainly did their homework and thought things through. However, as attractive as their service seems to be, I find no compelling reasons to move away from del.icio.us (and even less motivation to use two bookmarking services).
Really hope there is room for two in their segment.

[Update]: There is a great writeup here on their design/development process.

Tuesday, February 14

Adopt a comedian (the AAC needs you!)

ZeFrank has done it again. The 1/4 mile longcar bit kills me...

Monday, February 6

Python for experts - Shipping part 1

The last one of my previous series of posts on Python addresses the issue of shipping Python applications.
Simply put, if I ask people to help my research by using an application that I developed, I do not want to force them to:

  • read large manuals
  • unzip and fiddle with my 'distributed zipped folder' with executables, DLLs, and other helper files
  • install/uninstall stuff on their machine
  • waste their time
Ideally, I want to give them a small(ish), standalone file they can download, double-click to run, and delete when they're done.
On Windows, I could only find two tools that claim to accomplish that:

py2exe
PyInstaller

Both have options to deliver either a distribution folder or a standalone file executable. I was only interested on the latter option.

py2exe seems to have problems with applications using Tkinter for the GUI. For my server module, which does not have a GUI, the setup file below did the job.


# setup.py
from distutils.core import setup
import py2exe

setup(data_files=[("abbreviations.txt")],
   name = "Jiim Server",
   description = "Cross-Linguist Server Prototype.",
   version = "1.1",
   author='Jorge De Castro',
   author_email='jorge at bcs dot org dot uk',
   zipfile=None,
   console= [{"script": "server.py"}]
)


This yielded a server.exe standalone file with 4.5Mb.

PyInstaller hit the spot. It is simple to use (simpler than py2exe) and their documentation is very good. Furthermore, after I installed UPX as instructed on their homepage, the executable created was compressed to less than half(!) the size (1.85Mb) of the one created with py2exe. The command line options I used are shown below:

> python Makespec.py --onefile --name=server C:\Workplace\python\jiim\server.py
> python Build.py server\server.spec


It seems possible to have py2exe do the same (or most) things PyInstaller does, but the latter is much nicer and easier to use. Plus, it just works as expected.
Be prepared to struggle with py2exe's (lack of) documentation if you want slightly more complex setups.

Friday, February 3

My Reusable Advice - part 1

Logging and tracing are separate concerns of an application (except for applications where this is an explicitly specified requirement). Thus, I was becoming increasingly annoyed with the


import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
...



and corresponding logging calls all over core modules, business classes, and even POJOs that required occasional debugging.

Furthermore, any changes to logging policies/strategies required multiple changes across multiple classes and a rebuild.

AOP is the technology for separating crosscutting concerns into single units called aspects. An aspect is a modular unit of crosscutting implementation that encapsulates behaviors that affect multiple classes into reusable modules.
AOP is thus the best way to log & trace entry & exit methods on demand. My earlier reluctance was due to the slightly harder way to debug control flow, as exemplified below:


...
if (condition){
log("Doing X")
do X
}else{
log("Doing Y")
do Y
}
...


The scenario above is still possible but not so straight forward to do with AOP. But really, the gains outshone the limitations. Consider the advice below, using the SpringFramework:


import org.aopalliance.intercept.MethodInterceptor;
import org.aopalliance.intercept.MethodInvocation;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

public class MethodExecutionTimeInterceptor implements MethodInterceptor {
private final Log logger = LogFactory.getLog(getClass());
public Object invoke(MethodInvocation methodInvocation) throws Throwable {
logger.info("intercepted method '" + methodInvocation.getMethod().getDeclaringClass() + "::" + methodInvocation.getMethod().getName() + "'");
long startTime = System.currentTimeMillis();
try {
Object retVal = methodInvocation.proceed();
return retVal;
} finally {
logger.info("method duration '" + (System.currentTimeMillis() - startTime) + "' msecs");
logger.info("resuming method '" + methodInvocation.getMethod().getDeclaringClass() + "::" + methodInvocation.getMethod().getName() + "'");
}
}
}


I can apply the logging unit above to any subset of classes in my application, or indeed to the whole application. The advice will automatically run whenever its pointcut matches a join point in my running program. Should logging requirements change or become redundant, I can remove the aspect without touching application code. The original code does not know of the logging aspect being applied to it.
This single aspect contributes to the implementation of a number of methods, modules, or objects, increasing both reusability and maintainability of the code.

For future reference, IBM DeveloperWorks as an extensive array of very useful articles on AOP.

A full logging example can be found here, many AOP resources can be found here, and a good introduction to AOP can be found here.

Thursday, February 2

2005 In Retrospect: Music

Here are the top 5 albums that were on heavy rotation on my iPod:

  1. Antony and the Johnsons, I'm a bird now - I first heard Antony & the Johnsons in 1999 (if my memory serves me well), when they opened for Current 93 at Sadler's Wells (I think). It was, together with David Byrne's "Monster in a Mirror Tour", one of the best and most intense live acts I have ever seen. Been a faithful fan ever since, and will never forget them.
  2. Bloc Party, Bloc Party - These Essex boys really rock! Keke, their frontman, has a quite a voice . Their sound has the rock'n'roll attitude of a Doolitle (I know, this is a bold statement!), the freshness of an early Blur, and can sometimes (Banquet) remind me of The Cure. "Like drinking poison, like eating glass" oh yeah!
  3. Coldplay, X & Y - Darnit. I admit I wasn't expecting much from this release but they certainly delivered. I give it up, Coldplay deserve to be right up there with the U2s and Radioheads: they simply have the talent.
  4. Royksopp, The Understanding - what a masterpiece, I love it! Karin Dreijer's voice in What else is there is unavoidably seductive!
  5. Zhou Hui - Something I brought from my trip to China in 2001. Just recovered my CD that was scratched due to overuse. She has got to have the most beautiful voice and sings like an angel. Can't even find an (non-Chinese) Internet link, that is how precious she is!

Runners up: dEUS - Pocket Revolution, Frank Black - Honeycomb, Gorillaz - Demon Days, Kings Of Leon - Aha Shake Heartbreak, Keane - Hopes and Fears, Sigur Ros - Takk

Wednesday, February 1

More WYSIWYG

In a previous post I referenced a few user-friendly, WYSIWYG editors for the Web. The good people at http://www.geniisoft.com compiled an extensive list with (all?) open-source and commercial WYSIWYG products in the market.
Nice one, thanks.