Bootstrapping a business without shortcuts

 by Shalin  on   20 Jul 2011

It is not hard to Bootstrap a company. Many people think bootstrapping is all about thinking short-term. Generate money for the company today. I think otherwise.

Bootstrapping successfully needs a long-term vision. Doing services to bootstrap a product company is short-term. Building minimum viable product, selling as soon as you have a prototype is long-term.

Bootstrapped entrepreneurs are not in business because they see a gap in the market. They start companies because of their ideas and ideology. Sticking to long-term vision is the shortest path to remain viable.



ActiveRecord Finders: Returns nil or Throws Exception

 by Lakshman  on   19 Jul 2011

ActiveRecord finders behave differently for various types of finders. Suppose you have a model called Account. Here are the ways you can get a record with id 34 in the `accounts` table.

acc = Account.find(34)
acc = Account.where(:id => 34).first
acc = Account.where(:id => 34)

Suppose a record with id = 34 does not exist in `accounts` table. Most programmers would think that the finders will throw ActiveRecord::RecordNotFound exception in all cases. No, thats not the behavior here. In the first case, using ‘find’ method returns ActiveRecord::RecordNotFound exception. Where as in the second case using ‘where’ method, it returns nil object. In the third case it returns an empty array []

ruby-1.9.2-p180 :001 > Account.find(34)
ActiveRecord::RecordNotFound: Couldn’t find Account with ID=34
ruby-1.9.2-p180 :002 > Account.where(:id => 34).first
=> nil
ruby-1.9.2-p180 :003 > Account.where(:id => 34)
=> []

If we find records using ‘find’ method, it is assumed that we have prior knowledge of the table ‘accounts’ and the primary key values. So, if there is no record with that id, an exception is thrown. If we use ‘where’ method to find records, we are querying based on some conditions. If the query finds anything that matches our conditions, it returns the result. If it cannot find any record that matches our conditions, it returns an empty array or nil object.

Empty array is returned when we fire a non-singular query (as in third case). A Nil object is returned if we fire a singular query. This behavior have to be kept in mind when find records and apply conditions on them, in the Rails controllers.



The day we fired the system admin

 by Shalin  on   18 Jul 2011

I recently received a call from my cousin, he runs a small brick-mortar business and works really hard. His question on a sunday evening was:

“What anti-virus should I be using?”

My reply was with another question: “Do you want to have the same call again 6-months later?” He obviously replied with a No.

So, I answered him: “Then, get a Mac!”.

Now, probably the #1 reason someone wouldn’t move to Mac in India is a software called Tally. Tally (windows-only) is unarguably the most popular accounting package in India. But then you could simply run windows using parallels or bootcamp and deal with it.

Don’t get me wrong, I am not saying that you cannot run Windows virus-free and don’t really have to re-install-the-OS-every-6-months. But it’s quite hard without good IT support. You just don’t need an anti-virus, but probably also need a firewall and a malware blocker, and a more secure browser. Keep all of it updated (using their own unique update process) all the time. I know it’s not that hard, but most people don’t want to do this.

At Tenmiles, we started with Dell desktops running Windows. A server running Windows Server 2000. We mastered it all to ensure there is zero-downtime but as we hired more and more people we realized we had to make them familiar with all those little things that make the difference. From knowing what service pack they are using to understanding how an array of tools help us stay safe. Nevertheless, many of them called me or one of the know-all guys for help. We loved the adventure of fixing stuff. Then, one-day, I bought a Mac. Used it at work.

The first few weeks, the signals I got from my co-workers was, he has made a lot of money – so he is buying expensive designer stuff and soon will fall flat when he gets troubled by compatibility with the majority of us (and the software). A few months later, few folks at office decided to buy their own Macs at their own expense as their primary work machine. I was soon forgetting all the Win-OS expertise I had learnt over the years.

Instead of hiring a system admin, I actually fired the system-admin role in me and my colleague. We started buying Macs for everyone.



Starting up: 5 Reasons to hire freshers

 by Shalin  on   12 Jul 2011

At Tenmiles freshers have played a huge role in building the company – they’ve stayed the longest and most importantly delivered top-notch production ready work. Many years ago when ‘startups’ and product companies were not so often spoken about (hyped?), it was much easier hiring great freshers compared to the experienced lot with already fat pay checks in services companies.

So, if you are hiring, think hard about hiring freshers as well.

#5: They are in-expensive: They are not going to cost you an arm and a leg. While money is important as they begin, good chances that a talented person is on a look out for the right job and pay is not the most critical requirement.

#4: They share their experience: They are most likely to talk about their work to all their friends. Everyone’s probably got a job and are reaching out to each other updating where they are and what they are doing. A fresher any day spreads the word faster about your company.

#3: Likely to stay longer: They are fresh and you are probably the first one to mould, motivate and inspire them. They don’t just get a pay-check but also all the guidance they require to nurture their talent. If you’ve got this right, they are likely to stick around lot longer and be a part of the growth story.

#2: They are young: They’ve just passed out of college. They start looking at your company as an outsider without too much mental baggage about how other companies work. They bring in a fresh perspective and ideas to the table. They are full of energy and can really slog to make things possible.

#1: They are hungry: This is what I love the most about hiring freshers. They are hungry and foolish. They want to win the world. They want to make a difference. They are eagerly waiting for recognition that does not look like a marksheet or a certificate. They were waiting for this day and you’ve got an opportunity to turn their enthusiasm into great work.



Rails Performance Tip: Query Optimization

 by Lakshman  on   11 Jul 2011

Rails applications will get significant performance boost if the sql queries sent to the database are optimized. Database must not be hit with requests unless there is an absolute necessity.

Two Basic steps for Optimization:

  1. Add database indexes on all foreign keys
  2. add_index :tasks, :project_id
  3. Use Eager loading to avoid n+1 query problems, in sensible places.
  4. Project.find(12).includes(:tasks, :notes)

    QueryReviewer gem:

This gem helps a lot in optimizing the SQL queries. For every page request, it gives good statistics on the number of queries, number of slow queries, in-efficient queries etc.,
Check it out.



Monday mornings, an entrepreneurs take

 by Shalin  on   11 Jul 2011

Sunday night makes me think I am still at school, waiting to get out and start a business. Meet the real world. I must admit, I love monday mornings. I think many entrepreneurs I know love getting back to work – be it monday morning or back from a holiday. Some actually work most of the times during the weekend and get lot more work done than the they would the whole week. Irrespective, monday mornings are both important and inviting.

I can share all the thoughts I had over the weekend with my team. Reset priorities for the week. Start engaging with customers. Get responses to the emails I sent all of Friday. To say the least, get to do what you love to do the most.

Welcome, monday morning!