maemo.org - Talk

maemo.org - Talk (https://talk.maemo.org/index.php)
-   Off Topic (https://talk.maemo.org/forumdisplay.php?f=19)
-   -   Beaker: twitter web service project proposal (https://talk.maemo.org/showthread.php?t=37458)

RevdKathy 2010-02-08 08:00

Re: Beaker: twitter web service project proposal
 
Ahhh gotcha. :)

robbie 2010-02-08 10:16

Re: Beaker: twitter web service project proposal
 
Quote:

Originally Posted by Texrat (Post 515643)
The idea is a utility that will break big posts into serialized twitter messages.

Wouldn't that defeat the 'purpose' of twitter?

Texrat 2010-02-08 16:46

Re: Beaker: twitter web service project proposal
 
Quote:

Originally Posted by robbie (Post 515886)
Wouldn't that defeat the 'purpose' of twitter?

People are doing it anyway, manually. And I'm not talking about novels.

Texrat 2010-03-14 01:20

Re: Beaker: twitter web service project proposal
 
Heh... just got the VB.Net version of this code working. Bracing for backlash... :D

Texrat 2010-03-14 17:18

Re: Beaker: twitter web service project proposal
 
In case anyone is interested, here's the VB.Net version of the multi-tweet code:

Code:

        If Tweet_TextBox.Text.Length > 140 Then
            Do While tempTweet.Length >= 132
                chunkCut = 132
                While tempTweet.Substring(chunkCut, 1) <> " "
                    'test for punctuation too (?!,;)
                    chunkCut = chunkCut - 1
                End While
                tweetChunk(chunkCount) = tempTweet.Substring(0, chunkCut).Trim
                tempTweet = tempTweet.Remove(0, chunkCut)
                chunkCount = chunkCount + 1
            Loop
            tweetChunk(chunkCount) = tempTweet.Trim
            For tweets = 0 To chunkCount
                tweetUpdate = (tweets + 1).ToString & "/" & (chunkCount + 1).ToString & " " & tweetChunk(tweets)
                If tweets < chunkCount Then tweetUpdate = tweetUpdate & " +"
                tw.Update(tweetUpdate)
            Next
        Else
            tw.Update(Tweet_TextBox.Text)
        End If
        Tweet_TextBox.Clear()

Basically it looks to see if the tweet has more than 140 characters, and if so, breaks it down into serialized chunks. Because it can't predict the number of chunks accurately, I allow for prefixed serial part to be xx/yy so if it's x/y then the tweet "misses" 3 characters for total length (I add a space too). In addition, I add a space and + character at the end so that's 2 more. In other words, most tweets will be 135 characters or less.


All times are GMT. The time now is 08:10.

vBulletin® Version 3.8.8