Showing posts with label code. Show all posts
Showing posts with label code. Show all posts
4

iPRATIK - the Twitter web app



After coming home in the college vacations, I faced with a shocking truth. My parents were going to US to meet my sis and me, being the worst timing champion, was having his internship in the same period. As a result, I DID NOT go.
So, they went and I was left in a lonely home, with crappy food and alternate day office routine (currently dong internship in Huawei).
Plenty of free time I can say, so decided to work on a twitter app. And the result is iPRATIK. It can send as well as show tweets from your twitter account as well as lets you see the twitter info of other people too.The best thing is you can access it from anywhere,regardless of what OS you are using or whether you are accessing from a pc or a mobile.It just works.
It is coded entirely in php using curl .It is powered by OAuth library by Abraham Williams. And while coding it, I was powered by recurring sessions of maggi and pizza.

I am still pondering over the licensing issues. The api being in MIT/X license and I intend to release it under GNU/GPL v3. It actually sparked a flame war over licensing topic in lug-bombay mailing list :D
Now, why such a name?
Well, iPRATIK was just chosen as test phase name because Steve Jobs was going haywire at that time over the new iPHONEv4(he still is, btw). Later, I decided to go with it.

now, cutting all this crap here is the link to try it yourself :)
http://pratikanand.co.cc/ipratik/login.php


and here is the source code:
http://github.com/pratikone/ipratik-twitter



Preview of my twitter web application I have been working for... on Twitpic

Future plans ??
Yaa, sleeping and eating at first. Later, I may further develop it and port to mobile platform.Till then , it's all peace and pizza.
0

MagMIT


Last semester, I got an offer from Nitin, Editor of the College Editorial Board to design a website of it. They wanted the website to be the social interactive portal of the college. The previous website, despite being colourful was bulky and lacked much efficiency. Hence, I teamed up with Karik and we started making the site. After 3 times of design changes and code re-writings ,we finally got the node.
The current website is very light and has streamlined design. Whatsoever be the condition of college wifi, the site opens up on a mouse click. To our relief , the site is being well-appreciated everywhere. Though, this is not the end.We still have to make it power-packed.

Long way to go....
here is the link www.magmit.com
0

Play Them All : My media player project


PlayThemAll is the media project player project created by me to build a light-weight media player which can play almost all popular audio formats. Its UI should be simplistic enough to get the operations done easily. It is coded in GNU/C++ using Qt libraries and uses Gstreamer for playback capabilities. It is my first Free and Open Source Software (FOSS) Project. Supported platform is debian based Linux systems (tested on Ubuntu 8.04, 9.04).

Future additions:

1. Platform-independence (so same code will run on Windows as well)
2. Playlist support of popular media players like WMP, Winamp and VLC
3. Video playback support
4. Drag-n-Drop capability

More suggestions and ideas are welcome.

Project hosted on sourceforge http://sourceforge.net/projects/playthemall/

It is under GNU/GPL i.e. you are free to use and re-distribute its source code.
3

First bash-python script for ION access


It was all running well.When suddenly soon after midnight , it stops. Yes, all mitians know what I am talking about.Its the same strange restriction of ION to cutoff wifi access after 12:30, leaving us all in frustration. But there a privileged few whose IDs work at night. But they guard them as a great secret and rarely such id comes out in public. But when it does, it indeed attracts a whole bunch of users to use it. Ultimately ION detects the heavy data usage and blocks it down. Then again wait for new id to surface.

This was the situation with me too. It all started one night when my "painfully" acquired night id got blocked right at the moment when I needed it most. Anger and frustration started emerging. Suddenly, with a flash of light an idea struck to me : Why not make a script to find all the working night IDs. It will take ION ages to close them all down. So, this is how the work started.

A plan was made..the time was less..sessionals were about to start...something had to be done quick and perfect. So , me and harry teamed up together to do it. We started learning BASH scripting and started applying our existing knowledge of python. With much of sleepless nights and morning brainstorming sessions, within a week it got prepared. On the first night of its trial run, harry felt asleep :). So it was all upto me, I closed all apps, re-connected the connected , fired the terminal ,typed the script path and ENTER. Voila! it started working, almost flawlessly. I couldn't believe my eyes, it was our one serious effort of solving daily life problem using programming. It felt greattttttttt. And know what? the no. of ids it gave in trial run: 150+

Here is the screenshot of how the script looks. Though it is not of the original script (for security reasons.)
0

A month full of Busy schedule


This month came and passed within an eye wink..Before I could settle down well, exams were up again..
Well....blame may be given on my very busy schedule during these days...Techtatva09, our college annual techfest was to be held and I was organiser of one of the events as well as in Creative Designer team of it...So big time tension. Moreover, I was working with few of seniors to build the prototype of the new MIT website which was presented infront of the Director, board members and the company official who has made the previous one (And it was a great success :)). Later started working with ISTE, now am a member of its working committee :). Quite soon, somebody from edboard saw my artworks in TT09 and just a day later I got a call from EdBoard asking if I am interested in joining it.. Well I did, an interview was held for taking up the edbaord designers.So, I applied for the post of Digital Designer. We were given a 2 poems and asked to design something on its theme ,also to explain it .We did and my design was declared the best :) , I was the first one to get selected. So, finally I am in the Editorial Board of the college..

This is how this month passed and it changed a lot of things for me (made me a busy man ;))

PS: Have included a pic of the design for the edboard

Currently me and Kartik Mandaville are now making its new EdBoard website : MagMIT ...will be posting the link as soon as it gets over
Let's see what remaining months have in stock.
3

small qt app to play wav file


Finally , after being very busy for preparation techtatva09 (MIT's tech fest), I got some time today.So thought of continuing my experimentations further. After hours of brainstorming, came up with my first qt app, a small app to play and stop wave files. Using the help of QSound libraries for achieving it. Coincidently, this my first gnu/c++ GUI program.

Here is the screenshot.
2

Tic Tac Toe v2.0 GUI

Finally, after a week full of tests i am free now. The code which I had posted below was indeed an incomplete one. Haritosh took time on building the GUI interface and indeed , he built it great.
Then came the debugging process which ate up almost entire Sunday of ours but finally its done.
Its almost complete but a few glithces are still there. So , here is the first game which I wrote from the scratch and finally its done. It feels good really good. :)



http://pastebin.com/fb2b5e22
0

Misery ends...game is done..Tic tac toe is up and running

Finally , after long sessions of coding, debugging , again coding again debugging and lots and lots of frustration, the code ends today at 200 hours in morning.
It went through a lot of troubles, revamps, version changes and above all blunders. Code debugged by me was overwritten by haritosh (as he took the earlier version and saved it over mine). The problems of coding a Turbo C++ code in linux with a cranky DOS emulator like DosBox just added to the trouble. But it finally paid off. The code is done, the AI is working perfectly.
Now, the next thing in my mind is to port it to GUI to make a proper graphical game even for lamers.

So, work begins from now.

here's the source code. Its of roughly 212 lines compared to other scripts we found on net which had more than 700 lines but AI was very poor or wasn't there at all.

All I can say that a good start by me towards serious level of software programming.

http://pastebin.ca/1525066

PS:here it is shown of 450 lines because of useless space introduced by the site.
0

Tic Tac Toe misery

Well a few days back I started working on a code for a simple tic tac toe game in C++ entirely. The game is supposed to feature very good computer AI.

I am doing logical part and a dear friend of mine, Haritosh, is doing GUI and presentation of the game. Spent two days discussing the idea and the algorithms, finally got down to coding. After another two sleepless nights, I completed the code. When compiled gave me 25 errors, I was shocked.
Well, another day was spent in correcting those errors. When project seemed nearly finished , i decided to play a dummy game. When run , it started giving unimaginable logical errors (some of them like both u and computer have won the game). Enough of this brotherhood, I decided to give more of my precious time to this. So 2 days have already passed and I have removed most of the logical errors but the biggest one remained. The game carried on even after someone wins. I was frustated to death then Haritosh(the had already finished the GUI) came to my rescue and pointed out the error.
I was using character array but in the func for checking the winner and terminating the game, i had used integer array in parametres. So, it was converting char array to int array and was acting bizarrely. Finally after this much debugging, i am ready to complete it by a day or two. And had a good night's sleep yesterday.
1

swine flu forms


In wake of the newly spread epidemic of Swine Flu, international airports started registration forms swine flu. I came across it when my sister, coming from the US, had to wait 2 hrs. at immigrations becasue of this form. It asks you whether you have swine flu or not?. I wonder if anyone will reply 'YES' to that.....

Since, i am working on designing web related apps in php, I decided to create an online form of this registration form.

here's the code of the backend php file:


mysql_connect('localhost','root','*****') or die("Unable to connect");
while(!(mysql_select_db('swineflu')))
mysql_query("CREATE DATABASE swineflu");
$query="CREATE TABLE medreport (name varchar(20), nation varchar(20), med_note varchar(40), relative varchar(20), comment varchar(40),swine int)";
mysql_query($query);

//inserting values

$name=$_POST['app_name'];
$nation=$_POST['app_nation'];
$medhis=$_POST['med_his'];
$rel=$_POST['app_rel'];
$comm=$_POST['app_comm'];
if ($_POST['question'])
{ $swine='1';}
else $swine='0';

$query="INSERT INTO medreport values('$name','$nation','$medhis','$rel','$comm','$swine')";
mysql_query($query);
if(mysql_affected_rows())
{ echo "Your information has been recorded";}
else echo "An error has occured";

if ($swine)
echo "You have been swined";
?>



It gives a dangerous message : You have been swined , if found infected.

All the data goes to a mysql database from where it can be retrieved on authenticating user name and password. I am currently working on it.
1

Easter egg in python 2.6

Recently i found a new easter egg in Python. It is a nice one, u get a long poem about python describing its features. And i used to think they have stopped putting easter eggs. Microsoft even has a rule that the programmer who puts any easter egg in their program goes straight out of the job. They consider it a reason for security loophole. I think Microsoft should look into its code rather than blaming easter eggs for loopholes.

Anyways, here the cheat.

Go to python console and type import this and u will get:


The Zen of Python, by Tim Peters

Beautiful is better than ugly.
Explicit is better than implicit.
Simple is better than complex.
Complex is better than complicated.
Flat is better than nested.
Sparse is better than dense.
Readability counts.
Special cases aren't special enough to break the rules.
Although practicality beats purity.
Errors should never pass silently.
Unless explicitly silenced.
In the face of ambiguity, refuse the temptation to guess.
There should be one-- and preferably only one --obvious way to do it.
Although that way may not be obvious at first unless you're Dutch.
Now is better than never.
Although never is often better than *right* now.
If the implementation is hard to explain, it's a bad idea.
If the implementation is easy to explain, it may be a good idea.
Namespaces are one honking great idea -- let's do more of those!



It's now on my ORKUT profile.
 
Copyright © PRATIK ANAND's weblog.