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


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


I've been listening to a lot of new music lately. If you notice my 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.


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.


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.