Sunday, December 29, 2013

Django on Mac OS X (Django 1.5.5., Postgres)

My first tryst with Web Programming was in 1999. When I was still in college, and was an intern in Philips Software Center, Bangalore.

One of the teams there wanted an online testing software and my internship was no way related to programming. (Was doing some CMM Gap Analysis stuff!) - I decided to do this as a side project.

I had NO idea what it would involve. I then came across JWSDK Java Web Service Development Kit 1.0. That was the day it was launched. I just downloaded that, Java and got cracking. I learnt about GET/POST methods, and was my first tryst with Servlets. Even learnt the concept of cookies from first principles ;-) - It was a success, in the sense that people could use it for a limited time and it worked!

From the heady world of internet, I plunged into the absolute basics for many years - Embedded Realtime Systems Programming in the domain of Wireless / Networks became my area of focus. However, I never lost touch of my first love - Web App development and AI.

I thought I should restart by learning some of the current web frameworks. My options were clear and out in open - Ruby on Rails vs Django. I decided to take the plunge to Rails a few weeks ago. However, I had so many issues - Don't know Ruby, Rails, Web Frameworks etc. When you try a new problem, it is absolutely imperative to reduce the number of unknowns. After a few weeks, I decided to go Django. I am relatively good at Python. Now, I had to learn only the web framework (no need to learn Ruby or the DSL (rails))

---

I decided to get started on my Mac (MBP RD 2012) with OS X Mavericks. Little did I know that I would take a day to get this started!

The best way to get started with Django is https://docs.djangoproject.com/en/1.5/intro/tutorial01/

I had Python 2.7.5 installed (2.7.6 is recommended for Mac OS X Mavericks)

Installing Django was a piece of cake with
pip install django==1.5.5

I had to do that because the tutorial assumes 1.5.5. and by not specifying the version, I got 1.6 (the latest stable release). And, I know that these are two MAJOR releases (1.5 vs 1.6)

I also had the hello world project executed. Now came the tough part. I had decided to use Postgres as my backend (know someone who is really good, and wanted to do a quick prototype of a concept with him)

I downloaded and installed the Graphical installer for Mac OS X (9.3.2) - http://www.postgresql.org/download/macosx/

Then I had to install psycopg2 (python binding for postgres) - All hell broke loose

1. sudo pip install failed 
 Because the compiler couldn't find <stdio.h>

Solution: Download and install Command Line Tools for Mac OS X Mavericks
https://developer.apple.com/downloads/index.action
Command Line Tools (OS X Mavericks) for XCode - Late October

2. After this, psycopg2 got going with a LONG loop (nearly endless) - It gave me some error involving XCode. I thought XCode was not required to get this up and going. I had to download the 2.04 GB Xcode 5.02 (Damn!) - Thankfully, I had my Airtel 4G dongle (connected to a HSPA+ network in Chennai) and hence got this up in an hour and a half. Should be faster in an LTE connection in Bangalore.

And then I could compile and build psycopg2

3. My happiness was shortlived. I opened a Python prompt and entered import psycopg2

from psycopg2._psycopg import BINARY, NUMBER, STRING, DATETIME, ROWID ImportError: dlopen(/Users/sviyer/dev/.virtualenvs/dbtest/lib/python2.7/site-packages/psycopg2/_psycopg.so, 2): Library not loaded: libssl.1.0.0 dylib Referenced from: /Users/sviyer/dev/.virtualenvs/dbtest/lib/python2.7/site-packages/psycopg2/_psycopg.so Reason: image not found 


There was a workaround - The issue was python runtime was not able to locate the libssl in standard location - The solution:

export DYLD_LIBRARY_PATH=/usr/local/Cellar/openssl/1.0.1c/lib


Now when I import psycopg2, it worked! 

But, that's not end of the story

4. I tried setting this environment variable in /etc/launchd.conf - Unfortunately, this did not work
Srirams-MacBook-Pro:etc sriram$ more /etc/launchd.conf 
DYLD_LIBRARY_PATH=/Library/PostgreSQL/9.3/lib


5. Finally, thank stackoverflow :), I created symlinks for the same in /usr/lib (http://stackoverflow.com/questions/16407995/psycopg2-image-not-found)
$ sudo ln -s /Library/PostgreSQL/9.2/lib/libssl.1.0.0.dylib /usr/lib
$ sudo ln -s /Library/PostgreSQL/9.2/lib/libcrypto.1.0.0.dylib /usr/lib

I did write that we shouldn't use stackoverflow as primary debug tool (http://yourstory.com/2013/12/death-computer-science/) - However, In my defence, I did use it after my digging around! (Though shalt not smite me)

In case you are one of the newbies like me trying to setup Django on your Mac OS  X, hope this helps.

In summary:

1. Install Command Line Tools for X Code
2. Install X Code
3. Install Django 
4. Install Postgres
4. Install psycopg2

Get going! 

Will share my adventures (if it would be useful to a larger community)

Have fun! 

Wednesday, September 18, 2013

Be your startup’s toughest critic!



 A lot of people I know feel that the potential Investors were very tough on them or on their startups. I would say that YOU, as the entrepreneur should be the toughest critic of your startup.

There is a difference between optimism and fantasy – While the former is grounded in reality, the latter is based on utopian beliefs.

In the battle of gut and the brain, I strongly believe that that gut should win. However, it is very important to have the facts and numbers right before stepping into a business.

The strange thing about startup is that it is prone to failure even if all the ‘t’s are crossed and all the ‘i’s are dotted. So, to venture into a startup without proper planning is definitely not the wisest thing to do.

There are literally infinite resources on creating a pitch for a VC. The pitches range from ‘Elevator’ ones where you do a pitch in a couple of minutes, to detailed partner meetings where you have an hour or more to share details of your business to the investors.

The problem comes when the entrepreneur has not thought through the ‘business’ aspect of the company (which is the MOST important part of the company) instead focus on the technical inanities. The technology is of course important. But, it means nothing if it doesn’t create traction and in the end, create value for the entrepreneur and investors. No VC can do philanthropy from the money collected from their Limited Partners! They can only donate the money that they earn AFTER the return of the investment

Can you don the role of the toughest critic of your company? Ask yourself the following questions:

1.     What problem does my product / service solve? Will YOU pay for a similar service if it is available?
2.     How big is the market? Is your solution applicable to everyone in the planet? Or is it limited to a market that is very limited?
3.     Business Model – How do you plan to generate revenue? Will you ask your customers to pay once, or do you ask your customers to subscribe?
4.     Traction – How often does your user come back to use the product? Does the novelty wear off after initial excitement?
5.     Entry Barrier – What does it take for a BIG player to make an entry and take away the market? (This is becoming less important than it used to be)
6.     Team – Do you have a team that can work in sync with the vision to pull it off?
7.     Do you have a co-founder? (Most important question to have a YES to)
8.     Do you know how your product will be positioned or priced? What are the metrics that you need to track to know if you are progressing?

There are more questions, and honestly, as an entrepreneur you must know more about your domain than anyone else. Dispassionately, ask all the tough questions.

It is very important to write down all the assumptions and QUESTION ALL YOUR ASSUMPTIONS periodically! Has the market drivers changed? Is there an impact of macro-economic policies / indicators? For e.g., in my startup, we suffered a lot since we had to rely on some of the technology rollouts by Network Operators, which were not in our control

The study of Vedanta, the most advanced section of Indian / Hindu Philosophy requires analysis of a concept from multiple angles without losing perspective when you move across different views. So, the students of Vedanta chant a particular hymn (called Medha Suktam) to increase their analytical skills for this kind of application (analyzing a problem from multiple perspectives)

I am not asking you to drop the famed entrepreneur’s optimism! I am just asking you to periodically wear a hat of a critic and do a jolly good job at it, before you walk into the office of a VC / Entrepreneur!  Be your startup’s TOUGHEST critic!

PS- A slightly modified version of this article was published in YourStory.inhttp://yourstory.in/2013/09/founder-startup-critic-yourself/

Friday, September 6, 2013

Smartphones = Starbucks Coffee? (And call your Mobile, a SCAM)




“The whole purpose of places like Starbucks is for people with no decision-making ability whatsoever to make six decisions just to buy one cup of coffee. Short, tall, light, dark, caf, decaf, low-fat, non-fat, etc. So people who don't know what the hell they're doing or who on earth they are can, for only $2.95, get not just a cup of coffee but an absolutely defining sense of self: Tall. Decaf. Cappuccino” – You’ve Got Mail (1998)




I find the name ‘phone’ in most devices we call as Smartphones as amusing. I am sure there is a study out there, which says how less we use the device as a ‘phone’ i.e. to make and receive calls.

I am sure, a smartphone now is a mobile access to various services like Facebook, Twitter, Games, Navigation, Music and sometimes a calculator, alarm etc. Almost two years ago I wrote about this: “Make Apps, not Hardware!” http://yourstory.in/2011/09/make-apps-not-hardware/


I think the time has come to stop calling them as ‘Smart Phones’, ’Super Phones’ etc. They are ‘Service and Content Access Mobile devices’ (SCAM?) – I am sure this is not a catchy name, but this is what the mobile phones of the day are. Because, in their current form, they are gateways to:
  1.  Access Services: Twitter, Facebook, Enterprise Apps
  2.  Access Content: Music, Audio, Video, Photos
  3. Create and Share Content


Phone feature is almost just a ‘good to have’, and a side effect of the devices needing connectivity to offer the above services. (How else do we explain big screens that are bigger than the face of the user?) – But, still the name SCAM picks up, I’ll continue calling it as ‘Phone’ – But, when the word picks up, remember – you heard it here first!

Coming to the quote in the beginning of the article, I just realized, that each phone is unique. A person chooses a phone and then adds different apps (services / content), customizations to it to make it their own. Each phone has its own distinct personality. This is becoming so important that no longer does hardware / brand etc play a major role in deciding a phone. It all comes down to ‘Can I do <something> with this phone?’ which always translates to ‘Does it have an App that can do <something>?’

Needless to say each platform owner – iOS, Android, Windows Phone etc. compete with each other in terms of building better app stores and supporting a developer ecosystem that motivates them to build better apps. Few days ago, Nokia spokesperson said that they feel that there is a gap in Apps and they should work on filling it - http://gigaom.com/2013/07/29/even-nokia-thinks-theres-a-windows-phone-app-gap-of-sorts/


Just like a person has his own personality (or a multiple personality disorder) while ordering coffee in Starbucks, a Smartphone is a reflection of the person who uses it.  A phone reveals it all – Games lover, photo addict, eternal dweller of Facebook / Twitter etc.

A smartphone basically comes out of its factory as a plain vanilla(?) computing and communications device, that gets it color and personality form the user.

So, go ahead, dress up your SCAM! (And, don’t call it a phone!)

Tuesday, September 3, 2013

Dynamics of Microsoft's Acquisition of Nokia



The Deal
The BIG news this morning was that Microsoft is planning to acquire devices division and IP portfolio of Nokia for 7.2 Billion USD. This is going to have a big impact in the world of Mobile devices and communications. 

Microsoft plans to buy the devices and services division of Nokia for 5 Billion USD and the IP / Patent portfolio for 2.2 Billion USD. However, Nokia's Network / Infrastructure division (NSN) is not part of the deal. 

Shift to Devices and Services
Apple renamed itself from 'Apple Computers' as it continues to focus on Devices and Services. Steve Ballmer in his 2012 Shareholder Report  focusses on the shift from being a software company to growing into a 'Devices and Services' company. This acquisition (bid) for Nokia is the step in this direction.

Challenges
However, this transformation is going to be difficult for Microsoft. The challenge lies in the fact that Microsoft, in its current avatar, is a supplier to many of the device vendors. Apple is the most vertically integrated OEM – They make their hardware, software and drive their sales and distribution. In case of Google and Microsoft, their main focus WAS software. However, with Google acquiring Motorola, Google acquired a stake in the hardware market. (Though some claim that the acquisition was for the patents to have a strong case against Apple). 

Now, with Microsoft acquisition of Nokia, most phone / tablet OEMs should be worried. Needless to say, Android dominates in the number of devices, followed by iOS. Android and iOS accounted for about 90% of smart devices shipped in the first quarter of 2013 - Windows Phone is the third, followed by Blackberry. 

Microsoft in its deck to shareholders and community explaining the rationale behind the acquisition, says that this acquisition will lead to greater success for Windows Phone ecosystem, and hence will increase the market share for OEMs who make WP devices (Slide #16 -) - However, it remains to be seen if the OEMs become suspicious or trust Microsoft to make non-biased decisions while working on Windows Phone platform. 

Samsung Perspective
With Android roadmap controlled by Google (which has Motorola Mobile Devices) and Microsoft buying Nokia, Samsung whose devices use either Android or Windows Phone should be worried. Their own OS Bada did not take off as much as they wanted to. Now they are trying to evaluate Tizen as a potential platform. Samsung has enough cash to make major acquisitions in this space. I think Blackberry (with its BB10) may be a prime candidate, with Blackberry officially on sale

I might not be surprised if Samsung makes a bid for emerging OS companies like Jolla - It is unlikely that Samsung might bet big on pure Open Source efforts like Tizen , Firefox OS or Ubuntu phone   

It is not just Samsung, but companies like HTC, Lenovo and the like might make bids for these OS companies. 

To conclude, this is a VERY exciting phase in the evolution of Mobile devices, and I hope Microsoft / Nokia pull this off. With Stephen Elop back in Microsoft, Microsoft can even find a suitable candidate to be the successor to Steve Balmer!