10 5 / 2013
25 2 / 2013
This was my first real Hackathon experience. Real because it was my first full fledged hackathon — before this I did participate in a few programming events at college’s where we had to create an app in a couple of hours. It was organized by Google Developers Group. As usual it was a 24 hours hackathon.
So here’s what I learned -
1. Prepare in advance
While you are planning to attend a hackathon, you might want to short list a few ideas, days before the event. Brainstorming this with a friend will be even better. It also helps, if you can define the scope of the idea that want to work on. Try to answer a few questions — How big will the project be? Can you build it as a solo developer? How familiar are you with technologies that you will be using? Are the organizers putting any constraints on which technologies you can or can not use? (Come on, you seriously don’t need to be aware of anything, apart from the language itself! In fact, you can just figure out everything else)
I began thinking of ideas as soon as the hackathon dates were put up. Me and my my brother (also an hacker, and my partner at the hackathon) used to brainstorm, discussing whether or not it was realistic, and did we have enough skills to execute it. Also if the thing we build, would it be of any use to people? Are we solving an real problem? We short-listed a few ideas that answered the above questions positively.
2. Deciding on the idea
One question that you would like to ask yourself while deciding on the idea would be — is it realistic? This is one major decision, because since you’ll have a very limited amount of time with you, with limited resources. The idea actually has to be well planned before the execution really begins. Even though we had thought of a few ideas in advance, it was quite confusing to settle on one when the hackathon started.
At that point the most important thing that you have to consider is — whether or not you can execute it well in the allotted time? Once you make the decision you have to break the execution down into stages, and allocate enough time to each stage. This really helps you with analyzing whether or not, what you’re trying to achieve is doable and helps you keep check on time later.
In the beginning, it seemed to turn out to be quite challenging for us. Since the idea that we decided had much bigger scope, and only with 24 hours in our hands, it seemed too tough but we weren’t going to back down.
3. Have awesome people in your team
Well, the idea that you’ll be working often requires skills. And the better the skills you have, the more efficiently you can execute you’re idea. This is one thing, that depends on how well you can convince some other guy (a developer probably), to work on your idea. The more convincing you are, better the talent you’ll attract.
We were pretty lucky on this one — we had one of the best front end developers (I ve meet yet) Jay Kanakiya, along with Narendra Rajput, a hardcore Ruby developer and myself (a Python Lover). So we weren’t really short of skills at least. I am a Python/Django developer but it won’t be cool to praise myself :-)
3. Get stuff done
Hackathons are all about getting stuff done. At the end of the day, what really matters is how well did you execute your idea. And many a times its not easy, because when you get stuck at something (everyone does), and you might not succeed even after spending the precious time figuring it out (it just happens :-( )
Well this is the prime time, where you are really tested on how well do you make decisions. You have to come up with the plan B (no-one really has a plan B), an alternative. Its all about how do you actually #hack the problem (come with a crazy solution, which before that never existed).
We did face, enough problems, but the way we hacked our way was the fun part.
And did I tell you we won the second prize?
We are told we will be featured, on developers.google.com - so hold your breath!
The app that we built at the hackathon is available in beta here.
We are working hard to launch it for public soon so share your feedback (good and bad).
Do let me know if you are going for a hackathon and need a hand.
Special thanks to Nilesh Bhojani for helping me with the blog post.
You can view the hackathon album here
30 11 / 2012
Recently, while browsing for some Facebook Timeline covers that I wanted for my Facebook Profile. I came across hundreds of covers that I would love to have on my hard-disk (actually, I really dont why I wanted them on my hard-disk). And then, I came across a few websites that allowed directory browsing. So I started saving the images manually. And well those directories had thousands of images, and downloading them manually would suck (being a #hacker you always want everything to be automated).
So I started hacking a script, that would carry out this task for me. And in just 15 minutes, I cracked it. And had fun, downloading entire webserver directories.
You need to have Python installed on your system, for using it.
This script also makes use of Beautifulsoup, you can install it, by using the following command:
pip install beautifulsoup4 # if you have pip installed
easy_install BeautifulSoup4 # if you have easy_install
For using the script, you need to pass the directory url as an argument to the script, for Eg.
For downloading the directory at http://www.namecovers.com/_asset/_thumb/
python downloader.py http://www.namecovers.com/_asset/_thumb/
You can also fork it on Github.
import urllib2, sys, os from bs4 import BeautifulSoup from urlparse import urlparse def downloader(urls, grab_url, foldername): if not os.path.exists(foldername): print "\""+ foldername + "\" does not exist!" os.makedirs(foldername) print "Creating \"" + foldername + "\"..." for cover in urls: try: print "Downloading item " + cover + "..." print grab_url + cover img = urllib2.urlopen(grab_url + cover) output = open(foldername + "/" + cover,'wb') output.write(img.read()) output.close() print cover + "... downloaded!!" except Exception, e: pass return def main(url): urls =  print "Fetching the page..." page = urllib2.urlopen(url).read() print "Fetching completed!" soup = BeautifulSoup(page) print "Grabbing the objects of the page..." lis = soup.find_all("li") for item in lis: urls.append(item.a['href']) domain = urlparse(url) downloader(urls, url, domain.netloc) print "All files have been successfully downloaded!" print "\tHack by Virendra Rajput, \n\tFollow me on Twitter @bkvirendra\n\tI Blog at http://virendra.me/" return if __name__ == '__main__': main(sys.argv)
01 10 / 2012
I have this habit of forgetting important tasks, lately. Since multitasking is never an easy job, to do and you tend to forget alot. Being a regular member of the Brahma Kumaris community, I was looking forward to contribute to the community some way possible.
Hence, I was thinking of creating an Online presence of the community. So after a while, I created a Facebook Page for Brahma Kumaris, where I used to share Daily Muralis along with videos for classes, that I had to fetch from various sources online.
I did the task of updating the Page manually for a while, but it wasn’t possible for a lazy guy like me to do it long, considering all the lazy habits I have. And it was important to update the Page exactly in the morning, so that it would reach members all around the globe.
I added a few fellow members of the community as the Admin of the Page, so that they could help me with updating the page, regularly. But still we weren’t able to keep it updated.
So I decided to solve the problem, the HACKER WaY. And finally came up with the script that I developed in 2 hours approximately, when I challenged my Bro, that I would get it done in an hour, but it took me an hour more.
After testing it, thoroughly, and adding support for Hindi language, I created a Cron Job, that would run exactly at 9:30 AM, everyday.
The script would fetch the Jewels Brahma Kumaris Page, and would parse it to get the Murali text from it, and then filter it to remove any special characters, or so.
Then it would make a post request to the Facebook Graph API with all the required credentials, and get the Murali posted on the Page. Since the murali was available in 2 languages, I had 2 different scripts, for handling each language.
The scripts have really been useful, for keeping the Page updated regularly, and have contributed in increasing the Page Reach and Likes as well. Currently, the Page has 2,731 likes. And around 150+ people talking about this. Now, I rarely have to check the page, since the Cron manages it all.
Well, I mostly prefer Python, but I used PHP to create these scripts since, Python has a lot of hosting issues. I was considering hosting it on Heroku, but again Heroku doesn’t provide Cron for free. Hence PHP was a better option, again.
You can fork it on Github.
Discuss it on Hackernews
I would like to hear from you, about any such similar situations that you have come across, and how you managed to solve it.