<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0">

<channel>
	<title>Lukáš Lalinský</title>
	
	<link>http://oxygene.sk/lukas</link>
	<description>Random notes and stuff</description>
	<lastBuildDate>Tue, 02 Mar 2010 19:35:33 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/LukasLalinsky" /><feedburner:info uri="lukaslalinsky" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><item>
		<title>Fun with timestamps</title>
		<link>http://feedproxy.google.com/~r/LukasLalinsky/~3/j17nwTQYLwM/</link>
		<comments>http://oxygene.sk/lukas/2010/03/fun-with-timestamps/#comments</comments>
		<pubDate>Tue, 02 Mar 2010 19:32:56 +0000</pubDate>
		<dc:creator>Lukáš Lalinský</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[fail]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[stackoverflow]]></category>
		<category><![CDATA[timezone]]></category>

		<guid isPermaLink="false">http://oxygene.sk/lukas/?p=342</guid>
		<description><![CDATA[Some programming languages really encourage using UNIX timestamps for working with dates. PHP is a good example of such a language. Functions like date, strtotime, strftime are used all the time. Most people don&#8217;t realize that timestamps in general can&#8217;t really be used for calculations though. The problem is that most countries use daylight saving [...]]]></description>
			<content:encoded><![CDATA[<p>Some programming languages really encourage using <a href="http://en.wikipedia.org/wiki/Unix_time">UNIX timestamps</a> for working with dates. PHP is a good example of such a language. Functions like <a href="http://php.net/manual/en/function.date.php"><code>date</code></a>, <a href="http://php.net/manual/en/function.strtotime.php"><code>strtotime</code></a>, <a href="http://php.net/manual/en/function.strftime.php"><code>strftime</code></a> are used all the time. Most people don&#8217;t realize that timestamps in general can&#8217;t really be used for calculations though. The problem is that most countries use <a href="http://en.wikipedia.org/wiki/Daylight_saving_time">daylight saving time</a>, which means that two times a year the local timezone changes. This nicely breaks the assumption that every day has 24 hours. It doesn&#8217;t. Sometimes it has 23 or 25 hours.</p>
<p>This <a href="http://stackoverflow.com/questions/2361222/php-date-function-finding-the-previous-week/2361335#2361335">StackOverflow answer</a> is a nice example of the problem:</p>
<pre>
$mondayStr = "last monday";
if (date('N') !== '1') {  // it's not Monday today
    $mondayStr .= " last week";
}

$monday = strtotime($mondayStr);
echo date('r', $monday);    // Mon, 22 Feb 2010 00:00:00 +1000

$sunday = $monday + 86400 * 7 - 1;
echo date('r', $sunday);    // Sun, 28 Feb 2010 23:59:59 +1000
</pre>
<p>The code seems logical. Get the timestamp of the last Monday, add 60 * 60 * 24 * 7 &#8211; 1 seconds and you have the end of Sunday. Works fine most of the time. Although, if the <code>$monday</code> happens to be <em>Mon, 22 Mar 2010 00:00:00</em>, the date that was supposed to be <em>Sun, 28 Mar 2010  23:59:59</em> will actually be <em>Mon, 29 Mar 2010 00:59:59</em>. Why? Because 28 March 2010 has only 23 hours.</p>
<p>Never use timestamps to do calendar calculations. It&#8217;s hard to get it right. If you really have to, at least use GMT timestamps.</p>
<img src="http://feeds.feedburner.com/~r/LukasLalinsky/~4/j17nwTQYLwM" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://oxygene.sk/lukas/2010/03/fun-with-timestamps/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://oxygene.sk/lukas/2010/03/fun-with-timestamps/</feedburner:origLink></item>
		<item>
		<title>Database Modeller 0.3</title>
		<link>http://feedproxy.google.com/~r/LukasLalinsky/~3/iD99I43iGc8/</link>
		<comments>http://oxygene.sk/lukas/2010/01/database-modeller-0-3/#comments</comments>
		<pubDate>Sun, 24 Jan 2010 08:41:06 +0000</pubDate>
		<dc:creator>Lukáš Lalinský</dc:creator>
				<category><![CDATA[Announce]]></category>
		<category><![CDATA[Database Modeller]]></category>
		<category><![CDATA[dbmodel]]></category>
		<category><![CDATA[release]]></category>

		<guid isPermaLink="false">http://oxygene.sk/lukas/?p=320</guid>
		<description><![CDATA[Database Modeller 0.3 has been released. There isn&#8217;t as many changes as I wanted, but the main changes were unreleased for almost half a year. You can download the source code and Windows installer on the project page.
Changes since version 0.2:

PDF export
Support for printing
Opening of files passed through the command line arguments (Bug #401595)
The recently [...]]]></description>
			<content:encoded><![CDATA[<p>Database Modeller 0.3 has been released. There isn&#8217;t as many changes as I wanted, but the main changes were unreleased for almost half a year. You can download the source code and Windows installer on the <a href="http://oxygene.sk/lukas/projects/dbmodel/">project page</a>.</p>
<p>Changes since version 0.2:</p>
<ul>
<li>PDF export</li>
<li>Support for printing</li>
<li>Opening of files passed through the command line arguments (<a href="https://bugs.launchpad.net/dbmodel/+bug/">Bug #401595</a>)</li>
<li>The recently used files list now always uses absolute paths</li>
<li>Implemented auto-scrolling in the diagram view (<a href="https://bugs.launchpad.net/dbmodel/+bug/420324">Bug #420324</a>)</li>
<li>The &#8220;Close&#8221; menu item will now only close the document, not the window (<a href="https://bugs.launchpad.net/dbmodel/+bug/420322">Bug #420322</a>)</li>
<li>Use the selected file format in the export dialog, instead of relying only on the extension (<a href="https://bugs.launchpad.net/dbmodel/+bug/396056">Bug #396056</a>)</li>
</ul>
<img src="http://feeds.feedburner.com/~r/LukasLalinsky/~4/iD99I43iGc8" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://oxygene.sk/lukas/2010/01/database-modeller-0-3/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://oxygene.sk/lukas/2010/01/database-modeller-0-3/</feedburner:origLink></item>
		<item>
		<title>Mercurial, part 1</title>
		<link>http://feedproxy.google.com/~r/LukasLalinsky/~3/c-rf4FGZBDs/</link>
		<comments>http://oxygene.sk/lukas/2010/01/mercurial-part-1/#comments</comments>
		<pubDate>Sat, 23 Jan 2010 08:00:38 +0000</pubDate>
		<dc:creator>Lukáš Lalinský</dc:creator>
				<category><![CDATA[Rants]]></category>
		<category><![CDATA[Tools]]></category>
		<category><![CDATA[fail]]></category>
		<category><![CDATA[hg]]></category>
		<category><![CDATA[mercurial]]></category>

		<guid isPermaLink="false">http://oxygene.sk/lukas/?p=283</guid>
		<description><![CDATA[I&#8217;ve been using Mercurial at work for two months now and the expectations I had about it didn&#8217;t change to anything better. I guess it looks cool for people who are used to SVN, or even CVS, and are not familiar with other DVCS. I must say that as a Bazaar user, I miss a [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been using Mercurial at work for two months now and the expectations I had about it didn&#8217;t change to anything better. I guess it looks cool for people who are used to SVN, or even CVS, and are not familiar with other DVCS. I must say that as a Bazaar user, I miss a lot of things. There are some that can be worked around, for something you just have to be extra careful and for something you are out of luck. I really don&#8217;t get how people use Mercurial for managing large projects.</p>
<h3>Cheap Branches</h3>
<p>One of the main reason people use DVCS is cheap branching. The most surprising thing for me was that Mercurial doesn&#8217;t offer many choices. It doesn&#8217;t have the concept of branches, like Bazaar or Git. All you have is an immutable repository that can contain multiple head revisions. By default, you are expected to clone the whole repository. As <a href="http://oxygene.sk/lukas/2009/10/working-with-branches-in-bazaar/">I mentioned earlier</a>, I tend to work with many feature branches, so I prefer to have just one working tree.</p>
<p>One way to partially solve this problem is the <a href="http://mercurial.selenic.com/wiki/BookmarksExtension">bookmarks extension</a>. It basically allows you to have dynamic tags that move to new revisions as you commit. The initial configuration looks like this:</p>
<pre>[extensions]
bookmarks =
[bookmarks]
track.current = True</pre>
<p>The next step is to go to your clone and set the main/trunk/master/etc. bookmark:</p>
<pre>hg bookmark main</pre>
<p>This is necessary, so that you easily know which revisions represents the project&#8217;s &#8220;mainline&#8221;. With the configuration I mentioned, the extension will track your current bookmark and update only that one. To set the current bookmark, you can use update:</p>
<pre>hg up -r main</pre>
<p>It&#8217;s important to always have the current bookmark set to <em>main</em> whenever you are fetching changes from the mainline. Otherwise you will have to manually fix the bookmark&#8217;s revision.</p>
<p>Creating new &#8220;feature branches&#8221; is easy then:</p>
<pre>hg bookmark -r main my-feature
hg up -r my-feature</pre>
<p>One important thing to remember is that after you use this, the repository will contain multiple heads. This means you can&#8217;t use plain <code>hg push</code> to push changes to remote repositories. You always have to specify the revision, for example:</p>
<pre>hg push -r main https://hg.example.com/projects/trunk</pre>
<h3>Merging</h3>
<p>When it comes to merging, Mercurial doesn&#8217;t make your life easier at all. The default assumption is that visual merging is the preferred way to go. Maybe I&#8217;m just too stupid, but I don&#8217;t get visual merge tools. I just don&#8217;t know how to use them. I prefer merging changes manually in my text editor, after I see the changes for the whole project. Mercurial would start up the merge tool for each file linearly, which means you don&#8217;t have a global picture of impact on the project, when you are supposed to resolve a merge. I just can&#8217;t work that way.</p>
<p>Fortunately, Mercurial does have an internal three-way merge algorithm, that can leave conflict markers in the merged files and let me do my job. You can configure it this way:</p>
<pre>[ui]
merge = internal:merge</pre>
<p>This actually uses the merge code from Bazaar, so I expected I&#8217;ll be done quickly. There is one problem though. Instead of using patience diff, like Bazaar, it uses its own diff algorithm. The result is that in Bazaar the algorithm works just fine, in Mercurial it produces horrible results. That&#8217;s actually pretty funny, considering the fact that I used ideas from Mercurial&#8217;s diff code to implement the C version of patience diff in Bazaar.</p>
<p>Next step, the <a href="http://mercurial.selenic.com/wiki/MergeProgram">Mercurial wiki</a> suggests <code>diff3</code> as a possible non-interactive merge tool. There are no examples how to configure it, but something like this technically works:</p>
<pre>[ui]
merge = diff3
[merge-tools]
diff3.args = -m $local $base $other &gt; $output</pre>
<p>In my experience, this produces even worse results than <code>internal:merge</code>, so there is no reason to use it.</p>
<p>The last idea was to use the <code>merge</code> program from <a href="http://www.gnu.org/software/rcs/">RCS</a> (yes, that&#8217;s right, using an ancient VCS to fix issues in a &#8220;modern&#8221; VCS). I must say that installing RCS in 2010 feels weird, but as long as I can get my job done&#8230; Once it was installed, I used this configuration:</p>
<pre>[ui]
merge = merge</pre>
<p>I was surprised that the results were acceptably good. Not perfect, but I knew I can&#8217;t expect more from a three-way merge. Ideally I&#8217;d like Bazaar&#8217;s merge algorithm with patience diff, but I probably won&#8217;t find time to port it, so <code>merge</code> will stay as my default merge tool for some time.</p>
<p>That&#8217;s only the first part of the problem though. Now you have files with conflict markers and you need to resolve them. Based on my experience with other version control systems, I assumed conflicts would be listed in <code>hg status</code>, but I was wrong. They are nicely hidden here:</p>
<pre>hg resolve -l | grep '^U'</pre>
<p>After manually resolving the conflicts, you can use the following command to mark the files as resolved:</p>
<pre>hg resolve -m path/to/file</pre>
<p><em>To be continued&#8230;</em></p>
<img src="http://feeds.feedburner.com/~r/LukasLalinsky/~4/c-rf4FGZBDs" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://oxygene.sk/lukas/2010/01/mercurial-part-1/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		<feedburner:origLink>http://oxygene.sk/lukas/2010/01/mercurial-part-1/</feedburner:origLink></item>
		<item>
		<title>Redirect HTTP requests to HTTPS in Apache</title>
		<link>http://feedproxy.google.com/~r/LukasLalinsky/~3/NpQBKIW9KGM/</link>
		<comments>http://oxygene.sk/lukas/2010/01/redirect-http-requests-to-https-in-apache/#comments</comments>
		<pubDate>Tue, 12 Jan 2010 18:20:26 +0000</pubDate>
		<dc:creator>Lukáš Lalinský</dc:creator>
				<category><![CDATA[Tools]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[mod_rewrite]]></category>
		<category><![CDATA[snippet]]></category>
		<category><![CDATA[web]]></category>

		<guid isPermaLink="false">http://oxygene.sk/lukas/?p=271</guid>
		<description><![CDATA[One more short snippet, that might be useful to me in the future. If you have a website served by Apache and want your clients to only use HTTPS, you can use this mod_rewrite configuration:
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [L]
If the server then gets any HTTP request, it will redirect the client to the [...]]]></description>
			<content:encoded><![CDATA[<p>One more short snippet, that might be useful to me in the future. If you have a website served by Apache and want your clients to only use HTTPS, you can use this <a href="http://httpd.apache.org/docs/2.0/mod/mod_rewrite.html">mod_rewrite</a> configuration:</p>
<pre>RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [L]</pre>
<p>If the server then gets any HTTP request, it will redirect the client to the same URL, but with the <code>https</code> scheme. This means that actual requests will be only ever served via HTTPS.</p>
<img src="http://feeds.feedburner.com/~r/LukasLalinsky/~4/NpQBKIW9KGM" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://oxygene.sk/lukas/2010/01/redirect-http-requests-to-https-in-apache/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://oxygene.sk/lukas/2010/01/redirect-http-requests-to-https-in-apache/</feedburner:origLink></item>
		<item>
		<title>Technical book authors</title>
		<link>http://feedproxy.google.com/~r/LukasLalinsky/~3/w-9-NcFCKWA/</link>
		<comments>http://oxygene.sk/lukas/2010/01/technical-book-authors/#comments</comments>
		<pubDate>Wed, 06 Jan 2010 12:56:27 +0000</pubDate>
		<dc:creator>Lukáš Lalinský</dc:creator>
				<category><![CDATA[Rants]]></category>
		<category><![CDATA[ego]]></category>
		<category><![CDATA[fail]]></category>
		<category><![CDATA[rant]]></category>
		<category><![CDATA[stackoverflow]]></category>

		<guid isPermaLink="false">http://oxygene.sk/lukas/?p=260</guid>
		<description><![CDATA[To be honest, I don&#8217;t read technical books much. I prefer reading the official documentation for a product I need to work with, or use some other ways to get information about it. I always assumed people who write such books are experts though. There are many book authors on Stack Overflow, but today I [...]]]></description>
			<content:encoded><![CDATA[<p>To be honest, I don&#8217;t read technical books much. I prefer reading the official documentation for a product I need to work with, or use some other ways to get information about it. I always assumed people who write such books are experts though. There are many book authors on Stack Overflow, but today I encountered a particularly interesting situation with one of them.</p>
<p>Somebody asked a <a href="http://stackoverflow.com/questions/1993050/how-can-i-set-the-output-file-for-perls-filefetch">question about a Perl module</a> a few days ago and based on reading the source code of the module, I gave them one possible way to solve the problem. Today, <a href="http://stackoverflow.com/users/8817/brian-d-foy">an author of multiple Perl books</a> came in and very confidently claimed that my solution will never work. I explained him why he is wrong, but it didn&#8217;t help. The problem was that he failed to read the source code correctly and made incorrect assumptions based on that. I pointed him to specific parts of the code, still nothing. At that point I wanted to gave up, but later he came up with a broken example, which didn&#8217;t work for different reasons, that should show me why I&#8217;m wrong. Soon after that he realized what is wrong about the example, changed his answer and deleted all his old comments, as if they never happened.</p>
<p>The problem I see is not this specific case (I&#8217;ve seen far more of them, either on Stack Overflow or some IRC channels), but the fact that even average programmers write popular programming books. And people learn from these books. I guess the saying about teachers who failed to apply their knowledge in practice, which I can&#8217;t remember right now, applies even for book authors. What a wonderful world.</p>
<p><em>(I just needed to get this out of myself.)</em></p>
<img src="http://feeds.feedburner.com/~r/LukasLalinsky/~4/w-9-NcFCKWA" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://oxygene.sk/lukas/2010/01/technical-book-authors/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://oxygene.sk/lukas/2010/01/technical-book-authors/</feedburner:origLink></item>
		<item>
		<title>Using UTF-8 with fithesis</title>
		<link>http://feedproxy.google.com/~r/LukasLalinsky/~3/QZFl_m6_c5k/</link>
		<comments>http://oxygene.sk/lukas/2009/12/using-utf-8-with-fithesis/#comments</comments>
		<pubDate>Sat, 26 Dec 2009 16:09:29 +0000</pubDate>
		<dc:creator>Lukáš Lalinský</dc:creator>
				<category><![CDATA[Tools]]></category>
		<category><![CDATA[fi mu]]></category>
		<category><![CDATA[fithesis]]></category>
		<category><![CDATA[latex]]></category>
		<category><![CDATA[tex]]></category>

		<guid isPermaLink="false">http://oxygene.sk/lukas/?p=252</guid>
		<description><![CDATA[My faculty has it&#8217;s own thesis LaTex style, which makes it very easy to get a decent looking thesis out of LaTeX without too much effort. The problem is that the style requires you to use ISO-8859-2 in your document, which is something I can&#8217;t really live with. :) Here are instructions how to convert [...]]]></description>
			<content:encoded><![CDATA[<p>My faculty has it&#8217;s own <a href="http://www.fi.muni.cz/~xpavlov/fithesis/">thesis LaTex style</a>, which makes it very easy to get a decent looking thesis out of LaTeX without too much effort. The problem is that the style requires you to use ISO-8859-2 in your document, which is something I can&#8217;t really live with. :) Here are instructions how to convert the style to UTF-8. I&#8217;m posting them here in hope that it will help some other student of <a href="http://www.fi.muni.cz/index.xhtml.en">Faculty of Informatics, Masaryk University</a> in the future.</p>
<p>I&#8217;m doing this on an Ubuntu laptop, so first I&#8217;ll need LaTeX:</p>
<pre>sudo apt-get install texlive</pre>
<p>Then download fithesis:</p>
<pre>wget http://www.fi.muni.cz/~xpavlov/fithesis/install.sh
wget http://www.fi.muni.cz/~xpavlov/fithesis/fithesis-0.2.12.tar.gz
tar -zxvf fithesis-0.2.12.tar.gz
cd fithesis-0.2.12</pre>
<p>Convert the sources to UTF-8 and change the package options in the file:</p>
<pre>recode latin2..utf8 fithesis.dtx
sed -i 's/latin2/utf8/' fithesis.dtx</pre>
<p>And now we can install it:</p>
<pre>cd ..
chmod a+x install.sh
./install.sh 0.2.12 /usr/share</pre>
<p>At this point you can use the package in your UTF-8 encoded LaTeX document.</p>
<img src="http://feeds.feedburner.com/~r/LukasLalinsky/~4/QZFl_m6_c5k" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://oxygene.sk/lukas/2009/12/using-utf-8-with-fithesis/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://oxygene.sk/lukas/2009/12/using-utf-8-with-fithesis/</feedburner:origLink></item>
		<item>
		<title>Resizing a LVM swap volume</title>
		<link>http://feedproxy.google.com/~r/LukasLalinsky/~3/7hoZl89fQnM/</link>
		<comments>http://oxygene.sk/lukas/2009/12/resizing-a-lvm-swap-volume/#comments</comments>
		<pubDate>Wed, 16 Dec 2009 19:33:40 +0000</pubDate>
		<dc:creator>Lukáš Lalinský</dc:creator>
				<category><![CDATA[Tools]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[lvextend]]></category>
		<category><![CDATA[lvm]]></category>
		<category><![CDATA[snippet]]></category>
		<category><![CDATA[swap]]></category>

		<guid isPermaLink="false">http://oxygene.sk/lukas/?p=238</guid>
		<description><![CDATA[Another post mainly for myself, just so I know where to find the information quickly the next time I need it. If you have swap on a LVM volume, these commands can be used to resize it (in this case, increase by 100MB):
swapoff /dev/vg_foo/lv_swap
lvextend -L+100M /dev/vg_foo/lv_swap
mkswap /dev/vg_foo/lv_swap
swapon /dev/vg_foo/lv_swap
That is: disable swapping on the volume, extend [...]]]></description>
			<content:encoded><![CDATA[<p>Another post mainly for myself, just so I know where to find the information quickly the next time I need it. If you have swap on a LVM volume, these commands can be used to resize it (in this case, increase by 100MB):</p>
<pre>swapoff /dev/vg_foo/lv_swap
lvextend -L+100M /dev/vg_foo/lv_swap
mkswap /dev/vg_foo/lv_swap
swapon /dev/vg_foo/lv_swap</pre>
<p>That is: disable swapping on the volume, extend it, re-create the swap area and enable swapping again.</p>
<img src="http://feeds.feedburner.com/~r/LukasLalinsky/~4/7hoZl89fQnM" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://oxygene.sk/lukas/2009/12/resizing-a-lvm-swap-volume/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://oxygene.sk/lukas/2009/12/resizing-a-lvm-swap-volume/</feedburner:origLink></item>
		<item>
		<title>Redirect to Google’s OpenID</title>
		<link>http://feedproxy.google.com/~r/LukasLalinsky/~3/irM2MbqhMlg/</link>
		<comments>http://oxygene.sk/lukas/2009/12/redirect-to-googles-openid/#comments</comments>
		<pubDate>Sat, 12 Dec 2009 11:02:27 +0000</pubDate>
		<dc:creator>Lukáš Lalinský</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[google]]></category>
		<category><![CDATA[openid]]></category>
		<category><![CDATA[xrds]]></category>

		<guid isPermaLink="false">http://oxygene.sk/lukas/?p=241</guid>
		<description><![CDATA[I&#8217;ve started using OpenID some time ago and I really like it. I was surprised that large companied like Google or Yahoo! are OpenID providers and that made me to try using Google&#8217;s OpenID. The first site I logged in to was Stack Overflow, which has nice buttons for major providers, so that was easy. [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve started using OpenID some time ago and I really like it. I was surprised that large companied like <a href="http://code.google.com/intl/sk/apis/accounts/docs/OpenID.html">Google</a> or <a href="http://openid.yahoo.com/">Yahoo!</a> are OpenID providers and that made me to try using Google&#8217;s OpenID. The first site I logged in to was <a href="http://stackoverflow.com/">Stack Overflow</a>, which has nice buttons for major providers, so that was easy. The problem was when I first needed to log in to a site without such buttons. After some searching I&#8217;ve found out that the Google OpenID end-point is <a href="https://www.google.com/accounts/o8/id">https://www.google.com/accounts/o8/id</a>, but I had to search for it every single time I needed it. Every time I find it I think it shouldn&#8217;t not that hard to remember the URL, but the next time I need it I just can&#8217;t remember it.</p>
<p>So I thought about switching to using my own URL as my OpenID, but I didn&#8217;t want to run my own provider server. OpenID supports delegation, so normally it would be a matter of adding two lines of HTML code to the header of this blog and I could use Google&#8217;s OpenID server with my own URL. The issue is with the way Google handles identities. The main URL <a href="https://www.google.com/accounts/o8/id">https://www.google.com/accounts/o8/id</a> is the same for everyone and Google will generate an unique OpenID for every combination of user and OpenID consumer. This is nice from privacy point of view, but it makes it impossible to use OpenID delegation, because in the delegation code I have to specify my OpenID. I can&#8217;t do that if my OpenID is different for every site I log in to.</p>
<p>I ended up with just adding this to the static HTML file I have on <a href="http://oxygene.sk/">http://oxygene.sk/</a>:</p>
<pre id="line1">&lt;<span>meta</span><span> http-equiv</span>=<span>"X-XRDS-Location" </span><span>content</span>=<span>"https://www.google.com/accounts/o8/id" </span><span><span>/</span></span>&gt;</pre>
<p>This means that every time I want to log in to an OpenID-enabled site, I can type in <a href="http://oxygene.sk/">http://oxygene.sk/</a> and it will use the same Google&#8217;s OpenID as before. Not exactly what I wanted initially, but it&#8217;s better than having to remember the long URL.</p>
<img src="http://feeds.feedburner.com/~r/LukasLalinsky/~4/irM2MbqhMlg" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://oxygene.sk/lukas/2009/12/redirect-to-googles-openid/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://oxygene.sk/lukas/2009/12/redirect-to-googles-openid/</feedburner:origLink></item>
		<item>
		<title>File names and Unicode</title>
		<link>http://feedproxy.google.com/~r/LukasLalinsky/~3/cagnZtkS-u8/</link>
		<comments>http://oxygene.sk/lukas/2009/12/file-names-and-unicode/#comments</comments>
		<pubDate>Sun, 06 Dec 2009 09:56:49 +0000</pubDate>
		<dc:creator>Lukáš Lalinský</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[encoding]]></category>
		<category><![CDATA[filesystem]]></category>
		<category><![CDATA[qstring]]></category>
		<category><![CDATA[TagLib]]></category>
		<category><![CDATA[unicode]]></category>
		<category><![CDATA[utf-8]]></category>

		<guid isPermaLink="false">http://oxygene.sk/lukas/?p=226</guid>
		<description><![CDATA[Dealing with file names in a cross-platform application is not easy. A question about using a file name in QString to create a new TagLib file came up on the TagLib development mailing list yesterday. The original problem was not related to Unicode, but after fixing one C++ issue, it ended up there. So, what [...]]]></description>
			<content:encoded><![CDATA[<p>Dealing with file names in a cross-platform application is not easy. A <a href="http://marc.info/?l=taglib-devel&amp;m=126003964003689&amp;w=2">question about using a file name in <code>QString</code> to create a new TagLib file</a> came up on the TagLib development mailing list yesterday. The original problem was not related to Unicode, but after fixing one C++ issue, it ended up there. So, what was wrong?</p>
<p><code>QString</code> represents an Unicode string. That is, an array of  <a href="http://en.wikipedia.org/wiki/Code_point">Unicode code-points</a>. The issue is that on most UN*X platforms, filesystems are not aware of Unicode. File names are stored as an array of bytes. The filesystems don&#8217;t care how are the bytes interpreted, but if applications want to display non-ASCII characters properly, they need to decode the bytes into Unicode. Since the filesystem itself doesn&#8217;t know the encoding, it&#8217;s necessary to look for the information somewhere else.</p>
<p>The user&#8217;s locale is probably the first place to look. If the user uses some encoding for input/output, it&#8217;s expectable that they use the same encoding for file names. This doesn&#8217;t always have to be the case, so GNOME for example uses a special environment variable named <a href="http://library.gnome.org/devel/glib/stable/glib-running.html#G_FILENAME_ENCODING"><code>G_FILENAME_ENCODING</code></a>. The problem is that all these solutions work globally for all filesystems. What if the main filesystem uses UTF-8 for everything, but the media player on which I sometimes upload files from Windows uses a different encoding? There is no way to tell applications that it should use CP-1250 for <code>/media/disk-1</code> and UTF-8 for everything else.</p>
<p>That&#8217;s not everything though. Seeing broken characters is not nice, but not a blocking problem either. What if the application can&#8217;t even read or write such files? That&#8217;s a much larger issue. If the application is using Unicode to store file names, but it can&#8217;t properly decode/decode the name, it won&#8217;t be able to access the file. The obvious solution is to ignore Unicode and just use byte arrays. This would work fine on UN*X, but new problems will show up if you are trying to write a cross-platform application. To be able to access all files on Windows, you have to do the exact opposite. You have to work with Unicode. On Mac you also have to work with Unicode, but it&#8217;s even more interesting, because the filesystem will do Unicode normalization for you. There is no solution that works in all cases on all platforms.</p>
<p>To summarize the situation:</p>
<ul>
<li>File names on UN*X are byte arrays. You don&#8217;t know their 	encoding, you can only guess. It&#8217;s safest to not treat them as 	Unicode. If you want to treat them as Unicode, use functions like 	<code><a href="http://doc.trolltech.com/4.5/qfile.html#decodeName-2">QFile::decodeName()</a></code> or <code><a href="http://library.gnome.org/devel/glib/unstable/glib-Character-Set-Conversion.html#g-filename-from-utf8">g_filename_from_utf8()</a></code> to do the guessing for you.</li>
<li>File names on Windows are in Unicode. You can work with them 	using UTF-16.</li>
<li>File names on Mac are in normalized Unicode. You can work 	with them using UTF-8, but you can&#8217;t just save any Unicode. The 	filesystem will normalize it to NFD for you.</li>
</ul>
<p>It&#8217;s sad to say, but I think this is one area where Windows is the nicest platform to deal with.</p>
<img src="http://feeds.feedburner.com/~r/LukasLalinsky/~4/cagnZtkS-u8" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://oxygene.sk/lukas/2009/12/file-names-and-unicode/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://oxygene.sk/lukas/2009/12/file-names-and-unicode/</feedburner:origLink></item>
		<item>
		<title>Stack Overflow Careers</title>
		<link>http://feedproxy.google.com/~r/LukasLalinsky/~3/HXTNRxbVgms/</link>
		<comments>http://oxygene.sk/lukas/2009/12/stack-overflow-careers/#comments</comments>
		<pubDate>Sat, 05 Dec 2009 08:13:12 +0000</pubDate>
		<dc:creator>Lukáš Lalinský</dc:creator>
				<category><![CDATA[Rants]]></category>
		<category><![CDATA[job]]></category>
		<category><![CDATA[rant]]></category>
		<category><![CDATA[stack overflow]]></category>

		<guid isPermaLink="false">http://oxygene.sk/lukas/?p=222</guid>
		<description><![CDATA[When I have some free time and I&#8217;m bored, I try to help people at Stack Overflow.  Recently the owners of Stack Overflow launched a site where you can post your CV, which are linked to your Stack Overflow account, and companies can search them. Nice idea. But the business model behind it makes it [...]]]></description>
			<content:encoded><![CDATA[<p>When I have some free time and I&#8217;m bored, I try to help people at <a href="http://stackoverflow.com/users/60950/lukas-lalinsky">Stack Overflow</a>.  Recently the owners of Stack Overflow launched a site where you can post your CV, which are linked to your Stack Overflow account, and companies can search them. Nice idea. But the business model behind it makes it horrible. <a href="http://www.joelonsoftware.com/items/2009/12/02.html">This blog post by Joel Spolsky</a> actually made me write this rant. Stack Overflow is obviously doing very good at getting money from ads. People answering questions over there actually make them money, as they increase the value of the site. (They still display ads even to those people, which is something I also don&#8217;t get, but with <a href="http://adblockplus.org/">Adblock Plus</a>, I don&#8217;t care.) The thing is that they charge job seekers for having their CV searchable within the site. The official reason for that is that they want to ensure that everybody who has their CV listed there is actively looking for a job. If that&#8217;s so, why are they raising the price from $29 to $99? $29 should do just as well for filtering the people who post their CV &#8220;just because they can&#8221;. I have real trouble imagining any competent programmer (who actively contributes to Stack Overflow, therefore makes sure they get their ad revenue) would want to pay to get his CV listed on the site. It&#8217;s not about the money though, it&#8217;s about the principle. I wouldn&#8217;t pay for such a service, just like I wouldn&#8217;t send my CV to a recruitment agency.</p>
<img src="http://feeds.feedburner.com/~r/LukasLalinsky/~4/HXTNRxbVgms" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://oxygene.sk/lukas/2009/12/stack-overflow-careers/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://oxygene.sk/lukas/2009/12/stack-overflow-careers/</feedburner:origLink></item>
	</channel>
</rss>
