<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2spanishfull.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss 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/" xmlns:creativeCommons="http://backend.userland.com/creativeCommonsRssModule" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0">

<channel>
	<title>Bicosyes - since evermore...</title>
	
	<link>http://bicosyes.com</link>
	<description />
	<lastBuildDate>Tue, 27 Oct 2009 17:38:55 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<creativeCommons:license>http://creativecommons.org/licenses/by-nc-sa/3.0/</creativeCommons:license><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" href="http://feeds.feedburner.com/Bicosyes-SinceEvermore" type="application/rss+xml" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com" /><item>
		<title>A new gem: rubygems is it jruby?</title>
		<link>http://feedproxy.google.com/~r/Bicosyes-SinceEvermore/~3/KdzLpDj8944/</link>
		<comments>http://bicosyes.com/a-new-gem-rubygems-is-it-jruby/#comments</comments>
		<pubDate>Mon, 24 Aug 2009 18:30:11 +0000</pubDate>
		<dc:creator>blaxter</dc:creator>
				<category><![CDATA[JRuby]]></category>
		<category><![CDATA[rubygems]]></category>
		<category><![CDATA[rubygems-isitjruby]]></category>

		<guid isPermaLink="false">http://bicosyes.com/?p=864</guid>
		<description><![CDATA[A few days ago after seeing this tweet, I've decided to migrate the gem rubygems-isit19 to jruby. Thanks to this, when you install another gem you'll be able to read about compability of this gem with jruby, the information is fetched from isitjruby.com website.
Once you have installed the gem you will have two main features, [...]]]></description>
			<content:encoded><![CDATA[<p>A few days ago after seeing <a href="http://twitter.com/jruby/status/3431143889">this tweet</a>, I've decided to migrate the gem <em><a href="http://seattlerb.rubyforge.org/rubygems-isit19/"><strong>rubygems-isit19</strong></a></em> to <strong><a href="http://jruby.org">jruby</a></strong>. Thanks to this, when you install another gem you'll be able to read about compability of this gem with jruby, the information is fetched from <a href="http://isitjruby.com/"><strong>isitjruby.com</strong></a> website.</p>
<p>Once you have installed the gem you will have two main features, it's easier if I just show you. First the messages when you install gems:</p>
<pre class="bash">&nbsp;
$ jgem <span style="color: #c20cb9; font-weight: bold;">install</span> daemons
&nbsp;
daemons <span style="color: #000000;">1.0</span><span style="color: #000000;">.10</span> probably might not work, blaxter says <span style="color: #000000;">1.0</span> fails
Update http://isitjruby.com/daemons with your experiences!
&nbsp;
Successfully installed daemons<span style="color: #000000;">-1.0</span><span style="color: #000000;">.10</span>
<span style="color: #000000;">1</span> gem installed
$ jgem <span style="color: #c20cb9; font-weight: bold;">install</span> cucumber
&nbsp;
cucumber <span style="color: #000000;">0.3</span><span style="color: #000000;">.97</span> might work, <span style="color: #000000;">100</span>% say <span style="color: #000000;">0.3</span><span style="color: #000000;">.11</span><span style="color: #000000;">.3</span> works on jruby
Update http://isitjruby.com/cucumber with your experiences!
&nbsp;
Successfully installed cucumber<span style="color: #000000;">-0.3</span><span style="color: #000000;">.97</span>
<span style="color: #000000;">1</span> gem installed
$ jgem <span style="color: #c20cb9; font-weight: bold;">install</span> faker
&nbsp;
faker <span style="color: #000000;">0.3</span><span style="color: #000000;">.1</span> is <span style="color: #000000;">100</span>% verified jruby
Update http://isitjruby.com/faker with your experiences!
&nbsp;
Successfully installed faker<span style="color: #000000;">-0.3</span><span style="color: #000000;">.1</span>
<span style="color: #000000;">1</span> gem installed
&nbsp;</pre>
<p>And also we have an explicit gem command:</p>
<pre class="bash">&nbsp;
$ jgem isitjruby faker
faker <span style="color: #000000;">0.3</span><span style="color: #000000;">.1</span>:    http://isitjruby.com/faker
    Blaxter says <span style="color: #000000;">0.3</span><span style="color: #000000;">.1</span> works on GNU/Linux
        it works perfectly, and it passes all <span style="color: #7a0874; font-weight: bold;">test</span>.
$ jgem isitjruby daemons
daemons <span style="color: #000000;">1.0</span><span style="color: #000000;">.10</span>:    http://isitjruby.com/daemons
    blaxter says <span style="color: #000000;">1.0</span> fails on GNU/Linux
        Daemons use fork, jruby doesn<span style="color: #ff0000;">'t support fork, so it doesn'</span>t work and
        never will
&nbsp;</pre>
<p>And that's it. <a href="http://github.com/blaxter/rubygems-isitjruby/tree/master">The code is on github</a> be free of fork me or open any issues. The important thing is populate with relevant information <a href="http://isitjruby.com">isitjruby.com</a> for benefit of all jruby community. Oh I forgot to tell you <strong>how to install it</strong>, very easy, I've uploaded the gem to <a href="http://gemcutter.org/gems/rubygems-isitjruby">gemcutter</a> so you can install it with something like</p>
<pre>$ jgem install rubygems-isitjruby -s http://gemcutter.org</pre>
<p>It's also in github, but I think (and I hope) gemcutter will be the next rubyforge, so better gemcutter <img src='http://bicosyes.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> .</p>
<img src="http://bicosyes.com/?ak_action=api_record_view&id=864&type=feed" alt="" /><img src="http://feeds.feedburner.com/~r/Bicosyes-SinceEvermore/~4/KdzLpDj8944" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://bicosyes.com/a-new-gem-rubygems-is-it-jruby/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		<feedburner:origLink>http://bicosyes.com/a-new-gem-rubygems-is-it-jruby/</feedburner:origLink></item>
		<item>
		<title>Backup incremental de tu base de datos con Git</title>
		<link>http://feedproxy.google.com/~r/Bicosyes-SinceEvermore/~3/e9twz60edvk/</link>
		<comments>http://bicosyes.com/backup-incremental-de-tu-base-de-datos-con-git/#comments</comments>
		<pubDate>Thu, 09 Jul 2009 19:48:13 +0000</pubDate>
		<dc:creator>blaxter</dc:creator>
				<category><![CDATA[Bases de Datos]]></category>
		<category><![CDATA[Git]]></category>
		<category><![CDATA[backups]]></category>
		<category><![CDATA[databases]]></category>
		<category><![CDATA[mysql]]></category>

		<guid isPermaLink="false">http://bicosyes.com/?p=858</guid>
		<description><![CDATA[Una forma realmente interesante de realizar backups de tus bases de datos (por ser trivial y muy potente) es usando Git. El proceso es simple y se basa en la realización de los dumps de la base de datos de forma que cada fila de las tablas sea un insert aislado, de esa forma en [...]]]></description>
			<content:encoded><![CDATA[<p>Una forma realmente interesante de realizar backups de tus bases de datos (por ser <strong>trivial</strong> y muy potente) es usando <strong><a href="http://git-scm.com/">Git</a></strong>. El proceso es simple y se basa en la realización de los dumps de la base de datos de forma que cada <strong>fila</strong> de las tablas sea <strong>un</strong> <em>insert</em> aislado, de esa forma en cada commit solo estaremos salvando las diferencias respecto al último estado (tanto <em>deletes</em> como <em>inserts</em>, como <em>updates</em>).</p>
<p>En el caso concreto de <a href="http://www.mysql.com/">MySQL</a> inicialmente haríamos algo como esto:</p>
<pre class="bash">$ <span style="color: #c20cb9; font-weight: bold;">mkdir</span> mydatabase &amp;&amp; <span style="color: #7a0874; font-weight: bold;">cd</span> mydatabase
$ mysqldump --skip-extended-insert &gt; data.sql
$ git init
$ git add data.sql
$ git commit -m <span style="color: #ff0000;">&quot;Initial dump of mydatabase&quot;</span></pre>
<p>A partir de entonces podemos automatizar el proceso con un script tan simple como este:</p>
<pre class="bash">$ <span style="color: #c20cb9; font-weight: bold;">cat</span> /usr/bin/git_backup_database
<span style="color: #808080; font-style: italic;">#!/bin/sh</span>
<span style="color: #007800;">BACKUP_DIRECTORY=</span>$<span style="color: #000000;">1</span>
<span style="color: #007800;">DATABASE=</span>$<span style="color: #000000;">2</span>
&nbsp;
<span style="color: #7a0874; font-weight: bold;">cd</span> <span style="color: #007800;">$BACKUP_DIRECTORY</span> &amp;&amp; \
mysqldump --skip-extended-insert <span style="color: #007800;">$DATABASE</span> &gt; data.sql &amp;&amp; \
git commit -am <span style="color: #ff0000;">&quot;Updating dump `date +%Y_%m_%d__%H_%M`&quot;</span></pre>
<p>Según el volumen de consultas que tenga tu base de datos, te será interesante ponerlo en <strong>cron</strong> con una frecuencia determina u otra. Adicionalmente sería recomendable ejecutar <em>$ git gc</em> para optimizar el repositorio. Por ejemplo, dos veces al día y una vez a la semana mantenimiento:</p>
<pre class="bash"><span style="color: #000000;">0</span> <span style="color: #000000;">0</span> * * * /usr/bin/git_backup_database /path/to/mydatabase mydatabase
<span style="color: #000000;">0</span> <span style="color: #000000;">12</span> * * * /usr/bin/git_backup_database  /path/to/mydatabase mydatabase
<span style="color: #000000;">0</span> <span style="color: #000000;">1</span> * * <span style="color: #000000;">1</span> <span style="color: #7a0874; font-weight: bold;">cd</span> /path/to/mydatabase &amp;&amp; git <span style="color: #c20cb9; font-weight: bold;">gc</span></pre>
<p>Además desde otro equipo nadie te impide hacer un <em>$ git clone ssh://equipo:path/to/mydatabase</em> y tener todo el historial de la base de datos en un plis (bueno eso es relativo, que ocupará lo suyo...) o incluso programar un <em>$ git pull</em> para tener varios backups en distintas maquinas. En definitiva, se abren un sinfín de opciones <img src='http://bicosyes.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> .</p>
<img src="http://bicosyes.com/?ak_action=api_record_view&id=858&type=feed" alt="" /><img src="http://feeds.feedburner.com/~r/Bicosyes-SinceEvermore/~4/e9twz60edvk" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://bicosyes.com/backup-incremental-de-tu-base-de-datos-con-git/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		<feedburner:origLink>http://bicosyes.com/backup-incremental-de-tu-base-de-datos-con-git/</feedburner:origLink></item>
		<item>
		<title>C++, cadenas multilínea de forma clara</title>
		<link>http://feedproxy.google.com/~r/Bicosyes-SinceEvermore/~3/NJ_M5EpDYT4/</link>
		<comments>http://bicosyes.com/c-cadenas-multilinea-de-forma-clara/#comments</comments>
		<pubDate>Sat, 13 Jun 2009 14:05:05 +0000</pubDate>
		<dc:creator>blaxter</dc:creator>
				<category><![CDATA[C++]]></category>
		<category><![CDATA[C]]></category>
		<category><![CDATA[multiline]]></category>
		<category><![CDATA[string]]></category>
		<category><![CDATA[tips]]></category>

		<guid isPermaLink="false">http://bicosyes.com/?p=846</guid>
		<description><![CDATA[Según el estándar c++98 (sección 2.13.4) las cadenas literales tienen como propiedad que durante el análisis léxico del código fuente (la primera fase que realiza el compilador, convirtiendo texto de entrada a tokens y símbolos) se concatenarán cadenas adyacentes.
In translation phase 6 (2.1), adjacent narrow string literals are concatenated and adjacent wide string literals are [...]]]></description>
			<content:encoded><![CDATA[<p>Según el <a href="http://en.wikipedia.org/wiki/ISO/IEC_14882#Language_standard">estándar c++98</a> (sección 2.13.4) las cadenas literales tienen como propiedad que durante el análisis léxico del código fuente (la primera fase que realiza el compilador, convirtiendo texto de entrada a tokens y símbolos) se concatenarán cadenas adyacentes.</p>
<blockquote><p>In translation phase 6 (2.1), adjacent narrow string literals are concatenated and adjacent wide string literals are concatenated. </p></blockquote>
<p>Esto viene a decir que podemos partir nuestras cadenas en cualquier momento sin poner ningún signo de concatenación entre ellas, de esta forma:</p>
<pre class="cpp">&nbsp;
<span style="color: #0000ff;">const</span> <span style="color: #0000ff;">char</span> s1* = <span style="color: #666666;">&quot;dum&quot;</span> <span style="color: #666666;">&quot;de&quot;</span> <span style="color: #666666;">&quot;dum&quot;</span>;
<span style="color: #0000ff;">const</span> <span style="color: #0000ff;">char</span> s2* = <span style="color: #666666;">&quot;dum&quot;</span>
                 <span style="color: #666666;">&quot;de&quot;</span>
                 <span style="color: #666666;">&quot;dum&quot;</span>
;</pre>
<p>Lo cual viene realmente bien para formar código bien indentado y formateado, pues aunque también podemos usar "\" para saltar de línea, el texto a continuación no puede estar indentado pues significaría incluir esos espacios/tabuladores en la cadena que estamos definiendo. Y lo realmente interesante es que todo esto está en la propia definición del lenguaje, no es ninguna ayuda concreta del compilador, a los ojos del programa todas las siguientes definiciones son idénticas:</p>
<pre class="cpp">&nbsp;
<span style="color: #339900;">#include &lt;string&gt;</span>
<span style="color: #339900;">#include &lt;iostream&gt;</span>
&nbsp;
<span style="color: #0000ff;">const</span> <span style="color: #0000ff;">char</span> * cmp<span style="color: #000000;">&#40;</span> <span style="color: #0000ff;">const</span> <span style="color: #0000ff;">char</span> *s1, <span style="color: #0000ff;">const</span> <span style="color: #0000ff;">char</span> *s2 <span style="color: #000000;">&#41;</span>;
&nbsp;
<span style="color: #0000ff;">int</span> main<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>
<span style="color: #000000;">&#123;</span>
&nbsp;
    <span style="color: #0000ff;">const</span> <span style="color: #0000ff;">char</span> * s1 = <span style="color: #666666;">&quot;My spoon is too big&quot;</span>
                      <span style="color: #666666;">&quot;My spoon is TOO BIG&quot;</span>
                      <span style="color: #666666;">&quot;I AM A BANANA&quot;</span>;
    <span style="color: #0000ff;">const</span> <span style="color: #0000ff;">char</span> * s2 = <span style="color: #666666;">&quot;My spoon is too big<span style="color: #666666; font-weight: bold;">\</span>
My spoon is TOO BIG<span style="color: #666666; font-weight: bold;">\</span>
I AM A BANANA&quot;</span>;
    <span style="color: #0000ff;">const</span> <span style="color: #0000ff;">char</span> * s3 = <span style="color: #000000;">&#40;</span> std::<span style="color: #00eeff;">string</span><span style="color: #000000;">&#40;</span><span style="color: #666666;">&quot;My spoon is too big&quot;</span><span style="color: #000000;">&#41;</span> +
                        std::<span style="color: #00eeff;">string</span><span style="color: #000000;">&#40;</span><span style="color: #666666;">&quot;My spoon is TOO BIG&quot;</span><span style="color: #000000;">&#41;</span> +
                        std::<span style="color: #00eeff;">string</span><span style="color: #000000;">&#40;</span><span style="color: #666666;">&quot;I AM A BANANA&quot;</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#41;</span>.<span style="color: #00eeff;">c_str</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;
&nbsp;
    std::<span style="color: #0000dd;">cout</span> &lt;&lt; <span style="color: #666666;">&quot;s1 and s2 are &quot;</span> &lt;&lt; cmp<span style="color: #000000;">&#40;</span> s1, s2 <span style="color: #000000;">&#41;</span> &lt;&lt; std::<span style="color: #00eeff;">endl</span>;
    std::<span style="color: #0000dd;">cout</span> &lt;&lt; <span style="color: #666666;">&quot;s1 and s3 are &quot;</span> &lt;&lt; cmp<span style="color: #000000;">&#40;</span> s1, s3 <span style="color: #000000;">&#41;</span> &lt;&lt; std::<span style="color: #00eeff;">endl</span>;
    std::<span style="color: #0000dd;">cout</span> &lt;&lt; <span style="color: #666666;">&quot;s2 and s3 are &quot;</span> &lt;&lt; cmp<span style="color: #000000;">&#40;</span> s2, s3 <span style="color: #000000;">&#41;</span> &lt;&lt; std::<span style="color: #00eeff;">endl</span>;
&nbsp;
    <span style="color: #0000ff;">return</span> <span style="color: #0000dd;">0</span>;
<span style="color: #000000;">&#125;</span>
&nbsp;
<span style="color: #0000ff;">const</span> <span style="color: #0000ff;">char</span> * cmp<span style="color: #000000;">&#40;</span> <span style="color: #0000ff;">const</span> <span style="color: #0000ff;">char</span> *s1, <span style="color: #0000ff;">const</span> <span style="color: #0000ff;">char</span> *s2 <span style="color: #000000;">&#41;</span>;
<span style="color: #000000;">&#123;</span>
    <span style="color: #0000ff;">while</span><span style="color: #000000;">&#40;</span> *s1 &amp;&amp; *s2 &amp;&amp; *s1++ == *s2++ <span style="color: #000000;">&#41;</span>;
    <span style="color: #0000ff;">if</span> <span style="color: #000000;">&#40;</span> <span style="color: #000000;">&#40;</span> *s1 != *s2 <span style="color: #000000;">&#41;</span> || <span style="color: #000000;">&#40;</span> *s1 || *s2 <span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#41;</span>
        <span style="color: #0000ff;">return</span> <span style="color: #666666;">&quot;different&quot;</span>;
    <span style="color: #0000ff;">return</span> <span style="color: #666666;">&quot;equal&quot;</span>;
<span style="color: #000000;">&#125;</span></pre>
<pre class="bash">$ <span style="color: #c20cb9; font-weight: bold;">c++</span> const_char_declaration_sample.<span style="color: #c20cb9; font-weight: bold;">cpp</span> &amp;&amp; ./a.out
s1 and s2 are equal
s1 and s3 are equal
s2 and s3 are equal</pre>
<img src="http://bicosyes.com/?ak_action=api_record_view&id=846&type=feed" alt="" /><img src="http://feeds.feedburner.com/~r/Bicosyes-SinceEvermore/~4/NJ_M5EpDYT4" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://bicosyes.com/c-cadenas-multilinea-de-forma-clara/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		<feedburner:origLink>http://bicosyes.com/c-cadenas-multilinea-de-forma-clara/</feedburner:origLink></item>
		<item>
		<title>Visualización de la documentación de todas las gemas instaladas</title>
		<link>http://feedproxy.google.com/~r/Bicosyes-SinceEvermore/~3/QiLKUu1jCY0/</link>
		<comments>http://bicosyes.com/visualizacion-de-la-documentacion-de-todas-las-gemas-instaladas/#comments</comments>
		<pubDate>Sun, 31 May 2009 12:55:10 +0000</pubDate>
		<dc:creator>blaxter</dc:creator>
				<category><![CDATA[Ruby]]></category>
		<category><![CDATA[bdoc]]></category>
		<category><![CDATA[gems]]></category>
		<category><![CDATA[rdoc]]></category>

		<guid isPermaLink="false">http://bicosyes.com/?p=835</guid>
		<description><![CDATA[La documentación de las gemas de ruby se genera a partir del código fuente mediante rdoc. Después de eso puedes optar por ver individualmente cada una o usar gem server.
Para poder mejorar todo esto podemos usar par de útiles herramientas: (1) la plantilla para rdoc, hanna; y (2)bdoc como alternativa a gem server para visualizar [...]]]></description>
			<content:encoded><![CDATA[<p>La documentación de las gemas de ruby se genera a partir del código fuente mediante rdoc. Después de eso puedes optar por ver individualmente cada una o usar <a href="http://rubygems.org/read/chapter/18">gem server</a>.</p>
<p>Para poder mejorar todo esto podemos usar par de útiles herramientas: (1) la plantilla para rdoc, <strong><a href="http://github.com/mislav/hanna/tree/master">hanna</a></strong>; y (2)<a href="http://manalang.com/archives/2009/03/29/introducing-bdoc-a-better-gem-doc-browser/"><strong>bdoc</strong></a> como alternativa a gem server para visualizar la documentación.</p>
<p><strong>Hanna</strong> es una plantilla para rdoc que mejora notablemente el formato por defecto. Podemos ver la diferencia fácilmente, por ejemplo, en la documentación de rspec con <a href="http://rspec.rubyforge.org/rspec/1.1.11/">el formato típico</a> <em>vs</em> <a href="http://rspec.rubyforge.org/rspec/1.2.6/">la documentación hecha con hanna</a>. La instalación es simple:</p>
<pre class="bash">$ <span style="color: #c20cb9; font-weight: bold;">sudo</span> gem sources -a http://gems.github.com
$ <span style="color: #c20cb9; font-weight: bold;">sudo</span> gem <span style="color: #c20cb9; font-weight: bold;">install</span> mislav-hanna</pre>
<p>Para que a partir de ahora se generar la documentación con esta plantilla, puede añadir a tu <em>.gemrc</em> la siguiente línea:</p>
<pre>rdoc: --inline-source --line-numbers --template=hanna</pre>
<p>Y para convertir la documentación de todas tus gemas instaladas, puedes hacer algo como esto:</p>
<pre class="bash">$ <span style="color: #c20cb9; font-weight: bold;">sudo</span> gem list | <span style="color: #c20cb9; font-weight: bold;">awk</span> <span style="color: #ff0000;">'{print $1}'</span> | <span style="color: #c20cb9; font-weight: bold;">xargs</span> <span style="color: #c20cb9; font-weight: bold;">sudo</span> hanna --gems</pre>
<p>Por otro lado, gracias a <strong>bdoc</strong> podremos navegar fácilmente entre todas las documentaciones.</p>
<pre class="bash">$ <span style="color: #c20cb9; font-weight: bold;">sudo</span> gem <span style="color: #c20cb9; font-weight: bold;">install</span> manalang-bdoc
$ bdoc</pre>
<p><a href="http://bicosyes.com/wp-content/uploads/2009/05/bdoc.jpg"><img src="http://bicosyes.com/wp-content/uploads/2009/05/bdoc-300x157.jpg" alt="bdoc" title="bdoc" width="300" height="157" class="aligncenter size-medium wp-image-836" /></a><br />
Ejecutando <em>bdoc</em> se nos abrirá en nuestro navegador por defecto listo para poder leer la documentación y poder movernos fácilmente entre las diferentes gemas (y versiones). Muy útil.</p>
<img src="http://bicosyes.com/?ak_action=api_record_view&id=835&type=feed" alt="" /><img src="http://feeds.feedburner.com/~r/Bicosyes-SinceEvermore/~4/QiLKUu1jCY0" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://bicosyes.com/visualizacion-de-la-documentacion-de-todas-las-gemas-instaladas/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://bicosyes.com/visualizacion-de-la-documentacion-de-todas-las-gemas-instaladas/</feedburner:origLink></item>
		<item>
		<title>Librería de logging para C++, boost::logging</title>
		<link>http://feedproxy.google.com/~r/Bicosyes-SinceEvermore/~3/yHu7F6LEX4w/</link>
		<comments>http://bicosyes.com/libreria-de-logging-para-c-boostlogging/#comments</comments>
		<pubDate>Sun, 17 May 2009 19:58:31 +0000</pubDate>
		<dc:creator>blaxter</dc:creator>
				<category><![CDATA[C++]]></category>
		<category><![CDATA[boost]]></category>
		<category><![CDATA[boost::logging]]></category>
		<category><![CDATA[C]]></category>
		<category><![CDATA[logging]]></category>

		<guid isPermaLink="false">http://bicosyes.com/?p=789</guid>
		<description><![CDATA[En C++  tienes diversas librerías de logging, la mayoría son clones de log4j realmente, u otras con un estilo diferente bastante interesante; pero como suele ser costumbre en el mundo C++, tienes una alternativa relacionada con las librerías boost (en realidad boost::logging no es de boost oficialmente, pero es más que probable que en [...]]]></description>
			<content:encoded><![CDATA[<p>En C++  tienes diversas librerías de <em>logging</em>, la mayoría son <a href="http://logging.apache.org/log4cxx/index.html">clones</a> <a href="http://log4c.sourceforge.net/">de</a> <a href="http://logging.apache.org/log4j/">log4j</a> <a href="http://log4cpp.sourceforge.net/">realmente</a>, u otras con un <a href="http://www.pantheios.org/">estilo</a> diferente <a href="http://www.arg0.net/rlog">bastante interesante</a>; pero como suele ser costumbre en el mundo C++, tienes una alternativa relacionada con las <a href="http://www.boost.org/">librerías <strong>boost</strong></a> (en realidad <em>boost::logging</em> no es de boost oficialmente, pero es <a href="http://archives.free.net.ph/message/20080218.000757.d0fe0ce5.en.html">más que probable</a> que en el futuro lo sea) que suele ser la ganadora por méritos propios.</p>
<p>Estoy hablando de <a href="http://torjo.com/log2/index.html">la implementación de John Torjo</a>. Muy flexible a la hora de configurarla unido a un uso trivial de la misma (como tiene que ser, tampoco es que, la labor de logging, sea algo muy complejo que digamos...). Para conocer todos los detalles puedes leerte la extensa y útil <a href="http://torjo.com/log2/doc/html/index.html">documentación</a>, aunque de primeras puede ser un tanto compleja debido a nuevos conceptos que se usan a diestro y siniestro.</p>
<p>Principalmente debemos de conocer dos cosas:</p>
<ul>
<li>Qué tipo de <strong>filtro</strong> queremos: el cual será el encargado decidir si un mensaje se escribe o no, dependiendo tanto de si el logging está activado, como si cumplimos la restricción de nivel (debug, warn, error, etc...)</li>
<li>Qué tipo de <strong>log</strong> queremos: ¿cómo debe de ser el formato de salida?, ¿cuál es la salida/s? ¿cómo será su comportamiento?.</li>
</ul>
<p>Una vez definido esto, podemos escribirnos un par de ficheros en los cuales definiremos el log que podrá ser usado desde cualquier parte de la aplicación, incluyendo el header, y siempre y cuando se haya inicializado previamente. </p>
<pre class="cpp">&nbsp;
<span style="color: #339900;">#ifndef __LOGGING_HPP__</span>
<span style="color: #339900;">#define __LOGGING_HPP__</span>
&nbsp;
<span style="color: #339900;">#include &lt;boost/logging/format_fwd.hpp&gt;</span>
&nbsp;
<span style="color: #0000ff;">using</span> <span style="color: #0000ff;">namespace</span> boost::<span style="color: #00eeff;">logging</span>;
<span style="color: #0000ff;">using</span> <span style="color: #0000ff;">namespace</span> boost::<span style="color: #00eeff;">logging</span>::<span style="color: #00eeff;">scenario</span>::<span style="color: #00eeff;">usage</span>;
&nbsp;
<span style="color: #0000ff;">typedef</span> use&lt;
    filter_::<span style="color: #00eeff;">change</span>::<span style="color: #00eeff;">single_thread</span>, <span style="color: #ff0000;">// how often does the filter change?</span>
    filter_::<span style="color: #00eeff;">level</span>::<span style="color: #00eeff;">no_levels</span>,      <span style="color: #ff0000;">// does the filter use levels?</span>
    logger_::<span style="color: #00eeff;">change</span>::<span style="color: #00eeff;">single_thread</span>, <span style="color: #ff0000;">// how often does the logger change?</span>
    logger_::<span style="color: #00eeff;">favor</span>::<span style="color: #00eeff;">correctness</span>     <span style="color: #ff0000;">// what does the logger favor?</span>
  &gt; finder;
&nbsp;
BOOST_DECLARE_LOG_FILTER<span style="color: #000000;">&#40;</span> g_log_filter, finder::<span style="color: #00eeff;">filter</span> <span style="color: #000000;">&#41;</span>
BOOST_DECLARE_LOG<span style="color: #000000;">&#40;</span> g_log, finder::<span style="color: #00eeff;">logger</span> <span style="color: #000000;">&#41;</span>
&nbsp;
<span style="color: #339900;">#define L_ BOOST_LOG_USE_LOG_IF_FILTER( g_log(), g_log_filter()-&gt;is_enabled() )</span>
&nbsp;
<span style="color: #0000ff;">void</span> initialize_logs<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;
&nbsp;
<span style="color: #339900;">#endif // __LOGGING_HPP__</span></pre>
<p>Aquí acabamos de declarar un log, sin niveles, para una aplicación simple sin usar un thread separado para el logging. Para ver otras alternativas puedes echarle un ojo a los namespaces <a href="http://torjo.com/log2/doc/html/namespaceboost_1_1logging_1_1scenario_1_1usage_1_1filter__.html">boost::logging::scenario::usage::filter_</a> y <a href="http://torjo.com/log2/doc/html/namespaceboost_1_1logging_1_1scenario_1_1usage_1_1logger__.html">boost::logging::scenario::usage::logger_</a>. </p>
<p>Finalmente solo nos quedaría inicializar el log (o logs, recuerda que nada te impide tener tantos como quieras):</p>
<pre class="cpp">&nbsp;
<span style="color: #339900;">#include &quot;logging.hpp&quot;</span>
<span style="color: #339900;">#include &lt;boost/logging/format_ts.hpp&gt;</span>
<span style="color: #339900;">#include &lt;boost/thread/xtime.hpp&gt;</span>
&nbsp;
BOOST_DEFINE_LOG_FILTER<span style="color: #000000;">&#40;</span> g_log_filter, finder::<span style="color: #00eeff;">filter</span> <span style="color: #000000;">&#41;</span>
&nbsp;
BOOST_DEFINE_LOG<span style="color: #000000;">&#40;</span> g_log, finder::<span style="color: #00eeff;">logger</span> <span style="color: #000000;">&#41;</span>
&nbsp;
<span style="color: #0000ff;">void</span> initialize_logs<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>
<span style="color: #000000;">&#123;</span>
  g_log<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>-&gt;writer<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>.<span style="color: #00eeff;">add_formatter</span><span style="color: #000000;">&#40;</span> formatter::<span style="color: #00eeff;">idx</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>, <span style="color: #666666;">&quot;[%] &quot;</span>  <span style="color: #000000;">&#41;</span>;
  g_log<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>-&gt;writer<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>.<span style="color: #00eeff;">add_formatter</span><span style="color: #000000;">&#40;</span> formatter::<span style="color: #0000dd;">time</span><span style="color: #000000;">&#40;</span><span style="color: #666666;">&quot;$hh:$mm.$ss &quot;</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#41;</span>;
  g_log<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>-&gt;writer<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>.<span style="color: #00eeff;">add_formatter</span><span style="color: #000000;">&#40;</span> formatter::<span style="color: #00eeff;">append_newline</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#41;</span>;
&nbsp;
  <span style="color: #0000ff;">typedef</span> detail::<span style="color: #00eeff;">flag</span>&lt;destination::<span style="color: #00eeff;">file_settings</span>&gt; flag;
  destination::<span style="color: #00eeff;">file_settings</span> file_settings;
  file_settings.<span style="color: #00eeff;">initial_overwrite</span> = flag::<span style="color: #00eeff;">t</span>&lt;bool&gt;<span style="color: #000000;">&#40;</span> &amp;file_settings, <span style="color: #0000ff;">true</span> <span style="color: #000000;">&#41;</span>;
  g_log<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>-&gt;writer<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>.<span style="color: #00eeff;">add_destination</span><span style="color: #000000;">&#40;</span>
      destination::<span style="color: #0000ff;">file</span><span style="color: #000000;">&#40;</span> <span style="color: #666666;">&quot;app_debug.txt&quot;</span>, file_settings <span style="color: #000000;">&#41;</span>
    <span style="color: #000000;">&#41;</span>;
  g_log<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>-&gt;writer<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>.<span style="color: #00eeff;">add_destination</span><span style="color: #000000;">&#40;</span>
      destination::<span style="color: #0000dd;">cerr</span>
    <span style="color: #000000;">&#41;</span>;
&nbsp;
  g_log<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>-&gt;turn_cache_off<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>; <span style="color: #ff0000;">// for showing output immediately</span>
  g_log<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>-&gt;mark_as_initialized<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;
<span style="color: #000000;">&#125;</span></pre>
<p>Aquí tenemos que hacer la definición del <em>log</em> y del <em>filter</em> de la misma forma que hemos hecho su declaración anteriormente. Definimos <a href="http://torjo.com/log2/doc/html/namespaceboost_1_1logging_1_1formatter.html">el formato de salida</a> como más nos guste y finalmente solo nos queda indicar dónde se deben de escribir los mensajes. Se puede tener varios destinos, aunque básicamente podemos usar desde ficheros hasta cualquier <em><a href="http://www.cplusplus.com/reference/iostream/">stream</a></em>, pasando por las salidas estándar (fíjate en los typedef de <a href="http://torjo.com/log2/doc/html/namespaceboost_1_1logging_1_1destination.html">boost::logging:destination</a>).</p>
<p>Una cosa importante que merece la pena mencionar es la llamada al método <em>turn_cache_off()</em>, especialmente importante si usas una salida a consola, pues por defecto el logging se cachea y solo se escribe al destino cada cierto tiempo, por lo que si monitorizas el log en tiempo real es crucial desactivar esta caché.</p>
<p>De esta forma, ya tendremos en cualquier parte de nuestro código donde incluyamos la declaración una macro <em>L_</em> (o como la hayamos definido) lista para ser usada:</p>
<pre class="cpp">&nbsp;
L_ &lt;&lt; <span style="color: #666666;">&quot;Here we are&quot;</span>;
&nbsp;
<span style="color: #0000ff;">unsigned</span> <span style="color: #0000ff;">int</span> n = <span style="color: #0000dd;">42</span>;
L_ &lt;&lt; <span style="color: #666666;">&quot;The meaning of life is &quot;</span> &lt;&lt; n;
&nbsp;
L_ &lt;&lt; boost::<span style="color: #00eeff;">format</span><span style="color: #000000;">&#40;</span> <span style="color: #666666;">&quot;We can even use the awesome %s library versión %d.%d.%d&quot;</span> <span style="color: #000000;">&#41;</span>
    % <span style="color: #666666;">&quot;boost::format&quot;</span>
    % <span style="color: #000000;">&#40;</span> BOOST_VERSION / <span style="color: #0000dd;">100000</span> <span style="color: #000000;">&#41;</span>
    % <span style="color: #000000;">&#40;</span> <span style="color: #000000;">&#40;</span> BOOST_VERSION / <span style="color: #0000dd;">100</span> <span style="color: #000000;">&#41;</span> % <span style="color: #0000dd;">1000</span> <span style="color: #000000;">&#41;</span>
    % <span style="color: #000000;">&#40;</span> BOOST_VERSION % <span style="color: #0000dd;">100</span> <span style="color: #000000;">&#41;</span>;</pre>
<img src="http://bicosyes.com/?ak_action=api_record_view&id=789&type=feed" alt="" /><img src="http://feeds.feedburner.com/~r/Bicosyes-SinceEvermore/~4/yHu7F6LEX4w" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://bicosyes.com/libreria-de-logging-para-c-boostlogging/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://bicosyes.com/libreria-de-logging-para-c-boostlogging/</feedburner:origLink></item>
		<item>
		<title>Cómo ver por Internet la F1 de forma precisa (y sin anuncios)</title>
		<link>http://feedproxy.google.com/~r/Bicosyes-SinceEvermore/~3/oxMFOfmXtGk/</link>
		<comments>http://bicosyes.com/como-ver-por-internet-la-f1-de-forma-precisa-y-sin-anuncios/#comments</comments>
		<pubDate>Sun, 10 May 2009 15:03:43 +0000</pubDate>
		<dc:creator>blaxter</dc:creator>
				<category><![CDATA[F1]]></category>
		<category><![CDATA[live timing]]></category>
		<category><![CDATA[online]]></category>
		<category><![CDATA[tv3]]></category>

		<guid isPermaLink="false">http://bicosyes.com/?p=814</guid>
		<description><![CDATA[Las retransmisiones de LaSexta de la Formula 1 dejan bastante que desear, sobretodo cuando se refiere a las carreras de los domingos. Algunos aspectos negativos son estos:

Calidad de imagen pésima. En 4:3 en vez de 16:9
Mucha, mucha, muchísima publicidad. Durante la carrera, así a ojo, diría que te tragas alrededor de 30minutos de publicidad perfectamente.
Comentarios [...]]]></description>
			<content:encoded><![CDATA[<p>Las retransmisiones de <a href="http://www.lasextadeportes.com/formula1/inicio">LaSexta de la Formula 1</a> dejan <a href="http://www.vayatele.com/la-sexta/la-formula-1-se-estrena-en-la-sexta">bastante que desear</a>, sobretodo cuando se refiere a las carreras de los domingos. Algunos aspectos negativos son estos:</p>
<ul>
<li>Calidad de imagen pésima. En <a href="http://vimeo.com/3894698?pg=embed&sec=">4:3 en vez de 16:9</a></li>
<li>Mucha, mucha, muchísima publicidad. Durante la carrera, así a ojo, diría que te tragas alrededor de 30minutos de publicidad perfectamente.</li>
<li>Comentarios penosos, subjetivos y sin calidad (excepto Pedro De La Rosa obviamente) por parte de Antonio Lobato y Víctor Seara (difícil decidirse cual de ellos es más ignorante).
<ul>
<li>No paran de confundirse y decir estupideces cuando se refiere al futuro de la carrera, solo entrando en razón cuando De La Rosa pone las cosas claras.</li>
<li>No retransmiten la carrera, comentan las acciones que pasan en función a cómo pueden llegar a afectar a un único piloto, a pesar de existir, por lo normal, 19 más.</li>
<li>Se centran en acontecimientos irrelevantes, y la mayor parte de las veces, mal; olvidándose del transcurso real de la carrera.</li>
</ul>
</li>
<p>La solución es bastante simple, sobretodo si tienes alguna forma cómoda de ver tu ordenador en una pantalla de televisión. Por una parte necesitamos (1) una forma precisa de poder conocer el <strong>transcurso</strong> de la carrera, y por otra necesitamos (2) una <strong>imagen</strong> y, no está de más, algunos <strong>comentaristas</strong> que sean competentes en su trabajo. Para solucionar el primer punto tenemos el fantástico <a href="http://www.formula1.com/services/live_timing/"><strong>live timing de formula1.com</strong></a>, en el cual podemos ver los tiempos en tiempo real de todos los pilotos, sector a sector. Y para el segundo punto, tenemos la retransmisión online de la <a href="http://elsesports.cat/">cadena catalana <strong>tv3</strong></a>. El resultado será algo como esto:</p>
<div id="attachment_815" class="wp-caption aligncenter" style="width: 310px"><a href="http://bicosyes.com/wp-content/uploads/2009/05/f1_tv3.jpg"><img src="http://bicosyes.com/wp-content/uploads/2009/05/f1_tv3-300x149.jpg" alt="Formula 1 online: Tv3 y Live timing de f1.com" title="Ver Formula 1 online" width="300" class="size-medium wp-image-815" /></a><p class="wp-caption-text">Formula 1 online: Tv3 y Live timing</p></div>
<p>Las únicas "<em>desventajas</em>" de este método son:</p>
<ul>
<li>Comentarios en catalán: pero realmente es muy fácil de seguir (si sabes español claro), y eso que yo soy un negado para los idiomas</li>
<li>Resolución inferior al TDT: la resolución online no es nada espectacular, pero dado que no lo vamos a ver a pantalla completa, es más que suficiente para poder leer las letras y verlo de forma correcta.</li>
<li>Retraso de 20seg.: la TDT en verdad tiene también un retraso respecto a la realidad, de unos 3-5 segundos (lo puedes comprobar con el live timing) en este caso, estos 20segundos no es un problema tan grande puesto que de esta forma te da tiempo a analizar la evolución de los tiempos y luego ver su "resultado" en la imagen. Se podría decir que la imagen va a ir "1 sector" atrasada, lo cual viene hasta bien.</li>
</ul>
<p>Personalmente ganan las ventajas respecto a las desventajas, por lo que después de haber probado este método, para seguir este último <a href="http://www.thef1.com/noticias/noticias-2009/mayo-2009/button-sigue-con-la-apisonadora-y-gana-en-barcelona">Gran Premio de España</a>, creo que repetiré para los próximos 12 de esta temporada.</p>
<img src="http://bicosyes.com/?ak_action=api_record_view&id=814&type=feed" alt="" /><img src="http://feeds.feedburner.com/~r/Bicosyes-SinceEvermore/~4/oxMFOfmXtGk" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://bicosyes.com/como-ver-por-internet-la-f1-de-forma-precisa-y-sin-anuncios/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		<feedburner:origLink>http://bicosyes.com/como-ver-por-internet-la-f1-de-forma-precisa-y-sin-anuncios/</feedburner:origLink></item>
	</channel>
</rss>
