Vijay Krishna's Notes http://vijaykrishna.posterous.com Most of my notes as a student of computer software and everything around it. posterous.com Thu, 14 Apr 2011 06:30:09 -0700 Inverted Indices http://vijaykrishna.posterous.com/inverted-indices http://vijaykrishna.posterous.com/inverted-indices The first time i came across this data structure, i was quite ashamed of the fact that i did not know of it earlier. This seemingly simple concept eases the complicated process of search by leaps and bounds. Most of what i know about this is really a whiff of the top layer of this amazing heap of brilliance. I got most of my introductory notes about this concept from its Wikipedia page. Now, in order to understand this concept of data structuring, or rather to understand it better, lets have a look at Forward Indexing. Let us assume that there are three files, t1,t2 and t3 with the following data: t1 - "an apple" t2 - "a day" t3 - "an apple a day" Now the forward index of the file would look like this: T1 = {"an", apple} T2 = {"a", "day"} T3 = {"an", "apple", "a", "day"} Thus, in order to search for a word like "a", you have to do a sequential search of all three text files for a satisfactory result. This, seemingly simple approach mind you, is a time consuming and complex process as the data set gets bigger. Here we have about 3 text files with not more than 4 words per file with a search query containing one single lettered character. Things are bound to get slow and difficult when you are looking at say about a Million files, with a minimum of 10,000 words in each file and a full phrases sentence for the search query. And imagine doing this again and again. Now, let us look at the Inverted Index: I(an) = {1,3} I(apple) = {1,3} I(a) = {2,3} I(day) = {2,3} I(a) => Index for the word "a" and its results imply the file numbers where the word can be found. So, in order to find the location of the word "a", you really have to goto I(a) which gives you 2 & 3 which are the files where the word is located. It gets better when you have to search for a string of words together, say "day apple": You take the intersection of I(day) and I(apple) for you to get this: {2,3} n {1,3} = {3} Hence 3 is the only text file where the these two word come together. This makes search fast and efficient. Something which we have always been trying to do. Let us take this a step further: What if we were to start storing the position of the words in the text files along with the text file's numbers in the inverted index. So the inverted index would then look something like this: I(an) = {(1,1), (3,1)} I(apple) = {(1,2), (3,2)} I(a) = {(2,1), (3,3)} I(day) = {(2,2), (3,4)} where (3,1) would imply file 3 and word 1. So now when u search for "an apple", you will not only be able to match the words but also the sequence in which they appear in the query string with that in the file: I(an) = {(1,1), (3,1)} I(apple) = {(1,2), (3,2)} I(a) = {(2,1), (3,3)} I(day) = {(2,2), (3,4)} So this elegant data structure is very fast and has been instrumental in all kinds of information retrieval systems, right from search engines to DNA matching algorithms. Tell me, did you know of this one before hand?

Permalink | Leave a comment  »

]]>
http://files.posterous.com/user_profile_pics/1369599/pic.jpeg http://posterous.com/users/hcGXxsTkwP6SS Vijay Krishna Palepu vpalepu Vijay Krishna Palepu
Mon, 28 Mar 2011 05:10:20 -0700 The IT Cottage Industry http://vijaykrishna.posterous.com/the-it-cottage-industry http://vijaykrishna.posterous.com/the-it-cottage-industry My mom is a brilliant chef! The best there is! She has had about 30 years of cooking experience and she has been at since she was twelve. Similarly, my colleague's father is a master automobile engineer and has been working with vehicles for a great deal of time now. Many of my uncles are profound at their religion and mantras. This is a generation that we look at with great pity, since they did not have the power of information and computing at their disposal. Well, atleast that is what i hear when people talk about them. And it is hilarious to say the least. This is a generation which might not have had Wikipedia or Google at their disposal, but were equally and perhaps more knowledgeable and experienced in certain things in their days than what we are today. They did not have information at their disposal, but rather they hunted it out, and held it close and together even after all these years. That is information you cannot ignore, that is knowledge that we must not let go of. So as i sat about doing nothing fantastic at office, i realised the amount of value, monetary, this information had. You are talking about expertise gained over 30 years, in very specific areas ranging from South Indian cuisine, Motor bikes and Sanskrit mantras. Most of these things from our culture as human beings. Mind you, such knowledge has not surfaced for the first time. In the past due to poor means of information storage, rich volumes of information was lost as it was passed down as word of mouth from father to son and mother to daughter. I can not even imagine the magnitude of loss that has taken place already and shudder when i realize that we are on the brink of making a different set of errors, but with the same results; loss of knowledge all over again. What is most alarming is the fact that, this is happening when technologies concerning information storage and retrieval are at their beastly forms and only seem to be getting better. What a pity it would be if we allowed our over arrogant selves to ignore the rich knowledge slip away just because we can never bring ourselves to respect our elders because they could not learn how to use a computer. So speaking a little more about the value of that information, (and do not get me wrong here, i used and will continue to respect my parents even before this thought came to my mind) let me put it this way: in the olden days when India was stepping into Industrialization, there was  a calling to the villagers and rural segments to help out the process by running small scale industries from their homes. These industries would be based on arts and crafts learnt in one's family, perhaps as a tradition even. This was popularly dubbed as the Cottage Industry, an industry which existed in most households of the nation, especially in the rural fixtures. A fundamental purpose of such a growth was also to keep those arts and crafts alive by giving them a sound industrial backup and economy. A similar situation has come about with the information that i was speaking about in the preceding paragraphs. It is time that the Industry of Information Technology, called upon the previous generations and encourage them to record their information for their own monetary gains. Blogs, personally developed websites and, even notes and pages on Facebook perhaps. And using these methods and means would just be scratching the possibilities for a full blown information revolution. Never do i claim that such activities are not taking place. All i say is that there is a dire requirement to make those actions and effort a lot more deliberate. Encourage our elders to blog to start with. That I think will be a great start!

Permalink | Leave a comment  »

]]>
http://files.posterous.com/user_profile_pics/1369599/pic.jpeg http://posterous.com/users/hcGXxsTkwP6SS Vijay Krishna Palepu vpalepu Vijay Krishna Palepu
Thu, 24 Mar 2011 15:38:12 -0700 The way of the Hackers http://vijaykrishna.posterous.com/the-way-of-the-hackers http://vijaykrishna.posterous.com/the-way-of-the-hackers
To follow the path: look to the master, follow the master, walk with the master, see through the master, become the master.
The path here means that of a hacker. You see, a hacker is not someone who breaks into your computer and steals all ur information or burns down your PC. No, that is a Cracker. A Hacker on the other hand is an engineer who forms the backbone of the world of engineering and technology. He is in a way responsible for how things run. He is very learned and very intelligent. And by that means, yes, he can break into another's computer and do a lot damage. But he does not. He is the so called Ninja of the information and electronic world. Sadly many have misinterpreted this possession of knowledge in the negative manner as i just described. This largely due to those, who have shallow understandings of the technology and engineering that has gone behind things like the IC and the Internet. This shallow knowledge can and is used to carry out illegal things, electronically. They are the Crackers. But trust me, Hackers are nothing like that. They do not have shallow levels of knowledge. They are the masters of their domains. They are the great engineers and scientists in the world of Information and Technology. Unlike a Cracker who goes by an alias, they never conceal their identity. They are proud of who they are. And they never hide it. They not only respect and understand Computers and wires, but also have great respect for other things alike. Music, Art, Culture. They are patrons to many things which require great volumes of intellect and understanding. They are good listeners and never arrogant. Two qualities that Crackers can never possess, simply due to the fact they they are light and high on knowledge. A Hacker is always down to earth. A hacker is many things, but not a thief. This is the way of the Hackers. I might sound dramatic here, but check it out for your self: Go and Google, "How to become a Hacker", or goto this link::http://catb.org/~esr/faqs/hacker-howto.html

Permalink | Leave a comment  »

]]>
http://files.posterous.com/user_profile_pics/1369599/pic.jpeg http://posterous.com/users/hcGXxsTkwP6SS Vijay Krishna Palepu vpalepu Vijay Krishna Palepu
Tue, 15 Mar 2011 17:38:24 -0700 My favorite Class in College http://vijaykrishna.posterous.com/my-favorite-class-in-college http://vijaykrishna.posterous.com/my-favorite-class-in-college I am a Computer Engineer. And i love my subjects. Having said that, i never really enjoyed any class in college when it was to do with computers to be very honest. I like doing practical work. Thats my nature. You can not change it. So that probably restricted me from doing a lot of work in class as such. And practicals would be taken care of in the hostel rooms rather than the practical laboratories. Again, fact of life, i hate working on someone else's time frame, a time frame mind you. Give me a deadline, and the work will be delivered. Do not give me schedules. And for the better part of my engineering it work rather well. But, i am not going to talk about the classes i did not attend or the ones which i did not enjoy. I am here to talk about the one set of classes i did enjoy. In my first year where everyone is taught the basics of all forms and tools of engineering, i was introduced to Engineering Graphics, as one such generic tool of engineering. Never really understood why, but was thankful to God, for having such a subject. "Why", you ask? Simply because, there were no theory classes to it. All work was practical. All work was on ground. There was little drama and more substance. And there was true learning and thinking. I liked the fact that the lecturer was tough on us. it was a difficult subject and people failed in it all the time. That always kept me on the edge of my seat in those classes. I had always liked, rather loved geometry. But what i liked even more was 3D graphics. Having such interests really helped my EGR cause. The whole idea of perspective and angles together always kept me interested. Never was there a dull moment in class. Never was there a calculation error like that in maths. The line and curves would settle into a perfect symphony of drawings which would simply have to turn out right if the basics were taken care of. The best part of it all was that we were always using the fundamentals of angles, geometry, a pinch of math and physics. But challenges like in any other subject was there in this as well. One had to get a complete grip and control over the pencil. It was art and logic combined. Art! Yes, that too. You see, i was never good at free hand drawing. Despite that, to have actually done well and enjoy this was a greater high than anything else. The fact that i had complete control over the kind of pressure i was applying with the pencil on the paper, to come out with the exact shade of gray, as desired, was always an encouraging fact. It also helped that it was the first subject in which i actually scored above 40 in my midterms (more like scored at all :D ). My favorite class in college was Engineering Graphics, not because i was good at it. But because, i learnt a lot, enjoyed working with the pencil and scale even more and was allowed to do so by my instructor.

Permalink | Leave a comment  »

]]>
http://files.posterous.com/user_profile_pics/1369599/pic.jpeg http://posterous.com/users/hcGXxsTkwP6SS Vijay Krishna Palepu vpalepu Vijay Krishna Palepu
Fri, 11 Mar 2011 13:55:24 -0800 The Marriage Code http://vijaykrishna.posterous.com/the-marriage-code http://vijaykrishna.posterous.com/the-marriage-code While attending a typical south Indian wedding today, i got engrossed in the ceremony and its proceedings. Every hour there was a puja to be done and it was kind of maddening to be very honest. So, while this madness was going along it normal course, i started taking some interest in the prayers being offered to the Gods and started to ask people as to what they meant, (they were being chanted in Sanskrit), i noticed that every now and then the priest would ask for the bride's or the groom's name. Very so often he was also asking for the names of the parents. At places the priest was asking the couple to do a thing or two by giving them explicit instructions for the same.That is when a brain wave came to me, which might probably leave most of the priests unemployed when it comes to performing such ceremonies and prayers. The whole thing is (simply put) a chunk of code (the prayers) which is wrapped around a function or method with names of the bride, groom and their parents as parameters. The so called instructions given by the priest are nothing but messages being passed from the function to its environment. So, in the view of the statement just made, why can we not have systems which can automate religious ceremonies and prayers? Imagine the amount of efficiency we will get with doing something like that. There will be no bloopers by the priest. There will be no requirement for the priests to come all the way to the actual venue of the event to perform the ceremony. Thus you save a lot of money in transport costs and staying expenses if the wedding is actually in a remote area. You can quicken the process if you want. If you want to involve the human element, you can actually have the priest perform the wedding from a distance. Distance worships!! All this can actually enable the priests to perform various kinds of ceremonies and functions at the same time at different locations in the world. If this whole this kicks off, then you can actually get this whole software/system, as an opensource system, which you can download at zero cost from the internet, and all you would then require is a PC to run it. We will then have Microsoft shipping a MS Prayer in its Office Suite of Software and Google will throw in the same thing free of cost on Google Docs as a part of its cloud applications. You will actually have a lot of variety to choose from. There will those running on just Linux or Windows or Apple. For Windows you will get the pirated versions. WOW!!! With this idea, you have actually linked piracy with worships, prayers, and weddings. In order to avoid that bad notion of piracy being associated with such sacred events people might actually buy the costly license and for once there will be a software with no issues of piracy. Or, watching this notion by the people, Microsoft might actually overprice the thing, thinking that people will bear the whole cost burden. And then, people might actually show up their true colors and go with the pirated version anyway. You might actually have one religion accusing the other to have pirated the systems associated with their religious ceremonies. You will have riots in the name of software. International religious conventions will be convened to solve the menace created with this software. Vatican might feel threatened by this use of science and technology and the Pope will then vehemently opose it. Looking at all this, i guess its better not to go into something like that. But then, come to think of it: The world's economy, religious sentiments and power vendors will feel threatened with this single software. :) Worth trying to find out?

Permalink | Leave a comment  »

]]>
http://files.posterous.com/user_profile_pics/1369599/pic.jpeg http://posterous.com/users/hcGXxsTkwP6SS Vijay Krishna Palepu vpalepu Vijay Krishna Palepu
Tue, 01 Mar 2011 18:02:51 -0800 Comprehensive Guide to Ruby on Rails http://vijaykrishna.posterous.com/comprehensive-guide-to-ruby-on-rails http://vijaykrishna.posterous.com/comprehensive-guide-to-ruby-on-rails This is one awesome guide to Ruby on Rails i stumbled upon today. The whole thing is more or less a comic strip and you will end up laughing while learning for a change. So here is the link: http://mislav.uniqpath.com/poignant-guide/book/ Have fun coding!!

Permalink | Leave a comment  »

]]>
http://files.posterous.com/user_profile_pics/1369599/pic.jpeg http://posterous.com/users/hcGXxsTkwP6SS Vijay Krishna Palepu vpalepu Vijay Krishna Palepu
Fri, 18 Feb 2011 17:08:26 -0800 Google Maps JS API http://vijaykrishna.posterous.com/google-maps-js-api http://vijaykrishna.posterous.com/google-maps-js-api With my involvement in  the ongoing work on my undergrad college website, i was asked to churn out a simple piece of code for a dynamic Google map for the location of AIT. I already did this using Static Maps some time ago and it was recieved well. But, there was a huge demand for a dynamic map and after a quick 30 min revision of the JS API i managed this fragment of rather simple code: [sourcecode language="javascript"] <!DOCTYPE html> <html> <head> <meta name="viewport" content="initial-scale=1.0, user-scalable=no" /> <style type="text/css"> html { height: 100% } body { height: 100%; margin: 0px; padding: 0px } #map_canvas { height: 100% } </style> <script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"> </script> <script type="text/javascript"> function initialize() { var latlng = new google.maps.LatLng(18.60700,73.87507); var myOptions = { zoom: 14, center: latlng, mapTypeId: google.maps.MapTypeId.ROADMAP }; //marker var map = new google.maps.Map(document.getElementById("map_canvas"),myOptions); var marker = new google.maps.Marker({ position: latlng, title:"Army Institute of Technology, Pune, IN"}); marker.setMap(map); //info window var contentString = '<div id="content">'+ '<div id="siteNotice">'+ '</div>'+ '<h1 id="firstHeading" class="firstHeading">Army Institute of Technology</h1>'+ '<div id="bodyContent">'+ '<p style="width:100%"><img src="http://aitpune.com/picture/aitlogo2.gif" style="float:right" hieght="100" width="100" alt="Onward to Glory"/> Dighi Hills,Alandi Road<br /> ' + 'Pune, INDIA-411015<br /><br />Phone: (020)27157534,27157612<br />Fax: 91-20-27157534<br />E-Mail: ait@aitpune.com</p>'+ '</div>'+'</div>'; var infowindow = new google.maps.InfoWindow({content: contentString}); google.maps.event.addListener(marker, 'click', function() {infowindow.open(map,marker);}); } </script> </head> <body onload="initialize()"> <div id="map_canvas" style="width:100%; height:100%"></div> </body> </html> [/sourcecode] Simple enough really. Nothing to it. Go have a look at the Google Maps JS API 3 tutorial (Google it...) and you should be able to figure it out without any issues. As usual Google's documentation is brilliant.

Permalink | Leave a comment  »

]]>
http://files.posterous.com/user_profile_pics/1369599/pic.jpeg http://posterous.com/users/hcGXxsTkwP6SS Vijay Krishna Palepu vpalepu Vijay Krishna Palepu
Sun, 13 Feb 2011 18:28:38 -0800 12 Months of Persistence http://vijaykrishna.posterous.com/12-months-of-persistence http://vijaykrishna.posterous.com/12-months-of-persistence aitoss.net/commons This is what 12 months of pure persistence has resulted in. What started as a simple suggestion by Tosif Ahmed AIT computers 2008, (currently in Edinburgh University, UK) has come to that link above. He suggested this to me and asked me to set up the team. I called in Karan, Akshay, Nikant and Prince all seemingly capable people in web development, eager to learn and build something new. After a month of work, i think that was the time period, Paritosh joined in. He was brilliant at generating the right content for the site world right from the word go. Prince and Nikant were just good at learning something new at a very rapid pace. Karan and Akshay employed their skills at Photoshop and Dreamweaver. Late nights figuring out the structure of the site, living on caffeine, generating content, brainstorming on the organization of the site. It was fun. Here is a picture of us, which we took for the college magazine, Srijna 2010. I think this was around April. [caption id="attachment_251" align="aligncenter" width="363" caption="The Website Team, April 2010 (LtoR): Vijay, Nikant, Paritosh, Prince, Karan, Akshay"]
Media_httpvpalepufile_bvpgj
[/caption] After I passed out new people joined the team, the Web team as we call it. Pallavi, Nitika, Avinash & Sandeep. It seems a lot has happened over the last 8 months or so. The team finally made a bold presentation to the HOD's meet in the college and they were well received. We have come this far and hopefully the 24th of this month should be a day of success. May God be with us and may this site see the first ray of the rising Sun on the 24th!

Permalink | Leave a comment  »

]]>
http://files.posterous.com/user_profile_pics/1369599/pic.jpeg http://posterous.com/users/hcGXxsTkwP6SS Vijay Krishna Palepu vpalepu Vijay Krishna Palepu
Fri, 04 Feb 2011 18:22:01 -0800 Google Static Maps http://vijaykrishna.posterous.com/google-static-maps http://vijaykrishna.posterous.com/google-static-maps I will cut to the chase. The following are two static images showing the location of my college on Google maps. [caption id="" align="aligncenter" width="600" caption="AIT on Google Maps"]
Media_httpmapsgooglec_xggst
[/caption] [caption id="" align="aligncenter" width="600" caption="AIT on Google Maps with custom marker"]
Media_httpmapsgooglec_tpeie
[/caption] The following are the two URLs which i constructed in about 5 mins to come up with these images: http://maps.google.com/maps/api/staticmap?center=18.60598,73.87507&zoom=14&size=600x600&sensor=false&format=gif&markers=color:blue|label:A|18.60598,73.87507 http://maps.google.com/maps/api/staticmap?center=18.60598,73.87507&zoom=14&size=600x600&sensor=false&format=gif&markers=icon:http://tinyurl.com/62863uh|18.60670,73.87900 Its simpler then saying Google. Or so i think. :D

Permalink | Leave a comment  »

]]>
http://files.posterous.com/user_profile_pics/1369599/pic.jpeg http://posterous.com/users/hcGXxsTkwP6SS Vijay Krishna Palepu vpalepu Vijay Krishna Palepu
Sun, 23 Jan 2011 18:27:34 -0800 Chrome WebStore http://vijaykrishna.posterous.com/chrome-webstore http://vijaykrishna.posterous.com/chrome-webstore I opened my browser (read Google Chrome) yesterday and i saw something new in it. Apps !!! I was like, "Hello!! What are you?" And within two clicks of the mouse i end up in the CHROME WEBSTORE!!! It is awesome the way Google does it! Google has now housed all of its Chrome  Extensions, Skins and Apps (yes that is correct, Apps) under one roof and it is simply awesome to say the least. Most of these products or add-ons are free, but you can charge for your apps as well. It takes a nominal fee of $5 to submit your app into the Store itself. A price which is next to nothing in my opinion, given that it is a one time payment. The first time i ventured into the store i hit it off with my favorite section which happens to be the Themes Section. The Store currently houses a whole gamut of Themes that are more than what you would normally see in your Tool Menu -> Options -> Personal Stuff -> Get Themes. You actually had some amazing set of colors and covering all kinds of people. These are a few i tried out for my browser: The Shrine Theme Ethereal 2 (This is the one i stuck with) Coming Winter Theme You also have a fantastic set of themes for Football lovers, one for every popular football playing nation. Here is the one for Brazil. Then you have the Apps. Now let me give an idea of what Apps are. They are not Add-ons. They do not form a part of your browser. Remember the blank empty space when you minimize all the options in a new tab of Chrome ie Most Visited and Recently Closed. Well there is an empty space there with a nothing in the background except for your theme's image/design if you have one. Point is imagine if you could have tiles or links to the favorite Apps you could possibly have, instead of an empty space. They are like little tools just as you have in your cell phone. These are specifically built for Chrome i guess, since they are Chrome Apps but can be run in other browsers as well. But the thing is that they are highly advanced and interactive websites which open in a new tab. You get access to 3 default Apps when it is activated in your browser, they are, The WebStore itself, an interesting Game called Entanglement and Popit, another game i guess, no clue really have not tried it yet. So fundamentally these are web applications built keeping in mind the Chrome Browser. Then finally you have the Chrome Extensions which are closer to the conventional Add-ons you get in other browsers like FireFox. These appear along with the Tools Menu in the Top right hand corner of your Browser. These are called browser actions and are meant for adding additional functionality to your browser, an extn for Gmail or any other mail to check your Mail in a single mouse click. You also have page actions which come up only in specific pages such as a Map functionality which will appear in the OmniBar when you navigate to a page with an Address in it. Apart from giving the user a brilliant experience, the WebStore is a fantastic place to let loose as a developer and/or tester. The documentation for all of this is simply fantastic and easy to use and as usual supports all well known technologies like JavaScript, HTML and CSS. I am neck deep into understanding Extensions for the time being. I may get to the Themes as well. ;) All in all a great add on to an already brilliant browser, which simply makes the Web experience that much more brilliant. :D

Permalink | Leave a comment  »

]]>
http://files.posterous.com/user_profile_pics/1369599/pic.jpeg http://posterous.com/users/hcGXxsTkwP6SS Vijay Krishna Palepu vpalepu Vijay Krishna Palepu