Monthly Archive for March, 2008

The New Cultural Communities

Stewart Mader links to an interview of Professor Richard Florida at Newsweek about the increasing link between place and psychology.

Florida points out that industries in large cities have become far more specialized:

New York is great in fashion design and investment banking. San Francisco’s great in software. L.A.’s great in entertainment technology. And Nashville is the epicenter of music production. So if you want to pursue a given career, it’s not just that you can make it in any big city, because now there is a smaller number of big cities that will be the key places for you.

He goes on to emphasize the influence that an individual’s choice of a place to live will have on his or her opportunities in life:

But many of these people give little thought to the fact that where they live will have an effect on so many facets of their lives—from their ability to find a mate to their access to certain careers. You need to be smart about place to actually have the life that you want to have.

I think that we’re in the middle of a large global reorganization. For a very long time predating mass communications, local cultures were highly individualized and often cut off from one another. People’s values and customs were a product of their culture, of their specific geographical location, of their ethnicity.

With the mass media, rapid travel, and global economy that developed in the 20th Century, local cultures broke down in some ways as the boundaries were no longer defined by geography or ethnicity. People were exposed to new ideas, and new cultures of like-minded people grew up as a new layer above (or below?) the geographic centers. You saw the emergence of cultures that exist both as a subset of any given local culture, and as a global culture with mirror images that sprung up across the world. As examples, I mean things like youth cultures (punk, goth, rave, etc.) as well as tech/geek cultures, and as more people become connected online, more and more niche cultures arise with both local presences within geographic communities, and global bonds via the Internet. These are cultures based on ideas and outlooks, rather than upbringing, and increasingly, people are finding cultures that fit their personalities, joining those communities, and ignoring or rejecting the traditional cultures that they were brought up with.

But the really interesting part is how ease of travel means that more and more people with a strong foundation in one of these new cultures are banding together in geographical locations. You can see this especially in the Bay Area, home of not only tech culture, but also progressive politics and a certain artistic aesthetic. It seems that so few people here are native, most having moved here to join one of these cultures, and the ones that are native are just as fully immersed. The natives who don’t identify with the new culture of the Bay Area are barely present — maybe they’re leaving the area, or perhaps they’re just drowned out. You can see this in many other cities too, like Berlin’s young bohemian party culture, LA’s entertainment industry, DC’s political machinery, etc. Affluent people are both flocking to these cities, and flocking away from them, depending on their affinity for the new cultures that have arisen within them. Many young people who are raised within the metropolitan area of these cities either accept the values of their dominating cultures, or they leave for a city that fits their personality better.

What this all adds up to, IMO, is a mass reshuffling of the deck. Within time, the whole world — or at least the portion of it with the means to do so — may rearrange itself according to the personalities and preferences of its inhabitants. And then it seems like we’d be right back where we started, in a way, with cultural boundaries drawn by geography. On the one hand, we would still have the communication technology to provide exposure to other cultures, but on the other hand, as the access to this increases and people have to filter more and more of it, I wonder if people will choose to expose themselves to other cultures.

Infallible APIs

Fellow Atlassian Charles Miller recently wrote an amusing post about methods and constructors in Java that declare a checked exception, but can be called in a way that is required by the specification not to fail. A common example involves string encodings:

try {
    s = new String(byteArray, "UTF-8");
} catch (UnsupportedEncodingException e) {
    throw new Error("UTF-8 is missing??");
}

This code is the result of two conflicting factors. On one hand, since the constructor in question takes an arbitrary character encoding, the case of the encoding being unavailable must be taken into account. On the other hand, 90% of code that calls this constructor will be explicitly invoking a character set that is required to be provided with the Java Runtime Environment, and its absence would be an error serious enough to justify terminating the VM entirely.

The unnecessary exception-handling code is ugly, and obscures the actual intent of the method in which it appears. Charles jokingly proposes adding a “yoda” statement to Java to tell the JVM, “do, or do not; there is no try.”

Another Solution

Usually, code smells like this indicate a poorly-designed API. If you know the method can be called in a way such that failure would mean there’s an internal error, then it shouldn’t be throwing a checked exception. As is often the case, you could solve this problem with stronger types:

public class Charset {
    public static Charset findByName(String charsetName)
        throws UnsupportedEncodingException
    // ...
    public static class Standard {
        public static final Charset UTF_8 = //...
        public static final Charset US_ASCII = //...
        /// etc.
    }
}

Then give String a new constructor:

    public String(byte[] bytes, Charset charset) {
        // no exception declared!
        //...
    }

Now you’ve got a few different ways to use this. When you know you want to use a built-in encoding:

    String s = new String(byteArray, Charset.Standard.UTF_8);
    // no checked exception here!

When you want to use a variable encoding, that may or may not be defined in this VM:

    Charset charset;
    try {
        charset = Charset.findByName(charsetName);
    } catch (UnsupportedEncodingException e) {
        System.err.println("Unknown charset: " + charsetName
            + "; falling back to US-ASCII");
        charset = Charset.Standard.US_ASCII;
    }
    String s = new String(byteArray, charset);

And the original String constructor could remain—rewritten to use the new Charset facilities—as a convenience for the case where you really do want to use an unknown encoding, and fail if it’s not present:

    try {
        String s = new String(byteArray, charsetName);
    } catch (UnsupportedEncodingException e) {
        System.err.println("Unknown charset: " + charsetName
            + "; ignoring");
    }

The Worst Part of it All

As it happens, Sun, did add a Charset class to Java in 1.4, as part of the NIO framework. Astonishingly, they still did not define constant implementations of Charset for the set of required standard ones. So you still have to look them up by name, and you still have to catch an exception! Worse yet, they invented some new exceptions for the purpose, UnsupportedCharsetException and IllegalCharsetNameException. These exceptions are unchecked runtime exceptions, which avoids the problem of having to clutter your code with exception handling code in the cases where you are using a standard charset, but makes it easier to mishandle cases where you aren’t.

The kicker, though, is that String does not have a constructor that accepts a Charset object! Instead, you’re supposed to use the CharsetDecoder class or the decode method of Charset, which wraps everything in Buffer objects, making you jump through a few hoops to accomplish the same things:

    String s = Charset.forName(charsetName).decode(ByteBuffer.wrap(byteArray)).toString();
    // this might throw an exception, but it's unchecked
    // so we don't need to catch it unless we want to handle it

Ick.

Still, though, the NIO charset handling is a little bit better than what we had before, and it gives you some flexibility that wasn’t there in the previous implementation (for example, you can control how to handle unmappable byte sequences). It wouldn’t be too hard to add in a few utility methods to smooth over the rough edges here. I’ll leave that as an exercise for the reader.

Escape

Escape

After working on it for over six months, I’m happy to finally announce my new techno/electro DJ mix, Escape.


Escape (download)


This is my first mix released since 2005’s Year of Reflection, which was actually recorded in 2004 (hence the title). So I’ve been on a bit of a break from this type of thing for a while. My turntables and records have been boxed up in my closet for a year and a half, and it’s probably only a matter of time before I sell them all. But I’m actually very happy for this.

I made this mix entirely with Ableton Live using MP3s that I downloaded from eMusic, Beatport and Bleep. This is something I’ve wanted to do for years, but at first the technology didn’t exist, then the technology appeared but songs were unavailable digitally, and more recently the technology and music both became readily available, but I couldn’t find the time to put them together. I called the mix “Escape” in part because I’ve finally found my way past these obstacles and made something very close to what I always hoped would be possible in a post-vinyl DJing age.

Far from some people’s claims that using software to beat-match and mix is the easy way out, this was the most labor-intensive mix that I’ve ever created. Tracks were transposed, extended, edited, sliced up, and processed heavily to get them to blend well. It was a very educational experience, but it also taught me that I still have a lot to learn. I hope, now that this is finished, I can spend more time learning and applying these new skills to original productions, something else I’ve intended for years but never made the time to pursue seriously.

I hope it goes without saying, but please be aware that the independent labels that produce this music rely on the support of electronic music fans to stay in business, and I am not providing this mix to profit from the work of the original artists. Especially since I’m no longer playing out, I made this purely for the fun of creating it, but I hope that if you enjoy the music you hear, you’ll buy the original tracks.

Tracklist

00:00–04:19 Ellen Allien & Apparat – Red Planets
02:16–10:50 Lucien-N-Luciano – Future Senses (feat. Francisca Leon) (mini re-edit)
07:46–14:49 The Field – Over the Ice
12:38–21:46 Minilogue – Space
19:48–28:23 Monolake – Plumbicon
21:36–27:47 Alex Smoke – Never Want to See You Again
26:43–33:04 Lusine – The Stop (Robag Wruhme remix)
31:19–34:27 Modeselektor – B.M.I.
32:51–36:57 Kraftwerk – Numbers
33:53–39:17 Ellen Allien & Apparat – Do Not Break
37:51–45:01 Undo & Vicknoise – Mescalina
42:27–49:41 The Field – Everday
48:17–56:48 Gui Boratto – Beautiful Life

I plan to upload some of my older mixes to this site in the coming weeks and months, and maybe even dig out some of the previously-unreleased recordings if anyone would be interested. In the meantime, I’d love to hear what you think of this one in the comments.

Photo credit: sierraromeo