Eclipse DTD Trick

January 31, 2006

Love it or hate it, Eclipse is very insistent on going out to the web to fetch DTDs to validate the active XML file. When it can't find one, it whines, complains and puts an ugly yellow mark on your file, tagging it as a warning condition. Perhaps this is a small itch, but I felt like scratching it, so I have included an equally small solution to the problem.

The problem with DTDs is (and has always been?) that they don't necessarily point to actual internet resources. Authors use DTD URIs as namespaces to keep the elements in one definition totally seperate from ones (perhaps with the same name) in another. In the early days, it was even encouraged that authors just make up any old URL, as long as it was, and would remain to be, unique. Well, maybe Eclipse missed that day in class, so we hack on.

The question remains, where can you find the DTD in a consistent location, from whereever you are? Sure, you can load it into your local catalog, but as soon as you are on another computer, the problem is back. We want a permanent solution. The source code repository, of course! These servers are always available, serve up the files without interference from a website rebranding, and better yet, they are already versioned! Brilliant! Simply use the "download" link from the web-based CVS/SVN tool that points to the DTD file in the source code repository in your DOCTYPE definition at the top of the file (we have to at least assume the author checked it in!). I will leave you with an example:

<?xml version="1.0"?>
<!DOCTYPE facelet-taglib PUBLIC
"-//Sun Microsystems, Inc.//DTD Facelet Taglib 1.0//EN"

* remove the endline in the URL when copying

Posted at 12:50 AM in Java | Permalink Icon Permalink | Comment Icon Comments (2)

Giant-Ass Image Viewer 2

January 23, 2006

GSV2 I am proud to announce that the next generation of the Giant Ass Image Viewer has been released to the world! For those of you who are not familiar with the original program, the Giant-Ass Image Viewer (GSV) is a javascript driven user interface for viewing large, high-resolution images, behaving very similarly to the Google Map interface. This interface allows a browser client to pan and zoom an image that is much larger than the screen, fetching tiled sections on demand. As one edge of the image moves off the screen in one direction, new portions of the image appear on the opposing side. Using this type of interface allows the image being viewed to theoretically be infinite. As such, the taxation on the network connection is minimized tremendously by the fact that only portions of the image are needed at any given time.

This next version offers a host of new features that were absent in the first cut, in addition to a new code design. (I want to add that the original program is an excellent script and the additions in no way dimish the accomplishments of the author. So before continuing on, hats off to Michal Migurski).

After hacking on GSV for a while, I got to the point where the code was starting to get tied in knots as I tried to weave in new features. Before continuing on, I decided that it would benefit tremendously from a new design, so I didn't waste a minute before rewriting the code from the ground up as a javascript object. The program now has a very clean and readable design that is quite extensible. It makes use of the observer pattern as well, that notifies listeners of events such as move and zoom. This pattern allows other programs to track its status.

So what else is different? GSV 2 adds a significant boost in performance by using more concise logic and throttling the response to mouse move events. It also fixes rounding errors in the tile placement that was causing artifacts, takes advantage of image preloading and caching, caps the maximum zoom level, disables pan events for areas outside of boundary, recenters on a double click of the mouse, smooth scrolls when repositioning, displays and optional loading image while fetching an uncached tile, fits the viewport to the size of the window, and uses a cross-browser grabbing mouse cursor, amidst other changes. Finally, the workhorse of the program, the python tilemaker script, has also been rewritten to be more informative and flexible.

I will be contributing the code back to the original author, Michal Migurski, so the location of the project page is undecided at this point. However, I have made a demo available in the cooker, which offers a NASA view of the Mars venturer, Spirit.

Posted at 10:25 AM in Javascript | Permalink Icon Permalink | Comment Icon Comments (36)

Ubuntu Redefines Linux

January 10, 2006

Redefining it by saying that it just works! I am back again telling the world how great Ubuntu is because, well, it deserves the praise. The intentions for Breezy Badger, the latest cut of the Ubuntu distribution, were to make it easy to use and to work right out of the box. I had heard that it lived up to these expectations and I even had several colleagues in my office come to me, virtually star struck by its aptitude, recounting their pleasant installation experiences. However, nothing could prepare me for how I felt when I it asked me for my credentials for my (previously non-functional) wireless card 30 seconds after booting my computer with the installer CD. It almost brought a tear to my eye...not because I didn't think it was possible under Linux, but because I will now long for those long, cold nights googling for answers to obscure kernel messages trying to get something to work. I am going to have to step back and spend some time actually using the desktop (so that's why we install these operating systems)!

To the Ubuntu team and the entire community, job very, very well done! I could continue on, raving about how many things work so seamlessly in Breezy, but then I would be sqaundering all the time I get to actually use the darn thing!

Posted at 07:55 PM in Linux | Permalink Icon Permalink | Comment Icon Comments (2)