<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xml:base="http://www.cduce.org/~abate" xmlns:dc="http://purl.org/dc/elements/1.1/">
<channel>
 <title>Pietro Abate - Pietro Abate homepage/working blog</title>
 <link>http://www.cduce.org/~abate/frontpage</link>
 <description>The basic front page view.</description>
 <language>en</language>
<item>
 <title>running skype in a schroot</title>
 <link>http://www.cduce.org/~abate/running-skype-a-schroot</link>
 <description>&lt;p&gt;If I don&#039;t trust a stranger to wonder inside my house, why should I allow a closed source program to access my home directory ? Apart from the paranoia and conspiracy implications I decided to spend some time learning how to chroot skype (and iceweasel for that matter, since I don&#039;t really trust javascript, flash and the mozilla plugin model) in a chroot. &lt;/p&gt;
&lt;p&gt;I started from this article :&lt;br /&gt;
&lt;a href=&quot;http://www.debian-administration.org/articles/566&quot; title=&quot;http://www.debian-administration.org/articles/566&quot;&gt;http://www.debian-administration.org/articles/566&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;This recipe didn&#039;t work out of the box. This is mine:&lt;/p&gt;
&lt;p&gt;Now step by step:&lt;br /&gt;
First we install the software. I&#039;m working on a debian unstable...&lt;br /&gt;
&lt;code&gt;&lt;br /&gt;
apt-get install schroot debootstrap&lt;br /&gt;
&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Then we create the chroot with debootstrap, we install skype and let apt-get do the rest. Installing skype will cause a lot of broken dependencies. &lt;code&gt;apt-get -f install&lt;/code&gt; will fix them all. Quick and dirty.&lt;br /&gt;
Note: you have to copy the package inside the chroot!&lt;/p&gt;
&lt;p&gt;&lt;code&gt;&lt;br /&gt;
sudo debootstrap --variant=minbase --arch i386 sid /home/chroot/sid &lt;a href=&quot;http://ftp.fr.debian.org/debian&quot; title=&quot;http://ftp.fr.debian.org/debian&quot;&gt;http://ftp.fr.debian.org/debian&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;sudo schroot -d / -c sid -p -- dpkg -i /skype-debian_2.0.0.68-1_i386.deb&lt;/p&gt;
&lt;p&gt;sudo schroot -d / -c sid -p -- apt-get -f install&lt;br /&gt;
&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;At this point the chroot is ready. To run an application, we still need to convince the xserver to accept xsessions from the chroot to be displayed. Since but default my xserver doesn&#039;t accept tcp connections (--nolisten tcp), we need to bind-mount the tmp directory inside the chroot.&lt;/p&gt;
&lt;p&gt;See also : &lt;a href=&quot;http://www.gelato.unsw.edu.au/IA64wiki/XinChroot&quot; title=&quot;http://www.gelato.unsw.edu.au/IA64wiki/XinChroot&quot;&gt;http://www.gelato.unsw.edu.au/IA64wiki/XinChroot&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Notice that this is not the safest solutions. We could re-start the xserver to listen to tcp connections and avoid this step. I&#039;ve chosen to go this way at the moment.&lt;/p&gt;
&lt;p&gt;&lt;code&gt;&lt;br /&gt;
mount --bind /tmp /home/chroot/sid/tmp&lt;br /&gt;
&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Then we need to authorize the client using xauth and run you command using this little wrapper&lt;br /&gt;
&lt;code&gt;&lt;br /&gt;
xauth extract - $DISPLAY | xauth -f /home/chroot/sid$HOME/chhome/.Xauthority merge -&lt;/p&gt;
&lt;p&gt;schroot -- &quot;$@&quot;&lt;/p&gt;
&lt;p&gt;rm -f /home/chroot/sid$HOME/chhome/.Xauthority&lt;br /&gt;
&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Depending from your settings you might want to fix the display variable. Running schroot with the &lt;code&gt;-p&lt;/code&gt; option let you pass your env variables to the application in the chroot. I suggest you don&#039;t do that but add a .bashrc in your chroot home to set only selected variables.&lt;/p&gt;
&lt;p&gt;We are ready to skype away in our chroot:&lt;br /&gt;
&lt;code&gt;&lt;br /&gt;
./wrapper skype&lt;br /&gt;
&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Installing iceweasel is just a matter of apt-get in the chroot.&lt;/p&gt;
&lt;p&gt;Maybe now they won&#039;t be able to tap in your computer so easily, but they will still be able to record you conversations and messages !!!&lt;/p&gt;
</description>
 <comments>http://www.cduce.org/~abate/running-skype-a-schroot#comments</comments>
 <category domain="http://www.cduce.org/~abate/tags/debian">debian</category>
 <category domain="http://www.cduce.org/~abate/tags/unix">unix</category>
 <pubDate>Sun, 27 Apr 2008 12:12:56 +0200</pubDate>
 <dc:creator>abate</dc:creator>
 <guid isPermaLink="false">240 at http://www.cduce.org/~abate</guid>
</item>
<item>
 <title>mod rewrite rule</title>
 <link>http://www.cduce.org/~abate/mod-rewrite-rule</link>
 <description>&lt;p&gt;A quick one about mod_rewrite. I added ssl to cduce.org for our user pages. However I&#039;ve no use of ssl to serve our static pages. This rule will redirect all https requests (^443$) that are not related to userdirs (!^/~) to http:// .&lt;/p&gt;
&lt;p&gt;&lt;code&gt;&lt;br /&gt;
        RewriteEngine   on&lt;br /&gt;
        RewriteCond %{SERVER_PORT} ^443$&lt;br /&gt;
        RewriteCond %{REQUEST_URI} !^/~&lt;br /&gt;
        RewriteRule ^(.*)$ http://www.cduce.org$1 [L,R]&lt;br /&gt;
&lt;/code&gt;&lt;/p&gt;
</description>
 <comments>http://www.cduce.org/~abate/mod-rewrite-rule#comments</comments>
 <category domain="http://www.cduce.org/~abate/tags/apache">apache</category>
 <pubDate>Sun, 13 Apr 2008 20:52:23 +0200</pubDate>
 <dc:creator>abate</dc:creator>
 <guid isPermaLink="false">237 at http://www.cduce.org/~abate</guid>
</item>
<item>
 <title>Openldap + SSL</title>
 <link>http://www.cduce.org/~abate/openldap-ssl</link>
 <description>&lt;p&gt;There are many many howto on the net regarding this topic.  Here I&#039;ll not give another howto, but just a list of mistakes I&#039;ve done today. I hope this will same some time to others.&lt;/p&gt;


&lt;h2 id=&quot;toc0&quot;&gt;openssl certs&lt;/h2&gt;
 With debian we generally use make-ssl-cert to generate self signed certs. This tools works fine also to generate ssl certs for ldap. The only &lt;em&gt;important&lt;/em&gt; thing to remember is to specify your FQN as host name while creating the cert. Failing to do that will make the openldap server fail to start. Remember also to change the permissions of the server certificate to allow the openldap user to read it.
&lt;h2 id=&quot;toc1&quot;&gt;self signed certs VS signed certs&lt;/h2&gt;
 If I understand correctly, openldap works just fine with self signed certs, but this is not optimal. To generate signed certs, you first need to create a CA cert and then use this to sign you server cert. In debian you can find scripts to do that in &lt;code class=&quot;geshifilter ocaml&quot;&gt;/usr/lib/ssl/misc/&lt;/code&gt;
&lt;h2 id=&quot;toc2&quot;&gt;TLS_REQCERT allow&lt;/h2&gt;
 If you use a self signed cert you need to specify &lt;code class=&quot;geshifilter ocaml&quot;&gt;TLS_REQCERT allow&lt;/code&gt; in /etc/ldap/ldap.conf and &lt;code class=&quot;geshifilter ocaml&quot;&gt;TLSVerifyClient allow&lt;/code&gt; in you /etc/ldap/slapd.conf. The first is necessary to get the ldap clients working. I&#039;m not sure about the second one in the server configuration file.
&lt;h2 id=&quot;toc3&quot;&gt;pam and nss&lt;/h2&gt;
&lt;p&gt;&lt;div class=&quot;geshifilter ocaml&quot; style=&quot;font-family: monospace;&quot;&gt;cat /etc/libnss-ldap.&lt;span style=&quot;color: #060;&quot;&gt;conf&lt;/span&gt; &lt;br /&gt;
base dc=cduce,dc=org&lt;br /&gt;
uri ldaps://osmium.&lt;span style=&quot;color: #060;&quot;&gt;pps&lt;/span&gt;.&lt;span style=&quot;color: #060;&quot;&gt;jussieu&lt;/span&gt;.&lt;span style=&quot;color: #060;&quot;&gt;fr&lt;/span&gt;&lt;br /&gt;
ldap_version &lt;span style=&quot;color: #c6c;&quot;&gt;3&lt;/span&gt;&lt;br /&gt;
ssl on&lt;/div&gt;&lt;/p&gt;

&lt;p&gt;&lt;div class=&quot;geshifilter ocaml&quot; style=&quot;font-family: monospace;&quot;&gt;cat /etc/pam_ldap.&lt;span style=&quot;color: #060;&quot;&gt;conf&lt;/span&gt; &lt;br /&gt;
base dc=cduce,dc=org&lt;br /&gt;
uri ldaps://osmium.&lt;span style=&quot;color: #060;&quot;&gt;pps&lt;/span&gt;.&lt;span style=&quot;color: #060;&quot;&gt;jussieu&lt;/span&gt;.&lt;span style=&quot;color: #060;&quot;&gt;fr&lt;/span&gt;&lt;br /&gt;
ssl on&lt;br /&gt;
ldap_version &lt;span style=&quot;color: #c6c;&quot;&gt;3&lt;/span&gt;&lt;br /&gt;
pam_password crypt&lt;br /&gt;
nss_base_passwd ou=people,dc=cduce,dc=org?one&lt;br /&gt;
nss_base_shadow ou=people,dc=cduce,dc=org?one&lt;br /&gt;
nss_base_group&amp;nbsp; ou=group,dc=cduce,dc=org?one&lt;br /&gt;
nss_base_netgroup ou=netgroup,dc=cduce,dc=org?one&lt;/div&gt;&lt;/p&gt;

&lt;p&gt;The important bits here are the &lt;code class=&quot;geshifilter ocaml&quot;&gt;ssl on&lt;/code&gt; to force the client to use ssl. Of course, remember to specify ldaps in the uri.&lt;/p&gt;


&lt;h2 id=&quot;toc4&quot;&gt;Enable ldaps&lt;/h2&gt;
 On debian you need to modify /etc/default/slapd and add this line: &lt;div class=&quot;geshifilter ocaml&quot; style=&quot;font-family: monospace;&quot;&gt;SLAPD_SERVICES=&lt;span style=&quot;color: #3cb371;&quot;&gt;&amp;quot;ldap://127.0.0.1:389/ ldaps://cduce.org:636/&amp;quot;&lt;/span&gt;&lt;/div&gt; I decided to keep ldap without ssl on localhost, but only ldaps on the external interface.&lt;p&gt;More about Kerberos + SASL + OpenLdap soon...&lt;/p&gt;

</description>
 <comments>http://www.cduce.org/~abate/openldap-ssl#comments</comments>
 <category domain="http://www.cduce.org/~abate/tags/debian">debian</category>
 <category domain="http://www.cduce.org/~abate/tags/openldap">openldap</category>
 <category domain="http://www.cduce.org/~abate/tags/ssl">ssl</category>
 <category domain="http://www.cduce.org/~abate/tags/unix">unix</category>
 <pubDate>Sun, 13 Apr 2008 20:47:27 +0200</pubDate>
 <dc:creator>abate</dc:creator>
 <guid isPermaLink="false">236 at http://www.cduce.org/~abate</guid>
</item>
<item>
 <title>nagios</title>
 <link>http://www.cduce.org/~abate/nagios</link>
 <description>&lt;p&gt;This week I spent some time configuring nagios to track our infrastructure, including web services and hardware.&lt;/p&gt;

&lt;p&gt;Nagios is an interesting piece of software. It&#039;s very flexible and kinda easy to setup. I&#039;ve to say that the documentation is not particularly well written. However sites like &lt;a href=&quot;http://www.nagiosexchange.org/&quot;&gt;http://www.nagiosexchange.org/&lt;/a&gt; make like very easy. Setting it up on debian is pretty straightforward.&lt;/p&gt;

&lt;p&gt;It took me a while to understand how the various configuration files are organized and what is the object hierarchy. My small contribution today is about this plugin to check if a web service is up and running.&lt;/p&gt;

&lt;p&gt;you can put this snippet in /etc/nagios-plugins/config/url.cfg &lt;div class=&quot;geshifilter ocaml&quot; style=&quot;font-family: monospace;&quot;&gt;define command&lt;span style=&quot;color: #6c6;&quot;&gt;&amp;#123;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; command_name&amp;nbsp; &amp;nbsp; check_url&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; command_line&amp;nbsp; &amp;nbsp; /usr/lib/nagios/plugins/check_http -H $HOSTADDRESS$ -I $HOSTADDRESS$ -u $ARG1$&lt;br /&gt;
&lt;span style=&quot;color: #6c6;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
define command&lt;span style=&quot;color: #6c6;&quot;&gt;&amp;#123;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; command_name&amp;nbsp; &amp;nbsp; check_url_ssl&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; command_line&amp;nbsp; &amp;nbsp; /usr/lib/nagios/plugins/check_http -H $HOSTADDRESS$ --ssl -u $ARG1$&lt;br /&gt;
&lt;span style=&quot;color: #6c6;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;/div&gt;&lt;/p&gt;

&lt;p&gt;Then to use it, you have to add a file (eg. web_services.conf) in /etc/nagios2/conf.d with this content:&lt;/p&gt;

&lt;p&gt;&lt;div class=&quot;geshifilter ocaml&quot; style=&quot;font-family: monospace;&quot;&gt;define service &lt;span style=&quot;color: #6c6;&quot;&gt;&amp;#123;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; host_name&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;WebService&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; service_description&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;PYTHON&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; check_command&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;check_url_ssl!https://trac.&lt;span style=&quot;color: #060;&quot;&gt;cduce&lt;/span&gt;.&lt;span style=&quot;color: #060;&quot;&gt;org&lt;/span&gt;/&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; use&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;generic-service&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; notification_interval&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;span style=&quot;color: #c6c;&quot;&gt;0&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #6c6;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;/div&gt;&lt;/p&gt;

&lt;p&gt;to check if a particular service is there. The trick is to define a host named WebService to organize all service under one heading.&lt;/p&gt;

&lt;p&gt;Next Step is to integrate munin with nagios.&lt;/p&gt;

</description>
 <comments>http://www.cduce.org/~abate/nagios#comments</comments>
 <category domain="http://www.cduce.org/~abate/tags/unix">unix</category>
 <category domain="http://www.cduce.org/~abate/tags/work">work</category>
 <pubDate>Wed, 19 Mar 2008 18:48:34 +0100</pubDate>
 <dc:creator>abate</dc:creator>
 <guid isPermaLink="false">235 at http://www.cduce.org/~abate</guid>
</item>
<item>
 <title>Recursive subtyping revealed </title>
 <link>http://www.cduce.org/~abate/recursive-subtyping-revealed</link>
 <description>&lt;p&gt;The other day I read the article: &amp;quot;Recursive Subtyping revealed&amp;quot;. A Functional Pearl by Gapeyev, Levin and Pierce. This is a bit of code I wrote to convince myself of the algorithm described in the paper.&lt;/p&gt;

&lt;p&gt;You can get the article &lt;a href=&quot;http://citeseer.ist.psu.edu/gapeyev00recursive.html&quot;&gt;here&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;div class=&quot;geshifilter ocaml&quot; style=&quot;font-family: monospace;&quot;&gt;&lt;span style=&quot;color: #06c; font-weight: bold;&quot;&gt;type&lt;/span&gt; at =&lt;br /&gt;
&amp;nbsp; &amp;nbsp; |Top |Nat |Bool |Even | Odd&lt;br /&gt;
&amp;nbsp; &amp;nbsp; |Times &lt;span style=&quot;color: #06c; font-weight: bold;&quot;&gt;of&lt;/span&gt; &lt;span style=&quot;color: #6c6;&quot;&gt;&amp;#40;&lt;/span&gt; at * at &lt;span style=&quot;color: #6c6;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; |Arrow &lt;span style=&quot;color: #06c; font-weight: bold;&quot;&gt;of&lt;/span&gt; &lt;span style=&quot;color: #6c6;&quot;&gt;&amp;#40;&lt;/span&gt; at * at &lt;span style=&quot;color: #6c6;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; |Mu &lt;span style=&quot;color: #06c; font-weight: bold;&quot;&gt;of&lt;/span&gt; &lt;span style=&quot;color: #6c6;&quot;&gt;&amp;#40;&lt;/span&gt; string * at &lt;span style=&quot;color: #6c6;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; |Var &lt;span style=&quot;color: #06c; font-weight: bold;&quot;&gt;of&lt;/span&gt; string&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;color: #06c; font-weight: bold;&quot;&gt;module&lt;/span&gt; S = SortedList.&lt;span style=&quot;color: #060;&quot;&gt;Make&lt;/span&gt;&lt;span style=&quot;color: #6c6;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #06c; font-weight: bold;&quot;&gt;struct&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #06c; font-weight: bold;&quot;&gt;type&lt;/span&gt; t = &lt;span style=&quot;color: #6c6;&quot;&gt;&amp;#40;&lt;/span&gt;at * at&lt;span style=&quot;color: #6c6;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #06c; font-weight: bold;&quot;&gt;let&lt;/span&gt; &lt;a href=&quot;http://caml.inria.fr/pub/docs/manual-ocaml/libref/Pervasives.html#VALcompare&quot;&gt;&lt;span style=&quot;&quot;&gt;compare&lt;/span&gt;&lt;/a&gt; = &lt;a href=&quot;http://caml.inria.fr/pub/docs/manual-ocaml/libref/Pervasives.html#VALcompare&quot;&gt;&lt;span style=&quot;&quot;&gt;compare&lt;/span&gt;&lt;/a&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #06c; font-weight: bold;&quot;&gt;let&lt;/span&gt; hash = &lt;a href=&quot;http://caml.inria.fr/pub/docs/manual-ocaml/libref/Hashtbl.html&quot;&gt;&lt;span style=&quot;&quot;&gt;Hashtbl&lt;/span&gt;&lt;/a&gt;.&lt;span style=&quot;color: #060;&quot;&gt;hash&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #06c; font-weight: bold;&quot;&gt;let&lt;/span&gt; equal &lt;span style=&quot;color: #6c6;&quot;&gt;&amp;#40;&lt;/span&gt;t1,t2&lt;span style=&quot;color: #6c6;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #6c6;&quot;&gt;&amp;#40;&lt;/span&gt;s1,s2&lt;span style=&quot;color: #6c6;&quot;&gt;&amp;#41;&lt;/span&gt;&amp;nbsp; =&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #6c6;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #6c6;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;a href=&quot;http://caml.inria.fr/pub/docs/manual-ocaml/libref/Pervasives.html#VALcompare&quot;&gt;&lt;span style=&quot;&quot;&gt;compare&lt;/span&gt;&lt;/a&gt; t1 s1&lt;span style=&quot;color: #6c6;&quot;&gt;&amp;#41;&lt;/span&gt; = &lt;span style=&quot;color: #c6c;&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: #6c6;&quot;&gt;&amp;#41;&lt;/span&gt; &amp;amp;&amp;amp; &lt;span style=&quot;color: #6c6;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #6c6;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;a href=&quot;http://caml.inria.fr/pub/docs/manual-ocaml/libref/Pervasives.html#VALcompare&quot;&gt;&lt;span style=&quot;&quot;&gt;compare&lt;/span&gt;&lt;/a&gt; t2 s2&lt;span style=&quot;color: #6c6;&quot;&gt;&amp;#41;&lt;/span&gt; = &lt;span style=&quot;color: #c6c;&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: #6c6;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #06c; font-weight: bold;&quot;&gt;end&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #6c6;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;color: #06c; font-weight: bold;&quot;&gt;module&lt;/span&gt; B = SortedList.&lt;span style=&quot;color: #060;&quot;&gt;Make&lt;/span&gt;&lt;span style=&quot;color: #6c6;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #06c; font-weight: bold;&quot;&gt;struct&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #06c; font-weight: bold;&quot;&gt;type&lt;/span&gt; t = string&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #06c; font-weight: bold;&quot;&gt;let&lt;/span&gt; &lt;a href=&quot;http://caml.inria.fr/pub/docs/manual-ocaml/libref/Pervasives.html#VALcompare&quot;&gt;&lt;span style=&quot;&quot;&gt;compare&lt;/span&gt;&lt;/a&gt; = &lt;a href=&quot;http://caml.inria.fr/pub/docs/manual-ocaml/libref/Pervasives.html#VALcompare&quot;&gt;&lt;span style=&quot;&quot;&gt;compare&lt;/span&gt;&lt;/a&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #06c; font-weight: bold;&quot;&gt;let&lt;/span&gt; hash = &lt;a href=&quot;http://caml.inria.fr/pub/docs/manual-ocaml/libref/Hashtbl.html&quot;&gt;&lt;span style=&quot;&quot;&gt;Hashtbl&lt;/span&gt;&lt;/a&gt;.&lt;span style=&quot;color: #060;&quot;&gt;hash&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #06c; font-weight: bold;&quot;&gt;let&lt;/span&gt; equal t s&amp;nbsp; = &lt;span style=&quot;color: #6c6;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;a href=&quot;http://caml.inria.fr/pub/docs/manual-ocaml/libref/Pervasives.html#VALcompare&quot;&gt;&lt;span style=&quot;&quot;&gt;compare&lt;/span&gt;&lt;/a&gt; t s&lt;span style=&quot;color: #6c6;&quot;&gt;&amp;#41;&lt;/span&gt; = &lt;span style=&quot;color: #c6c;&quot;&gt;0&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #06c; font-weight: bold;&quot;&gt;end&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #6c6;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;color: #5d478b; font-style: italic;&quot;&gt;(* canonical substitution *)&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #06c; font-weight: bold;&quot;&gt;let&lt;/span&gt; &lt;span style=&quot;color: #06c; font-weight: bold;&quot;&gt;rec&lt;/span&gt; sub x t = &lt;span style=&quot;color: #06c; font-weight: bold;&quot;&gt;function&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; |Var s &lt;span style=&quot;color: #06c; font-weight: bold;&quot;&gt;when&lt;/span&gt; s = x -&amp;gt; t&lt;br /&gt;
&amp;nbsp; &amp;nbsp; |Times&lt;span style=&quot;color: #6c6;&quot;&gt;&amp;#40;&lt;/span&gt;t1,t2&lt;span style=&quot;color: #6c6;&quot;&gt;&amp;#41;&lt;/span&gt; -&amp;gt; Times&lt;span style=&quot;color: #6c6;&quot;&gt;&amp;#40;&lt;/span&gt;sub x t t1,sub x t t2&lt;span style=&quot;color: #6c6;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; |Arrow&lt;span style=&quot;color: #6c6;&quot;&gt;&amp;#40;&lt;/span&gt;t1,t2&lt;span style=&quot;color: #6c6;&quot;&gt;&amp;#41;&lt;/span&gt; -&amp;gt; Arrow&lt;span style=&quot;color: #6c6;&quot;&gt;&amp;#40;&lt;/span&gt;sub x t t1,sub x t t2&lt;span style=&quot;color: #6c6;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; |_ &lt;span style=&quot;color: #06c; font-weight: bold;&quot;&gt;as&lt;/span&gt; t -&amp;gt; t&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;color: #5d478b; font-style: italic;&quot;&gt;(* free variables *)&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #06c; font-weight: bold;&quot;&gt;let&lt;/span&gt; &lt;span style=&quot;color: #06c; font-weight: bold;&quot;&gt;rec&lt;/span&gt; fv = &lt;span style=&quot;color: #06c; font-weight: bold;&quot;&gt;function&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; |Var t -&amp;gt; B.&lt;span style=&quot;color: #060;&quot;&gt;add&lt;/span&gt; t B.&lt;span style=&quot;color: #060;&quot;&gt;empty&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; |Times&lt;span style=&quot;color: #6c6;&quot;&gt;&amp;#40;&lt;/span&gt;t1,t2&lt;span style=&quot;color: #6c6;&quot;&gt;&amp;#41;&lt;/span&gt; -&amp;gt; B.&lt;span style=&quot;color: #060;&quot;&gt;cup&lt;/span&gt; &lt;span style=&quot;color: #6c6;&quot;&gt;&amp;#40;&lt;/span&gt;fv t1&lt;span style=&quot;color: #6c6;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #6c6;&quot;&gt;&amp;#40;&lt;/span&gt;fv t2&lt;span style=&quot;color: #6c6;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; |Arrow&lt;span style=&quot;color: #6c6;&quot;&gt;&amp;#40;&lt;/span&gt;t1,t2&lt;span style=&quot;color: #6c6;&quot;&gt;&amp;#41;&lt;/span&gt; -&amp;gt; B.&lt;span style=&quot;color: #060;&quot;&gt;cup&lt;/span&gt; &lt;span style=&quot;color: #6c6;&quot;&gt;&amp;#40;&lt;/span&gt;fv t1&lt;span style=&quot;color: #6c6;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #6c6;&quot;&gt;&amp;#40;&lt;/span&gt;fv t2&lt;span style=&quot;color: #6c6;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; |_ -&amp;gt; B.&lt;span style=&quot;color: #060;&quot;&gt;empty&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;color: #06c; font-weight: bold;&quot;&gt;exception&lt;/span&gt; Undef &lt;span style=&quot;color: #06c; font-weight: bold;&quot;&gt;of&lt;/span&gt; &lt;span style=&quot;color: #6c6;&quot;&gt;&amp;#40;&lt;/span&gt;at * at&lt;span style=&quot;color: #6c6;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;color: #06c; font-weight: bold;&quot;&gt;let&lt;/span&gt; &lt;span style=&quot;color: #06c; font-weight: bold;&quot;&gt;rec&lt;/span&gt; subtype &lt;span style=&quot;color: #6c6;&quot;&gt;&amp;#40;&lt;/span&gt;a,s,t&lt;span style=&quot;color: #6c6;&quot;&gt;&amp;#41;&lt;/span&gt; =&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #06c; font-weight: bold;&quot;&gt;if&lt;/span&gt; s = t &lt;span style=&quot;color: #06c; font-weight: bold;&quot;&gt;then&lt;/span&gt; S.&lt;span style=&quot;color: #060;&quot;&gt;add&lt;/span&gt; &lt;span style=&quot;color: #6c6;&quot;&gt;&amp;#40;&lt;/span&gt;s,t&lt;span style=&quot;color: #6c6;&quot;&gt;&amp;#41;&lt;/span&gt; a&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #06c; font-weight: bold;&quot;&gt;else&lt;/span&gt; &lt;span style=&quot;color: #06c; font-weight: bold;&quot;&gt;if&lt;/span&gt; &lt;a href=&quot;http://caml.inria.fr/pub/docs/manual-ocaml/libref/List.html&quot;&gt;&lt;span style=&quot;&quot;&gt;List&lt;/span&gt;&lt;/a&gt;.&lt;span style=&quot;color: #060;&quot;&gt;mem&lt;/span&gt; &lt;span style=&quot;color: #6c6;&quot;&gt;&amp;#40;&lt;/span&gt;s,t&lt;span style=&quot;color: #6c6;&quot;&gt;&amp;#41;&lt;/span&gt; a &lt;span style=&quot;color: #06c; font-weight: bold;&quot;&gt;then&lt;/span&gt; a&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #06c; font-weight: bold;&quot;&gt;else&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #06c; font-weight: bold;&quot;&gt;let&lt;/span&gt; a0 = S.&lt;span style=&quot;color: #060;&quot;&gt;add&lt;/span&gt; &lt;span style=&quot;color: #6c6;&quot;&gt;&amp;#40;&lt;/span&gt;s,t&lt;span style=&quot;color: #6c6;&quot;&gt;&amp;#41;&lt;/span&gt; a &lt;span style=&quot;color: #06c; font-weight: bold;&quot;&gt;in&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #06c; font-weight: bold;&quot;&gt;match&lt;/span&gt; &lt;span style=&quot;color: #6c6;&quot;&gt;&amp;#40;&lt;/span&gt;s,t&lt;span style=&quot;color: #6c6;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #06c; font-weight: bold;&quot;&gt;with&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; |_,Top -&amp;gt; a0&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; |Mu&lt;span style=&quot;color: #6c6;&quot;&gt;&amp;#40;&lt;/span&gt;x,s1&lt;span style=&quot;color: #6c6;&quot;&gt;&amp;#41;&lt;/span&gt;,_ -&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; subtype&lt;span style=&quot;color: #6c6;&quot;&gt;&amp;#40;&lt;/span&gt;a0,sub x s s1,t&lt;span style=&quot;color: #6c6;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; |_,Mu&lt;span style=&quot;color: #6c6;&quot;&gt;&amp;#40;&lt;/span&gt;x,t1&lt;span style=&quot;color: #6c6;&quot;&gt;&amp;#41;&lt;/span&gt; -&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; subtype&lt;span style=&quot;color: #6c6;&quot;&gt;&amp;#40;&lt;/span&gt;a0,s,sub x t t1&lt;span style=&quot;color: #6c6;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; |Times&lt;span style=&quot;color: #6c6;&quot;&gt;&amp;#40;&lt;/span&gt;s1,s2&lt;span style=&quot;color: #6c6;&quot;&gt;&amp;#41;&lt;/span&gt;,Times&lt;span style=&quot;color: #6c6;&quot;&gt;&amp;#40;&lt;/span&gt;t1,t2&lt;span style=&quot;color: #6c6;&quot;&gt;&amp;#41;&lt;/span&gt; -&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #06c; font-weight: bold;&quot;&gt;let&lt;/span&gt; a1 = subtype&lt;span style=&quot;color: #6c6;&quot;&gt;&amp;#40;&lt;/span&gt;a0,s1,t1&lt;span style=&quot;color: #6c6;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #06c; font-weight: bold;&quot;&gt;in&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; subtype&lt;span style=&quot;color: #6c6;&quot;&gt;&amp;#40;&lt;/span&gt;a1,s2,t2&lt;span style=&quot;color: #6c6;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; |Arrow&lt;span style=&quot;color: #6c6;&quot;&gt;&amp;#40;&lt;/span&gt;s1,s2&lt;span style=&quot;color: #6c6;&quot;&gt;&amp;#41;&lt;/span&gt;,Arrow&lt;span style=&quot;color: #6c6;&quot;&gt;&amp;#40;&lt;/span&gt;t1,t2&lt;span style=&quot;color: #6c6;&quot;&gt;&amp;#41;&lt;/span&gt; -&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #06c; font-weight: bold;&quot;&gt;let&lt;/span&gt; a1 = subtype&lt;span style=&quot;color: #6c6;&quot;&gt;&amp;#40;&lt;/span&gt;a0,t1,s1&lt;span style=&quot;color: #6c6;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #06c; font-weight: bold;&quot;&gt;in&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; subtype&lt;span style=&quot;color: #6c6;&quot;&gt;&amp;#40;&lt;/span&gt;a1,s2,t2&lt;span style=&quot;color: #6c6;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; |_ -&amp;gt; &lt;span style=&quot;color: #06c; font-weight: bold;&quot;&gt;raise&lt;/span&gt; &lt;span style=&quot;color: #6c6;&quot;&gt;&amp;#40;&lt;/span&gt;Undef &lt;span style=&quot;color: #6c6;&quot;&gt;&amp;#40;&lt;/span&gt;s,t&lt;span style=&quot;color: #6c6;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #6c6;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;color: #06c; font-weight: bold;&quot;&gt;let&lt;/span&gt; &lt;span style=&quot;color: #6c6;&quot;&gt;&amp;#40;&lt;/span&gt;&amp;lt;:&lt;span style=&quot;color: #6c6;&quot;&gt;&amp;#41;&lt;/span&gt; t s = subtype&lt;span style=&quot;color: #6c6;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #6c6;&quot;&gt;&amp;#91;&lt;/span&gt;&lt;span style=&quot;color: #6c6;&quot;&gt;&amp;#93;&lt;/span&gt;,t,s&lt;span style=&quot;color: #6c6;&quot;&gt;&amp;#41;&lt;/span&gt;;;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;color: #5d478b; font-style: italic;&quot;&gt;(* ------------- parser -------------------*)&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #06c; font-weight: bold;&quot;&gt;open&lt;/span&gt; Camlp4.&lt;span style=&quot;color: #060;&quot;&gt;PreCast&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #06c; font-weight: bold;&quot;&gt;module&lt;/span&gt; TypeGram = MakeGram&lt;span style=&quot;color: #6c6;&quot;&gt;&amp;#40;&lt;/span&gt;Lexer&lt;span style=&quot;color: #6c6;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;color: #06c; font-weight: bold;&quot;&gt;let&lt;/span&gt; expression = TypeGram.&lt;span style=&quot;color: #060;&quot;&gt;Entry&lt;/span&gt;.&lt;span style=&quot;color: #060;&quot;&gt;mk&lt;/span&gt; &lt;span style=&quot;color: #3cb371;&quot;&gt;&amp;quot;expression&amp;quot;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
EXTEND TypeGram&lt;br /&gt;
&amp;nbsp; GLOBAL: expression;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; expression: &lt;span style=&quot;color: #6c6;&quot;&gt;&amp;#91;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #3cb371;&quot;&gt;&amp;quot;arrow&amp;quot;&lt;/span&gt; &lt;span style=&quot;color: #6c6;&quot;&gt;&amp;#91;&lt;/span&gt; e1 = SELF; &lt;span style=&quot;color: #3cb371;&quot;&gt;&amp;quot;-&amp;gt;&amp;quot;&lt;/span&gt;; e2 = SELF -&amp;gt; Arrow&lt;span style=&quot;color: #6c6;&quot;&gt;&amp;#40;&lt;/span&gt;e1, e2&lt;span style=&quot;color: #6c6;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #6c6;&quot;&gt;&amp;#93;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; | &lt;span style=&quot;color: #3cb371;&quot;&gt;&amp;quot;prod&amp;quot;&lt;/span&gt;&amp;nbsp; &lt;span style=&quot;color: #6c6;&quot;&gt;&amp;#91;&lt;/span&gt; e1 = SELF; &lt;span style=&quot;color: #3cb371;&quot;&gt;&amp;quot;x&amp;quot;&lt;/span&gt;;&amp;nbsp; e2 = SELF -&amp;gt; Times&lt;span style=&quot;color: #6c6;&quot;&gt;&amp;#40;&lt;/span&gt;e1, e2&lt;span style=&quot;color: #6c6;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #6c6;&quot;&gt;&amp;#93;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; | &lt;span style=&quot;color: #3cb371;&quot;&gt;&amp;quot;var&amp;quot;&lt;/span&gt; &lt;span style=&quot;color: #6c6;&quot;&gt;&amp;#91;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #3cb371;&quot;&gt;&amp;quot;Nat&amp;quot;&lt;/span&gt; -&amp;gt; Nat&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; | &lt;span style=&quot;color: #3cb371;&quot;&gt;&amp;quot;Even&amp;quot;&lt;/span&gt; -&amp;gt; Even&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; | &lt;span style=&quot;color: #3cb371;&quot;&gt;&amp;quot;Odd&amp;quot;&lt;/span&gt; -&amp;gt; Odd&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; | &lt;span style=&quot;color: #3cb371;&quot;&gt;&amp;quot;Bool&amp;quot;&lt;/span&gt; -&amp;gt; Bool&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; | &lt;span style=&quot;color: #3cb371;&quot;&gt;&amp;quot;T&amp;quot;&lt;/span&gt; -&amp;gt; Top&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; | &lt;span style=&quot;color: #3cb371;&quot;&gt;&amp;quot;mu&amp;quot;&lt;/span&gt;; `UIDENT x ; &lt;span style=&quot;color: #3cb371;&quot;&gt;&amp;quot;.&amp;quot;&lt;/span&gt; ; e = SELF -&amp;gt; Mu&lt;span style=&quot;color: #6c6;&quot;&gt;&amp;#40;&lt;/span&gt;x,e&lt;span style=&quot;color: #6c6;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; | `UIDENT x -&amp;gt; Var x&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; | &lt;span style=&quot;color: #3cb371;&quot;&gt;&amp;quot;(&amp;quot;&lt;/span&gt;; e = SELF; &lt;span style=&quot;color: #3cb371;&quot;&gt;&amp;quot;)&amp;quot;&lt;/span&gt; -&amp;gt; e&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #6c6;&quot;&gt;&amp;#93;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &lt;span style=&quot;color: #6c6;&quot;&gt;&amp;#93;&lt;/span&gt;;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;color: #06c; font-weight: bold;&quot;&gt;END&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;color: #06c; font-weight: bold;&quot;&gt;let&lt;/span&gt; p s = TypeGram.&lt;span style=&quot;color: #060;&quot;&gt;parse_string&lt;/span&gt; expression &lt;span style=&quot;color: #6c6;&quot;&gt;&amp;#40;&lt;/span&gt;Loc.&lt;span style=&quot;color: #060;&quot;&gt;mk&lt;/span&gt; &lt;span style=&quot;color: #3cb371;&quot;&gt;&amp;quot;&amp;lt;string&amp;gt;&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #6c6;&quot;&gt;&amp;#41;&lt;/span&gt; s&lt;br /&gt;
&lt;span style=&quot;color: #5d478b; font-style: italic;&quot;&gt;(* ------------- parser -------------------*)&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;color: #5d478b; font-style: italic;&quot;&gt;(* Examples *)&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #06c; font-weight: bold;&quot;&gt;let&lt;/span&gt; a = p &lt;span style=&quot;color: #3cb371;&quot;&gt;&amp;quot;mu X . ( Nat -&amp;gt; (Nat x X))&amp;quot;&lt;/span&gt; ;;&lt;br /&gt;
&lt;span style=&quot;color: #06c; font-weight: bold;&quot;&gt;let&lt;/span&gt; b = p &lt;span style=&quot;color: #3cb371;&quot;&gt;&amp;quot;Nat -&amp;gt; (Nat x (mu X . (Nat -&amp;gt; (Nat x X))))&amp;quot;&lt;/span&gt; ;;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;color: #06c; font-weight: bold;&quot;&gt;let&lt;/span&gt; d = p &lt;span style=&quot;color: #3cb371;&quot;&gt;&amp;quot;mu X . ( Nat -&amp;gt; (Even x X))&amp;quot;&lt;/span&gt; ;;&lt;br /&gt;
&lt;span style=&quot;color: #06c; font-weight: bold;&quot;&gt;let&lt;/span&gt; e = p &lt;span style=&quot;color: #3cb371;&quot;&gt;&amp;quot;mu X . ( Even -&amp;gt; (Nat x X))&amp;quot;&lt;/span&gt; ;;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;color: #5d478b; font-style: italic;&quot;&gt;(* suppose Even is subtype of Nat *)&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #06c; font-weight: bold;&quot;&gt;let&lt;/span&gt; &lt;span style=&quot;color: #6c6;&quot;&gt;&amp;#40;&lt;/span&gt;&amp;lt;::&lt;span style=&quot;color: #6c6;&quot;&gt;&amp;#41;&lt;/span&gt; t s = subtype&lt;span style=&quot;color: #6c6;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #6c6;&quot;&gt;&amp;#91;&lt;/span&gt;Even,Nat&lt;span style=&quot;color: #6c6;&quot;&gt;&amp;#93;&lt;/span&gt;,t,s&lt;span style=&quot;color: #6c6;&quot;&gt;&amp;#41;&lt;/span&gt;;;&lt;br /&gt;
d &amp;lt;:: e;;&lt;/div&gt;&lt;/p&gt;

</description>
 <comments>http://www.cduce.org/~abate/recursive-subtyping-revealed#comments</comments>
 <category domain="http://www.cduce.org/~abate/tags/ocaml">ocaml</category>
 <category domain="http://www.cduce.org/~abate/tags/subtyping">subtyping</category>
 <pubDate>Fri, 14 Mar 2008 14:16:37 +0100</pubDate>
 <dc:creator>admin</dc:creator>
 <guid isPermaLink="false">234 at http://www.cduce.org/~abate</guid>
</item>
<item>
 <title>mysql + ssl and xen headahe</title>
 <link>http://www.cduce.org/~abate/mysql-ssl-and-xen-headahe</link>
 <description>&lt;p&gt;Well today I tried to understand why our production server (shame shame) has rebooted twice in a row in the last 3 days. The only visible problem in the logs is the infamous xen error : &amp;quot; xen_net: Memory squeeze in netback driver.&amp;quot; . Googling around it seems kinda common and the recommended solution is to add dom0-min-mem to xend.conf and dom0_mem as a kernel option. I&#039;ve done that and updated the xen hypervisor to the latest bakcported version. The machine is up and running and everything seems fine at the moment. I didn&#039;t touch the kernel. This is an other avenue that I might explore if what I&#039;ve done today didn&#039;t fix the problem.&lt;/p&gt;

&lt;p&gt;The second problem today was related to mysql. I wanted to configure it to use SSL. Configuring mysql and the client is not too &lt;a href=&quot;http://www.waterlovinghead.com/MysqlSSL&quot;&gt;difficult&lt;/a&gt;. And this is working just fine. On the other hand I haven&#039;t manage to convince php5 to connect via ssl. Googleing around didn&#039;t help much.&lt;/p&gt;

&lt;p&gt;By default mysql allows non encrypted connections. To force the connection to use SSL, you must specify it per user basis with &lt;code class=&quot;geshifilter ocaml&quot;&gt;REQUIRE SSL&lt;/code&gt; in a grant statement.&lt;/p&gt;

</description>
 <comments>http://www.cduce.org/~abate/mysql-ssl-and-xen-headahe#comments</comments>
 <category domain="http://www.cduce.org/~abate/tags/unix">unix</category>
 <category domain="http://www.cduce.org/~abate/tags/work">work</category>
 <pubDate>Tue, 11 Mar 2008 17:37:09 +0100</pubDate>
 <dc:creator>abate</dc:creator>
 <guid isPermaLink="false">233 at http://www.cduce.org/~abate</guid>
</item>
<item>
 <title>magacli, openipmi, ipmitool</title>
 <link>http://www.cduce.org/~abate/magacli-openipmi-ipmitool</link>
 <description>&lt;p&gt;If you manage a dell poweredge, it will come a time where you are curious to know about the health of your machine. These are few notes.&lt;/p&gt;

&lt;p&gt;The first thing you will try is probably the dell management server. It&#039;s the usual java monster with web interface and all in it. I don&#039;t like it. So I installed openimpi and got the megacli bianry from the lsi website.&lt;/p&gt;

&lt;p&gt;openimpi is easy: &lt;code class=&quot;geshifilter ocaml&quot;&gt;apt-get install opemimpi impitools&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Then we need to load the impi kernel modules: &lt;div class=&quot;geshifilter ocaml&quot; style=&quot;font-family: monospace;&quot;&gt;ipmi_si&lt;br /&gt;
ipmi_devintf&lt;br /&gt;
ipmi_msghandler&lt;br /&gt;
ipmi_poweroff&lt;br /&gt;
ipmi_watchdog&lt;/div&gt;&lt;/p&gt;

&lt;p&gt;more info about impi on debian can be found &lt;a href=&quot;http://buttersideup.com/docs/howto/IPMI_on_Debian.html&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;The next thing is to get the LSI raid monitoring tool. &lt;a href=&quot;https://twiki.cern.ch/twiki/bin/view/FIOgroup/DiskRefPerc&quot;&gt;This&lt;/a&gt; is a compendium for this tool. This utility is not packaged for debian and actually is a 32 bits binary. You can download it from &lt;a href=&quot;http://www.lsi.com/support/downloads/megaraid/miscellaneous/linux/1.01.39_Linux_Cli.zip&quot;&gt; here&lt;/a&gt;. Then you just need to extract the binary with unzip and rpm.&lt;/p&gt;

&lt;p&gt;If you really want to use omsa this &lt;a href=&quot;http://ubuntuforums.org/showpost.php?p=2336772&amp;amp;postcount=54&quot;&gt;page &lt;/a&gt; gives you all the info you need.&lt;/p&gt;


&lt;h3 id=&quot;toc0&quot;&gt;Monitoring Script&lt;/h3&gt;
 From &lt;a href=&quot;http://people.binf.ku.dk/~hanne/blog/?postid=11&quot;&gt;HERE&lt;/a&gt;. &lt;div class=&quot;geshifilter ocaml&quot; style=&quot;font-family: monospace;&quot;&gt;#!/bin/sh&lt;br /&gt;
CONT=&lt;span style=&quot;color: #3cb371;&quot;&gt;&amp;quot;a0&amp;quot;&lt;/span&gt;&lt;br /&gt;
STATUS=&lt;span style=&quot;color: #c6c;&quot;&gt;0&lt;/span&gt;&lt;br /&gt;
MEGACLI=/root/bin/megacli&lt;br /&gt;
&lt;br /&gt;
echo -n &lt;span style=&quot;color: #3cb371;&quot;&gt;&amp;quot;Checking RAID status on &amp;quot;&lt;/span&gt;&lt;br /&gt;
hostname&lt;br /&gt;
&lt;span style=&quot;color: #06c; font-weight: bold;&quot;&gt;for&lt;/span&gt; a &lt;span style=&quot;color: #06c; font-weight: bold;&quot;&gt;in&lt;/span&gt; $CONT&lt;br /&gt;
&amp;nbsp;&lt;span style=&quot;color: #06c; font-weight: bold;&quot;&gt;do&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp;NAME=`$MEGACLI -AdpAllInfo -$a |grep &lt;span style=&quot;color: #3cb371;&quot;&gt;&amp;quot;Product Name&amp;quot;&lt;/span&gt; | cut -d: -f2`&lt;br /&gt;
&amp;nbsp; &amp;nbsp;echo &lt;span style=&quot;color: #3cb371;&quot;&gt;&amp;quot;Controller $a: $NAME&amp;quot;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;noonline=`$MEGACLI PDList -$a | grep Online | wc -l`&lt;br /&gt;
&amp;nbsp; &amp;nbsp;echo &lt;span style=&quot;color: #3cb371;&quot;&gt;&amp;quot;No of Physical disks online : $noonline&amp;quot;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;DEGRADED=`$MEGACLI -AdpAllInfo -a0&amp;nbsp; |grep &lt;span style=&quot;color: #3cb371;&quot;&gt;&amp;quot;Degrade&amp;quot;&lt;/span&gt;`&lt;br /&gt;
&amp;nbsp; &amp;nbsp;echo $DEGRADED&lt;br /&gt;
&amp;nbsp; &amp;nbsp;NUM_DEGRADED=`echo $DEGRADED |cut -d&lt;span style=&quot;color: #3cb371;&quot;&gt;&amp;quot; &amp;quot;&lt;/span&gt; -f3`&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&lt;span style=&quot;color: #6c6;&quot;&gt;&amp;#91;&lt;/span&gt; &lt;span style=&quot;color: #3cb371;&quot;&gt;&amp;quot;$NUM_DEGRADED&amp;quot;&lt;/span&gt; -ne &lt;span style=&quot;color: #c6c;&quot;&gt;0&lt;/span&gt; &lt;span style=&quot;color: #6c6;&quot;&gt;&amp;#93;&lt;/span&gt; &amp;amp;&amp;amp; STATUS=&lt;span style=&quot;color: #c6c;&quot;&gt;1&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;FAILED=`$MEGACLI -AdpAllInfo -a0&amp;nbsp; |grep &lt;span style=&quot;color: #3cb371;&quot;&gt;&amp;quot;Failed Disks&amp;quot;&lt;/span&gt;`&lt;br /&gt;
&amp;nbsp; &amp;nbsp;echo $FAILED&lt;br /&gt;
&amp;nbsp; &amp;nbsp;NUM_FAILED=`echo $FAILED |cut -d&lt;span style=&quot;color: #3cb371;&quot;&gt;&amp;quot; &amp;quot;&lt;/span&gt; -f4`&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&lt;span style=&quot;color: #6c6;&quot;&gt;&amp;#91;&lt;/span&gt; &lt;span style=&quot;color: #3cb371;&quot;&gt;&amp;quot;$NUM_FAILED&amp;quot;&lt;/span&gt; -ne &lt;span style=&quot;color: #c6c;&quot;&gt;0&lt;/span&gt; &lt;span style=&quot;color: #6c6;&quot;&gt;&amp;#93;&lt;/span&gt; &amp;amp;&amp;amp; STATUS=&lt;span style=&quot;color: #c6c;&quot;&gt;1&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&lt;span style=&quot;color: #06c; font-weight: bold;&quot;&gt;done&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;a href=&quot;http://caml.inria.fr/pub/docs/manual-ocaml/libref/Pervasives.html#VALexit&quot;&gt;&lt;span style=&quot;&quot;&gt;exit&lt;/span&gt;&lt;/a&gt; $STATUS&lt;/div&gt;
&lt;h3 id=&quot;toc1&quot;&gt;Open source RAID card monitor&lt;/h3&gt;
 &lt;a href=&quot;http://megactl.svn.sourceforge.net/viewvc/megactl/trunk/&quot;&gt;http://megactl.svn.sourceforge.net/viewvc/megactl/trunk/&lt;/a&gt;&lt;p&gt;It would be nice to have a munin plugin for this monitoring tools.&lt;/p&gt;

</description>
 <comments>http://www.cduce.org/~abate/magacli-openipmi-ipmitool#comments</comments>
 <category domain="http://www.cduce.org/~abate/tags/unix">unix</category>
 <pubDate>Fri, 07 Mar 2008 13:44:03 +0100</pubDate>
 <dc:creator>abate</dc:creator>
 <guid isPermaLink="false">232 at http://www.cduce.org/~abate</guid>
</item>
<item>
 <title>ocamlbuild + camlp4 + ocamlfind</title>
 <link>http://www.cduce.org/~abate/ocamlbuild-camlp4-ocamlfind</link>
 <description>&lt;p&gt;Recently I tried to answer to a problem posed on the OCaml mailing list. Basically the problem is how to compile using  ocamlbuild using ocamlfind and camlp4. The Camlp4 wiki has already all the ingredients. Here I mix them up in a short example.&lt;/p&gt;

&lt;ol&gt;
    &lt;li&gt; _tags : is the ocamlbuild dep file&lt;/li&gt;
    &lt;li&gt; bar.ml : is a ml file that uses the syntax extension pa_float to compile.&lt;/li&gt;
    &lt;li&gt; foo.ml : is a ml file that depends on bar.ml and the str module (fetched via ocamlfind)&lt;/li&gt;
    &lt;li&gt; pa_float.ml : is the source code of the camlp4 syntax extension.&lt;/li&gt;
&lt;/ol&gt;


&lt;h3 id=&quot;toc0&quot;&gt;The code&lt;/h3&gt;
&lt;p&gt;&lt;strong&gt;_tags&lt;/strong&gt; &lt;div class=&quot;geshifilter ocaml&quot; style=&quot;font-family: monospace;&quot;&gt;&lt;span style=&quot;color: #3cb371;&quot;&gt;&amp;quot;pa_float.ml&amp;quot;&lt;/span&gt;: use_camlp4, pp&lt;span style=&quot;color: #6c6;&quot;&gt;&amp;#40;&lt;/span&gt;camlp4of&lt;span style=&quot;color: #6c6;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #3cb371;&quot;&gt;&amp;quot;bar.ml&amp;quot;&lt;/span&gt;: camlp4o, use_float&lt;/div&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;bar.ml&lt;/strong&gt; &lt;div class=&quot;geshifilter ocaml&quot; style=&quot;font-family: monospace;&quot;&gt;&lt;span style=&quot;color: #06c; font-weight: bold;&quot;&gt;let&lt;/span&gt; x = Float.&lt;span style=&quot;color: #060;&quot;&gt;&lt;span style=&quot;color: #6c6;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;/span&gt; &lt;span style=&quot;color: #c6c;&quot;&gt;3&lt;/span&gt;/&lt;span style=&quot;color: #c6c;&quot;&gt;2&lt;/span&gt; - &lt;a href=&quot;http://caml.inria.fr/pub/docs/manual-ocaml/libref/Pervasives.html#VALsqrt&quot;&gt;&lt;span style=&quot;&quot;&gt;sqrt&lt;/span&gt;&lt;/a&gt; &lt;span style=&quot;color: #6c6;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #c6c;&quot;&gt;1&lt;/span&gt;/&lt;span style=&quot;color: #c6c;&quot;&gt;3&lt;/span&gt;&lt;span style=&quot;color: #6c6;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #6c6;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #06c; font-weight: bold;&quot;&gt;let&lt;/span&gt; f x =&lt;br /&gt;
&amp;nbsp; Float.&lt;span style=&quot;color: #060;&quot;&gt;&lt;span style=&quot;color: #6c6;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #06c; font-weight: bold;&quot;&gt;let&lt;/span&gt; pi = &lt;a href=&quot;http://caml.inria.fr/pub/docs/manual-ocaml/libref/Pervasives.html#VALacos&quot;&gt;&lt;span style=&quot;&quot;&gt;acos&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot;color: #6c6;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #c6c;&quot;&gt;-1&lt;/span&gt;&lt;span style=&quot;color: #6c6;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #06c; font-weight: bold;&quot;&gt;in&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; x/&lt;span style=&quot;color: #6c6;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #c6c;&quot;&gt;2&lt;/span&gt;*pi&lt;span style=&quot;color: #6c6;&quot;&gt;&amp;#41;&lt;/span&gt; - x**&lt;span style=&quot;color: #6c6;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #c6c;&quot;&gt;2&lt;/span&gt;/&lt;span style=&quot;color: #c6c;&quot;&gt;3&lt;/span&gt;&lt;span style=&quot;color: #6c6;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &lt;span style=&quot;color: #6c6;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;/div&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;foo.ml&lt;/strong&gt; &lt;div class=&quot;geshifilter ocaml&quot; style=&quot;font-family: monospace;&quot;&gt;&lt;span style=&quot;color: #06c; font-weight: bold;&quot;&gt;open&lt;/span&gt; &lt;a href=&quot;http://caml.inria.fr/pub/docs/manual-ocaml/libref/Str.html&quot;&gt;&lt;span style=&quot;&quot;&gt;Str&lt;/span&gt;&lt;/a&gt;&lt;br /&gt;
&lt;span style=&quot;color: #06c; font-weight: bold;&quot;&gt;let&lt;/span&gt; x = Bar.&lt;span style=&quot;color: #060;&quot;&gt;x&lt;/span&gt;&lt;/div&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;myocamlbuild.ml&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;div class=&quot;geshifilter ocaml&quot; style=&quot;font-family: monospace;&quot;&gt;&lt;span style=&quot;color: #06c; font-weight: bold;&quot;&gt;open&lt;/span&gt; Ocamlbuild_plugin;;&lt;br /&gt;
&lt;span style=&quot;color: #06c; font-weight: bold;&quot;&gt;open&lt;/span&gt; Command;;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;color: #06c; font-weight: bold;&quot;&gt;let&lt;/span&gt; packages = &lt;span style=&quot;color: #3cb371;&quot;&gt;&amp;quot;str&amp;quot;&lt;/span&gt;;;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;color: #06c; font-weight: bold;&quot;&gt;let&lt;/span&gt; ocamlfind x = S&lt;span style=&quot;color: #6c6;&quot;&gt;&amp;#91;&lt;/span&gt;A&lt;span style=&quot;color: #3cb371;&quot;&gt;&amp;quot;ocamlfind&amp;quot;&lt;/span&gt;; x; A&lt;span style=&quot;color: #3cb371;&quot;&gt;&amp;quot;-package&amp;quot;&lt;/span&gt;; A packages&lt;span style=&quot;color: #6c6;&quot;&gt;&amp;#93;&lt;/span&gt;;;&lt;br /&gt;
&lt;br /&gt;
dispatch &lt;span style=&quot;color: #06c; font-weight: bold;&quot;&gt;begin&lt;/span&gt; &lt;span style=&quot;color: #06c; font-weight: bold;&quot;&gt;function&lt;/span&gt;&lt;br /&gt;
| Before_options -&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; Options.&lt;span style=&quot;color: #060;&quot;&gt;ocamlc&lt;/span&gt; := ocamlfind&amp;amp; A&lt;span style=&quot;color: #3cb371;&quot;&gt;&amp;quot;ocamlc&amp;quot;&lt;/span&gt;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; Options.&lt;span style=&quot;color: #060;&quot;&gt;ocamlopt&lt;/span&gt; := ocamlfind&amp;amp; A&lt;span style=&quot;color: #3cb371;&quot;&gt;&amp;quot;ocamlopt&amp;quot;&lt;/span&gt;;&lt;br /&gt;
&lt;br /&gt;
| After_rules -&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; flag &lt;span style=&quot;color: #6c6;&quot;&gt;&amp;#91;&lt;/span&gt;&lt;span style=&quot;color: #3cb371;&quot;&gt;&amp;quot;ocaml&amp;quot;&lt;/span&gt;; &lt;span style=&quot;color: #3cb371;&quot;&gt;&amp;quot;pp&amp;quot;&lt;/span&gt;; &lt;span style=&quot;color: #3cb371;&quot;&gt;&amp;quot;use_float&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #6c6;&quot;&gt;&amp;#93;&lt;/span&gt; &lt;span style=&quot;color: #6c6;&quot;&gt;&amp;#40;&lt;/span&gt;A&lt;span style=&quot;color: #3cb371;&quot;&gt;&amp;quot;pa_float.cmo&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #6c6;&quot;&gt;&amp;#41;&lt;/span&gt;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; flag &lt;span style=&quot;color: #6c6;&quot;&gt;&amp;#91;&lt;/span&gt;&lt;span style=&quot;color: #3cb371;&quot;&gt;&amp;quot;ocaml&amp;quot;&lt;/span&gt;; &lt;span style=&quot;color: #3cb371;&quot;&gt;&amp;quot;link&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #6c6;&quot;&gt;&amp;#93;&lt;/span&gt; &lt;span style=&quot;color: #6c6;&quot;&gt;&amp;#40;&lt;/span&gt;A&lt;span style=&quot;color: #3cb371;&quot;&gt;&amp;quot;-linkpkg&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #6c6;&quot;&gt;&amp;#41;&lt;/span&gt;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; dep&amp;nbsp; &lt;span style=&quot;color: #6c6;&quot;&gt;&amp;#91;&lt;/span&gt;&lt;span style=&quot;color: #3cb371;&quot;&gt;&amp;quot;ocaml&amp;quot;&lt;/span&gt;; &lt;span style=&quot;color: #3cb371;&quot;&gt;&amp;quot;ocamldep&amp;quot;&lt;/span&gt;; &lt;span style=&quot;color: #3cb371;&quot;&gt;&amp;quot;use_float&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #6c6;&quot;&gt;&amp;#93;&lt;/span&gt; &lt;span style=&quot;color: #6c6;&quot;&gt;&amp;#91;&lt;/span&gt;&lt;span style=&quot;color: #3cb371;&quot;&gt;&amp;quot;pa_float.cmo&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #6c6;&quot;&gt;&amp;#93;&lt;/span&gt;;&lt;br /&gt;
| _ -&amp;gt; &lt;span style=&quot;color: #6c6;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #6c6;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #06c; font-weight: bold;&quot;&gt;end&lt;/span&gt;;;&lt;/div&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;pa_float.ml&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;div class=&quot;geshifilter ocaml&quot; style=&quot;font-family: monospace;&quot;&gt;&lt;span style=&quot;color: #06c; font-weight: bold;&quot;&gt;module&lt;/span&gt; Id = &lt;span style=&quot;color: #06c; font-weight: bold;&quot;&gt;struct&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &lt;span style=&quot;color: #06c; font-weight: bold;&quot;&gt;let&lt;/span&gt; name = &lt;span style=&quot;color: #3cb371;&quot;&gt;&amp;quot;pa_float&amp;quot;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &lt;span style=&quot;color: #06c; font-weight: bold;&quot;&gt;let&lt;/span&gt; version = &lt;span style=&quot;color: #3cb371;&quot;&gt;&amp;quot;1.0&amp;quot;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #06c; font-weight: bold;&quot;&gt;end&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;color: #06c; font-weight: bold;&quot;&gt;open&lt;/span&gt; Camlp4&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;color: #06c; font-weight: bold;&quot;&gt;module&lt;/span&gt; Make &lt;span style=&quot;color: #6c6;&quot;&gt;&amp;#40;&lt;/span&gt;Syntax : &lt;span style=&quot;color: #06c; font-weight: bold;&quot;&gt;Sig&lt;/span&gt;.&lt;span style=&quot;color: #060;&quot;&gt;Camlp4Syntax&lt;/span&gt;&lt;span style=&quot;color: #6c6;&quot;&gt;&amp;#41;&lt;/span&gt; = &lt;span style=&quot;color: #06c; font-weight: bold;&quot;&gt;struct&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &lt;span style=&quot;color: #06c; font-weight: bold;&quot;&gt;open&lt;/span&gt; &lt;span style=&quot;color: #06c; font-weight: bold;&quot;&gt;Sig&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &lt;span style=&quot;color: #06c; font-weight: bold;&quot;&gt;include&lt;/span&gt; Syntax&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &lt;span style=&quot;color: #06c; font-weight: bold;&quot;&gt;class&lt;/span&gt; float_subst _loc = object&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #06c; font-weight: bold;&quot;&gt;inherit&lt;/span&gt; Ast.&lt;span style=&quot;color: #060;&quot;&gt;map&lt;/span&gt; &lt;span style=&quot;color: #06c; font-weight: bold;&quot;&gt;as&lt;/span&gt; super&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #06c; font-weight: bold;&quot;&gt;method&lt;/span&gt; _Loc_t _ = _loc&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #06c; font-weight: bold;&quot;&gt;method&lt;/span&gt; expr =&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #06c; font-weight: bold;&quot;&gt;function&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; | &amp;lt;:expr&amp;lt; &lt;span style=&quot;color: #6c6;&quot;&gt;&amp;#40;&lt;/span&gt; + &lt;span style=&quot;color: #6c6;&quot;&gt;&amp;#41;&lt;/span&gt; &amp;gt;&amp;gt; -&amp;gt; &amp;lt;:expr&amp;lt; &lt;span style=&quot;color: #6c6;&quot;&gt;&amp;#40;&lt;/span&gt; +. &lt;span style=&quot;color: #6c6;&quot;&gt;&amp;#41;&lt;/span&gt; &amp;gt;&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; | &amp;lt;:expr&amp;lt; &lt;span style=&quot;color: #6c6;&quot;&gt;&amp;#40;&lt;/span&gt; - &lt;span style=&quot;color: #6c6;&quot;&gt;&amp;#41;&lt;/span&gt; &amp;gt;&amp;gt; -&amp;gt; &amp;lt;:expr&amp;lt; &lt;span style=&quot;color: #6c6;&quot;&gt;&amp;#40;&lt;/span&gt; -. &lt;span style=&quot;color: #6c6;&quot;&gt;&amp;#41;&lt;/span&gt; &amp;gt;&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; | &amp;lt;:expr&amp;lt; &lt;span style=&quot;color: #6c6;&quot;&gt;&amp;#40;&lt;/span&gt; * &lt;span style=&quot;color: #6c6;&quot;&gt;&amp;#41;&lt;/span&gt; &amp;gt;&amp;gt; -&amp;gt; &amp;lt;:expr&amp;lt; &lt;span style=&quot;color: #6c6;&quot;&gt;&amp;#40;&lt;/span&gt; *. &lt;span style=&quot;color: #6c6;&quot;&gt;&amp;#41;&lt;/span&gt; &amp;gt;&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; | &amp;lt;:expr&amp;lt; &lt;span style=&quot;color: #6c6;&quot;&gt;&amp;#40;&lt;/span&gt; / &lt;span style=&quot;color: #6c6;&quot;&gt;&amp;#41;&lt;/span&gt; &amp;gt;&amp;gt; -&amp;gt; &amp;lt;:expr&amp;lt; &lt;span style=&quot;color: #6c6;&quot;&gt;&amp;#40;&lt;/span&gt; /. &lt;span style=&quot;color: #6c6;&quot;&gt;&amp;#41;&lt;/span&gt; &amp;gt;&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; | &amp;lt;:expr&amp;lt; $int:i$ &amp;gt;&amp;gt; -&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #06c; font-weight: bold;&quot;&gt;let&lt;/span&gt; f = &lt;a href=&quot;http://caml.inria.fr/pub/docs/manual-ocaml/libref/Pervasives.html#VALfloat&quot;&gt;&lt;span style=&quot;&quot;&gt;float&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot;color: #6c6;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;a href=&quot;http://caml.inria.fr/pub/docs/manual-ocaml/libref/Pervasives.html#VALint_of_string&quot;&gt;&lt;span style=&quot;&quot;&gt;int_of_string&lt;/span&gt;&lt;/a&gt; i&lt;span style=&quot;color: #6c6;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #06c; font-weight: bold;&quot;&gt;in&lt;/span&gt; &amp;lt;:expr&amp;lt; $`flo:f$ &amp;gt;&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; | e -&amp;gt; super#expr e&lt;br /&gt;
&amp;nbsp; &lt;span style=&quot;color: #06c; font-weight: bold;&quot;&gt;end&lt;/span&gt;;;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; EXTEND Gram&lt;br /&gt;
&amp;nbsp; &amp;nbsp; GLOBAL: expr;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; expr: LEVEL &lt;span style=&quot;color: #3cb371;&quot;&gt;&amp;quot;simple&amp;quot;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #6c6;&quot;&gt;&amp;#91;&lt;/span&gt; &lt;span style=&quot;color: #6c6;&quot;&gt;&amp;#91;&lt;/span&gt; &lt;span style=&quot;color: #3cb371;&quot;&gt;&amp;quot;Float&amp;quot;&lt;/span&gt;; &lt;span style=&quot;color: #3cb371;&quot;&gt;&amp;quot;.&amp;quot;&lt;/span&gt;; &lt;span style=&quot;color: #3cb371;&quot;&gt;&amp;quot;(&amp;quot;&lt;/span&gt;; e = SELF; &lt;span style=&quot;color: #3cb371;&quot;&gt;&amp;quot;)&amp;quot;&lt;/span&gt; -&amp;gt; &lt;span style=&quot;color: #6c6;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #06c; font-weight: bold;&quot;&gt;new&lt;/span&gt; float_subst _loc&lt;span style=&quot;color: #6c6;&quot;&gt;&amp;#41;&lt;/span&gt;#expr e &lt;span style=&quot;color: #6c6;&quot;&gt;&amp;#93;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #6c6;&quot;&gt;&amp;#93;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; ;&lt;br /&gt;
&amp;nbsp; &lt;span style=&quot;color: #06c; font-weight: bold;&quot;&gt;END&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #06c; font-weight: bold;&quot;&gt;end&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;color: #06c; font-weight: bold;&quot;&gt;let&lt;/span&gt; &lt;span style=&quot;color: #06c; font-weight: bold;&quot;&gt;module&lt;/span&gt; M = Register.&lt;span style=&quot;color: #060;&quot;&gt;OCamlSyntaxExtension&lt;/span&gt; Id Make &lt;span style=&quot;color: #06c; font-weight: bold;&quot;&gt;in&lt;/span&gt; &lt;span style=&quot;color: #6c6;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #6c6;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;/div&gt;&lt;/p&gt;


&lt;h3 id=&quot;toc1&quot;&gt;To Compile&lt;/h3&gt;
 &lt;div class=&quot;geshifilter ocaml&quot; style=&quot;font-family: monospace;&quot;&gt;$ocamlbuild foo.&lt;span style=&quot;color: #060;&quot;&gt;byte&lt;/span&gt; -classic-display&lt;br /&gt;
/usr/bin/ocamlopt -I /usr/lib/ocaml/&lt;span style=&quot;color: #c6c;&quot;&gt;3.10&lt;/span&gt;&lt;span style=&quot;color: #c6c;&quot;&gt;.0&lt;/span&gt;/ocamlbuild unix.&lt;span style=&quot;color: #060;&quot;&gt;cmxa&lt;/span&gt; /usr/lib/ocaml/&lt;span style=&quot;color: #c6c;&quot;&gt;3.10&lt;/span&gt;&lt;span style=&quot;color: #c6c;&quot;&gt;.0&lt;/span&gt;/ocamlbuild/ocamlbuildlib.&lt;span style=&quot;color: #060;&quot;&gt;cmxa&lt;/span&gt; myocamlbuild.&lt;span style=&quot;color: #060;&quot;&gt;ml&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
+ /usr/lib/ocaml/&lt;span style=&quot;color: #c6c;&quot;&gt;3.10&lt;/span&gt;&lt;span style=&quot;color: #c6c;&quot;&gt;.0&lt;/span&gt;/ocamlbuild/ocamlbuild.&lt;span style=&quot;color: #060;&quot;&gt;cmx&lt;/span&gt; -o myocamlbuild&lt;br /&gt;
&lt;br /&gt;
/usr/bin/ocamldep -modules foo.&lt;span style=&quot;color: #060;&quot;&gt;ml&lt;/span&gt; &amp;gt; foo.&lt;span style=&quot;color: #060;&quot;&gt;ml&lt;/span&gt;.&lt;span style=&quot;color: #060;&quot;&gt;depends&lt;/span&gt;&lt;br /&gt;
/usr/bin/ocamldep -pp camlp4of -modules pa_float.&lt;span style=&quot;color: #060;&quot;&gt;ml&lt;/span&gt; &amp;gt; pa_float.&lt;span style=&quot;color: #060;&quot;&gt;ml&lt;/span&gt;.&lt;span style=&quot;color: #060;&quot;&gt;depends&lt;/span&gt;&lt;br /&gt;
ocamlfind ocamlc -package str -c -I +camlp4 -pp camlp4of -o pa_float.&lt;span style=&quot;color: #060;&quot;&gt;cmo&lt;/span&gt; pa_float.&lt;span style=&quot;color: #060;&quot;&gt;ml&lt;/span&gt;&lt;br /&gt;
/usr/bin/ocamldep -pp &#039;camlp4o pa_float.&lt;span style=&quot;color: #060;&quot;&gt;cmo&lt;/span&gt;&#039; -modules bar.&lt;span style=&quot;color: #060;&quot;&gt;ml&lt;/span&gt; &amp;gt; bar.&lt;span style=&quot;color: #060;&quot;&gt;ml&lt;/span&gt;.&lt;span style=&quot;color: #060;&quot;&gt;depends&lt;/span&gt;&lt;br /&gt;
ocamlfind ocamlc -package str -c -pp &#039;camlp4o pa_float.&lt;span style=&quot;color: #060;&quot;&gt;cmo&lt;/span&gt;&#039; -o bar.&lt;span style=&quot;color: #060;&quot;&gt;cmo&lt;/span&gt; bar.&lt;span style=&quot;color: #060;&quot;&gt;ml&lt;/span&gt;&lt;br /&gt;
ocamlfind ocamlc -package str -c -o foo.&lt;span style=&quot;color: #060;&quot;&gt;cmo&lt;/span&gt; foo.&lt;span style=&quot;color: #060;&quot;&gt;ml&lt;/span&gt;&lt;br /&gt;
ocamlfind ocamlc -package str -linkpkg bar.&lt;span style=&quot;color: #060;&quot;&gt;cmo&lt;/span&gt; foo.&lt;span style=&quot;color: #060;&quot;&gt;cmo&lt;/span&gt; -o foo.&lt;span style=&quot;color: #060;&quot;&gt;byte&lt;/span&gt;&lt;/div&gt;</description>
 <comments>http://www.cduce.org/~abate/ocamlbuild-camlp4-ocamlfind#comments</comments>
 <category domain="http://www.cduce.org/~abate/tags/ocaml">ocaml</category>
 <pubDate>Fri, 07 Mar 2008 10:39:43 +0100</pubDate>
 <dc:creator>abate</dc:creator>
 <guid isPermaLink="false">231 at http://www.cduce.org/~abate</guid>
</item>
<item>
 <title>RedMine experiments</title>
 <link>http://www.cduce.org/~abate/redmine-experiments</link>
 <description>&lt;p&gt;&lt;a href=&quot;http://redmine.org/&quot;&gt;RedMine&lt;/a&gt; is a hosting solution for Open projects conceptually similar to &lt;a href=&quot;http://trac.org&quot;&gt;Trac&lt;/a&gt;. At first sight, the main difference with trac is that redmine is multi-project, while trac has a narrower vision where each trac instance is a project. To be fair there are extensions in trac to administer multiple projects at once, built this is not shipped with the system.&lt;/p&gt;

&lt;p&gt;It&#039;s written in ruby. This is not a problem per-se, but since I never worked with Rails, it took a bit more then necessary to get it going. In the end, I configure redmine to run as a cgi as I didn&#039;t manage to get the fast-cgi interface going. The problem is mostly related with apache. It&#039;s fairly slow in this way, but this is by design.&lt;/p&gt;

&lt;p&gt;I&#039;ve used Rails 2.0 shipped with debian unstable on a stable machine. The installation was painless as rails doesn&#039;t have conflicting dependencies.&lt;/p&gt;

&lt;p&gt;I&#039;ve to play with it a bit more, but it seems a good system , somehow better then trac if you want to have a forge-style site without installing gforge itself.&lt;/p&gt;

</description>
 <comments>http://www.cduce.org/~abate/redmine-experiments#comments</comments>
 <category domain="http://www.cduce.org/~abate/tags/hacking">hacking</category>
 <pubDate>Fri, 29 Feb 2008 16:45:23 +0100</pubDate>
 <dc:creator>abate</dc:creator>
 <guid isPermaLink="false">230 at http://www.cduce.org/~abate</guid>
</item>
<item>
 <title>New Cduce Release 0.5.2.1</title>
 <link>http://www.cduce.org/~abate/new-cduce-release-0521</link>
 <description>&lt;p&gt;This is a minor bug-fix release. A new MacOsX binary package is avalaible. See the Download page for download information, or the CHANGES  file to know what&#039;s new.&lt;/p&gt;
&lt;p&gt;Not much to add.&lt;/p&gt;
</description>
 <comments>http://www.cduce.org/~abate/new-cduce-release-0521#comments</comments>
 <category domain="http://www.cduce.org/~abate/tags/cduce">cduce</category>
 <pubDate>Fri, 29 Feb 2008 16:32:47 +0100</pubDate>
 <dc:creator>admin</dc:creator>
 <guid isPermaLink="false">229 at http://www.cduce.org/~abate</guid>
</item>
</channel>
</rss>
