September 2009

Sometimes you need to remember a command line tool, refresh some concepts about a programming language, etc. Because this I want to post here two nice a very useful tools: technical posters and reference cards.

  • RefCards are normally a summary of things written in a two sides page.
  • Techposters are a similar concept but fills a great page.

I point only to two sites, but if you spend some time to find a bit more you could find other nice sites with great docs.

No doubt to put your comment and attach other sites with documentation (like scribd).

Taking a walk on our big virtual world I found this nice page http://elements.wlonk.com. which contains fun periodic tables which can be a great help to remember the elements.

As the page says: These colorful, fun, and informative periodic tables are great for elementary, middle, and high school students, as well as adults.

There are two kind of syntax hightlighters for a web place, those who run on the server side and those who run in the client side.

The first group depends on your server, if you are using plain HTML pages or any CMS or blog system (Wordpress, Drupal etc). When you request a page, the server side code highlighters colorizes your text in the appropriate way and returns it to the clients.

In the opposite, the client side code highlighters are, basically, a pice of JavaScript code that is loaded with your page, scan your code and highlight the specified blocks. All the work is done by the client, the browser.

In summary, this post is all about to point to the Alex Gorbatchev syntax highlighter a very nice client side solution, which among other things has:

  • Support for a great number of languages: C, Java, Bash, XML, Perl, PHP, ...
  • Collapsible code option
  • Line numbers
  • Wrap lines
  • ...and many more
You can see it in action on this blog :)

If like me, you need to parse some text using regular expressions and it must be done in a casi insensitive way, here is the trick you are looking for.

If you use the Pattern class approach, then add the Pattern.CASE_INSENSITIVE flag:

Pattern p = Pattern.compile("YOUR_REGEX", Pattern.CASE_INSENSITIVE);

If you prefer to use the String.matches() method, then use the ?i flag in the regular expression:

"XYZxyz".matches("(?i)[a-z]+")

I want to note I found this help on: http://blogs.sun.com/xuemingshen/entry/case_insensitive_matching_in_java.

The project

Having the previous in mind, my final decision was to use WWJ as the 3D API and wrap it as a very nice desktop application. So a new question arise: do I must use a framework or programming the application from the beginning?

Again, when working on my own 3D API I was reading and making some tests with NetBeans Platform. There are other good frameworks like EclipseRCP or, the recently appeared on these days, Swing Application Framework, but after some readings I finally choose NetBeans Platform for the next reasons:

  • 100% Swing
  • Modular runtime container
  • Plugin support
  • Window system
  • Support handling actions, files and many other things typical in applications.
  • Active project, decent documentation and great forum activity.

I have no doubt, NetBeans Platform plus WWJ is a great combination.

Screenshots and Videos

Swing Annotations

Prism Objects

History

The Balloon Project was born some time ago (I think in 2006) when ear NASA was preparing a Java API for WorldWind.

I always like 3D but never have enough time to make someting related with it. Finally I was decide to start my own virtual globe project. I was spent one year learning and programming 3D and as result I produce my first API release, never published, with next features:

  • Smooth globe, no elevation information.
  • Layer+Object composition, that is, all the information in the globe is understanted as layers: tile layers, icon layers, vector layers, composite layer, etc and every layer contains renderable objects: points, icons, polygons, images.
  • WMS tiles request, I was initially created a WMS tile layer to get content from WMS servers. That way you can overlap aerial images with street data from OpenStreetMaps, etc.
  • Picking, all objects reacts under mouse events throught the OPENGL picking mechanism.

Then... why to change to NASA WWJ?

This answer is easy. In the same year NASA release the first or second version of WWJ which some important features, like elevations. Also, in the next months I saw how the NASA team publish new release with more improvements I can do anlone.

Because this I start learning WWJ API and make some little contributions:

What I had in mind is not only to create a virtual globe API, NASA WWJ is the best Java alternative for that, but to create a complete applications.

Recently I started working with Jetty. I have never used it, always working with Tomcat and my dear GlassFish.

One of my first problems with Jetty was about the symbolic links in Linux. Usually, while developing, I like to have my code organized in some directories and my servers in others. Then I create a simlink from the webapps Jetty's folder to my project folder. But that strategy fails initially in Jetty.

Taking a look in the FAQ pages found here and here, you can read that:

Jetty by defaults runs in a mode where all file accesses are checked for aliases, such as case insensitivity, short names, symbolic links and extra characters (Eg %00). If a resource is an alias, then it is treated as not found.

There are, or at least I know two solutions.

  1. Start Jetty by command line and specify the property value, like: java -Dorg.mortbay.util.FileResource.checkAliases=False -jar start.jar
  2. Adding it as an initialization parameter in the webdefault.xml file:
    default org.mortbay.jetty.servlet.DefaultServlet . . . aliases true . . .
No doubt to put any comments.

IDL

IDL (Interactive Data Language)

Be patient I'm trying to get my old IDL code and publish here

  • EventAction class brings to IDL objects the possibility to emit "events" and assosiate actions (procedures, functions or object methods) to be executed every time the event ocurrs. For example, supossing a typically button class, you may want to execute some procedures when the click event ocurrs. The code is accompanied with an example. Execute "@run.g" to test it.
    EventAction emulates the Java Listeners attached to object and simplifies the programming style.