Joining the Big Red

After a great year serving as the Hacker-in-Residence at Quotidian Ventures, I’m excited to announce that I’m starting classes this fall at Cornell University, through the brand-new Cornell NYC Tech program!

As noted on the original program website (screenshot above), this program is atypical in many ways. The program focuses on preparing master’s students not just to be successful academically as engineers, but also as practitioners and entrepreneurs.

To that effect, the program extends beyond the standard requirements of a master’s degree in computer science. In addition to classes such as Cryptography and Signal and Image Processing, the semester calendar includes a number of events aimed at introducing Cornell students to individuals in the New York tech community, and at building key skills such as pitching a startup, engaging effectively with media, and hiring/interviewing. In addition, students take two business classes focused on entrepreneurship each semester, including an entrepreneurship practicum taught by Greg Pass, the former CTO of Twitter.

It also includes a semester-long master’s project. For mine, I’ll be working with a few Google engineers to contribute to the IPython project.

I’m looking forward to the coming year, and I’ll be sure to keep everyone posted once my classes and project get underway!

Why You've Never Read "I Have A Dream"

(I know some people will be interested in a followup post to Don’t Fly During Ramadan. I plan on writing one, but this post happens to be timely.)

Yesterday, August 28th, 2013, marks the 50th anniversary of Martin Luther King’s famous speech, “I Have a Dream”.

If you live in the US, you’ve probably heard of this speech. You’ve also probably never read it, heard the audio, or seen the video in its entirety.

Unfortunately, the speech is under copyright, and will remain so until 2083. As a result, it is illegal to republish under most circumstances.

Except for the famous, titular line, textbooks in schools almost never publish “I Have A Dream”. Documentaries can only include small, five-second clips. Take a moment and ask the people sitting near you if they’ve ever heard the opening lines:

“I am happy to join with you today in what will go down in history as the
greatest demonstration for freedom in the history of our nation. ”

I’ll bet you they haven’t.

Your children, grandchildren, and perhaps great-grandchildren, will probably grow up without the opportunity of experiencing this moment in history. They will learn about it in grade school, based off of secondhand accounts from teachers who have never read the speech either. And so on.

Frustratingly, the copyright holders include the estate of the person who delivered the speech, but not even the estate of the two other people who wrote it (and likely wrote most of it).

Worse, “I Had A Dream” was delivered on the steps of the Lincoln Memorial. If it had been delivered in 2013, not 1963, there would have been hundreds of cell phone recordings of the speech all across the Internet within minutes. It was truly a public performance in every sense of the word.

The original purpose of copyright, as defined by the US constitution:

To promote the Progress of Science and useful Arts, by securing for limited Times to Authors and Inventors the exclusive Right to their respective Writings and Discoveries

Emphasis mine.

Let’s ask ourselves: if Martin Luther King, Jr. had known that six generations of students would grow up without legal access to his speech at “the greatest demonstration for freedom in the history of our nation”, would he have been more likely to deliver it…. or less?


EDIT Hacker News readers have been kind enough to point out that schools may be able to use copies of parts of the speech under “fair use” privileges, and that copies of the text of the speech are available online.

However, the King estate does heavily enforce its copyright on the video recording of the speech (arguably the more important part), and this recording is much harder to find online (and, when it can be found, is legally questionable).

In retrospect, this post should probably have been titled “Why You’ve Never Seen/Heard ‘I Have a Dream’”, since the argument is stronger for the video recording; however, it’s important to note that most modern textbooks don’t include the text of the speech, and that the reason for that is due to the copyright restrictions and the royalties.

Perhaps a teacher has the right (and enough interest) to print out copies for the student separately, but students are unlikely to find it in most textbooks.

Don’t Fly During Ramadan

A couple of weeks ago, I was scheduled to take a trip from New York (JFK) to Los Angeles on JetBlue. Every year, my family goes on a one-week pilgrimage, where we put our work on hold and spend time visiting temples, praying, and spending time with family and friends. To my Jewish friends, I often explain this trip as vaguely similar to the Sabbath, except we take one week of rest per year, rather than one day per week.

Our family is not Muslim, but by coincidence, this year, our trip happened to be during the last week of Ramadan.

By further coincidence, this was also the same week that I was moving out of my employer-provided temporary housing (at NYU) and moving into my new apartment. The night before my trip, I enlisted the help of two friends and we took most of my belongings, in a couple of suitcases, to my new apartment. The apartment was almost completely unfurnished – I planned on getting new furniture upon my return – so I dropped my few bags (one containing an air mattress) in the corner. Even though I hadn’t decorated the apartment yet, in accordance with Hindu custom, I taped a single photograph to the wall in my bedroom — a long-haired saint with his hands outstretched in pronam (a sign of reverence and respect).

The next morning, I packed the rest of my clothes into a suitcase and took a cab to the airport. I didn’t bother to eat breakfast, figuring I would grab some yogurt in the terminal while waiting to board.

I got in line for security at the airport and handed the agent my ID. Another agent came over and handed me a paper slip, which he said was being used to track the length of the security lines. He said, “just hand this to someone when your stuff goes through the x-ray machines, and we’ll know how long you were in line.’ I looked at the timestamp on the paper: 10:40.

When going through the security line, I opted out (as I always used to) of the millimeter wave detectors. I fly often enough, and have opted out often enough, that I was prepared for what comes next: a firm pat-down by a TSA employee wearing non-latex gloves, who uses the back of his hand when patting down the inside of the thighs.

After the pat-down, the TSA agent swabbed his hands with some cotton-like material and put the swab in the machine that supposedly checks for explosive residue. The machine beeped. “We’re going to need to pat you down again, this time in private,” the agent said.

Having been selected before for so-called “random” checks, I assumed that this was another such check.

“What do you mean, ‘in private’? Can’t we just do this out here?”

“No, this is a different kind of pat-down, and we can’t do that in public.” When I asked him why this pat-down was different, he wouldn’t tell me. When I asked him specifically why he couldn’t do it in public, he said “Because it would be obscene.”

Naturally, I balked at the thought of going somewhere behind closed doors where a person I just met was going to touch me in “obscene” ways. I didn’t know at the time (and the agent never bothered to tell me) that the TSA has a policy that requires two agents to be present during every private pat-down. I’m not sure if that would make me feel more or less comfortable.

Noticing my hesitation, the agent offered to have his supervisor explain the procedure in more detail. He brought over his supervisor, a rather harried man who, instead of explaining the pat-down to me, rather rudely explained to me that I could either submit immediately to a pat-down behind closed-doors, or he could call the police.

At this point, I didn’t mind having to leave the secure area and go back through security again (this time not opting out of the machines), but I didn’t particularly want to get the cops involved. I told him, “Okay, fine, I’ll leave”.

“You can’t leave here.”

“Are you detaining me, then?” I’ve been through enough “know your rights” training to know how to handle police searches; however, TSA agents are not law enforcement officials. Technically, they don’t even have the right to detain you against your will.

“We’re not detaining you. You just can’t leave.” My jaw dropped.

“Either you’re detaining me, or I’m free to go. Which one is it?” I asked.

He glanced for a moment at my backpack, then snatched it out of the conveyor belt. “Okay,” he said. “You can leave, but I’m keeping your bag.”

I was speechless. My bag had both my work computer and my personal computer in it. The only way for me to get it back from him would be to snatch it back, at which point he could simply claim that I had assaulted him. I was trapped.

While we waited for the police to arrive, I took my phone and quickly tried to call my parents to let them know what was happening. Unfortunately, my mom’s voicemail was full, and my dad had never even set his up.

“Hey, what’s he doing?” One of the TSA agents had noticed I was touching my phone.
“It’s probably fine; he’s leaving anyway,” another said.

The cops arrived a few minutes later, spoke with the TSA agents for a moment, and then came over and gave me one last chance to submit to the private examination. “Otherwise, we have to escort you out of the building.” I asked him if he could be present while the TSA agent was patting me down.

“No,” he explained, “because when we pat people down, it’s to lock them up.”

I only realized the significance of that explanation later. At this point, I didn’t particularly want to miss my flight. Foolishly, I said, “Fine, I’ll do it.”

The TSA agents and police escorted me to a holding room, where they patted me down again – this time using the front of their hands as they passed down the front of my pants. While they patted me down, they asked me some basic questions.

“What’s the purpose of your travel?”

“Personal,” I responded, (as opposed to business).

“Are you traveling with anybody?”

“My parents are on their way to LA right now; I’m meeting them there.”

“How long is your trip?”

“Ten days.”

“What will you be doing?”

Mentally, I sighed. There wasn’t any other way I could answer this next question.

“We’ll be visiting some temples.” He raised his eyebrow, and I explained that the next week was a religious holiday, and that I was traveling to LA to observe it with my family.

After patting me down, they swabbed not only their hands, but also my backpack, shoes, wallet, and belongings, and then walked out of the room to put it through the machine again. After more than five minutes, I started to wonder why they hadn’t said anything, so I asked the police officer who was guarding the door. He called over the TSA agent, who told me,

“You’re still setting off the alarm. We need to call the explosives specialist”.

I waited for about ten minutes before the specialist showed up. He walked in without a word, grabbed the bins with my possessions, and started to leave. Unlike the other agents I’d seen, he wasn’t wearing a uniform, so I was a bit taken aback.

“What’s happening?” I asked.

“I’m running it through the x-ray again,” he snapped. “Because I can. And I’m going to do it again, and again, until I decide I’m done”. He then asked the TSA agents whether they had patted me down. They said they had, and he just said, “Well, try again”, and left the room. Again I was told to stand with my legs apart and my hands extended horizontally while they patted me down all over before stepping outside.

The explosives specialist walked back into the room and asked me why my clothes were testing positive for explosives. I told him, quite truthfully, “I don’t know.” He asked me what I had done earlier in the day.

“Well, I had to pack my suitcase, and also clean my apartment.”

“And yesterday?”

“I moved my stuff from my old apartment to my new one”.

“What did you eat this morning?”

“Nothing,” I said. Only later did I realize that this made it sound like I was fasting, when in reality, I just hadn’t had breakfast yet.

“Are you taking any medications?”

The other TSA agents stood and listened while the explosives specialist and asked every medication I had taken “recently”, both prescription and over-the-counter, and asked me to explain any medical conditions for which any prescription medicine had been prescribed. Even though I wasn’t carrying any medication on me, he still asked for my complete “recent” medical history.

“What have you touched that would cause you to test positive for certain explosives?”

“I can’t think of anything. What does it say is triggering the alarm?” I asked.

“I’m not going to tell you! It’s right here on my sheet, but I don’t have to tell you what it is!” he exclaimed, pointing at his clipboard.

I was at a loss for words. The first thing that came to my mind was, “Well, I haven’t touched any explosives, but if I don’t even know what chemical we’re talking about, I don’t know how to figure out why the tests are picking it up.”

He didn’t like this answer, so he told them to run my belongings through the x-ray machine and pat me down again, then left the room.

I glanced at my watch. Boarding would start in fifteen minutes, and I hadn’t even had anything to eat. A TSA officer in the room noticed me craning my neck to look at my watch on the table, and he said, “Don’t worry, they’ll hold the flight.”

As they patted me down for the fourth time, a female TSA agent asked me for my baggage claim ticket. I handed it to her, and she told me that a woman from JetBlue corporate security needed to ask me some questions as well. I was a bit surprised, but agreed. After the pat-down, the JetBlue representative walked in and cooly introduced herself by name.

She explained, “We have some questions for you to determine whether or not you’re permitted to fly today. Have you flown on JetBlue before?”

“Yes”

“How often?”

“Maybe about ten times,” I guessed.

“Ten what? Per month?”

“No, ten times total.”

She paused, then asked,

“Will you have any trouble following the instructions of the crew and flight attendants on board the flight?”

“No.” I had no idea why this would even be in doubt.

“We have some female flight attendants. Would you be able to follow their instructions?”

I was almost insulted by the question, but I answered calmly, “Yes, I can do that.”

“Okay,” she continued, “and will you need any special treatment during your flight? Do you need a special place to pray on board the aircraft?”

Only here did it hit me.

“No,” I said with a light-hearted chuckle, trying to conceal any sign of how offensive her questions were. “Thank you for asking, but I don’t need any special treatment.”

She left the room, again, leaving me alone for another ten minutes or so. When she finally returned, she told me that I had passed the TSA’s inspection. “However, based on the responses you’ve given to questions, we’re not going to permit you to fly today.”

I was shocked. “What do you mean?” were the only words I could get out.

“If you’d like, we’ll rebook you for the flight tomorrow, but you can’t take the flight this afternoon, and we’re not permitting you to rebook for any flight today.”

I barely noticed the irony of the situation – that the TSA and NYPD were clearing me for takeoff, but JetBlue had decided to ground me. At this point, I could think of nothing else but how to inform my family, who were expecting me to be on the other side of the country, that I wouldn’t be meeting them for dinner after all. In the meantime, an officer entered the room and told me to continue waiting there. “We just have one more person who needs to speak with you before you go.” By then, I had already been “cleared” by the TSA and NYPD, so I couldn’t figure out why I still needed to be questioned. I asked them if I could use my phone and call my family.

“No, this will just take a couple of minutes and you’ll be on your way.” The time was 12.35.

He stepped out of the room – for the first time since I had been brought into the cell, there was no NYPD officer guarding the door. Recognizing my short window of opportunity, I grabbed my phone from the table and quickly texted three of my local friends – two who live in Brooklyn, and one who lives in Nassau County – telling them that I had been detained by the TSA and that I couldn’t board my flight. I wasn’t sure what was going to happen next, but since nobody had any intention of reading me my Miranda rights, I wanted to make sure people knew where I was.

After fifteen minutes, one of the police officers marched into the room and scolded, “You didn’t tell us you have a checked bag!” I explained that I had already handed my baggage claim ticket to a TSA agent, so I had in fact informed someone that I had a checked bag. Looking frustrated, he turned and walked out of the room, without saying anything more.

After about twenty minutes, another man walked in and introduced himself as representing the FBI. He asked me many of the same questions I had already answered multiple times – my name, my address, what I had done so far that day. etc.

He then asked, “What is your religion?”

“I’m Hindu.”

“How religious are you? Would you describe yourself as ‘somewhat
religious’ or ‘very religious’?”

I was speechless from the idea of being forced to talk about my the extent of religious beliefs to a complete stranger. “Somewhat religious”, I responded.

“How many times a day do you pray?” he asked. This time, my surprise must have registered on my face, because he quickly added, “I’m not trying to offend you; I just don’t know anything about Hinduism. For example, I know that people are fasting for Ramadan right now, but I don’t have any idea what Hindus actually do on a daily basis.”

I nearly laughed at the idea of being questioned by a man who was able to admit his own ignorance on the subject matter, but I knew enough to restrain myself. The questioning continued for another few minutes. At one point, he asked me what cleaning supplies I had used that morning.

“Well, some window cleaner, disinfectant -” I started, before he cut me off.

“This is important,” he said, sternly. “Be specific.” I listed the specific brands that I had used.

Suddenly I remembered something: the very last thing I had done before leaving was to take the bed sheets off of my bed, as I was moving out. Since this was a dorm room, to guard against bedbugs, my dad (a physician) had given me an over-the-counter spray to spray on the mattress when I moved in, over two months previously. Was it possible that that was still active and triggering their machines?

“I also have a bedbug spray,” I said. “I don’t know the name of it, but I knew it was over-the-counter, so I figured it probably contained permethrin.” Permethrin is an insecticide, sold over-the-counter to kill bed bugs and lice.

“Perm-what?” He asked me to spell it.

After he wrote it down, I asked him if I could have something to drink. “I’ve been here talking for three hours at this point,” I explained. “My mouth is like sandpaper”. He refused, saying

“We’ll just be a few minutes, and then you’ll be able to go.”

“Do you have any identification?” I showed him my drivers license, which still listed my old address. “You have nothing that shows your new address?” he exclaimed.

“Well, no, I only moved there on Thursday.”

“What about the address before that?”

“I was only there for two months – it was temporary housing for work”. I pulled my NYU ID out of my wallet. He looked at it, then a police officer in the room took it from him and walked out.

“What about any business cards that show your work address?” I mentally replayed my steps from the morning, and remembered that I had left behind my business card holder, thinking I wouldn’t need it on my trip.

“No, I left those at home.”

“You have none?”

“Well, no, I’m going on vacation, so I didn’t refill them last night.”
He scoffed. “I always carry my cards on me, even when I’m on vacation.” I had no response to that – what could I say?

“What about a direct line at work? Is there a phone number I can call where it’ll patch me straight through to your voicemail?”

“No,” I tried in vain to explain. “We’re a tech company; everyone just uses their cell phones”. To this day, I don’t think my company has a working landline phone in the entire office – our “main line” is a virtual assistant that just forwards calls to our cell phones. I offered to give him the name and phone number of one of our venture partners instead, which he reluctantly accepted.

Around this point, the officer who had taken my NYU ID stormed into the room.

“They put an expiration sticker on your ID, right?” I nodded. “Well then why did this ID expire in 2010?!” he accused.

I took a look at the ID and calmly pointed out that it said “August 2013” in big letters on the ID, and that the numbers “8/10” meant “August 10th, 2013”, not “August, 2010”. I added, “See, even the expiration sticker says 2013 on it above the date”. He studied the ID again for a moment, then walked out of the room again, looking a little embarrassed.

The FBI agent resumed speaking with me. “Do you have any credit cards with your name on them?” I was hesitant to hand them a credit card, but I didn’t have much of a choice. Reluctantly, I pulled out a credit card and handed it to him. “What’s the limit on it?” he said, and then, noticing that I didn’t laugh, quickly added, “That was a joke.”

He left the room, and then a series of other NYPD and TSA agents came in and started questioning me, one after the other, with the same questions that I’d already answered previously. In between, I was left alone, except for the officer guarding the door.

At one point, when I went to the door and asked the officer when I could finally get something to drink, he told me, “Just a couple more minutes. You’ll be out of here soon.”

“That’s what they said an hour ago,” I complained.

“You also said a lot of things, kid,” he said with a wink. “Now sit back down”.

I sat back down and waited some more. Another time, I looked up and noticed that a different officer was guarding the door. By this time, I hadn’t had any food or water in almost eighteen hours. I could feel the energy draining from me, both physically and mentally, and my head was starting to spin. I went to the door and explained the situation the officer. “At the very least, I really need something to drink.”

“Is this a medical emergency? Are you going to pass out? Do we need to call an ambulance?” he asked, skeptically. His tone was almost mocking, conveying more scorn than actual concern or interest.

“No,” I responded. I’m not sure why I said that. I was lightheaded enough that I certainly felt like I was going to pass out.

“Are you diabetic?”

“No,” I responded.

Again he repeated the familiar refrain. “We’ll get you out of here in a few minutes.” I sat back down. I was starting to feel cold, even though I was sweating – the same way I often feel when a fever is coming on. But when I put my hand to my forehead, I felt fine.

One of the police officers who questioned me about my job was less-than-familiar with the technology field.

“What type of work do you do?”

“I work in venture capital.”

“Venture Capital – is that the thing I see ads for on TV all the time?” For a moment, I was dumbfounded – what venture capital firm advertises on TV? Suddenly, it hit me.

“Oh! You’re probably thinking of Capital One Venture credit cards.” I said this politely and with a straight face, but unfortunately, the other cop standing in the room burst out laughing immediately. Silently, I was shocked – somehow, this was the interrogation procedure for confirming that I actually had the job I claimed to have.

Another pair of NYPD officers walked in, and one asked me to identify some landmarks around my new apartment. One was, “When you’re facing the apartment, is the parking on the left or on the right?” I thought this was an odd question, but I answered it correctly. He whispered something in the ear of the other officer, and they both walked out.

The onslaught of NYPD agents was broken when a South Asian man with a Homeland Security badge walked in and said something that sounded unintelligible. After a second, I realized he was speaking Hindi.

“Sorry, I don’t speak Hindi.”

“Oh!” he said, noticeably surprised at how “Americanized” this suspect was. We chatted for a few moments, during which time I learned that his family was Pakistani, and that he was Muslim, though he was not fasting for Ramadan. He asked me the standard repertoire of questions that I had been answering for other agents all day.

Finally, the FBI agent returned.

“How are you feeling right now?” he asked. I wasn’t sure if he was expressing genuine concern or interrogating me further, but by this point, I had very little energy left.

“A bit nauseous, and very thirsty.”

“You’ll have to understand, when a person of your… background walks into here, travelling alone, and sets off our alarms, people start to get a bit nervous. I’m sure you’ve been following what’s been going on in the news recently. You’ve got people from five different branches of government all in here – we don’t do this just for fun.”

He asked me to repeat some answers to questions that he’d asked me previously, looking down at his notes the whole time, then he left. Finally, two TSA agents entered the room and told me that my checked bag was outside, and that I would be escorted out to the ticketing desks, where I could see if JetBlue would refund my flight.

It was 2:20PM by the time I was finally released from custody. My entire body was shaking uncontrollably, as if I were extremely cold, even though I wasn’t. I couldn’t identify the emotion I was feeling. Surprisingly, as far as I could tell, I was shaking out of neither fear nor anger – I felt neither of those emotions at the time. The shaking motion was entirely involuntary, and I couldn’t force my limbs to be still, no matter how hard I concentrated.

In the end, JetBlue did refund my flight, but they cancelled my entire round-trip ticket. Because I had to rebook on another airline that same day, it ended up costing me about $700 more for the entire trip. Ironically, when I went to the other terminal, I was able to get through security (by walking through the millimeter wave machines) with no problem.

I spent the week in LA, where I was able to tell my family and friends about the entire ordeal. They were appalled by the treatment I had received, but happy to see me safely with them, even if several hours later.

I wish I could say that the story ended there. It almost did. I had no trouble flying back to NYC on a red-eye the next week, in the wee hours of August 12th. But when I returned home the next week, opened the door to my new apartment, and looked around the room, I couldn’t help but notice that one of the suitcases sat several inches away from the wall. I could have sworn I pushed everything to the side of the room when I left, but I told myself that I may have just forgotten, since I was in a hurry when I dropped my bags off.

When I entered my bedroom, a chill went down my spine: the photograph on my wall had vanished. I looked around the room, but in vain. My apartment was almost completely empty; there was no wardrobe it could have slipped under, even on the off-chance it had fallen.

To this day, that photograph has not turned up. I can’t think of any “rational” explanation for it. Maybe there is one. Maybe a burglar broke into my apartment by picking the front door lock and, finding nothing of monetary value, took only my picture. In order to preserve my peace-of-mind, I’ve tried to convince myself that that’s what happened, so I can sleep comfortably at night.

But no matter how I’ve tried to rationalize this in the last week and a half, nothing can block out the memory of the chilling sensation I felt that first morning, lying on my air mattress, trying to forget the image of large, uniformed men invading the sanctuary of my home in my absence, wondering when they had done it, wondering why they had done it.

In all my life, I have only felt that same chilling terror once before – on one cold night in September twelve years ago, when I huddled in bed and tried to forget the terrible events in the news that day, wondering why they they had happened, wondering whether everything would be okay ever again.

Why I Like Neo4j

Earlier this week, I gave a presentation comparing various SQL/NoSQL databases. I provided an overview of five different databases described their particular use cases, but I noticed myself talking about one much more than the rest: Neo4j.

Part of this is because Neo4j is one of the least-known database from a list that includes PostgreSQL, Redis, MongoDB, and CouchDB. But part of it is because it takes a really fascinating approach to data. While I’ve used MongoDB in the past for a number of applications, I’ve really enjoyed using Neo4j for a couple of recent projects – and I think I finally understand why: MongoDB prefers to internalize data attributes, whereas Neo4j seeks to externalize them. (Incidentally, Neo4j’s approach is loosely analogous to the way objects are handled in Lisp).

Alternatively, MongoDB is about data properties, whereas Neo4j is about data relationships.

In MongoDB, the idiomatic way to represent data is as an object, which contains properties. I might have the following:

  { "name" : "John",
     "state" : "NY"
    }



  { "name" : "Frank",
    "state" : "NY"
    }

If I want to find all New York residents. MongoDB selectors lets me do this with a simple query: db.users.find({"state" : "NY"}). However, let’s be clear about what is actually happening: there is no inherent connection between the “state” field in John’s object and the “state” field in Frank’s object. It is almost as if the fact that both fields have the value “NY” is coincidental. Both happen to “own” the same value and reference this property by the same name. The primary way of interacting with data in MongoDB is by aggregating relationships into objects and then querying against those aggregate relationships.

In Neo4j, I might instead do the following:

This represents the exact same information, but the interface is very different, and one difference is particularly notable: John’s “NY” value and Frank’s “NY” value are both the same – not just by coincidence, but by the very structure of our database relationship. Furthermore, neither the John node nor the Frank node “owns” the NY node.

Finding all New York residents is therefore as easy as finding all directed edges of type “lives in” that terminate on the (single!) “NY” node.

Thus, the primary way of interacting with data in Neo4j is by disaggregating data objects into datapoints and then defining relationships between datapoints. It’s a slight stretch, but we can almost say that the relationships are more important than the data itself! Since Neo4j prefers not to internalize information within nodes, a single node is nowhere near as informative as the entire collection of related nodes.

As a fairly blunt analogy, it’s the difference between the following:

{"_id" :  ObjectId("50e21b4623e50ac61370"),
  "field-1" : "value1",
   "field-2" : "value2"}

This is not to say that Neo4j doesn’t support properties – in Neo4j, nodes can have properties (and edges can too). However, aggregating over nodes by property value is likely suboptimal, and it robs you of the very power that a graph-based database is designed to provide.

This parallels the Lisp object system (CLOS) in a way that’s a bit subtle and probably worthy of its own post. For those of us who naturally prefer functional programming styles, however, graph-based databases like Neo4j may provide an interesting way of looking at our data.

Sputnik: Rising Above the Air

Apple has achieved success in large part because it created expectations rather than satisfying them. This marketing strategy paid off for Apple; for example the iPhone wasn’t compared to existing smartphones like the Blackberry, which would have highlighted its relative shortcomings (no copy-and-paste, inferior battery life, AT&T-lock-in, etc.). It was viewed as its own entity that targeted a different market altogether.

And, to an extent, that market segmentation was initially true – the iPhone caught on quickly among demographics that weren’t using Blackberries for enterprise and personal use. According to this narrative, RIM and Palm sold “personal organizers” with phone functionality, whereas Apple sold “touchscreen smartphones”. If you’d tried to predict iPhone sales by demographic based on Blackberry and Palm devices, you’d have been way off, because the devices targeted very different markets.

Criticisms of the iPhone based on comparisons to Blackberries and Palm devices didn’t hold up as well, because the target iPhone users didn’t have the same expectations as existing PDA + phone users – many of the first iPhone most passionate users had never owned a smartphone or PDA before. When the iPhone finally got some of these missing features, they were a nice surprise, but they weren’t deciding factors for the first generation of users. iPhone users didn’t complain about the lack of voice control and drop-down notifications (available in Android since very early versions), but they still celebrated the release of Siri and iOS5 notifications without comparing them to the devices that had offered this support for ages.

I was excited to hear yesterday that Project Sputnik was coming out of beta. As a beta tester, I can testify that the computer, a Dell XPS13 supporting Ubuntu out-of-the-box is excellent – in fact, it may be the single best laptop I’ve purchased.

I fielded a number of questions all day yesterday about the laptop on Hacker News. Most people were asking questions about how it compared to the Macbook Air in the predictable ways: display resolution, keyboard feel, touchpad, suspend support, etc. While I’ve been happy on all of these counts – the Sputnik keyboard, for example, is clearly superior – they’re far from the most important things I look for in a laptop.

Many of the components of the “Apple touch” sound fine in theory. It’s just that, when you get down to brass tacks, I’d gladly trade a metal vs. plastic chassis for tiling window management, focus-follows-mouse, and a Caps Lock key that isn’t hilariously incompatible with Vim. (Not to mention the underlying operating system itself: unified package management, tmpfs support, etc.) And have – I’ve run Linux on other hardware (Samsung, HP, etc.) for some years now as my main computers/laptops.

People who criticise the XPS13 in comparison to the Macbook Air for feature $X are missing the point, just like the Android users who laughed at Siri for implementing a fraction of the voice commands that Android had provided for years. Siri wasn’t made to compete with an Android feature; it was made to compete with previous versions of iOS and targeted at those who would never have considered buying a non-iOS phone.

In the same vein,, I don’t like the Sputnik laptop because the Macbook Air is “good enough” and the Sputnik laptop is better. I like it because I dislike the Macbook Air, and Sputnik just so happens to borrow the few appealing aspects of an otherwise unappealing laptop and adds that to the existing models I know and love.

Android has four times the market share as iOS, but for many iPhone users, switching isn’t even a possibility. The iPhone has transcended the realm of competition for a small minority of the market by competing with nobody but itself. It’s not even close to the dominant mobile platform, but nobody’s complaining about its profits.

Similarly, while Linux may never gain the majority share of the Ultrabook market – even among developers – it doesn’t need to in order to be indispensable for a smaller, but highly profitable, minority of the market.

Not surprisingly, Sputnik’s price bothered some Apple users. While I was fortunate as a beta tester to receive a 20% discount on the Sputnik model I currently have, I would easily have paid the sticker price ($1,549) if I were getting it today. The price compares favorably to the Macbook Air, spec-for-spec2, but again, that misses the point. I would easily pay more for a machine simply because it provides out-of-the-box support for a better OS. Linux may be free-as-in-freedom, but I’d still prefer it even if it weren’t free-as-in-beer as well!

Objects & Procedures: A Python and Java Comparison

Earlier today, I had a discussion with another hackNY fellow about whether Java was more strictly object-oriented than Python. While neither language is truly object-oriented in the pure sense, it’s clear to me that Python is hands-down more consistently object-oriented, whereas Java is a mixture of object-oriented and procedural programming.

Put another way:

Java forces you to write class-based code using both objects and non-objects, requiring you to juggle both objects and non-objects simultaneously.

Python forces you to write object-based code, so you only need to handle objects, ever.

Like a good citizen of the OO world, Python makes objects so transparent and seamless that you don’t even realize that basic calls like addition involve objects.

a = 5
a += 2

As we shall see, Python lets you break out of OO strictness, but only if you really, really want to (which means you also really know what you’re doing.). Python also lets you take advantage of this object-oriented abstraction, by redefining integer addition on odd numbers to perform division instead (for example) – but again, only if you know what you’re doing!

(Python’s type system is a bit complex, so I will have to gloss over some of the details here. If you’re interested in more, I would recommend reading this StackOverflow question about metaclasses in Python and the book Python Types and Objects (available for free online). If anybody know similarly good resources for Java, I will be happy to add them here.)

Object-Oriented programming is just functional programming in disguise

Yes, you heard me! And just so you don’t take my word for it, here’s a 2003 email from Alan Kay (the ‘inventor’ of object-orientation). He closes with the essence:

OOP to me means only messaging, local retention and protection and hiding of state-process, and extreme late-binding of all things. It can be done in Smalltalk and in LISP. There are possibly other systems in which this is possible, but I’m not aware of them.

(Note that he does not mention inheritance, classes, or polymorphism – having these does not imply object-orientation!

Also note that this email is from 2003, around the height of Java’s popularity.)

Understanding Messages

This is the most important one. You can spend a lot of time studying messaging, but I’m going to cut to the chase and tell you that (spoiler alert!) messages is basically just currying.

In the Smalltalk sense, you have an object, and you can pass messages to it. The result will be another value, which may be another object that you want to pass messages to.

This is no different from functional programming; a method is a higher-order message which takes other parameters (messages) and returns values. Calling a method and providing a parameter to a method are both just messages.

Understanding local retention, protection, and hiding

This could be a blog post in itself, but it’s essentially a comment on implementing encapsulation using scope and closure. An oversimplification: closures are a way to ‘export’ access to local variables while still maintaining control over them (ie, how they can be access/modified, and by whom).

Understanding late binding

This is the sticking point. Python is dynamically typed and uses duck typing. In other words, the following call:

$ foo.bar

does not need to know the type of ‘foo’ – all it does is look up the list of attributes that ‘foo’ has and looks for something called ‘bar’. You can do this manually with the getattr() function or the __dict__ attribute. If that attribute is a callable (a function), you can also do

$ foo.bar()

or

$ foo.bar(5)

This is more or less the same as passing foo the message ‘bar’, then passing the message ’(’ telling it to access the hidden ’__call__’ attribute, then passing it the message ‘5’ and the message ’)’ telling it to end the call.

What happens if ‘bar’ is not found? This is where things get interesting:

If an attribute is not found in the object, it then looks up the attribute in the class. But classes are objects in Python, so it’s looking up the attribute in another object. This is because Python classes are really just syntactic sugar for prototypical inheritance.
If getattr() doesn’t see the attribute listed in the dictionary of attributes, it then looks up the .__class__ attribute and then looks in the __dict__ associated with that. (The docs provide more precise information).

Don’t be fooled by the name .__class__ – this doesn’t actually have to be a class (at least, not the way you’re probably thinking of a ‘class’!).

This means you can do wacky things like this:

(I’d encourage you to experiment with this yourself! Try modifying the attributes).

In other words, “class Foo(object):” is syntactic sugar that creates an object of class ‘type’ with a ’__name__’ attribute of  ‘Foo’, then binds it to the external variable name Foo. We could do this without a ‘class’ keyword altogether, by writing:

Foo = type(‘Foo’, (object,), {‘apple’ : ‘red’})

Note that the external name and the ’__name__’ attribute are completely independent. 

(In fact, not only can Python objects be created without the ‘class’ keyword, they don’t even need to have classes, as long as they are capable of handling all of the messages that an object with a class can.)

Note: the reason this is possible is not that Python is a dynamic language; the reason this is possible is that Python objects don’t ‘inherit’ from classes; they simply contain a ’__class__’ attribute that is a reference to another object, which can be accessed, mutated, and referenced just like any object.

Objects all the way down…. almost

What happens when you get to the prototype of a prototype of an object (or equivalently, the class of a class of an object)?

To avoid getting into higher-order type theory, I’m going to wave my hands a bit and point you towards the concept of a kind; that is, the type of a type constructor.

It gets down to this: all of Python can essentially be derived from one kind – if you follow the turtles (prototypes) all the way down, you’ll eventually reach some common ground. And you don’t even have to go that far to see the benefits – you can access attributes (functions and values) of objects, classes, and values interchangeably, because they’re all objects. Classes included.

Which brings us to Java….

Everything is an object (except if it’s not)

Java fails to be an object-oriented language for one reason: In Java, all objects have a class, but not all typed values have classes, so some values can have a type without being an object.

This is another way of saying that Java supports (and requires) multiple kinds. This is illustrated very easily by the need for the object autoboxing for primitive types. The following code will fail with an interesting error code:

because an int is not an object. You need to provide an Integer, which behaves the same most of the time…. except when it doesn’t. Many people incorrectly refer to Integer as a ‘wrapper object’, but while it’s not a primitive, it’s not an object either; it can be used interchangeably with objects 98% of the time, but not the remaining 2%.

That 2%, ‘except when it doesn’t’ seems small, but it’s the key to understanding why Java is not actually object-oriented. It’s not quite class-oriented either, but it’s more class-oriented than object-oriented, because you rarely (never?) create objects directly; instead, you create classes (named or anonymous) which you later instantiate as objects (sometimes only once).

The fact that Java is (almost) class-oriented doesn’t make it any more object-oriented; in fact, it makes Java less object-oriented, because classes prevent many of the abstraction properties that make OO programming powerful.

If there’s interest, I could illustrate some of those limitations in Java specifically, though for now, I think I’ll save that for a separate post!

Appropriating Your Cake and Eating It Too

I was very disappointed this evening to find that, with their new API rules, Twitter is trying to eat their cake and still have it too. To put it simply, ask yourself this: would Twitter be what it is today if these policies had existed from the start?

Meetup had its own sink-or-swim moment when it began charging for Meetup groups. Changes like these affect the way the product is received by a network; they don’t change they way the product can be used, but they change the way the product is used.

This happens because network-driven products are eventually appropriated by the network. If you run a network-driven product, you want this. It means your users are teaching you how to use your product, not the other way around. You may even change your company’s vision in response. This is a Good Thing.

The flip side of appropriation is that you no longer own your product. You may think you do. Your server costs may disagree. But you’re mistaken if you think that public control of your product starts with your IPO.

Taking bold moves and yanking your product out from under your users’ feet works for a while. Sometimes it may be the right decision. But Twitter should have realized that the last time they were in this position was in 2008, by my estimate.

From the start, Twitter has grown because it is quasi-universal. The 140 character limit was chosen for compatibility with text-messaging. To say that the third-party clients have been a boost to Twitter’s traffic would be a disservice; Twitter’s own official clients on OS X and iOS were originally third-party creations.

Very early on, Twitter had two choices:

1. Double down on their API, brand themselves as a  platform, and monetize accordingly (data, advertising, or usage-based pricing [which is different from applying for permission!])

2. Become a closed network, with centralized tools for interacting with the network, and monetize off of a walled garden.

Now, the choice is still there – but it’s no longer Twitter-the-company who will be deciding. And it seems Twitter-the-network has a very different vision in mind.

The Irrational Choice

Spectator has defined my college experience in a way no other organization could. I first signed up for the mailing list during a prospective students’ visit over four years ago – before I even was a student at Columbia – and have been there ever since. After all that time, having held multiple titles (including president), I finally got to see my own words printed today in the paper for the first, and only, time as a student here.

Speech is free, but words aren’t cheap. My college career, in 785 words: The Irrational Choice.

Online Piracy: The New 'War on Drugs'

Recently, I was asked to lead a discussion for a Columbia student group about internet ‘piracy’. The topic isn’t synonymous with SOPA/PIPA/ACTA, but those bills obviously came up. Glenn Greenwald does an excellent job explaining why, even if SOPA is dead, we may still be losing the war.

This is what I have to add about all of those bills.

No law will ever stop online filesharing (in the long run).

Copyright, copyleft, public domain, whatever – it doesn’t matter. Technology moves too fast, and government moves too slowly. We’ve seen it time and again – they shut down Napster, then Kazaa popped up. Kazaa came under fire, then torrenting became popular. Now the trend is towards magnet links, which are even easier to share, and even harder to censor. Temporary setbacks aside, if you really want to keep getting digital media for free, I’d bet almost anything you’ll still be able to in ten, fifteen, twenty years. (If we haven’t yet moved beyond digital media to telepathy by then, that is).

It’s worse than the drug war, because it’s not even a fair battle. You need a lot of cooperation in Congress to get a bill passed, but you only need one Shawn Fanning or one gojomo to come up with a brilliant innovation that turns everything on its head again. At best, this is an arms race – an arms race in which the technological innovators have the upper hand every time. 

Even with every law in the world on yours side, if you can’t even stop people from buying and selling drugs, which are rival, excludable, and expensive[1], don’t kid yourself thinking you can stop people from consuming a good that costs nothing to reproduce, and at zero marginal cost to both supplier and consumer.

These laws should be applied universally, or not at all.

The natural counterargument to my first point is that ACTA/SOPA/PIPA would/should only go after ‘the worst offenders’. That’s even worse. If you’re going to censor information, it has to be censored equally and uniformly. That’s the difference between applying a law out of principle and applying a law because it suits your own interests.

That statement applies to many laws, and it’s why I feel so strongly about it. With the war on drugs, we also go after ‘only the worst offenders’, and look where it’s gotten us. Any law applied selectively is applied with a bias, whether intentionally or not – it’s just that the bias may not be obvious.

With the war on drugs, the real victims are primarily racial minorities (especially black/Latino), the poor, and youth. (This is such common knowledge that I won’t even bother linking to sources, but if you really don’t believe me and can’t find a credible source, let me know.)

Sometimes, that’s the entire point. There are plenty of examples of laws which have been used primarily – even exclusively – for purposes completely unrelated to the original ones. The PATRIOT act is only the most recent controversy that comes to mind; U.S. (and world) history is littered with other examples. The recent ‘child porn’ law, if it it passes, would eventually be used for far more than child pornography – mark my words. Child porn is just a convenient red herring.

The war on drugs marginalizes certain groups so dramatically that I’ve heard it referred to as ‘the new Jim Crow’. With ACTA/SOPA/PIPA, I don’t know who the real victims would be. Certainly not ‘the worst offenders’. Maybe youth? Political activists? Independent musicians? I don’t know. All I know is that I don’t want to find out.

But ‘pirates’? Nah. Don’t worry about them. The government will ‘stop’ filesharing, just like it ‘stopped’ drug use.

[1] Even if you don’t trust the DEA’s published list of street prices – and I wouldn’t blame you for not – I think it’s clear that the street price for any drug is greater than $0.

 One of the nice things about living in New York is that I have…

 One of the nice things about living in New York is that I have the opportunity to experience the Occupy Wall St. protests directly, without the filter of any secondary source. Last weekend, I was in the financial district, so I took a short walk to Zuccotti Park, the campground that protesters now dub ‘Liberty Park’. At the bottom are two of my favorite pictures from the trip.

After seeing the protests firsthand, all I can say is this: these people aren’t kidding around.

I can’t say that I agree with all of their concrete goals. But whether or not you do agree with them, it’s clear that this isn’t some temporary fad. Before, I was shocked when Mayor Bloomberg backed down on his plans to clear the park, but after visiting the park, I can see why. On this Saturday afternoon, the park was filled with an incredibly diverse range of people – not at all some easily dismissed ‘fringe group’. But here’s the kicker – the part that should really terrify anybody who wishes that the Occupy Wall Street protests would just go away:

These people look happy.

I’ve seen my fair share of protests before, and people tend to look fired up and ready for action. Sure, the OWS protesters are angry and ready for action too. But they’re also clearly comfortable where they are – camping in sleeping bags on a semi-private park in downtown Manhattan. With a band playing in one corner and street cart food vendors all around the edge of the park, it wasn’t too hard to close my eyes and imagine myself in a modern-day Woodstock. I talked briefly to a few people, and they seemed like a political protest was exactly what they wanted to be doing on a Saturday afternoon, thank you very much. 

And that was only a few hours before thousands of them stormed Times Square.

When the weather gets cooler around mid-November, I expect the crowd in Zuccotti Park to shrink, but that doesn’t mean I think Occupy Wall Street will die down. Already there are signs that it is spreading to universities like Columbia (which, in case you’ve forgotten, has quite a history of protest).

You may not agree with the objectives of Occupy Wall St. – I find some of their goals problematic myself – one thing is clear. When you have a bunch of people protesting out of anger and frustration, there’s trouble ahead. But when you have a bunch of people protesting from anger and frustration and genuinely enjoying the fight, you’d better believe that they won’t just fade away.

(I’ve spoken to some friends in other cities who are under the impression that this is a ‘dreads vs. suits’ battle. These two photos that I took last week tell a different story – one of the reasons I believe that this isn’t going away anytime soon.)