You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomee.apache.org by stratwine <to...@gmail.com> on 2011/05/31 00:58:28 UTC

A patch for OPENEJB-1565 (Retweet OpenEJB contributors feed)

Hi,

I have added a patch for OPENEJB-1565.

Please review..

Thanks,
Vishwa

--
View this message in context: http://openejb.979440.n4.nabble.com/A-patch-for-OPENEJB-1565-Retweet-OpenEJB-contributors-feed-tp3561896p3561896.html
Sent from the OpenEJB Dev mailing list archive at Nabble.com.

Re: A patch for OPENEJB-1565 (Retweet OpenEJB contributors feed)

Posted by stratwine <to...@gmail.com>.
David Blevins-2 wrote:
> 
> So if @personNotInList tweets about OpenEJB, then @personInList hits the
> retweet button on the twitter website, that retweet from @personInList
> will be retweeted by @OpenEJB ?
> 

I thought by intuition that it should work that way. Then I just checked
once today, to find that a twitter list doesn't gather "retweets" 

http://help.hootsuite.com/entries/345389-viewing-retweets-in-a-list-stream
viewing retweets in a list 

The simple workaround would be to do a textual retweet using "RT
@personNotInList ... " But that wouldn't have the embedded image of the one
who originally tweeted. 

The longer approach would be to get the list members' screen_names through
one call, then retrieve each member's statuses and filter out. 

-Vishwa

--
View this message in context: http://openejb.979440.n4.nabble.com/A-patch-for-OPENEJB-1565-Retweet-OpenEJB-contributors-feed-tp3561896p3575590.html
Sent from the OpenEJB Dev mailing list archive at Nabble.com.

Re: A patch for OPENEJB-1565 (Retweet OpenEJB contributors feed)

Posted by Jean-Louis MONTEIRO <je...@gmail.com>.
Retweets seem to work but on our home page, tweets are not working.
Who can have a look or hack on?

Jean-Louis

--
View this message in context: http://openejb.979440.n4.nabble.com/A-patch-for-OPENEJB-1565-Retweet-OpenEJB-contributors-feed-tp3561896p3629911.html
Sent from the OpenEJB Dev mailing list archive at Nabble.com.

Re: A patch for OPENEJB-1565 (Retweet OpenEJB contributors feed)

Posted by David Blevins <da...@gmail.com>.
On Jul 23, 2011, at 1:04 PM, stratwine wrote:

> Hi,
> 
> Noticed retweeting for #TomEE was added.. 
> 
> Have submitted a patch, a small fix on that and some tests..

Excellent!  And if I haven't said it recently -- this bot is awesome!

I have another challenge for you.  Just setup an account for @ApacheTomEE.  Thinking we might experiment with tweets about a wider scope of hashtags; say #MyFaces #OpenWebBeans #OpenJPA, etc.  Ideally the list of hashtags would be configurable per twitter account.

Same basic principal though -- only retweet from the list of "contributors".

On the note of making things more generic, we can probably skip the case-sensitive vs case-insensitive thing I added.  I forgot that people in the contributor list essentially "approve" tweets by retweeting them, so we don't need to use case-sensitivity as a way of filtering out garbage.  We can just do that ourselves.

We can probably make a new jira for this as well.  The first one is more than solved.

-David


Re: A patch for OPENEJB-1565 (Retweet OpenEJB contributors feed)

Posted by stratwine <to...@gmail.com>.
Hi,

Noticed retweeting for #TomEE was added.. 

Have submitted a patch, a small fix on that and some tests..

Thanks,
Vishwa

--
View this message in context: http://openejb.979440.n4.nabble.com/A-patch-for-OPENEJB-1565-Retweet-OpenEJB-contributors-feed-tp3561896p3689405.html
Sent from the OpenEJB Dev mailing list archive at Nabble.com.

Re: A patch for OPENEJB-1565 (Retweet OpenEJB contributors feed)

Posted by stratwine <to...@gmail.com>.
Hi Romain,

Thanks ! The working is quite simple..

Retweet.java is the standalone program, that needs to be run. When run, it
would pick up valid messages from
http://twitter.com/#!/OpenEJB/contributorsand retweet it here (
http://twitter.com/#!/waltic1 )  I used this account (waltic1) for testing
this.. To be changed later to open-ejb-twitter account.

*This is how the implementation is done-*

1) ScreenNamesRetriever.getContributorsNames() fetches all the contributors'
screen-names as a list
2) UserStatusRetriever.getAllContributorsOpenEJBStatuses() loops through the
screen-names-list, and gets openejb tweets of each user
       *Can test this with RetweetITest.java (It retrieves openejb messages
of one user - 'stratwine' )

This method internally uses OpenEJBMessageFilterUtil.java to filter out some
messages -
 OpenEJBMessageFilterUtil.acceptOrRejectTweets() method filters out some
messages based on these conditions -

if (!isOlderThanAnHour(keyValue) & isOpenEJBTweet(tweet) &
!isRetweeted(keyValue) ) {
            acceptTweet(openEJBStatusIDs, keyValue, tweet);
        } else {
            logWhyTweetWasRejected(keyValue, tweet);
        }

Thus rejecting tweets that are:
-older than an hour,
-that don't have #openejb or @openejb in the message
-that has not been retweeted before

3)Retweet.java gets the 'id' of the messages to be retweeted using
UserStatusRetriever.getAllContributorsOpenEJBStatuses() , and posts a
retweet request to the configured twitter account.

(Right now, 'waltic1' is configured' ) So the retweets should be visible
from this account.


When you check, I think none of the messages would be picked up for retweet,
( because of  those three conditions above ).
Tweaking OpenEJBMessageFilterUtil.isOlderThanAnHour(keyValue) to allow older
ones, should help pick some messages, I guess..

    private static boolean isOlderThanAnHour(Map keyValue) {
        String dateAsString =(String) keyValue.get("created_at");
        Calendar calendar = Calendar.getInstance();
        calendar.add(Calendar.HOUR_OF_DAY, -1); // *some 40 hours or so here
for while testing *

Let me know if its fine.. I'll be around in IRC too, so pull me anytime :)

Thanks,
Vishwa

On Wed, Jun 15, 2011 at 2:02 AM, Romain Manni-Bucau [via OpenEJB] <
ml-node+3597740-724640723-241096@n4.nabble.com> wrote:

> Hi!
>
> i commited it,
>
> i have an exception about the time format, i'll have a look, maybe it is
> because my locale (fr) is not the same as yours.
>
> i'm not a twitter user, can you explain me a bit how does it work please
> (if
> i want to try it)?
>
> - Romain
>
> 2011/6/8 stratwine <[hidden email]<http://user/SendEmail.jtp?type=node&node=3597740&i=0>>
>
>
> > Hi,
> >
> > Please take RetweetFunctionallyGood2Updated.patch instead of
> > RetweetFunctionallyGood2.patch
> >
> > (Added some headers for classes)
> >
> > -Vishwa
> >
> > --
> > View this message in context:
> >
> http://openejb.979440.n4.nabble.com/A-patch-for-OPENEJB-1565-Retweet-OpenEJB-contributors-feed-tp3561896p3583480.html
> > Sent from the OpenEJB Dev mailing list archive at Nabble.com.
> >
>
>
> ------------------------------
>  If you reply to this email, your message will be added to the discussion
> below:
>
> http://openejb.979440.n4.nabble.com/A-patch-for-OPENEJB-1565-Retweet-OpenEJB-contributors-feed-tp3561896p3597740.html
>  To unsubscribe from A patch for OPENEJB-1565 (Retweet OpenEJB contributors
> feed), click here<http://openejb.979440.n4.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=3561896&code=dG92aXNod2FuYXRoQGdtYWlsLmNvbXwzNTYxODk2fDY0ODE2MTMzNQ==>.
>
>


--
View this message in context: http://openejb.979440.n4.nabble.com/A-patch-for-OPENEJB-1565-Retweet-OpenEJB-contributors-feed-tp3561896p3599950.html
Sent from the OpenEJB Dev mailing list archive at Nabble.com.

Re: A patch for OPENEJB-1565 (Retweet OpenEJB contributors feed)

Posted by David Blevins <da...@gmail.com>.
It's hooked up and appears to be working! :)

Let the retweeting begin!


-David

On Jun 18, 2011, at 9:30 AM, Karan Malhi wrote:

> Really liked reading this thread. Vishwa, you explained as you
> patched, nice way to keep everybody updated. Looking forward to more
> patches from you :). Great work!.
> Would be really neat if we could formalize the documentation for this
> and add it to our docs.
> 
> On Wed, Jun 15, 2011 at 2:18 PM, Romain Manni-Bucau
> <rm...@gmail.com> wrote:
>> it seems to work (as far as i can test without a tweeter account), good job!
>> 
>> - Romain
>> 
>> 2011/6/15 stratwine <to...@gmail.com>
>> 
>>> *A way to check the 'retweet' part alone (by hardcoding some tweet-ids):*
>>> 
>>> If most tweets are filtered out, and we needed to test the 'retweet' part
>>> alone, we can test it this way:
>>> 
>>> Retweet.retweetThisCollectionOfStatuses(Collection<String>
>>> nonRetweetedOpenEJBStatusIDs) - the value for this collection can be
>>> hardcoded with some tweet-ids
>>> 
>>> We can get some tweet-ids, by adding
>>> 
>>> this logger statement:
>>> 
>>> logger.debug("Rejected Id:"+keyValue.get("id"));
>>> 
>>> in
>>> 
>>> OpenEJBMessageFilter.logWhyTweetWasRejected(..)
>>> 
>>> and running Retweet.java once..  will give us some tweet-ids like
>>> 
>>> 30631 [main] DEBUG
>>> org.apache.openejb.tools.twitter.OpenEJBMessageFilterUtil  - Older than an
>>> hour?: true
>>> 30631 [main] DEBUG
>>> org.apache.openejb.tools.twitter.OpenEJBMessageFilterUtil  - Rejected
>>> Id:75967627025068032
>>> 30631 [main] DEBUG
>>> org.apache.openejb.tools.twitter.OpenEJBMessageFilterUtil  -
>>> IsOpenEJBTweet?:true
>>> 30631 [main] DEBUG
>>> org.apache.openejb.tools.twitter.OpenEJBMessageFilterUtil  - Was it
>>> retweeted before:true
>>> 30631 [main] INFO
>>> org.apache.openejb.tools.twitter.OpenEJBMessageFilterUtil  - Tweet Not
>>> Considered:Asked an answered. How to unit test web service security with
>>> #CXF and #OpenEJB http://t.co/0ZQr2k9 #javaEE
>>> 
>>> ( Just thought of it.. I should've added that line before )
>>> 
>>> Thanks,
>>> Vishwa
>>> 
>>> On Wed, Jun 15, 2011 at 10:17 PM, Vishwanath Krishnamurthi <
>>> tovishwanath@gmail.com> wrote:
>>> 
>>>> Hi Romain,
>>>> 
>>>> Thanks ! The working is quite simple..
>>>> 
>>>> Retweet.java is the standalone program, that needs to be run. When run,
>>> it
>>>> would pick up valid messages from
>>>> http://twitter.com/#!/OpenEJB/contributors and retweet it here (
>>>> http://twitter.com/#!/waltic1 )  I used this account (waltic1) for
>>> testing
>>>> this.. To be changed later to open-ejb-twitter account.
>>>> 
>>>> *This is how the implementation is done-*
>>>> 
>>>> 1) ScreenNamesRetriever.getContributorsNames() fetches all the
>>>> contributors' screen-names as a list
>>>> 2) UserStatusRetriever.getAllContributorsOpenEJBStatuses() loops through
>>>> the screen-names-list, and gets openejb tweets of each user
>>>>        *Can test this with RetweetITest.java (It retrieves openejb
>>> messages
>>>> of one user - 'stratwine' )
>>>> 
>>>> This method internally uses OpenEJBMessageFilterUtil.java to filter out
>>>> some messages -
>>>>  OpenEJBMessageFilterUtil.acceptOrRejectTweets() method filters out some
>>>> messages based on these conditions -
>>>> 
>>>> if (!isOlderThanAnHour(keyValue) & isOpenEJBTweet(tweet) &
>>>> !isRetweeted(keyValue) ) {
>>>>             acceptTweet(openEJBStatusIDs, keyValue, tweet);
>>>>         } else {
>>>>             logWhyTweetWasRejected(keyValue, tweet);
>>>>         }
>>>> 
>>>> Thus rejecting tweets that are:
>>>> -older than an hour,
>>>> -that don't have #openejb or @openejb in the message
>>>> -that has not been retweeted before
>>>> 
>>>> 3)Retweet.java gets the 'id' of the messages to be retweeted using
>>>> UserStatusRetriever.getAllContributorsOpenEJBStatuses() , and posts a
>>>> retweet request to the configured twitter account.
>>>> 
>>>> (Right now, 'waltic1' is configured' ) So the retweets should be visible
>>>> from this account.
>>>> 
>>>> 
>>>> When you check, I think none of the messages would be picked up for
>>>> retweet, ( because of  those three conditions above ).
>>>> Tweaking OpenEJBMessageFilterUtil.isOlderThanAnHour(keyValue) to allow
>>>> older ones, should help pick some messages, I guess..
>>>> 
>>>>     private static boolean isOlderThanAnHour(Map keyValue) {
>>>>         String dateAsString =(String) keyValue.get("created_at");
>>>>         Calendar calendar = Calendar.getInstance();
>>>>         calendar.add(Calendar.HOUR_OF_DAY, -1); // *some 40 hours or so
>>>> here for while testing *
>>>> 
>>>> Let me know if its fine.. I'll be around in IRC too, so pull me anytime
>>> :)
>>>> 
>>>> Thanks,
>>>> Vishwa
>>>> 
>>>> 
>>>> On Wed, Jun 15, 2011 at 2:02 AM, Romain Manni-Bucau [via OpenEJB] <
>>>> ml-node+3597740-724640723-241096@n4.nabble.com> wrote:
>>>> 
>>>>> Hi!
>>>>> 
>>>>> i commited it,
>>>>> 
>>>>> i have an exception about the time format, i'll have a look, maybe it is
>>>>> because my locale (fr) is not the same as yours.
>>>>> 
>>>>> i'm not a twitter user, can you explain me a bit how does it work please
>>>>> (if
>>>>> i want to try it)?
>>>>> 
>>>>> - Romain
>>>>> 
>>>>> 2011/6/8 stratwine <[hidden email]<
>>> http://user/SendEmail.jtp?type=node&node=3597740&i=0>>
>>>>> 
>>>>> 
>>>>>> Hi,
>>>>>> 
>>>>>> Please take RetweetFunctionallyGood2Updated.patch instead of
>>>>>> RetweetFunctionallyGood2.patch
>>>>>> 
>>>>>> (Added some headers for classes)
>>>>>> 
>>>>>> -Vishwa
>>>>>> 
>>>>>> --
>>>>>> View this message in context:
>>>>>> 
>>>>> 
>>> http://openejb.979440.n4.nabble.com/A-patch-for-OPENEJB-1565-Retweet-OpenEJB-contributors-feed-tp3561896p3583480.html
>>>>>> Sent from the OpenEJB Dev mailing list archive at Nabble.com.
>>>>>> 
>>>>> 
>>>>> 
>>>>> ------------------------------
>>>>>  If you reply to this email, your message will be added to the
>>> discussion
>>>>> below:
>>>>> 
>>>>> 
>>> http://openejb.979440.n4.nabble.com/A-patch-for-OPENEJB-1565-Retweet-OpenEJB-contributors-feed-tp3561896p3597740.html
>>>>>  To unsubscribe from A patch for OPENEJB-1565 (Retweet OpenEJB
>>>>> contributors feed), click here<
>>> http://openejb.979440.n4.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=3561896&code=dG92aXNod2FuYXRoQGdtYWlsLmNvbXwzNTYxODk2fDY0ODE2MTMzNQ==
>>>> .
>>>>> 
>>>>> 
>>>> 
>>>> 
>>> 
>>> 
>>> --
>>> View this message in context:
>>> http://openejb.979440.n4.nabble.com/A-patch-for-OPENEJB-1565-Retweet-OpenEJB-contributors-feed-tp3561896p3600016.html
>>> Sent from the OpenEJB Dev mailing list archive at Nabble.com.
>>> 
>> 
> 
> 
> 
> -- 
> Karan Singh Malhi


Re: A patch for OPENEJB-1565 (Retweet OpenEJB contributors feed)

Posted by Karan Malhi <ka...@gmail.com>.
Really liked reading this thread. Vishwa, you explained as you
patched, nice way to keep everybody updated. Looking forward to more
patches from you :). Great work!.
Would be really neat if we could formalize the documentation for this
and add it to our docs.

On Wed, Jun 15, 2011 at 2:18 PM, Romain Manni-Bucau
<rm...@gmail.com> wrote:
> it seems to work (as far as i can test without a tweeter account), good job!
>
> - Romain
>
> 2011/6/15 stratwine <to...@gmail.com>
>
>> *A way to check the 'retweet' part alone (by hardcoding some tweet-ids):*
>>
>> If most tweets are filtered out, and we needed to test the 'retweet' part
>> alone, we can test it this way:
>>
>> Retweet.retweetThisCollectionOfStatuses(Collection<String>
>> nonRetweetedOpenEJBStatusIDs) - the value for this collection can be
>> hardcoded with some tweet-ids
>>
>> We can get some tweet-ids, by adding
>>
>> this logger statement:
>>
>> logger.debug("Rejected Id:"+keyValue.get("id"));
>>
>> in
>>
>> OpenEJBMessageFilter.logWhyTweetWasRejected(..)
>>
>> and running Retweet.java once..  will give us some tweet-ids like
>>
>> 30631 [main] DEBUG
>> org.apache.openejb.tools.twitter.OpenEJBMessageFilterUtil  - Older than an
>> hour?: true
>> 30631 [main] DEBUG
>> org.apache.openejb.tools.twitter.OpenEJBMessageFilterUtil  - Rejected
>> Id:75967627025068032
>> 30631 [main] DEBUG
>> org.apache.openejb.tools.twitter.OpenEJBMessageFilterUtil  -
>> IsOpenEJBTweet?:true
>> 30631 [main] DEBUG
>> org.apache.openejb.tools.twitter.OpenEJBMessageFilterUtil  - Was it
>> retweeted before:true
>> 30631 [main] INFO
>> org.apache.openejb.tools.twitter.OpenEJBMessageFilterUtil  - Tweet Not
>> Considered:Asked an answered. How to unit test web service security with
>> #CXF and #OpenEJB http://t.co/0ZQr2k9 #javaEE
>>
>> ( Just thought of it.. I should've added that line before )
>>
>> Thanks,
>> Vishwa
>>
>> On Wed, Jun 15, 2011 at 10:17 PM, Vishwanath Krishnamurthi <
>> tovishwanath@gmail.com> wrote:
>>
>> > Hi Romain,
>> >
>> > Thanks ! The working is quite simple..
>> >
>> > Retweet.java is the standalone program, that needs to be run. When run,
>> it
>> > would pick up valid messages from
>> > http://twitter.com/#!/OpenEJB/contributors and retweet it here (
>> > http://twitter.com/#!/waltic1 )  I used this account (waltic1) for
>> testing
>> > this.. To be changed later to open-ejb-twitter account.
>> >
>> > *This is how the implementation is done-*
>> >
>> > 1) ScreenNamesRetriever.getContributorsNames() fetches all the
>> > contributors' screen-names as a list
>> > 2) UserStatusRetriever.getAllContributorsOpenEJBStatuses() loops through
>> > the screen-names-list, and gets openejb tweets of each user
>> >        *Can test this with RetweetITest.java (It retrieves openejb
>> messages
>> > of one user - 'stratwine' )
>> >
>> > This method internally uses OpenEJBMessageFilterUtil.java to filter out
>> > some messages -
>> >  OpenEJBMessageFilterUtil.acceptOrRejectTweets() method filters out some
>> > messages based on these conditions -
>> >
>> > if (!isOlderThanAnHour(keyValue) & isOpenEJBTweet(tweet) &
>> > !isRetweeted(keyValue) ) {
>> >             acceptTweet(openEJBStatusIDs, keyValue, tweet);
>> >         } else {
>> >             logWhyTweetWasRejected(keyValue, tweet);
>> >         }
>> >
>> > Thus rejecting tweets that are:
>> > -older than an hour,
>> > -that don't have #openejb or @openejb in the message
>> > -that has not been retweeted before
>> >
>> > 3)Retweet.java gets the 'id' of the messages to be retweeted using
>> > UserStatusRetriever.getAllContributorsOpenEJBStatuses() , and posts a
>> > retweet request to the configured twitter account.
>> >
>> > (Right now, 'waltic1' is configured' ) So the retweets should be visible
>> > from this account.
>> >
>> >
>> > When you check, I think none of the messages would be picked up for
>> > retweet, ( because of  those three conditions above ).
>> > Tweaking OpenEJBMessageFilterUtil.isOlderThanAnHour(keyValue) to allow
>> > older ones, should help pick some messages, I guess..
>> >
>> >     private static boolean isOlderThanAnHour(Map keyValue) {
>> >         String dateAsString =(String) keyValue.get("created_at");
>> >         Calendar calendar = Calendar.getInstance();
>> >         calendar.add(Calendar.HOUR_OF_DAY, -1); // *some 40 hours or so
>> > here for while testing *
>> >
>> > Let me know if its fine.. I'll be around in IRC too, so pull me anytime
>> :)
>> >
>> > Thanks,
>> > Vishwa
>> >
>> >
>> > On Wed, Jun 15, 2011 at 2:02 AM, Romain Manni-Bucau [via OpenEJB] <
>> > ml-node+3597740-724640723-241096@n4.nabble.com> wrote:
>> >
>> >> Hi!
>> >>
>> >> i commited it,
>> >>
>> >> i have an exception about the time format, i'll have a look, maybe it is
>> >> because my locale (fr) is not the same as yours.
>> >>
>> >> i'm not a twitter user, can you explain me a bit how does it work please
>> >> (if
>> >> i want to try it)?
>> >>
>> >> - Romain
>> >>
>> >> 2011/6/8 stratwine <[hidden email]<
>> http://user/SendEmail.jtp?type=node&node=3597740&i=0>>
>> >>
>> >>
>> >> > Hi,
>> >> >
>> >> > Please take RetweetFunctionallyGood2Updated.patch instead of
>> >> > RetweetFunctionallyGood2.patch
>> >> >
>> >> > (Added some headers for classes)
>> >> >
>> >> > -Vishwa
>> >> >
>> >> > --
>> >> > View this message in context:
>> >> >
>> >>
>> http://openejb.979440.n4.nabble.com/A-patch-for-OPENEJB-1565-Retweet-OpenEJB-contributors-feed-tp3561896p3583480.html
>> >> > Sent from the OpenEJB Dev mailing list archive at Nabble.com.
>> >> >
>> >>
>> >>
>> >> ------------------------------
>> >>  If you reply to this email, your message will be added to the
>> discussion
>> >> below:
>> >>
>> >>
>> http://openejb.979440.n4.nabble.com/A-patch-for-OPENEJB-1565-Retweet-OpenEJB-contributors-feed-tp3561896p3597740.html
>> >>  To unsubscribe from A patch for OPENEJB-1565 (Retweet OpenEJB
>> >> contributors feed), click here<
>> http://openejb.979440.n4.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=3561896&code=dG92aXNod2FuYXRoQGdtYWlsLmNvbXwzNTYxODk2fDY0ODE2MTMzNQ==
>> >.
>> >>
>> >>
>> >
>> >
>>
>>
>> --
>> View this message in context:
>> http://openejb.979440.n4.nabble.com/A-patch-for-OPENEJB-1565-Retweet-OpenEJB-contributors-feed-tp3561896p3600016.html
>> Sent from the OpenEJB Dev mailing list archive at Nabble.com.
>>
>



-- 
Karan Singh Malhi

Re: A patch for OPENEJB-1565 (Retweet OpenEJB contributors feed)

Posted by Romain Manni-Bucau <rm...@gmail.com>.
it seems to work (as far as i can test without a tweeter account), good job!

- Romain

2011/6/15 stratwine <to...@gmail.com>

> *A way to check the 'retweet' part alone (by hardcoding some tweet-ids):*
>
> If most tweets are filtered out, and we needed to test the 'retweet' part
> alone, we can test it this way:
>
> Retweet.retweetThisCollectionOfStatuses(Collection<String>
> nonRetweetedOpenEJBStatusIDs) - the value for this collection can be
> hardcoded with some tweet-ids
>
> We can get some tweet-ids, by adding
>
> this logger statement:
>
> logger.debug("Rejected Id:"+keyValue.get("id"));
>
> in
>
> OpenEJBMessageFilter.logWhyTweetWasRejected(..)
>
> and running Retweet.java once..  will give us some tweet-ids like
>
> 30631 [main] DEBUG
> org.apache.openejb.tools.twitter.OpenEJBMessageFilterUtil  - Older than an
> hour?: true
> 30631 [main] DEBUG
> org.apache.openejb.tools.twitter.OpenEJBMessageFilterUtil  - Rejected
> Id:75967627025068032
> 30631 [main] DEBUG
> org.apache.openejb.tools.twitter.OpenEJBMessageFilterUtil  -
> IsOpenEJBTweet?:true
> 30631 [main] DEBUG
> org.apache.openejb.tools.twitter.OpenEJBMessageFilterUtil  - Was it
> retweeted before:true
> 30631 [main] INFO
> org.apache.openejb.tools.twitter.OpenEJBMessageFilterUtil  - Tweet Not
> Considered:Asked an answered. How to unit test web service security with
> #CXF and #OpenEJB http://t.co/0ZQr2k9 #javaEE
>
> ( Just thought of it.. I should've added that line before )
>
> Thanks,
> Vishwa
>
> On Wed, Jun 15, 2011 at 10:17 PM, Vishwanath Krishnamurthi <
> tovishwanath@gmail.com> wrote:
>
> > Hi Romain,
> >
> > Thanks ! The working is quite simple..
> >
> > Retweet.java is the standalone program, that needs to be run. When run,
> it
> > would pick up valid messages from
> > http://twitter.com/#!/OpenEJB/contributors and retweet it here (
> > http://twitter.com/#!/waltic1 )  I used this account (waltic1) for
> testing
> > this.. To be changed later to open-ejb-twitter account.
> >
> > *This is how the implementation is done-*
> >
> > 1) ScreenNamesRetriever.getContributorsNames() fetches all the
> > contributors' screen-names as a list
> > 2) UserStatusRetriever.getAllContributorsOpenEJBStatuses() loops through
> > the screen-names-list, and gets openejb tweets of each user
> >        *Can test this with RetweetITest.java (It retrieves openejb
> messages
> > of one user - 'stratwine' )
> >
> > This method internally uses OpenEJBMessageFilterUtil.java to filter out
> > some messages -
> >  OpenEJBMessageFilterUtil.acceptOrRejectTweets() method filters out some
> > messages based on these conditions -
> >
> > if (!isOlderThanAnHour(keyValue) & isOpenEJBTweet(tweet) &
> > !isRetweeted(keyValue) ) {
> >             acceptTweet(openEJBStatusIDs, keyValue, tweet);
> >         } else {
> >             logWhyTweetWasRejected(keyValue, tweet);
> >         }
> >
> > Thus rejecting tweets that are:
> > -older than an hour,
> > -that don't have #openejb or @openejb in the message
> > -that has not been retweeted before
> >
> > 3)Retweet.java gets the 'id' of the messages to be retweeted using
> > UserStatusRetriever.getAllContributorsOpenEJBStatuses() , and posts a
> > retweet request to the configured twitter account.
> >
> > (Right now, 'waltic1' is configured' ) So the retweets should be visible
> > from this account.
> >
> >
> > When you check, I think none of the messages would be picked up for
> > retweet, ( because of  those three conditions above ).
> > Tweaking OpenEJBMessageFilterUtil.isOlderThanAnHour(keyValue) to allow
> > older ones, should help pick some messages, I guess..
> >
> >     private static boolean isOlderThanAnHour(Map keyValue) {
> >         String dateAsString =(String) keyValue.get("created_at");
> >         Calendar calendar = Calendar.getInstance();
> >         calendar.add(Calendar.HOUR_OF_DAY, -1); // *some 40 hours or so
> > here for while testing *
> >
> > Let me know if its fine.. I'll be around in IRC too, so pull me anytime
> :)
> >
> > Thanks,
> > Vishwa
> >
> >
> > On Wed, Jun 15, 2011 at 2:02 AM, Romain Manni-Bucau [via OpenEJB] <
> > ml-node+3597740-724640723-241096@n4.nabble.com> wrote:
> >
> >> Hi!
> >>
> >> i commited it,
> >>
> >> i have an exception about the time format, i'll have a look, maybe it is
> >> because my locale (fr) is not the same as yours.
> >>
> >> i'm not a twitter user, can you explain me a bit how does it work please
> >> (if
> >> i want to try it)?
> >>
> >> - Romain
> >>
> >> 2011/6/8 stratwine <[hidden email]<
> http://user/SendEmail.jtp?type=node&node=3597740&i=0>>
> >>
> >>
> >> > Hi,
> >> >
> >> > Please take RetweetFunctionallyGood2Updated.patch instead of
> >> > RetweetFunctionallyGood2.patch
> >> >
> >> > (Added some headers for classes)
> >> >
> >> > -Vishwa
> >> >
> >> > --
> >> > View this message in context:
> >> >
> >>
> http://openejb.979440.n4.nabble.com/A-patch-for-OPENEJB-1565-Retweet-OpenEJB-contributors-feed-tp3561896p3583480.html
> >> > Sent from the OpenEJB Dev mailing list archive at Nabble.com.
> >> >
> >>
> >>
> >> ------------------------------
> >>  If you reply to this email, your message will be added to the
> discussion
> >> below:
> >>
> >>
> http://openejb.979440.n4.nabble.com/A-patch-for-OPENEJB-1565-Retweet-OpenEJB-contributors-feed-tp3561896p3597740.html
> >>  To unsubscribe from A patch for OPENEJB-1565 (Retweet OpenEJB
> >> contributors feed), click here<
> http://openejb.979440.n4.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=3561896&code=dG92aXNod2FuYXRoQGdtYWlsLmNvbXwzNTYxODk2fDY0ODE2MTMzNQ==
> >.
> >>
> >>
> >
> >
>
>
> --
> View this message in context:
> http://openejb.979440.n4.nabble.com/A-patch-for-OPENEJB-1565-Retweet-OpenEJB-contributors-feed-tp3561896p3600016.html
> Sent from the OpenEJB Dev mailing list archive at Nabble.com.
>

Re: A patch for OPENEJB-1565 (Retweet OpenEJB contributors feed)

Posted by stratwine <to...@gmail.com>.
*A way to check the 'retweet' part alone (by hardcoding some tweet-ids):*

If most tweets are filtered out, and we needed to test the 'retweet' part
alone, we can test it this way:

Retweet.retweetThisCollectionOfStatuses(Collection<String>
nonRetweetedOpenEJBStatusIDs) - the value for this collection can be
hardcoded with some tweet-ids

We can get some tweet-ids, by adding

this logger statement:

logger.debug("Rejected Id:"+keyValue.get("id"));

in

OpenEJBMessageFilter.logWhyTweetWasRejected(..)

and running Retweet.java once..  will give us some tweet-ids like

30631 [main] DEBUG
org.apache.openejb.tools.twitter.OpenEJBMessageFilterUtil  - Older than an
hour?: true
30631 [main] DEBUG
org.apache.openejb.tools.twitter.OpenEJBMessageFilterUtil  - Rejected
Id:75967627025068032
30631 [main] DEBUG
org.apache.openejb.tools.twitter.OpenEJBMessageFilterUtil  -
IsOpenEJBTweet?:true
30631 [main] DEBUG
org.apache.openejb.tools.twitter.OpenEJBMessageFilterUtil  - Was it
retweeted before:true
30631 [main] INFO
org.apache.openejb.tools.twitter.OpenEJBMessageFilterUtil  - Tweet Not
Considered:Asked an answered. How to unit test web service security with
#CXF and #OpenEJB http://t.co/0ZQr2k9 #javaEE

( Just thought of it.. I should've added that line before )

Thanks,
Vishwa

On Wed, Jun 15, 2011 at 10:17 PM, Vishwanath Krishnamurthi <
tovishwanath@gmail.com> wrote:

> Hi Romain,
>
> Thanks ! The working is quite simple..
>
> Retweet.java is the standalone program, that needs to be run. When run, it
> would pick up valid messages from
> http://twitter.com/#!/OpenEJB/contributors and retweet it here (
> http://twitter.com/#!/waltic1 )  I used this account (waltic1) for testing
> this.. To be changed later to open-ejb-twitter account.
>
> *This is how the implementation is done-*
>
> 1) ScreenNamesRetriever.getContributorsNames() fetches all the
> contributors' screen-names as a list
> 2) UserStatusRetriever.getAllContributorsOpenEJBStatuses() loops through
> the screen-names-list, and gets openejb tweets of each user
>        *Can test this with RetweetITest.java (It retrieves openejb messages
> of one user - 'stratwine' )
>
> This method internally uses OpenEJBMessageFilterUtil.java to filter out
> some messages -
>  OpenEJBMessageFilterUtil.acceptOrRejectTweets() method filters out some
> messages based on these conditions -
>
> if (!isOlderThanAnHour(keyValue) & isOpenEJBTweet(tweet) &
> !isRetweeted(keyValue) ) {
>             acceptTweet(openEJBStatusIDs, keyValue, tweet);
>         } else {
>             logWhyTweetWasRejected(keyValue, tweet);
>         }
>
> Thus rejecting tweets that are:
> -older than an hour,
> -that don't have #openejb or @openejb in the message
> -that has not been retweeted before
>
> 3)Retweet.java gets the 'id' of the messages to be retweeted using
> UserStatusRetriever.getAllContributorsOpenEJBStatuses() , and posts a
> retweet request to the configured twitter account.
>
> (Right now, 'waltic1' is configured' ) So the retweets should be visible
> from this account.
>
>
> When you check, I think none of the messages would be picked up for
> retweet, ( because of  those three conditions above ).
> Tweaking OpenEJBMessageFilterUtil.isOlderThanAnHour(keyValue) to allow
> older ones, should help pick some messages, I guess..
>
>     private static boolean isOlderThanAnHour(Map keyValue) {
>         String dateAsString =(String) keyValue.get("created_at");
>         Calendar calendar = Calendar.getInstance();
>         calendar.add(Calendar.HOUR_OF_DAY, -1); // *some 40 hours or so
> here for while testing *
>
> Let me know if its fine.. I'll be around in IRC too, so pull me anytime :)
>
> Thanks,
> Vishwa
>
>
> On Wed, Jun 15, 2011 at 2:02 AM, Romain Manni-Bucau [via OpenEJB] <
> ml-node+3597740-724640723-241096@n4.nabble.com> wrote:
>
>> Hi!
>>
>> i commited it,
>>
>> i have an exception about the time format, i'll have a look, maybe it is
>> because my locale (fr) is not the same as yours.
>>
>> i'm not a twitter user, can you explain me a bit how does it work please
>> (if
>> i want to try it)?
>>
>> - Romain
>>
>> 2011/6/8 stratwine <[hidden email]<http://user/SendEmail.jtp?type=node&node=3597740&i=0>>
>>
>>
>> > Hi,
>> >
>> > Please take RetweetFunctionallyGood2Updated.patch instead of
>> > RetweetFunctionallyGood2.patch
>> >
>> > (Added some headers for classes)
>> >
>> > -Vishwa
>> >
>> > --
>> > View this message in context:
>> >
>> http://openejb.979440.n4.nabble.com/A-patch-for-OPENEJB-1565-Retweet-OpenEJB-contributors-feed-tp3561896p3583480.html
>> > Sent from the OpenEJB Dev mailing list archive at Nabble.com.
>> >
>>
>>
>> ------------------------------
>>  If you reply to this email, your message will be added to the discussion
>> below:
>>
>> http://openejb.979440.n4.nabble.com/A-patch-for-OPENEJB-1565-Retweet-OpenEJB-contributors-feed-tp3561896p3597740.html
>>  To unsubscribe from A patch for OPENEJB-1565 (Retweet OpenEJB
>> contributors feed), click here<http://openejb.979440.n4.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=3561896&code=dG92aXNod2FuYXRoQGdtYWlsLmNvbXwzNTYxODk2fDY0ODE2MTMzNQ==>.
>>
>>
>
>


--
View this message in context: http://openejb.979440.n4.nabble.com/A-patch-for-OPENEJB-1565-Retweet-OpenEJB-contributors-feed-tp3561896p3600016.html
Sent from the OpenEJB Dev mailing list archive at Nabble.com.

Re: A patch for OPENEJB-1565 (Retweet OpenEJB contributors feed)

Posted by Romain Manni-Bucau <rm...@gmail.com>.
done, i simply had to add the locale to the simple date format.

- Romain

2011/6/14 Romain Manni-Bucau <rm...@gmail.com>

> Hi!
>
> i commited it,
>
> i have an exception about the time format, i'll have a look, maybe it is
> because my locale (fr) is not the same as yours.
>
> i'm not a twitter user, can you explain me a bit how does it work please
> (if i want to try it)?
>
> - Romain
>
>
> 2011/6/8 stratwine <to...@gmail.com>
>
>> Hi,
>>
>> Please take RetweetFunctionallyGood2Updated.patch instead of
>> RetweetFunctionallyGood2.patch
>>
>> (Added some headers for classes)
>>
>> -Vishwa
>>
>> --
>> View this message in context:
>> http://openejb.979440.n4.nabble.com/A-patch-for-OPENEJB-1565-Retweet-OpenEJB-contributors-feed-tp3561896p3583480.html
>> Sent from the OpenEJB Dev mailing list archive at Nabble.com.
>>
>
>

Re: A patch for OPENEJB-1565 (Retweet OpenEJB contributors feed)

Posted by Romain Manni-Bucau <rm...@gmail.com>.
Hi!

i commited it,

i have an exception about the time format, i'll have a look, maybe it is
because my locale (fr) is not the same as yours.

i'm not a twitter user, can you explain me a bit how does it work please (if
i want to try it)?

- Romain

2011/6/8 stratwine <to...@gmail.com>

> Hi,
>
> Please take RetweetFunctionallyGood2Updated.patch instead of
> RetweetFunctionallyGood2.patch
>
> (Added some headers for classes)
>
> -Vishwa
>
> --
> View this message in context:
> http://openejb.979440.n4.nabble.com/A-patch-for-OPENEJB-1565-Retweet-OpenEJB-contributors-feed-tp3561896p3583480.html
> Sent from the OpenEJB Dev mailing list archive at Nabble.com.
>

Re: A patch for OPENEJB-1565 (Retweet OpenEJB contributors feed)

Posted by stratwine <to...@gmail.com>.
Hi,

Please take RetweetFunctionallyGood2Updated.patch instead of
RetweetFunctionallyGood2.patch

(Added some headers for classes)

-Vishwa

--
View this message in context: http://openejb.979440.n4.nabble.com/A-patch-for-OPENEJB-1565-Retweet-OpenEJB-contributors-feed-tp3561896p3583480.html
Sent from the OpenEJB Dev mailing list archive at Nabble.com.

Re: A patch for OPENEJB-1565 (Retweet OpenEJB contributors feed)

Posted by stratwine <to...@gmail.com>.
Hi,

I've added another patch now.. (RetweetFunctionallyGood2.patch)

So far from what I have tested, it looks good to me.

If a personNotInList tweets about openejb, and if a personInList retweets,
now this is picking it up :)

I have commented code in these two classes:

StoreAccessToken.java and
ContribListStatusRetriever.java 

These classes are no longer required, and can be deleted.


Thanks,
Vishwa

--
View this message in context: http://openejb.979440.n4.nabble.com/A-patch-for-OPENEJB-1565-Retweet-OpenEJB-contributors-feed-tp3561896p3583062.html
Sent from the OpenEJB Dev mailing list archive at Nabble.com.

Re: A patch for OPENEJB-1565 (Retweet OpenEJB contributors feed)

Posted by stratwine <to...@gmail.com>.
David Blevins-2 wrote:
> 
> All checked in and reformatted!
> 
> 

Cool, thanks !


David Blevins-2 wrote:
> 
> 
> So what do we have to do before we can set this up as a cron job? 
> Executing it every hour is the easy part, but not sure about the auth
> steps and tokens involved.
> 

I'll give a shot at changing retrieval of statuses by retrieving screennames
of contributors and then their statuses from their timeline (so any openejb
retweet gets picked up). Then we can hook this up.

The Auth part is simple too. Just have to run AccessTokenGenerator.java
once.
It gives a URL that you'll have to visit (with openejb twitter account
logged into, in some other tab ). 
On clicking "Authorize this App" the webpage gives a pin number.
AccessTokenGenerator waits for that PIN number input. Once that pin number
is entered, it gives two tokens- consumer token and consumer secret 

Those tokens should be pasted in RetweetTool.properties against the
respective keys.

This is how it is now, with a mock account.

# Below tokens now reflect a mock twitter account (waltic1) that authorized
access
# TODO: Change to Open EJB Twitter Account, once this works fine
retweetApp.authorizedUser.consumer.token=310745104-M7gs5njthMd5UD4nnwvaAVzsfBLwmyEGUyd7opk
retweetApp.authorizedUser.consumer.tokenSecret=PZzNv4sLpNAWpCW8TICs5xhrUqjaPr3x83PLjPUoI

-Vishwa

--
View this message in context: http://openejb.979440.n4.nabble.com/A-patch-for-OPENEJB-1565-Retweet-OpenEJB-contributors-feed-tp3561896p3575636.html
Sent from the OpenEJB Dev mailing list archive at Nabble.com.

Re: A patch for OPENEJB-1565 (Retweet OpenEJB contributors feed)

Posted by David Blevins <da...@gmail.com>.
On Jun 4, 2011, at 6:39 PM, David Blevins wrote:

> 
> On Jun 4, 2011, at 5:49 PM, stratwine wrote:
> 
>> Hi,
>> 
>> I have added another patch (RetweetFunctionallyGood.patch). This retweets
>> pretty well, with original the image of original-tweeter emebedded. 
>> 
>> It takes a default list of recent tweets (around 15 ) from the list
>> Checks for #openejb or @openejb pattern in the tweet.
>> If present, checks it it was retweeted
>> If not retweeted, adds it to a list 
> 
> Perfect.
> 
>> Then the list is looped and each entry is retweeted ( with a 5 min thread
>> sleep, for each entry, so that it doesn't look like spamming a set of tweets
>> at once.. Is that fine ? )
> 
> Nice touch!
> 
>> Apart from the retweet check that we do,Twitter forbids any repeat post with
>> a 403 status code. So that additionally ensures that this app doesn't do any
>> repeat posts.
> 
> Smart for Twitter and good for us.
> 
>> One thing though: If anyone not in the list had retweeted an OpenEJB status,
>> before this app tries, then that message gets filtered out as "retweeted".
>> As a result, it wouldn't be picked up for retweeting.
>> 
>> In that case anyone in the list can do a native retweet like " RT @person
>> original-message" I guess
> 
> So if @personNotInList tweets about OpenEJB, then @personInList hits the retweet button on the twitter website, that retweet from @personInList will be retweeted by @OpenEJB ?
> 
> If so, fantastic :)  If not, I'm sure we can figure something out :)
> 
>> I'll do any tidying in another patch.
> 
> Cool.  I'll commit it then reformat the code to convert the tabs to spaces and get the braces right.  Then feel free to hack away :)

All checked in and reformatted!

So what do we have to do before we can set this up as a cron job?  Executing it every hour is the easy part, but not sure about the auth steps and tokens involved.

Can't wait to hook this thing up! :D


-David


Re: A patch for OPENEJB-1565 (Retweet OpenEJB contributors feed)

Posted by David Blevins <da...@gmail.com>.
On Jun 4, 2011, at 5:49 PM, stratwine wrote:

> Hi,
> 
> I have added another patch (RetweetFunctionallyGood.patch). This retweets
> pretty well, with original the image of original-tweeter emebedded. 
> 
> It takes a default list of recent tweets (around 15 ) from the list
> Checks for #openejb or @openejb pattern in the tweet.
> If present, checks it it was retweeted
> If not retweeted, adds it to a list 

Perfect.

> Then the list is looped and each entry is retweeted ( with a 5 min thread
> sleep, for each entry, so that it doesn't look like spamming a set of tweets
> at once.. Is that fine ? )

Nice touch!

> Apart from the retweet check that we do,Twitter forbids any repeat post with
> a 403 status code. So that additionally ensures that this app doesn't do any
> repeat posts.

Smart for Twitter and good for us.

> One thing though: If anyone not in the list had retweeted an OpenEJB status,
> before this app tries, then that message gets filtered out as "retweeted".
> As a result, it wouldn't be picked up for retweeting.
> 
> In that case anyone in the list can do a native retweet like " RT @person
> original-message" I guess

So if @personNotInList tweets about OpenEJB, then @personInList hits the retweet button on the twitter website, that retweet from @personInList will be retweeted by @OpenEJB ?

If so, fantastic :)  If not, I'm sure we can figure something out :)

> I'll do any tidying in another patch.

Cool.  I'll commit it then reformat the code to convert the tabs to spaces and get the braces right.  Then feel free to hack away :)


-David


Re: A patch for OPENEJB-1565 (Retweet OpenEJB contributors feed)

Posted by stratwine <to...@gmail.com>.
Hi,

I have added another patch (RetweetFunctionallyGood.patch). This retweets
pretty well, with original the image of original-tweeter emebedded. 

It takes a default list of recent tweets (around 15 ) from the list
Checks for #openejb or @openejb pattern in the tweet.
If present, checks it it was retweeted
If not retweeted, adds it to a list 

Then the list is looped and each entry is retweeted ( with a 5 min thread
sleep, for each entry, so that it doesn't look like spamming a set of tweets
at once.. Is that fine ? )

Apart from the retweet check that we do,Twitter forbids any repeat post with
a 403 status code. So that additionally ensures that this app doesn't do any
repeat posts.

One thing though: If anyone not in the list had retweeted an OpenEJB status,
before this app tries, then that message gets filtered out as "retweeted".
As a result, it wouldn't be picked up for retweeting.

In that case anyone in the list can do a native retweet like " RT @person
original-message" I guess

I'll do any tidying in another patch.

-Vishwa





--
View this message in context: http://openejb.979440.n4.nabble.com/A-patch-for-OPENEJB-1565-Retweet-OpenEJB-contributors-feed-tp3561896p3574471.html
Sent from the OpenEJB Dev mailing list archive at Nabble.com.

Re: A patch for OPENEJB-1565 (Retweet OpenEJB contributors feed)

Posted by David Blevins <da...@gmail.com>.
On May 31, 2011, at 3:53 PM, stratwine wrote:

> Wow, feels great. My First time submitting a patch to any open source project
> :) 
> Didn't know it was this simple :)

Simple and fun!  Little projects like the one you're working are great ways to start too.

> Well, the next step would be to retrieve access tokens, so that we can send
> post requests to the twitter account.
> 
> Then, retrieval of statuses from the contribution list.
> 
> I've just attached a patch for these, please review ( Attached twice by
> mistake, but both files are the same )

All applied! And thanks for putting the headers in! 

Looking good.  Really starting to form up.


-David


Re: A patch for OPENEJB-1565 (Retweet OpenEJB contributors feed)

Posted by stratwine <to...@gmail.com>.
Wow, feels great. My First time submitting a patch to any open source project
:) 
Didn't know it was this simple :)

Well, the next step would be to retrieve access tokens, so that we can send
post requests to the twitter account.

Then, retrieval of statuses from the contribution list.

I've just attached a patch for these, please review ( Attached twice by
mistake, but both files are the same )

-Vishwa

--
View this message in context: http://openejb.979440.n4.nabble.com/A-patch-for-OPENEJB-1565-Retweet-OpenEJB-contributors-feed-tp3561896p3564563.html
Sent from the OpenEJB Dev mailing list archive at Nabble.com.

Re: A patch for OPENEJB-1565 (Retweet OpenEJB contributors feed)

Posted by David Blevins <da...@gmail.com>.
On May 30, 2011, at 4:45 PM, stratwine wrote:

> Yep, Done :) 

Checked in!

So what is the next step?


-David




Re: A patch for OPENEJB-1565 (Retweet OpenEJB contributors feed)

Posted by stratwine <to...@gmail.com>.
Yep, Done :) 

--
View this message in context: http://openejb.979440.n4.nabble.com/A-patch-for-OPENEJB-1565-Retweet-OpenEJB-contributors-feed-tp3561896p3561982.html
Sent from the OpenEJB Dev mailing list archive at Nabble.com.

Re: A patch for OPENEJB-1565 (Retweet OpenEJB contributors feed)

Posted by David Blevins <da...@gmail.com>.
On May 30, 2011, at 3:58 PM, stratwine wrote:

> Hi,
> 
> I have added a patch for OPENEJB-1565.
> 
> Please review..

That's awesome, Vishwa!  Got it ready to check in.  Small request, can you reattach the patch and make sure to click that "Grant license to ASF" option.

Once we get that I can check in and we can get rolling!


-David