I've spend some time (but still too little) to build my Tweet of the Day application. The initial version was made for a DataRage presentation (taking place next Thursday over the Internet).
The program has a single database table (on a remote DB or a local file), in both cases managed using a ClientDataSet with these fields:
FieldName = 'ID'
FieldName = 'EXPECTED'
FieldName = 'POSTED'
FieldName = 'TEXT'
The id is just an internal value (not the twitter id), the date and time for publication (which should be in the future), if it has been posted, and the actual 140 maximum characters for twitter. There is a button to create a new entry, which fills the ID, sets expected to 24 hours after the last entry, creates the initial text with "#number".
Editing is sone in an edit box that refreshes a "how many characters still to go" label:
nChars := 140 - Length (DbEdit1.Text);
if nChars > 10 then ...
The actual code is what the program uses to post to twitter:
listParams := TStringList.Create; listParams.Add ('status=' + ClientDataSet1TEXT.AsString); strResult := idhttp1.Post ('http://twitter.com/statuses/update.xml', listParams)
You have to provide a username and password in the IdHTTP1 component configuration, but the code is really as simple as it looks! Of course, the entire application still needs more (the automatic posting is still untested) and it might be worth having a companion web server where you can pre-post entries, to avoid having the application to keep running on a computer connected to the Internet.
But you should get an idea. Again, more info during my talk at DataRage next week, where I'll show also another program I wrote for adding rows to a Goole Apps spreadsheet in real time. I'll probably show the same progams also at Basta! Italia, on Tuesday.