Archive for June, 2010

ΖψϊΓΓє® Welcomes You!

After reading the Headline you might be wondering if this post contains any text regarding Hermaphrodites(Zwitter in German) or of Rammstein’s Song.

But NO!.

It is just a front-end GUI for twitter API created using python, Qt bindings for python and twitter module for python developed by DeWitt Clinton (My Sincere Thanks to him for creating such an awesome module).

The name happens to be just fusion of my Nick Zarthon and Twitter i.e Zwitter ..:P

When started settings dialog gets opened asking for your username and password.

After Entering the details it loads your data and then displays the main Window, now you can perform any function you like just by clicking the button. Titles of the buttons are self explanatory for their functions.

The major coding was done to support contextMenu(Menu that appears after we Right Click) in listWidget(Main Display Area)

Different contextMenu is displayed depending on what type of element is clicked and currently what type of list is being shown,

  • Elements are of two types, User and Status
  • List type can be of Public Timeline, Get Replies,  Latest Friends Status and Direct Message

Through them you Create friends, Destroy friendship, Reply, Retweet(I just retweets them, you cannot edit it), Get information about a particular user, Post New Direct Message, reply to one etc….

You can also reply to more than one person at a time, when you press Reply button, you will see following dialog

It shows you all your friends list, you can also see their Real Names just selecting Real Names from combo Box.

To add a user to reply list just Double Click its name, you can also filter out the list by entering initials in search label, it will show all the members that contain the string in Search Field.

There is one constraint, you can only edit one line as soon as you press enter the text is posted.

Similarly there is a dialog for Message.

Source code can be found at

http://github.com/zarthon/PyQt_twitter

Try IT!! And please Reply how you like it or have any questions and feel free to send bugs at

<mohitrajkothari@gmail.com>

Advertisements

A simple Command line API for Twitter update

After having wasted almost half of my vacations, one night I though of developing a simple command line API for Twitter, though there are thousands of applications available for tweeting, I developed it to only get more knowledge of libcurl .

/*
AUTHOR: Mohit Kothari
It's a simple Command Line API for updating your status

USAGE:
$./twit
Enter Username: abc
Enter Password(Max 100):
Enter the message: add

RETURN:
It will return a blob of JSON information
*/

#include<iostream>
#include<curl/curl.h>
#include<string>
#include<cstring>
#include<curses.h>
using namespace std;

void input_user(string &user){
	cout<<"Enter Username: ";
	cin>>user;
	return;
}

void input_pass(string &pass){
	char ch[100];
	initscr();
	printw("Enter Password(Max 100): ");
	noecho();
	getstr(ch);
	pass = ch;
	echo();
	endwin();
}
int main(int argc, char* argv[]){
	string msg,user,pass,final="";
	string status = "";
	char *fina, *sta;

	input_user(user);
	input_pass(pass);

	cout<<"Enter the message: ";
	getline(cin,msg);
	getline(cin,msg);
	if(msg.size()>140){
		msg.erase(140);
	}

	status += "status="+msg;
	final += "http://"+user+":"+pass+"@twitter.com/statuses/update.json";

	fina = new char[final.size()+1];
	sta=new char[status.size()+1];
	strcpy(fina,final.c_str());
	strcpy(sta,status.c_str());
	CURL *curl;
	CURLcode res;
	curl = curl_easy_init();

	if(curl){
		curl_easy_setopt(curl,CURLOPT_URL,fina);
		curl_easy_setopt(curl,CURLOPT_POSTFIELDS,sta);
		res=curl_easy_perform(curl);
		curl_easy_cleanup(curl);
	}

	return 0;
}

I have shared the Source in git-hub: http://github.com/zarthon/git_twit

It just updates your status, it doesn’t have the function to get recent tweets, I am trying to implement it
and also is looking forward to build a GUI using Qt.
Lets hope it turns out good.

Enfin mon premier blog!

Finally after getting inspired by many of my college mates who have started blogging and fed up with the extreme boredom in my life mainly because of the ongoing vacations, I present to you my first ever blog.

Happy Reading..

Well as said in my first post, this blog mainly contains posts as a result of my boredom. They may contains source codes, stories, pics etc.,the range is infinite. Hence the title is MaY bE or mAy Be nOt!! as I was not sure of any fix title…Confusion.
You might find certain French words here and there..because of my interest in French and my failure to learn it. Hence fulfilling my dream I use French words(Courtesy Google Translator…:P)