Updates from February, 2011 Toggle Comment Threads | Keyboard Shortcuts

  • K 10:31 PM on February 28, 2011 Permalink
    Tags: , , , , , ,   

    Building a Modern Computer in 12 Steps – A Perfect Elective Course for Sem 3 of CSE 

    Just watched this Google Tech Talk on From Nand to Tetris in 12 steps by Shimon Schocken introducing a course he developed along with Noam Nisan:

    A must watch for all CS faculty of hardware, algorithms and systems.

    The course covers 12 projects to be done over a single semester covering building everything from basic logic gates to computer architecture, and from machine language to an operating system starting from a False and a NAND using a custom HDL. This led me to think over how wonderful it would have been if we had this course in our curriculum in the last sem. Here are my observations over some of the projects:

    • Elementary Logic Gates, Combinatorial Chips and Sequential Chips – perfect alternative for our Hardware Lab course, which never led to any real learning (only frustration in trying to get all that mess of little wires and chips on a bread board to work correctly). We even get to built an ALU in the 2nd project and memory in 3rd project.
    • Machine Language and Computer Architecture – ideal introduction to our Computer Organization course of this semester. Learning to create a simple assembly language (before diving into MIPS assembly) and a simple enough architecture using our own ALU created in 2nd project (before trying to by heart more complex MIPS architecture) would have added motivation for the 4th semester CO course.
    • Assembler, Virtual Machine, Programming Language, Compiler, Operating System – taught in still higher semesters here (5th and 6th) but it would have been so good to get an initial idea about all these before actually getting into the depth of these core areas of Computer Science making them more interesting to learn in the process.

    I always used to wonder how logic gates could be the basic elements of a computer, or how flip flops could form memory, or those 1’s and 0’s connect the hardware and software together. The whole course provides a deep insight on the functioning of a computer, letting one connect all those dots together and learn how they work together to form a wonderful machine. The course emphasizes on how abstraction (which many may call the core idea of engineering especially in circuit branches) can do wonders.

    I have already placed an order for my copy of The Elements of Computing book 3-days back, expecting to receive it on this Thursday and have plans to spend some time of the summer vacations doing projects from this course.

    Few links:

    EDIT (2011-03-08): Told about this course to Paleri Sir, got another perspective about this: it may lead students to underestimate the complexity of these sophisticated machines called computers. My take is that it will depend on the instructor and how she carries the course to make pupils understand and appreciate the sophistications involved in designing a real system.

    EDIT (2013-04-12): Updated link to course website.

    • Ershad K 10:45 PM on February 28, 2011 Permalink | Reply

      Wonderful 🙂 Thanks for sharing the info.

    • pramode 8:57 PM on March 9, 2011 Permalink | Reply

      Happy to know that more people are getting to know about this very interesting course!

      • Kartik 9:28 PM on March 9, 2011 Permalink | Reply

        Yeah, me and Ershad even bought the book to do these projects.

  • K 8:00 AM on February 28, 2011 Permalink
    Tags: , , , ,   

    The Branch Tour 2011 and me (Part 1) 

    Disclaimer: The following post is dedicated to all my branch mates and is a little more on the personal side. Additionally, the post is too long and may not be of any relevance for those who seek to attain any bit of technical nirvana from this blog. So, you may happily TLDR this post.

    Many have asked me why I decided to go for branch tour when almost none of the northies were ready to go. The reasons were many – the most prominent being I wanted to know my branch mates, to connect with them, share some laughs, joys together (the whole first year, the shy, not-into-cultural-activities Kartik in me had tried to stay away (read: not actively participated) from events like Sangam, Spectrum, Debutante which are meant for bringing the whole branch together – for this Rama (happy now?) had always cursed me). The other reason was that even after being here in Calicut for over a year and a half I had not tried to visit any places (Bangalore being an exception – which I visited 2 times last year for non-fun conferences). The northies not going for tour was not much of a problem for me as I thought over and realized I have had more and better Malayali friends compared to northies at least in my branch (yeah, I did try to get them involved too, but one by one everyone except Mamde backed out).

    Day 1 – Visit to Meenmutty Waterfalls and Pookot Lake, Wayanad

    The first day started by waking up at 4:30 and packing up my bag in a hurry. I had packed up everything in my laptop bag and realized just minutes before boarding the bus that I will need warm clothes too. Ran back to my room and packed up a few additional clothes in another bag (phew, this saved me from freezing at Ooty 3 days later).

    The two buses for about 70 of us left the campus at 6. I just knew that we were going towards Wayanad. After having breakfast and a few photo shoots, we traveled to Meenmutty waterfalls.

    Hiking for 2 kms followed to the falls and I can say the trekking was fun! I was reminded of good old days of childhood when me and my siblings used to play at our shop jumping and climbing on stocks of plywood and logs of wood. I found a new energy flowing in me. On the way were green, serene tea plantations which still behold my eyes. We visited 2 waterfalls for which we had to take different ways – first one was not that impressive, being so far from the viewpoint but the second one was what I call a real waterfall – many of the boys just jumped into the water (and many unwilling ones were either pulled in or slipped in!). It was a blissful sight, we just wanted to stay there forever. I started to discover the people of my branch during all this – the always lively (and ready with her handycam) Varsha, helping and caring Sachin, Delbin and Jaseem, the wild ones Bhasi and Pinki, the ever talking MG among others. On the way back we were served a cool drink of lime water in a shanty which was so relieving after all this climbing over the hillocks.

    Fish Curry Meals (lunch) was served in a Dhaba-like restaurant (which again reminded me of home place) where I (the veggie) had to do with the rice only. Me, Mamde, Syam and many more concluded in an after lunch discussion that this trekking was a perfect starting for the 4-day tour.

    Next up was Pookot Lake, where me and Mamde decided to go for boating recalling that it was such a long time since each of us did that earlier (I don’t even remember what age I was when I went for boating with my parents, probably in Electra World). It was 20-minutes fun well spent with many more boaters – Dipin, Jose, Nithin, Vineeth, Hashir, Aravind, Assim, Boban, Delbin, and Thridev – in the lake. After this followed a visit to a dam, where a lot of photographs were taken including those of the most remarkable (and much tagged on fb) body-show by Najih. It was quite a lovely place with the rising moon, and setting sun and the blue water.

    We left for Mysore. Stay at Comfort-Inn at night was, well, what else to say, a comfort. I had not stayed in such a good hotel ever (our room even had a working AC!). The first day was par our expectations of the tour.

    Day 2 – St. Philomena’s Church, Chamundi Hills, ZooBrindavan Gardens, Mysore

    The first place we visited after leaving Comfort Inn was the church. As I had never visited a church before (my closest was going to church, on insistence of my best friend Hitesh, the night before my 10th class results were declared only to find it closed, we were apparently too late), it was a new experience for me. I was reminded of all those Dan Brown novels and movies I had read and watched noticing the general attributes of the church. I had to do some pondering over my being an atheist when Nivetha asked about it. Some more photo sessions were done before we left for Chamundi Hills.

    Not until we had reached there I realized this too was a religious place – and far more like the typical ones compared to the church. Again flashes of my first visit to South India (just less than 2 years ago) and pilgrimage sites like Thirupathi-Thirumala and Meenakshi temples started coming to my mind. Thankfully we didn’t have to visit the temple and wait in the seemingly unending line here. We just roamed around taking more photos here and there. Girls seemed to find the place pretty amusing with all those shops selling artifacts and what I termed as girl-stuff. We did visit a small side-temple, which to my dismay didn’t even have a source of water anywhere nearby so I could at least wash my hands after removing socks and shoes. Another funny thing happened after I came out of temple, some priest just started tying a thread with rudrakhsha on my arm, which for some reason I didn’t object to. He kept on saying it’s for good luck and after finishing his job asked for 10 bucks, which I couldn’t refuse. The poor thread survived a mere 10 minutes on my arm. And I forgot to mention the time we (group of over 10 people) had waited for to get a glass of that ganne ka juice from the corner near the bus parking on the way towards temple. We observed how the juice-wallah kept on squeezing the canes again and again and again to extract the last drop of juice from them.

    Next in our (ever-evolving) itinerary was the Mysore Zoo (which won over Mysore Palace in a small hands-up vote only because of the fact that it houses the only Gorilla of South Asia). I voted for it again for the fact that my last visit to a zoo was I-don’t-remember-when (I must be 10 or even less). The zoo visit was overall fun and I tried to know more about so many kinds of different creatures. I was specially eager to see (a real!) white tiger, gorilla, rhino, hippo, African elephants, flamingos and giraffe. This was here that I really felt I should have had a better camera. Nivetha, Monix, Navya (or Varsha?) and Susmitha deserve special mention for tolerating me and my boring gyaan all this time in the zoo. BTW I noticed later the name of the zoo was Sri Chamarajendra Zoological Gardens, phew!

    Next we traveled to Brindavan Gardens which, I felt, had a lot of similarity to Akshardham Temple of Delhi because of the fort like walls and more because of the fountain show. As it was turning dark, I stopped taking pics with my good-old N72. We climbed over all those stairs to reach the fountain show area only to find no space left for us. Showing the branch spirit we all dropped down together to sit on the floor just a second before the show started. Somehow I felt, the fountain show could have been better if they had not included those Bollywood songs. Next one-two hours were spent roaming around the huge garden among sprinkles of water from so many fountains on all sides and more photo sessions in the grass lawns.

    The night was spent traveling to our next destination – Hoganakkal.

    So you managed to read all of the above? Congratulations! You deserve a special mention on this blog – get yourself one my posting a comment below :P. BTW there are some good and not-so-good photos I took during the tour available online, do take a look at my CSE Branch Tour – Picasa Web Album.

    This part 1 just mentions half of all I have to say about our wonderful first branch tour. I am still in process of writing the part 2, expect to read it tonight.

    • Jinto Jolly James 12:05 PM on February 28, 2011 Permalink | Reply

      Comprehensively Written 🙂 … I have been to the very same places with more than one class-tours, with different bunch of people.. Your descriptions were too good in the descriptive and argumentative tone and did initiate a collage of memories..

      p.s: I never knew that there are Flamingo’s in Mysore Zoo.. Thanks for the info.. Maybe something to look forward to, if I ever gonna go there again..

      • Kartik 3:14 PM on February 28, 2011 Permalink | Reply

        Thanks a lot for your comment Jinto. I am obliged to know this lead you to remember old memories. 🙂

    • Ashwin Jacob 11:35 PM on February 28, 2011 Permalink | Reply

      I guess I shouldn spoil the spirit by commenting!

      • Kartik 11:46 PM on February 28, 2011 Permalink | Reply

        Well, you are welcome to comment. Be it positive or negative.

    • ashwinbj 11:50 PM on February 28, 2011 Permalink | Reply

      Ok! I will comment after sometime! A negative opinion from a fellow student at the beginning itself will dampen this post!

      • ashwinbj 11:50 PM on February 28, 2011 Permalink | Reply

        Good work btw!

      • Kartik 11:52 PM on February 28, 2011 Permalink | Reply

        Don’t worry about dampening, who posts any useful comments these days anyway?

    • Delbin 12:38 AM on March 1, 2011 Permalink | Reply

      U missed the visit of a dam, where the body show of najih and group photo taking were happened.. I still dunno the name of that dam.

      • Kartik 12:43 AM on March 1, 2011 Permalink | Reply

        You should take a look again, it’s there! 😉

    • Pankaj Mamde 2:13 AM on March 1, 2011 Permalink | Reply

      It was the first time that I ate fishes in my life (actually to really “FILL” my tummy!).

      • Kartik 6:52 PM on March 2, 2011 Permalink | Reply

        so you have the occasion recorded on the Internet now!

    • Syam 6:24 PM on March 2, 2011 Permalink | Reply

      Your blog vividly reminds me of all those happy memories ! Great work ! 🙂

      • Kartik 6:51 PM on March 2, 2011 Permalink | Reply

        That’s the whole reason of writing this blog – not to forget those delightful memories. Thanks for your comment.

    • Ershad K 12:43 AM on January 6, 2012 Permalink | Reply

      Let me see what happened in Hoganakkal! Nicely written travelogue 🙂

      • Kartik 12:46 AM on January 6, 2012 Permalink | Reply

        Thanks Ershad, comments welcome on part 2 also. 🙂

  • K 4:00 PM on February 25, 2011 Permalink
    Tags: ,   

    Wow! Just noticed – my blog reached over a 1000 hits. Hope to be a more regular blogger this time.

  • K 3:48 PM on February 10, 2011 Permalink
    Tags: , , , ,   

    Input/Output using Text Files Without Diving into File Handling 

    It’s quite easy to use text files as input source or to redirect the output of programs to files if you happen to do programming on a unix/linux terminal.

    Let’s take an example of a usual random number generator:

    // random.c
    #include <stdio.h>
    #include <stdlib.h>
    int main ()
            int i, count=99999999;
            for (i = 0; i < count; i += 1)
                    printf("%d\n", (int)random());
            return 0;

    Let’s generate an executable by the name random.out for this program:

    gcc random.c -o random.out

    Then, to redirect it’s output we can use output redirection offered by the bash shell (tip: reduce the value of count in the code above if you don’t want to generate a 1 GiB file and waste both time and disk space):

    ./random.out > randout.txt

    The > (greater than symbol) redirects the standard output to the file named randout.txt.

    To use a file as input source, the < (less than symbol) is used, e.g.:
    ./quicksort.out < randout.txt

    You can also combine both redirections:
    ./quicksort.out < randout.txt > sortedfile.txt

    Another nifty concept is pipelining (or piping), which can be used to redirect output from a program as input of another, for example, to generate random numbers on fly and feed them to my quicksort program I can do:
    ./random.out | ./quicksort.out > sortedfile.txt

    In the above, input source files is not specified as required number of inputs are taken directly from random program. | (vertical pipeline symbol) enables this functionality.

    The program which you create for using these text files should just be able to receive the input and return the output separated by newline characters. Using a for loop for taking definite number of inputs is preferred.

    See also: Redirection on Wikipedia

    Don’t hesitate to leave a comment if this post helped you.

    EDIT (2011-02-24): Got into trouble while using this method for taking input in my DSA lab last week. Apparently this works only if the for loop for taking input does just that – input iteratively in an array – and nothing else. While calling insert function in a binary search tree implementation along with the scanf inside the input loop lead to weird input to the program. File handling seems to be the only solution in this situation. Though if you find any explanation for this behavior of bash shell, please do share in the comments.

    • K Dinesh 7:08 AM on February 17, 2011 Permalink | Reply

      Hi there !

      You can as well do this without writing a C program. There is a variable called RANDOM defined in bash enviornment that gives you random numbers between 0 and 32767. This variable keeps changing.

      So just a shell script that for loop doing echo $RANDOM can be used instead of the C program.

      Enjoying your posts. Keep posting. 🙂

    • Kartik 6:50 PM on February 19, 2011 Permalink | Reply

      Thanks a lot for posting your comment Dinesh. 🙂

      I will surely give a try to the method you suggested. However, it is limited to a small range of numbers, and in my case I was trying to play with over a million numbers.

      • K Dinesh 7:16 AM on February 27, 2011 Permalink | Reply

        Once you have a random source you can create any range of random numbers. For eg: you can do
        expr $RANDOM \* $RANDOM.

        • Kartik 8:38 AM on February 27, 2011 Permalink

          Wow! That’s nifty. Thanks for the tip. 🙂

  • K 6:50 AM on February 1, 2011 Permalink
    Tags: , , , , ,   

    Accessing NIT Calicut’s Ubuntu Mirror (in the campus) 

    As the FOSSCell webserver has been facing troubles these days, the instructions to use the Ubuntu Mirror of NIT Calicut that were available on the FOSSCell wiki are being missed by many. Here they are though not in the informative way as were given on the wiki:

    Add the following to your /etc/apt/sources.list and comment out other similar repos.

    deb lucid-updates main multiverse restricted universe
    deb lucid-security main multiverse restricted universe
    deb lucid main multiverse restricted universe

    Then update the repo database using:
    sudo apt-get update

Compose new post
Next post/Next comment
Previous post/Previous comment
Show/Hide comments
Go to top
Go to login
Show/Hide help
shift + esc