<?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>tov's Blog &#187; Programmierung</title>
	<atom:link href="http://blog.nobody-is-like.me/category/programmierung/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.nobody-is-like.me</link>
	<description>Just another (geeky) WordPress weblog</description>
	<lastBuildDate>Sat, 16 Jul 2011 14:57:15 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Brainfuck</title>
		<link>http://blog.nobody-is-like.me/2010/03/brainfuck/</link>
		<comments>http://blog.nobody-is-like.me/2010/03/brainfuck/#comments</comments>
		<pubDate>Tue, 16 Mar 2010 10:31:12 +0000</pubDate>
		<dc:creator>tov</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Programmierung]]></category>

		<guid isPermaLink="false">http://blog.nobody-is-like.me/?p=57</guid>
		<description><![CDATA[Hmmm&#8230; Kleine Fingerübung in Perl (pre-alpha ) Ah ja: Brainfuck: http://lmgtfy.com/?q=Brainfuck #!/usr/bin/env perl use Term::ReadKey; ReadMode 'raw'; my $debug = 0; my $code; if ($ARGV[0]){ { local $/ = undef; local *FILE; open FILE, "+++++++++[-]+++[>++++++++++++.]]></description>
			<content:encoded><![CDATA[<p>Hmmm&#8230; Kleine Fingerübung in Perl (pre-alpha <img src='http://blog.nobody-is-like.me/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> )</p>
<p>Ah ja: Brainfuck: <a href="http://lmgtfy.com/?q=Brainfuck">http://lmgtfy.com/?q=Brainfuck</a></p>
<pre>#!/usr/bin/env perl
use Term::ReadKey;
ReadMode 'raw';
my $debug = 0;

my $code;
if ($ARGV[0]){
	{ local $/ = undef; local *FILE; open FILE, "<".$ARGV[0]; $code = <FILE>; close FILE }
}

$code ||=
">+++++++++[<+++++++++++++>-]<-.-----.+++++++
.>+++[>++++++++++<-]
>++.<<----.+++.
--------- . -------.>++++[<+++++>-]<+.>++++++++++.";

$code =~ s/[^\.,+-\[\]<>]//msg;
$| = 1;
my @val;
@val[ 0 .. 29999 ] = (0) x 30000;
my $vpt = 0;
my @ls;
my @le;
my $lpt = 0;
my $cc  = 0;
my @c   = split( '', $code );
my $nc  = @c;
while ( $cc < $nc ) {
    $_ = $c[ $cc++ ];
    print "vpt:$vpt \$val[\$vpt]"
      . $val[$vpt]
      . " loop_counter:$loop_counter loop(counter)_start:"
      . $ls[$loop_counter]
      . " loop(counter)_end:"
      . $le[$loop_counter]
      . " cc:$cc command:$_\n"
      if $debug;
    /</ and do { $vpt        and $vpt--; next };
    />/ and do { $vpt < @val and $vpt++; next };
    /\+/ and do { $val[$vpt] = $val[$vpt] + 1; next; };
    /\-/ and do { $val[$vpt] = $val[$vpt] - 1; next; };
    /\./ and do { print chr( $val[$vpt] ); next; };
    /\,/ and do { $val[$vpt] = ord( ReadKey 0 ); next; };
    /\[/ and do {
        if   ( $val[$vpt] ) { $ls[ $lpt++ ] = $cc - 1 }
        else                { $cc = defined $le[$lpt] ? $le[$lpt] : (index($code,']',$cc)+1) }
        next;
    };
    /\]/ and do {
        $le[ --$lpt ] = $cc;
        $cc = $ls[$lpt];
        next;
    };
}
print "\n";
</pre>
]]></content:encoded>
			<wfw:commentRss>http://blog.nobody-is-like.me/2010/03/brainfuck/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Establish a 2nd database connection in Rails</title>
		<link>http://blog.nobody-is-like.me/2009/06/establish-a-2nd-database-connection-in-rails/</link>
		<comments>http://blog.nobody-is-like.me/2009/06/establish-a-2nd-database-connection-in-rails/#comments</comments>
		<pubDate>Thu, 18 Jun 2009 15:54:56 +0000</pubDate>
		<dc:creator>tov</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Programmierung]]></category>
		<category><![CDATA[Ruby and Rails]]></category>
		<category><![CDATA[informix]]></category>
		<category><![CDATA[Rails]]></category>
		<category><![CDATA[Ruby]]></category>

		<guid isPermaLink="false">http://blog.nobody-is-like.me/2009/06/18/establish-a-2nd-database-connection-in-rails/</guid>
		<description><![CDATA[OK, you can find some howto&#8217;s everywhere on the web but only on this site I found the complete solution: [sourcecode language='ruby'] class SecondConnection < ActiveRecord::Base SecondConnection.establish_connection( :adapter => &#8220;informix&#8221;, :host => &#8220;localhost&#8221;, :username => &#8220;hansnase&#8221;, :password => &#8220;very_secret&#8221;, :database => &#8220;ccdb@localhost&#8221; ) self.abstract_class = true end [/sourcecode] &#8220;self.abstract_class = true&#8221; makes the thing actually [...]]]></description>
			<content:encoded><![CDATA[<p>OK, you can find some howto&#8217;s everywhere on the web but only on <a href="http://blog.freerails.de/?p=347">this</a> site I found the complete solution:</p>
<p>[sourcecode language='ruby']<br />
class SecondConnection < ActiveRecord::Base</p>
<p>SecondConnection.establish_connection(<br />
:adapter  => &#8220;informix&#8221;,<br />
:host     => &#8220;localhost&#8221;,<br />
:username => &#8220;hansnase&#8221;,<br />
:password => &#8220;very_secret&#8221;,<br />
:database => &#8220;ccdb@localhost&#8221;<br />
)</p>
<p>self.abstract_class = true<br />
end<br />
[/sourcecode]</p>
<p>&#8220;self.abstract_class = true&#8221; makes the thing actually work. Otherwise Rails seems to cache the database connection and does not switch back if you access any other classes but SecondConnection.</p>
<p>Yeah!</p>
<p>Later: Not so Yeah&#8230;</p>
<p>I had to establish another call to<br />
[sourcecode language='ruby']<br />
  ActiveRecord::Base.establish_connection<br />
       logger.info { &#8220;Establishing Base Connection&#8221; }<br />
       log_connections<br />
[/sourcecode]</p>
<p>I assume it&#8217;s either an Informix problem or related to the old rails version I&#8217;m driving with.<br />
Nevertheless: It works now.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.nobody-is-like.me/2009/06/establish-a-2nd-database-connection-in-rails/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Rails and incoming mails on a Mac Leopard workstation</title>
		<link>http://blog.nobody-is-like.me/2009/06/rails-and-incoming-mails-on-a-mac-leopard-workstation/</link>
		<comments>http://blog.nobody-is-like.me/2009/06/rails-and-incoming-mails-on-a-mac-leopard-workstation/#comments</comments>
		<pubDate>Wed, 17 Jun 2009 16:27:15 +0000</pubDate>
		<dc:creator>tov</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Mac OS X]]></category>
		<category><![CDATA[Programmierung]]></category>
		<category><![CDATA[Ruby and Rails]]></category>

		<guid isPermaLink="false">http://blog.nobody-is-like.me/2009/06/17/rails-and-incoming-mails-on-a-mac-leopard-workstation/</guid>
		<description><![CDATA[Obviously I&#8217;m in a need of such an installation, otherwise I wouldn&#8217;t have googled about this (btw.: Do you know lmgtfy.com). Here are some snippets from: ChrizDee Craig Ambrose And? What did I do: I first enabled Postfix using 1). After this I have changed /etc/aliases: [sourcecode language='ruby'] echo &#8216;rails_mailer: &#8220;&#124;/usr/local/bin/mail_handler.rb&#8221;&#8216; >> /etc/aliases chmod 755 [...]]]></description>
			<content:encoded><![CDATA[<p>Obviously I&#8217;m in a need of such an installation, otherwise I wouldn&#8217;t have googled about this (btw.: Do you know <a href="http://lmgtfy.com">lmgtfy.com</a>).</p>
<p>Here are some snippets from:</p>
<ol>
<li><a href="http://www.chrizdee.de/2008/10/20/postfix-mailserver-unter-os-x-leopard-einrichten/">ChrizDee</a></li>
<li><a href="http://blog.craigambrose.com/past/2008/2/9/respond_toemail_or_how_to_handle/">Craig Ambrose</a></li>
</ol>
<p>And? What did I do:</p>
<p>I first enabled Postfix using 1). After this I have changed /etc/aliases:</p>
<p>[sourcecode language='ruby']</p>
<p>echo &#8216;rails_mailer: &#8220;|/usr/local/bin/mail_handler.rb&#8221;&#8216; >> /etc/aliases<br />
chmod 755 /usr/local/bin/mail_handler.rb&#8221;&#8216; >> /etc/aliases<br />
sudo newaliases<br />
sudo postfix reload</p>
<p>[/sourcecode]</p>
<p>[sourcecode language='ruby']<br />
#!/usr/bin/ruby<br />
require &#8216;net/http&#8217;<br />
require &#8216;uri&#8217;Net::HTTP.post_form URI.parse(&#8216;http://localhost:3000/emails&#8217;), { &#8220;email&#8221; => STDIN.read }</p>
<p>[/sourcecode]</p>
<p>The script above will be triggered by every mail that will be sent to rails_mailer@localhost (resp. your hostname). It will put a post-request to localhost:3000/email including the email in the parameter &#8220;email&#8221;.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.nobody-is-like.me/2009/06/rails-and-incoming-mails-on-a-mac-leopard-workstation/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Hpricot: XML to Hash</title>
		<link>http://blog.nobody-is-like.me/2009/03/hpricot-xml-to-hash/</link>
		<comments>http://blog.nobody-is-like.me/2009/03/hpricot-xml-to-hash/#comments</comments>
		<pubDate>Fri, 20 Mar 2009 18:20:09 +0000</pubDate>
		<dc:creator>tov</dc:creator>
				<category><![CDATA[Programmierung]]></category>
		<category><![CDATA[Ruby and Rails]]></category>
		<category><![CDATA[Hpricot]]></category>
		<category><![CDATA[Rails]]></category>
		<category><![CDATA[Ruby]]></category>

		<guid isPermaLink="false">http://blog.nobody-is-like.me/?p=21</guid>
		<description><![CDATA[Well: I nearly lost all my hairs about this. Strange that I couldn&#8217;t find something like this in the docs.Situation: I have some XML code from that I need parts being put into a simple hash (see below). The following small ruby snippet does exactly this. Only thing that&#8217;s not working is the &#8220;inner_xml&#8221; part. [...]]]></description>
			<content:encoded><![CDATA[<p>Well: I nearly lost all my hairs about this. Strange that I couldn&#8217;t find something like this in the docs.Situation:</p>
<p>I have some XML code from that I need parts being put into a simple hash (see below).</p>
<p>The following small ruby snippet does exactly this.</p>
<p>Only thing that&#8217;s not working is the  &#8220;inner_xml&#8221; part. I personally don&#8217;t need it but your mileage may vary and you may want to fix the issue (and give me a note)</p>
<p>[sourcecode language='ruby']<br />
require &#8216;rubygems&#8217;<br />
require &#8216;hpricot&#8217;<br />
require &#8216;pp&#8217;</p>
<p>text = <<eof</p>
<payment>
		<vat></p>
<pay_vat>0</pay_vat>
			<vat_id/><br />
		</vat><br />
		<creditcard><br />
			<type>master</type><br />
			<holder>Franz Fluchsfinger</holder><br />
			<company/><br />
			<no>52660xxxxxxxxxxx79</no><br />
			<kpn/><br />
			<valid_until>09/10</valid_until><br />
			<data>Just some data</data><br />
			<xml_for_demo><inner_xml>inner text</inner_xml></xml_for_demo><br />
			<signature>a5f4e2shortened4b1e523ca873837c8f1c9ea66ee1924d</signature><br />
		</creditcard>
</payment>
eof</p>
<p>xml =Hpricot.XML(text)<br />
a= xml/&#8221;creditcard/*&#8221;<br />
h={}<br />
a.each {|b|<br />
	h[b.name] = b.inner_text if b.is_a? Hpricot::Elem<br />
}<br />
pp h	</p>
<p>[/sourcecode]</p>
<p>result:</p>
<p><code><br />
ruby test.rb<br />
{"company"=&gt;"",<br />
"xml_for_demo"=&gt;"inner text",<br />
"no"=&gt;"52660xxxxxxxxxxx79",<br />
"holder"=&gt;"Franz Fluchsfinger",<br />
"signature"=&gt;"a5f4e2shortened4b1e523ca873837c8f1c9ea66ee1924d",<br />
"type"=&gt;"master",<br />
"valid_until"=&gt;"09/10",<br />
"kpn"=&gt;"",<br />
"data"=&gt;"Just some data"}<br />
</code></p>
<p>Btw.: I found the solution partly on <a href="http://railsforum.com/viewtopic.php?id=22055">http://railsforum.com/viewtopic.php?id=22055</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.nobody-is-like.me/2009/03/hpricot-xml-to-hash/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Rails Snippets</title>
		<link>http://blog.nobody-is-like.me/2009/02/rails-snippets/</link>
		<comments>http://blog.nobody-is-like.me/2009/02/rails-snippets/#comments</comments>
		<pubDate>Wed, 25 Feb 2009 10:27:11 +0000</pubDate>
		<dc:creator>tov</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Programmierung]]></category>
		<category><![CDATA[Ruby and Rails]]></category>
		<category><![CDATA[Rails]]></category>
		<category><![CDATA[Ruby]]></category>

		<guid isPermaLink="false">http://blog.nobody-is-like.me/?p=15</guid>
		<description><![CDATA[Some small snippets of Rails/Ruby codes that I&#8217;d like to not forget&#8230; I found an interesting site on the Web: http://matthall.wordpress.com/2006/12/06/how-to-execute-a-rails-controller-action-via-cron/  Tweaking it a bit: require '../config/environment' require 'pp' id = ARGV[0] if id.nil? raise &#60; USAGE: $0 RESELLER_ID eof end app = ActionController::Integration::Session.new app.get "/kunden/status_mail/#{id}" This works fine from a Rails subdirectory and calls the [...]]]></description>
			<content:encoded><![CDATA[<p>Some small snippets of Rails/Ruby codes that I&#8217;d like to not forget&#8230;</p>
<p>I found an interesting site on the Web: <a href="http://matthall.wordpress.com/2006/12/06/how-to-execute-a-rails-controller-action-via-cron/" title="How to Execute a Rails Controller Action via. Cron">http://matthall.wordpress.com/2006/12/06/how-to-execute-a-rails-controller-action-via-cron/ </a></p>
<p>Tweaking it a bit:<br />
<code>require '../config/environment'<br />
require 'pp'<br />
id = ARGV[0]<br />
if id.nil?<br />
raise &lt;<eof><br />
USAGE: $0 RESELLER_ID<br />
eof<br />
end<br />
app = ActionController::Integration::Session.new<br />
app.get "/kunden/status_mail/#{id}"</eof></code></p>
<p>This works fine from a Rails subdirectory and calls the same action like http://RAILSSITE/kunden/status_mail/ID</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.nobody-is-like.me/2009/02/rails-snippets/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Git Installation</title>
		<link>http://blog.nobody-is-like.me/2008/03/git-installation/</link>
		<comments>http://blog.nobody-is-like.me/2008/03/git-installation/#comments</comments>
		<pubDate>Mon, 10 Mar 2008 13:18:51 +0000</pubDate>
		<dc:creator>tov</dc:creator>
				<category><![CDATA[Programmierung]]></category>

		<guid isPermaLink="false">http://blog.nobody-is-like.me/?p=6</guid>
		<description><![CDATA[GIT? Was&#8217;n das? Git ist ein Versionskontrollsystem, &#228;hnlich wie das bekannte CVS bzw. dessen Nachfolger &#8220;Subversion&#8221;.Der gro&#223;e Vorteil von &#8220;git&#8221; ist die hervorragende Unterst&#252;tzung von &#8220;Branches&#8221;, etwas was ich mit CVS/Subversion immer nur ziemlich rudiment&#228;r hinbekommen habe. Hier nun die Installation auf einem &#228;lteren SuSE-System: 1) Sourcecode von http://git.or.czcd /usr/local/srcaktuell: wget http://kernel.org/pub/software/scm/git/git-1.5.4.4.tar.bz2 2) auspackentar xjvpf [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://git.or.cz" rel="self" title="GIT">GIT</a>? Was&#8217;n das?</p>
<p>Git ist ein Versionskontrollsystem, &auml;hnlich wie das bekannte CVS bzw. dessen Nachfolger &#8220;Subversion&#8221;.<br />Der gro&szlig;e Vorteil von &#8220;git&#8221; ist die hervorragende Unterst&uuml;tzung von &#8220;Branches&#8221;, etwas was ich mit CVS/Subversion immer nur ziemlich rudiment&auml;r hinbekommen habe.</p>
<p>Hier nun die Installation auf einem &auml;lteren SuSE-System:</p>
<p>1) Sourcecode von http://git.or.cz<br />cd /usr/local/src<br />aktuell: wget http://kernel.org/pub/software/scm/git/git-1.5.4.4.tar.bz2</p>
<p>2) auspacken<br />tar xjvpf git-1.5*<br />cd git-1.5*<br />./configure<br />make<br />make install</p>
<p>It&#8217;s that simple <img src='http://blog.nobody-is-like.me/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<p>Allerdings: Wenn Ihr mit einem nicht lokalen Repository arbeitet _muss_ die gleiche Prozedur auch auf dem Rechner mit dem Repository stattfinden (also wget, tar, configure, make, make install)<br />Sonst gibt&#8217;s immer ein freundliches:</p>
<p>git clone ssh://user@HOSTNAME/fileserver/git/REPOSITORY<br />Initialized empty Git repository in /home/jrelease/REPOSITORY/.git/<br />bash: git-upload-pack: command not found<br />fatal: The remote end hung up unexpectedly<br />fetch-pack from &#8216;ssh://user@HOSTNAME/fileserver/git/REPOSITORY&#8217; failed.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.nobody-is-like.me/2008/03/git-installation/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

