Archive for July, 2009

Hulu Desktop 0.9.6 is Out

Monday, July 13th, 2009

HuluDesktop.jpg

I read a tweet about DVRs and Hulu Desktop and decided to see if they had an update, and sure enough they did - 0.9.6 is out and it's got a nice new feature - it allows you to pick what you want the app to do on startup. I don't like it to start playing the last thing I was watching because, frankly, I've already watched it. No, I like it to go to the "favorites" menu so that maybe I'll see something that might catch my eye.

This is still one of the slickest apps that shows TV and movies to the desktop. I don't mind the commercials as it's targeted and I'd have to watch them on TV anyway. It's the cost of watching, I understand.

I also love that the web page for Hulu Desktop shows House, MD - one of my favorite TV shows.

MacVim Snapshot 46 is Out

Monday, July 13th, 2009

MacVim.jpg

It's been a while, but this morning I'm happy to say that the crew working on MacVim have been able to put together a new update of the fantastic editor for the Mac - Snapshot 46. There are quite a few changes including NetBeans support and a new logging/debugging facility so that should we have any issues, it's much easier for the guys to debug the issue.

Fantastic editor. If I only had one, it'd have to be Vim.

Updating Google Visualizations Behind a Curtain

Thursday, July 9th, 2009

SquirrelFish.jpg

Today I was faced with a nasty little problem. I've started to add the annotations to the Google Visualization AnnotatedTimeLine widget and when switching them on and off I ran into a problem with the way I had implemented double-buffering: the unused area where the annotations are in the Flash component has a transparent background, so given that the two widgets have the same size in pixels, the "hidden" graph that doesn't have the annotations active is going to "bleed" through the one that does, with it's transparent background.

Yuck!

How to fix it?

Well, the simplest idea I had was to place a curtain between the two divs in zIndex space. Basically, in the HTML I added another div with nothing on it and set it's zIndex value to midway between the other two: 25.

This wasn't working right, so I changed the CSS on the curtain div to have a background-color of #fff. This looked a lot better, but again, it didn't seem to work all the time.

I pushed and prodded on this... adding a non-breaking space to the div... changing the color to try and see what was happening... then it hit me: Maybe the zIndex was being changed?

I added the one line to reset the zIndex of the curtain to 25 every time I flipped the other two, and Bingo! That was it. It seems that at least in Firefox, the JavaScript/CSS was "moving" the "static" div in zIndex space when I moved the others. Odd, but at least I have it worked out. Sweet.

PETA has Gone Off the Deep End – Fly Rights

Thursday, July 9th, 2009

GottaWonder.jpg

This has got to be the evidence that PETA has really, collectively, lost their minds. I remember seeing the original video, and thought that the President was pretty neat in getting the fly.

The response is out of control:

"We support compassion even for the most curious, smallest and least sympathetic animals," PETA spokesman Bruce Friedrich said Wednesday. "We believe that people, where they can be compassionate, should be, for all animals."

They're saying he shouldn't have swatted the fly! What's up with these people? Are they totally off the deep end? What little compassion I had for them and what they are trying to accomplish vaporized as soon as I read this official statement. Show more compassion for a fly? As if anyone should? How about rabid dogs? Bats? Venomous snakes?

Amazing.

Safari 4.0.2 is on Software Updates

Thursday, July 9th, 2009

Safari.jpg

Last evening I was updating Liza's MacBook Air and I noticed that there were a few updates for her machine on Software Updates - included was Safari 4.0.2. This morning I got Safari 4.0.2 for my MacBook Pro. Too bad they require a restart, but so it goes.

The update has stability fixes for the Nitro (SquirrelFish) JavaScript engine as well as the standard round of security and stability fixes that comes with all Safari Updates. Had to get it, but hated the reboot.

Neat Idea for JavaScript-Based Time Localization

Wednesday, July 8th, 2009

WebDevel.jpg

My web app caches the data it sends to the clients so that if another client asks for the same data while nothing's changed, I send them the same data and it's pretty fast. The problem there is that it's timed data, and that means that all the clients around the world have been seeing the data in Chicago-time. Not really what I want for a good user experience in New York and London.

So I needed to see if there was a way I could bring client localized time to the app without losing all the advantages of the cached datasets. If I passed in the location (region/TimeZone) of the client to the servlet, then I'd have a different cached response for each request in a region. Not ideal. Much better to be able to do it client-side. But that begs the question of how to do this?

One way would be to have the server generate GMT times for everything and then each client would have to deal with adjusting the data to the local time, and I almost went with that, but I decided to stick with the Chicago-based time and then add the GMT Offset in the package from the server.

If the client has the GMT Offset of the server, then it can see if it's GMT Offset is different from the server's, and if so, it can calculate the difference and apply it to all the times in the result set. Nice... for the Chicago users (the vast majority) there would be no change as the changes would be skipped, but for New York and London, I could update the data.

OK, how to do this?

Well... the first part is to generate the GMT Offset in the servlet. Since the offsets in Java and JavaScript have an opposite sign, the right thing to do is to standardize on one and then make the other 'fit' it. I chose to stick with the JavaScript version, so my Java servlet code looks like this:

  public UserInfo() {
    // don't forget to call the super's constructor - no matter what
    super();
    // start by getting the GMT offset in mins for this guy
    GregorianCalendar   now = new GregorianCalendar();
    if (now != null) {
      _gmtOffsetMins = (int)(-1)*(now.get(now.ZONE_OFFSET)
                                  + now.get(now.DST_OFFSET))/60000;
    }
  }

where my UserInfo is passed back to the client AJAX with some information about the validated user. Now it's got the GMT Offset in the same sign as JavaScript expects. Good. Now all I needed to do was convert the data that needed converting.

I created a JavaScript function:

  function convertTimesToLocalTime() {
    // get the time right now for the correct offset
    var now = new Date();
    var localOffset = now.getTimezoneOffset();
    if (localOffset != userInfo.gmtOffsetMins) {
      // get the soze of the table as we're going to need it
      var rowCnt = graphData.getNumberOfRows();
      // now let's run through the first column anc update the times
      for (var r = 0; r < rowCnt; ++r) {
        var obj = graphData.getValue(r, 0);
        if (obj instanceof Date) {
          // get the time from the server into UTC
          var utc = obj.getTime() + userInfo.gmtOffsetMins * 60000;
          // make this UTC time into a local time
          graphData.setValue(r, 0, new Date(utc - localOffset * 60000));
        }
      }
    }
  }

With this, I don't do anything unless I need to, and when I have to, I get the time data in the local timezone - regardless of where that is! I'm really happy with this as it adds a little overhead to the client, but it allows my server to not mess with localizations and keeps the cache intact. Nice.

Bean 3.2.1 is Out

Wednesday, July 8th, 2009

Bean.jpg

This morning I saw that Bean 2.3.1 was released with the one minor bugfix of:

  • fixed UI glitch: Bean Preferences > Style > Line Spacing now assigns line spacing correctly (user reported)

which could be a pain, but it hasn't been an issue for me - yet. In any case, it's nice that they are responding to issues from users, and I got the update.

VLC 1.0.0 is Finally Released

Wednesday, July 8th, 2009

VLC.jpg

After a great deal of work, the VideoLAN folks have finally released VLC 1.0.0 and (of course) I got it and updated my copy on my MacBook Pro. While it's a nice player, the biggest reason I have this is to use Handbrake which now requires VLC if you're going to rip DVDs - which is the reason for having Handbrake in the first place.

I haven't dug into the release notes (primarily because I can't find them on the web site), but I'm sure they've added things since the last version. But the biggie is that it's final, and Handbrake uses it.

The Wildest Database Setup I’ve Seen

Tuesday, July 7th, 2009

database.jpg

I love my job, I really do. This place has the nicest people I've worked with in a long time. It's great. But it's not perfect. Case in point: I was working on trying to figure out a production problem yesterday where a few INSERT statements into a MS SQL Server database was throwing up exceptions about primary key violation and this, in turn, was causing SELECT statements to fail.

I can't blame this place for MS SQL Server's problem of locking out the SELECT statements when it's upset about primary key violations on INSERT statements. Face it - the database should just fail the transaction and then go on about it's business. There's no need to have locks that are going to gum up the works for SELECT statements. That's Microsoft's fault.

But the problem that really led to this was the fact that I had part of a primary key was 'PHL' and another row had 'phl'. Now, to every other database I've ever used these are distinct values. The datatype is a simple varchar(16), and it's always been unique to me. But not this database.

No, it was a design choice to make all keys (primary and foreign) as well as indexes to be case insensitive. Amazing. This would be OK if they forced all the varchar data to be stored upper-case, but they don't, and it isn't. Which means that every stored procedure or client code needs to deal with converting the data coming out to the proper case. Again, possible, but why?

The closest thing I got to an answer was that historically, this matches the way the data was handled in the flagship app from years gone by. OK, I can possibly see that, but not really. If you're going to invest in a serious relational database, then why on earth tie it's hands with something like case-insensative keys?

I've put code into the applications that deal with the database to make sure that things are all uppercased, but it's still a potential problem for me until I get this code through Q/A and out into production.

PHP 5.3.0 final Available from Marc L’s Site

Tuesday, July 7th, 2009

WebDevel.jpg

Marc Liyanage has once again published a build of PHP - this time 5.3.0 final, and it's a great little way to include it on a stock Mac. I've been using this guy's builds of PHP and PostgreSQL for years, and I've always been happy with the packaging he's done. It installs and works, how can you beat that?

[7/8] UPDATE: Marc updated the package with a different MySQL driver - supposedly a better one, so I got that and installed it as well. Good enough for me.

[7/13] UPDATE: Marc updated the package with a fixed PDFlib - the previous one was broken, so I got that and installed it as well. Good enough.