Monthly Archives: February 2015
Agile and Spiritualism
Ahemm..first my apologies for tying a camel’s tail to a pony’s tail – this post is akin to that. Totally 2 unrelated disciplines being compared 🙂
Agile – as you know is what we use to create kickass products.
Spiritualism is to me the exploration of the Why? – Why are we happy, or sad. Why did we come on earth, why we die?
I practise Agile at work, and explore Spiritualism constantly in all things.
During one of my meditations it hit me – A developer practising Agile, and what Spirituality teaches us are so common.
The Now
Our mind is like a pendulum. It either swings to the past – oh I did this, said this, he spoke rudely to me that day, I missed giving a good repartee .. or swings to the future – oh what will happen if I don’t file my tax returns, what if I confront my colleague tomorrow.. it goes on and on – swinging back and forth. And when the pendulum hits the Now – it is where happiness is – pure unblemished joy. It stays for a fleeting second.. and then goes on to dwell in the past or future – leaving the joy as a memory.
We try to get to the now.. and hang on to it – and it is a lifetime’s effort to get there – and then you get enlightened… perhaps.
When I first heard of a “Story” – in the Agile context – I was told to focus on that story alone while developing. Not to worry about the future stories in the pipeline, or the changes in requirement that might or might not come, or what the nearby developer pair is working upon. Focus on just your story, and do a great job on it. Everything will turn out to be just right.
As a developer, as you focus on just the story ( with a little cross-eye on an open ended design ) the outcome will be 100% Bug free and your story will sail to QA complete effortlessly.. and then you hit God Mode in your team.
The Now is your Story.
Death & Failure
As you get more spiritual you get more comfortable with Death – the big end. Because you know it is not the end, but the beginning of another adventure. You will be tossing out all that you earned, and will have to start all over again. However some of the intelligence you acquired – will come to help in the next adventure. Dejavu, Gut instinct, Karma are all that.
There is a parallel in Agile as well. It taught me to scrap everything I had worked, and start from scratch if there is a need – Agile is comfortable with change and does not crib ( unlike giving a big Change Requirement Document and a bill ) My backyard has many dead bodies – some unfinished abandoned projects and some code, some perfectly working stuff.. but had to be archived and might never get opened again. However, someday it will all come to use. Even if the Story I worked on never gets to production or the project fails to see the light of the day – the learnings are enormous.
Most of the good discipline I picked are from failures – either from my own handiwork, or watching other developers mess up.
Celebrate Death & Failure!
Discipline
One can read as much as you want on Spiritual books, or listen to all the lectures from Spiritual Gurus – but the real joy is in practising it – in a disciplined manner. Only when you sit down to meditate do you experience bliss. For best results – lot many things have to be followed – like food habits, health routine, sincerity of actions, purity in thought.. Break any one of them – you get nothing in the end.
Again for an Agile project to be successful – just reading books and viewing lectures from Agile Thinkers is not sufficient – the team has to be disciplined at every step. Standups, near abstract stories, continuous builds, unit tests, automated tests, periodic showcases…. break any one of them and the project is doomed.
God speed my Agile Developer friends!
Yours Truly
The Agile Guru 🙂
Fun with Raspberry Pi
This post is a 101 Introduction to Raspberry Pi. I will show you how to use a Raspberry Pi to create an Apple TV, Chromecast equivalent, and also read and push your home temperature to a server.
It is the best time to be a geek! There is 3G everywhere and 8MB Bandwidth at home and office. Geeks everywhere carry a super computer in their pocket now!
TBs of storage are now available for a dime. Everything is backed up realtime to the cloud. Even if you lose your device or hard drive crashes, it can all be downloaded back. Maps and GPS Accuracy is spot on. The stuff geeks have now makes James Bond look like a kid showing off in a School Science project.
And we need not deal with Windows or IE anymore. It is either Android or iOS or Ubuntu or OS X.
And then comes this Raspberry Pi to the party – from the open source hardware movement – a cute little computer – the size of a palm – which costs just Rs. 2,500 and can do a hell lot of things.
How to procure a Raspberry Pi
I got mine from Amazon.in – protocentral was the vendor. Just the raspberry pi ( motherboard, 4 USB, HDMI port, ethernet port ) will be 2,500. I also got a kit which had a SD card with the OSes, USB dongle, a breadboard, a few resistors, a capacitor and a power supply (which blew off). Also ordered a DHT11 a temperature and humidity sensor – it is 99Rs. It all came to Rs.5000.
Raspberry Pi or Arduino?
Just like the yin-yangs of vi emacs, android iOS, raspberry pi also has a yang – it is this Arduino. While Raspberry Pi is from UK, Arduino is from Italy. From what I learnt Raspberry Pi is good for beginners – understands Python and is more general purpose and can only talk digital. Arduino needs C ( segmentation fault – thought I had broken up with you) and is more rugged and can talk analog.
Some say start your prototype on Pi, then manufacture on arduino. Might know more about this as I keep digging.
Setting up Pi
Apart from Pi you will need these things
1. A TV with HDMI input
2. A keyboard
3. Mouse
4. 8GB or more SD Cards
5. Ethernet cable, and a router ( alternative is to share wifi on laptop over ethernet port )
6. A laptop/desktop – to format SD Card
Raspbmc
If you have a spare SD Card, format it to Fat. Then download Noobs Lite – Network Install Only – http://www.raspberrypi.org/downloads/, unzip and copy the entire folder contents into the root of the SD Card.
Boot the Pi with the SD Card, and it will show an option with a few OSes. Choose Raspbmc – this is
the XBMC port and turns your Tv into a Smart Tv.
Here you will have to connect your Pi to the router through the ethernet port – so it can download the OS ( around 700MB ). The setup is entirely automatic and does not ask for any configuration. The default user account is pi and password is raspberry.
There are so many Add-ons and settings that are available – like a Youtube Add-on, or a subtitles Add-on for Movies. There is also a free XBMC Remote app on iOS and Android with which you can connect to the Pi to control TV.
Raspbian
This is a regular light weight debian port. Works quite well in the puny pi. You can get another SD Card and install Raspbian ( same steps as raspbmc above ) – so you can swap the 2 sdcards. There is also a multi boot option so you can boot into Raspbmc or Raspbian or more. I did not try this.
Say Hi to GPIO
GPIO – General Purpose Input Output. This is where things get interesting. There are 8 pins which can either send a 5V voltage, or receive a signal.
I wired the DHT 11 – Temperature and Humidity sensor to the Pi and was able to read the settings. Was quite easy.
1. The circuit layout I got here : https://chrisbaume.wordpress.com/2013/02/10/beer-monitoring/. Looks scary – but it is actually a very simple circuit. My skills are not that great, just followed the circuit to the T and it worked at the first try.
2. Get the Adafruit drivers and see if you can read the sensor.
git clone git://github.com/adafruit/Adafruit-Raspberry-Pi-Python-Code.git .
cd Adafruit_DHT_Driver #go to the folder where DHT driver is present
Adafruit_DHT 11 14 #11 is for DHT11 sensor, 14 is the Pin I used
If you get temp and hum in output with numbers, then the circuit is working fine. Sometimes it will not give any reading, and a hex error will show up.
3. Next is to push this to a server. Again it is super easy.
First – create an account at thingspeak.com and get a key.
I created a shell script which will call this python script with the temperature as argument. Then this script will post the readings to thingspeak.
Shell Script :
#!/bin/sh
SCRIPT=”/home/pi/playground/Adafruit_DHT_Driver/Adafruit_DHT 11 14″
TEMPERATURE=`$SCRIPT | grep “Temp” | awk -F ” ” ‘{print $3}’`
echo “$TEMPERATURE”
HITTHING=”/home/pi/playground/mycode/kandivali_temp $TEMPERATURE “
THINGSPEAK=`$HITTHING`
Python Script :
#! /usr/bin/python
import datetime
import logging
import time
import httplib, urllib
import sys
# The feed id and API key that is needed
thingSpeakKey = “getyourownkey”
tempvar=”nil”
for arg in sys.argv:
tempvar = arg
if (tempvar != ‘/home/pi/playground/mycode/kandivali_temp’):
print “Updating ThingSpeak “, time.strftime(“%A, %B %d at %H:%M:%S”)
params = urllib.urlencode({‘field1’: tempvar, ‘key’:thingSpeakKey})
headers = {“Content-type”: “application/x-www-form-urlencoded”, “Accept”: “text/plain”}
conn = httplib.HTTPConnection(“api.thingspeak.com:80”)
conn.request(“POST”, “/update”, params, headers)
response = conn.getresponse()
print “Thingspeak Response:”, response.status, response.reason
if (response.reason != ‘OK’):
print “Problem, “, response.status, response.reason
Here are a few readings I got – https://thingspeak.com/channels/25022
Next step would be to merge the shell script with Python ( still learning ), and run this as a cron job every 3 minutes or so.
The above concept is “Hello World” equivalent of Internet of Things. I can connect to any sensor, and when things go bad – ( lets say the temperature starts spiking ), can send a notification on a phone to someone. The possibilities are infinite.
Some Gotchas
* Pi is configured to UK Locale by default. When you hit Shift 2 ( to get the @ symbol ) you will get a Pound symbol – and so on. It is annoying. Just go to /etc/default/keyboard and set it to US and reboot.
* I connected an external Hard drive, and Pi was not detecting it. The external hard drive needed a power source before Pi could detect it.
* Pi can be connected to a USB port of the laptop. Need not hunt for a free power slot. Figured this out after the usb power plug blew up.
* Looking at TV and typing tires the eyes. Instead set a Static DHCP IP and then ssh to pi using Putty if you are on windows ( ssh pi@192.168.1.111, password raspberry ) and can use your laptop’s keyboard.
Happy Baking!
The Man Purse
Way back in 2000, I first heard about man purse in a Seinfeld episode and had a good laugh. Little more than a decade later, I find myself using one. Here is me defending in the court on why I use a man purse.
Your Honour, Men needed just a few essentials those days. A purse/wallet + keys, a mobile phone + a hand kerchief and a comb on the back pocket. Real men don’t need to carry a pocket note book. They write stuff and lose it behind credit card acknowledgements.
It gives a sense of peace – which is hard to describe. Your honour you have to experience this bliss. When you know your phone and iPad are fully charged and you can wait forever in a mall while the missus shops, or when waiting to pick up someone from the airport – you can listen to music without worry of draining the battery, or read a book, or write a blog post – like this one.
The defence rests its case. Hope the court will forgive me for laughing at the Man purse back in 2000.
And to my Man friends, get a Man Purse – why should women have all the fun!