Sunday, April 29, 2007

Culture or the Lack of It -

When I met Rhishi today, it was beyond doubt that the topic of conversation is going to be WC final, in which in a splendid display of high quality cricket, the Champions won the cup. Before I go further, which is the topic of current discussion, I'd like to restate Glenn McGrath's comments on winning the world Cup - "In 1996 we lost in the final, in 1999 we won the WC, in 2003 we won the WC undefeated and this year we won the WC unchallenged, that has been our progress!" Remember this is not a rehearsed dialogue written on a paper, this is something that comes impromptu. So what lies deep beneath is the supreme confidence and a sheer attitude. Yes sunny the same freaking attitude that results in such a response..

So what makes them a great cricketing side? Rhishi said - it's not just about one game, it is the result of "culture for sports" that is lacking here. I couldn't agree with him more.

When I am speaking about culture, I am not speaking about "५००० साल पुरानी संस्कृती", I am speaking of an ecosystem, a social infrastructure etc.

Then the topic drifted to in general "lack of culture" for anything out here. I remember saying to pilot a couple of days back "Do you know why we don't have 14 year old hackers?(please no Ankit Fartia) 'Cos we don't have 8 year olds who see their dad (or mom) coding at home" and discussion started from there.

How poorly we raise our kids "I am speaking about well-to-do urban middleclass". If a child doesn't see his dad or mom doing coding or indulging in some kind of "active" hobby, the child is not going to think that this is something that he should be doing in life. What constitutes an "active" hobby, A hobby in which you "create" something for yourself. eg. "writing blog could be an active hobby", but "reading books (without writing reviews about them) or listening to music does not constitute active hobby".

So what is the culture in which our kids are raised? (well most of them) Parents busy making money, I have no objections to that. But their idea of spending quality time with family constitutes to "going to malls, eating at Mcdonalds and spending half of their time while doing this in finding a place to park their Maruti Swift or whichever car they own". This is not quality time - This is just entertainment, which no doubt is extremely important in one's life but not everything.

Thus if a kid is raised while watching is mom and possibly grandmon watching "झी अल्फा TV मराठी (typical middle class maharashtrian household) or सांस भी कभी बहु थीish" serials, he thinks there is nothing better than that in life to be done. If his dad is watching "star news/aaj tak" he thinks this is what is important in life.

And this is precisely what I call lack of culture.......

Of course having this culture is not going to create a breed of 14 year old hackers or Adam Gilchrists', but thats our best shot at it.......

Just to conclude - Though I am not a father but I find most of the parents teach their kids "all wrong things" -
eg. you should respect elders. Saying "शुभं करोती" (typical maharashtrian family) in the evening etc.

I think it'd be suffice if they teach them just two things "respect everyone" and "work hard", unfortunately the child is a demanding creature and he can learn things only when exemplified..

Random Nonsense

I have this nasty habit of making observations about seemingly innocuous things and trying to find patterns, its Mental Masturbation to be honest, but its fun...... For instance here is a list of patterns that I have found in last few weeks

1. After I came back from bangalore sometime Feb-endish, I noticed that there is a sudden spurt in the ladies driving bikes, what was noticable was the variety of the bikes...

2. The most "in" color at the moment for a peeps of certain age group (and intelligence too I believe) is the "hutch pink". I am noticing faar too many "hutch pink" t-shirts than of any other colors or pattern.

3. This is a bit nasty one - Suddenly quite a few drainages in the city(?) of Pune are leaking,

Sunday, April 22, 2007

Reality Bites :-(

This weekend I spent a fair amount of time in solving the Ruby-Quiz for the week (#121). It appeared to me that I have really cracked a fundoo solution, till I checked some of the other solutions on the list. Looking at those solutions - my solution looks like a minnow. It probably simply means that I don't know the language well enough and have to work much more to get anywhere closer to others.. Never mind though..

There is a trick that I learnt this weekend -

Given a number N how do you find all permutations of N using numbers (1 and 2)

The answer is simple



1 = [[1]]

2 = [[1,1], [2]]

3 = [[1,1,1], [2,1], [1,2]]

4 = [[1,1,1,1], [2,1,1], [1,2,1], [1,1,2], [2,2]]


Got it?

Sunday, April 15, 2007

On Startups etcetra....

There is almost a bubbly trend now a days to call a "mee-too-social-foo" as a startup. I decided to break this down into : What consitutes a startup? what is simply a web application and what is neither and just a me-too? I keep thinking about this a lot, since I am involved with a project thats somewhere in between.

Like everything else, "Things start with an idea or a question". Let's take the typical example Paul Graham takes, "How about a Web Based Spreadsheet?" Now, a web based 'spreadsheet' isn't really a cool idea.. No not because "google" is doing it.. It's simply because there is enough technology available in the open-source for anyone to make that.... Dojo-Flex you name it and anyone with a bit of spare time and willingess can do it. I know the bitch is in the details, but its a well-known technology.

What is really a web-service, but not a "startup?"

Web service is a new kind of service that utilizes existing technologies and delivers it in a different flavor, a very good example of web-service is del.icio.us The web services themselves have a merit if you happen to make one that is not existing... And this really does not have to be a great technological breakthrough, but just nice ways of packaging stuff, usually they have nothing much as far as 'Revenue Models' go. Google Adsense is not revenue model (its old eyeballs business, don't worry not going to work!!) Thus, yes "new creative web services can potentially be 'acquisition targets'. But beyond a point they loose their value, so better take the deal when the banker offers them! (Remember Deal or No Deal?).

What is a me-too-social-foo?
Me-too-social-foo Is just a display of 'php' 'mysql' 'rails' etc. skills. So if you happen to make one count on getting a job somewhere that requires those skills. But nothing beyond that.

What is a startup then?
Startup -> Starup in my opinion has to have following constituents -
-> A sound enabling technology (which can be packaged in multiple applications)
-> A revenue model (May be not on Day 1, but certainly within 5 quarters of going live.)
-> They may suck a lot of money, before making any money themselves.
Example : "joost" is a very good example of this. (actually it is just an offshoot of an underlying technology developed a few years ago!)

Things like flickr fall somewhere between 'Web-service' and 'startup'!!!

So if you are working on something, you ask yourselves this question and thus position yourselves accordingly...

Ok, so people may ask what is 'paahijen' then?
I think the short answer is "web service", can it potentially be a "startup"? The answer is may be!! Is it yet another me-too-social-foo!! Certainly NOT!! (We don't have anything remotely social out there!!)

So far so good.. What has got a decent chance of success?
The short answer is "No one really knows!" Making something available on the web is like making movies - You have no ideas which will become hit and there is no real metric for judging it.. If people like it, it becomes hit if they don't it won't!!

So why should I try then?
Of course no one making a movie starts with an intention of making a super-flop. And also in my opinion (s)he does an honest job (barring few, won't take their names here!). So if you think of a "story to tell? Go ahead make a movie (aka web-app or startup or me-too-social-foo)" You never know!!

Friday, April 13, 2007

Computers 101

This was a loong overdue post. Thanks to a lot of folks I know for whom computers == Windows, sometimes it becomes very difficult to deal with. Hence I decided to create a short course (hence the name 101) about computers....

1. Brand of the Computer is not the Brand of the Monitor (eg. those who buy Assembled computers often tell me that they've bought an "LG"" computer say.)

2. Without getting into basics of CPU (tower like black box which whines when you power it on), the monitor, keyboard, mouse, speakers and webcam etc. Let me go straight to the business.

3. Computer generally stores files (Thus files are stored on computer, to be precise on "disk" and not stored "in Microsoft Word!" say)

4. A file is usually some data with some more information which some applications know how to read and thus can open those files. e.g. "Microsoft word can open a .doc file or is able to read a ".doc" file but not a ".exe" file. The .doc and .exe are called extensions which basically tells what type of file it is (which by the way is a very stupid way of doing things.. but lets leave it for the moment..)

5. You don't open a file by double clicking it.. When you double click a file an application (say "Internet Explorer" opens that file for you!) So please don't ever ever say anyone that open the file by double clicking it!!!!

6. Just like one uses Windows, there are other Operating Systems too. Now what the heck is an operating sytem? It is a program that runs other programs.... Ok for easier understanding you can treat it like God who runs the world!, but unlike God it is fallible (I guess God is fallible too!) Short form of Operating System is OS. Now some of you may think it is incredibly stupid for others to use other "so called Operating System" after all there is only one God.. To answer your question .. Just like different religions follow different God, there are other religions in Computers too! Respect them...(hoping you do in your real life)

7. Next time someone says he's on Linux please please understand all he means is he's using different Operating System.

8. Internet is a network of computers and Messenger, Internet Explorer etc. are applications that run on network or Internet. It is absolutely not necessary to use only those applications to talk with other applications. (How is for course 102)

I guess thats enough for 101.

Thursday, April 12, 2007

A nifty Ruby regexp trick

Just hit upon this while working on a rails project. Thought it might be worth sharing with others in case someone is interested.
The idea is as follows ->
suppose one defines a simple regular expression as follows

r = '(a)|(b)|(c)'

re = Regexp.new(r)


This re can be used with either String.match. The String.match returns a MatchData object. Often one is interested in an array. which can be obtained by String.scan instead of String.match. However this array is actually an array of Arrays, with "nil" at places where the string doesn't match..
eg.

"abhijit".scan(re)

will return

[["a", nil, nil], [nil, "b", nil], [nil, nil, "h"]]

If one just wants the array as ["a", "b", "c"], one could use following trick.

"abhijit".scan(re).flatten.compact

The flatten flattens out the array and compact gets rid of all nil
pretty useful .. One can then iterate over this array. Somehow this convenience is not offered by MatchData or atleast I don't know of it.

Wednesday, April 11, 2007

Understanding blocks in Ruby...

Blocks in Ruby.

I am trying to learn Ruby, because I am working on a Rails project. If one browses around for Ruby literature on the web, one often finds a common thing - 'Blocks are the best part of Ruby'. I have often used them while trying to do something.find { do stuff } . But never really appreciated what they were, till I decided to solve that mystery. If one googles 'ruby blocks', one finds typical examples illustrating how they are used, but not necessarily why and how they should be used. This sort of confused me to a greater degree. Basically, after spending a good couple of hours, I realized what blocks are how they are used and what is similarity difference between ruby blocks and python lambda?


1. Blocks are typically executed with an iterator -

Basically, a block is a piece of code which is enclosed between a '{' and '}' and follows immediately following a method call. Typically one would find

myarray.each {|x| p x;}


'each' is basically an 'iterator' over an Array object. Ok so what is an 'iterator' - is a method that invokes block of code repeatedly. Thus first use of 'blocks' is - they can be used to pass random code to an 'iterator' and that gets executed. But then what is the big deal about it? Well basically at first sight, one doesn't quite appreciate this. But consider -
- Find the square of each number in the array
- Find a list of all numbers in an array that is divisible by three

Now to solve the two problems ordinarily one would require two methods 'do_square' and 'is_divisible_by_3', but 'blocks' make it much simpler. Just pass a different code block to the 'each' methord.

2. Blocks can be used for 'transactional use'.

A very common example of this is code like

File.open('foo.txt', 'r') do |afile|
while ( s = afile.gets)
p s
end
end


At first sight, this might appear like another use of 'iterator' an iterator oer lines of a file. But this is not strictly true.

the 'open' function of a File class (note not Object) 'yield's the block above. Thus actually the whole of while (s = ...) code is getting executed in the File.open function itself. Sounds a bit un-intuitive. Ok.. So what's the big deal again? Well this takes care of Opening and Closing the file when done automatically in case the user forgets to do so.

3. Blocks can be used to create 'Proc' objects

This use of ruby blocks is like 'python lambda'. Though ruby blocks are far more flexible than python lambda as python lambda allows you only a single line of code.
consider this


def foo(x)
return proc { |y| x+y;}
end

p = foo(2)

p.call(2) = 4
p.call(2000) = 2002

I haven't really used this form of blocks yet. So can't comment about where this can be useful.

Actually a lot of what I have understood can be found on this page of ruby book.

Tuesday, April 03, 2007

What is a great poetry?

The lazy sunday had been kind of productive for some fancy new ideas :-) After falling in love with the rather haunting song, I was thinking what really makes a great poetry?


I agree the answers to this are going to be largely personal, I am just trying to thing what I perceive as a Good Poetry.

To me I think it is something like this "You understand every word of the poem, every sentence of it, but don't really get oh what is the poet trying to say and almost feel like calling him and asking, "hey what did you mean to say here?"eg. consider this - from the famous बीडी song -

ना बुलाया ना बताया माने नींद से जगाया मर गयी|
ऐसा चौंखे लिहाफ़ में नसीब आ गया
वोह इलायची खिलायके करीब आ गया|

now I just couldn't get the meaning of this... or even

जो भी कहां उस चंद्रभान ने फट से हो गयी राजी मैं|

now why does the lyricist wants to use the word चंद्रभान?

When I really get these questions, I start liking the it.. eg. consider another one (and for a change this is not one of the haunting types but a bit of religios marathi song)

पिते दूध डोळे मिटूनी जात मांजराची मनी चोरट्याच्या कारे भिती चंदण्यांची

सरावल्या हातांनाही कंप का सुटावा? उघड दार देवा आता उघड दार देवा....

this one is by ग. दि. माडगुळकर.

PS: I used to use ScratchPad for typing marathi or hindi words, till aditya said to me, I use it to write even in english.. After trying it myself, I think I will never use blogger editor again.

Sunday, April 01, 2007

democratization of startuping

In his famous book "the world is flat" Thomas Friedman speaks about democratization of information, finance and politics, which is really a very interesting observation. While enjoying a rather lazy Sunday afternoon, an interesting thought came to mind - "There is one more thing that is getting democratized and that is startuping".

What a startup needs? idea, funding, platform to quickly test out and deploy it to get a user feedback. Here is how this is getting democratized.


1. Thanks to opensource tools and frameworks like ruby on rails, its a matter of weeks to test out your idea and see it evolve in front of your eyes.

2. Thanks to the initiatives like Y-combinator by Paul Graham, there is a funding available to bright ideas for a period of time where you can make something meaningful and if one comes up with something really meaningful at the end of a period of three months, he can look for further funding or simply can get acquired for a decent bit of money and the best thing is you can apply to it from anywhere, we've applied even sitting in India. So funding is no longer a luxury for those who are within few miles of Sandhill Road.

3. Thanks to shared hosting plans for about 40 bucks a month (thats just 13 Starbucks Cafe Mocha, or 7 Sam Adams if you prefer it that way), you can keep it live for a considerable period of time and figure out how users' see it.

Thus anyone with an idea and willingness to put in few hours everyday can make a startup whether it succeeds or not is a different issue and thats the best part of it. The society filters out good ones from bad ones. Well not necessarily.. I don't find myspace quite good, still if the people like it and use it, there is a value it is delivering.


Happy startuping!!!

check this song....

Thanks to "महावितरण" I was almost without any kind of plausible entertainment for some time, when I decided to play some songs from movie "ओम्कारा". This one is just one high quality stuff.

Thanks "गुलज़ारजी"

(written whatever I could gather while listening and typing simultaneously.. ofcourse in multiple attempts NOT written in "google hindi transliteration")

मैं चांद निगल गयी । हो जी मैं चांद निगल गयी दुइया रे
हूं भीतर भीतर आग जलें बात करु तो सेक़ लगे
आजी भीतर भीतर आग जले बात करु तो सेक़ लगें

हो मैं चांद निगल गयी दैया रे अंग पे ऐसे छाले पड़ें
तेज़ का झोंका का करु सी सी करती।
सी सी सी सी करती मैं मरू ज़बाँ पे लागा जि लागा जि रे
ज़बाँ पे लाग लागा रे नमक़ इश्क का| होए मेरे इस्क़ का


बलम से मांगा मांगा रे
बलम से मांगा रे बलम से मांगा मांगा रे
बलम से मांगा रे बलम से मांगा मांगा रे नमक इस्क़ का तेरे इस्क़ का

हाय रे तेरे इस्क का

जबा पे...


हाय रे तेरे इस्क का

जबा पे...

सभी छेडें हैं मुझको सिपाहिए बाँके छमियें
उधारी लेने लगे हैं गली के बनिये बनिये
कोइ तो कवडि तुभी लुटा दे.
आजी थोडी थोडी शहद चटा दे.
आजी तेज़ का तदक क्या करुं सी सी करती मैं मरु ..
आजी .. रातभर छाना रे नमक इस्क का. हाये तेरे इस्क का

रातभर छाना राअतभर छाना राअतभर छाना रे .....

जबां पे लागा लागा रे ...

हो ऐसी भूक लगी जालिम की ..
हो ऐसी भूक लगी जाआलिम की ..
के बासुरीं जैसी बाजी मैं
अरे जो भी कहां उस चंद्रभान ने
फट से हो गयी राजी मैं.

हय कभि अखियों से पीना कभी होठोंसे पीना
कभी अछा लगे मरना कभी मुस्कील लगे जीना
करवट करवट प्यास लगी थी.
आजि बलम कि आहट पास लगी थी .
टेज का झौका का करु सी सी करती मैं मरु...
डलीभर डाला डालाजि रे .......

जबां पे.....

बलम से मांगा मांगा रे....