USD

iPad Keyboard Layout WTF

You blew away 500$ on the craps table at Vegas flirting with the waitress in the low cut dress. I bought an iPad. So let’s call it even and stop judging, shall we?

Since everybody and their mother is writing an iPad review, I’ve decided to do the Internet a favor and not contribute to the hypefest. Instead, let’s talk about an interesting “design bug” in the keyboard layouts.

Due to the touch screen nature of the device, the iPad takes a leaf from the iPhone and implements multiple keyboard layouts, depending on the application context. I’m calling four of these layouts “Email mode”, URL Mode”, “Text Mode” and “Special Character Mode”. Here’s a side-by-side of the first three modes:

This morning, my roommate Meg pointed out an interesting observation in the Text Mode layout. the iPad has an interesting placement of the question mark (”?”) character as a shift-modifier for a comma(”,”). Now, there’s this “?123” button that when pressed, shows you special characters and number keys. But when you press it, the “?” key disappears! Where did it go?

Closer inspection shows that it has moved to the center of the keyboard. This is odd, you’d think: The question mark has always been right next to the shift key since the beginning of time. Further, this bizarre disappearing act when switching modes is unintuitive. Why would someone make such a design decision? Let’s take a look at iPhone’s Special Character Mode for an answer:

Notice how the “?” character on the iPhone is at the center, unlike classic keyboard layouts, where it’s to the left of the shift (which in turn has been replaced by the backspace key). The iPad is clearly trying to maintain consistency with it’s iPhone heritage. However, since it is a very different beast, it also tries to be change things up a bit and borrow from it’s big-boy-computer heritage; ending up with strange design oddities like these. Which begs the question, should a tablet be designed as a larger phone, a smaller computer, a bit of both, or just something completely different?

While this is a fairly minor quirk, it is representative of many oddities in the design of the interface across the board. Despite Apple’s willingness to throw the past out and redesign UIs, the need for consistency with its own family of products often creates ugly contradictions.

a reason to travel

From my roommate Tim’s New Zealand travelogue, that I recently discovered:

The whole cost? Twenty-five dollars (and those are New Zealand dollars, it was $13 American).

For the curious ones among you, he has strained his lateral tendons and may have inflamed some of the nerves in his arm. If it’s not better in six weeks, we’ll find another clinic and he’ll be taking care of for twelve dollars. Amazing.

The woman we were staying with described the wonders of socialized medicine and reasonable pension plans and all things New Zealand. All I could think about was how much it all cost and how it was paid for. She seemed to anticipate my question and explained “Of course it helps when you’re not paying to build nuclear weapons and fight illegal wars.” There it is. As a country, the United States has chosen war and destruction over education, medicine, science, and infrastructure. What a choice.

This is why travel is important. It allows you to see other systems, meet other people, and experience the roads not taken. It makes you a better citizen of the world and of your community. The world is a big place and you should always try to see more of it than you have. And there the lesson ends.

|

Chasing Money

Philip Greenspun’s article on money has an interesting opening parable:

“There are three ways to make money. You can inherit it. You can marry it. You can steal it.”
— conventional wisdom in Italy

A young man asked an old rich man how he made his money. The old guy fingered his worsted wool vest and said, “Well, son, it was 1932. The depth of the Great Depression. I was down to my last nickel. I invested that nickel in an apple. I spent the entire day polishing the apple and, at the end of the day, I sold the apple for ten cents. The next morning, I invested those ten cents in two apples. I spent the entire day polishing them and sold them at 5 pm for 20 cents. I continued this system for a month, by the end of which I’d accumulated a fortune of $1.37. Then my wife’s father died and left us two million dollars.”

| |

A Quick Fix for Yahoo branding on Flickr

Techcrunch continued their usual Yahoo-bashing with this story today:

It appears that a few days ago there was a slight change to Flickr’s logo: an addition of a small Yahoo logo to the right side so it reads “Flickr from Yahoo.” In response, many Flickr users have taken to the photo-sharing site’s forums to express their horror at the Yahoo’s new branding of Flickr.

There is definitely some truth to the community backlash, but what I see as more aggravating is a great missed branding opportunity for Yahoo!.

Flickr and Delicious have both been adamant opponents to Yahoo! branding. Even though Yahoo! owns it, the Delicious frontpage doesn’t contain a single mention of Yahoo. Both sites’ communities are predominantly “indie” brand lovers; and don’t want “the man” to infringe their beloved service (even if the man is running it).

What’s crazy is that Yahoo recently launched a $100 million campaign called “Y!ou and Yahoo!”. What’s also interesting is that Flickr actually had a branding that said “Flickr loves you” (in place of Flickr BETA), which reflected Flickr’s personality and branding. People got used to it, and some even thought it was cute.

The last thing you want to do is force a new logo on to the community in an ungraceful manner. Here’s a convenient solution: to morph the “loves you” logo into the “Y!ou and Yahoo!” campaign and do a “flickr loves Y!ou” logo, killing two birds with one stone. The community sees a subtle evolution of the existing logo, and the “Y!ou” campaign is placed on a huge community”.

| |

BaconSnake: Inlined Python UDFs for Pig

I was at SIGMOD last week, and had a great time learning about new research, discussing various research problems, meeting up with old friends and making new ones. I don't recall exactly, but at one point I got into a discussion with someone about how I'm probably one of the few people who've actually had the privilege of using three of the major distributed scripting languages in production: Google's Sawzall, Microsoft's SCOPE and Yahoo's Pig. The obvious question then came up -- Which one do I like best? I thought for a bit, and my answer surprised me -- it was SCOPE, for the sole reason that it allowed inline UDFs, i.e. User Defined Functions defined in the same code file as the script.

I'm not aware if Sawzall allows UDFs, and Pig allows you to link any .jar files and call them from the language. But the Microsoft SCOPE implementation is extremely usable: the SQL forms the framework of your MapReduce chains, while the Mapper, Reducer and Combiner definitions can be written out in C# right under the SQL -- no pre-compiling / including necessary.

Here's how simple SCOPE is. Note the #CS / #ENDCS codeblock that contains the C#:

R1 = SELECT A+C AS ac, B.Trim() AS B1 FROM R WHERE StringOccurs(C, “xyz”) > 2 

#CS 
public static int StringOccurs(string str, string ptrn) {
   int cnt=0; 
   int pos=-1; 
   while (pos+1 < str.Length) {
        pos = str.IndexOf(ptrn, pos+1) ;
        if (pos < 0) break; cnt++; 
   } return cnt;
}
#ENDCS

Since I'm working at Yahoo! Research this summer, and I missed this feature so much, I thought -- why not scratch this itch and fix the problem for Pig? Also, while we're at it, maybe we can use a cleaner language than Java to write the UDFs?

Enter BaconSnake (available here), which lets you write your Pig UDFs in Python! Here's an example:

-- Script calculates average length of queries at each hour of the day

raw = LOAD 'data/excite-small.log' USING PigStorage('\t')
           AS (user:chararray, time:chararray, query:chararray);

houred = FOREACH raw GENERATE user, baconsnake.ExtractHour(time) as hour, query;

hour_group = GROUP houred BY hour;

hour_frequency = FOREACH hour_group 
                           GENERATE group as hour,
                                    baconsnake.AvgLength($1.query) as count;

DUMP hour_frequency;

-- The excite query log timestamp format is YYMMDDHHMMSS
-- This function extracts the hour, HH
def ExtractHour(timestamp):
	return timestamp[6:8]

-- Returns average length of query in a bag
def AvgLength(grp):
	sum = 0
	for item in grp:
		if len(item) > 0:
			sum = sum + len(item[0])	
	return str(sum / len(grp))

Everything in this file in normal Pig, except the highlighted parts -- they're Python definitions and calls.

It's pretty simple under the hood actually. BaconSnake creates a wrapper function using the Pig UDFs, that takes python source as input along with the parameter. Jython 2.5 is used to embed the Python runtime into Pig and call the functions.

Using this is easy, you basically convert the nice-looking "baconsnake" file above ( the .bs file :P ) and run it like so:

cat scripts/histogram.bs | python scripts/bs2pig.py > scripts/histogram.pig
java -jar lib/pig-0.3.0-core.jar -x local scripts/histogram.pig

Behind the scenes, the BaconSnake python preprocessor script includes the jython runtime and baconsnake's wrappers and emits valid Pig Latin which can then be run on Hadoop or locally.

Important Notes: Note that this is PURELY a proof-of-concept written only for entertainment purposes. It is meant only to demonstrate the ease of use of inline functions in a simple scripting language. Only simple String-to-String (Mappers) and DataBag-to-String (Reducers) functions are supported -- you're welcome to extend this to support other datatypes, or even write Algebraic UDFs that will work as Reducers / Combiners. Just drop me a line if you're interested and would like to extend it!

Go checkout BaconSnake at Google Code!

Update: My roommate Eytan convinced me to waste another hour of my time and include support for Databags, which are exposed as Python lists. I've updated the relevant text and code.

Update (Apr 2010): Looks like BaconSnake's spirit is slowly slithering into Pig Core! Also some attention from the Hive parallel universe.

New York, New York!

It’s been a little over 2 weeks since I moved to the Big Apple for the summer. Much like my last visit to NYC in 2007, this time I’m working for the another dotcom company .

NYC is a seriously awesome place. There’s so much stuff going on that it became a little hard to pick exactly what to do. Being the lazy person that I am, I decided to crowdsource this decision. So I put up a Facebook status update: Arnab wonders what to do in NYC. Suggestions? Within a few hours, I had 16 suggestions! Here’s an edited list. I’ve also added a few of my own suggestions:

The plan is to strike each one of these off my list (in addition to the usual stuff like going to see a Broadway play, etc). Let’s see how this works out!

If I had a million dollars

If I had a million dollars to spend, I would invest them in these two things:

Preventative secondary healthcare for rural areas:

They are not doctors. They are not nurses. They are illiterate women from India’s Untouchable castes. Yet as trained village health workers, they are delivering babies, curing disease, and saving lives—including their own.

and Cell Phones for developing areas :

Mobile phone ownership in India is growing rapidly, six million new mobile subscriptions are added each month and one in five Indian’s will own a phone by the end of 2007. By the end of 2008, three quarters of India’s population will be covered by a mobile network. Many of these new “mobile citizens” live in poorer and more rural areas with scarce infrastructure and facilities, high illiteracy levels, low PC and internet penetration.

Obama vs McCain : A management perspective

There has been a lot of debate and noise about the 2008 US election. Politics, ethics and opinions aside, let’s think about this from a simple facts-and-numbers perspective. Ignore all the controversy of popular vote vs electoral college, etc etc. Let’s consider the contest in the way it’s defined right now.

You have finite resources, and you need to win the election. It costs a fixed amount of effort to convince each person. What’s the most optimal way to win an election?

So you run an optimized campaign. You strategize and make a campaign that gives you a much better “bang for buck”. In a perfect world, you should spend enough time to convince as little over 50% of each constituency and then move on, since you’ve won there and you should spend your resources elsewhere. This should be the primary objective function to measure a campaign’s efficacy.

Using numbers from the Wikipedia :
Obama : 66,495,308 votes, 365 electoral votes. 365/66 = 5.5
McCain : 58,123,419 votes, 162 electoral votes. 162/58= 2.79

Hence, we can see that Obama’s campaign was TWICE more efficient than McCain’s.

If the ability to lead a campaign is any reflection of leadership of the country, this does seem like a decisive victory in leadership skills.

Now, in case someone argues that Obama had more money, let’s look at spending reports from Opensecrets.org:
Obama : 640M$ = 1.75M$ per electoral vote
McCain : 370M$ = 2.28M$ per electoral vote

Again, Obama was 1.3 times more efficient with his donation money.

So overall, 2x efficiency in campaign effort, and 1.3x efficiency in use of money. What I see is a great contest in management, with a clear winner.

|

pepsi rebranding

Brand New reports the purported rehaul of Pepsi’s entire branding inventory :

More information at Adage.com (Google cache link) :

NEW YORK (AdAge.com) — PepsiCo today said it will pour some $1.2 billion over three years into a push that will include sweeping changes to its brands, including what Chairman-CEO Indra Nooyi characterized as a revamp of “every aspect of the brand proposition for our key [carbonated soft drink] brands. How they look, how they’re packaged, how they will be merchandised on the shelves, and how they connect with consumers.

The white band in the middle of the logo will now loosely form a series of smiles. A “smile” will characterize brand Pepsi, while a “grin” is used for Diet Pepsi and a “laugh” is used for Pepsi Max. Also, Mountain Dew will be rebranded as Mtn Dew.

linked list