Karan Parikh http://www.karanparikh.com Programmer | Student | Human posterous.com Wed, 16 May 2012 13:21:00 -0700 Reflections on Spring 12 http://www.karanparikh.com/reflections-on-junior-year http://www.karanparikh.com/reflections-on-junior-year

Wow. I guess I'm a senior now. Feels a bit strange to be honest. I've grown a lot these past three years, and I can't wait to see what my last year at UIUC holds. I feel that my next two semesters are going to be as crazy as Spring 12 was. I'm pretty sure I will be taking 18 credit hours each semester, and am also looking to do some research. 

Let's talk a bit about Spring 12. CS 473: Algorithms was AWESOME. It was a lot of hard work, but the material that I learnt in that class is invaluable. My favorite topics had to be Greedy Algorithms and Dynamic Programming. There is just something beautiful about these two topics that appeal to me. In CS 440: AI, I enjoyed our discussions about Bayesian Networks and HMMs tremendously. I'd come across these terms before but could never fully understand what they meant, or why they were used. 440, and it’s book, changed that. I also improved my Python skills in this class since I did all the programming assignments in Python. CS 421: Compilers was another great class. I came into the class not caring much about compilers in general, but along the way I developed an appreciation for language design, parsers, interpreters and compilers to such an extent that I’m considering taking more advanced compiler classes before I graduate. 

The only thing that disappointed me about Spring 12 was that I didn’t have the time to learn a new language/framework/database etc. Hopefully, I shall make up for that this Summer. 

 

Permalink | Leave a comment  »

]]>
http://files.posterous.com/user_profile_pics/1327313/164823_10150365401275402_561030401_16724183_6417567_n.jpg http://posterous.com/users/1lxnkZxp9MoF Karan Parikh karanparikh Karan Parikh
Sun, 11 Sep 2011 17:13:00 -0700 Post Facebook Camp Hackathon, Pre Yahoo Open Hack All Stars 2011 http://www.karanparikh.com/post-facebook-camp-hackatho-pre-yahoo-open-ha http://www.karanparikh.com/post-facebook-camp-hackatho-pre-yahoo-open-ha

Facebook held it's Camp Hackathon at UIUC yesterday, and it was another great experience. Sam and I built a system to remotely control your iTunes music library via text messaging, a web interface and voice. Technologies used were Python, PHP, Twilio and NodeJS (NowJS and Express). I'm a huge fan of NowJS, it's an excellent product that makes realtime communication in NodeJS so much simpler, and it opens up a world of possibilities in terms of applications that can be built. It's the fourth time I've used this library, and each time it's elegance blows me away. The same holds true for Express.  Robust and easy to use (though we didn't use it heavily for this project). All the text messaging stuff was handled via Twilio, another service that I am a huge fan of. 

Heading out to New York tomorrow for the Yahoo Open Hack All Stars 2011. I'm super excited for this event and can't wait for the competition to begin!

Permalink | Leave a comment  »

]]>
http://files.posterous.com/user_profile_pics/1327313/164823_10150365401275402_561030401_16724183_6417567_n.jpg http://posterous.com/users/1lxnkZxp9MoF Karan Parikh karanparikh Karan Parikh
Tue, 02 Aug 2011 21:35:00 -0700 Snip: pastie.org clone using Express and Redis http://www.karanparikh.com/snip-pastieorg-clone-using-express-and-redis http://www.karanparikh.com/snip-pastieorg-clone-using-express-and-redis

I've been wanting to learn and write something using Redis and Nodejs for the past few days. While scouring the Internet for knowledge I came across this article that describes how to implement a simple pastie.org clone using Redis and nodejs. I used this article as 'inspiration' and modified their sample application.

Instead of using Nerve for routing and returning html in the form of a string, I decided to use Express to build the application and Jade for the templates. I also replaced Pygmentize, used for syntax highlighting, with a Javascript syntax highlighter. Lastly, I swapped the Redis module 'redis-client' with the recommended 'redis' module instead. I then rewrote the application using these new tools.

Code is here. 

 

Permalink | Leave a comment  »

]]>
http://files.posterous.com/user_profile_pics/1327313/164823_10150365401275402_561030401_16724183_6417567_n.jpg http://posterous.com/users/1lxnkZxp9MoF Karan Parikh karanparikh Karan Parikh
Mon, 01 Aug 2011 19:22:00 -0700 Linkedin Intern Hackday http://www.karanparikh.com/linkedin-intern-hackday http://www.karanparikh.com/linkedin-intern-hackday

WOW.

That is pretty much all I have to say after getting back from the Intern hackday. The sheer level of technical wizardry on display was ridiculous. There was a VNC client implemented in Javascript, a multiplayer capture the flag game that used nodejs + WebGL, a webapplication that allows you to share files by 'streaming' it to another user (no storage on an intermediate server) written in Django ... all in all, absolutely amazing. Sam and I built a web based AI, called 'Sherlock'. We used a homegrown audio recorder + chunker written in Python, Google + Bing + Qwiki APIs and NowJS for server-client distribution. I was really happy with how our application turned out in the end, it looked great and functioned pretty well. We made the final 15 (out of 45 teams) and I am really proud of what we accomplished over the course of 16 hours. 

For the curious, the winners were: 1st prize was the capture the flag game, 2nd prize was taken by Linked Out (an application that used data available on Likedin to predict who will change jobs) and the 3rd prize was grabbed by the Django-streaming-file-sharing application (they called themselves Beamit). 

#inday, I shall miss you.

 

Permalink | Leave a comment  »

]]>
http://files.posterous.com/user_profile_pics/1327313/164823_10150365401275402_561030401_16724183_6417567_n.jpg http://posterous.com/users/1lxnkZxp9MoF Karan Parikh karanparikh Karan Parikh
Mon, 25 Jul 2011 23:07:00 -0700 On Django http://www.karanparikh.com/on-django http://www.karanparikh.com/on-django

A week or two ago I started learning Django, and wrote my first app, a simple contacts book thingy. Right from the get go, I was amazed by how everything felt so natural in Django, at least to me. The MTV pattern seemed really intuitive and I had no problem diving right in and creating an app. The Django documentation is extremely well written and answered all the questions I had while coding. Even though I was creating my first Django app, I had no problems in incorporating generic views, model forms, pagination etc. In order to have database migration support (yes, I kept changing the schema even for a simple app :p) I installed South and everything was smooth sailing from there. The last thing I want to add to the app is search capabilities, and for this I've decided to use the Haystack application. I'm pretty sure this is overkill for such a simple app, but I wanted to try out this application and hence decided to throw it in.

After working with Django, I've decided to go back and give Rails another go. I've almost completely forgotten all the concepts from Rails, and I would love to refresh my memory. 

Permalink | Leave a comment  »

]]>
http://files.posterous.com/user_profile_pics/1327313/164823_10150365401275402_561030401_16724183_6417567_n.jpg http://posterous.com/users/1lxnkZxp9MoF Karan Parikh karanparikh Karan Parikh
Mon, 25 Jul 2011 20:25:00 -0700 Mozilla World Series of Hack http://www.karanparikh.com/mozilla-world-series-of-hack http://www.karanparikh.com/mozilla-world-series-of-hack

Sam and I took part in Mozilla’s World Series of Hack held on 7/22/11 7.30pm to 7/23/11 7.30am. The rules of this contest were slightly different from previous hackathons I’ve attended: contestants were allowed to start work on their projects as early as 7/15. They would then have 12 hours to work on it during the event and then they must demo at 8.00am. 

Sam and I had an idea that we started working on sometime around 7/19, but on the day of the competition we decided to completely change our idea and build something in the 12 hour period.

We wanted to implement a turntable.fm clone in 12 hours. Our concept revolved around a social music experience, where peers (users) connected to hubs (channels) and within a hub they could play music that would be heard by all peers connected to that hub. Each hub would have a ‘now-playing’ queue and songs added by peers would get added to this queue. Everyone present in the hub could also chat with other users present in the hub.

We implemented our idea using node.js, making heavy use of the awesome NowJS library for communication between the server and the clients. All audio playback was handled using html5.

NowJS is a wonderful library, and it was no suprise that a LOT of teams at the event took full advantage of it’s capabilities. The guys from NowJS were also at the event and were super helpful. 

Overall, the event was a great experience, and I learnt a lot in 12 hours. Kudos to Mozilla and the engineers from all the other companies who helped make WSOH kickass.

 

Permalink | Leave a comment  »

]]>
http://files.posterous.com/user_profile_pics/1327313/164823_10150365401275402_561030401_16724183_6417567_n.jpg http://posterous.com/users/1lxnkZxp9MoF Karan Parikh karanparikh Karan Parikh
Sun, 03 Jul 2011 10:08:00 -0700 Tweet streamer using Node.js http://www.karanparikh.com/tweet-streamer-using-nodejs http://www.karanparikh.com/tweet-streamer-using-nodejs

A day or two ago I decided to learn Node.js and was looking for tutorials and articles on the internet for the same. In my quest for knowledge I came across this tutorial that talks about building a real-time tweet streamer using Node. Unfortunately, the code as presented on the website doesn't work, I guess due to changes in the Node API since the tutorial. After a bit of researching and digging around in the Node API docs, I managed to produce a version that works.

Be warned though, this application makes a LOT of requests to the Twitter API resulting in your application being banned for an hour from using the Twitter API. Also, this is the first node application that I have written, so I might be making a lot of beginner mistakes. Please forgive me for this. The goal of writing this application was to have a working version of what was presented to us in the tutorial.

The version of node I am using(based on the output of 'node -v') is 'v0.5.0-pre'.

Here is my code.

Permalink | Leave a comment  »

]]>
http://files.posterous.com/user_profile_pics/1327313/164823_10150365401275402_561030401_16724183_6417567_n.jpg http://posterous.com/users/1lxnkZxp9MoF Karan Parikh karanparikh Karan Parikh
Sat, 02 Jul 2011 09:00:00 -0700 All your __import__ are belong to us http://www.karanparikh.com/all-your-import-are-belong-to-us http://www.karanparikh.com/all-your-import-are-belong-to-us

Everyone knows and loves Python's import function. This function is used to import external modules into the current module/script we are writing. Here are a few simple examples illustrating how the function can be used:

1
2
3
4
5
6
7
8
9
10
11
12
# import a specific module
from vehicle.four_wheels import car
my_car = car.Car(transmission="automatic")

# import a specific class within a module
from vehicle.four_wheels.car import Car
my_car = Car(transmission="automatic")

# import everything from a module into the current namespace
from vehicle.four_wheels import *
my_car = Car(transmission="automatic")
my_bus = Bus(color="Yellow")

Internally, a call to the import function makes a call to the built-in __import__ function. However, there are 2 cases where using import would not work and the only way out is to call __import__ ourselves.

The most common case where we would have to call __import__ directly would be when we want to import specific modules at run-time based on user input. Here is how we might do that:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# global scope these variables so that
# we can use them throughout our code
Car = None
Bus = None

#
# exciting stuff happening here
#

# now, based on the variable vehicle
# we want to import a specific module
if vehicle == "car":
    # equivalent to: from vehicle.four_wheels.car import Car
    _Car = __import__("vehicle.four_wheels.car", globals(), locals(), ["Car"])
    Car = _Car.Car
if vehicle == "bus":
    # equivalent to: from vehicle.four_wheels.bus import Bus
    _Bus = __import__("vehicle.four_wheels.bus", globals(), locals(), ["Bus"])
    Bus = _Bus.Bus


Yes, I know that we didn't really have to import at run-time in the previous example. It was just meant to be a simple example :)

Another case where we might have to call __import__ is when, for some reason, the parent modules/folders for a module we want to import or a module itself has a name with characters that are not allowed by Python. For example, something like the snippet below would not work:

1
2
# this does not work!
from vehicles.four-wheels.car import Car

Notice how the hyphen is not allowed in the module name. Here is how we might work around that:

1
2
3
# this works!
_Car = __import__("vehicles.four-wheels-car", globals(), locals(), ["Car"])
Car = _Car.Car

Permalink | Leave a comment  »

]]>
http://files.posterous.com/user_profile_pics/1327313/164823_10150365401275402_561030401_16724183_6417567_n.jpg http://posterous.com/users/1lxnkZxp9MoF Karan Parikh karanparikh Karan Parikh
Mon, 30 May 2011 19:35:00 -0700 California! http://www.karanparikh.com/california http://www.karanparikh.com/california

I've been in California for 3 weeks now and I've been having a blast! Work is great and being with friends and family is always a good time.

I've started work on my secret project, but have been having misgivings about it since yesterday. More specifically, I'm concerned about the fact that what I'm building is not how I pictured my idea. I've decided to stop development for a few days and think more seriously about the purpose of the application. I think I have a good idea, it's just that I feel that I'm not executing it correctly. In the meantime, I'll be working on the other items on my Summer to-do list. Also, I think I'm going to take up running on the days that I don't bike to work :| 

Permalink | Leave a comment  »

]]>
http://files.posterous.com/user_profile_pics/1327313/164823_10150365401275402_561030401_16724183_6417567_n.jpg http://posterous.com/users/1lxnkZxp9MoF Karan Parikh karanparikh Karan Parikh
Tue, 10 May 2011 19:02:00 -0700 My Ubuntu Setup http://www.karanparikh.com/my-ubuntu-setup http://www.karanparikh.com/my-ubuntu-setup

I'm currently running Ubuntu 10.04, and will update to 11.04 in a week. Since I started using Ubuntu over a year and half ago I've found a few apps that I now absolutely cannot live without. Here is my attempt at listing most of them, in no particular order:-

tig: Text based gui for browsing git repos. 

ddd: For when command line gdb is just not enough. Used it extensively during my CS 241 course, especially for the programming assignment in which we had to implement malloc(); pointer arithmetic can get messy quickly :)

gvim: I'm a huge (g)vim fan! I adore this colorscheme, and you should also get this for painless folder navigation within (g)vim. 

Dropbox: Ever since my old laptop died on me and I lost all my data, I've started to become super cautious with regards to backing data up. That's where Dropbox comes in and simplifies my life. I'm a huge fan of their service and the way syncing with multiple devices works so seamlessly. 

vlc: for when you need your media fix. 

Ubuntu Tweak: makes customizing your Ubuntu setup a breeze. 

Cheese Webcam Booth: My choice for a webcam software. 

xpad: Allows you to put sticky notes on your desktop, very similar to the notes widget in Windows 7

Faenza icon set: It's pretty. Oh, so pretty.

htop: It's like top. But better. 

That's all I can think of right now. I'm petty sure I'm missing a few so I'll be editing this post as and when I think of something. 

Permalink | Leave a comment  »

]]>
http://files.posterous.com/user_profile_pics/1327313/164823_10150365401275402_561030401_16724183_6417567_n.jpg http://posterous.com/users/1lxnkZxp9MoF Karan Parikh karanparikh Karan Parikh
Sat, 07 May 2011 13:27:00 -0700 Finals! http://www.karanparikh.com/finals http://www.karanparikh.com/finals

Finals have started here at the U of I, and I just got done with my CS 411 final yesterday. 3 more to go: Math 415 8.00am on 5/9, Phil 102 at 1.30pm on 5/9 and CS 241 at 8.00am on 5/13. I'm heading to California after that to begin my internship with Riverbed Technologies, Inc. Yay! I'm going to be working at the Sunnyvale, CA office. I can't wait for Summer :) 

 

Permalink | Leave a comment  »

]]>
http://files.posterous.com/user_profile_pics/1327313/164823_10150365401275402_561030401_16724183_6417567_n.jpg http://posterous.com/users/1lxnkZxp9MoF Karan Parikh karanparikh Karan Parikh
Sat, 23 Apr 2011 13:59:00 -0700 Bacon? http://www.karanparikh.com/update-preferences-set-music-lamb-of-god-wher http://www.karanparikh.com/update-preferences-set-music-lamb-of-god-wher

While working on my CS 411 final project, I found myself listening to my "Lamb of God" radio station on Pandora extensively, somehow simple PHP-MySQL tasks and Lamb of God-esque epic metal music go great together. Like bacon, cheese and fries :D. 

 

 

Permalink | Leave a comment  »

]]>
http://files.posterous.com/user_profile_pics/1327313/164823_10150365401275402_561030401_16724183_6417567_n.jpg http://posterous.com/users/1lxnkZxp9MoF Karan Parikh karanparikh Karan Parikh
Tue, 19 Apr 2011 20:52:00 -0700 work Work WORK http://www.karanparikh.com/work-work-work-0 http://www.karanparikh.com/work-work-work-0

<emotional> I just realized that this semester will be over in just under a month. Soon I will be a Junior. A JUNIOR! I can't believe how fast time seems to be moving. I'm having an amazing time at UIUC so far: I love my major, I've met wonderful people and I've learnt a lot about life in general. I can't believe this will all be over in two years. </emotional>

"But what about the title of this post?" you ask. I have to finish a group project for Phil 102, a group project for CS 411, a homework and programming assignment for CS 241. And catch up in all my classes. And start prep for finals. 

Permalink | Leave a comment  »

]]>
http://files.posterous.com/user_profile_pics/1327313/164823_10150365401275402_561030401_16724183_6417567_n.jpg http://posterous.com/users/1lxnkZxp9MoF Karan Parikh karanparikh Karan Parikh
Mon, 04 Apr 2011 16:44:00 -0700 One week after Spring Break http://www.karanparikh.com/one-week-after-spring-break http://www.karanparikh.com/one-week-after-spring-break

Spring break was awesome. I finished almost all the work that I had been assigned and got to play some Black Ops, watch new television shows and eat some amazing food. I can't wait to head back there during Summer!

The CS 241 programming assignment, where one has to implement malloc + realloc + free, was an amazing learning experience. Mentally going over my CS 225 notes and thinking abou which data structures to use, making small changes in my C code to optimize it for slightly better performance, finding the right balance between memory utilization and speed; I learnt a lot over the course of the assigment and it was also a lot of fun. 

In other news, I'm now an Undergraduate Research Assistant for the Locus group! I'm working with my friend Onur to develop web applications for this project. So far, we've written code in Python(which I'm pretty sure we'll have to port over to php) and we'll be starting the next phase of development soon. 

Permalink | Leave a comment  »

]]>
http://files.posterous.com/user_profile_pics/1327313/164823_10150365401275402_561030401_16724183_6417567_n.jpg http://posterous.com/users/1lxnkZxp9MoF Karan Parikh karanparikh Karan Parikh
Fri, 18 Mar 2011 13:31:00 -0700 Life etc. http://www.karanparikh.com/life-etc http://www.karanparikh.com/life-etc

Installed node.js and MongoDB on my computer yesterday. Might play a bit with that over Spring Break. Another goal of mine is to finish my CS 241 programming assignment(implementation of malloc) and catch up in all my classes. And work on the CS 411 project. 

Check out this amazing CSS 3 demo!

Permalink | Leave a comment  »

]]>
http://files.posterous.com/user_profile_pics/1327313/164823_10150365401275402_561030401_16724183_6417567_n.jpg http://posterous.com/users/1lxnkZxp9MoF Karan Parikh karanparikh Karan Parikh
Sat, 12 Mar 2011 21:08:00 -0800 One week to Spring Break! http://www.karanparikh.com/one-week-to-spring-break http://www.karanparikh.com/one-week-to-spring-break

First: http://kathack.com/. Absolutely amazing.

Need to finish my CS 241 programming assignment that's due on 3/14. To the vim-mobile!

Permalink | Leave a comment  »

]]>
http://files.posterous.com/user_profile_pics/1327313/164823_10150365401275402_561030401_16724183_6417567_n.jpg http://posterous.com/users/1lxnkZxp9MoF Karan Parikh karanparikh Karan Parikh
Wed, 09 Mar 2011 21:06:00 -0800 3 -> 0 http://www.karanparikh.com/3-0 http://www.karanparikh.com/3-0

Finally done with the 3 exams I had this week. Only a Philosophy midterm and a CS 241 programming assignment to finish before I had to California for Spring Break. 

I also started work on the "great idea" I mentioned a couple of posts ago. And I discovered this gem that will prove to be extremely useful during the dev process. Can't wait to build this!

Permalink | Leave a comment  »

]]>
http://files.posterous.com/user_profile_pics/1327313/164823_10150365401275402_561030401_16724183_6417567_n.jpg http://posterous.com/users/1lxnkZxp9MoF Karan Parikh karanparikh Karan Parikh
Mon, 07 Mar 2011 20:45:00 -0800 Two http://www.karanparikh.com/two http://www.karanparikh.com/two

Two more exams for me this week: CS 241 midterm tomorrow and then CS 411 midterm the next day. Someone on the CS 241 newsgroup came up with the brilliant idea of creating a Google Doc to help people study for the midterm, and it is just plain awesome! It is extremely useful and will greatly help me to study for this exam.

~2 more weeks till Spring Break. Yay!

Permalink | Leave a comment  »

]]>
http://files.posterous.com/user_profile_pics/1327313/164823_10150365401275402_561030401_16724183_6417567_n.jpg http://posterous.com/users/1lxnkZxp9MoF Karan Parikh karanparikh Karan Parikh
Sun, 06 Mar 2011 19:24:00 -0800 But it's so neatly formatted...AND syntax highlighting! http://www.karanparikh.com/but-its-so-neatly-formattedand-syntax-highlig http://www.karanparikh.com/but-its-so-neatly-formattedand-syntax-highlig

http://www.somethingofthatilk.com/index.php?id=135

Permalink | Leave a comment  »

]]>
http://files.posterous.com/user_profile_pics/1327313/164823_10150365401275402_561030401_16724183_6417567_n.jpg http://posterous.com/users/1lxnkZxp9MoF Karan Parikh karanparikh Karan Parikh
Wed, 23 Feb 2011 21:53:00 -0800 About midterms and blog neglect http://www.karanparikh.com/about-midterms-and-blog-neglect http://www.karanparikh.com/about-midterms-and-blog-neglect


It's not been that long since I started this blog, and already the frequency of posts is decreasing. I think I am going to make a conscious effort to start posting more; I used to enjoy writing when I was younger and feel that I should continue doing so in the future.

I found out today that I'll be having two midterms and a final in a row after a week: 3/7 is my Physics 214 final, 3/8 is my CS 241 midterm and 3/9 is my CS 411 midterm. Hopefully I won't have a hard time if I start studying like a week or so earlier.

The CS 241 programming assignment (sorting and merging numbers in files using threads) took me slightly longer than it should have: I made s stupid mistake while coding that was leading to disastrous race conditions between my threads. I guess I learned my lesson about not coding in the middle of the night while sleep beckons. On the plus side, I did learn about helgrind and used it to debug my code. I learned a lot doing that assignment and overall it was a great experience.

I also came up with, what I think is, a brilliant idea for a website that Sam and I will be building soon. I even went and bought the domain for the website. My plan is to build it during Spring Break and launch it within the end of this semester. More details to follow.

 

 

Permalink | Leave a comment  »

]]>
http://files.posterous.com/user_profile_pics/1327313/164823_10150365401275402_561030401_16724183_6417567_n.jpg http://posterous.com/users/1lxnkZxp9MoF Karan Parikh karanparikh Karan Parikh