My Octopress Blog

A blogging framework for hackers.

New York City - a Nice Place to Live, but I Wouldn’t Want to Visit

I’m living in New York, New York this summer while I work at IBM Research. From the offset, I was skeptical of the city. Any city, really. I grew up in Colorado, where the population of the entire state is less than a third of that of the NYC metro area.

The first week was a little rocky, but mostly because I was unfamiliar with my neighborhood and wasn’t sure where people went to do their grocery shopping, to eat, grab a drink and so forth. By Monday of the following week, I knew my commute to work like the back of my hand, blending in among the real New Yorkers with the disaffected forward-looking stare that says, “I just want to get where I’m going, pal.”

When I first arrived, I was on a red-eye flight and got in around 9. I had contemplated taking a taxi to my place, both wanting to have ridden in a New York City Yellowcab and not wanting to deal with public transit, but when I got there I felt like I ought to hit the ground running. Riding on the bus, I examined the faces and demeanors of all those around me, wondering to myself which best embodied the New Yorker. On the bus, off the bus, transfer to another bus in Harlem. The name of the neighborhood brought to mind poverty and violence, and frankly, as a wet-behind-the-ears exhausted-and-irritable honkey with luggage, I had no idea what to expect. Getting off the bus and walking to the transfer, I passed the undeniable odor of marijuana, urine, drunk and irate homeless people and so forth. Bear in mind this was about 10 am on a Sunday. But while waiting, I realized something sort of magical about the city – no one cares. If you don’t get in anyone’s way or make yourself particularly noticeable, but just wear that look of just wanting to get where you’re going, no one will notice you’re there.

I had imagined that it would be a city of all kinds (which, it really is) but also a city of all kinds of rude. This was a major misconception. Though most citizens would not return a “hello” from a stranger on the street, most will help with directions when asked and apologize when they bump into you. I had hoped that at some point during the summer I would accidentally bump into someone who would then call back at me “hey, I’m walkin’ here!” This seems unlikely to happen at this point.

There are some stereotypes that are true to TV life. Attractive, busy and exasperated professional women are in abundance, a la Liz Lemon of 30 Rock, for example. There is a certain level of dress that seems to be expected here, even on the street. Most men wear shirts and resort to jeans as their most casual and most women, at least this time of year, wear dresses, though I think that might be because of how outrageously hot it can get.

The New Yorker’s hatred of tourists is a uniting factor, and something that I began to understand almost immediately. It can be easy to get distracted by the enormous buildings, and visual stimuli, but most inhabitants pass these things every day and are just on their way to work, or dinner, or a friend’s. I’m gaining a sense of what parts of the city to avoid for this reason - it’s very frustrating to get stuck behind a slow-walking tourist who’s aloofness makes him meander windingly down the sidewalk, impossible to pass. Times Square is a death trap – three blocks of fanny-pack-wearing fathers trying to decide what to see next, keep track of lagging children and generally getting in everyone’s way. But, let the tourists have Times Square.

Don’t take too long here. A friend who shall remain nameless visited me here, and used to the slower-paced life in Boulder, CO, she pondered what she wanted from a pizza place only after we had gotten to the front of the line. On another occasion, she flip-flopped on her order. To be fair, these places weren’t extremely busy, but it brought to light the fact that there’s an expectation here that you have been to a place before, know exactly what you want, and can complete your transaction in less than a minute. In some ways, this is a charm that I like; there are many places to eat here, but I’ve quickly developed preferences and can walk into my favorite pizza place and make my order like a regular.

My favorite things about New York couldn’t be experienced in a vacation here. When I first moved in, for example, I was so pleased with the view from my place. Not that it’s particularly incredible (I live on the Upper East Side and I don’t know what sort of reputation the neighborhood holds as far as views), but I like it all the same. I look out my window and I see dozens of different buildings that I would call skyscrapers, all designed differently, peppered with garden terraces and charming signs of age. The jagged horizon is somehow enchanting, and my curtains always stay open. At night the neighboring buildings provide a soft and diffuse light, and different patterns of lit windows.

I love walking down certain streets and being able to see down the avenues, the tiny separations between giant buildings. Properly positioned, you can sometimes see a mile or so before a hill obstructs the view. It reminds me of a project I saw to create a horizonless map of Manhattan.

The last few hours of sunlight in the day are perfect. People talk about the Colorado sky, or the sunsets we have, but I’ve never seen light quality quite like this. It’s a beautiful golden warmth every day without fail. It makes me want to curl up and take a nap, or stretch out on the lawn and enjoy the end of the day. In the park, this deliciousness is only compounded by the reservoirs, the heavy trees and residents playing frisbee, picnicking and taking walks along the paths. It’s a beautiful time, and there’s an odd sense of community to it. I’ve often wondered if such a place existed, where there isn’t any one group that’s out and enjoying the place, or even a tight-knit group of neighbors. But there is a dense packing of total strangers who can come to the same place and enjoy the grass and the outdoors.

Almost most of all, I love Central Park. I was excited when I found my place because it’s a mere three cross-town blocks from Central Park. I bike around there almost every day, and it’s almost always a treat. There are hordes of runners, cyclists, rollerbladers and even a few cross-country skiers. As a cyclist, you have to keep a watchful eye on the bipeds you’re passing as they sometimes have a tendency to step out in front of you. We largely ignore crosswalks, and only the few cars on the road observe them. There are some sections that are filled with horse-drawn carriages, bikeshaws and more adventurous tourists who decided to rent a bike and ride around the park, but you make do. Sometimes it’s actually quite a thrill to be riding as fast as you can and dodging these obstacles and having a little friendly battle with other riders. This, too, is a nice feature about riding here – no matter what your level, you can always find an equivalent cyclist for a little friendly competition and motivation.

Biking in the city is also a pretty big rush. In the morning hours, most of the usually-busy roads are ghost-towns, but seventh avenue at 7 in the evening is a sea of taxis. I was riding down one day to Penn Station in the evening, catching a train out to Long Island to see a friend. A bicyclist will make it down there faster than a taxi, but it’s not for the faint of heart. Sprint, breaks, sprint, dodge pedestrian, coast, zip between cars, breaks, sprint. There are no bike lanes, but rather only the spaces between cars. The upside of this game of Frogger is that you can zip out between any two lanes where there’s space. I’m not quite sure how cab drivers feel about us, but I imagine that if nothing else, they’re quite used to people with a death-wish.

Had I never spent more than several weeks here, I never would have discovered what I love about the city. These are the things one does and notices not when trying to visit the Met or Times Square or the Empire State Building, but only when you’ve enough time to be alright with not packing every waking hour or weekend with a trip to somewhere new and exciting. This is the meandering life, and enjoying it.

Shared Objects

Shared objects are great. Imagine you have several programs running that all make use of the same library. If they are all statically linked against that library, then there will be several copies of essentially the same code in memory. Shared objects allow all these programs to reference the same code, held in memory in only one spot.

I’ve recently been spending a lot of time trying to get a few key libraries compiled on a cluster, where the idea is to run jobs based on these libraries in parallel. As memory is particularly limited, and there are several cores per node, I figured it would particularly make sense to compile everything as a shared object. Also, a subsequent library depended on it.

A lot of different packages configure, build and install themselves in a number of ways and often don’t adhere to conventions. Despite trying every flag known to man into the configuration tools, I was unable to get a particular piece to build as a shared object. But I happened upon a particularly useful code snippet to save the day:

1
2
ar -x mylib.a
gcc -shared *.o -o mylib.so

Colbert Report

One of the joys I was hoping to experience here in New York City was to go to a filming of The Colbert Report. Unfortunately, getting a ticket can be tricky. There are rarely tickets available, and so you have to sign up to receive notifications when they become available.

If you do not constantly sit on your email, your chances of going are greatly diminished. I’ve been trying for about a month, because as a computer scientist, I am often on my email and can usually respond pretty quickly (< 5 minutes). Today… was my lucky day. Sort of.

I responded within a minute of receiving a notification, and was pleased that today I had been fast enough. There were still 40 tickets left! By the time I had finished filling out the form, there were a mere 28 left. I’m sure that in a couple of minutes the whole thing had closed off. It would seem that Colbert’s a popular guy.

So, here’s the trouble… the filming is on August 23rd, about a week and a half after I leave the city, and mere days before returning to Saudi Arabia. Just… my… luck.

Sockets, Endianness and Your BlueGene/P

Endianness is one of those things that, as a computer scientist you learn about but rarely have to think about. It does occasionally come into play and I recently had some frustration with it.

For the uninitiated, it’s talking about the order in which bytes are stored in memory, and unsurprisingly, different processors have different philosophies regarding this.

The term itself comes from Gulliver’s Travels, when two groups have strongly-held beliefs regarding on which end it was best to crack a hard-boiled egg. And as in the book, it can cause tension.

I’m working with a library in which a server and client communicate over sockets, and they tend to prepend their messages with the length of the message to follow. In the code, it’s stored as a four-byte integer, and for the most part, it works beautifully. However, we recently ported it to the BlueGene/P, which uses PowerPC chips. These, unlike the common Intel chip, are big-endian, and so client and server would hang, waiting for an exceptionally large message when only a small one was sent. For example, there are some common messages that are 329 bytes long. If you interpret the value 329 using the alternative endianness, you’ll expect 1224802304 bytes, or about 1.2 GB.

I’ll admit that it took a while to catch, but we eventually got it figured out. We don’t use sockets much, but couldn’t imagine that this was a problem that hadn’t been encountered before. After all, the internet uses sockets, has been around for a long time, and it’s not as if big-endian devices aren’t allowed on. It turns out that there is in fact a convention - that information sent over sockets ought to be in big-endian format, but networking libraries provide you with functions to help out with this.

The functions htons, htonl and sometimes htonll convert Host to network two-byte, four-byte and eight-byte messages respectively. And the inverse functionality is encapsulated by ntohs, ntohl and ntohll.

Lesson learned.

Freediving

One of the greatest features of KAUST is its proximity to the Red Sea. In fact, when I look out of my apartment window, I see water in the harbor a mere 30 meters away. The campus beach is all of a 10-minute ride away. Countless afternoons friends and I have decided that we don’t need to go back to the office today and that our time might be better spent snorkeling on the reef.

Skin diving is great by virtue about its accessibility. Strictly speaking you just need goggles, but that’s easily augmented with a snorkel and fins - all things you can just throw in a backpack. And in fact, some people can hold their breath for relatively long periods of time. At least, long enough to go down, see something interesting and come back up. However, there are others that take it to a whole different level:

via WonderHowTo

While I’ll continue to work on holding my breath, I think a pony bottle or bailout bottle would be an interesting addition to all this.

EPICS

Engineering Practices Introductory Course Sequence. Every student from the Colorado School of Mines has taken the two-course series, and talks about it with a slight distaste in his mouth. For some students it’s a much-needed first pass at writing reports, dressing up, speaking in front of others. (This is something I’ve actually come to appreciate about the system - its emphasis on presenting to peers.)

I remember when I took it, we were supposed to design a small device within certain (relatively arbitrary) constraints to collect a soil sample. The premise was unrelatable - that we might one day be responsible for a subsystem deployed to collect a soil sample on a distant planet, without thought about its return.

It’s become rather popular lately in certain communities to program and attach digital cameras to weather balloons and take pictures from as high up as 30km (about 20 miles) or so. The results speak for themselves:

What I found regrettable about my EPICS experience was that it was too far removed to really care about the project. It had its fun moments, and I was glad that for EPICS 2 I got to work on a project I really believed in with some friends (it was a considerable improvement). But this is an example of a project I contemplate and eye over longingly, even outside the context of a course. Similar projects can cost on the order of a couple hundred dollars and are relatively feasible, even for freshman engineers. To have something you built venture farther from the earth than any one of us likely ever will, bring back pictures and live to tell the tale would be extremely rewarding.

Had there been projects like this when I was in school, I know that my experience would have been that much more enriched.

Women Drivers

Living at KAUST comes with certain privileges not extended to Saudi at large. For example, women do not have to wear abayas on campus, or even scarves to cover their hair. Men and women are allowed to talk openly, although there are restrictions on fraternization. Also, women can drive.

Thus, it occurred to me recently - if you’re a woman driver in Saudi, you get arrested and then who knows what else. If you’re a woman driver in the US, you get a discount on your car insurance.

It Was a Triumph

With Steam now available for Mac, I’ve finally come to 2007 and played Portal. Now I finally have a context for the internet memes that we all know and love.

As a game, it was fantastic - some of the puzzles are pretty challenging, but the mark of a good game is that it builds you up to make you better. Each of the test chambers develops a few critical skills or techniques, and these situations can be recognized by type later on and solved analogously. By the end, you’ve developed a complete skillset for solving much more complicated puzzles than at the beginning. It’s an important difference - a game that develops you and a game that simply gets harder.

One of the things that makes it really enjoyable to play is the quirky commentary provided by GLaDOS. It is peppered through out with phrases like, “at this point you’ve realized that our last statement was of course a complete fabrication,” and “did you know that you can donate any of your vital organs to the Aperature Science self-esteem program for girls?”

I enjoyed it immensely and look forward to playing other titles from Steam, like Half-Life 2 and so forth. For those of you who missed it, I’m Still Alive:

Heartsaver Course

A fellow student recently arranged for a number of us to take a CPR and AED (automatic external defibrillator) short course. I think every one of the 11 KAUST students is either an avid diver and/or snorkeler.

I can’t speak for everyone, but I know for my personally it was because I wanted to be able to be a better dive buddy. (In PADI and all diving certifications you’re supposed to dive with a buddy for both safety and fun.) Although we always take appropriate precautions when diving, it can still be a dangerous sport. We all feel like learning CPR and how to operate an AED were easy steps to mitigate some of this risk.

During dive training, we have to practice some emergency maneuvers, but I always had this lingering curiosity about whether or not it would come back to you naturally during an emergency situation. Once while diving, my friend Noah took off his tank and regulator and swam over to our friend Luca and signaled that he was out of air, asking to use his alternate air source. While it’s a simple act to share your air, seeing another diver pop up needing air would be quite a surprise.

That said, I realized after the course that we were at least better prepared for unforeseen accidents than we were when we started.