Monday, March 08, 2010

Creating Mylyn Connector Plugin - part 1


Quite recently I struggled with my company's internal bug tracker, especially lack of Mylyn integration in Eclipse. The easiest way to make it work was just to develop it :) I started with Mylyn/Integrator Reference but as usual Eclipse documentation sucks (I used to develop a lot of SWT/JFace applications and the best documentation I found was outside of Eclipse). It's too short, too shallow and most of all written by/to people who knows Mylyn APIs and architecture quite well. As far as I understand someone who wants just to integrate Mylyn with some bug tracker doesn't have to have this kind of knowledge, but I also understand that Mylyn guys don't really have time for stuff like this.

Anyway, I also found very short tutorial (http://jvliet.blogspot.com/2007/02/creating-mylar-connector-plugin-for.html) explaining in a bit more details how to create Eclipse PDT project etc. But this tutorial doesn't explain all the tiny details that made me spend many hours wondering HTF it should all work together.

In this short series of posts I'll try to give you much simpler tutorial (for morons like me) how to start new Mylyn Connector Plugin even if you're new to Eclipse Plug-in Development. I'll save your time!

OK - let's start. First video shows how to checkout Eclipse Mylyn and Trac packages (only packages required for connector development reference). In all tutorials authors say that you should take Trac Connector as example but they never point to concrete CVS repository and CVSROOT directory. I do:



Second video shows how to create new Mylyn connector project and make it visible in the new Mylyn Connection wizard (I took icons from Trac for simplicity - you can/should use your own). All steps in this tutorial are MANDATORY - if you miss something I'm 99.9% sure it will not work:



Enjoy and stay tuned for more videos in the upcoming weeks...

PS. I used Eclipse 3.5 (Galileo):

Wednesday, February 03, 2010

JavaOne is dead?


I was just looking for the information regarding JavaOne 2010 and found some worrisome blog posts:

Was JavaOne 2009 the last?
JavaOne 2010?
JavaONE 2010? Seems Like It Will Take Place

According to the Moscone Center website JavaOne 2010 is already scheduled between 22nd - 25th of June 2010.

I hope to go there this year! Keep your fingers crossed for my dept's budget :)

Tuesday, February 02, 2010

Memory Leak Protection in Tomcat 7 - fwd


Picture (c) DZone
I'm just forwarding you to a good article on memory leaks protection implementation in the upcoming Apache Tomcat 7.

This article is a in a form of short (but quite comprehensive) interview with:

Mark Thomas, a Senior Software Engineer with SpringSource and committer for Apache Tomcat

Mark points directly to SVN repository where you can actually see how the mechanism he's describing works under the hood.

Mark also mentions about other new features that will be available in new Tomcat 7 (which should be released in alpha in Feb 2010).

Monday, February 01, 2010

How to ensure your IE toolbar buttons are always visible?


Some time ago I encountered a wall while developing add-on for Internet Explorer. I wanted my add-on's button to be always visible after installation process, similarly to delicious stuff.

Problem seems to be quite simple - just check Browser Helper Object's (BHO) options and set some flag (aside of this subject I will tell you that developing pure BHO is a nightmare). In fact there is no such option. Internet Explorer seemed not extensible to this extent. Also finding something in the Internet appeared to be impossible. What the hell? Delicious guys made it!

After quite long searching I was very close to give up and resign from this "feature". But my sixth sense (yes, you should use it a lot while working with Microsoft) was telling me - "check the registry". So I did, and it was a bull's eye shot.

The thing you have to do is to increase the width of Tool Band Width of Internet Explorer (my NSIS script contains this):
WriteRegDWORD HKCU "Software\Microsoft\Internet Explorer\CommandBar" "ToolBandWidth" 800
It's very very primitive but it's the only solution I found to work. You just have to provide the desired width in pixels (decimal value) you'd like IE toolbar to be. Don't worry - you can put there even a value of 3000 - IE is smart enough not to extend the toolbar more than needed i.e. if you put a value of 1000 and your buttons need only 500 pixels IE will automatically adjust toolbar width to 500px.

This solution works but has also a big disadvantage. As you can see I write information to the registry for HKCU (HKEY_CURRENT_USER), so if you are installing the add-on with user Administrator, only this user will have Tool Band enlarged. If you open IE with another user she will probably not see your add-on button(s) (applies to IE7 and IE8).

Until now I couldn't find a better way - did you?

Monday, January 18, 2010

Tomcat 6 Developer's Guide - book review


Picture (c) Packt Publishing
Few days ago I received brand new "Tomcat 6 Developer's Guide" book which I’ll try to review shortly here. The book is best described in few sentences by the author himself:
"While Tomcat is one of the most popular servlet containers, its inner workings still remain a mystery to many developers. If you only have a superficial familiarity of how this container actually functions, much of its power remains untapped and underutilized. [...]"

Before I start let me just mention that I’m experienced Java and Java EE developer and have worked with Tomcat server (with breaks) since version 4.x (year 2003). This means that I know how to develop, deploy, monitor and tune web applications in this web server. I also worked a little bit with Tomcat internals like custom class loaders. Despite that, this book gave me even more information and knowledge. With this book I was able not only to understand how Tomcat works internally but also where and how I could improve it or basically modify internal components for my needs.

Let’s start the review here - first of all I’d like to say that the author Damodar Chetty meets his goals in this book. He states in the preface that this book is not for web developers who want to learn how to write Java Servlet / JSP applications and how to deploy them in Tomcat container. I totally agree with the author – this book will not teach you that. This book is for people who want to know how Tomcat works internally in order to tune it or modify it for specific needs.

The author promises to go deep inside Tomcat’s architecture and implementation in order to better understand what’s under the hood, how it works and how you can improve or monitor it. I can assure you that this goal is met. This book describes in detail also other aspects of Java EE environment that are not directly connected to the Tomcat container but on which its implementation is based.

In this book Damodar Chetty firstly describes Tomcat’s high-level architecture and then breaks them down up to basic Java classes. This way he makes the whole complex architecture easy to understand. The author describes all Tomcat’s components one by one which is reflected in the Table of Contents. I think the author’s intention here was to make the reader read the book from cover to cover. I think so, because if you just want to learn about one particular component it will be a bit difficult to understand all the references to the previous sections. In my opinion this book should be read entirely to make every aspect clear, otherwise you will need to go back in the book and search for previously explained subjects, which is not easy.
This book is definitely component-oriented rather than how-to- or problem-oriented, so if you have a concrete problem or question regarding Tomcat you may have problems finding answer in this book.

All topics are difficult and in my opinion this book is for experienced Java and Java EE developers and administrators. In this field the book fully satisfied me. More so, many topics like "URLs and protocol handlers", "Java class loading" or "Implementing a custom class loader" may be very useful out of the scope of Tomcat server.

What I like in this book’s style is that all, even most complex subjects are explained in a clear way. Every complex component is broken down into pieces that are more easy to explain and understand. This book is also very concise in the source code examples. This makes it more time-consuming to read but on the other hand it forces the reader to understand the subject rather to copy-paste included source code. This aspect again makes this book accessible for experienced developers who know Java and Java EE environments pretty well and are able to start developing their own examples from the textual description.

This book does not promise to cover all the subjects around Tomcat but few of them are really missing in my opinion. Despite full description of how Tomcat is built and how it works I really miss chapters describing how to configure load-balancer for Tomcat or a cluster of Tomcat web servers. I know there are many books or Internet resources that cover these subjects but it would be just nice to have it here. I also realize that load-balancers and clustering components are not core Tomcat components and maybe this is the reason why they are not covered in this book.

To summarize, I think "Tomcat 6 Developer's Guide" book is a really good one and describes Tomcat web server in a pretty detailed fashion. Please note again that you will not learn from this book how to develop web applications using Java Servlet and JSP technologies. You will learn how to effectively use and also modify tomcat internals for you specific needs. You need to be experienced Java / Java EE developer to fully understand all the topics and successfully apply knowledge from this book. I would basically recommend you reading full description of this book available here before buying it.

Monday, December 21, 2009

Tomcat 6 Developer's Guide is here


Picture (c) Packt Publishing
Few days ago I was contacted by Amit Sharma (Marketing Research Executive at Packt Publishing) who asked me if I can review their new book Tomcat 6 Developer's Guide. It was published just few days ago and sound interesting, so I agreed.

I expect the book to be rather for advanced users who want to dig in into Tomcat's architecture and more tricky configurations (e.g. SSL and load balancing with Apache front-end, clustering, security realms for Single Sign-In like Kerberos or Windows NTLM).

My short review of the book will follow shortly (in mid Jan 2010). Stay tuned!

Wednesday, December 16, 2009

Spring 3.0 goes public


Here it is http://www.springsource.com/download

Spring 3.0 is here and I hope it will serve Java developers as good as the previous releases. Spring Framework used to be de facto Java EE standard and I believe it will remain so for the next couple of years:

For some very recent news, Spring 3.0 GA is compatible with Java EE 6 final in terms of runtime environments now (e.g. on GlassFish v3 as released last week) and supports JPA 2.0 final already (e.g. using EclipseLink 2.0). We also support the newly introduced @ManagedBean (JSR-250 v1.1) annotation for component scanning now, which nicely complements our @Inject (JSR-330) support for annotation-driven dependency injection.

More details in these posts:

Tuesday, September 29, 2009

Server timeout for maven release:perform or site:deploy


I just wanted to release a piece of software I'm working on when I encountered a wall. Big, high and not very talkative wall - read timeout. I thought maybe the configuration of the server (and Web DAV) I described in this post has changed? No way - everything is like it was. The only thing that has changed is Maven version from 2.0.9 to 2.2.1 (where you don't have to define DAV extension in the build part).

Fortunately I also had my old environment where it worked (I meanMmaven 2.0.9). I noticed that the full build takes over 2 minutes while on the new Maven I get the timeout after 1 minute and few seconds. This way I realized that maybe increasing the timeout value will help. IT DID!!!

So how to do this? It's simple - just add:
<servers>
  <server>
    <id>someId</id>
    <username>blahblah</username>
    <password>blahblah</password>
    <configuration>
      <timeout>120000</timeout> <!-- your timeout in milliseconds -->
    </configuration>
  </server>
  ...
in the MAVEN_HOME/conf/settings.xml file and restart your Maven task.

Enjoy!

Tuesday, September 22, 2009

My daily WTF



I was just slapped but web application: "Your password must be different from the 12 previous passwords".

Very "secure" (obscure) system forcing me to have my original password (of value "password") plus additional 12 passwords of values "password1", "password2", etc. On the other hand there is no other policy requiring me to have at least one digit or capital letter. The only one is that my new password has to be different than 12 that I had before.

WTF?

Sunday, September 20, 2009

Add-in Express™ - a great tool for tiny price


Picture (c) Add-in Express™
I recently had to develop Internet Explorer plugin that had had to be compatible with versions 6, 7 and 8 of this browser. I searched the net a bit and I found a lot of solutions to do this. The best (if not the only one) solution is to implement Browser Helper Object (BHO). The problem with doing it manually is that it was designed by Microsoft which means that even if implementing it is easy you have to store zillions of information in the Windows registry to make your application work. This, on the other hand, is not that easy as you have to know exactly what and where to store, how to generated COM classes' GUIDs, and if it's not enough this kind of work is not testable or debugable.

Of course, it's easy to find some ready solutions with demo how to register all objects, etc. Another problem with this is that all the documentation from MS or from opensource community is pretty old and irrelevant. For example some example plugins I found worked out-of-the-box, however I had some special needs that were not addressed and that I couldn't find any documentation for.

Let's try the other way
In the previous paragraphs I forgot to mention that the software I was up to develop had to be delivered in two days (I mean the demo showing that it's possible to develop such plugin at all). This way I didn't have time to dig into the COM docs and BHO registration options. I found Add-in Express™ plugins for Visual Studio. My obvious choice was Add-in Express™ 2009 for Internet Explorer® and Microsoft® .net (AE4IE).

Benefits
With this tool I achieved more in 5 minutes than with Microsoft and opensource documentation in two days. It's not an exaggeration if I say that every developer is able to create at least working skeleton of IE plugin in 15 minutes. AE4IE has excellent documentation and is extremely easy to use. ROI is obvious and very quick as this tool gives a great quality for the price it costs.

With AE4IE templates for Visual Studio you not only create plugins in 5 minutes. This tool also creates the whole project structure as well as the Setup project that enables your users installing the plugins in the user-friendly manner. And it takes only few clicks!!! I love it.

It saves a lot of time and hard work of digging into MS documentation or reading (and buying) books on BHO/COM subjects.

Another good point is that developers are given pure Microsoft API such as IWebBrowser2 - this way you gain full power over your plugin and don't have to worry about COM specification and Windows registry configuration.

What about the support
Add-in Express™ team replies and solves problems very quickly and professionally. There is a special forum where you can find answers for many real-life questions and find solutions to common problems.

Extremely useful thing is also having a technical blog of Add-in Express™ team where they present new features and explain how to solve advanced issues (e.g. with sharing data between COM objects).

Conclusions
I'm very happy with this tool and would recommend it to every small or big company that has to develop IE plugin. You will never do what they did for such a small amount of money. The whole purchasing procedure takes 5 minutes and after another 15 minutes you have your plugin ready. The only remaining thing to do is to implement the business logic. How cool is that?

DISCLAIMER: I have no business connections with Add-in Express™ company and my review is not a commercial break