Adding Combo Graph to BKit

June 13th, 2007

comboGraph.png

Today one of the developers wanted to add lines to the VantagePoint bar graphs that I had wrapped with nice little helper classes and applets for BKit. The problem is that a bar graph can't have lines, but a combo graph can. So I added the combo graph as a type to the BKBaseGraph and the BKBaseGraphApplet. The idea is that it's very much like the bar graph - even being subclassed off it, but the way it handles the lines versus bars is to have essentially two types of variables: regular variables that are the bars, and line variables that are the lines.

Once I figured that out, and then fixed up a few methods like getColumnHeadersOnGraph(), it wasn't that hard to get everything working. The subclassing was interesting in that I had to have tests for the combo graph before the bar graph as the instanceof would have been true for the bar graph class when I really wanted it to hold out for the combo graph. Not bad, but interesting.

The final thing was a new applet PARAM tag to indicate what lines to put on the graph. I chose asline:<col> ("as line") so if I had columns one, two, and three as bars, and four as a line, the relevant PARAM tags would be:

  <PARAM NAME="visible:one" VALUE="TRUE" />
  <PARAM NAME="visible:two" VALUE="TRUE" />
  <PARAM NAME="visible:three" VALUE="TRUE" />
  <PARAM NAME="asline:four" VALUE="TRUE" />

This tests out great and the line width, color, etc. all work on the line in the combo graph - as you'd expect. It's a nice little addition to the toolkit.

Fiddling Around with CSS

June 12th, 2007

Today has been a bit of a slow day - the data is good, trades are flowing, things are really humming along - all of which makes for a slow day for me. Not a tragedy - I had time today to mess around a little with the CSS on the server editor. I had picked up the CSS for tabs from WebFX and the 'winclassic' version was as close to Windows as I could have hoped. The problem was, it used the Windows-defined colors for 3D objects, and while that's really nice on IE, it's a mess on Firefox as those aren't globally defined in Firefox like they are in IE. So I set out to clean up a few things and in the same way that the fonts were cleaned up a while back, by specifying the RGB components, I was able to get IE and Firefox to match exactly. Nice.

I'm sure that if I had the time, energy and interest, I could look at the CSS stuff and make something really spiffy. I've seen very nice scrolling tables in CSS, and lots of other stuff, so I know it's possible, it's just that this kind of fiddling is something I really hate to do. It reminds me of the time when coding Windows apps that you had to layout your GUI components in code - moving things over 5 pixels, saving, recompiling, testing... it got old very fast. Someone is going to make this processes with CSS faster, and when they do, it'll catch on a lot better than it has up to now.


Interestingly, Apple's stock took a hit from the Keynote. I know it wasn't earth-shaking stuff, but it's really interesting to see that perception is far more important than reality in the markets. People expected something wild... something very Steve, and what they got was a developer's conference keynote - talking about the upcoming OS features. I guess even The Steve needs to watch out for his own distortion field... if he doesn't have the batteries freshly charged he can get himself into trouble.

WWDC 2007 Keynote News

June 11th, 2007

keynote_sm.png

Well... I happened to really like the MacRumors coverage of the WWDC keynote through IRC. I didn't think it'd be that different, but the response time is, of course, very fast for a chat connection, and even with the AJAX version of the web page, it's much faster to send just the text in chat than to update part of a page. So, I read the chat transcript and then looked at the pictures on the web page. Pretty nice.

Most of the keynote was Leopard, and the new features: new Finder, new dotMac integration, and the new features that had already been shown in previous keynotes. I have to say that it was a nice presentation, but nothing really surprising. It's nice to see that Leopard is going to have the features that warrant a $129.00 upgrade price, but there's not a lot that's really horribly wrong with Tiger (10.4) right now.

And that's when it hit me... this is very much a consumer update. This is so that the apps look more uniform, that iChat has more features, Finder is easier to use, backups are automatic with Time Machine, stuff like that. This is an update for my Mom. It's got nice things for me, but nothing compared to what it'll be like for my Mom. In that sense, it's going to be really exciting. She'll like it.

Summertime and Relaxation? HA!

June 11th, 2007

This past three-day weekend we took a trip to northeastern Indiana to a state park for a little pseudo-family reunion with my side of the family. It had it's moments... there was swimming for the kids... playing in the wide-open spaces with footballs, baseballs, frisbees... taking a hike to the nature center... having pizza with everyone... no doubt, there were fun times. But it wasn't very restful. Summertime isn't very restful, is it? I mean, the weather is nice, and for those of us that live in cold and ice for far too long each year, it seems that we're so excited about the warmth, that we forget that we're wearing ourselves out.

Then, on the way home it's time to stop by the Farm and see Liza's Dad. Always fun, but we get to spend about an hour or so with him and then it's time to head out to get back in town in time for me to get some sleep before I have to get up and start the week. I know that my workload is at least partly to blame, but that's also the primary reason that we have the time and money to do the things we do. So we can't be too hard on the workload.

I look forward to the weekends to rest and relax. But it seems that summertime is always not when you get to really rest and relax. Liza said to me "Lazy, Hazy, Crazy Days of Summer? HA!" and she's right on the money. I don't like the snow, but Holy Cow! I'm ready for a little rest already.

Coding like your Life depended on it

June 7th, 2007

This morning has been a very hectic morning. Some new instruments were traded and they weren't feeding properly into one of my systems so while I was trying to handle the production problem of halting the trades and manually amending positions, I was also trying to find the place in the code where I could augment the search symbology so that the instruments would feed. That, on top of trying to make an app that I didn't write a little more visually obvious that one of the instruments you have up you are not permissioned for from the exchanges. I got the guts of the fee-liable blocking done, but the app wasn't being a visually clear as the project manager wanted.

What a morning, indeed.

The second app had to wait as I feverishly tried to get things in production straightened out. Trades were backing up, things weren't looking good. Lots of stress if I have to restart the server... not fun. Amazingly, when the trades were pulled from the retry list and the positions manually updated, and the trade feed restarted, things started to work. This was major lucky break. With this, I had time to work on the solution. It took me another half hour to code the solution, test it in the development environment and then get it ready to deploy, but I had breathing room. The fix is a simple fall-back one - if the original symbology isn't found, try this other kind and see if it's there. It works cleanly without breaking anything else and it just plain works.

Once that was done I could focus my attention to the app with the visual issue. I'm not a big fan of Win32/MFC GUIs, and certainly when I didn't write them in the first place. Comments in this app date it to 1998 - that's almost a decade old, and the code shows it. There are a few comments, but not many. Trying to get things figured out is a process of tracing the logic through different libraries, different directories, it's a mess. But in the end I was able to get what I think the users will find reasonable. We'll have to see.

Most importantly, I'm out of the woods and things have calmed down. That's a major relief.

Getting Close to Burn-Out

June 6th, 2007

These past few days have been very up-and-down for me. Typically, that means I'm getting closed to burn-out as my tolerance for idiots is at a low point and they effect me more than usual. OK, that's harsh, but it's not that far from the truth. Today I had to dig into code that I told the management was a mess from before Y2K, and hasn't gotten any better with age. It may have been sleek and nicely designed at one time (for a Windows app) but now it's just a mess. There's too much business logic in the GUI and there's no clear pattern for the design. What part is doing what? Where's the documentation? All these are good questions that go completely unanswered. This makes for long, stressful, days. But it's a job.

Summer Time is here for the kids... today was the last (half) day of school and that means that they'll be doing a lot more things - running here, going to Band practice, Karate, etc. It's a hectic time and it's always nice when they go back to school in the Fall. But for now, it's time to enjoy the first few days of Summer and have a few cook-outs. Maybe a good burger with a slab of onion will pick up my spirits...

It's for sure, I need to find something.

Oh... MarsEdit's ability to include these images is amazing. I just can't believe how easy they have made it to include a little picture with a blog entry. I've been slapping them on the last few, and I really like the look of this. This is way better than my own on-line Journal... WordPress and MarsEdit are pretty impressive.

New MacBook Pros Arrive

June 6th, 2007

product-15in.jpg

The new MacBook Pros hit the Apple web site today and while they are a nice upgrade, I don't think I'll be getting one as my existing MacBook Pro isn't that much different from these guys. The biggest changes are the screen - you can get more pixels, which is always nice, and the graphics card, that's nice. Oh... and now you can get it with 4GB RAM while mine only holds 3GB. Nice, to be sure, but even all together, it doesn't justify the upgrade. But something else hit the wires this week that will - the quad-core Intel mobile chips due out next year. Yes indeed... put four cores into the MacBook Pro 17 and it'll be something to get. That will be an upgrade I'll make.

Java Allocation Speed

June 5th, 2007

java-logo-thumb.png

One of the developers using some objects in a Java library I wrote and maintain came to me to ask why this one operation was taking as long as it was. It's basically a table objects and views that can be placed on this table (and other views) to "stack up" a "deck" so that the end result is a table that has just what you want, in the order you want, etc. After talking with this guy, I realized that there wasn't a good reason that an aggregation on top of an aggregation was taking longer than the first aggregation. I mean the data set was less, and so it should, in theory, take less time. But it wasn't. And not by a little. So I decided to dig into it.

The first step was to build a test frame for this kind of environment. You see, it wasn't effecting small data sets like it was effecting the larger ones, so I built up a 100,000 x 100 table, and then aggregated it to 10,000 x 100 and then to 100 x 100. What I saw was that the first aggregation took about 13 sec. and the second one took about 8 minutes. OK, this was a good test case, and so I went into profiling mode to find where the time was really getting spent.

The first thing I thought was that the rows and columns were being inefficiently accessed by linear searches of their labels. But after putting that code in (it was in the base table, which is why I thought the first one was faster), it turned out that it didn't really improve the speed a lot. It went down to 5.5 sec and 3+ min. Better, but not nearly good enough.

Then I looked at some of the individual operations and what was there blew me away. In one method, I was returning the column headers as a Vector of Strings. The implementation for the base table was to return the ivar that was the Vector of Strings, and to have in the comments on the method the warning that this is the reference to the storage of the column headers, so mess with it at your own peril. In the aggregate view I had the code making a copy of the Vector and returning that. This was a hold-over from several of the views where the underlying table's columns can change and the system needs to augment the column headers on the fly.

That was the killer.

By creating a new Vector of Strings each time the row was accessed it took so much longer than simply returning the ivar that when I changed it to use an ivar the times went to 5.5 sec and 0.5 sec - they're going in the right direction now! I was amazed at this, but then I started to think about it. Java's allocator is probably doing a lot more than a typical C/C++ copy constructor, and as such it's load on the system is more. Even so, it was not the best idea to have a construction in the tight loop of the aggregator. All is fixed and I'm looking at the last two views that might need changing, but I'm not sure that even they do as they aren't doing the same kind of work that the aggregator was doing. But I'll give them a look and see if I can speed them up as well.

New NetNewsWire Update

June 5th, 2007

MarsEditIcon128.jpg

It's been a while since I started using NetNewsWire, and primarily as an efficient way to look at a handful of sites like Slashdot and Freshmeat, that I had been following for a while. I just got tired of all the adds I had to watch, and while I know where the money comes from, it didn't make it any quicker to go to all the web sites, read what I wanted and then move on. Also, I had to make a mental note of the last article I read on each site, and that made it most convenient to have the sites up all the time. This was a mess. The for some reason I read an article about NetNewsWire and decided to give it a try.

I started with the 'lite' version and after about a month decided that this was the kind of software that I should be supporting with money. It did exactly what it said it did, smoothly, cleanly, efficiently, and didn't try to be the end-all-be-all application. It did one thing, and it did it extremely well. I was sold.

Ever since then, and this may be back in the 1.x days, I can't remember exactly, I have followed the development of NetNewsWire and really enjoyed it's progress. Now it's in version 3.0, and it's as good as it ever was. One of the things I like most about it is the fact that even though many of it's users like to have a nice, big window up for all the lists, etc. I prefer a nice, little window with just the specifics. And NetNewsWire looks and works as well in the small window format as the large window format. Very nice app.

Coding Standards and Minimal Design

June 4th, 2007

Today I saw a chunk of code that was checked in and had a very hard time understanding exactly what it was doing. The comments didn't really help, and the variable names weren't a lot of help either. I actually had to walk through the code a line at a time to understand what it was doing. Now I'm no paragon of design and coding virtue, but there's a point where you really need to hold yourself - and the folks you work with, to some bare minimum standards in this area. A 20-line method in Java should not take someone to walk through the code to understand what it's doing. I read Kernighan's quote: Debugging is twice as hard as writing the program, so if you write the program as cleverly as you can, by definition, you won't be clever enough to debug it. and agree with it 100%. The extension of that might be: If you have trouble understanding what you just wrote, the other guy, six months from now, will have to re-write it.

So I figured out the code and started cleaning it up. It didn't need the functionality changed, that was fine. It was the variable names and the flow, and more than anything, the lack of comments saying what was going on and why. I know these are things that aren't popular with a lot of developers, but they make the job of maintenance and extension a lot easier. It also won't hurt to spend just 15 or 20 minutes looking at what you need and trying to see if there's a better way than your first cut. Don't spend the entire day, but spend a little bit of time to make sure that you're putting down something that the next guy will be able to pick up easily.