How I am learning Python from scratch Part 2

So it’s been slightly over a month since I’ve been with Insync (google docs sync not the band). Thought this would be a good opportunity for me to give an update on what’s been going on and how I’ve been getting on with Python. (Btw, they are looking for a few Level 80 troll eating amaterasu sprouting ninja samurai ronin assassin fireman to join the company in Singapore and Philippines.)

Currently, I’ve been working on mini apps. I’ve set myself a target of producing one mini app a week until I’m deemed good enough to work on production related tasks. My mini app ideas are very simple with the objective of getting something working out as soon as possible. This is also a lot more fun than doing books and tutorials like what I mentioned previously.


Mini App1: Twitter Tag Cloud

Enter your twitter username and it generates a tagcloud of words based on your last 100 tweets. It’s not a ‘smart’ tagcloud in that common words like the, he, she shows up. Ignore the oAuth part in the title. Leftover CSS 😀

This was created using Python, Django and Python-Twitter library. Models weren’t use as there were no databound elements in the app.

Mini App2: oAuth Twitter Status Getter

Ok for some reason, the app doesn’t seem to be working now. I’ll probably have a look at it later BUT it’s suppose to do this: Authenticate using oAuth with your twitter account. It then grabs the last 50 tweets from your timeline. There is an input box that allows you to change how many tweets that get displayed. This number is databound such that the next time you log in to the app, the same number of tweets that you set previously is displayed. I’ll update with screenshots once I figure out what the hell is going on.

FYI, for the technical savvy, I am getting BadStatusLine when twitter redirects the user back to my application.

Mini App3: Flickr Photobrowser

The latest and the greatest. This app is currently live on my free EC2 instance. Check it out here (**UPDATE** I’ve taken this down to save me some EC2 hours). For those who can’t be asked to click, see the screen shot below.  Basically, input your Flickr username and it gets all your public photos and displays them in a gallery with pagination. Did you hear that? Pagination baby. Paginationpaginationpaginationpagination. That’s nice, I like the sound of pagination. Oh, there is also has some nice CSS mouseover effects applied to it.

This was by far the most complicated app of the 3. It took me a while to figure out the pagination feature on Django. Setting up Apache and mod_wsgi on Amazon was also tricky as it was my first time setting up a webserver. The documentation was bloody intimidating at first glance but just keep your head down and bang a few walls with it, you’ll pull through just like everyone else. The Flickr API itself was fairly straight forward but I didn’t do anything that required authentication. That just messes things up.

And yes, that’s me with the ultraman facial pose.

**update** Just realized my little app is not a hundred miles away from which was recently launched.

Lessons Learnt

  1. If you want to play around with RESTful services and API’s, Twitter is a good place to start.
  2. I found myself doing quite a fair bit of stitching together code and then augmenting it for my own purposes as opposed to writing the entire app from scratch.
  3. Deployment has been my greatest source of grief at the moment. There’s quite a fair bit to know about the web development that is really not related to coding. At this moment, I still haven’t figured out how to get Django, Apache, mod_wsgi and EC2 to play together nicely.
  4. For morale reasons, you would probably want to make your app live on the internet and ‘show off’ to everyone and say: Hey! Look at me, I made this! On this note, I think being able to deploy a Rails app onto a service like Heroku is definitely one big plus for going with RoR for a beginner. Having said that however, I understand the learning curve for RoR to be steeper initially compared to Python/Django.
  5. Be prepared to get your hands dirty in shell/bash (or command prompt in Windows). I spent 30 mins wondering why ‘cd projects’ didn’t exists only to realize bash was case sensitive. And while you’re at it, say hello to this primitive thing call Vi or Vim. I still don’t quite know what the difference is.
  6. I know a lot of you guys are going to be bouncing between concepts and jargons. It takes a while for everything to sink in so don’t worry if you don’t get it the first time. For example, I’m only just beginning to understand what a web server actually does and the role it plays in the ecosystem.
  7. Less reddit, more code.
  8. I estimate I’ve spent less than 50% of my time actually coding in Python and more time messing with sys admin stuff and Django.

That’s all for now.

Hacker News Effect

Ok so this is for you data freaks. So I blogged about turning into a hacker last week and I think it related well with many people. I had about 10,000 views to my blog within a 2 day period. So I thought it might be interesting to share the details of the HN effect. I posted to HN at about midnight on 03/03/11 GMT+8.

So roughly 2 hours into my blog post, I was in 4th position on the homepage. This translates into the following views:

So what can we learn from this?

  1. A lot of people out there want to be hackers 🙂
  2. To get to the homepage, you need the following ingredients
    1. Submit your blog post at 00:00 GMT +8 on a Thursday
    2. You need to get 23 upvotes, 21 comments and roughly 1200 inbound clicks to make it to the homepage of Hacker News
    3. You need to get all these within a 2 hour time frame

Of course these numbers are relative to the popularity of other news for that day. But I think this gives a rough idea to the order of magnitudes that is required to make it to the homepage.

By the next day, I was still on the frontpage but below the fold (27th position I think). I didn’t take a screenshot of that but I had I think 4-5k page views by then. I stopped tracking my position on HN shortly after.

This is how the final numbers look like:

An idea is an if…else… statement

Idea Cat

I have an idea, why don't you feed me?

Since I’ve been back, I’ve met many buddies whom to my surprise, have all been hatching up business ideas. But I always get bemused when they say: “this is top secret for your eyes and ears only Nai!!”. Firstly, thanks for the vote of confidence. Secondly, you’re being silly. I think Derek Sivers nailed it when he said ideas are just multipliers of execution.

Keeping in line with my undertaking to become a hacker, I see an idea as a single if…else… statement. Thinking out loud: if my idea works, return me lotsa money, else do not pass go, do not collect $200. Where execution comes in is that it allows you to slap else if conditions along the way. The better execution the more else if conditions you can slap. Reducing these cycle times would be what the Lean Startup is all about.

So putting the 2 ideas together: Good idea * bad execution = $0. Bad idea * good execution = $0 BUT good execution allows you to discover that your idea is bad, quicker.

If you’re still not convinced, here are my top 3 reasons why you should not be cagey about your idea:

  1. Feedback: In the same way how if you shot a hole-in-one and no one saw it, ideas need feedback and validation from other people to verify its existence (or non-existence if its a bad idea). This is almost like a quick sanity litmus test. There are many ways to do this such as :
  2. Evolution: It takes feedback, discussions, differences of opinions for your idea to take shape and evolve. Why is this important? Mainly because no one gets it right the first time round. It is only through the gathering of different perspectives from subject matter experts (or not), the bouncing of ideas and the resulting synthesis does one conclude at a very high level if the idea is worth pursuing or not.
  3. Connections: Confucius once say: “Man are born good…”. Your friends want to help you, so help them help you! It’s this crazy karma, real life upvoting system or what I call the Goodwill Bank, that powers the human race.They can do this with expertise or more often than not, connections. People whom they think might find your idea interesting or might be able to help you operationally.

I think entrepreneurs can be a paranoid bunch and are afraid of people ‘stealing’ their ideas. Well guys, were you expecting zero competition? The battlefield is at your execution and that’s where the focus ought to be at.

Turning into a Hacker aged 27

Hacker for Dummies

oxymoron much?

One of my biggest realizations having been in the trenches of a startup for 2.5 years was this: you will not be very helpful if you cannot code pre product market fit. At my previous startup, my CEO was also the CTO. So when he was out fund raising, development essentially grounded to a halt.

In any case, at the very early stages of a startup, what are you going to do if you can’t code? There are only that much research/admin/strategy/cust. dev/misc work a non-technical person can do. I also do not think division of labour works very well at the early stages. It’s the kind of thing you do when you got scale and need expertise. Right at the beginning, you got nothing but a gut feeling about something and what needs doing is the building of a prototype to validate those feelings.

Therein lies my problem. I can’t code ergo I have a major liability if I wanted to do another startup. At a ripe ol’ age of 27, I needed to turn into a hacker and fast.

The term hacker has the usual connotations: near genius IQ, scant regard for authorities, young whiz kid types and depending on whether you’ve seen Swordfish, blowjobs. I have exactly none of those attributes (ok, bjs aren’t an attribute but whatever). It helps that I have chosen a more functional definition of a hacker — that is someone who does a hackjob that is just barely good enough to get the job done. No more, no less.

In a bid to accelerate my learning progress, I’ve took to cold emailing startups who code in Python, hoping for a sort of internship/apprenticeship type gig. I can count with 2 hands the number of startups that made the shortlist. Luckily for me, the kind folks at Insync (google docs sync, not the band) took me in.  So this marks the start of my journey from zero to hacker. I’ll be posting my learnings along the way so if you’re interested, check back!