<?xml version="1.0" encoding="UTF-8" ?>
<rss version="2.0" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wikidot="http://www.wikidot.com/rss-namespace">

	<channel>
		<title>Piotr Gabryjeluk blog:dev</title>
		<link>http://piotr.gabryjeluk.pl</link>
		<description>Blog, photos and developer notes of Piotr Gabryjeluk, one of Wikidot.com developers.</description>
				<copyright></copyright>
		<lastBuildDate>Thu, 09 Feb 2012 20:45:22 +0000</lastBuildDate>
		
					<item>
				<guid>http://piotr.gabryjeluk.pl/dev:test-na-redundancje-kodu</guid>
				<title>Test na redundancję kodu</title>
				<link>http://piotr.gabryjeluk.pl/dev:test-na-redundancje-kodu</link>
				<description>

&lt;p&gt;Czas na nieco żartobliwy eksperyment&amp;#8230;&lt;/p&gt;
&lt;p&gt;by &lt;span class=&quot;printuser avatarhover&quot;&gt;&lt;a href=&quot;http://piotr.gabryjeluk.pl/profile2:2462&quot; target=&quot;_blank&quot;&gt;&lt;img class=&quot;small&quot; src=&quot;http://www.wikidot.com/avatar.php?userid=2462&amp;amp;size=small&amp;amp;timestamp=1328820320&quot; alt=&quot;Gabrys&quot; style=&quot;background-image:url(http://www.wikidot.com/userkarma.php?u=2462)&quot; /&gt;&lt;/a&gt;&lt;a href=&quot;http://piotr.gabryjeluk.pl/profile2:2462&quot; target=&quot;_blank&quot;&gt;Gabrys&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;
</description>
				<pubDate>Thu, 19 May 2011 10:25:21 +0000</pubDate>
												<content:encoded>
					<![CDATA[
						 <p>Czas na nieco żartobliwy eksperyment&#8230;</p> <div class="content-separator" style="display: none:"></div> <p>Wpierw liczymy ile jest niepustych i nietrywialnych linii kodu, np.:</p> <div class="code"> <pre> <code>find katalog1 katalog2 -name '*.php' -exec cat '{}' ';' | sed 's/^\s\+//' | sed 's/\s\+$//' | grep -v '^$' | grep -v '^function\|^public\|^protected\|^private\|^class\|static\|^}\|^{\|^?&gt;\|^&lt;?php\|^//\|^\*\|^/\*' | wc</code> </pre></div> <p>Potem liczymy ile jest unikalnych linii w tym co znaleźliśmy:</p> <div class="code"> <pre> <code>find katalog1 katalog2 -name '*.php' -exec cat '{}' ';' | sed 's/^\s\+//' | grep -v '^$' | grep -v '^function\|^public\|^protected\|^private\|^class\|static\|^}\|^{\|^?&gt;\|^&lt;?php\|^//\|^\*\|^/\*' | sort | uniq | wc</code> </pre></div> <p>Dzielimy jedną liczbę przez drugą i uzyskujemy współczynnik redundancji kodu.</p> <p>Należy dostosować kod do danego języka, aby lepiej matchować trywialne linie, które są potrzebne, ale przecież nie świadczą o redundancji kodu.</p> <p>by <span class="printuser avatarhover"><a href="http://piotr.gabryjeluk.pl/profile2:2462" target="_blank"><img class="small" src="http://www.wikidot.com/avatar.php?userid=2462&amp;size=small&amp;timestamp=1328820320" alt="Gabrys" style="background-image:url(http://www.wikidot.com/userkarma.php?u=2462)" /></a><a href="http://piotr.gabryjeluk.pl/profile2:2462" target="_blank">Gabrys</a></span></p> 
				 	]]>
				</content:encoded>							</item>
					<item>
				<guid>http://piotr.gabryjeluk.pl/dev:ubuntu-11-04-natty-on-sony-vaio-sz640</guid>
				<title>Ubuntu 11.04 (Natty) on Sony Vaio SZ640</title>
				<link>http://piotr.gabryjeluk.pl/dev:ubuntu-11-04-natty-on-sony-vaio-sz640</link>
				<description>

&lt;p&gt;As always, when a new Ubuntu release is done, I&#039;m installing in onto my Sony Vaio SZ series laptop and experience some problems, that I later work on and finally fix.&lt;/p&gt;
&lt;p&gt;To let others use this knowledge every half a year a note like this is written onto my blog.&lt;/p&gt;
&lt;p&gt;by &lt;span class=&quot;printuser avatarhover&quot;&gt;&lt;a href=&quot;http://piotr.gabryjeluk.pl/profile2:2462&quot; target=&quot;_blank&quot;&gt;&lt;img class=&quot;small&quot; src=&quot;http://www.wikidot.com/avatar.php?userid=2462&amp;amp;size=small&amp;amp;timestamp=1328820320&quot; alt=&quot;Gabrys&quot; style=&quot;background-image:url(http://www.wikidot.com/userkarma.php?u=2462)&quot; /&gt;&lt;/a&gt;&lt;a href=&quot;http://piotr.gabryjeluk.pl/profile2:2462&quot; target=&quot;_blank&quot;&gt;Gabrys&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;
</description>
				<pubDate>Tue, 10 May 2011 16:49:09 +0000</pubDate>
												<content:encoded>
					<![CDATA[
						 <p>As always, when a new Ubuntu release is done, I'm installing in onto my Sony Vaio SZ series laptop and experience some problems, that I later work on and finally fix.</p> <p>To let others use this knowledge every half a year a note like this is written onto my blog.</p> <div class="content-separator" style="display: none:"></div> <h1><span>Installation</span></h1> <p>You can read about installation LiveCD issues in a <a href="http://piotr.gabryjeluk.pl/dev:ubuntu-11-04-final">separate blog post</a>. Let's concentrate on things specific to Sony Vaio (mostly the dual-graphics system we have from Sony).</p> <p>Let's just say it's much better to install Ubuntu using the Intel graphics (the graphics-card switch in STAMINA position) card, since it's supported much much better by Linux.</p> <h1><span>Installing nVidia drivers</span></h1> <p>This should be easy, but is not due to a few glitches. Let's get through them step by step:</p> <ol> <li>Have the Ubuntu installed using Intel graphics card (STAMINA mode)</li> <li>Stop the laptop</li> <li>Put the graphics-mode switch to SPEED mode</li> <li>Start the laptop again</li> <li>Wait till you can log in</li> <li>Log in. You won't be able to use the Unity desktop, so classic Ubuntu desktop should be launched (if not, choose &quot;Classic Ubuntu (no effects)&quot; from drop-down list when logging in)</li> <li>Click System &#187; Administration &#187; Additional drivers</li> <li>Choose recommended driver and click enable. This will download and install the nVidia drivers for you.</li> <li>Don't reboot yet. You need to blacklist the nouveau driver (it's the open-source 3D nVidia driver attempt). Do this:<br /> <span class="code-block-inside-li">echo blacklist nouveau | sudo tee /etc/modprobe.d/blacklist-nv.conf</span></li> <li>OK. Now you can reboot. The nvidia driver should kick in and you should have working Unity desktop</li> </ol> <p>One more thing. Intel 3D drivers are now broken, so you won't have the Unity desktop working in there. Let's fix it!</p> <h1><span>Make 3D graphics (and Unity desktop) work in both Intel and nVidia</span></h1> <p>This is basically the same as explained in <a href="http://piotr.gabryjeluk.pl/dev:ubuntu-11-04-final">the previous post</a>, but using separate script (so it's more elegant).</p> <p>Create executable file <tt>/usr/local/bin/detect-gl</tt> :</p> <div class="code"> <pre> <code>sudo touch /usr/local/bin/detect-gl sudo chmod +x /usr/local/bin/detect-gl</code> </pre></div> <p>Edit it:</p> <div class="code"> <pre> <code>sudo gedit /usr/local/bin/detect-gl</code> </pre></div> <p>Put the following into it:</p> <div class="code"> <pre> <code>#!/bin/bash if ls -l /etc/alternatives/gl_conf | grep nvidia; then link=nvidia else link=mesa fi if lspci | grep 'VGA compatible controller: nVidia Corporation'; then hw=nvidia else hw=intel fi if [ &quot;$link&quot; = &quot;nvidia&quot; -a &quot;$hw&quot; = &quot;intel&quot; ]; then update-alternatives --set gl_conf /usr/lib/mesa/ld.so.conf ldconfig killall Xorg fi if [ &quot;$link&quot; = &quot;mesa&quot; -a &quot;$hw&quot; = &quot;nvidia&quot; ]; then update-alternatives --set gl_conf /usr/lib/nvidia-current/ld.so.conf ldconfig killall Xorg fi</code> </pre></div> <p>Call that script from /etc/rc.local (commands from this script are launched on each boot). Open file /etc/rc.local:</p> <div class="code"> <pre> <code>sudo gedit /etc/rc.local</code> </pre></div> <p>before <tt>exit 0</tt> line, put the following line:</p> <div class="code"> <pre> <code>/usr/local/bin/detect-gl</code> </pre></div> <p>Your whole file should look more or less like this:</p> <div class="code"> <pre> <code>#!/bin/sh -e # # rc.local # # This script is executed at the end of each multiuser runlevel. # Make sure that the script will &quot;exit 0&quot; on success or any other # value on error. # # In order to enable or disable this script just change the execution # bits. # # By default this script does nothing. /usr/local/bin/detect-gl exit 0</code> </pre></div> <p>This script will make sure the proper GL library is used for both graphics cards (Mesa lib for Intel, nVidia lib for nVidia card).</p> <h1><span>Fixing nVidia backlight issues</span></h1> <p>This is the most elegant solution I could think of. As the brightness settings almost work (when you press the Fn-F5, Fn-F6 keys, the notification appears and the bar shows you the backlight changes) we'll use D-Bus to listen for backlight change signal to set the backlight using nvclock command.</p> <p>Install nvclock:</p> <div class="code"> <pre> <code>sudo apt-get install nvclock</code> </pre></div> <p>Now create executable file:</p> <div class="code"> <pre> <code>sudo touch /usr/local/bin/nvidia-brightness-helper.py sudo chmod +x /usr/local/bin/nvidia-brightness-helper.py</code> </pre></div> <p>Edit it:</p> <div class="code"> <pre> <code>sudo gedit /usr/local/bin/nvidia-brightness-helper.py</code> </pre></div> <p>Put the following into it:</p> <div class="code"> <div class="hl-main"> <pre> <span class="hl-comment">#!/usr/bin/env python</span><span class="hl-code"> </span><span class="hl-reserved">import</span><span class="hl-code"> </span><span class="hl-identifier">dbus</span><span class="hl-code">, </span><span class="hl-identifier">gobject</span><span class="hl-code"> </span><span class="hl-reserved">from</span><span class="hl-code"> </span><span class="hl-identifier">subprocess</span><span class="hl-code"> </span><span class="hl-reserved">import</span><span class="hl-code"> </span><span class="hl-identifier">call</span><span class="hl-code"> </span><span class="hl-reserved">from</span><span class="hl-code"> </span><span class="hl-identifier">dbus</span><span class="hl-code">.</span><span class="hl-identifier">mainloop</span><span class="hl-code">.</span><span class="hl-identifier">glib</span><span class="hl-code"> </span><span class="hl-reserved">import</span><span class="hl-code"> </span><span class="hl-identifier">DBusGMainLoop</span><span class="hl-code"> </span><span class="hl-reserved">def</span><span class="hl-code"> </span><span class="hl-identifier">apply_brightness</span><span class="hl-brackets">(</span><span class="hl-identifier">new_brightness</span><span class="hl-brackets">)</span><span class="hl-code">: </span><span class="hl-reserved">if</span><span class="hl-code"> </span><span class="hl-identifier">new_brightness</span><span class="hl-code"> &lt; </span><span class="hl-number">15</span><span class="hl-code">: </span><span class="hl-identifier">new_brightness</span><span class="hl-code"> = </span><span class="hl-number">15</span><span class="hl-code"> </span><span class="hl-identifier">call</span><span class="hl-brackets">([</span><span class="hl-quotes">'</span><span class="hl-string">nvclock</span><span class="hl-quotes">'</span><span class="hl-code">, </span><span class="hl-quotes">'</span><span class="hl-string">-S</span><span class="hl-quotes">'</span><span class="hl-code">, </span><span class="hl-builtin">str</span><span class="hl-brackets">(</span><span class="hl-identifier">new_brightness</span><span class="hl-brackets">)])</span><span class="hl-code"> </span><span class="hl-comment"># only launch when nVidia is present</span><span class="hl-code"> </span><span class="hl-reserved">if</span><span class="hl-code"> </span><span class="hl-identifier">call</span><span class="hl-brackets">([</span><span class="hl-quotes">'</span><span class="hl-string">bash</span><span class="hl-quotes">'</span><span class="hl-code">, </span><span class="hl-quotes">'</span><span class="hl-string">-c</span><span class="hl-quotes">'</span><span class="hl-code">, </span><span class="hl-quotes">'</span><span class="hl-string">lspci | grep &quot;VGA compatible controller: nVidia Corporation&quot; 1&gt;/dev/null</span><span class="hl-quotes">'</span><span class="hl-brackets">])</span><span class="hl-code"> == </span><span class="hl-number">0</span><span class="hl-code">: </span><span class="hl-identifier">dbus</span><span class="hl-code">.</span><span class="hl-identifier">mainloop</span><span class="hl-code">.</span><span class="hl-identifier">glib</span><span class="hl-code">.</span><span class="hl-identifier">DBusGMainLoop</span><span class="hl-brackets">(</span><span class="hl-identifier">set_as_default</span><span class="hl-code">=</span><span class="hl-reserved">True</span><span class="hl-brackets">)</span><span class="hl-code"> </span><span class="hl-identifier">bus</span><span class="hl-code"> = </span><span class="hl-identifier">dbus</span><span class="hl-code">.</span><span class="hl-identifier">SessionBus</span><span class="hl-brackets">()</span><span class="hl-code"> </span><span class="hl-identifier">bus</span><span class="hl-code">.</span><span class="hl-identifier">add_signal_receiver</span><span class="hl-brackets">(</span><span class="hl-identifier">apply_brightness</span><span class="hl-code">, </span><span class="hl-identifier">dbus_interface</span><span class="hl-code">=</span><span class="hl-quotes">&quot;</span><span class="hl-string">org.gnome.PowerManager.Backlight</span><span class="hl-quotes">&quot;</span><span class="hl-code">, </span><span class="hl-identifier">signal_name</span><span class="hl-code">=</span><span class="hl-quotes">&quot;</span><span class="hl-string">BrightnessChanged</span><span class="hl-quotes">&quot;</span><span class="hl-brackets">)</span><span class="hl-code"> </span><span class="hl-identifier">loop</span><span class="hl-code"> = </span><span class="hl-identifier">gobject</span><span class="hl-code">.</span><span class="hl-identifier">MainLoop</span><span class="hl-brackets">()</span><span class="hl-code"> </span><span class="hl-identifier">loop</span><span class="hl-code">.</span><span class="hl-identifier">run</span><span class="hl-brackets">()</span> </pre></div> </div> <p>Now open your <em>Startup programs</em> configuration dialog and add the script to things started when you log in.</p> <h1><span>Fixing suspend</span></h1> <p>I must confess I haven't check the suspend without doing this but suspecting it IS broken like in was in Maverick, I've blacklisted the TPM modules by putting:</p> <div class="code"> <pre> <code>blacklist tpm blacklist tpm_bios blacklist tpm_tis blacklist tpm_infineon</code> </pre></div> <p>into <tt>/etc/modprobe.d/blacklist-tpm.conf</tt> file.</p> <h1><span>Poor 3D performance</span></h1> <p>When running Unity all the 3D games have poor performance. I found the easiest workaround is to log in into <em>Classic Ubuntu (with no effects)</em> desktop, which gives you standard GNOME with no compiz and nice 3D performance for launched apps.</p> <h1><span>Dual-screen issues</span></h1> <p>I'm using a dual-screen setup (laptop's LCD + external monitor connected via VGA port). The current version of Ubuntu has multiple issues with this, especially when aligning the screens in vertical (laptop's screen being the bottom one, big LCD the top one). The &quot;dock&quot; or &quot;launcher&quot; if you wish appears on the wrong screen (the small laptop instead of on the big screen). To fix this do this:</p> <div class="code"> <pre> <code>xrandr --output VGA1 --primary</code> </pre></div> <p>Log out and in again after doing this. Launcher is on top screen now :-).</p> <p>I found another irritating bug: when you plug in a big external monitor into the VGA port, the desktop automatically expands to both monitor (not a bug yet), but on one or both of them, some area is black, so you can't see the menus and windows. Logging out and in is also a workaround for this.</p> <p>When you log in with an external monitor connected, the desktop is strangely stretched and has some artifacts. Interestingly taping Super button (to show the Ubuntu Dash) and Escape (to hide it) refreshes the screen and it looks OK then.</p> <p>It's hard to put some windows on the bottom screen (your mouse pointer stops on the bottom of the top screen while dragging). You can move the windows even further down using Alt and dragging by window content (and not the title bar).</p> <p>Once a window is on the bottom screen, trying to resize it crashes the application and it disappears&#8230; The workaround is to resize by holding Alt key and drag with middle mouse button.</p> <h1><span>Other issues</span></h1> <p>When using Intel graphics card and Unity, Adobe Flash movies (YouTube for example) shows some artifacts. From time to time they also crash the whole X session (I'm not sure why).</p> <p>OK, this would be it. Hope this helps someone.</p> <p>by <span class="printuser avatarhover"><a href="http://piotr.gabryjeluk.pl/profile2:2462" target="_blank"><img class="small" src="http://www.wikidot.com/avatar.php?userid=2462&amp;size=small&amp;timestamp=1328820320" alt="Gabrys" style="background-image:url(http://www.wikidot.com/userkarma.php?u=2462)" /></a><a href="http://piotr.gabryjeluk.pl/profile2:2462" target="_blank">Gabrys</a></span></p> 
				 	]]>
				</content:encoded>							</item>
					<item>
				<guid>http://piotr.gabryjeluk.pl/dev:ubuntu-11-04-final</guid>
				<title>Ubuntu 11.04 final</title>
				<link>http://piotr.gabryjeluk.pl/dev:ubuntu-11-04-final</link>
				<description>

&lt;p&gt;A few weeks after testing &lt;a href=&quot;http://piotr.gabryjeluk.pl/dev:ubuntu-11-04-beta-1&quot;&gt;Ubuntu 11.04 beta 1&lt;/a&gt; which brought me a bit of disappointment, I decided to test the recently released final version of this most popular Linux distribution.&lt;/p&gt;
&lt;p&gt;As I had no more CDs or DVDs, I decided to try booting the distribution from USB drive that I assembled from microSDHC card reader and a microSD 4GB card that I got with my Android phone using standard Ubuntu tool called &amp;quot;Boot disk assistant&amp;quot;, which burns CD ISO file onto a USB drive in a way that it becomes bootable equivalent of the CD with additional option to save the modifications you make to the Live system on the disk itself, so that it becomes more or less persistent.&lt;/p&gt;
&lt;p&gt;by &lt;span class=&quot;printuser avatarhover&quot;&gt;&lt;a href=&quot;http://piotr.gabryjeluk.pl/profile2:2462&quot; target=&quot;_blank&quot;&gt;&lt;img class=&quot;small&quot; src=&quot;http://www.wikidot.com/avatar.php?userid=2462&amp;amp;size=small&amp;amp;timestamp=1328820320&quot; alt=&quot;Gabrys&quot; style=&quot;background-image:url(http://www.wikidot.com/userkarma.php?u=2462)&quot; /&gt;&lt;/a&gt;&lt;a href=&quot;http://piotr.gabryjeluk.pl/profile2:2462&quot; target=&quot;_blank&quot;&gt;Gabrys&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;
</description>
				<pubDate>Thu, 05 May 2011 17:45:25 +0000</pubDate>
												<content:encoded>
					<![CDATA[
						 <p>A few weeks after testing <a href="http://piotr.gabryjeluk.pl/dev:ubuntu-11-04-beta-1">Ubuntu 11.04 beta 1</a> which brought me a bit of disappointment, I decided to test the recently released final version of this most popular Linux distribution.</p> <p>As I had no more CDs or DVDs, I decided to try booting the distribution from USB drive that I assembled from microSDHC card reader and a microSD 4GB card that I got with my Android phone using standard Ubuntu tool called &quot;Boot disk assistant&quot;, which burns CD ISO file onto a USB drive in a way that it becomes bootable equivalent of the CD with additional option to save the modifications you make to the Live system on the disk itself, so that it becomes more or less persistent.</p> <div class="content-separator" style="display: none:"></div> <h1><span>LiveUSB creation</span></h1> <p>First I decided to use that option and let the program use about 3&#160;GB for the overlay file. This made the program busy for about a half an hour, the card reader (actually writer) got warm, and the result was the USB was not that bootable.</p> <p>A day after that attempt I decided to give it a try without the persistence and it worked this time. The problem came when I tried to &quot;Try Ubuntu&quot; (in opposite to &quot;Install Ubuntu&quot;). The graphic mode quited and I got nothing in return. I tried multiple things to do in text mode, rebooted a few times and after that it appeared that the graphic mode re-run after about a minute. The CPU was completely idle in this time as was the disk, so this wasn't reasonable thing.</p> <p>Anyways it appeared the release was much more stable than the beta version I tested and it kind of even worked. I found a few concepts useful and cool, so I decided to put the system on my disk to give it a serious try.</p> <h1><span>Having it on disk</span></h1> <p>Automatically detecting an external monitor was the biggest positive surprise for me. This never worked in Ubuntu till now. The downside is the graphics got crazy and displayed desktop in not really usable chunks, but I moved some windows around and it got fixed.</p> <h1><span>nVidia troubles</span></h1> <p>Then I tried booting with nVidia graphics card enabled (I have a dual-graphics Sony Vaio laptop) to see if the drivers would automatically install. Ubuntu first booted into classic Ubuntu mode (no fancy Unity desktop shell) but it was usable. I navigated to <em>System &#187; Administration &#187; Additional Drivers</em> and chose the recommended proprietary nVidia drivers to install. They got installed and I was asked to reboot the computer so I did.</p> <p>After the reboot graphic mode was not working and so didn't the text mode. I rebooted with Intel graphics card to discover that installing the nVidia drivers broke Intel drivers which made me without Unity desktop shell even on previously working Intel card. Since I knew what to do to &quot;fix&quot; nVidia I did this &#8212; I blacklisted the <tt>nouveau</tt> module and also a bunch of <tt>tpm</tt> modules that prevented from proper resume after suspend in previous version of Ubuntu. And rebooted with nVidia card chosen.</p> <p>This time Xorg went up, the Unity showed up and everything was more or less OK. After removing nVidia drivers (<tt>apt-get remove nvidia-current</tt>) Intel got working Unity back. But I wanted to have Unity working on both graphics card without constant installing and uninstalling nVidia drivers and I figured out how to do it.</p> <h1><span>Automating Intel/nVidia boots</span></h1> <p>In <tt>/etc/rc.local</tt> before <tt>exit 0</tt> I entered something like this:</p> <div class="code"> <pre> <code>if ls -l /etc/alternatives/gl_conf | grep nvidia; then link=nvidia else link=mesa fi if lspci | grep 'VGA compatible controller: nVidia Corporation'; then hw=nvidia else hw=intel fi if [ &quot;$link&quot; = &quot;nvidia&quot; -a &quot;$hw&quot; = &quot;intel&quot; ]; then update-alternatives --set gl_conf /usr/lib/mesa/ld.so.conf ldconfig killall Xorg fi if [ &quot;$link&quot; = &quot;mesa&quot; -a &quot;$hw&quot; = &quot;nvidia&quot; ]; then update-alternatives --set gl_conf /usr/lib/nvidia-current/ld.so.conf ldconfig killall Xorg fi</code> </pre></div> <p>This code checks whether current GL implementation is nVidia (valid for nVidia card) or Mesa (valid for Intel card), then checks current card by examining the output of <tt>lspci</tt> command and uses certain <tt>update-alternatives</tt> lines followed by <tt>ldconfig</tt> to update the GL implementations. <tt>killall Xorg</tt> kills the X server which is brought back by login manager with GL library updated.</p> <p>This is a dirty hack but it works just well for me and made both graphic cards working with no additional work.</p> <h1><span>Glitches/Summary</span></h1> <p>Ubuntu seems very stable now, but X server crashed a few times (especially loading Flash videos from Vimeo in Firefox). There are some problems in multi-monitor configurations, like no way to move the window to bottom monitor (if they are aligned vertically) by dragging its top bar (moving with Alt works). The windows on bottom monitor are not maximized properly (they are maximized on the top monitor instead) and they can't be resized by dragging the resize handles (but resizing with Alt+middle mouse button works).</p> <p>There were some other small random issues, either not really relevant or easily fixable, but overall it seems a <em>very good beta release</em>. But wait. This is no beta, but final release. In this case it's not good. It's OK for a Linux user like me, but it definitely should not be released for regular users. Shame on you Canonical. They promised they release in April, but they should have release another beta release, do a serious testing (what I did was anything but unusual), <strong>fix the remaining bugs and then release the final version</strong>.</p> <p>by <span class="printuser avatarhover"><a href="http://piotr.gabryjeluk.pl/profile2:2462" target="_blank"><img class="small" src="http://www.wikidot.com/avatar.php?userid=2462&amp;size=small&amp;timestamp=1328820321" alt="Gabrys" style="background-image:url(http://www.wikidot.com/userkarma.php?u=2462)" /></a><a href="http://piotr.gabryjeluk.pl/profile2:2462" target="_blank">Gabrys</a></span></p> 
				 	]]>
				</content:encoded>							</item>
					<item>
				<guid>http://piotr.gabryjeluk.pl/dev:ubuntu-11-04-beta-1</guid>
				<title>Ubuntu 11.04 Beta 1</title>
				<link>http://piotr.gabryjeluk.pl/dev:ubuntu-11-04-beta-1</link>
				<description>

&lt;p&gt;Let&#039;s talk about Ubuntu 11.04 Beta 1. Honestly I don&#039;t think it really should be beta already. It just doesn&#039;t work for me. I think the only reason the &amp;quot;release&amp;quot; is called beta is that it&#039;s April already and the stable version of the system should be delivered to the end of it to justify the 11.04 name/version.&lt;/p&gt;
&lt;p&gt;by &lt;span class=&quot;printuser avatarhover&quot;&gt;&lt;a href=&quot;http://piotr.gabryjeluk.pl/profile2:2462&quot; target=&quot;_blank&quot;&gt;&lt;img class=&quot;small&quot; src=&quot;http://www.wikidot.com/avatar.php?userid=2462&amp;amp;size=small&amp;amp;timestamp=1328820321&quot; alt=&quot;Gabrys&quot; style=&quot;background-image:url(http://www.wikidot.com/userkarma.php?u=2462)&quot; /&gt;&lt;/a&gt;&lt;a href=&quot;http://piotr.gabryjeluk.pl/profile2:2462&quot; target=&quot;_blank&quot;&gt;Gabrys&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;
</description>
				<pubDate>Fri, 08 Apr 2011 21:05:12 +0000</pubDate>
												<content:encoded>
					<![CDATA[
						 <p>Let's talk about Ubuntu 11.04 Beta 1. Honestly I don't think it really should be beta already. It just doesn't work for me. I think the only reason the &quot;release&quot; is called beta is that it's April already and the stable version of the system should be delivered to the end of it to justify the 11.04 name/version.</p> <div class="content-separator" style="display: none:"></div> <p>Let's start from the beginning. I'm having a Sony Vaio laptop with dual graphics system. During boot I can switch if nVidia or Intel graphics card is used. While on nVidia card, I didn't encounter any problems but the thing in &quot;Extra Drivers&quot; no nVidia card was detected. I'm not sure, maybe this &quot;automatic&quot; 3rd party driver installation is only activated after a real install.</p> <p>I really wanted to see the new Ubuntu interface, so I switched to Intel graphics card and rebooted the machine. After a while I was able to &quot;Try Ubuntu&quot;, I started the Firefox and then I noticed I don't have a network connection configured, so I clicked the network manager icon, chose my wifi network and tried to enter the password, but this caused compiz to close unexpectedly. Multiple times. After I managed to click &quot;cancel&quot; button the window decorations were gone and keyboard focus was not passed to clicked field, which made my system unusable. The standard shortcut to run command in Ubuntu: Alt-F2 didn't work either.</p> <p>This was a pretty short test, but not passed at all. Ubuntu 11.04 doesn't deserve beta status, there are stability issues. For example trying to suspend the laptop in nVidia mode (without any commercial drivers) froze it instead so i had to reboot :-(.</p> <p>by <span class="printuser avatarhover"><a href="http://piotr.gabryjeluk.pl/profile2:2462" target="_blank"><img class="small" src="http://www.wikidot.com/avatar.php?userid=2462&amp;size=small&amp;timestamp=1328820321" alt="Gabrys" style="background-image:url(http://www.wikidot.com/userkarma.php?u=2462)" /></a><a href="http://piotr.gabryjeluk.pl/profile2:2462" target="_blank">Gabrys</a></span></p> 
				 	]]>
				</content:encoded>							</item>
					<item>
				<guid>http://piotr.gabryjeluk.pl/dev:export-to-twitter</guid>
				<title>Export To Twitter</title>
				<link>http://piotr.gabryjeluk.pl/dev:export-to-twitter</link>
				<description>

&lt;p&gt;From today on, you can export pages updates to your Twitter account. For each page created a Twitter status update will be posted.&lt;/p&gt;
&lt;p&gt;by &lt;span class=&quot;printuser avatarhover&quot;&gt;&lt;a href=&quot;http://piotr.gabryjeluk.pl/profile2:2462&quot; target=&quot;_blank&quot;&gt;&lt;img class=&quot;small&quot; src=&quot;http://www.wikidot.com/avatar.php?userid=2462&amp;amp;size=small&amp;amp;timestamp=1328820321&quot; alt=&quot;Gabrys&quot; style=&quot;background-image:url(http://www.wikidot.com/userkarma.php?u=2462)&quot; /&gt;&lt;/a&gt;&lt;a href=&quot;http://piotr.gabryjeluk.pl/profile2:2462&quot; target=&quot;_blank&quot;&gt;Gabrys&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;
</description>
				<pubDate>Mon, 18 Oct 2010 20:57:25 +0000</pubDate>
												<content:encoded>
					<![CDATA[
						 <p>From today on, you can export pages updates to your Twitter account. For each page created a Twitter status update will be posted.</p> <p>The functionality is called Tweet My Wiki and is available for all Wikidot users (free and Pro).</p> <p>This feature was coded mostly by me, including the Wikidot URL shortener, that utilizes Redirect module and internal PageSaver API (similar to pages.save_one <a href="http://www.wikidot.com/doc:api">external API</a> method) to make it all happen.</p> <p>by <span class="printuser avatarhover"><a href="http://piotr.gabryjeluk.pl/profile2:2462" target="_blank"><img class="small" src="http://www.wikidot.com/avatar.php?userid=2462&amp;size=small&amp;timestamp=1328820321" alt="Gabrys" style="background-image:url(http://www.wikidot.com/userkarma.php?u=2462)" /></a><a href="http://piotr.gabryjeluk.pl/profile2:2462" target="_blank">Gabrys</a></span></p> 
				 	]]>
				</content:encoded>							</item>
					<item>
				<guid>http://piotr.gabryjeluk.pl/dev:using-caps-key-as-second-tab</guid>
				<title>Using Caps Key As Second Tab</title>
				<link>http://piotr.gabryjeluk.pl/dev:using-caps-key-as-second-tab</link>
				<description>

&lt;p&gt;As we all know, Caps Lock key is useless and annoying, so some folks change it to behave as third Control key. I prefer using two Controls I already have, so I mapped the Caps Lock key to Tab (which I use very often).&lt;/p&gt;
&lt;p&gt;by &lt;span class=&quot;printuser avatarhover&quot;&gt;&lt;a href=&quot;http://piotr.gabryjeluk.pl/profile2:2462&quot; target=&quot;_blank&quot;&gt;&lt;img class=&quot;small&quot; src=&quot;http://www.wikidot.com/avatar.php?userid=2462&amp;amp;size=small&amp;amp;timestamp=1328820321&quot; alt=&quot;Gabrys&quot; style=&quot;background-image:url(http://www.wikidot.com/userkarma.php?u=2462)&quot; /&gt;&lt;/a&gt;&lt;a href=&quot;http://piotr.gabryjeluk.pl/profile2:2462&quot; target=&quot;_blank&quot;&gt;Gabrys&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;
</description>
				<pubDate>Wed, 23 Dec 2009 13:49:45 +0000</pubDate>
												<content:encoded>
					<![CDATA[
						 <p>As we all know, Caps Lock key is useless and annoying, so some folks change it to behave as third Control key. I prefer using two Controls I already have, so I mapped the Caps Lock key to Tab (which I use very often).</p> <div class="content-separator" style="display: none:"></div> <div class="code"> <pre> <code>$ xmodmap - remove Lock = Caps_Lock keycode 0x42 = Tab &lt;hit Ctrl-D now&gt;</code> </pre></div> <p>This works till you logout. If it does work, you can make this persistent by adding those two lines to your empty or missing ~/.Xmodmap file:</p> <div class="code"> <pre> <code>remove Lock = Caps_Lock keycode 0x42 = Tab</code> </pre></div> <p>If this doesn't work for you, it's possible your window manager doesn't take care of this file, but if you have a way to execute commands at each start of GNOME/KDE/whatever, just add the following command to those run it startup sequence:</p> <div class="code"> <pre> <code>xmodmap ~/.Xmodmap</code> </pre></div> <p>by <span class="printuser avatarhover"><a href="http://piotr.gabryjeluk.pl/profile2:2462" target="_blank"><img class="small" src="http://www.wikidot.com/avatar.php?userid=2462&amp;size=small&amp;timestamp=1328820321" alt="Gabrys" style="background-image:url(http://www.wikidot.com/userkarma.php?u=2462)" /></a><a href="http://piotr.gabryjeluk.pl/profile2:2462" target="_blank">Gabrys</a></span></p> 
				 	]]>
				</content:encoded>							</item>
					<item>
				<guid>http://piotr.gabryjeluk.pl/dev:cleaning-up</guid>
				<title>Cleaning Up</title>
				<link>http://piotr.gabryjeluk.pl/dev:cleaning-up</link>
				<description>

&lt;p&gt;Some of you, following Wikidot code on &lt;a href=&quot;http://github.com/gabrys/wikidot&quot;&gt;GitHub&lt;/a&gt; may see it&#039;s nicely split into templates, php, web and conf directories. But this is the first impression.&lt;/p&gt;
&lt;p&gt;by &lt;span class=&quot;printuser avatarhover&quot;&gt;&lt;a href=&quot;http://piotr.gabryjeluk.pl/profile2:2462&quot; target=&quot;_blank&quot;&gt;&lt;img class=&quot;small&quot; src=&quot;http://www.wikidot.com/avatar.php?userid=2462&amp;amp;size=small&amp;amp;timestamp=1328820321&quot; alt=&quot;Gabrys&quot; style=&quot;background-image:url(http://www.wikidot.com/userkarma.php?u=2462)&quot; /&gt;&lt;/a&gt;&lt;a href=&quot;http://piotr.gabryjeluk.pl/profile2:2462&quot; target=&quot;_blank&quot;&gt;Gabrys&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;
</description>
				<pubDate>Thu, 17 Sep 2009 16:42:53 +0000</pubDate>
												<content:encoded>
					<![CDATA[
						 <p>Some of you, following Wikidot code on <a href="http://github.com/gabrys/wikidot">GitHub</a> may see it's nicely split into templates, php, web and conf directories. But this is the first impression.</p> <div class="content-separator" style="display: none:"></div> <p>Maintaining Wikidot is a bit more complex, because, files uploaded to sites are located in web, side to side with some static Wikidot php and javascript files. Also for historical reasons, there are web/files<span style="white-space: pre-wrap;">--</span>common and web/files<span style="white-space: pre-wrap;">--</span>local directories, which maps to /common<span style="white-space: pre-wrap;">--</span>* and /local<span style="white-space: pre-wrap;">--</span>* URLs and in fact, the files<span style="white-space: pre-wrap;">--</span>local is never served directly by the web server (need to check permissions first).</p> <p>Also some time ago, we made static files versioned, so that we can apply more aggressive HTTP caching to them (reducing average page load time) and still be able to fix bugs on them without waiting a few days till the cache expire. In current model, URL to static file contains version hash, this may be for example: <a href="http://static.wikidot.com/v--b44e0ce810ee/common--javascript/WIKIDOT.js">http://static.wikidot.com/v--b44e0ce810ee/common--javascript/WIKIDOT.js</a> (notice the b44e0ce810ee). The whole static.wikidot.com is now hosted on Amazon's CloudFront, which means you get static Wikidot files from a server nearby your location and not always from USA.</p> <p>This all become quite complicated, so we decided to make things really clear and simple in the source code. The primary rule: make the source code (updatable from git) separate from files uploaded by users and generated by Wikidot. Second rule: make files that are automatically generated during installation (not in the runtime) separate from persistent files (like the uploaded by users) and from source code.</p> <p>And at the end there needs to be some place for logs and a place for temporary data (we need this to generate some random cool stuff, but after generating them, files are deleted).</p> <p>So we end up with something like this:</p> <ul> <li>WIKIDOT_ROOT <ul> <li><strong>data/</strong> <ul> <li>avatars/ &#8212; user avatars</li> <li>sites/ &#8212; site files (both generated thumbnails and uploaded files)</li> </ul> </li> <li><strong>generated/</strong> <ul> <li>static/ &#8212; generated static files. This dir can be server directly by a fast non-PHP webserver for static.wikidot.com in case we don't want CloudFront anymore</li> </ul> </li> <li><strong>tmp/</strong> &#8212; temporary files including Smarty compiled versions of templates. Content of this dir can be safely removed</li> <li><strong>logs/</strong> &#8212; Wikidot logs</li> <li>everything else &#8212; comes from git and is unchangeable by application</li> </ul> </li> </ul> <p>Application needs write-access to data, tmp and logs. Generated dir needs write access to one installing or upgrading application.</p> <p>Wikidot persistent data is now ONLY database and data/ directory, so it's easy to backup and restore the application (if you have enough time to make full backup of this).</p> <p>There is still one exception to this nice schema which is php/db/base directory, which is autogenerated during installation from XML database definition files, but the cleaning is not over, I still work on this.</p> <p>Nice thing about this work is that it does not need a lot of code changing, because directory paths are usually stored in one (max two) places in application, so this kind of totally reorganizing directory structure does not break things. As such, it is very very worth doing it. In the end we get clean internal structure of files and it's clear which files you can safely remove, which you can restore from git (and thus you can experiment a little on them &#8212; in case of crash, just re-download application), which are &quot;state&quot; of the Wikidot and where to look for logs.</p> <p>This all is also very important, because we aim to make current Wikidot.com source open and as such we want it to be a nice code.</p> <p>by <span class="printuser avatarhover"><a href="http://piotr.gabryjeluk.pl/profile2:2462" target="_blank"><img class="small" src="http://www.wikidot.com/avatar.php?userid=2462&amp;size=small&amp;timestamp=1328820321" alt="Gabrys" style="background-image:url(http://www.wikidot.com/userkarma.php?u=2462)" /></a><a href="http://piotr.gabryjeluk.pl/profile2:2462" target="_blank">Gabrys</a></span></p> 
				 	]]>
				</content:encoded>							</item>
					<item>
				<guid>http://piotr.gabryjeluk.pl/dev:wikidot-crashes</guid>
				<title>Wikidot Crashes</title>
				<link>http://piotr.gabryjeluk.pl/dev:wikidot-crashes</link>
				<description>

&lt;p&gt;Last night we made Wikidot online again after a great crash.&lt;/p&gt;
&lt;p&gt;Wikidot was down for about 12 hours and the time it was down was full of work for us. We got a few things that could be broken starting from recent changes of the Wikidot software, hardware failure, high load-related kernel bugs or limitations to connection number or maximum possible number or file descriptors.&lt;/p&gt;
&lt;p&gt;by &lt;span class=&quot;printuser avatarhover&quot;&gt;&lt;a href=&quot;http://piotr.gabryjeluk.pl/profile2:2462&quot; target=&quot;_blank&quot;&gt;&lt;img class=&quot;small&quot; src=&quot;http://www.wikidot.com/avatar.php?userid=2462&amp;amp;size=small&amp;amp;timestamp=1328820321&quot; alt=&quot;Gabrys&quot; style=&quot;background-image:url(http://www.wikidot.com/userkarma.php?u=2462)&quot; /&gt;&lt;/a&gt;&lt;a href=&quot;http://piotr.gabryjeluk.pl/profile2:2462&quot; target=&quot;_blank&quot;&gt;Gabrys&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;
</description>
				<pubDate>Thu, 27 Aug 2009 13:03:23 +0000</pubDate>
												<content:encoded>
					<![CDATA[
						 <p>Last night we made Wikidot online again after a great crash.</p> <p>Wikidot was down for about 12 hours and the time it was down was full of work for us. We got a few things that could be broken starting from recent changes of the Wikidot software, hardware failure, high load-related kernel bugs or limitations to connection number or maximum possible number or file descriptors.</p> <div class="content-separator" style="display: none:"></div> <p>The problem is Wikidot kind of worked, so some people had their sites loading, some other not and getting &quot;500&quot; errors. We didn't want to stop it, but at some point Wikidot was completely unusable. We switched the database to the other machine, but this was not the solution, then we switched all Wikidot traffic to the machine, still no good, we switched the software to some previous version, but this still seemed bad.</p> <p>Finally we worked out, there was a site, that had so big traffic, that it killed anything else (and itself as well). When we temporarily disabled it, the whole Wikidot started to work nicely again. Then Michał made some improvements for the high traffic site serving and the situation is stable again.</p> <p>In the middle of everything, we had huge problems with our hosting company and their service called Portable IP addresses. It seems that switching DNS is much more reliable that using Portable IPs that took hours to switch (and were supposed to take seconds to switch)! DNS switching time was 15 minutes.</p> <p>We learned a lot from the situation. Hardware upgrade postponed from really long time needs to be done quite quickly. We need more servers, to see which element breaks. For example if database server has high load, we know we need to tune database settings. If we have all on one massive server and one brick on it crashes, it usually causes all the server overloaded and this causes other bricks to crash as well, so it's hard too tell what the real problem is.</p> <p>Another thing is that we see our users want information on what happens. It's bad when Wikidot crashes, but it's even worse, when it crashes and they have no information about this.</p> <p>So, the next time a similar disaster happens we'll update on each technical detail possible, to let you know, that we know it's broken and we work hard to fix it. Other thing is, we plan having more fail-over servers in case something dies.</p> <p>Thank you all for using Wikidot, it's a great pleasure working (and fixing things) for you!</p> <p>by <span class="printuser avatarhover"><a href="http://piotr.gabryjeluk.pl/profile2:2462" target="_blank"><img class="small" src="http://www.wikidot.com/avatar.php?userid=2462&amp;size=small&amp;timestamp=1328820321" alt="Gabrys" style="background-image:url(http://www.wikidot.com/userkarma.php?u=2462)" /></a><a href="http://piotr.gabryjeluk.pl/profile2:2462" target="_blank">Gabrys</a></span></p> 
				 	]]>
				</content:encoded>							</item>
					<item>
				<guid>http://piotr.gabryjeluk.pl/dev:yaml-and-php</guid>
				<title>YAML and PHP</title>
				<link>http://piotr.gabryjeluk.pl/dev:yaml-and-php</link>
				<description>

&lt;p&gt;There are 3 main YAML implementations for PHP:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Syck (native C library bindings to PHP)&lt;/li&gt;
&lt;li&gt;Symphony YAML (pure PHP)&lt;/li&gt;
&lt;li&gt;Spyc (pure PHP again)&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;This is the comparison.&lt;/p&gt;
&lt;p&gt;by &lt;span class=&quot;printuser avatarhover&quot;&gt;&lt;a href=&quot;http://piotr.gabryjeluk.pl/profile2:2462&quot; target=&quot;_blank&quot;&gt;&lt;img class=&quot;small&quot; src=&quot;http://www.wikidot.com/avatar.php?userid=2462&amp;amp;size=small&amp;amp;timestamp=1328820321&quot; alt=&quot;Gabrys&quot; style=&quot;background-image:url(http://www.wikidot.com/userkarma.php?u=2462)&quot; /&gt;&lt;/a&gt;&lt;a href=&quot;http://piotr.gabryjeluk.pl/profile2:2462&quot; target=&quot;_blank&quot;&gt;Gabrys&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;
</description>
				<pubDate>Thu, 30 Jul 2009 19:03:36 +0000</pubDate>
												<content:encoded>
					<![CDATA[
						 <p>There are 3 main YAML implementations for PHP:</p> <ul> <li>Syck (native C library bindings to PHP)</li> <li>Symphony YAML (pure PHP)</li> <li>Spyc (pure PHP again)</li> </ul> <p>This is the comparison.</p> <div class="content-separator" style="display: none:"></div> <h1><span>What the hell is YAML</span></h1> <p>Have you heard about XML or JSON? YAML is similarly to JSON and XML a way to store (read and write) structured data like arrays (a.k.a. lists), dictionaries (a.k.a. hash maps) and atomic values like strings and numbers. The structures can be nested, to form a definition of near-real-life objects, for example:</p> <div class="code"> <pre> <code>--- Piotr Gabryjeluk: company: Wikidot Inc. university: Nicolaus Copernicus University, Toruń, Poland lives_in: Toruń, Poland hobbies: - basketball - playing the guitar</code> </pre></div> <p>Which translates to PHP:</p> <div class="code"> <div class="hl-main"> <pre> <span class="hl-inlinetags">&lt;?php</span><span class="hl-code"> </span><span class="hl-var">$data</span><span class="hl-code"> = </span><span class="hl-reserved">array</span><span class="hl-brackets">(</span><span class="hl-quotes">'</span><span class="hl-string">Piotr Gabryjeluk</span><span class="hl-quotes">'</span><span class="hl-code"> =&gt; </span><span class="hl-reserved">array</span><span class="hl-brackets">(</span><span class="hl-code"> </span><span class="hl-quotes">'</span><span class="hl-string">company</span><span class="hl-quotes">'</span><span class="hl-code"> =&gt; </span><span class="hl-quotes">'</span><span class="hl-string">Wikidot Inc.</span><span class="hl-quotes">'</span><span class="hl-code">, </span><span class="hl-quotes">'</span><span class="hl-string">university</span><span class="hl-quotes">'</span><span class="hl-code"> =&gt; </span><span class="hl-quotes">'</span><span class="hl-string">Nicolaus Copernicus University, Toruń, Poland</span><span class="hl-quotes">'</span><span class="hl-code">, </span><span class="hl-quotes">'</span><span class="hl-string">lives_in</span><span class="hl-quotes">'</span><span class="hl-code"> =&gt; </span><span class="hl-quotes">'</span><span class="hl-string">Toruń, Poland</span><span class="hl-quotes">'</span><span class="hl-code">, </span><span class="hl-quotes">'</span><span class="hl-string">hobbies</span><span class="hl-quotes">'</span><span class="hl-code"> =&gt; </span><span class="hl-reserved">array</span><span class="hl-brackets">(</span><span class="hl-quotes">'</span><span class="hl-string">basketball</span><span class="hl-quotes">'</span><span class="hl-code">, </span><span class="hl-quotes">'</span><span class="hl-string">playing the guitar</span><span class="hl-quotes">'</span><span class="hl-brackets">)</span><span class="hl-code"> </span><span class="hl-brackets">))</span><span class="hl-code">;</span> </pre></div> </div> <p>So you see YAML is quite nice even when you need to write it yourself.</p> <p>YAML has its specification (see <a href="http://yaml.org">http://yaml.org</a>), so once we have standard YAML parser and standard YAML dumper we can send arrays from one machine to another and the result should be the same array as was sent.</p> <h1><span>PHP</span></h1> <p>So let's see what are the choices if you want to play with YAML in PHP.</p> <h2><span>Syck</span></h2> <p>This is the fastest and the most complete YAML dumper and loader library available. This is binding to C library and this is available in PEAR. It is also available as regular package in Ubuntu repository, so install it by simple:</p> <div class="code"> <pre> <code>aptitude install php5-syck</code> </pre></div> <p>In some shared hosting environment this could be a problem, so you need a pure PHP solution.</p> <h2><span>Spyc</span></h2> <p>This was the first PHP YAML implementation I saw. It is both dumper and loader and it seemed to work fine, but then I found some bugs, that stopped me from using it as the base and only YAML loader and dumper for Wikidot.</p> <p>This one has really nice thing, which is nice when you want your users to enter YAML to define things (like we do for forms). It is quite forgiving when it comes to the syntax and ignores things that don't fit and still parses the rest.</p> <p>Unfortunately as I stated before Spyc dumper so, when you first dump an array and then load it with Spyc you get something different (for example multiple new-lines are treated as one). Not good. Also as a loader it does not fully understand the full YAML specification (which is quite huge BTW).</p> <h2><span>Symphony YAML</span></h2> <p>This one is pure-PHP as well, so you don't need special rights, to use it on a PHP-enabled machine.</p> <p>It's loader does not understand full YAML specification, so for example you can't load documents dumped by Syck. Dumper is good.</p> <h1><span>Summary</span></h1> <table class="wiki-content-table"> <tr> <th></th> <th>Syck</th> <th>Spyc</th> <th>Symphony YAML</th> </tr> <tr> <td>type of library</td> <td>PHP extension</td> <td><strong>pure PHP library</strong></td> <td><strong>pure PHP library</strong></td> </tr> <tr> <td>speed</td> <td><strong>fast</strong></td> <td>slow</td> <td>slow</td> </tr> <tr> <td>loader: YAML support</td> <td><strong>full</strong></td> <td>bad</td> <td>not bad</td> </tr> <tr> <td>loader: if YAML is corrupted</td> <td>exception</td> <td><strong>tries to do its best to load the rest</strong></td> <td>exception</td> </tr> <tr> <td>dumper: YAML human-readable</td> <td>more-or-less</td> <td><strong>yes</strong></td> <td>more-or-less if set properly</td> </tr> <tr> <td>dumper: YAML conforms to spec</td> <td><strong>yes</strong></td> <td>no</td> <td><strong>yes</strong></td> </tr> <tr> <td>loads Syck's dumper output correctly</td> <td><strong>yes</strong></td> <td>no</td> <td>no</td> </tr> <tr> <td>loads Symphony's dumper output correctly</td> <td><strong>yes</strong></td> <td>no</td> <td><strong>yes</strong></td> </tr> </table> <h2><span>Verdict: loader</span></h2> <p>Syck is the winner in loading YAML. If you cannot use Syck, use Symphony YAML. If you need to parse user input (which should be human readable/writable similar to YAML), use Spyc.</p> <p>Actually, this is nice combination for loading:</p> <div class="code"> <div class="hl-main"> <pre> <span class="hl-inlinetags">&lt;?php</span><span class="hl-code"> </span><span class="hl-reserved">try</span><span class="hl-code"> </span><span class="hl-brackets">{</span><span class="hl-code"> </span><span class="hl-comment">// if syck is available use it</span><span class="hl-code"> </span><span class="hl-reserved">if</span><span class="hl-code"> </span><span class="hl-brackets">(</span><span class="hl-identifier">extension_loaded</span><span class="hl-brackets">(</span><span class="hl-quotes">'</span><span class="hl-string">syck</span><span class="hl-quotes">'</span><span class="hl-brackets">))</span><span class="hl-code"> </span><span class="hl-brackets">{</span><span class="hl-code"> </span><span class="hl-reserved">return</span><span class="hl-code"> </span><span class="hl-identifier">syck_load</span><span class="hl-brackets">(</span><span class="hl-var">$string</span><span class="hl-brackets">)</span><span class="hl-code">; </span><span class="hl-brackets">}</span><span class="hl-code"> </span><span class="hl-comment">// if not, use the symfony YAML parser</span><span class="hl-code"> </span><span class="hl-var">$yaml</span><span class="hl-code"> = </span><span class="hl-reserved">new</span><span class="hl-code"> </span><span class="hl-identifier">sfYamlParser</span><span class="hl-brackets">()</span><span class="hl-code">; </span><span class="hl-reserved">return</span><span class="hl-code"> </span><span class="hl-var">$yaml</span><span class="hl-code">-&gt;</span><span class="hl-identifier">parse</span><span class="hl-brackets">(</span><span class="hl-var">$string</span><span class="hl-brackets">)</span><span class="hl-code">; </span><span class="hl-brackets">}</span><span class="hl-code"> </span><span class="hl-reserved">catch</span><span class="hl-code"> </span><span class="hl-brackets">(</span><span class="hl-identifier">Exception</span><span class="hl-code"> </span><span class="hl-var">$e</span><span class="hl-brackets">)</span><span class="hl-code"> </span><span class="hl-brackets">{</span><span class="hl-code"> </span><span class="hl-comment">// if YAML document is not correct,</span><span class="hl-code"> </span><span class="hl-reserved">return</span><span class="hl-code"> </span><span class="hl-identifier">Spyc</span><span class="hl-code">::</span><span class="hl-identifier">YAMLLoadString</span><span class="hl-brackets">(</span><span class="hl-var">$string</span><span class="hl-brackets">)</span><span class="hl-code">; </span><span class="hl-brackets">}</span> </pre></div> </div> <p>This way, you have the fastest library used if possible, then the best pure-PHP, and if it fails in a way, that document was badly written (by human being for example), you fall-back to Spyc.</p> <h2><span>Verdict: dumper</span></h2> <p>In my opinion Symphony YAML dumper is the best from the three in terms of usability, portability and interoperability, because its output can be read by both itself and Spyc.</p> <p>However, if you dump YAML often, use (hell faster) Syck for both loading and dumping. The generated YAML won't be readable by Symphony YAML or Spyc, but this is because they don't follow the specification (so not Syck's problem in fact).</p> <p>Also note, that any valid JSON dumper output is readable by standard YAML 1.2 loaders, because JSON is a subset of YAML 1.2. So if using for data exchange (and not for talking to human) any fast JSON dumper can be used.</p> <p>by <span class="printuser avatarhover"><a href="http://piotr.gabryjeluk.pl/profile2:2462" target="_blank"><img class="small" src="http://www.wikidot.com/avatar.php?userid=2462&amp;size=small&amp;timestamp=1328820321" alt="Gabrys" style="background-image:url(http://www.wikidot.com/userkarma.php?u=2462)" /></a><a href="http://piotr.gabryjeluk.pl/profile2:2462" target="_blank">Gabrys</a></span></p> 
				 	]]>
				</content:encoded>							</item>
					<item>
				<guid>http://piotr.gabryjeluk.pl/dev:july-news</guid>
				<title>July News</title>
				<link>http://piotr.gabryjeluk.pl/dev:july-news</link>
				<description>

&lt;p&gt;Some of you may be more used to me posting more often, than in last time.&lt;br /&gt;
Some of you may wonder why I stopped blogging.&lt;/p&gt;
&lt;p&gt;by &lt;span class=&quot;printuser avatarhover&quot;&gt;&lt;a href=&quot;http://piotr.gabryjeluk.pl/profile2:2462&quot; target=&quot;_blank&quot;&gt;&lt;img class=&quot;small&quot; src=&quot;http://www.wikidot.com/avatar.php?userid=2462&amp;amp;size=small&amp;amp;timestamp=1328820321&quot; alt=&quot;Gabrys&quot; style=&quot;background-image:url(http://www.wikidot.com/userkarma.php?u=2462)&quot; /&gt;&lt;/a&gt;&lt;a href=&quot;http://piotr.gabryjeluk.pl/profile2:2462&quot; target=&quot;_blank&quot;&gt;Gabrys&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;
</description>
				<pubDate>Tue, 28 Jul 2009 15:41:03 +0000</pubDate>
												<content:encoded>
					<![CDATA[
						 <p>Some of you may be more used to me posting more often, than in last time.<br /> Some of you may wonder why I stopped blogging.</p> <div class="content-separator" style="display: none:"></div> <h2><span>Brussels</span></h2> <p>Last month was full of adventures. It started 1st of July with me going to Brussels meat our friend to talk about wikipedia-like site about art. We're going to help this man build the most complete site about art using Wikidot software!</p> <p>BTW, this was my first flight in lifetime. Quite a strange feeling, but generally fine.</p> <h2><span>Forms</span></h2> <p>I was working on some nice technical and UI improvements to Wikidot, that is crucial for the art site (but really really nice for Wikidot as well, like forms for editing, entering and viewing structured data to wiki pages).</p> <h2><span>Search issues</span></h2> <p>That week was also spent on some massive Wikidot.com search engine tweaks. A stupid one-line bug, which was <strong>not</strong> exporting proper LC_ALL environmental variable in indexing script, caused many sites that used Asian or East-European languages to be not indexed (most notably the great <a href="http://istorijska-biblioteka.wikidot.com/">ИСТОРИЈСКА БИБЛИОТЕКА</a>). At first we though that we can re-index the broken sites, but our re-indexing mechanism was way too slow (would last for weeks for all broken sites).</p> <p>Pieter then challenged me. He said he can index whole Wikidot in 6 hours. I thought it's not even possible, but then I started to work on that and I managed to index the whole Wikidot in less than 2 hours without indexing tags at first. Then with tags, it took 2 hours and 10 minutes or so. That was damn fast!</p> <p>Inspired by this and an accident of disk full error on /var partition of our webserver (but this is why we keep user-uploaded files and other important things on separate disks), I also rewrote the incremental indexer, to work in similar way to the whole-Wikidot-re-indexer.</p> <h2><span><tt>search-api reindex</tt></span></h2> <p>If you care about some technical details:</p> <ul> <li>all search operations are issued with use of search-api, a separate program that can: <ul> <li>re-index whole Wikidot</li> <li>queue indexing page/thread</li> <li>queue deleting page/thread</li> <li>queue re-indexing site</li> <li>flush queue</li> </ul> </li> <li>search-api is written in Python</li> <li>search-api uses PyLucene - a native Java Lucene library binded to CPython objects with PyJCC. Compiled with GNU Java Compiler to native code (like C programs), this binding has improved performance over using Lucene with Sun's Java.</li> <li>before rewriting it to only-Python, search-api was written in BASH and was a wrapper to: <ul> <li><tt>java -jar searchApiHelper.jar search &quot;phrase-to-search&quot;</tt></li> <li><tt>php search-api-helper.php flush</tt></li> </ul> </li> <li>search-api also takes care of file locking to assure that <ul> <li>only one process tries to modify the index</li> <li>items are added to queue one-after-another</li> <li>when doing some big index modification (read: full re-index) queue is not flushed (so that after the re-index all changes are applied to new index)</li> <li>when flushing queue takes more time, and cron tries to run more flushing processes, they simply end (so only one process flushes the queue at a time)</li> </ul> </li> </ul> <h2><span>Union of Rock Festival</span></h2> <p>Just after week spent in Brussels in nice hotel I went to Węgorzewo, Mazury (Poland biggest lakes distinct) to have fun on rock music festival. Unfortunately, the music level was not very impressive, so I mainly enjoyed the atmosphere on the camping area.</p> <p>The weather was not great. It was wet everywhere, the ground was covered in 20 centimeters of mud and it was hard to walk around without getting dirty. But during the first day of being there, I learned to do that.</p> <h2><span>Improved workflow at Wikidot</span></h2> <p>Some of you noticed, that recently we started to work more efficiently, but this is not quite true. In fact we work as efficiently as before, but we are better organized, and have better priorities on tasks. Also we keep track of what we do, so we can then tell what we've done. So for us, this is a little more work of &quot;documenting&quot; our work (so maybe we work even less efficiently than before?), but for the outside world, we make more noise (in a positive meaning) around that. So basically, people know what we do, what we are going to do, when they can expect changes and most importantly, they understand why some feature request is being postponed. This is (and was) because we have more important things to do, but before they couldn't tell it.</p> <p><span class="printuser avatarhover"><a href="http://www.wikidot.com/user:info/squark" ><img class="small" src="http://www.wikidot.com/avatar.php?userid=160264&amp;size=small&amp;timestamp=1328820321" alt="Squark" style="background-image:url(http://www.wikidot.com/userkarma.php?u=160264)" /></a><a href="http://www.wikidot.com/user:info/squark" >Squark</a></span> turned into a professional project manager, that manages our time. <span class="printuser avatarhover"><a href="http://www.wikidot.com/user:info/pieterh" ><img class="small" src="http://www.wikidot.com/avatar.php?userid=99&amp;size=small&amp;timestamp=1328820321" alt="pieterh" style="background-image:url(http://www.wikidot.com/userkarma.php?u=99)" /></a><a href="http://www.wikidot.com/user:info/pieterh" >pieterh</a></span> decided to <a href="http://blog.wikidot.com/">talk</a> to the Community and listen to their complaints (he reads or at least skims every post on Community forums). He tells Łukasz what needs to be done, Łukasz knows when we will have time to do this. This way communication inside Wikidot improved. Also we (<span class="printuser avatarhover"><a href="http://piotr.gabryjeluk.pl/profile2:1" target="_blank"><img class="small" src="http://www.wikidot.com/avatar.php?userid=1&amp;size=small&amp;timestamp=1328820321" alt="michal frackowiak" style="background-image:url(http://www.wikidot.com/userkarma.php?u=1)" /></a><a href="http://piotr.gabryjeluk.pl/profile2:1" target="_blank">michal frackowiak</a></span> and me) no longer look on Community forums (some of you may regret), but this allows us to concentrate on our work.</p> <h2><span>The work continues</span></h2> <p>As I mentioned before, we want to introduce a great feature to Wikidot, which is <em>forms</em>. But the implementation now concentrates on the <a href="http://www.wikidot.org/">open source version of Wikidot software</a> (once it's ready, working and tested we'll copy the feature to the Wikidot.com service).</p> <h2><span><tt>aptitude install wikidot</tt></span></h2> <p>As forms is a huge change, I started to prepare a good ground for it and closed most important bugs in Wikidot open source and I'm about to start making Ubuntu packages for it to allow even-simpler installation on Debian-based systems. Now the installation involves only <a href="http://www.wikidot.org/installation-guide">6 child-easy steps</a> and in fact can be done by copying&amp;pasting a few commands.</p> <h2><span>Yesterday's party</span></h2> <p>Yesterday I went to met some old-school-times friends in the heart of the city. It was meant to be a meeting for &quot;a beer or two&quot; but evolved into beer and dancing till morning. That was first time I get a morning bus (not even the first) to my home just after partying.</p> <p>It was such a great fun and great folks I met.</p> <h2><span>Summary</span></h2> <p>I hope with this long blog post (but divided into friendly sections ;) ) I recompensed long period of not-posting anything here.</p> <p>by <span class="printuser avatarhover"><a href="http://piotr.gabryjeluk.pl/profile2:2462" target="_blank"><img class="small" src="http://www.wikidot.com/avatar.php?userid=2462&amp;size=small&amp;timestamp=1328820321" alt="Gabrys" style="background-image:url(http://www.wikidot.com/userkarma.php?u=2462)" /></a><a href="http://piotr.gabryjeluk.pl/profile2:2462" target="_blank">Gabrys</a></span></p> 
				 	]]>
				</content:encoded>							</item>
					<item>
				<guid>http://piotr.gabryjeluk.pl/dev:lucene-replaces-local-searches</guid>
				<title>Lucene Replaces Local Searches</title>
				<link>http://piotr.gabryjeluk.pl/dev:lucene-replaces-local-searches</link>
				<description>

&lt;p&gt;As some of you know, some time ago I worked on a new &lt;a href=&quot;http://piotr.gabryjeluk.pl/dev:wikidot-search-launched&quot;&gt;Wikidot search&lt;/a&gt;. It is used for the &lt;a href=&quot;http://www.wikidot.com/search:all&quot;&gt;Search all sites&lt;/a&gt; page.&lt;/p&gt;
&lt;p&gt;This work was done, because searching the whole Wikidot database was far from being fast. At first we used Google Custom Search Engine to solve the problem, but we wanted to be independent from it. Also we wanted to include search results that are accessible by the person that searches but not by search engines (like private sites).&lt;/p&gt;
&lt;p&gt;This worked really good. The only problem was long time spent to display the results. It was like 20 seconds, which was far better than when using previous search, but much worse than Google. This was strange, because from previous tests, we calculated the average search time should be about a second or two.&lt;/p&gt;
&lt;p&gt;by &lt;span class=&quot;printuser avatarhover&quot;&gt;&lt;a href=&quot;http://piotr.gabryjeluk.pl/profile2:2462&quot; target=&quot;_blank&quot;&gt;&lt;img class=&quot;small&quot; src=&quot;http://www.wikidot.com/avatar.php?userid=2462&amp;amp;size=small&amp;amp;timestamp=1328820321&quot; alt=&quot;Gabrys&quot; style=&quot;background-image:url(http://www.wikidot.com/userkarma.php?u=2462)&quot; /&gt;&lt;/a&gt;&lt;a href=&quot;http://piotr.gabryjeluk.pl/profile2:2462&quot; target=&quot;_blank&quot;&gt;Gabrys&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;
</description>
				<pubDate>Tue, 23 Jun 2009 18:25:58 +0000</pubDate>
												<content:encoded>
					<![CDATA[
						 <p>As some of you know, some time ago I worked on a new <a href="http://piotr.gabryjeluk.pl/dev:wikidot-search-launched">Wikidot search</a>. It is used for the <a href="http://www.wikidot.com/search:all">Search all sites</a> page.</p> <p>This work was done, because searching the whole Wikidot database was far from being fast. At first we used Google Custom Search Engine to solve the problem, but we wanted to be independent from it. Also we wanted to include search results that are accessible by the person that searches but not by search engines (like private sites).</p> <p>This worked really good. The only problem was long time spent to display the results. It was like 20 seconds, which was far better than when using previous search, but much worse than Google. This was strange, because from previous tests, we calculated the average search time should be about a second or two.</p> <div class="content-separator" style="display: none:"></div> <p>It started to be clear, when we noticed that only 20-30 searches per day are performed. The index is quite big, and it needs to be cached in RAM to work with sufficient performance.</p> <p>Today I did more tests under heavy load and it seams Lucene can handle big number of queries. When users search often, the index is partially or even fully cached by the filesystem and searches are really quick!</p> <p>But our main problem to solve today was slow local search a.k.a. &quot;search this site&quot;. Moreover many concurrent queries were degrading database performance (not only for searching), so we decided to enable Lucene for local searches as well.</p> <p>I must say it works really nice, fast and has a nice set of syntax tricks you can do with it, for example you can search for pages with something in tags. Just search for <em>youtube tags:embed</em>. This would search for pages matching <em>youtube</em> (in tags, title or content) and with <em>embed</em> in tags. If no such pages are found, partial matches are also returned, like: pages matching <em>youtube</em> (but with no <em>embed</em> in tags) or pages with <em>embed</em> in tags, (but not matching <em>youtube</em>).</p> <p>To sum up, new search is faster, gives more accurate results, saves the database performance (which was the main goal) and allows nicer syntax than the old one.</p> <p>by <span class="printuser avatarhover"><a href="http://piotr.gabryjeluk.pl/profile2:2462" target="_blank"><img class="small" src="http://www.wikidot.com/avatar.php?userid=2462&amp;size=small&amp;timestamp=1328820321" alt="Gabrys" style="background-image:url(http://www.wikidot.com/userkarma.php?u=2462)" /></a><a href="http://piotr.gabryjeluk.pl/profile2:2462" target="_blank">Gabrys</a></span></p> 
				 	]]>
				</content:encoded>							</item>
					<item>
				<guid>http://piotr.gabryjeluk.pl/dev:php-as-fastcgi-backend</guid>
				<title>PHP as FastCGI backend and Lighttpd</title>
				<link>http://piotr.gabryjeluk.pl/dev:php-as-fastcgi-backend</link>
				<description>

&lt;h1&gt;&lt;span&gt;Wikidot + Lighttpd + PHP5&lt;/span&gt;&lt;/h1&gt;
&lt;p&gt;At Wikidot we use PHP5 as FastCGI backend to Lighttpd light-and-fast webserver. It works like this:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;there are a few hundreds of php5-cgi processes (name is cgi, but they also support FastCGI mode) running and waiting to be used&lt;/li&gt;
&lt;li&gt;lighttpd (only one needed!) process manages the network connections to all the clients and once the request is ready serves a static file or forwards the request to one of PHP backends processes.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;by &lt;span class=&quot;printuser avatarhover&quot;&gt;&lt;a href=&quot;http://piotr.gabryjeluk.pl/profile2:2462&quot; target=&quot;_blank&quot;&gt;&lt;img class=&quot;small&quot; src=&quot;http://www.wikidot.com/avatar.php?userid=2462&amp;amp;size=small&amp;amp;timestamp=1328820321&quot; alt=&quot;Gabrys&quot; style=&quot;background-image:url(http://www.wikidot.com/userkarma.php?u=2462)&quot; /&gt;&lt;/a&gt;&lt;a href=&quot;http://piotr.gabryjeluk.pl/profile2:2462&quot; target=&quot;_blank&quot;&gt;Gabrys&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;
</description>
				<pubDate>Mon, 15 Jun 2009 20:59:29 +0000</pubDate>
												<content:encoded>
					<![CDATA[
						 <h1><span>Wikidot + Lighttpd + PHP5</span></h1> <p>At Wikidot we use PHP5 as FastCGI backend to Lighttpd light-and-fast webserver. It works like this:</p> <ul> <li>there are a few hundreds of php5-cgi processes (name is cgi, but they also support FastCGI mode) running and waiting to be used</li> <li>lighttpd (only one needed!) process manages the network connections to all the clients and once the request is ready serves a static file or forwards the request to one of PHP backends processes.</li> </ul> <div class="content-separator" style="display: none:"></div> <p>We used to use internal Lighttpd FastCGI process manager, meaning the lighttpd processes actually used to start the PHPs.</p> <h1><span>Problems</span></h1> <p>We encountered some known problems of 500 (server side) errors appearing after some random time, especially under a high traffic. The typical message appearing at the Lighttpd's error.log was:</p> <div class="code"> <pre> <code>&lt;some date&gt;: (mod_fastcgi.c.2494) unexpected end-of-file (perhaps the fastcgi process died): pid: ...</code> </pre></div> <p>There are plenty of reports on this in both <a href="http://forum.lighttpd.net/topic/93190">Lighttpd</a>'s and <a href="http://bugs.php.net/bug.php?id=43295">PHP</a>'s <a href="http://forum.lighttpd.net/topic/93190">forums</a>, <a href="http://pecl.php.net/bugs/bug.php?id=12608">bug</a> <a href="http://redmine.lighttpd.net/issues/1466">trackers</a> and even <a href="http://www.rooftopsolutions.nl/article/201">some</a> <a href="http://jcj.net/?p=24">blogs</a>.</p> <h1><span>Workarounds</span></h1> <p>We managed to write some hacky scripts that detected the situation and restarted the backends when needed. The reaction was so quick, that almost no-one noticed the error, but damn, this is not how WE solve problems.</p> <h1><span>A blind try</span></h1> <p>We decided to give spawn-fcgi a shot. What is it? It is a program that spawns FastCGI backends (independently from Lighttpd server). Why trying it? I've read somewhere, that it works more reliably than the internal Lighttpd spawner. What's interesting is that this program comes from lighttpd package, so we're in family anyway. It's mainly intended to run the FastCGI backends from different user than the webserver user or to run them on different machine(s) than the webserver machine. This can be used naturally for some smart load-balancing.</p> <p>The only problem of this solution we encountered was internal limit of number of processes to spawn by a single process which was 256 (hardcoded, fixed in next versions). But at the same time, we decided to build a few FastCGI bridges (each spawning ~200 PHPs) anyway so that was no longer a problem for us.</p> <p>What was quite surprising (but honestly, I deeply believed in this), our problems with 500 server errors and PHP disappeared. This configuration works for about 2 weeks now with absolutely no hacky scripts involved and no restarting needed. Cool.</p> <h1><span>Why I wrote this</span></h1> <p>I wrote this short note just for the record and to let other people know, that using spawn-fcgi instead of the internal Lighttpd's FastCGI spawner might solve their problems with PHP (FastCGI) and 500 internal server errors.</p> <p>Hope this helps someone.</p> <p>by <span class="printuser avatarhover"><a href="http://piotr.gabryjeluk.pl/profile2:2462" target="_blank"><img class="small" src="http://www.wikidot.com/avatar.php?userid=2462&amp;size=small&amp;timestamp=1328820321" alt="Gabrys" style="background-image:url(http://www.wikidot.com/userkarma.php?u=2462)" /></a><a href="http://piotr.gabryjeluk.pl/profile2:2462" target="_blank">Gabrys</a></span></p> 
				 	]]>
				</content:encoded>							</item>
					<item>
				<guid>http://piotr.gabryjeluk.pl/dev:announcing-pymalist</guid>
				<title>Announcing pymalist</title>
				<link>http://piotr.gabryjeluk.pl/dev:announcing-pymalist</link>
				<description>

&lt;p&gt;I would like to announce &lt;a href=&quot;http://piotr.gabryjeluk.pl/pymalist&quot;&gt;pymalist&lt;/a&gt; project. It is a stupid and simple highly-modular Pythonic mail list server, that uses basic concepts to do the job well.&lt;/p&gt;
&lt;p&gt;by &lt;span class=&quot;printuser avatarhover&quot;&gt;&lt;a href=&quot;http://piotr.gabryjeluk.pl/profile2:2462&quot; target=&quot;_blank&quot;&gt;&lt;img class=&quot;small&quot; src=&quot;http://www.wikidot.com/avatar.php?userid=2462&amp;amp;size=small&amp;amp;timestamp=1328820321&quot; alt=&quot;Gabrys&quot; style=&quot;background-image:url(http://www.wikidot.com/userkarma.php?u=2462)&quot; /&gt;&lt;/a&gt;&lt;a href=&quot;http://piotr.gabryjeluk.pl/profile2:2462&quot; target=&quot;_blank&quot;&gt;Gabrys&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;
</description>
				<pubDate>Sat, 23 May 2009 12:24:04 +0000</pubDate>
												<content:encoded>
					<![CDATA[
						 <p>I would like to announce <a href="http://piotr.gabryjeluk.pl/pymalist">pymalist</a> project. It is a stupid and simple highly-modular Pythonic mail list server, that uses basic concepts to do the job well.</p> <div class="content-separator" style="display: none:"></div> <p>Read more on <a href="http://piotr.gabryjeluk.pl/pymalist">pymalist</a> page, browse the source on <a href="http://github.com/gabrys/pymalist">GitHub project page</a>.</p> <p>by <span class="printuser avatarhover"><a href="http://piotr.gabryjeluk.pl/profile2:2462" target="_blank"><img class="small" src="http://www.wikidot.com/avatar.php?userid=2462&amp;size=small&amp;timestamp=1328820321" alt="Gabrys" style="background-image:url(http://www.wikidot.com/userkarma.php?u=2462)" /></a><a href="http://piotr.gabryjeluk.pl/profile2:2462" target="_blank">Gabrys</a></span></p> 
				 	]]>
				</content:encoded>							</item>
					<item>
				<guid>http://piotr.gabryjeluk.pl/dev:wikidot-org-refresh</guid>
				<title>Refreshing www.wikidot.org</title>
				<link>http://piotr.gabryjeluk.pl/dev:wikidot-org-refresh</link>
				<description>

&lt;p&gt;Yesterday I started refreshing &lt;a href=&quot;http://www.wikidot.org/&quot;&gt;www.wikidot.org&lt;/a&gt; website &amp;#8212; the home of Wikidot open source software.&lt;/p&gt;
&lt;p&gt;Also we decided to move from managing our code in SVN to Git &amp;#8212; more precisely to www.github.com. Our project page at GitHub is the following: &lt;a href=&quot;http://github.com/gabrys/wikidot&quot;&gt;http://github.com/gabrys/wikidot&lt;/a&gt;. Feel free to just follow it or even fork!&lt;/p&gt;
&lt;p&gt;Last times, I made Wikidot insanely easy to install (check out the &lt;a href=&quot;http://www.wikidot.org/installation-guide&quot;&gt;installation guide&lt;/a&gt;). It totally rocks (you can install Wikidot within 10 commands and no file editing).&lt;/p&gt;
&lt;p&gt;by &lt;span class=&quot;printuser avatarhover&quot;&gt;&lt;a href=&quot;http://piotr.gabryjeluk.pl/profile2:2462&quot; target=&quot;_blank&quot;&gt;&lt;img class=&quot;small&quot; src=&quot;http://www.wikidot.com/avatar.php?userid=2462&amp;amp;size=small&amp;amp;timestamp=1328820321&quot; alt=&quot;Gabrys&quot; style=&quot;background-image:url(http://www.wikidot.com/userkarma.php?u=2462)&quot; /&gt;&lt;/a&gt;&lt;a href=&quot;http://piotr.gabryjeluk.pl/profile2:2462&quot; target=&quot;_blank&quot;&gt;Gabrys&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;
</description>
				<pubDate>Thu, 21 May 2009 18:11:17 +0000</pubDate>
												<content:encoded>
					<![CDATA[
						 <p>Yesterday I started refreshing <a href="http://www.wikidot.org/">www.wikidot.org</a> website &#8212; the home of Wikidot open source software.</p> <p>Also we decided to move from managing our code in SVN to Git &#8212; more precisely to www.github.com. Our project page at GitHub is the following: <a href="http://github.com/gabrys/wikidot">http://github.com/gabrys/wikidot</a>. Feel free to just follow it or even fork!</p> <p>Last times, I made Wikidot insanely easy to install (check out the <a href="http://www.wikidot.org/installation-guide">installation guide</a>). It totally rocks (you can install Wikidot within 10 commands and no file editing).</p> <div class="content-separator" style="display: none:"></div> <p>I want to state, that this post is the last about the Wikidot open source software on this blog, as I'm running a new blog just about the Wikidot software at <a href="http://www.wikidot.org/blog">wikidot.org</a>. This will be more practical to filter the posts and will push some life into that site.</p> <p>At the end I want to invite you to the <a href="http://www.wikidot.org/irc-channel">Wikidot IRC channel</a> #wikidot at irc.freenode.org. That would be probably the easiest way to contact the Wikidot team without much formalism.</p> <p>(As many posts here were about Wikidot software, this blog will be less regularly updated, but if really care about Wikidot software news, just follow the new one and you won't be spammed about posts about Python, BASH or other things. I hope that blog-split will really help everyone.)</p> <p>by <span class="printuser avatarhover"><a href="http://piotr.gabryjeluk.pl/profile2:2462" target="_blank"><img class="small" src="http://www.wikidot.com/avatar.php?userid=2462&amp;size=small&amp;timestamp=1328820321" alt="Gabrys" style="background-image:url(http://www.wikidot.com/userkarma.php?u=2462)" /></a><a href="http://piotr.gabryjeluk.pl/profile2:2462" target="_blank">Gabrys</a></span></p> 
				 	]]>
				</content:encoded>							</item>
					<item>
				<guid>http://piotr.gabryjeluk.pl/dev:ubuntu-and-intel-agn-wireless-card</guid>
				<title>Ubuntu And Intel AGN Wireless Card</title>
				<link>http://piotr.gabryjeluk.pl/dev:ubuntu-and-intel-agn-wireless-card</link>
				<description>

&lt;p&gt;I &lt;strong&gt;finally&lt;/strong&gt; managed to get a version of kernel/modules that work nice on my wireless card:&lt;/p&gt;
&lt;p&gt;by &lt;span class=&quot;printuser avatarhover&quot;&gt;&lt;a href=&quot;http://piotr.gabryjeluk.pl/profile2:2462&quot; target=&quot;_blank&quot;&gt;&lt;img class=&quot;small&quot; src=&quot;http://www.wikidot.com/avatar.php?userid=2462&amp;amp;size=small&amp;amp;timestamp=1328820321&quot; alt=&quot;Gabrys&quot; style=&quot;background-image:url(http://www.wikidot.com/userkarma.php?u=2462)&quot; /&gt;&lt;/a&gt;&lt;a href=&quot;http://piotr.gabryjeluk.pl/profile2:2462&quot; target=&quot;_blank&quot;&gt;Gabrys&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;
</description>
				<pubDate>Tue, 19 May 2009 15:20:42 +0000</pubDate>
												<content:encoded>
					<![CDATA[
						 <p>I <strong>finally</strong> managed to get a version of kernel/modules that work nice on my wireless card:</p> <div class="content-separator" style="display: none:"></div> <div class="code"> <pre> <code>06:00.0 Network controller: Intel Corporation PRO/Wireless 4965 AG or AGN [Kedron] Network Connection (rev 61)</code> </pre></div> <p>I had problems since late Hardy or Intrepid, using different kernel from that time with no luck. The worst case was connecting to WPA2 Enterprise (user/password) secured network. In worst subcase, I had the connection for 5-20 minutes and after that the network card or driver hanged and then only computer reboot used to help.</p> <p>I was used to see <tt>iwlist scan</tt> errors like &quot;Resource temporarily unavailable&quot; or &quot;Busy&quot;. <tt>dmesg</tt> showed different things on different kernels.</p> <p>My frustration was great, when the problem started (after some upgrades that meant to improve things) to appear even on unsecured network. The connection was broken and I had to notoriously reconnect with my NetworkManager.</p> <p>Finally I found a version of kernel that plays well.</p> <p>It's from jaunty-proposed repository (enable it in your Synaptic or other package manager). Don't use jaunty-backports (this one was only broken). The package that solves things is: <strong>linux-backports-modules-jaunty</strong> version <strong>2.6.28.12.16</strong>. The install should also update the linux-image to 2.6.18-12 (update your grub.conf as usual to include the changes).</p> <p>After rebooting, run uname, to verify the kernel version:</p> <div class="code"> <pre> <code># uname -a Linux vaio 2.6.28-12-generic #43-Ubuntu SMP Fri May 1 19:31:32 UTC 2009 x86_64 GNU/Linux</code> </pre></div> <p>This is crucial here: <strong>2.6.28-12-generic</strong>. The original Ubuntu kernel is 2.6.28-11 not -12.</p> <p>Hope this helps someone (with VAIO SZ or any other Intel AGN-enabled notebook with Ubuntu).</p> <p>by <span class="printuser avatarhover"><a href="http://piotr.gabryjeluk.pl/profile2:2462" target="_blank"><img class="small" src="http://www.wikidot.com/avatar.php?userid=2462&amp;size=small&amp;timestamp=1328820321" alt="Gabrys" style="background-image:url(http://www.wikidot.com/userkarma.php?u=2462)" /></a><a href="http://piotr.gabryjeluk.pl/profile2:2462" target="_blank">Gabrys</a></span></p> 
				 	]]>
				</content:encoded>							</item>
					<item>
				<guid>http://piotr.gabryjeluk.pl/dev:wikidot-opensource-changes-in-trunk</guid>
				<title>Wikidot OpenSource Changes In Trunk</title>
				<link>http://piotr.gabryjeluk.pl/dev:wikidot-opensource-changes-in-trunk</link>
				<description>

&lt;p&gt;I decided to wait no more and share what I&#039;ve kept at my local disk. I committed the changes &lt;a href=&quot;http://piotr.gabryjeluk.pl/dev:wikidot-opensource-direction&quot;&gt;I&#039;ve been working on&lt;/a&gt; to the repository.&lt;/p&gt;
&lt;p&gt;The biggest change is Wikidot is now single wiki engine by default (you need additional configuration for the wiki farm mode).&lt;/p&gt;
&lt;p&gt;by &lt;span class=&quot;printuser avatarhover&quot;&gt;&lt;a href=&quot;http://piotr.gabryjeluk.pl/profile2:2462&quot; target=&quot;_blank&quot;&gt;&lt;img class=&quot;small&quot; src=&quot;http://www.wikidot.com/avatar.php?userid=2462&amp;amp;size=small&amp;amp;timestamp=1328820321&quot; alt=&quot;Gabrys&quot; style=&quot;background-image:url(http://www.wikidot.com/userkarma.php?u=2462)&quot; /&gt;&lt;/a&gt;&lt;a href=&quot;http://piotr.gabryjeluk.pl/profile2:2462&quot; target=&quot;_blank&quot;&gt;Gabrys&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;
</description>
				<pubDate>Sat, 16 May 2009 11:38:27 +0000</pubDate>
												<content:encoded>
					<![CDATA[
						 <p>I decided to wait no more and share what I've kept at my local disk. I committed the changes <a href="http://piotr.gabryjeluk.pl/dev:wikidot-opensource-direction">I've been working on</a> to the repository.</p> <p>The biggest change is Wikidot is now single wiki engine by default (you need additional configuration for the wiki farm mode).</p> <div class="content-separator" style="display: none:"></div> <p>What demonstrates the change is the simplified installation process.</p> <p>Now it's as simple as installing any other software or service:</p> <ol> <li>install the dependencies <ul> <li>for Ubuntu: <tt>sudo aptitude install lighttpd php5 php5-cli tetex-bin tetex-extra gs-gpl imagemagick libmagic1 subversion postgresql-8.3 php5-tidy php5-pgsql php5-gd zip make</tt></li> </ul> </li> <li>get the code <ul> <li><tt>svn co <a href="http://svn.wikidot.org/repos/wikidot1/trunk/">http://svn.wikidot.org/repos/wikidot1/trunk/</a> wikidot-install-dir</tt></li> <li><tt>cd wikidot-install-dir</tt></li> </ul> </li> <li>if on Ubuntu: configure conf/wikidot.ini and set user at [db] section to your login name</li> <li>prepare database (create role and database) <ul> <li>as user postgres: <tt>make prepare_db</tt></li> </ul> </li> <li>build Wikidot: configure files and make initial dabatase <ul> <li>as you: <tt>make</tt></li> <li>this prints a secret URL at the end, you'll use it to configure Admin password</li> </ul> </li> <li>start Wikidot <ul> <li>./wikidotctl start</li> </ul> </li> <li>set Admin password <ul> <li>use your browser and navigate to the secret URL make prints at the end</li> </ul> </li> </ol> <p>We would like to finally create Debian/Ubuntu packages for that (once it gets more stable and have some bug fixed). So keep tuned!</p> <p>by <span class="printuser avatarhover"><a href="http://piotr.gabryjeluk.pl/profile2:2462" target="_blank"><img class="small" src="http://www.wikidot.com/avatar.php?userid=2462&amp;size=small&amp;timestamp=1328820321" alt="Gabrys" style="background-image:url(http://www.wikidot.com/userkarma.php?u=2462)" /></a><a href="http://piotr.gabryjeluk.pl/profile2:2462" target="_blank">Gabrys</a></span></p> 
				 	]]>
				</content:encoded>							</item>
					<item>
				<guid>http://piotr.gabryjeluk.pl/dev:wikidot-opensource-direction</guid>
				<title>Wikidot OpenSource Development Direction</title>
				<link>http://piotr.gabryjeluk.pl/dev:wikidot-opensource-direction</link>
				<description>

&lt;p&gt;Today we though that we might completely change the direction for Wikidot OpenSource. This would deprecate the previous &lt;a href=&quot;http://piotr.gabryjeluk.pl/dev:wikidot-1-0-roadmap&quot;&gt;Wikidot 1.0 Roadmap&lt;/a&gt;. Also this solution deprecates &lt;a href=&quot;http://piotr.gabryjeluk.pl/dev:wdlite-ready-for-testing&quot;&gt;wdLite&lt;/a&gt; (which was a big dirty hack).&lt;/p&gt;
&lt;p&gt;by &lt;span class=&quot;printuser avatarhover&quot;&gt;&lt;a href=&quot;http://piotr.gabryjeluk.pl/profile2:2462&quot; target=&quot;_blank&quot;&gt;&lt;img class=&quot;small&quot; src=&quot;http://www.wikidot.com/avatar.php?userid=2462&amp;amp;size=small&amp;amp;timestamp=1328820321&quot; alt=&quot;Gabrys&quot; style=&quot;background-image:url(http://www.wikidot.com/userkarma.php?u=2462)&quot; /&gt;&lt;/a&gt;&lt;a href=&quot;http://piotr.gabryjeluk.pl/profile2:2462&quot; target=&quot;_blank&quot;&gt;Gabrys&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;
</description>
				<pubDate>Mon, 11 May 2009 20:01:25 +0000</pubDate>
												<content:encoded>
					<![CDATA[
						 <p>Today we though that we might completely change the direction for Wikidot OpenSource. This would deprecate the previous <a href="http://piotr.gabryjeluk.pl/dev:wikidot-1-0-roadmap">Wikidot 1.0 Roadmap</a>. Also this solution deprecates <a href="http://piotr.gabryjeluk.pl/dev:wdlite-ready-for-testing">wdLite</a> (which was a big dirty hack).</p> <div class="content-separator" style="display: none:"></div> <h1><span>Single wiki mode</span></h1> <p>The main difference is introducing a new Wikidot installation mode: &quot;sigle wiki mode&quot; and setting it as the default instead of &quot;wiki farm mode&quot;.</p> <p>What does it mean?</p> <ul> <li>you don't have to bother about: <ul> <li>domains (DNS)</li> <li>mail configuration</li> <li>root access (you can start Wikidot on custom port &#8212; default 8080)</li> </ul> </li> <li>you get direct administration panel for managing users</li> </ul> <p>But:</p> <ul> <li>you get only ONE single wiki</li> <li>you cannot create more wikis</li> <li>every IP/DNS address pointing to the started server (and corresponding port) displays THE wiki</li> <li>no mail invitations or password recovery</li> <li>no HTTPS</li> </ul> <h1><span>Lighttpd</span></h1> <p>Our main webserver is now <a href="http://lighttpd.net/">Lighttpd</a>, we forget about Apache. We can do this, because now you can run your regular Apache server on :80 port and Lighttpd serving Wikidot on :8080 (or other). They don't overlap, so there's no need to keep the compatibility.</p> <p>Wikidot is a full web service with its dedicated web server running on separate port. This is the philosophy.</p> <h1><span>Scripts</span></h1> <p>To make Wikidot easily installable, we're going to create a script (possibly a Makefile) that will simplify the whole process. It would be 4 steps:</p> <ul> <li>install dependencies</li> <li>setup the database</li> <li>edit ini file (supply database credentials)</li> <li>make</li> </ul> <p>Dependencies are Lighttpd, PHP, PostgreSQL, ImageMagick and maybe a few other things. Each of them can be installed without root access, but with root access it would be just as easy as</p> <ul> <li>aptitude install lighttpd php5-cgi postgresql-8.3 ImageMagick</li> </ul> <p>(or so)</p> <p>Running/stopping Wikidot:</p> <ul> <li>./wikidotctl start</li> <li>./wikidotctl stop</li> </ul> <h1><span>Next steps</span></h1> <p>Once all this is done (which isn't too much work BTW), we could make a *.deb package, that would take care of dependencies, database, creating a special user for wikidot, setting the root directory by convention and installing init script in proper place. Then you would just:</p> <ul> <li>/etc/init.d/wikidot start/stop/restart</li> </ul> <p>This should kill all Wikidot-is-to-hard-to-install issues.</p> <h1><span>&#8230; upgrade to wiki farm</span></h1> <p>Once you have your single-wiki Wikidot up and running you may want to upgrade to full featured wiki farm solution. The one-wiki would become the main wiki (as is www.wikidot.com for the Wikidot.com service), other wikis would be able to be created. On the other hand, as your getting more powerful, you need to configure your DNS (have a domain-class just for your wiki farm), mail service and move the service to the main HTTP port (80).</p> <h1><span>The hardest thing</span></h1> <p>Q: What is the hardest thing to do in that plan?<br /> A: The hardest thing is to create a module to manage wiki users.</p> <p>This should not be too hard, so in the overall, this should work!</p> <p>I'm waiting for your opinions.</p> <p>by <span class="printuser avatarhover"><a href="http://piotr.gabryjeluk.pl/profile2:2462" target="_blank"><img class="small" src="http://www.wikidot.com/avatar.php?userid=2462&amp;size=small&amp;timestamp=1328820321" alt="Gabrys" style="background-image:url(http://www.wikidot.com/userkarma.php?u=2462)" /></a><a href="http://piotr.gabryjeluk.pl/profile2:2462" target="_blank">Gabrys</a></span></p> 
				 	]]>
				</content:encoded>							</item>
					<item>
				<guid>http://piotr.gabryjeluk.pl/dev:api-save</guid>
				<title>API page.save</title>
				<link>http://piotr.gabryjeluk.pl/dev:api-save</link>
				<description>

&lt;p&gt;The &lt;a href=&quot;http://www.wikidot.com/doc:api&quot;&gt;Wikidot API&lt;/a&gt; &lt;strong&gt;page.save&lt;/strong&gt; method is one of the things we&#039;ve been holding over for weeks, just because there were so many other important things to do.&lt;/p&gt;
&lt;p&gt;But the API is also important, because it can enable developers (which are big fraction of our users) to create applications that use Wikidot.com as a service. This can be useful in many ways, the best example I can think of is creating an application, that get some photos from your disk, uploads them to Wikidot, creates a page for each of them and saves some metadata from them into it.&lt;/p&gt;
&lt;p&gt;Today, I finally managed to start working on one of the most important API method which is page.save. This method obviously is for saving a page. The page saving mechanism in Wikidot is quite complex, because of advanced site permissions, various performance optimizations, caches and many scenarios of updating a page.&lt;/p&gt;
&lt;p&gt;by &lt;span class=&quot;printuser avatarhover&quot;&gt;&lt;a href=&quot;http://piotr.gabryjeluk.pl/profile2:2462&quot; target=&quot;_blank&quot;&gt;&lt;img class=&quot;small&quot; src=&quot;http://www.wikidot.com/avatar.php?userid=2462&amp;amp;size=small&amp;amp;timestamp=1328820321&quot; alt=&quot;Gabrys&quot; style=&quot;background-image:url(http://www.wikidot.com/userkarma.php?u=2462)&quot; /&gt;&lt;/a&gt;&lt;a href=&quot;http://piotr.gabryjeluk.pl/profile2:2462&quot; target=&quot;_blank&quot;&gt;Gabrys&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;
</description>
				<pubDate>Thu, 07 May 2009 20:32:23 +0000</pubDate>
												<content:encoded>
					<![CDATA[
						 <p>The <a href="http://www.wikidot.com/doc:api">Wikidot API</a> <strong>page.save</strong> method is one of the things we've been holding over for weeks, just because there were so many other important things to do.</p> <p>But the API is also important, because it can enable developers (which are big fraction of our users) to create applications that use Wikidot.com as a service. This can be useful in many ways, the best example I can think of is creating an application, that get some photos from your disk, uploads them to Wikidot, creates a page for each of them and saves some metadata from them into it.</p> <p>Today, I finally managed to start working on one of the most important API method which is page.save. This method obviously is for saving a page. The page saving mechanism in Wikidot is quite complex, because of advanced site permissions, various performance optimizations, caches and many scenarios of updating a page.</p> <div class="content-separator" style="display: none:"></div> <p>Also, we wanted to make page.save to be one method to update and create pages, which involves other permission checking, because in some cases you have permission to create a page, but not to edit. This is especially true if you have a site category with everybody-can-create-but-only-author-can-edit policy.</p> <p>I started from dealing with updating already existing pages, so for now page.save can't yet create pages. We have more or less working page.save for the following activities:</p> <table class="wiki-content-table"> <tr> <th></th> <th>code in Python syntax</th> </tr> <tr> <th>set title</th> <td><strong>page.save</strong>({ 'site': 'quake', 'page': 'dev:api-save', <strong>'title': 'Other title'</strong> })</td> </tr> <tr> <th>update page source</th> <td><strong>page.save</strong>({ 'site': 'quake', 'page': 'dev:api-save', <strong>'source': '+ Come back later'</strong> })</td> </tr> <tr> <th>set tags</th> <td><strong>page.save</strong>({ 'site': 'quake', 'page': 'dev:api-save', <strong>'tags': ['wikidot', 'api']</strong> })</td> </tr> <tr> <th>all at once</th> <td><strong>page.save</strong>({ 'site': 'quake', 'page': 'dev:api-save', <strong>'title': 'Other title', 'source': '+ Come back later', 'tags': ['wikidot', 'api']</strong> })</td> </tr> </table> <p>Notes:</p> <ul> <li>the API service is XML-RPC based, so the syntax of calls is syntax of the programming language you use (Python used as an example syntax)</li> <li>site: quake and page: dev:api-save means <span style="white-space: pre-wrap;">http://</span><strong>quake</strong>.wikidot.com/<strong>dev:api-save</strong> page</li> <li>setting tags as a single string (comma- or space-separated) is also supported</li> <li>setting of parent page is also supported in similar way to setting the title</li> </ul> <p>Now we're going to review the code, ensure there is no more caching mechanism I forgot about and make final polishing. This includes generating notifications to be send to page-watchers and saving revision comments.</p> <p>This method is crucial for the API. Once it gets fully working (including creating pages), applications will be able to:</p> <ul> <li>create pages</li> <li>read pages</li> <li>modify pages</li> </ul> <p>and this the <strong>core functionality we want to provide with the Wikidot API</strong>.</p> <p>Check out the <a href="http://www.wikidot.com/doc:api-methods">API methods</a> to see if page.save is already out.</p> <p>If you want to test the (beta) API, drop a comment at the <a href="http://www.wikidot.com/doc:api">Wikidot API page</a>.</p> <p>by <span class="printuser avatarhover"><a href="http://piotr.gabryjeluk.pl/profile2:2462" target="_blank"><img class="small" src="http://www.wikidot.com/avatar.php?userid=2462&amp;size=small&amp;timestamp=1328820321" alt="Gabrys" style="background-image:url(http://www.wikidot.com/userkarma.php?u=2462)" /></a><a href="http://piotr.gabryjeluk.pl/profile2:2462" target="_blank">Gabrys</a></span></p> 
				 	]]>
				</content:encoded>							</item>
					<item>
				<guid>http://piotr.gabryjeluk.pl/dev:iphone-vs-android</guid>
				<title>Apple&#039;s iPhone VS Google&#039;s Android</title>
				<link>http://piotr.gabryjeluk.pl/dev:iphone-vs-android</link>
				<description>

&lt;p&gt;Do you wonder what are the main differences between iPhone and Android?&lt;/p&gt;
&lt;p&gt;I prepared a quick and highly subjective comparison.&lt;/p&gt;
&lt;p&gt;by &lt;span class=&quot;printuser avatarhover&quot;&gt;&lt;a href=&quot;http://piotr.gabryjeluk.pl/profile2:2462&quot; target=&quot;_blank&quot;&gt;&lt;img class=&quot;small&quot; src=&quot;http://www.wikidot.com/avatar.php?userid=2462&amp;amp;size=small&amp;amp;timestamp=1328820321&quot; alt=&quot;Gabrys&quot; style=&quot;background-image:url(http://www.wikidot.com/userkarma.php?u=2462)&quot; /&gt;&lt;/a&gt;&lt;a href=&quot;http://piotr.gabryjeluk.pl/profile2:2462&quot; target=&quot;_blank&quot;&gt;Gabrys&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;
</description>
				<pubDate>Sun, 03 May 2009 17:45:50 +0000</pubDate>
												<content:encoded>
					<![CDATA[
						 <p>Do you wonder what are the main differences between iPhone and Android?</p> <p>I prepared a quick and highly subjective comparison.</p> <div class="content-separator" style="display: none:"></div> <p>First in what ares the two phones are comparable:</p> <ul> <li>they are phones</li> <li>they look and behave similarly (users can easily migrate from one to another)</li> </ul> <p>OK, now what is different:</p> <table class="wiki-content-table"> <tr> <th>area</th> <th>iPhone</th> <th>Android</th> </tr> <tr> <th>GUI</th> <td>eye-candy and polished to single detail</td> <td>eye-candy but not perfect</td> </tr> <tr> <th>applications you can install</th> <td>only from AppStore (application from different repositories after jail-breaking)</td> <td>any application from start</td> </tr> <tr> <th>hardware</th> <td>phone, music player</td> <td>many small devices (including netbooks)</td> </tr> <tr> <th>integration with Desktop</th> <td>Mac/Windows</td> <td>Mac/Windows/Linux</td> </tr> <tr> <th>software developing platform</th> <td>closed (need to enroll first), special IDE for Mac</td> <td>open, runs also on Linux, includes Eclipse plug-in integrated with device Emulator</td> </tr> <tr> <th>hacking</th> <td>jail-break and install many open-source applications</td> <td>get root access on your G1 with specially designed SD-card (gold-card), or install Android on other device (like FreeRunner)</td> </tr> </table> <p>I just need to say, that developing application for Android is just easy as</p> <ul> <li>downloading and unpacking SDK (software development kit)</li> <li>running Android Debug/Development Bridge from the SDK:</li> </ul> <div class="code"> <pre> <code>$ cd SDK $ tools/adb start-server</code> </pre></div> <ul> <li>installing an Eclipse plug-in (via the Eclipse update dialog)</li> <li>creating virtual Android device (emulator)</li> </ul> <div class="code"> <pre> <code># cd SDK # tools/android create avd -t 1 -n &quot;androidemulator&quot;</code> </pre></div> <ul> <li>running emulator</li> </ul> <div class="code"> <pre> <code># cd SDK # tools/emulator -avd &quot;androidemulator&quot;</code> </pre></div> <ul> <li>and then, for every application you want to write: <ul> <li>creating new Android project with Eclipse</li> <li>developing application in Java and Visual-Editors (mainly for GUI development)</li> <li>testing on emulator (by clicking on Run in Eclipse)</li> </ul> </li> </ul> <p>The .apk files (which are fully-enclosed applications) are created automatically. You can then sign them with your key and sell on Android Application Market. This requires you to register for $50. 1/3 of your income is taken by Google.</p> <p>I really need to say, this impresses me much, because the SDK (including emulator) and Eclipse plug-in are so well integrated, that I didn't need any Android-specific knowledge to start working on Android application. I would really, really like to develop something for iPhone, just for comparison, but I would need to have Mac and then enroll to the developer platform. Also I would need to learn Objective C, a language that is hardly used outside of areas influenced by Apple.</p> <p>So to cut long story short from the developer point of view it seems that Android is much much better. Also the fact that your application will run on more devices in the future without any modifications is really nice.</p> <p>by <span class="printuser avatarhover"><a href="http://piotr.gabryjeluk.pl/profile2:2462" target="_blank"><img class="small" src="http://www.wikidot.com/avatar.php?userid=2462&amp;size=small&amp;timestamp=1328820321" alt="Gabrys" style="background-image:url(http://www.wikidot.com/userkarma.php?u=2462)" /></a><a href="http://piotr.gabryjeluk.pl/profile2:2462" target="_blank">Gabrys</a></span></p> 
				 	]]>
				</content:encoded>							</item>
					<item>
				<guid>http://piotr.gabryjeluk.pl/dev:to-i-owo</guid>
				<title>To i owo</title>
				<link>http://piotr.gabryjeluk.pl/dev:to-i-owo</link>
				<description>

&lt;p&gt;Tracę już powoli pomysły na sensowne tytuły notek, ale pisać coś trzeba. Zatem dzisiaj krótkie podsumowanie ostatnich kilku dni.&lt;/p&gt;
&lt;p&gt;by &lt;span class=&quot;printuser avatarhover&quot;&gt;&lt;a href=&quot;http://piotr.gabryjeluk.pl/profile2:2462&quot; target=&quot;_blank&quot;&gt;&lt;img class=&quot;small&quot; src=&quot;http://www.wikidot.com/avatar.php?userid=2462&amp;amp;size=small&amp;amp;timestamp=1328820322&quot; alt=&quot;Gabrys&quot; style=&quot;background-image:url(http://www.wikidot.com/userkarma.php?u=2462)&quot; /&gt;&lt;/a&gt;&lt;a href=&quot;http://piotr.gabryjeluk.pl/profile2:2462&quot; target=&quot;_blank&quot;&gt;Gabrys&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;
</description>
				<pubDate>Wed, 29 Apr 2009 20:34:10 +0000</pubDate>
												<content:encoded>
					<![CDATA[
						 <p>Tracę już powoli pomysły na sensowne tytuły notek, ale pisać coś trzeba. Zatem dzisiaj krótkie podsumowanie ostatnich kilku dni.</p> <div class="content-separator" style="display: none:"></div> <h1><span>CUDA</span></h1> <p>Zaczynając od początku czyli od wczoraj: rano działy się niezłe CUDA. Konkretnie, chodzi o technologię firmy nVidia stosowaną w kartach graficznych, która nazywa się CUDA. Ogólny zamysł polega na wykorzystaniu jednostki GPU (procesor karty graficznej) do wykonywania napisanych w języku podobnym do C (i odpowiednio skompilowanych).</p> <p>Procesory GPU różnią się znacznie od naszych CPU (centralnych procesorów). W procesorze CPU mamy zwykle 1, 2 lub 4 rdzenie. W procesorach graficznych kart nVidii mamy dziesiątki, czy nawet setki multiprocesorów (bliski procesorowi wielordzeniowemu).</p> <p>Ogólnie, możemy uruchomić około 1000 i więcej &quot;wątków&quot; na jednej karcie graficznej. Daje to spore możliwości wykorzystania takiej architektury w obliczeniach równoległych. Przedtem taka architektura była tylko wykorzystywana przez zamknięte sterowniki karty graficznej w celu renderowania skomplikowanej grafiki 3D w czasie rzeczywistym (i nie tylko). Teraz moc obliczeniowa stoi przed zdolnymi programistami i czeka na wykorzystanie.</p> <p>Oprócz niewątpliwej zalety jaką jest wysoka współbieżność, mamy również garść bardzo szybkiej pamięci do dyspozycji (tak szybka jak rejestry procesora). Po krótkiej analizie jednak okazało się, że konieczność współdzielenia jej przez wiele wątków redukuje nam średnią ilość tej szybkiej pamięci do kilku bajtów na wątek. Należy więc jednak trochę z tym uważać.</p> <p>Odwołania do pamięci RAM karty graficznej są wolne, jednak procesor potrafi w czasie &quot;czekania&quot; na dane z RAM-u wykonywać inny wątek. Jest to również stosowane w zwykłych procesorach. Znane jest pod pojęciem wywłaszczenia procesu (np., gdy proces oczekuje na operację I/O na wolnym dysku na jego miejsce &quot;wskakuje&quot; inny proces). Jednak w odróżnieniu od zwykłego procesora, gdzie wywłaszczenie inicjuje system operacyjny, a samo przełączenie kontekstu jest dość kosztowne, w CUDA-ch wywłaszczenie jest częścią logiki realizowanej sprzętowo i jest bardzo bardzo szybkie. Zatem odpowiednio oprogramowując używanie pamięci globalnej, możemy uzyskać wykonywanie programu (złożonego z wielu &#8212; np. 256 &#8212; wątków) bez przerw w wykorzystywaniu mocy obliczeniowej GPU.</p> <p>Oprócz zalet mamy oczywiście też wady. Jedną z nich (choć można to uznać za zaletę) jest brak mechanizmów cache'owania i stronicowania, co powoduje konieczność bardzo skrupulatnego zarządzania pamięcią.</p> <p>Np. na moim laptopie nie udało się uruchomić prawie żadnej przykładowej aplikacji dołączonej do SDK CUDA-ów. Powód: za mało pamięci. Pamięci karty graficznej oczywiście. W przypadku tradycyjnego procesora pamięć zwykle nie stanowi problemu, ponieważ tak naprawdę nigdy nią nie zarządzamy. Jako podstawę mamy pamięć RAM. Gdy komórka pamięci jest często używana trafia (automatycznie) do keszu, który jest dużo szybszy. Z drugiej strony, jeśli pamięci brakuje, następuje przeniesienie nieużywanej pamięci do swapa, czyli na dysk, który z kolei jest bardzo wolny w porównaniu do pamięci RAM.</p> <p>Efekt jest taki, że programując nie przejmujemy się gdzie będzie przechowywana zmienna. Na start trafia ona do RAM-u, ale może zostać skopiowana do szybkiego kesza, lub przeniesiona na wolny dysk. W CUDA-ch musimy sami zdecydować gdzie będą przechowywane poszczególne zmienne. Problem, który się pojawia, to nieznana ilość dostępnej pamięci. Każda karta ma inną dostępną pamięć każdego rodzaju, co więcej uruchomienie aplikacji graficznych (np. Compiz) zmniejsza ilość dostępnej pamięci.</p> <p>Są zatem dwa wyjścia &#8212; albo programujemy na konkretną kartę grafiki i wymagamy, aby tylko nasz program był na niej uruchomiony (a nie np. jeszcze Quake ;) ), albo inwestujemy w jakiś system zarządzania pamięcią karty graficznej (czyli robimy kawałek systemu operacyjnego, tyle, że na GPU). Oczywiście druga rzecz jest trudna i zmniejsza wydajność całego systemu.</p> <p>W praktyce pozostaje jeszcze jedno rozwiązanie. Zakupienie karty nVidia SPECJALNIE do obliczeń w technologii CUDA. Firma nVidia nie pozostawia nas w trudnej sytuacji i daje nam do dyspozycji kartę Tesla, która ma ze 4&#160;GB RAM-u, dużo wszystkiego (wątków, multiprocesorów itd), za to w zasadzie ciężko ją nazwać graficzną, bo nie ma wyjścia wideo. Przewrotnie, co?</p> <h1><span>Android</span></h1> <p>Następny dzień, następna prezentacja. Dzisiaj dotyczyła ona systemu Android opierającego się na jądrze Linux przystosowanego dla telefonów komórkowych (takich jak HTC G1) i innych małych urządzeń. System, pomimo jądra Linuksa jest czymś zupełnie innym niż znane nam z desktopów Ubuntu, a nawet projekty uruchamiania Linuksa na telefonach (np. OpenMoko). Różnica polega na tym, że warstwa narzędzi GNU (shell, podstawowe programy, zarządzanie użytkownikami) zostaje zastąpiona przez warstwę bibliotek w C i w Javie.</p> <p>Należy sobie jednak zdać sprawę z tego, że Java w Androidzie, to rzecz nieco inna niż Java używana na PC-tach, czy nawet w komórkach. Androidowa Java ma swoją implementację maszyny wirtualnej. Jest to DalvikVM, zoptymalizowany na maszyny o małej ilości RAM-u (64MB dla całego systemu) i wolnych procesorach (200-500&#160;MHz i ARM). Z tej optymalizacji bierze się inny bytecode, który optymalizuje użycie CPU i RAM. Również w celu zwiększenia wydajności pracy z pakietami zmianie ulega sposób wewnętrznej organizacji pakietu.</p> <p>Jednak wciąż pozostaje to Java i to dość niedaleko leżąca od tej Sunowej. W praktyce bowiem programowanie wygląda tak:</p> <ul> <li>programujemy w Javie (jednak mamy do dyspozycji mniej funkcji bibliotecznych)</li> <li>kompilujemy programy do bytecodu Sunowego (pliki class)</li> <li>tworzymy paczkę JAR</li> <li>korzystając z narzędzia dx konwertujemy plik JAR do pliku JAR, który zawiera bytecode przystosowany do maszyny DalvikVM. Otrzymany JAR jest zwykle ponad 2 razy mniejszy!</li> </ul> <p>Poza zmianą formatu bytecode'u, czeka nas również zmiana w działaniu wszystkich istotnych części systemu. Odpowiednie klasy dostarczone w bibliotece Androida pozwalają nam na tworzenie &quot;okien&quot;, zadań działających w tle, komunikowanie się z innymi procesami, dostęp do danych zapewnianych przez inne programy (np. książkę adresową), ustawień telefonu i sprzętu. Wszystko to jest opakowane przez zarządcę uprawnień, który przyznaje danej aplikacji prawa do różnych części systemu po uprzednim uzgodnieniu tego z użytkownikiem telefonu ;). W praktyce, wygląda to tak:</p> <ul> <li>twórca aplikacji definiuje w &quot;opisie&quot; aplikacji (plik AndroidManifest.xml) jakich uprawnień potrzebuje aplikacja (np. uprawnienie do wybierania numeru, uprawnienie do czytania z GPS-u, uprawnienie do uruchamiania aplikacji)</li> <li>użytkownik instalując aplikację przyznaje jej uprawnienia, o które aplikacja prosi. W przeciwnym razie instalacja nie dokonuje się</li> <li>aplikacja może robić cokolwiek zostało jej dozwolone, każde użycie niedozwolonej funkcji kończy się wyjątkiem</li> </ul> <p>Dostęp do ograniczanych zasobów odbywa się przez specjalne Androidowe API. Dostęp w inny sposób nie jest możliwy, ponieważ każda aplikacja jest uruchamiana z innym numerem użytkownika i w zupełnym odizolowaniu (pewnie coś podobnego do chroota) od innych aplikacji.</p> <p>Dostępna jest również komunikacja między aplikacjami. Ogólnie mówiąc jest to koncepcja podobna do D-BUS, jednak implementacja jest nieco inna.</p> <p>Inną ciekawą funkcją aplikacji pracujących w systemie Android jest ich gotowość do bycia zabitym w każdym momencie. Z racji ograniczenia ilości pamięci dostępnej dla systemu i mimo wszystko (pomimo sporego postępu względem Javy Suna) wysokiego zużycia pamięci przez aplikacje Javove, system zawiera mechanizm zabijania procesów w przypadku, gdy zaczyna brakować zasobów (CPU lub RAM).</p> <p>Każda aplikacja jednak może się przygotować na taką sytuację, ponieważ w momencie przykrycia aplikacji przez inną (kiedy to możliwe jest jej zabicie) wywołana jest metoda onStop (lub onPause w przypadku częściowego zakrycia), która umożliwia zrzut stanu aplikacji do systemowej bazy danych. Gdy użytkownik wraca do aplikacji (pomimo, że została w tle zabita, użytkownik wcale tego nie widzi), system ponownie uruchamia aplikację przywracając jej poprzedni stan. To jak aplikacja chce reprezentować swój stan zależy od samej aplikacji.</p> <p>Problemem maszyny Dalvik, podobnie jak i maszyny wirtualnej Javy Suna, to długi czas uruchamiania się (mniej niż sekunda na Twoim Pentium4? Aparat G1 jest ~10 razy wolniejszy). DalvikVM na telefonie HTC G1 uruchamia się około 5 sekund. Jest to problem tym bardziej, że każda aplikacja uruchamiana jest w swojej własnej instancji tej maszyny (w celach zapewnienia wymaganej izolacji).</p> <p>Tutaj do akcji wkracza specjalna usługa systemowa zygote, która jak tylko może przygotowuje proces maszyny wirtualnej Dalvik, który, gdy jest potrzeba zostaje oddany jakiemuś procesowi do natychmiastowego wykorzystania. Przez następne 5 sekund zygote znowu przygotowuje (kolejną) maszynę Dalvik i czeka aż jakiś proces o nią poprosi. Widać, że o ile nie uruchamiamy aplikacji częściej niż co pięć sekund, otrzymujemy złudzenie natychmiastowego uruchamiania aplikacji. Niezły trik.</p> <p>Widać, że inżynierzy pracujący nad systemem Android stawali na głowie, żeby wszystko było naprawdę dopracowane. Nie inaczej jest z dopieszczeniem programistów. Każdy, kto chce napisać swoją aplikację dla systemu Android może sobie ściągnąć Android-SDK, które zawiera emulator (oparty o QEmu) i narzędzia potrzebne do budowania (dx, apkbuild), i debugowania aplikacji.</p> <p>Dostępna jest również wtyczka do Eclipse'a o nazwie ADT (Android Developer Toolkit). Pozwala ona stworzyć aplikację dla Androida jednym kliknięciem, zbudować ją drugim, a uruchomić na wcześniej uruchomionym emulatorze trzecim :). Widziałem to w akcji i wygląda to naprawdę bardzo przyjemnie.</p> <p>Minusem Androida są trudności jakie niesie przeportowanie istniejących nie-androidowych aplikacji:</p> <ul> <li>aplikacje w C trzeba dolinkować do Google'owego bionic &#8212; lekka wersja biblioteki standardowej C &#8212; coś w stylu uclibc</li> <li>aplikacje w Javie mogą nie działać, bo używają rzeczy niezaimplementowanych w bibliotece Javy Dalvika</li> <li>GUI Androida jest zupełnie inne od każdego innego (oparte o pliki XML - zatem może trochę podobne do XUL-a). Zatem GUI w przypadku każdej aplikacji trzeba przepisać</li> </ul> <p>Naturalnym pytaniem, które się rodzi w czasie rozważań nad Androidem jest jego przyszłość. Choćby w porównaniu z iPhonem, którego w pierwszym miesiącu sprzedaży sprzedało się więcej niż wszystkich telefonów z Androidem na pokładzie. Zatem, co może przeważyć szalę zwycięstwa na stronę Androida? iPhone to jeden telefon (no konkretnie to dwa modele) i jeden software (no konkretnie to chyba trzy wersje). Android to otwarta platforma, która będzie stosowana nie tylko w telefonach firmowanych przez Google (póki co HTC G1 i G2), ale również przez inne telefony, takie jak FreeRunner (port i to całkiem dobrze działąjący na to urządzenie już dawno dostępny).</p> <p>Czołowi producenci tacy jak Samsung, czy Motorola planują wprowadzić do swojej oferty po 2-3 modele z Androidem. Do tego dochodzą netbooki, samochody (ktoś już portuje Androida na samochód), również odtwarzacze MP3, a być może i komputery stacjonarne. Możliwość uruchomienia aplikacji Androidowej na komputerze pracującym pod kontrolą Linuksa byłaby bardzo miła (zwłaszcza, że nie ma żadnych technicznych przeszkód). No i najważniejsze, ogromny wkład w rozwój Androida na platformach innych niż wspierane komercyjnie ma rosnąca społeczność deweloperów i testerów.</p> <p>Wiwat społeczność!</p> <h1><span>Podsumowanie</span></h1> <p>Ostatnie dwa dni w moim życiu pozwoliły na poszerzenie mojej wiedzy na temat technologii, które mogą w ciągu najbliższych 2 lat odmienić życie ludzi na naszej planecie. Oczywiście może się tak nie stać, ale samo poznawanie rzeczy, o których można powiedzieć &quot;dobrze przemyślane, dopracowane, świeże, potrzebne i pomysłowe&quot; przyprawia mnie o dreszczyk emocji.</p> <p>Muszę powiedzieć, że choć początkowo byłem sceptyczny wobec Androida, myślę teraz, że ma spore szanse za szybki rozwój i wielki (również komercyjny) sukces. Jak pamiętamy na samym spodzie architektury, zaraz nad sprzętem znajduje się jądro Linuksa. Niektóre jego modyfikacje dokonane na potrzeby telefonu trafiły do głównej (lub testowej) gałęzi kernela, co świadczy o dobrej jakości tych zmian.</p> <p>Pokazuje również, że praca nad tym systemem powoduje również szereg innych pożytecznych (choć pobocznych) zjawisk, co jest oczywiście bardzo budujące (i zupełnie nie występuje w przypadku zamkniętego oprogramowania).</p> <h1><span>Stop Cenzurze</span></h1> <p>Cały entuzjazm i moją ogólną radość mącą plany UE dotyczące ograniczenia dostępu do Internetu przez zmianę rozporządzeń europejskich, które są lobbowane przez duże firmy telekomunikacyjne, które prawdopodobnie mogą zwiększyć w ten sposób swoje zyski ze świadczenia usług internetowych i wykończyć małych providerów. Już raz Unia Europejska pokazała, że w sprawie informatycznej niezależności, potrafi się zachować w sposób rozsądny odrzucając propozycję wprowadzenia patentów na oprogramowanie. Miejmy nadzieję, że i tym razem nie zostanie ograniczona konkurencja w tym sektorze i kontrowersyjne rozwiązanie zostanie wyśmiane i zapomniane.</p> <p>O szczegółach można przeczytać na specjalnej stronie poświęconej temu zagadnieniu: <a href="http://stopcenzurze.wikidot.com/">http://stopcenzurze.wikidot.com/</a> . Można tam również okazać swoje poparcie dla akcji przez wirtualne podpisanie petycji.</p> <p>by <span class="printuser avatarhover"><a href="http://piotr.gabryjeluk.pl/profile2:2462" target="_blank"><img class="small" src="http://www.wikidot.com/avatar.php?userid=2462&amp;size=small&amp;timestamp=1328820322" alt="Gabrys" style="background-image:url(http://www.wikidot.com/userkarma.php?u=2462)" /></a><a href="http://piotr.gabryjeluk.pl/profile2:2462" target="_blank">Gabrys</a></span></p> 
				 	]]>
				</content:encoded>							</item>
				</channel>
</rss>
