<?xml version="1.0" encoding="UTF-8"?>
<!-- generator="wordpress/2.2" -->
<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/"
	>

<channel>
	<title>MoMolog</title>
	<link>http://momolog.info</link>
	<description>Die Firma MoMolog aus Berlin stellt sich vor. Projekte, Ideen und Aktuelles.</description>
	<pubDate>Sat, 10 May 2008 10:08:30 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.2</generator>
	<language>en</language>
			<item>
		<title>Prototype Hash was killed</title>
		<link>http://momolog.info/2008/02/09/prototype-hash-was-killed/</link>
		<comments>http://momolog.info/2008/02/09/prototype-hash-was-killed/#comments</comments>
		<pubDate>Sat, 09 Feb 2008 14:43:53 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[Mootools]]></category>

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

		<guid isPermaLink="false">http://momolog.info/2008/02/09/prototype-hash-was-killed/</guid>
		<description><![CDATA[In what they call a &#8220;backwards compatibility change&#8221; the prototype core developers have introduced some changes to the prototype Hash class.
A little history:
From version 1.5 the Hash class started behaving a bit differently because now the Enumerable methods where copied into the Hash prototype instead of into the instances, as before. That helped minimize the [...]]]></description>
			<content:encoded><![CDATA[<p>In what they call a &#8220;<a href="http://prototypejs.org/api/hash">backwards compatibility change</a>&#8221; the prototype core developers have introduced some changes to the prototype Hash class.<br />
A little history:<br />
From version 1.5 the Hash class started behaving a bit differently because now the Enumerable methods where copied into the Hash <strong>prototype</strong> instead of into the instances, as before. That helped minimize the memory footprint but introduced incompatibilities and removed the possibility to patch Enumerables methods because after patching Enumerable one would have to manually copy its methods into all &#8220;inheriting&#8221; classes again.<br />
To my understanding that is in conflict with the dynamic inheritance in prototype-based languages like javascript.<br />
See <a href="http://groups.google.com/group/prototype-core/browse_thread/thread/d6c5b3caa59f003d/524412167c69b4c8?lnk=gst&#038;q=hash#524412167c69b4c8">this thread</a> for more info.</p>
<p>Now with 1.6. things get worse. The Hash object is not an JS object with added functionality anymore, its a wrapper around one.<br />
The following code will work in 1.5.0.2 but not in 1.6:<br />
<code><br />
test = $H({a: 1, b:2});<br />
alert(test.a); // -&gt; 1 in version 1.5<br />
</code><br />
Instead, in prototype 1.6 you have to write <code>test.get(&#039;a&#039;)</code> to get to the property &#8220;a&#8221; of the underlying object. In case you need the whole object, there is always <code>test.toObject()</code> to the rescue. Bye bye, consise and short notation.</p>
<p>I feel the developers forgot what made prototype so wildly successfull: Its beautiful concept of enhancing the built in objects, not wrapping them.</p>
<p>I consider leaving the prototype world alltogether and will switch to <a href="http://mootools.net">mootools</a>. </p>
<p><a href="http://dev.rubyonrails.org/ticket/3592">Unlike prototype</a>, mootools returns a hash on filtering a hash.</p>
]]></content:encoded>
			<wfw:commentRss>http://momolog.info/2008/02/09/prototype-hash-was-killed/feed/</wfw:commentRss>
		</item>
		<item>
		<title>PHP and MySQL on MacOSX 10.5. Leopard</title>
		<link>http://momolog.info/2007/11/25/php-and-mysql-on-macosx-105-leopard/</link>
		<comments>http://momolog.info/2007/11/25/php-and-mysql-on-macosx-105-leopard/#comments</comments>
		<pubDate>Sat, 24 Nov 2007 22:07:04 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[MacOSX]]></category>

		<guid isPermaLink="false">http://momolog.info/2007/11/25/php-and-mysql-on-macosx-105-leopard/</guid>
		<description><![CDATA[After installing Leopard, the previous Apache configuration file in /etc/httpd/httpd.conf is no longer used. The Apache configuration sits in /etc/apache2/httpd.conf now.
In order to enable PHP again, I uncommented the following line first:
LoadModule php5_module libexec/apache2/libphp5.so
Second, to get my virtual hosts running again, I used the adapted Leopard version of Patrick Gibsons excellent utility
virtualhost.sh which even automatically [...]]]></description>
			<content:encoded><![CDATA[<p>After installing Leopard, the previous Apache configuration file in /etc/httpd/httpd.conf is no longer used. The Apache configuration sits in /etc/apache2/httpd.conf now.<br />
In order to enable PHP again, I uncommented the following line first:<br />
<code>LoadModule php5_module libexec/apache2/libphp5.so</code><br />
Second, to get my virtual hosts running again, I used the adapted Leopard version of Patrick Gibsons excellent utility<br />
<a href="http://patrickgibson.com/utilities/virtualhost/">virtualhost.sh</a> which even automatically moves all prior (Tiger) virtual hosts.<br />
Finally to get rid of the error<br />
<code>Can&#039;t connect to local MySQL server through socket &#039;/var/mysql/&#039;</code><br />
I successfully followed the steps found <a href="http://www.luismajano.com/blog/index.cfm/2007/10/30/Getting-MySQL-to-work-with-Leopard-MySQL-on-Leopard">here</a>:<br />
<code>sudo mkdir /var/mysql/<br />
sudo ln -s /tmp/mysql.sock /var/mysql/mysql.sock<br />
</code></p>
<p>Everything is up and running fine now.</p>
]]></content:encoded>
			<wfw:commentRss>http://momolog.info/2007/11/25/php-and-mysql-on-macosx-105-leopard/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Which programming language am I?</title>
		<link>http://momolog.info/2007/05/09/what-i-am/</link>
		<comments>http://momolog.info/2007/05/09/what-i-am/#comments</comments>
		<pubDate>Wed, 09 May 2007 12:39:11 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[Allgemein]]></category>

		<guid isPermaLink="false">http://momolog.info/2007/05/09/what-i-am/</guid>
		<description><![CDATA[Which Programming Language are You?
]]></description>
			<content:encoded><![CDATA[<a href="http://www.bbspot.com/News/2006/08/language_quiz.php"><img
src="http://www.bbspot.com/Images/News_Features/2006/08/language/visual_basic.jpg" width="300" height="90"
border="0" alt="You are Visual Basic. You have little respect for common sense.  You are immature, but have recently begun to grow up."><br />Which Programming Language are You?</a>
]]></content:encoded>
			<wfw:commentRss>http://momolog.info/2007/05/09/what-i-am/feed/</wfw:commentRss>
		</item>
		<item>
		<title>hstore magic</title>
		<link>http://momolog.info/2007/04/17/hstore-magic/</link>
		<comments>http://momolog.info/2007/04/17/hstore-magic/#comments</comments>
		<pubDate>Tue, 17 Apr 2007 10:08:54 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[Postgresql]]></category>

		<guid isPermaLink="false">http://momolog.info/2007/04/17/hstore-magic/</guid>
		<description><![CDATA[A lot of nice things can be done with postgresql&#8217;s hstore type.
They are a nice way to store flags, for example, and by providing an aggregate function to sum them up, one can easily compute complex unions of properties.
First we define an aggregate function to sum postgresql hstores, straightforward as this:

CREATE AGGREGATE sum(
&#160;&#160;sfunc&#160;&#160;&#160;&#160; = hs_concat,
&#160;&#160;basetype&#160;&#160;= [...]]]></description>
			<content:encoded><![CDATA[<p>A lot of nice things can be done with <a href="http://www.sai.msu.su/~megera/wiki/Hstore">postgresql&#8217;s hstore type</a>.</p>
<p>They are a nice way to store flags, for example, and by providing an aggregate function to sum them up, one can easily compute complex unions of properties.</p>
<p>First we define an aggregate function to sum postgresql hstores, straightforward as this:</p>
<pre>
CREATE AGGREGATE sum(
&nbsp;&nbsp;sfunc&nbsp;&nbsp;&nbsp;&nbsp; = hs_concat,
&nbsp;&nbsp;basetype&nbsp;&nbsp;= hstore,
&nbsp;&nbsp;stype&nbsp;&nbsp;&nbsp;&nbsp; = hstore,
&nbsp;&nbsp;initcond&nbsp;&nbsp;= &#039;&#039;
);
</pre>
<p>Allows for beautiful constructs as </p>
<pre>
CREATE OR REPLACE FUNCTION array_to_hstore(text[]) RETURNS hstore AS $$
&nbsp;&nbsp;DECLARE
&nbsp;&nbsp;&nbsp;&nbsp;arr&nbsp;&nbsp;&nbsp;&nbsp; text[];
&nbsp;&nbsp;&nbsp;&nbsp;result&nbsp;&nbsp;hstore;
&nbsp;&nbsp;BEGIN
&nbsp;&nbsp;&nbsp;&nbsp;SELECT INTO arr $1;
&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;SELECT INTO result sum(key=&gt;1) FROM (
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;select
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;btrim(arr[idx.i]) as key
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;from
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;generate_series(1, array_upper(arr,1)) as idx(i)
&nbsp;&nbsp;&nbsp;&nbsp;) as dummy;
&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;RETURN result;
&nbsp;
&nbsp;&nbsp;END
$$ LANGUAGE plpgsql;
</pre>
<p>Now what can be done with that? For example we can turn comma separated lists into hstores:</p>
<pre>
mydb=&gt; SELECT array_to_hstore(string_to_array(&#039;a, b, c, a&#039;, &#039;,&#039;));
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;array_to_hstore&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&#45;&#45;-&#45;&#45;-&#45;&#45;-&#45;&#45;-&#45;&#45;-&#45;&#45;-&#45;&#45;-&#45;&#45;-&#45;&#45;-&#45;&#45;-&#45;&#45;-&#45;&#45;-&#45;&#45;-&#45;&#45;&#45;-
 &quot;a&quot;=&gt;&quot;1&quot;, &quot;b&quot;=&gt;&quot;1&quot;, &quot;c&quot;=&gt;&quot;1&quot;
(1 Zeile)
</pre>
]]></content:encoded>
			<wfw:commentRss>http://momolog.info/2007/04/17/hstore-magic/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Using Finks svk on MacOSX with zsh</title>
		<link>http://momolog.info/2007/02/23/using-finks-svk-on-macosx-with-zsh/</link>
		<comments>http://momolog.info/2007/02/23/using-finks-svk-on-macosx-with-zsh/#comments</comments>
		<pubDate>Fri, 23 Feb 2007 15:02:33 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[MacOSX]]></category>

		<guid isPermaLink="false">http://momolog.info/2007/02/23/using-finks-svk-on-macosx-with-zsh/</guid>
		<description><![CDATA[Some days ago I tried installing svk on MacOSX using fink. 
Everything worked fine except when I finally tried to use it:

aljoscha% svk
Can&#039;t locate Class/Autouse.pm in @INC 
(@INC contains: /System/Library/Perl/5&#46;.. [snip] &#46;..5.8.1 .) at /Library/Perl/5.8.6/SVK.pm line 6.
BEGIN failed&#45;-compilation aborted at /Library/Perl/5.8.6/SVK.pm line 6.
Compilation failed in require at /usr/bin/svk line 6.
BEGIN failed&#45;-compilation aborted at /usr/bin/svk line [...]]]></description>
			<content:encoded><![CDATA[Some days ago I tried installing svk on MacOSX using fink. 
Everything worked fine except when I finally tried to use it:
<pre><br />
aljoscha% svk<br />
Can&#039;t locate Class/Autouse.pm in @INC <br />
(@INC contains: /System/Library/Perl/5&#46;.. [snip] &#46;..5.8.1 .) at /Library/Perl/5.8.6/SVK.pm line 6.<br />
BEGIN failed&#45;-compilation aborted at /Library/Perl/5.8.6/SVK.pm line 6.<br />
Compilation failed in require at /usr/bin/svk line 6.<br />
BEGIN failed&#45;-compilation aborted at /usr/bin/svk line 6.<br />
</pre>
The solution was not so obvious to me: Fink sets its paths in 
/sw/bin/init.sh (/sw/bin/init.csh for csh users respectively)

Putting a 
<pre><br />
source /sw/bin/init.sh<br />
</pre> 
into your ~/.zshrc makes svk happy.]]></content:encoded>
			<wfw:commentRss>http://momolog.info/2007/02/23/using-finks-svk-on-macosx-with-zsh/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Testcase I</title>
		<link>http://momolog.info/2006/10/16/testcase-i/</link>
		<comments>http://momolog.info/2006/10/16/testcase-i/#comments</comments>
		<pubDate>Mon, 16 Oct 2006 09:42:53 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[Prototype]]></category>

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

		<guid isPermaLink="false">http://momolog.info/2006/10/16/testcase-i/</guid>
		<description><![CDATA[



These tests check that, with the prototype fix in place 

$H({fruit:&#34;apple&#34;, vegetable:&#34;cucumber&#34;}).reject(
&#160;&#160;function(el) { return (el[1] == &#039;cucumber&#039;);}
) == $H({fruit:&#34;apple&#34;})

and 

$H({fruit:&#34;apple&#34;, vegetable:&#34;cucumber&#34;}).findAll(
&#160;&#160;function(el) { return (el[1] == &#039;apple&#039;); }
) == $H({fruit:&#34;apple&#34;}) 



 





// 
]]></description>
			<content:encoded><![CDATA[<script src="/js/extlib/prototype/prototype-1.4.0-patched.js" type="text/javascript"></script>
<script src="/js/extlib/scriptaculous/unittest.js" type="text/javascript"></script>
<link rel="stylesheet" href="/js/extlib/scriptaculous/test.css" type="text/css" />

These tests check that, with the prototype fix in place 
<pre><br />
$H({fruit:&quot;apple&quot;, vegetable:&quot;cucumber&quot;}).reject(<br />
&nbsp;&nbsp;function(el) { return (el[1] == &#039;cucumber&#039;);}<br />
) == $H({fruit:&quot;apple&quot;})<br />
</pre>
and 
<pre><br />
$H({fruit:&quot;apple&quot;, vegetable:&quot;cucumber&quot;}).findAll(<br />
&nbsp;&nbsp;function(el) { return (el[1] == &#039;apple&#039;); }<br />
) == $H({fruit:&quot;apple&quot;}) <br />
</pre>

<!-- Log output -->
<div id="testlog"> </div>

<!-- here go any elements you do the testing on -->

<!-- Tests -->
<script type="text/javascript" language="javascript">
// <![CDATA[
  new Test.Unit.Runner({
    
    setup: function(){with(this){
      this.given    = $H({fruit: "apple", vegetable: "cucumber"});
      this.expected = $H({fruit: "apple"});
    }},

    testReject: function(){ with(this) {
      var rejected  = this.given.reject(function(el) { return (el[1] == 'cucumber'); });
      assertEqual(this.expected.inspect(), rejected.inspect());
    }},

    testFind: function(){ with(this) {
      var found = this.given.findAll(function(el) { return (el[1] == 'apple'); });
      assertEqual(this.expected.inspect(), found.inspect());
    }}

  });



// ]]&gt;
</script>
]]></content:encoded>
			<wfw:commentRss>http://momolog.info/2006/10/16/testcase-i/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Fixing the Prototype Enumeration Mixin</title>
		<link>http://momolog.info/2006/10/14/prototype-enumeration/</link>
		<comments>http://momolog.info/2006/10/14/prototype-enumeration/#comments</comments>
		<pubDate>Sat, 14 Oct 2006 11:42:56 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[Prototype]]></category>

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

		<guid isPermaLink="false"></guid>
		<description><![CDATA[The following article describes ticket #3592 in the RoR Trac and explains a proposed solution.
Prototypes Enumerable mixin class does not properly respect the mixees internal format. For example the reject and findAll methods, operating on Hashes, return Arrays instead of Hashes.

var a = $H({a:1, b:2, c:1, d:3}); 
document.writeln(a.inspect().escapeHTML());
&#160;
=&#62;#&#60;Hash:{&#039;a&#039;: 1, &#039;b&#039;: 2, &#039;c&#039;: 1, &#039;d&#039;: 3}&#62;
&#160;
var [...]]]></description>
			<content:encoded><![CDATA[<p>The following article describes <a href="http://dev.rubyonrails.org/ticket/3592">ticket #3592</a> in the RoR Trac and explains a proposed solution.</p>
<p>Prototypes Enumerable mixin class does not properly respect the mixees internal format. For example the <code>reject</code> and <code>findAll</code> methods, operating on Hashes, return Arrays instead of Hashes.</p>
<pre>
var a = $H({a:1, b:2, c:1, d:3}); 
document.writeln(a.inspect().escapeHTML());
&nbsp;
=&gt;#&lt;Hash:{&#039;a&#039;: 1, &#039;b&#039;: 2, &#039;c&#039;: 1, &#039;d&#039;: 3}&gt;
&nbsp;
var b = a.reject(function(val){ return (val[1]==1) });
document.writeln(b.inspect().escapeHTML());
&nbsp;
=&gt; [[&#039;b&#039;, 2], [&#039;d&#039;, 3]]&nbsp;&nbsp; // !!! should be hash
&nbsp;
var c = b.findAll(function(val){ return (val[0]==&#039;d&#039;) });
document.writeln(c.inspect().escapeHTML());
&nbsp;
=&gt; [[&#039;b&#039;, 2], [&#039;d&#039;, 3]]&nbsp;&nbsp; // !!! should be hash
</pre>
<p>In Ruby (from which the inspiration for the Enumerable Mixin stems), the reject method does return a hash, not an array, when operating on an hash:  </p>
<pre>
irb(main):001:0&gt; a={:a =&gt; 1, :b =&gt; 2, :c =&gt; 1, :d =&gt; 3}&nbsp;&nbsp;
&nbsp;
=&gt; {:b=&gt;2, :c=&gt;1, :a=&gt;1, :d=&gt;3}&nbsp;&nbsp;
&nbsp;
irb(main):002:0&gt; b=a.reject{|k,v| v==1}
&nbsp;
=&gt; {:b=&gt;2, :d=&gt;3} 
</pre>
<p>The patch requires all classes that want to mixin Enumerable to define two more methods similar to <code>_each</code>:<br />
<code>_new</code>, which returns an empty object of that class and<br />
<code>_add</code>, that adds an element. Enumerable mixin thus needs to make no more assumptions about the internal structure of its mixee class.</p>
<p>After the fix the methods return correctly:</p>
<pre>
=&gt; #&lt;Hash:{&#039;b&#039;: 2, &#039;d&#039;: 3}&gt;
</pre>
]]></content:encoded>
			<wfw:commentRss>http://momolog.info/2006/10/14/prototype-enumeration/feed/</wfw:commentRss>
		</item>
	</channel>
</rss>
