1st Year @ MIT – PART 3

Here comes , The Most Awaited Part of the Four Part Series of my First Year Experiences . This post took a very long time to me to write …

The Other Three Parts … ( m giving the links here . this way I get to increase backlinks and in turn my Page Rank ..hehe )

Part 1
Part 2
Part 4

From Delhi to Manipal :

I came by the most famous train for MITians .. MANGLA .. on the 11th January .. As usual , my friend Anirudh was with me and along with him , my friend Ankit ( 9.67 CGPA mind it .. ) and Abhishek was to board at Bhopal
The Train Journey went peacefully, we played UNO and saw a movie with couple of fellow batchmates ( one of them later on became a great friend of mine ) ..

Also , one important thing to note is that I was for the first time cursing the Indian Railways for being on time because my train arrived exactly on time and as a result , I had to leave my movie halfway .

Manipal :

The Semester was to start on Jan 14 .  I had reached on Saturday, 12th at midnight .Had pizzas from dominos as the train food sucked . I had physics cycle this semester which meant I had to study Engineering Graphics and work like a carpenter in the workshop wearing a auto driver’s uniform . As the sem progressed , my worst fears came true , I hated the studies like anything .. all physics and mechanical .. no computers . Imagine a computer science student doing soldering , welding and drawing designs using pencil ( not a software ) !!! . So , my marks went on a downward trend . My interest had reached a new “low” . As I had no interest in studying the college syllabus , I spent time learning PHP which turned out to be great for me ( Refer post on Web Dev Workshop ) . REVELS, our cultural fest was organised in March . I participated in some events and as usual no results . Then , we had Tech Weekend organised by IEEE Manipal in April . .I was one of the organisers of it and was helping in its website and registrations .

Then , my dreaded EG sessional came , guess what I got a meagre 19 out of 50 . EG was the first subject in my life till now which had the power to scare me .. (lol) . I had actually made all plans to come back early for the make – up exam .But , with help from friends and my birthday wishes I passed EG with a B grade . The EG exam was right on my birthday . Well , it was actually blessing in disguise . I had only one wish to make that was ” to pass in EG ” . Imagine having the most fearful exam on your birthday !! My exam went well and my day was made .

This semester went pretty fast and no major events happened .

PS : For the observant readers , I have mentioned about my train journey to Manipal in January twice in my blog.. Once here and once in the PART 2 post .. Did you notice this ?? There’s only a small difference between the both .

PS: This post is pretty much undescriptive. A long time has passed since the 2nd Sem

LUG Manipal – Install Fest and Web Development Workshop

Well , I finally had my first hand experience at organising a complete workshop. I had a amazing learning experience andI gained a lot of knowledge especially by solving doubts  .. I remember one of the doubts was how do we print “<br/>” using php .. Well , its pretty easy but still it took time for me to figure it .. Also , speaking on the stage for three days removed all traces of stage fear ..( lolz) ..

Install Fest :

LUG Manipal organisesd a Linux ( Ubuntu 9.04 to be precise ) Install Fest from 6th to 8th October . Well , this time , it was the job of the second years to do it . I being a noobie in Linux did not have much idea , so I just did whatever I was told by Saurabh . Here , I should congratulate Saurabh for the excellent organisation of the entire fest which went without any major hiccups .I gave a talk on Open Office and Viruses in Linux  in the second day of the fest . Also ,at the last day , I spoke on the upcoming Web Development Workshop .

Web Development Workshop :

A workshop on how to make web  pages covering HTML , MySQL and PHP conducted by LUGM .We ( LUGM ) focused on web development rather than web designing .We  were planning this workshop from around 6 months but due to many problems it could not materialise . I had prepared the slides way back in July .So , it was finally decided on the last day (  i.e 9th )  to conduct the workshop from 12th October 2009 . With only three days , we had plenty of work to do .The next day , we got the room booked ( NLH 405 ) . We got the top floor as there were manyother events going on . The posters were up the next day at all important places in MIT .SMS’s were sent with a request to “Forward to all ” . LUGM website , the wiki page and the Facebook Fan page was updated . Also , a facebook event was created to futher publicise . Manu, my classmate made class announcements in all the first year classes . He did the job single handedly ( Dunno why he likes the job so much ) . Meanwhile , slides were being given the final touches by Pratik and Saurabh . Me and saurabh made a comphrensive plan of the entire workshop detailing each and every thing . Our seniors suggested some changes and then we were all set to roll .

So , finally the D-Day arrived . I bunked two classes to be in time for the workshop even though I did not have anything to speak on the first day . The crowd was ok , almost the entire class room was filled . One more thing which I forgot to mention that I received a number of calls ( as my name and number was printed on the poster ) asking me for registration and if there is any fees for it .

Well , I don’t blame the first years for the ignorance of the fact that LUGM does not charge people . It is actually the work of other clubs who charge people for attending a workshop where a student is teaching you .Pretty funny isnt it ?   For the report, LUGM does not charge people for attending a workshop neither is there any registration . ( Check out the guiding principle of LUGM )

Coming back to the topic ,the first day went pretty well .HTML and beginning of MySQL was dealt with . As expected , the turnout on the second day was less than the previous day.  The second day consisted of MySQL and beginning with PHP . At the end of the day , we gave a small assignment which involved the use of forms and POST . I was glad that many had made the effort of completing the assignment . The third day basically consisted of integrating PHP with MySQL , Sessions and Cookies .On the last day , we were expecting a low turnout , but the turnout was far less than I expected . We had kept this day only for application , so we demonstrated a login page complete with Remember Me feature from scratch .Although the turnout was less but the response was amazing .We had divided the entire application into modules and then gave some time for the students to complete . I was glad that many were easily able to complete the modules in time .

For more ,

The post about the workshop on the LUG Website

Slides of the workshop

Refer to the Guiding Principles of LUGM

Wiki of LUGM

LUG Manipal Website

Facebook Fan Page

LUGM Forums

LUGM on Twitter

Trip to Hanumangundi Falls

The much awaited getaway from Manipal  … the first weekend trip of my sophomore year.

After many plans , finally I went to Hanumangundi Falls , a place only 2 hours from  Manipal . By the way , Manipal has manyamazing palces nearby and many are yet to be discovered .

Initially , a group of three including me were going .. But , in the morning two of my friends joined us .We planned to depart at 9 am but as usual I was sleeping till 8 30 ( even though a friend woke me up at 7 30 am). So , finally after much delay we started at 10 after having a nice breakfast .

In Short :

Caught a bus to Karkala then had snacks and bought stuff to eat .. took a bus to Hanumangundi Falls after much hassle ( as none of us knew Kannada ) . Finally , we reached our destination . Then we bought tickets worth Rs 20 each .

At the Falls :

After 387 ( PS : Anirudh really counted the number of steps ) steps , we reached the falls . No words can describe this moment . Wasting no time , we went right into the water . After getting accustomed to the icy cold water , we ventured right under the falls , it was just like being under a shower .. The only difference being here was the force of the water was much greater  ( BTW the height of the falls is 100 feet ) . Abhinav ( one of the accompany friends ) then made us have snacks sitting on the top of rocks with water everywhere around us . While I was happily munching away a packet of Lays .. a crab was trying the same thing with my feet . Poor creature , it could do nothing as I noticed it and tried to kick it away . Oh Yes , I was safe and sound , not even a scratch ( My apologies to all my enemies i.e if they are any lolz) . After having chips , biscuits and Coke , we finally came out of the water for a photoshoot . We went further down and were just starting to change clothes when we found another small falls of just around 10 – 20 feet . It was too tempting , so we again got drenched . Then , with much determination I came out and finally changed clothes .

Then the time came to say ” GOOD BYE ” and we started our upward trek ( 387 steps ) . As soon as we reached the top , we found a bus just going past us , we thought we wait and catch the next bus only to discover that the next bus was another one and a half hours away . We were dead tired , so we all sat down and just rested , without uttering a word . I was getting tensed about the bus as it was late and we were in middle of some place  with no means of transport and Yes no cellphone signals . All my worries went away as  the bus came . We waved frantically for it to stop.

I then slept off peacefully ( I like the Bus rides a lot ) only to be awaken at Karkala where we changed buses . On the way to Manipal , we made a plan to dine at Woodland in Udupi (PS:  it is not a shoe shop ).

After a wholesome dinner along with a dessert , we finally reached the hostel and I slept off .

Well ,this was probably my first memoir of a trip . I hope many more will follow .

For more info on Hanumangundi Falls , visit http://bit.ly/stHGq ..

PS : Forgot to mention , I bought a new pair of sandals while we were in Udupi . 

As usual , comments are most welcome .

Brainfuck ….

What’s the first thing that comes into your mind reading this ?? ( I am leaving the list empty ) ..
Well, let me break the suspense .. 
Brainfuck is a programming Language ..

From wiki ,

The brainfuck programming language is an esoteric programming language noted for its extreme minimalism. It is a Turing tarpit, designed to challenge and amuse programmers, and is not suitable for practical use. Its name has been variously bowdlerized. The name of the language is generally not capitalized, although it is a proper noun.

 How I came across BRAINFUCK  :

I came to know about this language through a senior ( Akshay Kothari ) … Infact , our LUG Manipal T-Shirts have a brainfuck code on the backside … Hence , I was determined to learn Brainfuck ..

I started with some basic stuff like Hello World.  Then , I started to write a code to display  ”BRAINFUCK IS COOL “

Here’s the code :

</p>
<p>+++++++++[&gt;+++++++&gt;+++++++++&gt;+++++++&gt;++++++++&gt;+++++++++&gt;++++++++&gt;+++++++++&gt;+++++++&gt;++++++++&gt;<br />
++++&gt;++++++++&gt;+++++++++&gt;++++&gt;+++++++&gt;+++++++++&gt;++++++++&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;-]&gt;+++.&gt;+.&gt;++.&gt;+.&gt;---.&gt;<br />
--.&gt;++++.&gt;++++.&gt;+++.&gt;----.&gt;+.&gt;++.&gt;----.&gt;++++.&gt;--..&gt;++++.</p>
<p>

 

Next on the list is to probably implement some of the basic programs like Fibonacci , Loops , etc

PS: With brainfuck , I have further increased my knowledge of different languages ..

For more info , WIKI

IInd Year : Formula Manipal , Ed Board and Techtatva …

The first month (July ) of my second year witnessed many dramatic events ranging from change of room mate to getting a website to design … It took me time to settle down .Too many changes  happened :  a new hostel , a new mess , a new class etc etc … I will soon upload photos  to my flickr account .

 In the end of July , I started designing the website for Formula Manipal using WordPress.. I chose WordPress because of its features like easy updation , user friendly , variety of themes etc etc . After installing wordpress over the server , I edited many features to custom suit their needs . Building a website using WordPress is very easy , so it just took me a week to complete .

The Website :  http://www.formulamanipal.com/

August came and life sprang back into Manipal (the usual rains ) .. I was well settled though longed to go back to my previous hostel . I continued working with my Manager Application based on PHP which I started in the summer holidays .. I applied for the College Ed- Board (Editorial Board ) ,and  half heartedly gave the interview in which our Associate Director ( Student Welfare ) grilled me for half an hour . Thankfully , I was selected along with my two classmates .

My First Sessional results also came and to my delight  I topped in my class ( 77%) .

September arrived and Techtatva ( MIT’s national level college fest ) came  . I was a organiser of Algosm under Param Category . Infact , the only work I did was to oganize the info desks set up by the first years . I took part in many events though a lot less than the last year . Another year of Techtatva went without any prizes for me . I hope I perform a lot better next year .

Thats all thats happened this semester ..

PS : Remember to check out the photos

1st Year @ MIT – PART 2

As you can see that this is the second part of the four part series of the experiences of my first year … Click here  for the part 4 and part 1 ..

The part 2 basically caters to the winter holidays after the first sem ….

DEC 4 : The day of the last exam . .. All the exams went pretty well .. Most of the day went in packing and “byes” .. I had a train (Mangla )to catch at night .. we were 5 people (Me, Anirudh , Aatif , Zubair and Appan ).. had a wonderful journey .. played CS in the train with a couple of KMC guys … The food was horrible but who cares about it when you are going home and have wonderful company.

Read the rest of this entry »

Where Did I go ????????

Its 48 days without a post … you must be wondering where did I go ?? I think its the longest time that this blog has been without a update …

Don’t worry , I am back with another post .. the continuation of the 1st year at MIT  PART 2 ..

Even though , now I have entered my sophomore year at college , I am still writing about my first year because you can never forget your first year …

I will write in detail about my second year in another post . For now, the important events till now :

I was too busy with college life .. many things changed.. a new hostel .. a new section .. etc etc ..  I made the website of Formula Manipal ( http://www.formulamanipal.com ) using WordPress  … I also got selected for the ” ED BOARD ” of our college ..  First sessionals passed off peacefully .. I topped in two of the subjects .. Now , Techtatva is coming up .. Hope this year turns out to be a lot better for me ..

PS : If you have any suggestions for the Magazine of MIT  , please visit http://www.magmit.com and post it there .. or leave as a comment .. I will forward it to the Editor ..

Remember Me option

Well , I was making a small login script which authenticates the user name and the password . I had completed it .. not a big task .. But , then I thought why not put up a Remember me option . The one which when checked , remembers your user id or password depending upon the implementation .

I made one which remembers the user name , so you dont have to type the user id every time you login .

This is the screenshot of the login page .

rem me

I am only giving the code for the Remember Me part.

Here’s the code :

This displays the checkbox . This should be inside a form.

<input type="checkbox" name="Rem" />Remember Me

This creates the cookie named ‘remember’ . Write this code where you process the form .

< ?php
if(isset($_POST['Rem']))
 {
 setcookie('remember',$_POST['user'],time() +60*60*24*30 );
 }
?>

I have set the cookie to expire in 30 days from the current time . You can set whatever you wish

time() displays the amount of seconds since epoch i.e  00:00:00 UTC on January 1, 1970

60*60*24*30 is the number of seconds in 30 days .

Now , to display the user name , if the remember me option was selected . This should be where you display the form . (the same file in which you had writtenthe remember me option ) .

< ?php
if(isset($_COOKIE['remember']))
 {
 echo "<input name =\"user\" type=\"text\" id=\"user\" value=".$_COOKIE['remember']."/>";

 }
?>

Note : I have made the remember me option only for the user name . If you want the password to also be remembered, then set another cookie for password in the same way .

As always , comments are most welcome !!!

1st Year @ MIT – PART 4

The first question that comes to your mind will be ”Where is part 1, 2 and 3?” For all those ignorant readers part 1 is here . But, still part 2 and 3 is left. Well, you can’t find them on the blog because I am still writing them. So, the question now arises why PART-4 before the other two parts. To understand the answer, let me first tell you how the 1st year is divided into 4 parts (2 semesters +???).

PART 1: First Semester (16 July – 5 Dec)

PART 2: Holidays after the first semester (6 Dec – 11 Jan)

PART 3: Second Semester (12Jan – 29th May)

PART 4: Holidays after the Second semester (30th May – 19th July)

Many of you would disagree with my division of the year into different parts but in an engineering student’s life, this is how it is. So bear with me!

Now , coming to the point , the reason of releasing part 4 before the other two is simply because PART 4 is still fresh in my mind … I will have to go deeper into my mind for the other two parts (lolzzz…..)

First Three days ( May 29 , 30 and 31 ) : 29th May was the last working day which also coincided with  my Engineering Graphics Exam .. and more importantly my BIRTHDAY.. (I would describe my experiences of E.G. in detail in PART 3 )..  My birthday celebrations were mixed with packing woes ( I had to pack all my stuff and lock it up in the common room ) … but despite the busy schedule, my friends had time for the coveted “Birthday Bums “.

Rajdhani Express, boarding time, 6.50 am, May 30th : As I got late packing my stuff, we planned to go on for a night out, and thus ordered pizzas. We went on to play scrabble for like 4-5 hours and then it was departing time. It was the first time, that there was no one else on my ticket but still I knew a couple of friends on the same train. As soon as I boarded, we were given breakfast in which I noticed a considerable drop of quality from earlier. I won’t go into much of the details except that I slept most of the time, read a novel and played cards. I knew few people in my compartment and made friends with the rest. I reached Hazrat Nizzamudin on 31st May at around 2.30 pm, the train was late by around 3 hrs (I hope Mamta Banerjee does something for these delays). Then, I went up to the wrong gate of the station (the Nizzamudin station has two gates).

I reached my home finally at 4 pm and then had a hearty lunch (the famous Mummy ka khaana). In the evening, I went to Nirula’s to have my favorite ice cream (Butterscotch flavor).

June: June went off pretty peacefully without much major events. I had started to become an internet addict thanks to the free Wi-Fi by my neighbors. I was online most of the time. Chatted almost daily with five different people, increasing my contacts manifolds. Well, it was great saying “hi” to the same person five times a day (Aamir and Prateek would understand it much better). I also honed up my skills of programming (learnt JS, PHP, CSS, and HTML). Then, came the 10th of June the R-DAY (results came out). I was very anxious about my result this time because of EG. I got to know my result when I was in a dentist’s chair (imagine getting to know your result when a doctor is operating upon you). So, the question arises what’s my GPA (Grade Point Average), a modest 8.38 and CGPA 8.77

Many would think of it as a very good one. I am not boasting but being ambitious I expect more of myself.

One of the major things that happened was that I got a Learner’s License made and started learning driving. Well, it was cool to be in the driving seat.

Me and my school friends had two reunions this time around. Even after two I could only meet up half my class. It was great to meet my friends after a gap of six months. We played cricket, TT, pool, carom and HIDE N SEEK (that too in the biggest mall in NOIDA, The Great India Place). I suggest all my readers to try playing hide n seek in a mall; believe me its great fun running around with all the onlookers staring.

July: The onset of July saw to an enhancement of my driving skills (took a couple of U – turns etc.). I met up with my friends once again. But this time at the heart of Delhi, Connaught Place. This was our third reunion which saw an increase in the boys to girl ratio by a great deal (there were 3 girls and 4 boys, a number never seen before).  We spent a lot of time hunting for an eating place (imagine we couldn’t find an eatery in CP!!!).The most important outing of this month was the visit to my school .. It was a great time meeting all the teachers after you have passed out … I have to mention here , the change of attitude one sees when we meet our teachers after passing out .. Almost every teacher of mine told us that ours was the best and the most disciplined batch they had ever taught, but during school , I remember hearing the opposite  .. The only irritating thing was that I had to repeat the answer to “what I was studying ?” almost 15 times … I managed to watch ICE AGE 3 with my friends .. Also , I went a couple of times with my family for a outing …

As only 12 days have passed there is nothing more to add. But we friends plan to watch the much awaited movie Harry Potter – 6, first day first show and be the guinea pigs of reporters.

After such a roller coaster of events in these holidays I am really looking forward to the re-opening of college. Ah yes , I would be a senior …

PS : This is the first time that a post on this blog by me has been edited by someone . I am grateful to Anirudh ( for editing ) and Prateek  ( for critical comments ) for their help …

SAVING PASSWORDS

Well , I was working on a small site … in which I had to save passwords of many users ..  Till  a week ago , I used to save the passwords simply as a string which means anybody having the access to the database could have viewed the password .. which is a serious security breach but I had not paid any attention to it … till the time my friend (Manu ) told me to use MD5 for hashing the password.. I searched on google about it … it was very simple … But ,I am still writing this post so that people beginning with php could benefit ..

Here is the syntax :

string md5 ( string $str [, bool $raw_output= false ] )

It returns the hash as a 32-character hexadecimal number.

Here is the detailed description

So , when you check the user if he has logged in using the correct password , you do like this :

include 'includes/mysqlconnect.php';                   // include mysql connections here
user=$_POST['user'];
 if(get_magic_quotes_gpc())
 $user=strippslashes($user);
 $user=mysql_real_escape_string($user);
 $sql="SELECT * FROM user WHERE Username='".$user."'";
$result=mysql_query($sql);
$row=mysql_fetch_array($result);
$password=$row['Password'];
if($password==md5($_POST['pass']))           // pass is the name of the variable which contains the password
echo "Correct password";               // you have established the fact that the user has entered the correct password

In this small code , I compare the password entered by the user in a previous page which is passed on to this code by POST with a variable name ‘pass’ . I first select the password of the particular user then store it into a variable named password and then compare it with the md5 hash of the POST variable ..

Now , suppose if you have already saved many passwords into your database ( this happened with me ), then how to go about it ..One option is that you can ask all your users to reregister .. but that would surely be a waste of time ..

So , I wrote about a php script for it .. ( I am sure all experienced coders would find this very easy )

include 'fm2/includes/mysqlconnect.php';            // the mysql connections
$sql="SELECT * FROM user ";
 $result=mysql_query($sql);

while($row=mysql_fetch_array($result))
{
 $password=$row['Password'];
$password=md5($password);
$sql2 = "UPDATE `info`.`user` SET `Password` = '".$password."'  WHERE `Username` = '".$row['Username']."'";
 $result2=mysql_query($sql2);
}

Simply save this as .php extension and run the file .. Remember to include the mysql connections  ..

Here , you take the data of all the users from the database and then md5 each password then save it to the database …

Interested people could read on to know that breaking a md5 is almost impossible … click here

I hope this little piece of code helps someone …

PS: If anyone has anything more to share on saving passwords , he/she is most welcome .. Use the comments section or the contact me page ..
BTW , I discovered how to post codes in wordpress ..

UPDATE :

As suggested by ankur and djays , you could make your password more secure using sha and salt ..
First generate the salt ( as given by djays in the comments)

$salt = substr(str_pad(dechex(mt_rand()),8,’0′,STR_PAD_LEFT),-8);
$secured = $salt . hash(’sha256′,$password.$salt);

Then save both the salt and the secured in your database .

When ever you wish to authenticate the user , select the salt and the password for the particular user and then generate the $secured using :
$secured = $salt . hash(’sha256′,$password.$salt);
Now , compare the $secured and the password from the database . If they match , then the user has entered the correct password .