day 1 in torino

A few years ago, I finished a round of Golf at Oneota Country Club and came up to the patio area.  A  bunch of guys I knew were sitting around a table with some other men I did not know.  It turned out that the strangers were visiting Decorah on a Rotary International exchange program from Torino Italy.  One of the men I met that night was Stefano.  Little did I know that he would play and integral role in the course on the olympic games I'm teaching right now.

When craig proposed the course, and we talked about Torino, we  both thought of Stefano.  I contacted him via email, and he immediately responded that he would be happy to help.  Stefano organized a very nice morning for us.  He stopped at our hotel to walk with us to the Foundacion Alberto Collonetti, where some of his friends were gathered.  The friends had all been involved in the Olympics in some way as volunteers, and they told told us a bit about what they had done, and what the Olympics had meant to Torino.  Although some of the venues have very quickly decayed and are going unused, everyone agreed that the Olympics had a big economic and cultural impact on the city.  Before the olympics Torino was probably only known as the home of the shroud, and was not really a tourist destination, but since the olympics Torino has become a tourist destination for people from throughout the world.  In addition the olympics had a big impact on the character of the people, according to many that we spoke with, prior to the olympics people in Torino were not very welcoming of strangers, but since then the city has learned to be more friendly and open.  We saw this to some degree, but in general we found it was difficult to find someone that could speak english.  This was such a different experience than I have had traveling in other cities in Italy.  After the presentations were over they answered the students questions for quite a while.  We were happy to use some of our honoraria money to make a small donation to the Foundacion.

Stefano and his friend Fabrizio helped us the rest of the day by accompanying us to the Olympic Village, to lunch, and even to our second meeting of the day with Delatre.  For lunch we walked through the abandoned village and over to a rehabilitated Fiat factory.  The factory has been turned into a mall, and office building.  Across the street from the end of the mall is a place called Eataly, which is a very nice high end grocery store (more on this later) that also has a cafeteria.  We bought Stefano and Fabrizio lunch, and it was nice to have Stefano translate the menu for us. We had a very nice glass of Prosecco naturale, not the champagne version but the still version.  Craig and I each had a plate of pasta with meat sauce (veal) while the others had pasta and mussels.

A couple of bus rides later and we were at Delatre.  This is a technology company that does a lot of web work for NBC, the BBC, and CTV.  Their big thing is tying together the video stream with all the meta data about the players and the scores.  For broadcasters they basically provide everything you would need to know to do color commentary on a game.  They license some cool technology that tracks each football player on the pitch, as well as the ball and the referees.  The software can detect when one player passes to another, and provides real time statistics.  You can access this on the website, like nbcolympics.com,  or they have a special product just for broadcasters to use.  It was a very interesting presentation, especially for the 3 computer scientists in the group.

After the presentation they allowed craig to stay behind to print out our boarding passes.  I took the rest of the group down the road to the grocery store.  The original idea was to wait for craig, but we soon gave up on that and began walking back to the hotel on our own.

We knew that to get back to the hotel we just had to walk east until we found Corso Re Umberto.  At that point we would go north to our hotel.  I knew it was a long way, so once we reached Re Umberto I said I would run across the road and see if the bus went all the way up to our hotel.  Unfortunately as I was asking the bus driver this question, he just started driving away.  I tried to wave to the confused looking students on the other side of the road, who were staring at the place the bus used to be as if I had somehow vanished into thin air.  I did manage to make eye contact with one or two so they knew I was on the bus and they soon followed.  Meanwhile back at the hotel we waited and waited for craig.  Finally I decided not to wait any longer and just go ahead with our group discussion.  When craig finally returned we had our first glimpse of what flying Ryanair was going to be like.  To print out our online boarding passes he had to enter, name, birthday, passport number, expiration date, flight information for every member of our group before he could print out the passes!  Of course this took forever, especially since on the first try he entered all of the information only to be told that the session had time out.  This meant he had to enter it all over again, but in smaller batches.

After the group discussion we walked down the block to ottoe tre quarte (8 3/4) where we had a glass of wine and some Calzone.  After dinner we were both exhausted so we just went back to the hotel to get some sleep.  Lest you think I was in bed by 7, you should know that supper time in this part of italy doesn't start until 8:00pm.

 

 

my name is brad, i'll be your sommelier this evening

Sometimes a Swiss Army Knife can make you the most popular guy in your hotel corridor!  Some of the students have discovered that when you are in italy, and close to France, wine is much cheaper than beer.  What do you do if you are not a wine drinker?  Choose an inexpensive wine at random from a store and bring it back to the hotel.  Step 2, after realizing that wine bottles have these things called corks, and corks require a special tool to remove them from your bottle, you wander around the corridor wondering how you are going to find a cork screw.  This is where I came in.

"Do you know where we can find a corkscrew?"  I was asked.  Being a leader makes me the font of all knowledge of course, so I must know.  "Well..." I said, "I have a corkscrew on my swiss army knife."  "Great!  can you open this for me?"  Why not, I thought... Somehow the idea of me opening a bottle of wine for a student wasn't anywhere on my list of duties as a faculty member, and I'm not sure its one that the administration would want to cultivate, but here we are in Italy, I might as well be helpful.  So, I cut the foil and pop one cork.  Its as if the sound of that cork sliding out of the bottle was like some kind of whistle.  The next thing I know I'm surrounded by students holding bottles of wine.  One or two of them decided it would be a great idea to take a picture of me opening wine bottles.  I think the picture below really captures the moment.  You can see Craig laughing in the background as if to say,  "ha ha, there goes Brad's career."

CIMG7035.jpg

Thus began our first night in Torino.  It was another long train trip from Lausanne to Torino, made a bit more exciting by the fact that just after we crossed the border into Italy the train got behind schedule.  What had been a 40 minute layover in Milano Centrale turned into a 10 minute dash from one train to the next.

Once we got to Torino, we had lunch, our first at McDonalds since the trip began, because we knew we were too early to check into our hotel.  I had a McBacon and fries.  It tasted quite good.  The Hotel Artua Solferino is a nice old European hotel.  Each room is very different.  My room is up the stairs at the end of the hall, and has the smallest bathroom in Italy.  Right over my shower is a skylight that leaks cold air like crazy.  This morning as I tried to take a shower, I could not get hot water and so the combination of the cool breeze and the luke warm shower water (with approximately zero pressure) was pretty pathetic.

After orienting the students to the area, we turned them loose to see what they could find for dinner.  Craig and I waited a while and then took off for the city centro.  We walked around and investigated a lot of restaurants.  We looked for some that might be able to accommodate our entire group, and some that looked like they might be nice for us.  We ended up finding a great little neighborhood restaurante.  Not a tourist place at all, and not pretentious.  They had a three course chefs menu that looked great.  I had awesome risotto, a green salad, and delicious veal arrosto.  The meal came with 3 dl of wine which was perfecto.

With dinner done, we made our way back to the hotel.  Its amazing how tired I get each day, worrying about the 24 welfare of 24 students traveling in a foreign country where none of us really speak the language well is very tiring.  This seems to be especially true here in Torino.  Although we have heard that the city has made great strides in welcoming tourists, we find that there are not all that many people that really speak English.  Despite that , it is a good beginning to Torino.

 

craig's death march to the invisible tower

Its that depressing, cloudy, cool kind of weather here in Lausanne.  Low clouds and mist that block any hope you have of seeing across the lake, much less Mont Blanc.  The result is that the city does not seem warm or friendly.  When we walked by the lake area on our way to the tourist museum it was deserted and quiet.  Of course this is their off season but it was still strange, and it makes me wish I was home where even when things are cloudy and bleak you have the warmth of loved one's around you.

The visit to the Olympic museum was good.  They have some cool interactive exhibits where you can test your reflexes, train at altitude, and have a look at all of the new technologies that athletes and their coaches are using.  My favorite was the basketball tracker.  A camera on each corner of the court records the movements of players, a computer is then able to use that information to triangulate the exact position of each player on the court at all times.  Coaches are now using this to do a statistical analysis of how players are likely to respond to different offensive or defensive strategies.  Very cool.

When we finished our tour, the mist had lifted a bit so we could actually see the mountains peeking up over the low clouds.  I think that is Mont Blanc on the right of the picture below.  It may be a little hard to tell, but there is actually a layer of low clouds right at the top of the flag poles in the picture.

 

IMG_2162.jpg

After the museum tour, everyone was on their own for lunch.  Craig and I checked out the Manora, which is a nice, reasonably priced buffet near St. Francis.    After lunch I walked around a bit, and bought a new converter to replace the one I left in the outlet in Interlaken.  We had a hike planned to a tower on the highest point in town for 3:00 in the afternoon.

Unfortunately it was raining a bit at 3, and the clouds had returned but we decided to give it a try anyway.  After a very long walk up hill we found this spot.

IMG_2183.jpg

which wasn't a tower, but there was a flag pole we could climb.  As you can see there is not much scenery behind the students as we were up into the clouds. and it was hard to see the lake much less any of the mountains from where we were.  Nonetheless Craig was determined to find the tower that we set off for, and so while the rest of us were fooling around and looking at the small plastic bag with the odd botanical stencil on it he was trying to find the tower.  And, after another half mile of walking up hill here it was:

IMG_2184.jpg

You could not even see the top of the tower when you were standing right in front of it.  However, we had come this far and were determined to reach the peak.  So we climbed the 151 stairs to the top of the tower.  And we were barely treated to a view of each other.

 

IMG_2194.jpg

You can see we were definitely in the clouds!

The walk back to the hostel was all downhill and definitely an easier walk.  We found a nice french bistro to stop for a happy hour drink, and enjoyed the rest.  After we got back to the Hostel and caught up with the rest of the students, Craig and I found a very nice Asian restaurant (Asian Garden) for our supper.  Back to the room and to bed.

Its a great group of students and its fun to see them come together as they get to know each other better.  They rely less on us and more on each other with each passing day of the trip, and thats a good thing.

 

how lindsey vonn spoiled my day in interlaken

The morning started out like any other morning, up at 7:00, a light breakfast, then hop on the bus to the ski slopes.  OK, maybe not like every other morning, but a pretty desirable thing to aspire to anyway.

To get to the ski slopes from Interlaken requires a bus ride, to Winderwil, followed by a train ride to Lauterbrunn, followed by a different train ride to Wengen, followed by a trip up the Mannlichen Gondola.  Unfortunately after all that trouble the quality of the snow was pretty bad.  The weather here in Interlaken the past couple of days has been unseasonably warm, so the snow is really icy in the morning, turning to slush by mid-day.  Most of the students that followed me out the door of our Hostel (Backpackers Villa Sonnenhof) were beginners.  By the end of the day they were calling themselves the Blue Crew because they were only taking the blue runs.  Note to U.S. skiiers, in the Alps blue is easy, red is intermediate, while black is for experts.  Somehow I got separated from the group right away and ended up doing the first run by myself.  It turned out that they had all skiied a ways ahead of mebut had stopped to contemplate their options in terms of which run to take.  Even after that contemplation they ended up taking a red run, which was not what they wanted to do.  It was during this first run that Aaron took a spill, and tore the ACL, and MCL ligaments in his knee.

Even though I waited at the bottom and top of the lift hoping to find the group again I was unsuccessful for several runs.  Maybe an hours worth of skiing.  Finally I did see the group coming off the blue run and the first thing I heard was "have you seen Aaron?"

No I said, why?

He fell and hurt himself on the run.  He told us to go on to the bottom but now we're too scared to ski back down to him.

So, I took my board down the run and found him sitting all by himself by the side of a snow making machine.  Only one person had stopped to see if he needed help, and due to the language barrier apparently determined he was fine.  Meanwhile, I had talked to a couple of ski instructors and managed to locate a ski patrol on a snowmobile.  He joined us on the slope and made the assessment that Aaron was going to need to go to Wengen for some X-Rays.  As we were waiting we decided that we needed a better cover story than falling during the first run of the day.  Hence the Lindsey Vonn reference.  Our story is that she was on the slopes practicing for the world cup race next week and decided to flirt with Aaron, this distracted him momentarily and caused him to crash.  Sadly she did not stop to help or he would probably feel just fine.

After wrapping Aaron up like a Papoose on the sled behind the snowmobile the patrol took off for the Gondola, and I was supposed to ski down and take the lift back up and meet them there.  By the time I arrived the Gondola had already taken Aaron down, so I had to wait for the next one.  Down in Wengen Aaron got a ride in a taxi to the doctor's office and was awaiting an X-ray by the time I arrived.  It only took about an hour and a half at the doctors office to get the X-Ray with the preliminary diagnosis of a torn crucial ligament.  They scheduled a followup appointment the next day so the other doctor could read the X-ray and weigh in.  They outfitted Aaron with a pair of crutches that included flip down spikes for the bottom to aid in navigating through the snow, and we were off.  Aaron with one ski boot on and his crutches, me carrying the other ski boot, his poles, helmet, skiis, and my own board, it was kind of a sad sight to see us slowly trudging through the narrow streets of Wengen back to the Bahnhoff.  Remember all the train and bus stops it took to get to Wengen?  Well we had to do the whole process in reverse loading and offloading skis, boards, etc. at each change.

Aaron and I made it back to the Hostel, where we began the process of calling our travel insurance company, Luther Study Abroad folks, and Aaron's parents.  As I write this we are in "insurance-limbo" waiting to hear from our company whether they will cover an MRI in Laussane.  The MRI is critical because it appears that in addition to the torn ligaments there is also a small bone chip.  If the chip is too large or in the wrong place then He'll have to go home and get ready for surgery.

 

day 2, or is it 3?

I can't believe that I actually slept until 8:00AM.  After waking up at 3 AM I was afraid I was done for, but I dropped back to sleep and slept hard until 8.  After a quick breakfast at the Hostel it was time for some Munich touring on our own.   A few of us were going to go to the Deutches Museum, but most of the group was headed to Dachau.  I really enjoyed the museum, I went straight to the Math, Computer Science, and Astronomy exhibit, where I discovered that they had an actual Enigma machine, in the cryptography area.

There were many other great exhibits, the aeronautical area had a cross section of an Airbus A320 and several other interesting aircraft, there was a really amazing mining exhibit as well.  The nautical area was equally amazing with replicas of ships both large and small.  You could easily spend a whole day at the museum, but my mind was pretty overloaded by 11:30.  The plan was to head back to the Viktalien Markt for a street lunch of sausage and bread, unfortunately everything was closed, it turns out that Epiphany is a national holiday in Germany, so we really had to work to find a street vendor that was open.  I had to try the Currywurst, which was a sausage in a sweet sauce with curry powder sprinkled over the top.  It was a delicious German meets Indian fusion street food kind of thing.

With lunch behind us we met up with the rest of the group to head back to the airport to meet with Sebastian, a marketing guy, from Lufthansa.  He gave us a great presentation on Lufthansa and their support of the Munich 2018 bid.  The Lufthansa folks had very generously provided us all with Munich 2018 stocking hats and scarves.  After the meeting we took a group photo with everyone wearing their new gifts.

Group 2.jpgAfter the Lufthansa meeting we returned to the Hostel for some group discussion and to get ready for our dinner at the Hofbrauhaus!  We were not in the main hall, but were upstairs in their groupdining area.  I had a fantastic dinner of veal ragout with Spaetzel, and a good size dark beer.

Dinner was pretty calm until a huge group of Canadiens came it.  It was a group of ninth grade hockey players and their parents.  Things really started to heat up when the parents started singing Canadian drinking songs and chugging their beers.  This brought on a resounding L-U, L-U, L-U-T-H, T-H, T-H, T-H-E-R from the Luther crowd and soon we were all friends.

Back at my room, sleep was hard to come by in this second night.  I mostly drifted in and out of sleep until my alarm went off at 6AM, we needed to be out of the hostel and headed for the train station by 6:45.  As I write this I am on the train to Mannheim and then Interlaken.

 

in praise of the two fat ladies

via The Amateur Gourmet

Mr. Game Show was a Hanukkah gift that my parents bought me one year in the 1980s. It looked like a regular board game (small ... Read More >>

dear apple

Dear Apple,

You lost a sale today. I know its just one less iPhone you are going to sell, and in the grand scheme of things does not amount to anything. I suppose its not really your fault, and as a loyal Apple customer its much easier for me to blame AT&T than you. Still, it makes me sad to have to tell you this. I waited as long as I could for AT&T to expand their network in my direction. I’ve hung on every Verizon rumor for two years. Finally after enduring a year of carrying my iPod touch in the same pocket as the mind numbingly horrible Motorola Crush I bought an HTC Desire yesterday. Android!! I never thought I would see the day.

Here’s whats even worse, I like it! It has some great apps Gmail, Calendar, and many apps that I already love on my iPod Touch and iPad: Dropbox, Evernote, 1Password, Kindle, Facebook, Twitter, Weather, Stocks, and a 5, yes 5, megapixel camera! I already love the gps, so the location aware apps work, I love the WiFi and the Bluetooth.

I’m going to miss OmniFocus, but I carry around my Ipad almost everywhere I go so I don’t think I’ll miss it that much.

So Apple, I’ll remain a loyal customer, at least for now. I’m going to continue to develop my app for the iPad, I still love my iMac and my MacBook Pro. But if US Cellular comes out with a decent family data plan in the next month or so you may lose two more sales as the rest of my family follows me into the smartphone world.

ebook man is cleaning out the library

So today I sat in my office and looked over at my library of books, probably about 700 books all together. The top half of the library contains my cookbook collection and lots of other non-fiction books. The bottom half is largely science fiction, some paperbacks that I’ve had for 30 years, The Lord of the Rings trilogy for example. There were also several large stacks of books on the floor because the shelves are full. Jane is wanting me to do something to get the books off the floor. Even though she doesn’t spend that much time in my office so I don’t know why it bothers her, but she’s right the piles have been accumulating and its time to do something.

Suddenly it hit me, I could let all of the paperbacks go. I’ve been saving them for years because they are my favorites and maybe I’ll read them again, or maybe I just like to look at the shelves and see my old favorites sitting there. I’m not sure what the precise reason is, whatever it is I’m over it. I just realized that if I did want to read them again, I would no longer want to do it by holding a real book in my hand. I realized that just like all of my old ’80s music that I had on cassette tape these are relics of my past, and if I did want to read them again I would be happier to download them to my iPad and read them in the kindle app or iBooks. But, fat chance that the iBooks store would have any of these old favorites. I prefer the iPad over the dedicated Kindle because it saves me one device. Plus until now the kindle required cell coverage that I don’t have.

So, here, for posterity, and maybe to remind me in the future if I come back and read this post instead of staring at bookshelves, is a random walk through the lower half of my library. If you have suggestions for what I can do with the paperbacks let me know. If you read this list and have suggestions for other authors you think I would like, definitely let me know.

  • Rober Sawyer, every book ever written by him except for the current WWW series which I bought in electronic form from the beginning. Factoring Humanity, Calculating God, the Hominid Series, great ideas

  • Isaac Asimov, The robot books, and the entire foundation series. These books took me through college.

  • Stephen R. Donaldson, the Thomas Covenant Chronicles. Covenant is still one frustrating guy whenever I think about these books. Although I notice that there are some new additions to the series that are out in eBook form…

  • Dan Simmons, the Hyperion, Endymion series. The Shrike was one scary monster.

  • David Brin, Despite the absolutely dismal movie the Postman is still a favorite in how it forshadowed the web. I also have some Brin on the upper half of the library, The Transparent Society is an excellent book to get you thinking about privacy in the digital age.

  • Orson Scott Card, the Enders Game series… I loved all of these books, and I even like some of the more recent ones where he goes back and fills in some missing pieces from the perspective of other characters.

  • Connie Willis, The Doomesday Book is awesome as are many of her other stories although none have captivated me as much as that one.

  • Frank Herbert, The Dune series of course.

  • Robert Heinlien, Stranger in a Strange Land and others.

  • Mary Doria Russel, The Sparrow. This is one of my all time favorite books, in fact I even made my Paideia students read it last year. I’m sure they thought I was off the deep end for making them read Science Fiction in a serious class like Paideia but Oh well.

  • Robert Russo, not science fiction but a great writer. I like all of his books, but teaching at a small college, I get tears in my eyes from laughing so hard when I read Straight Man.

  • And speaking of non-science fiction books, Jon Hassler, this guy captures small town midwest living so well. From Staggerford to Rookery Blues they are amazing. I miss him, and I miss Connie Helgen who recommended him to me. After our trip to Ireland this summer I’ve been longing to go back and read a Green Journey again, but I just checked and its not available in the Kindle store. Horrors!

  • James Halperin, The Truth Machine, and I just read an article this morning about a group out in california that is using MRI as a new lie detector. Anyway, read this book.

  • Roger Zelazny, the whole Amber Series, kind of a disfunctional family but the whole series is fun to read.

  • John Grisham, hmmm why did I save all of these??

  • Carl Sagan, Contact. I read this way before the Jodi Foster movie. That was just a bonus for a young geek who loved her in the after school specials.

  • J. R. R. Tolkien, a boxed set of the Hobbit and the Lord of the Rings. I don’t think I can part with these. I still remember reading these late at night with a flashlight under my blanket. I’ve still never been able to make it through the Silmarillion though.

  • Douglass Adams, such a loss, The Hitchhikers Guide to the Galaxy series. I swear I can open up any of these books to a random page and start reading and I’ll be laughing in no time.

  • Neal Stephenson, Snow Crash and Cryptonomicon. I’ve never had the energy to make it through the Quicksilver books, but I have Anathem on my iPad so we’ll see.

  • Gordon R. Dickson, Dorsai, the Chantry Guild, The Final Encyclopedia

  • Larry Niven, the Ringword Books, and other books with Jerry Pournelle (a Mote in God’s Eye) I still remember looking forward to reading Pournelle’s Chaos Manor column in Byte magazine every month

  • Robert Charles Wilson, Spin, Darwinia, The Chronoliths, and others.

  • Vernor Vinge, A Fire Upon the Deep, a Deepness in the Sky

  • Ursula K. LeGuin, The Dispossessed, and the Earthsea books.

  • Mary Stewart, The Crystal Cave series that retells the legend of King Arthur.



I also discovered a rather interesting section on the shelves devoted to historical fiction, but I’ll leave that for another time. I just wanted to mention it in case you’ve concluded that I’m hopelessly one dimensional.

I would also say that I’ve discovered that computer science reference books work very well as ebooks. I’ve been teaching myself to program my iPad and I have several good references in electronic form. Its nice to have them open on my big screen, and its easy to find examples when you can search.

google app engine service login

So I’m working on an app during my sabbatical that has an iPad component and an online Google App Engine component. The Google App Engine part is half web based and half web service based. Of course this means that the local client part has to be able to authenticate itself to the Google App Engine before it can communicate and do useful stuff. Finding good reliable examples of how to do this is surprisingly hard. For the Objective C code I’m working on I found a nice set of classes that do the trick for you here: On Github For Python I found some example code on stackoverflow. However it was not really in a reusable form.

The basic outline of what you have to do is as follows:

1. Login to https://www.google.com/accounts/ClientLogin This will give you an auth token.
2. Use the token you gained in step 1 to login to your Google App engine application or service. When you have successfully logged in to your service google will set an ACSID cookie for you to use when you make subsequent requests to your service. This prevents you from having to login each time you make a web service request.

I’ve taken some ideas from both places mentioned above and have created a Python class for logging in and accessing app engine services from Python. To use this module you just need to import it and create a GoogleAppEngineLogin object. Once the object is created you can use the open method on the object to access further services. The open method is just a convenience wrapper around urllib2.urlopen but it also makes sure that your cookie has not expired before it makes a request. If you have comments or suggestions for how to improve the code please let me know via email or leave a comment.

The code is reproduced below, but you can also just download the file from git clone git@gist.github.com:36b1c45ed39298178907.git


import getpass
import urllib
import urllib2
import cookielib


class GoogleAppEngineLogin(object):
“""
Logging in to an App Engine Account (when you use google users) is
a two step process: First you must login to Google generally. This
gets you an auth token. The auth token is used as part of a
request to login to your app/service During the login process for
your app/service the server sets a cookie with the name of ACSID,
it is this cookie and its value that serves as the authentication
token for your own service/app. So, for future requests you need
to give the server the cookie as part of your request. Handling
cookies can be a bit tricky if you haven’t had some experience with
it but luckily Python’s cookielib module makes it all pretty
automatic.

This class takes care of the whole login process for you, and then
gives you a simple helper to access the URLs for your service.
The helper function makes sure the cookie is still valid and
passes on the request along with the cookie. Technically you
would not even need to use the helper function, you could use
urllib2 directly to access your service but this seems a bit
neater to me.

Some of this code was inspired by and lifted from an example on
stackoverflow.com, but that was all in-line code my contribution
is to add some error handling and encapsulate the whole thing
inside a class to make it easier to include in my/your own
programs. Here’s a link to the original thread on stackoverflow
http://stackoverflow.com/questions/101742/how-do-you-access-an-authenticated-google-app-engine-service-from-a-non-web-pyt

“""

def init(self, user_email, user_pw, uri, source):
“""
Create a Google App Engine Object.
Arguments:
- user_email: your google username
- user_pw: your google password
- uri: The url of your google app engine service
- source: The unique name of your google app engine service
“""
self._user_email = user_email
self._user_pw = user_pw
self._uri = uri
self._source = source
self._authtoken = None
self._auth_cookie = None

if not self.google_client_login():
raise RuntimeError(“Could not login to Google”)

if not self.app_engine_login():
raise RuntimeError(“Could not login to your application”)


def google_client_login(self):
#
# get an AuthToken from Google accounts
#
auth_uri = ‘https://www.google.com/accounts/ClientLogin'
authreq_data = urllib.urlencode({ “Email”: self._user_email,
“Passwd”: self._user_pw,
“service”: “ah”,
“source”: self._source,
“accountType”: “HOSTED_OR_GOOGLE” })
auth_req = urllib2.Request(auth_uri, data=authreq_data)
try:
auth_resp = urllib2.urlopen(auth_req)
auth_resp_body = auth_resp.read()
except:
return False
# auth response includes several fields - we’re interested in
# the bit after Auth=
auth_resp_dict = dict(x.split("=")
for x in auth_resp_body.split("\n”) if x)
try:
self._authtoken = auth_resp_dict[“Auth”]
except:
return False

return True

def app_engine_login(self):
#
# Get a cookie
# we use a cookie to authenticate with Google App Engine
# by registering a cookie handler here, this will automatically store the
# cookie returned when we use urllib2 to open
# http://www.google.com/accounts/ClientLogin
self._cookiejar = cookielib.LWPCookieJar()
opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(self._cookiejar))
urllib2.install_opener(opener)


serv_args = {}
serv_args[‘continue’] = self._uri
serv_args[‘auth’] = self._authtoken

full_serv_uri = “%s/_ah/login?%s” % (self._uri,urllib.urlencode(serv_args))

serv_req = urllib2.Request(full_serv_uri)
serv_resp = urllib2.urlopen(serv_req)
serv_resp_body = serv_resp.read()


for i, c in enumerate(self._cookiejar):
if c.name == ‘ACSID’:
self._auth_cookie = c
return True

return False

def open(self,url,data=None):
“""
url should be a properly encoded url ready to go. data is
optional and should be used to provide parameters to pass
along with the URL when you want to use POST instead of GET.
If you provide data it must be properly encoded just as if you
were calling urlopen directly yourself.
“""
if self._auth_cookie.is_expired():
if not self.google_client_login() or not self.app_engine_login():
raise RuntimeError(“Cannot get proper authorization for this request”)

serv_req = urllib2.Request(url,data)
return urllib2.urlopen(serv_req)


if name == “main":
user = raw_input(“User: “)
pw = getpass.getpass(“Password: “)
service_url = “http://myapp.appspot.com
service_name = “myapp”
gae = GoogleAppEngineLogin(user,pw,service_url,service_name)
h = gae.open(“http://myapp.appspot.com/my/service")
print h.read()



polk county biking

Here’s a quiz for you… What do deer, old cars, a saw mill, and black bears all have in common? These are all things I regularly see on my rides around polk county. The countryside by our cabin is some of the best riding around, every road is paved and very lightly travelled. I can ride around any number of lakes and have all kinds of flexibility to make a route that is anywhere from 12 to 50 miles long. Bone Lake, Half Moon, Pipe, Balsam, Little Blake, Butternut, these are a few of the lakes that I loop in and through on a regular basis.

So, the other night I took my camera for a ride and focused more on the picture taking that the riding. Here’s my favorite shot from the night and you can find the rest of them here:IMG_1264.jpg

Incidentally, this picture illustrates where the bear comes in to the picture. This little pond is at the bottom of a little hill and around a nice little corner. One morning a came coasting down the hill and around the corner to see a black bear, he would have been right in the bottom right corner of the picture. I don’t know which of us was more surprised! The bear took off one way and I took off as fast as I could up the hill and past the pond. We’ve never seen each other again.