Throwback to those college days

I miss ’em.

It has been 5 years since I left college. Six, if you exclude the last year of college which went down chasing my dream career. The first two years is what I count as one of the best times of my life. The freedom of living away from family. The company of friends. The phase of entering manhood. Best times!

One of my hostel mates got married last week. So have a lot of others in the past couple of years. My turn is not far either. (hopefully.) Looking back, time has flown so fast. Not a happy feeling, but that’s how it is. Change is the only constant. You can only hope that what lies ahead brings good memories for you. Chasing work deadlines and loan payoffs, life has taken a backseat somewhere.

In these circumstances, we have two choices. The first is to accept that our original judgements might have been at fault. We question whether it was quite such a good idea to put our faith in a cult leader whose prophecies didn’t even materialize. We pause to reflect whether the Iraq war was quite such a good idea given that Saddam didn’t pose a threat we imagined.

The difficulty with this option is simple: it’s threatening. It requires us to accept that we are not as smart as we like to think. It forces us to acknowledge that we can sometimes be wrong, even on issues on which we have staked a great deal.

So here’s the second option: denial. We reframe the evidence. We filter it, we spin it, or ignore it altogether. That way, we can carry on with the comforting assumption that we were right all along. We are bang on the money! We didn’t get duped! What evidence that we messed up?

Book Review : The Mahabharata Quest – The Alexander Secret

book cover

Ok. So this book is a sequel to the The Mahabharata Secret. But belonging to a different series. ( of three books ? ) And yeah it’s better.

The first few chapters of the book are really captivating. Gradually, though, the reader will be able to relate to the author’s style of writing from his previous book. A little over the top, filmy, very similar to Dan Brown, only less thrilling. The plot jumps are a little jerky. It’s starts resembling a Hollywood action movie of the 2000s era. ( Helicopters , explosions, secret medical facilities ) New, yet a little deja vu. It also sometimes feels like the book had undergone a lot of editing. Some of the events have been fast forwarded, while some of them have been painstakingly described in detail. ( the retrovirus infecting the bacteria process ) But still this one was much better than the previous book. I actually enjoyed it, considering that it was this author’s second novel.

Full marks for the history references. The way Alexander’s journey to India and back has been reimagined and linked to the Mahabharata tales, is really impressive. Since, it involves Indian myths and legends, I personally enjoyed reading it and was able to relate to it much more than say ‘The Lost Symbol’ with American Stone Masonry as it’s plot base.

My Rating : 2.5 out of 5
For : History references and reimagined explanations ( samudramanthan )
Against : Weird editing. No emotional connect. Jerky plots.

Book Review : The Mahabharata Secret

So, I got reading after a while. Well not after a while coz I keep reading here and there. But yeah, a fiction book after a while. This is what I thought.

The book did not stick out as different or gripping. It’s your pretty standard Indiana Jones script. It was very predictable right from White being Murphy ( spoiler alert ) and Radha and Vijay falling in Love. Pretty standard stuff. The only marks it will be getting from my side will be for the history research. That too very little.

The book starts off with the murder of a nuclear scientist, whose nephew, Vijay, comes back from America ( Duh! ) to solve the mystery around it. He also gets emails from his uncle about a secret from the time of Ashoka relating to Mahabharata that needs to be protected. Eventually he solves the clues in his uncle’s emails and with the help of a scholar old guy who is good at old languages ( perfect! ), an athletic friend ( nice! ) and the old guy’s daughter ( lovely! ) he’s able to track the secret down. With terrorists from LeT and AlQaeda on Vijay’s trail, you have the perfect recipe for an adventure novel.

But unfortunately, the story writing falls short of expectations. There are some weird events thrown in here and there which don’t really go with the plot. Out of place humor between Colin and Vijay adds to the “wtf?” effect. The only thing that gripped me was the history part; when the author goes back to ancient times and writes about a secret brotherhood, the lost chapter of Mahabharata and ancient warfare technology.

My rating : 1.5 out of 5
For : A bit of interesting history
Against : Predictable, Hollywood-ish, zero-thrill

integrating phpdotenv ( .env ) files in CodeIgniter 3.0 using hooks

Screen Shot 2016-01-26 at 7.03.31 PM

So we all know one of the tenets of the 12 factor app is to store config in the environment. CodeIgniter allows production and development config and database files to be stored in separate directories. But they all reside inside the git repo and therefore not really safe for storing sensitive values like database connections params or auth codes.

In comes phpdotenv, a really clean way to achieve this. Laravel already implements this and it’s fairly easy to do the same in CodeIgniter as well. Here’s how :

Enable Composer

You can skip this step, if you already have Composer integrated to CI.

Composer makes PHP awesome. Although you can implement the above without composer but this method is way more elegant. The following config flag has to be turned on in your application/config/config.php file:

$config['composer_autoload'] = true;

Next create a composer.json file inside the application folder with the following contents :

After that you need to run composer install inside that directory. Here I am assuming that you have composer installed globally. The other options of course, is to download the composer.phar file (here’s how) and run php composer.phar install. But make sure not to add composer.phar to your version control. It’s not meant to be there.

I would recommend installing composer globally, here’s how you do it.

Add Hook

Now we create a pre_system hook to load phpdotenv. This is the most appropriate hook as it is called right after loading composer and before the controller. Here is what my application/config/hooks.php looks like :

And then enable hooks in application/config/config.php as it does not come enabled by default:
$config['composer_autoload'] = true;

A dirty way to do it would have been calling the same code in index.php file. But changing the core files of a framework is almost always a bad idea and makes upgrading/debugging very difficult.

Create a .env file

The hook code was configured to load the .env file from inside the applications folder. You can change that if you want.

And that’s it, you can keep separate .env on your production servers and on your dev server. The values can be accessed via either getenv() or $_ENV superglobal variables. Here is a sample .env file

Nice. So that does it. Let me know if you have something to say in the comments.


[typerush] the dilemma

To develop as a Product guy or to develop as a Tech guy??!

There are major differences in the approach.

A product guy will focus less on the backend technologies used, accepting a barely working prototype with acceptable design and focussing more on shipping the product out to beta testers so that things that matter can be prioritized. Look and feel will be important. Evolving usability and virality factors will be the prime focus while technology will take a back seat.

A tech guy will look to try out platform candidates before finalizing one on the basis of performance. He will try to incorporate state-of-the-art tools to make the technology stack look impressive. A few learnings on the way will be welcome and will be given dedicated bandwidth. Some delay to launch will be fine.

Is this the reason why product guys and tech guys almost always end up debating? May be.