<?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"
	>

<channel>
	<title>Filip Tepper</title>
	<atom:link href="http://filiptepper.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://filiptepper.com</link>
	<description>try...catch the moment</description>
	<pubDate>Sun, 09 Nov 2008 20:27:09 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.6.3</generator>
	<language>en</language>
			<item>
		<title>[Hint] Reading STDERR output in PHP</title>
		<link>http://filiptepper.com/2008/11/09/hint-reading-stderr-output-in-php/</link>
		<comments>http://filiptepper.com/2008/11/09/hint-reading-stderr-output-in-php/#comments</comments>
		<pubDate>Sun, 09 Nov 2008 20:24:27 +0000</pubDate>
		<dc:creator>Filip Tepper</dc:creator>
		
		<category><![CDATA[Hints]]></category>

		<category><![CDATA[Tools]]></category>

		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://filiptepper.com/?p=8</guid>
		<description><![CDATA[Recently I was working on a command line PHP script. I know that there are better ways to do things, but I didn&#8217;t want to use any other language, since most developers in our company know mainly PHP.
The script exec&#8217;s MySQL command to execute a batch of SQL queries. I also wanted the script to [...]]]></description>
			<content:encoded><![CDATA[<p>Recently I was working on a command line <code>PHP</code> script. I know that there are better ways to do <em>things</em>, but I didn&#8217;t want to use any other language, since most developers in our company know mainly <code>PHP</code>.</p>
<p>The script <a href="http://php.net/exec"><code>exec</code></a>&#8217;s <a href="http://mysql.com/"><code>MySQL</code></a> command to execute a batch of <code>SQL</code> queries. I also wanted the script to mail the error messages. <code>mysql</code> redirects error messages to <code>STDERR</code> - but STDERR is by default not available in <code>exec</code>&#8217;s <code>output</code> argument.</p>
<p>Walkaround is simple:</p>

<div class="wp_syntax"><div class="code"><pre class="php php" style="font-family:monospace;"><span style="color: #990000;">exec</span><span style="color: #009900;">&#40;</span><span style="">'your_command 2&gt;&amp;1'</span><span style="color: #009900;">&#41;</span>;</pre></div></div>

<p>Works!</p>
]]></content:encoded>
			<wfw:commentRss>http://filiptepper.com/2008/11/09/hint-reading-stderr-output-in-php/feed/</wfw:commentRss>
		</item>
		<item>
		<title>[Beta] Webbynode - VPS provider</title>
		<link>http://filiptepper.com/2008/11/09/beta-webbynode-vps-provider/</link>
		<comments>http://filiptepper.com/2008/11/09/beta-webbynode-vps-provider/#comments</comments>
		<pubDate>Sun, 09 Nov 2008 09:09:07 +0000</pubDate>
		<dc:creator>Filip Tepper</dc:creator>
		
		<category><![CDATA[Betas]]></category>

		<category><![CDATA[django]]></category>

		<category><![CDATA[PHP]]></category>

		<category><![CDATA[python]]></category>

		<category><![CDATA[ruby]]></category>

		<category><![CDATA[ruby on rails]]></category>

		<guid isPermaLink="false">http://filiptepper.com/?p=26</guid>
		<description><![CDATA[Back to my tech-blogging, hopefully for good!
This is just a quick note to let you know that there&#8217;s new VPS hosting service launching and it requires your input. Webbynode is giving out free beta accounts for Ruby on Rails, Django and PHP (and more!) applications.
I have a couple of drafts one-step-from-being-posted and back from project [...]]]></description>
			<content:encoded><![CDATA[<p>Back to my tech-blogging, hopefully for good!</p>
<p>This is just a quick note to let you know that there&#8217;s new VPS hosting service launching and it requires your input. <a href="http://webbynode.com/">Webbynode</a> is giving out free beta accounts for <a href="http://rubyonrails.com/"><code>Ruby on Rails</code></a>, <a href="http://djangoproject.com/"><code>Django</code></a> and <a href="http://php.net/"><code>PHP</code></a> (and more!) applications.</p>
<p>I have a couple of drafts one-step-from-being-posted and back from project management to development so expect more updates soon.</p>
]]></content:encoded>
			<wfw:commentRss>http://filiptepper.com/2008/11/09/beta-webbynode-vps-provider/feed/</wfw:commentRss>
		</item>
		<item>
		<title>[Tool] SQLite Manager</title>
		<link>http://filiptepper.com/2008/09/17/tool-sqlite-manager/</link>
		<comments>http://filiptepper.com/2008/09/17/tool-sqlite-manager/#comments</comments>
		<pubDate>Wed, 17 Sep 2008 10:12:36 +0000</pubDate>
		<dc:creator>Filip Tepper</dc:creator>
		
		<category><![CDATA[Tools]]></category>

		<category><![CDATA[sqlite]]></category>

		<guid isPermaLink="false">http://filiptepper.com/?p=19</guid>
		<description><![CDATA[For a couple of months I&#8217;ve been developing some Adobe AIR applications - all of them require local SQLite databases. To get the job done I needed an application that would ease SQLite DB management.
After some googling SQLite Manager poped up. It&#8217;s a pretty easy yet powerful tool - can be run both a Firefox [...]]]></description>
			<content:encoded><![CDATA[<p>For a couple of months I&#8217;ve been developing some <a href="http://www.adobe.com/products/air/"><code>Adobe AIR</code></a> applications - all of them require local <a href="http://sqlite.org/"><code>SQLite</code></a> databases. To get the job done I needed an application that would ease <code>SQLite</code> DB management.</p>
<p>After some googling <a href="http://code.google.com/p/sqlite-manager/">SQLite Manager</a> poped up. It&#8217;s a pretty easy yet powerful tool - can be run both a <a href="http://firefox.com/"><code>Firefox</code></a> extension or a stand-alone application (via <a href="http://developer.mozilla.org/en/XULRunner"><code>XULRunner</code></a>).</p>
<p>My only wish so far - a decent-looking interface.</p>
<div id="attachment_21" class="wp-caption aligncenter" style="width: 310px"><a href="http://filiptepper.com/wp-content/uploads/2008/09/sqlite-manager.png"><img src="http://filiptepper.com/wp-content/uploads/2008/09/sqlite-manager-300x189.png" alt="SQLite Manager" title="sqlite-manager" width="300" height="189" class="size-medium wp-image-21" /></a><p class="wp-caption-text">SQLite Manager</p></div>
]]></content:encoded>
			<wfw:commentRss>http://filiptepper.com/2008/09/17/tool-sqlite-manager/feed/</wfw:commentRss>
		</item>
		<item>
		<title>[Hint] Discarding non-ASCII characters in Ruby on Rails</title>
		<link>http://filiptepper.com/2008/05/05/hint-discarding-non-ascii-characters-in-ruby-on-rails/</link>
		<comments>http://filiptepper.com/2008/05/05/hint-discarding-non-ascii-characters-in-ruby-on-rails/#comments</comments>
		<pubDate>Mon, 05 May 2008 20:18:46 +0000</pubDate>
		<dc:creator>Filip Tepper</dc:creator>
		
		<category><![CDATA[Hints]]></category>

		<category><![CDATA[ruby on rails]]></category>

		<category><![CDATA[utf-8]]></category>

		<guid isPermaLink="false">http://filiptepper.com/?p=14</guid>
		<description><![CDATA[My current Ruby on Rails project requires SEO-friendly URL-s. I&#8217;ve installed acts_as_slugable plugin, but soon I found out that all my slugs contained Polish characters (in UTF-8). After some googling (Polish Ruby on Rails forum) and some more sips of coffee I came up with some modifications to acts_as_slugable.
Here&#8217;s lib/acts_as_slugable_ascii.rb:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
 require 'string'
&#160;
module Multiup
  module [...]]]></description>
			<content:encoded><![CDATA[<p>My current <a href="http://rubyonrails.org/">Ruby on Rails</a> project requires <a href="http://en.wikipedia.org/wiki/Search_engine_optimization">SEO</a>-friendly URL-s. I&#8217;ve installed <code><a href="http://code.dunae.ca/acts_as_slugable/README">acts_as_slugable</a></code> plugin, but soon I found out that all my slugs contained Polish characters (in UTF-8). After some googling (<a href="http://www.rubyonrails.pl/forum/viewtopic.php?pid=658">Polish Ruby on Rails forum</a>) and some more sips of coffee I came up with some modifications to <code>acts_as_slugable</code>.</p>
<p>Here&#8217;s <code>lib/acts_as_slugable_ascii.rb</code>:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
</pre></td><td class="code"><pre class="ruby ruby" style="font-family:monospace;"> <span style="color:#CC0066; font-weight:bold;">require</span> <span style="color:#996600;">'string'</span>
&nbsp;
<span style="color:#9966CC; font-weight:bold;">module</span> Multiup
  <span style="color:#9966CC; font-weight:bold;">module</span> Acts
    <span style="color:#9966CC; font-weight:bold;">module</span> Slugable
      <span style="color:#9966CC; font-weight:bold;">module</span> InstanceMethods
        private
          <span style="color:#9966CC; font-weight:bold;">def</span> create_slug
            <span style="color:#0000FF; font-weight:bold;">return</span> <span style="color:#9966CC; font-weight:bold;">if</span> <span style="color:#0000FF; font-weight:bold;">self</span>.<span style="color:#9900CC;">errors</span>.<span style="color:#9900CC;">length</span> <span style="color:#006600; font-weight:bold;">&gt;</span> 0
&nbsp;
            <span style="color:#9966CC; font-weight:bold;">if</span> <span style="color:#0000FF; font-weight:bold;">self</span><span style="color:#006600; font-weight:bold;">&#91;</span>source_column<span style="color:#006600; font-weight:bold;">&#93;</span>.<span style="color:#0000FF; font-weight:bold;">nil</span>? <span style="color:#9966CC; font-weight:bold;">or</span> <span style="color:#0000FF; font-weight:bold;">self</span><span style="color:#006600; font-weight:bold;">&#91;</span>source_column<span style="color:#006600; font-weight:bold;">&#93;</span>.<span style="color:#9900CC;">empty</span>?
              <span style="color:#0000FF; font-weight:bold;">return</span>
            <span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
            <span style="color:#9966CC; font-weight:bold;">if</span> <span style="color:#0000FF; font-weight:bold;">self</span><span style="color:#006600; font-weight:bold;">&#91;</span>slug_column<span style="color:#006600; font-weight:bold;">&#93;</span>.<span style="color:#9900CC;">to_s</span>.<span style="color:#9900CC;">empty</span>?
              test_string = <span style="color:#0000FF; font-weight:bold;">self</span><span style="color:#006600; font-weight:bold;">&#91;</span>source_column<span style="color:#006600; font-weight:bold;">&#93;</span>
&nbsp;
              proposed_slug = test_string.<span style="color:#9900CC;">strip</span>.<span style="color:#9900CC;">downcase</span>.<span style="color:#CC0066; font-weight:bold;">gsub</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">/</span><span style="color:#006600; font-weight:bold;">&#91;</span>\<span style="color:#996600;">'<span style="color:#000099;">\&quot;</span><span style="color:#000099;">\#</span><span style="color:#000099;">\$</span><span style="color:#000099;">\,</span><span style="color:#000099;">\.</span><span style="color:#000099;">\!</span><span style="color:#000099;">\?</span><span style="color:#000099;">\%</span><span style="color:#000099;">\@</span><span style="color:#000099;">\(</span><span style="color:#000099;">\)</span>]+/, '</span><span style="color:#996600;">').to_ascii
              proposed_slug = proposed_slug.gsub(/&amp;/, '</span><span style="color:#9966CC; font-weight:bold;">and</span><span style="color:#996600;">')
              proposed_slug = proposed_slug.gsub(/[<span style="color:#000099;">\W</span>^-_]+/, '</span><span style="color:#006600; font-weight:bold;">-</span><span style="color:#996600;">')
              proposed_slug = proposed_slug.gsub(/<span style="color:#000099;">\-</span>{2}/, '</span><span style="color:#006600; font-weight:bold;">-</span><span style="color:#996600;">')
&nbsp;
              suffix = &quot;&quot;
              existing = true
              acts_as_slugable_class.transaction do
                while existing != nil
                  existing = acts_as_slugable_class.find(:first, :conditions =&gt; [&quot;#{slug_column} = ? and #{slug_scope_condition}&quot;,  proposed_slug + suffix])
                  if existing
                    if suffix.empty?
                      suffix = &quot;-0&quot;
                    else
                      suffix.succ!
                    end
                  end
                end
              end         
              self[slug_column] = proposed_slug + suffix
            end
        end
      end
    end
  end
end
&nbsp;
ActiveRecord::Base.class_eval do
  include Multiup::Acts::Slugable
end</span></pre></td></tr></table></div>

<p>The only difference is the use of <code>to_ascii</code> method.</p>
<p>Now, we need to extend the <code>String</code> class. <code>to_ascii</code> method converts Polish UTF-8 characters to ASCII and discards all unknown characters:</p>

<div class="wp_syntax"><div class="code"><pre class="ruby ruby" style="font-family:monospace;"> <span style="color:#CC0066; font-weight:bold;">require</span> <span style="color:#996600;">'iconv'</span>
&nbsp;
<span style="color:#9966CC; font-weight:bold;">class</span> <span style="color:#CC0066; font-weight:bold;">String</span>
  <span style="color:#9966CC; font-weight:bold;">def</span> to_ascii
    ascii = <span style="color:#996600;">'acelnoszzACELNOSZZ'</span>
    non_ascii = <span style="color:#996600;">&quot;<span style="color:#000099;">\2</span>71<span style="color:#000099;">\3</span>46<span style="color:#000099;">\3</span>52<span style="color:#000099;">\2</span>63<span style="color:#000099;">\3</span>61<span style="color:#000099;">\3</span>63<span style="color:#000099;">\2</span>34<span style="color:#000099;">\2</span>77<span style="color:#000099;">\2</span>37&quot;</span>
    to_ascii_string = <span style="color:#0000FF; font-weight:bold;">self</span>
    <span style="color:#9966CC; font-weight:bold;">begin</span>
      result = <span style="color:#CC00FF; font-weight:bold;">Iconv</span>.<span style="color:#9900CC;">new</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">&quot;CP1250&quot;</span>, <span style="color:#996600;">&quot;UTF-8&quot;</span><span style="color:#006600; font-weight:bold;">&#41;</span>.<span style="color:#9900CC;">iconv</span><span style="color:#006600; font-weight:bold;">&#40;</span>to_ascii_string<span style="color:#006600; font-weight:bold;">&#41;</span>
    <span style="color:#9966CC; font-weight:bold;">rescue</span> <span style="color:#6666ff; font-weight:bold;">Iconv::IllegalSequence</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> e
      failed = e.<span style="color:#9900CC;">failed</span>.<span style="color:#9900CC;">chars</span>.<span style="color:#CC0066; font-weight:bold;">split</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">//</span>, <span style="color:#006666;">2</span><span style="color:#006600; font-weight:bold;">&#41;</span>
      to_ascii_string = to_ascii_string.<span style="color:#CC0066; font-weight:bold;">gsub</span><span style="color:#006600; font-weight:bold;">&#40;</span>failed<span style="color:#006600; font-weight:bold;">&#91;</span>0<span style="color:#006600; font-weight:bold;">&#93;</span>, <span style="color:#996600;">''</span><span style="color:#006600; font-weight:bold;">&#41;</span>
    <span style="color:#9966CC; font-weight:bold;">retry</span>
    <span style="color:#9966CC; font-weight:bold;">end</span>
   result.<span style="color:#9900CC;">tr</span>!<span style="color:#006600; font-weight:bold;">&#40;</span>non_ascii, ascii<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>

<p>And we&#8217;re done!</p>
<p>Just add the following line to your model:</p>

<div class="wp_syntax"><div class="code"><pre class="ruby ruby" style="font-family:monospace;"> <span style="color:#CC0066; font-weight:bold;">require</span> <span style="color:#996600;">'acts_as_slugable_ascii'</span></pre></div></div>

<p>and configure <code>acts_as_slugable</code> as instructed in <code>README</code> file. Now you&#8217;re ready to face your users.</p>
]]></content:encoded>
			<wfw:commentRss>http://filiptepper.com/2008/05/05/hint-discarding-non-ascii-characters-in-ruby-on-rails/feed/</wfw:commentRss>
		</item>
		<item>
		<title>[Hint] Nice URLs with observe_field</title>
		<link>http://filiptepper.com/2008/04/08/hint-nice-urls-with-observe_field/</link>
		<comments>http://filiptepper.com/2008/04/08/hint-nice-urls-with-observe_field/#comments</comments>
		<pubDate>Tue, 08 Apr 2008 18:15:59 +0000</pubDate>
		<dc:creator>Filip Tepper</dc:creator>
		
		<category><![CDATA[Hints]]></category>

		<guid isPermaLink="false">http://filiptepper.com/?p=13</guid>
		<description><![CDATA[For the last couple of weeks I&#8217;ve been working on a small Ruby on Rails application (and learning both Ruby and Rails in the same time). Since everyone&#8217;s talking about the one-and-only Rails way, I wanted to make my little app as Rails as possible. That means that you have to write some workarounds to [...]]]></description>
			<content:encoded><![CDATA[<p>For the last couple of weeks I&#8217;ve been working on a small <code><a href="http://rubyonrails.org/">Ruby on Rails</a></code> application (and learning both <code>Ruby</code> and <code>Rails</code> in the same time). Since everyone&#8217;s talking about the one-and-only <em>Rails way</em>, I wanted to make my little app as <em>Rails</em> as possible. That means that you have to write some workarounds to get things done the <em>Rails way</em>.</p>
<p>I wanted to add an <code>onchange</code> event to my <code>collection_select</code>. Normally you would put something like this in your template (that&#8217;s what I did after browsing through a couple of tutorial/helps):</p>

<div class="wp_syntax"><div class="code"><pre class="ruby ruby" style="font-family:monospace;"><span style="color:#006600; font-weight:bold;">&lt;%</span>= collection_select<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#ff3333; font-weight:bold;">:story</span>, <span style="color:#ff3333; font-weight:bold;">:license_id</span>, License.<span style="color:#9900CC;">find</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#ff3333; font-weight:bold;">:all</span><span style="color:#006600; font-weight:bold;">&#41;</span>, <span style="color:#ff3333; font-weight:bold;">:id</span>, <span style="color:#ff3333; font-weight:bold;">:name</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">%&gt;</span>
<span style="color:#006600; font-weight:bold;">&lt;%</span>= observe_field<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">'story_license_id'</span>, <span style="color:#ff3333; font-weight:bold;">:frequency</span> <span style="color:#006600; font-weight:bold;">=&gt;</span>; 0, <span style="color:#ff3333; font-weight:bold;">:update</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'story_license_description'</span>, <span style="color:#ff3333; font-weight:bold;">:url</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#006600; font-weight:bold;">&#123;</span>:controller <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'license'</span>, <span style="color:#ff3333; font-weight:bold;">:action</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'description'</span><span style="color:#006600; font-weight:bold;">&#125;</span>, <span style="color:#ff3333; font-weight:bold;">:with</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'&quot;id=&quot;+value'</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">%&gt;</span></pre></div></div>

<p>This code however results in ugly URLs (ie. <code>/license/description?id=1</code>). If you want to keep URLs nice, use the following method:</p>

<div class="wp_syntax"><div class="code"><pre class="ruby ruby" style="font-family:monospace;"><span style="color:#006600; font-weight:bold;">&lt;%</span>= collection_select<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#ff3333; font-weight:bold;">:story</span>, <span style="color:#ff3333; font-weight:bold;">:license_id</span>, License.<span style="color:#9900CC;">find</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#ff3333; font-weight:bold;">:all</span><span style="color:#006600; font-weight:bold;">&#41;</span>, <span style="color:#ff3333; font-weight:bold;">:id</span>, <span style="color:#ff3333; font-weight:bold;">:name</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">%&gt;</span>
<span style="color:#006600; font-weight:bold;">&lt;%</span>= observe_field<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">'story_license_id'</span>, <span style="color:#ff3333; font-weight:bold;">:frequency</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> 0, <span style="color:#ff3333; font-weight:bold;">:update</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'story_license_description'</span>, <span style="color:#ff3333; font-weight:bold;">:url</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#006600; font-weight:bold;">&#123;</span>:controller <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'license'</span>, <span style="color:#ff3333; font-weight:bold;">:action</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'description'</span>, <span style="color:#ff3333; font-weight:bold;">:id</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">&quot;'+value+'&quot;</span><span style="color:#006600; font-weight:bold;">&#125;</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">%&gt;</span></pre></div></div>

<p>This way you&#8217;ll keep your URLs beatiful throughout your application (ie. <code>/license/description/1</code>).</p>
<p>Oh, and forgive me the <em>Rails way</em> irony.</p>
]]></content:encoded>
			<wfw:commentRss>http://filiptepper.com/2008/04/08/hint-nice-urls-with-observe_field/feed/</wfw:commentRss>
		</item>
		<item>
		<title>[Hint] Deploying Ruby on Rails applications on Dreamhost with Capistrano</title>
		<link>http://filiptepper.com/2008/03/24/hint-deploying-ruby-on-rails-applications-on-dreamhost-with-capistrano/</link>
		<comments>http://filiptepper.com/2008/03/24/hint-deploying-ruby-on-rails-applications-on-dreamhost-with-capistrano/#comments</comments>
		<pubDate>Mon, 24 Mar 2008 14:32:56 +0000</pubDate>
		<dc:creator>Filip Tepper</dc:creator>
		
		<category><![CDATA[Hints]]></category>

		<category><![CDATA[capistrano]]></category>

		<category><![CDATA[gems]]></category>

		<category><![CDATA[ruby on rails]]></category>

		<guid isPermaLink="false">http://filiptepper.com/2008/03/24/hint-deploying-ruby-on-rails-applications-on-dreamhost-with-capistrano/</guid>
		<description><![CDATA[So, you have a nifty Ruby on Rails application, got yourself a cheap Dreamhost account and you want to give Capistrano a try. And what do you get - errors.
This occurs if you have Ruby gems installed in your home directory (probably ~/.gems/). I&#8217;m assuming that you already have your environment configured. Despite that you [...]]]></description>
			<content:encoded><![CDATA[<p>So, you have a nifty <a href="http://rubyonrails.org/">Ruby on Rails</a> application, got yourself a cheap <a href="http://www.dreamhost.com/r.cgi?294478">Dreamhost</a> account and you want to give <a href="http://www.capify.org/">Capistrano</a> a try. And what do you get - errors.</p>
<p>This occurs if you have Ruby gems installed in your home directory (probably <code>~/.gems/</code>). I&#8217;m assuming that you already have your environment configured. Despite that you still can get errors like <code>no file to load -- json</code> when executing <code>cap deploy</code>. That&#8217;s because you have your shell configured, but most likely non-interactive environment is left intact.</p>
<p>To fix this you have to modify your <code>.bashrc</code> file (since you probably added <code>GEM_HOME</code> and <code>GEM_PATH</code> to <code>.bash_profile</code>):</p>

<div class="wp_syntax"><div class="code"><pre class="bash bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">export</span> <span style="color: #007800;">GEM_HOME</span>=<span style="color: #007800;">$HOME</span><span style="color: #000000; font-weight: bold;">/</span>.gems 
<span style="color: #7a0874; font-weight: bold;">export</span> <span style="color: #007800;">GEM_PATH</span>=<span style="color: #007800;">$GEM_HOME</span>:<span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>lib<span style="color: #000000; font-weight: bold;">/</span>ruby<span style="color: #000000; font-weight: bold;">/</span>gems<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">1.8</span></pre></div></div>

<p>And you&#8217;re probably done.</p>
<p>You can also check these articles, they&#8217;ve been very helpful:<br />
<a href="http://www.rubyrobot.org/article/deploying-rails-20-to-mongrel-with-capistrano-21">Deploying Rails (2.0) to Mongrel with Capistrano 2.1</a><br />
<a href="http://capify.org/getting-started/rails">Using Capistrano with Rails</a><br />
<a href="http://wiki.dreamhost.com/Ruby_on_rails">Ruby on Rails - Dreamhost</a></p>
]]></content:encoded>
			<wfw:commentRss>http://filiptepper.com/2008/03/24/hint-deploying-ruby-on-rails-applications-on-dreamhost-with-capistrano/feed/</wfw:commentRss>
		</item>
		<item>
		<title>[Hint] Detecting Firefox 3 in extensions</title>
		<link>http://filiptepper.com/2008/03/20/hint-detecting-firefox-3-in-extensions/</link>
		<comments>http://filiptepper.com/2008/03/20/hint-detecting-firefox-3-in-extensions/#comments</comments>
		<pubDate>Thu, 20 Mar 2008 09:42:11 +0000</pubDate>
		<dc:creator>Filip Tepper</dc:creator>
		
		<category><![CDATA[Hints]]></category>

		<category><![CDATA[firefox]]></category>

		<category><![CDATA[javascript]]></category>

		<category><![CDATA[xul]]></category>

		<guid isPermaLink="false">http://filiptepper.com/2008/03/20/hint-detecting-firefox-3-in-extensions/</guid>
		<description><![CDATA[For a couple of months I&#8217;ve been developing a Firefox extension called BlipFox - an interface to Blip, Polish way-better-than-the-original-Twitter-clone. With Firefox 3 coming soon I had to get my extension ready for the final release.
Due to some chrome changes and bugs I had to update some code related to dynamic overlay rendering. Now all [...]]]></description>
			<content:encoded><![CDATA[<p>For a couple of months I&#8217;ve been developing a Firefox extension called <a href="http://blipfox.com/">BlipFox</a> - an interface to <a href="http://blip.pl/">Blip</a>, Polish way-better-than-the-original-Twitter-clone. With Firefox 3 coming soon I had to get my extension ready for the final release.</p>
<p>Due to some <a href="http://developer.mozilla.org/en/docs/Updating_extensions_for_Firefox_3">chrome changes</a> and <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=130078">bugs</a> I had to update some code related to dynamic overlay rendering. Now all I need to know is whether the extensions is installed on Firefox 2 or Firefox 3, hence this snippet of code:</p>

<div class="wp_syntax"><div class="code"><pre class="javascript javascript" style="font-family:monospace;"><span style="color: #003366; font-weight: bold;">function</span> isFF3<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
	<span style="color: #003366; font-weight: bold;">var</span> foo <span style="color: #339933;">=</span> Components.<span style="color: #660066;">classes</span><span style="color: #009900;">&#91;</span><span style="color: #3366CC;">&quot;@mozilla.org/login-manager;1&quot;</span><span style="color: #009900;">&#93;</span>;
	<span style="color: #000066; font-weight: bold;">return</span> <span style="color: #000066; font-weight: bold;">typeof</span> foo <span style="color: #339933;">===</span> <span style="color: #3366CC;">'function'</span>;
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>How do you like? Let me know if there are other methods of detecting Firefox 3 (more elegant, perhaps?).</p>
]]></content:encoded>
			<wfw:commentRss>http://filiptepper.com/2008/03/20/hint-detecting-firefox-3-in-extensions/feed/</wfw:commentRss>
		</item>
		<item>
		<title>[Hint] Using Windows keyboard in OS X Leopard</title>
		<link>http://filiptepper.com/2008/03/18/hint-using-windows-keyboard-in-os-x-leopard/</link>
		<comments>http://filiptepper.com/2008/03/18/hint-using-windows-keyboard-in-os-x-leopard/#comments</comments>
		<pubDate>Tue, 18 Mar 2008 19:58:13 +0000</pubDate>
		<dc:creator>Filip Tepper</dc:creator>
		
		<category><![CDATA[Hints]]></category>

		<category><![CDATA[applescript]]></category>

		<category><![CDATA[OS X]]></category>

		<guid isPermaLink="false">http://filiptepper.com/2008/03/18/hint-using-windows-keyboard-in-os-x-leopard/</guid>
		<description><![CDATA[Since sometimes I&#8217;m awfully lazy - I got myself a second keyboard, just for the sake of not having to carry one to office and back. At home I use my beloved Apple Keyboard, while at work - a crappy, no-name, ten-bucks-a-piece one (it does it job, though!).
However, since at work I use a Windows [...]]]></description>
			<content:encoded><![CDATA[<p>Since sometimes I&#8217;m awfully lazy - I got myself a second keyboard, just for the sake of not having to carry one to office and back. At home I use my beloved <a href="http://www.apple.com/keyboard/">Apple Keyboard</a>, while at work - a crappy, no-name, ten-bucks-a-piece one (it does it job, though!).</p>
<p>However, since at work I use a Windows keyboard I had a problem with the switched Option / Command keys. I&#8217;ve tried <a href="http://doublecommand.sourceforge.net/">DoubleCommand</a>, however I had to click through the System Preferences each time I switched my keyboard. Couple of minutes of googling and a <a href="http://www.tuaw.com/2006/10/13/an-applescript-to-enable-windows-keyboards-to-control-a-mac/">nice script</a> popped out. However, it was useless in OS X Leopard, so I made a couple of quick changes and here&#8217;s something I came up with. First, switch-to-windows-keyboard script:</p>

<div class="wp_syntax"><div class="code"><pre class="applescript applescript" style="font-family:monospace;"><span style="color: #b1b100;">tell</span> application <span style="color: #ff0000;">&quot;System Preferences&quot;</span>
	activate
	<span style="color: #b1b100;">set</span> current pane <span style="color: #b1b100;">to</span> pane <span style="color: #ff0000;">&quot;com.apple.preference.keyboard&quot;</span>
<span style="color: #b1b100;">end</span> <span style="color: #b1b100;">tell</span>
<span style="color: #b1b100;">tell</span> application <span style="color: #ff0000;">&quot;System Events&quot;</span>
	<span style="color: #b1b100;">get</span> properties
	<span style="color: #b1b100;">tell</span> process <span style="color: #ff0000;">&quot;System Preferences&quot;</span>
		click button <span style="color: #ff0000;">&quot;Modifier Keys…&quot;</span> <span style="color: #b1b100;">of</span> <span style="color: #000066;">tab</span> group <span style="color: #cc66cc;">1</span> <span style="color: #b1b100;">of</span> window <span style="color: #ff0000;">&quot;Keyboard &amp; Mouse&quot;</span>
		click pop up button <span style="color: #cc66cc;">2</span> <span style="color: #b1b100;">of</span> sheet <span style="color: #cc66cc;">1</span> <span style="color: #b1b100;">of</span> window <span style="color: #ff0000;">&quot;Keyboard &amp; Mouse&quot;</span>
		delay <span style="color: #cc66cc;">0.3</span>
		click menu item <span style="color: #cc66cc;">4</span> <span style="color: #b1b100;">of</span> menu <span style="color: #cc66cc;">1</span> <span style="color: #b1b100;">of</span> pop up button <span style="color: #cc66cc;">2</span> <span style="color: #b1b100;">of</span> sheet <span style="color: #cc66cc;">1</span> <span style="color: #b1b100;">of</span> window <span style="color: #ff0000;">&quot;Keyboard &amp; Mouse&quot;</span>
		delay <span style="color: #cc66cc;">0.3</span>
		click pop up button <span style="color: #cc66cc;">1</span> <span style="color: #b1b100;">of</span> sheet <span style="color: #cc66cc;">1</span> <span style="color: #b1b100;">of</span> window <span style="color: #ff0000;">&quot;Keyboard &amp; Mouse&quot;</span>
		delay <span style="color: #cc66cc;">0.3</span>
		click menu item <span style="color: #cc66cc;">3</span> <span style="color: #b1b100;">of</span> menu <span style="color: #cc66cc;">1</span> <span style="color: #b1b100;">of</span> pop up button <span style="color: #cc66cc;">1</span> <span style="color: #b1b100;">of</span> sheet <span style="color: #cc66cc;">1</span> <span style="color: #b1b100;">of</span> window <span style="color: #ff0000;">&quot;Keyboard &amp; Mouse&quot;</span>
		delay <span style="color: #cc66cc;">0.3</span>
		click button <span style="color: #ff0000;">&quot;OK&quot;</span> <span style="color: #b1b100;">of</span> sheet <span style="color: #cc66cc;">1</span> <span style="color: #b1b100;">of</span> window <span style="color: #ff0000;">&quot;Keyboard &amp; Mouse&quot;</span>
	<span style="color: #b1b100;">end</span> <span style="color: #b1b100;">tell</span>
<span style="color: #b1b100;">end</span> <span style="color: #b1b100;">tell</span>
<span style="color: #b1b100;">tell</span> application <span style="color: #ff0000;">&quot;System Preferences&quot;</span>
	<span style="color: #000066;">quit</span>
<span style="color: #b1b100;">end</span> <span style="color: #b1b100;">tell</span></pre></div></div>

<p>Second, back-to-apple-keyboard script:</p>

<div class="wp_syntax"><div class="code"><pre class="applescript applescript" style="font-family:monospace;"><span style="color: #b1b100;">tell</span> application <span style="color: #ff0000;">&quot;System Preferences&quot;</span>
	activate
	<span style="color: #b1b100;">set</span> current pane <span style="color: #b1b100;">to</span> pane <span style="color: #ff0000;">&quot;com.apple.preference.keyboard&quot;</span>
<span style="color: #b1b100;">end</span> <span style="color: #b1b100;">tell</span>
<span style="color: #b1b100;">tell</span> application <span style="color: #ff0000;">&quot;System Events&quot;</span>
	<span style="color: #b1b100;">get</span> properties
	<span style="color: #b1b100;">tell</span> process <span style="color: #ff0000;">&quot;System Preferences&quot;</span>
		click button <span style="color: #ff0000;">&quot;Modifier Keys…&quot;</span> <span style="color: #b1b100;">of</span> <span style="color: #000066;">tab</span> group <span style="color: #cc66cc;">1</span> <span style="color: #b1b100;">of</span> window <span style="color: #ff0000;">&quot;Keyboard &amp; Mouse&quot;</span>
		click button <span style="color: #ff0000;">&quot;Restore Defaults&quot;</span> <span style="color: #b1b100;">of</span> sheet <span style="color: #cc66cc;">1</span> <span style="color: #b1b100;">of</span> window <span style="color: #ff0000;">&quot;Keyboard &amp; Mouse&quot;</span>
		click button <span style="color: #ff0000;">&quot;OK&quot;</span> <span style="color: #b1b100;">of</span> sheet <span style="color: #cc66cc;">1</span> <span style="color: #b1b100;">of</span> window <span style="color: #ff0000;">&quot;Keyboard &amp; Mouse&quot;</span>
	<span style="color: #b1b100;">end</span> <span style="color: #b1b100;">tell</span>
<span style="color: #b1b100;">end</span> <span style="color: #b1b100;">tell</span>
<span style="color: #b1b100;">tell</span> application <span style="color: #ff0000;">&quot;System Preferences&quot;</span>
	<span style="color: #000066;">quit</span>
<span style="color: #b1b100;">end</span> <span style="color: #b1b100;">tell</span></pre></div></div>

<p>You might ask why not use <a href="http://www.tuaw.com/2006/10/13/an-applescript-to-enable-windows-keyboards-to-control-a-mac/">Ryan Block&#8217;s script</a>? Well, since I rely heavily on <a href="http://www.blacktree.com/">QuickSilver</a> I also created two <a href="http://www.sveinbjorn.org/platypus">Platypus</a> applications - one for each script. I&#8217;m a keyboard user, so I didn&#8217;t like the clicking on the Macintosh / PC screen. ;-]</p>
]]></content:encoded>
			<wfw:commentRss>http://filiptepper.com/2008/03/18/hint-using-windows-keyboard-in-os-x-leopard/feed/</wfw:commentRss>
		</item>
		<item>
		<title>[Release] Fluid&#8217;s Google Reader Fix</title>
		<link>http://filiptepper.com/2008/03/01/release-fluids-google-reader-fix/</link>
		<comments>http://filiptepper.com/2008/03/01/release-fluids-google-reader-fix/#comments</comments>
		<pubDate>Sat, 01 Mar 2008 08:49:28 +0000</pubDate>
		<dc:creator>Filip Tepper</dc:creator>
		
		<category><![CDATA[Releases]]></category>

		<category><![CDATA[fluid]]></category>

		<category><![CDATA[javascript]]></category>

		<category><![CDATA[OS X]]></category>

		<guid isPermaLink="false">http://filiptepper.com/2008/03/01/release-fluids-google-reader-fix/</guid>
		<description><![CDATA[For quite a few weeks I&#8217;ve been using Fluid with Google Reader - having a standalone WebKit based application with dock notification works great for me. However, one thing has been bothering me - Fluid never clears the dock badge when all the items are read. I&#8217;ve just posted a little fix for this issue [...]]]></description>
			<content:encoded><![CDATA[<p>For quite a few weeks I&#8217;ve been using <a href="http://fluidapp.com/">Fluid</a> with Google Reader - having a standalone WebKit based application with dock notification works great for me. However, one thing has been bothering me - Fluid never clears the dock badge when all the items are read. I&#8217;ve just posted a little fix for this issue - grab it at <a href="http://userscripts.org/scripts/show/23422">http://userscripts.org/scripts/show/23422</a>.</p>
<p>Let me know if this works for you!</p>
]]></content:encoded>
			<wfw:commentRss>http://filiptepper.com/2008/03/01/release-fluids-google-reader-fix/feed/</wfw:commentRss>
		</item>
		<item>
		<title>[Hint] Pasting content into Ext&#8217;s 1.1.1 HtmlEditor</title>
		<link>http://filiptepper.com/2008/02/01/hint-pasting-content-into-exts-111-htmleditor/</link>
		<comments>http://filiptepper.com/2008/02/01/hint-pasting-content-into-exts-111-htmleditor/#comments</comments>
		<pubDate>Fri, 01 Feb 2008 13:16:13 +0000</pubDate>
		<dc:creator>Filip Tepper</dc:creator>
		
		<category><![CDATA[Hints]]></category>

		<category><![CDATA[ext]]></category>

		<category><![CDATA[javascript]]></category>

		<category><![CDATA[linux]]></category>

		<category><![CDATA[windows]]></category>

		<guid isPermaLink="false">http://filiptepper.com/2008/02/01/hint-pasting-content-into-exts-111-htmleditor/</guid>
		<description><![CDATA[Ext has it&#8217;s up and downsides, but is indeed a great framework if you need out-of-the-box set of tools for complex layout development. However we&#8217;ve noticed that Ext&#8217;s HtmlEditor has problems with content that is pasted into the textarea (we used Firefox 2.0 on both Linux and Windows - never happened on OS X systems). [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://extjs.com/">Ext</a> has it&#8217;s up and downsides, but is indeed a great framework if you need out-of-the-box set of tools for complex layout development. However we&#8217;ve noticed that Ext&#8217;s HtmlEditor has problems with content that is pasted into the textarea (we used <a href="http://mozilla.com/">Firefox 2.0</a> on both Linux and Windows - never happened on OS X systems). After pasting some <code>HTML</code> the <code>getRawValue</code> method returns a string that doesn&#8217;t include the pasted content. This issue only occurs if after pasting the content HtmlEditor&#8217;s <code>textarea</code> is not modified - inserting any character (including whitespace) will prevent it.</p>
<p>The workaround is easy - you need to use the method <code>syncValue</code>. An excerpt from Ext&#8217;s <a href="http://extjs.com/deploy/ext-1.1.1/docs/">documentation</a>:</p>
<blockquote><p>Protected method that will not generally be called directly. Syncs the contents of the editor iframe with the textarea.</p></blockquote>
<p>Despite it being protected we can call it directly. If you&#8217;re facing the problem of missing content then use the following snippet to read data from HtmlEditor:</p>

<div class="wp_syntax"><div class="code"><pre class="javascript javascript" style="font-family:monospace;">YourHtmlEditor.<span style="color: #660066;">syncValue</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>;
<span style="color: #003366; font-weight: bold;">var</span> content <span style="color: #339933;">=</span> YourHtmlEditor.<span style="color: #660066;">getStylesheet</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">+</span> <span style="color: #3366CC;">&quot;<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span> <span style="color: #339933;">+</span> YourHtmlEditor.<span style="color: #660066;">getRawValue</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>;</pre></div></div>

<p>We use it in our webmail module and it works like a charm (finally!).</p>
]]></content:encoded>
			<wfw:commentRss>http://filiptepper.com/2008/02/01/hint-pasting-content-into-exts-111-htmleditor/feed/</wfw:commentRss>
		</item>
	</channel>
</rss>
