Saturday, July 24, 2010

Portland & OSCON 2010

I am on my way back from OSCON. I have a red eye that leaves at 10:30 pm and I will be home at 8:30 am on Saturday morning. Today I took the Portland Walking Tours "Best of Portland" tour. Brad the archaeologist was our guide and he did a pretty good job. The tour included part of the downtown area. Here are photos and video I took. (BTW, I am posting this on the FREE wireless internet at PDX. Portland rocks!)


This one was actually not from the tour, but was the view from the Oregon Convention Center.




And this is the convention center from my hotel room window.




Here is the view from the Metro as we go over the Willamette river. You can just see Mt. Hood peaking over that hill in the background.




This is the federal courthouse in Pioneer Square.


More views from Pioneer Square




and some more...




This milepost sign on the east side of the square gives the distance to local attractions and other locations around the world. Note that it is "a long way to Tipperary". :)



"Animals in Pools" by Georgia Gerber










"Quest"by Count Alexander von Svoboda, 1970



IMG_20100722_145147

The Portland Building - Designed by Michael Graves - First major public building of the postmodern movement.

IMG_20100722_145418

Portlandia - the second-largest hammered copper statue in the United States, after the Statue of Liberty.

IMG_20100722_145431



IMG_20100722_145929

An attractive downtown garden

IMG_20100722_145937

IMG_20100722_145955


IMG_20100722_150401




IMG_20100722_150618

IMG_20100722_150624

IMG_20100722_150647






IMG_20100722_152536

IMG_20100722_151926


The atrium of the hall was designed to look like a theatre.

IMG_20100722_151934

Very cool skylight.

IMG_20100722_152158

IMG_20100722_152214

Bizarro sculpture on which visitors are encouraged to sit. Reminds me somehow of The Silver Chair in the Chronicles of Narnia.

IMG_20100722_152445

IMG_20100722_152514

"Wise Fools" outside the hall.

IMG_20100722_153655

The park blocks

IMG_20100722_153956

Very cool perspective mural. The only real windows are in the center.

IMG_20100722_155436

Benson Bubblers - to keep the lumberjacks from getting drunk during lunch


IMG_20100722_155754

The Portland City Hall building

IMG_20100722_155944



The Thompson Elk Statue in Chapman park

IMG_20100722_160638

Solar powered self compacting trash can. Reduces the frequency of trash pickups

IMG_20100722_160827

IMG_20100722_160832

Outside the World Trade Center

IMG_20100722_160958

Electric car charging station

IMG_20100722_161640

Mill Ends Park - World's smallest public park

IMG_20100722_161914

IMG_20100722_161917




IMG_20100722_162126

IMG_20100722_162131



Willamette River with Mt. Hood in the background


Thursday, July 1, 2010

Bumper Sticker Anti-Socialism

With simplistic bumper stickers like these so popular with unhappy conservatives, what Michael Polanyi wrote in 'On Liberalism and Liberty' (1) seems especially relevant. Near the end of the essay, he talks about the waning influence of the ideologies which produced so many of the disastrous events of the 20th century. He then points out that despite their passing, there are those who cling to the illusion of their continued existence.
However, the souring of old illusions does not necessarily produce a fresh appetite for reality. There is still an ordinate amount of political hysteria about. Much of it is the hysteria of anti-capitalists who nurse their unchanging resentment of existing society, even though they no longer see any radical alternative to this society. But in part it also stems from excited anti-socialists who still keep confusing public life by their hypochondriac fears. With their gaze fixed on the lands stricken by Communism, they detect incipient symptoms everywhere of 'creeping socialism': an obsession quite widespread in America. Too many people are still glaring at each other through the angry masks of obsolete ideologies.
I totally agree, and I think if we hope to ever move past this nonsensical debate in America between so-called capitalism and socialism, we need to stop oversimplifying things and labeling them what they are not. Polanyi continues:
Moreover, our discarded costumes have become the raging fashion among hundreds of millions of Asiatics and Africans, deluded by our past examples and precepts. The theory of Marxist Socialism, about to be forgotten in the countries of their origin, are fast becoming the centrepiece of Asiatic and African folklore. The violent sentiments of the illiterate native masses--universal hatred of the white man, Moslem fanaticism in the Arab countries, orgiastic frenzy in Africa--are all harnessed without difficulty by a Westernised native intelligentsia to their own sophisticated conspiratorial projects.
This last statement is really disturbing in that it speaks of a reality that is rarely if ever acknowledged in American political discourse. By pretending that our political & economic choices are as simple as capitalism versus socialism, and by ignoring the underlying cultural traditions which are the basis for American democracy, we only aid those who would use bankrupt ideologies to pursue their ends to the detriment of mankind.

 1. 'On Liberalism and Liberty' Encounter IV March 1955 pp. 29-34.

Monday, June 28, 2010

Recursively Find Permutations of a List in Java

I recently needed to implement an algorithm to find all orderings of a list in Java. Using google I found some code for finding all permutations of a string:

public class MainClass {
  public static void main(String args[]) {
    permuteString("", "String");
  }

  public static void permuteString(String beginningString, String endingString) {
    if (endingString.length() <= 1)
      System.out.println(beginningString + endingString);
    else
      for (int i = 0; i < endingString.length(); i++) {
        try {
          String newString = endingString.substring(0, i) + endingString.substring(i + 1);

          permuteString(beginningString + endingString.charAt(i), newString);
        } catch (StringIndexOutOfBoundsException exception) {
          exception.printStackTrace();
        }
      }
  }
}

My quick and dirty conversion to do the same with a List follows:

  public static void permutateList( List<String> startList, List<String> endList, List<List<String>> result )
  {
    if (endList.size() <= 1)
    {
      List<String> permResult = new ArrayList<String>();
      permResult.addAll(startList);
      permResult.addAll(endList);
      result.add(permResult);
    }
    else
    {
      for (int i = 0; i < endList.size(); i++)
      {
        List<String> newEndList = new ArrayList<String>();
        for ( int j = 0; j < i; j++ ) newEndList.add(endList.get(j));
        for ( int j = i+1; j < endList.size(); j++ ) newEndList.add(endList.get(j));

        List<String> newStartList = new ArrayList<String>();
        newStartList.addAll(startList);
        newStartList.add(endList.get(i));

        permutateList(newStartList, newEndList, result);
      }
    }
  }

Call it with an empty list for the first parameter, a source list that you want to find permutations for in the second parameter, and an empty List of Lists to contain the results. I am sure there are ways to make this more efficient (please comment), but it works.

Wednesday, June 16, 2010

My New BSG Macbook Decal

We just got new laptops at work and after being inspired by a few colleagues, I decided to decorate it with this very cool vinyl decal:


My son Jonah was really into it:


It was slightly challenging to apply (the vinyl kept sticking to the backer when I tried to separate it), but after a few minutes it was on and looks great. If you are interested in one for yourself, check out Crafty Gal Decals (So say we all!).

Tuesday, May 18, 2010

Agile Methodology & the Marshmallow Challenge


I was recently thinking about this TED talk by Tom Wujec on team problem solving. He talks about the Marshmallow Challenge, where teams of four have to build the tallest free standing structure out of 20 sticks of spaghetti, 1 yard of tape and a marshmallow, with the marshmallow on top. What he has found is that kindergarteners actually do better than MBA graduates. He suggests that one of the reasons is that the MBA grads tend to try to find the single right plan and then focus all their effort on finding that plan, and when they get around to implementing it, and finally placing the marshmallow on top, it fails and they have run out of time. When I watched this talk it immediately made me think of the Waterfall Model for software development (see also Big Design Up Front). 

This then got me thinking about how I personally tend to approach problems, which is usually more like the kindergartener teams that Wujec talks about. They immediately start trying out different things until they find a workable approach. I do the same thing when I approach a new programming problem. I think about different ways to attack it, then I pick one that I think might work and jump in. I then iterate on that solution as needed until I have something that seems to be doing what I want, and if needed do some refactoring to reach the final product.   A good non-programming example of this approach came up this weekend. We were packing up from a camping trip and I was loading our fabric car top carrier with some of our gear. I had packed it up before we left, so I basically knew how much stuff I would fit if I was able to pack it exactly the same. My wife was giving me things to put into it and she indicated her doubts about how much would fit. It really irked me (to the point of me getting kind of nasty with her) because I was in the process trying different things and try to put things in so that they would fit, and it seemed like she was predicting that what I was doing was just not going to be possible. I would much rather try out some different approaches to solving the problem than decide beforehand that a thing can't be done.

It occurs to me that this whole iterative / agile approach is really just solving a problem with a kind of learn as you go philosophy. In software, it is rare that you have sufficient knowledge of all aspects of the technology and domain to do a 100% complete specification before you implement something (waterfall model). Instead, it is better to learn and gain knowledge about the domain and technology as you go by jumping in and writing some code. Looking at it as learning process also allows you to decide where planning does make sense (when you do have knowledge about certain problems and solutions). In the Marshmallow Challenge, the competitors who did the best were the architects and engineers and I think this is because they had some existing knowledge and training that allowed them to quickly select or narrow down the possible solutions. So, when we are architecting software or creating marshmallow structures, one of the critical first steps is recognizing what we know and more importantly what we don't know.