<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Aberration &#187; HowTo</title>
	<atom:link href="http://tomasz.sterna.tv/topics/howto/feed/" rel="self" type="application/rss+xml" />
	<link>http://tomasz.sterna.tv</link>
	<description>technology babbling</description>
	<lastBuildDate>Thu, 02 Sep 2010 00:33:02 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Installing Gnome Shell under Ubuntu Linux</title>
		<link>http://tomasz.sterna.tv/2010/04/installing-gnome-shell-under-ubuntu-linux/</link>
		<comments>http://tomasz.sterna.tv/2010/04/installing-gnome-shell-under-ubuntu-linux/#comments</comments>
		<pubDate>Mon, 12 Apr 2010 12:26:01 +0000</pubDate>
		<dc:creator>Tomasz Sterna</dc:creator>
				<category><![CDATA[HowTo]]></category>
		<category><![CDATA[gnome]]></category>
		<category><![CDATA[gnome shell]]></category>
		<category><![CDATA[ubuntu]]></category>

		<guid isPermaLink="false">http://tomasz.sterna.tv/?p=630</guid>
		<description><![CDATA[At work there is still sluggish Ubuntu on my desktop. I wanted to use Gnome Shell (which I got to love under Arch) on it though. Step One &#8211; Gnome Shell PPA # echo 'deb http://ppa.launchpad.net/ricotz/testing/ubuntu lucid main # GnomeShell PPA' >> /etc/apt/sources.list # aptitude update Step Two &#8211; Install the Beast # aptitude install [...]]]></description>
			<content:encoded><![CDATA[<p>At work there is still <a href="http://tomasz.sterna.tv/2010/04/bye-bye-ubuntu-welcome-arch/">sluggish Ubuntu</a> on my desktop. I wanted to use Gnome Shell (which I got to love under Arch) on it though.</p>
<ol>
<li>Step One &#8211; Gnome Shell PPA
<pre>
# echo 'deb http://ppa.launchpad.net/ricotz/testing/ubuntu lucid main # GnomeShell PPA' >> /etc/apt/sources.list
# aptitude update
</pre>
</li>
<li>Step Two &#8211; Install the Beast
<pre>
# aptitude install gnome-shell
</pre>
</li>
<li>Step Three &#8211; Activate!
<pre>
$ echo 'export WINDOW_MANAGER=gnome-shell' >> ~/.gnomerc
</pre>
</li>
<li>Step Four &#8211; RELOGIN</li>
</ol>
<p><small><a href="http://tomasz.sterna.tv/2010/04/installing-gnome-shell-under-ubuntu-linux/">Installing Gnome Shell under Ubuntu Linux</a> &copy;, <a rel="license" href=""></a>.</small></p>]]></content:encoded>
			<wfw:commentRss>http://tomasz.sterna.tv/2010/04/installing-gnome-shell-under-ubuntu-linux/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>GSM Dial-Up over Nokia N900 Bluetooth on Ubuntu Karmic</title>
		<link>http://tomasz.sterna.tv/2009/12/gsm-dial-up-over-nokia-n900-bluetooth-on-ubuntu-karmic/</link>
		<comments>http://tomasz.sterna.tv/2009/12/gsm-dial-up-over-nokia-n900-bluetooth-on-ubuntu-karmic/#comments</comments>
		<pubDate>Sun, 27 Dec 2009 16:54:02 +0000</pubDate>
		<dc:creator>Tomasz Sterna</dc:creator>
				<category><![CDATA[HowTo]]></category>
		<category><![CDATA[Maemo]]></category>
		<category><![CDATA[bluetooth]]></category>
		<category><![CDATA[dialup]]></category>
		<category><![CDATA[gsm]]></category>
		<category><![CDATA[n900]]></category>
		<category><![CDATA[nokia]]></category>
		<category><![CDATA[ubuntu]]></category>

		<guid isPermaLink="false">http://tomasz.sterna.tv/?p=455</guid>
		<description><![CDATA[It was some time ago that I needed to setup a Dial-Up connection on my Ubuntu workstation and boy, things have changed since. The procedure got easier, but it still isn&#8217;t straightforward. This time you don&#8217;t need to manually edit files though. :-) Let&#8217;s get to the business&#8230; Nokia N900 part Default Maemo5 bluetooth setup [...]]]></description>
			<content:encoded><![CDATA[<p>It was some time ago that I needed to setup a <a href="http://tomasz.sterna.tv/2007/05/networkmanager-and-gsm-dial-up-over-bluetooth/">Dial-Up connection on my Ubuntu workstation</a> and boy, things have changed since. The procedure got easier, but it still isn&#8217;t straightforward. This time you don&#8217;t need to manually edit files though. :-)</p>
<p>Let&#8217;s get to the business&#8230;<span id="more-455"></span></p>
<p><strong>Nokia N900 part</strong></p>
<p>Default <a href="http://wiki.maemo.org/Bluetooth">Maemo5 bluetooth</a> setup on Nokia N900 does not provide Dial-Up Networking BlueZ profile. You need to install &#8220;Bluetooth Dial-up Networking&#8221; package from <a href="http://wiki.maemo.org/Extras-testing">extras-testing repository</a>. Restart the phone after installing to activate DUN.</p>
<p style="text-align: center;"><a href="http://tomasz.sterna.tv/uploads/2009/12/Screenshot-20091227-160856.png"><img class="size-medium wp-image-456 aligncenter" title="App Manager" src="http://tomasz.sterna.tv/uploads/2009/12/Screenshot-20091227-160856-300x180.png" alt="App Manager" width="300" height="180" /></a></p>
<p><strong>Ubuntu Karmic part</strong></p>
<p>Ubuntu default gnome-bluetooth package does not provide means needed to setup Dial-Up connection. You need to replace it with a lot better Blueman. First add <a href="https://launchpad.net/~blueman/+archive/ppa">Blueman PPA</a> to repositories.</p>
<p><a href="http://tomasz.sterna.tv/uploads/2009/12/zrzut_ekranu-Modyfikuj-źródło.png"><img class="aligncenter size-medium wp-image-459" title="Blueman PPA" src="http://tomasz.sterna.tv/uploads/2009/12/zrzut_ekranu-Modyfikuj-źródło-300x172.png" alt="Blueman PPA" width="300" height="172" /></a></p>
<p>Then install Blueman. It will replace gnome-bluetooth. Reboot workstation to get changes active.<a href="http://tomasz.sterna.tv/uploads/2009/12/zrzut_ekranu-Centrum-oprogramowania-Ubuntu.png"></a><a href="http://tomasz.sterna.tv/uploads/2009/12/zrzut_ekranu-Centrum-oprogramowania-Ubuntu1.png"></a><a href="http://tomasz.sterna.tv/uploads/2009/12/zrzut_ekranu-Centrum-oprogramowania-Ubuntu1.png"></a><a href="http://tomasz.sterna.tv/uploads/2009/12/zrzut_ekranu-Centrum-oprogramowania-Ubuntu.png"></a><a href="http://tomasz.sterna.tv/uploads/2009/12/zrzut_ekranu-Centrum-oprogramowania-Ubuntu.png"><img class="aligncenter size-full wp-image-466" title="App Manager - Blueman" src="http://tomasz.sterna.tv/uploads/2009/12/zrzut_ekranu-Centrum-oprogramowania-Ubuntu.png" alt="App Manager - Blueman" width="600" height="113" /></a></p>
<p>Right click on bluetooth icon in notification area and &#8220;Setup a new device&#8230;&#8221; &#8211; pair your N900. Then left click on same icon and &#8220;Bluetooth devices&#8221; window opens.<a href="http://tomasz.sterna.tv/uploads/2009/12/zrzut_ekranu-Urządzenia-Bluetooth.png"></a><a href="http://tomasz.sterna.tv/uploads/2009/12/zrzut_ekranu-Urządzenia-Bluetooth1.png"></a><a href="http://tomasz.sterna.tv/uploads/2009/12/zrzut_ekranu-Urządzenia-Bluetooth1.png"><img class="aligncenter size-full wp-image-467" title="Bluetooth Devices" src="http://tomasz.sterna.tv/uploads/2009/12/zrzut_ekranu-Urządzenia-Bluetooth1.png" alt="Bluetooth Devices" width="500" height="180" /></a></p>
<p>Select your device and click &#8220;Settings&#8230;&#8221; button. Then connect &#8220;Dialup Networking (DUN)&#8221;. This will add your device to NetworkManager. Right click Network icon in notification area and select &#8220;Modify connections&#8230;&#8221;. Then on &#8220;Mobile&#8221; tab &#8220;Add&#8221; a connection for &#8220;Installed GSM device&#8221;. It&#8217;s good to check &#8220;Connect automatically&#8221;.<a href="http://tomasz.sterna.tv/uploads/2009/12/zrzut_ekranu-Połączenia-sieciowe.png"><img class="aligncenter size-medium wp-image-461" title="Network Connections" src="http://tomasz.sterna.tv/uploads/2009/12/zrzut_ekranu-Połączenia-sieciowe-300x180.png" alt="Network Connections" width="300" height="180" /></a><a href="http://tomasz.sterna.tv/uploads/2009/12/zrzut_ekranu-Nowe-połączenie-komórkowe.png"><img class="aligncenter size-medium wp-image-460" title="New mobile connection" src="http://tomasz.sterna.tv/uploads/2009/12/zrzut_ekranu-Nowe-połączenie-komórkowe-300x207.png" alt="New mobile connection" width="300" height="207" /></a><a href="http://tomasz.sterna.tv/uploads/2009/12/zrzut_ekranu-Modyfikowanie-iPlus-N900.png"><img class="aligncenter size-medium wp-image-458" title="GSM Connection" src="http://tomasz.sterna.tv/uploads/2009/12/zrzut_ekranu-Modyfikowanie-iPlus-N900-274x300.png" alt="GSM Connection" width="274" height="300" /></a></p>
<p>Now when you want to establish a connection just click the Bluetooth icon in notification area, right click your device and Connect &#8220;Dial-up Networking&#8221;. NetworkManager will kick in if you checked it to connect automatically and you&#8217;re online.</p>
<p><strong>Have Fun.</strong></p>
<p><small><a href="http://tomasz.sterna.tv/2009/12/gsm-dial-up-over-nokia-n900-bluetooth-on-ubuntu-karmic/">GSM Dial-Up over Nokia N900 Bluetooth on Ubuntu Karmic</a> &copy;, <a rel="license" href=""></a>.</small></p>]]></content:encoded>
			<wfw:commentRss>http://tomasz.sterna.tv/2009/12/gsm-dial-up-over-nokia-n900-bluetooth-on-ubuntu-karmic/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Fullscreen StarCraft on Linux WINE</title>
		<link>http://tomasz.sterna.tv/2009/10/fullscreen-starcraft-on-linux-wine/</link>
		<comments>http://tomasz.sterna.tv/2009/10/fullscreen-starcraft-on-linux-wine/#comments</comments>
		<pubDate>Mon, 26 Oct 2009 22:24:23 +0000</pubDate>
		<dc:creator>Tomasz Sterna</dc:creator>
				<category><![CDATA[HowTo]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[StarCraft]]></category>
		<category><![CDATA[XOrg]]></category>

		<guid isPermaLink="false">http://tomasz.sterna.tv/?p=433</guid>
		<description><![CDATA[In order for StarCraft to launch full screen WINE needs to be able to change X11 resolution. Unfortunately, on new laptops the graphics subsystem only reports resolution native to the LCD display, thus the only resolution available in X on my system is 1280&#215;800. I needed to add one more &#8211; native to StarCraft &#8211; [...]]]></description>
			<content:encoded><![CDATA[<p>In order for StarCraft to launch full screen WINE needs to be able to change X11 resolution.<br />
Unfortunately, on new laptops the graphics subsystem only reports resolution native to the LCD display, thus the only resolution available in X on my system is 1280&#215;800.</p>
<p>I needed to add one more &#8211; native to StarCraft &#8211; and let the graphics hardware scale it to full screen.<br />
It&#8217;s pretty easy using XRandr extensions:</p>
<pre>
$ cat .xprofile
xrandr --newmode "640x480_120.00"  52.41  640 680 744 848  480 481 484 515  -HSync +Vsync
xrandr --addmode LVDS1 640x480_120.00
</pre>
<p><small><a href="http://tomasz.sterna.tv/2009/10/fullscreen-starcraft-on-linux-wine/">Fullscreen StarCraft on Linux WINE</a> &copy;, <a rel="license" href=""></a>.</small></p>]]></content:encoded>
			<wfw:commentRss>http://tomasz.sterna.tv/2009/10/fullscreen-starcraft-on-linux-wine/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>PHP &#8220;Cannot modify header information&#8221; and the dreaded BOM</title>
		<link>http://tomasz.sterna.tv/2009/06/php-cannot-modify-header-information-and-the-dreaded-bom/</link>
		<comments>http://tomasz.sterna.tv/2009/06/php-cannot-modify-header-information-and-the-dreaded-bom/#comments</comments>
		<pubDate>Mon, 01 Jun 2009 11:40:04 +0000</pubDate>
		<dc:creator>Tomasz Sterna</dc:creator>
				<category><![CDATA[HowTo]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://tomasz.sterna.tv/?p=394</guid>
		<description><![CDATA[Were you ever hit by the PHP warning: Warning: Cannot modify header information - headers already sent by (output started at some/file.php:1) in some/other/file.php on line 123 ? The first line of the file in question some/file.php looks innocent: &#60;?php A standard PHP code opening tag. So, where are the outputted characters? Well&#8230; Welcome to [...]]]></description>
			<content:encoded><![CDATA[<p>Were you ever hit by the PHP warning:<br />
<code>Warning: Cannot modify header information - headers already sent by (output started at some/file.php:1) in some/other/file.php on line 123</code> ?</p>
<p>The first line of the file in question <code>some/file.php</code> looks innocent:<br />
<code>&lt;?php</code><br />
A standard PHP code opening tag. So, where are the outputted characters?<br />
Well&#8230; Welcome to Unicode world. With multibyte characters there is a need of distinguishing low-endian from high-endian encoded files. It&#8217;s a job of the <a href="http://en.wikipedia.org/wiki/Byte-order_mark">BOM</a> &#8211; byte-order mark &#8211; it is an invisible, no length space with a unique two bytes character code U+FEFF. It does not affect the rendered content of the document and it is easy to detect the endianness of the document.</p>
<p>But PHP is not a renderer &#8211; it takes the two bytes literally and sends them to browser. But before any content, it needs to send HTTP headers. The rest of the story is obvious &#8211; you cannot modify already sent headers and PHP warns you about the fact.</p>
<p><strong>How to remove BOM?</strong><br />
It&#8217;s not that easy &#8211; in most editors it is not an editable character and they just leave it as-is. For me, the easiest way is to open the file in <a href="http://www.scintilla.org/SciTE.html">SciTE</a>, change the File -> Encoding from <em>UTF-8 with BOM</em> to <em>UTF-8</em> and save it.</p>
<p><small><a href="http://tomasz.sterna.tv/2009/06/php-cannot-modify-header-information-and-the-dreaded-bom/">PHP &#8220;Cannot modify header information&#8221; and the dreaded BOM</a> &copy;, <a rel="license" href=""></a>.</small></p>]]></content:encoded>
			<wfw:commentRss>http://tomasz.sterna.tv/2009/06/php-cannot-modify-header-information-and-the-dreaded-bom/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Using monit with Ubuntu Server</title>
		<link>http://tomasz.sterna.tv/2009/05/using-monit-with-ubuntu-server/</link>
		<comments>http://tomasz.sterna.tv/2009/05/using-monit-with-ubuntu-server/#comments</comments>
		<pubDate>Wed, 27 May 2009 12:08:44 +0000</pubDate>
		<dc:creator>Tomasz Sterna</dc:creator>
				<category><![CDATA[HowTo]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[Administration]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Monit]]></category>
		<category><![CDATA[ubuntu]]></category>

		<guid isPermaLink="false">http://tomasz.sterna.tv/?p=383</guid>
		<description><![CDATA[Monit is a software watchdog &#8211; a very useful tool to keep your service daemons alive. The best way to run monit is as the Init managed process. But there is no /etc/inittab on Ubuntu anymore. Instead we have Upstart. Adding Monit as an Upstart service is easy. Let me show you how&#8230; Upstart is [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://mmonit.com/monit/">Monit</a> is a software <a href="http://en.wikipedia.org/wiki/Watchdog_timer">watchdog</a> &#8211; a very useful tool to keep your service daemons alive.</p>
<p>The best way to run monit is as the Init managed process. But there is no <code>/etc/inittab</code> on Ubuntu anymore. Instead we have <a href="http://upstart.ubuntu.com/">Upstart</a>. Adding Monit as an Upstart service is easy. Let me show you how&#8230;</p>
<p><span id="more-383"></span>Upstart is event based, and its event handling configuration is in <code>/etc/event.d</code>. The configuration is a bit similar to <code>/etc/inittab</code>, but a bit more verbose and placed in separate files. To add Monit as a managed process, just create a file similar to a getty spawner configuration in <code>ttyX</code>. I named my file: <code>/etc/event.d/monit</code> with content of:</p>
<p><code># Run monit in standard run-levels<br />
start on stopped rc2<br />
start on stopped rc3<br />
start on stopped rc4<br />
start on stopped rc5<br />
stop on runlevel 0<br />
stop on runlevel 1<br />
stop on runlevel 6<br />
respawn<br />
exec /usr/sbin/monit -Ic /etc/monit/monitrc</code></p>
<p>Next just start monit. Issue a command:<br />
<code>start monit</code></p>
<p>Good luck with service monitoring.</p>
<p><small><a href="http://tomasz.sterna.tv/2009/05/using-monit-with-ubuntu-server/">Using monit with Ubuntu Server</a> &copy;, <a rel="license" href=""></a>.</small></p>]]></content:encoded>
			<wfw:commentRss>http://tomasz.sterna.tv/2009/05/using-monit-with-ubuntu-server/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>nginx and BOSH / Comet connections</title>
		<link>http://tomasz.sterna.tv/2009/05/nginx-and-bosh-comet-connections/</link>
		<comments>http://tomasz.sterna.tv/2009/05/nginx-and-bosh-comet-connections/#comments</comments>
		<pubDate>Mon, 25 May 2009 10:10:14 +0000</pubDate>
		<dc:creator>Tomasz Sterna</dc:creator>
				<category><![CDATA[HowTo]]></category>
		<category><![CDATA[Jabber/XMPP]]></category>
		<category><![CDATA[http]]></category>
		<category><![CDATA[jabber]]></category>
		<category><![CDATA[nginx]]></category>
		<category><![CDATA[xmpp]]></category>

		<guid isPermaLink="false">http://tomasz.sterna.tv/?p=372</guid>
		<description><![CDATA[Yesterday I was scratching my head badly, why on earth my development BOSH installation (I am developing a web based Jabber client) did not work, while the production one did fine. After digging (telnet and hand crafted HTTP+XMPP requests did the job well) I found out, that my local nginx installation was &#8220;to new&#8221;. The [...]]]></description>
			<content:encoded><![CDATA[<p>Yesterday I was scratching my head badly, why on earth my development BOSH installation (I am developing a web based Jabber client) did not work, while the production one did fine. After digging (telnet and hand crafted HTTP+XMPP requests did the job well) I found out, that my local nginx installation was &#8220;to new&#8221;.</p>
<p>The latest nginx version does proxied request caching. It buffers the proxied server response and pushes it to the client as a whole. It does help in mitigating client-backend bandwidth differences, but breaks Comet requests like the BOSH one. There is an option added to nginx for this very purpose: proxy_buffering. You need to disable the buffering: <code>proxy_buffering off;</code>.</p>
<p><span id="more-372"></span>So, the complete BOSH proxy location should look like this:</p>
<p><code>	location /http-bind/ {<br />
		proxy_buffering off;<br />
		tcp_nodelay on;<br />
		keepalive_timeout 55;<br />
		proxy_pass      http://xmpp.server:5280/xmpp-httpbind/;<br />
	}</code></p>
<p><small><a href="http://tomasz.sterna.tv/2009/05/nginx-and-bosh-comet-connections/">nginx and BOSH / Comet connections</a> &copy;, <a rel="license" href=""></a>.</small></p>]]></content:encoded>
			<wfw:commentRss>http://tomasz.sterna.tv/2009/05/nginx-and-bosh-comet-connections/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Connecting remote X client to Windows workstation over SSH</title>
		<link>http://tomasz.sterna.tv/2009/05/connecting-remote-x-client-to-windows-workstation-over-ssh/</link>
		<comments>http://tomasz.sterna.tv/2009/05/connecting-remote-x-client-to-windows-workstation-over-ssh/#comments</comments>
		<pubDate>Tue, 05 May 2009 11:29:27 +0000</pubDate>
		<dc:creator>Tomasz Sterna</dc:creator>
				<category><![CDATA[HowTo]]></category>
		<category><![CDATA[Administration]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[SSH]]></category>

		<guid isPermaLink="false">http://tomasz.sterna.tv/?p=141</guid>
		<description><![CDATA[Being a Linux administrator usually means having many remote servers at care. The best tool to do the job is SSH and your favourite shell launched remotely (mine is good-ol&#8217; Bash). Problems arise when the only thing you have (or are allowed to have) at hand locally is a Windows workstation. Put this problem has [...]]]></description>
			<content:encoded><![CDATA[<p>Being a Linux administrator usually means having many remote servers at care. The best tool to do the job is SSH and your favourite shell launched remotely (mine is good-ol&#8217; Bash).</p>
<p>Problems arise when the only thing you have (or are allowed to have) at hand locally is a Windows workstation. Put this problem has a good solution already &#8211; <a href="http://www.chiark.greenend.org.uk/~sgtatham/putty/">PuTTY</a>.</p>
<p>But what if the application you need is an X client? You need to launch it remotely and display its windows on some X11 screen. Unfortunately Windows does not provide one.</p>
<p>You need to install a separate X11 server on your windows workstation. The best free one is <a href="http://sourceforge.net/projects/xming">Xming</a>.<br />
Get it, install and run &#8220;Xming&#8221; app. You should see the X icon in taskbar. You&#8217;re now half way there.</p>
<p>Next, launch PuTTY<a href="http://tomasz.sterna.tv/uploads/2009/05/putty-x11-forwarding.png"><img src="http://tomasz.sterna.tv/uploads/2009/05/putty-x11-forwarding-150x150.png" alt="putty-x11-forwarding" title="putty-x11-forwarding" width="150" height="150" class="alignright size-thumbnail wp-image-142" /></a> and enable X11 forwarding on your Connection -> SSH -> X11 pane. Check &#8220;Enable X11 forwarding&#8221; and enter <code>127.0.0.1:0</code> at &#8220;X display location&#8221;.</p>
<p>Login to the remote server account and check whether X11 forwarding is working. Issue command: <code>echo $DISPLAY</code>. You should get something like: <code>localhost:10.0</code>. You&#8217;re done.</p>
<p>But if you did get nothing, you&#8217;re not completely out of luck. Most probable reason is that X11 forwarding is disabled on your remote host. Check <code>/etc/ssh/sshd_config</code> &#8220;X11Forwarding&#8221; directive. If it is set to &#8220;no&#8221; or unset, just set it to &#8220;yes&#8221; (or ask the system administrator to set it). While you are there it&#8217;s worth setting &#8220;X11DisplayOffset 10&#8243; too there, to avoid clashing local X servers on the machine.</p>
<p><small><a href="http://tomasz.sterna.tv/2009/05/connecting-remote-x-client-to-windows-workstation-over-ssh/">Connecting remote X client to Windows workstation over SSH</a> &copy;, <a rel="license" href=""></a>.</small></p>]]></content:encoded>
			<wfw:commentRss>http://tomasz.sterna.tv/2009/05/connecting-remote-x-client-to-windows-workstation-over-ssh/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>PHP FastCGI with nginx on Ubuntu</title>
		<link>http://tomasz.sterna.tv/2009/04/php-fastcgi-with-nginx-on-ubuntu/</link>
		<comments>http://tomasz.sterna.tv/2009/04/php-fastcgi-with-nginx-on-ubuntu/#comments</comments>
		<pubDate>Tue, 07 Apr 2009 13:14:08 +0000</pubDate>
		<dc:creator>Tomasz Sterna</dc:creator>
				<category><![CDATA[HowTo]]></category>
		<category><![CDATA[FastCGI]]></category>
		<category><![CDATA[nginx]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://tomasz.sterna.tv/?p=98</guid>
		<description><![CDATA[One of the questions arising during Apache to nginx migration is &#8220;How to run my PHP based applications?&#8221;. Nginx supports PHP only via FastCGI interface (which is the prefered way of running PHP for me anyway). There are dozens of HOWTOs for configuring nginx to direct .php files requests to FastCGI, but only a few [...]]]></description>
			<content:encoded><![CDATA[<p>One of the questions arising during <a href="http://httpd.apache.org/">Apache</a> to <a href="http://www.nginx.org/">nginx</a> migration is &#8220;How to run my PHP based applications?&#8221;. Nginx supports PHP only via FastCGI interface (which is the prefered way of running PHP for me anyway). There are dozens of HOWTOs for configuring nginx to direct .php files requests to FastCGI, but only a few covering the topic of running the PHP FastCGI backend. None of them covers the correct way, though.</p>
<p>Let me show you how to get it right&#8230;<span id="more-98"></span></p>
<p>PHP CGI binary is perfectly able running a FastCGI interface by itself. There is no need to run it with an external wrapper. No need to install anything more than the PHP itself.</p>
<p>Just install the php-cgi: <code>aptitude install php5-cgi</code> and run: <code>php-cgi -b 127.0.0.1:9000</code>. Done. You have PHP running FastCGI interface on localhost on port 9000. You can connect to it from nginx using <code>fastcgi_pass 127.0.0.1:9000;</code>.</p>
<p>php-cgi binary is configurable using environment variables. The most interesting ones are PHP_FCGI_CHILDREN telling how many child processes to launch and PHP_FCGI_MAX_REQUESTS telling how many requests each child need to process before termination (and launching another one).</p>
<p>I use this command (wrapped in a simple script) on my development machine. But server needs something to launch the PHP FastCGI processes on boot. Here is a simple <code>init.d</code> script to get the php-cgi running as a normal system service:</p>
<pre>
#!/bin/bash
BIND=127.0.0.1:9000
USER=www-data
PHP_FCGI_CHILDREN=15
PHP_FCGI_MAX_REQUESTS=1000

PHP_CGI=/usr/bin/php-cgi
PHP_CGI_NAME=`basename $PHP_CGI`
PHP_CGI_ARGS="- USER=$USER PATH=/usr/bin PHP_FCGI_CHILDREN=$PHP_FCGI_CHILDREN PHP_FCGI_MAX_REQUESTS=$PHP_FCGI_MAX_REQUESTS $PHP_CGI -b $BIND"
RETVAL=0

start() {
      echo -n "Starting PHP FastCGI: "
      start-stop-daemon --quiet --start --background --chuid "$USER" --exec /usr/bin/env -- $PHP_CGI_ARGS
      RETVAL=$?
      echo "$PHP_CGI_NAME."
}
stop() {
      echo -n "Stopping PHP FastCGI: "
      killall -q -w -u $USER $PHP_CGI
      RETVAL=$?
      echo "$PHP_CGI_NAME."
}

case "$1" in
    start)
      start
  ;;
    stop)
      stop
  ;;
    restart)
      stop
      start
  ;;
    *)
      echo "Usage: php-fastcgi {start|stop|restart}"
      exit 1
  ;;
esac
exit $RETVAL
</pre>
<p>Put it in <code>/etc/init.d/php-fastcgi</code>, make it executable <code>chmod +x /etc/init.d/php-fastcgi</code>, unleash the daemons <code>/etc/init.d/php-fastcgi start</code> and finally make it permanent <code>update-rc.d php-fastcgi defaults</code>.</p>
<p>May the nginx + php-cgi fastcgi serve you well.</p>
<p>P.S. Here&#8217;s a simple snippet of nginx configuration to make use of the described service:</p>
<pre>

server {
        listen          80;
        server_name     example.com;

        access_log      /var/log/nginx/example.com.access_log;
        error_log       /var/log/nginx/example.com.error_log warn;

        root            /var/www/example.com/public;

        index           index.php index.html;
        fastcgi_index   index.php;

        location ~ \.php {
                include /etc/nginx/fastcgi_params;
                keepalive_timeout 0;
                fastcgi_param   SCRIPT_FILENAME  $document_root$fastcgi_script_name;
                fastcgi_pass    127.0.0.1:9000;
        }
}
</pre>
<p><small><a href="http://tomasz.sterna.tv/2009/04/php-fastcgi-with-nginx-on-ubuntu/">PHP FastCGI with nginx on Ubuntu</a> &copy;, <a rel="license" href=""></a>.</small></p>]]></content:encoded>
			<wfw:commentRss>http://tomasz.sterna.tv/2009/04/php-fastcgi-with-nginx-on-ubuntu/feed/</wfw:commentRss>
		<slash:comments>29</slash:comments>
		</item>
		<item>
		<title>Gentoo physical machine to Ubuntu OpenVZ container migration</title>
		<link>http://tomasz.sterna.tv/2009/03/gentoo-physical-machine-to-ubuntu-openvz-container-migration/</link>
		<comments>http://tomasz.sterna.tv/2009/03/gentoo-physical-machine-to-ubuntu-openvz-container-migration/#comments</comments>
		<pubDate>Wed, 25 Mar 2009 09:23:10 +0000</pubDate>
		<dc:creator>Tomasz Sterna</dc:creator>
				<category><![CDATA[HowTo]]></category>
		<category><![CDATA[gentoo]]></category>
		<category><![CDATA[migration]]></category>
		<category><![CDATA[OpenVZ]]></category>
		<category><![CDATA[ubuntu]]></category>

		<guid isPermaLink="false">http://tomasz.sterna.tv/?p=78</guid>
		<description><![CDATA[Recently I migrated two Gentoo based physical installations to Ubuntu based OpenVZ containers. The should-be piece-of-cake process gave mi the hell of a headache. After the migration the container network did not work as expected. To be exact, it did not work at all&#8230; OpenVZ uses one &#8220;bare&#8221; venet0 device on the host side, connected [...]]]></description>
			<content:encoded><![CDATA[<p>Recently I migrated two Gentoo based physical installations to Ubuntu based OpenVZ containers.<br />
The should-be <a href="http://wiki.openvz.org/Physical_to_VE">piece-of-cake process</a> gave mi the hell of a headache. After the migration the container network did not work as expected. To be exact, it did not work at all&#8230;</p>
<p><span id="more-78"></span>OpenVZ uses one &#8220;bare&#8221; venet0 device on the host side, connected to a multi-IP (or multi-aliased) venet0 device on the container side with a twisted PTP connection. The IP-level communication is done via 192.0.2.1 virtual gateway. It&#8217;s clever. It works well. But it&#8217;s not straightforward to get running &#8211; especially with sparse documentation OpenVZ has.</p>
<p>After a few hours of fighting and cursing I finally got it to work.</p>
<ol>
<li>Create the container and migrate content as described in <a href="http://wiki.openvz.org/Physical_to_VE">Physical to container</a> doc.</li>
<li>Tune it according to the above doc and <a href="http://wiki.openvz.org/Gentoo_template_creation">Gentoo template creation</a> doc.</li>
<li>In the container remove all the network configuration scripts from runlevels: <code>rc-update del net.eth0; rc-update del net.eth1 ...</code></li>
<li>Create a script for venet0 device: <code>ln -s net.lo /etc/init.d/net.venet0</code> and add it to default runlevel: <code>rc-update add net.venet0 default</code>.</li>
<li>Set up the /etc/conf.d/net the following way:
<pre>
config_venet0=(
        "123.234.123.234/32" # the old eth0 address
        "10.0.0.1/24" # the old eth1 address
)
routes_venet0=(
        "192.0.2.1 dev venet0"
        "default via 192.0.2.1"
)
</pre>
</li>
</ol>
<p>P.S. For the curious ones &#8211; yes, the &#8220;old&#8221; <a href="http://www.chrome.pl/">Chrome Platform</a> (seikken+amenite) is crammed in a new shiny Dell 1U rack server. ^_^</p>
<p><small><a href="http://tomasz.sterna.tv/2009/03/gentoo-physical-machine-to-ubuntu-openvz-container-migration/">Gentoo physical machine to Ubuntu OpenVZ container migration</a> &copy;, <a rel="license" href=""></a>.</small></p>]]></content:encoded>
			<wfw:commentRss>http://tomasz.sterna.tv/2009/03/gentoo-physical-machine-to-ubuntu-openvz-container-migration/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Exim4, PostgreSQL and: invalid byte sequence for encoding UTF8</title>
		<link>http://tomasz.sterna.tv/2009/03/exim4-postgresql-and-invalid-byte-sequence-for-encoding-utf8/</link>
		<comments>http://tomasz.sterna.tv/2009/03/exim4-postgresql-and-invalid-byte-sequence-for-encoding-utf8/#comments</comments>
		<pubDate>Wed, 25 Mar 2009 08:51:18 +0000</pubDate>
		<dc:creator>Tomasz Sterna</dc:creator>
				<category><![CDATA[HowTo]]></category>
		<category><![CDATA[exim]]></category>
		<category><![CDATA[exim4]]></category>
		<category><![CDATA[postgres]]></category>
		<category><![CDATA[utf8]]></category>

		<guid isPermaLink="false">http://tomasz.sterna.tv/?p=75</guid>
		<description><![CDATA[Today I got mailed by cron, that there is something in Exim&#8217;s paniclog. After investigating I found a line like this: 2009-03-25 09:40:24 failed to expand "${lookup pgsql{SELECT [...]}}" while checking a list: lookup of "SELECT [...]" gave DEFER: PGSQL: query failed: ERROR: invalid byte sequence for encoding "UTF8": 0xc06e No wonder&#8230; There is a [...]]]></description>
			<content:encoded><![CDATA[<p>Today I got mailed by cron, that there is something in Exim&#8217;s paniclog. After investigating I found a line like this:</p>
<pre>
2009-03-25 09:40:24 failed to expand "${lookup pgsql{SELECT [...]}}" while checking a list: lookup of "SELECT [...]" gave DEFER: PGSQL: query failed: ERROR:  invalid byte sequence for encoding "UTF8": 0xc06e
</pre>
<p>No wonder&#8230; There is a local_user check in place in RCPT ACL and Exim checks username in DB table. The $local_part in the SQL query is taken directly from RCPT TO command without checking its encoding validity. You may expect <em>anything</em> on the wire though.</p>
<p>You need to add a check for UTF-8 validity of the $local_part. Exim does not have it built-in, but there is an easy way to code it manually.</p>
<p><span id="more-75"></span>Create an <code>/usr/local/bin/isutf8</code> file:</p>
<pre>
#!/bin/bash
exec echo "$1" | /usr/bin/iconv -f UTF-8 -t UTF-8 &gt;/dev/null 2&gt;&amp;1</pre>
<p>Make it executable and add this rule to RCPT ACL just before the local_parts check:</p>
<pre>deny
    message = address is invalid UTF-8
    condition = ${run{/usr/local/bin/isutf8 \"$local_part\"}{no}{yes}}</pre>
<p>Restart Exim and you&#8217;re done.</p>
<p><small><a href="http://tomasz.sterna.tv/2009/03/exim4-postgresql-and-invalid-byte-sequence-for-encoding-utf8/">Exim4, PostgreSQL and: invalid byte sequence for encoding UTF8</a> &copy;, <a rel="license" href=""></a>.</small></p>]]></content:encoded>
			<wfw:commentRss>http://tomasz.sterna.tv/2009/03/exim4-postgresql-and-invalid-byte-sequence-for-encoding-utf8/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

<!-- Dynamic Page Served (once) in 0.670 seconds -->
<!-- Cached page served by WP-Cache -->
