Sunday, January 28, 2007

Convention over configuration in Java web apps

Diego Pires Plentz sent me an update on a project that he works on: VRaptor that uses Java 5 annotations to reduce the amount of configuration required. An example:
@Logic(parameters={"login","password"})
public String execute(String login, String password) {
allows direct URL access to class methods, creation of POJOs, etc. This looks cool for Java developers, but for me I have moved on to Ruby on Rails for new web application development (unless a customer asks for J2EE :-)

True confession: programming in Javascript and loving it

Javascript is a flexible functional language similar to Common Lisp and Scheme, if not in syntax, at least in spirit. Bruce Tate wrote a good overview JavaScript's language features that is well worth reading.

I find HTML's DOM model to be unpleasant to work with, but Javascript the language is fun to use. I have been using the Dojo toolkit a lot lately and the authors of Dojo have done a fine job of building a platform that insulates programmers from the hassles of DOM and browser incompatibilities.

I am currently working on another AI book (using Ruby for the examples) but I would enjoy later writing a Javascript book from my own perspective (a developer who wants to use the same Javascript skill set when developing using Ruby on Rails, Java, Common Lisp, etc.).

What to do to survive the recession? Build wealth

I am going to loan my copy of The Millionaire Next Door to my kids and nieces as a guide for long term wealth building - this entertaining book is a road map for building wealth instead of living a consumption based life style.

Since many more economists are now warning about the serious structural problems in our economy (that the war in Iraq is keeping out of the public consciousness), it occurred to me that Stanley and Danko's advice on money management and life style also apply to protecting you and your family from economic downturns. I am old enough to have lived through several economic "boom and bust" cycles, and one thing that has always caught my attention is that during "boom" economic times, a lot of people seem to believe that the good times will never end. In fact cycles are natural, should not be feared, and should be planned for.

New York Times advice: "Eat food. Not too much. Mostly plants."

I just sent this link to my family and friends with the joke that the news media, in this case the New York Times, feeling guilty for not doing their proper job during during the run up to the Iraq invasion has finally decided to tell the truth about food :-)

This article on food and nutrition strikes a cord with me for another reason: I have friends who worry about future shortages of potable water and energy. I believe that the solution to future resource problems is simple: let the free market determine the costs of the food that we eat. A case in point: why should Congress give the beef industry about $40 billion a year in free water subsidies?

Raising meat for food rather than plants does the following:
  • Uses 10 times the water
  • Uses 10 times the energy
  • Generates horrendous pollution of the air and underground water supplies
  • Raises health care costs caused by unhealthy eating habits
I think that it is fine to eat meat, but we only need tiny portions each day to augment a primarily vegetarian diet.

It all comes down to a personal choice not to be a glutton, be it gluttony for food, buying large fuel inefficient vehicles, or houses larger than your family needs for comfortable living that you will never be able to own (i.e., pay off the mortgage). I believe that water and energy resource problems are solvable with free market economics and raising our collective consciousness concerning the downside of gluttonous life styles.

Saturday, January 20, 2007

Using the Dojo Javascript library in Ruby Rails

I have been using the fine Dojo Javascript library in a web app written in Common Lisp and this morning added Dojo to the code base for a current Rails project. The easiest way to get started using Dojo and Rails is to simply install the developer's version (non-compacted) of dojo.js and the src directory directly in your Rail project's public/javascripts directory, so it looks like this:
public/
javascripts/
dojo.js
src/
Again, the "src" directory contains the dojo source files (besides the dojo.js loader). Dojo will complain about rendered Rails web pages withot HTML and HEAD tags, so I added the following HTML with Dojo setup to the view for my main application controller:
<html>
 <head>
  <title>KBSportal KnowledgeManagement</title>
  <script type="text/javascript">
  djConfig = {isDebug: true};
 </script>
 <script src="/javascripts/dojo.js" type="text/javascript"></script>
 <script type="text/javascript">
  dojo.require("dojo.io.*");
  dojo.require("dojo.event.*");
  dojo.require("dojo.widget.TabContainer");
  dojo.require("dojo.widget.LinkPane");
  dojo.require("dojo.widget.ContentPane");
  dojo.require("dojo.widget.LayoutContainer");
  dojo.require("dojo.widget.Checkbox");
 </script>
 <style type="text/css">
  body {
   font-family : sans-serif;
  }
  .dojoTabPaneWrapper {
   padding : 10px 10px 10px 10px;
  }
 </style>
</head>
Dojo is definitely "heavier weight" than the prototype.js Javascript library that is provided with Rails so you may not want to use Dojo for very high traffic sites.

Wednesday, January 17, 2007

The genius of Jerry Weinberg

In the 1970s when I started professional software development there was one book that changed the way I viewed my job: The Psychology of Computer Programming

I was working at a large company and being right out of college I was surprised at the political nature of work. I was also surprised how difficult it seemed for people (including myself!) to see errors in their own work. Anyway reading this book over 30 years ago had a great positive effect on my career.

I saw a reference recently to another of Jerry's books: The Secrets of Consulting

I have been working, mostly out of a home office, as a consultant for about 10 years. Although I really enjoy consulting because of the variety of projects, consulting does have its drawbacks. I am not quite done reading Jerry's new book but it has already given me good insights into my chosen profession, mostly dealing with realizing what I don't know and new ways of thinking about the non-technical aspects of consulting. Excellent!

Friday, January 05, 2007

Suggestion for PC manufacturers

Most large PC manufacturers pay a small price for OEM Windows, but then usually only sell PCs with Windows bundled. I prefer Linux, but I get value add also having a dual boot Windows partition.

My suggestion to PC manufacturers: offer an option making the Windows partition only 50% of the disk. This saves some time in setting up dual boot systems. I have used programs to shrink a Windows partition but I would rather not have to do either this or re-install Windows and Linux.

Wednesday, January 03, 2007

Long term prediction: Microsoft loses its monoply power

This is not a prediction for the 2007 New Year, but I believe that in the next 5 to 10 years Microsoft's influence on the computer/IT industry will be very much diminished. The transition to open source and open data formats has already started in Europe and developing countries looking to save money and is picking up some momentum in the US.

The new DRM features of Vista will turn off many users who are more interested in using their computers for information technology than for watching movies and listening to music. Any security advantages of DRM will probably be countered by more problems with interoperability with third party software and other operating systems (dual boot!).

Some pressure for the transition from Windows to open source will be the fear of some foreign governments of security issues with a closed operating system. Several years ago Microsoft had to provide Windows source code to the Chinese government.

Microsoft has been very effective in fighting back against open source using threats of patent infringement and "influencing" government officials. All large corporations "influence" government officials, so I am not particularly picking on Microsoft here. I also acknowledge that Microsoft has a responsibility to their stockholders to make a profit. BTW, I sold my Microsoft stock in 2005 because I was unhappy with their pushing proprietary document formats - not a financial decision.

I believe that in the next five years that more local and national governments will either use more open source software or completely switch over to open source. I expect this to be a slow and steady process. I also believe that organizations not using open source software will eventually find themselves with both economic and technical disadvantages.

Tuesday, January 02, 2007

Nutch: a platform is born

I have used Nutch for two contracting jobs and Lucene for many jobs. Until today, I have viewed Nutch simply as:
  • Quick to configure for target websites to spider and to administer spidering
  • Trivial to run search web application
  • Web service provider (OpenSearch API)
Today however I started looking more closely at the underlying Hadoop architecture (like the distributed Google file system and their map reduce client library) and at both the available plugins and the plugin architecture. New opinion: Nutch is a platform for building more complex web applications and knowledge management applications.