June 2009 Archives

My StackOverflow flair

| | No TrackBacks

I don't think my column layout is wide enough to put this on the right-hand side, so for now I am posting my StackOverflow rating in this article:

Finnair fan fares

| | No TrackBacks

Finnair advertised today in amNewYork that it had fares to Asia: Seoul, Beijing, and Shanghai for $848; Hong Kong, Tokyo, Osaka, and Nagoya for $948. Let's leave out for a minute that you can't see these fares listed on their site. I find it fascinating that Finnair is flying people from New York to Asia via Helsinki:

Now you can fly Finnair's brand new aircraft from New York (JFK) via Helsinki (HEL) to Asia at a very good price.

Isn't it a lot farther this way? Concretely, how far is it from JFK to TYO via HEL versus the direct route? Fortunately, the web has the answer. Using a great circle, the most direct route on our ovoid planet, JFK-HEL-TYO is 8981 miles. JFK-TYO is 6763 miles. So the Finnair route is about one-third longer. I guess that's good if you are accumulating air miles.

And how long does this actually take? I went to Sidestep.com to look up a hypothetical JFK-TYO flight leaving 2009-06-23 and returning 2009-06-30. Northwest quotes a JFK-NRT return flight for $848 that takes 14:10 outbound and 12:40 on the return. Finnair's flight leaves JFK at 17:40 and arrives at HEL at 08:50 the next day. I think that's 15 hours less 6 hours for timezones or 9 hours. Then there is an 8:30 layover before the flight leaves HEL at 17:20 and arrives at NRT at 08:55 the following day. I'm not certain of the math, but it sounds like you could:

  • take Northwest and leave JFK at 13:50 and arrive at NRT at 17:00+1 day or
  • take Finnair and leave JFK at 17:40 and arrive at NRT at 08:55+2 days.

So on Finnair, you leave 4 hours later and arrive 16 hours later, for a trip that is 12 hours longer: 26 hours on Finnair versus 14 hours on Northwest.

And it's cheaper on Northwest anyway: Northwest for $848 versus Finnair for the advertised price of $948 or the Finnair.com's current price of $1178.

So on cost, time, and distance, this is a non-starter. It just doesn't make any sense to me.

Recent projects

| | No TrackBacks

I've been to a fair number of technical conferences and presentations recently:

  • 2009-04-16 Devscovery
    Followed WPF track led by Walt Ritscher -- 1.5 days.[Day 2, Day 3]
  • 2009-05-18 Enterprise Developer Conference
    Followed the user experience and WPF tracks. [Description]
  • 2009-05-29 WPF Line of Business
    Microsoft 2 day presentation on WPF. [Description]
  • 2009-06-08 Wintellect.com's Mastering WPF
    A two-day web presentation by Walt Ritscher on WPF. [Description]

I've also been fairly active in Meetup.com groups, following the latest developments in the python, .NET, and the ALT.NET communities. [Meetup profile]

There is no substantive Unix on my resume, but recently I have been doing a lot with Ubuntu (Hardy and Jaunty) because I have been deploying my Django applications to Apache. I've installed Ubuntu with Apache and development tools to my laptop, a home server, a server at slicehost.net, and a server at webfaction.com.

I've also started to push out my projects as open source on github.com. So far, all of the work is in python and django. The django work has given me a chance to brush up on my web development technologies: HTML, CSS, and JavaScript.

I am always forgetting how to do dictionary construction. Here is a piece of code I restructured for a friend. Notice that the dictionary is created from a sequence of tuples. (Slightly modified from the original for better pretty-printing.)

def slug_to_lower(fn):
    """
    Decorator to lowercase string arguments to a function.
    """
    import string
    def is_string(x):
        return isinstance(x, str) or isinstance(x, unicode)
    def trans(x):
        return (x if not is_string(x) else string.lower(x))
    def wrapped(*args, **kwargs):
        neo_args = [trans(x) for x in args]
        tuple_list = [(k,trans(v)) for k,v in kwargs.items()]
        neo_kwargs = dict(tuple_list)
        return fn(*neo_args, **neo_kwargs)
    return wrapped

The things I don't know about python

| | No TrackBacks

Sometimes, I amaze myself with what I don't know. Here is a simple case: in python, you can pass a function a dictionary with keys with the same name as the function's arguments. For some reason, I thought this was only available when you identified keyword arguments.

>>> def foo(a, b) :
...     return a + b
...
>>> foo(2, 5)
7
>>> d = {'a':2, 'b':5}
>>> foo(**d)
7

Getting github working in Windows

| | No TrackBacks

What a nightmare. I generated an SSH key on Windows with puttygen to submit to github but I could not get git to retrieve the code I had authored. (Somehow, I'd managed to put the initial revision up and then broken things -- perhaps with a clone using the general URL.) Using SSH -vi <key> github.com did not help -- I still got Permission denied (public key) errors.

I ended up generating the SSH key on Ubuntu, copying that into github, and confirming that I could SSH to github.com. Here were my steps:

# Generate the rsa keys
cd ~
ssh-keygen -t rsa
chmod 600 ~/.ssh/id_rsa.*
ssh-add ~/.ssh/id_rsa.pub

# Copy public key to clipboard, paste into github
cat ~/.ssh/id_rsa.pub | xclip -selection clipboard

# Test: connect to github through console
ssh -F config -vi ~/.ssh/id_rsa.pub github.com

# Actually clone the source
cd ~/src
git clone git@github.com:username/project.git

Still, I wanted to get git working on my Windows box. This web page was instructive. Once I realized that the message meant that it could not find the key and that the default location is ~/.ssh, I copied the keys to .ssh under my home directory on Windows. Doh! You get it? The tilde stands for c:\users\username on Vista and Windows 7 and c:\Documents and Settings\username in Windows 2000 and XP. It's just not a Windows convention to use tilde -- or to use directory names that start with a period. For good measure, I added a config file for that directory:

Host github.com
  User git
  Port 22
  Hostname github.com
  IdentityFile ~/.ssh/id_rsa
  TCPKeepAlive yes
  IdentitiesOnly yes
  PreferredAuthentications publickey

I think that if you copy your RSA key files to C:\Program files\git\.ssh with the config file above, you can then run this command to make sure all is well:

"C:\Program files\git\bin\ssh" -vi id_rsa.pub -F config git@github.com

Ideally, you'll be asked to confirm the github.com signature, prompted for the public key's signature three times (and since you made it without a password, you'll just hit ENTER three times), and get a message that there is no shell acccess to github. I think that there will then be a known_hosts file in the .ssh directory and the keys will have been copied to ~/.ssh. Copy the config file there for good measure and you should be able to run git to push code from your source directory.




2009-06-08: I had to revisit this today. I could not connect on a Windows box because it was picking up the wrong ssh from my path. The workaround is to set the exact one desired using the environment variable, GIT_SSH.

Pages

OpenID accepted here Learn more about OpenID
Powered by Movable Type 4.32-en

About this Archive

This page is an archive of entries from June 2009 listed from newest to oldest.

May 2009 is the previous archive.

July 2009 is the next archive.

Find recent content on the main index or look in the archives to find all content.