Travel: Santa Monica sunset, Dia de los Muertos in Los Angeles

Some pictures from last year Dia de los muertos (Day of the dead) and sunset from Santa Monica during the California fires last October.

Santa Monica sunset during California fires last October

Santa Monica sunset

Santa Monica sunset

Dia de los muertos (Day of the dead) in Los Angeles

Dia de Los Muertos

Flamenco dancer corpse

La Katrina

Katrina with baby
Paying attention

Dia de Los Muertos

AJAX with Yahoo UI components and DWR

I’ve been playing lately with YUI, the Yahoo User Interface library. So far I’ve used the autocomplete and treeview components, and I have to say they are quite easy to use and very complete. I had used Script.aculo.us autocomplete before, but YUI autocomplete has a lot of configuraiton options and all of them really well documented, like caching or being able to easily use it as a normal dropdown when the user just clicks on the field without typing anything. Event handling is also pretty easy.

DWR in the other side is a really easy way to expose your service interfaces through javascript. It is included in Appfuse if you want to see examples.

This is an example configuration that uses Spring to get the myService bean and exposes its getEmployeesByPartialName method. You can also use DWR with Spring namespaces from Spring version 2


<dwr>
  <allow>
    <create creator="spring" javascript="MyService">
      <param name="class" value="com.acme.MyService" />
      <param name="beanName" value="myService" />
      <include method="getEmployeesByPartialName"/>
      <convert converter="bean" match="com.acme.Employee"/>
    </create>
  </allow>
</dwr>

Cool, isn’t it? now prepare to be scared. If you expose a method in your service through javascript users can do all kinds of nasty things. If the user needs to be logged in, not too bad, but still you will most likely need some security framework that can secure java objects and not just http request. Spring Security AKA Acegi can do that using the AOP MethodInvocation interceptor, you just need to configure what permissions needs each method.

A tricky part was integrating YUI with DWR, at least for me that haven’t done much javascript in my life. Here you can see how the html looks like for a employees dropdown that lists the ones that match what you type in the input box, querying the service for the values. The values received can be any object, not just strings, in populateArray you can see how the values to display and the ids are stored for later retrieval.

<input type="text" id="employeeList" />
<div id="employeeListAutocomplete" class="autocomplete"></div>
<script type="text/javascript">
     <!-- populate suggestions array -->  
     function populateArray(dataFromServer, dataFromBrowser){
      for (var i = 0; i < dataFromServer.length; i++) {
       <!-- each employee object has a firstName and lastName property -->
       dataFromBrowser.push([dataFromServer[i].firstName + ' ' + dataFromServer[i].lastName, dataFromServer[i].partyId]);
      }  
     }  
       
     <!-- call dwr remote method and returns suggestions --> 
     function getEmployees(sQuery){
      var aResults = [];
      var callbackProxy = function(results){
          populateArray(results, aResults); 
      }; 

      <!-- disable async req ! --> 
      var callMetaData = { callback:callbackProxy, async:false}; 
      <!-- Call remote method --> 
      MyService.getEmployeesByPartialName(sQuery, callMetaData); 

      return aResults; 
     }

    var managerAutoComp;

    YAHOO.example.ACJSFunction = new function(){
        <!-- Instantiate JS Function DataSource -->
        this.employeesDS = new YAHOO.widget.DS_JSFunction(getEmployees);
        this.employeesDS.maxCacheEntries = 50;
   
        <!-- Instantiate Employee AutoComplete -->
        this.employeeAutoComp = new YAHOO.widget.AutoComplete('employeeList','employeeListAutocomplete', this.employeesDS);
        this.employeeAutoComp.minQueryLength = 0;
        this.employeeAutoComp.maxResultsDisplayed = 50;
        this.employeeAutoComp.prehighlightClassName = "yui-ac-prehighlight";
        this.employeeAutoComp.useShadow = true;

        <!-- autocomplete on employee field focus without typing anything -->
        this.employeeAutoComp.textboxFocusEvent.subscribe(function(){
            var sInputValue = YAHOO.util.Dom.get('employeeList').value;
            if(sInputValue.length === 0) {
                var oSelf = this;
                setTimeout(function(){oSelf.sendQuery("");},0);
            }
        });

        <!-- handler for employee selections -->
        this.employeeAutoComp.itemSelectEvent.subscribe(function(sType, aArgs){
            var aData = aArgs[2]; <!-- array of the data for the item as returned by the DataSource [value,id] -->
            var selectedId = aData[1];
            alert('you have selected id: ' + selectedId);
        });

        <!-- Preload content in the container
        this.employeeAutoComp.sendQuery("");
        -->
    };
</script> 

Happy AJAX coding!

Update: fixed the code listing, I hate Roller!

Travel: Liechtenstein, Zurich, Manila

Some pictures from my trips to Liechtenstein, Switzerland and Manila.

Vaduz, Liechtenstein

Vaduz, Liechtenstein

Zurich

Zurich

Zurich Panorama at night

Manila, from the Ortigas business district looking to Makati

Ortigas, Manila Panorama

Manila Sunset

Manila Sunset

Manila Sunset

Maven at EclipseCON

I’ll be next March 17th-20th at EclipseCON in Santa Clara, California, giving two talks. if you are going to be attending and you want some specific topic to be covered please leave a comment and I’ll try to make your time worthwhile.

Q4E, Maven integration for Eclipse short talk

"Q for Eclipse" (Q4E) is a new Open Source project that integrates
Apache Maven and the Eclipse IDE for faster, more agile, and more
productive development.
The plugin allows you to run Maven from the IDE, import existing Maven
projects without intermediate steps, create new projects using Maven
archetypes, synchronize dependency management, search artifact
repositories for dependencies that are automatically downloaded, view a
graph of dependencies and more!
If you are a Maven and Eclipse user join us to discover how to take
advantage of all these features, as well as how they can help you to
improve your development process. 

Maven, Eclipse and OSGi working together tutorial

With the growing popularity of Apache Maven, Eclipse, and OSGi, the
most frequently-asked questions are: "Can they work together?" and, "Do
they fight for the same space?"
This tutorial will cover the strengths and weaknesses of each, explains
where they overlap, and how they complement each other so you can get
maximum productivity. It pays special attention to the build process,
dependency management, collaboration, repository management, and
available tools, as well as the future direction of the technologies.
The solutions proposed will be based on the work done in the Apache
Maven and Apache Felix projects, along with several Eclipse Foundation
projects like Eclipse PDE
and Eclipse Buckminster.

Q for Eclipse 0.4.0 released

A new release of Q4E, the Eclipse plugin for Maven, is out. I’m going to quote Abel announcement, only adding something that he forgot, the new 0.5.0 release we are working on has initial support for importing parent projects (pom projects).

After some delay (you can blame it on Christmas� we committers need to have some fun far away from the computer), there is a new version of q4e waiting for you.

This version is 0.4.0 and has some interesting new features. Probably the best one is that it is much faster.

On the fancier side of things, the dependency viewer has been cleaned a bit and now more cleanly draws the dependencies. Judge for yourself:

q4e dependency viewer

For 0.5.0, we have a new contributor, Jake Pezaro who is working on integrating his dependency analysis tool into q4e.

Also, we are introducing a new and noteworthy page for q4e, and you can follow the current status from the wiki (what�s pending, what�s done and previous releases� changelog). You can use the list of pending tasks to take a look at what we�re trying to get into 0.5.0� but also to help us! We always welcome helping hands (remember that you can look for easy tasks to get started).

If you like living on the edge, the development update site already has a preview of the upcoming 0.5.0 version. Come and try it!

Exist Global Acquires DevZuz

It’s finally public, Exist Global has acquired DevZuz. Exist is based in the Philippines, and we are very familiar with the great people there, as we have been using their services for the last years.

I’m proud to join Exist in a role that will allow me to get involved in new projects and technologies, helping Exist leverage open source, but still continuing forward with Q4E and involved in the Apache and Eclipse Foundations. No, I’m not moving to Philippines ( yet 😉 ) although I’ll probably spend there even more time.

Read the news at Reuters.

No, I’m not dead, I’m back in Coruña

No, I’m not dead, I’ve been traveling for the last weeks, three continents and five countries, now relaxing home in Coruña for Christmas, and trying to catch up with email, sorry if I didn’t answer yours, but it’s taking me a while (or maybe it went to the trash when I deleted the thousands of emails from different mailing lists and social networking sites).

But I have to answer some posts I’ve read in other blogs, post some pictures, and talk about many changes that happened lately. More to come soon.

Oh, and don’t trust Spanish news today, it’s Dia de los Inocentes (equivalent to April Fool’s Day). Yes we do it December 28th, with Latin America and the Philippines, and it’s the right day to do it! 😉

Eclipse jars now in Maven repository

After some time trying to figure out what the best conversion from Eclipse plugins / OSGi bundles naming conventions to Maven naming I had finally put many Eclipse plugins in the central Maven repository (see only the Eclipse plugins that got copied in this batch). It’s sometimes a bit tricky, but the main goal was a bidirectional automated translation from Bundle-SymbolicName and Bundle-Version to groupId, artifactId and version in Maven.

Basically you take the BundleId and use the dots to split it. The last section is the artifactId, the rest is the groupId. For the versions they are pretty much the same, only changing dashes and underscores. There’s a maven-osgi library very light that you can use to do these conversions, used by the Maven Eclipse and Felix bundle plugins.

This improves the support for building Eclipse plugins from Maven, although you can do some things already, or using Eclipse libraries from Maven projects. We’ll see more activity in these two fields soon.

Some people complained that you get weird jar names like net-1.0.0-I20070531.jar. Something I’d like to point out is that the repository is just an interface, the way artifacts are stored internally shouldn’t matter to the clients (Maven, Ivy,…). Plugins that generate a flat directory with jars (like assembly, war,…) should take care of renaming the jars to groupId.artifactId, to avoid clashes in the namespace, and so you get a meaningful name out of a hierarchical directory structure.

Travel: Austrian Tirol

From Fussen (the town where Neuschwanstein castle is) I crossed the border to Austria to drive through the Tirol, and back to Germany to the town of Garmisch. It’s a nice drive through the alps, and the highlight is the Zugspitze, the highest mountain in Germany. The border between Germany and Austria goes throught the mountain and there used to be a border checkpoint at the summit. On the road you can see the usual speed limit sign as in any other European country, although in Germany there’s a difference, the limit in the motorway (freeway, highway,…) is suggested instead of mandatory.

In the Austrian side there’s a golf course at the botton that provides amazing views of the mountain.

Germany generic speed limit sign at the border

Germany generic speed limit sign at the border

Austrian alps

Austrian alps

Zugspitze

Zugspitze

Zugspitze Panorama

Zugspitze Panorama

Zugspitze Panorama from golf course

Zugspitze Panorama from golf course

Travel: Schloss Neuschwanstein and Hohenschwangau

Schloss Neuschwanstein (literally New Swan Stone Castle) and Schloss Hohenschwangau (Castle of the High Swan County) are both located near the town of F�ssen, in Bavaria, Germany.

Neuschwanstein is the most photographied building in Germany, and was the inspiration for Disney’s Sleeping Beauty castle in Disneyland. It was built by by Ludwig II of Bavaria who commissioned the design to a theatrical set designer, instead of an architect. The interior of the castle was never finished as in 1886
the King was declared insane
and arrested, found drowned some days later.

The close by Marienbr�cke (Mary’s Bridge) over a waterfall provides an amazing view of the castle.

Hohenschwangau was Ludwig II of Bavaria residence, built by his father, King Maximilian II of Bavaria. Ludwig used the castle while it’s own Neuschwanstein was not finished.

Neuchswanstein castle

Neuchswanstein castle

Neuchswanstein castle mountains

Neuchswanstein castle mountains

Neuchswanstein castle Panorama

Neuchswanstein castle Panorama from Marienbr�cke

Neuchswanstein castle and Marienbrucke Panorama

Neuchswanstein castle and Marienbrucke Panorama

Neuchswanstein castle, Marienbrucke

Neuchswanstein castle, Marienbrucke

Neuchswanstein castle, Marienbrucke Panorama

Neuchswanstein castle, Marienbrucke Panorama

Neuchswanstein castle, Marienbrucke Panorama

Neuchswanstein castle, Marienbrucke Panorama

Neuchswanstein castle mountains

Neuchswanstein castle mountains

Neuchswanstein castle mountains

Neuchswanstein castle mountains

Heidelberg castle from Neuschwanstein castle

Heidelberg castle from Neuschwanstein castle

Heidelberg castle lake Panorama

Heidelberg castle lake Panorama