How to fix error of missing zip decoder in Django with Ubuntu 14.04

If installing Django on Ubuntu 14.04 and you run into an error like “IOError: decoder zip not available” solve it as follows:

Install libzip and create a symbolic link in /usr/lib using the commands:

sudo apt-get install zlib1g-dev
sudo ln -s /usr/lib/x86_64-linux-gnu/libz.so /usr/lib/libz.so

Next, reinstall PIL using the commands while in bosg virtual environment:

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

Finally, refresh project if on producion environment.

How to search for packages in Ubuntu

Sometimes while working in Ubuntu you may want to find a package, but not know its name. There’s a command for that. It’s called apt-cache.

apt-cache search <your package>

Source

apt – How do I search for available packages from the command-line? – Ask Ubuntu. http://askubuntu.com/questions/160897/how-do-i-search-for-available-packages-from-the-command-line

How to Send Email in Terminal

In this article I demonstrate how to send emails from the terminal of an Ubuntu machine. It’s assumed you have a Mail Transfer Agent like Exim 4 or Postfix set up.

 echo "<message goes here>" | mail \
 -s "<subject goes here>" <to email address>

Sources

How to send email from the Linux command line – Simple Help. http://www.simplehelp.net/2008/12/01/how-to-send-email-from-the-linux-command-line/

How to remove a PPA on Ubuntu

On Ubuntu, you may add a PPA to get some cutting edge feature and then decide you don’t need that feature anymore. So you may decide to remove the PPA to get the regular version of a library. How do we remove a PPA?

Use the –remove flag, similar to how the PPA was added:

sudo add-apt-repository --remove ppa:whatever/ppa

A safer alternative is to use ppa-purge. Install it with the command:

sudo apt-get install ppa-purge

And then remove the PPA, downgrading gracefully packages it provided to packages provided by official repositories:

sudo ppa-purge 

How to fix error Ascii codec can’t encode unicode character in Django on Ubuntu

In this article I will discuss how to fix error messages saying Ascii codec can’t encode some unicode character when setting up Django on Ubuntu.

A solution is to change the LANG and to set the LC_ALL environment variables.

So, edit /etc/apache2/envvars

Change

LANG=C

to

LANG='en_US.UTF-8'

Also add the following:

LC_ALL='en_US.UTF-8'

How to read cron jobs

From time to time you may be interested in verifying that your cron jobs run as expected. How do we do that? By reading the logs of course. I will describe how to find cron logs in this article.

By default cron jobs get logged to

/var/log/syslog

To view only cron jobs, run the following command:

 grep CRON /var/log/syslog

How to Type in Yoruba

Yoruba is one of the most widely spoken indigenous languages in Africa, spoken by close to 30 million people. It is written with the normal English alphabet plus a few extra “dotted” letters: Ẹ/ẹ, Ọ/ọ, Ṣ/ṣ. Also tone marks are required, grave ` for low and acute ´ for high.

The dotted letters can be made with the US Extended keyboard layout, using Option + x, followed by the base letter. Tones can then be added using Option + Shift + ` and Option + Shift + e

Source

Multilingual Mac: Typing Yoruba. http://m10lmac.blogspot.co.uk/2007/02/typing-yoruba.html

A Visit to Amsterdam

On short visit to Netherlands I had the opportunity to spend a night in Amsterdam. Boy, was it lovely! A few friends and I arrived at Schiphol airport in the evening. From here we had to board a train to Amsterdam Central Station close to where our hotel was located. I was amazed by the sight of the train. It was a double-decker train! I never knew such existed.

double-decker-train

In London double-decker buses are a common sight, but trains, not at all. Overjoyed at the prospect of boarding such novelty my friends and I went straight for the top floor!

on-the-double-decker-train4

A while later we were at Amsterdam Central and I got to behold fine architecture and a plethora of tourists. The massive Victoria Hotel stood by noticeably. One thing that caught my eye was the sheer number of bicycles in the city. I’ve heard that bicycles are a popular means of transportation in Amsterdam, but you really need to see how many bikes are in this place. Honestly, I’ve never seen so many bikes close together in my life. There were trams nearby, and one could see the ocean close by with a boat or two. From the looks of things the station is a part of a sort of island.

around-amsterdam-central-station

Before reaching Amsterdam I was a bit worried that I may find it difficult communicating with the folks there, Dutch being the main language of Netherlands. But I was pleasantly surprised to find out that English is very popular in the city. Right from the airport I found many signs in English and in the city virtually everyone I talked to spoke English. In short, we had no problems getting around there. It was only later, after the trip that I realized that English is actually an official language in Amsterdam due to its long history trading with English speaking countries and the eagerness of the Dutch to learn English.

Amsterdam has a vibrant night life. There are many shops open till late, selling an assortment of things. Food shops dot the landscape with all sort of delicacies from pizza, to burger to more traditional foods. The place was chuck full of tourists walking around enjoying the sights. There’s also the Red Light Districts with its wide array of sex workers. My friends and I had an amazing time exploring the city for the short while we were there.

One small downside I noticed in the are around Amsterdam Central Station is that ATM machines seemed quite scarce. My friends and I had to ask no less than three people before we could find an ATM! So, if travelling to Amsterdam, I recommend having some Euros in cash handy. As a matter of principle I advice holding local currency in cash when travelling to any foreign country.

By and large, I will very much like to visit Amsterdam again and this time do a lot more exploration. I also recommend it as a holiday destination.

It’s all about Breathing

Yesterday was the first time I swam across the breath of the swimming pool without stopping, all thanks to my regular swimming instructor who came back from break and a particularly nice swim mate of mine who offered some crucial tips. I was ecstatic on reaching the other side. I’ll now share the tips I learnt that have improved my swimming technique.

Breathing – you have to breath out SLOWLY into the water. Don’t force out air as this makes you run out of breath quickly. Also it seems this helps you relax. It’s like when in air. You generally breath out gently. Do the same while swimming, but into the water. Previously I used to breath out quickly in water and usually found out to my utter dismay, half way through the lap that I was already out of breath and ready to sink. When I controlled my breathing I found that I could travel longer before running out of breath. This I feel is the single most important factor I altered that improved my swimming yesterday.

You have to really kick against the swimming pool wall at the beginning of a push and glide, kick routine. This gives propulsion that takes you farther through the water. In previous lessons I used to give a soft kick to the pool wall at the start of a glide. But I tried out giving the wall a solid kick and watched in glee as I glided swiftly through the water.

Take a deep breath before taking the plunge. The extra air in your lungs keeps you buoyant for longer.

Kick fast. Fast kicks from the hips appear to propel the body forward and keep you buoyant for longer. The faster you kick, the faster you move through water.

Strengthen both arms. This applies especially when learning front crawl technique. I find my right hand is stronger than my left hand when making a stroke, most likely because I’m right-handed. As such I have to do some exercises to strengthen my left hand so that I can have equally powerful strokes on both hands.

Eat at least a few hours BEFORE going to swim. Eating a lot just swimming makes you feel heavier and gives you more work to do as you try to push your weight through the water.

That’s all for now. To my fellow new swimmers out there, I hope you find some of these tips useful. If you have comments or tips you like to share, feel free to drop a comment below. Enjoy!