Tuesday, August 31, 2010

Oracle JDBC Logging

During a database upgrade (oracle 10g to 11g) I had to debug a series of JDBC calls. I suspected a performance bottleneck in a database query and decided to look for the offending SQL statement.  This is when I started to find how much information there is about JDBC logging. Most places I researched pointed me to p6spy, a nice tool which according to the documentation "intercepts and optionally modifies database statements". This was helpful to determine that the bottleneck was not a SQL statement from our application, but instead a library (open source) which needed metadata information.

Monday, July 19, 2010

Useful Closures use-cases in Flex

As flex is based on Actionscripts 3, it is possible to leverage some of the features of an ECMA-based language not readily available in strongly-typed languages.  Most Java developers will probably ignore the ability to use powerful features such as closures when the use-case simply makes sense. Consider the following:

Tuesday, June 8, 2010

Localizing Flex Applications

In my attempt to localize my flex application, it quickly became evident how simple it is to do basic localization in flex. As soon as I tried to implement more complex features, I realized how complicated it can become (e.g. add special characters, support multiple locales, flex builder problems, etc). In the interest of sharing the wealth, I'll describe the steps I took, so I don't have to keep on repeating some of these in future development efforts. These steps are:

Monday, May 17, 2010

My thoughts on RabbitMQ

It is no mystery that I have been following the Spring Portfolio for sometime now.  As I continue to observe the business decisions they are making, its exciting to see how SpringSource is positioning itself to be a powerful player in the Enterprise Development arena.  Some months ago, SpringSource announced their acquisition of RabbitMQ and I thought I should get familiar with their choice for messaging solution.

Wednesday, April 28, 2010

My Git Configuration

I have configured Git locally in many places now and I thought of placing a copy of my personal choice (my .gitconfig file).  Perhaps this will help me setup my personal environment everywhere I'm using it. I should put this on github at some point. A few things to notice:
  1. I prefer p4merge for merge tool. It's simply awesome, worth to try if you haven't yet.
  2. Vim as my editor. Yes, I don't use emacs.
  3. Yes, I code on a Mac!
My .gitconfig as follows:

Spring Roo: Persistence Setup

I've found Spring Roo to be a great way to learn how to setup configuration properly.  As I continue to spend time in configuring my home project, I continue to be amazed at the powerful features that Roo brings to the table. I had written a small application for tracking family chores. I spent about 25 minutes drawing the entities in a napkin, then spent 10 minutes writing a Roo script (file with extension "roo"). Then, I opened a Roo shell and run "script myscript.roo". This created my project, including all the scaffolding for my entities.  I had my project running in minutes. After a while, I detected a problem with my entities relationship and wanted to see the persisted data. Of course, I had the the "IN MEMORY" choice, which brought all sort of problems when trying to see the data within.

Friday, April 2, 2010

Mavenizing a Flex Project with multiple artifacts

  I was asked to include a Flex project within the current build process in place (maven2 based). Now, I like maven for many reasons which I'm not going to explain in this entry, however I would like to say a bit about my experience with such a "mavenization" if you will. Most Flex projects I've been involved are developed either directly in Flex Builder (Fb3) and/or compile using an Ant task. Nothing wrong with this approach, however Maven encourages a convention that may not necessarily be embraced in a traditional Flex Application. I hope to explain what I mean by this in the next paragraphs.

Thursday, March 25, 2010

My Journey into using efflex

As I tried to introduce powerful animations to personal RIA project, I came across this project called Efflex. The demos showed a lot of potential. I was very impressed with some of the nice features to improve ViewStack selection (particularly the Flip3D and Cube3D demos). As my excitement drove me to use it, I found so many problems integrating to it, particularly with the following:
  1. There were no SWC files to use (the 2 provided never worked). 
  2. Building the source required FlexBuilder as well as to understand the project layout.
  3. Some of the code was not committed, hence the compilation failed in so many ways.
  4. There were dependencies that were not documented.
I took this as a personal challenge and I can happily report that I made it work. I'd like to describe what I had to do to make it happen in case others go through this problem (as I suspect it's the case based on some of the postings I read on the site).

Tuesday, March 23, 2010

Alternate Tooltip for <mx:List /> items

I spent sometime trying to understand ways to add tooltips for items within a <mx:List ..> component. As I naively used the dataTipFunction(), it was pretty evident (at least in my case) that I needed something whereby I can have more control, a more robust solution than the out-of-the-box solution. This is when I decided to use the itemRollOver and itemRollOut events and corresponding handlers.

Saturday, March 13, 2010

My Review on Spring-Roo

So I gave a presentation about Spring Roo recently. Hopefully this means I'll get a kangaroo.  I felt it went pretty well. I decided to share some of my remarks as I think I learned more by presenting than by trying it. As I can not put a presentation on my document (yet), I'll show the text of my slides and will explain some of the things I discussed while presenting.

Thursday, March 11, 2010

Lessons learned at 360Flex

It's time to reflect a bit about the latest 360Flex. This was a good time to learn about Hardware integration with the Flash Platform. Here we have integration with Arduino boards (via as3glue or merapi).  Also, I learned a bit about JComm as well as how these sensors can send Event objects whereby one can react and listen (think credit card readers, robots, etc). Nice possibilities that make so much sense for thick client applications using Adobe Air... Very exciting.

Wednesday, March 10, 2010

Monkey Patching in Flex

I recently attended 360Flex. It was an excellent conference. I thought I knew some Flex, but I was certainly not aware of how much others are doing with Flex, Actionscript and the Flash Platform in general. Very interesting concepts. One of the nice concepts I recently learned while at San Jose was "Monkey-Patching".  Fortunately, I had the chance to practice how to use it after the conference and learned so much about the internals of some Flex components.  Here is what I did.

Tuesday, February 16, 2010

Understading some of Roo's magic

  I must admit that I was among the many developers I know who are very skeptical about Aspect Oriented Programming (AOP).  I've written many aspects myself, some which I now define as "entry-level".  I had not seen a clear use-case for aspects other than the basic "auditing", "logging" or "security" use cases.  So, a few months ago I started to play with one of the latest tools from SpringSource, namely Spring-Roo. To my surprise, Roo was not only meeting my expectations, but also made me a believer on yet another good use case for AOP.  The use case of tooling support.  I'll try to explain some of the magic which Roo brings to software development using AspectJ.

Thursday, February 11, 2010

Removing Unused Workspaces from Eclipse

Workspaces in Eclipse is one of those features that are often unused or not used enough.  Personally, I find it extremely helpful to use them, particularly when working on different branches. There are times when you need/want to delete some of these workspaces from your workspace list. Here is how you can do this:

Saturday, January 30, 2010

Spring: @Autowired Constructors

Since the introduction of Spring 2.0, I have seen a trend where developers use the @Autowired annotation very often. I must admit, I like a combination of annotations with some XML declaration, however I'm still debating whether making a decision of using @Autowired scales well in the long run. I would like to show how this feature can seem unintuitive.  Furthermore, even tools like SpringSource Tool Suite can get confused at times.

Thursday, January 28, 2010

Spring 3.0 and <mvc:annotation-driven />

I have used Struts1 and Struts2 extensively for years.  With that background, I can appreciate some of the things that Spring-MVC brings to the table such as Dependency Injection, clean integration with Bean Validator (JSR-303), smooth Integration with different View Technologies, among others. Furthermore,  Spring-MVC has been making improvements through out each release that has made it a more robust framework, including the latest REST support. Like every framework, there is always a "gotcha" in a feature and such is the case for <mvc:annotation-driven />.

<mvc:annotation-driven /> is a nice feature, however depending on how you are used to organize your Spring-MVC files, it can prove to be confusing. I'll try to explain my findings as clear as I can.

Tuesday, January 26, 2010

XML Validation within Eclipse

  Working with XML can be a wonderful experience. Most people I know (in the industry) don't consider XSD/DTD validation a task that is challenging enough so as to spend time and/or effort to either learning it or writing to it. This feeling changes rapidly as tooling support (e.g. IDEs) produces hiccups when XML validation generates errors that can not be understood by the same engineering staff.  For example, have you ever had the infamous problem reported through Eclipse's console:

cvc-complex-type.2.4.c: The matching wildcard is strict, but no declaration can be found for element 'custom-filter'.


  By default Eclipse has XML validation on. This means that it will look for a DTD of XSD to validate your XML file. The message above indicates that there's an XML element named custom-filter that can not be resolved with any of the XSD that Eclipse is aware within it's catalog registry.

Monday, January 25, 2010

Dynamic Web Projects in Eclipse

As I fixed a maven war project to more effectively use the Web Tools Project (WTP), I realized I could share the configuration I used with the hope to help others get some light as needed.  I'll be assuming you are familiar with the .classpath file as well as the .project file (which Eclipse uses heavily) to setup the dynamic web project.  Furthermore, I'll assume you are familiar with the notion of a "nature" within the Eclipse environment.  Lastly, I would like to refer readers to the official Eclipse FAQ.  In particular, I would like to refer you to the section where the sharing of the .project and .classpath files in version control (e.g. subversion, git, etc) is considered a good practice. Note that these tips will also work with the Springsource Tool Suite (STS)

Wednesday, January 20, 2010

Developing on Windows and jps

  In the last few months, I have been forced to develop using a Windows environment. I must admit I miss most of my linux/unix command prompt usage, among which is the "jps" tool.  For those of you not familiar with it, jps is a "process status" tool and is part of the jdk.  According to the documentation, this is an unsupported tool and comes with no guarantee, however I've found it to be a simple tool that can come in handy in certain situations as the one I'm about to describe.

  During my initial maven build, the test phase was throwing exceptions due an incorrect configuration.  As I tried to delete the target directory, windows reported the folder was in use.  Cygwin's "ps" command didn't reveal much.  Window's "Task Manager" wasn't really saying much either.  This is where "jps" brought light.  Jps reported the SurefireBoot.jar still hanging in there (apparently due to some unrelease resource). Unfortunately, the problem became even more serious as the reported PID was not that simple to kill (using Cygwin's kill command).