Case insensitivity on HFS+

As most of you (I have limited readership on my blog and I'm pretty sure I know all of you) know, I've moved away from Linux to the Mac world a couple of months ago. I have an ancient PowerMac G4 for my home desktop and I use a MacBook Pro at work. Of course, I still use Linux for most development; Linux laptop at home and a server at work, so I haven't found the need to do any hardcore dev work on OS X till date.

This weekend, I decided to try my hand at porting Java-GNOME 4.x to OS X. I'm blogging that effort in a different post, but to cut to the chase, I was burned by case insensitivity on HFS+ for the most part of the weekend. It turns out, that despite being a UNIX, by default, OS X chooses a case-preserving but case-insensitive configuration for its filesystem. While you can choose a case-sensitive configuration (You'll have to select at format time!), you're likely to break third party non-Apple apps such as Adobe Photoshop.

Consider the following piece of code:





public class Test {
public interface CLICKED {
public void perform();
}

public interface Clicked {
public void perform();
}

public static void main(String[] args) {

Clicked myClicked = new Clicked() {
public void perform() {
System.out.println("Inside interface Clicked");
}
};

CLICKED myCLICKED = new CLICKED() {
public void perform() {
System.out.println("Inside interface CLICKED");
}
};

myClicked.perform();
myCLICKED.perform()
}
}





I'm sure you'll agree that this is a reasonable piece of Java, by most standards. We create two Interfaces and define two objects by implementing their methods. Now, we invoke "javac" and get this piece to compile. We typically expect a class file for each Outer class and a qualified class file for each Inner interface/class as Outer$Inner.class and so forth No sweat:

[pendyals@fermi:~/test/Test] $ javac Test.java
[pendyals@fermi:~/test/Test] $ ls
Test$1.class Test$CLICKED.class Test.class Test.java
[pendyals@fermi:~/test/Test] $

But what's this! We only have Test$CLICKED.class! Evidently we're missing a Test$Clicked.class! Where could it be? How about we look in the Test$CLICKED.class?


[pendyals@fermi:~/test/Test] $ javap -c Test\$CLICKED
Compiled from "Test.java"
public interface Test$Clicked{
public abstract void perform();
}


Evidently, the only interface compiled in, is called Clicked and not CLICKED. As you'd have guessed by now, attempting to run this class will result in a Exception:



[pendyals@fermi:~/test/Test] $ java Test
Exception in thread "main" java.lang.NoClassDefFoundError: Test$CLICKED (wrong name: Test$Clicked)
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:675)

...


If you haven't guessed what happened: Javac created a Test$CLICKED.class file and put in the byte code for the CLICKED interface. Then, after compiling the byte code for the Clicked interface, it wanted to write into its corresponding file. Before writing, it checks to see if the file exists and if it does, just overwrites the file. HFS+ of course, dutifully returned a handle to "Test$CLICKED.class" when asked for "Test$Clicked.class" and this caused javac to silently overwrite it.

As is painfully evident, the case-insensitive nature of HFS+ has repercussions far beyond naming files correctly. Since languages like Java require you to name files with class names, an incorrectly designed application could fail silently and not alert you of the fact that a class file has been rewritten.

While the "typical" UNIX response would be to dismiss OS X and HFS+'s behavior as absurd or "immature" (yes I've heard that one), it would seem to me that a prudent design shouldn't require case-sensitivity in any form. I use the word "prudent" in a tongue-in-cheek sort of way, because there's no requirement for Java apps to run on OS X or Windows if the app designer didn't want it to.

Fingers burnt. Lesson learnt.

Bird brained



On my way to the Twin lakes Java (an amazing Coffee shop at Twin Lakes, MI), I was overflown by a rather satisfied looking Bald Eagle. Satisfied, since he'd just finished off what looked like a rather large carcass of a rather unlucky hare. I screeched the car to a halt, jumped out and took a few pictures of him as he circled (!?) and flew past. Mighty pleased with myself for having bagged a good picture of a Bald Eagle, I looked through the pictures to realize to my horror, that I'd been shooting with the ISO set to "HI1". In Nikon's terminology, for the D60, "HI1" == 3200 and also "Avoid using". So there _was_ a reason I had to shoot at 1/4000 and F11 to get the correct exposure.

Feeling pretty silly, I returned and plonked down on the couch with the Rubik's cube in hand. Deciding that I had to get through the silly cube in better than my usual 1:20-1:40 minutes, I started trying to learn all 41 algorithms of the Fridrich method. Then, I came across one of the most useful webpages I've seen in recent times: http://www.freewebs.com/sirshazaam/f2l.htm
The guy has most painstakingly listed out every one of the algorithms for the F2L and has pictures of the cube, for each of them as well. Brilliant.

Having had enough, I attempted hitting the sack at about 6:45 AM, when I heard what sounded like a Warbler. Deciding that I couldn't sleep any more, I picked up the device of photographic expression and walked out. After stalking the fella for more than 20 minutes, I finally caught sight of this brown feathered chappy, chirping away in a brown tree. Perfect. Getting a clear line of sight of the guy was a tough job.






Having shot what I thought was an okay-ish picture and double-checking to make sure the ISO was not an obscene value, I walked around for a little bit, coming across another magnificent sight. Somehow, just somehow, I get the feeling that today's going pretty well for a start.

The gear




Pictured, is my new D60 along with a bargain Soligor 90-230mm F4.5 manual, I got off eBay, for $20.
The other glass (not in the picture), is a humble Nikkor AF-S 18-55 DX VR.

The Soligor has been my lens of choice, ever since I began understanding the concept of exposure better. Shooting without any metering whatsoever and with a manual focus is a little daunting at first (especially so, for someone new to D-SLRs), but certainly not a major hurdle.

The remote control on the right, is a Phillips universal remote, that I've programmed to use as a remote trigger for the D60.

Web widgets

So, the intarwebs is filled with these "Take the pink ponies quiz and see your score now!!!" tests. I normally avoid these abominations. The Political Compass however, is one of my favorites. The Political Compass's theory is, that the traditional Left-Right line, in itself is insufficient. Political orientation, really is a two dimensional plot, with the other axis being the Authoritarian-Libertarian line. Intrigued? Try them out at politicalcompass.org.

Also, I score as

Economic Left/Right: -1.50
Social Libertarian/Authoritarian: -5.79 . To see it on a graph, click here

Also, in order to ascertain bragging rights (Slackbot, this is for you):

80 words

Typingtest

Deer chase!


Deer chase!
Originally uploaded by Srichand Pendyala
I was driving up to Copper Harbor on a bright beautiful Saturday, when this Whitetailed deer running alongside the road, passed me from the left, crossed over onto the right lane and then sprinted along the road for a good half a minute.

Not wanting to confuse the Deer any further, I kept a good distance away from it, but stayed right behind it, while a friend dug my camera out of the bag. During those few seconds, my speedometer read approx 35 miles an hour and the Deer was almost always a constant distance from me.

Finally when I got my camera, I flipped the wheel to "P" mode, let the camera choose everything, zoomed to 55mm and fired off a burst of shots, trying to capture the chappy, while the sunlight was still on him.

Having had enough excitement and thrill for the day (its white tail up, indicating fear and alarm), the Deer decided that discretion was the better part of valor and vanished into the woods in a blitz.

Removing quizzes from your Facebook feed

Here's how you remove annoying Quiz updates from your Facebook feed:

If you haven't already, install the Greasemonkey add on for Firefox (https://addons.mozilla.org/en-US/firefox/addon/748), then install the Greasemonkey script to remove the Quiz updates

You can find the Greasemonkey script at http://userscripts.org/scripts/source/44459.user.js

Louise Attaque


I recently re-discovered Louise Attaque, a French Folk rock band. I first heard them live at the Alliance Française de Bangalore sometime in 2005.

Not surprisingly, that was also the first time I'd heard rock in a different European language (I'm fairly accustomed to English!). Although I barely understood a word, I didn't feel lost or out of place. They say music doesn't have a language; perhaps they're right.

Regardless of the genre you listen to, I highly recommend giving Louise Attaque a listen. They've got catchy tunes, with interesting guitar, harmonica, violin and accordion pieces. I don't understand French, but I've been told that their lyrics are pretty interesting too.

The French are a friendly people (see note [1] below for an exception), particularly so at the Alliance Française of Bangalore. If you're in the area and you feel the parisian touch, you might want to stop by.

[1] Overheard at the Aéroport Paris-Charles de Gaulle : "Why do you presume I speak English?"

Incoming Ice Age?

Lake Superior, almost froze over 100% [1] again this season. The accepted theory, is that the Lake has a massive ice cover once every 20 years. The lake was last frozen over in 2003, nearly 100% in 1996, 96% in 1994, 100% in 1979, 95% in 1972, 100% 1962[2].

The Lake seems to have frozen over again, over the 2008-2009 winter. Between 1962 and 1979, 17 years elapsed before the lake completely froze. It took another 17 years before it froze in 1996 and another 7 years before it froze in 2003. Its only taken another 6, before the lake frozen over again in 2009.

If this statistical correlation is to be trusted and extrapolated, then we are looking at a scenario where the lake will begin to freeze over with much shorter cycles, possibly resulting in the lake freezing completely each year.

Is this a sign of the onset of an Ice Age? Most scientific bodies tend to think that this is just an anomaly and that we are in a global-warming phase. Technically, we are still in an Ice age, as Ice sheets in both Greenland and Antarctica exist.

[1] Its difficult to define "completely freeze over". Its accepted that "very little open water areas" is what is "completely frozen" could mean.

[2] Data from http://climate.umn.edu/doc/journal/superior030603.htm

One year...

... since JP Morgan bought Bear Stearns for $2 a share. I hope someone's learnt a lesson.

The iPhone camera



Originally uploaded by Srichand Pendyala
The iPhone's much maligned camera, with a 2 mega pixel "resolution" sensor is actually capable of taking good pictures.

The controls on the camera ("Click") certainly don't rival even the closest point and shoot cameras. But it certainly has its charm. For one, it takes all the technicality out of taking a picture and lets you concentrate on composing your picture and just your picture. The downside of course, is that you don't get to choose any aperture, speed or focus settings. But seriously, its a camera on a Phone!

Picture on this post, is from the tram at the Minneapolis airport. Post processed with the Camerabag application, on the iPhone itself. Click on the picture to see my Flickr stream, with more iPhone pictures.

New photo gallery

It turns out, Flickr's 200 photo limit [1] for their free is actually quite measly. Especially if you're the type who likes to put up every mediocre picture online! To be fair, Flickr has a paid account, called Flickr Pro, which removes the 200 photo restriction.

I could create another Blogspot, or get a Tumblr account, all of which would let me upload pictures without restriction. Sure, searching and previews would be a pain, but then again, what in life is painless? Alternately, I could jut dump all pictures into a folder and let Apache just display a listig. Or I could add all new photos, to the already existing http://srichand.net.in/photos page. Or, I could just get a Flickr pro account...

Except of course, I already pay for a webhost, for http://srichand.net.in/ . I see little reason to pay up twice the amount I pay for it, just to host some pictures. Of course, the problem with http://srichand.net.in/photos is that, I'm running an ancient version of Coppermine. The thing I do not like about Coppermine, is its Album centric approach to photo management. Every photo needs to be in an Album, requiring me to create, learn and know an entire hierarchy of photos. I'd much rather prefer to have a "bunch" of photos and tag some of the pictures I like and mark some others as favorite. Of course, the ability to create "sets" (Similar to Flickr and Adobe LR2) is an added bonus. The other problem with Coppermine, of course, is its complexity. Somehow, just somehow, at first glance, its interface looks more complex than useful.

And so, I feel the need to move off Coppermine into a simpler gallery system. What do I need? The ability to preview _lots_ of pictures on one page (Certainly not a massive waste of whitespace, the way Coppermine does). A detailed "picture" page, that shows a picture, along with its EXIF data. And the whole AJAX thing, which I've shunned so far, is probably the ideal implementation detail here. It'd be awesome to move between pictures without reloading the page. The same goes for editing the Title, Description and the Tags of the photo, without going to an "Edit" page, for each picture. And yes, batch tagging!

I'm certainly going to look around some existing systems for a bit. I am already beginning to like the Plogger system a good bit. It might need some hacking to support what I want. If not, I'll probably just go get myself a Flickr Pro account anywho.

Image viewer for Linux

Terrible. That's the only word I'd use to describe my experience with F-Spot. Any image viewer that moves files around on the filesystem, without my explicit permission each time, is just terrible. F-Spot's instability is legendary too.

Google's Picasa 3 for Linux is okay for the most part. Except of course, Google's choice to override my Alt+Ctrl key binding for full-screen mode is irritating, to say the least. Anyone who uses multiple desktops on GNOME knows my pain. And of course, you can't upload to Flickr from Picasa directly.

KDE's Digikam has most of the right components in place. Except, that it wants me to look at my entire collection in a Folder centric view. I can't view all Folders at once.

Is there any other image viewer I should try out?

Also, WHY cannot image viewers standardize on tagging formats? I have to tag and retag my pictures each time I change image viewers.

Enough of ranting for today, time to get some sleep.

Mood: Arrr!!!

Extra topping? Black olives please!

Everyone has their own personal favorite straw man argument. Some realize that its a straw man, most don't. Here's mine.

Human-Computer Interaction is all about intelligent interfaces that feel "natural" to a Human user. We would want the computer to figure out what we want to do and do it with minimal fuss. For instance, I would want the "Computer" to be able to understand exactly what I mean when I say "I think I want to watch a movie". It would also be really nice, if the "Computer" would guess exactly what mood I'm in, figure out what movie I'd like to watch right now and play it right away. While we're at it, figure out that I'd like to eat a personal pan pizza from Pizza Hut and order it online.

Notice something missing from the above story? There was the "Human" (me), the "Computer" was right there too. Oh that's right, no "Interaction" ! But the "Computer" did guess what you wanted and did it too, you say.

The "Interaction", that seems implicit in the above story, really is a one way street. The subservient "Computer" does what it been statistically trained to do. In technical terms, the "Human" emitted a signal, which was processed by the "Computer", interpolated it to figure out what movie I wanted to watch and extrapolated it to figure out that I might want a pizza and ordered it. Notice the absence of any affirmation or negation. The "Computer" has just been transformed to a fancy glorified signal processor.

Interaction is a two way street. Interaction , in the technical sense requires more than one participant (entity) , to receive, process, understand and emit signals. Imagine the same scenario as before, but replace the "Computer" with another "Human". The outcome, is no longer influenced just by the sheer observation of one participant : "I think I want to watch a movie". The outcome, is now the result of an Interaction, between the two participants. This Interaction, will likely entail speech, hand gestures, facial expressions, discussion of similar events from the past ("Oh that Spielberg guy can't direct for nuts, remember ET?") and possibly, a compromise on choices. It is very possible, that at the end of this scenario, both our participants decide to ditch the idea of watching a movie and play a game or go out on a drive.

In the first example, one participant generated a single verbal signal while the other participant was only passively involved in the Interaction. The passive participant only processed the only signal received and acted. In the second example, both participants were involved in active interaction. Both participants generated a wide range of signals, processed each others signals, analyzed them and emitted a reply signal.

Clearly, the second form of Interaction transferred a lot more information. We could model two-participant Interaction to be a control process (Disclaimer: I don't know enough of control theory or signal processing to be certain though). It could be said, that the choices and opinions of both participants in the second example, were different at the end of the Interaction than before. Some would even use the adjective "enriched".

In either case, it can be certainly expected, that this Interaction would have a very strong influence on future Interactions. This is a critical difference between modeling HCI as signal processing, versus modeling HCI as a control system (see disclaimer above). The essence I'm trying to capture, is that for HCI to be successful, we should expect and _demand_ that the "Human" actually interact with the "Computer". Every software that incorporates AI in some form, has a "training phase", where the explicit interaction is the "Human" teaching the "Computer". I would argue, that this really isn't HCI.

[ I work on "intelligent" [1] Sketch recognition systems, with a special interest in collaborative sketch interfaces. I'm certainly no expert though.]

Brandon Paulson and Tracy Hammond of the Sketch Recognition Lab at Texas A&M argue in their paper, [2] that forcing users to learn the system, rather than the system learn the user's intentions places constraints on the user. I would think that both extremes are undesirable, but a balance between the two is important. When both the user and the system are able to understand each other, the equilibrium achieved is termed "natural", in the sense used in the very first line of this post.

Do I have a straw man? I don't know.

[1] I wish I knew what "intelligent" meant, with respect to sketch recognition. I suspect no one knows either.
[2] This isn't an attack on their work, but an example of the sentiment I seem to encounter in many HCI publications. To add, the SRL at Texas A&M produces some awesome sketch recognition work.

Coercion, bribe or ... election promises?

A big problem, in any election (electronic or off line), is the problem of coerced or bought-out votes. In general, no elections system or electoral authority can completely eliminate voter-coercion. If a voter chooses to sell his vote and actually carry out his end of the deal, then it must be considered part of the due process of election and his vote must be honored. If on the other hand, the agent of coercion is unable to convince the voter , then a forced vote is anomalous in the process.

Although not evident at first, the line between a "valid and freely chosen vote" and "invalid and coerced vote" is very thin. Finally, how does one different between coercion and campaigning? Try the following two statements:

"If you vote for me, I will pay you $100."
"If you vote for me, I will cut your taxes by $100."

Are they different? If so, how?