koi samajhayega mujhe

kya hai ye Pyar,
kyo hota hai ye pyar,
kyo kehte hai ise pyar,
khafa hone par bhi,
kyo aata hai us par pyar,
pyar… ye kaisi paheli hai pyar,
koi samajhayega mujhe,
kis ko kehte hai pyar…

koi acha lage to koi kehta usko pyar,
koi khayalo me bas jaaye to kisi ka wo pyar,
koi labo pe halki hassi chod jaaye to wo pyar,
koi yaad aaye to koi kehta usko pyar,
koi samajhayega mujhe,
kaise hota hai ye pyar…

kabhi dost ban jaata hai pyar,
kabhi kisi ajnabi se ho jaata hai pyar,
kabhi kisi dil ke kone me,
chingaari jaisa sulagta hai pyar,
koi samajhayega mujhe,
kisse hota hai ye pyar…

koi pyar ke naam se darta hai,
koi pyar pe marta hai,
koi jakhm khaye baitha hai pyar ka,
koi intezaar karta hai pyar ka,
koi samajhayega mujhe,
kin rasto se guzarwata hai ye pyar…

kabhi mohalle ki chhato par,
kabhi daak ke khato par, (I know its connected world with msg and phone but fir bhi yehi sahi lagta hai)
kabhi college ki ho-halle (हो-हल्ले) me,
kabhi party ki balle balle me,
ho jaata hai pyar,
koi samajhayega mujhe,
kaha hota hai ye pyar…

koi kahe ‘I love you’,
koi kahe ‘I have a crush on u’,
koi kahe ‘tum pe marti/marta hu’,
koi kahe ‘mera pyar tu’,
koi samajhayega mujhe,
kaise bayan hota hai ye…

kabhi ek se, to kabhi do se,
to kabhi puri duniya jahan se,
ladna padta hai kabhi is pyar me,
kabhi khud se, to kabhi pyar se,
koi samajhayega mujhe,
kyo itna mushkil hota hai ye…

koi kahe ye pyar hota meetha,
koi kahe ye pyar hai karwa,
koi kahe iska noorani rang,
koi kahe issa bazaro me nahi milta sang,
koi samajhayega mujhe,
kis tarah ka pyar hai hota…

kabhi rang gore pe aata pyar,
kabhi sawal (सावल) pe bhi aa jaata pyaar,
kabhi balishth (बलिष्ठ) pe aata pyar,
kabhi nirbal pe bhi aa jaata pyar,
koi samajhayega mujhe,
kya dekh kar aata hai ye pyar…

koi isme sharmila ban jaata hai,
koi isme seema laang jaata hai,
koi isme jeevan saathi ban jaata hai,
koi isme fakira ban jaata hai,
koi samajhayega mujhe,
aakhir kis anjaam pe pahuchata hai ye pyar…

P.S. I don’t have proof but I think its NP problem ;)

If I could

If I could rewind time then I want to meet you again,
That first sight, that first talk again,

If I could rewind time then I would like to spend time with you again,
That walk on the river side, that trip together again,

If I could rewind time then I would like to ask out again,
That your ever saying never again,

If I could rewind time then surely I choose you over my dreams,
I would stop those freak outs, those stupid moments of insane,

If I could…

I want to be with you again…

Starting Fresh!!! tl;dr

(Title and the following text is my last day [30th March, 2012] mail at Adobe, This is reflecting my views only as Individual, Adobe has nothing to do with it)

Hi All,

Today is my last day at Adobe. This is not going to be last day kind of mail.

It is about my life, my journey and my views. It is about creating dots for my life. Since, Adobe is one milestone on my way to my dream. So, here I am writing on that milestone, where I am heading to.

I am going to follow my childhood dream, that I have to do something of My own. Over the period, that My own thing remains there but what that My own thing got change with time. So, I am going to follow that one dream of mine. If you had such dream in your childhood or early adulthood then go ahead and follow that since that what makes you really happy, that doesn’t necessary to be crazy like mine. I said dreams ‘in your childhood or early adulthood’, Since after you join corporate you acquire dreams of your superiors and successful/happy colleagues (don’t acquire mine if you don’t have passion and courage to do crazy things with your life).

This job and these future ventures of mine are also just the Milestones that leads to me to my dream. I have plans for next 20 years, So I have plans for what makes me happy for next 20 years. Currently, technology is not quite mature to handle my dream project and I don’t have enough resources to push technology like I wanted it to be.

I am not believer of revenue first philosophy, I am believer of enabling and pushing comforts to new level through my technological passion. I believe that money is always by product of passionate work. So, I am starting with little money just my savings. However, I have big dream, passion and dedication to stand for what actually I wanted. I am not what others wanted me to be, I was, I am and I will remain what I wanted it to be. That’s why I am getting my smile back.

I know what My strengths are, coding and developing anything from initial just idea to full product(I believe that :) ). I am not expert in communication, since I never want it to be (it consume lots of brainpower without producing any useful ideas/thoughts). Knowing what I am not expert of is really useful because I invested my energy to find partners with that as strength. And, I know this mail could have grammatical mistakes, just another crappy thing that I never used to. :)

I am believer of open-source philosophy, the term free software doesn’t mean you can’t sell it for money. Please read this article for more information. I had hard time to sell this idea here at Adobe. Why it comes here, surprise surprise (wait for future, It will came very soon).

To me breaking Jinx of traditions is what needs to be done. Traditions evolves it’s not a constant thing, you have to change with that otherwise you will be old sooner than others. This is why I am breaking Jinx of last day or similar depressing title of mails.

And, yes I am leaving Adobe after 2.5+ years. And, I am very excited about that. I know people will think that I am too optimistic about what I am doing; its high risk business that I am entering in, however My motto is to enjoy my life.

I will let you know my future projects very soon.

Please free to contact me @

Gmail – <removed-to-avoid-spam>.2020@gmail.com
Facebook – http://facebook.com/gagan1985
LinkedIn – http://in.linkedin.com/in/gagandeep1985

There is one interesting thing about my gmail id. It is created prior to T20 cricket thing, It is about India will become developed nation by 2020, another dream of one of my ideal A.P.J. Abdul Kalam.

Regards,
Gagan

P.S. I know that breaking Jinx takes time and energy. And, I will miss most people mail box. Since, they have filters in their mind for last day or similar titles. :)

Installing Ubuntu or any other Linux flavor from USB stick

For Impatients:
Use UNetbootin, Universal Netboot Installer to create bootable USB drive of your favorite Linux distro.

For all Others,

I got 3 new machines to create my own lab of experiments (long awaiting plan, first look of it will be posted soon). I have to install Ubuntu Linux distro but forgot to brought any CD/DVD. So, I tried installing Ubuntu from USB. To my surprise, Ubuntu came with usb-creator.exe for windows in its ISO image. You can extract usb-creator.exe from 7-zip. It comes with nice easy to use UI.

At first it was giving me some error because I didn’t formatted my USB drive. After formatting, it created required USB from Ubuntu ISO created.

However, After booting the system with USB drive, system hung on the screen that display this message “SYSLINUX 4.03 2010-10-22 EDD Copyright (c) 1994-2010, H. Peter Anvin et al”.

I searched a lot and found that there is some problem with usb-creator.exe itself that shipped with Ubuntu ISO. In some thread it was suggested that use UNetbootin, Universal Netboot Installer instead of Ubuntu’s default one.

  • http://askubuntu.com/questions/26269/how-do-i-install-ubuntu-from-an-usb-drive#_=_
  • http://askubuntu.com/questions/34088/cant-install-with-usb-pen-drive-syslinux-problem
  • http://askubuntu.com/questions/26269/how-do-i-install-ubuntu-from-an-usb-drive
  • Unetbootin is also easy to use and even comes with option to download your favorite Linux distro.

    Unetbootin UI

    After creating bootable USB disk from Unetbootin. I was able to install Ubuntu from USB drive in just 5 minutes. :)
    S5KZSMEP6B2F

    How to create you own Gmail like loader / progress bar with Jquery

    Sometimes, It is necessary to create progress bar or loader to show user that something happening in the background. Loader/loading icons are good way to do this but If you want your user to show actual progress then something else is needed. A progress bar which shows how much task has been completed and how much left.

    Gmail has done some remarkable job in this. Since, Gmail loader is simple and elegant in looks. And, It is really simple to create a Gmail like loader.

    What you need is two divs. One div will treated like container, which will filled by other div to show progression of the task. So, outer div will contain border only and shows totality of the task, where as internal div will contain background color, it will give sense of filling the outer div. And, when some part of task happened we will increase this inner div’s size. So that, it fills outer div and give sense to user that we had done something and hence increase the progress.

    Here is the example to do Gmail like loading feature,

    
    <!DOCTYPE>
    <html>
        <head>
            <title>Gmail like loader</title>
            <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js"></script>
            <script>
                function callMe(inc)
                {
                    inc = inc || 10
                    var w = parseInt((parseInt($("#inner").css("width"))/parseInt($("#inner").parent().css("width")))*100)+ inc;
                    $("#inner").width(w+"%");
                    if(w>100)$("#inner").width(0);
                }
    
                $(document).ready(function(){
                    var id = setInterval(callMe,1000);
                });
    
            </script>
        </head>
        <body>
            loading...
            <div id="outer" style="border:1px solid;width:200px;height:10px;overflow:hidden;">
                <div id="inner" style="background-color:#0F67A1;height:100%;width:0%;"/>
            </div>
        </body>
    </html> 
    

    I had two divs, outer and inner. outer had border and inner had background color. In outer we had used overflow:hidden to hide inner div progression if it increases beyond 100% (length/width of the outer div). I had to use interval to show some progress.

    Update: Demo
    http://jsfiddle.net/gagan/62CZZ/embedded/result/
    Update 2 : Working Demo

    Converting Simple XML to JSON in Python

    Converting simple XML to JSON with some Google like extensions (http://code.google.com/apis/gdata/docs/json.html) like $t for text content and replace ‘:’ in element name with ‘$’. It is fairly simple here is how I do it.

    import xml.parsers.expat
    import sys,string
    
    # 3 handler functions
    def start_element(name, attrs):
        #sys.stdout.write 'Start element:', name, attrs
    	sys.stdout.write('{"'+string.replace(name,':','$')+'":{')
    	for attr in attrs.keys():
    		sys.stdout.write('"'+attr+'":"'+attrs[attr]+'",')
    def end_element(name):
        #sys.stdout.write 'End element:', name
    	sys.stdout.write('}')
    def char_data(data):
        #sys.stdout.write 'Character data:', repr(data)
    	if data and (data!=""):
    		sys.stdout.write( '"$t":{"'+data+'"}' )
    
    p = xml.parsers.expat.ParserCreate()
    
    p.StartElementHandler = start_element
    p.EndElementHandler = end_element
    p.CharacterDataHandler = char_data
    
    p.Parse("""<?xml version="1.0"?>
    <ns:parent id="top"><child1 name="paul">Text goes here</child1><child2 name="fred">More text</child2></ns:parent>""", 1)

    Google App Engine : Full Text Search support in pre-release version

    Full Text Search in Google’s app engine is what limiting me from adopting app engine at a first place, may be others feels this as limitation too. But, Then something interesting happened two Google guys presented in Google IO the upcoming feature of the App Engine – Full Text Search. They presented what I needed most. They are Google they had to provide search capabilities, that’s what issues reported by one of user. I didn’t hear any word from them since then about Full Text Search. May be they are planning big opening for this big feature.

    But,  2-3 days earlier they released pre-released version in their opensource app engine SDK. But, they didn’t mention anywhere in the changes or release notes that it contain search capabilities. Yesterday, I explored the python SDK and found that there is new search libraries and apis in ext folder (google/appengine/ext/search). Then I created the document for python SDK through epydoc. And found this doc of search package (google.appengine.ext.search),
    Full text indexing and search, implemented in pure python.
    Defines a SearchableModel subclass of db.Model that supports full text indexing and search, based on the datastore's existing indexes.

    Don't expect too much. First, there's no ranking, which is a killer drawback. There's also no exact phrase match, substring match, boolean operators, stemming, or other common full text search features. Finally, support for stop words (common words that are not indexed) is currently limited to English.

    To be indexed, entities must be created and saved as SearchableModel instances, e.g.:

    
    class Article(search.SearchableModel):
    text = db.TextProperty()
    ...
    
    article = Article(text=...)
    article.save()
    

    To search the full text index, use the SearchableModel.all() method to get an instance of SearchableModel.Query, which subclasses db.Query. Use its search() method to provide a search query, in addition to any other filters or sort orders, e.g.:

    
    query = article.all().search('a search query').filter(...).order(...)
    for result in query:
    ...
    

    The full text index is stored in a property named __searchable_text_index.

    Specifying multiple indexes and properties to index
    ---------------------------------------------------

    By default, one index is created with all string properties. You can define multiple indexes and specify which properties should be indexed for each by overriding SearchableProperties() method of model.SearchableModel, for example:

    
    class Article(search.SearchableModel):
    @classmethod
    def SearchableProperties(cls):
    return [['book', 'author'], ['book']]
    

    In this example, two indexes will be maintained - one that includes 'book' and 'author' properties, and another one for 'book' property only. They will be stored in properties named __searchable_text_index_book_author and __searchable_text_index_book respectively. Note that the index that includes all properties will not be created unless added explicitly like this:

    
    @classmethod
    def SearchableProperties(cls):
    return [['book', 'author'], ['book'], search.ALL_PROPERTIES]
    

    The default return value of SearchableProperties() is [search.ALL_PROPERTIES] (one index, all properties).

    To search using a custom-defined index, pass its definition in 'properties' parameter of 'search':

    Article.all().search('Lem', properties=['book', 'author'])

    Note that the order of properties in the list matters.

    Adding indexes to index.yaml
    -----------------------------

    In general, if you just want to provide full text search, you *don't* need to add any extra indexes to your index.yaml. However, if you want to use search() in a query *in addition to* an ancestor, filter, or sort order, you'll need to create an index in index.yaml with the __searchable_text_index property. For example:

    - kind: Article
    properties:
    - name: __searchable_text_index
    - name: date
    direction: desc
    ...

    Similarly, if you created a custom index (see above), use the name of the property it's stored in, e.g. __searchable_text_index_book_author.
    Note that using SearchableModel will noticeable increase the latency of save() operations, since it writes an index row for each indexable word. This also means that the latency of save() will increase roughly with the size of the properties in a given entity. Caveat hacker!

    Hoping this will help others and also encourage others to think and adopt Google app engine as more capable system to handle real world problems.

    Python : Create directory if directory/folder(s) don’t exists already

    In Python, I have to make sure, for quite a lot time, that some directory path exists before I can do some operation on that. So, here is the code in python that make sure some directory path or folder path exists before we do something on that directory.

    It will create all the directories in the path, if they are not exists

    import os, errno
    
    def make_sure_dir_exists(path):
        if not os.path.exists(dir):
            try:
                os.makedirs(path)
            except OSError as exc: # Python &amp;gt;2.5
                if exc.errno == errno.EEXIST:
                    pass
                else: raise
    

    Why big internet companies (Google, Facebook, Twitter, Yahoo, etc) going so much open source ?

    If you were ever wondering why these big comapanies (Google, Facebook, Twitter, Yahoo, etc) going so much open source. There are various factors that contributed to this attitude of these new corporates. These factors are Cost of training, Delivery Time & Quality of delivery and ultimately assurance about replicating infrastructure at thier level needs lots of capital. Now each fators in detail, 
    Cost of Training - Any big company goes into phases of attrition then new hires as norm not exception. So, they want new people to at least familiar with technologies they are working with, if not the whole process.  
    Delivery Time & Quality of delivery - For these big internet brand names delivery time and Quality of any service or feature and addressing any critical issue in short span of time are crucial for their brand name. They are earning because of their brand name otherwise their are many pirates are out there. So, they need developes, who can write quality code in short time. And, these two things increase over time of developer association with technology used. Therefore, this is most important factor why these companies want developers to know about what they are working upon.
    Assurace - BIG Internet companies are more about scale and process rather than trade secrets and softwares. they know their most of the client side code can be easily be duplicated. So, they concentrate on not on how to protect that but concentrate on scaling each product to a level where others can’t do that much of scaling. Even, scaling to that level is also possible but that is certainely very capital intensive. So, they are almost assure that their scaling cannot be challenged in near future.

    Update: I asked same question to stackoverflow community and got pretty good answers http://programmers.stackexchange.com/questions/53788/why-big-internet-companies-google-facebook-twitter-etc-going-open-source-way

    Python : Create path or directories, if not exist

    I came across to this question very often, that how to create a directory structure, if I know the exact path of file or directory hierarchy. That is not difficult but very time consuming if you don’t know where to find the resources. Let go to code we need,

    
    def assure_path_exists(path):
            dir = os.path.dirname(path)
            if not os.path.exists(dir):
                    os.makedirs(dir)
    

    first line define python function/module assure_path_exists, which take one argument “path” of file or directory.
    second line, ensure path contain directory only. it strips filename, if there is any.
    third line, checks for whether this path (pointed by dir), exists or not
    forth line, if path pointed by dir not exists, we create that path through os.makedirs

    Done!!!