Archive for the ‘Coding’ Category

Slugging it Out in the Trenches…

Thursday, January 28th, 2010

For the last two days I've been busy just slugging it out in the trenches. Nothing fun, nothing exciting, just lots of drudge work that needed to be done, and I'm faster at doing it than anyone else, so I might as well just shut up, suck it up, get my head down and push through it.

Nothing exciting and glamorous about the last two days. Nothing.

Lots and Lots of Little UI Changes

Tuesday, January 26th, 2010

WebDevel.jpg

For the last two days I've been hip-deep in a ton of little UI changes and additions to my web app. I can understand the reasons for the changes - it's the fist time they have actually sat down and thought about it for more than 2 seconds. When they did, and started to think about what they really wanted, they had some changes. Unfortunately, it was a lot harder to do this all a week (or more) after the initial creation of the page(s), but I suppose better late than never, eh?

There were things like re-arranging the columns in a table, and because of the nature of the Google Visualization Table, you can't re-arrange the columns in the view - they're fixed. So until they add this feature, I'm stuck putting the data in the right order before it gets to the client. Not horrible, but when it hits several pages, it's just a little time-consuming.

I also had requests for a few new fields. Nothing major, but putting it on four different pages meant a lot of little updates and making sure to try and pull together as much code as possible so that it's not copy-n-paste reuse. It's the easiest way to add the same thing in several places, but it would lead to a mess later on. I'll probably do a bit of work tomorrow to try and coalesce this even more. It's getting to be big.

In the end, I got the changes made and emails sent to clients so they knew the fields were there. Good enough.

Differences in Java’s URLEncoder and JavaScript’s unescape()

Friday, January 22nd, 2010

This afternoon I ran into a problem between Java's URLEncoder and JavaScript's unescape() funtion. Ideally, I'd be able to create a URL in a Java servlet and ship it to the client and use JavaScript's unescape() function to parse the GET variables for the page. And it almost works. Almost.

The problem is the space character. The URLEncoder encodes the space into a plus sign ('+') and not the hex code (%20). The JavaScript unescape() function doesn't convert the plus sign into a space. So I have to do the following in my code:

  function parseGETVars() {
    var retval = [];
    var urlChunks = String(document.location).split('?');
    if (urlChunks[1]) {
      var pairs = urlChunks[1].split('&');
      for (var i = 0; i < pairs.length; ++i) {
        if (pairs[i]) {
          var parts = pairs[i].split('=');
          retval[parts[0]] = unescape(parts[1]).replace(/\+/,' ');
        }
      }
    }
  }

With the little change, I can use the Java URLEncoder and still get things working. Not too bad, but why on earth are these guys not doing the same conversions?

CoRD 0.5.2 is Out

Friday, January 22nd, 2010

CoRD.jpg

This morning I noticed that CoRD 0.5.2 was out, and with it, a hope that I may never have to have another Windows box again. This is an incredible app - works every bit as well as Windows' own Remote Desktop client for everything I need: get to a machine, run what I need, fiddle with files and settings, and get out. It's amazing.

With the update it's running in 64-bit on Snow Leopard, and several crashes have been fixed. It's also got the self-install/on-disk-location checks which have been talked about a lot in the web lately for Mac apps. I'm encouraged when I see this kind of thing picked up by really nice open source projects. Clearly, these guys are good, and that's great news.

I'll keep using this as long as it's available because I never want to have another Windows box, and there's no way business is going to give them up.

Firefox 3.6 is Out

Friday, January 22nd, 2010

Firefox3.5.jpg

This morning I noticed that the Mozilla group has finally released Firefox 3.6 - with a stunning list of changes. Among the biggies for me:

  • Protection from out-of-date plugins to keep users safer as they browse.
  • Improved JavaScript performance, overall browser responsiveness, and startup time.
  • Support for new CSS attributes such as gradients, background sizing, and pointer events.
  • Support for new DOM and HTML5 specifications including the Drag & Drop API and the File API, which allow for more interactive web pages.

but there's a lot more there for everyone.

When there's a major update to Firefox, like this, all the themes and plugins fail until the developers have a chance to update them to the new system. This morning was no exception for me. I had to mess with quite a few things in order to get Firefox working on Mac, Windows, and Linux.

Theme Problems - Whitehart 3.6.5 [XP & Linux]

I use the Whitehart theme for XP and Linux and of course it's not ready. Sadly, there's nothing I can do here as it's not in my skill-set to mess with the theme. I'll just have to live with the default theme until they get around to updating it.

XML Rendering Problems [XP & Linux]

I need to look at the XML output of several different servlets and because the servlet's content-type is text/html as opposed to application/xhtml+xml, I don't really see the XML - just some of the unbounded data in the XML. This isn't very useful. The old plug-in I used to force a content-type switch wasn't compatible with Firefox 3.6, so I tried Force Content-Type 1.2.2. What a gem!

I simply install this, activate it, and then put in the mapping for the URLs I need using JavaScript regex and BINGO! It works like a champ! I spent nearly half a day initially trying to figure out what the problem was, but this time, this guy had me up and running in less than 15 mins. That's fast.

If you need to see XML in Firefox on XP or Linux get it.

Java Plug-in [Linux]

This was a puzzler until I started googling it... the Java plug-in for Linux for Firefox 3.6 changed from the old libjavaplugin_oji.so to the new libnpjp2.so. For the JDKs distributed from Sun, this file is in the same basic directory structure, and a simple find will find it. But there's no errors in using the old one, it just doesn't load. Switch to the new one and restart Firefox, and all is well.

This little tidbit wasn't in any of the docs I read, and I wasn't the only one that thought this was an oversight. I can't imagine that after years of using the old plugin, I'd have thought to switch on my own. I'm sure glad one of the developers spoke up on this thread. Yikes!

Coda 1.6.10 is Out

Wednesday, January 20th, 2010

This morning I noticed that the guys at Panic have released Coda 1.6.10 - which is great. It's still the all-in-one that I want to use for my next project on the Mac, I just haven't had time to get to it. The CSS, JavaScript and HTML along with the preview and publishing make it just what I want to use.

TextWrangler 3.1 is Out

Wednesday, January 20th, 2010

The guys at Bare Bones have updated their free editor TextWrangler to version 3.1. It's the little brother to BBEdit, and is a great alternative for those times you don't need everything BBEdit has, or for those that just can't see the need to pay that much for a text editor. In any case, it's nice to have as a backup.

Finished the AJAX for the Fusion Page

Tuesday, January 19th, 2010

I spent the latter part of today getting all the AJAX and client (JavaScript) post-processing on the 'Fusion' page with the graph and table I started the other day. Getting the data wasn't bad, but unlike the previous table I created with the collapsing groups, these groups aren't clearly defined. In fact, the groups are contained in the table itself. This allows me to not have to worry about the group definitions, but at the same time, I needed to change everything about the old scheme because I didn't have the group definitions.

It wasn't horrible, but it took a little bit of thinking to get the summations, indentation, sorting, tagging and collapsing all working. A couple of hours of quiet work, which of course, turned out to be an entire afternoon because I don't have quiet, and making it (with my fingers in my ears) doesn't make for easy typing.

Yes... I wish I had quiet. But I don't.

In the end, I've got the code I needed, and it's off the the London users for them to kick around and send me any changes they might have.

Bad Code Just Keeps on Giving…

Tuesday, January 19th, 2010

GottaWonder.jpg

I know it's been a recurring theme of late, but I just can't help from commenting on the fact that a Good Coder can take Bad Code and keep it running far, far longer than it's probably good for the organization. Additionally, it keeps on giving to the coder long after he's tried to fix things up. Primarily because you can't really re-write the bad code - then it'd be a new project. No, management wants you to fix it, and quickly.

Well today I came across another lovely little "gotcha" with this application I've inherited. The designer tried to make a nice inheritance system for Stocks, Futures, Options, and to his credit, the ideas are basically nice, but the implementation is... well... let's just say not what I'd have done. But it's there. That's not the problem.

No, today I realized that a new portfolio has basically a bunch of stocks, but in order to get the pricing and calculated data for the instruments, I had to do a special type of query for futures that have no options on them. It's like the data source was written to supply data for stocks, futures, and options -- but only if you had options on the underlyings. If you just had a stock - too bad.

So they made this hack that a future was basically a stock. Not really - that whole expiration thing swept under the rug... but it's what I'm stuck with. I had to write code to make stocks from futures, and put it into the code base and write all the JUnit tests, etc. in order to get this one portfolio properly evaluating.

Not my idea of fun. And I'm sure it's not going to be my last realization about this codebase.

Dense Visualizations in the Finance Industry

Friday, January 15th, 2010

GoogleVisualization.jpg

I think one of the things I really like about the Finance Industry - certainly creating applications and visualizations for it, is the density of the visualizations and applications. Most finance applications are running on machines that have a ton of other things running, and the users want to see as much data as possible. I've seen traders with dual 30" monitors and an additional three 19" monitors all tied to a raft of machines - all just to get the data they need in front of their eyes for the trades. It's pretty impressive.

I have to say I'm the same way. I love the visual density of the information in graphs and well designed tables. So when the users in London asked me to essentially fuse two pages together - and two of the more complex, active, pages at that, I had to rise to the challenge.

This fusion page has the Google AnnotatedTimeLine widget on it for the intraday values of several portfolios, and it also has a Google Table widget to contain the product-level values for the components of those portfolios. There are a few other things, but these two are going to update independently of each other with the trigger being the same timer event. So they will be close, but not really in sync.

Today I did most of the HTML/CSS layout to get the components on the page. This is necessary because the AnnotatedTimeLine is really two stacked on top of each other to function as a double-buffered system. We draw to the 'back' one, then flip them. Pretty simple, but necessary because of the delays in updating the ATL with new data.

I'll be able to put the AJAX behind this when I get back on Tuesday. Nice to have a three-day weekend!