Thursday, December 15, 2011

Advice for aspiring GSOCers


I have been getting some mails across regarding how to apply to GSOC etc.. I thought it would be better if scribble this piece of advice and mail back the link, it would be easier for me and also for the readers.. :)
So here are a few points on my head, right now.. I will keep editing it so that it retains its relevance. I would happy to get response from you all (good/bad)...


Be clear in what you want out of your summers and what is your field of interest. Once you know yourself, find out the organizations that are working in your field of interest. 


Check out the various projects they have worked in. Find one project of which interests you.
Warning: Don't work for a proposal for many projects. Select one or max two ideas and start tweeking with the code..


Don't get bogged down with a lot of code that you come across, if you are working with an existing project, there are all chances a lot of code is already on place. Even if you are starting out of scratch, clearly jot down the requirements and the approach you are going to follow to meet those. Check with the mentor if she approves of it.


Hang out on irc channel for your org as well as gsoc-in its the indian channel for gsoc participants.. You'd find some good and helpful people there. For project related advice get in touch with previous successful participants for the org, that would be very helpful. and don't worry about the reply of the mentor. They are very busy people and generally come in regular contact only after selection. Don't bug them much, be patient!


A good proposal which captures your thought clearly is the key to all of it. Check out the various proposals submitted by the folks to your organization earlier. You'll get a better idea.
The honeynet project is absolutely an intelligent choice if you are interested in honepots & malwares.
Zhijie Chen was the previous contributor to the project which I worked with. Here are the links he provided me.
http://joyan.appspot.com/tag/phoneyc


Don't be disheartened if its your first time, as Everyone has a first time. So, if you are interested, you MUST apply.
I hope it helps.. 

Wednesday, December 14, 2011

Find PG/Flat: Dos & Don'ts

Most of the employed folks switch jobs and think to move to newer places to reduce the commuting time and avoid the troubles of driving and wasting already endangered fuel resources.
I made a switch to Delhi from Gurgaon earlier 2 weeks. For one week I actually commuted from Gurgaon to Delhi using metro and the local transportation. But believe me, it sucks, your 2.5 hours (one way) just go to trash. How much motivated you are to work, you won't be able to everyday. With each passing week your efficiency will decrease not only in the transit but also in the office hours.
So check out the other option and that is find a place to live nearby, but that is just another cumbersome and f***ing bad job to do(*)
The star above signify that conditions apply to this... ;)
If you are looking for a PG or Room or Flat (1 bhk/ 2 bhk/ 3 bhk) or shared flat options, please don't follow the traditional way, at least if you are reading this!

WAYS TO SEARCH AN ACCOMMODATION ANYWHERE ON PLANET (INCLUDING INDIA)

Don'ts
1. Don't get a broker, first of all. Please for God's sake, these brokers are professionals in making a fool out of you!
2. Even if you do, don't go with them after a day's long work. Since you are too tired and all the brain cells have actually been put to sleep when you put your laptop to sleep!
3. The broker's will take you to certain places on a rickshaw, auto, bike or car and drive you nuts by convincing that the option they are showing you is the best available and most coveted option available in the vicinity. The gut feeling tells you that it is a lie. Don't ever even think of not following your gut feeling.
4. And last, even if you have done all the above, please, please, please don't give the broker any advance  or token money on the same day. Atleast, go and see the place another time with/ without (preferably) the broker! You'll know the truth.

Dos
1. Surf the google maps to locate the areas in the vicinity yourself
2. Check out with the other employees where do they prefer living.
3. Create a profile on Sulekha.com
4. Create an add clearly stating your requirements and if you are really in shortage of money, host it for free!
5. Check out the options on sulekha.com and send SMS to the people offering the same closely related to your requirements.
6. Go out to check the accommodations in person only on the weekends or take a day off and go. (Check don't #2)
7. Talk clearly. For instance: Who owns the devices in the house? Are they willing to share? Are there sufficient cooking utensils? etc. etc.
8. Whenever you are travelling using a public transport, call the various options you have with you. One it utilises your transit time in the best possible manner and second you never know if you get lucky, like me, and get the best matching house!

So, finding a home is not all that troublesome afterall!

Friday, November 25, 2011

Time - My perception

Time flies, when happy
Time crawls, when sad
But what time never does--
is stagnate
Whatever be, time passes by...

It never waits
It never chases
It never was
It never will be
It just is!

Everything happens, with time
However hard you may try
However fast you may rush
However effort you may put
to make it otherwise
Time always sways you by...

When its time you'll only wonder
how things would happen
A barren land
would give tons of harvest
All you'd do then is research on it
Broadcast on the media, giveaway nobels..
But the farmer, true to himself, would
then only smile and move on to the field

Hold on,
to yourself.
Time will take care of the rest.
Don't beat your chest
You'll gain nothing
only it will pain
Loss or Gain
are the sides of the same coin
Time keeps flipping this coin.
Fools you off into being the actor..
in realty time is the director!
So hold on to the coin itself
You'll not be mesmerized or surprised
You'll just be...
like time & love
through eternity!

Friday, July 8, 2011

Intricacies of Failure & Disappointment

There is a simple program which shows that not every disappointment leads to failure. If a proper approach is taken then disappointment proves to be inevitable ingredient to SUCCESS!
In fact there are multitude of stories to learn from like Edison, Nelson Mandela, Einstein, Mark Twain from the history and Googlers: Larry Page & Sergey Brin as well as Facebooker: Mark Zuckerberg. Not to forget our iMan (Jobs) from the recent past, who stood in the face of disappointment but didn't fail...

So what's in the code??

#include "patience.h"

printf ("Disappointment != failure\n"); 
switch(disappointed)
{
  case "Comfort":
    printf ("BEWARE:Don't get trapped in the comfort zone\n");
  case "Solution":
    printf ("SEARCH: Start when you have licked your wounds\n");
  default:
    printf ("BEST CASE: some of both\n");
    printf ("MORAL: It stimulates learning & growth\n");
}


The fall-through switch case construct is the crux of the above code! ;)

Friday, June 10, 2011

Feviquick: Bond with the best!

पकड़े रहना छोड़ना नही.... I heard of this tagline of Feviquick, the adhesive that boosts of bonding any two broken or separate pieces together, FOREVER period. This property has never served any good for me, instead the worst, it has marred the beauty of my mp3 player!!
It was really disgusting to witness this drops of feviquick that spilled on the player at the junction where its USB was capped.., as now the only option as the pidlite claimed is the cap and the player are BOND with the best.. :( 
To ultimately use the player for anything i.e. sharing music files or listening it is evident, the player has to have the property of the USB stick..
A lot of people tried whatever came to their minds.. 
  • nail polish remover
  • knife
  • hot water..
And the one to suffer was only mp3 player and me :(
Finally, some googling and some application helped.. What seemed to work out the separation was a hot knife. We heated the knife and applied it at the specific junction of the body of the player and the removable cap. We did it once, no help. Reheated. No result. Reheated. Voila. The beauty revealed itself!! The task ahead was to see if the machine still had the patience to be used for any good. To my luck, it had!
Check out the photostream of the bonded mp3 player...

Wednesday, May 18, 2011

Generating Doxygen Output

To generate the output of C code using Doxygen, one has to generate a Doxygen Configuration file and customize some options there according to one's requirement. The steps that I generally follow are listed below:

  1. doxygen -g [config-file-name-optional]: if the file name is given then configuration file is named that else it is Doxyfile.
  2. Edit Doxyfile. I prefer it with vim, so
    vim Doxyfile
    Then set following options:
    1. OPTIMISE_OUTPUT_FOR_C = YES
    2. FILE_PATTERNS = *.c *.h
    3. RECURSIVE = YES
    4. EXTRACT_ALL = YES
    5. EXTRACT_STATIC = YES
    6. SHOW_INCLUDE_FILES = NO
    7. Save and exit the vim editor with the key combination [esc]:wq
  3. Now just run doxygen by issuing command
    doxygen [config-file-name-optional]. In my case I write just doxygen
  4. Two folders are created html/ and latex/.
Start browsing your documentation in any browser by clicking on the files.html present in the html/ folder.
To generate pdf we need the latex/ folder. How to generate pdf? Use pdflatex tool.

Tuesday, May 17, 2011

Blogger-posts' URL

One of my habits while blogging is to put the title of the posts before I start scribbling ahead.. But with one of my recent posts I realized that the title once given is used forever for that blog-post, whatever changes you make to the title the URL remains the same.

General format of the URL's of blogger are:
http://blog-title.blogspot.com/yyyy/mm/first-four-words-of-title.html

Suppose you are writing some post about a concept and you gave the title as "Basic understanding gathered about Cloning". Now you would be thinking the URL would at least have the word cloning in it, but that is not so! WHY?
Because, the URL picks only first-four-words-of-title :P
Now if you try to edit the post's title to "Understanding Cloning", only the tile gets changed not the URL!!!

What I did to change to the URL of my post was to create a new post and paste the HTML of the previous post and write the new title of my choice, then delete the older post!! :P
Thats pretty ugly, YUCK! Please somebody suggest a more humane procedure :)

Documentation using Doxygen

Doxygen is a great tool to document the code in a neat style in most of the desired formats like html, chm, pdf, latex and also rtf!  Most of the customization of the doxygen output is possible through the options in configuration file of doxygen, generally called Doxyfile, unless named something else while generation.
All the commands that Doxygen understands are documented here.
Below is a list of some options that I found useful for the documentation of my code, extracted from the above link only:

1. To undcoument sections of code from the doxygen output:

#ifndef DOXY_DOC_SKIP
code-segment-to-skip-from-documentation
#endif

 Define this in the configuration file of Doxygen, which is Doxyfile if no name has been provided while generation of the initial configuration.           
PREDEFINED = DOXY_DOC_SKIP

2. To undocument/document some section from the doxygen comments:
/**
doxygen-captured comments
\if WANTED_ENABLED
doxygen uncaptured comments
\endif
*/

This will disable the documentation of the block in the \if &\endif construct, if at any later stage you want in the documentation, Put the flag in configuration file at the
ENABLED_SECTION = WANTED_ENABLED
This would enable in the documentation.

3. To have numbered documentation:
/**
* -# Numbered list
*    -# sublist
**/

4. To enable the documentation of the static functions in C, edit the configuration file in
EXTRACT_STATIC = YES

5. To enable the hyperlinks in pdf generated by doxygen and have the Table of Contents in the pdf document
PDF_HYPERLINKS         = YES
SHOW_DIRECTORIES       = YES

6. To capture tables and ascii charts/images put in the comment block as it is in the doxygen generated documentation, enclose the section in the \verbatim construct. For instance,
/**
  * - This is just to show the use of verbatim
  *\verbatim
 ________________________
|  S.NO.      | Command  |
|========================|
|     1.      |  printf  |
|     2.      |  scanf   |
| _______________________|
   \endverbatim
**/

Sunday, May 1, 2011

Ubuntu 11.04 and wireless connectivity problem

Wireless connection worked absolutely fine with the Broadcom STA driver on my lenovo machine - i386 until I upgraded to 11.04 when the natty narwhal's wireless connection became actually notorious! ;)
What finally worked for me to get the wireless connection working, Thanks to Eric Moon, is this. The last answer here did the trick.

I was getting the network UNCLAIMED status with

$sudo lshw -C network
PCI (sysfs) 
  *-network UNCLAIMED    
       description: Network controller
       product: BCM4311 802.11b/g WLAN
       vendor: Broadcom Corporation
       physical id: 0
       bus info: pci@0000:04:00.0
       version: 01
       width: 32 bits
       clock: 33MHz
       capabilities: pm msi pciexpress bus_master cap_list
       configuration: latency=0
       resources: memory:f0000000-f0003fff
  *-network
       description: Ethernet interface
       product: NetLink BCM5906M Fast Ethernet PCI Express
       vendor: Broadcom Corporation
       physical id: 0
       bus info: pci@0000:06:00.0
       logical name: eth0
       version: 02
       serial: 00:1e:ec:96:04:3d
       size: 100Mbit/s
       capacity: 100Mbit/s
       width: 64 bits
       clock: 33MHz
       capabilities: pm vpd msi pciexpress bus_master cap_list ethernet physical tp 10bt 10bt-fd 100bt 100bt-fd autonegotiation
       configuration: autonegotiation=on broadcast=yes driver=tg3 driverversion=3.116 duplex=full firmware=sb v3.04 ip=192.168.1.8 latency=0 link=yes multicast=yes port=twisted pair speed=100Mbit/s
       resources: irq:44 memory:b8000000-b800ffff

and with

$ sudo iwconfig 
lo        no wireless extensions.

eth0      no wireless extensions.

Thus I connected to a working wired connection and installed the missing piece of two softwares, namely, firmware-b43-installer and b43-fwcutter; after deactivating the current Broadcom STA driver under Shortcuts->Additional Drivers, section.

Then running the following command activates the newly installed driver:

$ sudo modprobe b43

Still I did not get the wireless lit up as indicated in the post there, and that was because the wireless was not active in my laptop. In my lenovo machine FN+F5 is the shortcut to turn on/off the wireless. So that combination got my wifi finally up!
Now on executing:

 $ sudo lshw -C network 

no UNCLAIMED network was reported...
Also,

$ sudo iwconfig

stated a wlan0 connection!!

Sunday, April 3, 2011

Multitasking and its blunders

Too many things to do. Finally nothing done!

A bird in hand is worth two in the bush! How true this is, I understand now. For me the reality is::: 100 flying birds and 0 bullets in the gun --> FRUSTRATION!!!

Things I want to do:

  1. Map volume keys to answer and reject calls on N900, instead of the touch option.
  2. Automatically answer call in the time set, if headphones are plugged in, thereby saving the effort of picking the phone out of pocket..
  3. Django powered chefschatter.com
  4. Start a food joint-"Ghar ka Khana"
  5. Write an application that helps me keep track of how many Thursday fasts have I successfully completed.
  6. Buy a second hand or not very costly bicycle..
  7. Understand the basic or internals of Linux.. Its been almost three years and I am still a noob when it comes to making use of it.. Troubleshooting still means to me--GOOGLE!! I am handicapped without a working net connection!
Many others...

(Any and all suggestions on how to's for the above list, would be highly appreciated)

The list goes on and on.. These tasks being not organised are running with & in the end and other small tasks like washing clothes, cleaning the room, cooking and earning a living, (the only good part is that atleast my work environment doesn't place me far from my tux.), taking up stupid freelancing projects.. eat up on the time I have.. Yeah, not to forget the time I kill in small talks..

 The big question is will I keep cribbing or break the important tasks into achievable chunks and put them to 'fg' ...

I just wish, I take control on most of the ways I spend the days, hours and minutes of my life.. and at the end I have no thoughts like "what if..", "if I had just done it.."

Its important I learn the most important thing in life - "Stay hungry, stay foolish and stay dirty!"

TBF: Dos an Don'ts

(FYI; TBF may be expanded to: To Be Followed ;)

Friday, March 11, 2011

Playing DJANGO on my N900

Hey this was pretty similar to playing with it as on my laptop.. Linux is in sync.. With a little difference being that the repo of the phone had no django. So the output of following command wasn't quite exciting..

$ apt-cache search django

But downloading django-1.2.5.tar.gz and extracting it using the tar -xvzf extraction, and running the setup.py command as root prepared the instrument for me..


$ tar -xvzf Django-1.2.5.tar.gz
$ cd Django-1.2.5
$ sudo gainroot # assumes gainroot is installed
# python setup.py install


To check if the installation has been successful.. just try out the get_version() at the python prompt..

$ python
>>> import django
>>> django.get_version()
1.2.5

Voila.. All set now just rock'n'roll!!!

Wednesday, February 23, 2011

Vim shortcuts: Efficient Editing

Vim is editors' best friend, like earthworms are of farmers'. I have started appreciating the beauty of the various shortcuts in vim. They make editing so much fun and time efficient. I wonder it would have been really pathetic to not have been introduced to vim-craft!

Here are some shortcuts that I use:
1. To yank and paste: {[num-of-lines]"[reg-name]yy} + {"[reg-name]p}
2. To cut and paste:  {[num-of-lines]"[reg-name]dd} + {"[reg-name]p}
3. a) To move through the file; mark the file: {m[char]} + {'[char]} 
    b) Some inbuilt marks- {''} : Move to the last visited line, {'.} : Move to last edited line.
4. Ctags are very useful when viewing C files.
5. To move to similar parenthesis: %
6. a) Macros to repeat similar series of tasks over and over:
           q[char]                                      #starts recording into [char]
               (steps)
            q                                               #stops recording
     b) To repeat the macro:
           @[char]

To be continued..

Helpful links:
1. Byte of Vim
2. Vim cookbook











What it means "To Stumble Upon"

It means: drink and drive; You'll hit at something, may be it would change the course of your life, perhaps, also the world's development.. Well it definitely doesn't means think and drive..
And now what's gotten into my head that I am blurting out this very well known thing.. Its just that I see it as a problem with myself..
I think the problem with me is that I want to take careful steps and do calculated things in the process of achieving the ultimate thing.. It would be rather better that I start enjoying the journey instead of the destinations. I have not yet started with learning django though I want to learn it since the middle of this year.. Quoting Rajeev Motwani, Sergey Brin's advisor at Stanford- " It wasn't that they sat down and said, lets build the next great search engine, it was that while solving a problem they stumbled on a neat idea.."
What I should be doing now is wander, instead of travel..
What I have been doing so far is calculate the work I would do, the returns the effort would bring, but these calculation and predictions are based on the my little knowledge, formed out of the little understanding of the peer reviews where I land, based on the foolish keywords combinations searched by Google. so its like I have screwed up the whole thing and still i am hoping to find the best..
Let me now get ready for the adventure, fun, spontaneity.. :P

Utility of bitwise operators.

"All the memory addressing in modern machines is byte ordered.", said my Boss, frustrated at my foolishness and lack of comprehensiveness of this fundamental.
What I was trying to do was read bits from the memory as if accessing them out of an array. For instance read the bit-value at position 13, which is actually 5th bit at second byte, considering the buffer I am working on starts with 0. Damn!! It never happened, I was never successful in this endeavor. Why?? The answer to this became clear to me with that single line my boss told me.
This revelation that memory addressing is byte ordered made many concepts fall into place for me. I instantly became clear of the importance of data types like unsigned/signed int/char, big/little endianness.
This may be wierd. But thats how things are many a times, atleast for me. This is something I wasn't aware of. Aware of as in, conscious realization of it. I am sure I have read it many times, thanks to my background.
I became aware of it just today when I was analyzing a hexdump of a frame transferred between two networking layers. I was supposed to program the fate of the packet based on the value in its header field. Thats when it dawned upon me that in order to know what is there in the frame header, I have to use MASK!!
This is where is most of the C functionalities like typecasting, bitwise and (&), or (^), not (!) etc.. , left and right shift operators (<<) (>>), come handy. Below is a code that highlights the basic usage..

#include "stdio.h"
#include "stdlib.h"

int main()
{
        int i;
        int * an_int = (int *)malloc(sizeof (int));
        *an_int = 255;
        unsigned char * a_char = (unsigned char*)an_int;
        for (i = ((*an_int) & 0); i < ((*an_int) & 4); i++)
        {
                printf("byte wise an_int has at %d[th] position char %d\n",i,*(a_char+i));
        }
        free(an_int);
        return 0;
}

Missing element

They wrote of it,
they write of it..
They will write of it..
I had read it
i remember
but took notice of it never..
Time and now I knew
I missed that,
it remained for me unexpressed
I could never touch, smell, see or taste it..
But it was definitely heard and felt around
and when this happened my joy knew no bound
my eyes whispered and my lips saw
and I was in complete awe..
Yes, its that eternal instinct
none can rob you of
no weapon can destroy
AI as of now lacks..
Is completely humane
but missing in humans nowadays
its explicit but not understood
its written but never taught
its the feeling that can never be stripped of..
Like clothes, talent, knowledge, prowess..
Its the salt in the recipe of living!
Its the character of the being..