Udun's Labs

Python's Super

First thing that comes to mind : why do I need to name the superclass explicitly, instead of passing in self.__class__ (or better still, type(self)) ? Because:

class Base(object):
    def method(self):
        print 'original'

class Derived(Base):
    def method(self):
        print 'derived'
        super(type(self), self).method()

class Subclass(Derived):
    def method(self):
        print 'subclass of derived'
        super(Subclass, self).method()

leads to:

>>> Subclass().method()
subclass of derived
derived
derived
derived
<...>
  File "<stdin>", line 4, in method
  File "<stdin>", line 4, in method
  File "<stdin>", line 4, in method
RuntimeError: maximum recursion depth exceeded while calling a Python object

And this pretty much explains the second question I had.

Set Up Octopress in Windows 7

Download ruby from here - I downloaded rubyinstaller-1.9.3-p448.exe

Install it, add it to path then create a folder to host octopress and your blog (in DB naturlich) and fire up git bash.

Welcome to Git (version 1.8.4-preview20130916) # how are you ?

MrD@MRSD /c/dropbox/Udun
$ ruby --version
ruby 1.9.3p448 (2013-06-27) [i386-mingw32]

MrD@MRSD /c/dropbox/Udun
$ git clone git://github.com/imathis/octopress.git
Cloning into 'octopress'...
remote: Counting objects: 10967, done.
remote: Compressing objects: 100% (5107/5107), done.
remote: Total 10967 (delta 5807), reused 9843 (delta 4984)
Receiving objects: 100% (10967/10967), 2.46 MiB | 82.00 KiB/s, done.
Resolving deltas: 100% (5807/5807), done.
Checking connectivity... done

MrD@MRSD /c/dropbox/Udun
$ cd octopress/

MrD@MRSD /c/dropbox/Udun/octopress (master)
$ gem install bundler
Fetching: bundler-1.3.5.gem (100%)
Successfully installed bundler-1.3.5
1 gem installed
Installing ri documentation for bundler-1.3.5...
Installing RDoc documentation for bundler-1.3.5...

MrD@MRSD /c/dropbox/Udun/octopress (master)
$ bundle install
Fetching gem metadata from https://rubygems.org/.......
Fetching gem metadata from https://rubygems.org/..
Resolving dependencies...
Using rake (0.9.2.2)
Installing RedCloth (4.2.9)
Installing chunky_png (1.2.5)
Installing fast-stemmer (1.0.1)
Gem::InstallError: The 'fast-stemmer' native gem requires installed build tools.


Please update your PATH to include build tools or download the DevKit
from 'http://rubyinstaller.org/downloads' and follow the instructions
at 'http://github.com/oneclick/rubyinstaller/wiki/Development-Kit'
An error occurred while installing fast-stemmer (1.0.1), and Bundler cannot
continue.
Make sure that `gem install fast-stemmer -v '1.0.1'` succeeds before bundling.

Oops. Install1 RubyDevKit - I downloaded DevKit-tdm-32-4.5.2-20111229-1559-sfx.exe. Install means unzip - I unzipped into C:\_\Ruby. Then