Possession is less than nine tenths.

October 25th, 2008

Walking into a library doesn’t make you literate. Owning a speedo doesn’t make you a swimming superstar. Nor does having a chemistry set make you a chemist. Sure, all of these statements make sense. It’s hard to argue otherwise. So why was I so shocked this morning when I realized that scribbling my appointments into a calendar doesn’t make me organized? That’s right, I woke up bright and early to play squash with a friend from college—I even had the decency to send a polite text message to her while heading over to the courts.

“Hemenway, I’m on my way.”

She responded with a real, voice-to-voice telephone call. Her voice was laughing, though. It looks like I’ll need to wake up, bright and early, again, tomorrow morning How can this be? My Google calendar was wrong. I was wrong.

Moral 1: Having a resource is only half the story. You need to know how to use it well, too. (The computer scientists have a phrase for this sort of situation, “Garbage in, garbage out.”)
Moral 2: I should get an assistant.

At least I got some quality practice in.

Share and Enjoy:
  • De.lirio.us
  • del.icio.us
  • Digg
  • NewsVine
  • Reddit
  • scuttle
  • Slashdot
  • Technorati

Read my other blog, too.

July 21st, 2008

When I was a sophomore in college, math had got me down pretty bad. You see, it’s never math’s fault if you don’t get an answer. My friends and I used to joke that math was that really hot cheerleader in high school. And who did she date? Well, the star quarterback of the football team of course. She wouldn’t even look at any of us; I wasn’t good enough to be the waterboy, let alone make it onto the team of professional mathematicians. At least that’s how I felt.

Looking to crawl out of my math-induced low, I did what I thought you’re supposed to do in such a situation: I went to one of my professor’s office hours for advice and consolation. And he responded, I suppose, in the way that he thought you were supposed to respond in a such situation: he told me that I’d probably do well as a science writer, like for the New York Times. It was as if the cheerleader had spit in my face. A science writer—really? But I wanted to study quasi-Fuchsian groups or sympletic geometry or something exciting and esoteric like that. I left those office hours feeling less supported than I had when I entered.

Well, it looks like that professor knew me better than I did myself. That’s right, I’m going to start posting (hopefully regularly) for Complex Systems and Society. The idea as hatched (not by me) while I was hanging around the Santa Fe Institute, essentially the Mecca of complex systems, earlier this summer. Look there for accessible commentary from researchers on current research. I’ll probably write about evolutionary game theory, sociobiology, and other stuff I don’t have the background to write about with much authority (not that that has stopped me before, mind you). Now that doesn’t mean I won’t write here anymore—I’ve been remiss in my duties, I know—because I will. I have three entries drafted already.

My first set of posts over at Complex Systems will detail what goes on in my head as I read Foundations of Social Evolution. So far it’s been a treatise on the Price equation, which describes natural selection with a hierarchy of effects. The concept is something I’ve run into a handful of times. Each encounter left me running away without a proper understanding. Forty-four pages into this book and I still don’t have a firm purchase on it. The fledgling computer scientist in me likes that it’s recursive, though. With some persistence and a little luck, I’m sure I’ll have something useful to say before my first deadline rolls around.

Anyway, this is a note to you, faithful reader, to wish me good luck on my foray into science writing. Look for something over there by August 2.

Share and Enjoy:
  • De.lirio.us
  • del.icio.us
  • Digg
  • NewsVine
  • Reddit
  • scuttle
  • Slashdot
  • Technorati

Some Mottos

February 3rd, 2008

I’m loathe to write this post, because I know it’s going to be short and what I’m about to write—and my essential character, therefore—can easily be misinterpreted. Still, in the last two days people have accidentally uttered things that I think could be motto-worthy. However, one of my implicit mottos, one that I will not formally list, is, “You shouldn’t have too many mottos.” After all, it’s hard enough to carry around a handful of maxims throughout the day. Many more and I’d run out of the computational resources necessary to live by my own standards.

It is my hope that once I’ve got these things committed to (metaphorical, digital) paper, I’ll be able better to organize them, combine them, and generalize them. That’s right: it’s time for a spring cleaning of my wintered philosophies.

So here they are in chronological order:

  1. You can never have too much butter fat.
  2. Treat a person like dirt and he’ll stick to you like mud.
  3. I am smarter than my genes.
  4. I am more patient than a five year old.
  5. Be the person you want to attract.

On Friday DJ accidentally pointed out that I’ve ignored the deterministic components of nurture in the old war between nature and nurture. So maybe it’d be worthwhile to add

  • I can outgrow my environment.

And this morning my aunt Robin called to discuss her responses to Carol Dweck’s book on self and motivation theories that I mentioned a long time ago. I told her that I find her receptiveness to what Dweck has to say encouraging. Her response could warrant a more permanent place in my daily life:

  • It doesn’t matter what you think if it’s not working.

Do you have any words of wisdom that I should consider introducing to my list? You know I love comments.

Share and Enjoy:
  • De.lirio.us
  • del.icio.us
  • Digg
  • NewsVine
  • Reddit
  • scuttle
  • Slashdot
  • Technorati

Making Proper New Year’s Resolutions

January 1st, 2008

It that’s time again: the start of a new year. And while my cat hasn’t seemed to respond to the fleeting opportunity to mend one’s ways that the beginning of a new year brings, I have. In order to honor that age-old tradition of turning over a new leaf and calendar all at once, I’ve decided to make some new year’s resolutions of my own.

I applaud those people who pause long enough mentally to arrange their lives, reflect, and respond accordingly. I think it’s important to remove ourselves from the hustle and bustle of our own lives, make the familiar unfamiliar, and critically examine where we are and where we’re going. But in my experience, people have got the technique all wrong. Few people know how to come up with a proper resolution. And without a good resolution, how could you ever hope of using it to signpost your journey through the coming year? So I am here to impart my deep if not self-important insight to you, free of charge.

I remember my mother calling me one early January to wish me a happy new year and to share her resolution for the new year. “Josh, this year my resolution is to be happier,” she told me over the phone. Likewise, my dad resolved to make more money. And this year, for about twelve seconds, I thought, wouldn’t it be nice if I managed my time more efficiently? Sure, these are all nice things to wish for, at least on the surface, but good resolutions they are not. (I hope my parents don’t mind my saying so here.) It’s hard to argue with anyone who wants the time and wealth it takes to be happy. (It takes wealth and time, doesn’t it?) So what makes these resolutions to bad? Well, two things.

A year is a long time, and it’s hard to keep track of long-term behavior when you experience it only in the moment. For this reason, avoid making resolutions that are fuzzy. Resolutions need to be stated in a way that gives you an easy way to know whether you achieved them. You need to build a measure into your goal, so you know whether you made it or not. In this way you have a mechanism to figure out how to adjust your actions if you’ve run off track. For example, instead of resolving to “be wealthier,” try to save 10% of your paycheck each week in account that you can’t touch until next year. It’s easy to check whether you’ve been saving over the course of a year. It’s a lot harder to evaluate your relative wealth from 365 days in the past.

Not only is it hard to know whether you’ve achieved a fuzzy goal, it’s hard to know how even to start. How in the world does someone go about “being happier” anyway? Resolutions should suggest a planned course of action. To kill two birds with one stone, I’m going to venture that a regular, regimented work-out routine would make me happier and force me to manage my time more efficiently. According to search trends on Google, it looks like a lot of people feel the same way. Look at how the number of searches on term “gym” spiked at the start of 2004, 2005, 2006, and 2007.

But we have to be careful to make sure that our resolution to go the gym has: (1) a well-defined goal, and (2) suggests a way to achieve that goal. So this year, I’ve resolved (2) to go to pool three days a week, so that I can (1) swim a mile without stopping. And, oh, to be more successful, too.

Happy new year, everyone.

Share and Enjoy:
  • De.lirio.us
  • del.icio.us
  • Digg
  • NewsVine
  • Reddit
  • scuttle
  • Slashdot
  • Technorati

Hold the door, please!

September 2nd, 2007

Everyday each of us engages in several delicate dances with the other members of society. I secretly long for the days of learned formalities, proper ettiquette, and wide-spread manners. If someone were just to tell me what to do, things would run more smoothly. Take, for instance, the simple act of holding the door for another person.

So far I’ve only noticed one person play the situation correctly. On several occasions, I held the door for my friend Lane, who, by chance, was always a good ten yards away when I first spotted him. Lane usually acknowledged my act of kindness. He might say, “Thanks, Joshie,” but he would never speed up as I stood. The moments seemed to lag as he slowly approached the entrance to the dining hall. Once he arrived, I thanked him with full sincerity. Most people, I explained, sprint once they realize that someone else is holding the door for them. However, that ruins the favor. What sort of charity requires you to break a sweat? Lane had enjoyed my gift as it was intended, and I believe we both appreciated the exchange all the more for it.

But that sort of action doesn’t readily transfer to any other person. On Friday a stranger held a door for me, and like most people, I sped up as soon as I noticed that I was inconveniencing another person. The man beckoned me to slow down, but how could I? Then I’d come across as arrogant and entitled. I’ll make no one a doorman for me. Well, at least no stranger. And there lies the fundamental difference. Lane and I are friends. This man and I were not. For some reason it’s easier for me to take advantage of my friends than strangers. I guess that’s a good thing for society at large, though a little strenuous on my immediate circle of friends. I believe sociobiologists would have a thing or two to say about multi-level selection processes at this point, but I don’t.

Instead I have a few questions. Normally we think of selfish behavior as something that individuals inflict on members outside of their group. (The ones who are selfish to those inside their group is called “cheaters” or a “defectors”.) The defectors take advantage of and therefore benefit from the cooperators on the individual level. Locally, the defectors do better. But when it comes to asking for help, it’s easier for me to ask someone I know I can trust. I’m more willing to ask my friends to do me favors than strangers. In the iterated prisoner’s dilemma, it’s in your best interest to cooperate with your partner because you’re going to see them again. If you screw them over, they’ll remember it and be less likely to help you in the future. But in many cases I impose on other precisely because I know I’ll see them again. My willingness to ask others to do things for me increases with my level of comfort with them, and I see it in others, too.

Take it up a notch and look at groups as your fundamental unit rather than individuals. People have noticed before that groups that have more (internal) cooperators do better on average than groups with fewer. That seems to make sense. If more people in your group are willing to help out others in your group, the group should run more smoothly than groups that don’t work well together. Nothing exciting there. But what happens when there’s lots of internal chaos but external altruism—can groups composed of individuals that take advantage of each other but cooperate with members outside of the group coexist given proper inter-group interaction?

Because the comfortable defectors have to act charitably when someone else calls on them, it’s a little unfair to characterize them as defectors. Maybe it’s best to call them comfortable defectors-generous forgivers. This is starting to sound like the win-stay, lose-shift strategy. Maybe the folks studying evolutionary dynamics can clear things up for me. Help me out if you can, especially if I’m already comfortable with you.

Technorati Tags: , , , , , , , , , , ,

Share and Enjoy:
  • De.lirio.us
  • del.icio.us
  • Digg
  • NewsVine
  • Reddit
  • scuttle
  • Slashdot
  • Technorati

Geotools, WFS-T Update Request

August 3rd, 2007

A pet project of mine has flung me into the exciting though less-than-firm territory of web-backed geographical information systems. Since I don’t have the thousands of dollars it costs to get a commercial server like those provided by ESRI, I’ve had to check out the open-source alternatives. And there are some out there. I’m using GeoServer, and it works great! I can send all the web-feature service transactions (WFS-T) in XML I want and it works every time. Not bad if you want to make a GoogleMap of your house on your own—so long as you’re content to hard-code everything by hand. Should you want to jazz things up a bit (i.e., make minimally useful dynamic maps), like me, then you have to do a little more work. Actually, you need to do a lot more work.

GeoServer is built on top of a gargantuan set of Java libraries, collectively packaged under the name GeoTools. Now I appreciate that this thing exists, all two hundred and fifty megs of source code and all the functionality that comes with it. However, navigating the mountain of documentation for this thing is, at least for me, a little daunting. It took me a few days (and some serious help from my friend Matt) to figure out how to write a simple update transaction using their API. (Compare that to the forty-two seconds it takes me to type up the XML.)

Since other people might want to know what they have to do update an attribute field using WFS with GeoTools, and since I couldn’t easily find out how to do it elsewhere, I’ve decided to post a short snippet of code right here on my blog. That’s right: my charity knows no bounds.

In this example I’m going to update the value of all the features (polygons, lines, points, whatever) that match a simple filter. Here I’m going to change the value of propertyToUpdate to updatedValue using a filter to get all the features with the attribute called constraintProperty with a value of constraintValue. I’ve marked them in red, so that it’s as easy as possible to customize this example to fit your needs. Let’s start with the XML that the Open Geospatial Consortium standards expects to see.

<wfs:Transaction service=”WFS” version=”1.0.0″
     xmlns:myns=”http://www.domain.com/ns
     xmlns:ogc=”http://www.opengis.net/ogc”
     xmlns:wfs=”http://www.opengis.net/wfs”>
  <wfs:Update typeName=”myns:LayerToUpdate“>
    <wfs:Property>
        <wfs:Name>propertyToUpdate</wfs:Name>
        <wfs:Value>updatedValue</wfs:Value>
    </wfs:Property>
    <ogc:Filter>
        <ogc:PropertyIsEqualTo>
            <ogc:PropertyName>constraintProperty</ogc:PropertyName>
            <ogc:Literal>constraintValue</ogc:Literal>
        </ogc:PropertyIsEqualTo>
    </ogc:Filter>
  </wfs:Update>
</wfs:Transaction>

Now let’s rock out the Java.

Like I said, GeoTools is mammoth. To make life easy, we’re going to import a whole bunch of classes for this example. So many, in fact, that their number really warrants my displaying them here in their own list. What’s more, the names of some of classes (like Filter) show up in more than one package, and you need to keep track of which is used where. So keep an eye out for things from org.opengis.

import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.HashMap;
import java.util.Map;
import java.util.logging.Level;

import org.geotools.data.DataStore;
import org.geotools.data.DefaultTransaction;
import org.geotools.data.FeatureStore;
import org.geotools.data.Transaction;
import org.geotools.data.wfs.WFSDataStoreFactory;
import org.geotools.feature.AttributeType;
import org.geotools.feature.FeatureType;
import org.geotools.filter.FilterFactoryFinder;
import org.geotools.xml.XMLSAXHandler;

import org.opengis.filter.Filter;
import org.opengis.filter.FilterFactory;
import org.opengis.filter.expression.Expression;

In our constructor we’ll set up a connection to the WFS server using a URL. If you’re tinkering with GeoServer, then that URL you’re looking for probably looks something like http://localhost:8080/geoserver/wfs. Since we know that we’ll want to filter our responses, it’s not a terrible idea to make a filter factory now and save it for later. In GeoTools everything is made using a factory. For filters, we need to make a factory using the new keyword, though. Here goes.

public class WFSUpdater {

    private DataStore wfs;
    private FilterFactory filterFactory;

    public WFSUpdater(String url) {
      try {
        URL endPoint = new URL(url);

        XMLSAXHandler.setLogLevel(Level.OFF); // turns off logging for XML parsing.

        // Parameters to connect to the WFS server, namely the URL.
        // You could have others, say if you had to authenticate your connection with a username and password.

        Map params = new HashMap();
        params.put(WFSDataStoreFactory.URL.key, endPoint);

        wfs = (new WFSDataStoreFactory()).createNewDataStore(params);
        filterFactory = FilterFactoryFinder.createFilterFactory();

      } catch (MalformedURLException e) {
        e.printStackTrace();
      } catch (IOException e) {
        e.printStackTrace();
      }
    }

Now that we have a connection, it’s time to make the transaction. As a first timer to GeoTools, I found it difficult to crawl through the documentation. Lots of their classes and methods have been deprecated with no clear hints about what to use instead. I had a hard time finding the right constructors. In what follows everything is hard-wired into the code, but it shouldn’t be all that bad to tweak things so that it works the way you like.

public void updateProperty(String propertyToUpdate, String updatedValue) {
    // This is the layer name on the server.
    String layer = “myns:LayerToUpdate“;
    Transaction update = new DefaultTransaction(”update”); // The handle/ID of this transaction is called “update.” It’s required.

    try {
      // Make the filter.
      Expression property = filterFactory.property(”constraintProperty“);
      Expression value = filterFactory.literal(”constraintValue“);
      Filter filter = filterFactory.equals(property, value); // This is an org.opengis.filter.Filter.

      FeatureStore features = (FeatureStore) wfs.getFeatureSource(layer);

      // Set the transaction. Otherwise, we can’t commit our changes later on.
      features.setTransaction(update);

      // Fetch the property from the FeatureType schema so that we can update it with the new value.
      FeatureType schema = features.getSchema();
      AttributeType atrributeToUpdate = schema.getAttributeType(propertyToUpdate);

      features.modifyFeatures(atrributeToUpdate, updatedValue, (org.geotools.filter.Filter) filter); // There’s that casting again.

      // Record the modifications.
      update.commit();

      } catch (IOException e) {
        e.printStackTrace();
      }
    }
}

Anyway, I hope this saves some people the hassle of tearing through the Javadocs for GeoTools. Also, if there’s a better way to do what I did, please let me know. Happy GIS-ing.

Technorati Tags: , , , , , , , , , , , , ,

Share and Enjoy:
  • De.lirio.us
  • del.icio.us
  • Digg
  • NewsVine
  • Reddit
  • scuttle
  • Slashdot
  • Technorati

Animal imagination

July 15th, 2007

This time I have a question for you, the kind reader: can anyone tell me (or point me to a study that suggests) whether non-human animals practice their skills outside of a group?

On many a PBS nature documentary, you can find a gathering of young, fury things play-fighting one another to hone their hunting and social skills. However, human athletes will substitute physical competitors with imagined or abstracted ones. It’s common for athletes to compete against recorded times, high scores, or a mental reincarnations of a previous or idealized self during practice in the absence of a physically present opponent. And this sort of activity isn’t confined to sports like running or cycling. Full teams can visualize a routine or match performance for positive effect. Marines are instructed to imagine their hitting a target—and this sort of practice increases accuracy. These pretend opponents have real, demonstrable, and causal power. In short, human imagination is pretty powerful aid to skill acquisition, at least.

So let’s get back to my opening question: to what extent can non-human animals imagine? Please help me out if you can.

Technorati Tags: , , , , , ,

Share and Enjoy:
  • De.lirio.us
  • del.icio.us
  • Digg
  • NewsVine
  • Reddit
  • scuttle
  • Slashdot
  • Technorati

Genetics by the Poolside

July 8th, 2007

Happy Independence Day! To celebrate our nation’s founding, my family and I often hit up the Cape. This year was no exception, there’s little to report. The weather has been spotty: a little rain here, a few showers there, but nothing substantial. Someone was playing bagpipes the other night. And I witnessed a gruesome car accident a few feet from my balcony during the fireworks spectacular. A mass of people immediately sprang up to help the man, direct traffic, and call 911 repeatedly until emergency vehicles could make their way here. I was genuinely impressed by the response, professional and make-shift alike. Within seconds the response team had the guy off to the hospital in no time flat. I think it prudent not to speculate on the cyclist’s health. I don’t want to jinx anything, you know.

And since it’s vacation time, I’m here, at the kitchen table, on my laptop, implementing genetic algorithms. Maybe later I’ll describe what I did. Maybe if I do, someone will be able to tell me if my results make any sense. Whether or not my programs reproduce the classical results isn’t really the point, though. Look at the evolution of strategies for playing the iterated prisoner’s dilemma: they make perfect modern art tile mosaics! I bet someone’d love to have this pattern on their pool floor or garden wall. (Don’t be alarmed that they don’t appear all that related. Each row in black represents the fittest individual from one of a number of independent runs. That is, they probably never had the chance to meet each other.) Imagine the graphic tastefully obscured by flowering vines. (Click on it for a larger image.)

I can see an upside-down raccoon in it. What can you find?

Share and Enjoy:
  • De.lirio.us
  • del.icio.us
  • Digg
  • NewsVine
  • Reddit
  • scuttle
  • Slashdot
  • Technorati

Summer Informal Seminar

May 29th, 2007

No, I haven’t been off on vacation in the Caribbean—but I have seen the third pirates movie. It was great. But I wanted to let anyone out their who is interested that I’m going to lead an informal seminar on general relativity at UMass/Boston this summer starting June 4th. Here are the details.

What: An informal seminar on differential geometry and general relativity
When: MTh 5–6:30pm
June 4th — early-August
Where: Taffee Tanimoto Conference Room
Science Center
Third Floor, Room 180
Website: www.gsd.harvard.edu/~jreyes/GR
Share and Enjoy:
  • De.lirio.us
  • del.icio.us
  • Digg
  • NewsVine
  • Reddit
  • scuttle
  • Slashdot
  • Technorati

Visitation Rights

April 15th, 2007

Last night I was hanging out on the couch, while DJ played video games on my living room television. I don’t quite remember what obnoxious thing I was doing—I do remember, however, that it was, indeed, deliberately obnoxious—but it prompted DJ to burst, “You make me want to drink.”

“Then you should never have children,” I replied.

A few weekends ago, I babysat my six year old friend Robert while his mother was away on a business trip. It was the longest they had even been separated. Naturally I was a little anxious about watching the little captain under such new and trying circumstances. Originally I agreed to stay from Friday after he got out of school and until Sunday afternoon. That Tuesday things change. Arrangements had been made for Robert sleep over at his friend’s house on Friday and to go to the circus Saturday morning. Officially, my duties wouldn’t start until Saturday afternoon. Great! Or so I thought.

Children have a habit of getting sick right before a big, fun event. Robert’s friend is just like any other kid in that regard. Friday morning at ten, I woke up to an emergency phone call from from Robert’s friend’s mother. Apparently, the friend was at the doctors office with a temperature of 102. The sleep-over and circus would have to wait for another, healtier week. So I frantically got ready to take the next bus in town. (Mind you, it takes about 2 hours to get from here to there by public transportation.) I get to the apartment with some time to spare, so I sit on the couch to write emails until Robert gets home. Then phone rings again. It’s the friend’s mother. Her son felt better and the boys were really looking forward to the sleep-over, so if I didn’t mind, maybe Robert could stay at his friend’s house for the night after all. I agreed. Who am I to deny Robert some quality time with his friend—especially if it frees up my Friday night? Still, it’d take another two hours to get home if that was my plan. My cell phone rang one more time. This time it was DJ.

DJ’s grandmother volunteers her time and her house to a pricy kick-drugs-through-prayer rehabilitation program called Teen Challenge, and their graduation happened to be that night. Naturally, DJ’s grandmother wanted to be there. One of women she sponsors was graduating—for a second time. Anyway, the whole situation made DJ feel a little uneasy and he was looking for company. Because they had to pick me up, we were an hour late to the ceremonies, cutting the total time there to only about two hours.

I was back in Cambridge by noon the next day, just in time for Robert’s return home. Now I’m not related to Robert. Even still, I couldn’t help but feel like a divorced dad picking up his kid for a weekend visit. First they schedule me three days with him. Then they take that away and build up his expectations with a promise to the circus. But then they steal that from him, but keep him for the time it would take to go to the circus. After that, they drop him off with me. By this time Robert feels entitled and demands that we do “something fun.” I was set up for failure. Maybe that’s what the system intends and why it works so well.

Let me tell you how happy he was when we missed the last showing of Sharks 3D at the New England Aquarium due to some unforeseen construction on the Blue Line. We ended up on a bus that took us to Wood Island by mistake. Robert refused to sleep until we did “something fun,” which translates into something expensive and outside of the apartment. There was no way I was going to take him somewhere “fun” at 8:30pm on a Friday night. Instead, I suggested we play a game: “You pretend to fall asleep. You don’t have actually to sleep—just convince me that you’re asleep.”

Robert is shrewd, though. He wanted fun and he let me know it. “Josh, I know this is just a pyschological trick,” he reminded me. “I’m not going to bed until we do something fun.” I don’t easily give in to ultimatums, especially not from six year olds who are out of line. He has a bed time and he knows it. So I sat by his bed in the dark silently for 90 minutes. Eventually, he fell asleep.

The next day we did see Sharks 3D. We arrived and had purchased our tickets by 10am. We waited in the lobby (with a painful detour near Old City Hall in between) until show time at 2:20pm. I read him some Wittengstein on the bus ride home. I don’t think he appreciated it much.

Technorati Tags:, , , , , , , , , , , , , ,

Share and Enjoy:
  • De.lirio.us
  • del.icio.us
  • Digg
  • NewsVine
  • Reddit
  • scuttle
  • Slashdot
  • Technorati

Protected by AkismetBlog with WordPress