<?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>Enrique Chávez Garcia- Desarrollo de Web &#187; twitter</title>
	<atom:link href="http://tmeister.net/category/twitter/feed/" rel="self" type="application/rss+xml" />
	<link>http://tmeister.net</link>
	<description>Blog acerca de desarrollo orientado hacia Flash, Flex y Actionscript.</description>
	<lastBuildDate>Thu, 19 Jan 2012 20:25:41 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	
		<item>
		<title>Jobs Digger &#8211; Disponible en GitHub</title>
		<link>http://tmeister.net/2011/10/27/jobs-digger-disponible-en-github/</link>
		<comments>http://tmeister.net/2011/10/27/jobs-digger-disponible-en-github/#comments</comments>
		<pubDate>Thu, 27 Oct 2011 21:24:00 +0000</pubDate>
		<dc:creator>Tmeister</dc:creator>
				<category><![CDATA[Nodejs]]></category>
		<category><![CDATA[twitter]]></category>

		<guid isPermaLink="false">http://tmeister.net/?p=671</guid>
		<description><![CDATA[El fin de semana pasado estuve jugando con Nodejs y les quiero compartir el código de este experimento para ello cree un repo en GitHub para que lo puedan descargar integro. Den click en el Ribbon de la derecha, ese anaranjado o sigan la liga directamente a https://github.com/Tmeister/jobs-digger De cualquier forma copio el README para poder clonarlo y hacerlo [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://github.com/Tmeister/jobs-digger"><img class="alignright" style="border-style: initial; border-color: initial; border-width: 0px; margin: 0px;" title="Jobs Digger - My weekend project Nodejs &amp;&amp; Socket.io" src="http://s3.amazonaws.com/github/ribbons/forkme_right_orange_ff7600.png" alt="" width="149" height="149" /></a>El fin de semana pasado estuve <a title="Jobs Digger – Nodejs" href="http://tmeister.net/2011/10/22/jobs-digger-nodejs/">jugando con Nodejs </a>y les quiero compartir el código de este experimento para ello cree un repo en GitHub para que lo puedan descargar integro.</p>
<p>Den click en el Ribbon de la derecha, ese anaranjado o sigan la liga directamente a <a href="https://github.com/Tmeister/jobs-digger">https://github.com/Tmeister/jobs-digge</a><a href="https://github.com/Tmeister/jobs-digger">r</a></p>
<p>De cualquier forma copio el README para poder clonarlo y hacerlo funcionar en sus maquina.</p>
<p>&nbsp;</p>
<h1>README.md</h1>
<p>&nbsp;</p>
<h1><span class="Apple-style-span" style="font-size: 20px;">Que es</span></h1>
<p>Jobs Digger es una &#8220;app&#8221; hecha en nodejs cuyo objetivo primordial es buscar en el stream de twitter hashtags y los tweets que contengan esos hashtags ubicarlos geográficamente en un mapa.</p>
<h2>Dependencias.</h2>
<p>Esta guia esta enfocada para sistemas *nix, lease Linux/Macintosh lo siento si usan Windows <img src='http://tmeister.net/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<h3>Nodejs</h3>
<p>Lo primero es asegurarse de tener Nodejs instalado. Si usas ubuntu puedes usar:</p>
<pre><code>sudo apt-get install nodejs </code></pre>
<p>O sigue esta guía <a href="http://joyeur.com/2010/12/10/installing-node-and-npm/">http://joyeur.com/2010/12/10/installing-node-and-npm/</a></p>
<h3>NPM</h3>
<p>Ademas de usar <a href="https://github.com/isaacs/npm">Npm</a> el cual es un manejador de paquetes para Node, este es muy útil para declarar nuestras dependencias y al momento de hacer deploy instalarlas.</p>
<h3>MongoDB</h3>
<p>Como base de datos usaremos <a href="http://www.mongodb.org/display/DOCS/Quickstart+Unix">MongoDB</a></p>
<h2>Como lo hago funcionar.</h2>
<p>Simplemente clona este repo</p>
<pre><code>mkdir digger cd digger git clone git@github.com:Tmeister/jobs-digger.git . </code></pre>
<h3>Modifica los datos de tus cuentas en el archivo jobs.js</h3>
<pre><code>var twitter_user = ""; var twitter_pass = ""; var hashtags = "#jobs, #job, #trabajo, #trabajos"; var db_host = ""; //ej. mongodb://localhost/jobs </code></pre>
<h3>Instalamos las dependencias</h3>
<p>Desde digger instalamos las dependencias que estan descritas en el archivo package.json usando</p>
<pre><code>npm install . </code></pre>
<p>Si todo va bien veremos un log como el siguiente:</p>
<pre><code>[tmeister digger]$ npm install . npm WARN mongodb@0.9.6-22 package.json: bugs['web'] should probably be bugs['url'] &gt; mongodb@0.9.6-22 install /home/tmeister/Sites/tuto-digger/node_modules/mongoose/node_modules/mongodb &gt; bash ./install.sh ================================================================================ = = = To install with C++ bson parser do  = = the parser only works for node 0.4.X or lower = = = ================================================================================ Not building native library for cygwin twitter-node@0.0.2 ./node_modules/twitter-node mongoose@2.3.8 ./node_modules/mongoose --- colors@0.5.0 --- hooks@0.1.9 --- mongodb@0.9.6-22 stylus@0.19.0 ./node_modules/stylus --- growl@1.1.0 --- mkdirp@0.0.7 --- cssom@0.2.0 express@2.4.7 ./node_modules/express --- mkdirp@0.0.7 --- mime@1.2.4 --- connect@1.7.2 --- qs@0.3.1 socket.io@0.8.6 ./node_modules/socket.io --- policyfile@0.0.4 --- redis@0.6.7 --- socket.io-client@0.8.6 jade@0.16.4 ./node_modules/jade --- mkdirp@0.0.7 --- commander@0.2.1 </code></pre>
<p>Ahora solo ejecutamos nuestra apliación</p>
<pre><code>node app.js </code></pre>
<p>Y veremos</p>
<pre><code>tmeister digger]$ node app.js info - socket.io started Express server listening on port 3000 in development mode </code></pre>
<p>Listo, ingresamos a la dirección <a href="http://localhost:3000/">http://localhost:3000</a> y veremos el resultado, el cual lo pueden ver en linea en <a href="http://digger.tmeister.net/">http://digger.tmeister.net</a></p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://tmeister.net/2011/10/27/jobs-digger-disponible-en-github/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Obtener tweets usando PHP &amp; Flex 4 (Gumbo)</title>
		<link>http://tmeister.net/2009/12/09/obtener-tweets-usando-php-flex-4-gumbo/</link>
		<comments>http://tmeister.net/2009/12/09/obtener-tweets-usando-php-flex-4-gumbo/#comments</comments>
		<pubDate>Wed, 09 Dec 2009 23:17:49 +0000</pubDate>
		<dc:creator>Tmeister</dc:creator>
				<category><![CDATA[Flex 4]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[twitter]]></category>
		<category><![CDATA[api ejemplo]]></category>

		<guid isPermaLink="false">http://tmeister.net/?p=512</guid>
		<description><![CDATA[En este ejemplo, ya no muy básico, les mostrare como obtener los últimos tweets de un usuario y mostrarlos en Flex 4 (Gumbo) para ello haremos uso de PHP como gateway, con PHP obtendremos los tweets por medio del API de Twitter y los desplegaremos en forma de XML para poder leerlos en Flex. Este ejemplo esta hecho [...]]]></description>
			<content:encoded><![CDATA[<p>En este <a href="http://tmeister.net/category/flex-4/">ejemplo</a>, ya no muy básico, les mostrare como obtener los últimos tweets de un usuario y mostrarlos en <a href="http://tmeister.net/category/flex-4/">Flex 4 (Gumbo)</a> para ello haremos uso de PHP como gateway, con PHP obtendremos los tweets por medio del <a href="http://apiwiki.twitter.com/">API de Twitter</a> y los desplegaremos en forma de XML para poder leerlos en Flex.</p>
<div class="info">Este ejemplo esta hecho con <a href="http://labs.adobe.com/technologies/flashbuilder4/" target="_blank">Flash Builder 4 Beta 2</a> y necesita el <a href="https://www.adobe.com/go/getflashplayer">FlashPlayer 10</a> para poder visualizarlo correctamente</div>
<h1>Ejemplo</h1>
<div>
<object width="600" height="350">
<param name="movie" value="http://tmeister.net/flex/gumbo/last-tweet/tweets.swf"></param>
<param name="quality" value="high"></param>
<param name="wmode" value="transparent"></param>
<param name="menu" value="false"></param>
<param name="bgcolor" value="#ffffff"></param>
<param name="allowScriptAccess" value="always"></param>
<param name="allowFullScreen" value="true"></param>
<embed type="application/x-shockwave-flash" width="600" height="350" src="http://tmeister.net/flex/gumbo/last-tweet/tweets.swf" quality="high" bgcolor="#ffffff" wmode="transparent" menu="false" allowFullScreen="true" ></embed>
</object>
</div>
<p>Lo primero que necesitamos es crear el script en PHP para poder conectarnos al <a href="http://apiwiki.twitter.com/">API de Twitter</a>, obtener los tweets y desplegarlos en XML.</p>
<h1>PHP</h1>
<pre class="brush: php; title: ; notranslate">
&lt;?php
/**
 * get_user_tweets()
 *
 * @param mixed $username
 * @param integer $count
 * @return array $out
 */
function get_user_tweets($username, $count = 10)
{
	/**
	 * URL para obtener los tweets en formato JSON
	 * Utilizaremos curl para hacer la conexion al API de Twitter
	 * */
	$url = 'http://twitter.com/statuses/user_timeline/'.$username.'.json?count='.$count;
	$curl = curl_init();

	/**
	 * Iniciamos CURL pasando que URL vamos a cargar
	 * */
	curl_setopt($curl, CURLOPT_URL, $url);
	/**
	 * Indicamos que querremos el output de regreso
	 * */
	curl_setopt ($curl, CURLOPT_RETURNTRANSFER, 1);
	/**
	 * Ponemos un TimeOut al script
	 */
	curl_setopt ($curl, CURLOPT_CONNECTTIMEOUT, 10);

	/**
	 * Ejecutamos CURL
	 */
	$json = curl_exec($curl);

	/**
	 * Cerramos la conexion
	 */
	curl_close($curl);

	/**
	 * Tomanos el resultado (JSON) y lo parseamos en PHP
	 */
	$tweets = json_decode($json);
	$out;

	/**
	 * Por ultimo por cada tweet tomanos el contenido y lo metemos en un Array
	 */
	foreach($tweets as $tweet)
	{
		$out[] = $tweet-&gt;text;
	}

	return $out;
}

/**
 * Con la informacion obtenida del API construimos un XML y lo mostramos
 */
$out = '&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf8&quot;?&gt;';
$out .= &quot;&lt;tweets&gt;&quot;;
$tweets = get_user_tweets('tmeister', 10);
foreach($tweets as $tweet)
{
	$out .= &quot;&lt;tweet&gt;$tweet&lt;/tweet&gt;&quot;;
}
$out .= &quot;&lt;/tweets&gt;&quot;;
header (&quot;content-type: text/xml&quot;);
echo $out;
?&gt;
</pre>
<p>El resultado del script lo puedes ver en <a href="http://tmeister.net/flex/gumbo/last-tweet/last.php">http://tmeister.net/flex/gumbo/last-tweet/last.php</a></p>
<h1>MXML</h1>
<p>Una vez que tenemos el XML solo falta mostrar su contenido en Flex.</p>
<pre class="brush: xml; title: ; notranslate">
&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;
&lt;s:Application
    xmlns:fx=&quot;http://ns.adobe.com/mxml/2009&quot;
    xmlns:s=&quot;library://ns.adobe.com/flex/spark&quot;
    xmlns:mx=&quot;library://ns.adobe.com/flex/halo&quot;
    width=&quot;100%&quot;
    height=&quot;100%&quot;
    creationComplete=&quot;{service.send()}&quot;
    viewSourceURL=&quot;http://tmeister.net/flex/gumbo/last-tweet/srcview/index.html&quot;
    &gt;

    &lt;fx:Script&gt;
        &lt;![CDATA[
            import mx.collections.ArrayCollection;
            import mx.controls.Alert;
            import mx.rpc.events.FaultEvent;
            import mx.rpc.events.ResultEvent;

            [Bindable]
            private var _tweets:ArrayCollection;

            protected function service_resultHandler(event:ResultEvent):void
            {

                _tweets = new ArrayCollection();

                for each( var tweet:String in event.result.tweet  )
                {
                    _tweets.addItem(tweet);
                }
            }

            protected function service_faultHandler(event:FaultEvent):void
            {
                Alert.show(event.fault.faultString, &quot;Error&quot;);
            }

        ]]&gt;
    &lt;/fx:Script&gt;

    &lt;fx:Declarations&gt;
        &lt;s:HTTPService
            id=&quot;service&quot;
            result=&quot;service_resultHandler(event)&quot;
            fault=&quot;service_faultHandler(event)&quot;
            url=&quot;http://tmeister.net/flex/gumbo/last-tweet/last.php&quot;
            showBusyCursor=&quot;true&quot;
            resultFormat=&quot;e4x&quot;
            &gt;
        &lt;/s:HTTPService&gt;
    &lt;/fx:Declarations&gt;

    &lt;mx:VBox verticalCenter=&quot;0&quot; horizontalCenter=&quot;0&quot;&gt;
        &lt;mx:Repeater id=&quot;rep&quot; dataProvider=&quot;{_tweets}&quot;&gt;
            &lt;s:Label text=&quot;{rep.currentItem}&quot; /&gt;
            &lt;mx:HRule width=&quot;100%&quot; /&gt;
        &lt;/mx:Repeater&gt;
    &lt;/mx:VBox&gt;

&lt;/s:Application&gt;
</pre>
<p>Con esto ya podemos mostrar los últimos tweets de un timeline sin necesidad de usar librerias ni de PHP o de ActionScript.</p>
]]></content:encoded>
			<wfw:commentRss>http://tmeister.net/2009/12/09/obtener-tweets-usando-php-flex-4-gumbo/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Object Caching 424/474 objects using disk: basic

Served from: tmeister.net @ 2012-02-07 00:06:44 -->

<!-- W3 Total Cache: Db cache debug info:
Engine:             disk: basic
Total queries:      27
Cached queries:     2
Total query time:   0.0330
SQL info:
    # | Time (s) |    Caching (Reject reason)     |   Status   | Data size (b) | Query
    1 |   0.0003 |            enabled             | not cached |           536 | SELECT option_value FROM wp_options WHERE option_name = 'akismet_comment_nonce' LIMIT 1
    2 |   0.0002 |            enabled             | not cached |           538 | SELECT option_value FROM wp_options WHERE option_name = 'aiosp_post_title_format' LIMIT 1
    3 |   0.0002 |            enabled             | not cached |           553 | SELECT option_value FROM wp_options WHERE option_name = 'widget_available_drainhole-statistics' LIMIT 1
    4 |   0.0003 |            enabled             | not cached |           525 | SELECT option_value FROM wp_options WHERE option_name = 'jetpack_id' LIMIT 1
    5 |   0.0004 |  disabled (Query is rejected)  | not cached |             0 | SHOW TABLES LIKE 'wp_tla_data'
    6 |   0.0006 |  disabled (Query is rejected)  | not cached |             0 | SHOW COLUMNS FROM wp_tla_data LIKE 'xml_key'
    7 |   0.0005 |            enabled             |   cached   |          4215 | SELECT * FROM wp_tla_data
    8 |   0.0183 |            enabled             | not cached |           529 | SELECT option_value FROM wp_options WHERE option_name = 'theme_switched' LIMIT 1
    9 |   0.0004 |            enabled             | not cached |           714 | SELECT post_modified_gmt FROM wp_posts WHERE post_status = 'publish' AND post_type IN ('post', 'page', 'attachment', 'slideshow', 'portfolio') ORDER BY post_modified_gmt DESC LIMIT 1
   10 |   0.0001 |            enabled             | not cached |           698 | SELECT post_date_gmt FROM wp_posts WHERE post_status = 'publish' AND post_type IN ('post', 'page', 'attachment', 'slideshow', 'portfolio') ORDER BY post_date_gmt DESC LIMIT 1
   11 |   0.0003 |            enabled             | not cached |           676 | SELECT wp_term_taxonomy.term_id
					FROM wp_term_taxonomy
					INNER JOIN wp_terms USING (term_id)
					WHERE taxonomy = 'category'
					AND wp_terms.slug IN ('twitter')
   12 |   0.0003 |            enabled             | not cached |           634 | SELECT term_taxonomy_id
					FROM wp_term_taxonomy
					WHERE taxonomy = 'category'
					AND term_id IN (40)
   13 |   0.0005 |            enabled             | not cached |          3462 | SELECT t.*, tt.* FROM wp_terms AS t INNER JOIN wp_term_taxonomy AS tt ON t.term_id = tt.term_id WHERE tt.taxonomy = 'category' AND t.slug = 'twitter' LIMIT 1
   14 |   0.0016 |  disabled (Query is rejected)  | not cached |             0 | SELECT SQL_CALC_FOUND_ROWS  wp_posts.* FROM wp_posts  INNER JOIN wp_term_relationships ON (wp_posts.ID = wp_term_relationships.object_id) WHERE 1=1  AND ( wp_term_relationships.term_taxonomy_id IN (72) ) AND wp_posts.post_type = 'post' AND (wp_posts.post_status = 'publish') GROUP BY wp_posts.ID ORDER BY wp_posts.post_date DESC LIMIT 0, 15
   15 |   0.0054 |  disabled (Query is rejected)  | not cached |             0 | SELECT FOUND_ROWS()
   16 |   0.0003 |            enabled             |   cached   |          3462 | SELECT t.*, tt.* FROM wp_terms AS t INNER JOIN wp_term_taxonomy AS tt ON t.term_id = tt.term_id WHERE tt.taxonomy = 'category' AND t.slug = 'twitter' LIMIT 1
   17 |   0.0002 |            enabled             | not cached |          4670 | SELECT * FROM wp_users WHERE ID = '1'
   18 |   0.0003 |            enabled             | not cached |          8065 | SELECT user_id, meta_key, meta_value FROM wp_usermeta WHERE user_id IN (1)
   19 |   0.0002 |            enabled             | not cached |          3815 | SELECT t.*, tt.* FROM wp_terms AS t INNER JOIN wp_term_taxonomy AS tt ON tt.term_id = t.term_id INNER JOIN wp_term_relationships AS tr ON tr.term_taxonomy_id = tt.term_taxonomy_id WHERE tt.taxonomy IN ('category') AND tr.object_id IN (671) ORDER BY t.name ASC
   20 |   0.0002 |            enabled             | not cached |          3312 | SELECT t.*, tt.* FROM wp_terms AS t INNER JOIN wp_term_taxonomy AS tt ON tt.term_id = t.term_id INNER JOIN wp_term_relationships AS tr ON tr.term_taxonomy_id = tt.term_taxonomy_id WHERE tt.taxonomy IN ('post_tag') AND tr.object_id IN (671) ORDER BY t.name ASC
   21 |   0.0003 |            enabled             | not cached |          1927 | SELECT post_id, meta_key, meta_value FROM wp_postmeta WHERE post_id IN (671)
   22 |   0.0003 |            enabled             | not cached |         13296 | SELECT * FROM wp_posts WHERE ID = 671 LIMIT 1
   23 |   0.0003 |            enabled             | not cached |          4058 | SELECT t.*, tt.* FROM wp_terms AS t INNER JOIN wp_term_taxonomy AS tt ON tt.term_id = t.term_id INNER JOIN wp_term_relationships AS tr ON tr.term_taxonomy_id = tt.term_taxonomy_id WHERE tt.taxonomy IN ('category') AND tr.object_id IN (512) ORDER BY t.name ASC
   24 |   0.0002 |            enabled             | not cached |          4078 | SELECT t.*, tt.* FROM wp_terms AS t INNER JOIN wp_term_taxonomy AS tt ON tt.term_id = t.term_id INNER JOIN wp_term_relationships AS tr ON tr.term_taxonomy_id = tt.term_taxonomy_id WHERE tt.taxonomy IN ('post_tag') AND tr.object_id IN (512) ORDER BY t.name ASC
   25 |   0.0006 |            enabled             | not cached |          1814 | SELECT post_id, meta_key, meta_value FROM wp_postmeta WHERE post_id IN (512)
   26 |   0.0003 |            enabled             | not cached |         14100 | SELECT * FROM wp_posts WHERE ID = 512 LIMIT 1
   27 |   0.0003 |            enabled             | not cached |           528 | SELECT option_value FROM wp_options WHERE option_name = 'disqus_cc_fix' LIMIT 1
-->

<!-- W3 Total Cache: Page cache debug info:
Engine:             disk: enhanced
Cache key:          category/twitter/feed/_index.html
Caching:            disabled
Reject reason:      DONOTCACHEPAGE constant is defined
Status:             not cached
Creation Time:      0.504s
Header info:
X-Pingback:         http://tmeister.net/xmlrpc.php
Last-Modified:      Thu, 19 Jan 2012 20:25:41 GMT
ETag:               "5128b61493d147f8e15e42f284d2c6d2"
X-Powered-By:       W3 Total Cache/0.9.2.4
Content-Type:       text/xml; charset=utf-8
-->
