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

Update:

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/ipython_config.py; create it with ipython profile create if you don’t have it) with:

c.TerminalInteractiveShell.editing_mode = ‘vi’

Source:

python – How do I use vi keys in ipython under *nix? – Stack Overflow. http://stackoverflow.com/questions/10394302/how-do-i-use-vi-keys-in-ipython-under-nix

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\
 /usr/local/include/freetype

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

Troubleshooting

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
dir(_imaging)

See if jpeg_decoder is among the properties

First Day Swimming

It was a nice cool evening and I was ready to swim. Armed with my swimming shorts, one pound coin for using the lockers and membership card, I headed to the a nearby pools and fitness centre. At the receptionist desk a friendly staff showed me the way to the changing room.

Having changed into my swimming shorts and stored away my clothing, I was set to hit to the pool. So I entered the main swimming pool area and feasted my eyes on a few jolly swimmers having the time of their lives in the pool. Behold there was no sign of training going on. So, mildly confused, I asked a lady who appeared to be a life guard where swimming lessons were taking place. She aptly directed me to a room to the left.

On entering the swimming lessons room I discovered another pool with a bunch of swimmers and a nice lady who gave instructions to some apparently neophyte swimmers. “Ah, finally!” I thought. I’m at the right place. The instructor asked me to wait, that our lessons will start shortly. Taking a seat next to another first-time swimmer I chatted away as we both waited patiently for our lessons to begin.

Finally it was our turn to swim. The instructor checked off our names on her register, a POS-like device. The first thing we did was to sit at the edge of the pool with our legs in the water. There were three learners in my group. Next, we stood in the water and then walked up and down the breath of the pool both forward and backwards. I remember feeling quite wobbly as I took my first steps. I had a rather unsteady gait somewhat akin to a child taking his first steps. But I overcame that feeling pretty quickly and within minutes was walking confidently back and forth.

After a while it was time to float. At the instructor’s command we stood by the edge of the pool, stretched our hands toward the wall, turned face down into the water and let our legs float above the pool floor, float for a few seconds and then stand. I was eagerly expecting to float like a beach ball, but something bewildering happened. I sank like a rock!

Something wasn’t right. I decided to look at my fellow learners. To my amazement they floated. One of them, a fine plumpy girl, floated like she had been swimming for years. The other girl, a skinny one, also floated. I then thought “maybe the sinking was a one-off”. So I tried floating again. And again I sank quick. Several sinking experiences later I asked my instructor what was going on. How come I sank while others floated. It was at this point I learnt something crucial about swimming.

Fat floats and muscle sinks. People who have large amounts of fat in their body tend to float on water because fat is lighter than water. On the other hand, people who are skinny or very muscular tend to sink when stationary because muscle is heavier than water. I fall in the second category, so I have to do extra work e.g. kick to stay afloat.

I learnt also that in order to float in water it’s important to relax. If you are too tense you will sink. Don’t fight against the water. Rather you should feel your way through it.

Next we practised push and glide. In doing this we dived into the water, the just glided through until we were almost out of breath at which point we stood, took a breath and did it again.

After that, we learnt to kick in the water. In doing this we stood by the edge of the pool, held our hands straight perpendicular to the pool wall, floated our legs and kicked. The idea was to maintain a position near the surface of the water. Again I got optimistic, hoping this was my time to float. Lo and behold I tried this and sank! Again, my body composition was to blame. In consolation my instructor told me that the more I practised the better I will get and that I needed to kick more vigorously.

I practised push, glide and kick several more times until the end of the lesson at which point the instructor recommended that I buy swimming goggles. I thought she was just giving a friendly admonition. It wasn’t until I got home that I understood the gravity of not wearing goggles in the first place. My eyes hurt like crazy. Apparently the pool had some chemical (likely Chlorine) and my eyes were sensitive to it. So, big advice to anyone attempting to learn swimming in a pool. Buy yourself a good pair of goggles! You won’t regret it.

By and large, I’ve started learning the basics of swimming and will keep you posted. Enjoy.

An approach to Problem Solving – Solving Simple Problems First

I have fond memories of the good old days solving numerous problems in examinations. Often times I ran into really facile problems whose solutions were comparable to eating meat pie. However, there were other instances where things just weren’t that simple. Yep, you got it. I’m talking about complex problems. In this article I discuss how I tackle problems of varying difficulty in limited time. This technique I will cover is actually quite simple and very powerful and it is as follows: solve simple problems first. I will discuss a few reasons why you should take this principle seriously.

First, by solving simple problems first, you increase your productivity and sense of accomplishment. Imagine trying to solve ten problems each carrying equal marks. Let’s assume the first two are deviously difficult for whatever reason (maybe lack of preparation) while the next five are very simple. Should you try to solve these first two completely before moving on to anything else, you may very well realize that by the time you are done with those questions time is up. And guess what? You only score a maximum of 20%. On the other hand, if you skim through the first two questions, find quickly that these are beasts and just move on to the third without solving the first two, then you will found to your delight five easy questions to solve and a maximum of 50% if that’s all you are able to solve.

Apart from the obvious reason that you stand a chance of getting better output by solving simple problems first, there’s an even more interesting and perhaps counter-intuitive reason one should leave the harder problems for later and it is as follows: Leaving a challenging problem for later actually increases the likelihood of you solving the problem. When faced with a really challenging problem, it has been shown scientifically that by taking one’s mind off that problem and doing some other things, one gives the brain time to subconsciously find a solution to the problem. This principle is called Incubation. Now there is no guarantee that this will work 100% but it definitely beats spending arbitrary amounts of time trying to solve the problem in one go without even a guarantee one will be arrive at the right solution.

Thus we see that when confronted with several problems to solve in time-constrained situations, it pays to tackle the easier ones first as this increases our potential output and also gives you a better chance of solving even the initially difficult problems. While I first learnt this principle while taking examinations in school, I have found it quite invaluable in everyday life.

Cut the Chase to Success by Putting Effort

We have always heard that you need to work hard to become successful. This is true for a variety of reasons. Well, first, when whoever it is that is responsible for bestowing success upon you observes your hard-working attitude in comparison that that of your peers, then all things being equal he or she is likely to want to entrust success and its accompanying responsibility onto you seeing that you are suited for it. But that’s not why I am writing this essay. There is another even more pertinent, and perhaps under-emphasized reason why putting effort cuts the chase to success. And it is this: Putting effort helps you tell very quickly when a thing is not worth doing.

Before going further let us put a solid definition behind what it means to be successful in the context of this essay. I will define being successful as the state of doing or having things that bring you lasting happiness and make you feel like you are fulfilling your life’s purpose.

Now to the point of telling when a thing is worth doing. If you put in mediocre effort into an endeavour you greatly desire, there is a chance you will succeed, however minuscule that chance may be. If you succeed, then good luck! Maybe that activity is actually easier than your envisaged or you are just plain lucky. But chances are that you will not succeed. Now if in the more likely situation you do not succeed in that endeavour, then there are two possible solutions: 1. You need to put in more effort in that same activity. 2. You need to do another activity altogether.

As you can see, you have reached a moment of indecision. You can’t say with hundred  percent certainty that the activity you are partaking in is indeed worth your while at all. So you may as well repeat the same endeavour, but with greater and more appropriate effort. Now again after repeating the endeavour with greater rigour and preparation, there is still a chance of success and failure. If the activity was worth engaging in in the first place, then your odds of succeeding will be increased. On the other hand, if the activity was a terrible idea in the first place, then you will find out only after a second attempt. Note that it may take several attempts to weed out all the possibilities of unfavourable results stemming from lack of effort, depending on how much care and effort you exert when carrying out the activity.

If, on the other hand, you put in your best during the first try, then there will be much less uncertainty why things turn out the way they do in the event that the results are unfavourable. At least it won’t be for mediocre effort. As a result you will quickly reach the point where you ask yourself if a thing is worth doing at all or not. Upon great thought on this question, there is a chance you may discover that the activity wasn’t even worth doing in the first place and you will be able to, with a clear conscience, let go of such activity and take on more lucrative ventures.

Here’s an example to put some meat on the bone of the issue. A guy named Bob wants to spend time with a girl. He gets some food cooked, makes little effort to clean up the house, makes a quick and dirty attempt at entertainment, doesn’t bother to take a shower due to waking up late, then invites her over. The girl comes over, spends a little time and rushes off, leaving Bob in utter bewilderment as to why she didn’t hang out with him as he expected. Well, on thorough thought, he may come to ask himself many questions: Is she the right girl? Could I have worked a little more on the food? Could I have cleaned the house a little more? Could I have done a little more in the way of entertainment to keep her interested? Should I have had a good shower and dressed better before seeing her (obviously)?

As you can see, Bob has many things to consider. On the other hand, let’s assume another guy Sam wants to hang out with a girl. Before she comes he gets a lot of assorted food made, does a thorough job in cleaning the house, makes conscientious effort to provide good entertainment, has a bath and dresses in clean clothes. When the girl arrives assume Sam makes solid effort to keep her entertained and give her a good time. If this same girl rushes off without having a genuine emergency, then Sammy will find it much easier to reach the point where he asks if the girl is even worth his time or not. Why? Because he won’t have to ask if the problem was due to a dirty environment, poor entertainment, or poor effort in the nutritional department. He will be able to put his relation with such girl into perspective quickly in light of the question and reach an appropriate decision which will augur well with his conscience. This is the power of putting good effort into whatever we do each and every time.

In conclusion, it really pays to put in one’s possible best into any activity worth doing at all because it makes it easier for us to earn the trust of our fellow man, but also because it helps us reach major decisions quicker in our lives, act quicker, and become successful quicker.

 

A Review of New Words With Friends

There’s this really awesome educational game I came across recently while surfing popular games on Google Play. It’s called New Words With Friends. Having given the Android version of this game a thorough test, I’ll share my review. Published by the famous game studio, Zynga, New Words With Friends is an excellent and engaging educational game to play with both friends and new folks. Essentially, it’s like playing Scrabble on a phone and it works cross-platform as an Android app, iOS app and even a Facebook app. Without further ado I’ll discuss the high points.

First, the game has really cool graphics. The game has a cool trendy look easy on the eyes and sure to please. It’s got a Facebook-like theme and a good combination of warm and cool colours. There really isn’t much to fault in terms of its looks. The game icon even has a winter feel to it.

Second, New Words With Friends is very social. It’s possible to invite Facebook friends to play. You can even nudge those unresponsive friends to get them in faster. You get ranked alongside friends you’ve played with by total and average scores, ramping up that competitive spirit as you strive towards first place! New Words With Friends also has a Community Match feature that allows you to find avid players nearby just waiting to play with you or to choose who you will like to play with. There’s even a Smart Match feature that immediately finds a game for you to play. The game also has a handy chat tool to help you converse with your buddies or new found friends as you play.

Next is Statistics. Being a lover of all things mathematical and scientific I naturally enjoy a healthy dose of Statistics. New Words With Friends keeps track of your game statistics daily showing valuable metrics of how your verbal aptitude appreciates over time. Some statistics tracked include highest scoring words, longest words used, highest score in any game, average game score, score of words over time, etc.

Fourth is the Educational value. While playing this game, you have access to an in-built dictionary apparently based on the famous Dictionary.com. There is also a Word of the Day feature showing you new words each day to beef up your vocabulary.

Alright alright. So it’s obvious I really like this game. That doesn’t mean there aren’t any criticisms. First of all is the adverts. You have to watch an ad for at least a few seconds after every game move. I understand the makers of the game have to make some dough so it’s not so bad though. There’s an option in settings to buy the game.

Second, the dictionary is quite laggy. When searching for words in quick succession the dictionary doesn’t always keep up. For example you may open the dictionary feature and search for a word only to discover after a moment the meaning of a previous word show up. I feel the dictionary should be made a little more responsive. The app could cancel pending searches for example when a user submits a new query.

Third, there are some words you can play but can’t find meanings for using the dictionary. I suppose this is because that dictionary does not have the words. Perhaps Zynga could integrate other dictionaries to find meanings of words outside the default one.

By and large, New Words With Friends is a fantastic game with great social tools and educational value. I highly recommend this game to anyone with a decent smart phone looking for a game to pass time.

A Visit to Red Dog Saloon

Just earlier this evening I had the privilege of visiting an excellent  restaurant in the heart of Hoxton Square called Red Dog Saloon. I remember having a welcoming feeling as my colleagues and I approached the building with its bright lights. The interior was very cosy. Having made a reservation before arriving, we were met by a dashing young lady just by the entrance who took our details and aptly directed us to our table.

The place was packed. It was a average sized restaurant and just about every table was occupied. Voices of light chat could be heard from all directions as people talked very freely over a variety of dishes and drinks.

At the table, menus were already lying in wait alongside cutlery. So, naturally, we perused the menus as we settled down. Having looked at several menus in several restaurants in my time, I must say I was impressed with the wide variety Red Dog offered. They even had some very curiously named dishes like ‘The Punisher,’ ‘Double Trouble’ and ‘The Devastator’.  How cool is that? ‘Waiter, can I please have some Double Trouble?’

We were promptly attended by a waiter who took our orders for drinks, gave us ample time to peruse the menu and eventually took our orders for food. He was patient and polite in explaining what some of the dishes were when asked.

Our milkshakes were served in rather interesting metallic cups which looked like they had been specially kept in some freezer along with the shakes themselves. After considerable waiting, our orders eventually arrived, consisting of several plates of briskets and ribs among other things. Boy, Red Dog sure serves some delicious ribs! Needless to say, I haven’t tasted meat so good in ages. I got a helping of some mashed potatoes, again which tasted decent. These were very reminiscent of having a proper meal way back in Texas.

The only small criticism I and a colleague of mine had was that our orders weren’t delivered completely. However, the waiter rectified this and brought the remaining items after some time.

While enjoying ourselves, we took an ample number of pictures of the group as is the tradition when we go on outings. You know, something for the album.

After a very hearty meal, drinks and cool conversation we were ready to go. A waiter promptly took away our used dishes and happily offered to package some of our leftovers in case we wanted to take it away. Now, how cool is that? I, having a delicious brisket in front of me but very sated from the ribs eaten earlier, accepted the offer without hesitation.

By and large, Red Dog is an awesome restaurant to visit alone or with friends and family. The atmosphere is relaxing and the food is delicious. I can definitely see myself going there again in the near future.

 

 

True Friends

True friendship is something we all aspire to have in our lives. You can’t place a price on friendship as the intervention of a friend can very well be the difference between success and failure or even between life and death. Of course the individual is very important. Nevertheless, there is only so much you can do in life without support from your friends, be it family, spouse, children or other friends you pick up on the course of daily life. So, being someone who has travelled a bit and had the good fortune of having some true friends, I will share my thoughts on what I consider true friendship. Here are ten questions I recommend asking yourself when wondering if a person is your true friend. This is by no means exhaustive and is subjective, but may serve as a decent guide.

1. How often does the person ask after you? If he or she checks up on you sufficiently frequently and consistently whether in person or via various social media, there is a good chance he or she is a friend. Otherwise, think twice. Of course, this is assuming you also make an effort to check up on the person.

2. How often does he or she keep his or her promises to you? Does he or she make conscientious effort to keep promises or does he or she frequently keep you hanging. A person who keeps promises likely values you as a person and is more likely to be your friend than someone who doesn’t.

3. How much time is he or she willing to take out to be with you? Try calling this person to hang out for drinks for example. Is he or she someone who usually enthusiastic about being around you for example, or does he or she seem adept at cooking up the most curious excuses for not attending. True friends take out time from their busy schedules to hang out with each other.

4. How willing is he or she to help you when you are in need? An old saying goes: A friend in need is a friend indeed. There are many friends who rejoice with you when things are rosy. They will praise you like no other when they have something to gain from you. No sooner do you get into trouble than they disappear rather inexplicably into thin air. So, is he or she someone you can call at twelve midnight should you have problems and expect to get moving? If so, you need no more proof that you have a true friend in him or her. Otherwise, think twice.

5. Does he or she caution you when you mess up? A true friend is not afraid to caution you or even tell you off when you go down a slippery slope. He or she is likely to be an adviser and confidant, quick to point out areas where they feel you are better off. So, here’s a simple experiment to try. Do something silly knowingly in the presence of this person. How likely is he or she to call your attention to it? If he or she frequently remains as silent as a mouse, then think twice.

6. Does he or she celebrate with you on events you find significant or on your achivements? A true friend is likely to remember your birthday for example. When you make that breakthrough in whatever field of endeavour you dabble into, who pops champagne with you and makes you feel really good about your achivement? You got it, true friends.

7. Is he or she keen to share insights with you that could better your life in some way? Someone who easily and freely gives you tips on things you can do to accomplish your goals even without asking is very likely your friend. Of course, not every insight a friend gives you will make you a millionaire or even be a good tip in the first place. However, you will usually know if he or she has good intent.

8. Does this person know where you live and has he or she cared to visit? Here is an experiment. Invite this person to your place for lunch on a weekend. What is he or she likely to say? The home is a very important place. It is a place where most people are most at ease in. We all know the cliché: There is no place like home. A person who is enthusiastic about visiting your home is likely a friend. He if or she on the other hand frequently cooks up excuses to not come, think twice.

9. Is he or she honest? Does he or she tell you things they way they are or does he or she try to sugar-coat things? A true friend is likely to let you know in no uncertain terms when he or she does not like something and otherwise. Watch out for consistent honesty in anyone you venture to call your true friend. If he or she lies to you with impunity, watch out!

10. How often does he or she invite you to celebrate his or her successes? When you succeed in that grand endeavour, first you pat yourself on the back for a job well done, right? Then you inform your family to rejoice with you if they are your friends, right? And after that you consider informing your true friends to rejoice with you, don’t you? So, when this person succeeds in his or her goals, if he or she invites you to celebrate, then he or she is very likely your friend, otherwise, you may want to reconsider.

That’s a wrap. If you have that special someone who satisfies several or all of the criteria above, then you very likely have a true friend. Cherish him or her every day and most importantly, be a true friend to others.