<?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>Zen</title>
	<atom:link href="http://zefonseca.com/blogs/zen/feed/" rel="self" type="application/rss+xml" />
	<link>http://zefonseca.com/blogs/zen</link>
	<description></description>
	<lastBuildDate>Tue, 22 May 2012 00:24:02 +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>Yahoo! is Yahoo!&#8217;s own worst enemy</title>
		<link>http://zefonseca.com/blogs/zen/yuckhoo/</link>
		<comments>http://zefonseca.com/blogs/zen/yuckhoo/#comments</comments>
		<pubDate>Mon, 21 May 2012 18:45:12 +0000</pubDate>
		<dc:creator>Zen</dc:creator>
				<category><![CDATA[/etc]]></category>
		<category><![CDATA[The Web]]></category>

		<guid isPermaLink="false">http://zefonseca.com/blogs/zen/?p=608</guid>
		<description><![CDATA[It was March this year when I decided to check an old Yahoo! email account I had. To my surprise, as I log in, there&#8217;s a billing invoice for U$ 300 from Yahoo! Directory for a site that hasn&#8217;t existed for a while now. De: &#8220;dirsubmit326@yahoo-inc.com&#8221; Para: jmafonseca2008@yahoo.com.br Enviadas: Sexta-feira, 9 de Março de 2012 [...]]]></description>
			<content:encoded><![CDATA[<p>It was March this year when I decided to check an old Yahoo! email account I had. To my surprise, as I log in, there&#8217;s a billing invoice for U$ 300 from Yahoo! Directory for a site that hasn&#8217;t existed for a while now.</p>
<blockquote><p>De: &#8220;dirsubmit326@yahoo-inc.com&#8221; <dirsubmit326@yahoo-inc.com><br />
Para: jmafonseca2008@yahoo.com.br<br />
Enviadas: Sexta-feira, 9 de Março de 2012 5:35<br />
Assunto: Yahoo! Listing [Order 151913725]</p>
<p>Dear Yahoo! Directory Submit Client:</p>
<p>The URL you previously submmitted for expedited review</p>
<p><url:http://www.allwebhotels.com/></p>
<p>with Yahoo! Directory Submit order #151913725 <strong>has been reviewed<br />
by the Yahoo! Directory Submit editorial team as part of the Annual Review<br />
process and your credit card has been charged the applicable fee.</strong>
</p></blockquote>
<p>Never mind that the site has been off the air since earlier in 2011 so Yahoo! did obviously never review this site &#8211; because the site did no longer exist on March 9 2012. </p>
<p>They went ahead and charged my card without ever providing the service they claim they did. </p>
<p>Billing a card twice by accident is a mistake. The batch job failing overnight is a mistake. Charging for the wrong currency is a mistake. These are nuisances, but are explainable and normally easy to fix.</p>
<p><strong>But claiming to have reviewed a site that doesn&#8217;t exist is not a mistake, it&#8217;s a scam.</strong></p>
<p>It is now May 21 2012 and I have never heard back from them. But it doesn&#8217;t stop there. Have a look at the rest of this ridiculous message:</p>
<blockquote><p>
In accordance with the Yahoo! Directory Submit Terms of Service, <strong>your site<br />
is reviewed annually to ensure the site is functional, placed in<br />
an appropriate category, has an accurate and relevant<br />
description, and continues to meet the qualifications for<br />
inclusion in the Yahoo! Directory.</strong> For more information on the<br />
Annual Review and/or the Recurring Annual Fee, please see the<br />
Yahoo! Directory Submit Terms of Service<br />
(http://docs.yahoo.com/info/suggest/terms.html).
</p></blockquote>
<p>Really? AllWebHotels.com is fully functional and &#8220;meets your qualifications&#8221; for the Yahoo! Directory?!  That&#8217;s one great quality control you got going there!</p>
<p>On top of it all, just to complete my day, an old friend of mine requested a conversation by Yahoo! Messenger. I downloaded it and regrettably installed the thing. </p>
<p>Now their messenger installed all sorts of spyware on my Firefox and I simply can&#8217;t get rid of all the Yahoo! crap on my browser.<br />
<img src="http://zefonseca.com/blogs/zen/wp-content/uploads/2012/05/yahoosucks.png" alt="" title="yahoosucks" width="500" class="alignnone size-full wp-image-609" /></p>
<p>Oh and Yahoo! apparently uninstalled the uninstall function, I can&#8217;t find it anywhere. </p>
<p><img src="http://zefonseca.com/blogs/zen/wp-content/uploads/2012/05/yahootoolbar.jpg" alt="" title="yahootoolbar" width="429" height="378" class="alignnone size-full wp-image-610" /></p>
<p>They took U$ 300 from me for no reason, they didn&#8217;t reply support emails requesting a refund for this scam and then they crapped all over my browser.</p>
<p>Google, Facebook and DuckDuckGo don&#8217;t even have to try. Yahoo! is destroying itself. What a sad end to one of the WWW&#8217;s once most exciting success stories.</p>
<p><img src="http://zefonseca.com/blogs/zen/wp-content/uploads/2012/05/yahoostinks.png" alt="" title="yahoostinks" width="497" height="317" class="alignnone size-full wp-image-622" /></p>
<p><img src="http://zefonseca.com/blogs/zen/wp-content/uploads/2012/05/rage.png" alt="" title="rage" width="320" height="243" class="alignnone size-full wp-image-623" /></p>
]]></content:encoded>
			<wfw:commentRss>http://zefonseca.com/blogs/zen/yuckhoo/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>(Perl OO Quirks)[0]</title>
		<link>http://zefonseca.com/blogs/zen/perl-oo-quirks/</link>
		<comments>http://zefonseca.com/blogs/zen/perl-oo-quirks/#comments</comments>
		<pubDate>Wed, 14 Mar 2012 14:41:43 +0000</pubDate>
		<dc:creator>Zen</dc:creator>
				<category><![CDATA[Perl]]></category>

		<guid isPermaLink="false">http://zefonseca.com/blogs/zen/?p=588</guid>
		<description><![CDATA[Here&#8217;s a classic example of a Perl OO gotcha, for beginners. You want to subclass the ubiquitous LWP::UserAgent. Let&#8217;s start with the basics. This should work, right? package MyAgent; use LWP::UserAgent; use base 'LWP::UserAgent'; sub new { my ($this) = @_; my $obj = {}; return bless $obj, $this; } 1; Well, it doesn&#8217;t. The [...]]]></description>
			<content:encoded><![CDATA[<p>Here&#8217;s a classic example of a Perl OO gotcha, for beginners. You want to subclass the ubiquitous LWP::UserAgent. Let&#8217;s start with the basics. This should work, right?</p>
<p><code>package MyAgent;</p>
<p>use LWP::UserAgent;<br />
use base 'LWP::UserAgent';</p>
<p>sub new {<br />
 my ($this) = @_;<br />
 my $obj = {};<br />
 return bless $obj, $this;<br />
}</p>
<p>1;</code></p>
<p>Well, it doesn&#8217;t. The parent class&#8217; fields haven&#8217;t been correctly set up. Try $object->timeout(), for example. The following test&#8230;.</p>
<p><code>ok($ua->timeout() > 0, 'timeout must be > 0');</code></p>
<p>&#8230;will fail. Because we haven&#8217;t run the parent constructor, which should set up a properly initialized UserAgent. We need to run the parent constructor in order to fill in the object. </p>
<p>Let&#8217;s go with our intuition, I&#8217;d probably try this.<br />
<code>package MyAgent;</p>
<p>use LWP::UserAgent;<br />
use base 'LWP::UserAgent';</p>
<p>sub new {<br />
	my ($this) = @_;<br />
	my $obj = {};<br />
	bless $obj, $this; # bless our class<br />
	$obj->SUPER::new( ); # call our parent constructor<br />
	return $obj;<br />
}</p>
<p>1;</code></p>
<p>That won&#8217;t work. We get:</p>
<p><code>Attempt to bless into a reference at /usr/share/perl5/LWP/UserAgent.pm line 82.</code></p>
<p>We&#8217;re giving our parent a reference to ourselves, not a class name. UserAgent can&#8217;t bless $something => $HASHREF which is the correct, documented, behavior for bless. </p>
<p>So we&#8217;re left another alternative: instantiate the parent object, which should fill in all instance variables, then we bless that to ourselves. Which is what calling the super constructor is supposed to do in any object oriented language.</p>
<p><code>package MyAgent;</p>
<p>use LWP::UserAgent;<br />
use base 'LWP::UserAgent';</p>
<p>sub new {<br />
	my ($this) = @_;<br />
<strong>	my $obj = $this->SUPER::new( );		</strong> # we instantiate a parent object<br />
	bless $obj, $this; # and then bless it to our current class!<br />
	$obj->agent("MyAgent/0.1");<br />
	return $obj;<br />
}</p>
<p>1;</code></p>
<p>Let&#8217;s write a simple test case for that:</p>
<p><code>#!/usr/bin/perl</p>
<p>use strict;<br />
use warnings;<br />
use Test::More "no_plan";<br />
use MyAgent;<br />
use Data::Dumper;</p>
<p>my $user_agent = new MyAgent();<br />
isa_ok($user_agent, 'MyAgent');<br />
isa_ok($user_agent, 'LWP::UserAgent');<br />
</code></p>
<p>Both isa_ok tests pass: it&#8217;s a MyAgent and it&#8217;s a subclass of LWP::UserAgent.</p>
<h2>What did we do?</h2>
<p>We instantiated the parent class explicitly and then told Perl it belonged to our current class(we blessed it). It&#8217;s almost like class composition instead of inheritance, except instead of having the superclass stored as an instance variable, we have it stored as the blessed variable itself &#8211; which probably is what every other object oriented language does anyway, each in their own chic way.</p>
<h2>Common Mistakes</h2>
<p>Trying something like Java won&#8217;t work.<br />
<code>package MyAgent;</p>
<p>use LWP::UserAgent;<br />
use base 'LWP::UserAgent';</p>
<p>sub new {<br />
	my ($this) = @_;<br />
	my $obj = {};<br />
        <strong>$this::SUPER->new();</strong> # doesn't do what we want<br />
	bless $obj, $this;<br />
	return $obj;<br />
}</p>
<p>1;</code></p>
<p>$this::SUPER->new() doesn&#8217;t do anything for us in the above example. The variable which will become our object is $obj, and it&#8217;s just an empty hash. $this contains MyAgent, nothing more. MyAgent::SUPER->new() makes it clear why: new() is setting up a class, statically, nothing is returned from it and $obj is not filled with instance data.</p>
<p>The following is not a mistake per se, but it&#8217;s ugly OO code.</p>
<p><code>sub new {<br />
	my ($this) = @_;<br />
	<strong>my $obj = new LWP::UserAgent();</strong><br />
	bless $obj, $this;<br />
	return $obj;<br />
}</code></p>
<p>Calling the superclass explicitly also works, but is ugly(some might say uglier still, considering the already quirky OOrientation in Perl)</p>
<h2>How do other popular packages do it?</h2>
<p><code>package WWW::Mechanize;</p>
<p>....</p>
<p>    # line 268<br />
    my $self = $class->SUPER::new( %parent_parms );<br />
    bless $self, $class;</p>
<p></code></p>
<p>Exactly as we did on the working example above. </p>
<p>__FIN__<br />
1;</p>
]]></content:encoded>
			<wfw:commentRss>http://zefonseca.com/blogs/zen/perl-oo-quirks/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Guns &#8216;n SOPA</title>
		<link>http://zefonseca.com/blogs/zen/guns-n-sopa/</link>
		<comments>http://zefonseca.com/blogs/zen/guns-n-sopa/#comments</comments>
		<pubDate>Thu, 15 Dec 2011 11:50:04 +0000</pubDate>
		<dc:creator>Zen</dc:creator>
				<category><![CDATA[The Web]]></category>

		<guid isPermaLink="false">http://zefonseca.com/blogs/zen/?p=581</guid>
		<description><![CDATA[SOPA is based on the absurd principle that sites shall be co-responsible for criminal acts committed by their members. It turns web sites into accomplices for copyright violations perpetrated by people the site owners have never met. It is a confession of defeat by authorities &#8211; they are unable to enforce copyright law in the [...]]]></description>
			<content:encoded><![CDATA[<p>SOPA is based on the absurd principle that sites shall be co-responsible for criminal acts committed by their members. It turns web sites into accomplices for copyright violations perpetrated by people the site owners have never met. It is a confession of defeat by authorities &#8211; they are unable to enforce copyright law in the new reality of 2011, thus they will remove everybody&#8217;s rights online because of their particular failure.</p>
<p>Let&#8217;s draw a parallel here. Blaming Reddit, Youtube and even Wikipedia for any eventual copyrighted content submitted by their users is akin to blaming gun makers for homicides committed using their product.  You will not, in our lifetimes, see the gun makers be criminally convicted for murders committed using their product. It&#8217;s been tried, and it&#8217;s always been a lost cause. Civil lawsuits have been won, damages have been granted for violent gun-related crimes, but a criminal conviction has never been attained, precisely because you can&#8217;t be criminally responsible for crime you didn&#8217;t commit(or actively participate in, in some way).</p>
<p>Why should SOPA, then, convict websites like Wikipedia of a felony if anyone is able to submit copyrighted content to them? It is obvious that if SOPA is passed, it may be used against websites by the very copyright holders. Copyright owners, <a href="http://torrentfreak.com/how-to-find-fake-torrents-uploaded-by-the-mpaa-and-riaa/">who have been known for spreading their own content</a> as a &#8220;honey pot&#8221; in order to implicate downloaders, could easily sabotage sites like Wikipedia by submitting their own content, taking screenshots filing lawsuits for copyright infringement.</p>
<p>SOPA has the potential to create a sea of lawsuits, by everyone against everyone. Just upload your copyrighted work and file a criminal complaint any given site. This old trick has been used against me in the past, by a photographer. </p>
<p>One website I worked on was sued by a photographer who claimed one of his photos was used without authorization. We checked and the photo had been uploaded just days before the lawsuit was filed&#8230;it is unlikely this photographer found this photo casually on the internet. Most likely, we were the victims of that very photographer. We checked and this person had over 300 identical lawsuits against sites which allowed the upload of photos. Basically, this photographer was making a living by submitting his photos and then filing lawsuits. As of this time, we&#8217;re still defending ourselves against his accusations. Now, imagine if SOPA were in effect here, we&#8217;d be criminally responsible, along with 300 others, for a crime we didn&#8217;t commit.</p>
<p>SOPA has the potential of destroying the collaborative nature of the Internet and it must be stopped. Do your part!</p>
]]></content:encoded>
			<wfw:commentRss>http://zefonseca.com/blogs/zen/guns-n-sopa/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Google, the scraper?</title>
		<link>http://zefonseca.com/blogs/zen/google-the-scraper/</link>
		<comments>http://zefonseca.com/blogs/zen/google-the-scraper/#comments</comments>
		<pubDate>Wed, 16 Nov 2011 00:41:41 +0000</pubDate>
		<dc:creator>Zen</dc:creator>
				<category><![CDATA[The Web]]></category>

		<guid isPermaLink="false">http://zefonseca.com/blogs/zen/?p=575</guid>
		<description><![CDATA[Google penalizes any site which copies content from another with the intent of taking the original author&#8217;s traffic. I wonder if they have a special deal with some sites in order to present their content on Google&#8217;s search results directly? Here&#8217;s a simple example. I&#8217;ll ask Google to define what monopoly means. I take the [...]]]></description>
			<content:encoded><![CDATA[<p>Google penalizes any site which copies content from another with the intent of taking the original author&#8217;s traffic. I wonder if they have a special deal with some sites in order to present their content on Google&#8217;s search results directly?</p>
<p>Here&#8217;s a simple example. I&#8217;ll ask Google to define what monopoly means.<br />
<img src="http://zefonseca.com/blogs/zen/wp-content/uploads/2011/11/monopoly_google.png" alt="" title="monopoly_google" width="508" class="alignnone size-full wp-image-576" /></p>
<p>I take the definition and search for it in quotes, on Google itself. Which gives me the following result:<br />
<img src="http://zefonseca.com/blogs/zen/wp-content/uploads/2011/11/oxford_monopoly.png" alt="" title="oxford_monopoly" width="526" height="310" class="alignnone size-full wp-image-577" /></p>
<p>The definition which Google showed on its search result is exactly the same provided by the Oxford Dictionary. But the user never reached the source of the original definition of &#8220;monopoly&#8221;, never registered for that site&#8217;s services, never even saw the logo of Oxford. </p>
<p>I wonder if dictionary sources are getting some compensation for allowing this? </p>
]]></content:encoded>
			<wfw:commentRss>http://zefonseca.com/blogs/zen/google-the-scraper/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Gmail shows incomplete Twitter messages</title>
		<link>http://zefonseca.com/blogs/zen/gmail-shows-incomplete-twitter-messages/</link>
		<comments>http://zefonseca.com/blogs/zen/gmail-shows-incomplete-twitter-messages/#comments</comments>
		<pubDate>Mon, 19 Sep 2011 15:26:28 +0000</pubDate>
		<dc:creator>Zen</dc:creator>
				<category><![CDATA[The Web]]></category>
		<category><![CDATA[Twitter]]></category>

		<guid isPermaLink="false">http://zefonseca.com/blogs/zen/?p=566</guid>
		<description><![CDATA[If, by any chance, you decide to reset your Twitter password and you receive the message via Gmail, you&#8217;ll find that it&#8217;s currently impossible to procede because only a part of the message is displayed. The solution is to &#8220;View Original Message&#8221; on the drop-down menu located at the top-right hand corner of Gmail messages. [...]]]></description>
			<content:encoded><![CDATA[<p>If, by any chance, you decide to reset your Twitter password and you receive the message via Gmail, you&#8217;ll find that it&#8217;s currently impossible to procede because only a part of the message is displayed.</p>
<p><img src="http://zefonseca.com/blogs/zen/wp-content/uploads/2011/09/twitter-reset-pwd-gmail.png" alt="" title="Twitter reset password on Gmail message" width="579" height="259" class="alignnone size-full wp-image-567" /></p>
<p>The solution is to &#8220;View Original Message&#8221; on the drop-down menu located at the top-right hand corner of Gmail messages. There you&#8217;ll find the link, you should copy and paste it into a new browser tab.</p>
]]></content:encoded>
			<wfw:commentRss>http://zefonseca.com/blogs/zen/gmail-shows-incomplete-twitter-messages/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Solving the &#8220;Software caused connection abort&#8221; mod_cache problem</title>
		<link>http://zefonseca.com/blogs/zen/mod_cache-problem/</link>
		<comments>http://zefonseca.com/blogs/zen/mod_cache-problem/#comments</comments>
		<pubDate>Tue, 16 Aug 2011 00:51:14 +0000</pubDate>
		<dc:creator>Zen</dc:creator>
				<category><![CDATA[Linux/UNIX]]></category>

		<guid isPermaLink="false">http://zefonseca.com/blogs/zen/?p=547</guid>
		<description><![CDATA[In the first days of August I was in charge of setting up a new Apache server for a medium traffic site. The backend was a rather large system that had finally passed all tests on the x86 64 bit platform. We&#8217;d finally be leaving 32 bits behind. After a few pleasant hours of the [...]]]></description>
			<content:encoded><![CDATA[<p>In the first days of August I was in charge of setting up a new Apache server for a medium traffic site. The backend was a rather large system that had finally passed all tests on the x86 64 bit platform. We&#8217;d finally be leaving 32 bits behind.</p>
<p>After a few pleasant hours of the usual custom compilations, package upgrades and pre-requisites checking, the migration was finally done. To our surprise, all went perfectly &#8211; not a single glitch. </p>
<p>Comparing to some of my past experiences, it&#8217;d be surreal to imagine such a successful migration a few years ago, with zero complaints or technical issues. </p>
<p>Peace lasted very little, as expected: several hours after the launch, Apache had started randomly returning blank pages and producing 500 Server Errors. </p>
<p>The only clue I had was this error_log entry, repeated thousands of times:<br />
<code><br />
(103)Software caused connection abort: cache: error returned while trying to return disk cached data<br />
</code></p>
<p>So mod_cache was ruining our sleep.</p>
<h3>What didn&#8217;t work</h3>
<p>Since you&#8217;ve likely Googled or Binged the problem and read all the suggestions in mailing lists and forums, here are some steps I tried and still didn&#8217;t work: </p>
<ul>
<li>Disabled SELinux &#8211; no luck.  (Who knows, in previous lives I had issues with Apache serving and SELinux.) </li>
<li>Changed mounted disks for the cache data &#8211; no luck. (Maybe we had a bad filesystem, who knows.)</li>
<li>I thought it could be related to the <a href="http://aws.amazon.com/ebs/">Amazon EBS</a> virtual drive latency, so I used the instance RAM memory for the cache directory(<a href="http://www.cyberciti.biz/tips/what-is-devshm-and-its-practical-usage.html">using tmpfs</a>) &#8211; no luck.</li>
<li>Tried reducing the CacheDirLevels and CacheDirLength to one. Nope&#8230;wait 15 minutes or so, and the errors returned.</li>
<li>Set htcacheclean to clean up after 30 minutes, allowing only 250MBytes of cache data. (/usr/sbin/htcacheclean -p /var/cache/apache/ -l250M -d30). No luck &#8211; the errors still appeared, seemingly randomly.</li>
</ul>
<p>There was apparently no specific file type that triggered the error. PHP scripts, Perl programs, WordPress, MediaWiki and our in-house systems &#8211; all equally affected.</p>
<p><em>Note that each time the Cache settings were changed, we started with a fresh cache directory(/var/cache/apache1,apache2,apache3 &#8230; apacheN). Once we found a solution, we went back to /var/cache/apache &#8211; cleaning it up before.</em></p>
<p>After reading a dozen or so related complaints in mailing lists and having unsuccessfully tried their recommendations I figured it was time to access the Apache documentation and see what directives we could tweak that could help us.</p>
<p><a href="http://httpd.apache.org/docs/2.2/mod/mod_disk_cache.html">mod_disk_cache</a> gives us 5 configuration options only: CacheDirLength, CacheDirLevels, CacheMaxFileSize, CacheMinFileSize and CacheRoot.  Click <a href="http://httpd.apache.org/docs/2.2/mod/mod_disk_cache.html">here</a> for a detailed explanation of each. After testing several combinations of these directives, and starting with a fresh cache directory, the error would return after a few thousand(or so) requests. Debugging this issue is specially hard because the problem doesn&#8217;t happen as soon as the Apache server is started &#8211; it takes a while to replicate and test.</p>
<h3>The Solution</h3>
<p>This combination of CacheMaxFileSize and CacheDisable for the images directory.<br />
<code><br />
CacheMaxFileSize 64000<br />
CacheDisable /images<br />
</code></p>
<p>Limiting the cached files to 64KB and making sure the /images directory was not being cached solved the problem. It&#8217;s been a week now and we had zero of the dreaded &#8220;Software caused connection abort&#8221; error 103 messages. Having to block the images directory came as a shock to us, because none of the errors we examined were triggered by serving an image. It seemed random and happened for html files, PHP and Perl scripts and so forth.</p>
<p>So what&#8217;s the cause? I have no idea. Folks wanted the site back up and running, so we had zero time left for long debugging sessions. It&#8217;s something which only happened after a few minutes. The reason it took the initial install more time to present the problem was because we performed the main migration on a late sunday night, when traffic was considerably lower. </p>
<h3>Additional Info</h3>
<p><code><br />
#httpd -l<br />
Compiled in modules:<br />
  core.c<br />
  prefork.c<br />
  http_core.c<br />
  mod_so.c</p>
<p># httpd -v<br />
Server version: Apache/2.2.15 (Unix)<br />
Server built:   Apr  9 2011 08:58:28</p>
<p># uname -a<br />
Linux hostname_here 2.6.32-131.4.1.el6.x86_64 #1 SMP Fri Jun 10 10:54:26 EDT 2011 x86_64 x86_64 x86_64 GNU/Linux</p>
<p># Cache-related directives on httpd.conf:<br />
CacheRoot   /var/cache/apache/<br />
CacheEnable disk /<br />
<strong>CacheMaxFileSize 64000</strong><br />
CacheDirLevels 1<br />
CacheDirLength 1<br />
<strong>CacheDisable /images</strong><br />
CacheDefaultExpire 176400<br />
CacheIgnoreHeaders Set-Cookie<br />
CacheIgnoreNoLastMod On<br />
</code></p>
]]></content:encoded>
			<wfw:commentRss>http://zefonseca.com/blogs/zen/mod_cache-problem/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Quieting &#8216;DBIx::Class::ResultSet::next(): Prefetching multiple has_many rels&#8217; messages</title>
		<link>http://zefonseca.com/blogs/zen/quiet-dbix-class/</link>
		<comments>http://zefonseca.com/blogs/zen/quiet-dbix-class/#comments</comments>
		<pubDate>Sun, 07 Aug 2011 01:24:16 +0000</pubDate>
		<dc:creator>Zen</dc:creator>
				<category><![CDATA[Perl]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://zefonseca.com/blogs/zen/?p=543</guid>
		<description><![CDATA[The error_log for my DBIx::Class based sites were absolutely packed with warnings about n to n relationships getting out of hand, such as this line: [Sat Aug 06 21:09:02 2011] [warn] [1144]ERR: 32: Warning in Perl code: DBIx::Class::ResultSet::next(): Prefetching multiple has_many rels addresses and addresses at the same level (person) will explode the number of [...]]]></description>
			<content:encoded><![CDATA[<p>The error_log for my DBIx::Class based sites were absolutely packed with warnings about n to n relationships getting out of hand, such as this line:<br />
<code><br />
[Sat Aug 06 21:09:02 2011] [warn] [1144]ERR:  32:  Warning in Perl code: DBIx::Class::ResultSet::next(): Prefetching multiple has_many rels addresses and addresses at the same level (person) will explode the number of row objects retrievable via ->next or ->all. Use at your own risk. at /chili/beans/Lib/Process.pm line 38<br />
</code></p>
<p>I&#8217;m aware of the dangers of a badly implemented ORM schema and I took care to add enough constraints to my query so that next() won&#8217;t blow up my memory space. And I never use all() &#8230; at all().</p>
<p>So I searched for options on how to quiet these messages, because in a heavy traffic site these log files reach gigabytes every day. Plus, logging all that stuff surely slows the site down. Here&#8217;s how I solved it. If you came here looking for an elegant solution, please hit Back now.</p>
<p><code><br />
# cd /usr/local/share/perl5/DBIx/Class<br />
# vi ResultSource.pm<br />
:/Prefetching # this will search for the first occurrence of the word Prefetching<br />
        #carp (<br />
        #  "Prefetching multiple has_many rels ${last} and ${pre} "<br />
        #  .(length($as_prefix)<br />
        #    ? "at the same level (${as_prefix}) "<br />
        #    : "at top level "<br />
        #  )<br />
        #  . 'will explode the number of row objects retrievable via ->next or ->all. '<br />
        #  . 'Use at your own risk.'<br />
        #);<br />
</code></p>
<p>Comment out the multiline carp() call, and Bob&#8217;s your uncle. A clean error_log from now on.</p>
]]></content:encoded>
			<wfw:commentRss>http://zefonseca.com/blogs/zen/quiet-dbix-class/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Increasing MySQL login and network timeouts for EC2 instances</title>
		<link>http://zefonseca.com/blogs/zen/mysql-ec2-timeout/</link>
		<comments>http://zefonseca.com/blogs/zen/mysql-ec2-timeout/#comments</comments>
		<pubDate>Sat, 06 Aug 2011 17:31:39 +0000</pubDate>
		<dc:creator>Zen</dc:creator>
				<category><![CDATA[Amazon Web Services]]></category>
		<category><![CDATA[MySQL]]></category>

		<guid isPermaLink="false">http://zefonseca.com/blogs/zen/?p=538</guid>
		<description><![CDATA[For quite a few days now I&#8217;d been getting 500 Server Errors on my main Apache server, which is an EC2 instance at Amazon Web Services. The traffic on some of the sites is quite respectable, so i was definitely not a &#8220;morning bug&#8221; issue. The messages I was receiving varied, and the error seemed [...]]]></description>
			<content:encoded><![CDATA[<p>For quite a few days now I&#8217;d been getting 500 Server Errors on my main Apache server, which is an EC2 instance at Amazon Web Services. </p>
<p>The traffic on some of the sites is quite respectable, so i was definitely not a &#8220;<a href="http://modperlbook.org/html/20-1-5-5-The-morning-bug.html">morning bug</a>&#8221; issue.</p>
<p>The messages I was receiving varied, and the error seemed random &#8211; it wasn&#8217;t the first connection, it wasn&#8217;t a last, not related to long queries, not related to a certain section of the web site and so on. Worst kind of problem to debug.</p>
<p>Some of the messages I received included:<br />
<code><br />
DBI Connection failed<br />
or<br />
Can't connect to MySQL server on [...]<br />
or<br />
DBI Connection failed: Lost connection to MySQL server at 'reading authorization packet', system error: 0 at [...]<br />
</code></p>
<p>Further testing led me to several MySQL bug reports, some of which were legitimate. Others were just support requests disguised as bugs.</p>
<p>It turns out sometimes the network latency of EC2 instances can get quite high. I&#8217;d heard such comments before, but never had any issues.</p>
<p>Raising connect_timeout from the default of 5 seconds to 30 solved the &#8216;connection failed&#8217; problem. Raising the net_read_timeout solved the &#8216;Lost connection&#8217; issue. All three problems were related to network latency.</p>
<p>Added to my MySQL server&#8217;s /etc/my.cnf [mysqld] section:<br />
<code><br />
connect_timeout=30<br />
net_read_timeout=45<br />
</code></p>
]]></content:encoded>
			<wfw:commentRss>http://zefonseca.com/blogs/zen/mysql-ec2-timeout/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>The timthumb.php vulnerability</title>
		<link>http://zefonseca.com/blogs/zen/the-timthumb-php-vulnerability/</link>
		<comments>http://zefonseca.com/blogs/zen/the-timthumb-php-vulnerability/#comments</comments>
		<pubDate>Wed, 03 Aug 2011 23:52:39 +0000</pubDate>
		<dc:creator>Zen</dc:creator>
				<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://zefonseca.com/blogs/zen/?p=531</guid>
		<description><![CDATA[If your website, like the one you&#8217;re reading now, has timthumb.php anywhere on one of its themes, you should be aware of a zero day remote exploit uncovered just hours ago. Update: download the fixed version here. The discussion is happening over at the timthumb.php development site. If you don&#8217;t absolutely need to use external [...]]]></description>
			<content:encoded><![CDATA[<p>If your website, like the one you&#8217;re reading now, has timthumb.php anywhere on one of its themes, you should be aware of a zero day remote exploit uncovered just hours ago.</p>
<p><strong><a href="http://timthumb.googlecode.com/svn/trunk/timthumb.php">Update: download the fixed version here.</a></strong></p>
<p><a href="http://code.google.com/p/timthumb/issues/detail?id=212#c18">The discussion is happening over at the timthumb.php development site.</a></p>
<p>If you don&#8217;t absolutely need to use external images on your site thumbnails, then you should clear the $allowedSites array immediatley:</p>
<p><code><br />
$allowedSites = array (<br />
	'flickr.com',<br />
	'picasa.com',<br />
	'blogger.com',<br />
	'wordpress.com',<br />
	'img.youtube.com',<br />
	'upload.wikimedia.org',<br />
);<br />
</code></p>
<p>The vulnerable code is at line 641:</p>
<p><code><br />
				$isAllowedSite = false;<br />
				foreach ($allowedSites as $site) {<br />
					<strong>if (strpos (strtolower ($url_info['host']), $site) !== false) {</strong><br />
						$isAllowedSite = true;<br />
					}<br />
				}<br />
</code></p>
<p>strpos() will report a true value if it finds the allowed site anywhere within the $site string. So &#8216;flickr.com.badguyblackhat.com&#8217; will pass.</p>
<h3>The Exploit</h3>
<p>Instead of submitting an image, an attacher will try to make a thumbnail out of a file containing PHP code, also ending in the .php extension. </p>
<p>The thumbnail process will fail of course, but a copy of the PHP file will be stored at the ./cache/ directory &#8211; using the same name that was submitted(including .php). The attacker will then access the file remotely and your server will run its contents.</p>
<p>The vulnerability is very serious, it is out on the WWW right now and you should take immediate action.</p>
<h3>Temporary Fix</h3>
<p>Clear the $allowedSites array until a new version is released. </p>
<p><a href="http://timthumb.googlecode.com/svn/trunk/timthumb.php">Update: download the fixed version here.</a></p>
<p><code><br />
$allowedSites = array ();<br />
</code></p>
]]></content:encoded>
			<wfw:commentRss>http://zefonseca.com/blogs/zen/the-timthumb-php-vulnerability/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to get out of Google+</title>
		<link>http://zefonseca.com/blogs/zen/how-to-get-out-of-google/</link>
		<comments>http://zefonseca.com/blogs/zen/how-to-get-out-of-google/#comments</comments>
		<pubDate>Wed, 20 Jul 2011 18:15:50 +0000</pubDate>
		<dc:creator>Zen</dc:creator>
				<category><![CDATA[The Web]]></category>

		<guid isPermaLink="false">http://zefonseca.com/blogs/zen/?p=525</guid>
		<description><![CDATA[This may be hard to find in the Google system: https://plus.google.com/u/0/downgrade/ Unfortunately, I shared a couple of posts on Google+ and they ended up on over a hundred mailboxes as unsolicited mail. The checkbox under the Share button means you&#8217;d like to share with everyone NOT on Google+. I scanned it in a hurry and [...]]]></description>
			<content:encoded><![CDATA[<p>This may be hard to find in the Google system:</p>
<h2>https://plus.google.com/u/0/downgrade/</h2>
<p>Unfortunately, I shared a couple of posts on Google+ and they ended up on over a hundred mailboxes as unsolicited mail. The checkbox under the Share button means you&#8217;d like to share with everyone NOT on Google+. I scanned it in a hurry and ended up accidentally spamming almost 200 mailboxes of former bosses, former relationships and tens of folks I haven&#8217;t talked to in a while. Some of the phone calls were less friendly than others.</p>
<h3>In one word: Awkward.</h3>
<p>Tip received via <a href="http://www.reddit.com/">Reddit.com</a></p>
]]></content:encoded>
			<wfw:commentRss>http://zefonseca.com/blogs/zen/how-to-get-out-of-google/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

