Friday, October 23, 2009

Gantt project and Bugzilla "Integration"

I spend some of my time keeping whatever project management tool I happen to be using in sync with all the other project tools used throughout the development process. I have used MS-Project, Open Project, and Gantt Project (couple others in there as well but mostly these). With all of them I am stuck have to manually sync up Bugzilla and various excel spreadsheets and my project plan. This annoys me.

There are a number of integrated project management/bug tracking tools out there...but I like Bugzilla and people like their excel sheets for their own tracking, so why should any of this have to change? All these tools should work better together and not force you into their methodology of project planning, bug tracking, etc.

So today I happened to find an interesting work around to the whole problem. Gantt Project has a remarkably simple and elegant xml file format that is just asking to be monkeyed with. First thing I was able to get the excel tracking list for the next release into the proper xml format with assignments start times etc, now the really cool part...I wrote a quick groovy script (I am a little enamored of groovy at the moment) and was able to pull in bug status information, duration and find bugs that I had missed and update my Gantt project. Every morning I can pull down the status information and update my project plan in seconds and not have to worry about missing anything that was entered in Bugzilla which didn't make the plan. I now get a synced project plan with updated bugzilla status info every morning. I am sure I will find more things to tinker with too!

I still have to put up with the issues of Gantt Project (it's not a bad little tool, but it is lacking a find command and is pretty simple in its feature set). None the less I am much less annoyed now.

Saturday, September 12, 2009

Sending email using groovy

My first groovy task was to write a simple test harness that would send an email. This was not the easiest thing in the world I have to say. I guess the groovy folks didn't add anything to groovy to make sending email easier than it is in straight java. There is a grail mail plugin that looks good, but I didn't want to add the dependency just to send an email and wasn't sure it would work just with groovy.

The first mistake I made was to try and figure out how to create a "main" method. I spent about half an hour before figuring out I don't need one. I now make sure to chant "scripting language" three times before I do anything with groovy. This has helped a lot.

As an aside, this scripting language plus the seemless integration into java is a wonderful reason to use groovy for unit tests. Even if you don't buy into anything else about groovy it would be great for rapid creation of JUnit tests.

So here is my very first groovy script (I almost said app, "scripting language...scripting language"). I am sure I have done all kinds of things that are not quite right, but it sends me an email which for now is good enough. If for some reason you would like to use it feel free it is licensed under the MIT license. Just copy and paste it into a new file, make sure you have mail.jar (from java-mail) and activation.jar in your classpath and groovy it.


import javax.mail.internet.*;
import javax.mail.*
import javax.activation.*


message = "test groovy mail"
subject = "groovy sent this"
toAddress = "to@example.com"
fromAddress = "from@example.com"
host = "localhost"
port = "25"

Properties mprops = new Properties();
mprops.setProperty("mail.transport.protocol","smtp");
mprops.setProperty("mail.host",host);
mprops.setProperty("mail.smtp.port",port);

Session lSession = Session.getDefaultInstance(mprops,null);
MimeMessage msg = new MimeMessage(lSession);


//tokenize out the recipients in case they came in as a list
StringTokenizer tok = new StringTokenizer(toAddress,";");
ArrayList emailTos = new ArrayList();
while(tok.hasMoreElements()){
emailTos.add(new InternetAddress(tok.nextElement().toString()));
}
InternetAddress[] to = new InternetAddress[emailTos.size()];
to = (InternetAddress[]) emailTos.toArray(to);
msg.setRecipients(MimeMessage.RecipientType.TO,to);
InternetAddress fromAddr = new InternetAddress(fromAddress);
msg.setFrom(fromAddr);
msg.setFrom(new InternetAddress(fromAddress));
msg.setSubject(subject);
msg.setText(message)

Transport transporter = lSession.getTransport("smtp");
transporter.connect();
transporter.send(msg);

Friday, September 4, 2009

Grails

There was an interesting article (I think on slashdot but couldn't find it) the other day about a statistical analysis of forum questions regarding .NET, EJB, Grails and Ruby on Rails. It basically said that the number of questions on .NET and EJB was higher on the weekdays; Grails and Ruby on Rails questions went up on the weekends. This leads the author to the conclusion that programmers, in general, feel that .NET and EJB are not as fun as Ruby on Rails and Grails.

After reading the above article and writing what felt like my 18th abstraction class in AppFuse to allow me to change from Hibernate if I ever wanted to, which allows me to change my database if I ever want to I decided to try Grails. The very first thing a newcomer like myself finds is a paradigm I was not really familiar with: "coding by convention". What this really means is that all those naming conventions that are not important, except if you don't follow them you have such a mess of an app that no one could ever figure out how to make any changes, are used by Grails instead of XML configuration files. What this means concretely, taking struts as an example, you have an MyAppAction that has a MyAppForm and is reached from a URL http://localhost/myApp. To make that work you have an XML file, which has (wait for it) duplicate information. Grails takes the names and figures out much the same way a human programmer would that these are all related and doesn't need any XML to glue it all together. Why do programmers allow this struts example anyways? We hate this type of duplication, and yet there it is. I am not picking on struts either, I like struts, most frameworks are like this.

Another nifty part of Grails is some really cool database abstraction technology. The GORM persistence technology is really powerful. It actually reminds me of something called Relational Views that ATG had in their Dynamo product about 10 years ago, but taken to the next logical level. The GORM tutorial provides for a nice casual read that shows what it can do conceptually much better than I could.

The ability to auto-generate HTML for listing, and editing database entities is just great. If you are creating a simple CRUD application or a prototype you can be off and running extremely quickly. For example the reason for my app (the web portion anyways) was a simple web app that had a couple of database tables and required a user to log in. I carved out the web part into 2 different phases, phase 1 is a single table to be viewed and updated, basic authentication that would be kept in the database with a single user type. Phase 2 has some more associations where certain users can only see data that they are authorized for, and an admin module for the user. With Grails I built phase 1 in 4 hours...and I am sure someone more familiar with Grails could have done it in about a quarter of that time.

I was going to write about my experience with it, but there is not a lot to write about. Here are the 2 tutorials I used, they were great.
  • Official Quick Start
  • Logon Tutorial. There were a couple problems with this one if you go here and search for "Simple Login Tutorial" you will see the corrections. Still very simple to read and follow.
When I move on to phase 2 I hope to get into some more interesting bits of Grails and Groovy and post something here.

With all this said I don't have any real experience with how Groovy performs, or how maintainable Groovy would be with a group of people. I suspect a Groovy app would be fine in a production environment as it is using Spring and Hibernate after all is said and done. As for maintainability the framework itself enforces (or heavily encourages anyways) proper naming conventions which would be a big plus, but the use of groovy is not as well supported in most IDEs I think.

Saturday, August 1, 2009

Maven an opinion

The 5 minute tutorial for Maven is great and illustrates the ease of use for a simple project. If you are starting a new project you can have a build file up and running in minutes (really). The catch is that your directory structure needs to follow the Maven directory structure. With a non-trivia build routine the upgrade is going to be a multi-day effort (Google ant maven upgrade). I would need to get something tangible for this effort...which of course is the dependency management.

I can see the value of dependency management in an open source project, it fills the same need as yum, apt-get etc; where there are many more people compiling the project with many odd ball libraries lying around on these disparate systems. Having a very large project with multiple modules that must integrate together Maven would also be one solution. You could run your own repository that would then be shared among the projects. This central repository could then be managed and a general release could be made, QA'd and deployed independent of releases of the sub project. I really, however, don't see the value otherwise. External libraries should be documented with their versions and what they do. They should be placed under version control with the rest of the source code. This is really not hard to do for anything but the largest of projects. Having libraries change around without a careful understanding of what has changed would not satisfy most QA departments that I have ever worked with, and the external reliance on the maven repositories is not the same as putting them under version control.

My conclusion is that I would look at Maven for a new project because of it's easy of use to get up and going, potential other benefits that I have not yet seen, and lack of downside given it can make ant calls, but would not recommend moving to it from Ant due to the effort of upgrade.

Friday, July 10, 2009

Selenium and the missing IDE

Finally figured out my Selenium IDE problem. I run an apple Macintosh (OSX), with Firefox. When starting up the Selenium IDE I got a very nice toolbar without anything underneath it, needless to say not very useful:

After trying the usual suspects, and even upgrading to Firefox 3.5 I was still no closer.
Today I found the answer quite by accident, it was the nice minimalistic theme I use little fox!
Reverting back to the default theme and viola all is working. I googled around a bit and it seems this is not a problem just with little fox. I will now get back to playing with what seems to be a very interesting open source tool; sadly without little fox.

Dojo DnD first impressions

I was pleased to have a dojo drag and drop sample up and running in just about an hour. There was a great tutorial at sitepen which helped me get up and running quickly. The whole package is simple, and starting with the dojo supplied example eliminated most of the messing around with the style sheets which is where it appears most of the heavy lifting is done. I wish I had time to explore this more...my next task is to see if I can get a drag and drop application setup with the ability to edit the members of the list.

Tuesday, June 30, 2009

VMWare evaluation

I have had some time to digest VMWare now. I think the moment that I knew that moving to VMWare was a good idea was when a developer told me they needed a machine to deploy their new server on. 30 minutes later I walked into their office with the host name and login credentials.

During my evaluation of this I was worried about the performance drains across the multiple servers on one ESX host (physical machine). I also thought that I could achieve much the same affect by sharing a single server and changing port numbers around. The port numbering would be error prone...I can just picture saying "remember http://server:123 and NOT http://server:1234". Additionally the different ports would be a problem with some load balancers that cannot switch up ports, only hosts. Patching, machine reboots, shared system libraries would also be harder when sharing the same server across disparate machines.

All of that aside (as they are all solvable problems) the isolation that VMWare provides is an essential feature. By this I mean a spike in one servers usage will not bring down all of the rest of the servers. The VM's are really different machines (until you pull the power cord out, then they are the same machine). This of course is known. It is what VMWare is really about, but somethings in life you just need to see to believe, otherwise it is simply magic.

The final kicker is that if a physical host goes down you can migrate the VM to another physical host. You have to have a SAN setup to do this and more than one physical host of course. When done properly can actually make you think differently. When a server is freed of it's physical ties all kinds of new possibilities arise.

I am curious to try the xen hypervisor open source project and build a VM environment for my development setup...but after printing the very very large manual it will have to wait for some time.

Sunday, June 21, 2009

First blog entry

I do not think that I have anything particularly interesting to say, however I think think that people interested in me for some other reason may find what I have to say at least enlightening.

Another reason for this is that the area that we fail at (or at least did until very recently) in modern society is writing. You go back in history and find a ton of people writing letters and journals (just watch any PBS special on the civil war to see what I mean). These regular folks give us an idea of what life was like back then. I think blogs may be what future people use to get a sense of what life was like back at the turn of the millennium.

More to come...