Apr 26 2007

Creating Internet Shortcuts in Windows

Do you need to create a Firefox or Internet Explorer shortcut to your website in a client’s desktop? To create an internet shortcut just create a new text file where the file extension is URL. The internet shortcut extension needs to be capitalized to URL. As an example, I’ll create a Juixe.URL file and simply place it the desktop. Open the newly created text file with your favorite text editor such as SciTE and add text like the following.


Even though we created a simple text file, it will have the icon of your default browser with the little shortcut arrow in the bottom left. If you double click on the newly created internet shortcut, a simple URL file, it will open your default browser to the indicated URL.

Technorati Tags: , , , , , ,

Apr 25 2007

Embedding Jetty

Jetty is a lightweight open source Java-based HTTP Server and Servlet container. Jetty’s small footprint makes it perfect for embedding into larger Java applications, in fact Jetty is used by the likes of Jboss Application Server and Apache Geronimo.

Embedding Jetty is extremely easy. For the most part you just create a new instance of a Jetty server, indicate where the server can find the resource files, such as HTML/PNG files, maybe add a Web Application Resource (WAR), and start the server. Here is the code step by step, of course the following code assumes you have added the required jars.

Server server = new Server(8080);

The above creates an instance of the Jetty server (org.mortbay.jetty.Server) listening at port 8080, but does not start the server. At this point we would need to add a default resource handler with the location of the directory which contains the public HTML, JPG, JS, and additional files which will can be requested by clients.

ResourceHandler publicDocs = new ResourceHandler();

I would also like to add support for a Java-based web application.

String webappPath = “c:/path/to/webapp.war”;
String contextPath = “/webapp”;
WebAppContext webapp = new WebAppContext(webappPath, contextPath);

Now I need to add the public resource and web application handlers to the Jetty server.

HandlerList hl = new HandlerList();
hl.setHandlers(new Handler[]{publicDocs, webapp});

At this point, you can start the server simply by calling the start method.


Once you have the above code up and running point your browser to http://localhost:8080 to connect to the Jetty server, of course you would need some index.html in the public docs directory. In this example, if where to connect to the web application described here you can do so by directing your browser to http://localhost:8080/wepapp.

Technorati Tags: , , , , , , , ,

Apr 19 2007

Google AJAX Feed API

Google recently made available a new JavaScript-based API for downloading RSS and Atom feeds. Up to now I have been using Magpie RSS for downloading, caching, and displaying feeds. I was just thinking of tinkering with Feedtools for manipulating and handling feeds in Ruby/Rails, but I would much rather like for Google to deal with, cache, and pay for the bandwidth of all the RSS feeds that I consume.

You will need to get a developer key, just like for all other of Google’s APIs, before you start using the Google AJAX Feed API. Once you have a developer key, they will give you all the JavaScript code you need to start displaying feed entries, well you might want to configure the feed format and/or how many entries you want.

As an example of what you can do, or of what others have done which you can use, with the new Google AJAX Feed API check out Feed Billboard.

Technorati Tags: , , , , , , , , , ,

Apr 19 2007

Is Software Development Dead?

It seems to me that there is a common theme, or meme, propagating in the background of developers’ mind as I keep reading how such and such technology is dead. Take for example the latest incarnation of this question asked by Zarar Siddiqi, Are JSPs Dead? I would suppose that JSPs are dead if Java was dead. But being pronounced dead by pundit engineers does not inflict Java alone. A few days ago Paul Graham made a uproar in technology circles by proclaiming that Microsoft is Dead and that Redmond rigor mortis was setting in on the software giant. Personally I think that Microsoft has soo much money in the bank that it won’t die that easy, they could just buy kidneys, patents and technology from whomever they want. But even with all that cash at hand someone asked on the Joel on Software forum if .NET was dead.

You can find premature obituaries not only for programming languages such as Python and Perl, but for the whole software industry.

Is “Free Software” Dead? No! Is commercial software dead? No! Is Enterprise Software Dead? No! No! No!

I feel that these questions are troll-level orange as they don’t help to answer any software questions or help in any design debate. These questions are not food for thought, but food for FUD. Just to answer your questions, Fortran is not dead, Perl still takes care of business, and Lisp is still alive and kicking.

JSP, and Microsoft, and all these technologies must be quoting Mark Twain right about now when he said, “The reports of my death are greatly exaggerated.” Now, can we all just get back to coding?

Technorati Tags: , , , , , , , , ,

Apr 9 2007

Embedding HSQLDB

HSQLDB is a fast, small, and robust relational database management system (RDBMS) written in Java. HSQLDB provides both in-memory and disk-based database implementations. HYSQLDB is small enough that it can be embedded into an application with little effort and is currently in use by OpenOffice, Jboss, Jira, and Mathematica amongst other software applications.

Embeddinging HSQLDB is as simple as adding the hsqldb.jar to your class path. Once you have the class path set, load the HSQLDB driver, as you would for any JDBC driver.


After registering the driver, you can just connect to a HSQLDB as you would with any other JDBC compliant database engine. It is hard to believe, but this is all you have to do to embed a database into your Java-based application!

You can connect to HSQLDB in two fashions, as an in memory database or persisted file-based database.

As an in-memory database, your database and all it’s data exist only while your application is running. Once you restart your application, you will need to recreate the tables and insert records to rebuild the database. An in-memory database are useful only if you don’t care if you loss the data. To create an in-memory database connect using code like the following, you can replace database_name with with something that is applicable to your application.

String url = “jdbc:hsqldb:mem:database_name”;
String user = “sa”;
String password = “”;
Connection c = DriverManager.getConnection(url, user, password);

If you want your data to be stored and persisted after your application has exited, then you will have HSQLDB write the data to a file on disk. To create a file-based database use a JDBC URL like the following where you replace the path to the database file with something that is appropriate to your application.

String url = “jdbc:hsqldb:file:/path/to/database/file”;
String user = “sa”;
String password = “”;
Connection c = DriverManager.getConnection(url, user, password);

You can also use a relative path your user.dir system property to your database file. The user.dir property contains the directory form which your Java process starts.

Once you have a JDBC connection to HSQLDB you create tables and insert rows as you normally would in JDBC.

Technorati Tags: , , , , , , ,

Apr 9 2007

Software Development Environment

I had to update our project wiki and detail our current software development environment. I found that we are lagging a bit behind the latest Java technologies and tools, but from a business perspective I think it is hard to up sell existing customers just so that developers can use the latest Java language features in their code. Large software clients usually invest a lot of time and money into the applications they use for their business processes and can’t upgrade based on the schedule of software tool vendors.

Thinking about the current state of tech tools, I wanted to jot down the tools of the trade that I use on a day to day basis.

Java Development/Work
Java 1.4.2
Maven 1.0
Eclipse 3.1.2 with Perforce plugin

Java Development/Home
Java 1.5
Maven 2.0
Eclipse 3.2.1 with Subclipse, Groovy, JavaCC, and Aptana plugins
Subversion 1.3

Ruby on Rails
Ruby 1.8.4
Rails 1.2.2
RadRails 0.7.2

SQL Server 2005 Express
Oracle 10g Express
Mysql 4.1.15

Firefox Plugins
Firebug 1.04
Web Developer 1.1.3
Selenium IDE 0.8.7

Miscellaneous Editors
SciTE 1.70
Komodo Edit 4.0
TextWrangler 2.2

Google Apps

Technorati Tags: , , , , , , , , , , , , , , ,