Sunday, November 25, 2012

Writing usable scripts in Ruby

Usable command line tools/scripts

There are a lot of command line tools written in ruby, python, bash, c or any other languages. They are usable simply because there is a standard way in dealing with them
this way can be summarized in the following points:
  1. There has to be a usage example/brief help at the finger tips of the user ( by running with --help      or -h)
  2. arguments should have default values which are explained in the help
  3. misusage or missing mandatory arguments should fire the help message

ruby tools

OptionParser is part of the standard library in ruby that takes care of this script packaging.  they show long and short examples
This is an example of the script:
require 'optparse'
options = {} do |opts|
opts.banner = "Usage: script_name.rb [options]"
opts.on("-v", "--[no-]verbose", "Run verbosely") do |v|
  options[:verbose] = v
p options
# Actual script code goes here
this allows the script to be used as:
$ ./script_name.rb -h
Usage: script_name.rb [options]
            -v, --[no-]verbose Run verbosely

$ ./script_name.rb -v

$ ./script_name.rb


no matter how small your script is, it is still better to package it as a gem. to keep track of releases, version, author.
let the actual code be part of the lib content. and the wrapper running (under bin) user OptParser and then call the script code with the specified options

Tuesday, November 20, 2012

Success of Startups

Entrepreneurship has become one of the one of the most interesting topic in the business side in any country in the world. While it is digging its way in the middle east, there is some sort of confusion and a lot of aspects related to that topic. A Startup can act and advance to tackle business opportunities in a way that competes with large enterprises. and most of the times, they need to be supported by Investors to back them up.

One of the things that started to really bother me in the culture is the definition of success of a startup. No one denies that a decent revenue generating startup is a successful one. However, some people believe that just raising an investment is a success.... umm, debatable.

I believe we can make some kind of analogy with some entities that showed up in the past decade like biznas and skybiz (I'm sure some of you will remember those names).   they used an invalid scheme summarized as:

  • People can register and join the network for a fee (as an investment, their money will get back doubled and doubled)
  • They need to invite 10 friends, and will get rewarded when their friends register and join the network
  • each of the new invited friends will get his money back with profit when he invites more friends.. and so on
The problem here is that, as an entity, you are not providing any value... you are rewarding people on reselling what u offer (which is nothing)... early adopters are usually rewarded and set as a successful example to motivate new ones.. but as time goes on, users form a kind of pyramid while people on top are relieved, and at the bottom are still trying to invite more friends. at least to cover their fees. this is a flawed business.. and officially stated as unlawful scheme

This is known as the "Pyramid Scheme".  from wikipedia: "A pyramid scheme is a non-sustainable business model that involves promising participants payment or services, primarily for enrolling other people into the scheme, rather than supplying any real investment or sale of products or services to the public.[1][2]"

Investment in Startups is different, because startups are meaningful entities with a mission, and need the investment on different levels to expand and grow up. However, if we took the value, the mission and revenue generation of a startup out of our evaluation, And focused only on the amount of money they were able to raise, then we're not anywhere far from the flawed scheme that was used by biznas and others.

We can think of raising investments as an indication that they're progressing in the right direction. well, at least someone has double checked that and invested his own money in this. But if the investor himself was not that mature, and only thought of the value of his equity when the startups goes for VC rounds of investments, then we're also back to the same flawed scheme.

That's why I believe that raising investments alone cannot be a success measure for a Startup