Posts in Category: Open Source

EclipseDay 2009 at the Googleplex

Last Thursday, August 27th, Google kindly hosted the second edition of the EclipseDay at the Googlepex. The event was a full day of technical sessions on Eclipse. Having been an Eclipse tools developer for the last 1-year, this event was an excellent opportunity to improve my Eclipse skills, network with other Eclipse developers and attend a series of excellent talks.

The agenda divided the sessions in two tracks and I selected the following sessions to attend:

  • Eclipse in the Enterprise: Lessons from Google, by Terry Parker and Robert Konigsberg from Google: the day started with this joint keynote session from Terry and Robert, where they described how Eclipse at Google evolved from the days when it was just used by a small group of developers and any integration with Google’s building system was done through external scripts and some manual hacks, to today’s enterprise deployment of a customized Eclipse environment with complete integration with the build system, in addition to usability/functionality enhancements to automate some developers’ tasks.
  • OSGi for Eclipse Developers, by Chris Aniszczyk from EclipseSource: I enjoyed all the sessions, but this was the best session of the day for me! After reading a few tutorials about OSGi and getting the feeling that I was missing something about it, Chris presentation finally nailed it for me! The fact that he started by explaining OSGi without mentioning Eclipse helped a lot, as previous tutorials I had read mixed both OSGi and Equinox and I ended up not understanding what was pure OSGi and what was Eclipse. The session covered several topics, as the OSGi services architecture, bundles, life cycle and even how you can run BUG modules on OSGi :-) Overall a great session, and it was good to talk to him later during the break and discuss OSGi a bit more.
  • Developing for Android with Eclipse, by Xavier Ducrohet from Google: Xavier is the lead for the Android SDK and in this session he covered several aspects of the SDK, from a quick start with the SDK to issues they have found while developing, it the most common used features and opened the curtain on some new features to come. Xavier also covered some of the issues/limitations with using the emulator instead of a real device.
  • Deploying Successful Enterprise Tools, by Joep Rottinghuis from eBay: based on his experience with leading an Eclipse tools team at eBay, Joep described the process of building, deploying and supporting tools in the enterprise level. The session was not specifically focused on Eclipse but nonetheless offered very valuable insights on the challenges one encounters when deploying tools in the enterprise, from early adoption to user feedback, maintenance, documentation and support, besides the effort necessary to come up with new and improved functionality.
  • Build and Provision: Two Sides of the Coin We Love to Hate, Ed Merks, EMF lead: after having read several chapters from EMF: Eclipse Modeling Framework (2nd Edition) just a few months ago, I really wanted to attend Ed’s talk. After all, I have been using a fairly decent dose of EMF lately and it is always great to hear the leaders in the technologies we use.  However, as the title suggests, the session was not about EMF but about the Eclipse’s build and provision system. Ed’s presentation focused on how the build is an essential tool to any project and, at the same time, not generally liked by most of the participants in the project, (especially) due to the constraints caused when the build breaks. Then he went on to explain the Eclipse build process, together with the efforts that have been done on automation and provisioning.

Overall, it was a great day! Although 3 sessions focused on build/provisioning/deployment, each one of them tackled different aspects of the process and contributed with valuable insights. Another thing I would like to note is the quality of the speakers and their sessions! No product or marketing pitch, just pure technical joy :-)

As of this writing, the slides are available online at http://wiki.eclipse.org/Eclipse_Day_At_Googleplex_2009#Presentation_Slides_.26_Videos

Thanks to the organizers for EclipseDay 2009, and hope to join you again in 2010!

Debugging Ant tasks in Eclipse

Today I came  an issue that required me to debug a custom Ant task that we have. While the Eclipse integrated debugger allows you to step through the targets and tasks in the build.xml file using the action Debug As -> Ant Script, it doesn’t actually let you step into the java class that implements the task. This is a major drawback, as most of the complexity (and issues :-)) tend to be in the task implementation code.

After searching around for a bit, I came across the Eclipse Remote Debugger debug configuration. This configuration allows you to remotely debug applications, by establishing a JDWP (Java Debug Wire Protocol, part of JPDA – Java Platform Debug Architecture) connection between the running application and the debugger. After learning about this, setting up the environment to debugg Ant tasks from within Eclipse was pretty straightforward.

The first step is to setup the Ant script launcher to run in debug mode and attach to the debug server. The following should be used as JRE arguments for the Ant configuration:

-Xdebug -agentlib:jdwp=transport=dt_socket,server=y,address=8000

You can setup your Ant configuration by going to Run -> External Tools -> External Tools Configurations and creating a new Ant Build configuration. Inser the location of the build file in the main tab and setup the arguments in the JRE tab:


After the Ant configuration is setup, we need to take care of the remote debugger configuration. Go to Run -> Debug Configurations… and create a new configuration for Remote Java Application. Make sure you set the same port number that you used in the Ant configuration, and you are good to go.

Now, place the breakpoints in your build.xml and java classes. In order to debug, you need to first launch the Ant script and then attach the debugger to it. Do right click in the build.xml file and select Debug As -> Ant Script. Then go to Run -> Debug Configurations… select the Remote Ant Debugger and click Debug. The debugger will now attach to the running proccess and let you step through both the xml file and the java classes:

Have fun!

Monitor calibration in Linux

If you are into photography, then you should already know that calibrating your monitor is something really important if you plan to print your pictures. I recently printed some photos and noticed that the printed colors were considerably different from the colors on my LCD. After comparing my monitor with a few others, it was obvious that mine, and some of the others too, were not color calibrated.

Monitors can be calibrated to display the “correct” colors by using a calibration device, complemented by the vendor software. I decided to buy the Spyder2Express since it had good reviews and a reasonable price. Unfortunately, there is no color calibration device that is supported on Linux by its vendor and I currently use Linux (openSuse) as my main operative system. I could use my work laptop running windows to calibrate the monitor, then export the color profile and import it in Linux. There is an article here on how to do it. With help from one of the comments in that article, I found about Argyll Color Management System. Argyll is a monitor calibration software package for Linux that supports most of the existing calibration devices. It uses the Windows binary software to create a Linux binary in order to be able to communicate with the device to run the calibration tests and create a color profile. It also provides an utility to apply the color profile to your monitor.

The steps to calibrate your monitor in Linux using Argyll are pretty simple. In my case, using the Syper2Express device, all I had to do was runt the following commands(as root, or give the user permission to communicate with the usb device):

$ cd Argyll_V1.0.3/
$ ./spyd2en -v /media/ColorVision/setup/setup.exe (creates binary file to communicate with device)
$ ./dispcal -v -y l -o MyMonitor (runs calibration tests and creates monitor color profile)
$  ./dispwin MyMonitor.icc (applies color profile to monitor)

The generated color profile can also be imported to your post processing software like GIMP in order to use the monitor color profile instead of using a more common profile like sRGB or Adobe RGB.

Batch update of EXIF info

exiftool is a very useful utility that allows you to query or edit EXIF information from pictures. Going through some of my pictures recently, I have found some sets of pictures with incorrect date in the EXIF info, be it a few hours off or even 1 year and a few days off. Fixing them one by one was not an option, so after a couple of searches on google I found exiftool. It is a command line utility that lets you edit EXIF information and you can do it in batches of files or folders, even using conditions to specify when a change must be applied.

For me, the need was only to change some photos info so that it shows the real time they were taken, three hours before the saved setting. The command was as simple as this:

exiftool -DateTimeOriginal-='0:0:0 3:0:0' -CreateDate-='0:0:0 3:0:0' myfolder/

The format for date changes is ‘YYY:MM:dd hh:mm:ss’.

Mylyn task manager

When I migrated my development environment to Eclipse 3.4 Ganymede, one of the things that caught my attention on Eclipse’s update website was a plugin called Mylyn. A visit to the website, a look over the webcast and it sounded something promising.

It definitely is! Mylyn is a task manager that changes your IDE context based on tasks. You create a task, add resources to its context and when you activate the task, it hides all the other (unneeded) resources from your views (project/package explorer, outlines, editors, etc…). It provides integration with several task repositories, like Bugzilla and Trac. Unfortunately, it doesn’t provide a connector to Clearcase, but I’m still able to use it in an automated way.

I find the tool really awesome when I do something basic like switching tasks: it just closes all the editor windows and projects in the explorer for the task I’m leaving and opens all the files I was working on for the task I’m switching to. This would take me several minutes to do by myself, so having a tool that does that in 1 second is pretty neat!

Here are some more things I like about Mylyn:

  • ability to customize CVS/SVN checkin comments based on templates. Most, if not all, of my commit comments are in the form of “Bug#xxxxx: 1 line description of the bug and fix”. With Mylyn, I can get the comment populated automatically with information from the associated task.
  • when I (re)activate a task, it positions the cursor in the file and method (if java file) I was working on.
  • I can use the URL feature to link to the Clearcase defect page for each one of my defects
  • dynamically adds resources as we follow method references
  • Mylyn filters unrelated content from all views, but I especially like the end result for the package explorer and outline view. When working with classes that have tens of methods, showing just a handful of them in the outline simplifies things a lot!

And the things I don’t like that much:

  • no connector to Rational ClearCase. I have to copy some notes and Defect info from Clearcase to my task manually.
  • the option to show filtered content only shows content at the same level. I would like to have a “show all” option for when I need to look for some resource.
  • It slows down the system a bit. Not too bad, but I do notice it when I have several eclipse instances running.

Overal, I think Mylyn is a great tool and very useful! Even more if you are working with Bugzilla/Trac projects.

If you want to give it a try, this is Mylyn’s homepage and this is a Mylyn tutorial.

 

Persisting XML with OpenJPA

I’ve been looking at JPA – Java Persistence Architecture and decided to play a bit with OpenJPA using DB2 as the back-end. My goal: to persist and query XML data in DB2, making use of DB2’s pureXML capabilities to query the XML data using SQL/XML‘s XMLQUERY() function.

However, while OpenJPA has an extensive documentation, the examples are not always complete and there isn’t a lot of information on the web regarding OpenJPA error determination and solving. So, here are some recommendations for some of the problems I have encountered. The class xml.Address is the one to be persisted as XML in the database using JPA and it is stored as the field shipAddress of the Order objects.

 [java] Exception in thread "main" <openjpa-1.0.0-r420667:568756 fatal user error>
org.apache.openjpa.persistence.ArgumentException:
Type "class xml.Address" does not have persistence metadata. 

Suggestion: Remove the reference to xml.Address from persistence.xml

[java] Exception in thread "main" <openjpa-1.0.0-r420667:568756 nonfatal user error>
org.apache.openjpa.persistence.InvalidStateException:
Encountered unmanaged object "xml.Address@9b2a51" in
persistent field "xml.Order.shipAddress" of managed object "xml.Order@12b3349"
during flush.  However, this field does not allow cascade persist. 
You cannot flush unmanaged objects.
  [java] FailedObject: xml.Address@9b2a51

Suggestion: Make sure you have no @Entity or @Embeddable annotations in xml.Address. The main annotation is @XmlRootElement.

 [java] Exception in thread "main" <openjpa-1.0.0-r420667:568756 fatal general error>
org.apache.openjpa.persistence.PersistenceException:
"xml" doesnt contain ObjectFactory.class or jaxb.index

Suggestion: add a file jaxb.index into your xml package containing all the classes to be persisted as XML: a file containing Address in our case.

Photoshop filters on GIMP

For the GIMP users that, like me, keep complaining that Photoshop has so much more filters to do some fancy effects, the agony is over :-)

I just found this today, but it dates back to 2004. There is a GIMP plugin that handles Photoshop plugins. It is called PSPI and it works like a charm on the filters I have tested so far.

Here are the instructions on how to get it working on Windows:

  1. download the binary package from here.
  2. copy the plugin file to “C:\Program Files\GIMP-2.0\lib\gimp\2.0\plug-ins”
  3. start GIMP
  4. click on Menu Xtns -> Photoshop Plug-in Settings
  5. add the folders where you have your photoshop plugins (.exe or .8bf files)
  6. restart GIMP
  7. all the compatible plugins in the folders you specified in step 5 will show up under the Filters menu (*)

This was a new for me, and I’m quite happy as there was a couple of photoshop filters that I like to play with sometimes (just for fun, but still).

(*) For some odd reason, all my plugins appear under the sub-menu “Flaming Pear”, the creators of the first photoshop plugin I loaded into GIMP.

DB2 on Rails update

I’m back to fiddling around with my Ruby on Rails experiments(1)(2). I was able to create a very useful 2-way mapping between Ruby objects and xml data stored in DB2 pureXML. Basically, trying to replicate some of ActiveRecord’s functionality but for XML data. I still find it odd, though, that both ROXML and xml-mapping haven’t had much activity as of late. I’m wondering if there is any new OXM library around that I don’t know of.

Also on the same topic:

  • the main DB2 on Rails website is up and running again, with a revamped design and now using wordpress instead of typo.
  • a new version of the ibm_db driver was also released, containing several bugfixes. Update it through gems (gem update ibm_db) or from here: http://rubyforge.org/projects/rubyibm/ 

DB2 Student Ambassador

After reading Alcides Fonseca’s post regarding is opportunity to become an MSP and asking whether other companies have similar programs, I would like to introduce two programs related with DB2 that are targeted for university students: DB2 On Campus and DB2 Student Ambassador.

DB2 on Campus: The DB2 on Campus Program is a project designed to promote the use of DB2 in universities. The logistics and delivery of the program is performed between the DB2 Express-C team, and the local IBM Academic Initiative representative. The program consists of the following items and activities:

  1. A speech titled “The role of DB2 Express-C in the Information on Demand World”. This speech explains DB2 9 technology, with an emphasis on pureXML™, and encourages students to use DB2 Express-C, create university DB2 user groups, participate in the DB2 forums, and write documents about DB2. All of these activities can help them to advance their future careers.
  2. Introductory DB2 courses to obtain DBA and developer skills.
  3. Free DB2 books donated to the university library
  4. Free DB2 certification exams offered to the students

I will be at University of Minho on September 19th doing the speech for the DB2 on Campus program. There was not enough time to prepare the full-day event, but if you or someone at your university is interested in having this full-day event happening at your university, please feel free to email me and I’ll put you in contact with the program’s manager in order to schedule the event (my email is vrodrig at us.ibm.com).

There is a DB2 On Campus Facebook group. Follow these instructions to join. 

Subscribe to the DB2 Express-C blog to keep updated on news regarding this free to develop, deploy and distribute database(1). 

DB2 Student Ambassador: This is a program for individual students that want to promote the use of DB2 at their education institutions. Though the program is voluntary, it gives students a chance to learn more about DB2, develop presentation skills and marketing skills. All of these skills will be valuable in their careers. At the end of the program, the student will receive a letter of recommendation from IBM including all the details of the activities performed. The more activities performed, the better the letter of recommendation! We hope this will help the student get a job more easily in the future.

I consider this to be an excellent opportunity to get involved and interact with developers from a huge project like DB2, distributed across Toronto and Silicon Valley laboratories.

More information  about this program can be found here: http://www-306.ibm.com/software/data/db2/express/students_programs.html#ambassador

 

Although I’m only familiar with the DB2 programs, for the ones interested, there is also an IBM Academic Initiative program, focused on Open Standars, Open Source and IBM resources for the academic world.

The opportunities are out there, so just grab the one you like and boost your career :-)

(1) Yes, it is the fully loaded version available for free, with one limitation: it can only use up to 4GB of RAM :-) 

 

XML Mapping in Ruby

Dear lazy web…

I’ve been playing with Ruby and XML lately, and one of the key features I need to use is XML mapping from XML to Ruby objects and vice versa. However, both ROXML and XML::Mapping do not seem to be very active at the moment. Both forums contain un-replied questions  several months old, and I can’t find any examples that are not a couple of years old.

Is there any XML Mapping library for Ruby that is currently active(*)? XML::Mapping was serving me good enough, until the moment that I needed some of the documented features and found that they are not supported in the current release :-(

 (*) by active I don’t mean it needs to be in exclusively in code development, but at least with some recent activity in forums, documentation, examples, etc..