<?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>Bicosyes - since evermore... &#187; english</title>
	<atom:link href="http://bicosyes.com/tag/english/feed/" rel="self" type="application/rss+xml" />
	<link>http://bicosyes.com</link>
	<description></description>
	<lastBuildDate>Sat, 06 Mar 2010 20:03:06 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Code Monkey like Fritos</title>
		<link>http://bicosyes.com/code-monkey-like-fritos/</link>
		<comments>http://bicosyes.com/code-monkey-like-fritos/#comments</comments>
		<pubDate>Sat, 06 Mar 2010 20:01:55 +0000</pubDate>
		<dc:creator>blaxter</dc:creator>
				<category><![CDATA[LOL]]></category>
		<category><![CDATA[Programación]]></category>
		<category><![CDATA[acustic]]></category>
		<category><![CDATA[code monkey]]></category>
		<category><![CDATA[english]]></category>
		<category><![CDATA[song]]></category>
		<category><![CDATA[video]]></category>

		<guid isPermaLink="false">http://bicosyes.com/?p=922</guid>
		<description><![CDATA[Until now I've never heard about this song, about a code monkey, funny and nice at the same time. The same songwriter, Jonathan Coulton, has a lot more of similar (geek) songs. Awesome. Code Monkey get up get coffee Code &#8230; <a href="http://bicosyes.com/code-monkey-like-fritos/">Sigue leyendo <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Until now I've never heard about this song, about a code monkey, funny and nice at the same time. The same songwriter, <a href="http://en.wikipedia.org/wiki/Jonathan_Coulton">Jonathan Coulton</a>, has a lot more of similar (geek) songs. Awesome.</p>
<div class="center"><object width="480" height="385"><param name="movie" value="http://www.youtube.com/v/7s8S7QxpjeY&hl=es_ES&fs=1&rel=0"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/7s8S7QxpjeY&hl=es_ES&fs=1&rel=0" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="480" height="385"></embed></object></div>
<blockquote><p>
Code Monkey get up get coffee<br />
Code Monkey go to job<br />
Code Monkey have boring meeting with boring manager Rob<br />
Rob say Code Monkey very diligent<br />
but his output stink<br />
his code not functional or elegant<br />
what do Code Monkey think<br />
Code Monkey think maybe manager want to write goddamn login page himself<br />
Code Monkey not say it out loud<br />
Code Monkey not crazy just proud</p>
<p>Code Monkey like Fritos<br />
Code Monkey like Tab and Mountain Dew<br />
Code Monkey very simple man<br />
with big warm fuzzy secret heart<br />
Code Monkey like you<br />
Code Monkey like you</p>
<p>Code Monkey hang around at front desk<br />
tell you sweater look nice<br />
Code Monkey offer buy you soda<br />
bring you cup bring you ice<br />
you say no thank you for the soda cause<br />
soda make you fat<br />
anyway you busy with the telephone<br />
no time for chat</p>
<p>Code Monkey have long walk back to cubicle<br />
he sit down pretend to work<br />
Code Monkey not thinking so straight<br />
Code Monkey not feeling so great</p>
<p>Code Monkey like Fritos<br />
Code Monkey like Tab and Mountain Dew<br />
Code Monkey very simple man<br />
with big warm fuzzy secret heart<br />
Code Monkey like you<br />
Code Monkey like you a lot</p>
<p>Code Monkey have every reason<br />
to get out this place<br />
Code Monkey just keep on working<br />
to see your soft pretty face<br />
Much rather wake up eat a coffee cake<br />
Take bath, take nap<br />
This job fulfilling in creative way<br />
such a load of crap<br />
Code Monkey think someday he have everything even pretty girl like you<br />
Code Monkey just waiting for now<br />
Code Monkey say someday, somehow</p>
<p>Code Monkey like Fritos<br />
Code Monkey like Tab and Mountain Dew<br />
Code Monkey very simple man<br />
with big warm fuzzy secret heart<br />
Code Monkey like you<br />
Code Monkey like you</p></blockquote>
<img src="http://bicosyes.com/?ak_action=api_record_view&id=922&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://bicosyes.com/code-monkey-like-fritos/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>boost::asio, synchronous read with timeout</title>
		<link>http://bicosyes.com/boostasio-synchronous-read-with-timeout/</link>
		<comments>http://bicosyes.com/boostasio-synchronous-read-with-timeout/#comments</comments>
		<pubDate>Sun, 20 Dec 2009 20:48:25 +0000</pubDate>
		<dc:creator>blaxter</dc:creator>
				<category><![CDATA[C++]]></category>
		<category><![CDATA[boost]]></category>
		<category><![CDATA[boost::asio]]></category>
		<category><![CDATA[C]]></category>
		<category><![CDATA[english]]></category>
		<category><![CDATA[snippet]]></category>

		<guid isPermaLink="false">http://bicosyes.com/?p=833</guid>
		<description><![CDATA[The boost::asio (which means asynchronous input/output) library, is quite powerful library for asynchronous i/o, but it could be a bit difficult at first to figure out how to do a normal synchronous read. So, as a reminder for my future-me, &#8230; <a href="http://bicosyes.com/boostasio-synchronous-read-with-timeout/">Sigue leyendo <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>The <strong><a href="http://www.boost.org/doc/libs/1_40_0/doc/html/boost_asio.html">boost::asio</a></strong> (which means asynchronous input/output) library, is quite powerful library for asynchronous i/o, but it could be a bit difficult at first to figure out how to do a normal <strong>synchronous</strong> read. So, as a reminder for my future-me, and for you, this snippet it'll be very useful to accomplish that. Probably there will be another ways for doing that, but this is how I managed to do it:</p>
<pre class="cpp"><span style="color: #0000ff;">using</span> <span style="color: #0000ff;">namespace</span> boost::<span style="color: #00eeff;">asio</span>;
<span style="color: #0000ff;">using</span> <span style="color: #0000ff;">namespace</span> boost::<span style="color: #0000dd;">system</span>;
<span style="color: #0000ff;">using</span> boost::<span style="color: #00eeff;">optional</span>;
&nbsp;
ip::<span style="color: #00eeff;">tcp</span>::<span style="color: #00eeff;">socket</span> _socket; <span style="color: #ff0000;">// it could be another kind of socket, not only ip::tcp</span>
&nbsp;
<span style="color: #ff0000; font-style: italic;">/**
 * Dumb function to be used as handler argument and save the error_code
 * into a pointer
 *
 * e.g.: boost::bind( &amp;set_result, some_pointer, _1 )
 */</span>
<span style="color: #0000ff;">void</span> set_result<span style="color: #000000;">&#40;</span> optional&lt;error_code&gt;* a, error_code b <span style="color: #000000;">&#41;</span>
<span style="color: #000000;">&#123;</span>
  a-&gt;reset<span style="color: #000000;">&#40;</span> b <span style="color: #000000;">&#41;</span>;
<span style="color: #000000;">&#125;</span>
&nbsp;
<span style="color: #339900;">#define TIMEOUT 60</span>
<span style="color: #ff0000; font-style: italic;">/**
 * it uses _socket
 * if timeout happends throw a system_error exception
 */</span>
template&lt;typename MutableBufferSequence&gt;
optional&lt;error_code&gt; read_with_timeout<span style="color: #000000;">&#40;</span>
    <span style="color: #0000ff;">const</span> MutableBufferSequence&amp; buffer
  <span style="color: #000000;">&#41;</span> throw<span style="color: #000000;">&#40;</span> system_error <span style="color: #000000;">&#41;</span>
<span style="color: #000000;">&#123;</span>
  optional&lt;error_code&gt; timer_result;
  optional&lt;error_code&gt; read_result;
&nbsp;
  deadline_timer timer<span style="color: #000000;">&#40;</span> _socket.<span style="color: #00eeff;">io_service</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#41;</span>;
&nbsp;
  timer.<span style="color: #00eeff;">expires_from_now</span><span style="color: #000000;">&#40;</span> seconds<span style="color: #000000;">&#40;</span>TIMEOUT<span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#41;</span>;
  timer.<span style="color: #00eeff;">async_wait</span><span style="color: #000000;">&#40;</span> boost::<span style="color: #00eeff;">bind</span><span style="color: #000000;">&#40;</span>&amp;set_result, &amp;timer_result, _1<span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#41;</span>;
&nbsp;
  boost::<span style="color: #00eeff;">asio</span>::<span style="color: #00eeff;">async_read</span><span style="color: #000000;">&#40;</span>
      _socket,
      buffer,
      boost::<span style="color: #00eeff;">asio</span>::<span style="color: #00eeff;">transfer_at_least</span><span style="color: #000000;">&#40;</span> buffer_size_helper<span style="color: #000000;">&#40;</span>buffer<span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#41;</span>,
      boost::<span style="color: #00eeff;">bind</span><span style="color: #000000;">&#40;</span> &amp;set_result, &amp;read_result, _1 <span style="color: #000000;">&#41;</span>
    <span style="color: #000000;">&#41;</span>;
&nbsp;
  _socket.<span style="color: #00eeff;">io_service</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>.<span style="color: #00eeff;">reset</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;
&nbsp;
  <span style="color: #0000ff;">while</span> <span style="color: #000000;">&#40;</span> _socket.<span style="color: #00eeff;">io_service</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>.<span style="color: #00eeff;">run_one</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#41;</span>
  <span style="color: #000000;">&#123;</span>
    <span style="color: #0000ff;">if</span> <span style="color: #000000;">&#40;</span> read_result <span style="color: #000000;">&#41;</span>
    <span style="color: #000000;">&#123;</span>
      timer.<span style="color: #00eeff;">cancel</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;
    <span style="color: #000000;">&#125;</span>
    <span style="color: #0000ff;">else</span> <span style="color: #0000ff;">if</span> <span style="color: #000000;">&#40;</span> timer_result <span style="color: #000000;">&#41;</span>
    <span style="color: #000000;">&#123;</span>
      _socket.<span style="color: #00eeff;">cancel</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;
      throw system_error<span style="color: #000000;">&#40;</span>
          error_code<span style="color: #000000;">&#40;</span> errc::<span style="color: #00eeff;">timed_out</span>, get_generic_category<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#41;</span>
        <span style="color: #000000;">&#41;</span>;
    <span style="color: #000000;">&#125;</span>
  <span style="color: #000000;">&#125;</span>
  <span style="color: #0000ff;">return</span> read_result;
<span style="color: #000000;">&#125;</span>
&nbsp;</pre>
<p>I hope it will be useful, have fun.</p>
<img src="http://bicosyes.com/?ak_action=api_record_view&id=833&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://bicosyes.com/boostasio-synchronous-read-with-timeout/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>How to know, in ruby, which methods have been added and by whom?</title>
		<link>http://bicosyes.com/how-to-know-in-ruby-which-methods-have-been-added-and-by-whom/</link>
		<comments>http://bicosyes.com/how-to-know-in-ruby-which-methods-have-been-added-and-by-whom/#comments</comments>
		<pubDate>Mon, 23 Nov 2009 19:50:37 +0000</pubDate>
		<dc:creator>blaxter</dc:creator>
				<category><![CDATA[Ruby]]></category>
		<category><![CDATA[debug]]></category>
		<category><![CDATA[english]]></category>
		<category><![CDATA[method_added]]></category>
		<category><![CDATA[monkeypatching]]></category>

		<guid isPermaLink="false">http://bicosyes.com/?p=885</guid>
		<description><![CDATA[If you are not very careful, monkeypatching could be very harmful. One thing to remember is that you should never override a method to add funcionality, for those kind of thinks you must use alias chain method pattern, a safer &#8230; <a href="http://bicosyes.com/how-to-know-in-ruby-which-methods-have-been-added-and-by-whom/">Sigue leyendo <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>If you are not very careful, monkeypatching could be very harmful. One thing to remember is that you should <strong>never</strong> override a method to <strong>add</strong> funcionality, for those kind of thinks you must use <em>alias chain method pattern</em>, a safer way of doing that. </p>
<p>For the rest of the <em>monkeypatching</em>, i.e. add new methods, you could debug them really easy with something like this:</p>
<pre class="ruby"><span style="color:#9966CC; font-weight:bold;">class</span> <span style="color:#9966CC; font-weight:bold;">Class</span>
   <span style="color:#9966CC; font-weight:bold;">def</span> method_added<span style="color:#006600; font-weight:bold;">&#40;</span>method_name<span style="color:#006600; font-weight:bold;">&#41;</span>
      <span style="color:#CC0066; font-weight:bold;">puts</span> <span style="color:#996600;">&quot;#{method_name} added to #{self}, callstack:&quot;</span>
      <span style="color:#CC0066; font-weight:bold;">puts</span> <span style="color:#CC0066; font-weight:bold;">caller</span>.<span style="color:#9900CC;">map</span><span style="color:#006600; font-weight:bold;">&#123;</span>|line| <span style="color:#996600;">&quot;<span style="color:#000099;">\t</span>#{line}&quot;</span> <span style="color:#006600; font-weight:bold;">&#125;</span>.<span style="color:#9900CC;">join</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">&quot;<span style="color:#000099;">\n</span>&quot;</span><span style="color:#006600; font-weight:bold;">&#41;</span>
   <span style="color:#9966CC; font-weight:bold;">end</span>
<span style="color:#9966CC; font-weight:bold;">end</span></pre>
<p>You can always add more code to filter by class or by method's name. Let's see an example:</p>
<pre class="ruby">$ more example.<span style="color:#9900CC;">rb</span>
<span style="color:#CC0066; font-weight:bold;">require</span> <span style="color:#996600;">'date'</span>
<span style="color:#CC0066; font-weight:bold;">require</span> <span style="color:#996600;">'time'</span>
&nbsp;
<span style="color:#9966CC; font-weight:bold;">class</span> <span style="color:#9966CC; font-weight:bold;">Class</span>
   <span style="color:#9966CC; font-weight:bold;">def</span> method_added<span style="color:#006600; font-weight:bold;">&#40;</span>method_name<span style="color:#006600; font-weight:bold;">&#41;</span>
      <span style="color:#0000FF; font-weight:bold;">return</span> <span style="color:#9966CC; font-weight:bold;">if</span> %w<span style="color:#006600; font-weight:bold;">&#40;</span>method_added<span style="color:#006600; font-weight:bold;">&#41;</span>.<span style="color:#9966CC; font-weight:bold;">include</span>? method_name.<span style="color:#9900CC;">to_s</span>
      <span style="color:#CC0066; font-weight:bold;">puts</span> <span style="color:#996600;">&quot;#{method_name} added to #{self}, callstack:&quot;</span>
      <span style="color:#CC0066; font-weight:bold;">puts</span> <span style="color:#CC0066; font-weight:bold;">caller</span>.<span style="color:#9900CC;">map</span><span style="color:#006600; font-weight:bold;">&#123;</span>|line| <span style="color:#996600;">&quot;<span style="color:#000099;">\t</span>#{line}&quot;</span> <span style="color:#006600; font-weight:bold;">&#125;</span>.<span style="color:#9900CC;">join</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">&quot;<span style="color:#000099;">\n</span>&quot;</span><span style="color:#006600; font-weight:bold;">&#41;</span>
   <span style="color:#9966CC; font-weight:bold;">end</span>
<span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
<span style="color:#9966CC; font-weight:bold;">class</span> <span style="color:#CC00FF; font-weight:bold;">Time</span>
   <span style="color:#9966CC; font-weight:bold;">def</span> to_date
      <span style="color:#CC00FF; font-weight:bold;">Date</span>.<span style="color:#9900CC;">ordinal</span> <span style="color:#0000FF; font-weight:bold;">self</span>.<span style="color:#9900CC;">year</span>, <span style="color:#0000FF; font-weight:bold;">self</span>.<span style="color:#9900CC;">yday</span>
   <span style="color:#9966CC; font-weight:bold;">end</span>
<span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
<span style="color:#9966CC; font-weight:bold;">class</span> <span style="color:#CC00FF; font-weight:bold;">Date</span>
   <span style="color:#9966CC; font-weight:bold;">def</span> to_time
      <span style="color:#CC00FF; font-weight:bold;">Time</span>.<span style="color:#9900CC;">parse</span> <span style="color:#0000FF; font-weight:bold;">self</span>.<span style="color:#9900CC;">to_s</span>
   <span style="color:#9966CC; font-weight:bold;">end</span>
<span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
<span style="color:#CC0066; font-weight:bold;">raise</span> <span style="color:#996600;">&quot;to_date not working&quot;</span> <span style="color:#9966CC; font-weight:bold;">unless</span>
   <span style="color:#CC00FF; font-weight:bold;">Time</span>.<span style="color:#9900CC;">now</span>.<span style="color:#9900CC;">to_date</span> == <span style="color:#CC00FF; font-weight:bold;">Date</span>.<span style="color:#9900CC;">today</span>
<span style="color:#CC0066; font-weight:bold;">raise</span> <span style="color:#996600;">&quot;to time not working&quot;</span> <span style="color:#9966CC; font-weight:bold;">unless</span>
   <span style="color:#CC00FF; font-weight:bold;">Time</span>.<span style="color:#9900CC;">now</span>.<span style="color:#9900CC;">to_date</span>.<span style="color:#9900CC;">to_time</span> == <span style="color:#CC00FF; font-weight:bold;">Date</span>.<span style="color:#9900CC;">today</span>.<span style="color:#9900CC;">to_time</span></pre>
<p>The output will be:</p>
<pre>$ ruby example.rb
to_date added to Time, callstack:
	example.rb:13
to_time added to Date, callstack:
	example.rb:19</pre>
<p>Nice, isn't it?. Remember to be carefull with your monkeypatching, with great power comes great responsibility, it's just a tool, neither magic nor the panacea.</p>
<img src="http://bicosyes.com/?ak_action=api_record_view&id=885&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://bicosyes.com/how-to-know-in-ruby-which-methods-have-been-added-and-by-whom/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

