How to Contribute to Open Source (When You're Not Exactly Scott Hanselman): Page 2

(Page 2 of 2)

As you can see they are treating each tweet as an array and then iterating through that array to check the words for @usernames and #hashtags. Initially, I was going to have this loop check for a word either starting with, or having the second character be @, but then it occured to me that we only want to check that first word in the tweet, since this issue is only an issue in that first word. It's adding more checks to each word to throw the logic into the loop and there has to be a better way to do it.

I figured a great way to do this would be if I could separate the initial character and the @username into two separate parts of the array. I knew you couldn't insert into a string array, but you can with an arraylist.

how to contribute to an open source project

I turned the array into an Arraylist and then I can make the first character and @username two words in the array. Then the loop will treat the see the @username for what it is and make it a link.

I was all set to check this in when I realized how much of a performance hit making the array into an Array List would be. So, I've gotta come up with something else. I decided to remove the functionality to format the @username from inside to loop, make it a method and call it before entering the loop if it falls in our char+username if statement, then call it from inside the loop if it is an actual username within the tweet.

how to contribute to an open source project

There we go and here are our final changes to the OnTweetTextChanged method:

how to contribute to an open source project

I tested again, and we're looking great.

how to contribute to an open source project

Step next: submitting our patch.

how to contribute to an open source project

What you want to do is go to the svn folder where everything is contained right click as if you were committing your work however go to "Create Patch" instead. Select the files you changed and save the patch somewhere.

how to contribute to an open source project

SVN will show you a diff for your changes, go through and make sure you put everything in the patch.

how to contribute to an open source project

Now go to the Witty issues list, and submit your patch along with a comment about what it is doing and then submit!

That's it! We're golden. All together it took a little over an hour What have I gained here?

1. I got to add a feature I wanted to an application that I use.

2. After I submitted my first patch I got great feedback and critique from a developer I really look up to (Jon Galloway). You can have the same experience as long as the project you are working on is run by people you think are interesting.

3. I got to work with a new framework.

4. I feel like I've contributed something to the community, I walked around smugly for at least a few hours (j/k, but it's cool).

Anyway, I hope this encourages you to get started. I'm certainly glad I did.

Page 2 of 2

Previous Page
1 2

Tags: open source, developer, programmers

0 Comments (click to add your comment)
Comment and Contribute


(Maximum characters: 1200). You have characters left.