As I have been very busy lately I couldn’t find any time to write a blog entry, so it’s about time now.
About a week ago I attended a businesspartner meeting organized by the Dutch Java User Group (NL-JUG). One of the topics was this year’s JavaOne visit and of course we talked a little about the terrible session planner (see my other post) and the problems that Klaasjan (NL-JUG chair) and I had with it. Reminded us of the good old times you had this ‘all sessions at a glance’ overview thingie.
Instead of spending all my energy biling the current session planner, why not come up with something better? Or at least, something that works better for me. So I sat down and gave myself a two hour deadline to come up with something useful.
Let me share something with you. If you give yourself a two hour deadline, one comes up with crazy ideas. Some of them which I can’t really state here, risking being fired by my employer :o) Well, after ten minutes of evil thoughts I decided to take the following approach:
1. Open a browser and head to the fantastic Session Builder tool at the JavaOne website.
2. After logging in with my personal JavaOne id, I used the infamous querytool to show me an overview of all sessions by day, starting Monday.
3. Next, simply select all sessions, or BOFs that you find of any interest. Take your time to check out the abstracts if you’re not immediately seduced by the session’s title.
4. When you’re done for Monday, add your selection to MySchedule. Maybe the tool starts nagging that you have selected multiple sessions in the same timeslot, but I regard my selection as a shortlist, making my final decision the evening before a conference day.
5. Repeat steps 2 – 4 until you’ve had all conference days.
6. Select the MySchedule tab and click ‘Save MySchedule’ and notice the truly awesome ‘export to CSV’ button. In case some of you don’t know what CSV is, maybe you should take a minute to introduce yourself to this new technology that is most certain gonna wipe out XML in the enterprise. Okay…use the button to download the CSV file containing your schedule and save it to disk.
7. Next, we unleash the true power of Microsoft Excel on the poor CSV file. Open the CSV file with Excel and immediately, within the same mouse move select File -> Save As… -> Save as type: XML Spreadsheet (*.xml) -> OK. Exit Excel as fast as you can. Phfew…that was close! Could you feel the dark side?
8. We lost about half an hour now to create the schedule. Time is running out, so we need a simple XML parser. I decided to use something I’m familiar with, so I chose JDOM. Actually there’s lots of options, so pick your favorite. The XML spreadsheet has a very straightforward format. Use a text editor or browser to take a peek at it. Time for my next bold move. Instead of using Eclipse I thought it would be fun to take NetBeans 4.1 for a spin. Not that I am a true believer, but all of the current marketing power made me just a little curious. Just a little! I won’t go into a NetBeans vs. Eclipse shakeout here, but take it from me that NetBeans has some nice features that you’ll like, although in the end I still choose Eclipse, or WSAD (RAD) for that matter :o)
So where did I leave you? Ahh..we were about to parse the XML MySchedule and time is running out. Here we go:
Use JDOM’s SaxBuilder and load the schedule file from disk. SaxBuilder outputs a Document that can be processed with a simple iterator to obtain the worksheet from the XML document. Next, I wrote some methods to process tables and rows. The processRows() method actually contains all the good stuff because it has access to the actual data that we’re interested in. The structure of a row is the following: SESSIONID, STARTDATE, STARTTIME, ENDTIME, ROOM, TITLE. All you have to do here is write some tedious code, parsing all of the mentioned elements. I put the data into a ‘Session’ object, which in turn is being added to a collection of sessions. Next step is to perform a little sorting. We don’t want our planner to be as messy as the real thing, do we? :o) Sorting algorithms are kind of my weak spot. Maybe I should have asked my coworker Martin to get his hands dirty. I suspect him of performing a manual bubblesort when brushing his teeth. No offense Martin, lets just hope he’s not reading this :o) Anyway, my sorting algorithm doesn’t deserve a Nobel prize, or a Duke Award for that matter. I created a few ArrayLists and a switch to find out which day a session belongs to. This also involved a very crappy implementation of getDay() on the Session object. Nothing to be proud of here. Now that we’ve got everything sorted out it’s time to present our schedule in a somehow nicer format than the original. My first attempt was HTML. Create a method that outputs a few HTML statements that make up a simple TABLE and output all of the session info into this table. Repeat this for all conference days and there you have it, your own ‘everything at a glance’ schedule! You can fancy things up here with some coloring. I chose different colors for different types of sessions. Here’s an example of what the output looks like:
9. Alright, so this step 8 was one big step for mankind. I’ve got only one problem left. Time! Still got 30 minutes to the deadline. Time for a little stress now. The HTML table is nice, you can use Word or some pretty printing tool to output the schedule to your printer. But wait…I also own this HP iPAQ. Actually I mainly use it to run TomTom GPS Navigation in my car, but I could also use it as my handheld schedule at JavaOne. Unfortunately there is no good J2ME implementation on iPAQ that I know of. So workaround with the dark side once again. Lets call in the help of Google and do a search on ‘vCal specification’. Like always, first hit is a winner. This vCal specification is a very simple text-based format for describing calendar events. It uses EDI like syntax. Oh my…CSV, XML, EDI…where is this gonna get me? Back to NetBeans…alter the Session object to contain a toVCal() method and output the session data as a single vCal Event. According to the specification, events can also be bundled into a vCalendar. All I had to do was add a few lines of text. Result: a VCS file, containing all of the JavaOne sessions as calendar events.
10. Well we’re finally there. Minor disappointment is that uploading the VCS file using Bluetooth to my PDA didn’t have the expected result. Unfortunately the Calendar application on my iPAQ is unable to import the VCS file, or recognize the incoming Bluetooth data as a series of Calendar events. Once again a workaround here. Use Microsoft Outlook to import the VCS file into Outlook’s Calendar. When you’re done use ActiveSync to synchronize Outlook with the PDA and you’re all set! If you happen to own a Palm instead of an iPAQ, you can also use the Palm Desktop application to handle the VCS file for you. Here’s the final result showing in Outlook:
Alright, time’s up! So much for my ‘ten steps to make the most out of the JavaOne 2005 Session Planner’. Download the code here and do with it whatever you like. You need JDOM in order to compile and run. Get JDOM here.
Some suggestions left as a reader’s exercise… If you’re a real masochist, or master the art to split yourself up and attend all sessions at the same time (there is no spoon!) you could also return to the MySchedule tool and select all sessions. Don’t hold me responsible for side effects, like your hand feeling really numb after selecting 300 BOFs!
See you at JavaOne!