24 May 2007

Programmer's notebook, May

(new concept, tryin' it out...)

For RadioWave, I continued cleaning up my messy, messy code. Much of it was carried over from when I was learning JEE and so required a tear-down/rebuild. Along with some JSP refactoring, I began converting code over to the data framework I developed for EventNett. It cleanly abstracts objects into classes for HTTP forms, database ResultSets, and read/write POJOs. They make it easy to copy between the different domains and are far better than my first fumblings in Java (without forcing an more invasive, 3rd party framework on the code). All of this refactoring unfortunately means shakier code in the short term as bugs get worked out but a more stable site in the long term.

I added Classic FM, a station in Australian (recommended by a European listener) which has its own weird time zones, and the music and news feeds from KCRW. Along with this new content, I broke out the detailed listings from shows that list tracks they will be playing but that don't say when they'll be playing them. In RadioWave, these un-timed tracks show up with the same schedule range as their parent show, but with the schedule times light gray instead of white.

I also finally got the Arizona stations in the correct time zone. Although, we'll only know for sure when daylight savings (which they don't follow) hits again.

I moved hosting from my server to LunarPages last month. They have something called an add-on domain that is a very inexpensive way (free, +$2/mo. for JSP) to host a new domain using your existing space. They seem to be down for ~15 minutes every week, but the price is right for JSP hosting.

For EventNett I primarily focused on getting the time zone conversions right--converting the GMT database time to the users' times. That was a bitch and it shouldn't have been. Live and learn. The knowledge will eventually be useful for converting RadioWave's times from GMT.

The only other notable update was fixing the JSP/CSS for the embedded feed (you can see an example here). The CSS had kinda skewed from the main site. Most of the problems were with IE's handing of TABLEs that have their widths specified. If IE can't determine the width of a TABLE's parent DIV, it will use the page width. Nice. The solution--as I now know and will cherish--is to create a DIV between the TABLE and its parent and specify a width of 100% in its CSS (not in its width attribute).

Finally, work (isn't it always the least interesting?). I had been struggling with getting the data sent from an existing utility to be received properly by a servlet I had written. The utility had been in the field for years with no issues (AFAIK), but when it sent data to my servlet--via HTTPS PUT--every other message was garbled. Unencrypted data came across fine, but SSL failed. What to do?

After getting schooled in the use of Wireshark from a co-worker, we poked and prodded with the packets for a few days, trying to learn what SSL should look like. I first wrote a Java utility to make the same calls, but it didn't reproduce the mangled packets. Finally, I wrote a C++ utility, mimicking the Win32 calls that the actual application was using. Testing with that, I found that the problem occurred only if data was sent from a Win2000 machine. I did some googling and found that the Win32 calls weren't being passed the correct flags; still waiting on verification though. Man, I hope that fixes it, 'cause I'm all out of ideas.

[ posted by sstrader on 24 May 2007 at 6:46:33 PM in Programming ]