Friday, December 28, 2007

Holiday Travel

  • Changing four airline tickets on Delta: $75/ticket = $300
  • Adding new rental reservation for 5 days = $250
  • Being able to let kids recover from pneumonia before traveling = priceless
Interesting side note... I couldn't just extend my current rental car (a minivan, Chevy Uplander) because we had made the reservation through Priceline. This completely stymied both Budget's national and local offices. So I we just made another reservation through Priceline for the same kind of vehicle, picking up on the day we were to drop off the current rental. One would think that they will simply let us keep the current vehicle, but who knows. Their inefficiency has cost them. We bid a lower rate on the new reservation, since it won't be during peak holiday season, but would have been happy to pay the old rate if we could have just extended the current reservation. That comes out to about $15/day = $75, plus whatever take Priceline is getting.

Wednesday, December 26, 2007

Favorite Music of 2007

Year Zero by Nine Inch Nails -- Favorite artist releases very good concept album. I can't ask for anything more.

Carnavas by Silversun Pickups -- This came out last year, and I put on my list last year as well. I listened to it even more this year though.

The Boxer by The National -- This is probably my favorite music to listen to while programming or writing. The only problem is that the songs can be so engrossing that it can be distracting.

Neon Bible by Arcade Fire -- If somebody told me "there's been no good music in 2007" my retort would begin with Neon Bible.

Because of the Times by Kings of Leon -- The consensus criticism of this album is that it was too fractured and all over the place. Maybe that's true, but the songs are excellent. Put this whole album on your iPod and hit shuffle. Every time one of the tracks comes up, it's an instant joy.

In Rainbows by Radiohead -- This is a great album -- also a good retort to any "2007 sucked" claims. I have a feeling that it will remain in heavy rotation for me next year.

Ga Ga Ga Ga Ga Ga by Spoon -- This is another enjoyable album by Spoon. This is one of those albums where each time I listen to it I ask myself "why don't I listen to this more often?"

Robbers & Cowards by Cold War Kids -- I think this also was a 2006 album, but I didn't hear it until this year. A very good album overall, but I especially love "Hang Me Out to Dry."

Icky Thump by The White Stripes -- This was a disappointing album to some people. To me it is a great listen, even though it is probably not as memorable as previous albums by The White Stripes.

Graduation by Kanye West -- I go through love/hate cycles with this album. I tend to listen to it way too much, get sick of it, then two weeks later start all over. This definitely has some weaknesses, but there are too many good tracks to ignore it.

Saturday, December 15, 2007

Les Miles

I find it funny that Michigan has wanted Les Miles so badly. I am terribly unimpressed with Les Miles. He has had a great team the last two years, but that's because of the tremendous talent that Nick Saban left for him three years ago. Saban is well known as one of the best recruiters in college football. Les Miles got a great team. Look at all of the great players on his team, and all of the best ones were Saban recruits. His coaching has been quite questionable this year. Personally I thought he got incredibly lucky in many games this year. He made many questionable calls. Worse, when questioned about some of these calls after the game, he often left the impression that he was not completely aware of the situation when he made the call. Some people mistook this for "gutsy" calls, but they were actually just ignorant calls. He was dumb, but got lucky. His team could have easily lost two more games because of his mistakes. They still wound up losing two games when they clearly have the best team in the country. I was amazed that he prepared a double spy defense to play against Darren McFadden, and they still gave up 200 yards on the ground to him. Yes McFadden is a great player, but if you prepare a "trick" defense for a guy and it fails, then some of that failure has to attribute to the "trick" defense. Anyways, Les Miles does not seem like a great coach despite his team's success. His team is successful despite his poor coaching. And yet, Michigan can't stop salivating over him...

Mitchell Report

I don't care about athletes using drugs. Most people would agree that I have a minority opinion on this. But who cares about my opinion? Most people think that athletes using drugs is a form of cheating. It is bad. Period. If I was one of those people, I would be very happy about the Mitchell Report.

A lot of people have pointed out that the evidence in the Mitchell Report would not hold up in court. They point to Roger Clemens in particular. It's as if the Mitchell Report was supposed to produce evidence to be presented to a grand jury or something. If that would have been the purpose, then it would not have been worth releasing.

I think the point was to justify stricter measures to prevent the use of drugs in baseball. Obviously you can only prevent future use, you cannot change the past. If that is the purpose, then I think it does a very good job. It shows that by only getting two people to cooperate, they were able to find evidence against dozens of players. There is no way the public could not come away feeling that drug use is widespread in baseball. It's not just the guys hitting 40+ home runs. It's the starting pitchers, the relief pitchers. It's the low-power, fast running infielders and outfielders, as well as the sluggers and wannabe sluggers. It's the utility bench players. It's the upcoming players and aging veterans. It's future hall-of-famers and guys struggling to get at-bats.

If the public thinks that everyone is using, then it will be hard for the player's union to stop the owners from instituting testing that is on-par with the NFL or maybe even the Olympics. Smart and/or cynical folks will say that players will still find ways to use drugs to get an advantage, but it does not matter. All that matters is that most fans feel like order has been restored. They feel like they are watching a "fair" and "clean" game. The Mitchell Report forces the players' union to accept this kind of testing, or baseball will lose fans, and players' salaries will fall. It's that simple.

Now if three years from now, Alex Rios leads the majors with 25 homers... Well that would be pretty interesting, wouldn't it? I don't think it will be the case. There will the usual fluctuations in hitting vs. pitching, but no amount of drug testing will have much affect on the general proclivity of home runs.

Wednesday, December 12, 2007

ActionScript Reflection Workarounds

ActionScript has some nice reflection features. However, if you are used to Java or C# (for example) then ActionScript can seem kind of sub-par. One of the easiest things to do in Java is to create a new instance of a class dynamically:

Class<MyAwesomeClass> clazz = MyAwesomeClass.class;
MyAwesomeClass instance = clazz.newInstance();

Clearly this assumes a default constructor, but you get the picture. The equivalent in AS is:

var x:MyGreatClass;
var clazz:Class = flash.utils.getDefinitionByName("MyGreatClass") as Class;
var instance:MyGreatClass = new clazz() as MyGreatClass;
A couple of things to notice here. First, you have to declare a variable of the given type. Otherwise the AVM2 virtual machine is not smart enough to load the class and will blow up on the second line (thanks Wikipedia!) Next the standard AS Function getDefinitionByName returns an Object, not a Class, so you have to cast it. The only nice part is that you get to use the new operator with the instance variable clazz. Ah, finally we get a job-of-dynamic-language moment. To improve on this, I add a boilerplate method to my classes:

public static get clazz():Class
{
return MyGreatClass;
}

This let's me do the following:

var clazz:Class = MyGreatClass.clazz;
var instance:MyGreatClass = new clazz() as MyGreatClass;

Not quite as nice Java still, but close! The first line causes MyGreatClass to get loaded by the VM while at the same time providing a handle on the Class in question in a very convenient manner.

Tuesday, December 11, 2007

This is the Team We Want to Move to the South Bay?



Clearly one of these guys must go.

Nolan won't go because it would "send the wrong message" to the team.

Smith won't go because it will kill them with the salary cap.

So they will both be back and the Niners will be very bad ... again.

Monday, December 10, 2007

Tebowisms

Yeah, I'm pretty happy that Tim Tebow won the Heisman. He certainly deserved it. It was kind of sweet that Colt Brennan finished a distant third place. So much for June Jones and his attempt to raise up his guy by degrading Tebow.

I was reading the newspaper in Tahoe on Saturday, anticipating the Heisman ceremony that evening. They mentioned "Tebowisms" which appear to be similar to Chuck Norris Facts. Mildly amusing.

Anyways, Tebow gets one more team to wallop on this year, and it's another Big 10 team: Michigan. If you can't beat Appalachain State... heh heh. Vegas has Florida as 10 point favorites. Only USC is a bigger favorite among New Years day (and after) bowls, at 13.5 points over in the Rose Bowl. The SEC is heavily favored this year in general. SEC teams are favored in six of the eight bowl games they are playing in.

Next year should be interesting for Florida. Tebow says he will not leave for the Pros no matter what happens next year. He's certainly not your prototypical NFL QB anyways, so this may well be the case. Percy Harvin on the other hand is definitely going to be a high NFL draft pick. He is a little short for the pros, but his speed is ridiculous and his hands are very good as well. If Ted Ginn, Jr. is a first round pick, Harvin definitely is as well. So next year becomes make-or-break for Florida.

Friday, December 07, 2007

The Heisman and System QBs

There has been a lot of talk about "system" QBs. People point out Andre Ware or Texas Tech as examples of how systems can lead to inflated numbers. Sure they can. But the real issue is level of competition, not systems. That's why Texas Tech puts up big offensive numbers. That's why Hawaii does, too. A low level of competition will always cast extra scrutiny on star players.

Nobody complained about Tommie Frazier winning the Heisman. Clearly he was in a "system" albeit one where he ran the ball much more than he threw. It didn't matter. Nebraska played and beat the best out there. It takes a great player to perform at such a high level against tough competition.

June Jones and others have also made a point about the NFL potential of players being a factor in Heisman voting. That is just ridiculous. If NFL talent was relevant at all, then Peyton Manning should have won three Heismans. There has never been a more sure-fire future Pro Bowl quarterback coming out of college, but he did not win the Heisman and for good reason.

There have been many Heisman winners to have no little or no NFL success, particularly quarterbacks: Ware, Frazier, Charlie Ward, Danny Wuerffel, Jason White just to name a few. There is nothing wrong with this. It's part of the beauty of college athletics that it's not just the most physically gifted individuals who have the most success.

So sorry June Jones. Maybe your boy will be good in the NFL, who knows? Nobody runs your "pro" offense there, so I don't know how much his experience in Hawaii will help. Whatever the case, Hawaii has not played against formidable competition at all. You can't claim to be the best without playing against at other good teams. That is why Hawaii's undefeated season will not get them a shot at a national title game, and that's why Colt Brennan could throw 100 TDs and not win the Heisman.

As a side note, there was one thing that made me really happy when I read about June Jones's disparaging comments about Tim Tebow. I learned that Hawaii opens its season next year at The Swamp. Talk about sweet justice! Hawaii is going to torn up by Georgia in a few weeks, so that will demonstrate how meaningless their perfect season is... But it will be even more demonstrated next August. And before anyone brings up Boise State from last  year, try to actually remember that game. They had every break in the world, and still had to gamble on a trick play to be able to win that game. If that game was played nine more times, how many times do you think Boise State would win? Let's be honest here, maybe once?

Rails 2.0 Released

If you are upgrading, I recommend upgrading Gems first (gem upgrade -system) and then using it to upgrade Rails (gem install rails --server http://gems.rubyonrails.org). There are some nice features. I especially like some of the Ajax security and JavaScript aggregating. The (expanded) JSON and XML support in ActiveRecord is also nice. 

Wednesday, December 05, 2007

Tuesday, December 04, 2007

Confused Microsoft


So which is it Microsoft? Is Popfly a download, or not?

Monday, December 03, 2007

Oodle: Fail

I like reading Uncov, it almost always makes me smile. Harshness is fine its own right, but it's always better when mixed with technical harshness. So in that spirit, let's take a look at Oodle 2.0.

First, a disclaim: Oodle and eBay are (or at least were) partners. Obviously everything here is my opinion, and has nothing to do with eBay. I'm not going to comment on their business, just a few things I saw in a browser...

Now I came across Oodle because they are hosting a Lunch 2.0 in a couple of weeks. I got the Facebook invite from Terry, and started poking around Oodle. They've supposedly re-done their entire site and made it very Web 2.0-ish, hence the launch of "Oodle 2.0."  So what's the secret to their new UI? Let's find out.

I opened up Firebug on a page and saw 7 HTTP requests for JavaScript files. That seemed excessive. I started opening up each JS file that was coming across. Here's the start of the first one:


/*Copyright (c) 2007, Yahoo! Inc. All rights reserved.
Code licensed under the BSD License:
http://developer.yahoo.net/yui/license.txt
version: 2.3.1
*/

Alright, so they are using YUI, at least they didn't re-invent the wheel here. I kept reading this file and one line 11 I see:


/*Copyright (c) 2007, Yahoo! Inc. All rights reserved.
Code licensed under the BSD License:
http://developer.yahoo.net/yui/license.txt
version: 2.3.1
*/

Fail. But wait, there's more.  Starting at the end of Line 18 we have:



/*Copyright (c) 2007, Yahoo! Inc. All rights reserved.
Code licensed under the BSD License:
http://developer.yahoo.net/yui/license.txt
version: 2.3.1
*/


I'm seriously not making this up. See for yourself: http://img.oodle.com/jaml/autocomplete/1196308267

Ok, so that file is pretty bad. What about the other six? Here is the contents of another JS file (see it live in all its glory at http://img.oodle.com/jaml/focus/1195340840) :

function focus()

{

var focusElement;

if (document.getElementById('home-what'))

{

focusElement = document.getElementById('home-what');

}

else if (document.getElementById('search-what'))

{

focusElement = document.getElementById('search-what');

}

else if (document.getElementById('email'))

{

focusElement = document.getElementById('email');

}

else if (document.getElementById('sender'))

{

focusElement = document.getElementById('sender');

}

focusElement.focus();

}

addDOMLoadEvent(focus);

That's right, an HTTP request for 20-freaking lines of JS. FAIL! There was also three CSS files loaded for a single page. The ten combined external files are all loaded in the first 20 or so lines of HTML. It's like these guys are trying to make their site slow...

I looked at their house listings. You can click a "see details" for each listing and it makes a slick XmlHTTPRequest call. How very Web 2.0. The response to this is XML. What year is it? Haven't you guys learned about JSON? You would think using YUI they would have figured this out.

Here is one the URLs to a search: http://sf.oodle.com/housing/rent/home/-/bathrooms_2/bedrooms_3/bedrooms_4+/-/95118/+5/.
That looks very Ruby on Rails-ish (or maybe Django.) I looked at their cookies, including their session cookie, but nothing cried out RoR there. Still RoR would fit well with their slowness strategy.

Sunday, December 02, 2007

Weekly Football Musings

The BCS
Will this year be enough of a reason to unseat the Big 10's resistance to a playoff? I don't think so. They have such a $weet deal with ABC and the Rose Bowl. But could you just imagine if today would have been tournament seeding day, a la basketball, instead of bowl schedule day? Let's say we could do an eight team tourney (three weeks like the basketball tourney.) We would have

Ohio State vs. Kansas : This would be #1 vs. #8. Would Ohio State even be favored in this? Yeah probably, but not by a lot. This would theoretically be the most lopsided game, and it would still be very competitive.

LSU vs. USC : How awesome would this game be? I could imagine a lot of people predicting that the winner here wins the next two weeks as well. Also, would this be the first college football game ever where ever defensive starter would go on to start in the NFL one day?

Virginia Tech vs. Missouri : This game would be very interesting if for no other reason than the contrast in styles. You gotta think that Missouri would come into this game feeling very disrespected.

Oklahoma vs. Georgia : Wow, another slugfest. Georgia's offense really clicked down the stretch... Bob Stoops knows all about SEC football, but this might be a case of too much physical difference. Georgia is bigger and faster than Oklahoma at every position... Ok maybe not, but you know people would be making arguments like that.

That's the kind of amazing games we would see out of an eight team playoff. And of course West Virginia and Hawaii would both be freaking out that they are not part of the eight teams. You can just hear Hawaii complaining about going undefeated but not going to the big dance...

The Heisman
Let the buildup start. I am ridiculously biased, I know. But how can Tim Tebow not win this? If somebody told you last summer that a QB would throw for almost 3000 yards and 30 TDs and also ran for over 800 yards and 20 more TDs ... you would say that guy would win the Heisman. Somehow Tebow only being a sophomore and Florida not being in the BCS championship have decreased Tebow's amazing season. That is just crazy. Florida lost three games, in a year where everybody lost at least two. Anybody who watched Florida knows they lost games because of their completely inexperienced defense. The offense was much better than last year's national championship team, and Tebow was the biggest reason for that.

Tebow must win the Heisman. Chances are that this will be his best season, statistically. I think Coach Meyer would prefer to have more playmakers (not just Percy Harvin) around Tebow at WR/RB. If that is the case next year, Florida will run the ball a lot more. It will translate into less pass attempts for Tebow and less rushes for him, too. I think his efficiency will stay very high, and he will probably still score a lot of rushing TDs, but gross numbers will probably drop quite a bit.

Friday, November 30, 2007

First AIR App: JSON Viewer

I was debugging a problem the other day, and needed to inspect some JSON that was being sent out by a web application. Now we all know that JSON is superior to XML, right? However, one nice thing about XML is that I can grab a blob, throw it into an editor, and have the editor pretty print it for me. This is especially helpful when debugging the XML in question. It makes it easier to spot a mistake in the structure, or to simply navigate to a given value in the hierarchy.

I did some looking around for something to parse and view JSON for me. I found JSON Viewer from CodePlex. It is really nice. However, it is Windows only. I do some development on Windows, but a lot on my MacBook as well. I wanted something that would work on either.

Instead of spending more time looking, I decided to code. A year ago I might have written something in Java, but I decided this was a good chance to write something in ActionScript and leveraging Adobe AIR to create a desktop application. The result is an AIR-based JSON Viewer. It looks really ugly, but I'm no designer. It uses Adobe's corelib to parse JSON and then just massages the resulting object into a structure that can be read by a Flex Tree control.

One fun use of it is to go to some of your favorite sites. Open up Firebug to watch traffic. Look for some JSON, plop it into the app and take a nice look at the data being sent over the wire to your browser (or from your browser in some cases.)  Of course some foolish sites still use XML over the wire, but most of the bigger and/or newer ones use JSON.

Thursday, November 29, 2007

Meebo Platform and ActionScript

It has been a month or so since Meebo announced their "platform." Platforms are all the rage these days, six months after Facebook made everyone envious with their F8 platform. One interesting thing I noticed about Meebo's platform was that they gave you your choice of programming in JavaScript or ActionScript. How nice. So I took a look at their ActionScript support.

Several things jump out quickly, but let's state the obvious ones. They provide a Flash component for Flash 8. Now it's cool that they provide a component (even if "installing a component is arcane), but Flash 8. Seriously? Clearly this is something written in ActionScript 2.0. Now it would be one thing if they wanted to provide some support for AS2 developers, but what about AS3? It just seems crazy for a brand new platform to not support the latest version of one of the two languages it supports. It would be like Silverlight only supporting C# 1.1.

There's also the issue of providing support for the Flash IDE exclusively as well. I guess with AS3 support only, this is all you can expect. The Flash IDE is not made for developers, it is made for designers. Flex Builder is obviously the choice for developers, though it has its drawbacks.

I didn't see if Meebo provides the source code for the SWC. If they did, it probably wouldn't be too hard to compile it for AS3. Actually you might be able to use the AS2 component within an AS3, I haven't tried that. Still, if you're going to launch a me-too platform, at least do it right.

Wednesday, November 28, 2007

Mo' Ram

I've been working some lately with DB2. The worst thing about DB2, at least for a Mac-totin' developer, is that DB2 is not (yet) available for OSX. So what to do? I already had Vista installed on my MacBook via Boot Camp. So I installed DB2 on there and ... developed under Windows. Ugh. Running DB2 and Eclipse at the same time often resulted in not only a slow computer, but Eclipse stack overflows and out of memory errors. Funny how I never had such problems on OSX.

Once that project was done, I decided to upgrade the memory on my MacBook. The max it handles is 2GB (I had the 1 GB that was stock) so I went with that. So where to get the 2GB? Well there is always Apple @$300. Ouch. A better choice is Newegg, of course. For a change though, I found an equally good deal at Fry's, just up the road from my office. 2x1GB sticks of Patriot RAM for $65.

Now it was time to install the RAM. I am always quick to tell people that I am a software guy, not a hardware guy. However, Apple makes it really easy to install RAM on the MacBook. It took me like ten, maybe fifteen minutes total to upgrade the RAM. It could not have gone smoother.

The extra memory has inspired me to give Parallels a try. So far the results are mixed. Every time it launches, I get a message form Parallels saying it is installing Parallels Tools. Then Windows crashes (blue screen.) It reboots and seems ok, but it's still aggravating that it does this every time...

Saturday, November 24, 2007

Black Friday

Yesterday my wife convinced me to go shopping with her and her sister. Normally I dismiss the idea of shopping on Black Friday, smugly stating that people should just buy everything online. Long lines, supply shortfalls (artificial or not,) and the like are all just signs of inefficient markets that will be replaced by the ruthless efficiency of e-commerce. Somehow Crystal talked me in to hitting the mall at 7 AM...

One amusing thing to me is the bait-n-switch items. These are the "limited" quantity items that are offered at a huge discount (do stores actually take a loss on these things?) in order to get lots of people in the store. The store then runs out quickly, so customers wind up buying other, more expensive items. This year's bait-n-switch special was definitely GPS units. Not only did every big-box store out there have sub $200 GPS units in limited quantities, but places that don't normally sell GPS had them as well. Get your GPS at Long's Drugs or Sportsmart, woo hoo!

Black Friday was actually a lot of fun. My niece has managed various American Eagle stores for the last ten years or so, thus I have a lot of empathy for the folks who work on Black Friday. They all seemed to be in a good mood yesterday, and I had a good time joking around with people.

Black Friday had a dark moment for me though. I managed to drop my Blackberry in a (thankfully clean) toilet. I fished it out quickly, and took the battery out of it. I waited a few hours, and it booted it up. The keyboard was crazy though. Sometimes it would not type at all, but other times keys would be entered without me touching anything. So I took the battery back out and left it out over night. This morning everything is working good as new! What a relief!

Yesterday ended on a very bright note. We are going to Florida for Christmas this year, so my wife decided to give me an early present: a Nintendo Wii. She didn't want to try and hide it from me in the luggage, and this way we got to play it with our family in Bakersfield. I am happy to say that I have a sore shoulder this morning from playing Wii Tennis late last night... She asked me if I wanted other games for it, but I really did not expect a Wii and had no idea what games are supposed to be good on it. I will probably get Madden for it, just because I used to love Madden on the PS2 and Gamecube. Guitar Hero looks like a lot of fun, too. I have basically taken the last 3.5 years off from playing video games, as I stopped having time for stuff like that when we started having babies. I'm not sure how much time I will have to play it now either, maybe once I finish my book :-)

Tuesday, November 13, 2007

The Network Application Pattern

    Several years ago I worked in consulting. My company was hired by larger companies to build web applications. We worked on internal web applications, external ones, and even some that were completely consumer focused, like the Washington Post Jobs site. Often we wrote applications that replaced existing desktop applications. Many of these were so called thick clients or client-server applications.
    The list of technologies was all over the place: PowerBuilder, Swing, and Visual Basic. The reasons for the conversions were pretty similar though: make things more easily accessible. It was much easier to say “you need InternetExplorer 5.5 or higher” to run an application, than it was to require somebody to download and install, and stay upgraded to the latest version of an application. The hardest part about these conversions was trying to reproduce all the functionality. You just could not do it, and there were always compromises that you had to work out with the clients on this.
    These days I am starting to think that such compromises are unacceptable. The days of the thin client are coming to an end. At the same time, the days of the thick client are not coming back. Instead a different pattern has emerged, and it is going to win. I call it the Network Application, though other folks have different names and different takes on it. Here is what it is.

Misuse of Big Iron

    To make things as accessible as possible generally meant to require as little as possible on the end user’s machine. The browser wars necessitated this as well. Inconsistencies across browsers required a least common denominator approach. The browser become a rendering device, and nothing else really.
    All the computation required to determine the interface shown to a user was performed on servers. For awhile these servers were Big Iron -- look at how well SUNW did in the late 90’s. Moore’s Law caught up and lots of cheap servers replaced Big Iron, but the usage pattern remained unchanged. Programming languages flourished around this. Look at all the UI frameworks in Java, the explosion of PHP, and the emergence of Ruby on Rails.

Another Shift

    I am not one of those melodramatics who look for a single event and say “this epoch caused everything to change.” Things started changing. Browsers stabilized and Moore’s Law kept moving along. Microsoft’s attempt at subverting web browsers by creating IE-only extensions, ultimately backfired on them. They created XMLHttpRequest, which ultimately allowed for exactly what the Netscape think tank had always hoped for and Microsoft always feared: web applications that were on-par with desktop applications. Well sort of...
    Web applications still have a lot to be desired. As I mentioned earlier, it can be really hard to reproduce a desktop experience in a browser. There are a lot of things going on to solve that, and some of them might even work. Orthogonal to the technologies at play is the pattern of how to program applications that are as feature rich as desktop applications, but can be run from a browser with no software to download or worry about updating.

The Pattern

    The key to the pattern is to stop using servers for creating user interfaces. If you like to think of UIs using the popular Model-View-Controller paradigm, the server should only be a place for Models. Your View and your Controller should be running on a client computer, not a server. Your server will probably serialize a Model to send to the client so it can use it in a view, but otherwise the boundaries should be very clear.
    Why does this help with the problem of creating desktop-like applications? Because when all the view logic is located on the client, there are no limitations to the interactivity. For an example, think about infinite scrolling like you see in Yahoo Mail (I usually rip on Yahoo, so I thought this would be a nice change of pace.) If the view of the list of your emails is formed on a Yahoo server, then to scroll past the bottom means recalculating that view on a Yahoo server, even if it is to show one more email that is just past the bottom of the list. If you had to do it that way, you would not allow scrolling. You would force pagination, like GMail does. However, if you already have the code for creating that view on the client, then all you need on the client is the data to display.

Servers Are for Services

    The beauty of this pattern is that your servers become specialized in serving up data, not HTML. There is still some overhead in de-serializing the request and serializing the response and making it all work over HTTP, but it’s a lot less than the alternatives. Of course it’s not a read-only world, so you’re not just sending out data. You are also receiving changes to the data, either directly, or (hopefully) via a service interface. Just because we’re getting clever with our presentation design, doesn’t mean our middle-tier design can be garbage.
    Notice I used the Service word. This is the same word used by those SOA guys, and it means the same thing. There’s no reason that the clients that you build for your service (in this case user interfaces) cannot leverage the same infrastructure that clients built by other folks use. Now you may want to expose more services to the user interfaces that you built, or maybe you don’t... The point is that if you decouple the so called business logic of your system, then it is easy to build Network Applications that provide rich user interfaces to the end users of your system.

Implementations of the Pattern

    Like most patterns, this was one has emerged from implementations. It is not something I dreamed up in my ivory tower in San Jose. One of my favorites is the Google Web Toolkit. GWT let’s you build things kind of like you would for the old-school thick clients using Swing, but it turns around, turns everything into code that runs on the client. One of my friends was starting to learn GWT recently and I think he was surprised when I told him that everything in GWT becomes static assets that can be served up by any web server directly. They are very cache-able assets as well... There are GWT ways to hook up your server calls as well, and of course this does require a Java application server. But that part of your code can be done in JavaScript, using GWT’s JavaScript Native Interface (JSNI.) The nice thing about using the GWT server code is that you get to use the same object model on client and server.
    GWT is tied to JavaScript, and thus it inherits the limitations of JavaScript. My other favorite implementation of the pattern is Adobe Flex. Flex Builder 3 even has code generators for creating Java or PHP data services for communicating to your Flex application. Flex applications run inside the Flash player, and don’t have nearly as many limitations as JavaScript applications. Flex applications are usually much bigger than JavaScript ones, but are also very cache-able. Bandwidth is becoming less of an issue in terms of user experience, though it is still a cost issue.

The Moral of the Story

    If you are a UI engineer, you should not be writing HTML. You should only be writing code that executes on the client. There are many other options out there. In the JavaScript world, there’s Dojo’s Dijit, the Yahoo UI Library, even script.aculo.us. Ruby on Rails’ RJS has some similarities to GWT, but is not there yet. The Rails guys are still perfecting the last generation of web applications, and have not moved on yet :-) Straddling the JS and non-JS worlds is OpenLaszlo. I would be more enthusiastic about Laszlo if it was using new Flash technologies. On the non-JS side, the two chief non-Flash entities are Microsoft’s Silverlight and JavaFX.
    Now again, these are all technologies that can be used with this pattern. They can also be used outside of the pattern, though I would say that is probably a mistake :-)

Friday, November 09, 2007

FUD by Doug Crockford

I like some of Yahoo's Doug Crockford's ideas on JavaScript. So I watched this talk by him on the State of Ajax. It has a great buildup on the history of computing and comparing pre-Ajax web apps to the IBM 3270. He's also a clearly opinionated guy, but he really lets this influence his statements. Examples...

He claims that Java applets failed primarily because of "write once, run anywhere" was a broken promise. That's ridiculous. First off Java applets only needed to succeed on Windows, so write once, run anywhere was irrelevant for a desktop technology. He does correctly state that Java UI (AWT) was no good. He commits a lie of omission, by failing to mention Microsoft's JVM infringements. He then says that Java succeeded on the server because (wait for it) write once, run anywhere is not an issue on the server. Not only is this wrong, it's the opposite of the truth. When I first started writing Java server apps in 2000, I was writing it on Windows and deploying it to Solaris.

Next he heaps praise on JScript and says that its "bugs" were just reproductions of Netscape's bugs. There is some truth in this, but it certainly shows his bias. He states that JScript inveted XMLHttpRequest and that there no innovations for five years after that until Jesse James Garret "discovered" Ajax.

He completely ignores Flash. Earlier he states that write once, run anywhere is really difficult and anybody that can pull it off deserves credit. Well Flash pulls it off. He claims that JavaScript pulls it off, but that's just plain wrong. I don't know how somebody who knows JavaScript so well can state this. He's smart enough to know all about doing browser sniffing and conditional logic based on the results of that sniff.

Thursday, November 08, 2007

Flock 1.0

In case you missed the news, Flock finally went 1.0 late last month. I've been playing around with Flock for over a year. They're integration with social services has gotten better and better. I did a clean install of it and setup my Flickr, YouTube, and Blogger accounts very easily. I've given up on using it for RSS, as having a server-based solution (Google Reader) is too valuable to me. They've also added Facebook and Twitter integration, two favorite services of mine. Both are well done. And of course it's based off Firefox 2.0 now, which is great. Most Firefox plugins work great with it. I'm using its blog writer right now, as I'm planning on using it as my primary for a week or so and then figure out if I should go back to Firefox or not.

Blogged with Flock

Saturday, November 03, 2007

Big Foosball Gamez

I thought about writing about Open Social, but I'll leave that to Terry for now. Besides, football is more interesting, at least this week. I'm very pleased to see Florida's defense finally stop somebody, even if it was just Vanderbilt. Vandy's defense was ranked #14 in the country, which just shows how good Florida's offense is. Last week's game against Georgia would have been a lot different if Tebow hadn't got his shoulder dinged the week before. He's Florida's "conservative" offense, i.e. their ball control offense. The running game is an option running game, i.e. it is geared towards big plays. I'm not saying Florida would have won, that would be crazy. But Georgia had plenty of time to expose Florida's weak run defense, and boy they did a good job of that!

Anyways, the NFL is where all the hype is this week. That's one nice thing in college football. You have a lot of "game of the year" type games, seemingly every week. That's a direct consequence of the no playoff system where every loss is potentially catastrophic. People want a playoff (me included,) but just remember what you'll lose if you get that. This week has a game of the year in the NFL: New England at Indianapolis.

I hate New England. I'm a Dolphin fan (please no snickers) so I have to hate them. But I respect them. I respect using technology to "cheat". I so wish Miami was doing that, though I wouldn't want them to get caught. They really need those draft picks. I also respect running up the score. This is not high school or even college (both places where you see much more running up the score) where you could maybe have sympathy on an over-matched team. Nope, it's the NFL: home of the Marxist salary cap. Everyone is making crazy money, including the coaches. There's no room for sympathy. Now, personally I would probably be more careful about exposing my starters to injuries in meaningless games, but whatever. That's their risk to take.

All that being said... I hate New England. I don't mind Peyton Manning too much. After all, he never beat Florida and he can never change that. So go Indy.

On a more a logical basis, New England's offense doesn't match up that well to Indy's defense. The whole premise of Cover-2 is to minimize big plays. It takes a big armed QB to hit the deep gaps in a good Cover-2, and Tom Brady does not have a big arm. That doesn't take anything away from him. Brady is one a few great QB's without a great arm. Cover-2 with good safety play should neutralize Moss and Stallworth. I still think teams should be able to run on Indy, but have a hard time believing that New England will be the first team to do that effectively.

Indy's offense is more diverse and has been executing against defenses every bit as good as New England's. Recent history seems to indicate that Belichick has not been able to "solve" Peyton Manning for the last couple of years. Without a strategic advantage, New England's defense does not stack up well against Indy's offense. The opposite cannot be said. So, clearly you gotta go with the home-dog Colts.

Friday, November 02, 2007

ActionScript Getters and Setters

It's always nice when a programming language surprises you in a pleasant way. ActionScript 3 has get/set property syntax, very similar to C#:


public class Person implements IPerson
{
private var m_name:String;

public function get name():String
{
return m_name;
}

public function set name(value:String):void
{
m_name = value;
}
}

What was an even nicer surprise is that you can define properties in an ActionScript interface:


public interface IPerson
{
function get name():String;
function set name(value:String):void;
}

And then write code that makes it look like you're accessing the field of an inteface:


var person:IPerson = new Person();
person.name = "Michael";

Now if only we had this syntactic sugar in Java... 

Wednesday, October 31, 2007

Bad Writing

I like reading Marc Andreessen's blog. He has good insight. Today I saw the news about Google's Open Social initiative. I noticed that Ning was a participant, so I figured Marc would have something interesting to say about it. Reading his entry reminded me of many other entries by him and how incredibly annoying his writing style is. Let me give some qualification to this statement.

My 10th grade English teacher, Dr. Deluzain, was really tough. He made all of his students write a lot, and he absolutely tore up everything you wrote. I give him tons of credit for making me into a decent writer. In college, the biggest advantage I had over other Caltech students was not my mathematical abilities, it was my writing skill. Math bailed me out in many situations, and led to my only A+ (in quantum chemistry if you can believe that,) but I was always the best writer in every "soft" (literature, history, political science, etc.) class I took. Thanks Dr. D.

One of the lessons I learned from Dr. Deluzain was that you should never use styling in writing. This was 1991, so word processing had become popular. Of course people wanted to use bold and italics, or large fonts, to drive home points. Dr. D. taught me this was obnoxious and unnecessary. It showed poor skill. If you had to resort to such tactics to emphasize your point, then obviously you were doing so to make up for a lack of writing skill.

Fast forward back to the pmarca blog. Andreessen has to be the worst person I've ever seen at using italics and bold all over the place. Normally I just ignore it. College taught me that most technical people never need to hone their writing skills, so why should Andreessen be any different. The first full paragraph (most of his first few paragraphs are actually just sentences, but I digress) has 102 words in. Of those, 27 words are either bold or italics. Of the other 75 words, 21 are in quotations, which is a similar sign of poor writing (one I'm guilty of too, though it's not quite as bad.) It just makes my head hurt. I hate being a writing snob, but I needed to vent and that's part of what my blog is for.

I dislike writers who can only bring up negatives and never offer solutions to problems. So I decided to re-write his paragraph. I tried to keep his words as much as possible.

"Technically, Open Social is implemented as what I call a plugin API, or a Level 2 platform. In other words, it's not a web services API -- rather, it's a way for external applications to plug into a host environment (container). The external app literally shows up insides the pages of the container, and can make Javascript calls to retrieve information from the container and perform functions within the container. For example you can make a Javascript call to get a list of all of the user's friends, or to inject an event into the user's activity feed."

Isn't actually a lot less work to write it like this? Or has the web redefined good writing style? Maybe my way is antiquated and Marc's is exemplary...

Monday, October 29, 2007

A-Rod's The Man

Why is A-Rod leaving New York? Why did he announce it last night?

I think A-Rod is leaving because he can. He doesn't like it there, and can at least get the same money somewhere else. People keep saying "Boras must know that they can get better money from another team" but I don't think it has to be better. And that answers the second question.

The best way to sell A-Rod is not on his stats, as impressive as they are. The best way to sell him is on his potential economic impact to a team. The best way to emphasize that is to make sure that A-Rod is the story in baseball. That would not have happened if Boras had waited ten days past the World Series to announce A-Rod is opting out of his contract. Nope. But by announcing it while a lot of people were still paying attention to baseball, i.e. during the World Series, then he smoothly transitions all those World Series watchers into A-Rod watchers.

Boras doesn't have a deal in place already. He's going to have to work for his money, and this is part of how he's going to do it. His client wanted out of New York, and he's just doing his best given that situation.

So all the idiot Yankees fans (which is not all of them...) are getting their wish. No more A-Rod. The Yanks have a lot of money to spend on replacing A-Rod, so that should make for an interesting offseason in the Bronx.

For what it's worth, A-Rod has clearly made the right decision. Any other city would have worshiped A-Rod unconditionally before this season, and would be ready to rename their city after him at this point. I should know, I live in the Bay Area. Barry Bonds is the worst player to root for in baseball history since Ty Cobb, and he is completely adored in San Francisco. A-Rod is nowhere near as unlikeable as Bonds and is almost as good (especially if you consider position.) Plus look at the "new" ownership of the Yankees. They parted ways with Joe Torre and now A-Rod, and in both cases the owners felt the need to talk trash to the press. How old are these guys? It's just amazingly juvenile.

Mac Java 6

There's been a lot of developers upset that Leopard does not include Java 6. Does this make the Mac a poor choice of Java developers? No, it doesn't, not yet at least.

First of all, I fully expect that Apple will release an update to Leopard that will include Java 6 before the end of the year. But it doesn't matter too much because Java 6 was mostly a performance release for Sun. There's some nice things in the Swing implementation included on Hot Spot. Neither one of these things is even relevant for Apple. There are some language features (debugging, StAX parser) but these are pretty minor.

So to me it doesn't matter too much that there is no Java 6 for the Mac. Oh, but there actually is, or was. I personally had some problems with it, so I wasn't too surprised that it's no longer available from Apple.

Things only become problematic if Apple takes a long time to support Java 7 when it comes out, especially if you assume there will be a lot of language changes in Java 7. If that happens, then it could be conceivable that developers won't be able to use OSX. Others have pointed out that a major litmus is Eclipse. If Eclipse will run on OSX, then all is well. Eclipse 3.3 was released just a few months ago and was the first version of Eclipse to require Java 5... Eclipse is obviously important for Java developers, but also for Flex developers and even PHP developers.

Sunday, October 28, 2007

MoneySox

Obviously the Red Sox sweep was not surprising to me. I'm not a particular fan of the Red Sox, even though I thought they would win the World Series. If there is one endearing quality about them it's that the Red Sox are in a lot of ways an affirmation of Billy Beane and his analytic approach to baseball made famous in Michael Lewis's Moneyball. Theo Epstein is definitely from the same school of thought as Beane and it shows. The 2007 had a distinctive Moneyball feel to them, with patient hitters like Dustin Pedroia and Kevin Youkilis (Beane's "Greek god of walks" after all). Hideki Okajima is so reminiscent of Chad Bradford in Moneyball, and you could easily imagine Billy Bean building big stats for his hard-tossing closer, Jonathan Papelbon, and then trading him for a slew of underrated talent. Of course The A's would never have the money to sign other guys that Beane would love like David Ortiz, Manny Ramirez, J.D. Drew, and Mike Lowell. Would Beane like a guy like Josh Beckett? He typifies a lot of what Beane avoids (big, hard throwing right hander) though he certainly has put up some impressive numbers over the years. Anyways, if you're a fan of Billy Beane and Moneyball, then you probably had to root for the Red Sox.

Thursday, October 25, 2007

TextMate and the Weak Dollar

I started using TextMate as it is very popular with the Ruby on Rails crowd and I am writing a book on Rails. It is a great product, and I like using for all kinds of things now. So once my 30-day trial expired, I decided to purchase it. They use PayPal for processing payments, and they charge you in Euros. Luckily, PayPal easily handles the conversion for us Yankees. This brought a brutal reminder of just how weak the US Dollar is now:




1 U.S. Dollar = 0.68 Euros ... Ouch! Suddenly TextMate seemed like a pretty expensive text editor. I still bought it, but it really made me second-guess the most recent Federal Reserve rate cuts. That gives me one more reason to vote for Ron Paul!

Wednesday, October 24, 2007

Flash CS3 and SWCs

A co-worker called me up recently to ask me how to use a SWC with Flash CS3... A SWC is a collection of compiled ActionScript classes, similar to a DLL or JAR. They are very easy to use with Flex Builder and the Flex compilers. In this case, there was a SWC that I had created that my co-worker wanted to use in his Flash project. I knew that this was a pain. 

Flash CS3 thinks that SWCs are for UI components. You can create a SWC with a manifest.xml (in Flex Builder), drop it into your components directory, and use it. That's great for UI components, but not for class libraries.

On an older project, the developers using my library just linked to the source code directly to compile. I told the new developer to do that, but he quickly pointed out that the new version of my library used Adobe's corelib library... which is also a SWC. 

So the first thing I did was take the source of corelib and zip it together with the source code of my library to give to the developer. Now he could work while I solved this SWC problem. I saw a post on the corelib group site, but it did not quite solve my problem. So I emailed one of the corelib developers from Adobe.

He thought I should be able to add any SWC to the CS3 project's classpath (file->publish settings -> flash.) That did not work. I was able to compile against classes in the SWC, but got runtime errors equivalent to a Java NoClassDefError. 

About the same time, I was reading some documentation on PureMVC, an AS framework that looks promising to me. I noticed that it was supposed to be able to work with Flash CS3 and it was distributed as a SWC. I read the install directions for CS3 ... they indicated that you needed to use the source code, not the SWC.

So now I'm thinking that there may not be a solution to this problem. Maybe this is a bug in Flash CS3?

Monday, October 22, 2007

World Series Predictions

My LCS predictions wound up being pretty good! I started writing this a couple of days ago and forgot about it. Now I've got to finish it as the first pitch is being thrown...

Rob Neyer speculated a 60% probability of Boston winning. That seems pretty plausible from a statistical point of view. Boston has better hitting and much better pitching. I've seen some nonsense about how Colorado's pitching was great after the All-Star break, but that is a cherry-picked stat. Maybe it was great because they played more road games and against lesser competition? Their line-up stands up pretty well side-by-side to the Red Sox, but their pitching is not even close.

So... yeah Red Sox in 5 seems appealing. That would have Beckett getting a chance to clinch, though it would be at Coors Field. 

Sunday, October 21, 2007

Ning Code

I was leisurely sifting through feeds in Google Reader when I came across a new one from the Ning dev blog. It was about enabling public feeds in private networks. They explained why this was a hard problem (it is) but how you could enable it given some security caveats (so far so good.) One of the keys is changing the source code for your network, which is very cool. That's where the coolness ends. Here's an excerpt:

To change the display code, first visit the file /lib/XG_TemplateHelpers.php and find the function xg_autodiscovery_link(). Remove the if (XG_App::appIsPrivate()) { return; } text (but leave the ?> at the end of that line.)

Next, visit the various templates that might display RSS links. These files are:

  • /widgets/forum/templates/category/list.php
  • /widgets/forum/templates/topic/list.php
  • /widgets/forum/templates/topic/show.php

That list is actually much longer, but you get the point. Umm, hasn't anyone here ever heard of encapsulation? PHP supports OOP, or at least enough of it to easily hide this particular flag so you don't have to remote it in twelve places!

Saturday, October 20, 2007

Attributes vs. Elements

I was reading an article on developerWorks that I didn't write... It was about XML and Java. Sound like a tired, old subject? This had an interesting take: How the choices you make when writing XML influence your Java application code. One of the central themes was on using Attributes vs. Elements. One of the basic points was that using attributes leads to faster code. I decided to test this theory.

I took a pretty simple XML document. It was actually one that I had written recently for a real problem. I created two versions of the same document. One used elements exclusively. The other used attributes whenever it was possible. I then tested how fast it was to access two pieces of data. One was "shallow", i.e. near the root of the document. The other was heavily nested. In both examples, the data was an attribute in the attribute favored approach. I repeated the test over 10,000 iterations and tested it against three XML parsing technologies: the standard DOM implementation included with Java 6, using XPath with dom4j, and using the StAX implementation included with Java 6. For the DOM and dom4j techniques, I also examined the parsing time.

The results were a little surprising. I found no differences with attributes vs. elements for DOM. This was true for both traversing the tree and for parse time. I don't mean a negligible difference, I mean no difference at all. It was so surprising that I had to double check my code a few times. The big difference for DOM was that the code for the attribute favored approach was definitely simpler, which was one of the points in the developerWorks aritcle.

The dom4j story was different. It was slightly faster to parse the attribute document, but it was a bit faster to retrieve values on the element document. I was surprised by this, but the differences were very small, probably not statistically significant (I didn't test this, though.) The code was virtually identical, of course, since we were using XPath for the traversal. The dom4j was much slower than the DOM approach, which is again not too surprising.

Finally, the StAX tests showed faster results for the attributes document. There was a larger difference than in any of the other tests. This makes sense because you don't have to go as far in to the attributes document (a start element event contains the attribute data, but does not contain text child node) and there are less events fired in an attribute document vs. an elements document. For example, bar is three events, but is two events. Also, StAX was faster than either DOM or dom4j, as you would expect. The StAX code for the attributes document was also slightly simpler than it was for the elements document.

So if you're using DOM or StAX, you should definitely favor attributes over elements. It will be less code and in the StAX case, faster code. If you're running dom4j and XPath (or maybe XQuery) based navigation, then it doesn't matter as much and elements based seems ok. This really is important, as a lot of these "modern" RESTful web services are heavy on the elements format over the attributes format. This is doubly bad for web services, since there's obviously a much larger byte-cost on elements style documents.

Update: As request, I am attaching the source code I wrote for this little micro-bench. I tweaked it a little as I realized there was an inefficiency in one of my dom4j methods. This tweak made dom4j faster on the attributes document, which is more consistent with the rest of the results. To run the code, you need dom4j and you need either Java 6 or Java 5 plus a StAX implementation. I ran it on my MacBook under Java 5 using Sun's StAX parser.

Friday, October 19, 2007

GWT and XForms Series, Parts 3 and 4

The last two parts of the GWT and XForms series I wrote for IBM are up now: Part 3 and Part 4. Part 4 is fun since it is more "icing on the cake" kind of stuff as opposed to the core integration of the two technologies. I really wanted to work in some info GWT's ImageBundles. It's a slick implementation of the CSS sprite pattern.

Continuing down that tangent... I'd like to see an ActionScript implementation of that pattern. It would be cool to take a dozen images in Flex Builder, have it create a composite, and then use that for any references to those images in your Flex application. Of course maybe it's not needed. If you knew you needed those dozen images for your app, you could just embed them all in your SWF. That's going to be even more efficient since you won't have to make the HTTP request for the composite image. Obviously there are advantages to externalizing, since you could change the composite image without recompiling your SWF and without having to worry about referencing a new version of your SWF that's not being cached by users. It also allows for localization of the images. Enough rambling on that topic for now.

Wednesday, October 17, 2007

New IBM Tutorial on XUL

I wrote a tutorial on XUL for IBM. It's a very introductory look at XUL. You can do some seriously crazy programming in XUL. The focus of the tutorial is on how web skills can be leveraged in XUL. Adobe AIR is getting a lot of press right now (and deservedly so) for letting web developers bust out some desktop apps. XUL lets you do the same thing. It's definitely a little more complicated than AIR, but also much more powerful. XUL gives you access to a lot more desktop resources than AIR does. Plus, if there's something that it doesn't already give you, then you can just write some native code and expose it via XPCOM. I think a lot of AIR developers are already begging for this kind of extensibility.

Tuesday, October 16, 2007

Graduation

I've been listening to a lot of new music lately. If you notice my last.fm widget on the blog, then you can probably guess what my favorite has been so far: Graduation by Kanye West. The only problem with Graduation is the beginning. The first four tracks are weak. Everything after that is rock solid. I absolutely love Flashing Lights and Big Brother. The first four tracks keep this from being as good as Late Registration, but it's still easily way better than anything by West's contemporaries, including his big bro' Jay-Z.

Leopard

Am I going to buy Leopard? Take a look at this desktop...



Yep, I think I need stacks.

Monday, October 15, 2007

San Jose Half-Marathon

Yesterday I ran in my first half-marathon. It was a really amazing experience. Just running with 11000 other people is crazy and cool. I was very happy with my time, 2:03:52. I was very tired at the end, and I'm still a little sore the next day. I will definitely run another half marathon next year (gotta crack 2 hrs!) maybe in the San Francisco Marathon in July. Who knows. For now, I'm going to ease up on the running the rest of the year and probably swim a lot more. Running a half was my #2 resolution for 2007. It's nice to cross it off the list!

Wednesday, October 10, 2007

Radiohead Update

I got the "your download is ready" email last night. I was already asleep, so I didn't read it until this morning. I clicked the download link and voila, In Rainbows downloaded very quickly to my computer. It was a 48.4 MB zip archive of 10 MP3s. The MP3s were 160 KB CBR, which is a little disappointing. There was a lot of speculation that they would be 320 KB CBR. Actually 160 KB VBR would have been pleasing to me. Are there any MP3 players that have problems with VBR? It's superior to CBR in every way, especially @ 160 KB.

Anyways, everything was very smooth and fast. I was able to re-use the same link again from another computer. This is very nice and convenient. It looks like pre-ordering was definitely the way to go. I read this bit on NME about the official Radiohead site going down. What's interesting is that In Rainbows is not distributed from the official site. So the distribution site was obviously able to hold up to huge traffic and bandwidth demand, but the band's homepage did not. Maybe they should just move their homepage to MySpace like everybody else and let those guys deal with the infrastructure.

Neighborhoods

What do you get when you mix social networking and free market e-commerce? eBay Neighborhoods of course. This was just launched this week. It has some extra relevance for me as it was the first new eBay feature that I was involved in. So it's nice to see that it's getting some good press.

Tuesday, October 09, 2007

First Radiohead, Now NIN

As I await my email from Radiohead giving me a link to download their new, um , release tomorrow, I found a similar story that made me rejoice. My favorite band, Nine Inch Nails, has gone free agent. No more record company for Trent Reznor. This is the same guy who used camcorders, Final Cut, and a couple of Macs to create a concert collection video. Most of the truly awesome Year Zero recording from this year was recorded on Trent's MacBook Pro. Heck, he even release the Garage Band tracks for several of the songs so fans could have fun remixing the songs. The marketing for Year Zero has become infamous for its viral/guerilla tactics. Given all that, what was the function for a record company for NIN?

So will the next NIN recording be free like Radiohead's new one? That is a very interesting question. One must assume that without a record company, it will be a digital download only. In that case, it has to be DRM-free. It is expensive and complicated to do a DRM scheme (requires dedicated servers after all) and obviously distasteful for artists. Of course NIN could go the iTunes route. He obviously has an affinity for Apple products. Even if it is DRM-free (probably 320kbs MP3s, same as Radiohead is expected to release and same as NIN distributed on thumb drives as part of the Year Zero marketing) it does not necessarily mean it will be free (or pay whatever you want like Radiohead.) Still, I would definitely not be surprised if it was free. NIN has one of the great live shows in all of rock, and touring will always be a huge thing for them.

New GWT + XForms Series

I wrote a four-part series for IBM on using Google Web Toolkit and XForms together. Somehow IBM snuck part 1 and part 2 by me on their site. The tutorial uses JSNI a lot and touches on some of the latest features in GWT.

Monday, October 08, 2007

League Championship Series Predictions

Well at least I got the American League right... The biggest surprise by far was Arizona beating Chicago. Arizona does have good pitching (114 ERA+) but their hitting is terrible (88 OPS+.) I don't just mean below average either, it was the worst hitting in the NL. They had a .321 OBP as a team in a hitter-friendly park.

So obviously I must pick against Arizona, again. Everyone is billing this as the great offense (Colorado) vs. the great pitching (Arizona.) Colorado's pitching is actually quite good as well. Not as good as Arizona's, but much closer than most people would think. Colorado's pitching was 4th best in the NL (110 ERA+, behind Arizona, Chicago, and San Diego.) Coors Field was once again the most hitter friendly ballpark which lead to the second most runs scored. If you're not an idiot and take into account Coors Field, then their hitting was only 6th best in the NL, but still much better than the Chicago. Whatever, Colorado is Murder's Row when compared to Arizona. Colorado in 5.

Boston and Cleveland both had a little easier time with their opponents than expected, but you had to expect these two teams to be here. They were both very balanced, very good teams. Boston had the third best hitting, Cleveland was tied for fourth. Boston had the best pitching, and Cleveland had the third best pitching. Boston has a clear edge over Cleveland, but this should be a very close series... The Sabathia/Carmona combo looks a lot more intimidating against Boston than it did against New York. However, I had really forgotten just how bad Joe Borowski is until I had to watch him pitch the last two days. Boston's pitching is so good that Borowski will have to notch 2-3 saves for Cleveland to win. I just can't see that happening. Boston in 7.

Sunday, October 07, 2007

New Music Shopping List

I went shopping for some new music yesterday. The list:

The Reminder by Feist
Robbers & Cowards by Cold War Kids
The Shepherd's Dog by Iron & Wine
Kala by M.I.A.
Fort Nightly by White Rabbits
Graduation by Kanye West

(Yes I find it amusing that a search for any artist will find their MySpace page in the top 3 results.)

So far I've only listened to Feist and the verdict is still out.

Friday, October 05, 2007

Free Radiohead

You might have heard that Radiohead is offering their new, um album (this word seems antiquated, but so does CD, we need a new term), In Rainbows as a digital download. The "clever" part is that they let you name your own price. I've heard stuff on TV about this as well as bloggers talking about it. A lot of people have seemed to think that most people will pay a "reasonable" price. That just seemed ridiculous to me. I think most people will choose to exactly $0.00.

I went on their site and made a pre-order. I chose for the price $0.00 (well actually it was in British pounds, but 0 is still 0.) There was some mention of a potential transaction fee. However, I went through the whole process and there was no transaction fee. I completed the pre-order for $0.00. The site even seemed prepared for this and didn't bother asking me for a credit card because the price was $0.00. They did ask for all kinds of other stuff, like street address and mobile phone number. I put in bogus stuff for all that. They wanted an email address, and that's important. They email you the download details on October 10, the release date for In Rainbows.

So basically the price of the whole thing is your email address. Anything else you pay is just your charity to Radiohead. This may seem cynical, but it is reality from an economic standpoint. This is literally Radiohead's proverbial donation hat.

Why then is Radiohead doing this? Well they are selling a "deluxe version" in a fancy box with a vinyl LP of In Rainbows for $82. So they are giving their more devoted fans a chance to blow some serious cash. Otherwise they are clearly using this as a way to generate attendance for a tour, where they will make a lot of money. Presumably they will make more than enough money on the tour to pay for the cost of the infrastructure used to distribute the In Rainbows on the wire.

I don't know of any tour dates being announced yet. So maybe they are just crazy? Yeah, maybe.

Tuesday, October 02, 2007

Division Series Predictions

I have no emotional ties to any of the teams in the playoffs, so from a purely statistical standpoint... 

Rockies vs. Phillies -- The Phillies had the best offense, but the Rockies were slightly better overall. Their pitching was much better despite playing at Coors Field. Turn it around and you can say that Philly's hitting was better even though they did not play at Coors Field. With teams like these, you must consider home park effects. Colorado score 1.11 more runs per game at home than on the road. Philly scored 0.1. Colorado surrendered 0.36 more runs per game at home than on the road, and Philly gaved up 0.26 more run per game at home. Seems like the pitching-sucks-because-we're-at-home angle cancels out. The hitting does not. So you gotta say big advantage to Philadelphia.
Prediction: Philadelphia in 3

Diamondbacks vs. Cubs -- Obviously Arizona was incredibly lucky this season. They are not a good team. Good teams outscore their opponents. Both teams pitch very well (#1 and #2 in ERA+ in the NL) but neither is partciularly good at swinging the bat (or taking a pitch for that matter.) Chicago is better though. Low scoring games tend to be more random though, so this series will be closer than it should be.
Prediction: Chicago in 4

Red Sox vs. Angels -- Boston is superior in every way. The Angels are a good team, don't get me wrong. They are notorious for their lack of power and plate discipline, but still managed a 105 OPS+ as a team. Their pitching is viewed as their strength, and it's good too with a 103 ERA+. Good, but they should be crushed by Boston.
Prediction: Boston in 4

Yankees vs. Indians -- The Yankees offense is amazing, but their pitching is so-so at best. Cleveland is solid on both offense and defense. I don't think they can shut down the Yankees offense, I don't care if they do have the two best pitchers in the league. This is going to be a wild series, as any series with the Yankees would be.
Prediction: Indians in 5

MTOM Article on TheServerSide

My second article for the TheServerSide is up. Like the first one I did for TSS, this one is on WSO2. The article is all about how easy WSO2 makes it to use MTOM for sending SOAP messages with binary data attached to them, as well as the advantages of using MTOM in the first place. Products like WSO2 are making it pretty painless to use SOAP and its "advanced" features like MTOM. This article explains some of that magic.

Monday, October 01, 2007

eBay Desktop

I generally don't blog about my employer too much. But eBay officially released a very cool piece of software today, eBay Desktop. This is the beta product formerly known as San Dimas. It is an Adobe AIR product allowing you to do pretty much all things eBay related from a snazzy desktop application. Read all about it on eBay evangelist Alan Lewis's blog.

Saturday, September 29, 2007

Fantasy Baseball

The baseball regular season is almost over, thus fantasy baseball is almost over. I had three teams this year, two on ESPN and one on Yahoo. All three were free, but ESPN's service is far superior to Yahoo's. With ESPN you get live scoring, so at any time you can login and see how your team is doing. That's enough reason right there to play ESPN over Yahoo. I found that Yahoo's player news was not nearly as good as ESPN's. There were numerous times that it didn't indicate that a pitcher was going to be starting until just hours before the game actually started. This info was always available 24-48 hours earlier on ESPN. I wound up relying on ESPN to figure out which of my pitchers on Yahoo were starting.

Of course maybe my opinions are horribly biased. My two ESPN teams are winning their leagues easily, but my Yahoo team is in 8th place. So maybe I think ESPN's game is superior just because I've had more success on there.

Anyways, the end of the season gives me a chance to reflect on players that I did a good job of predicting their performance as well as ones that I did not. I had several players that drafted in all of my leagues because I was sure that they would outperform expectations. I also had some that I was sure would under-perform. Here's the ones that I was especially high on.

Chase Utley
Matt Holliday
Mark Teahen
John Smoltz
C.C. Sabathia
Ben Sheets

Five of the six were pretty good, four of the six really good. Obviously Teahen was the big disappointment on the list, and the biggest reach. So it's ok that he bombed, since he was a very late round draft pick. Sheets was also fairly cheap. He may not have been a slam dunk, but his team yielded my best free agent pickup: Ryan Braun. I picked him up on all three teams, and he's been amazing.

I did have one huge screw-up though. That was Carlos Pena. I picked him up in May, and gave up on him because he wasn't playing everyday. This was especially bad for my Yahoo team that never had a good first basemen all season.

So what about predictions for next year... Eh, it's football season. Ask me again in January.

No Silverlight for You

I attended an MSDN talk this week on Silverlight. It was given by Microsoft evangelist Anand Iyer. If you've been to any Microsoft developer centric events in the Bay Area, chances are that you've got to listen to Anand. He's an excellent speaker and this week's talks were no different. One of the things that makes his talks so good is the honesty. There's no BS, marketing spin.

My chief interest in Silverlight is as an "RIA" technology. I put RIA in quotes because there are different interpretations of that acronym. I was used to a definition similar to the one in Wikipedia: Rich Internet Application. The key in this definition is bringing a desktop-like experience to web applications.

Microsoft's definition is different. They call RIAs: Rich Interactive Applications. To them it is not about web applications with a desktop-like experience. It's about media. This may seem like a minor point, but actually it's the only point worth mentioning to me. It was the most important thing I took away from Anand's speech: Microsoft is only interested in rich media when it comes to Silverlight.

This seemed contradictory to me. After all, they've made a big deal about bringing the CLR to Silverlight 1.1. But Anand was crystal clear on this. If you want to build web applications, then you should be using ASP.NET and all of its great AJAX goodness. You can use Silverlight, but it's going to be very difficult as this is not the focus of Silverlight.

Indeed this message is consistent with the use of Silverlight. You can create a Silverlight application in Visual Studio 8, but you're going to be editing XAML, i.e. XML. Essentially you're creating low-level vector graphics commands wrapped in XML. One of the other attendees at the MSDN talk asked Anand if there is any kind of nice designer that was going to be built in to Visual Studio to make this easier and the answer was "Yes there will be a design view, but it is awful. You need to use Expression Blend."

And there it is. If you want to do Silverlight work, you need Blend. This is a tool made for designers and is not even available to MSDN subscribers. This tool is not meant for developers, and thus Silverlight is not meant for developers.

It's only meant for designers. It's only meant for creating animations or embedding video, etc. That's all Microsoft is going for. Imagine if Adobe got rid of Flex and said "you have to use Flash CS3." That's Microsoft's position.

Again with CLR support built into Silverlight, you might think that it's just a matter of time before it becomes a developer platform. But from what Anand had to say, it's going to be a long itme. There's not going to be developer support in Silverlight 1.1 and Visual Studio 8. VS8 won't be shipping until February and Silverlight 1.1 won't be shipping until next summer. Given that, I would have to guess that it will be at least two years before Silverlight becomes something that can be used by developers. That's truly disappointing.

Tuesday, September 25, 2007

LINQ

I'm attending an MSDN talk today on several subjects. The one I came for is Silverlight. The first session of the day was on LINQ. It was pretty interesting.

LINQ is a real weird bundle of syntax that is being added to C#. The speaker, Anand Iyer, mentioned that it will be implemented in Mono. First it adds a SQL syntax for slicing in memory data. The classic example is around doing sub-selection and ordering of a List. This is nice, but looks funny. Reminds me of Oracle's attempt to get people to write SQL in the middle of JSP pages.

The second part of LINQ is as an ORM for databases and XML. This winds up looking like a bizarre mix of EJB3 and ActiveRecord. Annotations are used to embed mapping (table to class, property to column, etc.) Or you can use "implied" bindings (convention over configuration-ish.) Obviously the latter gives you a lot less code to write. I think you can also use a mix of these things.

It's funny to watch a language evolve. C# started off copying Java, but improving on it. Like Java, it has started to envy some aspects of dynamic languages. Microsoft has been able to move much faster with C# than Sun has with Java. Of course a big part of that is that it's a younger, much less widely used language. The stuff in LINQ really allows for syntax that looks eerily like Ruby or Python with constructs like someObj.find(name=>"Bob") At the same time, you get to keep a lot IntelliSense, which is huge for developer productivity.

If you've ever wondered what Java would look like if you could mix-in Groovy, then take a look at LINQ. It's a mess. It really looks crazy. It even made the speaker crazy. He kept trying to correct indentation and spacing to make it look legible. I guess that's what we all have to look forward to in Java. It also makes me appreciate ActionScript. It's come from the other direction, starting out completely dynamic and becoming strongly typed (which bought them a 10x+ performance boost.) Look at a complex ActionScript 3.0 class and a C# class that uses LINQ. From a pure "grammarian" perspective, you will really appreciate AS3.

Monday, September 24, 2007

It's That Time Again

Time for Terry to fan the flames and listen to the ROR... In truth Terry is an avid Rails freelancer. He charges even less than what "average" PHP programmers charge for their hackin', just because he enjoys The Rails Way so much. When he says he is "sick" or "drunk", he's actually busy creating another blog site with Rails (he's up to twenty-four now, and is yet to write a single line of configuration.)

Thursday, September 20, 2007

Remembering

I was watching a clip of Move.On's Eli Parser defending their ad against General Petraeus. He made the analogy that he wished he could have attacked then Secretary of State, General Colin Powell after Powell presented the "facts" about Iraq's WMD program to the UN just before the Iraq War started. The brought back memories of the beginning of the war.

Where Were You When?
I'll never forget where I was when the war started. I was on a JetBlue plane going to Las Vegas. I was meeting up with all my old college buddies for the opening weekend of March Madness. JetBlue was DirecTV onboard, so I got to watch CNN showing live coverage of "Shock and Awe." It was a moment that really showed what generation I belong to: flying on a plane, watching satellite television of the beginning of a war in the Middle East. 

Obligatory "I told you so" Rant
Later on that evening in Vegas, I was sitting in the coffee shop of the Monte Carlo, where we were all staying. I was talking to two of my friends about what was going on in Iraq. My stance then was simple: Give the public the real reasons for the war and maybe it is justified, but don't give false reasons. We live in a democracy, and we can't undertake the ultimate act of a nation-state, war, without honest reasons for it. My father was the veteran of three wars, and he taught me that war is the most horrible thing in the world, but sometimes it is necessary. Was Iraq necessary? There's no way to answer that question without the real reasons.

Alan Greenspan
Which brings me to Alan Greenspan. You gotta figure this guy is feeling some heat with the housing bubble (that he certainly helped create) busting all around. Talk about terrible timing, too: he just released his memoirs. Can't imagine too many of those foreclosure "victims" will be buying that. It did contain one nugget that has turned into controversy. Greenspan claimed that the "Iraq war is largely about oil." 
Wait a minute, didn't I see people in the streets of San Francisco four years ago claiming this? Of course Greenspan has changed his story, I mean clarified his statement. But it brings up an interesting what-if.

Any Reason Will Do
What if the President was honest and had said in 2003 "we need to invade Iraq to secure strategic resources vital to our economy." I'm not saying that would have been honest, though maybe Greenspan thinks it would. Would people have gone along with it? There might have been a typical red-blue divide on it, much more of a divide than we saw back in 2003, but so what? 
There was a lot of blood lust in the air because of 9/11, and that was the biggest reason why people were willing for us to go to war. Not lies from the President. Not fear of WMDs. Not thirst for oil. Nope, it was a thirst for payback that Afghanistan did not quench. Any Arabic target with any reason might have done just fine. There was probably no need for Colin Powell to lie to the UN.

The Blood on Our Hands
That's what nobody wants to admit. You can't just blame Bush, Cheney, and Rumsfeld. We're all to blame. Look at all those Democrats who voted for the war, and who even now are reluctant to take real steps to bring it to an end. The American people would love to wash their hands of it now, but unfortunately it's not so easy. We're going to pay for this sin for a long time.

Wednesday, September 19, 2007

MX.Bloat

I've heard lots of folks complain about how using any ActionScript classes from Adobe causes extreme bloat. A lot of this is Flex framework related, and Adobe is hard at work at solving this problem by caching the framework on the Flash player. But sometimes it's even more subtle.

I was writing a library class today. I ran across two common problems. First, I needed to do some value based comparison. There should really be an equals method in ActionScript to make this trivial, but whatever. I came across this blog stating that you need to use the mx.utils.ObjectUtil class to do value based comparison. This is still not as good as having an equals method to override, because it's all or nothing, but it was good enough.

Next, I needed to do some rounding on a floating point number to a given precision. Once again there is something in ActionScript in the mx.formatters.NumberBase class. It has a formatRoundWithPrecision function that was exactly what was needed. It was a little awkward, since it takes in a String not a Number, but again whatever.

Using these two library classes caused my library to triple in size! The SWC went from 11kb to 38kb. I had added some other code, too, but it wasn't that much. So I stripped out these two function calls, implemented them myself. Now my SWC was back down to 13kb.

I knew using the Flex framework was expensive, but this was not the Flex framework. This was just a couple of utility classes.

Mint

Congrats to Mint for winning the TechCrunch40 Top Company award. I was recruited by Mint's VP of Engineering, David Michaels, earlier this year when Ludi Labs was winding down. I was very impressed with their technology. I was impressed with their business model, too, but what do I know about business models? I'm a lot harder to impress when it comes to technology. Apparently their business model is indeed pretty good. Seems like a killer combination: technology, business model, and now lots of press...

Tuesday, September 18, 2007

Facebook JavaScript

Just yesterday I was reading Marc Andreesen's latest musings on "platforms." He characterized Facebook's F8 platform as a plugin platform, where everything runs on your server but is shown inside the context of a page on Facebook. Technically he's wrong. If your application uses the Facebook Markup Language (FBML) then a Facebook server interprets the response from your server before sending a final response to the end user. After all, no browser supports FBML (yet?) so something has to turn it into HTML and JavaScript.

Of course a lot of applications don't use FBML at all, and use the IFrame approach instead. I am currently working on just such an application. My reason was not using FBML was simple: I needed JavaScript. I didn't even need complicated JavaScript. I just needed to let users click on an image, then set some hidden fields and submit a form. Pretty simple really, but not possible with FBML. Until today.

I go on Facebook this morning and what do I see? An announcement about Facebook JavaScript. I had actually seen this mentioned as being in beta a couple of weeks ago, and I guess it went from beta to production very rapidly.

Looking at its documentation, the were two puzzling things. First, you have to put your JS, err I mean FBJS, inside XML comments... That's a minor thing, and I can easily imagine how it simplifies their parsing of the response from your server. Next, they've wrapped almost all the DOM properties and methods. This makes sense, after all they don't want people to actually get the real DOM object and start screwing around with Facebook's real estate. But their wrapper uses getter/setters for all the properties ... That just seems arbitrary. If Facebook was written using Rails I would expect something like that, but I don't expect something like this from PHP guys.

There were also some very expected things. Like no JS runs on the profile unless it is triggered by what Facebook is calling an "active" event (like clicking on an image or link.) You can't subclass Array or Function. Does this prevent you from accessing their prototype and overriding default behavior?

Anyways, I am happy to see FBJS. I wish it would have been out sooner, as I think it could have simplified some work I've done in the past.

Monday, September 17, 2007

Unlucky Braves

My favorite baseball team, the Atlanta Braves, are just about out of the playoff picture. And that's too bad. Statistically, they are one of the best teams in the NL. If you use the Pythagorean formula, then Atlanta would have the second best record in the NL, just behind Arizona and just ahead of New York. In the "but that's why they play the game" world, the Braves have seven fewer wins then they should statistically. That's by far the most unlucky of any team in baseball. The most lucky by the way (no surprise here) is the Arizona Diamondbacks, who is in first place in the NL West despite having been outscored by their opponents.

Most people will blame the Braves pitching staff for their record. That's not really fair. They are middle of the pack in almost every pitching category, and are pretty (5th) in opponents on-base-percentage (despite the most intentional walks by far.) Oh, but it's the bullpen's fault, right? After all, the Braves cut their closer in the middle season. Nope, their bullpen is middle of the pack, too, in terms of blown saves and save percentage. It's not the pitching staff's fault. It's just bad luck. People hate to admit how important luck is in baseball.

If the Braves were having a luckier season, then Chipper Jones (my favorite player) would probably warrant some MVP votes. He had a DL stint which cost him in raw totals. Right now he leads the NL in batting, and is third in on-base percentage, second in slugging. He's second in runs created per 27 outs. He trails Barry Bonds in most of these categories. Yeah that Barry Bonds, the guy that everyone here in the Bay Area can't wait to get rid of at the end of the season.

As it is, it seems all but given that Prince Fielder will be NL MVP. Maybe Matt Holiday or Ryan Howard can sneak in there, just because RBIs are so overrated. Fielder's huge lead in homers and Milwaukee's feel good story seem like too much to overcome. As for the other individual awards:

  • NL Cy Yong: Jake Peavy in a landslide. If the season ended today, he'd win the triple crown!
  • AL MVP: Alex Rodriguez in a landslide. Magglio Ordononez will get some votes, since he leads the league in batting and is second to A-Rod in RBIs, but that's just silly. A-Rod leads the AL in HRs by 12! Oh and if anybody cares, he's by far the leader in both runs created and runs created per 27 outs.
  • AL Cy Young: Statistically no clear front runner. Can you believe there are eight AL pitchers with ERAs less than 3.50! Seems like most folks think it's a two pitcher race between Josh Beckett (leads the league in wins) and C.C. Sabathia. That's funny since C.C.'s teammate, Fausto Carmona, leads the league in ERA (just barely, but still) and has 17 wins just like C.C. I think Beckett will win it, just because Boston is the best team in AL by far.