Another Day of Swimming

Yesterday’s swimming lesson was very memorable. I had the privilege of learning under a different instructor, Phil, who covered for the regular instructor Claire. Phil is a children’s swimming instructor with deep knowledge and passion for swimming.

I learnt more fundamental things about swimming. Specifically, it was the first day I felt myself float confidently in water.

First, you need to breathe in deeply before diving into the water. The excess air in the lungs make you float higher longer.

Also, I learnt the importance of our ritual of walking across the water back and forth at the beginning of each lesson. We do it to get warmed up and get our muscles ready for the rigor of swimming.

Yesterday was the first time I tried back stroke and for the first time I felt myself float at the surface while doing it.

Furthermore, I learnt officially that flapping of the feet gives me next to no propulsion. I will need to use my hands to propel myself forward in addition to the initial momentum obtained from jumping into water.

There are two types of swimming aids: the paddle and the noodle – noodle helps you float even better. Previously we had been using just the paddle.

Finally, I learnt that when doing a star float face up I need to lean my upper body into the water so that my feet can come up. Basically I have to think of my body as a see-saw.

Ultimately I figured out that the best way to improve my swimming technique is a tried and true method: Practice.

How to enable vi mode for several terminal applications on Unix (os X)

In order to enable vi mode for several readline-compatible (terminal) applications ilke ipython, MySQL, etc. on Unix (os X)

Set the following in your ~/.inputrc file:

set editing-mode vi
set keymap vi
set convert-meta on


In case someone’s wandering in here recently, IPython 5.0 switched from readline to prompt_toolkit, so an updated answer to this question is to pass an option:

$ ipython --TerminalInteractiveShell.editing_mode=vi

… or to set it globally in the profile configuration (~/.ipython/profile_default/; create it with ipython profile create if you don’t have it) with:

c.TerminalInteractiveShell.editing_mode = ‘vi’


python – How do I use vi keys in ipython under *nix? – Stack Overflow.

How to fix problem of decoder jpeg not available

When doing image manipulation with PIL in a Django app, you may see an error like decoder jpeg not available.

To fix this on os X, first you need to install libjpeg as follows:

brew update
brew install libjpeg libpng

Next, try to reinstall PIL. Use the following command:

pip install  --no-cache-dir PIL --allow-external PIL --allow-unverified PIL

That should be all. However, if you get an error saying cc command failed while installing freetype, then you will need to install freetype2 as follows:

brew install freetype2

Next you need to create a symbolic link to allow pip find freetype2 as follows:

ln -s /usr/local/Cellar/freetype/2.6.1/include/freetype2\

Note: 2.6.1 above is the version as at the time I ran the command. Replace it with the appropriate number for you.


If you do the above steps and still get the error, then uninstall the version installed via pip and build PIL from source. I had to do this once. Here’s code to see the decoders available

import _imaging

See if jpeg_decoder is among the properties