<?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 &#187; integration</title>
	<atom:link href="http://blog.gugl.org/archives/category/integration/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.1</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>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>Integrating Rails and dhtmlxTabbar</title>
		<link>http://blog.gugl.org/archives/14</link>
		<comments>http://blog.gugl.org/archives/14#comments</comments>
		<pubDate>Tue, 24 Jun 2008 08:29:37 +0000</pubDate>
		<dc:creator>Roman</dc:creator>
				<category><![CDATA[integration]]></category>
		<category><![CDATA[Rails]]></category>
		<category><![CDATA[web]]></category>
		<category><![CDATA[dhtmlx]]></category>
		<category><![CDATA[patch]]></category>
		<category><![CDATA[Ruby]]></category>

		<guid isPermaLink="false">http://blog.gugl.org/archives/14</guid>
		<description><![CDATA[The dhtmlxTabbar is a nice tab-bar component from http://www.dhtmlx.com/ In order to use the AJAX loading feature I had to make a small change in the dhtmlxcommon.js so it mimics the behavior of Prototype by adding a X-Requested-With HTTP header. Thus, it&#8217;s possible to use request.xhr? in Rails. dhtmlxcommon.js]]></description>
			<content:encoded><![CDATA[<p>The <strong>dhtmlxTabbar</strong> is a nice tab-bar component from http://www.dhtmlx.com/<br />
In order to use the AJAX loading feature I had to make a small change in the <em>dhtmlxcommon.js</em> so it mimics the behavior of Prototype by adding a X-Requested-With HTTP header. Thus, it&#8217;s possible to use request.xhr? in Rails.<br />
<a href='http://blog.gugl.org/wp-content/uploads/dhtmlxcommonjs.txt'>dhtmlxcommon.js</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.gugl.org/archives/14/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

