A demo of jMaki: yet another unnecessary abstraction

No comments:
Doris Chen posted an screencast of jMaki in use (with Netbeans and Glassfish). It's unnecessary because a) jMaki isn't a good idea, b) the tooling looks cumbersome, and c) the end result looked really bad.

jMaki isn't a good idea because it's a taglib that tries to normalize the use of many javascript libraries by abstracting over them. In principle it reminds me of Apache's commons logging api, which is designed to abstract away the differences between Sun's logging API and log4j. This pattern of bad idea pervades the Java platform, unfortunately. Successful projects use succesful implementations, not just APIs. It's important to know Tomcat, not just the servlet APIs, and it's important to know log4j, not the commons API. And it's important to know jQuery and it's UI plugins, not jMaki. To do real work you're going to have to know the underlying JavaScript library anyway, so why bother with an abstraction that will just get in the way?

The Netbeans tooling looks rather cumbersome. I've been (re)reading Donald Norman's "The Design of Everyday Things" and was struck with how unruly Netbeans looked in the screancast. It's all the little things Doris has to do - find an obscure menu item to check that a plugin is installed, center the dialog box on her screen, search through a list of completely unrelated plugins to enable the one she wants, etc. Or when she drags a widget into the JSP and has to right-click and "format" the badly formatted text every time. Since when does dragging stuff create text? And why can't it format itself?

The final blow was that the end result looked (and sounded) like crap. The fish eye widget was layed out wrong, and the google map was too large and also layed out wrong. Putting sound in the page was just a bad idea - that's like adding blinking text. (Just because you can doesn't mean you should!)

Apologists would say (at least) that I'm nitpicking. At least the tools worked; and none of those things I mention are show stoppers, and any programmer who can't deal with a few tool quirks doesn't deserve his salary. And as for the end result looking bad, this was a programmer's demo, not a designer demo - it can all be fixed with some CSS edits later, done by a web designer.

My response is this: the tools work, but encourage errors. They encourage small errors of setup and use. But they encourage a much larger error: the tooling's "map" of the system is not that of the programmer's (or at least not this programmers). I fail to see what a JavaScript abstraction has to do with SVN, and yet these things are presented together in a dialog. I fail to see how a collection of text is a "widget" or why dragging would create text. And yes, I fail to see why I need a JavaScript abstraction in the first place that appears to do little more than substantially increase the complexity of my system.

I feel that IDE's are little more than glorified text-editors, and begin to fail when they themselves introduce abstractions. In a subtle way, the tooling begins to dictate the programmer's mental model of the design- and runtime of his system. In this case, it's nice that Netbeans can easily add a taglib to your web project. But it's not nice that this capability is expressed as a "plugin". It should be expressed as a macro or script: a macro that adds a jar or two there, a line of code to web.xml there, and adds some new JSP specific snippets (particularly taglib declaration and taglib instances). It may even remind you that you'll have to redeploy to get the effect. One concrete difference between a plugin and a script abstraction is that the Netbeans plugin method requires that you select the "plugin" on project creation.

The end result should look good because this kind of programming is all about the front-end. Widget positioning and sizing is not a trivial problem to be swept under the rug! Either jMaki or Netbeans needs to take better care to provide better defaults. And too, programmers are (hopefully) wary of these "slap it together" demos - everyone knows (or should know) that slapping stuff together is the easiest part of programming. It's fitting it all together professionally and solidly which takes time, effort and skill.

Illustrator Ninja

No comments:
Here is 40 hours of illustration condensed into 7 minutes by the remarkable Chad Pugh:


iPhone Invisible Shield Review

1 comment:
invisible shieldI scratched the screen of my iPhone a bit on my keys, and resolved to get a screen protector. I purchased the Invisible Shield from amazon.com for about $12. I followed the directions closely, and almost immediately noticed a reddish discoloration, and some subtle mottling - not bubbles but subtle irregularities in texture. I also noticed that the touch sensitivity of the screen was reduced. On two occasions keys that I did not intend to press were pressed and held - and it was the backspace key (which resulted in the loss of two fairly long text messages). Last night I removed the Invisible Shield. The difference was remarkable - my iPhone screen was brighter than it had been in 3 months, and the touch screen deliciously responsive. It was like getting a new iPhone.

I estimate that the cost to produce what is essentially a sticker has got to be very small - less than $1, which makes the asking price of $12 very high. (products of this nature are generally marked up by a factor of 5 or 6 - 12 is very high).

Given all of this, I cannot recommend the Invisible Shield. Given the pace of technological progress, it is better to endure the occasional scratch and eventually replace the device, especially if the usability of the device is reduced by that protection. I think that my iPhone's screen can last 4-5 years if I can manage to avoid putting my keys in the same pocket as the phone!

This is a photo of the removed Invisible Shield, clearly showing the reddish discoloration. Frankly, against the white napkin it looks much more dramatic than on an iPhone.



Having fun in Silverlake

No comments:

_MG_1334small
Originally uploaded by Christian Garrido
I love the composition of this shot I found on flickr. A great moment.

The limits of human art

No comments:
It is remarkable that a human can create anything larger than what can be contained in a canvas, or on a single sheet of paper. Novels, cars, software...these are monumentally complex objects, and if their true complexity were ever to be appreciated, I doubt anyone would have the heart to attempt their creation.

Despite the inherent difficulty, people still create large works, and sometimes successfully. That success is rare and precious, and should not be taken for granted.

Whole Foods mixed message

No comments:

Pink salt from the Himalayas. Millions of years old and harvested for
Whole Foods customers to the tune of about $16 per pound.

This is an example of a dilemma faced by Eco-tourists - they love
nature and want to preserve it, but they also want to hike in it and
enjoy it. But sometimes it's not possible to do both.

It's interesting to me that the same person who insists on organic
foods, recycled toilet paper and fuel efficient cars would buy
something so incredibly unsustainable as salt taken from the tallest
oldest mountains in the world.

Movie: How to Loose a Guy in 10 Days

No comments:
This is an old RomCom, and I'm only reviewing it because it was, like so many recent movies, both entertaining and troubling. Entertaining because it is in part a comedy of modern manners. Troubling because of it's rampant misogyny. And because it was recommended by a female friend I find it even more troubling.

The women in this picture are portrayed almost universally in a negative light. No, I get the premise - I understand that Kate Hudson's character "Andy" is trying to act like a crazy woman in order to push her love interest "Ben" away for the sake of a magazine article. I'm not really talking about those antics. I'm talking about her "real" behavior as a vapid, image-obsessed, vain, self-serving and manipulative woman. The other women who surround her are equally ethics-challenged and quite weak. "Mrs. Lauer", wife to the De Laur diamond magnate, is the classic cougar, in all her tasteless glory. In truth her over-the-top performance worked comedically.

The only positive role-models for women would be Ben's compeition. Two women given only cameos who seemed cool, collected, and focusedl. Of course, they still get beat out by the man though.

It troubles me that "reproductive fitness" for a woman in this movie (and in so many others) has been reduced down to having the right weight, clothing, and make-up, and avoiding certain behavioral faux paus. What happened to intelligence, compassion, energy, and kindness? Indeed, in this regard men hardly fair better in the movie - "reproductive fitness" for a man is reduced to six pack abs, a full head of hair, and a well appointed New York apartment, and the ability to put up with an excess amount of abusive female drama.

As an added little kick in the ribs, the movie portrays vegetarians and vegetarianism in a harsh light: vegetarian food is apparently tasteless and unsatisfying, and those who serve it are ugly, judgmental, and rude.

Idea: Annotated music streams

No comments:
The KCRW Music Stream is a wonderful resource - it's a free, commercial free, internet resource for a constant stream of thoughtfully selected, interesting music. My only gripe with it is that it can be hard to identify a song that you like. It's true that the DJ announces the artist/track/album on occasion, however this is not terribly convenient. It would be nice if the player (iTunes in my case) could display this information automatically.

Note that KCRW provides track information on the web, but it's not very easy to get to. It would be better to annotate the stream such that the information is already available in the player.

One workaround is Shazam - indeed it's a strange day when one holds their iPhone up to the computer speaker to identify a song! (This reminds me of another idea I had that would use OCR to make a bitmap brochure site SEO friendly...)

Anyway, the economics would seem to make this workable. After all, if I like a song enough to click somewhere, I'm probably willing to buy the song. (Indeed, this is Shazam's business model, from what I can tell).

The value of greed, fear, and vanity.

No comments:
Mortgages create fear, which in turn creates productive people, which is in the end good for everyone.

It seems that the most common motivations for success are fear and greed. Vanity and simple obsession follow a close second. Sheer joy in the work is perhaps the least common. In the west most people are motivated by fear - that is the true value of the mortgage culture. Instinctively people know that they need fear to function, to survive. While all people are motivated in the short term by greed, long term greed (usually mixed with vanity) is rewarded by the investor culture.

I make these comments without prejudice. In many ways I think any wealthy society owe fear and greed a debt of gratitude - without them, individuals and organizations could very well grind to a halt, too content for their own good. Indeed, there have been times in my life where I could have used a larger dose of fear to get me over a particularly difficult hurdle.

Consistent joyful motivation to excellence is quite rare. It is probably not possible without being an abstract thinker, and so able to derive pleasure and direction from an abstract ideal. The joyful motivation in its pure form seems more consistent with religious striving than with economic striving but n truth, I think that this motivation is shared by all at certain points in time. For example, the movie mogul (who is normally motivated by greed and vanity) may step back once in a while and appreciate the movie for the work of art that it is.


The Man is hosting a music festival!

No comments:
The Man is hosting this years misnamed "West Beach Music & Arts Festival". Check out their rules:
buzzkill

I mean, really? You're going to host a 3 day music event and do not allow blankets or chairs? "No outside food or drinks" has a rather obvious economic incentive - but I fail to see the case against blankets. And what about the ban on "Professional Cameras"?

I wonder how many artists would play this "festival" if they knew the rules?

Nice phishing attempt!

No comments:
What gets you is the implication that someone has charged something to your paypal account - something that is all too possible, alas.

Sweet! Another request to use a photo

No comments:
I realize it's not much, but this is the 4th time someone has asked to use a photo from my flickr stream. As an amatuer with very little experiene, I think that's just great. (I've no doubt that the really good photographers get that many requests per day - but I'm happy). Here's the image they like:



(For a book called "Superbikes", being produced in Japan.)

[Update: okay, I have to mention the irony here: this GS500 is in really really bad condition! If you look closely you can see the rust, and the tires are completely bald. There was a persistent oil leak that made riding it dangerous. I think it had something like 100k miles on it when I snapped this photo. It qualifies as a superbike only in the sense that it was super durable!]

Why templates are just a special case of AJAX

No comments:
I've been writing webapps with template languages for some time. Templates are a nice way to stay as close as possible to the original, static HTML. I've noticed that with Ajax in general, and jQuery in particular, one can get even closer to not modifying static HTML. I've also noticed that templating can and should be done on both the client and server.

There's a very nice Ajax architecture that basically dictates that you make a request against the server, retrieve meaningful data (rather than data embedded in presentation) as XML and then insert that data into the DOM. This is precisely how server-side templates work! The only difference is that the data is not serialized, and is generally some architecture specific form. For example, in Java the template data may be object graphs embedded in a HashMap.

A server-side template, then, could theoretically be replaced by an Ajax call, if the template worked on the client. For some years now, there's been XSLT support in all modern web clients, and XSLT can indeed be used as a templating language of sorts. However, XSLT is verbose, unwieldy, and therefore fails miserably in the only criterion that matters: does the architecture minimize the mutations you have to make to static HTML?

Actually, I think it would be a nifty thing to do client-side only templates, but for practical reasons I don't think such an architecture would fly (first, because some clients don't support meaningful programmatic execution of any sort, and second, because you'd have to take special care to avoid that initial loadind performance hit). Therefore one needs a solution that can execute in both places. XSLT can indeed work both server and client side, but as we've seen it's a less than optimal solution.

The approach I like is to use JavaScript for the templating language. Indeed, one codes the software as if it was client-side only Ajax, and then rely on runtime parameters to tell the server to exec that initial XHR on the server. This is made possible in a Java server by two pieces of technology, Rhino, and John Resig's env.js. It works, it's nice, and I'll write about it in more detail if there is interest.

A pretty sweet band: Lowen and Navarro

No comments:
This band was introduced to my by a neighbor - who is the niece of Navarro. They have a mature, soulful vibe with some pretty tight song writing ability. They sound like they'd be a good live show.

Idea: Recover my stolen stuff (dot com)

No comments:
Ok, so I just had a camera with lenses stolen, and I'm determined to find it. How can I do that? One thing is to register the SN with the national stolen goods registry (whatever that is - I could find no reference on the Internet).

Another thing I was going to try is to see if the combination of items was for sale in the usual places: craigslist, ebay, the recycler, and the local used photography places. But that's a lot of work, and I think that at least some of it could be automated.

So why not "recovermystolenstuff.com"?

My fetch

No comments:
My supernatural animal companion would almost certainly be a camel. Ill-tempered, intelligent, and totally adorable, just like me!


What bands are appropriate for live music?

No comments:
  1. Sigur Ros. NO!
  2. Yeah Yeah Yeahs. YES!
  3. Postal Service. Probably not.
  4. Tom Petty. YES!
  5. Jesca Hoop. Yes.

The girl at Native Foods

No comments:
She is beautiful. Very short blond hair, lovely big, sad eyes, and full lips. But I realized today that I can't put her into a story. I can't describe her well enough to even put her into a song. It's as if the singularity of her wowing appearance has prevented my creative faculties from functioning. And I don't know enough about her to go on reality. Is she a princess? A damsel? A fighter? A gentle healer? Or perhaps a barwench? Or an office worker, or a stay-at-home mom? Or perhaps an academic? Introvert? Extrovert? Does she challenge the world intelligently and with heartfelt energy? Does she succumb to the listless malaise that sometimes afflicts youth when no clear path presents itself? Is she doomed to an ordinary existence? Is she cursed to live in interesting times? Is she a student? Is she a lesbian? A drug addict? A philosopher?

Here is what I think.

I think she is an artist. I think she stays up late at night, singing folk songs around a campfire with friends. I think she only takes one hit of the joint that gets passed around. She doesn't say much, she is in fact very quiet, but she keeps a journal and tries to releive her constant worry of the world through writing about it, but it doesn't really help. She is bored by her job, but likes the people she works with. She loves dogs, but is ambivalent about babies. She likes boys with tatoos and long, matted hair. She doesn't like boys approaching her unless invited, which she does with her eyes, which everyone tells her are beautiful. She talks with her mom on the phone when she's lonely. She thinks with nostalgia of her childhood and worries that they were the best days of her life. She was the youngest child and has already rebeled in the usual ways and found it dull. She has an older brother, who moved to Chicago. She missed him a little bit, and wonders what the future holds for her.

Through the looking glass: the wonderful world of widgets

1 comment:
I was playing around with Sproutbuilder which is a really cool TTW WYSIWYG widget authoring tool. Now that's pretty cool, but it opened my eyes to a bunch of other synergistic tools, like gigya, which is something called a "widget network". Presumably this means "widget distribution network". Anyway, it appears that this is the tip of the iceberg.

You may wonder, what is so interesting about widgets? Constrained space design! Being efficient with the pixels you get is a kinda cool problem.

What does it mean for a company to issue new stock?

No comments:
Meryll Lynch will sell $8.5B in new stock. What does this mean for the existing ML shareholders? It means that new investors will be getting a piece of the company, but they'll be paying for it, which means old investors really are getting something in return for the stock dilution - cash. As an investor you only want this deal if your company needs a liquid cash shot in the arm, such that if it can't get it then your (undiluted) stock becomes worthless anyway.

The best deal for existing owners involves issuing the lowest number of shares at the highest price such that it's enough to save them. How do you determine these numbers? Seems to me that these numbers are largely a function of the current share price, outstanding stock count, and the estimated cash needed to solve the problem. And I have no idea what that function is.

The buyer wants the most shares at the lowest price, because in the event of a recovery the upside is much larger.

Another way to analyze the correct price for a new stock issue is to look at a hypothetical buyout. If the company recovers successfully, how much would ML be worth to a buyer (assuming 100% of sellers would be willing to sell at approx market rate)? (I believe this number is called "market capitalization".) Let's say that ML is worth $20B now but has every reason to believe it should be worth $100B, which it was 6mo ago (I'm totally making these numbers up). If there are 1B outstanding shares, should an investor think about buying at $20 or $100, or something else? Well, $100 makes no sense as there's no profit in it, even in the best case. $20 is a good number because their shares will be worth the same as everyone elses when they "hop on board" and stand to lose (or gain) exactly the same. However, $28.5 may make more sense: that's because if ML's value is $20B then gets $8.5B in cash, the company is, strictly speaking, worth $28.5B. So perhaps the new investors should spend $28.5/share!

So I guess assuming the sale goes well, it's actually a really really good thing for ML owners to get that cash - they see an immediate increase in stock value, and have the jet fuel needed to get past a rough spot and toward that $100B mark.

Earthquake

No comments:
Just had an earthquake. Felt pretty big - initial jolt, then an extended period of gentle swaying (over a minute - indeed we may still be swaying).

How to Server-side Google Analytics

4 comments:
There are many users who surf the web without a JavaScript enabled client - particularly users of the mobile web, and some portal users. The question arises: how do you track visitors with Google Analytics (hereafter "GA") that don't have a JavaScript enabled client? I recently took a stab at this problem by reverse-engineering urchin.js and re-writing it in Java. But it didn't work. This is my attempt to rectify the situation.

A bit of background: GA is normally installed on a site via a piece of JavaScript that executes onload. The script (which used to be called urchin.js and now is ga.js) examines the page and generates an HTTP request for a GIF from GA with lots of URL parameters. Based on those parameters (and probably the request headers) GA recieves all of its data. So our problem is in correctly constructing that URL.

But figuring out how to correctly construct that URL is tricky, and it's mostly undocumented. Google has taken pains to wrap the API in object-oriented JavaScript - but this is little help if you need to call that API from another language. Plus, the script is "minified" - and therefore unreadable.

After a little research I found a troubleshooting page that describes the HTTP request URL in more detail.

This is very helpful, but not sufficient for creating server-side verstion of the ga.js script. In particular the following questions are begged by the documentation:
  1. Most of the fields have to do with e-commerce, and can be ignored for basic analytics. Are they really optional?
  2. The fields that describe client capability are more problematic - can they be omitted?
  3. What use GA makes of the request headers, especially when the information is duplicated in URL parms?
  4. Why are encoded cookies sent at all? Can they be omitted?
  5. What is the "X10 data parameter"?
To answer these questions I will be constructing URLs with a text editor, sending them with curl, and seeing what impact it has on the GA reports. (Hopefully there won't be much latency or testing will be slow!)

[It occured to me while writing this that other mobile web developers must run into the same issue, so I search for "mobile analytics". Some interesting hits. But remarkably it seems like other folks concentrate on doing things like log file analysis. I personally think that's a bad idea. It also occured to me that we could use another analytics software, like the open source piwik, that has a more open tracking API. However switching analytics providers is only a last resort.]

[Google is probably wise to not provide server-side access to their analytics - they'd have to support a few more languages, and integration is a lot more difficult making the support load higher.]

The stuff that got stolen this weekend.

1 comment:
Well, it appears that there's been a theft this weekend. All told, I'd estimate I lost about $9k worth of stuff:
  1. Photography equipment. Canon 20D + 5 lenses (two of them L lenses), flash, photo backpack, memory cards. Worth about $5k.
  2. Cash. $2k. I feel particularly stupid about this. I had this much cash because I'd returned a computer to Costco, and sold another via craigslist, and was meaning to deposit it in the bank.
  3. Perhaps worst of all, my father's Rolex. It was a rather beat up Submariner, I've worn it perhaps twice, but it was an heirloom. Worth $2k possibly.
  4. An unopened iPod Touch that I'd been meaning to sell on craigslist. $300.
Oddly, they didn't take my laptop (an older Thinkpad) or my Bose Waveradio, or my CDs or even my 21" monitor. I know everything was in place Saturday, but I suspect that they hit me on Sunday when I was out because they didn't take my (brand new) MacBook which was here all day Saturday, but not Sunday. It's telling that they took only stuff that was highly portable (the camera and lenses were in a backpack).

Goodbye camera!



I filed a police report, registered serial numbers and the police have promised to dust for prints, but frankly I doubt they'll find anything - I have very little hope that my stuff will be returned, or the thief caught.

How do I feel? Pissed, mainly. I'm pissed at the loss, and pissed at myself for my stupidity - I left the door unlocked, thinking that my 2nd floor position would protect me, and believing in the basic decency of human beings. The camera and cash are replaceable - the watch is not.

Life kinda sucks right now.