Archive

Archive for May, 2011

My small tribute to an unknown (to me) skateboarder – Brighton & Hove

May 17th, 2011

Last weekend I noticed this on a Brighton bench.

Skateboarder tribute

I had to share.

admin Music, Skateboarding

Show tweets including retweets from user with Linq2Twitter issue

May 16th, 2011

I came across a weird one this week.

I have been working on a brand new project at work and one of the user stories was about a Twitter “widget” with tweets from a specific user. It was specified that the user could be any user and didn’t need to be authenticated. This is how I implemented it:

var twitterContext = new TwitterContext();

var statusTweets = from tweet in twitterContext.Status
                   where tweet.Type == StatusType.User &&
                   tweet.ScreenName == username
                   select tweet;

Then the requirements changed to include retweets from the same user. I changed my code to this:

var twitterContext = new TwitterContext();

var statusTweets = from tweet in twitterContext.Status
                   where tweet.Type == StatusType.User &&
                   tweet.ScreenName == username &&
                   tweet.IncludeRetweets
                   select tweet;

But when doing that, nothing was being returned.

After a long time trying other approaches I finally found what the problem was. Because I use Resharper I was advised to write ‘tweet.IncludeRetweets == true’ as only ‘tweet.IncludeRetweets’ and that just didn’t work. You actually need to have ‘tweet.IncludeRetweets == true’.

So, here is the correct code to get tweets from a user including retweets without being authenticated:

var twitterContext = new TwitterContext();

var statusTweets = from tweet in twitterContext.Status
                   where tweet.Type == StatusType.User &&
                   tweet.ScreenName == username &&
                   tweet.IncludeRetweets == true
                   select tweet;

I hope someone will find this useful.

admin C#, Linq2Twitter

Les Claypool – South of the Pumphouse

May 10th, 2011

As a great fan of Les Claypool I just had to get “South of the Pumphouse” – his novel. Yeah, I know it was released in 2007…

Anyway, I wasn’t sure if I would enjoy reading a novel as I do not usually read anything but technical books/manuals, cd/dvd covers lyrics and subtitles (and, being a vegan I also read all and any ingredients labels and the odd take-away leaflet) but this is a really interesting read. Kind of like watching a twisted and dark plasticine animation.

I am really enjoying the experience and cannot wait to read the next chapter – which I should be doing instead of writing this post, right?

Try reading Chapter 2 – “The Rage” if you can.

http://www.lesclaypool.com/pumphouse/

admin Music, Reading