Upgrade python to 2.7.3 in cygwin

AppEngine is using Python 2.7, but the version of python installed with cygwin is 2.6. I have been trying to find how to install Python 2.7.3 on my machine, then I find this post

I installed successfully on my machine, and here is the step:

  1. download Python
  2. download the patch to the same directory.
  3. extract Python to current directory apply the patch
    $ bzcat Python-2.7.3-cygwin.patch.bz2 | patch -p0
    patching file Python-2.7.3/Include/py_curses.h
    patching file Python-2.7.3/Modules/_curses_panel.c
    patching file Python-2.7.3/Modules/_io/_iomodule.c
    patching file Python-2.7.3/Modules/_io/_iomodule.h
    patching file Python-2.7.3/configure
    
    
  4. Remove the soft link for the current version of python
    $ ls -l /usr/bin/python
    lrwxrwxrwx 1 CGuo mkgroup 22 Sep 17 17:33 /usr/bin/python -> /usr/bin/python2.6.exe
    
    CGuo@CGUO-E8420 ~/Downloads/Python-2.7.3
    $ rm /usr/bin/python
    
  5. Run configure with /usr/local. I first tried with /usr/bin and it failed with permission issues.
    
    CGuo@CGUO-E8420 ~/Downloads/Python-2.7.3
    $ ./configure --prefix=/usr/local
    checking for --enable-universalsdk... no
    checking for --with-universal-archs... 32-bit
    checking MACHDEP... cygwin
    checking EXTRAPLATDIR...
    checking machine type as ...

git

I have been using a lot of git recently. The more I use it, the more I love it. As a start, this Pro Git Book is a must read!

Tag Cloud

The next task is to create Tag Cloud for this blog, this is a good reference: Tag Cloud With Python

It turns out the the https://github.com/atizo/PyTagCloud is using a library called pygame which is not available in AppEngine, and http://code.google.com/p/feed-tagcloud-appengine/ is tied to Google's bog platform. Need to search for new solutions.

Prettify

This looks pretty good!
var http = require("http");
var url = require("url");

function start(route, handle) {
	function onRequest(request, response) {
	    var pathname = url.parse(request.url).pathname;
	    console.log("Request for " + pathname + " received.");
	    route(handle, pathname, response, request);

	}

	http.createServer(onRequest).listen(8888);
	console.log("Server has started at port 8888.");
}

exports.start = start;

Python function syntax

Most of python syntax is pretty simple and straight forward, but I sometime confused with the function definition one. Here is a reminder to my self:

  • kind: regular input parameter
  • *arguments: all the other input parameter except keyword arguments
  • **keywrods: the keyword argument, which must be at the last. Keyword argument is in the form of key='value'

Example:

def cheeseshop(kind, *arguments, **keywords):
    print "-- Do you have any", kind, "?"
    print "-- I'm sorry, we're all out of", kind
    for arg in arguments:
        print arg
    print "-" * 40
    keys = sorted(keywords.keys())
    for kw in keys:
        print kw, ":", keywords[kw]
        
cheeseshop("Limburger", "It's very runny, sir.",
           "It's really very, VERY runny, sir.",
           shopkeeper='Michael Palin',
           client="John Cleese",
           sketch="Cheese Shop Sketch")

produces:

-- Do you have any Limburger ?
-- I'm sorry, we're all out of Limburger
It's very runny, sir.
It's really very, VERY runny, sir.
----------------------------------------
client : John Cleese
shopkeeper : Michael Palin
sketch : Cheese Shop Sketch

Nodejs

I have been interested in Nodejs for a while. I am very excited as a start. I am kind of disappointed after a while, a few if the issues I faced:

There are no mature framework out there. Many of the existing framework are stepping on the toes of each other. You have to completely rewrite your code once you change frameworks because they might listen to the same message. The message you are listening might be hijacked by others (so you never get it).

No IDE support. Given the nature of javascript, it is kind of understandable, but it impacts productivity a lot.
Poor documentation of frameworks. Even worse, the framework often changes dramatically from one version to another. You have to relearn (and redo) everything again.

Debug is hard, sometime there is no error at all. Most of the time, the exception is not where the problem is.

I am going to wait for a while for the framework and tools to catch up.

Why Python?

I have been asking myself the question, "why learn python"? It seems I enjoyed using it, otherwise I won't try the Appengine with Python. I want to know what other experts are saying, then I find this post:

http://www.linuxjournal.com/article/3882

I must agree that I have the similar feeling. I just can not put to words like that.

Favorite Icon

App Engine is kept logging error if you don't have a favorite icon. I found a like http://www.blogdoctor.me/2006/11/how-to-add-favicon-to-your-blog.html which shows a few ways to create one. So I did!

Python

All Button Pressed

Testing post

Testing Post Body