tag:blogger.com,1999:blog-39379662099354171772024-03-18T08:33:57.378+05:30Tech BiteTechnology bites me, and I bite back!prab97http://www.blogger.com/profile/08249127175244141165noreply@blogger.comBlogger103125tag:blogger.com,1999:blog-3937966209935417177.post-19877947601459283442015-10-10T20:21:00.003+05:302015-10-10T20:25:40.098+05:30An app to make democracy better<div dir="ltr" style="text-align: left;" trbidi="on">
I have an app idea to improve our rusty Indian democracy using crowd-sourcing, but I don't have enough time to prioritize it and actually build it. So I am posting this in public domain for someone to take it up and build it. Don't worry, I won't claim any credit.<br />
<br />
<u>The problem</u><br />
We cast our vote in the elections assuming our elected representatives will work for us and make our daily lives better. For the taxes we pay, we expect better roads, good public transport, easily available drinking water, good quality govt. schools and hospitals, reasonably priced ration, helpful police force and all the other required social infrastructure that is government's duty to provide in lieu of all our taxes. This is an ideal democracy. We are still very far from it.<br />
<br />
<u>What can an app do to fix this?</u> <br />
An app can do wonders. Consider the following use cases:<br />
1. The road in your colony is broken badly. You take your phone, launch an app, click the big red 'Report an issue' button with an exclamation mark. App starts the camera, you point the phone cam to the road and click the pic. App fetches your GPS co-ordinates (this is a key point). You optionally choose a category (e.g. Transportation) and add some description and submit it.<br />
2. There is a walled area labelled park in your colony. But inside there is a thick growth of shrubs, and no jogging track or children play amenities. What kind of park is that? You use the app to report the issue with a pic and GPS co-ordinates.<br />
3. You go to apply for a driving license. Lunch is from 1 to 1:30 PM but the guy at the counter left at 12:30 for lunch and you need to wait in the queue till 2:30PM or whenever he comes from his home. He is an arrogant a-hole and thinks that this job his his father's <i>jageer. </i>He needs to be taught a lesson. Pull the app, put a picture with missing guy's blank chair and wall clock with time in the background, report the issue.<br />
4. You are in a market and see that the local police is extracting <i>hafta </i>from the shop-cart owners. When the policemen go away (yeah, stay safe), pull up your phone report the issue. Then tell the shop owners too to do the same with their phones.<br />
5. You went to some govt. office and you anticipate you will be asked for bribe. Launch the app and it will record the audio, attach GPS co-ordinates and put it live for the world to see. <br />
<br />
<u>So what after I report an issue?</u> <br />
Imagine millions of Indians reporting their daily issues. We will have a huge database of issues now with proofs, all of which can be neatly seen on a map, panned and zoomed; seen with heatmaps, seen categorized by constituency and seen categorized by departments. Most of these might contain proofs in terms of pictures. We can browse and visualize this data in multiple innovative ways. We can compare MLAs across constituencies, we can compare states. We can figure out whether our MLA or MP is working or not and whether he/she should be given a second term. Vigilance department can act swiftly<br />
<br />
<u>What about the addressed issues?</u><br />
Once a govt. servant marks an issue as addressed and puts a justification, it needs to be reviewed and approved by the complainer or by a fixed number of people in the vicinity of that area.<br />
<br />
I have scratched the surface, now if you are really serious about it, spend sometime thinking about it and implementing it in the right way.</div>
prab97http://www.blogger.com/profile/08249127175244141165noreply@blogger.com30tag:blogger.com,1999:blog-3937966209935417177.post-15123794117893363872014-08-26T00:01:00.001+05:302014-08-26T00:01:59.715+05:30My problems with Facebook<div style="width: 100%; font-size: initial; font-family: Calibri, 'Slate Pro', sans-serif; color: rgb(31, 73, 125); text-align: initial; background-color: rgb(255, 255, 255);"><span style="color: rgb(38, 38, 38); font-family: Calibri, 'Slate Pro', sans-serif; line-height: initial;">1. On Facebook, I have 400+ friends. Out of which, I consider around 10 as real friends. Around 20 of them aren't friend-close to me but I had interactions of intellectual nature with them for extended periods which makes them important enough for me to value their opinions. The rest? They are not my friends. They are just in my friends list. A few of them like each of my posts and post a comment with just the word 'superlike' or 'wow this is great' or something of that sort. Although they do this in good faith, but this annoys me. Also I don't think they are competent enough to post a random comment on a topic I started on my wall. Looking from a different viewpoint, I don't want to say this in their face and un-friend them right away. Because I may need their help some day when, for some reason space time continuum deterministically puts me in their city and I am on harm's way.</span></div><div id="_originalContent" style=""><meta http-equiv="Content-Type" content="text/plain;"><style> body { font-family: "Calibri","Slate Pro","sans-serif"; color:#262626 }</style> <div>The bottomline? Facebook is not the app for me. I know you will say how can I create lists and do something with them like not showing my posts to specific lists. But so many lists with overlapping members aren't practical and worth my time to create and update regularly. Facebook's concept of friendship is fundamentally broken for me. It might not be that way for people who talk to each of their Facebook friends on a regular basis. Twitter's concept of followers suits me better. Facebook has that, but not the way it should be.</div><div>2. News feed's algorithm is out of my understanding. It hides many posts from me which I would like to see. If facebook thinks that a probabilistic set of algorithms is smart enough to determine what I would like to see on my newsfeed, they are wrong. Machine learning techniques are in fashion but the output is useless when it is used to forcefully solve a problem which isn't meant for it. I am sorry Facebook, but the hammer you are using for this nail is of wrong size.</div><div>3. I can not see all my wall posts. Many events and posts are missing from my timeline. I want my timeline to be a journal of everything I do on Facebook. Timeline literally isn't doing what it stands for in plain English.</div><div>4. I don't want to connect every other website with Facebook. I don't want Facebook to know what I do on that website. And I don't want that website to know what I do on Facebook.</div><br><br> <br><!--end of _originalContent --></div>prab97http://www.blogger.com/profile/08249127175244141165noreply@blogger.com24tag:blogger.com,1999:blog-3937966209935417177.post-59504752156142968892014-07-18T17:35:00.003+05:302014-11-07T17:38:55.269+05:30I don't like Google Maps<div dir="ltr" style="text-align: left;" trbidi="on">
The quality of Google Maps is deteriorating day by day. With their update on Android that killed the handy scale, to out of place venues, to UI irritations. Its all piling up.<br />
<div>
<br /></div>
<div>
Lets see the search quality. This screenshot will tell you everything. I searched for "KFC near me". It recommended me the one which is a 2 hour 25 minutes walk from my current location, despite showing up so many of them which are far closer.</div>
<div class="separator" style="clear: both; text-align: center;">
<a href="http://1.bp.blogspot.com/-SYvcFwNbT-E/U8kKlwmOxuI/AAAAAAAAEF0/by9e-xj8Jlk/s1600/Screenshot_2014-07-18-17-17-29.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://1.bp.blogspot.com/-SYvcFwNbT-E/U8kKlwmOxuI/AAAAAAAAEF0/by9e-xj8Jlk/s1600/Screenshot_2014-07-18-17-17-29.png" height="320" width="180" /></a></div>
<div>
Did I search for "KFC near me" or "KFC far from me"?</div>
<div>
<br /></div>
<div>
Lets see some example screenshots of POIs which exist on Google Maps within 2KM radius of my home but do not exist physically on planet earth. I guess, Google has indexed POIs from one of the parallel universes.</div>
<div class="separator" style="clear: both; text-align: center;">
<a href="http://1.bp.blogspot.com/-D_tsryY1FSM/U8kLJJsOWAI/AAAAAAAAEF8/hZ4lxXV3F2Q/s1600/Screen+Shot+2014-07-18+at+5.10.42+PM.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://1.bp.blogspot.com/-D_tsryY1FSM/U8kLJJsOWAI/AAAAAAAAEF8/hZ4lxXV3F2Q/s1600/Screen+Shot+2014-07-18+at+5.10.42+PM.png" height="200" width="320" /></a></div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://2.bp.blogspot.com/-RLfg7N1lFg4/U8kLM5sJ4nI/AAAAAAAAEGE/CIdxdSbceVY/s1600/Screen+Shot+2014-07-18+at+5.11.00+PM.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://2.bp.blogspot.com/-RLfg7N1lFg4/U8kLM5sJ4nI/AAAAAAAAEGE/CIdxdSbceVY/s1600/Screen+Shot+2014-07-18+at+5.11.00+PM.png" height="200" width="320" /></a></div>
<div>
<br /></div>
<div>
Look at that "Grand Sweets". I followed Maps and reached there to find someone's residence. I had indications early on that Google is lying to me and just wants me to walk so as to burn some calories. Because, why will Grand Sweets open their outlet inside a residential area?</div>
<div>
See that Domino's pizza. According to Google, it lies right there on the middle of an expressway!!!! If you can't employ human operators to fix it, then at least get it fixed using the crowd way. If n number of people, report a venue address as false/bogus please put someone to look at it and remove from maps.</div>
<div>
<br /></div>
<div>
One fine sunday, while returning back from a weekend getaway, I suggested my friend who was driving; to take a shortcut through a residential area to save a few kilometers. We used Google Maps to route us. It took us deep inside a colony showing us that we are inching towards our destination closer and closer. Suddenly we saw a wall in front of us. Google was telling us to take the car through that wall. Another time, I was with a friend on bike and needed to get the puncture repaired. I searched for bike repair shop. It showed us one at around 400 meters from our current location. We dragged the bike there only to find a chaiwala stall there. </div>
<div>
<br /></div>
<div>
There are umpteen numbers of factual inaccuracies on Google Maps. And they are stacking up pretty quickly. Within 2KM radius of me, I showed you two of them. I don't know how many more are there. According to a random estimate, I assume there are 1000+ factual inaccuracies in Google Maps, just in Chennai.</div>
<div>
<br /></div>
<div>
I have decided not to believe Google Maps for address of places. The best way is the old way. Ask the local people. If more than one person who are spaced at least 300 meters apart, tell you an address; then believe it. It must be true.</div>
</div>
prab97http://www.blogger.com/profile/08249127175244141165noreply@blogger.com4tag:blogger.com,1999:blog-3937966209935417177.post-74077426864892471742013-05-28T11:32:00.001+05:302016-05-31T03:36:57.070+05:30Debug Hadoop source code using an IDE(Intellij Idea)<div dir="ltr" style="text-align: left;" trbidi="on">
<i>This is my 100th blog post ;-)</i><br />
<br />
If you are someone who wants to dive into Hadoop source code and get a feel of the implementation details of all the abstracted out nitty-gritties of Hadoop's architectural overview, and want to get your hands dirty by modifying a thing or two; may be because you have just started your masters research on Hadoop or just for the sake of understanding the control flow; this post is for you.<br />
<br />
For learning practical applications of Hadoop, I have two recommendations for you. <a href="http://amzn.to/1sHzrSL" target="_blank">Hadoop - The Definitive Guide</a> and <a href="http://amzn.to/1sHzOMS" target="_blank">Hadoop in Action</a> are amazing books to start with. I started with them to understand the practical aspects of Hadoop.<br />
<br />
I use IntelliJ Idea Community Edition as my IDE(yes, because I don't like Eclipse), but this post should be fairly understandable to Eclipse fans too; although I won't be providing the steps for Eclipse. If you are not proficient with Eclipse then please download IntelliJ Idea from <a href="http://www.jetbrains.com/idea/" target="_blank">here</a> and use it, instead of posting mundane comments like <i>how to perform step number X in Eclipse</i>(or Netbeans or JCreator or Java IDE #9510). Make sure, you scroll down and choose the Community Edition to download. If you are on *nix, better use your distro's package manager to get it.<br />
Ok, lets start:<br />
<u>Step #1: Download Hadoop</u><br />
Downloading the latest version of Hadoop along with source code is simple. Just type Download Hadoop in your browser's omni search bar and follow your instinct. For the lazy soles in the kingdom of Dark Room at 3AM, here is the <a href="http://www.us.apache.org/dist/hadoop/common/stable/" target="_blank">link</a>. There are two tarballs of interest. One is <i>hadoop-<version>.tar.gz</i> which is around 60MB in size and the other is <i>hadoop-<version>-bin.tar.gz</i> which is around 33MB in size. The one with a <i>bin</i> in the name doesn't have the source code, only the binary executable is there. So, obviously download the one without bin in the name.<br />
<br />
<u>Step #2: Unpack the tarball and import in IntelliJ Idea</u><br />
After the download, unpack the tarball. With the following command(if you are on *nix):<br />
<blockquote>
tar -xzf hadoop-<version>.tar.gz
</blockquote>
<br />
Now fire up IntelliJ Idea. If you have just installed it, you will need to accept the License agreement. You will then, get to a screen like this:<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://3.bp.blogspot.com/-iP9B-dKsBdM/UVRgzsSkzxI/AAAAAAAABXM/Ij9IMO51dsQ/s1600/2013-03-28-205520_1280x800_scrot.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="237" src="https://3.bp.blogspot.com/-iP9B-dKsBdM/UVRgzsSkzxI/AAAAAAAABXM/Ij9IMO51dsQ/s320/2013-03-28-205520_1280x800_scrot.png" width="320" /></a></div>
<u>Tip #1: Full resolution images</u><br />
Click on any screenshot thumbnail to view the large image.<br />
<br />
Click <i>Import Project</i> and choose the directory named <i>hadoop-<version></i> eg. hadoop-1.0.4 which got materialized when you unpacked the tarball. An <i>Import Project</i> dialog will open. Then, blindly keep clicking next. During this, Idea will first search for sources, then libraries, then modules and then move to selecting project SDK. I would recommend setting the SDK as Sun Java 6. If you don't have it in your machine and you just have OpenJDK then download it from Oracle's site <a href="http://www.oracle.com/technetwork/java/javase/downloads/jdk6downloads-1902814.html" target="_blank">here</a>. Extract JDK to somewhere, for example /opt and make IntelliJ Idea point there in the <i>Select Project SDK</i> page of <i>Import Project</i> wizard. Afterwards, it will try searching for frameworks used and will find nothing. Here are the screenshots for all these steps, if you get stuck somewhere.<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://2.bp.blogspot.com/-WYflPbzTdK0/UVRmH52HtEI/AAAAAAAABXU/tsziIKKWvgM/s1600/2013-03-28-210054_1280x800_scrot.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="271" src="https://2.bp.blogspot.com/-WYflPbzTdK0/UVRmH52HtEI/AAAAAAAABXU/tsziIKKWvgM/s320/2013-03-28-210054_1280x800_scrot.png" width="320" /></a></div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://2.bp.blogspot.com/-r5VjjK7dfxQ/UVRmKead47I/AAAAAAAABXc/kKhfLf_H5j8/s1600/2013-03-28-210318_1280x800_scrot.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="271" src="https://2.bp.blogspot.com/-r5VjjK7dfxQ/UVRmKead47I/AAAAAAAABXc/kKhfLf_H5j8/s320/2013-03-28-210318_1280x800_scrot.png" width="320" /></a></div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://4.bp.blogspot.com/-heYdrsh4Pug/UVRmKmaQ30I/AAAAAAAABXg/-pgZCh76v8E/s1600/2013-03-28-210335_1280x800_scrot.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="269" src="https://4.bp.blogspot.com/-heYdrsh4Pug/UVRmKmaQ30I/AAAAAAAABXg/-pgZCh76v8E/s320/2013-03-28-210335_1280x800_scrot.png" width="320" /></a></div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://4.bp.blogspot.com/-OnNGExk9YMo/UVRmK7tpN5I/AAAAAAAABXk/NCQLDoPgLeM/s1600/2013-03-28-210328_1280x800_scrot.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="274" src="https://4.bp.blogspot.com/-OnNGExk9YMo/UVRmK7tpN5I/AAAAAAAABXk/NCQLDoPgLeM/s320/2013-03-28-210328_1280x800_scrot.png" width="320" /></a></div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://3.bp.blogspot.com/-addCbHd5MRg/UVRmNP4vflI/AAAAAAAABX0/6QR7vtSDNYA/s1600/2013-03-28-210344_1280x800_scrot.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="274" src="https://3.bp.blogspot.com/-addCbHd5MRg/UVRmNP4vflI/AAAAAAAABX0/6QR7vtSDNYA/s320/2013-03-28-210344_1280x800_scrot.png" width="320" /></a></div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://4.bp.blogspot.com/-E9CciZlgC4s/UVRmNt2_VJI/AAAAAAAABX8/xPCVNKVmrX8/s1600/2013-03-28-210408_1280x800_scrot.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="272" src="https://4.bp.blogspot.com/-E9CciZlgC4s/UVRmNt2_VJI/AAAAAAAABX8/xPCVNKVmrX8/s320/2013-03-28-210408_1280x800_scrot.png" width="320" /></a></div>
<br />
<div class="separator" style="clear: both; text-align: center;">
</div>
<div class="separator" style="clear: both; text-align: center;">
</div>
<div class="separator" style="clear: both; text-align: center;">
</div>
<div class="separator" style="clear: both; text-align: center;">
</div>
<div class="separator" style="clear: both; text-align: center;">
</div>
<div class="separator" style="clear: both; text-align: center;">
<a href="http://4.bp.blogspot.com/-nygOvMpHwDc/UVRmOenwIxI/AAAAAAAABYA/AMLMCOD4P1k/s1600/2013-03-28-210414_1280x800_scrot.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="273" src="https://4.bp.blogspot.com/-nygOvMpHwDc/UVRmOenwIxI/AAAAAAAABYA/AMLMCOD4P1k/s320/2013-03-28-210414_1280x800_scrot.png" width="320" /></a></div>
<br />
Click finish in the last step and you have successfully imported Hadoop in the IDE. You will then be greeted by a screen like this.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://3.bp.blogspot.com/-Zy1JdyJIS1A/UVRmouZejjI/AAAAAAAABYQ/lvXAEkR0Idw/s1600/2013-03-28-212140_1280x800_scrot.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="193" src="https://3.bp.blogspot.com/-Zy1JdyJIS1A/UVRmouZejjI/AAAAAAAABYQ/lvXAEkR0Idw/s320/2013-03-28-212140_1280x800_scrot.png" width="320" /></a></div>
<br />
<u>Step #3: Add the build.xml as Ant build file</u><br />
Right click the file <i>build.xml</i> in the left pane(Project Structure) and click the last option that says <i>Add as Ant build file</i><br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://3.bp.blogspot.com/-DvP90RB8Ce8/UVRqFrO1lQI/AAAAAAAABYc/nTuxJXyLq0s/s1600/2013-03-28-212924_1280x800_scrot.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="320" src="https://3.bp.blogspot.com/-DvP90RB8Ce8/UVRqFrO1lQI/AAAAAAAABYc/nTuxJXyLq0s/s320/2013-03-28-212924_1280x800_scrot.png" width="294" /></a></div>
To test whether all is well, click the <i>Ant Build</i> button in the extreme right bar to reveal <i>Ant Build</i> dock. Then double click the <i>clean </i>target to execute it. Once it is successfully executed double click the <i>compile</i> target.<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://3.bp.blogspot.com/-zE-VinBaKJU/UVR7Y08LoCI/AAAAAAAABYs/2xUpPskGjT4/s1600/2013-03-28-214124_1280x800_scrot.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="200" src="https://3.bp.blogspot.com/-zE-VinBaKJU/UVR7Y08LoCI/AAAAAAAABYs/2xUpPskGjT4/s320/2013-03-28-214124_1280x800_scrot.png" width="320" /></a></div>
<br />
If all is well, both <i>clean</i> and <i>compile</i> targets should execute successfully. If the <i>compile</i> target gets stuck at <i>Executing task: get</i>, you probably need a non-proxied internet connection. You can still get it working over proxy, but that is beyond the scope of this post.<br />
<br />
<u>Tip #2: Change keymap to Eclipse</u><br />
But before we get into the source code, I will recommend setting your keymap to Eclipse style. That can be done in File > Settings > Keymap as shown in below screenshot.<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://2.bp.blogspot.com/-VwEFhHN1vjU/UaQ0Axiyt9I/AAAAAAAACBM/Xtb9S2alF8Q/s1600/2013-05-28-100917_1280x800_scrot.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="236" src="https://2.bp.blogspot.com/-VwEFhHN1vjU/UaQ0Axiyt9I/AAAAAAAACBM/Xtb9S2alF8Q/s320/2013-05-28-100917_1280x800_scrot.png" width="320" /></a></div>
We did this because Eclipse is Ubiquitous and most of you are familiar with Eclipse shortcuts.<br />
<br />
<u>Step #4: Create a debug configuration</u><br />
Now we have to setup a <i>Run/Debug configuration</i>. In the Run menu, click Edit Configurations. Click the + sign on the top left and click Application.<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://2.bp.blogspot.com/-nmgOPCoGiPY/UaRCOP7L31I/AAAAAAAACCQ/kiy4bWrPiu8/s1600/2013-05-28-111112_1280x800_scrot.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="202" src="https://2.bp.blogspot.com/-nmgOPCoGiPY/UaRCOP7L31I/AAAAAAAACCQ/kiy4bWrPiu8/s320/2013-05-28-111112_1280x800_scrot.png" width="320" /></a></div>
<br />
<div class="separator" style="clear: both; text-align: center;">
</div>
Now what to fill in the text fields in this dialog? Let's find out!!!<br />
Open the file hadoop-1.0.4/bin/hadoop in a text editor. Scroll down to the end and modify the two lines with exec with echo; shown in the screenshots below.<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://4.bp.blogspot.com/-_8exIVt2hE0/UaQ3ZjupSPI/AAAAAAAACBo/mwku7GYGO98/s1600/2013-05-28-101715_1280x800_scrot.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="191" src="https://4.bp.blogspot.com/-_8exIVt2hE0/UaQ3ZjupSPI/AAAAAAAACBo/mwku7GYGO98/s320/2013-05-28-101715_1280x800_scrot.png" width="320" /></a></div>
Modify exec to echo.<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://3.bp.blogspot.com/-zbTcwqU7_pk/UaQ3aET1pyI/AAAAAAAACBs/rGpdNx3Sc2g/s1600/2013-05-28-101741_1280x800_scrot.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="193" src="https://3.bp.blogspot.com/-zbTcwqU7_pk/UaQ3aET1pyI/AAAAAAAACBs/rGpdNx3Sc2g/s320/2013-05-28-101741_1280x800_scrot.png" width="320" /></a></div>
<br />
This will let us see the exact command line for running a MapReduce job. Now open a terminal and navigate to hadoop directory and type this command:<br />
<blockquote class="tr_bq">
bin/hadoop jar hadoop-examples-1.0.4.jar wordcount conf output</blockquote>
You will get a huge output. The syntax is as follows:<br />
<blockquote class="tr_bq">
javaExecutablePath VMOptions mainClassFile programArguments</blockquote>
The output on my machine looks like this:<br />
<blockquote class="tr_bq">
/opt/java/bin/java -Dproc_jar -Xmx1000m -Dhadoop.log.dir=...<br />
...<hugegibberish><br />...jsp-api-2.1.jar org.apache.hadoop.util.RunJar hadoop-examples-1.0.4.jar WordCount conf output </hugegibberish></blockquote>
<br />
<ul style="text-align: left;">
<li><i>/opt/java/bin/java</i> is my javaExecutablePath</li>
<li><i>org.apache.hadoop.util.RunJar</i> is mainClassFile that will start hadoop.</li>
<li><i>hadoop-examples-1.0.4.jar WordCount conf output</i> is the programArguments list.</li>
<li>the huge thing denoted with dots above is the VM options.</li>
</ul>
<div>
So, fill in the text fields in debug configurations dialog accordingly. In the <i>Before Launch</i> section add the ant targets <i>clean</i> and <i>compile</i> as shown in the screenshot. In the <i>Use Classpath of Module</i> field, select hadoop-1.0.4. The below screenshot shows my configuration</div>
<div class="separator" style="clear: both; text-align: center;">
<a href="http://4.bp.blogspot.com/-lFCIeJOkwbY/UaRCsYjLR2I/AAAAAAAACCY/ca8NlfNiI6M/s1600/2013-05-28-110554_1280x800_scrot.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="201" src="https://4.bp.blogspot.com/-lFCIeJOkwbY/UaRCsYjLR2I/AAAAAAAACCY/ca8NlfNiI6M/s320/2013-05-28-110554_1280x800_scrot.png" width="320" /></a></div>
<div>
Click Ok. Now lets test our configuration. Click the <i>Debug Hadoop</i> button from the toolbar as shown in the screenshot.</div>
<div class="separator" style="clear: both; text-align: center;">
<a href="http://1.bp.blogspot.com/-thk8p94ULvQ/UaRDaTSe8DI/AAAAAAAACCg/hCd8hk3UnMo/s1600/2013-05-28-111605_1280x800_scrot.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="22" src="https://1.bp.blogspot.com/-thk8p94ULvQ/UaRDaTSe8DI/AAAAAAAACCg/hCd8hk3UnMo/s320/2013-05-28-111605_1280x800_scrot.png" width="320" /></a></div>
<div>
If all goes well, you will get expected output in <i>Console</i> tab of the bottom dock as shown in screenshot.</div>
<div class="separator" style="clear: both; text-align: center;">
<a href="http://4.bp.blogspot.com/-2YsW2iV056I/UaRFt8g4m4I/AAAAAAAACCw/OtekiNFAF0A/s1600/2013-05-28-112545_1280x800_scrot.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="63" src="https://4.bp.blogspot.com/-2YsW2iV056I/UaRFt8g4m4I/AAAAAAAACCw/OtekiNFAF0A/s320/2013-05-28-112545_1280x800_scrot.png" width="320" /></a></div>
<div>
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
</div>
<div>
Next let us see how to put breakpoints and step through the code.</div>
<div>
<br />
<u>Step #5: Add breakpoints in source code</u><br />
Press <i>Ctrl+Shift+R</i> and type <i>RunJar</i>. Select the <i>RunJar.java</i> from dropdown list and press enter. <i>RunJar</i> is the main class in Hadoop-1.0.4. </div>
<div class="separator" style="clear: both; text-align: center;">
<a href="http://3.bp.blogspot.com/-dNH8l7OzR-o/UaRGXg6WvyI/AAAAAAAACC4/KGRcXdOKsrk/s1600/2013-05-28-112837_1280x800_scrot.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="188" src="https://3.bp.blogspot.com/-dNH8l7OzR-o/UaRGXg6WvyI/AAAAAAAACC4/KGRcXdOKsrk/s320/2013-05-28-112837_1280x800_scrot.png" width="320" /></a></div>
<div>
The source for <i>RunJar.java</i> will open up. Press Ctrl+O and type <i>main</i> and press enter. You will jump to the <i>main</i> method. At the first line of the code in <i>main</i> method, click in the gutter to add a breakpoint in that line. See screenshot below. Click at the location where a red circle is shown in the screenshot. That's gutter area. For you the red circle will appear after clicking.</div>
<div class="separator" style="clear: both; text-align: center;">
<a href="http://1.bp.blogspot.com/-6AR8My9Y_EI/UaRHOMRifUI/AAAAAAAACDI/VbA_5T2gBs8/s1600/2013-05-28-113106_1280x800_scrot.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="131" src="https://1.bp.blogspot.com/-6AR8My9Y_EI/UaRHOMRifUI/AAAAAAAACDI/VbA_5T2gBs8/s320/2013-05-28-113106_1280x800_scrot.png" width="320" /></a></div>
<div>
Now that you have added a breakpoint, you can click the <i>Debug</i> button in the toolbar and after the <i>clean</i> and <i>compile</i> targets are executed, the program execution will begin and it will stop at the line where you added the breakpoint. From there, you can <i>step into</i>, <i>step over</i> and <i>step out</i> in the code from the run menu or F5, F6 or F7 keys.</div>
<div>
Now you are free to modify hadoop code and testing your changes.</div>
<div>
<br /></div>
<div>
Once you are done with this and spend some time on it, you will find out that you aren't able to follow the JobTracker or the TaskTracker's execution. This is because they are separate processes and run in different JVMs. In the next blog post I will cover how to debug JobTracker and TaskTracker.</div>
</div>
prab97http://www.blogger.com/profile/08249127175244141165noreply@blogger.com278tag:blogger.com,1999:blog-3937966209935417177.post-75432589935455766752013-05-28T09:41:00.001+05:302013-05-28T10:45:48.176+05:30App Permissions model in Android is broken<div dir="ltr" style="text-align: left;" trbidi="on">
I strongly feel that the App Permissions model on Android is seriously broken. Here is why.<br />
<u><br /></u>
<u>Why Permissions?</u><br />
Permissions are a way to allow/block apps from accessing data and phone's services upon users' discretion.<br />
<br />
<u>How is it broken on Android?</u><br />
In Android, when you install an app, you are shown a list of privileged features that the app is allowed to use. If you are satisfied with the permissions, the app uses, you install the app or cancel it. This is where it goes wrong. No one uses the list of permissions to make a decision whether to install the app or not. It is the trust and brand recognition on the basis of which users install the app. Suppose, you want to block one particular permission for an app. You can't do that. Either you allow all the permissions, or you don't install the app. Take the example of the Facebook for Android app. I don't want it to access my contacts list. Because it is a notorious app. It automatically sends friend requests to everyone in your contacts list if they are on Facebook. Although, this hasn't happened to me but it has happened to some of my friends who are not well versed with technology. So, probably the receptionist at XYZ hotel where you stayed an year ago, or an employee at ABC company whom you met in the lobby for showing you the way to conference room and the person handling customerservice@PQRtransportCompany.com too gets a friend request from you on Facebook. Clearly, you don't want the Facebook app to access your contacts list but you want it to <i>Access the Internet</i> and <i>Save data to SDCard</i>. But Android doesn't let you only block the <i>Contacts Access</i> permission and allow <i>Internet Access</i> and <i>SDCard Access</i>. You either don't install Facebook or let it be notorious.<br />
<br />
<u>What do I want Android permissions model to be like?</u><br />
<br />
<ul style="text-align: left;">
<li>The user should be able to grant all or some of the permissions to the app, when installing.</li>
<li>After installation, the user should be able to grant other permissions, or revoke existing ones.</li>
<li>There should be a panic mode or something similar, which when enabled will show a prompt to the user for each privileged permission access.</li>
</ul>
<br /></div>
prab97http://www.blogger.com/profile/08249127175244141165noreply@blogger.com6tag:blogger.com,1999:blog-3937966209935417177.post-29677602918636367122013-01-30T17:45:00.003+05:302013-01-30T17:45:41.411+05:30qBitTorrent not starting on Arch Linux<div dir="ltr" style="text-align: left;" trbidi="on">
Those of you, who use qBitTorrent as your client on Arch Linux, might be seeing this error message when trying to start <span style="background-color: #9fc5e8;">qbittorrent</span> from terminal.<br />
<br />
<blockquote class="tr_bq">
qbittorrent: error while loading shared libraries: libboost_system.so.1.50.0: cannot open shared object file: No such file or directory</blockquote>
From the GUI menu, it won't show any error message.<br />
<br />
The following command executed as root should fix the issue(it did for me):<br />
<br />
<blockquote class="tr_bq">
ln -s /usr/lib/libboost_system.so.1.52.0 /usr/lib/libboost_system.so.1.50.0</blockquote>
I don't think I need to explain why this fixes this issue. It is quite obvious from the error message and the command.</div>
prab97http://www.blogger.com/profile/08249127175244141165noreply@blogger.com7tag:blogger.com,1999:blog-3937966209935417177.post-24310507557762501982012-11-04T11:45:00.000+05:302012-11-04T11:45:06.345+05:30Thunderbird GMail account setup issues<div dir="ltr" style="text-align: left;" trbidi="on">
Google has revamped their accounts security by order of magnitudes and they have shown the world security is more than a password. The 2-step authentication is an awesome feature. But sometimes these features can cause some pain. For instance, today I was trying to configure Mozilla Thunderbird to fetch my GMail. I went to File -> New -> Existing Mail Account and put my gmail details. Thunderbird looked up the Mozilla ISP Db and found the settings.But when I tried to connect, it said username or password may be invalid. Then after lots of searching I found out this:<br />
<br />
https://accounts.google.com/DisplayUnlockCaptcha<br />
<br />
When you try to access your Google account from a new application, Google restricts the application for security. You can unlock this restriction by following the above link.<br />
<br />
If you have setup 2-step authentication, you need to create an Application Specific Password(ASP) and then use the new password in thunderbird to login. For this go to:<br />
<br />
https://www.google.com/settings/account<br />
<br />
In the left pane, click Security. Click the Edit button beside <i>Authorizing applications and sites </i>and then scroll down to the bottom in the new page after verifying your password. There, under <i>Application Specific Passwords</i>, enter your application name and click Generate to generate a new password. Use that password in Thunderbird and it will connect to your GMail account successfully.<br />
<br />
Not only Thunderbird but all third party non-web apps that connect to your Google account require an ASP setup if 2-step authentication is enabled in your account. </div>
prab97http://www.blogger.com/profile/08249127175244141165noreply@blogger.com2tag:blogger.com,1999:blog-3937966209935417177.post-27063761342360038362012-09-12T21:29:00.000+05:302012-09-12T21:29:42.630+05:30Block facebook on a proxied internet with iptables<div dir="ltr" style="text-align: left;" trbidi="on">
Those who access internet by setting a proxy(insti proxy!!) in their browsers and want to block facebook on their computers can issue the following command as root on their linux box<br />
<br />
<blockquote class="tr_bq">
iptables -I OUTPUT -m string --algo bm --string "facebook.com" -j DROP</blockquote>
<br />
I can't control myself from opening Facebook every now and then, when working in lab, just to see what's going on. Facebook is my biggest distraction. Hope this move will help me to concentrate on work.<br />
By the way, iptables doesn't persist the firewall rules across restarts. So I have appended the above command to my <i style="font-weight: bold;">/etc/profile </i>file so I don't have to manually type the above command when I fresh boot my computer.<br />
By the way the above command will block all packets that match the string facebook.com, so if you try to search for facebook.com in Google, you won't be able to see the results page, as the search query will never reach Google.<br />
<br />
And yeah, if you want to unblock facebook, check the rule number by issuing<br />
<blockquote class="tr_bq">
iptables -L OUTPUT</blockquote>
And see the line number. If the rule you created is on 1st line then line number is 1. Now issue the following command:<br />
<blockquote class="tr_bq">
iptables -D OUTPUT 1</blockquote>
<br />
<br />
<br /></div>
prab97http://www.blogger.com/profile/08249127175244141165noreply@blogger.com1tag:blogger.com,1999:blog-3937966209935417177.post-14743705727815775372012-07-29T01:18:00.002+05:302012-08-01T16:01:20.227+05:30Migration to systemd on Arch<div dir="ltr" style="text-align: left;" trbidi="on">
Today I migrated to systemd on my <a href="http://www.archlinux.org/" target="_blank">Arch</a> system. All the mortals unaware of the word, please allow me the privilege to introduce systemd - the latest replacement PID 1 in your linux box. As you might be aware that after the kernel loads up, it launches <i>init</i> in the inter-stellar space with the process ID of 1 which is responsible for forking other payloads into the user space. The traditional <a href="http://en.wikipedia.org/wiki/Init#SysV-style" target="_blank">SysV Init</a> boot method was conceived decades ago and has been used almost unaltered in most of the linux distros. It was excogitated in the age when processors were babies with single cores which could compute ONLY a few million instructions a second, the computers had only crossed the stone age and had just stepped into the semiconductor age(the second part of this statement is technically wrong, take it just as a humorous piece). <a href="http://en.wikipedia.org/wiki/Init#SysV-style" target="_blank">SysV Init</a> starts the userspace processes one by one. But today in the age of multicore monsters with each of the 4(or 6) cores capable of simultaneously computing at a staggering speed of more than a couple of billion instructions per second coupled with architectural innovations like <i><a href="http://en.wikipedia.org/wiki/Simultaneous_multithreading" target="_blank">simultaneous multithreading</a></i>(SMT i.e. hyper threading in intel terms), advance <i>tournament branch prediction</i>ing, added with <i>speculative execution</i> and deep pipelining that makes sure an application cleverly programmed can run almost as fast as the demarcation set by <i><a href="http://en.wikipedia.org/wiki/Amdahl's_law" target="_blank">Amdahl's law</a></i>; Sys V init is very inefficient since it's coders hadn't dreamt of these features in their weirdest of day(night)dreams.<br />
Then some bored lazy guy named <i>Lennard Pottering</i> at Fedora fed up of waiting for the age old system boot process to load his OS had a mesmerizing realization of an Archimedes like enlightening idea - <span style="background-color: lime;">to boot a system fast, start less; and start more parallelly</span>. And he came up with systemd along with some helping hands in the community. Although Ubuntu gave up on SysV Init long ago and took the <i><a href="http://en.wikipedia.org/wiki/Upstart" target="_blank">upstart</a></i> way, but systemd is any day any moment better than upstart.<br />
systemd organises services and other things(beyond the scope of this post) into <i>units</i>. An assortment of one or more <i>unit</i>s can be grouped into a target, which is similar to the concept of <i>runlevels</i> but is not exactly run level. A target can be a requirement for another target(i.e. latter inherits from former). And systemd starts the units as parallelly as possible by making sure independent units can start together and a unit dependent on another is held on, until its dependency is started.<br />
<span style="background-color: white;">Enough of background story and theory! Lets see how easy it is to set it up on <a href="http://www.archlinux.org/" target="_blank">Arch</a>. <a href="https://wiki.archlinux.org/" target="_blank">Archwiki</a> has an <a href="https://wiki.archlinux.org/index.php/Systemd" target="_blank">awesome page</a> for it, but n00bs are n00bs and are born to make mistakes and do things that they are not supposed to. Even non-n00bs can make silly mistakes :P</span><br />
<span style="background-color: white;">Install the packages <i>systemd</i>, <i>systemd-sysvcompat</i>, <i>systemd-arch-units</i> after removing the packages <i>sysvinit</i> and <i>initscripts</i>. But before removing initscripts, you may want to take a backup of <i>/etc/rc.conf</i>. Afterwards you should make a few files which are expected by systemd. They are /etc/hostname, /etc/vconsole.conf, /etc/locale.conf, /etc/timezone</span><br />
<blockquote># cp /etc/rc.conf /etc/rc.conf.bak<br />
# pacman -Rns sysvinit initscripts<br />
# pacman -S systemd systemd-sysvcompat systemd-arch-units<br />
# echo `hostname` > /etc/hostname<br />
</blockquote>
<span style="background-color: white;">In the file /etc/vconsole.conf write</span><br />
<blockquote class="tr_bq">
KEYMAP=us<br />
FONT=lat9w-16<br />
FONT_MAP=8859-1_to_uni
</blockquote>
<br />
and in the file /etc/locale.conf write<br />
<br />
<blockquote class="tr_bq">
LANG=en_US.UTF-8<br />
LC_COLLATE=C
</blockquote>
<br />
and lastly in the file /etc/timezone enter your timezone, for example:<br />
<br />
<blockquote class="tr_bq">
Asia/Calcutta</blockquote>
<br />
If you dual boot with Windows then to keep your linux system showing localtime write the following in /etc/adjtime<br />
<br />
<blockquote class="tr_bq">
0.0 0.0 0.0<br />
0<br />
LOCAL</blockquote>
You should also uncomment the <i>en_US-UTF8 UTF8</i> and <i>en_US-ISO8859-1</i> lines from /etc/locale-gen and then run the <i>locale-gen</i> command on the terminal as root user to avoid locale warnings while next time an <i>mkinitcpio</i> is done or something else that requires it.<br />
If you load some modules at boot time by adding them in <i>/etc/rc.conf</i> then to do the same with systemd, you can create a file named <i>/etc/modules-load.d/modules.conf</i> and add all your modules names each in a single line.<br />
For example:<br />
<br />
<blockquote class="tr_bq">
vboxdrv<br />
vboxnetflt</blockquote>
<br />
If you run some services from /etc/rc.conf at boot time, then you can use:<br />
<br />
<blockquote class="tr_bq">
# systemctl enable sshd.service</blockquote>
<br />
to keep starting them at boot. These service configs are in <i>/usr/lib/systemd/system/ </i>directory and are the units as introduced somewhere above in this post. All the files with extension <i>.service</i> are daemon units that you can run at boot or for certain targets, or later by the systemctl command.<br />
<br />
In case of some services, for example networkmanager you will see an error if you try to do a <i>systemctl enable </i>over it:<br />
<blockquote class="tr_bq">
Failed to issue method call: No such file or directory</blockquote>
<br />
Don't panic. Just create a symlink in /etc/systemd/system for that file in multi-user.target wants.<br />
<br />
Example:<br />
# ln -s /usr/lib/systemd/system/networkmanager.service /etc/systemd/system/multi-user.target.wants/networkmanager.service<br />
<br />
This may not exactly work in some cases if the daemon you want to start requires other daemons to be enabled too. In that case you can enable the required daemon first, or the required target first.<br />
<br />
Hope, this should get you up and running with systemd on your arch box.<br />
One more thing, systemd provides a nifty tool to analyse your boot time. Try these commands, and you will know what I mean:<br />
<br />
<blockquote class="tr_bq">
$ systemd-analyze<br />
$ systemd-analyze blame | less<br />
$ systemd-analyze plot > ~/bootplot.svg</blockquote>
By the way my Fujitsu Siemens Amilo Si3655 with Core2Duo P8400 2.26GHz, 320GB hard disk, 4 gigs of RAM and pae kernel boots in less than 13 seconds. Here is my output from systemd-analyze.
<blockquote class="tr_bq">
Startup finished in 656ms (kernel) + 2521ms (initramfs) + 9648ms (userspace) = 12826ms
</blockquote>
And here is my <a href="http://dl.dropbox.com/u/16933020/plot.svg" target="_blank">plot svg file</a>.<br />
<br />
<u>References:</u><br />
<a href="https://wiki.archlinux.org/index.php/Systemd">https://wiki.archlinux.org/index.php/Systemd</a><br />
<a href="http://0pointer.de/blog/projects/systemd.html">http://0pointer.de/blog/projects/systemd.html</a><br />
<a href="http://0pointer.de/blog/projects/why.html">http://0pointer.de/blog/projects/why.html</a><br />
<a href="http://freedesktop.org/wiki/Software/systemd">http://freedesktop.org/wiki/Software/systemd</a><br />
<a href="http://distrowatch.com/table.php?distribution=arch">http://distrowatch.com/table.php?distribution=arch</a><br />
<br />
<u>Notes:</u><br />
1. Commands prefixed with # are to be run as root user, and ones prefixed with $ are to be run as normal user.<br />
2. If you are not an arch user, please don't try to install systemd by following this article word by word. Fedora and OpenSuse come with systemd by default. Other distro users should check corresponding wiki and forums.</div>prab97http://www.blogger.com/profile/08249127175244141165noreply@blogger.com1tag:blogger.com,1999:blog-3937966209935417177.post-70650913711283175942012-07-02T22:04:00.000+05:302013-01-29T11:54:34.972+05:30Fix disfunctional shutdown/restart button in Arch Linux<div dir="ltr" style="text-align: left;" trbidi="on">
Arch Linux is one awesomely awesome operating system! You get a chance to build your own Linux system from scratch, right from installing the kernel, then installing core-utils, followed by editing config files and then setting up X and a Desktop Environment. I will post sometime later an step by step verbose article on building a system with Arch + XFCE + General utilities. For now I'll focus on the title of this post.<br />
<br />
Those of you who run Arch and start your GUI with:<br />
<br />
<blockquote class="tr_bq">
exec ck-launch-session dbus-launch startxfce4</blockquote>
<br />
in xinitrc and use SLIM might have noticed that you can't shutdown with the buttons available in your Desktop Env. <br />
<br />
The reason is that the updated version of SLIM already launches a console kit session(the thing responsible to execute commands that require root access). So there are two console kit sessions and the conflict.<br />
You can check the number of console kit sessions yourself by:<br />
<blockquote class="tr_bq">
ck-list-sessions</blockquote>
To solve it, remove the portion <span style="background-color: #9fc5e8;">ck-launch-session dbus-launch</span> from the exec line.<br />
Here is my .xinitrc, that you may use.<br />
<br />
<blockquote class="tr_bq">
#!/bin/sh<br />
# ~/.xinitrc<br />
# Executed by startx (run your window manager from here)<br />
if [ -d /etc/X11/xinit/xinitrc.d ]; then<br />
for f in /etc/X11/xinit/xinitrc.d/*; do<br />
[ -x "$f" ] && . "$f"<br />
done<br />
unset f<br />
fi<br /><br />
DEFAULT_SESSION=startxfce4<br />
case $1 in<br />
lxde)<br />
exec startlxde<br />
;;<br />
xfce4)<br />
exec startxfce4<br />
;;<br />
*)<br />
exec $DEFAULT_SESSION<br />
;;<br />
esac<br />
<br /><br />
/usr/bin/xscreensaver -no-splash &<br />
</blockquote>
<br /></div>prab97http://www.blogger.com/profile/08249127175244141165noreply@blogger.com2tag:blogger.com,1999:blog-3937966209935417177.post-52298805192082100262011-10-28T22:43:00.001+05:302011-11-05T08:33:25.754+05:30Setup transparent net access over insti proxies<div dir="ltr" style="text-align: left;" trbidi="on">
If you are a student at an institute that forces you to cross a damn proxy server for accessing internet, you must be fed up of entering your username and password time and again in browsers, as well as configuring each new application you install, to use the proxy. And if an application doesn't have any proxy configuration option, then you can't use that application! For example you can't install the Android Development plugin for eclipse. This is very irritating. And, some campuses add to this torture further by using crappy NTLM authentication.<br />
Here in IIT Madras exactly this condition prevails. But here I present a step by step walk through to get rid of this situation. Welcome to transparent proxying!<br />
<br />
<b><u>What is transparent proxy?</u></b><br />
A transparent proxy(correctly called intercepting proxy) intercepts your requests and forwards to the destination without letting your applications know that there is a proxy between you and internet. This is done with some intervention from <i>iptables </i>in Linux. So what are the advantages? You need not configure each and every application with the proxy address, port, username and passwords. You can keep the setting "Direct connection to internet" in every application and every darn-so-ever app will work flawlessly!!!! Cool?? Eh?? Lets start.<br />
<br />
<u><b>Configure a transparent proxy on your notebook</b></u><br />
I assume you are using a recent version of Ubuntu. Even older ones will do :) The steps should work for any Linux distro provided you use appropriate distro specific commands.<br />
<br />
Before installing software you should have a working internet connection. You may setup proxy in <i>/etc/apt/apt.conf </i>for the time being to install required software for now. You need to put the proxy details in <i>apt.conf</i> as follows for https, https and ftp:<br />
<br />
<i>Acquire::http::Proxy "http://<username>:<password>@<proxy-address>:<port></i><br />
<i><br /></i><br />
An example:<br />
<br />
<i>Acquire::http::Proxy "http://cs11m039:bleeeep@proxy.iitm.ac.in:3128";</i><br />
<i>Acquire::https::Proxy "https://cs11m039:bleeeep@proxy.iitm.ac.in:3128";</i><br />
<i>Acquire::ftp::Proxy "ftp://cs11m039:bleeeep@proxy.iitm.ac.in:3128";</i><br />
<i><br /></i><br />
If you are not from computer science background then I should tell you that, to edit <i>/etc/apt/apt.conf </i>you should open terminal then type <i>sudo gedit /etc/apt/apt.conf</i><br />
<br />
<u>Step 1: </u><br />
If your campus doesn't require NTLM authentication then you can simply install and configure squid to setup transparent proxying. The details for that are beyond the scope of this post and I may cover that sometime later or you may search the net for other writers who might have posted the same.<br />
IIT Madras campus network has NTLM. So I need to install <i>cntlm</i>. It works as a proxy and performs NTLM authentication on your behalf so you don't need to enter username and password everytime ypu lauch the browser. Type the following command and press enter:<br />
<blockquote class="tr_bq">
sudo apt-get install cntlm </blockquote>
Now edit <i>/etc/cntlm.conf </i>file and edit these lines to reflect your settings:<br />
<br />
<blockquote class="tr_bq">
Username<span class="Apple-tab-span" style="white-space: pre;"> </span>cs11m039<br />
Domain<span class="Apple-tab-span" style="white-space: pre;"> </span>iitm<br />
Password<span class="Apple-tab-span" style="white-space: pre;"> </span> password</blockquote>
If you have different proxies in institute and hostels then you can specify them all in these lines<br />
<br />
<br />
<br />
<blockquote class="tr_bq">
Proxy<span class="Apple-tab-span" style="white-space: pre;"> </span>10.93.0.38:3128<br />
Proxy<span class="Apple-tab-span" style="white-space: pre;"> </span>10.93.0.34:3128</blockquote>
Edit socks proxy details too<br />
<br />
<blockquote class="tr_bq">
SOCKS5Proxy<span class="Apple-tab-span" style="white-space: pre;"> </span>3128<br />
SOCKS5User<span class="Apple-tab-span" style="white-space: pre;"> </span>cs11m039:password</blockquote>
<br />
Leave all other settings as default. Instead of cs11m039, put your username and instead of password put your password. Instead of domain as iitm put your institutes NTLM domain. For SOCKS5Proxy put the port number of proxy.<br />
<br />
Now restart cntlm by typing:<br />
<br />
<blockquote class="tr_bq">
sudo service cntlm restart</blockquote>
<br />
Now open any browser and set the http proxy as 127.0.0.1 and port 3128. Try opening google.com. If it works, means you got cntlm installed perfectly. Proceed to next step. Else, double check your configuration. Make sure cntlm got installed. Also make sure if your computer is even turned on!!!!! If all else fails, write a comment here and I may reply if I feel like.(:P)<br />
<br />
<u>Step 2:</u><br />
Install tinyproxy.<br />
<blockquote class="tr_bq">
sudo apt-get install tinyproxy</blockquote>
<br />
Open its configuration file<br />
<br />
<blockquote class="tr_bq">
sudo gedit /etc/tinyproxy.conf </blockquote>
<br />
Edit these lines:<br />
<blockquote class="tr_bq">
Port 8888</blockquote>
<blockquote class="tr_bq">
Upstream 127.0.0.1:3128</blockquote>
Comment the line that says <i>Allow 127.0.0.1</i> by adding a leading # symbol before <i>Allow.</i><br />
Don't touch any other line.<br />
<br />
<u>Step 3:</u><br />
Open <i>/etc/default/tinyproxy</i> and put this inside and close the file:<br />
<br />
<br />
<i>case "$1" in</i><br />
<i> start)</i><br />
<i> iptables -t nat -A OUTPUT -p tcp --dport 80 -j REDIRECT --to 8888</i><br />
<i> ;;</i><br />
<i> stop)</i><br />
<i> iptables -t nat -F OUTPUT</i><br />
<i> ;;</i><br />
<i> restart)</i><br />
<i> start-stop-daemon --stop --quiet -t --exec $DAEMON > /dev/null || exit 0</i><br />
<br />
<i> iptables -t nat -F OUTPUT</i><br />
<i> iptables -t nat -A OUTPUT -p tcp --dport 80 -j REDIRECT --to 8888</i><br />
<i> ;;</i><br />
<i>esac</i><br />
<br />
<br />
Now restart tinyproxy by typing <i>sudo service tinyproxy restart </i><br />
Disable proxy settings in the browser and try opening a website. If you followed all the above steps correctly then the website should open. Also, you may now safely truncate the /etc/apt/apt.conf file and it will work. All your apps like installing software in Eclipse will work too without any problems.<br />
<br />
This is how your internet is working now:<br />
<br />
Your application requests for internet access which is received by Linux kernel and due to the <i>iptables</i> rule setup above the request is redirected to port 8888 where tinyproxy is running. Tinyproxy intercepts the non-proxyified request and makes it http-proxy request compliant then forwards it to upstream proxy which is cntlm running on port 3128. Cntlm then performs NTLM authentication and contacts the insti proxy server to serve your request.<br />
<br />
User application<==>Kernel(iptables)<==>tinyproxy intercepting proxy<==>cntlm authentication proxy<==>insti squid proxy<==>The internet<br />
<br />
Happy browsing!<br />
<br />
<b><u>Update</u></b><br />
On 3rd November, IIT Madras ditched the NTLM authentication and implemented rather insecure HTTP Basic authentication with OpenLDAP. Now you don't require cntlm if you want to setup transparent proxy.<br />
<br />
In step 1 above don't install cntlm. Just install polipo by:<br />
<blockquote class="tr_bq">
sudo apt-get install polipo</blockquote>
<br />
Then open its configuration file by:<br />
<blockquote class="tr_bq">
sudo gedit /etc/polipo/config</blockquote>
<br />
And set these values:<br />
parentProxy = "hproxy.iitm.ac.in:3128"<br />
parentAuthCredentials = "username:password"<br />
<br />
where username and password should be your username and your password for OpenLDAP.Also make sure to comment the lines that stand for SOCKS proxy.<br />
Also set its listening port to 3128, so that tinyproxy doesn't need to be reconfigured. And don't forget to uninstall or disable cntlm(if it is installed) from startup because both polipo and cntlm will try to capture port 3128 for listening and you may face issues.<br />
<br />
<br />
<br />
<br /></div>prab97http://www.blogger.com/profile/08249127175244141165noreply@blogger.com3tag:blogger.com,1999:blog-3937966209935417177.post-58131842506478581732011-09-29T00:13:00.001+05:302016-05-31T03:42:57.633+05:30My experience with CentOS 6<div dir="ltr" style="text-align: left;" trbidi="on">
And finally I decided to switch to 64 bit computing! Motivated by my Parallel Computer Architecture course (in which I'm underperforming) I decided to install CentOS 6 X86_64 version. IIT gives enough internet speed in the campus (if only you know how to tap into :P) that I ended up downloading the two bin-DVD ISOs as well as LiveCD and LiveDVD ISOs totalling around 8GB in less than 2 hours from <a href="http://ftp.jaist.ac.jp/pub/Linux/CentOS/6.0/isos/x86_64/">http://ftp.jaist.ac.jp/pub/Linux/CentOS/6.0/isos/x86_64/</a>. Then I used the cool <i>dd</i> command to replicate the LiveDVD ISO onto my pen drive.<br />
<br />
<blockquote>
<i>dd if=CentOS-6.0-x86_64-LiveDVD.iso of=/dev/sdb bs=1K</i></blockquote>
<br />
Don't forget to<br />
<blockquote>
<i>umount /dev/sdb1</i></blockquote>
before issuing the above command.<br />
<br />
So, after getting the bootable pen drive I restarted my notebook and pressed F12 to alter the boot order to select the pen drive instead of hard disk. The LiveDVD environment booted and I clicked on <i>autologin</i> letting it boot to GNOME by default. The interface was pretty fast. In fact much faster than Ubuntu because there is not much of eye candy at your disposal in CentOS by default. One irritation I had, was that I couldn't click by tapping the touchpad. I had to press the touchpad's left button to make the clicks. After some fiddling I found out in <i>System>Preferences>Mouse</i> in the <i>Touchpad</i> tab the option to <i>Enable mouse clicks with touchpad. </i>Then I enabled <i>Desktop Effects</i> and tested the <i>Desktop on a cube</i> of Compiz that pumps in zeal in linux fanboys and jeal in Windoze fans! Everything seemed to work perfectly, and I decided to go ahead and replace my Backtrack 5 installation with CentOS6. I launched the <i>Install to hard drive</i> installer and chose <i>create a cutom layout </i>in disk partitioning to specify my own partition to install and selected the Backtrack 5 partition and formatted it. After clicking the final install button, to my utter dismay the installer blurted something very nasty! <i>The installation media is corrupt and installer can't proceed! </i>Damn!!!!!!!!!!<br />
I rebooted to find that my Backtrack 5 partition was wiped out. I booted into Ubuntu and used <i>dd</i> to replicate the <i>bin-DVD1.iso</i> image into my USB pen drive. After a wait of around 15 minutes my bin-DVD1 installer was ready. I rebooted and chose USB boot after F12 but this time it said: <i>Operating system not found</i>!!! Damn again!<br />
After booting back to Ubuntu I replicated the LiveCD.iso into USB disk and re-booted into the LiveCD environment without any issues. I checked my system information and was proud to see 4GB of installed RAM! Both my 32-bit OSes viz. Windoze and Ubuntu 11.04 let me use only 3GB(approx.) RAM because of that damn memory mapping for I/O devices. Anyways I launched the installer and started following the wizard. During the bootloader setup screen I saw only Windoze was detected and named as Other. I added an entry for Ubuntu as well and edited the <i>Other</i> to read <i>Windoze</i>. I proceeded with the installer and after setting up all configs pressed the final install button. To my surprise, the install took less than 3 minutes!!!! Yes!! Thats right!<br />
Then I rebooted and after a couple of formalities booted straight into lean and thin and clean upto the brim desktop environment of GNOME with very basic set of apps like GIMP, OpenOffice etc. Next thing I did was to install the multimedia codecs. I issued the following command<br />
<blockquote>
<i>yum install gstreamer-plugins-base gstreamer-plugins-good gstreamer-plugins-bad gstreamer-plugins-ugly gstreamer-ffmpeg</i></blockquote>
For a user switching from Ubuntu it was nice to see that the package names are consistent across distros. Anyways I noticed that the gstreamer plugins from the base set and good set were already installed and yum started downloding the rest of them.<br />
Then I installed vlc media player by<br />
<blockquote>
<i>yum install vlc</i></blockquote>
When I tried typing <i>gcc</i> and <i>g++</i> on the terminal I got command not found. Same happened for <i>java</i> but <i>python</i> was installed and worked. They don't provide everything in the CD due to space constraint. So I went ahead to install these myself. yum install g++ didn't work.<br />
After some fiddling I noticed that I could hear sound when I plugged in the earphones but after plugging them out I couldn't hear any sound through speakers. Exactly same problem I faced in last october with Ubuntu and had posted at <a href="http://www.techbite.in/2010/10/realtek-alc888-sound-issues-in-ubuntu.html">http://www.techbite.in/2010/10/realtek-alc888-sound-issues-in-ubuntu.html</a> but I couldn't use the same solution for CentOS because there was no <i>/etc/modprobe.d/alsa-base.conf</i> in CentOS. I tried the <i>locate</i> command but in vain. If you know how to solve this issue please comment here.<br />
Next I updated <i>/etc/fstab</i> and entered the entries for auto mounting of my Windoze partitions and Ubuntu partition. But before that I had to installl <i>ntfs-3g</i> because that would let my CentOS access NTFS partitions.<br />
Anyways I went ahead with my installation streak and downloaded <i>flash plugin</i> 11 rc from Adobe's site for 64 bit architecture and extracted it and copied the <i>libflahplayer.so</i> to <i>~/.mozilla/plugins</i> directory and my firefox started to show YouTube videos after a restart. My installation streak is still going on and the apps waiting in the queue for installation are:<br />
<blockquote>
compiz<br />
w3m<br />
aria2c<br />
chrome<br />
opera<br />
nmap<br />
g++<br />
lftp<br />
openssh<br />
ettercap<br />
apache<br />
php<br />
mysql<br />
audacious<br />
skype<br />
gnuplot<br />
vidalia</blockquote>
<br />
After the installation of these I'll have a relaxed sleep because I have a 4 day holiday!! That will be enough for me to spend nice time with CentOS6.<br />
<br />
<u><i>Update</i>(Sep29 9:30AM IST):</u><br />
I added these two lines to /etc/modprobe.d/dist-alsa.conf to got the sound from speakers working after a restart.<br />
<blockquote>
<i>alias snd-card-0 snd-hda-intel<br />options snd-hda-intel model=auto</i></blockquote>
Other issues I faced so far are<br />
1. Upon trying to install <i>byobu-3.21-1.el6.noarch.rpm</i> it says it needs python 2.6. But I already have python 2.6.5 installed<br />
2. To run the ADT plugin for eclipse I require 32 bit libs support. Can't figure out how to do that. In Ubuntu 64 bit, one just have to install <i>ia32-libs</i> using <i>apt-get</i>.<br />
3. Can't install <i>audacious</i> through <i>yum</i>. It says <i>audacious-plugins</i> package not found.<br />
4. Installed <i>compiz</i> but can't find <i>ccsm</i><br />
5. Can't find aria2 through yum. I guess I've to hunt for a manual download of rpm instead.<br />
<br />
<u><i>Update(Oct 1 07:30PM IST)</i></u><br />
I downloaded JDK 7 from here <a href="http://www.oracle.com/technetwork/java/javase/downloads/java-se-jdk-7-download-432154.html">http://www.oracle.com/technetwork/java/javase/downloads/java-se-jdk-7-download-432154.html</a> and installed it. It worked perfectly. But after that I used <i>yum</i> to install Eclipse IDE which in turn installed OpenJDK and made it the default java. I hate OpenJDK and want only Sun JAVA. I tried:<br />
<blockquote>
update-alternatives --config java</blockquote>
But Sun Java wasn't listed there. There were two javas listed there. One was Open JDK 1.6 and other was gcj 1.5. I played some hide n seek and found out that Sun Java was installed in <i>/usr/java/</i> and there were three directories there named <i>jdk1.7.0, latest </i>and <i>default</i>. Then after some fiddling with the man page of <i>update-alternatives</i> command I issued these three commands:<br />
<br />
update-alternatives --install "/usr/bin/java" "java" "/usr/java/default/bin/java" 3<br />
update-alternatives --install "/usr/bin/javac" "javac" "/usr/java/default/bin/javac" 3<br />
update-alternatives --install "/usr/bin/javaws" "javaws" "/usr/java/default/bin/javaws" 3<br />
<br />
And then running this:<br />
<blockquote>
update-alternatives --config java </blockquote>
showed me Sun Java as the third option. Then I set it as the default java and my problem was solved.<br />
<br />
To get started with server administration in CentOS if you have some basic Linux background, you should read the <a href="http://amzn.to/1sHAqSN" target="_blank">CentOS Server Administration Cookbook</a>.<br />
<br /></div>
prab97http://www.blogger.com/profile/08249127175244141165noreply@blogger.com1tag:blogger.com,1999:blog-3937966209935417177.post-65072552974045795742011-08-11T06:25:00.000+05:302016-05-31T03:46:37.230+05:30M.Tech CS - Admissions through GATE - Analysis 2011<div dir="ltr" style="text-align: left;" trbidi="on">
<div>
<div dir="ltr" style="text-align: left;" trbidi="on">
<b><u>Intro</u></b><br />
This blog post has content specific to those:<br />
<br />
<ul style="text-align: left;">
<li>who belong to CS</li>
<li>who are under 460 rank in GATE</li>
<li>who are in General category</li>
</ul>
If you don't belong to the category described above, you may still read on because you may find some interesting information in this post.<br />
<br />
If you are just preparing for GATE, you should solve more and more questions. And for that I would recommend <a href="http://amzn.to/1Vr5cuN" target="_blank">GKP Publisher's Question Bank</a>. Although there are some mistakes in the book for solutions to some problems, but I recommend this book solely for the huge collection of problems it has.<br />
<br />
GATE CS has become very competitive and the competition is increasing every year at an alarming rate. In GATE 2009 only 41000 candidates appeared in CS. The number increased to 107086 in 2010, mostly contributed by recession and lack of job opportunities in IT sector. In 2011 amazingly the number of candidates rose to 136291(last rank was 136027 but exact number of candidates who appeared in the exam was 136291) although recession had retreated and jobs were available in plenty. This shows the increasing interest of Indian youth towards masters degree.<br />
<br />
<b><u>GATE - Who takes it? Why?</u></b><br />
<br />
<div>
<div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;">
Now lets know who are the people who opt to pursue M.Tech and why?</div>
<div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;">
<br /></div>
</div>
<div>
<div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;">
Broadly, there are three kinds of people who want to pursue M.Tech from IITs. The first kind is like me, who want better placement opportunities in reputed companies like Microsoft, Google, Cisco, Directi, Intel, Facebook, Yahoo! , Adobe etc. which are unavailable to most students who haven't done B.Tech from NITs or some other better colleges other than IITs. It is considered that these companies not only give you a well paid and reputed job that doesn't insult your talent but also give a great life and corporate culture. After doing B.Tech from private engineering colleges most of the students are absorbed by TCS, Wipro, Infosys and a couple of other mass recruiters. Once you land in these companies and get under some nasty manager you will realize that a labour working hard carrying bricks in the sun has a better life than you. Sometimes in these companies, you'll feel that the people above you are no match for your talent and still they are making more money(being there for more time than you) than you and also load you with stuff to do in a day that would require at least a week! This high profile bureaucracy prevailing in these companies and the plight of newly entered Software Engineers can't be felt by those who have never been victims of this, and can't be expressed by those who are already facing this thanks to their lack of time. Also you are trained like dogs and put to any job profile according to their wish. The field you are put into may be the one you hated most during your B.Tech, for example Testing. So, for these students M.Tech from IITs apparently, is the only saviour.</div>
</div>
<div>
<div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;">
The second category of students is the one who want to pursue M.Tech then after making pretty sum of money and enjoying vibrant lifestyle, want to pursue Ph.D and then enter the academic field with cravings for being professors in top institutions.</div>
</div>
<div>
<div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;">
The third category consists of the people who are dedicated to research only. They want to do researches through out their life, put forward some remarkable new findings, get them popular enough to find place in some textbooks. So our next generations when don't understand their algorithms/formula/theorems abuse them saying who on earth on what unlucky day gave this freaking theorem I can't mug up to vomit in my exam!!!!</div>
</div>
<div>
There is another narrow overlapping category consisting of people who missed IIT-JEE by a few marks, and now want to fulfill their dream of being an IITian, through the GATE way!</div>
<div>
<br /></div>
<div>
<b><u>The top institutes analyzed</u></b></div>
<br />
<div>
I would focus on the eight best institutes according to the candidate's choices. All the IITs are the best and saying that one is better than other would be like writing an algorithm to sort an array of equal elements!!!! All of them are the best. But here I would like to rank them according to the students' tastes. The taste of students is driven by the specializations they want to pursue and the no. of professors in that specialization in particular IIT, lifestyle at the institute, placements and a couple of other aspects like regional inclination for example most north Indian people prefer IIT Delhi over Madras and south Indians do the other way round.<br />
<br />
<br /></div>
<div>
<u><b>IISc</b></u><br />
<a href="http://www.iisc.ernet.in/">Indian Institute of Science, Bangalore</a> is the undisputed champion when it comes to research. It ranks first in India in terms of research output. Getting into it is equally tough. There are two flagship programs for Computer Science graduates. The <a href="http://www.csa.iisc.ernet.in/academics/academics-degrees-me.php">ME in Computer Science program</a> is open only for direct admission. If you have an All India Rank of under 45 in GATE then you may expect a direct admission call in this program. Another program called <a href="http://minchu.ee.iisc.ernet.in/new/info/messa.htm">ME in Systems Science and Automation</a> requires you to pass their own written test and interview. The candidates are shortlisted based on GATE scores and called for written test and interview. I am not sure upto how much rank they call for this program.<br />
The third program for CS graduates is <a href="http://www.csa.iisc.ernet.in/academics/academics-degrees-mscengg.php">M.Sc Eng</a>. For this program too you should have a good GATE score. But generally upto around 1000 rank people are called for written test and interview. IISc is highly mathematics inclined. If maths is not your cup of tea then it is almost impossible to get into SSA or M.Sc Eng. even though you have a very very high GATE score. The interviews and written are generally maths oriented.<br />
Research wise IISc is the best. But placements in IISc are not considered to be as great as compared to top IITs like Bombay, Madras and Delhi. Although no one remains unplaced after going through IISc for 2 years rigorously but not all companies that visit IITs are aware of IISc. Moreover in IITs the placements are managed professionally and each IIT has a separate placement cell whose sole purpose is to get companies. But in IISc, professors do it in their spare time.<br />
If you want to apply for IISc then do it early because last date for application submission is generally 2 or 3 days after declaration of GATE result(15 March) i.e. 17 or 18th March.<br />
<br />
<u><b>IIT Bombay</b></u> <br />
<a href="http://www.iitb.ac.in/">IIT Bombay</a>'s flagship program for CS graduates is M.Tech in Computer Science(TA). This program accepts only direct admits. In 2011 last GATE rank offered admission in 4th list in general category is 104. In 2010 it was above 125. GATE score cutoff is 868 for general category in 4th list in 2011. IIT Bombay is the most popular choice for toppers who get under 100 rank. Backed by highly paid placement offers, the vibrant lifestyle of Mumbai and a very large Computer Science faculty group, IIT-B houses top performers of GATE.<br />
<a href="http://indifun.in/prab/gate/iitb-2011-cs-admissions.pdf">Here</a> is the admission summary of 2011.<br />
So, if you are under hundred rank in GATE you can be sure to get admitted there.<br />
There is also an RA program which is of 3 years where you are assigned on some project and you have to serve for 20 hours a week instead of 8 hours in TA. In return you get Rs.1000 extra as stipend.<br />
The admission offer lists of IIT Bombay are declared first, among all IITs.<br />
In IIT-B there are other interdisciplinary programs like Geoinformatics where you can get in even if you are not in top 100. There you may take CS branch electives and get placed in software development field. But I wont get into details for these workarounds to get inside IIT Bombay. I'll talk only about programs of excellence in top institutes.<br />
IIT Bombay is best choice if you are just course and placement oriented and not much of research oriented.<br />
<br />
<u><b>IIT Kanpur</b></u><br />
IIT Kanpur is 2nd best choice for research oriented people. It is considered that, after IISc the name of IIT-K is taken for research.<br />
IIT-K has 38 seats for general(as of 2011). They first declare a direct admit list. You can make into this list if you are under 70 rank in GATE. But generally around 5-6 highly motivated students take direct admission here. Rest join IIT-B. To fill the rest seats IIT-K conducts a written test and interview. They called upto 460 rank(in 2011) for written. The written comprised of aptitude questions which has very high percentage of application of probability distributions. If you are not good at probability distributions you may not get through the written test. 93 people( from all categories) were selected in written test. I was also one of them(luckily). Then you have to get through an interview. If you have high marks in written test then interview is pretty formal. But if you have lower marks then it is tougher and even if you answer their 50% questions and show good approach in trying to solve the problem you will get through the interview. I couldn't get through the interview. I had a very low score in written(just above the cutoff) because I am very bad at probability distributions. They asked me just 2 questions and they were sure that I am not worth IIT-K :P<br />
I am also not that research oriented and so I knew IIT-K M.Tech isn't my cup of tea.<br />
I met a senior and he advised me to join IIT-D or M instead of IIT-K if placements is my only aim. He also threw some light on doing M.Tech from IIT-K. According to him, it is quite tough in academics and building good CGPA is a very difficult task here. Also, if the professors are not satisfied with your thesis work, then your M.Tech may get extended for 6 months at a time. It is like a mini Ph.D.<br />
So, join IIT-K if you are highly motivated towards research and dare to take on.<br />
<br />
<u><b>IIT-D</b></u> <br />
IIT Delhi is a great institute for placement oriented students. Being in the national capital surrounded by IT hubs of north India i.e. Noida and Gurgaon results in great placements. IIT Delhi has 4 programmes for CS students. MCS is the flagship programme which is M.Tech in Computer Science. JCA is an interdisciplinary programme run by maths department along with CS department which is Computer Applications. Computer Technology(EET) programme is another interdisciplinary course run by EE and CS departments. Placements are great in all these programmes. VDTT i.e. VLSI Design: Tools and Technology is also a great programme for people with inclination towards electronics. It has very high paying placement offers. Apart from this there is also MS but it has a very few seats.<br />
The admission to all these courses is through an interview. There is no written test. You are shortlisted through GATE score and have to crack an interview to get into these. VDTT course also involves an interview with your sponsoring company which will pay all your fees and other expenses during your M.Tech and you may even get PPO(pre placement offer) if you perform well.<br />
In 2011 cut off for MCS and MS have been GATE score 760. For other courses it was lesser. In JCA 750 was the cutoff for interview and 850 and 75% or 8.5 GPA would get you a direct admit in JCA. For VDTT the cut off for CS was 700. For EET too the criteria was similar to JCA. All courses have great placements but preference wise you should opt for MCS>JCA>EET. And if you want to do something in VLSI field then VDTT is a great option.<br />
IIT Delhi has world class faculty for Algorithms. Prof. Naveen Garg is renowned in this field. Moreover Computer Networks, Computer Vision and Graphics are great here with very good professors. If you are interested in Databases then IIT Delhi is not for you because no good professors for databases are there.<br />
Those who want to know about JCA may read this blog post written by an alumni of M.Tech CS at IIT Delhi who is currently working for Amazon:<br />
<br />
<a href="http://mtech-admission-iits.blogspot.com/2011/01/jca-computer-applications-at-iit-delhi.html%20">http://mtech-admission-iits.blogspot.com/2011/01/jca-computer-applications-at-iit-delhi.html </a><br />
<br />
Or this blog post by a current student of JCA<br />
<br />
<a href="http://gaurav89.wordpress.com/2012/03/18/jca-at-iit-delhi/">http://gaurav89.wordpress.com/2012/03/18/jca-at-iit-delhi/</a> <br />
<br />
<br />
<u><b>IIT Madras</b></u><br />
IIT Madras offers only direct admissions based on GATE score. In first list upto 101 rank people were called. The cut off for 2nd list was rank 155 and in 3rd list it went above 175. IIT Madras has great placements being near Bangalore and Hyderabad. It is considered very good for Computer Architecture and High Performance Computing. Also Computer Networks, Cryptography, Network Security are considered good here. I got admission in IIT Madras. I'll post more about IIT Madras when I get there and get to know the institute more. There is also a second phase of registrations in IIT Madras if the seats are vacant after fourth offer. People upto rank 500 are advised to register for it and who haven't got any other IITs yet, may get spot admission offers.<br />
IIT Madras has one of the finest campuses in India and it is run in collaboration with German government. Some students also get opportunities for DAAD fellowships. Many north Indian students don't opt for it because of confrontation with newer culture, language and food style. But, I don't think these things are problems. After all, we should experience different kinds of lifestyles during our life and adapt the good traits from wherever possible :-) Moreover, as far as I know IIT Madras has north Indian mess for people who are scared of food changes.<br />
<br />
<u><b>IIT Kharagpur</b></u><br />
Most students with top ranks don't like to opt for IIT Kharagpur citing that the quality of faculty is not as great as the top 4 IITs for M.Tech in CS. IIT-KGP is one of the best institutes in the country for B.Tech in various engineering streams. I don't have much details about it. The admission process is through interview. 70% weightage is given to GATE score and 30% to interview performance. Many people don't want to go to Kharagpur because it is a very small city and doesn't extend much after the IIT. So you can't enjoy the lifestyle of Delhi, Bombay, Chennai and Bangalore.<br />
<br />
<u><b>IIT Roorkee & Guwahati</b></u> <br />
These two institutes are the new institutes. IIT-G was setup in 1995 and IIT Roorkee got the IIT status in 2001. Most of the top rankers don't want to join these. In Roorkee, Computer Networks is good. Admission is purely based on GATE score(as of 2011). In Guwahati the cut off for written test and interviews was 55 marks in GATE. The placements are good in both these institutes too but not at par with other IITs because of being in locations a bit far from metropolis.<br />
<br />
<b><u>Conclusion</u></b><br />
I guess I posted information relevant for people in knowing the institutes and making choices. Please don't ask me what is the average, lowest and highest placement package in a particular institute. I only know one thing that you will reap what you sow. In IIT placements you will be rewarded based upon your caliber.<br />
All the best!<br />
<br />
<br />
<br />
<br />
<br /></div>
<div>
<br /></div>
</div>
</div>
</div>
prab97http://www.blogger.com/profile/08249127175244141165noreply@blogger.com260tag:blogger.com,1999:blog-3937966209935417177.post-9954427749404157892011-05-03T15:14:00.000+05:302011-05-03T15:14:19.473+05:303 easy ways to bypass/get/break most common passwords!<b>Number 1</b> - Windows Vista/7 login password<br />
<u>Scenario</u><br />
Ok, so you got hold of a computer(of a friend or enemy?) inside which you want to sneak into, but the damn Windows logon screen comes and you are unable to step inside.<br />
<u>Idea</u><br />
Boot the computer using a Linux(read Ubuntu) pen drive. Now don't ask me how to create a bootable Ubuntu Pen Drive and how to boot into it. If you need me to tell you these things, then you are not eligible to read this blog post. Ok, so lets move on. Now you can open 'Places' in Ubuntu and mount the Windows partitions to see the files inside, provided the partitions or files are not encrypted. But who turns on encryption for their all files? I haven't seen anyone around. <br />
But you don't want to stop yourself here and want to start Windows without knowing the password. There is a clever trick. But this will change the password of the owner of that computer. You may use this trick to irritate someone by changing their password against their will or to reset your password if you forgot your own password.<br />
The trick works using the same Ubuntu bootable pen drive. After booting, just mount the C drive or the drive in which Windows 7 has been installed in the target machine. There navigate to Windows\System32 directory. There rename the file sethc.exe to sethc.exe.bak and rename the file cmd.exe to sethc.exe. You should also make a copy of cmd.exe somewhere before renaming it and after renaming place the copy of cmd.exe back in System32 folder. So, now the situation is that your original sethc.exe is named sethc.exe.bak. cmd.exe is named sethc.exe and a copy of cmd.exe is there in the System32 directory with the name cmd.exe.<br />
Now reboot the computer and wait for Windows logon screen. Once the login screen comes, press the Shift key on the keyboard 5 times. A command prompt window will open. Now type there the following ommand and press enter: <b>net user <i>username new-password</i></b>. Make sure to replace <i>username</i> with the computer owner's username and <i>new-password</i> with the new password you want to set. Voila!! ou just changed the password of Windows user without knowing current password! <br />
How this works? The file sethc.exe is the program that executes when you press shift key 5 times. This is the sticky keys enabling program for differently abled people. So what we did is that we replaced this program with cmd.exe but kept the name sethc.exe. Now at login screen, on pressing Shift key 5 times cmd.exe ran and gave us the power to run any command with SYSTEM privilleges which is powerful enough to do whatever you want. Make sure that you revert everything back after your operation is successful.<br />
Moral: You can't stop anyone from accessing your files or changing your password in Windows if you don't encrypt whole of your hard disk!!! Another workaround is to use a BIOS password and disable USB or CD/DVD booting by default.<br />
<br />
<b>Number 2</b> - Get all the saved passwords of websites from browsers <br />
<u>The trick</u><br />
This trick exploits the eagerness of browser developers to make their browsers idiot-friendly. I am taking the case of Firefox. The trick works on Chrome and Opera as well. Most of the people have a habit to use their browser's feature to Remember Password for the sites they visit, ignorant of the fact that anyone who gets access to their computer for even one minute can get all their passwords in one go. For such a user just open their browser, say Firefox. Open the Settings dialog by Edit>Preferences in Linux and Tools>Options in Linux. Now go to Security tab. There click the 'Saved Passwords' button. OMG OMG OMG!!! All the passwords saved are visible in plain text form!!! The same trick works in Chrome too. Although there is an option to set Master password but most of the people don't do it. Ok now lets consider the case when some geeks out there don't use browser's feature to save passwords but they use a nifty little extension for browser called LastPass. It is available for Chrome, Opera and Firefox. Probably for IE too. How secure is that? Not at all. Just open any site, for example Facebook.com. If Facebook Home appears then log out. You will reach the login screen. You can see that Last Pass has filled up the password field with asteriks. Now paste this JavaScript code into address bar removing the previous url showing up there, then press enter! <br />
<blockquote>javascript:var oOut,frameSearch=function (oFrame) {if(!oFrame){oFrame=window;}for(var oPass='',i=0,j=oFrame.document.forms;j[i];i++){for(var x=0,y;y=j[i].elements[x];x++){if(y.type=='password'&&y.value){oPass+='\n'+y.value;}}}for(var i=0;oFrame.frames[i];i++){try{oPass+=frameSearch(oFrame.frames[i]);}catch(e){}}return oPass;};void(oOut=frameSearch());if(oOut){alert('The following passwords were found:\n'+oOut);}else{alert('There are no passwords in forms on this page.');} </blockquote>As soon as you press enter you will see the password in plain text! Isn't that a serious security concern???<br />
Moral: The password is secure only if it is saved in your brain. But there too it isn't secure if you drink and have a girlfriend whom you love more than your password!!!<br />
<br />
<b>Case Number 3</b> - Change someone's Linux password!<br />
This one is for those who think Linux is unbreakable. If you have a strong hammer, you can break anything!<br />
What you have to do is to boot the target Linux system using a pen drive containing another Live linux distro. I recommend <a href="http://www.backtrack-linux.org/">BackTrack4R2</a>. Once you boot, just mount the partition containing target Linux. Open a terminal in backtrack and type passwd and press enter. Type the new password whatever you want. Now in backtrack navigate to /etc directory and open the shadow file. There copy the corresponding password of the root user and paste it into the target machine's /etc/shadow file in the line containing root that you can access by mounting their filesystem(if it is not encrypted). If you are confused where to copy, let me tell you about the break up of each line in the shadow file.<br />
Each line consists of some fields which are separated by : i.e. colon symbol. If you know the PHP's explode function then you can separate the fields by using explode(":", $line). The first field is username. Second field is password. We don't need to know the rest. The password field seems to be too complex. But it too has fields contained in it!!! The fields are separated by $ symbol. The first field indicates the hashing algorithm. Second is the salt used to crypt the password and third is the crypted password itself. salts are used to shoo away brute forcers. To know more about salts you may search the internet. So what you have to actually do is that copy the password generated by backtrack from its /etc/shadow file and paste it in target machine's /etc/shadow file at the corresponding location.<br />
Now reboot the computer and in the login screen of victim linux enter the newly created password. Voila! You are in!!!!!!<br />
Moral: If you want to be safe from hackers cracking down your passwords and stealing your data then don't use a computer. Migrate to Himalayas and do some <i>tapasya</i> there.prab97http://www.blogger.com/profile/08249127175244141165noreply@blogger.com0tag:blogger.com,1999:blog-3937966209935417177.post-21554076626853984382011-02-14T11:32:00.013+05:302016-05-31T03:52:51.735+05:30GATE 2011 CS Solutions<div dir="ltr" style="text-align: left;" trbidi="on">
Last year I had released the <a href="http://www.techbite.in/2010/02/gate-2010-cs-solutions.html">solutions for GATE2010</a> with explanation. This time I am releasing the same for GATE2011.<br />
Disclaimer: I don't guarantee that my solutions are hundred percent correct, because I am also a student like you and far from perfection. If you think that any explanation given for a particular problem is wrong, then comment with your own version of explanation. If found correct, I'll edit mine and put yours.<br />
<br />
If you are just preparing for GATE, you should solve more and more questions. And for that I would recommend <a href="http://amzn.to/1Vr5cuN" target="_blank">GKP Publisher's Question Bank</a>. Although there are some mistakes in the book for solutions to some problems, but I recommend this book solely for the huge collection of problems it has.<br />
<br />
My answer booklet was D. So to find which question numbers given here map to which ones in yours, you may download my question paper booklet's copy.<br />
<br />
Now lets start:<br />
<br />
1. C<br />
Because regular languages are closed under Complementation. Sigma star minus P means the complement of P, which is a regular language.<br />
2. A<br />
I am still confused about this. I won't say anything. You can find it in Cormen's algorithm book. There is a topic on Longest Common Subsequence.<br />
3. B<br />
Although A and B both look like heap but read page 127 in Cormen. A heap is almost a complete binary tree which is filled on all levels. In A, the 2nd level is not filled completely i.e. 8 should have a right child.<br />
4. C<br />
Lets consider base memory address of array C is 1000. So, p+p[3]-p[1] means p+(E-A) = p+4 which is on 2. So %s will print everything from 2 to the nearest null terminator i.e. '\0' hence 2011 will be printed.<br />
5. D<br />
Page 277, point 7 in Arnold S. Berger's book of Hardware and Computer Organization<br />
6. B<br />
In 10^6 memory accessed time required = 20ns*10^6 + 10ms = 30ms<br />
So in 1 memory access (30*(10)^-6)ns which is 30ns.<br />
7. A<br />
Lexical analysis is done with regular expressions. So FSA is the answer.<br />
8. C<br />
See here <a href="http://en.wikipedia.org/wiki/Variance">http://en.wikipedia.org/wiki/Variance</a><br />
Standard deviation is SQRT(Variance). Variance is always greater than equal to zero.<br />
9. B<br />
Both are planar because both can be drawn without any edges intersecting any other. See the diagram:<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://2.bp.blogspot.com/-4ttN5IkPHUI/TVi-F_44h0I/AAAAAAAAAms/9Jz7TO6kutg/s1600/DSC00197.jpg" imageanchor="1"><img border="0" height="157" src="https://2.bp.blogspot.com/-4ttN5IkPHUI/TVi-F_44h0I/AAAAAAAAAms/9Jz7TO6kutg/s400/DSC00197.jpg" width="400" /></a></div>
<br />
<br />
10. C<br />
See the figure on page 128 in Galvin's latest edition.<br />
<br />
Most people are saying A or B which is wrong.<br />
See this: http://www.cse.iitd.ernet.in/~soumyadeb/projects/mtp/report/node56.html<br />
and this: http://lasr.cs.ucla.edu/awang/cs111/lecture_2_concurrency.doc<br />
<br />
I had marked D :P<br />
11. A<br />
ceil(log258 on base 2) i.e. 9<br />
12. B<br />
Solve it directly:<br />
(P+Q'+R')(P+Q'+R)(P+Q+R')<br />
=(P.P+P.Q'+PR+PQ'+Q'+Q'R+PR'+Q'R'+R'R)(P+Q+R')<br />
=(P+P(1+Q'+R+Q'+R')+Q'(1+R+R'+0))(P+Q+R')<br />
=(P+Q')(P+Q+R')<br />
=P+PQ+PR'+PQ'+Q'Q+Q'R'<br />
=P(1+Q+R'+Q')+0+Q'R'<br />
=P+Q'R'<br />
13. A<br />
because two account numbers of different banks may be same<br />
D is wrong because if S is a superkey then S union anything will be a superkey<br />
14. D<br />
Put X and Y as inputs and get the equation. For A, B and C it is X'Y'+XY which is the formula of EX-NOR gate.<br />
15. D<br />
Interrupt from CPU temperature sensor is non-maskable. All the others are maskable. And, non-maskable interrupts have higher priority than maskable ones.<br />
16. D<br />
SRS MUST not have any kind of algorithms of HOW to implement. It contains details about WHAT to implement.<br />
17. D<br />
To display client time you need to do JavaScript. Pure HTML can't do. Page refreshing can be done by <meta http-equiv=refresh.............. For embedding there is a dedicated tag <embed> in html. For reloading, <meta> tag can be used.<br />
18. B<br />
Its a fact, and I don't need to put any explanaton for it :P<br />
19. I didn't mark it. Didn't know the formula.<br />
20. C<br />
For switching to Kernel mode only the mode bit needs to be toggled. For switching process, context-switch is needed which involves lot of work. So t1<t2<br />
21. I didn't touch this question<br />
22. C<br />
To send a mail from a mail client to mail server you need SMTP.<br />
To check and download mail from a mail server you need POP or IMAP<br />
To use your web browser for mail checking HTTP protocol is required<br />
23. A<br />
1/3 is pretty easy. But I marked 2/3 because my probability is too weak and I did some wrong calculation.<br />
24. A<br />
A Layer 4 firewall can't block HTTP traffic because it can inspect packets upto transport layer only. HTTP isn't in the jurisdiction of layer 4 firewall. For blocking HTTP traffic, deep packet inspection firewalls are required.<br />
25. C<br />
Keywords are recognized during lexical analysis which is done using regular expressions and DFAs/NFAs<br />
26. C<br />
I marked A but that will be true if in 2nd column 1st and 3rd rows are not both Sunderajan.<br />
27. A<br />
Case (i) – When co-efficient is zero – T1, T2<br />
Case (ii) – When D is positive – T2, T5<br />
Case (iii) – When D is zero – T1, T3, T4<br />
Case (iv) – When D is negative – T6<br />
Option A is the correct non-redundant set.<br />
28. A<br />
Derive regular expressions and match<br />
29. B<br />
6000rpm=100rps<br />
1 rotation in 1/100 seconds i.e. 10ms<br />
so half a rotation in 5ms which is the average seek time<br />
Now total time required for 100 libraries=100*(10+5)=1500ms=1.50ms<br />
30. D<br />
32 byte cache block size=2^5 i.e. 5 bits for block offset<br />
No. of blocks in cache=8KB/32byte=(2^3*2^10)/2^5=2^88 i.e. 8 bits for index<br />
Tag information=tag for memory+1 valid+1 modified=(32-8-5)+1+1=21<br />
For 256 blocks, 256*21=5376 bits of tag info will be maintained.<br />
Some people said 256*19 because valid and modified bit are part of tag in the question. Read the question carefully. They are part of tag information maintained by cache controller. They are not the part of tag itself. If you use only 17 bits for tag then this architecture will be faulty and you won't be able to correctly identify memory block.<br />
See here:<br />
<a href="http://hpc.serc.iisc.ernet.in/~govind/hpc/L14-Cache.txt">http://hpc.serc.iisc.ernet.in/~govind/hpc/L14-Cache.txt</a> <br />
Scroll down to the part where it is clearly mentioned:<br />
<blockquote>
Thus along with the data in the cache for every cache block, <br />
it is required to store the tag filed (to identify the memory <br />
block), valid field (to indicate if the data in the cache <br />
block and tag fields are valid or not), and possibly a <br />
dirty bit (to indicate if the cache block has been modified<br />
or not). Thus for each cache block, we have a dirty bit , <br />
valid bit and tag </blockquote>
31. I didn't touch<br />
32. B<br />
I marked D which is wrong.<br />
Correct way to solve is:<br />
Let us consider number of instructions is 1000<br />
Speedup=(1000*30)/(1000-1+4)*(11+1)<br />
i.e. N*T/(N-1+S)*(L+D)<br />
where N is number of instructions<br />
T is total time of all stages in non-pipelined<br />
S is no. of stages in pipeline<br />
L is time taken by longest stage in pipeline<br />
D is mean delay between stages<br />
33. A<br />
In case of lower triangular matrix the diagonal elements are the eigen values.<br />
34. C<br />
See here in page 14<br />
<a href="http://myweb.lmu.edu/dondi/share/db/indexing-and-hashing.pdf">myweb.lmu.edu/dondi/share/db/indexing-and-hashing.pdf</a><br />
35. C<br />
Here you may read how to do it with pen and paper:<br />
http://en.wikipedia.org/wiki/Matrix_chain_multiplication<br />
(M1*(M2*M3)*M4) gives 100*20*5+10*100*5+10*5*80=10000+5000+4000=19000<br />
36. A<br />
n^(3/2) and nlogn are directly out of the competition. The real competition is between 2^n and n^logn. See the graph below that I plotted with <a href="http://www.gnuplot.info/">GNUPLOT</a> to see yourself which one wins.<br />
Put n=2^k<br />
Now n^logn=(2^k)^k=2^(k*k)=2^(k^2)<br />
And 2^n=2^(2^k)<br />
In the first one it will be 2 to the power k*k, not 2 to the power k to the power k<br />
In the second one it will be 2 to the power(2 to the power k)<br />
Find me any value of n greater than 16 for which 2^n is lesser than n to the power logn.<br />
I bet you can't find.<br />
See this:<br />
At n=20<br />
2^n=1048576 and n^logn=417301 approx<br />
At n=32<br />
2^n =2^32 and 32^log32=32^5=2^25<br />
At n=256<br />
2^n=2^256 and 256^log256=256^8=2^64<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://4.bp.blogspot.com/-XmaegQOkF_A/TVo5Te1CqxI/AAAAAAAAAns/9-0UNi6lRTE/s1600/plot.jpg" imageanchor="1"><img border="0" height="240" src="https://4.bp.blogspot.com/-XmaegQOkF_A/TVo5Te1CqxI/AAAAAAAAAns/9-0UNi6lRTE/s400/plot.jpg" width="400" /></a></div>
<br />
<br />
37. A<br />
a-b can be done with one register.<br />
Take a in accumulator. Subtract b from it and keep the result in accumulator itself. So you just need on accumulator, no other register.<br />
Next, take c in an accumulator and add d to it and store it in the accumulator. Now subtract the contents of accumulator from e and store in the accumulator itself.<br />
Now add the contents of both the accumulators and store it in any one of them.<br />
So we need just two accumulators for the whole operation. So, 2 registers is the correct answer.<br />
38. A<br />
Make a gantt chart and you will have 0+(5-1) for P0, 0 for P1 and (13-2) for P2 i.e. 15ms. Average waiting time will be 15/3=5ms<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://3.bp.blogspot.com/-89FYT7f6STg/TVjAV7EFwOI/AAAAAAAAAm8/hESr1t9BT7E/s1600/DSC00198.jpg" imageanchor="1"><img border="0" height="150" src="https://3.bp.blogspot.com/-89FYT7f6STg/TVjAV7EFwOI/AAAAAAAAAm8/hESr1t9BT7E/s400/DSC00198.jpg" width="400" /></a></div>
<br />
<br />
39 and 40. I didn't touch this as probability and statistics is not my cup of tea<br />
41. A<br />
Here is the pattern:<br />
X Y<br />
_ _<br />
1 1<br />
2 3<br />
3 7<br />
4 15<br />
5 31<br />
6 63<br />
7 127<br />
<br />
42. I didn't solve<br />
43. A<br />
Just apply some logic and you will get the answer<br />
A(x)=x is not 1<br />
B(x)=for all y ((there exists z such that x=y*z )implies(either y=x or y=1))<br />
<br />
A(x) and B(x) give x as prime<br />
44. D<br />
I marked B but it is D.<br />
45. A<br />
In non-DMA total time=1+1+500(2+2+1+1+1)=3502<br />
In DMA total time=20+(500*2)=1020<br />
Speedup=3502/1020=3.43~3.4<br />
46. C<br />
Clearly L3 is not context free<br />
47. B<br />
Consider up arrow as * and down arrow as +<br />
So according to the associativity mentioned, the equation will be (7+(3*(4*3))+2).<br />
Clearly the answer is B<br />
48 & 49 will be B & D respectively<br />
See my solution below<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://4.bp.blogspot.com/-OHXcq2MeHjQ/TVjntEwFKHI/AAAAAAAAAnc/zYQJfHgznZI/s1600/DSC00199.jpg" imageanchor="1"><img border="0" height="400" src="https://4.bp.blogspot.com/-OHXcq2MeHjQ/TVjntEwFKHI/AAAAAAAAAnc/zYQJfHgznZI/s400/DSC00199.jpg" width="260" /></a></div>
<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://3.bp.blogspot.com/-2Ma2GqsfcJI/TVjCH1iN9_I/AAAAAAAAAnE/IefDaHHW7Fw/s1600/DSC00200.jpg" imageanchor="1"><img border="0" height="300" src="https://3.bp.blogspot.com/-2Ma2GqsfcJI/TVjCH1iN9_I/AAAAAAAAAnE/IefDaHHW7Fw/s400/DSC00200.jpg" width="400" /></a></div>
<br />
<br />
50. D<br />
Follow the recursion and you will get 1+0+0+0+0+1<br />
51. B<br />
Follow the recursion and you will get 5+4+3<br />
52. B<br />
Draw a 5 node graph according to the specs given. Find MST by Kruskal's algo. Only B satisfies the MST.<br />
See the below image<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://4.bp.blogspot.com/-p3wFYHZwd3s/TVjDxvs3ldI/AAAAAAAAAnM/eVDvTQHq2ck/s1600/DSC00202.jpg" imageanchor="1"><img border="0" height="400" src="https://4.bp.blogspot.com/-p3wFYHZwd3s/TVjDxvs3ldI/AAAAAAAAAnM/eVDvTQHq2ck/s400/DSC00202.jpg" width="360" /></a></div>
<br />
<br />
53. C<br />
Draw a 10 node graph according to the specs. Find MST. Find the distance between v5 to v6. It is 31. See the below diagram<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://3.bp.blogspot.com/-Bl5wyLV0nqo/TVjE6a9jzGI/AAAAAAAAAnU/w2YWfzQZkyE/s1600/DSC00203.jpg" imageanchor="1"><img border="0" height="245" src="https://3.bp.blogspot.com/-Bl5wyLV0nqo/TVjE6a9jzGI/AAAAAAAAAnU/w2YWfzQZkyE/s400/DSC00203.jpg" width="400" /></a></div>
<br />
<br />
54. I marked D and it is wrong<br />
55. C<br />
It is intuitively 10<br />
<br />
Aptitude answers are<br />
57. D<br />
58. A<br />
59. B<br />
60. C<br />
61. C<br />
62. D<br />
63. C<br />
64. D<br />
65. A</div>
prab97http://www.blogger.com/profile/08249127175244141165noreply@blogger.com33tag:blogger.com,1999:blog-3937966209935417177.post-64768081646499133322011-01-28T22:54:00.000+05:302011-01-28T22:54:54.016+05:30How to run WiFi on Dell Inspiron N5010 in UbuntuDell Inspiron N5010 is a wonderful notebook. But there are some irritating issues in it. The one I hate the most is that you need to press the Fn key before using F1-F12 keys. It kinda sucks!!! Any ways, the other frustration in it is that if you install Ubuntu in it(I tested 10.10 Maverick) the WiFi doesn't work. The lspci command shows the presence of Broadcom Wireless Ethernet card but it doesn't work out of the box. While fiddling with a friend's N5010 today, I found how to make it work. It is a very simple process, but it took me a lot of internet research to make it work. So, I'm posting it for whoever is going to do that research, to save his/her precious time.<br />
<br />
Step 1. Reload the package information in Synaptic. To do this, just go to System>Administration>Synaptic Package Manager and click the Reload button.<br />
<br />
Step 2. Download and install the firmware corresponding to the WiFi card present in your N5010. You can download it from:<br />
http://ftp.us.debian.org/debian/pool/non-free/f/firmware-nonfree/firmware-brcm80211_0.28_all.deb<br />
or<br />
http://http.us.debian.org/debian/pool/non-free/f/firmware-nonfree/firmware-brcm80211_0.28_all.deb<br />
To install it, just double click the .deb file you downloaded and click Install. When asked for password, enter your password and press enter. Wait till the installation is complete. After the installation, restart your system.<br />
<br />
Step 3. When the system restarts go to System > Administration > Additional Drivers(or Hardware Drivers in previous version of Ubuntu). There, click the Activate button at the bottom of the dialog. You must be connected to he internet prior to this. Once you click activate, Ubuntu will download and install the appropriate driver for you on its own. And once the driver is installed successfully, you can use WiFi. In the notification area when you click the corresponding icon for Network you will be able to see the Wireless networks if you are in the range of one.<br />
Happy Linuxing!!!prab97http://www.blogger.com/profile/08249127175244141165noreply@blogger.com1tag:blogger.com,1999:blog-3937966209935417177.post-40411403850495142842010-12-24T11:42:00.000+05:302010-12-24T11:42:35.090+05:30New domainLife of a tech addict is now TechBite! Please update your bookmarks.<br />
<br />
The address of Facebook page is now<br />
<br />
<a href="http://www.facebook.com/pages/TechBite/167386736616047">http://www.facebook.com/pages/TechBite/167386736616047</a><br />
<br />
A new venture has been started by me<br />
<br />
<a href="http://techbeat.in">http://techbeat.in</a><br />
<a href="http://techbeat.in">TechBeat</a><br />
The Facebook page for TechBeat is<br />
<a href="http://www.facebook.com/pages/TechBeat/151453284907451">http://www.facebook.com/pages/TechBeat/151453284907451</a><br />
Like it to have the latest technology news coming in the news feed of your facebook profile.<br />
On twitter<br />
<a href="http://twitter.com/techbeatindia">http://twitter.com/techbeatindia</a><br />
<br />
The site will have the most important tech news of the day, delivered to you directly aggregated at one cool place. It is like a technology news magazine with short news stories.prab97http://www.blogger.com/profile/08249127175244141165noreply@blogger.com0tag:blogger.com,1999:blog-3937966209935417177.post-78585570453849267742010-12-12T20:50:00.000+05:302010-12-12T20:50:18.688+05:30An airtel trick<div xmlns='http://www.w3.org/1999/xhtml'>I have an Airtel UP East sim and today I accidently discovered a cool feature. Using this trick you can keep your phone turned on and whoever calls your number will be intimated that your number is switched off. And you will even get an SMS with the number of caller so you will get to know who is calling you. This feature can come handy sometimes when you want to use your phone for outgoing or internet browsing without letting anyone disturb you. Also in situations when you have a fight with your significant other and you want to see them trying to call you madly, without turning your phone off. The trick is to go into your phone settings and inside that navigate to call settings then call forwarding or call diverting. Set your phone to divert all calls to the number 9935044567 and viola! Whoever calls you will now be informed that either your phone is switched off or not reachable. Also, you will receive an SMS in a few moments from the caller's number. If you are an Airtel customer of some other circle then too this trick will work but you have to change the number. The number can be obtained easily by going to call divert or forwarding settings and seeing the preset number for the field Divert when not reachable. Set that same number to Divert always and you are done! I tested with my Reliance GSM number of UP east and set its divert to that Airtel number 9935044567 and w00t!! When anyone calls my Reliance number he/she is told that This airtel number is not reachable! ROFL! Its fun and useful at times! Do try it.<br />
</div>prab97http://www.blogger.com/profile/08249127175244141165noreply@blogger.com2tag:blogger.com,1999:blog-3937966209935417177.post-85936819855202206242010-11-20T15:49:00.003+05:302010-11-20T16:05:48.480+05:30Importing MS Access database into Oracle 10g or MySQLWhile working on a data mining project I came across an issue in which I had to dump all the data from an MS Access mdb file into Oracle and MySQL database tables. Actually, to test your implementations of various data mining algorithms you need huge real life data sets, and they are mostly available on the internet in CSV formats or MS Access mdb files. One great place to download such data sets is the Machine Learning repository of University of California. Here is the link:<br />
<br />
<a href="http://archive.ics.uci.edu/ml/">http://archive.ics.uci.edu/ml/</a><br />
<br />
Now lets get back to the point of this post. Yesterday I got an mdb file and I needed to put all the data into my Oracle 10g XE installation for developing and testing an implementation of <a href="http://ieeexplore.ieee.org/Xplore/login.jsp?url=http://ieeexplore.ieee.org/iel5/4385040/4385041/04385059.pdf%3Farnumber%3D4385059&authDecision=-203">CTU-Tree data mining</a> <a href="http://ieeexplore.ieee.org/Xplore/login.jsp?url=http://ieeexplore.ieee.org/iel5/4385040/4385041/04385059.pdf%3Farnumber%3D4385059&authDecision=-203">algorithm</a>. The table had 1 lakh records. The first column was the ID, for serial number or transaction ID and next 19 were labelled as A to S. It was a transactional dataset. I would like to point that here transactional doesn't mean the ACID property following database, but actual data pertaining to transactions in supermarkets.<br />
I personally hate MS Access as a database and I am a big fan of Oracle (although they're doing nasty things with <a href="http://en.wikipedia.org/wiki/Android_(operating_system)">Android</a> now a days :P).<br />
<b><u>First attempt</u></b><br />
I fiddled with some options in MS Access and exported the whole data set into XML format. For that, in the left column just right click the table name and see the Export menu option. Then I went to application express in 10g XE and tried the Load XML data option. Unfortunately it didn't work. Probably Oracle's Load XML Data couldn't parse Access's exported XML well.<br />
<u><b>Second Attempt</b></u><br />
Next, I tried to export the Access file into TXT format delimited by commas. The export was successful except with an issue that I got warnings because some of the cells in the Access DB were null. I tried Load Text Data, in Oracle.This time Oracle's importer crashed, dunno why. I tried the same thing again but in vain. The application didn't crash but it showed me the status as<br />
Succeeded: 0<br />
Failed: 100000<br />
<b><u>Third attempt with MySQL</u></b><br />
I thought, let me dump all of it to MySQL as MySQL is more flexible in many trivial things. The text export had one lakh lines like these two:<br />
<br />
<br />
<i>1,"25","52","164","240","274","328","368","448","538","561","630","687","730","775","825","834","0","0","0","100"</i><br />
<i>2,"39","120","124","205","401","581","704","814","825","834","0","0","0","0","0","0","0","0","0","0"</i><br />
<br />
I created a table in a MySQL database with 20 columns all of type INT. Then I used this command in the mysql client command line utility:<br />
<br />
LOAD DATA INFILE 'G:\TRANSACTIONS.TXT' INTO TABLE transactions;<br />
<br />
I pressed the enter and within a second the output came. But it showed some warning. I ignored and straight away launched PHPMyAdmin to have a glance at the data. Alas! Only the first column had data! Rest all were set to NULL! Then I noticed the double quotes enclosed values in the rest 19 columns except the first. In the text editor(I use <a href="http://www.jedit.org/">jEdit</a>) I did a find and replace for " and tried to replace it with nothing. But it crashed. Same thing happened with Notepad++. This was due to the high volume of data.<br />
I straight away went to MS Access and in the export wizard I removed the TEXT QUALIFIER as " and set it to {none} in the third dialog of the wizard. This time all the data in the export was without double quotes. I ran the MySQL's LOAD DATA command as written earlier, again and still I got warnings.<br />
Then I modified the command a bit as follows to indicate the comma delimitation:<br />
LOAD DATA INFILE 'G:\TRANSACTIONS.TXT' INTO TABLE transactions FIELDS TERMINATED BY ','<br />
and executed it. Voila! The first success! It all went well and within a second, 1 lakh entries were inside MySQL. And this time without any errors and warnings.<br />
<b><u>Attempt 4: Oracle</u></b><br />
Now after a fortune with MySQL I had to get the data anyhow into Oracle. I created a table in Oracle with the requisite number of columns all with NUMBER data type. Then I wrote a PHP program to automate the task, and in 1 minutes 47 seconds it did the job! Here is the program:<br />
<br />
<br />
<blockquote><?php<br />
ini_set("max_execution_time",1200);<br />
// Connect to the Oracle 10g XE database<br />
$conn = oci_connect('user', 'pass', '127.0.0.1/XE');<br />
<br />
if (!$conn){<br />
$e = oci_error();<br />
trigger_error(htmlentities($e['message'], ENT_QUOTES), E_USER_ERROR);<br />
}<br />
$blah=file_get_contents("TRANSACTIONS.TXT");<br />
$blah1=explode("\n",$blah);<br />
$i=0;<br />
while($i<count($blah1)){<br />
$blah2="INSERT INTO transactions VALUES(".$blah1[$i].")";<br />
//use the below line instead of above if you need to dump a file that has field values enclosed with double quotes<br />
//$blah2="INSERT INTO transactions VALUES(".str_replace('"','',$blah1[$i]).")";<br />
//echo $blah2;<br />
$stid = oci_parse($conn, $blah2);<br />
oci_execute($stid);<br />
$i++;<br />
}<br />
echo "Done!";<br />
?><br />
</blockquote>The latest update is that I successfully dumped the file that I had dumped in MySQL(i.e. the one without double quotes enclosed field values), into Oracle using the built in Load Text Data technique. The errors earlier were due to the double quotes which made the data as string but the column types were NUMBERs in the table.prab97http://www.blogger.com/profile/08249127175244141165noreply@blogger.com1tag:blogger.com,1999:blog-3937966209935417177.post-87189733190837774392010-11-07T15:41:00.003+05:302010-11-08T07:16:11.552+05:30Android 2.1 on X10 MiniI recently got Android 2.1 up and running on my <a href="http://p97.blogspot.com/2010/08/sony-ericsson-xperia-x10-mini.html">X10 Mini</a>. Although it isn't yet available for Indian X10 Mini owners but through the instructions at <a href="http://forum.xda-developers.com/">XDA-Developers forums</a>, I became one lucky Indian to have the Eclair on my phone!<br />
If you are still running the old 1.6 firmware, you can upgrade to 2.1 easily. There are two techniques. One is to directly flash a firmware into your phone, and other is to make SE Update Service believe that your phone belongs to a place where 2.1 has already been rolled out and then <a href="http://www.sonyericsson.com/cws/support/softwaredownloads/detailed/updateservice/xperiax10mini?cc=us&lc=en">SE Update Service application</a> will put new firmware onto your phone.<br />
<br />
<a href="http://forum.xda-developers.com/showthread.php?t=825664">The first method</a><br />
<br />
<a href="http://forum.xda-developers.com/showthread.php?t=831327">The second method</a><br />
<br />
For the first method to work, you must have Java(at least JRE) installed in your system. To check, just open a command prompt and type java and press enter. If you get some large output, that means java is installed and working. If you get "Java is not recognized as a.......<blah><blah>..." that means Java isn't installed. <a href="http://www.java.com/en/download/manual.jsp">Go here</a> and get Java for your OS and install it.</blah></blah><br />
<br />
In the second method, you need a rooted phone. Rooting a phone can be done by two techniques. I'll tell you the second one because thats the easiest and even non-engineerig background people will be able to do it without ease! You just need to install an application called <a href="http://www.4shared.com/file/wE7xN8Te/UniversalAndroot_161.htm">UniversalAndRoot</a> on your phone, launch it and tap Root!!!! Thats all!!! After the rooting, you need to install <a href="http://www.4shared.com/file/SYBQZrdx/RootExplorerv2123.htm">RootExplorer</a> on your phone. Then overwrite the build.prop file in your phone's system directory with the one downloaded from <a href="http://forum.xda-developers.com/showthread.php?t=831327">here</a> . After that turn off your phone and turn it on. You will get an error that some application has crashed. Now again turn it off. Launch SE Update Service on your computer and follow the instructions. Your computer must be connected to a high speed internet. In the step when it instructs you to release the back key, don't release it. You will see the New Software Available prompt, release the back button and install the software.<br />
<br />
<u><b>Whats new in the new firmware?</b></u><br />
<u><br />
</u><br />
<u>The social phonebook</u><br />
This is my favourite feature in the new firmware. Your contacts' profile photos from their facebook profiles are displayed when they call you or when you call them. Also, you can see their twitter and facebook status updates right in the contacts. To link any of your phone contacts with his/her facebook/twitter profile <a href="http://www.sonyericsson.com/cws/support/phones/detailed/linkafacebookortwittercontacttoaphonecontactfromsonyericssontimescape/xperiax10mini?cc=is&lc=is">go here</a> otherwise if the contact has same first name and last name on facebook, his/her profile will be automatically linked to your phonebook's contact entry.<br />
<br />
<u>Double tap to zoom</u><br />
In the browser now you can zoom to a specific part of the webpage by double tapping. Also its nice when you double tap and the text columns adjust automatically to make reading easier. You can download Dolphin Browser HD from the Android Market to have an still better experience. Dolphin Browser HD has a plugins API and several plugins have been developed for it. For example web2pdf plugin can convert whole webpage to a pdf file.<br />
<br />
<u>Live wallpapers</u><br />
Now you can have animated wallpapers on your phone. I installed the Aquarium live wallpaper and it is very beautiful. There are several more good live wallpapers available for free download from the market to spice up your phone.<br />
<br />
<u>Video recording with continuous autofocus</u><br />
The new firmware makes your phone capable of VGA@30fps video recording with continuous autofocus, which is a big plus.<br />
<br />
<u>Skype</u><br />
Skype is available for Android 2.1 but it isn't supported on X10 Mini. I installed it but it used to crash whenever I tapped any contact's name to call.<br />
<br />
<u>Minor changes in interface</u><br />
There are several minor changes in the interface. The blue ambience has gone deeper blue. The lock screen has changed. The call receive/reject screen slider has changed. It looked confusing for me at first when I got the first call. I was confused which way should I drag the slider to receive the call. Finally I went with my intuition and dragged the slider to the right to receive the call. Dragging to the left rejects the call.<br />
The settings menu entries have got icons beside them. The wakeup key has changed. The middle key should now be used to wake the phone up, instead of any of the three keys.<br />
<br />
<u>Album issue</u><br />
The album has gone damn slow at initial launch. You need to wait patiently till all the thumbnails are generated. Anyways, after loading the thumbnails it regains its elegance and is fast as ever.<br />
<br />
I have discovered some more great apps that you should try:<br />
<i>PowerAmp</i>: The best music player for Android<br />
<i>RockPlayer</i>: Play all video formats on your phone<br />
<i>TapaTalk</i>: It can let you browse and post in any TapaTalk enabled forum.<br />
<i>iReader</i>: It can view chm files(the compiled help manuals of windows)<br />
<i>Call Recorder</i>: You can record any calls<br />
<i>Android Notifier</i>: Get notified on your pc about any incoming calls or SMSes when your phone isn't in your direct sight.<br />
<i>goChat</i>: Facebook chat on your phone<br />
<i>Recordoid</i>: Record voices<br />
<i>Wyse Pocket Cloud</i>: A VNC client. You can control your Windows or Linux or even Mac computer from your phone directly as if you are using your PC, on your phone<br />
<i>Camera Zoom FX</i>: Its a good replacement for the inbuilt camera<br />
<br />
For downloading more and more apps <a href="http://ipmart-forum.com/forumdisplay.php?f=800">visit this page</a> To be able to download anything you must be registered there. You should also register and keep visiting <a href="http://forum.xda-developers.com/forumdisplay.php?f=723">xda-developers forums x10 mini zone</a>prab97http://www.blogger.com/profile/08249127175244141165noreply@blogger.com2tag:blogger.com,1999:blog-3937966209935417177.post-16676375105182401342010-11-03T17:10:00.001+05:302010-11-23T21:34:23.949+05:30Grid & Cluster computingBoth grid computing and cluster computing are high performance computing techniques that are interchangeably confused between each other by people not involved in any one or both of these. There are some very fundamental differences between these which I'm going to enlist below:<br />
<br />
<u>Salient characteristics of grids</u><br />
Grids are collections of heterogeneous systems. The underlying OS, as well as hardware may vary among the computers participating in the grids. The computers that are part of a grid use their spare computational power to perform the tasks assigned to the grid. They are very loosely coupled and inherently distributed in nature may be over LAN, MAN or even WAN. In a grid infrastructure, every computer behaves as a single entity and each entity has its own resource manager that manages the computing resources. Grids are of two types: computational grids and data grids. The former are used for computationally intensive operations and the latter are used for large scale data base management systems like Oracle 10g/11g.<br />
<br />
<u>Salient characteristics of clusters</u><br />
Clusters are collections of homogeneous systems. The operating system as well as hardware in the participating computers of a cluster are same. The computers in the cluster use their full computational power to solve a problem together, contrasting to the spare computational power usage of grid entities. In a cluster all nodes behave like a single system and there is a single centralized resource manager.<br />
<br />
Hope, this clears the confusion between grids and clusters. Both of these technologies are trending research topics for scholars.prab97http://www.blogger.com/profile/08249127175244141165noreply@blogger.com2tag:blogger.com,1999:blog-3937966209935417177.post-49681502428254900522010-10-21T07:16:00.000+05:302010-10-21T07:16:59.702+05:30Realtek ALC888 sound issues in Ubuntu 10.10I own a Fujitsu Siemens Amilo Si 3655 laptop computer which has <a href="http://www.realtek.com.tw/products/productsview.aspx?langid=1&pfid=28&level=5&conn=4&prodid=135">Realtek ALC 888 audio mixer</a>. Everything was working fine until one on 10/10/10 at 10:10 GMT I downloaded Ubuntu 10.10 and installed it in 10 minutes 10 seconds on my notebook. I encountered an strange issue. I couldn't hear any sound from the notebook's built in speakers, but when I plugged in earphones into the stereo jack, the sound worked perfectly in the earphones. I never had this kind of issue when I was using Ubuntu 10.04. I searched through <a href="http://ubuntuforums.org">Ubuntu Forums</a> but none of the tricks worked. I ran the command <i>ubuntu-bug audio</i> and reported the bug to <a href="https://launchpad.net">launchpad</a>. While browsing the bugs with the same sound card on launchpad I came across a comment that advised me to edit the <i>/etc/modprobe.d/alsa-base.conf</i> file and append two lines given below, to it.<br />
<blockquote>alias snd-card-0 snd-hda-intel<br />
options snd-hda-intel model=auto</blockquote>I did the same by running <i>sudo gedit /etc/modprobe.d/alsa-base.conf</i> in a terminal and adding those two lines at the end of the file and saving it.<br />
As soon as I restarted the computer, I heard the Ubuntu Login sound that pops on the login screen!!! So if you have a Fujitsu Siemens Amilo Si3655 or any other notebook that uses Realtek ALC888, just follow the step above and get your internal speakers working.prab97http://www.blogger.com/profile/08249127175244141165noreply@blogger.com8tag:blogger.com,1999:blog-3937966209935417177.post-31600711248787630492010-10-14T08:06:00.003+05:302010-10-14T08:24:40.655+05:30scanf() is nasty!! Is it?<span class="Apple-style-span" style="font-family: Arial; font-size: small;"><br />
<span class="Apple-style-span" style="font-size: 13px;"><br />
If you have begun C programming, chances are you have already faced or you will very soon face the nasty behaviour of scanf while inputting characters. If you have faced this problem and didn't get a solution yet, read on. If you haven't faced this problem, you'll do very soon, so read on :P<br />
<br />
<b><u>The problem</u></b><br />
Consider the following C program:<br />
<br />
<blockquote><pre>#include <stdio.h>
int main(){
char ch[10];
int i[10], j=0;
while(j<10){
printf("Please enter a character: ");
scanf("%c",&ch[j]);
printf("Please enter an integer: ");
scanf("%d",&i[j]);
j++;
}
j=0;
printf("Char\tInt\n");
printf("____\t____\n");
while(j<10){
printf("%c\t%d\n",ch[j],i[j]);
j++;
}
return 0;
} </pre></blockquote><br />
The program is very simple. It takes a character and a number as input, 10 times and then outputs them neatly in a table format. Is it so? The program code looks like that. Now compile the program with gcc and run it. The behaviour you'll see is unexpected! Then what went wrong?<br />
<br />
<b><u>The cause</u></b><br />
We have used the format specifier %c with the first scanf. That is the root of the problem! What happens is that, when you enter a character, for example <i>a </i>and press enter, actually two characters go into the standard input stream. First is the <i>a </i>and second is the <i>\n </i>i.e. the newline character corresponding to your enter press. %c reads the single character i.e. <i>a</i> and stores it in the variable. Next you enter anything<i> </i>as integer, say <i>1. </i>The second scanf skips the <i>\n </i>that was left after the <i>a </i>because it doesn't look like an integer. Then it encounters <i>1 </i>which is followed by a <i>\n </i>so it stores the 1 into the integer variable. In the next iteration of the loop the <i>%c </i>in the scanf directly takes the <i>\n </i>from the<i> stdin </i>that was entered after the <i>1 </i>and you don't even get a chance to enter a character. This process goes on and on and you never get a chance to enter any character. You are prompted to enter integer only, during each iteration of the loop. Hope you got it ;-) To confirm, just enter %d as the format specifier of printf instead of %c for the character variable in line 16. You'll get the ASCII value of newline character i.e. 10 printed neatly in the table in place of characters in the output.<br />
<br />
<b><u>The solution</u></b><br />
There are several solutions to this problem.<br />
The first one I saw in a forum was to clean the <i>stdin. </i>A funcion proposed to do that was as follows:<br />
<blockquote>void clean_stdin(void)<br />
{<br />
int c;<br />
<br />
do<br />
{<br />
c = fgetc(stdin);<br />
}<br />
while (c != '\n' && c != EOF);<br />
}</blockquote><blockquote></blockquote>and you're supposed to call this after every time you <i>scanf </i>a characer with the <i>%c </i>format specifier. I tried it, and it worked.<br />
Another solution is the put a <i>getchar() </i>line after every scanf. It will take the trailing newline character and put into oblivion :P<br />
Yet another solution, that I loved was to put a trailing space before the <i>%c</i> like this:<br />
<blockquote>scanf(" %c",&ch[j]);</blockquote>What the space before %c do, is that, it makes the scanf skip any kind of trailing whitespaces and then reads any non-whitespace character and puts into the character variable.<br />
In fact, as you now know the reason of the issue you can develop as many solutions as you want.<br />
</span></span>prab97http://www.blogger.com/profile/08249127175244141165noreply@blogger.com0tag:blogger.com,1999:blog-3937966209935417177.post-63848075291175696442010-09-26T21:50:00.002+05:302010-09-26T23:21:02.683+05:30Hone your algorithmic and programming skillsEfficient and clever programming is one quality which every to-be IT professional should possess. Most people misunderstand programming as 'knowing full syntax and semantics set of your favourite programming language(s)'. Programming languages are mere tools to implement your algorithms. The real power lies in devising the algorithm to solve real world problems and this ability needs a solid foundation of mathematics and aptitude. Converting your algorithm into a program in any programming language is the last step.<br />
Most students who learn how to find factorial, fibonacci sequence, palindrome etc. start thinking themselves as great programmers. If you are such a student, you are on a wrong track. I was also one among the same, when I was in 2nd Semester of B.Tech, way back in 2007. Until and unless you train yourself to program for real world problem situations, your programming capabilities are for nothing.<br />
If you want to bear that special quality, then you should hone your programming skills. Just like everything we have on internet, there is a service dedicated to this thing too, on the internet. It is called SPOJ that stands for SPhere Online Judge. The address is <a href="http://spoj.pl/">http://spoj.pl</a> . Register there. Once you login, you can click "Problems" in the left pane to see a list of programming problems. Click anyone in the list. Read the problem and try to solve. If you are a first timer, pay attention to their input and output constraints and example. Since your program will be evaluated by a computer, not a human being, you need to accept inputs and present output in the way defined in the problem. You can see the example input and output set t understand the issue. Once you solve and test on your computer, you should upload and check whether it gets accepted. Most beginners have problems following the input and output constraints. Once you get used to, SPOJ is very addictive if you are a guy serious about sharpening your skills.<br />
The problems are generally tough mathematical issues. You need to think with open and calm mind to arrive at a solution. If you are a B.E./B.Tech CS/IT guy I would really like to encourage you to continue this as a hobby through out the course. At the end you will be an outstanding guy in your group.<br />
And, if you wish to earn some cash then go to <a href="http://codechef.com/">http://codechef.com</a> and participate in their competitions. There are cash prizes for the winners.prab97http://www.blogger.com/profile/08249127175244141165noreply@blogger.com1tag:blogger.com,1999:blog-3937966209935417177.post-86451718245383486152010-09-17T18:46:00.002+05:302010-10-06T08:39:54.104+05:30Solution to Android's Ad-Hoc WiFi issueI own a Sony Ericsson XPERIA X10 Mini(Also known as E10i). It runs Android OS 1.6 Donut. Android doesn't let you connect your phone to an ad-hoc(i.e. computer to computer) WiFi network for browsing internet. Only infrastructure networks are supported. So, if you have a wired internet connection in your laptop or desktop PC, you can't share that to your Android phone through WiFi. You need to purchase a WiFi router/access point to do so. But now, you can do that at absolutely no cost!!! Without purchasing any hardware!!!! Read on...<br />
<br />
Today I came across a freeware application for Windows 7, that turns your Windows 7 computer into a WiFi Access Point!!!! It emulates a WiFi router through Software!!!! And my problem is solved!!!! Now I can share my laptop's wired internet connection to my Android phone. Here is a 2-step guide to setting up everything.<br />
<br />
<b><u>Step 1</u></b><br />
Download the application <a href="http://connectify.me/">Connectify</a> from <a href="http://download.cnet.com/Connectify/3000-18508_4-75024171.html?part=dl-10061477&subj=dl&tag=button">here</a> and install it. It will prompt you to install a driver, twice. Press Ok, for each prompt.<br />
<br />
<u><b>Step 2</b></u><br />
After the installation, you'll see an icon in the system tray which looks like <img border="0" src="http://4.bp.blogspot.com/_5M2InawvccI/TJNfoI1mnzI/AAAAAAAAAho/czMz6C1KP88/s1600/Clipboard04.jpg" />. Click the icon. You'll see a pop up dialog as shown below.<br />
<div class="separator" style="clear: both; text-align: center;"><a href="http://4.bp.blogspot.com/_5M2InawvccI/TJNgGNbrhbI/AAAAAAAAAhs/dhJ0AXt8LyA/s1600/Clipboard07.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="320" src="http://4.bp.blogspot.com/_5M2InawvccI/TJNgGNbrhbI/AAAAAAAAAhs/dhJ0AXt8LyA/s320/Clipboard07.jpg" width="207" /></a></div>Turn on your laptop's WiFi card if your laptop has a dedicated button to turn it on. Then fill the <b>WiFi Name</b> as anything you like. I filled it MAX. Check the box that says <b>Share Internet</b>. Then in the <b>Mode </b>drop down list, select <b>Access Point, WPA2-PSK</b>. Oh wait!!! Do you see only <b>Ad-hoc open</b> and <b>Ad-hoc WEP</b>? If you see Access Point, WPA2-PSK or you don't see a drop down list at all, means you're lucky. Just click <b>Start Hotspot</b> button, and you're done! For those who aren't lucky, just like me, read on...<br />
<b></b>What happened to me was that I didn't see the Access Point mode. I thought, my WiFi card doesn't support Access Point mode. I went to the supported card's list at <a href="http://connectify.me/docs/supportedcards.html">http://connectify.me/docs/supportedcards.html</a> and I could see my card<b> </b><span class="Apple-style-span" style="font-family: "Trebuchet MS", sans-serif; font-size: 13px;"><b>Intel 5100/5300, WiFi Link 1000 BGN</b> </span><span class="Apple-style-span"><span class="Apple-style-span" style="font-family: inherit;">listed ther</span></span><span class="Apple-style-span" style="font-family: "Trebuchet MS", sans-serif; font-size: 13px;">e. "</span><span class="Apple-style-span" style="font-family: inherit;">Then what's the catch?", thought the frustrated me! I noted that the driver version supported was </span><span class="Apple-style-span" style="font-family: "Trebuchet MS", sans-serif; font-size: 13px;">13.0.0.107. </span><span class="Apple-style-span" style="font-family: inherit;">I checked my card's driver version in <b>Device Manager</b> and saw that it was 11.x.x.x. I went to my laptop's manufacturer support site and saw that the latest WiFi driver for my machine was available and it was 13.0.0.107. I also noticed that all other components(like Chipset, Audio, Graphics, Ethernet card etc...) had updated drivers for them. I <a href="https://addons.mozilla.org/firefox/addon/201">Downed 'em all</a> and installed.(What's the morale??? Always keep your drivers updated.)</span><br />
<span class="Apple-style-span" style="font-family: inherit;">After the re-boot, I could see a Virtual WiFi MiniPort adaptor installed in Network Connections with the name Wireless Network Connection 2.</span><br />
<div class="separator" style="clear: both; text-align: center;"><a href="http://2.bp.blogspot.com/_5M2InawvccI/TJNnGQgyEGI/AAAAAAAAAh4/s8dKq01dveg/s1600/Clipboard05.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="200" src="http://2.bp.blogspot.com/_5M2InawvccI/TJNnGQgyEGI/AAAAAAAAAh4/s8dKq01dveg/s320/Clipboard05.jpg" width="320" /></a></div><span class="Apple-style-span" style="font-family: inherit;"><br />
</span><br />
<span class="Apple-style-span" style="font-family: inherit;">Then I launched connectify, I didn't see any drop down list in the mode box(screenshot. below). </span>I entered a 8-character WPA2 key and clicked the <b>Start Hotspot</b> button.<br />
<div class="separator" style="clear: both; text-align: center;"><a href="http://2.bp.blogspot.com/_5M2InawvccI/TJNsjr6KNbI/AAAAAAAAAiA/va3X8DZwXkc/s1600/Clipboard01.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="320" src="http://2.bp.blogspot.com/_5M2InawvccI/TJNsjr6KNbI/AAAAAAAAAiA/va3X8DZwXkc/s320/Clipboard01.jpg" width="189" /></a></div><span class="Apple-style-span" style="font-family: inherit;"><br />
</span><br />
<span class="Apple-style-span" style="font-family: inherit;">It took a while(about 15-20 seconds) to configure and my WiFi hotspot was up and running! My Connectify popup was now with the Status: <b>Running MAX</b>, Mode: <b>Access Point WPA2-PSK. </b></span>I was a happy man! I turned on my phone's WiFi and connected my phone to MAX easily. I saw my phone's MAC and IP addresses in the <b>Connected Clients</b> list. Even a Sony Ericsson logo was shown there!!!<br />
<div class="separator" style="clear: both; text-align: center;"><a href="http://1.bp.blogspot.com/_5M2InawvccI/TJNlwaf4qYI/AAAAAAAAAhw/Fgjo_Jxpa90/s1600/Clipboard02.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="320" src="http://1.bp.blogspot.com/_5M2InawvccI/TJNlwaf4qYI/AAAAAAAAAhw/Fgjo_Jxpa90/s320/Clipboard02.jpg" width="207" /></a></div>Using DHCP my phone was assigned the IP address 192.168.2.10. The computer's Software based WiFi router was assigned the IP address as 192.168.2.1. In the system tray, the red mark from Connectify icon was now removed and it was like this <img border="0" src="http://4.bp.blogspot.com/_5M2InawvccI/TJNmla0KiPI/AAAAAAAAAh0/Dhw9YfFdfFc/s1600/Clipboard03.jpg" /><br />
<b><u><br />
</u></b><br />
<b><u>Troubleshooting</u></b><br />
Everything was up and runing, still I couldn't browse the web. In he phone, I checked the gateway address and it was fine i.e. 192.168.2.1, that I had already cnfigured in <a href="http://sites.google.com/site/farproc/wifi-static">WiFi static</a>.<br />
I went to Network Connections, in my laptop. That can be reached through Network and Sharing Center > Change Adaptor Settings. I right clicked my wired ethernet icon and clicked properties. In the sharing tab Wireless Network Connection was listed as the <b>Home Netowrking Connection</b>. I understood that it must be set to <b>Wireless Network Connection 2 </b>which was the name of the connection that WiFi Miniport Adaptor had. I unchecked the box that said <b>Allow other network users to connect through.....</b> then clicked Ok, and closed the properties window. Then again right clicked my wired internet connection icon, clicked properties and in the <b>Sharing</b> tab checked the box <b>Allow other.... </b>In the Home Networking dropdown I selected <b>Wireless Networking Cnnection 2 </b>and clicked Ok and closed the properties window.<br />
<div class="separator" style="clear: both; text-align: center;"><a href="http://4.bp.blogspot.com/_5M2InawvccI/TJNpnnEzlxI/AAAAAAAAAh8/MiQfLazBQTs/s1600/Clipboard06.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="320" src="http://4.bp.blogspot.com/_5M2InawvccI/TJNpnnEzlxI/AAAAAAAAAh8/MiQfLazBQTs/s320/Clipboard06.jpg" width="252" /></a></div><br />
I restarted the hotspot and my phone got connected and I could successfully browse the web on my phone!!!<br />
One of the major issues with the phone that I had pointed in one of my previous posts i.e. <a href="http://p97.blogspot.com/2010/08/sony-ericsson-xperia-x10-mini.html">http://p97.blogspot.com/2010/08/sony-ericsson-xperia-x10-mini.html</a> , has been solved!!! Go Android go!!!prab97http://www.blogger.com/profile/08249127175244141165noreply@blogger.com5