Eclipse or SUNrise...

Eclipse or SUNrise...
...JAVA for sure

Tuesday, October 21, 2008

DB2, SQL and Timestamp

I found it quite difficult to figure out how to write a select in DB2, which would contain a proper time-condition. I wanted to query for some data, inserted couple of days ago. Google showed me many Internet forums, on which people complained that they had problems with to_date() function.

Well, the to_date() function in DB2 is generally used for formating the output of the select statements. For the condition you should use TIMESTAMP() or DATE() functions, for example:

SELECT something FROM table WHERE INPUT_DATE >= TIMESTAMP('2008-10-14 18:03:00.0') AND INPUT_DATE <= TIMESTAMP('2008-10-21 18:03:14.0')

Wednesday, October 8, 2008

Jazz and Rational Team Concert

Me at the conference
On 7 november 2008 in Warsaw, there was an inspiring conference about new technology upcoming from Rational (currently IBM). It's called the Jazz and it's a complete platform for new Rational product portfolio. You probably know RequisitePro, ClearCase, ClearQuest or FunctionalTester software from Rational. These tools were developed for long years. Yes, they have its downsides but they offer great functionality as well. I guess that it would be very hard to tell how much good software came out thanks to them. The conference made me to ponder little bit about todays software developement tools.

Since IBM bought Rational, it aimed to unify all the Rational functionality, which were provided by couple of separate and very different software products. Because IBM is one of the biggest donators of the Eclipse platform, it wanted to use it as the new cornerstone of its products. They have to be functional, very high quality and up to date (which not always was meet by Rational itself). Eclipse enabled IBM to do so.

So then, is all that Jazz-buzz only the well known Eclipse? Well, not quite. Its more like a philosophy. The Eclipse is only a technical capability to let people do their work as good as posible. In theory a good team, which works under an IT project should work like a clock. All the people should know their roles in the project and they should focus on their specialites - just like a good music band (jazz band to be precise). Creating beautiful music is very difficult, but when we have good musicans and proper instruments, thay can create amazing things.

In IT project we don't play music but we also need specialists and proper tools. Jezz is the tool, which simplify comunication between each of the roles. It standarize the protocole, with which team members comunicate with each other in order to produce the end product. Thats why Jazz is so connected with the RTC, the Team Concert product. This software has everything you need to help you create, track the progress or the right way of your project developement (including source control, reports, statistics, etc.).

We are the R-HEROES!!!You probably think that it is just a marketing crap. Well, not quite. I really am working with RTC for a while. First, I didn't like the idea to learn another project-tracking tool, but soon I realise that someone who designed it, knew what he is doing. RTC is an effort to implement an open source way of work. IBM liked the way Eclipse is beeing developed and it tried to formalize it inside the RTC product. What is the best - it is not the end of connections between RTC and open-source. IBM gives a free of charge, express version of RTC with almost all the features, but limits number of users. What is more important it is not only for Java technology projects. By 2009 there will be an RTC version for .NET developers as well (connector in the latest Visual Studio is actualy ready already).

Another great thing about RTC is that, IBM doesn't enforce you to leave all the legacy versions of Rational software that were used in your projects behind. RTC will have special conectors to integrate those products with it. In future, they all will be fully integrated (rewriten on new platform). The whole line of the Rational version 7 software will stand to be a full end to end solution to create software.

From this point, I thing that finally, after decades of history of creating software, someone made an attempt to make the software developement an official process based on this Jazz-tool-concept. Just like Ford created first line of car production, IBM probably tries to formalize the way to do software and make developement easer, eficient and repetitious.

Well, we will see about it. I am very excited because of Jazz. I'll write further immpresions of using RTC and other, next generation Rational jazz-products.

The real JAZZ!

Monday, September 1, 2008

Nike+ The Human Race 10K Warsaw

Yesterday, 31 september 2008 I had a chance to take part in the Nike+ The Human Race 10k in Warsaw. Yes, it's not connected with IT in any way (ok, I noticed that JEE applications served the Nike web pages and forms backend with the Flash as the frontend) but I was so positively amazed that I have to share it. The event was professionally staged, the people ware fantastic and the atmosphere was magicall. I'm proud that I could be a part of the global run and its creditable aim.

Thanks Nike and thank YOU! See you next year!

My Number: 0062222
My Time : 58' 47"

Tuesday, August 26, 2008

Exception Handlers in Struts

Although Struts version 1.x.x is 8 years old, it still is a solid ground for web applications. One of the key features of the version 1 of Struts is the ExceptionHandler capabilities. This functionality allows developers to trace exceptions produced in the web tier. It is very important because errors in jsp pages or servlets are hard to pinpoint. The ExceptionHandler is a simple servlet, just like another action classes - it is a perfect place to log error information which will be in many situations invaluable.

To use it we have to do only 2 things, first we should make our own ExceptionHandler class. Here is an example code:

public class MyOwnExceptionHandler extends
org.apache.struts.action.ExceptionHandler {

public ActionForward execute(Exception ex, ExceptionConfig ae,
ActionMapping mapping, ActionForm formInstance,
HttpServletRequest request, HttpServletResponse response)
throws ServletException {

System.err.println("==> MyOwnExceptionHandler\nexception: " + ex.toString()
+ " \nmapping: " + mapping.toString());

// TODO here log the info

ActionForward forward = super.execute(ex, ae, mapping, formInstance,
request, response);

return (forward);

Than edit the struts-config.xml and in <global-exceptions> tag paste these lines:

<exception handler="pl.sample.hellostruts.handlers.MyOwnExceptionHandler"
key="global.error.message" path="/exceptionPage.jsp" scope="request"

handler properies shows struts the exception handler class, path is the default page where the user will be directed after the fault (we can direct him dinamically in the MyOwnExceptionHandler class as well). The type defines a kind of exception on which the handler class will be initialized - in this example the MyOwnExceptionHandler will run when a java.lang.Exception will accur and which will not be catched in the code.

Tuesday, March 11, 2008

STRUTS and checkbox subimttion problem

There is a common problem with checkboxes and the STRUTS library - when unchecked in the form, their values are not populated properlly in the ActionForms (mostly booleans). There is couple of resolutions to this problem, but the best one in my opinion is to add aditional HTML input tag just after the checkbox tag:
<html:checkbox property="option" value="true" />
<input type="hidden" name="option" value="false">

How does it work? Well, the value of the hidden field as you know is always submited - so in the GET header it is visible as

but when we check the checkbox (on) its value is submited as well, so our header goes like this:

As you can see the option parameter is now duplicated in the header, but the header parser is reading only the first occurance of the parameter so our ActionForm is populated with the TRUE value.
Using this solutions is safe. All browsers shouldn't have any problems with it. It also doesn't depends on logic layer inside i.e. Action Classes witch makes the UI part of the application more transparent and transitable.