<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>TechnoBitez &#187; ruby</title>
	<atom:link href="http://www.technobitez.com/tag/ruby/feed" rel="self" type="application/rss+xml" />
	<link>http://www.technobitez.com</link>
	<description>Web Redefined</description>
	<lastBuildDate>Wed, 18 Jan 2012 05:17:04 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Expand Your Twitter Network With Ruby</title>
		<link>http://www.technobitez.com/social-network/expand-your-twitter-network-with-ruby</link>
		<comments>http://www.technobitez.com/social-network/expand-your-twitter-network-with-ruby#comments</comments>
		<pubDate>Sat, 11 Jul 2009 11:54:23 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Social Network]]></category>
		<category><![CDATA[ruby]]></category>
		<category><![CDATA[social networ]]></category>
		<category><![CDATA[Twitter]]></category>

		<guid isPermaLink="false">http://www.technobitez.com/?p=111</guid>
		<description><![CDATA[Have any basic idea of OOP? No? Then, don&#8217;t bother reading. Twitter is a place to have fun, stay updated and connect with friends of friends. Growing your network on Twitter now is becoming a little tougher than earlier. All thanks to bots and spammer You know, they are the spoilsports found everywhere. Anyways, I [...]]]></description>
			<content:encoded><![CDATA[<div class="KonaBody"><h6><em>Have any basic idea of OOP? No? Then, don&#8217;t bother reading. </em></h6>
<p><a rel="nofollow" target="_blank" href="http://twitter.com/">Twitter</a> is a place to have fun, stay updated and connect with friends of friends. Growing your network on  Twitter now is becoming a little tougher than earlier. All thanks to bots and  spammer <img src='http://www.technobitez.com/wp-includes/images/smilies/icon_neutral.gif' alt="icon neutral Expand Your Twitter Network With Ruby" class='wp-smiley' title="Expand Your Twitter Network With Ruby" />  You know, they are the spoilsports found everywhere.</p>
<p>Anyways, I found something interesting on <a rel="nofollow" target="_blank" href="http://blog.jerodsanto.net/2009/05/expand-your-twitter-network-in-less-than-15-lines-of-ruby/">Jerod Santo</a>’s blog. A way to expand  you Twitter network with Ruby. This Ruby (program) generates a list of people  highly followed by our friends.</p>
<p><strong>The Flow</strong></p>
<ol>
<li>Fetch the ids of all the people you follow</li>
<li>Use those ids to fetch the ids of all the people they follow</li>
<li>Remove any ids in both groups</li>
<li>Tally the occurrences of each unique id in the list</li>
<li>Sort them by most occurrences</li>
<li>Iterate the top 10 and print the user information</li>
</ol>
<p><strong>The Script</strong></p>
<pre>require 'rubygems'
require 'twitter'

base        = Twitter::Base.new(Twitter::HTTPAuth.new('username', 'password'))
my_friends  = base.friend_ids
candidates  = my_friends.inject(Array.new) { |array,id| array += Twitter.friend_ids(id); array }
candidates -= my_friends
tallied     = candidates.inject(Hash.new(0)) { |hash, can| hash[can] += 1; hash }
ordered     = tallied.sort { |x,y| y[1] &lt;=&gt; x[1] }

ordered[0..9].each do |array|
  user = base.user(array[0])
  puts "#{user.screen_name} is followed by #{array[1]} of the people you follow."
end</pre>
<h6>P.S I am not a Ruby programmer.</h6>
<p>P.S.S You can follow me on Twitter. Click <a rel="nofollow" target="_blank" href="http://twitter.com/joelfernandes">here</a> here to do so. <img src='http://www.technobitez.com/wp-includes/images/smilies/icon_smile.gif' alt="icon smile Expand Your Twitter Network With Ruby" class='wp-smiley' title="Expand Your Twitter Network With Ruby" /> </p>
</div>]]></content:encoded>
			<wfw:commentRss>http://www.technobitez.com/social-network/expand-your-twitter-network-with-ruby/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

