Google

OpenID

Another day at Google, another very neat tech talk. Today I went to a talk by Simon Willison about OpenID. I had heard of OpenID before, and I knew that it was recently added into Drupal by James Walker who wrote the Drupal-Gallery2 module that this site (and many many others) are using. Cool!

However, I didn't really "get it" and never spent the time to read up on things. That all changed today, and I've been convinced that OpenID is the way to go for several reasons:

  • One username and one password. No more remembering different things for different accounts, or using the same one everywhere and risking it getting compromised. You have one account with a trusted provider (hopefully eventually banks, etc, but for now everyone that has an AOL/AIM account has one, there are plenty of other OpenID servers out there, or you can run your own) and that's it.
  • No more having to register on someone's blog just to post comments. Log in with OpenID (Or just stay logged in with your browser), approve the site accessing your ID, and you're done! Logged in whenever you visit from now on. (This could cut down on comment spam once OpenID becomes more prevalent because a content owner could just require people to be authenticated by some OpenID before commenting)
  • No need to give MySpace/FaceBook/etc your GMail/Yahoo/Hotmail account information so that it can get your contacts. You can use OpenID to let one of them into the other instead
  • Did I mention it's one password for everything? Alternatively, it could be a client SSL certificate, one time pad, out-of-band provided browser cookie, out-of-band code (via SMS/Jabber/etc), biometric, SmartCard, etc.

So I'm hooked, as much as I can be at least. I deleted my silly LiveJournal account that I only had so that I could read other peoples blogs that were friend only and replaced it with an OpenID one. My OpenID points to ckdake.com (surprise surprise) which points to AOL as my OpenID provider. This lets me use my AIM user/password to get into my LiveJournal account so it's one less account I have to remember. Christian's blog (one of the Gallery guys) will be the first one where I test out leaving a comment with it, once I have something useful to say at least. Sadly, other than those two things, nothing else that I regularly use supports OpenID. Once Drupal 6 is out, I'll upgrade this site and Faster Mustache to use them, (and corndogorama.com and a couple of other sites I manage,) and hopefully other sites will start to do the same. AOL, Microsoft, and Sun are already behind this, so hopefully the ranks of FaceBook, Yahoo, and Google will follow!

T-shirts and SWIGged C

First of all, at Google it's another day, another t-shirt. I added a partial album of Google T-Shirts from this summer so far. I haven't even managed to take pictures of all of em yet..

But on to this SWIGged C thing. I was fighting with another very strange problem in some code I was working on. I'm writing all of my code in Python, but a lot of the things that I need to use are in C++. Conveniently, there is a nifty tool called SWIG that lets someone expose C++ and C objects and methods to "a variety of higher level programming languages" of which Python is one of. (Cool!) So there was some C++ code I needed to use and a quick Python loop later, I thought I had something written that would create all of the C++ backed objects that I needed. Each C++ object had 3 other C++ objects assigned to it in Python. All sounds believable and looked like perfectly good code to me, but something wasn't right. When running it I would get strange core dumps that didn't make any sense, and the 3 people I go to at work to ask Python questions were all baffled. In addition to just crashing, very strange things would happen like when trying to reference an object, I would get back the contents of one of the sub objects of the other objects some of the time and nothing other times. I fought this most of the day, trying wrapper classes, using a create method instead of doing the work in a loop, etc, but nothing seemed to work. I thought it might be an issue with variable scoping, but Python isn't stupid and a variable private to a method is private to that method, etc. After a suggestion from one of the guys I work with, I created a global array and used a counter in the loop separate from the SWIGged objects and indexed the objects in the array with that. My manager agreed with me that this was quite a goofy solution and sent me down another path of figuring things out.

Turns out, the problem was my lack of understanding how swig ties in with C++ and Python memory management. Either C++ or Python "owns" an object and if Python thinks it owns the object (It did because I created it in Python) and thinks it no longer has any references to the object(I wasn't using the C++ objects outside of that loop as far as Python knew because of threading crazyness), garbage collection will come by and trash the object, and eventually something else will use that chunk of memory (hence my crazy crashes and things showing up in odd places). There is a mention of object ownership and destruction for SWIGged objects in Python in the SWIG documentation, but I was new to all of this (I didn't even know what SWIG was or that I was using it at the start of the day!) so I ended up needing some pointers to the right place to look from someone that had seen this before. The solution: After creating the object in Python, just calling myObject.__disown()__. If things continue at this rate, I'll know more about Python by the end of this summer than I do about Perl (after spending 4 years teaching myself) and PHP (after spending 7+ years using it myself and 3+ years managing Gallery where we do things like beta test versions of PHP before they are released, use unit testing, and have paid security audits that I get to read.).

Somewhat famous.

This is a little overdue, but it needs to be posted anyways. I mentioned a few weeks ago that Carolyn Porco, the imaging team lead from the Cassini mission to Saturn, came to Google to give a talk. That seemed pretty awesome to me, but to outdo that, last week a few slightly more famous people stopped by:

  • Aubrey de Grey - This guy is convinced that science can prevent aging and is doing everything he can to make it so. He's the front man of biomedical gerontology much the same as Richard Stallman is of the Free Software movement. (Compare the pictures on their bios.. I didn't remember that until just now!) Dr de Gray gave a 30 minute presentation on the basics of preventing aging and spent another 30 minutes answering questions. Googlers tend to be very good at asking good questions, and the Q&A portion of talks is often more interesting than the actual presentation
  • NASA administrator Michael D Griffin gave a talk on NASA's plans for future spacefight. He expects a shift of the "easy" parts to commercial entities (like getting things into orbit), while leveraging federal funds to build communications infrastructure and coordinate getting people to Mars. The focus of NASA's plan for the future is getting people onto the moon again and then onto Mars, but there is still much that can be done with robotic exploration, and NASA could really use more funding to do what they feel need should be done.
  • Presidential candidate John Edwards stopped by later that day to talk about his platform and answer questions from a Google audience. Like most other politicians I've heard, I really liked half of what he said, and didn't feel as good about the other half. Perhaps I'll get to doing as much research as I would like when the election is a little closer.

I'm looking forward to who Google decides to bring next!

RSS Feeds

I have a lot of websites that I frequent all the time to stay on top of things that I think are important for one reason or another, and the list was getting big. Firefox kept asking me "Are you sure you want to open more than 15 tabs at once? This may slow down your computer," and that was for the "people", "software", and "other" bookmark folders. While thinking about how much I loathed RSS readers and how badly they tied you to one computer, and how the feed aggregator on Faster Mustache for a number of bike blogs is great but I don't know what I've read already, I was browsing around some internal Google documentation and stumbled across Google Reader. It's a Google thing so I could do the occasional personal catching up at work and still be "testing internal technologies" or something (It is a Google Labs experimental project after all. Things like oh, Google Maps got their start there.)

Needless to say, I'm impressed. The interface is as simple as it can be (and there is an even simpler interface designed to be used on the Wii!), and it's finally allowed me to get everything in one place where I can make sure not to miss things, all while wasting less time visiting sites that haven't been updated and waiting on tabs to load. Unlike other feed aggregators I've played with, it easily lets me "star" items so that I can go back to them easily later, shows inline images the way the author intended, and it makes pretty graphs of how often I read what how much. (If you're a regular here, you'll know how many points pretty graphs are worth when I'm evaluating something) I think I finally have everything loaded in there that I currently visit, and Google Reader sums it up nicely: "From your 44 subscriptions, over the last 30 days you read 336 items, starred 1 items, and shared 0 items." Everything from Slashdot, to my friend's blogs, to all kinds of bike related things, to the comments you leave on ckdake.com, all in one place!

To play with in the future, it supports tags which would require a little more input reading but would make finding things later a lot easier, and if a better feed reader comes along, Google Reader will export to a standard format that other readers can read in. If you have a lots of sites you check in on, I highly recommend giving Google Reader a try!

Meetings and Presentations

Sure sounds awful right? Nope! Last weekend Jens (from Gallery and Germany) was in Mountain View, so we figured we should do something. Friday night Ben (my roommate) and I showed Jens the most important things American: Malt Liquor and In-N-Out Burger. Good times! On Saturday, Bharat had a cookout at his place (another American experience that Jens needed before heading back to Germany on Sunday) and Bharat (+family), Robert, Alan(+Family), Jens, and I ate burgers and drank beer. Jens picked up a 12-pack of PBR to give to Bharat with a Stein from Germany and much hilarity ensued for the whole afternoon. Jens apparently thinks that Bharat's dog only speaks German and Bharat's kids apparently do not have an off switch. Bharat, Jens, Robert, and I ended up at a bar playing pool for the late evening and I ended up sleeping on Bharat's couch. (Robert was on another and Jens was on an air-mattress). Good Times.

But on to presentations... Google has these things called "Tech Talks." Sometimes it's internal Google things that I can't really talk about but they're really neat, but other times it's people from the outside talking about things that they think are cool and that Googlers will likely find interesting. I managed to go to three of them today and they were all definitely worth going to!

  • A guy from the Rentrak came and talked about how they use custom scalable database solutions to manage all of the video viewing data they can get their hands on. Movie theatres, Movie rentals, video on demand downloads, etc. Think several billion records generated a day..
  • A researcher from University of California Santa Barbara came and talked about fiber optic switching technologies. His lab has come up with actual working switching devices that can do things like switch 10GB/s of traffic in a single completely optical path using mere Watts of power dissipation. Compare this to the current optoelectronic that often require hundreds or thousands of Watts and can't even begin to work at wire speed for higher speeds without taking up lots of space. This guy's fully optical switch for a large amount of bandwidth will take up the space of one line card in a router and have the same capacity of a router that takes up two entire racks (~64 line cards) and uses _lots_ of power.
  • Carolyn Porco, the imaging team lead from the Cassini mission to Saturn. Her presentation was all pictures (you can see lots of images at ciclops.org, which she runs) with very interesting narration. The thing I found most interesting is that one of Saturn's moons has jets of particles shooting into space that are likely the result of liquid water on the surface. There could be life because there is plenty of organic matter and liquid water would do the trick! She gave the example that all a probe would need to do to detect things would be to land and just look up and stick out it's tongue. Interestingly, even though her involvement with NASA is tied up in robotic exploration, she is still a supporter of human space flight and things we should work on getting people further into space instead of just "flying around in circles." Her suggestion that NASA could use a lot more funding gets my vote!.

More tech talks to come in the following weeks!

Python n00b

Working at Google, I've had to start using Python. It's their scripting language of choice and even though all of my scripting experience is in Bash, Perl, and PHP, too bad! Using a new language isn't too bad because languages are just languages and once you know a couple you know them all, and Python isn't really any exception. I've had to search around for the basics like string operators, objects, and so on, but it's not to bad. I've probably written about 500 lines so far and things are doing what they are supposed to do. However, today I ran into something that stumped me for a while.

My current project had me making a tree like data structure (below is an example of something similar). Think boxes containing some number of smaller boxes which contained some number of smaller boxes, etc, which finally contain some number of tiny items in the smallest box. I set up all the classes to do this as well as methods to build test ones of arbitrary size and run some algorithms on it, but something weird was going on.

class Box:
  items = []

a = Box()
for b_label in range(2):
  b = Box()
  a.items.append(b)
  for c_label in range(2):
    c = Box()
    b.items.append(c)
    for d_label in range(2):
      d = Box()
      c.items.append(d)

for each in a.items:
  print '%s' % each

I expected this to print out the addresses of the two boxes in box a, however, it prints a list of all 14 boxes. (further exploring the data structure created shows me that each of the boxes at each level of the tree has each other box in it, totaling 2744 boxes at the inner most level. Uhm... there should only be 14 boxes! I tried all kinds of things, using a dictionary instead of an array for items, using __new__ and __init__ constructor code in the object, including a random string in the name of each object, including a random number in the constructor of the object that it stored to guarantee uniqueness, etc. But nothing worked! After spending too much time on this, I asked my Host (Google's word for the person interns work for) and she said it looked fine but to ask someone that knew Python better. Voila! The solution was so simple it would have been almost impossible to find searching for it. My usage of items was as a class variable. Even though it was inside the class, it acted as a singleton variable across all instances of the box object and was thus shared in each box. Every time anything was added to any box, it was added to all boxes instead of just it's parent box. The solution: declare the items variable in the constructor instead of the class so it would be scoped to the instance of the object:

class Box:
  def __init__(self):
    self._items = []

Problem solved! So if you're new to python and playing with things, make sure you scope everything properly! According to the guy that helped me out, he's pretty solid at python and still makes this mistake every now and then and it's very hard to track down.

California: Week 1 of 12

I'm almost settled in completely, there are still a few things I need to grab from the store but some new bike shoes are in the mail, and I ordered some external drive enclosures for the two hard drives I brought from home so that I can use VMware on my laptop to boot up Linux and get at all of my things (Music, Pictures, Etc). A new Dell will be along the way after the first paycheck from Google comes in. Also on the way is a Nintendo Wii (as soon as the Gamestop here has one or I find one online thats a good deal) and a road bike (There is a Performance Bike shop right down the street from here and currently every bike is on Sale so I may try some out this weekend). I picked up some new pillows that were on sale at Target for $4 each, and at work I've got a spiffy mouse and some spiffy headphones coming down the pipe for me.

Today was bike to work day in Silicon Valley so there were bikes everywhere today. Various companies and organizations had "energizer stations" around where you could stop for fruit, energy bars and drinks, and free stuff. In my two stops, I got a small bag, an REI water bottle, a bike to work day water bottle, various coupons for free things around town, a 15% off REI coupon, and some bike maps of the area. Once at Google I got a Google branded Specialized mini-pump and a bag of soap/shampoo stuff (uh, ok?). The annoying part about this is most of the available places to lock up were taken (which wasn't a problem in the morning because I was the 25th person on a bike to check in at the table, but was a problem when I biked to main campus for lunch) and people were biking all over the place on the road doing crazy things on their bikes, but I guess that's the price to pay!

Dinner was one of the biggest burritos I've ever seen (thank you Google) and it's only 9:30pm and I'm already down to an empty inbox and slightly shorter list of big things to get done. Tomorrow is already Friday!

Google Perk of the moment: Crazy Japanese heated toilet seats (with all the other crazy toilet seat functions) everytime I've needed to check.

first day at Google

So today was my first day at Google and it was pretty awesome. There's not really a whole lot that I can talk about because it's all super secret, but here's a few tidbits:

  • There is a life-size T-Rex skeleton outside. Today it happened to be eating a pink lawn flamingo. Anything outside is fair game for pictures but no pictures inside. I'll get some pictures up eventually, but I don't have what I need to get them camera->library->intarwebs just yet.
  • I am working on the coolest project ever. It's network performance related and is just pretty much the coolest thing ever. And thats all I can say about it!
  • My desktop machine at work has dual 24" monitors and is the most powerful machine I've ever had a keyboard plugged into. Which is good, because I'm going to be there for most of my time this summer.
  • Free food! It's everywhere. My food expenses this summer will be limited to when I feel the need to go out to eat somewhere. Indian restaurant in downtown Mountain View, here I come.
  • Biking here is very different from Atlanta. My commute is around 2.5 miles and is completely flat. I'll need to do a bit more riding than my commute to stay in shape so I'm going to get a super nice road bike to supplement the fixie. It's a 50 mile ride with 2000 feet of elevation gain and drop to get to the Pacific Ocean, so uh, it's on. There's a Performance Bike and an LBS or two pretty close, and my gut feeling is I'll end up with a high-end aluminum road bike from Performance.

Time to work on my sleep schedule some more, but there should be more frequent updates from me. This weekend is a BBQ at Bharat's house with a handful of Gallery people including Jens (from Germany), and the next weekend San comes to visit! The next weekend might be time to attempt a ride to the coast..