Tuesday, March 17, 2015

How to WIN CASH in the Maina and Kingangi's Cash Cow Game (Count the Cash)

If you are the lucky caller, wait till Maina tells you which of the 3 possible options can be ruled out, and then change your answer to whatever other option remains, I repeat, DO NOT STICK TO YOUR ORIGINAL ANSWER.

If you want to know why, continue reading below...

Firstly, for those who don't know what am talking about, Maina's Cash Cow is a challenge that runs on a weekdays radio progamme popularly know as Maina and King'ang'i in the morning, on Classic FM, a popular radio station in major Kenyan towns and their environs, especially Nairobi.

Here is how it basically runs:

  • Maina, the presenter, invites radio listeners to call the station and attempt their luck in counting his cash; only one lucky caller gets his call picked up, he will listene the sound of a Note Counting Machine and all he has to do is guesstimate the correct number of notes.
  • After the lucky caller guesses the number of notes, say 51, Maina goes ahead and gives the callewr two more possibilities. e.g 'What if I told you it's either 51, 52 or 53?', (should you still stick to your original answer? at this point it does not matter, change to whatever of the 3 you want, it was a guess anyway)
  • After the caller settles on one of the three numbers, Maina discloses that one of them is not correct. e.g The user settled on 51, and Maina goes like, 'What if I told you it's either 51 or 53?' (i.e rules out 52).
Apparently,  the correct probability solution will predict that SWITCHING from your original answer to whatever remaining option (i.e from 51 to 53 in this example) doubles your chances, from 33% to 67%. Well, it did not make sense to me too at first, I initially worked out that it's just two options (51, 53) and thus the probabilities should be 50% vs 50%. I will not delve into the probability theories that explain this, instead, I will direct you to a simplified python snippet that you can study and also execute to see the results for yourself. 

I implemented a simple computer algorithm to simulate the scenario and demonstrate why it is always NOT advisable to stick to your original answer as the caller tackling Maina's Cash Cow challenge. The simulation simply runs 10,000 challenges for each of two guys, one who always sticks to the original answer, and the other always switches. The simulation clearly demonstrated those who stick to their original answer only win ~ 33% of the time while those who switch their answers won ~ 67% of the time. The  code is here.


Some of the assumptions made are that:
- Maina knows the correct number of notes even before the caller begins guessing.
- Maina is going to be honest
- Of course it does not have to be real notes, it could be computer generated sound based on a predetermined number of notes or a real Note Counter, the math still stands.


Note: This is a classic probability puzzle known as the Monty Hall Problem.

Saturday, November 15, 2014

Running Background Jobs in Parallel on Linux

Background jobs are very easy to execute and monitor yet very powerful, allowing you to stay focused on what needs your attention the most while still fully utilizing your Computer's resources.

Let me give an example with conversion of MP4 files to MP3 files, a simple task I have to do every once in a while since my car music player only accepts mp3 on USB (of course, I have used the feature to do more advanced stuff).

The program I use is avconv, it's straight forward to install if you don't already have it. ffmpeg also works the same and is available on Windows and Mac. These are free software for handling multimedia data.

The following commands will only execute on bash though, the default shell on Ubuntu. which is also available on other Linux flavours, and probably available on the rest of the platforms.

I am using 3 bash concepts here i.e looping, substitution and of course background jobs.

First cd into the directory containing the mp4 files.

for f in *.mp4; do avconv -i $f ${f%.mp4}.mp3 & done

The above command will start the conversion of all mp4 files in the directory; but how? let's break it down, in my next article.

To monitor the status of your background jobs, just run

jobs

The output, something like this
 
[1]+  Stopped                 avconv -i $f ${f%.mp4}.mp3
[2]   Running                 avconv -i $f ${f%.mp4}.mp3 &
[3]   Running                 avconv -i $f ${f%.mp4}.mp3 &
[4]   Running                 avconv -i $f ${f%.mp4}.mp3 &
[5]   Running                 avconv -i $f ${f%.mp4}.mp3 &
[6]   Running                 avconv -i $f ${f%.mp4}.mp3 &
[7]   Running                 avconv -i $f ${f%.mp4}.mp3 &
[8]   Running                 avconv -i $f ${f%.mp4}.mp3 &
[9]   Running                 avconv -i $f ${f%.mp4}.mp3 &
[10]-  Running                 avconv -i $f ${f%.mp4}.mp3 &




Thursday, October 23, 2014

My Name is going to Mars

I submitted my name to be included on a NASA microchip to destinations beyond low-Earth orbit, including Mars. The micro-chip will take off aboard Orion, NASA's nextgen deepspace spacecraft,  on Dec. 4 2014 on a 4.5 hour flight-test, a two-orbit mission around Earth to test Orion’s systems. At the end of this short mission, my name will have to survive cringing speeds approaching 20,000 mph and temperatures near 4,000 degrees Fahrenheit, before splashing down in the Pacific Ocean.

If all goes as planned, the  microchip will be carried aboard in future NASA exploration flights and missions to Mars in an arrangement that could see me accrue space miles as a member of a global-space-faring society, exciting stuff!

Below is my official 'boarding pass'


Wednesday, October 8, 2014

JuiceSSH: My favorite Android App

This app has helped me incredibly. Well, what does it do? It allows you to ssh into a server and do everything you can accomplish on a regular terminal,  and this is from your mobile device.
It comes with an awesome keyboard feature set such as pop up keys for ctrl, tab e.t.c As a bonus, it allows you to connect to the mobile device's localhost and violate it in so many ways.
Personally I use an android version of it. Get to know it and it could turn out to be just what you needed to provide 99.9 uptime commitment on your applications.

Sunday, September 28, 2014

Thin SIM Technology Is Welcome

Am ready to try it out. Anything that cuts market entry costs opening up the industry to more competitors is good in my books. Instead of Safaricom trying to block it, they should just embrace it and use it to avail its MPesa products to 99.9% of all Kenyan mobile phone users.

Good call by CCK to let Equity try the technology for a year.

Looking forward to accessing Equity services from my SIM toolkit. Top on my wishlist is better payment APIs to help local devs create more powerful applications, anything to keep the fire in the Nairobi tech scene burning.