a little progress

This one goes to my mentor, Kushal Das, who has been running after me for my project for more than a week 😛 Kushal, I’m really sorry I was not being able to blog daily as you suggested me to; actually here in the midst of all these classes, tests and assignments in college, I was not getting suffcient time to sit with my work these days. But after much effort I did manage to get something. I have pushed one file in my git repository, please go through it.

The program I wrote will print the frequency of all the commits made in the ‘master’ branch of my repository and the respective month in which they were made (if only of course my repo has already been cloned by the user). Now all I gotta do now, is make this program universal (working for ANY repo) and then generate the required graph using matplotlib 🙂

installed matplotlib

just installed matplotlib and am now learning everything about it from a pdf which i got from the site http://matplotlib.sourceforge.net/Matplotlib.pdf. Btw I decided to jump directly to matplotlib without touching prettytable because I just want to complete my project as soon as possible, and get that “blissful” feeling I have been yearning for, for so many days. I hope I’ll be able to complete my work in a couple of weeks from today!

What I had to go through for not using the latest Fedora

I wanted to install pygt2 in my fedora16 machine. So I was going through the steps of installation given in the site https://github.com/libgit2/pygit2. Now, before installing pygit2 you need to install libgit2 first. So I followed the steps given in the site http://libgit2.github.com/ and it did install successfully, but unfortunately it was not working out for pygit2. So I asked Kushal Das what could be the reason for pygit2 not being able to get installed in my system, and he said that it was because I was using fedora 16 not 17. It would have worked smoothy for F17 but not for F16. For F16 “sudo yum install pygit2” wont work, but instead there are srpm files available for both libgit2 and pygit, which we first need to BUILD, in order to install them. Fortunately I will not have to do that work for myself because Kushal has promised that he’d build it for me 🙂 So, after i heard the above, I was instructed that I’d need to delete all the files of libgit2 first, before proceeding to the srpm building.

So I did a little googling and found this site http://www.cmake.org/Wiki/CMake_FAQ#Can_I_do_.22make_uninstall.22_with_CMake.3F and got to know the command needed to uninstall all the files required.. Now all I’m waiting for, is to get the build of the srpms of libgit2 and pygit2 🙂

My adventures with ‘Pro Git’

It’s been a long time since I wrote my last blog, maybe because I didnt get much time to work on my project recently, or because of too much ‘temptation from social life’ in college, or maybe because I just simply could not figure out how to actually start! Honestly speaking I guess it was because of the last option, I was trying to understand everything at once, when actually I didnt even know the basics or the root of the whole concept with which I have to be dealing with. Thankfully, I was suggested to take a few steps in learning first, and first understand about what “git” is all about

Well, so that was my motto… learning everything about git. So I opened up my e-book called “Pro Git” and started reading continuously from the first chapter. It was a really nice book, and the best thing about it was that everything was explained so elaborately that it would be pretty difficult for some one to NOT understand a concept 😛

Well, so I kept reading.. Actually I was having absolutely no idea about this project-handling and version controlling systems, leave out distributed vcs. So it was really interesting to read something which was entirely new to me.. Well, this, is what I learned from the book:

Git, is nothing but a platform, in which people can “keep” their projects, and handle the changes made to the files, efficiently.. Its more of like a virtual desk in which you can do your work, and its perfectly suitable for any large project you want to do. We can “clone” into a git repo, and create directories in our home computer’s hard drive, change and do any modifications to them, and then “add” them to the “platform”.. Actually I should not use this term platform any more, as it is officially called the “staging area”. Whatever, the thing is, we can create, modify, delete or make ANY changes to the files present in the hard-disk (officially known as the “working directory”) and when we are satisfied with it, we can simply “git add” them to the staging area, ready to be committed later. Now, after doing a part of the work, if you feel that that portion of the work is completed succesfully and no further changes would be needed later, then you can “commit” them by giving a suitable message telling the readers what exactly you have completed. Now this committing is I guess nothing but saving gedit file I guess, the only difference being that in this case, you’re saving a PROJECT, not a FILE 🙂  Another thing which I learned is that in git, when we save a part of our work by committing, they are not saved as “differences”, but are instead saved as SNAPSHOTS! The whole picture of what the condition of your project looks like, is taken a snapshot of, and it is saved. Infact, if a file is not changed, that file is not even considered and in the snapshot it can be seen for itself, the state of the file I mean. Quoting from the book:

The basic Git workflow goes something like this:
1. You modify files in your working directory.
2. You stage the files, adding snapshots of them to your staging area.
3. You do a commit, which takes the files as they are in the staging area and stores
that snapshot permanently to your Git directory.

I have also learnt about how we can clone into an existing directory, thus creating a directory in the hard drive of our computer thus making it much easier for us to work on the project while we are not online. In fact, there’re many things that can be done completely offline via git, but those which cant be done by other vcs’s. We can also check the status of the files in my repo by the “git status” command, and also make git to “track” files by “git add”-ing the file we want to be tracked. Basically what happens is that when we “add” the file it simply comes to the staging area! Another important thing is there: that even if we DO add a file, if we modify the file later.. while commiting, it will NOT take snapshot of the modified version but take the previous version only, since i did not “add” that file after modifying it.. smart! 🙂

Also, sometimes if we find that the command “git status” is too vague, then we can use the “git diff” command. It will show you the exact lines added and removed. There are many other formats of showing different kinds of info on what is present in the staging area and what not, but i’m not going into that!  Now let me come to the main thing.. Committing your changes. For that we can simply just do a “git commit” command which will take a snapshot of the current condition of the satging area.. and open a vi editor where it will ask for your message, OR, we can give that message in the command line itself by using the “-m” extension with the command and the message writing in double-quotes 🙂 We can also skip the staging area completely by providing the -a option with it, thus staging every file that is already tracked before doin the commit, letting yo skip the git add part completely. Now for removing files toh we can simply do “git rm” followed by the filename, and the file will be deleted ffrom the staging area, that’s no big deal..

Coming to the Commit History, we can view it using “git log” command which will show clearly the author, email-id, the MESSAGE, along with the date and time as well, in a nice structured manner. Actually I guess THIS is the area in which I need to focus on, for my proect!

Anyway, I guess I did cover up with the basics of Git, and must be able to work on it now without any difficulty. I have got the basic understanding about what it is, so now Im just gonna skip to concentrating on my main project, and referring to the “Pro Git” book in case I find something I would need to know in order for me to work on my project

Hello world!

I started my technical life from the day I had come to NIT Durgapur, leaving behind the worst college I had been studying in so far (maybe a week or two), Jalpaiguri Govt. College..and showing the cold shoulder to a couple of seniors I hated like hell!! My life actually opened up after I came here in NIT-D with too intellectual an environment for you to not do any work, too friendly an atmosphere, and too good the teachers (though the 1st year profs sucked, but the 2nd year ones are good). Anyway, just after the 1st year ended and I was living my utterly boring life at home during the two and a half months of summer vacations, my brother Samikshan Bairagya suggested me to take part in a summer training program. It was called ‘I know what you will do this summer’.. Well, so I checked out the site, saw that it’s free, and so I enrolled in it..

The classes started, I was loving it.. Actually our main teacher for this program, Mr. Kushal Das, currently an instructor at #dgplug which is a channel on IRC, in the beginning introduced everyone to a very strong and intelligent sense of humour which I just really loved, man.. You guys might not believe it but I just used to roll on the bed laughing while he used to mock some stupid people online.. His words can have that sting very finely, but with every reason to do so! Me and Shouvik (same college) used to love it and gossip amongst ourselves about it.. Maybe these classes were a tension breaker, and so I eagerly wanted to continue with it..

Plenty of laughs, lets come to the main thing.. We got used to his nature, so didnt ROFL so much now.. Classes got serious, we were started being taught python by none other than Kushal Das.. Actually he has even written a book on python as well “Python for You and Me’. One special reason I preferred this book, was because, firstly it was SHORT, and secondly, the book was written in such a way, that it need not write long passages to make the reader understand stuff, all that was needed, were some appropriate examples.. a really clever approach to efficient learning, which I really liked very much. So I learnt python, fairly well also.. Infact I had started to become so fascinated by this utterly easy, small but incredibly powerful language, that along with the programs that were given to be done in the online classes, I even devised some programs MYSELF as well.. such as the  program I wrote which would print the names and budgets of the top 350 All-time worldwide top-grossing movies according to the descending order of their BUDGETS (not the earnings).. and it was a success.. This python language is so cool, man.. just 7-8 lines can move mountains!!

Anyway, all said and done, finally I got to work on a project.. my work is to write a tool which can create plots/graphs of the commit history of a git repo. So I started working on it.. First of all I didnt even have any idea about what the hell this thing named github actually was. But thankfully my brother helped me a lot in making me understand it, and Chandan Kumar (a final year student of BC Roy College) helped me tremendously in guiding me step by step about how to use Konsole to use git repo’s and clone them, how to use SHA keys and all.. everything was told me by him, thanks to him for that!

Now one thing that Kushal had told me on the day of giving me the project, was that I have two options in terms of libraries, one is python-dulwich, and the other one being pygit2.. So I googled about them.. but sadly speaking, all they used to explain about these, contained whole bunches of really technical terms, and it was really difficult for me to understand about what exactly IS it, and how the hell to use it ??  And in college we got hardly around 6 hours free time in our hostel room, out of which, almost 90% of the time HAD to be wasted in meaningless social activities, I just couldnt concentrate on my work by any means.. I called my brother, but he was busy with gsoc and all.. Even Shouvik left this training so I couldnt even ask him! And here my teacher Kushal Das was pissed off for writing rubbish in the readme file of my git repo! (He didnt know that I was having no idea about what I was suppposed to do) Just in the middle of all this, my grandmother died.. MORE trouble! I just thought of calling it quits, but no I thought that I’d keep trying.. So finally today, after some suggestion from Kushal himself, I got to learn everything about git.. I learnt it from the following three links: http://en.wikipedia.org/wiki/Distributed_revision_control http://en.wikipedia.org/wiki/Source_code_management http://en.wikipedia.org/wiki/Git_(software) and managed to get an idea about this whole new concept on commits and repositories that has been boggling my mind for a week!