python

How to Find a iPad 2 using Python

I did not buy the version 1 iPad because an iPad without a front facing camera just does not seem right. At iPad 2 launch day, I was going to go stand in line (as I did for my iPhone 3GS) for one, as my office is about a mile away from the Boston Apple Store. However real work got in the way.

I did not anticipate the demand for this thing. I guess a lot of people were like me, skipping the iPad 1 and waited for the iPad 2. I did place an order order days after, which is of course too late.

Python to the rescue! Someone posted the links to check for stock on the Target mobile site. I threw together a quick python script, using BeautifulSoup (Don't you love BeautifulSoup ?) to scrape the site. Saturday night, I found a 32G black iPad 2 available in a Target close by ! I drove over almost first thing Sunday morning, only to find that the two that they had in stock was already purchased by someone who got there, waited for the store to open, at 8am.

Lesson here? Programming is easy. Actually getting up in the morning and driving over to wait in line is, well, a bit overkill. I think I will just wait for the online shipment.

Meanwhile, you can try out the python program here. Rename to .py for running.

Jacob Kaplan-Moss on DevOps

Jacob gave a talk at the Boston Django Meetup this month on the topic of DevOps -- The role of the developer and the role of sysadmin are merging, and it is a good thing. This idea certainly resonate with me. I started my career as a DevOps by necessity -- I worked with a new and proprietary mini-computer, the Stratus. The OS was designed to be a developer's OS. All the operation support tools are designed for used by developers. It was a great OS to work with. When I moved to the *nix world, I met Ben, still one of the best sysadmin I know, who actually introduced me to Python. The world has come full cycle now. With utility computing and browser based clients, small team with small budgets launch large scale, fast growing web applications, developers need to be their own sysadmin as well. This is the video of Jacob's talk. I was a little bit late and missed a few minutes at the beginning.

Jacob Kaplan-Moss on DevOps at Boston Django Meetup 2010 from PK Shiu on Vimeo.

2010 May Boston Python Meetup Videos

Here are the videos for the Boston Python Meetup in May, on "Testing". Two speakers were Marshall Weir on "Testing, Where Do I Start?" and Stephan Richter on "How to Test the Hard Stuff". The videos are pretty long. I ran out of SD space at the end so missed a little bit of info at the end. There were constructions at NERD with banging and buzzing. It is amazing that we got even this much usable audio from it.

Boston Python Meetup 2010 May Part 1 from PK Shiu on Vimeo.

Part I.

Boston Python Meetup May 2010 Part II from PK Shiu on Vimeo.

Part II

Fix Python source code to use spaces instead of tabs

What if someone gave you a Python source file that is indented using tabs? If you are using emacs, the following will let you convert it back to using spaces: [shell] # first set the buffer tab width to 4 (or whatever you like) M-x set-variable <return> tab-width <return> 4

# then mark the entire file C-x h

# do untabify to convert: M-x untabify <return> [/shell]

# That's it!

Technorati Tags: ,