<?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>noteslog.com</title>
	<atom:link href="http://noteslog.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://noteslog.com</link>
	<description></description>
	<lastBuildDate>Wed, 22 May 2013 12:16:43 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.5.1</generator>
		<item>
		<title>I&#8217;ve moved this blog to my VPS</title>
		<link>http://noteslog.com/post/ive-moved-this-blog-to-my-vps/</link>
		<comments>http://noteslog.com/post/ive-moved-this-blog-to-my-vps/#comments</comments>
		<pubDate>Sat, 20 Apr 2013 12:18:13 +0000</pubDate>
		<dc:creator>Andrea Ercolino</dc:creator>
				<category><![CDATA[other]]></category>

		<guid isPermaLink="false">http://noteslog.com/?p=1697</guid>
		<description><![CDATA[http://andowebsit.es/blog/noteslog.com/ &#160;]]></description>
				<content:encoded><![CDATA[<h3><a href="http://andowebsit.es/blog/noteslog.com/">http://andowebsit.es/blog/noteslog.com/</a></h3>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://noteslog.com/post/ive-moved-this-blog-to-my-vps/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Rails 4 (beta1) depends on Rdoc ~&gt;3.4 but Ruby 2 on Rdoc 4</title>
		<link>http://noteslog.com/post/rails-4-beta1-depends-on-rdoc-3-4-but-ruby-2-on-rdoc-4/</link>
		<comments>http://noteslog.com/post/rails-4-beta1-depends-on-rdoc-3-4-but-ruby-2-on-rdoc-4/#comments</comments>
		<pubDate>Thu, 04 Apr 2013 09:33:30 +0000</pubDate>
		<dc:creator>Andrea Ercolino</dc:creator>
				<category><![CDATA[other]]></category>

		<guid isPermaLink="false">http://noteslog.com/?p=1686</guid>
		<description><![CDATA[Gemfile.lock ... railties (4.0.0.beta1) actionpack (= 4.0.0.beta1) activesupport (= 4.0.0.beta1) rake (&#62;= 0.8.7) rdoc (~&#62; 3.4) thor (&#62;= 0.17.0, &#60; 2.0) ... So this fact makes ri not work in a Ruby 2 + Rails 4 project at the moment&#8230;<span class="ellipsis">&#8230;</span><div class="read-more"><a href="http://noteslog.com/post/rails-4-beta1-depends-on-rdoc-3-4-but-ruby-2-on-rdoc-4/">Read more &#8250;</a></div><!-- end of .read-more -->]]></description>
				<content:encoded><![CDATA[<p>Gemfile.lock</p>
<pre>...
railties (4.0.0.beta1)
  actionpack (= 4.0.0.beta1)
  activesupport (= 4.0.0.beta1)
  rake (&gt;= 0.8.7)
  rdoc (~&gt; 3.4)
  thor (&gt;= 0.17.0, &lt; 2.0)
...</pre>
<p>So this fact makes <strong>ri</strong> not work in a Ruby 2 + Rails 4 project at the moment&#8230; I suspect this could be the reason why docs were not included by default by RVM. Or possibly the other way around, due to the fact that docs are never included by default (so seldom used), Rails developers didn&#8217;t see there was a problem.</p>
<p>The easiest temporary fix is to use the full path to (the good) <strong>ri</strong>:</p>
<pre>$ /Users/.../.rvm/rubies/ruby-2.0.0-p0/bin/ri String</pre>
<p>Another temporary fix (I&#8217;m currently using this one) is to</p>
<ol>
<li>manually edit the Gemfile.lock such that above line reads instead
<pre>rdoc (&gt;= 3.4)</pre>
</li>
<li>execute
<pre>$ bundle update rdoc</pre>
</li>
</ol>
<p>After that, you can again execute <strong>ri</strong> without specifying its path.</p>
<pre>$ ri String</pre>
]]></content:encoded>
			<wfw:commentRss>http://noteslog.com/post/rails-4-beta1-depends-on-rdoc-3-4-but-ruby-2-on-rdoc-4/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>The need for an IDE in Ruby + Rails</title>
		<link>http://noteslog.com/post/the-need-for-an-ide-in-ruby-rails/</link>
		<comments>http://noteslog.com/post/the-need-for-an-ide-in-ruby-rails/#comments</comments>
		<pubDate>Tue, 02 Apr 2013 18:18:17 +0000</pubDate>
		<dc:creator>Andrea Ercolino</dc:creator>
				<category><![CDATA[Ruby + Rails]]></category>

		<guid isPermaLink="false">http://noteslog.com/?p=1685</guid>
		<description><![CDATA[Reading the 4th edition of the Agile Web Development with Rails book by Sam Ruby. With Ruby, however, much of this support just isn’t necessary. Editors such as TextMate and BBEdit give you 90 percent of what you’d get from<span class="ellipsis">&#8230;</span><div class="read-more"><a href="http://noteslog.com/post/the-need-for-an-ide-in-ruby-rails/">Read more &#8250;</a></div><!-- end of .read-more -->]]></description>
				<content:encoded><![CDATA[<p>Reading the 4th edition of the Agile Web Development with Rails book by Sam Ruby.</p>
<blockquote><p>With Ruby, however, much of this support just isn’t necessary. Editors such as TextMate and BBEdit give you 90 percent of what you’d get from an IDE but are far lighter weight. Just about the only useful IDE facility that’s missing is refactoring support.</p></blockquote>
<p>Hm, that&#8217;s unfortunate. One of the most useful IDE facility that’s missing is debugging support !! When you have a debugger integrated into the editor, you are not anymore thinking about debugging because it&#8217;s just another editing task.</p>
<p>You look at a piece of code, put a breakpoint, hit debug, and review the application state at that point in time, step by step.</p>
]]></content:encoded>
			<wfw:commentRss>http://noteslog.com/post/the-need-for-an-ide-in-ruby-rails/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>RubyMine Issues</title>
		<link>http://noteslog.com/post/rubymine-issues/</link>
		<comments>http://noteslog.com/post/rubymine-issues/#comments</comments>
		<pubDate>Sat, 15 Dec 2012 22:58:33 +0000</pubDate>
		<dc:creator>Andrea Ercolino</dc:creator>
				<category><![CDATA[Fixing]]></category>

		<guid isPermaLink="false">http://noteslog.com/?p=1678</guid>
		<description><![CDATA[RubyMine is my preferred IDE for Ruby development. I chose it for local and remote debugging from the browser. It has some space for improvement but it&#8217;s also pretty good. And support is excellent. These are the issues that I&#8217;ve<span class="ellipsis">&#8230;</span><div class="read-more"><a href="http://noteslog.com/post/rubymine-issues/">Read more &#8250;</a></div><!-- end of .read-more -->]]></description>
				<content:encoded><![CDATA[<p><a href="http://www.jetbrains.com/ruby/">RubyMine</a> is my preferred IDE for Ruby development. I chose it for local and remote debugging from the browser. It has some space for improvement but it&#8217;s also pretty good. And support is excellent.</p>
<p>These are the issues that I&#8217;ve reported. This list is mostly for my own use.</p>
<ol>
<li><a href="http://youtrack.jetbrains.com/issue/IDEA-103719" target="_blank">Replace in Path should be integrated into Find in Path</a></li>
<li><strong><a href="http://youtrack.jetbrains.com/issue/IDEA-103628" target="_blank">The &#8216;Replace in Path&#8217; functionality is completely broken</a></strong></li>
<li><a href="http://youtrack.jetbrains.com/issue/IDEA-103609" target="_blank">Number of &#8216;Found usages&#8217; depends on wether the button &#8216;Merge usages from the same line&#8217; is pressed or not</a></li>
<li><a href="http://youtrack.jetbrains.com/issue/IDEA-103560" target="_blank">Exclude external libraries from a custom scope of &#8216;Find in Path&#8217;</a></li>
<li><a href="http://youtrack.jetbrains.com/issue/IDEABKL-6703" target="_blank">In a big text file, it takes up to 2 seconds to move the caret only 1 char</a></li>
<li><a href="http://youtrack.jetbrains.com/issue/IDEA-97859" target="_blank">Depending on path tooltip position, displayed document is garbled</a></li>
<li><a href="http://youtrack.jetbrains.com/issue/IDEA-97861" target="_blank">Depending on caret position, displayed document is garbled</a></li>
<li><strong><a href="http://youtrack.jetbrains.com/issue/IDEA-96340" target="_blank">Replace in Path (with a grouping RegEx) makes a mess (depending on input)</a></strong></li>
<li><a href="http://youtrack.jetbrains.com/issue/IDEA-94830" target="_blank">File comparison should behave differently for ending lines</a></li>
<li><a href="http://youtrack.jetbrains.com/issue/IDEA-94831" target="_blank">Breakpoints dialog floats on top even if the parent project is closed (it has no closing button either)</a></li>
<li><a href="http://youtrack.jetbrains.com/issue/WEB-2360" target="_blank">Extract CSS is broken</a></li>
<li><a href="http://devnet.jetbrains.net/message/5466221" target="_blank">Dream remote debugging with the PassengerDebugger option</a></li>
<li><a href="http://devnet.jetbrains.net/thread/438118" target="_blank">How to remotely debug Rails in Apache + Passenger + RubyMine</a></li>
</ol>
]]></content:encoded>
			<wfw:commentRss>http://noteslog.com/post/rubymine-issues/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Orderly require scripts from a bookmarklet</title>
		<link>http://noteslog.com/post/orderly-require-scripts-from-a-bookmarklet/</link>
		<comments>http://noteslog.com/post/orderly-require-scripts-from-a-bookmarklet/#comments</comments>
		<pubDate>Wed, 05 Dec 2012 21:32:01 +0000</pubDate>
		<dc:creator>Andrea Ercolino</dc:creator>
				<category><![CDATA[other]]></category>

		<guid isPermaLink="false">http://noteslog.com/?p=1677</guid>
		<description><![CDATA[Abstracting a bit my bookmarklet for injecting jQuery, I&#8217;ve come to this one where you can orderly require needed scripts before executing a given payload. javascript:(function () { var debug = !false; var requested = false; orderly( require_jQuery('1.8.3', 'j'), require_SimpleModal('j'),<span class="ellipsis">&#8230;</span><div class="read-more"><a href="http://noteslog.com/post/orderly-require-scripts-from-a-bookmarklet/">Read more &#8250;</a></div><!-- end of .read-more -->]]></description>
				<content:encoded><![CDATA[<p>Abstracting a bit my bookmarklet for injecting jQuery, I&#8217;ve come to this one where you can orderly require needed scripts before executing a given payload.</p>
<p><pre><code class="javascript">javascript:(function () {

    var debug = !false;
    var requested = false;

    orderly(
        require_jQuery('1.8.3', 'j'),
        require_SimpleModal('j'),
        function() {
            payload(window.j);
        }
    );

    function payload(jQuery) {
        jQuery(function($) {
            $('body').click(function() {
                $('span:first').modal({
                    overlayClose: true,
                    opacity: 80,
                    overlayCss: {backgroundColor: &quot;#000&quot;},
                    maxHeight: 480,
                    maxWidth: 640,
                    containerCss:{
                        backgroundColor:&quot;#fff&quot;,
                        borderColor:&quot;#fff&quot;,
                        padding:20
                    }
                });
            });
        });
    }

    function require_jQuery(version, symbol) {
        return {
            url: 'http://ajax.googleapis.com/ajax/libs/jquery/' + version + '/jquery.min.js',
            is_loaded: function() {
                return !requested &amp;&amp; typeof window[symbol] != 'undefined' &amp;&amp; window[symbol].fn.jquery == version
                    ||  requested &amp;&amp; typeof window.jQuery  != 'undefined' &amp;&amp; window.jQuery.fn.jquery  == version;
            },
            before: function() {
                window.oldJQuery = window.jQuery;
                window.jQuery = window.undefined;
            },
            success: function() {
                jQuery.noConflict();
                window[symbol] = jQuery;
                console.info('jQuery ' + jQuery.fn.jquery + ' has been injected. (as &quot;' + symbol + '&quot;)');
            },
            ensure: function () {
                window.jQuery = window.oldJQuery;
            }
        };
    }

    function require_SimpleModal(jQuerySymbol) {
        return {
            url: 'http://cdn.jsdelivr.net/simplemodal/1.4.2/jquery.simplemodal.1.4.2.min.js',
            is_loaded: function() {
                return !requested &amp;&amp; typeof window[jQuerySymbol].modal != 'undefined'
                    ||  requested &amp;&amp; typeof window.jQuery.modal        != 'undefined';
            },
            before: function() {
                window.oldJQuery = window.jQuery;
                window.jQuery = window[jQuerySymbol];
            },
            ensure: function () {
                window.jQuery = window.oldJQuery;
            }
        };
    }

    function orderly(i) {
        var stuff = Array.prototype.slice.call(arguments);
        if (typeof i === 'number') {
            stuff.shift();
        }
        else {
            i = 0;
        }
        if (i == stuff.length) return;

        console_log('orderly ' + i);
        switch (typeof stuff[i]) {
            case 'string':
                break;
            case 'function':
                stuff[i]();
                orderly.apply(null, [i+1].concat(stuff));
                break;
            case 'object':
                load_script(stuff, i);
                break;
            default:
                throw 'Expected a valid argument (' + i + ')';
                break;
        }
    }

    function load_script(stuff, i) {
        var current = stuff[i];
        var url = current.url;
        console_log('load_script: request for ' + url);

        requested = false;
        var is_loaded = current.is_loaded;
        if (is_loaded()) {
            console_log('load_script: already available');
            orderly.apply(null, [i+1].concat(stuff));
            return;
        }
        var before = current.before;
        var success = function() {
            call_function(current.success);
            call_function(current.ensure);
            orderly.apply(null, [i+1].concat(stuff));
        };
        var failure = function() {
            call_function(current.failure);
            call_function(current.ensure);
        };
        call_function(before);

        console_log('load_script: requesting');
        var s = document.createElement('script');
        s.setAttribute('src', url);
        document.getElementsByTagName('head')[0].appendChild(s);

        requested = true;
        var time = 0;
        var id = setInterval(function () {
            console_log('load_script: retry #' + time);
            if (is_loaded()) {
                clearInterval(id);
                console_log('load_script: done');
                success();
                return;
            }
            ++time;
            if (time == 50) {
                clearInterval(id);
                console_log('load_script: giving up');
                failure();
                return;
            }
            console_log('load_script: waiting');
        }, 100);
        console_log('load_script: requested');
    }

    function call_function(f) {
        return typeof f == 'function' ? f() : null;
    }

    function console_log(msg) {
        if (debug) console.log(msg);
    }
})();</code></pre></p>
<p>The require_* functions could be made available from a central repository, so that you can find, copy and paste what you need. But going a bit forward, one could also make orderly support URIs like &#8216;ord://symbol:module/version&#8217; or &#8216;ord://symbol:host/module/version&#8217; like &#8216;ord://j:jquery/1.8.3&#8242; or &#8216;ord://j:jquery/modal/1.4.2&#8242;. They could be used like this:</p>
<p><pre><code class="javascript">orderly(
        'ord://j:jquery/1.8.3',
        'ord://j:jquery/modal/1.4.2',
        function() {
            payload(window.j);
        }
    );</code></pre></p>
<p>and because they are strings, they would not interfere with objects and functions. Execution will then be in two steps: first, request the definition object from the repository and, finally, request the script as specified by the definition object. This will be very similar to what Bundler does for Ruby.</p>
]]></content:encoded>
			<wfw:commentRss>http://noteslog.com/post/orderly-require-scripts-from-a-bookmarklet/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Content thieves</title>
		<link>http://noteslog.com/post/content-thieves/</link>
		<comments>http://noteslog.com/post/content-thieves/#comments</comments>
		<pubDate>Sat, 01 Sep 2012 00:55:43 +0000</pubDate>
		<dc:creator>Andrea Ercolino</dc:creator>
				<category><![CDATA[other]]></category>

		<guid isPermaLink="false">http://noteslog.com/?p=1670</guid>
		<description><![CDATA[From time to time I google &#8220;Login Dongle&#8221; to see if there are any new reviews of my plugin. Sometimes I find reviews stolen from others. That&#8217;s a common issue these days. But today, I&#8217;ve found a new breed of<span class="ellipsis">&#8230;</span><div class="read-more"><a href="http://noteslog.com/post/content-thieves/">Read more &#8250;</a></div><!-- end of .read-more -->]]></description>
				<content:encoded><![CDATA[<p>From time to time I google <a href="https://www.google.com/search?q=%22login+dongle%22+wordpress+-site:wordpress.org" target="_blank">&#8220;Login Dongle&#8221;</a> to see if there are any new reviews of <a href="http://wordpress.org/extend/plugins/login-dongle/" target="_blank">my plugin</a>.</p>
<p>Sometimes I find reviews stolen from others. That&#8217;s a <a href="https://www.google.com/search?q=stolen+content" target="_blank">common issue</a> these days.</p>
<p>But today, I&#8217;ve found a new breed of stolen content that deserves some attention.</p>
<blockquote style="overflow: hidden;"><p><a href="http://noteslog.com/blog/wp-content/uploads/2012/08/How-to-Improve-the-Security-of-your-WordPress-Blog.png" rel="lightbox[1670]" title="How to Improve the Security of your WordPress Blog"><img class="size-medium wp-image-1673 alignleft" title="How to Improve the Security of your WordPress Blog" src="http://noteslog.com/blog/wp-content/uploads/2012/08/How-to-Improve-the-Security-of-your-WordPress-Blog-74x300.png" alt="" width="74" height="300" /></a></p>
<p>original content<br />
<a href="http://www.labnol.org/internet/improve-wordpress-security/24639/" target="_blank">How to Improve the Security of your WordPress Blog</a><br />
published on 2012-08-07 by <a href="http://www.labnol.org/about/" target="_blank">Amit Agarwal<br />
</a></p>
<p>&nbsp;</p>
<p><a href="http://noteslog.com/blog/wp-content/uploads/2012/08/How-to-Secure-of-your-WordPress-Blog-Improving-Wordpress-Security.png" rel="lightbox[1670]" title="How to Secure of your WordPress Blog Improving WordPress Security"><img class="size-medium wp-image-1674 alignleft" title="How to Secure of your WordPress Blog Improving WordPress Security" src="http://noteslog.com/blog/wp-content/uploads/2012/08/How-to-Secure-of-your-WordPress-Blog-Improving-Wordpress-Security-61x300.png" alt="" width="61" height="300" /></a>stolen content<br />
<a href="http://www.techknot.com/1646/how-to-secure-your-wordpress-blog.html" target="_blank">How to Secure of your WordPress Blog: Improving WordPress Security<br />
</a>published on ??? by ???</p></blockquote>
<p>Usually, a thief steals content by (automatically) copying it from its original site to their own. You can easily <a href="https://www.google.com/search?q=&quot;This+plugin+takes+a+very+unique+approach+to+protect+your+WordPress.&quot;" target="_blank">find stolen content</a> by googling a short sentence of any post, between quotes. For example, today I see that that content has been stolen 355 times !!</p>
<p>But in this case the thief used substitutions, thus cleanly defeating the above search check. For example, let&#8217;s compare side by side the snippets that refer to my plugin in both versions of the content: original and stolen.</p>
<p>Here is the original version.</p>
<blockquote><p>This plugin takes a very unique approach to protect your WordPress. It generates a bookmarklet with a secret question that you can add to you bookmarks. While on the WordPress login page, enter you credentials and then press this bookmarklet to get into your WordPress – the button on the login screen won’t work.</p></blockquote>
<p>Here is the stolen one.</p>
<blockquote><p>This tool requires a very exclusive strategy to secure your WordPress. It produces a bookmarklet with a key query that you can add to you favorites. While on the WordPress sign in web page, get into you experience and then media this bookmarklet to get into your WordPress – the option on the sign in display will not perform.</p></blockquote>
<p>As you see, the stolen version has been obtained from the original one using these blind (i.e. automatic) substitutions:</p>
<table style="margin-left: 30px; width: 300px;">
<tbody>
<tr>
<td>plugin</td>
<td>tool</td>
</tr>
<tr>
<td>takes</td>
<td>requires</td>
</tr>
<tr>
<td>unique</td>
<td>exclusive</td>
</tr>
<tr>
<td>approach</td>
<td>strategy</td>
</tr>
<tr>
<td>protect</td>
<td>secure</td>
</tr>
<tr>
<td>generates</td>
<td>produces</td>
</tr>
<tr>
<td>secret</td>
<td><strong>key</strong></td>
</tr>
<tr>
<td>question</td>
<td><strong>query</strong></td>
</tr>
<tr>
<td>bookmarks</td>
<td>favorites</td>
</tr>
<tr>
<td>login</td>
<td>sign in</td>
</tr>
<tr>
<td>page</td>
<td>web page</td>
</tr>
<tr>
<td>enter</td>
<td><strong>get into</strong></td>
</tr>
<tr>
<td>credentials</td>
<td><strong>experience</strong></td>
</tr>
<tr>
<td>press</td>
<td><strong>media</strong></td>
</tr>
<tr>
<td>button</td>
<td><strong>option</strong></td>
</tr>
<tr>
<td>login</td>
<td>sign in</td>
</tr>
<tr>
<td>screen</td>
<td><strong>display</strong></td>
</tr>
<tr>
<td>won’t</td>
<td>will not</td>
</tr>
<tr>
<td>work</td>
<td>perform</td>
</tr>
</tbody>
</table>
<p>I&#8217;ve used bold to highlight substitutions that don&#8217;t work in the context.</p>
<p>There are two interesting reasons that explain why substitutions are highly effective for a thief even if they are not perfect.</p>
<p>The first is that the thief&#8217;s purpose is not to publish understandable news but it is to provide fresh content for their ads. And the second is that Google search engine finds substituted content too, so their ads get the same chances to get printed as the content they steal.</p>
<p>For example, in the results of the Login Dongle search, the original content appears at position 30 and the stolen one at 49. Not bad.</p>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://noteslog.com/post/content-thieves/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Fixing &#8220;uninitialized constant MysqlCompat::MysqlRes&#8221;</title>
		<link>http://noteslog.com/post/fixing-uninitialized-constant-mysqlcompatmysqlres/</link>
		<comments>http://noteslog.com/post/fixing-uninitialized-constant-mysqlcompatmysqlres/#comments</comments>
		<pubDate>Fri, 24 Aug 2012 21:11:24 +0000</pubDate>
		<dc:creator>Andrea Ercolino</dc:creator>
				<category><![CDATA[Fixing]]></category>

		<guid isPermaLink="false">http://noteslog.com/?p=1665</guid>
		<description><![CDATA[This is an old problem that affects an old Ruby gem: mysql (2.8.1). Apparently, it has a little bug somewhere that makes it look for a file in the wrong folder. I get this error always after installing a new app. The<span class="ellipsis">&#8230;</span><div class="read-more"><a href="http://noteslog.com/post/fixing-uninitialized-constant-mysqlcompatmysqlres/">Read more &#8250;</a></div><!-- end of .read-more -->]]></description>
				<content:encoded><![CDATA[<p>This is an old problem that affects an old Ruby gem: mysql (2.8.1). Apparently, it has a little bug somewhere that makes it look for a file in the wrong folder. I get this error always after installing a new app. The last time has been some minutes ago, after installing <a href="http://getontracks.org/downloads/comments/tracks-21/" target="_blank">TracksApp 2.1</a>, which is based on the old Rails 2.3.</p>
<p>The MySQL page about <a href="http://dev.mysql.com/doc/refman/5.5/en/apis-ruby.html" target="_blank">Ruby adapters</a> speaks about two of them. One called MySQL/Ruby, and the other (after a huge name creation effort)&#8230; Ruby/MySQL. They are respectively provided by the gems <a href="http://rubygems.org/gems/mysql" target="_blank">mysql (2.8.1)</a> and <a href="http://rubygems.org/gems/ruby-mysql" target="_blank">ruby-mysql (2.9.10)</a>. As you may have noticed, the first gem is the old version of the second. That is also confirmed by the dates they got updated, which is: 2.8.1, on 2009-08-21 and 2.9.10, on 2012-07-12.</p>
<p>Both adapters are authored by Tomita Masahiro. I do appreciate the effort he did, and his generosity in making them available to me, no doubt about that. But in my opinion, the name change was a mistake. I suppose he did it to tell the world they were two very different adapters (the old one C-based and the new one Ruby-based). Nonetheless, they really were two subsequent versions of the same thing.</p>
<p>The problem with TracksApp is exactly that. If Tomita Masahiro had stuck to the mysql name, then gem &#8220;mysql&#8221; in TracksApps would have referenced the latest version (what today is instead ruby-mysql) and all would have worked fine. But now, even with ruby-mysql installed, that gem requirement in TracksApp makes my system install the old mysql gem. That in turn makes Rails prefer mysql over ruby-mysql (why? lexical order?) and due to the known bug all my apps break.</p>
<p>My solution is to manually uninstall mysql each time it gets installed by some app. In fact I don&#8217;t know how to make my global Rails environment ignore mysql (2.8.1) even if some app requires it. I&#8217;ve tried with &#8220;bundle install &#8211;without mysql&#8221;, but mysql is a gem, not a group, so it does not work&#8230; My fix works because ruby-mysql perfectly replaces mysql and it&#8217;s just a drop-in, sharing the same adapter name (mysql).</p>
<p>Clearly, TracksApp is a new version of an old software, even if it is still based on Rails 2.3. If I was developing it, I&#8217;d have updated the Gemfile&#8230;</p>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://noteslog.com/post/fixing-uninitialized-constant-mysqlcompatmysqlres/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>How to remotely debug Rails in Apache + Passenger + RubyMine</title>
		<link>http://noteslog.com/post/how-to-remotely-debug-rails-in-apache-passenger-rubymine/</link>
		<comments>http://noteslog.com/post/how-to-remotely-debug-rails-in-apache-passenger-rubymine/#comments</comments>
		<pubDate>Thu, 23 Aug 2012 19:06:20 +0000</pubDate>
		<dc:creator>Andrea Ercolino</dc:creator>
				<category><![CDATA[other]]></category>

		<guid isPermaLink="false">http://noteslog.com/?p=1664</guid>
		<description><![CDATA[I&#8217;m now a Ruby on Rails programmer and the past week I&#8217;ve been frantically learning how to develop on my MacBook Air. My configuration Mac OS X Mountain Lion Xcode 4.4 Apache 2.2.22 MySQL 5.5.27 Phusion Passenger 3.0.15 Ruby 1.8.7 Rails<span class="ellipsis">&#8230;</span><div class="read-more"><a href="http://noteslog.com/post/how-to-remotely-debug-rails-in-apache-passenger-rubymine/">Read more &#8250;</a></div><!-- end of .read-more -->]]></description>
				<content:encoded><![CDATA[<p>I&#8217;m now a Ruby on Rails programmer and the past week I&#8217;ve been frantically learning how to develop on my MacBook Air.</p>
<h3>My configuration</h3>
<ol>
<li>Mac OS X Mountain Lion</li>
<li>Xcode 4.4</li>
<li>Apache 2.2.22</li>
<li>MySQL 5.5.27</li>
<li>Phusion Passenger 3.0.15</li>
<li>Ruby 1.8.7</li>
<li>Rails 2.3.12</li>
</ol>
<h3>My IDE</h3>
<p>I wanted an IDE like Zend Studio, whose remote debugging support for PHP I simply love.</p>
<p>After some research I bought a license for <a href="http://www.jetbrains.com/ruby/" target="_blank">RubyMine</a> 4.5, because I was impressed by its integration with Ruby and Rails and its excellent debugger.</p>
<p>Unfortunately, RubyMine&#8217;s offers remote <a href="http://www.jetbrains.com/ruby/features/ruby_debugger.html" target="_blank">debugging</a> configurations that (<a title="Dream remote debugging with the PassengerDebugger option" href="http://devnet.jetbrains.net/message/5466216" target="_blank">at the moment</a>) don&#8217;t allow to hook into a running instance. That means that you can&#8217;t remotely debug on your own application stack, unless your Rails server is run by a command line script.</p>
<p>Well&#8230; luckily enough, I&#8217;ve just found another way that allows me to remotely debug using my own stack.<br />
In fact, RubyMine&#8217;s local debugger does support <a title="Phusion Passenger Standalone users guide" href="http://www.modrails.com/documentation/Users%20guide%20Standalone.html" target="_blank">Passenger Standalone</a> as a Rails server, through a command line like this:</p>
<p><pre>/usr/bin/ruby /usr/bin/passenger start -a 0.0.0.0 -p 3000 --max-pool-size 1 --spawn-method conservative -e development</pre></p>
<p>in conjunction with the following file (config/initializers/rubymine_passenger_debug.rb)</p>
<p><pre># generated by RubyMine
debug_port = ENV['RUBYMINE_DEBUG_PORT']

if debug_port
  puts &quot;Preparing to launch debugger for #{$$}&quot;
  $:.push(*ENV['RUBYLIB'].split(&quot;:&quot;))
  require 'ruby-debug-ide'

  Debugger.cli_debug = (&quot;true&quot; == ENV['RUBYMINE_DEBUG_VERBOSE'])
  Debugger.start_server('127.0.0.1', debug_port.to_i)
end</pre></p>
<p>And it works like a charm.</p>
<h3>My method</h3>
<p>This example is based on the Notebook app created in the RubyMine tutorial <a href="http://tv.jetbrains.net/videocontent/discover-rubymine-in-a-few-simple-steps" target="_blank">Discover RubyMine in a Few Simple Steps</a>.</p>
<h4>(1/6) Edit /etc/hosts</h4>
<p>I make an alias in my Mac such that notebook.dev corresponds to 127.0.0.1 (localhost).</p>
<p><pre>#...
127.0.0.1    notebook.dev</pre></p>
<h4>(2/6) Edit &#8230;/apache2/extra/httpd-vhosts.conf</h4>
<p>I make a virtual host for my &#8220;remote&#8221; development site. Note that the notebook folder is under Sites. On the other hand, my &#8220;local&#8221; development site will be under RubymineProjects. To synch them you need to deploy, i.e. delete the notebook folder in Sites and copy again there the one in RubymineProjects.</p>
<p><pre>#...
NameVirtualHost *:80

&lt;VirtualHost *:80&gt;
    # this is the default entry !!!
    ServerName localhost
&lt;/VirtualHost&gt;

&lt;VirtualHost *:80&gt;
    ServerName notebook.dev
    ServerAlias www.notebook.dev
    
    ServerAdmin cappuccino.e.cornetto@gmail.com
    ErrorLog &quot;/private/var/log/apache2/notebook.dev-error_log&quot;
    CustomLog &quot;/private/var/log/apache2/notebook.dev-access_log&quot; common

    DocumentRoot &quot;/Users/andrea/Sites/notebook/public&quot;
    &lt;Directory &quot;/Users/andrea/Sites/notebook/public&quot;&gt;
        # This relaxes Apache security settings.
        AllowOverride all
        # MultiViews must be turned off.
        Options -MultiViews
    &lt;/Directory&gt;
&lt;/VirtualHost&gt;</pre></p>
<h4>(3/6) Edit &#8230;/apache2/httpd.conf</h4>
<p>This is where Passenger is configured into Apache. I configure my instance like RubyMine does when it starts Passenger Standalone for local debugging. This is a minor drawback&#8230; I think I can live with it + remote debugging.</p>
<p><pre>#...
LoadModule passenger_module /Library/Ruby/Gems/1.8/gems/passenger-3.0.15/ext/apache2/mod_passenger.so
   PassengerRoot /Library/Ruby/Gems/1.8/gems/passenger-3.0.15
   PassengerRuby /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby
   
   # when RubyMine executes Passenger Standalone for debugging, these are the settings...
   PassengerMaxPoolSize 1
   PassengerSpawnMethod conservative
   SetEnv RAILS_ENV development

#...</pre></p>
<h4>(4/6) Create &#8230;/notebook/lib/tasks/rdebug.rake</h4>
<p>I create a simple rake task to start the server with debugging enabled.</p>
<p><pre>task :rdebug do
  system(&quot;touch tmp/restart.txt&quot;)
  system(&quot;touch tmp/debug.txt&quot;)
end</pre></p>
<h4>(5/6) Add RubyMine &#8211; Run/Debug Configurations &#8211; Ruby remote debug</h4>
<p>I add a new <a href="http://www.jetbrains.com/ruby/webhelp/run-debug-configuration-ruby-remote-debug.html" target="_blank">Ruby remote debug</a> configuration. Remote host is the IP of my &#8220;remote&#8221; development site. The remote port can be any that is not already used. The local port is decided by the dialog box, so you&#8217;ll have a different number each time you add a new configuration. Remote and local root folders must match the same app tree such that the mapping works when debugging.</p>
<p><a href="http://noteslog.com/blog/wp-content/uploads/2012/08/Screen-Shot-2012-08-23-at-18.02.52.png" rel="lightbox[1664]" title="Screen Shot 2012-08-23 at 18.02.52"><img class="alignnone size-full wp-image-1667" title="Screen Shot 2012-08-23 at 18.02.52" src="http://noteslog.com/blog/wp-content/uploads/2012/08/Screen-Shot-2012-08-23-at-18.02.52.png" alt="" width="648" height="390" /></a></p>
<h4>(6/6) Edit &#8230;/notebook/config/environments/development.rb</h4>
<p>I add this block at the end of my development configuration. It is the keystone. Note that remote_host and remote_port must match the corresponding values in the Ruby remote debug configuration.</p>
<p><pre>#...
remote_host = '127.0.0.1'
remote_port = 7000

debug_flag = File.join(RAILS_ROOT, 'tmp', 'debug.txt')
if File.exists?(debug_flag)
  
  require 'ruby-debug-ide'
  Debugger.start_server(remote_host, remote_port)

  File.delete(debug_flag)
end</pre></p>
<h3>Debug sequence</h3>
<p>This is the sequence I use for remote debugging. Apart from the first step, the rest is the same used for local debugging.</p>
<ol>
<li>From a Terminal window: rake rdebug</li>
<li>From RubyMine &#8211; (notebook) Debug</li>
<li>From the browser &#8211; Reload a page and hit a breakpoint</li>
<li>RubyMine gets the focus and waits for you to debug</li>
</ol>
<div></div>
<p><a href="http://noteslog.com/blog/wp-content/uploads/2012/08/Screen-Shot-2012-08-23-at-21.02.37.png" rel="lightbox[1664]" title="Screen Shot 2012-08-23 at 21.02.37"><img class="alignnone size-full wp-image-1668" title="Screen Shot 2012-08-23 at 21.02.37" src="http://noteslog.com/blog/wp-content/uploads/2012/08/Screen-Shot-2012-08-23-at-21.02.37.png" alt="" width="959" height="655" /></a></p>
<p>And it works like a charm.</p>
]]></content:encoded>
			<wfw:commentRss>http://noteslog.com/post/how-to-remotely-debug-rails-in-apache-passenger-rubymine/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to neatly deploy with Git on OSX and Linux</title>
		<link>http://noteslog.com/post/how-to-neatly-deploy-with-git-on-osx-and-linux/</link>
		<comments>http://noteslog.com/post/how-to-neatly-deploy-with-git-on-osx-and-linux/#comments</comments>
		<pubDate>Fri, 25 May 2012 22:34:20 +0000</pubDate>
		<dc:creator>Andrea Ercolino</dc:creator>
				<category><![CDATA[Fixing]]></category>

		<guid isPermaLink="false">http://noteslog.com/?p=1660</guid>
		<description><![CDATA[First and foremost, let me apologize if you got here by a misleading title. I always strive to find a good title for my posts but this time I&#8217;m not satisfied. This post is about my specific needs in the<span class="ellipsis">&#8230;</span><div class="read-more"><a href="http://noteslog.com/post/how-to-neatly-deploy-with-git-on-osx-and-linux/">Read more &#8250;</a></div><!-- end of .read-more -->]]></description>
				<content:encoded><![CDATA[<p>First and foremost, let me apologize if you got here by a misleading title. I always strive to find a good title for my posts but this time I&#8217;m not satisfied. This post is about my specific needs in the described scenario, and I decided to publish it mainly for my own record. Unfortunately, a more precise title would have had an unfeasible length.</p>
<p>Lately I&#8217;ve been making changes to a web project I had downloaded to my Mac from a Linux server provided by 1and1. My<strong> first mistake</strong> was to use FTP on the root tree. Even if I have a 50 Mb connection at home, it was a never ending task. After hours waiting for the download to complete, I found out that both FileZilla and Cyberduck had problems with some filenames.</p>
<p>Then I discovered that 1and1 has a file manager in the admin interface that allows you to make a zip. My<strong> second mistake</strong> was to think that the feature would work as advertised. That was not the case. Apparently you can select many files and directories at once an compress them to a zip file by means of a button. The button pops up a second window from where you can choose the filename. When you accept, it starts working, and working, and working, up to when it exhausts the time allowed for running the task (15 minutes, I think).</p>
<p>I made two wrong assumptions here really: first that selecting multiple files had an effect on the subsequent operation and second that the button would do it. Luckily for me, I discovered that if I selected just one file or directory and used the compress option from its contextual menu, it worked fine. It took some time to compress about 500 MB but the resulting file took merely a bunch of seconds to download by FTP.</p>
<p>I started making my changes to the code and testing them on localhost. Meanwhile, also the remote web tree was changing because users were uploading to and deleting files from the web. (If I make a web, code and data are clearly set apart, such that a trunk cannot branch without control. But this is not a web I made, and the code is so weird and highly duplicated that I understand it with some difficulty.)</p>
<p>It was at that point in time when I discovered that 1and1 had Git installed and ssh was available. So I realized Git could help me deploy changes from my development environment back to the production environment with minimum downtime. I wanted to be able to move changes the other way around too, for example to get new data files. My <strong>third mistake</strong> was to think that I could do all of it with a production repo cloned to a development repo. Unfortunately, Git (by default) don&#8217;t allow to push to a standard (non-bare) repo. Neither could I easily pull from the development repo to the production repo, because of my dynamic IP at home.</p>
<p>I understood that I needed three repos: a development repo, a production repo, and a proxy, internet-reachable, bare repo. Not only I had to find a place for the proxy repo but it also needed to exist before the other two, so that I could clone them from it. The problem I faced was that the website was already fully deployed right into the htdocs directory and 1and1 didn&#8217;t allow me to write outside. Thank Git, a clone is equal to each other (mostly) and .gitignore is very effective, so I solved it like this:</p>
<ol>
<li>init a production repo into htdocs</li>
<li>add /bare.git/ to htdocs/.gitignore</li>
<li>commit anything (to the production repo)</li>
<li>bare-clone the production repo (htdocs/.git) to the proxy repo (htdocs/bare.git)</li>
<li>reverse the clone relationship between both repos</li>
</ol>
<p>I know it&#8217;s weird but works like a charm.</p>
<p><pre>$ cd /&lt;path&gt;/htdocs
$ git init
$ cat &gt; .gitignore

/bare.git/&lt;CTRL+D&gt;

$ git commit -a -m &quot;initial files&quot;
$ git clone --bare -l ./ ./bare.git
$ cd bare.git
$ git remote rm origin
$ cd ..
$ git remote add origin /&lt;path&gt;/htdocs/bare.git
$ git config branch.master.remote origin
$ git config branch.master.merge refs/heads/master</pre></p>
<p>After cloning the proxy repo to the development repo I could push and pull without any issue, but my <strong>fourth mistake</strong> was to think that all was nearly done. Instead UTF-8 filenames were my next headache because git status detected all those files as untracked. I tried hard to solve that issue, but in the end I decided just to work around it by committing those untracked files again.</p>
<p><pre>$ git status
# On branch master
# Your branch is ahead of 'origin/master' by 1 commit.
#
# Untracked files:
#   (use &quot;git add &lt;file&gt;...&quot; to include in what will be committed)
#
#   .gitignore
#   &quot;.../1... Foz d'Iguac\314\247u 2010.doc&quot;
</pre></p>
<div>
<p><pre>$ git add &quot;.../1... Foz d'Iguac\314\247u 2010.doc&quot;
fatal: pathspec '.../1... Foz d'Iguac\314\247u 2010.doc' did not match any files</pre></p>
<div>
<p><pre>$ git add &quot;.../1... Foz d'Iguaçu 2010.doc&quot;
$ git status
# On branch master
# Your branch is ahead of 'origin/master' by 1 commit.
#
# Changes to be committed:
#   (use &quot;git reset HEAD &lt;file&gt;...&quot; to unstage)
#
#   new file:   &quot;.../1... Foz d'Iguac\314\247u 2010.doc&quot;</pre></p>
<p>One of the problems is that Git/OSX is showing escaped filenames in the output of git status, but it wants them added unescaped. After adding, committing and pushing those files I got this from Cyberduck (I only clipped the same confidential data from all the lines):</p>
</div>
</div>
<p><a href="http://noteslog.com/blog/wp-content/uploads/2012/05/Screen-shot-2012-05-25-at-14.38.41.png" rel="lightbox[1660]" title="Screen shot 2012-05-25 at 14.38.41"><img class="alignnone size-full wp-image-1661" title="Screen shot 2012-05-25 at 14.38.41" src="http://noteslog.com/blog/wp-content/uploads/2012/05/Screen-shot-2012-05-25-at-14.38.41.png" alt="" width="580" height="120" /></a></p>
<p>Mirrored copies of the same files, also with the same filenames! Oh, that&#8217;s weird! Of course they have different encodings.</p>
<p>Git/Linux and Git/OSX work perfectly well inside their respective operating systems with UTF-8 filenames but as soon as you cross the border of a system, issues arise. Linux and OSX support UTF-8 filenames differently. I think Git is to blame because it should offer a state of the art layer for supporting a <em>distributed VCS</em>. I read something about it being fixed in a new version, but I cannot install anything on the remote Linux machine to test it.</p>
<p>Even after all of the above, at some point (I do not remember how it happened) git status kept showing again the pathspec error. So I completely removed all the data files directories from Git and added them to .gitignore. That solved all the issues&#8230; hopefully.</p>
]]></content:encoded>
			<wfw:commentRss>http://noteslog.com/post/how-to-neatly-deploy-with-git-on-osx-and-linux/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Testing my WordPress for Android</title>
		<link>http://noteslog.com/post/testing-my-wordpress-for-android/</link>
		<comments>http://noteslog.com/post/testing-my-wordpress-for-android/#comments</comments>
		<pubDate>Tue, 15 May 2012 18:39:00 +0000</pubDate>
		<dc:creator>Andrea Ercolino</dc:creator>
				<category><![CDATA[other]]></category>

		<guid isPermaLink="false">http://noteslog.com/?p=1657</guid>
		<description><![CDATA[I got this special build, just for me for now, with a fix that allows me to provide the endpoint for XML-RPC access. So the next version of my Login Dongle plugin is going to work for Android app too.<span class="ellipsis">&#8230;</span><div class="read-more"><a href="http://noteslog.com/post/testing-my-wordpress-for-android/">Read more &#8250;</a></div><!-- end of .read-more -->]]></description>
				<content:encoded><![CDATA[<p>I got this special build, just for me for now, with a fix that allows me to provide the endpoint for XML-RPC access. So the next version of my Login Dongle plugin is going to work for Android app too. I want to thank here the devs of this app that found a fix in no time, less than a day !!</p>
]]></content:encoded>
			<wfw:commentRss>http://noteslog.com/post/testing-my-wordpress-for-android/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
