<?xml version="1.0" encoding="UTF-8"?>
<!-- generator="wordpress/2.2.3" -->
<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>olpa, OSS developer</title>
	<link>http://uucode.com/blog</link>
	<description>advocating olpa's open source developments</description>
	<pubDate>Fri, 06 Jan 2012 11:43:00 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.2.3</generator>
	<language>en</language>
			<item>
		<title>custom tex in rpm/apt distributions</title>
		<link>http://uucode.com/blog/2012/01/06/custom-tex-in-rpmapt-distributions/</link>
		<comments>http://uucode.com/blog/2012/01/06/custom-tex-in-rpmapt-distributions/#comments</comments>
		<pubDate>Fri, 06 Jan 2012 11:43:00 +0000</pubDate>
		<dc:creator>olpa</dc:creator>
		
		<category><![CDATA[linux]]></category>

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

		<guid isPermaLink="false">http://uucode.com/blog/2012/01/06/custom-tex-in-rpmapt-distributions/</guid>
		<description><![CDATA[I prefer to use TeX from TeXlive distribution, not the default TeX bundled with an operating system. The problem is that rpm and apt tools check dependencies and insist on installing the wrong TeX. To trick the system, a fake package should be made and installed.
The next commands are for ALT Linux, maybe they are [...]]]></description>
			<content:encoded><![CDATA[<p>I prefer to use TeX from TeXlive distribution, not the default TeX bundled with an operating system. The problem is that rpm and apt tools check dependencies and insist on installing the wrong TeX. To trick the system, a fake package should be made and installed.</p>
<p>The next commands are for <a href="http://www.altlinux.org/">ALT Linux</a>, maybe they are not correct for other distributions.</p>
<p>1) Find what a package needs:</p>
<pre><code>
$ apt-cache show lyx | grep 'Depends:'
... texlive-latex-recommended ...
... /user/share/texmf ...
</code></pre>
<p>2) Create a fake spec-file &#8220;<tt>/home/rpmer/RPM/SPECS/dummy-provides.spec</tt>&#8220;, which &#8220;provides&#8221; the required facilities:</p>
<pre><code>
Name: dummy-provides
Version: 0
Release: alt2

Summary: Trick apt/rpm dependencies
License: Public domain
Group: Toys

Packager: Oleg Parashchenko <olpa uucode com>
BuildArch: noarch
Provides: /usr/bin/dvips dvipng texlive-latex-recommended /user/share/texmf

%description
%summary

%prep

%build

%install
mkdir -p %buildroot

%files

%changelog
* Fri Apr 01 2011 Oleg Parashchenko <olpa uucode com>
- initial list
</code></pre>
<p>3) Create a rpm-package:</p>
<pre><code>
$ rpm -bb dummy-provides.spec
...
Wrote: /home/rpmer/RPM/RPMS/noarch/dummy-provides-0-alt2.noarch.rpm
</code></pre>
<p>4) Install the package (&#8221;-ihv&#8221; to install, &#8220;-Uhv&#8221; to upgrade):</p>
<pre><code>
$ sudo rpm -Uhv /home/rpmer/RPM/RPMS/noarch/dummy-provides-0-alt2.noarch.rpm
</code></pre>
<p>Based on the <a href="http://thread.gmane.org/gmane.linux.altlinux.sisyphus/89715/focus=89840">discussion in the mailing list</a>, thanks everyone for help.</p>
]]></content:encoded>
			<wfw:commentRss>http://uucode.com/blog/2012/01/06/custom-tex-in-rpmapt-distributions/feed/</wfw:commentRss>
		</item>
		<item>
		<title>german-russian, german-arabic vim keymaps</title>
		<link>http://uucode.com/blog/2011/12/16/german-russian-german-arabic-vim-keymaps/</link>
		<comments>http://uucode.com/blog/2011/12/16/german-russian-german-arabic-vim-keymaps/#comments</comments>
		<pubDate>Fri, 16 Dec 2011 13:01:43 +0000</pubDate>
		<dc:creator>olpa</dc:creator>
		
		<category><![CDATA[vim]]></category>

		<guid isPermaLink="false">http://uucode.com/blog/2011/12/16/german-russian-german-arabic-vim-keymaps/</guid>
		<description><![CDATA[vim includes many keyboard layouts, defined as mappings for symbols of the english layout. Unfortunately, these maps are not useful when the base layout is german. QWERTZ vs QWERTY is not the only difference. Now, deutsch-russisch und deutsch-arabisch vim keymaps sind da.
Download: http://uucode.com/download/2011/12/vim-keymap-de-nn.tar.gz
keymap switch
I have no idea how to press &#8220;CTRL-^&#8220;, therefore decided to use [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://vim.org/">vim</a> includes many keyboard layouts, defined as mappings for symbols of the english layout. Unfortunately, these maps are not useful when the base layout is german. QWERTZ vs QWERTY is not the only difference. Now, deutsch-russisch und deutsch-arabisch vim keymaps sind da.</p>
<p>Download: <a href="http://uucode.com/download/2011/12/vim-keymap-de-nn.tar.gz">http://uucode.com/download/2011/12/vim-keymap-de-nn.tar.gz</a></p>
<h3>keymap switch</h3>
<p>I have no idea how to press &#8220;<tt>CTRL-^</tt>&#8220;, therefore decided to use another combination: &#8220;<tt>Shift-F1</tt>&#8220;. Add to vimrc:</p>
<pre><code>
map! &lt;S-F1> &lt;C-^>
</code></pre>
<h3>German-Russian</h3>
<p>Put the file &#8220;<tt>russian-jcuken-z.vim</tt>&#8221; to the directory &#8220;<tt>~/.vim/keymap</tt>&#8220;. Add to vimrc:</p>
<pre><code>
set keymap=russian-jcuken-z
set imsearch=-1
set iminsert=0
</code></pre>
<p>Only the first line is important, the rest is my preferences.</p>
<h3>German-Arabic</h3>
<p>Put the file &#8220;<tt>arabic_utf-8.vim</tt>&#8221; to the directory &#8220;<tt>~/.vim/keymap</tt>&#8220;.</p>
<h3>German-something</h3>
<p>Modify Python script &#8220;<tt>keymap-de-nn.py</tt>&#8221; to your needs.</p>
]]></content:encoded>
			<wfw:commentRss>http://uucode.com/blog/2011/12/16/german-russian-german-arabic-vim-keymaps/feed/</wfw:commentRss>
		</item>
		<item>
		<title>german pc keyboard on mac os x</title>
		<link>http://uucode.com/blog/2011/12/05/german-pc-keyboard-on-mac-os-x/</link>
		<comments>http://uucode.com/blog/2011/12/05/german-pc-keyboard-on-mac-os-x/#comments</comments>
		<pubDate>Mon, 05 Dec 2011 13:22:38 +0000</pubDate>
		<dc:creator>olpa</dc:creator>
		
		<category><![CDATA[Mac]]></category>

		<guid isPermaLink="false">http://uucode.com/blog/2011/12/05/german-pc-keyboard-on-mac-os-x/</guid>
		<description><![CDATA[The keys &#8220;< " and "^" seem swapped, but otherwise the normal PC german keyboard layout for Mac OS X is here: http://powerbook.blogger.de/2004/01/26/58788/mein-deutsches-pc-tastatur-layout-fr-macosx-103/.
]]></description>
			<content:encoded><![CDATA[<p>The keys &#8220;< " and "^" seem swapped, but otherwise the normal PC german keyboard layout for Mac OS X is here: <a href="http://powerbook.blogger.de/2004/01/26/58788/mein-deutsches-pc-tastatur-layout-fr-macosx-103/">http://powerbook.blogger.de/2004/01/26/58788/mein-deutsches-pc-tastatur-layout-fr-macosx-103/.</p>
]]></content:encoded>
			<wfw:commentRss>http://uucode.com/blog/2011/12/05/german-pc-keyboard-on-mac-os-x/feed/</wfw:commentRss>
		</item>
		<item>
		<title>control alt shift vmware</title>
		<link>http://uucode.com/blog/2011/07/28/control-alt-shift-vmware/</link>
		<comments>http://uucode.com/blog/2011/07/28/control-alt-shift-vmware/#comments</comments>
		<pubDate>Thu, 28 Jul 2011 07:46:17 +0000</pubDate>
		<dc:creator>olpa</dc:creator>
		
		<category><![CDATA[linux]]></category>

		<guid isPermaLink="false">http://uucode.com/blog/2011/07/28/control-alt-shift-vmware/</guid>
		<description><![CDATA[Sometimes vmware makes something very wrong, and X server do not understand the keys CTRL, ALT, SHIFT and similar anymore. Solution: &#8220;setxkbmap&#8221; without any arguments.
In case the setting are lost, my configuration is:

setxkbmap -model pc105 -layout de,ru -variant ,winkeys -option grp:caps_toggle -option compose:rwin

]]></description>
			<content:encoded><![CDATA[<p>Sometimes vmware makes something very wrong, and X server do not understand the keys CTRL, ALT, SHIFT and similar anymore. Solution: &#8220;setxkbmap&#8221; without any arguments.</p>
<p>In case the setting are lost, my configuration is:</p>
<pre>
setxkbmap -model pc105 -layout de,ru -variant ,winkeys -option grp:caps_toggle -option compose:rwin
</pre>
]]></content:encoded>
			<wfw:commentRss>http://uucode.com/blog/2011/07/28/control-alt-shift-vmware/feed/</wfw:commentRss>
		</item>
		<item>
		<title>chess fen plugin for anki</title>
		<link>http://uucode.com/blog/2011/06/27/chess-fen-plugin-for-anki/</link>
		<comments>http://uucode.com/blog/2011/06/27/chess-fen-plugin-for-anki/#comments</comments>
		<pubDate>Mon, 27 Jun 2011 12:01:11 +0000</pubDate>
		<dc:creator>olpa</dc:creator>
		
		<category><![CDATA[chess]]></category>

		<guid isPermaLink="false">http://uucode.com/blog/2011/06/27/chess-fen-plugin-for-anki/</guid>
		<description><![CDATA[After I discovered anki, a tool to assist in remembering facts, I started to actively use it. Among other uses, I want to keep in memory some important chess positions. To display these positions in anki, I have written a plugin.
In future, it would be possible to install it from the anki plugins repository, write [...]]]></description>
			<content:encoded><![CDATA[<p>After I discovered <a href="http://ankisrs.net/">anki</a>, a tool to assist in remembering facts, I started to actively use it. Among other uses, I want to keep in memory some important chess positions. To display these positions in anki, I have written a plugin.</p>
<p>In future, it would be possible to install it from the anki plugins repository, write now you have to install it manually. You have to donwload the plugin and unpack it to the anki &#8220;plugin&#8221; folder. Under Linux, the path is &#8220;$HOME/.anki/plugins&#8221;</p>
<p><a href="http://uucode.com/download/2011/chess_fen_20110627.zip">Download chess fen plugin for anki</a> (version 20110627).</p>
<p>The README-file is below, now two screenshots.</p>
<p>1) The text with fen-tags</p>
<p><img src='http://uucode.com/blog/wp-content/uploads/2011/06/anki-fen-text.png' alt='anki-fen-text.png' width="442" height="224" /></p>
<p>2) The fen-tag converted to image</p>
<p><img src='http://uucode.com/blog/wp-content/uploads/2011/06/anki-chess-dia.png' alt='anki-chess-dia.png' width="454" height="550" /></p>
<h3>The README-file</h3>
<p>chess fen<br />
Anki plugin to generate chess diagramms<br />
===========================================================</p>
<p>The plugin converts &#8220;fen&#8221; tag to a corresponding image.</p>
<p>The original text:</p>
<p>:: Do you like this position?<br />
:: [fen]rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1[/fen]</p>
<p>After processing:</p>
<p>:: &lt;img src=&#8221;xxxxx&#8221; width=&#8221;nn&#8221; height=&#8221;nn&#8221; border=&#8221;1&#8243; />&lt;br /><br />
:: &lt;b style=&#8221;color:gray;font-size:50%;&#8221;>[fen]rnbqkbnr/pppppppp<br />
::   /8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1[/fen]&lt;/b></p>
<p>The images are generated and stored in the deck&#8217;s media directory.<br />
An image is generated only if it does not exist. The plugin never<br />
deletes images. It is possible to test diagramm generation from<br />
the command line, see the comments inside &#8220;chess_fen.py&#8221;.</p>
<p>Installation<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;</p>
<p>Install the fen plugin from the anki plugins repository.</p>
<p>While it is not available there, unpack the archive into<br />
the anki&#8217;s plugin folder. Under Linux is it<br />
$HOME/.anki/plugins</p>
<p>License<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;</p>
<p>The GNU General Public License</p>
<p>Author<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;</p>
<p>Oleg Parashchenko, olpa@ http://uucode.com/</p>
]]></content:encoded>
			<wfw:commentRss>http://uucode.com/blog/2011/06/27/chess-fen-plugin-for-anki/feed/</wfw:commentRss>
		</item>
		<item>
		<title>delta debugging for latex</title>
		<link>http://uucode.com/blog/2011/04/27/delta-debugging-for-latex/</link>
		<comments>http://uucode.com/blog/2011/04/27/delta-debugging-for-latex/#comments</comments>
		<pubDate>Wed, 27 Apr 2011 12:36:50 +0000</pubDate>
		<dc:creator>olpa</dc:creator>
		
		<category><![CDATA[science]]></category>

		<guid isPermaLink="false">http://uucode.com/blog/2011/04/27/delta-debugging-for-latex/</guid>
		<description><![CDATA[From the delta debugging homepage: &#8220;With Delta Debugging, we can find failure-inducing circumstances automatically—circumstances such as the program input, changes to the program code, or program executions.&#8221; I tried to apply this technique to LaTeX, and surprisingly it worked. The code and samples of the experiment are uploaded on github.
The tools are:
* diffdelta.py: Finding which [...]]]></description>
			<content:encoded><![CDATA[<p>From the <a href="http://www.st.cs.uni-saarland.de/dd/">delta debugging homepage</a>: &#8220;With Delta Debugging, we can find failure-inducing circumstances automatically—circumstances such as the program input, changes to the program code, or program executions.&#8221; I tried to apply this technique to LaTeX, and surprisingly it worked. The code and samples of the experiment are <a href="http://github.com/olpa/tex/tree/86e556822effc63a3fa8630899b2ac47200bdd9a/delta_debugging">uploaded on github</a>.</p>
<p>The tools are:</p>
<p>* diffdelta.py: Finding which diff chunk causes an error.<br />
* latexdd.py: Finding a minimal failing example<br />
* stydd.py: sty-bug hunting</p>
]]></content:encoded>
			<wfw:commentRss>http://uucode.com/blog/2011/04/27/delta-debugging-for-latex/feed/</wfw:commentRss>
		</item>
		<item>
		<title>using a local copy of a file instead of downloading it in macports</title>
		<link>http://uucode.com/blog/2011/04/20/using-a-local-copy-of-a-file-instead-of-downloading-it-in-macports/</link>
		<comments>http://uucode.com/blog/2011/04/20/using-a-local-copy-of-a-file-instead-of-downloading-it-in-macports/#comments</comments>
		<pubDate>Wed, 20 Apr 2011 10:18:24 +0000</pubDate>
		<dc:creator>olpa</dc:creator>
		
		<category><![CDATA[Mac]]></category>

		<guid isPermaLink="false">http://uucode.com/blog/2011/04/20/using-a-local-copy-of-a-file-instead-of-downloading-it-in-macports/</guid>
		<description><![CDATA[In some cases, macports can&#8217;t or should not download a file from internet. Instead, it should use an already downloaded local copy. Unfortunately, this use case is not supported, and a workaround is required.
Step 1:
Make a copy of the directory with Portfile (located somewhere in /opt/local/var/macports/sources/rsync.macports.org/release/ports)
Step 2:
Put the file into the directory
Step 3:
Modify Portfile, add:

set [...]]]></description>
			<content:encoded><![CDATA[<p>In some cases, macports can&#8217;t or should not download a file from internet. Instead, it should use an already downloaded local copy. Unfortunately, this use case is not supported, and a workaround is required.</p>
<p>Step 1:</p>
<p>Make a copy of the directory with <tt>Portfile</tt> (located somewhere in <tt>/opt/local/var/macports/sources/rsync.macports.org/release/ports</tt>)</p>
<p>Step 2:</p>
<p>Put the file into the directory</p>
<p>Step 3:</p>
<p>Modify <tt>Portfile</tt>, add:</p>
<p><code><pre>
set orig_dir [pwd]
fetch {
  set file "PyICU-0.8.1.tar.gz"
  file mkdir $distpath
  file copy -force ${orig_dir}/$file ${distpath}/${file}
}</pre></code></p>
<p>Instead of &#8220;PyICU-0.8.1.tar.gz&#8221; write the name of your file.</p>
<p>Step 4:</p>
<p>Install</p>
<p><code><pre>
$ sudo port install -d -v
</pre></code></p>
]]></content:encoded>
			<wfw:commentRss>http://uucode.com/blog/2011/04/20/using-a-local-copy-of-a-file-instead-of-downloading-it-in-macports/feed/</wfw:commentRss>
		</item>
		<item>
		<title>solved: vmware does not work anymore</title>
		<link>http://uucode.com/blog/2011/04/04/solved-vmware-does-not-work-anymore/</link>
		<comments>http://uucode.com/blog/2011/04/04/solved-vmware-does-not-work-anymore/#comments</comments>
		<pubDate>Mon, 04 Apr 2011 12:09:52 +0000</pubDate>
		<dc:creator>olpa</dc:creator>
		
		<category><![CDATA[linux]]></category>

		<guid isPermaLink="false">http://uucode.com/blog/2011/04/04/solved-vmware-does-not-work-anymore/</guid>
		<description><![CDATA[After some system update, vmware stopped working. It wrote some information which modules are loaded, and then silently exited. In a log file &#8220;ui-NNNN.log&#8221;, I found: &#8220;vmui&#124; Caught signal 11&#8243;. The stacktrace said only that the crash was likely due to some signal.
Search in internet gave only one suggestion: use the gtk libraries, which are [...]]]></description>
			<content:encoded><![CDATA[<p>After some system update, vmware stopped working. It wrote some information which modules are loaded, and then silently exited. In a log file &#8220;ui-NNNN.log&#8221;, I found: &#8220;vmui| Caught signal 11&#8243;. The stacktrace said only that the crash was likely due to some signal.</p>
<p>Search in internet gave only one suggestion: use the gtk libraries, which are shipped together with vmware, not the system ones. Did not help.</p>
<p>But what if to force to use all the shipped libraries instead of the system ones?</p>
<p>Yet another log file, &#8220;appLoader-NNN.log&#8221; traces loading of libraries. A Python script to process it:</p>
<p><code><pre style='color:#000000;background:#ffffff;'><span style='color:#800000; font-weight:bold; '>import</span> sys<span style='color:#808030; '>,</span> re

re_so <span style='color:#808030; '>=</span> re<span style='color:#808030; '>.</span><span style='color:#e34adc; '>compile</span><span style='color:#808030; '>(</span><span style='color:#0000e6; '>'LOG NOT INITIALIZED \\| (.*so)[0-9.]* &lt;SYSTEM>'</span><span style='color:#808030; '>)</span>

fname <span style='color:#808030; '>=</span> sys<span style='color:#808030; '>.</span>argv<span style='color:#808030; '>[</span><span style='color:#008c00; '>1</span><span style='color:#808030; '>]</span>
h <span style='color:#808030; '>=</span> <span style='color:#e34adc; '>open</span><span style='color:#808030; '>(</span>fname<span style='color:#808030; '>)</span>
<span style='color:#800000; font-weight:bold; '>for</span> l <span style='color:#800000; font-weight:bold; '>in</span> h<span style='color:#808030; '>:</span>
  m <span style='color:#808030; '>=</span> re_so<span style='color:#808030; '>.</span>search<span style='color:#808030; '>(</span>l<span style='color:#808030; '>)</span>
  <span style='color:#800000; font-weight:bold; '>if</span> m<span style='color:#808030; '>:</span>
    s_so <span style='color:#808030; '>=</span> m<span style='color:#808030; '>.</span>group<span style='color:#808030; '>(</span><span style='color:#008c00; '>1</span><span style='color:#808030; '>)</span>
    <span style='color:#800000; font-weight:bold; '>print</span> <span style='color:#0000e6; '>'mv /usr/lib/%s* /usr/lib/tmp/'</span> <span style='color:#808030; '>%</span> s_so
h<span style='color:#808030; '>.</span>close<span style='color:#808030; '>(</span><span style='color:#808030; '>)</span>
</pre></code></p>
<p>After processing the log, I get a file &#8220;move.sh&#8221;:</p>
<pre>
mv /usr/lib/libsexy.so* /usr/lib/tmp/
mv /usr/lib/libart_lgpl_2.so* /usr/lib/tmp/
mv /usr/lib/libXrandr.so* /usr/lib/tmp/
...
</pre>
<p>(This codes only for my backup reasons, do not even try to use it unless you understand it completely.)</p>
<p>With all these libraries &#8220;removed&#8221;, vware started.</p>
<p>Using bisection, I found that in my case the bad library was &#8220;libgiomm&#8221;.</p>
<p>Repair script is:</p>
<p><code><pre>
#!/bin/sh

( \
mv /usr/lib/libgiomm-2.4.so.1 /usr/lib/libgiomm-2.4.so.1.3.0 /usr/lib/tmp/; \
  sleep 5; \
mv /usr/lib/tmp/libgiomm-2.4.so.1 /usr/lib/tmp/libgiomm-2.4.so.1.3.0 /usr/lib/ \
) &
sleep 1
vmware
</pre></code></p>
]]></content:encoded>
			<wfw:commentRss>http://uucode.com/blog/2011/04/04/solved-vmware-does-not-work-anymore/feed/</wfw:commentRss>
		</item>
		<item>
		<title>messed Helvetica etc on a PostScript printer</title>
		<link>http://uucode.com/blog/2011/03/22/messed-helvetica-etc-on-a-postscript-printer/</link>
		<comments>http://uucode.com/blog/2011/03/22/messed-helvetica-etc-on-a-postscript-printer/#comments</comments>
		<pubDate>Tue, 22 Mar 2011 13:16:54 +0000</pubDate>
		<dc:creator>olpa</dc:creator>
		
		<category><![CDATA[linux]]></category>

		<guid isPermaLink="false">http://uucode.com/blog/2011/03/22/messed-helvetica-etc-on-a-postscript-printer/</guid>
		<description><![CDATA[I&#8217;ve got PostScript files, which does look ok on the screen, but badly printed on Lexamark E232. The letters collide each with other, seems like instead of Helvetica some monospace font is substituted.
So far I have not found a rapair, but only a workaround:

ps2pdf -dPDFSETTINGS=/prepress print.ps print.pdf

And print the PDF-file.
]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve got PostScript files, which does look ok on the screen, but badly printed on Lexamark E232. The letters collide each with other, seems like instead of Helvetica some monospace font is substituted.</p>
<p>So far I have not found a rapair, but only a workaround:</p>
<p><code>
ps2pdf -dPDFSETTINGS=/prepress print.ps print.pdf
</code></p>
<p>And print the PDF-file.</p>
]]></content:encoded>
			<wfw:commentRss>http://uucode.com/blog/2011/03/22/messed-helvetica-etc-on-a-postscript-printer/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Gambit Scheme PHP backend, milestone 1: proof of concept</title>
		<link>http://uucode.com/blog/2011/02/09/gambit-scheme-php-backend-milestone-1-proof-of-concept/</link>
		<comments>http://uucode.com/blog/2011/02/09/gambit-scheme-php-backend-milestone-1-proof-of-concept/#comments</comments>
		<pubDate>Wed, 09 Feb 2011 13:56:01 +0000</pubDate>
		<dc:creator>olpa</dc:creator>
		
		<category><![CDATA[scheme]]></category>

		<guid isPermaLink="false">http://uucode.com/blog/2011/02/09/gambit-scheme-php-backend-milestone-1-proof-of-concept/</guid>
		<description><![CDATA[The goal of this release is to mark the milestone 1 (on github, as .tar.gz). I wanted to understand the GVM and to check if compilation to PHP is possible. This is done. While the current gambit-php version is very limited (only a few primitives are partially implemented), it covers all the important functionality:
* boot [...]]]></description>
			<content:encoded><![CDATA[<p>The goal of this release is to mark the milestone 1 (<a href="http://github.com/olpa/schemevm/tree/milestone1">on github</a>, as <a href="http://github.com/downloads/olpa/schemevm/gambit-php-20110208-milestone1.tar.gz">.tar.gz</a>). I wanted to understand the GVM and to check if compilation to PHP is possible. This is done. While the current gambit-php version is very limited (only a few primitives are partially implemented), it covers all the important functionality:</p>
<p>* boot up: &#8220;Hello, World&#8221; example<br />
* recursion: factorial, fibonacci, ackermann<br />
* closures: function which return function which return function etc<br />
* continuations: basic return example, yin-yang puzzle</p>
<p>Scheme code and generated PHP code:<br />
<a href="http://github.com/olpa/schemevm/tree/milestone1/step-by-step-examples">http://github.com/olpa/schemevm/tree/milestone1/step-by-step-examples</a></p>
<p>The second use of this milestone release is a demostration how to start a backend. The package contains the minimal amount of code to compile the examples. Therefore, the code is much easier to understand then the code of a complete working backend.</p>
<p>I coded straightforward. If I saw a way to solve a problem, I used this way without trying alternatives. In the development process &#8220;make it work, make it work correctly, make it work fast&#8221;, I&#8217;m on the step zero &#8220;experiment if it would work&#8221;.</p>
<p>One of the consequences is that performance is poor. For example, Ackermann function A(3,9) is 100 times slowed as by gsi-script and 30 times slower as native PHP implementation. The output from yin-yang puzzle is 30 times slower as by gsi-script and 10 times slower as by Guile. However, I&#8217;m optimistic and think there is a lot of possibilties for optimization.</p>
<p>The code is developed for PHP 4.4.8 and tested under PHP 3.0.</p>
]]></content:encoded>
			<wfw:commentRss>http://uucode.com/blog/2011/02/09/gambit-scheme-php-backend-milestone-1-proof-of-concept/feed/</wfw:commentRss>
		</item>
		<item>
		<title>tracing libc calls with dtrace</title>
		<link>http://uucode.com/blog/2011/01/26/tracing-libc-calls-with-dtrace/</link>
		<comments>http://uucode.com/blog/2011/01/26/tracing-libc-calls-with-dtrace/#comments</comments>
		<pubDate>Wed, 26 Jan 2011 14:00:43 +0000</pubDate>
		<dc:creator>olpa</dc:creator>
		
		<category><![CDATA[Mac]]></category>

		<guid isPermaLink="false">http://uucode.com/blog/2011/01/26/tracing-libc-calls-with-dtrace/</guid>
		<description><![CDATA[In order to find if I can affect a program through environment variables, I decided to trace all getenv calls and see if there is something interesting. Easy to said, harder to make. Fortunately, it is possible.
Quite fast, I found that I want to use the tool dtrace. To my disappointment, I realized that I [...]]]></description>
			<content:encoded><![CDATA[<p>In order to find if I can affect a program through environment variables, I decided to trace all <tt>getenv</tt> calls and see if there is something interesting. Easy to said, harder to make. Fortunately, it is possible.</p>
<p>Quite fast, I found that I want to use the tool <tt>dtrace</tt>. To my disappointment, I realized that I could not just click and run this tool, but had to learn.</p>
<p>Therefore, at the first I skipped the document <a href="http://dlc.sun.com/osol/docs/content/DTRCUG/gcgkk.html">Tracing User Processes</a> and returned to it only after making all the exercises of a tutorial: <a href="http://wikis.sun.com/display/DTrace/Introduction">Introduction</a>. Finally, I managed to get what I want:</p>
<pre><code>
$ cat getenv.d 
pid$target:libSystem.B.dylib:getenv:entry
{
    printf("getenv: '%s'", copyinstr(arg0));
}
% sudo dtrace -s getenv.d -c my_program
</code></pre>
<p>Note 1: Under Mac OS X, libc seems to be libSystem.B.dylib</p>
<p>Note 2: According to the documentation, I could use <tt>args[]</tt> array. But for some reason, I could not. Instead, I cast the first argument (int) to a string.</p>
]]></content:encoded>
			<wfw:commentRss>http://uucode.com/blog/2011/01/26/tracing-libc-calls-with-dtrace/feed/</wfw:commentRss>
		</item>
		<item>
		<title>\AddFontFeature in plain XeTeX</title>
		<link>http://uucode.com/blog/2011/01/18/addfontfeature-in-plain-xetex/</link>
		<comments>http://uucode.com/blog/2011/01/18/addfontfeature-in-plain-xetex/#comments</comments>
		<pubDate>Tue, 18 Jan 2011 12:15:40 +0000</pubDate>
		<dc:creator>olpa</dc:creator>
		
		<category><![CDATA[TeX]]></category>

		<guid isPermaLink="false">http://uucode.com/blog/2011/01/18/addfontfeature-in-plain-xetex/</guid>
		<description><![CDATA[XeLaTeX package &#8220;fontspec&#8221; provides an useful command &#8220;AddFontFeature&#8221; to add an effect to the curently selected font. Unfortunately, it works only if fontspec is used. Otherwise, a workaround is required. So far here is a draft to make text narrow:
Somewhere in .tex-file define the command:
\newcommand\ForceNarrowText{%
\def\addtoname"##1"{\def\NarrowFontName{"##1:extend=0.8"}}%
\expandafter\addtoname\fontname\font%
%\show\NarrowFontName
\font\NarrowFont=\NarrowFontName\relax \NarrowFont}

and then use it:
hello {\ForceNarrowText hello} hello
]]></description>
			<content:encoded><![CDATA[<p>XeLaTeX package &#8220;fontspec&#8221; provides an useful command &#8220;AddFontFeature&#8221; to add an effect to the curently selected font. Unfortunately, it works only if fontspec is used. Otherwise, a workaround is required. So far here is a draft to make text narrow:</p>
<p>Somewhere in .tex-file define the command:</p>
<pre style='color:#000000;background:#ffffff;'><code>\newcommand\ForceNarrowText<span style='color:#800080; '>{</span><span style='color:#808030; '>%</span>
\def\addtoname<span style='color:#800000; '>"</span><span style='color:#0000e6; '>##1</span><span style='color:#800000; '>"</span><span style='color:#800080; '>{</span>\def\NarrowFontName<span style='color:#800080; '>{</span><span style='color:#800000; '>"</span><span style='color:#0000e6; '>##1:extend=0.8</span><span style='color:#800000; '>"</span><span style='color:#800080; '>}</span><span style='color:#800080; '>}</span><span style='color:#808030; '>%</span>
\expandafter\addtoname\fontname\font<span style='color:#808030; '>%</span>
<span style='color:#808030; '>%</span>\show\NarrowFontName
\font\NarrowFont<span style='color:#808030; '>=</span>\NarrowFontName\relax \NarrowFont<span style='color:#800080; '>}</span>
</code></pre>
<p>and then use it:</p>
<pre style='color:#000000;background:#ffffff;'><code>hello <span style='color:#800080; '>{</span>\ForceNarrowText hello<span style='color:#800080; '>}</span> hello</code></pre>
]]></content:encoded>
			<wfw:commentRss>http://uucode.com/blog/2011/01/18/addfontfeature-in-plain-xetex/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Solved: unable to enumerate USB device on port 1</title>
		<link>http://uucode.com/blog/2011/01/18/solved-unable-to-enumerate-usb-device-on-port-1/</link>
		<comments>http://uucode.com/blog/2011/01/18/solved-unable-to-enumerate-usb-device-on-port-1/#comments</comments>
		<pubDate>Tue, 18 Jan 2011 08:19:59 +0000</pubDate>
		<dc:creator>olpa</dc:creator>
		
		<category><![CDATA[linux]]></category>

		<guid isPermaLink="false">http://uucode.com/blog/2011/01/18/solved-unable-to-enumerate-usb-device-on-port-1/</guid>
		<description><![CDATA[At some moment, my USB WLAN stick stopped working, and the log was polluted by messages like:

usb 6-1: new high speed USB device using ehci_hcd and address 62
hub 6-0:1.0: unable to enumerate USB device on port 1
hub 6-0:1.0: unable to enumerate USB device on port 1

At first, I decided that the stick had broken after [...]]]></description>
			<content:encoded><![CDATA[<p>At some moment, my USB WLAN stick stopped working, and the log was polluted by messages like:</p>
<pre>
usb 6-1: new high speed USB device using ehci_hcd and address 62
hub 6-0:1.0: unable to enumerate USB device on port 1
hub 6-0:1.0: unable to enumerate USB device on port 1
</pre>
<p>At first, I decided that the stick had broken after years of work, but out of curiousity tried to connect it to every USB port I found. It worked. The stick worked again when plugged into the keyboard, which in term was connected to the KVM.</p>
<p>What is funny, I did nothing, but after a few days the stick worked again correctly in its original port. I forgot about the problem. But after yet another vacations, the problem appeared again, and again disappeared in a few days.</p>
<p>I have no idea why.</p>
<p>But I finally found a solution here: <a href="http://www.absolutelytech.com/2010/04/18/solved-unable-to-enumerate-usb-device-disabling-ehci_hcd/">[Solved] Unable to enumerate USB device (Disabling ehci_hcd)</a>. I need to disable <tt>ehci_hcd</tt>. In my case, the commands is:</p>
<pre>
# cd /sys/bus/pci/drivers/ehci_hcd
# echo -n "0000:00:1a.7" > unbind
</pre>
<p>As a side effect, I do not have USB 2.0 on this bus anymore, but it is not a problem.</p>
<h2>24.02.2010, update</h2>
<p>To issue the command automatically on boot, one could edit <tt>/etc/rc.local</tt>, but in my case I need to have network loaded before. The best solution (I hope) is based on advice here:</p>
<p>https://bugs.launchpad.net/ubuntu/+source/linux/+bug/354832</p>
<blockquote><p>
You can disable this on boot by creating a /etc/udev/rules.d/disable-ehci.rules file containing:</p>
<p><code><pre>
ACTION=="add", SUBSYSTEM=="pci", DRIVER=="ehci_hcd", \
        RUN+="/bin/sh -c 'echo -n %k > %S%p/driver/unbind'"
</pre></code>
</p></blockquote>
<blockquote></blockquote>
]]></content:encoded>
			<wfw:commentRss>http://uucode.com/blog/2011/01/18/solved-unable-to-enumerate-usb-device-on-port-1/feed/</wfw:commentRss>
		</item>
		<item>
		<title>PDF external streams are not supported</title>
		<link>http://uucode.com/blog/2011/01/17/pdf-external-streams-are-not-supported/</link>
		<comments>http://uucode.com/blog/2011/01/17/pdf-external-streams-are-not-supported/#comments</comments>
		<pubDate>Mon, 17 Jan 2011 12:05:12 +0000</pubDate>
		<dc:creator>olpa</dc:creator>
		
		<category><![CDATA[publishing]]></category>

		<guid isPermaLink="false">http://uucode.com/blog/2011/01/17/pdf-external-streams-are-not-supported/</guid>
		<description><![CDATA[Theoretically, a part of a PDF file is allowed to be stored externally. The &#8220;external streams&#8221; were introduced already in an ancient PDF specification. But only Acrobat (Reader) 5 supports it. For Acrobat 8, one has to find a hidden security option to activate support. Apple Quartz seems not to support external streams at all. [...]]]></description>
			<content:encoded><![CDATA[<p>Theoretically, a part of a PDF file is allowed to be stored externally. The &#8220;external streams&#8221; were introduced already in an ancient PDF specification. But only Acrobat (Reader) 5 supports it. For Acrobat 8, one has to find a hidden security option to activate support. Apple Quartz seems not to support external streams at all. The same for poppler (definitely, the source code is checked) and maybe its ancestor xpdf.</p>
]]></content:encoded>
			<wfw:commentRss>http://uucode.com/blog/2011/01/17/pdf-external-streams-are-not-supported/feed/</wfw:commentRss>
		</item>
		<item>
		<title>eSATA hot swap in Linux</title>
		<link>http://uucode.com/blog/2010/12/29/esata-hot-swap-in-linux/</link>
		<comments>http://uucode.com/blog/2010/12/29/esata-hot-swap-in-linux/#comments</comments>
		<pubDate>Wed, 29 Dec 2010 19:40:47 +0000</pubDate>
		<dc:creator>olpa</dc:creator>
		
		<category><![CDATA[linux]]></category>

		<guid isPermaLink="false">http://uucode.com/blog/2010/12/29/esata-hot-swap-in-linux/</guid>
		<description><![CDATA[I hoped that eSATA interface allows to attach and detach HDDs to Linux on the fly, and the system would notice the changes automatically. The reality was quote apposite, the system hung during experiments. Finally, after scanning internet knowledge, and trying to get commands like atacontrol or scsiadd working, I found the command for manual [...]]]></description>
			<content:encoded><![CDATA[<p>I hoped that eSATA interface allows to attach and detach HDDs to Linux on the fly, and the system would notice the changes automatically. The reality was quote apposite, the system hung during experiments. Finally, after scanning internet knowledge, and trying to get commands like <tt>atacontrol</tt> or <tt>scsiadd</tt> working, I found the command for manual swap.</p>
<p>After a HDD is attached, ask Linux to re-scan the bus to find the HDD:</p>
<pre><code>
$ sudo sh -c 'echo "- - -" >/sys/class/scsi_host/host0/scan '
</code></pre>
<p>or without sudo:</p>
<pre><code>
# echo "- - -" >/sys/class/scsi_host/host0/scan
</code></pre>
<p>To detach the HDD (umount it first!) (in this case, the hdd is <tt>sdb</tt>):</p>
<pre><code>
$ sudo sh -c "echo 1 > /sys/block/sdb/device/delete "
</code></pre>
<p>or without sudo:</p>
<pre><code>
# echo 1 > /sys/block/sdb/device/delete
</code></pre>
<p>Well, I actually don&#8217;t need hotswap, manual swap is ok for me. The problem is solved.</p>
]]></content:encoded>
			<wfw:commentRss>http://uucode.com/blog/2010/12/29/esata-hot-swap-in-linux/feed/</wfw:commentRss>
		</item>
		<item>
		<title>vim unicode setup for windows 2000</title>
		<link>http://uucode.com/blog/2010/12/29/vim-unicode-setup-for-windows-2000/</link>
		<comments>http://uucode.com/blog/2010/12/29/vim-unicode-setup-for-windows-2000/#comments</comments>
		<pubDate>Wed, 29 Dec 2010 14:49:21 +0000</pubDate>
		<dc:creator>olpa</dc:creator>
		
		<category><![CDATA[windows]]></category>

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

		<guid isPermaLink="false">http://uucode.com/blog/2010/12/29/vim-unicode-setup-for-windows-2000/</guid>
		<description><![CDATA[To display unicode (utf8) files in vim in windows, the following commands should be added to %PROGRAMS%\Vim\_vimrc:

set encoding=utf-8
set guifont=Courier_New:h12
set guifontwide=Arial_Unicode_MS:h12

The built-in method to input diacritical marks is to use vim digraphs, Ctrl-K + symbol1 + symbol2. The full list of them can be displayed using :digraphs command.
]]></description>
			<content:encoded><![CDATA[<p>To display unicode (utf8) files in vim in windows, the following commands should be added to <tt>%PROGRAMS%\Vim\_vimrc</tt>:</p>
<pre>
set encoding=utf-8
set guifont=Courier_New:h12
set guifontwide=Arial_Unicode_MS:h12
</pre>
<p>The built-in method to input diacritical marks is to use vim digraphs, <tt>Ctrl-K + symbol1 + symbol2</tt>. The full list of them can be displayed using <tt>:digraphs</tt> command.</p>
]]></content:encoded>
			<wfw:commentRss>http://uucode.com/blog/2010/12/29/vim-unicode-setup-for-windows-2000/feed/</wfw:commentRss>
		</item>
		<item>
		<title>how to install latest LuaTeX</title>
		<link>http://uucode.com/blog/2010/12/21/how-to-install-latest-luatex/</link>
		<comments>http://uucode.com/blog/2010/12/21/how-to-install-latest-luatex/#comments</comments>
		<pubDate>Tue, 21 Dec 2010 12:45:04 +0000</pubDate>
		<dc:creator>olpa</dc:creator>
		
		<category><![CDATA[TeX]]></category>

		<guid isPermaLink="false">http://uucode.com/blog/2010/12/21/how-to-install-latest-luatex/</guid>
		<description><![CDATA[After reading Paul Isambert&#8217;s article &#8220;Three things you can do with LuaTeX that would be extremely painful otherwise &#8221; I finally decided to check LuaTeX. Unfortunately, the code from the article does not work under old LuaTeX from TeX Live 2009 (and probably from TeX Live 2010 too). I downloaded a binary from the site, [...]]]></description>
			<content:encoded><![CDATA[<p>After reading Paul Isambert&#8217;s article &#8220;<a href="https://www.tug.org/members/TUGboat/tb31-3/tb99isambert.pdf">Three things you can do with LuaTeX that would be extremely painful otherwise </a>&#8221; I finally decided to check <a href="http://www.luatex.org/">LuaTeX</a>. Unfortunately, the code from the article does not work under old LuaTeX from TeX Live 2009 (and probably from TeX Live 2010 too). I downloaded a binary from the site, tried to run it and got an expected error:</p>
<pre>
This is LuaTeX, Version beta-0.40.6-2009100220 (TeX Live 2009)
(Fatal format file error; I'm stymied)
</pre>
<p>There is no README. No installation instructions. No FAQ entry. Just a binary file.</p>
<p>Below is my way to run a new luatex without changing the working installation of TeX. First of all, I need the <tt>textool.sh</tt> wrapper to run TeX tools from non-standard locations, <a href="http://uucode.com/blog/2010/04/28/running-tex-tools-from-non-standard-locations/">decribed here</a>.</p>
<p>The next step is to generate a new luatex format:</p>
<pre>
$ ./textool.sh ./luatex --ini luatex-plain.tex
$ mv luatex-plain.fmt luatex.fmt
</pre>
<p>Finally, the file compiles:</p>
<pre>
$ ./textool.sh ./luatex LuaTUGboat.tex
</pre>
<p>As for luatex, context etc, I think the approach is the same. I don&#8217;t need these formats (yet), therefore haven&#8217;t tried to find details. They are welcome as comments.</p>
]]></content:encoded>
			<wfw:commentRss>http://uucode.com/blog/2010/12/21/how-to-install-latest-luatex/feed/</wfw:commentRss>
		</item>
		<item>
		<title>multi-page tables with inter-row page breaks</title>
		<link>http://uucode.com/blog/2010/12/06/multi-page-tables-with-inter-row-page-breaks/</link>
		<comments>http://uucode.com/blog/2010/12/06/multi-page-tables-with-inter-row-page-breaks/#comments</comments>
		<pubDate>Mon, 06 Dec 2010 13:03:19 +0000</pubDate>
		<dc:creator>olpa</dc:creator>
		
		<category><![CDATA[TeX]]></category>

		<guid isPermaLink="false">http://uucode.com/blog/2010/12/06/multi-page-tables-with-inter-row-page-breaks/</guid>
		<description><![CDATA[I&#8217;m not sure that a typesetting system exists, which could break within a table row. I managed to do it (in the first approximation) in LaTeX: source code, PDF, some explanations. 
]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m not sure that a typesetting system exists, which could break within a table row. I managed to do it (in the first approximation) in LaTeX: <a href="http://uucode.com/download/2010/12/inrow_break/test.tex">source code</a>, <a href="http://uucode.com/download/2010/12/inrow_break/test.pdf">PDF</a>, <a href="http://groups.google.com/group/comp.text.tex/msg/23402ec1fa8e740c">some explanations</a>. </p>
]]></content:encoded>
			<wfw:commentRss>http://uucode.com/blog/2010/12/06/multi-page-tables-with-inter-row-page-breaks/feed/</wfw:commentRss>
		</item>
		<item>
		<title>scheme as a virtual machine - III</title>
		<link>http://uucode.com/blog/2010/11/12/scheme-as-a-virtual-machine-iii/</link>
		<comments>http://uucode.com/blog/2010/11/12/scheme-as-a-virtual-machine-iii/#comments</comments>
		<pubDate>Fri, 12 Nov 2010 13:22:59 +0000</pubDate>
		<dc:creator>olpa</dc:creator>
		
		<category><![CDATA[scheme]]></category>

		<guid isPermaLink="false">http://uucode.com/blog/2010/11/12/scheme-as-a-virtual-machine-iii/</guid>
		<description><![CDATA[After experimenting with CPSCM, I have to drop it. The final now consists of two implementations: Chicken and Gambit.
For closures, CPSCM relies on the host language. It works well for Scheme, Lisp and JavaScript backends, but no luck for PHP.

function getMyFunc($a){
  return create_function('$b', 'print "a='.$a.', b=$b";');
}
$f1 = getMyFunc(1);
$f1(2);

The code above and a few tricks [...]]]></description>
			<content:encoded><![CDATA[<p>After experimenting with CPSCM, I have to drop it. The final now consists of two implementations: Chicken and Gambit.</p>
<p>For closures, CPSCM relies on the host language. It works well for Scheme, Lisp and JavaScript backends, but no luck for PHP.</p>
<p><code><pre>
function getMyFunc($a){
  return create_function('$b', 'print "a='.$a.', b=$b";');
}
$f1 = getMyFunc(1);
$f1(2);
</pre></code></p>
<p>The code above and a few tricks to emulate lambdas do not work in PHP 4. As I was told on Stackoverflow, &#8220;&#8230;some changes have been made starting with PHP 5.3, but even there you don&#8217;t have your expected variable scopes that would allow you to do what you have in your examples.&#8221;</p>
<p><a href="http://stackoverflow.com/questions/4155254/anonymous-functions-lambdas-closures-in-php-4">http://stackoverflow.com/questions/4155254/anonymous-functions-lambdas-closures-in-php-4</a></p>
<p>Anyway, despite of dropping, I like CPSCM.</p>
<h3>18.11.2010, update</h3>
<p>The same problem is with Chicken. The final winner is Gambit.</p>
]]></content:encoded>
			<wfw:commentRss>http://uucode.com/blog/2010/11/12/scheme-as-a-virtual-machine-iii/feed/</wfw:commentRss>
		</item>
		<item>
		<title>allow filenames with &#8216;?&#8217; in apache, or retiring a forum</title>
		<link>http://uucode.com/blog/2010/11/02/allow-filenames-with-in-apache-or-retiring-a-forum/</link>
		<comments>http://uucode.com/blog/2010/11/02/allow-filenames-with-in-apache-or-retiring-a-forum/#comments</comments>
		<pubDate>Tue, 02 Nov 2010 13:45:31 +0000</pubDate>
		<dc:creator>olpa</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://uucode.com/blog/2010/11/02/allow-filenames-with-in-apache-or-retiring-a-forum/</guid>
		<description><![CDATA[After I retired a blog, I continued with a forum. Unexpectedly, this step consists of two tasks:
1) convert phpBB2 forum to static pages
2) retain the old URLs
The first task was easy, all I needed is to carefully to change the templates and the source code to remove all the dynamic elements from the forum pages. [...]]]></description>
			<content:encoded><![CDATA[<p>After I <a href="http://uucode.com/blog/2010/10/19/retiring-a-wordpress-blog/">retired a blog</a>, I continued with a forum. Unexpectedly, this step consists of two tasks:<br />
1) convert phpBB2 forum to static pages<br />
2) retain the old URLs</p>
<p>The first task was easy, all I needed is to carefully to change the templates and the source code to remove all the dynamic elements from the forum pages. Then mirrored:</p>
<pre><code>
wget -r -np -m -p --wait=5 -o log http://mysite/forum2/
</code></pre>
<p>I checked the &#8220;log&#8221; file to make sure that all the pages downloaded ok:</p>
<pre><code>
grep '^   ' log  | grep -v '     0K'
</code></pre>
<p>Then I manually looked at the set of the downloaded files. I made several edit-mirror-check cycles before the result was ok.</p>
<p>After I uploaded the static copy, I got a nasty surprise. The names of files are:</p>
<pre><code>
viewforum.php?f=1
viewtopic.php?t=378&start=15
...
</code></pre>
<p>The web server (apache) can&#8217;t deliver such files because of the question sigh, which is reserved to separate the file name and the query. How to stop this correct behaviour?</p>
<p>The task is challenging. My answer is:</p>
<p>* Use mod_rewrite to change the question sign to the underscore sign<br />
* Correspondingly, rename the files: &#8220;viewforum.php?f=1&#8243; to &#8220;viewforum.php_f=1&#8243;, &#8220;viewtopic.php?t=378&#038;start=15&#8243; to &#8220;viewtopic.php?t=378&#038;start=15&#8243; etc.</p>
<p>The <tt>.htaccess</tt> is:</p>
<pre><code>
RewriteEngine On
RewriteCond %{ENV:REDIRECT_STATUS} =""
RewriteCond %{QUERY_STRING} !=""
RewriteRule ^(.*)$ $1_%{QUERY_STRING} [L]

ForceType "text/html; charset=iso-8859-1"
</code></pre>
<p>Everything is obvious except the line 2. After applying the rewrite rule, the sever repeats the rewriting process and can fall into a loop. The REDIRECT_STATUS-line detects the second pass and prevents the mod_rewrite from looping.</p>
<p>It was hard to construct this line. The documentation on mod_rewrite does not describe &#8220;REDIRECT_STATUS&#8221;. Thanks log level 9 for explaining the problem, Google for relevant search and Internet for storing knowledge.</p>
<p>As for rewriting the file names, different approaches are possible. I used Perl.</p>
<pre><code>
find forum2/ -name '*\?*' >flist
cat flist | perl -nle '$a=$_; s/\?/_/; rename $a,$_;'
</code></pre>
]]></content:encoded>
			<wfw:commentRss>http://uucode.com/blog/2010/11/02/allow-filenames-with-in-apache-or-retiring-a-forum/feed/</wfw:commentRss>
		</item>
	</channel>
</rss>

