<?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>Roman&#039;s tech blog</title>
	<atom:link href="http://blog.gugl.org/feed" rel="self" type="application/rss+xml" />
	<link>http://blog.gugl.org</link>
	<description>ruby, perl and other stuff</description>
	<lastBuildDate>Sat, 25 Jun 2011 20:33:32 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>Monit and Phusion Passenger</title>
		<link>http://blog.gugl.org/archives/120</link>
		<comments>http://blog.gugl.org/archives/120#comments</comments>
		<pubDate>Fri, 29 Apr 2011 22:21:24 +0000</pubDate>
		<dc:creator>Roman</dc:creator>
				<category><![CDATA[integration]]></category>
		<category><![CDATA[Rails]]></category>
		<category><![CDATA[monit]]></category>
		<category><![CDATA[passenger]]></category>

		<guid isPermaLink="false">http://blog.gugl.org/?p=120</guid>
		<description><![CDATA[While there&#8217;re multiple tools available for monitoring, ranging from Dan Bernshtein&#8217;s daemontools to God, I found that Monit is a pretty balanced solution. On one hand, it&#8217;s quite powerful, and on the other &#8211; it&#8217;s not resource hungry. The only drawback that I found, is that for monitoring a process, the process must have a [...]]]></description>
			<content:encoded><![CDATA[<p>While there&#8217;re multiple tools available for monitoring, ranging from Dan Bernshtein&#8217;s <a href="http://cr.yp.to/daemontools.html">daemontools</a> to <a href="http://god.rubyforge.org/">God</a>, I found that <a href="http://mmonit.com/monit/">Monit</a> is a pretty balanced solution. On one hand, it&#8217;s quite powerful, and on the other &#8211; it&#8217;s not resource hungry. The only drawback that I found, is that for monitoring a process, the process must have a pid-file saved somewhere. The Monit FAQ states that the programs which don&#8217;t have pid-file support should be run with some wrapper which will create it on their behalf.</p>
<p>I wanted to use Monit to monitor Rails&#8217; instances, so if they grow too fat, Monit will take care of that. The problem is that the pid file that the <a href="http://www.modrails.com/">Passenger</a> creates a) doesn&#8217;t have a predictable location (there&#8217;s something called &#8220;generation&#8221; or something like that), and b) doesn&#8217;t have children, as those processes are detached.</p>
<p>Of course there exists a possibility of patching Passenger for providing such pid files. But, luckily, Passenger provides extension points in form of callbacks which are fired when the application instance is created and when it&#8217;s taken down.</p>
<p>It was trivial to use this API to provide pid-file managing. The result of this work was the &#8220;passenger_monit&#8221; plugin.</p>
<p>So, go ahead, add &#8216;gem &#8220;passenger_monit&#8221;&#8216; to your Gemfile and give it a try!</p>
<p>The source is available from:<br />
<a href="https://github.com/romanbsd/passenger_monit">https://github.com/romanbsd/passenger_monit</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.gugl.org/archives/120/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title></title>
		<link>http://blog.gugl.org/archives/114</link>
		<comments>http://blog.gugl.org/archives/114#comments</comments>
		<pubDate>Tue, 05 Apr 2011 09:46:54 +0000</pubDate>
		<dc:creator>Roman</dc:creator>
				<category><![CDATA[Rails]]></category>
		<category><![CDATA[Ruby]]></category>
		<category><![CDATA[logging]]></category>

		<guid isPermaLink="false">http://blog.gugl.org/?p=114</guid>
		<description><![CDATA[Logging line numbers in Ruby Logger can be done with a simple decorator: class LoggerDecorator def initialize&#40;logger&#41; @logger = logger end &#160; %w&#123;debug info warn error fatal&#125;.each do &#124;method&#124; eval&#40;&#60;&#60;-eomethod&#41; def #{method}(msg) @logger.#{method}(position) {msg} end eomethod end &#160; private def position caller.at&#40;1&#41;.sub&#40;%r&#123;.*/&#125;,''&#41;.sub&#40;%r&#123;:in\s.*&#125;,''&#41; end end]]></description>
			<content:encoded><![CDATA[<p>Logging line numbers in Ruby Logger can be done with a simple decorator:</p>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;">  <span style="color:#9966CC; font-weight:bold;">class</span> LoggerDecorator
    <span style="color:#9966CC; font-weight:bold;">def</span> initialize<span style="color:#006600; font-weight:bold;">&#40;</span>logger<span style="color:#006600; font-weight:bold;">&#41;</span>
      <span style="color:#0066ff; font-weight:bold;">@logger</span> = logger
    <span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
    <span style="color:#006600; font-weight:bold;">%</span>w<span style="color:#006600; font-weight:bold;">&#123;</span>debug info warn error fatal<span style="color:#006600; font-weight:bold;">&#125;</span>.<span style="color:#9900CC;">each</span> <span style="color:#9966CC; font-weight:bold;">do</span> <span style="color:#006600; font-weight:bold;">|</span>method<span style="color:#006600; font-weight:bold;">|</span>
      <span style="color:#CC0066; font-weight:bold;">eval</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&lt;&lt;-</span>eomethod<span style="color:#006600; font-weight:bold;">&#41;</span>
        <span style="color:#9966CC; font-weight:bold;">def</span> <span style="color:#008000; font-style:italic;">#{method}(msg)</span>
          <span style="color:#0066ff; font-weight:bold;">@logger</span>.<span style="color:#008000; font-style:italic;">#{method}(position) {msg}</span>
        <span style="color:#9966CC; font-weight:bold;">end</span>
      eomethod
    <span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
    private
    <span style="color:#9966CC; font-weight:bold;">def</span> position
      <span style="color:#CC0066; font-weight:bold;">caller</span>.<span style="color:#9900CC;">at</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006666;">1</span><span style="color:#006600; font-weight:bold;">&#41;</span>.<span style="color:#CC0066; font-weight:bold;">sub</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">%</span>r<span style="color:#006600; font-weight:bold;">&#123;</span>.<span style="color:#006600; font-weight:bold;">*/</span><span style="color:#006600; font-weight:bold;">&#125;</span>,<span style="color:#996600;">''</span><span style="color:#006600; font-weight:bold;">&#41;</span>.<span style="color:#CC0066; font-weight:bold;">sub</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">%</span>r<span style="color:#006600; font-weight:bold;">&#123;</span>:<span style="color:#9966CC; font-weight:bold;">in</span>\s.<span style="color:#006600; font-weight:bold;">*</span><span style="color:#006600; font-weight:bold;">&#125;</span>,<span style="color:#996600;">''</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></div></div>

]]></content:encoded>
			<wfw:commentRss>http://blog.gugl.org/archives/114/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>MongoDB DLR support for Kannel</title>
		<link>http://blog.gugl.org/archives/111</link>
		<comments>http://blog.gugl.org/archives/111#comments</comments>
		<pubDate>Sun, 03 Apr 2011 20:26:11 +0000</pubDate>
		<dc:creator>Roman</dc:creator>
				<category><![CDATA[integration]]></category>
		<category><![CDATA[kannel]]></category>
		<category><![CDATA[mongodb]]></category>

		<guid isPermaLink="false">http://blog.gugl.org/?p=111</guid>
		<description><![CDATA[I wrote some code to make use of MongoDB as a DLR storage for Kannel SMS gateway. The code is available on github: https://github.com/romanbsd/kannel-mongodb]]></description>
			<content:encoded><![CDATA[<p>I wrote some code to make use of MongoDB as a DLR storage for Kannel SMS gateway.</p>
<p>The code is available on github:<br />
<a href="https://github.com/romanbsd/kannel-mongodb">https://github.com/romanbsd/kannel-mongodb</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.gugl.org/archives/111/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>ExtJS with Rails 3</title>
		<link>http://blog.gugl.org/archives/106</link>
		<comments>http://blog.gugl.org/archives/106#comments</comments>
		<pubDate>Sun, 06 Mar 2011 10:37:41 +0000</pubDate>
		<dc:creator>Roman</dc:creator>
				<category><![CDATA[extjs]]></category>
		<category><![CDATA[integration]]></category>
		<category><![CDATA[Rails]]></category>

		<guid isPermaLink="false">http://blog.gugl.org/?p=106</guid>
		<description><![CDATA[In order to make ExtJS play nicely with Rails, the following tweaks are needed: On the ExtJS javascript side, the following things are needed: 1. Ask server to server JSON: Ext.Ajax.defaultHeaders = &#123;'Accept': 'application/json'&#125;; 2. RailsJsonStore: Ext.data.RailsJsonStore = Ext.extend&#40;Ext.data.JsonStore, &#123; constructor: function&#40;config&#41; &#123; Ext.data.RailsJsonStore.superclass.constructor.call&#40;this, Ext.applyIf&#40;config, &#123; messageProperty: 'message', //for store.reader.getMessage() restful: true, url: '/'+ config&#91;'root'&#93; [...]]]></description>
			<content:encoded><![CDATA[<p>In order to make ExtJS play nicely with Rails, the following tweaks are needed:</p>
<p>On the ExtJS javascript side, the following things are needed:</p>
<p>1. Ask server to server JSON:</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">Ext.<span style="color: #660066;">Ajax</span>.<span style="color: #660066;">defaultHeaders</span> <span style="color: #339933;">=</span> <span style="color: #009900;">&#123;</span><span style="color: #3366CC;">'Accept'</span><span style="color: #339933;">:</span> <span style="color: #3366CC;">'application/json'</span><span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span></pre></div></div>

<p>2. RailsJsonStore:</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">Ext.<span style="color: #660066;">data</span>.<span style="color: #660066;">RailsJsonStore</span> <span style="color: #339933;">=</span> Ext.<span style="color: #660066;">extend</span><span style="color: #009900;">&#40;</span>Ext.<span style="color: #660066;">data</span>.<span style="color: #660066;">JsonStore</span><span style="color: #339933;">,</span> <span style="color: #009900;">&#123;</span>
    constructor<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>config<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        Ext.<span style="color: #660066;">data</span>.<span style="color: #660066;">RailsJsonStore</span>.<span style="color: #660066;">superclass</span>.<span style="color: #660066;">constructor</span>.<span style="color: #660066;">call</span><span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span><span style="color: #339933;">,</span> Ext.<span style="color: #660066;">applyIf</span><span style="color: #009900;">&#40;</span>config<span style="color: #339933;">,</span> <span style="color: #009900;">&#123;</span>
            messageProperty<span style="color: #339933;">:</span> <span style="color: #3366CC;">'message'</span><span style="color: #339933;">,</span> <span style="color: #006600; font-style: italic;">//for store.reader.getMessage()</span>
            restful<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">true</span><span style="color: #339933;">,</span>
            url<span style="color: #339933;">:</span> <span style="color: #3366CC;">'/'</span><span style="color: #339933;">+</span> config<span style="color: #009900;">&#91;</span><span style="color: #3366CC;">'root'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">+</span> <span style="color: #3366CC;">'s'</span><span style="color: #339933;">,</span>
            writer<span style="color: #339933;">:</span> <span style="color: #009900;">&#123;</span>encode<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">false</span><span style="color: #009900;">&#125;</span>
        <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
Ext.<span style="color: #660066;">reg</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'railsjsonstore'</span><span style="color: #339933;">,</span> Ext.<span style="color: #660066;">data</span>.<span style="color: #660066;">RailsJsonStore</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>3. XSRF protection:</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">Ext.<span style="color: #660066;">Ajax</span>.<span style="color: #660066;">on</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'beforerequest'</span><span style="color: #339933;">,</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>o<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #003366; font-weight: bold;">var</span> csrf <span style="color: #339933;">=</span> Ext.<span style="color: #660066;">select</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;meta[name='csrf-token']&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">first</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>csrf<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
                o.<span style="color: #660066;">defaultHeaders</span> <span style="color: #339933;">=</span> Ext.<span style="color: #660066;">apply</span><span style="color: #009900;">&#40;</span>o.<span style="color: #660066;">defaultHeaders</span> <span style="color: #339933;">||</span> <span style="color: #009900;">&#123;</span><span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span> <span style="color: #009900;">&#123;</span><span style="color: #3366CC;">'X-CSRF-Token'</span><span style="color: #339933;">:</span> csrf.<span style="color: #660066;">getAttribute</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'content'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>On Rails side:</p>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;">config.<span style="color:#9900CC;">active_record</span>.<span style="color:#9900CC;">include_root_in_json</span> = <span style="color:#0000FF; font-weight:bold;">false</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://blog.gugl.org/archives/106/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Livejournal ruby gem</title>
		<link>http://blog.gugl.org/archives/102</link>
		<comments>http://blog.gugl.org/archives/102#comments</comments>
		<pubDate>Mon, 22 Nov 2010 23:18:07 +0000</pubDate>
		<dc:creator>Roman</dc:creator>
				<category><![CDATA[Ruby]]></category>
		<category><![CDATA[livejournal]]></category>

		<guid isPermaLink="false">http://blog.gugl.org/?p=102</guid>
		<description><![CDATA[I forked the livejournal ruby gem (http://neugierig.org/software/livejournal/ruby/) which seems to be abandoned. It fixes the well known errors like: livejournal/entry.rb:174:in `load_prop': unknown prop which are due to new properties. It also has some new functionality. The fork can be found here. I tried to contact the author, but haven&#8217;t heard from him yet.]]></description>
			<content:encoded><![CDATA[<p>I forked the livejournal ruby gem (<a href="http://neugierig.org/software/livejournal/ruby/">http://neugierig.org/software/livejournal/ruby/</a>) which seems to be abandoned.<br />
It fixes the well known errors like:</p>
<pre>livejournal/entry.rb:174:in `load_prop': unknown prop</pre>
<p>which are due to new properties.<br />
It also has some new functionality.<br />
The fork can be found <a href="https://github.com/romanbsd/livejournal">here</a>.<br />
I tried to contact the author, but haven&#8217;t heard from him yet.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.gugl.org/archives/102/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Objective-C library for MusiXmatch API</title>
		<link>http://blog.gugl.org/archives/97</link>
		<comments>http://blog.gugl.org/archives/97#comments</comments>
		<pubDate>Tue, 28 Sep 2010 11:44:02 +0000</pubDate>
		<dc:creator>Roman</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://blog.gugl.org/?p=97</guid>
		<description><![CDATA[There&#8217;s a new cool startup called MusiXmatch which provides an easy access to lyrics. They already have tons of lyrics and they recently opened their API to the alpha testers. I wrote a basic library for accessing this service. While it&#8217;s incomplete, it already provides the most often used functionality such as searching for tracks [...]]]></description>
			<content:encoded><![CDATA[<p>There&#8217;s a new cool startup called MusiXmatch which provides an easy access to lyrics.<br />
They already have tons of lyrics and they recently opened their API to the alpha testers.<br />
I wrote a basic library for accessing this service. While it&#8217;s incomplete, it already provides the most often used functionality such as searching for tracks and getting lyrics.<br />
Example usage:</p>

<div class="wp_syntax"><div class="code"><pre class="objc" style="font-family:monospace;"><span style="color: #11740a; font-style: italic;">// Get a track</span>
Track <span style="color: #002200;">*</span>track <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span>Track trackWithId<span style="color: #002200;">:</span><span style="color: #2400d9;">123</span><span style="color: #002200;">&#93;</span>;
<span style="color: #400080;">NSString</span> <span style="color: #002200;">*</span>lyrics <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span>track lyrics<span style="color: #002200;">&#93;</span>;
&nbsp;
<span style="color: #11740a; font-style: italic;">// Or use the service directly</span>
MusiXmatchService <span style="color: #002200;">*</span>service <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span>MusiXmatchService sharedInstance<span style="color: #002200;">&#93;</span>;
<span style="color: #400080;">NSArray</span> <span style="color: #002200;">*</span>tracks <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span>service trackSearch<span style="color: #002200;">:</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;dreamer&quot;</span> numResults<span style="color: #002200;">:</span><span style="color: #2400d9;">10</span><span style="color: #002200;">&#93;</span>;
<span style="color: #a61390;">for</span> <span style="color: #002200;">&#40;</span>Track <span style="color: #002200;">*</span>track <span style="color: #a61390;">in</span> tracks<span style="color: #002200;">&#41;</span> <span style="color: #002200;">&#123;</span>
    NSLog<span style="color: #002200;">&#40;</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;TrackID: %u, Artist: %@, Title: %@&quot;</span>, track.mxmId, track.artist.name, track.name<span style="color: #002200;">&#41;</span>;
<span style="color: #002200;">&#125;</span></pre></div></div>

<p>Get it here:</p>
<p>http://github.com/romanbsd/musiXmatch</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.gugl.org/archives/97/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Cross compiling autoconf packages for iPhone</title>
		<link>http://blog.gugl.org/archives/91</link>
		<comments>http://blog.gugl.org/archives/91#comments</comments>
		<pubDate>Thu, 17 Jun 2010 12:19:33 +0000</pubDate>
		<dc:creator>Roman</dc:creator>
				<category><![CDATA[iPhone]]></category>

		<guid isPermaLink="false">http://blog.gugl.org/?p=91</guid>
		<description><![CDATA[While the MacOS X iPhone Developer package contains the needed cross-compiling tools, I haven&#8217;t found anywhere a clear explanation regarding how the environment should be set for compiling some standard autoconf/automake package. I&#8217;m using the following script (works on the XCode 3.2.2 on Snow Leopard): #!/bin/sh export CPP=&#34;/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/arm-apple-darwin10-gcc-4.2.1 -E&#34; export CC=&#34;/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/arm-apple-darwin10-gcc-4.2.1&#34; export CXX=&#34;/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/arm-apple-darwin10-g++-4.2.1&#34; &#160; export [...]]]></description>
			<content:encoded><![CDATA[<p>While the MacOS X iPhone Developer package contains the needed cross-compiling tools, I haven&#8217;t found anywhere a clear explanation regarding how the environment should be set for compiling some standard autoconf/automake package.<br />
I&#8217;m using the following script (works on the XCode 3.2.2 on Snow Leopard):</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#!/bin/sh</span>
<span style="color: #7a0874; font-weight: bold;">export</span> <span style="color: #007800;">CPP</span>=<span style="color: #ff0000;">&quot;/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/arm-apple-darwin10-gcc-4.2.1 -E&quot;</span>
<span style="color: #7a0874; font-weight: bold;">export</span>  <span style="color: #007800;">CC</span>=<span style="color: #ff0000;">&quot;/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/arm-apple-darwin10-gcc-4.2.1&quot;</span>
<span style="color: #7a0874; font-weight: bold;">export</span> <span style="color: #007800;">CXX</span>=<span style="color: #ff0000;">&quot;/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/arm-apple-darwin10-g++-4.2.1&quot;</span>
&nbsp;
<span style="color: #7a0874; font-weight: bold;">export</span> <span style="color: #007800;">CPPFLAGS</span>=<span style="color: #ff0000;">'-I/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS3.1.sdk/usr/lib/gcc/arm-apple-darwin10/4.2.1/include -I/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS3.1.sdk/usr/include'</span>
<span style="color: #7a0874; font-weight: bold;">export</span> <span style="color: #007800;">LDFLAGS</span>=<span style="color: #ff0000;">&quot;-L/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS3.1.sdk/usr/lib&quot;</span>
<span style="color: #7a0874; font-weight: bold;">export</span> <span style="color: #007800;">CFLAGS</span>=<span style="color: #ff0000;">&quot;-Os -pipe <span style="color: #007800;">$CPPFLAGS</span> <span style="color: #007800;">$LDFLAGS</span>&quot;</span>
<span style="color: #7a0874; font-weight: bold;">export</span> <span style="color: #007800;">CXXFLAGS</span>=<span style="color: #ff0000;">&quot;<span style="color: #007800;">$CFLAGS</span>&quot;</span>
&nbsp;
<span style="color: #7a0874; font-weight: bold;">export</span> <span style="color: #007800;">PATH</span>=<span style="color: #ff0000;">&quot;/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin:/bin:/usr/bin&quot;</span>
&nbsp;
<span style="color: #7a0874; font-weight: bold;">export</span> <span style="color: #007800;">ARCH</span>=arm-apple-darwin10
&nbsp;
.<span style="color: #000000; font-weight: bold;">/</span>configure <span style="color: #660033;">--build</span>=i386-apple-darwin10 <span style="color: #660033;">--host</span>=<span style="color: #007800;">$ARCH</span> <span style="color: #660033;">--enable-shared</span>=no <span style="color: #660033;">--prefix</span>=<span style="color: #000000; font-weight: bold;">/</span>usr $<span style="color: #000000; font-weight: bold;">@</span></pre></div></div>

<p>And then either use the resulting library, or add the source files alongside the generated config.h</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.gugl.org/archives/91/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Using curb with open-uri</title>
		<link>http://blog.gugl.org/archives/89</link>
		<comments>http://blog.gugl.org/archives/89#comments</comments>
		<pubDate>Wed, 18 Feb 2009 11:43:28 +0000</pubDate>
		<dc:creator>Roman</dc:creator>
				<category><![CDATA[Ruby]]></category>
		<category><![CDATA[web]]></category>
		<category><![CDATA[curb]]></category>
		<category><![CDATA[curl]]></category>
		<category><![CDATA[libcurl]]></category>
		<category><![CDATA[open-uri]]></category>

		<guid isPermaLink="false">http://blog.gugl.org/?p=89</guid>
		<description><![CDATA[Simple, but nice replacement for open-uri library (which uses rather slow Net::HTTP library) which uses libcurl (via curb). It&#8217;s easy to swap the original one just by replacing &#8216;require open-uri&#8217; with &#8216;require curb-openuri&#8217;. Should work as the original, even with better defaults (which, of course, can be changed). http://github.com/romanbsd/curb-openuri/tree]]></description>
			<content:encoded><![CDATA[<p>Simple, but nice replacement for open-uri library (which uses rather slow Net::HTTP library) which uses libcurl (via curb).<br />
It&#8217;s easy to swap the original one just by replacing &#8216;require open-uri&#8217; with &#8216;require curb-openuri&#8217;. Should work as the original, even with better defaults (which, of course, can be changed).</p>
<p><a href="http://github.com/romanbsd/curb-openuri/tree">http://github.com/romanbsd/curb-openuri/tree</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.gugl.org/archives/89/feed</wfw:commentRss>
		<slash:comments>13</slash:comments>
		</item>
		<item>
		<title>Non-negative Matrix Factorization for Ruby</title>
		<link>http://blog.gugl.org/archives/82</link>
		<comments>http://blog.gugl.org/archives/82#comments</comments>
		<pubDate>Mon, 09 Feb 2009 18:04:54 +0000</pubDate>
		<dc:creator>Roman</dc:creator>
				<category><![CDATA[Ruby]]></category>
		<category><![CDATA[gsl]]></category>
		<category><![CDATA[matrices]]></category>
		<category><![CDATA[nmf]]></category>
		<category><![CDATA[non-negative matrix factorization]]></category>
		<category><![CDATA[rb-gsl]]></category>

		<guid isPermaLink="false">http://blog.gugl.org/?p=82</guid>
		<description><![CDATA[Several months back I needed to compute NMF of some relatively larges matrices. Since the native Ruby code was painfully slow, and for some reason even failed to work for some matrices, I decided to write a C implementation which will leverage the GNU Scientific Library (GSL) and then wrap it for using in Ruby [...]]]></description>
			<content:encoded><![CDATA[<p>Several months back I needed to compute NMF of some relatively larges matrices.<br />
Since the native Ruby code was painfully slow, and for some reason even failed to work for some matrices, I decided to write a C implementation which will leverage the GNU Scientific Library (GSL) and then wrap it for using in Ruby application.<br />
It was a neat add-on to the rb-gsl ruby library. What it does is adding NMF module under the GSL::Matrix, and there you have a method nmf which receives a GSL::Matrix and number of columns as a parameter and then returns two matrices.<br />
Since this is an iterative algorithm, the number of runs is limited to 1000, and the desired difference cost metric is set to 10<sup>-6</sup>.<br />
I tried to contact the author and even posted my code in the issue tracker, but haven&#8217;t received any response at the time of writing.<br />
So I decided to create a git-svn mirror on Github and add my changes there.<br />
<a href='http://github.com/romanbsd/rb-gsl/tree/master'>http://github.com/romanbsd/rb-gsl</a></p>
<p>You can install the gem using this command:</p>
<pre>
  $ gem sources -a http://gems.github.com/ # (you only have to do this once)
  $ gem install romanbsd-gsl
</pre>
]]></content:encoded>
			<wfw:commentRss>http://blog.gugl.org/archives/82/feed</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>I18n support for validates_date_time</title>
		<link>http://blog.gugl.org/archives/77</link>
		<comments>http://blog.gugl.org/archives/77#comments</comments>
		<pubDate>Sun, 08 Feb 2009 10:39:29 +0000</pubDate>
		<dc:creator>Roman</dc:creator>
				<category><![CDATA[i18n]]></category>
		<category><![CDATA[Rails]]></category>

		<guid isPermaLink="false">http://blog.gugl.org/?p=77</guid>
		<description><![CDATA[This simple fix uses the fact, that if the second argument to the &#8216;add&#8217; method is a symbol, then a generate_message is called, which does all the voodoo of Rails 2.2 I18n. I tried to contact the original author to no avail, therefore I&#8217;ll post it here, hoping that if anyone needs it, it&#8217;ll surface [...]]]></description>
			<content:encoded><![CDATA[<p>This simple fix uses the fact, that if the second argument to the &#8216;add&#8217; method is a symbol, then a generate_message is called, which does all the voodoo of Rails 2.2 I18n.<br />
I tried to contact the original author to no avail, therefore I&#8217;ll post it here, hoping that if anyone needs it, it&#8217;ll surface on a Google search.<br />
The fix itself is quite simple:</p>

<div class="wp_syntax"><div class="code"><pre class="diff" style="font-family:monospace;">Index: lib/validates_date_time.rb
===================================================================
<span style="color: #888822;">--- lib/validates_date_time.rb  <span style="">&#40;</span>revision 403<span style="">&#41;</span></span>
<span style="color: #888822;">+++ lib/validates_date_time.rb  <span style="">&#40;</span>working copy<span style="">&#41;</span></span>
<span style="color: #440088;">@@ -114,7 +114,7 @@</span>
       if options<span style="">&#91;</span>:before<span style="">&#93;</span>
         options<span style="">&#91;</span>:before<span style="">&#93;</span>.each do |r|
           if r.value<span style="">&#40;</span>record<span style="">&#41;</span> and value &gt;= r.last_value
<span style="color: #991111;">-            record.errors.add<span style="">&#40;</span>attr_name, options<span style="">&#91;</span>:before_message<span style="">&#93;</span> % r<span style="">&#41;</span></span>
<span style="color: #00b000;">+            record.errors.add<span style="">&#40;</span>attr_name, :before, :default =&gt; options<span style="">&#91;</span>:before_message<span style="">&#93;</span> % r<span style="">&#41;</span></span>
             break
           end
         end
<span style="color: #440088;">@@ -123,7 +123,7 @@</span>
       if options<span style="">&#91;</span>:after<span style="">&#93;</span>
         options<span style="">&#91;</span>:after<span style="">&#93;</span>.each do |r|
           if r.value<span style="">&#40;</span>record<span style="">&#41;</span> and value &lt;= r.last_value
<span style="color: #991111;">-            record.errors.add<span style="">&#40;</span>attr_name, options<span style="">&#91;</span>:after_message<span style="">&#93;</span> % r<span style="">&#41;</span></span>
<span style="color: #00b000;">+            record.errors.add<span style="">&#40;</span>attr_name, :after, :default =&gt; options<span style="">&#91;</span>:after_message<span style="">&#93;</span> % r<span style="">&#41;</span></span>
             break
           end
         end</pre></div></div>

<p>I&#8217;ve a fork of the git-svn mirror here:<br />
<a href='http://github.com/romanbsd/validates_date_time/tree/master'>http://github.com/romanbsd/validates_date_time/tree/master</a></p>
<p>Then, for using it, you&#8217;ll just need to have the following path in your locale yml files (for example):</p>
<pre>
  activerecord:
    errors:
      models:
        user:
          attributes:
            birth_date:
              before: 'is wrong'
              after: 'is wrong'
</pre>
]]></content:encoded>
			<wfw:commentRss>http://blog.gugl.org/archives/77/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

