It’s my life

A blog abt GNU/Linux, Programming, Hacking, my thoughts , life ..

My Digital Signatures :)

Posted by ajay on May 8, 2008

One evening I didn’t have much work to do and I had a look at this page. After seeing the Quote there, I thought why not create one such signature for myself :). And here it is ->

i;double r[]={175297239055116917538816e2,591298870944180608}
;main(){150-i++?*r*+8.,1[r]*=2.,main():printf(r)^puts(r+1);}

Just a little note: You need to compile it using gcc ( g++ wont work ) in Linux.

PS 1: Many thanks to Maruti Borker for helping me in creating the signature.

PS 2: I’ve become foosball addict. For more details check out Maruti Borker’s recent post.

Posted in Programming | 2 Comments »

Success Stories this year: ug2k5 @ IIIT Hyderabad

Posted by ajay on May 3, 2008

Background: The last comment on my last post ( which was about 1 year ago ) encouraged me to write a post. And then after reading Aditya Agarwal’s blog and noticing that he too wrote a post after about 1 year, I thought that finally I should write one today :).

I guess the title explains what this post is about. Our batch has been doing great this year and almost all of my good friends have been able to get decent internships or other great opportunities to work this summer. I’m really happy about it and here I’m going to list the major good achievements by my batchmates this year ( 2008 ) :-

1. Felicity 08 was a great success. It involved a lot of hard work from my batch-mates. Since a lot of people have written about it already, so I guess I don’t need to put that all again.

2. Internships:

a) Amazon: Ankit Saraswat, Anupama Gali, Rahul Tenany, Shashank Agrawal, Sunil Soni.

b) GE Research: MNV Kartheek, Sashidhar G, Saurabh Sharma.

c) Google: Ajay Somani, Ankush Kalkote, Maruti Borker, Ramya Yaragani.

d) Gridstone Research: Subhashish Chand.

e) IBM: Navatha T, Sahiti P.

f) Microsoft: Aditya Agrawal, Gaurav Kharkwal, Harsh Vardhan Bansal, Himank Sharma, Manish Arora, Ojasvi Rajpal, Randeep Singh Banga, Shikha Agarwal, Vivek Prakash.

g) Nvidia: Richeek Arya.

h) Philips: Akash Agrawal, Phani Deepti.

i) Sarnoff: Piyush Nigam, Raveendra Meka, Ravindra Reddy.

j) SkWorks: AK Kartheek, Nitin Jain.

Lydia has got an internship at University of Sydney ( Australlia ). special congratulations to her. [ I have only listed the people who are joining, there are other offers too ].

3. Google Summer of Code: This I consider as the biggest achievement of my batch-mates. This year, 3 of them have got selected for Google Summer of Code. The lucky ones ( or rather, the deserving ones ) are Kulbir Saini, Vamshi Velegapuri, Kiran Kumar M. Kulbir Saini’s mentor is the original developer of Yum. Quite exciting opportunity to work with such a person. Hopefully these people will make some good contribution towards open source.

4. Research Papers: Vibhav Vinet of my batch has recently got a research paper accepted in CVPR. CVPR is one of the top 3 conferences in the area of computer vision. He worked on a parallel algorithm for graph cuts which can be implemented on specialized hardware ( contact him for more details :) ). There are some other people who are sending research papers in various conferences but I wont list them now.

5. Microsoft Open Source Scholar: From this year onwards, Microsoft is also funding open source projects by students in Indian universities provided that they are built around microsoft technologies. Following people from my batch have got this scholarship - Ankush Kalkote, Randeep Singh Banga, Aditya Agarwal, Manish Arora, Vamshi Velegapuri, Kiran Kumar M., Satyanarayana Koneru, Sridhar Duggi.

6. 3 of my batch-mates ( Kulbir Saini, Vamshi Velegapuri, M. Bhargav Chowdary ) have recently got the IIIT website redesign project. They will be working on main IIIT website and also the websites of all the research centers. Good thing about this is that they competed with 5 other companies to get this project and won :).

[offtopic]

This year, I have teamed up with Anshuman Singh (ug2), Gaurav Agarwal (ug2) and we have got decent ranks on a lot of contests conducted by various universities in India. This includes winning the annual programming contests ( some online and some onsite ) conducted by IIT Kharagpur, IIT Delhi, NIT Surathkal, Delhi College of Engineering, NIT Durgapur and Madras Institute of Technology. Anshuman Singh is also one of the top 5 candidates of India Student Mathematika competition conducted by Wolfram research. Kudos to him..

[/offtopic]

I hope these success stories list continues to grow like this in the next academic year too :). I will end the post now..

PS 1: I’m getting a lot fatter because of the good food at Google :D.

PS 2: If by mistake, I forgot to include anyone’s special achievements or anyone would like me to list them here. Please drop me an email, I will gladly update the post.

PS 3: I don’t know if someone else already posted something like this, I don’t read blogs often.

PS 4: Nightouts at Google office :), god I’m crazy..

Posted in My thoughts | 12 Comments »

Guys/Girls I appreciate the most in IIIT-H

Posted by ajay on May 14, 2007

I feel like writing a non-technical post after a long time.  I’ll come to the point now ->

Our Batch ->

1. Abhilash I -> Very good friend of mine. One of the most hardworking guys in our batch.

2. Aditya Agrawal. -> Mr. sophisticated. Gifted with lots of talents.

3. Myself  -> :D

4. Alok Kumar  -> Very very friendly in nature.

5. Ankush Kalkote  -> Excellent thiking capabilities. Always ready to help.

6. Gaurav Kharkwal. -> Perfection in everything he does.

7. HarshVardhan Bansal  -> Always “right”. He is very very lucky as well. ( things always turn out well when he is involved ).

8. Kulbir Saini -> truly a “BOND”. Its always fun when he is around…

9. Nitin Gupta -> Again very friendly in nature.

10. RS Banga  -> Very well mannered and nice guy.

11. Sashidhar  -> Highly intelligent and yet very polite.

12. Sambhav Jain -> A very kool and relaxed person. No anger what so ever.

13. Shikha Agrawal.  -> Very intelligent and friendly. The only girl I appreciate here.

14. Shrikant Nigam. -> A very down to earth guy. Very helpful.

Seniors ->

1.  Vishesh Kumar Uday. -> A source of inspiration for me from the very beginning.

2. Paresh Jain. -> A very helpful person.

3. Nirnimesh. [ not in IIIT-H anymore ]. -> Very Very intelligent. I love his mails.

4. Sandeep Kumar. -> Exceptional programmer, very helpful in nature.

Thanks to all of you for being here with me.  Cheers !!!

PS 1: I Don’t feel like doing any useful work since many days.

PS 2:  I tried but I didn’t get any internship this summer. Still a “berojgar”.

Posted in My thoughts | 12 Comments »

Sudoku Puzzles…… I love it. :)

Posted by ajay on January 16, 2007

I am writing a post again after a long time. Didn’t write one primarily due to the fact that I was very much busy these days due to Hectic schedule at college and ofcourse some other things ;). Anyway In vecations I wrote a kind of interesting c++ program to solve sudoku puzzles given in daily news papers. The program uses backtracking and thats why It’s complexity is exponential in general. But still on most of the puzzles that I tried; It works very fast ( almost negligable run time). You can download it or have a look at it here. If you find input puzzles where it doesn’t work ( bugs ) or you have better ideas to solve a sudoku puzzle ( in terms of run time ofcourse ), then please post it as a comment.

PS 1: The program is primarily written to solve puzzles of size 9 x 9. but can be easily modified to solve a bigger puzzle.

PS 2: I have been trying to solve this problem. But my idea doesn’t seem to run in time :(. If anybody solves it, please post a comment about the idea used to solve the problem.  ).

Posted in Programming | 8 Comments »

Setting up new keywords for programmes in ‘Vim’ .. good one ..

Posted by ajay on September 8, 2006

Recently I was working on my Operating systems assignment .. and I saw one thing .. all the primitive system types like pid_t , mode_t , dev_t , nlink_t  etc etc .. does not come coloured in vim editor like common types like int float etc .. do . I mean whenever you type int its color will change as the vim editor recognizes it as a keyword ( more specifically a datatype .. ) but it doesnt recognizes all the uncommon primitive system datatypes .. like pid_t etc etc .. I thought it would be nice to have those words coloured as we have int and stuff . that way editing will look more beautiful .. after some googling .. here is what I find ..

all the keywords are related to syntax .. so for creating new keywords . first of all we have to create a class of words .. for that we use the syntax command .. for example suppose for a C program you want to highlight some words I mentioned above as datatypes .. what you do is in the vim configuration file specific to C programmes ( Previously I told how to have specific configuration files for specific file types in vim here ) we write the following lines ..

syntax keyword cSysvar pid_t mode_t something_t x_t

highlight link cSysvar Type

now here cSysvar is the name of the class which you want to create . you can have as many of these classes as you want but the class name should begin with the file type you want to edit .. ( the same class in a cpp file will be named cppSysvar ) and the next character should be capital to distinguish the extention from the class name . ) .. now all the words written after cSysvar in the first line are the elements in the class cSysvar .. now the second line tell vim to recognize all the elements of class cSysvar as they are the members of class ‘Type’ ( Type is used to recognize datatypes ) ..

some other alternatives of type are as follows ..

Type -> datatype

Comment -> comment

Error -> syntax with errors ..

Number -> the color used for displaying numbers ..

Character -> used to represent single characters ..

there are some other also .. like Identifier , Underlined, Ignored , Delimiter, Statement , Preproc ( proprocessor directives ) .. and many more .. so you can change the last word in second command to have variation in the color used to display those particular words ..

and after these 2 commands whenever you open any C program vim will display those words ( written in the end of first line ) in a different color ( same as the color of the built in class you specify in the second line ) ..

I hope this will make Vim more beautiful ..

Happy Viming ..

Bytheway .. I recently got through in the Qualification round of Google Code Jam 2006 .. and the next stage will held on 14th of september . :) .. looking forward for that as well as Topcoder Collegiate Challange ..

Posted in Linux | 9 Comments »

you suggest any title ..

Posted by ajay on August 8, 2006

I’m back on wordpress after quite some time . Classes have started again.. and i should mention this time its a cool semester in terms of classes .. but we are given lots and lots of assignments ( specially in Operating Systems ) .. and no need to mention most of them are very “easy” though they  are tough ;) .. I heard somebody starting a so called “copier” blog .. and by the time I was able to copy anything, it was already deleted :d . Anyways ..I do have some points to share with the ones reading  this post ( If any :) ) ..

1.  My source Code for the OS Assignment 2 ( a programme to mimic the behavious of unix utility ‘ls’ ) - and it does the job quite reasonably well ( in most cases the output will match byte by byte with the original ls ) .. the options supported are -a, -b , -t , -R , -l ( I have explained them in the source code itself ). Since the deadline is over now my code can be safely accessed from this page . It’s a long one ( 615 lines ). The code is self explanatory and I suppose I have written enough comments ( coz this was also there in the problem statement .. usually I don’t have the habit of writing comments ) ..  and any comments regarding bugs in this code .. or any better ideas / algorithms are most welcome ) ..

2. Topcoder international Collegiate programming contest is coming soon and this will be my first big event on topcoder ( I hope to do well in this ) ..

3.  I have taken new project under Prof. Kamal sir .. and this time also my partner is my friend Parminder Singh. This time its related to blogs ( a topic quite new to us ) .. and this will be our ITWS 3 project too. I was buzy learning CGI ( in Python ) , and Java Script for the same and will start learning Ajax soon. The good thing is we will work in CDE lab ( wired rocks ) .. from now onwards.

btw I got a pretty interesting trick in a javascript tutorial . Normally if we write java scripts in our pages and some syntex is wrong or there is any error that particular part is not displayed properly or sometimes not displayed at all .. and we usually end up wasting around 1 hour or may be more for just a tiny spelling mistake . to avoid from anything of that sort,  what you can do is append these lines to the javascript written in the head section of the html document  ( or write this script in the javascript source file if you are using external linking ) ….

// make sure these lines are executed at the time of loading of the page ..

onerror=handleError
var text=”"
function handleError(msg,url,lineNumber){
text += “Error:” + msg + “\n\n”;
text += “Url:” + url + “\n\n”;
text += “Line Number:” + lineNumber + “\n\n”;
alert(text);
return true;
}

if you do this .. then from now onwards the html page will give you alerts about the errors along with the source file name and line numbers when you try to open the page in browser .. this might be very helpful sometimes .. in debugging purposes specially if you are not using any IDE for coding.

and last but not the least

1. Thanks a Lot to turbo and Ankur Jaiswal sir for helping me with #1 ( ls thing ) ..

Posted in Programming | 1 Comment »

Some good looking codes and interesting problems ..

Posted by ajay on July 21, 2006

recently .. while googling for solutions ( ;) ) of various problems .. I found some awsome codes .. written in various languages to do some tasks .. I’m not able to understand most of them .. but I find them worth sharing with my friends .. so … I’m writing a post devoted to those codes ..

1. A c programme to solve tower of Hanoi problem .. this one uses no function .. neigher any recurtion .. or stack or anything for that matter and does the tast in 6 lines .. and see the indentation style .. it just looks like a tower :p ..

main(
){int
z,y,n
;scanf(”%d”,&n);
for(y=1;(1<<n)-y
;y<<=z-1,printf(
“disk %i from %i to %i.\n”/**/
,z,(y&y-1)%3,((y|y-1)+1)%3),y
++)for(z=1;!(y&1);z++,y>>=1);}

2. The queen of problems .. N queens problem . .- If you are a computer science student .. you must have heard about n queens problem and probably solved that too .. and this C programme does that .. but .. this programme does it in quick time .. and for the rest .. just look at the code :) ..

int v,i,j,k,l,s,a[99];main(){for(scanf(”%d”,&s);*a-s;v=a[j*=v]-a[i],k=i<
s,j+=(v=j<s&&(!k&&!!printf(2+”\n\n%c”-(!l<<!j),” #Q”[l^v?(l^j)&1:2])&&++
l||a[i]<s&&v&&v-i+j&&v+i-j))&&!(l%=s),v||(i==j?a[i+=k]=0:++a[i])>=s*k&&
++a[--i]);printf(”\n\n”);}

yeah .. to this code just give the value of n as input and it will print the chess boards of all possible solutions .. check this out and thats it ..

3. another code to print first 15000 digits of pi .. this time written in C ..

a[52514],b,c=52514,d,e,f=1e4,g,h;main(){for(;b=c-=14;h=printf(”%04d”,
e+d/f))for(e=d%=f;g=–b*2;d/=g)d=d*b+f*(h?a[b]:f/5),a[b]=d%–g;}
isnt it amazing ..

4. an interesting problem ..

what is the “condition” such that .. this snippet of code prints HelloWorld!!

if condition

printf(”Hello);

else

print(”World!!);

my friend abhilash gave a nice solution for that ..

if ( printf(”Hello”)<0){

printf(”Hello”);

else

printf(”World!!);

5. Another interesting problem .. ( I am unable to find the solution of this one yet :( ) ..

Write a small C program, which while compiling takes another program
from input terminal, and on running gives the result for the second
program. (NOTE: The key is, think UNIX).
Suppose, the program is answer.c
Then, while compiling
$ cc -o answer answer.c
int main()
{
printf(”Hello World\n”);
}
^D
$ ./answer

Hello World
$
if anybody can solve this problem .. please let me know by commenting over the post .. with the solution

Happy coding ..

Posted in Programming | 12 Comments »

Some Special Codes ..

Posted by ajay on July 16, 2006

I was solving problems some time ago and came to know some good facts about c and c++  …….and wrote some interesting codes ..

1. A C programme which can print the file name it is kept in .. ;) ..

#include<stdio.h>

main(){

printf(”the source file name is %s\n”,__FILE__);

}

actually __FILE__ is a macro which stands for the file name the programme is kept in and the compiler does the rest .. for you ..

2. usage of assignment suppression operator in scanf .. — Suppose you have some crap input ( by crap I mean that the input is provided to you but that is not of any use to your program .. ) .. then what normally we do is take a dummy variable and scan the input in that variable ..

for example if you have to scan a integar which is of no use .. then what you do is

int dummy

scanf(”%d”,&dummy);

but there is one more method which can save memory and time

what you do is

scanf(”%*d”);

In this method .. we provide a character * to the scanf function and by doing that .. scanf will scan the input from standard input .. but it wont assign it to any variable .. ( this is scanned in a buffer of sufficient size .. and you dont have to worry about that ) ..

3.  my source code for problem KAMIL on spoj .. ( the best code in c language section .. ) ..

x=1;main(){for(;scanf(”%*[^DFLT\n]“)+1;x=getchar()<11?printf(”%d\n”,x),1:x*2);}

if anybody has a better idea on this problem .. then please do comment on the post ..

4. printing something in  variable width .. -

suppose you are to print some formatted output in some programme and for that sometime you require to print a variable in a fix width ..

for example if you have to pring an integar in width of 5 or more then you do

printf(”%5d”, var);

now if var is 10 it will append 2 leading spaces to complete the atleast 5 width rule ..

now suppose you dont want leading spaces but leading zeroes .. then here is another method to write the same ..

printf(”%05d”,var);

now if var is 10 it will print 00010 .. and so on

another condition comes if the width in which we want to print the variable is not known at the compile time .. saying that in other way suppose you want to print variable in a variable width which is contained in another variable x

then what we can do is

printf(”%*d”,x,var);

here x is the width length whenever we do this * operator .. then it looks for the next integar argument provided in the arguments and then  assumes that it is the width in which  the variable is to b printed ..

now if x = 2 then it will b the same as

printf(”%2d”,var); ..

this way we can work with this width thing pretty well ..

if any of you guys know some nice facts about c or cpp language .. then please post them as comments .. any gud suggestions related to things I posted are also welcome .. njoi coding .. :p

Posted in Programming | 12 Comments »

Installing color schemes for Vim editor ..

Posted by ajay on June 24, 2006

If you are busy programming all the day .. like some persons are and you are getting bored with the default color scheme of vim editor .. ( by color scheme i mean like in a .cpp file vim shows specific colors for different keywords .. that alltogether can be called as a color scheme .. ) .. Here is an idea .. you can install some color schemes for vim editor as you want and then you can switch between them ..

for installing color schemes first you need to create two directories in your home directories ..

[user@localhost.localadmin]mkdir ~/.vim [enter]

[user@localhost.localadmin]mkdir ~/.vim/colors [enter]

thats it your pc configuration part is done .. now you will need the theme configuration files .. you can download the latest color schemes and many old ones from here ( frm the official website of vim editor .. ) ..  Here are many themes to suit your mind and mood ..

now for each theme or i better call it a color scheme you will get a .vim file or an zipped archive which after extracting will produce lots of .vim files

now you have to copy all the files to the directory .vim/colors in your home directory ..

suppose the theme you downloaded is matrix.vim then ..

[user@localhost.localadmin]mv matrix.vim ~/.vim/colors [enter]

thats it ..  now whenever you are editing a file and you need to change the color scheme

just go to normal mode and do

:colorscheme matrix

and yeah .. all the appearences change .. :p .. similarly you can copy as many files to that directory and use those themes whenever you want to .

Now if you want a theme to b ur 'pet' or default theme then what you do is

in .vimrc of yours append this line

colorscheme matrix 

and from now onwards whenever you edit a file it will switch the scheme to matrix at the time of opening the file and you dont have to do this each time you edit a file ..and yeah now vim looks better then before .. :p 

and if you are interested in designing the themes of vim editor you can as well do that also ( I have not designed any theme as of now .. ) by looking at any config file for any color scheme .. what you have to do is just change the variables ( I mean the color values which are written .. ) and you can design you own theme for vim editor .. :p ( I am still not sure whether it works or not but .. I think it should work ) ..  

Enjoy Viming .. :)
any better ideas are always welcome ..  

Posted in Linux | 3 Comments »

Programming freaks @ ug1

Posted by ajay on June 22, 2006

While doing C programming assignments .. We all used to CURSE the prof and all .. but after SMR and Uday Vishesh .delivered a lecture about topcoder and all .. many people were programming out of interest not due to enforcement by the prof .. first we people started on topcoder .. but after that started on ACM Valladoid Online Judge and Sphere Online Judge as well . Plus we started taking part on many online programming contests as well like bitwise, bytecode, ICPC, Google India Code Jam etc ..

some of the people from ug1 who are coding are

1. ACM Valladoid Online Judge ( acm.uva .. )

Name No. of Solved Problems Rank ( India ) Rank ( world )
Ajay Somani 108 39 2261
Kulbir Saini 38 85 5216
Sharatchandra Pinapati 13 10630
Atul Kumar Dwivedi 10 12313
Maruti Borker 06 15875

2. Sphere Online Judge ( SPOJ )

Name No. of Solved Problems Points World Rank
Ajay Somani 38 13.2 229
Abhilash I 32 11.8 244
Maruti Borker 23 6.8 354
Sharatchandra Pinapati 19 6.5 362
Sunil Soni 13 3.2 560
Kulbir Saini 7 .9 1064

3. Topcoder

Name No. of Competetions Rating School Rank Country Rank
Ajay Somani 1 1571 1 18
Shikha Aggrawal 2 931 381
Maruti Borker 3 632 23 827
Kulbir Saini 3 602 24 861
Atul Kumar Dwivedi 3 590 25 875
Vivek Prakash —- —–

If anybody from our batch if programming on these sites and his name is left out due to my mistake .. Plzz let me know about it

and Thanks to

1. SMR, Uday Vishesh, Vardhman and Manikandan sir for their motivation.

2. Turbo for his classical effort for this ranklist of top 100 Indian coders at ACM UVA.

Posted in Programming | 3 Comments »