Discussing the nuts and bolts of software development

Wednesday, November 12, 2008

 

The Anti-social web - Twitter for the socially inept

Twitter was mentioned during Macadamian's corporate blogging presentation. "Useless! Bah! Humbug!" were the first thoughts to enter my head. Then the speaker pointed out that corporate bloggers should strive to see the positive side of any situation, and I figured making Twitter useful to a neo-Luddite was a good challenge; there must be an itch to scratch here, right?

All I knew about Twitter was that people think it's slow, and it's written in Ruby (on Rails.) After exploring a little more, I found out that it can provide private Atom feeds of your messages, and exposes a REST API (ooh, new, shiny!) That was enough to get me coding.

To keep things simple I decided to be boring and test out Twitter using Ruby (normally, I plan epic posts with 5 different languages, communicating through at least 2 protocols... and a database for no good reason.) The process I followed was:
require 'date'
require 'rest_client'
require 'rexml/document'

username = "your_twitter_id_here"
password = "your_twitter_password_here"

twitter = RestClient::Resource.new 'http://%s:%s@twitter.com' % [ username, password ]

# Send a message to twitter
result = twitter['statuses/update.xml'].post(
:status => "This is your computer. You have no life as of %s" % DateTime.now()
)
# print result

timelineXML = twitter['statuses/user_timeline.xml'].get({ :count => 5 });

# Make the XML usable
# (Use XmlSimple for even easier handling)
timeline = REXML::Document.new(timelineXML)

# Display the text element of every status returned by the service
# (print timelineXML to learn more about the structure of the result.)
puts "%s's timeline:" % username
timeline.elements.each('statuses/status/text') { |message|
puts message.text
}

As Twitter restricts you to 70 calls per hour, it's a good job Ruby (on REST) made this so easy. REST is a nice change from the usual URL gobbledygook that frameworks throw up - I can't wait to try it out in Struts2.

So, what can people with no interest in socializing do with Twitter?
One final note, until the authentication framework is more robust, don’t rely on anything you twit staying private.

Labels: , ,


Comments:
If you need an essay writing help I recommend you to visit this site. You will find a team of professional writers!
 
Thanks for the interesting information. Now there are so many computer programs that it is difficult to choose the best. But there are things that remain unchanged. For example, education. Thanks to tips from professional writers CustomEssayMeister everyone can write good essays.
 
We make your all details confidential when you take homework writing help with our experts. So don't worry about the privacy just take a few steps and get help in your homework on homework helpers Australia from students assignment help.
 
Assignment help Singapore service for students need academic support.Visit More: My Assignment Help Australia
 
It’s not just the products we buy. It’s estimated that a third of all food produced in the world is lost or wasted. Do your bit by eating up leftovers and use any ingredients you have spare to make interesting meals at https://essaysprofessors.com/write-my-capstone-project.html . Try to waste as little food as possible, and compost the organic waste you can’t eat.
 
This comment has been removed by the author.
 
Only the best talents work at the cheapest essay writing service EliteWritings. The service also relies on the latest plagiarism detection software to produce the best academic writing results. It does not hire non-professional writers from Third World countries.
 
Hi there! I assume that every student once during studying at college ordered different kind of paper at writing service. I want to recommend essaywriters net which can do your paper tasks. Our essay writer service has been known worldwide as one of the most trustworthy, reliable, industrious, and devoted services in the online academic writing industry.
 
Post a Comment



<< Home

This page is powered by Blogger. Isn't yours?