python

Project bus-routes -1

Posted on Updated on

For the last 4 days I have been writing codes for this project. Let me first explain whats it about. Basically it will be a mobile app which will show the bus number of different routes of kolkata. There are many websites and mobile apps which give this service but the real problem is that these sites are not totally correct and information is sometimes incomplete. For this I have decided to add an edit feature to the app.

So, if the user feels that the information needs some correction or is totally wrong¬† he/she can edit the record, this will help in creating a better database. At the start I got this idea that I simply cannot get information that is 100% correct, so this edit feature. Just like wikipedia does. ūüėČ

I wrote some code (basically extracted information into my local database). The site I am using to get all the information is here.

there were few other sites as well but the html so badly written that I couldn’t parse the desired data. In this case a single line python regrex expression did the job for me. Another python code got me all data present across 9 pages on the site.

Once I had all the desired data I stored them into my mongodb database and then some sorting. Adding few fields such as from, to, via, bus number. This was piece of cake, the real work was presenting this data when a query was made on the site. I started with the web app and would hence copy the same logic across mobile app.

Wrote a simple web app in Flask the site was up in few minutes. I used my API code (written in Bangalore) to search for the required data from the database. And boom, I realized my first problem, the site I chose to extract the information had multiple instances of same name. For ex: there was Howrah. and Howrah so if the former is to be matched against the latter in the database no result will be given. There are 405 records which had approx 10 names in it. So, the total number of names becomes approx 4k, wow!!!.

Now how to remove this shortcoming? (which I would not have got, if the admin of the site choose to be little bit sensible while writing the code.) i am thinking of adding models (just like in Django ) in the code and store all the record in a separate model. This would give me a standard entry to search for. But this would also mean I would have to feed all the data across every field. (there are many records) I can write a script that would populate all the models for me, hmm I will have to think about it.

The models will also help me in adding the edit feature that I was talking about. Something I had done in my previous internship. I will keep posting with all the progress. Meanwhile the present codes reside at Github, lot of changes need to be done in the coming days.

Until next

Advertisements

planning for future.

Posted on Updated on

The title might not give a clear indication of the post ahead. I am not at all planning my life, I think no one can. Life can be so unpredictable that you got to change at number of situations. Anyways, this is just to give what I am intended to do for the rest of my summer holidays.

I am quite active on twitter, have few followers (although I wish that number was large :/ ) and in the midst of all my tweets, I came across many interesting companies and people who are awesome entrepreneurs. I have also met few amazing friends here from across the country.

Instamojo will be the first company that I would like to talk about , I have been following this startup from its inception and I am highly intrigued by its founders. One of the reason why Instamojo happens to be my¬†favorite startup in India is because it has been¬†majorly scripted in Python. Well, that summons it up, isn’t it? No, theres more to the story than you think of.¬†¬†Harshad Sharma happens to be one of its founders. Let me first introduce you to Harshad Sharma.

Harshad Sharma is hard core techie and a Python lover, a dropout and works¬†predominantly according to his wishes. You might get a quick sneak-peak to his life by the post I wrote about him. Also he is an rockstar photographer as well. OH, by the way I work for Yourstory (India’s biggest online platform for entrepreneurs) as a part timer.¬†¬†That post helped me to get a personal interaction with him, which was booster for me. You know that feeling when you eye someone as your idol and then one day you actually get to intereact them in personal. Think about it, you might get a air of my feeling. From then he has been helping me out (in learning python) at times when I am stuck.

Okay now justifying the title of the post: as I am still studying in college and really aspire to intern at Instamojo. Well, that sounds simple enough, then why did I wrote a whole blogpost on it, eh? Well, if you look at the requirements of Instamojo, you will probably get an idea that its quite large (atleast for me it is ).¬†So, from that list I know bits of Python, 1% of Django and Crypotography and ……nothing of others (like databases and data structures, system¬†administration). So I am eyeing that internship for now. Whenever I open that “about us ” page on Instamojo site, I get an adrenaline rush in my body. Thats it, I have so much to prepare for the next semester and also hope I don’t get a backlog in my semesters.

Better get back to work now. Between #dgplug training post is due later in the day.

I am concluding my post with this cool pic clicked by Harshad:

tumblr_moqf51CvLw1sr4oqbo1_1280

untill next.

puzzle solving

Posted on Updated on

I have not spend much of time at solving complex algo problems given at random sites, not random but the likes of codechef etc. I also admit that I am not good at them but then I had this thought the other day.

These web portals hosts many competitive titles every month and people from India show up in huge numbers, majority of this number are students. So, here goes my question: If India really has so much talent in coding and algo then why not these students go on and start a mouth watering startup in India.
Or they are just interested in earning that lucrative prize money and work in US later.

No, I mean seriously why? On the other hand I have seen many quality programmers who have not played with these but have a wonderful talent in creating stuffs. I am not criticizing these problems (which are often called as Hackathon ), they are probably good means to get a solid grasp at algorithms, databases, trees etc. But people get so much attracted to these that don’t realize they can create a world of their own?

At first when I layed my hands on them I couldn’t get through any single problem, that discouraged me. And started doubting my capabilities but then I looked around, asked few experience people and figured out this might not be a great issue and I may get things with time. or may I wouldn’t, who cares these problems cannot decide my future can they ?

By the way today is 3rd day of dgplug training, I will be posting something related to them soon on the blog.

signing off till then.

picture credits

Python up and running from Fedora

Posted on Updated on

I had to write another blog post, found some interesting things on the web. (Later in the post)

Starting practising python commands in Fedora, it’s fun but will take few attempts to get used to it. Did I told you I started using Linux based operating systems. Say Good Bye to windows.
The drive in Fedora was installed has been partitioned and I cannot figure out which partition has fedora and which can be made for other uses. Apparently, Linux mint was earlier installed in it.

Nick Parlante has created a very neat web page to revise basic Python commands, here,  

Also if you are looking to build from scratch then Kushal Das book might come in very handy for you.

Signing off.

Untill next