Entries Tagged 'Software' ↓

Dirt & Grass

Dirt and grass are beautiful. Rocks, twigs, and bugs, too. Sometimes this world recognizes only majestic cathedrals, all too happy to look past the essence of life.

This is a corollary to something I’ve been struggling to articulate lately. Open source has made it; and because it has made it, people want to make it big. This is fine. I don’t have a problem with big companies, big projects, big money, and the rest.

Where I get uneasy is when people cultivate the sense that the fundamental distinction of free software is just access to source code, or the even simpler view of having no licensing cost.

No, this isn’t what really gets me. Continue reading →

Tweak working copy POMs without checking them in

A handy little snippet… This is something I’ve used a few times when I’m hacking in a working copy and need to change POMs for some local reason (usually versioning) but can’t check them back in modified. I’d like to tweak the POMs, work on other stuff, build/test, check everything but the POMs in, rinse and repeat. Here’s a workaround:

svn st | grep '^M' | grep '[ \/]pom.xml' | sed 's/^.......//' | xargs -I{} svn diff {} > pom.patch
svn st | grep '^M' | grep '[ \/]pom.xml' | sed 's/^.......//' | xargs -I{} svn revert {}
svn ci -m 'whatever'
patch -p0 < pom.patch

Happy hacking. -NB

Graceful AJAX degradation / progressive enhancement

In one of those beautifully lucky moments, I found an article I was wishing I had kept track of last night. I was chatting with Chuck and Matt a week ago about the pervasion of script in web pages these days and how hardly anything degrades reasonably. For years, I refused script entirely but, now, I have fallen victim to the trend. “Everybody has script enabled anyway. Mashups are inevitable. They want AJAX. Just script it.” That doesn’t mean that I don’t still want to use ELinks deep down.

So, I read one of those articles a while back where you feel a little bump and realize someone has lighted the path — with the best kind of light, showing the unnoticed obviousness. It’s like observing that HTTP actually works pretty well when you use it as carefully built, ten years after working around it furiously. It’s like noticing that really ugly (well structured, unstyled) web pages take the most beautiful CSS easily.

But I lost the article. And my recollection didn’t do it justice or support the point that you can script the snot out of a page without breaking Lynx. Then I read the Thread on Safari support in Sakai, mentioning Yahoo! Graded Browser Support. And something snapped; I thought this may have been where I found the article…

The article was on Hijax.

This is a cute name Jeremy Keith came up with for an approach to adding AJAX magic without breaking the basic function of web pages. It’s more or less a philosophical first principle of modern web development. You should read this article daily and soak it in like the Tao. -NB

Sakai JSONP callbacks in Entity Broker

So, I’m going to try to get back in the habit. I owe Ray two posts, so this is a warmup. Anyway…

I’ve just added JSONP callback support to Entity Broker. This allows you to make a data feed that can be used for mashups. The normal JSON feeds don’t allow for this because, when the script tag is added, the object literal just drops into the ether — it needs to be handed off to a function. Plenty of others are using this technique now and it’s well supported in things like jQuery; just search around.

The important bit is that you can either use the default callback function (jsonEntityFeed) or specify your own. You just craft a URL to the entity and optionally give a parameter. For example:

http://sakai/direct/entity-prefix/some-id.jsonp
http://sakai/direct/entity-prefix/some-id.jsonp?jsonCallback=myCustomCallback

If you are using jQuery, you can use the getJSON method to call an inline, unnamed callback like this:

$.getJSON('http://sakai/direct/entity-prefix/some-id.jsonp?jsonCallback=?',
function(data) {
alert(data.whatever.element[0].here);
});

It’s all pretty straightforward and tracked in SAK-16757. I imagine that this will get tagged at some point, but it’s just in trunk for now. Happy Hacking! -NB

Aptana + Vista + PHP + Oracle XE == Victory!

So, I’m doing some development against Oracle with PHP and really wanted Express Edition on a local machine to be able to hack without a lot of messing around (my other Oracle instances are behind VPNs, etc.)  I’ve also been thinking about hooking my desktop back up for one of those environment changes that results in a productivity boost.  A third factor is that I want to do this development in Aptana because, well, it’s just plain sweet.  Easily said…

Continue reading →

PHP json_encode is quirky

So, amidst an interesting fight with CakePHP, I was fortunate enough to spot a quirk in json_encode when passing arrays. If you have a typical ordinal array, life is good. If you have a typical associative array, life is good. The quirk is in how PHP decides what you have.

We define “life is good” here as: you pass something without meaningful keys, you get an array; you pass something with meaningful keys, you get an object.

When you have a regular old array of values (or rows of a result set, in my case) and you filter it with, e.g., array_filter, you can end up with holes in the ordinal numbering.  This delights json_encode, which displays its exceptional, “just works” intelligence, giving you an object full of numeric indexes pointing at what you thought would be unnamed items in an array.  In some cases, this makes no difference but, in some, it can be a big problem.

Fortunately, I’m generally in tune enough with the stylings of PHP that I went straight to trying array_values — and now, all is right with the world. Just wrap any array_filter calls with array_values if you plan to turn the goods into JSON. -NB

Stupid Eclipse trick — Dynamic Tracing with Conditional Breakpoints

So I’m debugging a chain of Sakai helpers and I ask myself…

“Self, is there an easy way to use the Eclipse debugger to fake some runtime/dynamic tracing?”

And the answer is a resounding “yes!”

If you set up conditional breakpoints at the places where you want those debug statements and inject some great println justice, magic is made. Eclipse is also nice enough to allow blocks of code or expressions. This means you can use just the println like an expression if you don’t care about the breaks, or make a println and a return if you do. See the screenshot for a somewhat nonsensical example.

All of this can be yours with a single startup of Tomcat and a tail -f. If you’re lucky enough to be hacking something in *-tool, life is even better. Save, mvn install sakai:deploy, relaunch your debug scenario, and keep an eye on that terminal. Somebody who knows what they’re doing with Eclipse could probably tell you how to even target an IDE view — catalina.out is fine for me, though.

…And for quick reference, you can right click on a breakpoint in the left-hand trough and select Breakpoint properties or use the Breakpoints view. On a Mac, Cmd-Shift-B toggles a breakpoint on a line, but getting to the properties with the keyboard is a pain (Opt-Shift-Q, B). In there, a natural-feeling sequence of arrows and Opt-Enter or a right click opens the dialog. Getting back to the editor is easier: F12.

Conditional Breakpoint Properties

Happy hacking! -NB

Flash 9.0.16.0 does NOT play nicely with local storage

OK. So I thought I wasn’t crazy. I reviewed my code. I tested Dojo versions. I isolated conditions. I followed dead-ends in desperation.

And then the problem goes away. I can’t get SharedObject storage to break anywhere (and I’m still not sure why it was broken, then magically fixed — I suspect an update to the remote machine I was using, since the cluster is monitored/managed).

And then, today, we replicate it in the one place in the world we really care about, and scrape the Flash version: 9.0.16.0.

So I check if Adobe is benevolent enough to lend a hand (installable old version) to poor developers who are getting hosed. They give a nice package, so I was thrilled.

Then I fight with the installers/uninstallers for 6 versions until I find a golden nugget: uninstall_flash_player.exe /clean takes care of the registry entry that was stopping anything but the latest version (as it had already been installed) from running, though they install with “no problems”.

And, with undue buildup, the point of this post:

Flash 9.0.16.0 does NOT work with Dojo Storage 1.1, period.

The good news is that all newer versions do, and 9.16 is coming up on two full years old with 3 major updates since. Time to beg for this lab to be updated and get on with better problems — like IE’s eternal lifetimes of objects created in iframes and its derivative memory leaks. -NB

37signals, entropy, and Sakai

Nathan Pearson, Sakai’s lead for the UX Initiative just forwarded a post from the 37signals blog. It’s referencing a video interview with Ira Glass, where he talks about being a fierce editor and moderator, cutting more tape than you roll. The post extends the interview’s mention of entropy as the disorganizing, enemy force to software.

In principle, I agree: entropy tends to bloat, delay, and complicate software. But the read-only experience of listener/viewer in storytelling is a bit different from daily use software. The post reveals some of the company’s “less is more all” philosophy.

Continue reading →

“These are the data.”

Those of you who attended the Sakai conference in Atlanta might recognize that quote. It’s attributable to Eben Moglen (SFLC), uttered during the “lunch discussion” with Matthew Small (Blackboard). “These are the data,” is a quote I’ve used countless times in the past 16 months. I’ll explain in a moment.

So, fast-forward, and we see posts from Michael Feldstein on the initial invalidation of all 44 claims and Blackboard’s response. The latter post (and Bb’s statement) is specifically about the percentages of patents that are upheld, invalidated, or altered under reexamination. This is the exact context of Dr. Moglen’s original quote. He presented some hard figures and summed up with those ringing words.

I’m not going to beat up on Blackboard — they’re looking at the rules and playing the game. I completely disagree with software patents, but they’re still allowed in the rulebook, so I can’t blame them for filing before someone else did. Indeed, the applications were filed in 1999 and 2000. It was a different frontier with respect to the Internet, Free Software, and software patents then (see LZW, Unisys, SCO).

Personally, I thought it was pretty bad karma to file a press release of a patent and lawsuit on the same day, turning the red lights in people’s minds into white hot light on the detailed claims. But then again, I’m not on their strategy team. It’s just too bad that we’re tying up all the energy, time, and tax dollars, bickering over how we play in the same edusandbox and who gets how big a slice.

Anyway, there are 44 patent claims. Of the 10 issues set forth in the reexamination request, the rejections of 6 were adopted with modification, those of one without modification, and those of 3 were not adopted. The union of all adopted rejections deems that all of the claims set forth in United States Patent 6,988,138 are unpatentable. These are the data. -NB

You can download the audio of the lunch session from the Sakai Confluence page. There is also a transcript from Jim Farmer.