Testing out the Apple TV

I picked up an Apple TV this weekend. I had been holding out for quite awhile because I just couldn’t rationalize the cost without there being the content to watch. However, on friday night I discovered that MIT was integrating their open courses into ITunes along with a lot of other schools, Cal Berkely, Stanford, Michigan Tech, …. This alone was enough to warrant the purchase price for me. I haven’t been able to find the time to watch things like this, except when I’m on a plane, but with it integrated into the tv like a tivo the barrier to learning just got a whole lot lower.

The next test involves starting to get content from ITunes that I normally would get from DirectTv. Our satellite bill has gotten a bit out of hand lately, higher than I really want to pay, especially to a company like DirectTv. So I’m going to try purchasing Dexter and Weeds from ITunes and canceling Showtime. ITunes offers the shows at 480p while DirectTv offers some form of HD, it’s hard to tell with their bandwidth shaving if you’re getting a full channel, but ShowtimeHD has had issues for us with the sound being out of sync. It’s the only channel that it happens with and it’s a minor thing but it can really be annoying.

So far, Apple TV gets a big thumbs up. Very easy to setup. Offers HDMI and digital audio connections. A minor quibble is that the remote is minuscule, I’m going to lose it or the dog is going to eat it.

I asked the Apple sales person if there was any reason to get the 160Gb model for $100 more than the 40Gb model. The unit essentially acts as a proxy for your computer over wifi. It slurps content over so that there aren’t problems with playback. With a decent wifi network setting though I had no problem playing video that hadn’t finished syncing so I can’t see any reason to get the larger model. Also if you have trouble with a wifi connection it offers straight ethernet as well.

Now I’ve just got to catch up on my MIT classes and my Google EngEdu videos (I’m SO happy that they’re now offering the ability to download an mp4 instead of the proprietary Google player junk).

Monitoring JVM Garbage Collection

I had an interesting thought in a meeting today. We were discussing various performance and monitoring improvements and monitoring garbage collection came up. It occurred to me that the JVM is able to monitor heap size and report it at any time, but the state of the last garbage collection isn’t available as far as I know from within the JVM.

You could take the round about way and log the GC status to a file and then read in that file, parse it, and get the information that you need. But you can’t get to it from within the JVM. For the reporting that we’re looking to do it would be nice to know what type of GC was last done, what the memory stats of that GC were, and how long the GC took.

Scalable applications

Been working with some new technologies lately and I’ve come to the conclusion that for building a scalable webapp, the combination of Java(Servlets/JSP), Spring, Distributed Hibernate caching, and Horizontally Partitioned Mysql Databases hits the sweet spot.

I’ve heard several people choosing Ruby on Rails and Python for speed of development, but if you have some decent Java engineers there really isn’t any reason why you couldn’t have something up just as fast with a tomcat application server.

The big plus is that when the surge of traffic hits, it’s now very simple to scale the site with increased commodity hardware and there isn’t any need to rearchitect the code.

 The one bit of code that I’m looking to get a bit more mature, that completes the picture, is Hibernate Shards, which is coming out of Google. Once this piece is ready for primetime, you’ve got a rock solid base to build applications off of.

Little gotcha with java auto-boxing

Came across a fun little bit of trivia when dealing with auto-boxing in java. I’m processing content from Cloudgrove and as I examined words I wanted to check if they were in a stop word list. To make this a quick process I have a HashMap<String,Integer> of the stop words. Where the key is the actual word and the value is just 1.

Simple thing to setup. I then added this bit of code to perform the actual test.

if(1 == STOP_WORDS.get(token)){

The problem was that I kept seeing NullPointerExceptions on this line. I checked to make sure that the STOP_WORDS hash was being set up properly and it was. I was a bit perplexed by what was going on . Then I realized that because I was comparing to an int and not an Integer java was trying to auto-box the value. The value would come back as null because the token was not a stop word and then try and convert the null Integer to an int throwing the NullPointerException.

So the moral of the story is that when using auto-boxing you have to be careful about null values. The easy fix was to change the check to:

if(STOP_WORDS.get(token) != null){

and then things worked as expected.

Google Video now offering actual videos

I have a RSS subscription to new videos on Google Video from their tech-talks that they regularly publish. These are a great set of videos that remind me of being in school and being able to attend guest lectures, well worth checking out. I noticed last night that when you choose to download the video you actually get a .mp4 file now instead of the proprietary Google Video wrapper. This is a great jump forward and addresses most of my issues with Google Video.