Leap year issues in apache commons-net

I never encountered any real Y2K bugs in code I was involved in. Today, however, I ran into a nasty problem caused by date parsing in the apache commons-net library.

We have a project where files are being processed, xslt transformations are applied and so on. Some of these files have to be retrieved using FTP (I know…). We use the Apache commons-net 1.4.1 library for doing this.

Today, a number of files were not processed. I had to dive into the Apache code (Open Source is cool) to find the problem.

The method we are calling is this:

org.apache.commons.net.ftp.FTPClient.listFiles (String dir).

Following a long trail with engines and parsers, I discovered that the FTPFiles that are created get a Date that is obtained by parsing the date provided by the ftp server. The Unix ftp server returns the date in the format "MMM d HH:mm". No year info is supplied. This caused problems, of course, since Feb 29 is not a valid day in the default year 1970.

For those interested in the code: have a look at org.apache.commons.net.ftp.parser.FTPTimestampParserImpl.parseTimestamp(String s).

Fixing this is not too hard, but it is easier to manually change the date of the File back to Feb 28 23:59 Lachend

I feel like it's April fools' day. I am curious how many other people run into a similar leap year issue. 

Still using NetBeans

I started using NetBeans 6 more than 2 months ago, and I am still using it.

People knowing me are very surprised. I typically don't use an IDE for more than 1 week, and then I go back to vi. Let me be clear, I am still using vi for most of my programming. But there are some tasks that I now prefer to do using NetBeans.

 

What I prefer to do with vi:

  • making new classes
  • writing code against API's I know very well

What I prefer to do with NetBeans:

  • writing code against API's I don't know well

The NetBeans functionality I am probably most happy with, is the "navigate to source" and "find usages" option. When using external software, I often want to know what is really happening when I call a method. Browsing through the code using the above mentioned functionality is much easier than grepping files and inspecting them with vi.

One of the reasons I abandoned IDE's in the past so quickly is that I am working on different systems with different capabilities. At this moment, my laptop is not really powerful enough to run NetBeans 6. It would be a blocking issue for me if I couldn't work on my laptop, using the same code as when I would be using NetBeans.

With NetBeans, this is no problem. I am not losing any time with merging code. NetBeans is working on the same files, without creating dependencies. The nbproject directory is not added to the CVS, and my laptop doesn't know that I'm working on desktops using NetBeans and vi at the same moment.

I already upgraded to NetBeans 6.0.1. I am curious myself how long I will manage to use an IDE this time.

Online privacy

The value of the Internet is mainly influenced by what users implicitly orexplicitly contribute to it. When I buy something online, I always checkfor testimonials from other customers. Without a positive referral, I hardlybuy something. Now, a testimonial is clearly something the user is willingto contribute. The problem occurs when users’ data is being used without theuser knowing it. And I agree that more action might be required in this area.Still, it surprises me how many people assume that the Internet is an anonymousplayground. When I send an email to someone, I always take into account thatthe content of that mail may be public available one day. The SMTP protocolis so open, and there are too many circumstances behind my control, so I won’tbe surprised if my mail is read by the wrong recipient.Something else to remember: once you put something on the Internet, it won’tleave without a trace. Actually, it will probably never leave. I remembera story where a link was created to someones blog site. That person didn’twant her blog to be read by everybody, so she put a password on it.But then, checking the Internet Archive WayBack Machine showed the blog asit was right before the password protection was installed.Be careful 🙂

Heading for JavaFX

JavaFX was announced at the previous JavaOne conference in San Francisco, 2007. It was clear from the beginning that this is an important strategic technology for Sun. Although I am not really into scripting languages, there are some things about JavaFX that I really like. Probably the most important feature to me is that you can use the power of the Java platform from within the scripting language.

I have done some experiments with JavaFX occasionally over the last few months. Nothing in official projects, though. I had the impression that although JavaFX seems to be very important for Sun, it would still take at least months before it really gains momentum. That turned out to be a reasonable guess. 

Very soon, however, I will do something more productive with JavaFX. Keep an eye on the DaliCMS pages to get more info in the not so distant future. My new guess is that JavaFX will get more and more attention in the next few months. 

JavaFX is one of the two RIA technologies I am very interested in. The other one is Flex. Using JavaFX does not mean that I abandon Flex. At the contrary, I think Flex definitely has its place in the RIA landscape. The choice between JavaFX and Flex depends on what your skills are, what you want to achieve and what a specific project's requirements are. 

At this moment, you won't find too much information about JavaFX (although openjfx.org and  planet JFX are helpful.

When I find some time, I plan to make some of my examples available as well. 

Popfolio site launched.

It's been exactly three years since we delivered our first dating platform with LodgON. On February 14, 2005, the For2 dating site was launched. Actually, For2 was our first "big community site". We haven't worked at the site for about 2 years now, but I think the functionality would still fit in a modern dating site.

Things have evolved, since. Today, Poppunt has launched the Popfolio site. On the Popfolio site, musicians, artists, designers,… can hook up with each other and become friends or (business) partners. 

The Popfolio site is created with DaliCMS . It is a good example about how web-sites are evolving into community-sites. An increasing number of todays websites offers the end-user at least the possibility to "do something personal" with the site. One of the cool things about DaliCMS is that it is very easy to integrate user-properties (dooh, I should call this "user-generated content") into regular web-pages. 

This is the way DaliCMS and I believe a number of other systems are taking. The user is getting more focus when building websites. Content is important, but the user is King. 

There are some major differences between the current Popfolio dating site and the sites we created years ago. One of these differences is performance. Today, if you use the Java EE 5 specifications in a clever way, performance is really "under control". One of the major differences is that we don't have to convert object 3 times between database and website. The same User entity that exists in the Persistence Layer (using Toplink in our case, the default implementation in Glassfish) is being used in the JSP's using JSTL. Combine that with some intelligent (and sometimes project-specific) caching in the web-container, and there you go.  

Congratulations to Poppunt, the Popfolio site is attracting a big audience at its first day! 

The OpenID breakthrough

OpenID is a standard developed by the OpenID foundation. Wikipedia describes OpenID as follows:

 OpenID is a decentralized single sign-on system. Using OpenID-enabled sites, web users do not need to remember traditional authentication tokens such as username and password. Instead, they only need to be previously registered on a website with an OpenID "identity provider" (IdP). Since OpenID is decentralized, any website can employ OpenID software as a way for users to sign in; OpenID solves the problem without relying on any centralized website to confirm digital identity.

Apart from other benefits, OpenID may solve the problem of many users who have different accounts on different websites or communities. Oversimplified, with OpenID you only need to remember one username/password. Other sites that depend on username/password credentials co-operate with the decentralized OpenID environment in order to verify the user credentials.

Although this may sound very trivial, there are a number of huge problems that had to be solved before the OpenID system is widely accepted.

safety: do we trust the OpenID protocol and the OpenID providers?

privacy: who own the data?

technology: what protocol is used?

It is clear that with a number of large players (e.g. Google and Yahoo), it is not easy to find a compromise on such an important topic. The "User" concept is extremely important to these companies, and they are very careful about the problems mentioned above.

With the recent announcement of OpenID (Google, IBM, Verisign and Yahoo joining the board of the OpenID Foundation), a major hurdle has been taken. The OpenID standard is now accepted by most of the key players in the market.  

I predict that a number of other announcements will follow in the near future. 

finding bugs in software

In most web-based projects I am currently involved in, one of the main challenges is the translation between user requirements/perception and software. One of the reasons is probably the fact that we are mainly in the business of social software, which is rather new and not well-defined. Every different project has different expectations, and uses a different concept.

As a matter of fact, we are working on completely different communities at the same moment, using the same software. The way users are looking at the community, is very different though. The translation between a specific user requirement and a generic feature in our software is extremely important to us.

I recently noticed the website www.utest.com , which pays Internet users to find bugs in software. At first sight, this looked like a perfect concept. Developers are not end-users, and outsourcing parts of the testing would help developers focus on the software. However, I see 2 reasons why we cannot use this concept internally at this moment. First of all, we have our internal non-interactive tests, that keep at least the algorithmic part of the code under control. These tests should somehow be connected to the external users tests. Apart from that, and more important, is the fact that it is not just the feedback from "a" user that is important. We need the feedback from the target group.

Different social networks attract different people. What some people consider an "annoying bug" in one network, might be considered a "security feature" in another network. 

Nevertheless, I think that using (and paying) the Internet population as a test-group is a very good idea for many software products.  

Java and closures

The controversy in the Java world about closures is getting more and more attention. These are the typical discussions I expect to see at the next JavaOne conference. I am not planning to start an explanation or discussion here, read Neal Gafter's blog for more information about closures.

It's good to see at least a discussion about closures and other things that are currently not part of the Java language but that would make it better. That proves that Java is an active language, and that a lot of people are actively thinking about how it can be improved.

One of the benefits of closures is that they decrease the use for inner classes. Without entering the discussion, either solution is fine by me. I don't use inner classes at all (ok, there are some exceptions that I don't take responsibility for anymore ;)), but it doesn't bother me they exist. Will I make use of closures when and if they are part of the Java language? Probably. But I don't see any blocking issue at this moment that would be solved with closures. Although I agree it would make coding in a number of cases "somewhat" simpler. And some people will make it in a number of cases "somewhat" complexer.

The bottom line of what I am trying to say is that most of us are trying to do their best with whatever concepts are available in Java.