This blog is subject the DISCLAIMER below.

Sunday, April 12, 2009

Twitter Common Friends

For the past couple of months, A lot of people (who I don't know) have been following my twitter.. Mostly they don't look like anybody I know, not even Egyptians, & I'm not that popular anyway.. I'm ok with people following me anyway.. My twitter is public, & I'm not planning to change that.. But sometimes I need to know if these are real people who are in my twitter "social network" or just some sort of zombies or bots..

I've just created a small app to act like "common friends" in Facebook so I can find out whether I really know them or not.. Actually a couple of these followers are really interesting people & I'm following them now.. The app finds common people you're follwoing.. not common followers, the followers all is almost the same it just need authentacation..



The application depend on a single twitter API which takes the user name as a parameter & returns an xml (or JSON) file of their freinds for eg these are my friends xml file:

http://twitter.com/statuses/friends/mshady.xml



I used the "XML schema definition" tool (Xsd.exe) to generate the class to use the xml nodes directly as nodes rather than querying the XML document.. I'm such a lazy coder.. I know :D..

Once the xml is deserialised into the users datatype like this:


XmlSerializer oXmlSerializer = new XmlSerializer(typeof(users));
users oUsers1 = (users)oXmlSerializer.Deserialize(
                     XmlReader.Create(@"http://twitter.com/statuses/friends/"+textBox1.Text+".xml"
                        ));

All you need to do is to find the intersection set between the two list/sets.. & display them
 
The source code & binaries are available here: http://cid-570d40f05cc0dc13.skydrive.live.com/self.aspx/Sample%20Code/TwitterTest.rar

2 comments:

ecmascripter said...

Hello there.

Sorry if my comment does not related with your topic.
It's because comment to your current post have a higher to be replayed.

My comment or question is about jasper report (chart). I have design in ireport and also compiled it to .jasper. However I can't display it in pdf using my web app.

Hossam Sadik said...

Hello,
Could you provide me with more information about the problem's environment e.g Jasper & IReport versions, application server and exception stacktrace. to the following mail [h.sadik@gmail.com].

Regards,