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

<channel>
	<title>László Monda's Blog &#187; My Code</title>
	<atom:link href="http://monda.hu/blog/category/hacking/my-code/feed/" rel="self" type="application/rss+xml" />
	<link>http://monda.hu/blog</link>
	<description>My reality. Be my guest.</description>
	<lastBuildDate>Tue, 08 Jun 2010 21:54:57 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>chnorm 0.3 released</title>
		<link>http://monda.hu/blog/2009/06/16/chnorm-03-released/</link>
		<comments>http://monda.hu/blog/2009/06/16/chnorm-03-released/#comments</comments>
		<pubDate>Tue, 16 Jun 2009 12:32:48 +0000</pubDate>
		<dc:creator>Laci</dc:creator>
				<category><![CDATA[Hacking]]></category>
		<category><![CDATA[My Code]]></category>

		<guid isPermaLink="false">http://monda.hu/blog/?p=454</guid>
		<description><![CDATA[You can fetch it while it's hot.
I've fixed the output of the --help option which crashed due to "invalid" characters in my accentuated name.  Thanks for Tamás for letting me know about this bug!
]]></description>
			<content:encoded><![CDATA[<p>You can fetch it <a href="http://monda.hu/chnorm">while it's hot</a>.</p>
<p>I've fixed the output of the --help option which crashed due to "invalid" characters in my accentuated name.  Thanks for Tamás for letting me know about this bug!</p>
]]></content:encoded>
			<wfw:commentRss>http://monda.hu/blog/2009/06/16/chnorm-03-released/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to make Konsole tab names always reflect the hostname of the current host</title>
		<link>http://monda.hu/blog/2008/08/23/how-to-make-konsole-tab-names-always-reflect-the-hostname-of-the-current-host/</link>
		<comments>http://monda.hu/blog/2008/08/23/how-to-make-konsole-tab-names-always-reflect-the-hostname-of-the-current-host/#comments</comments>
		<pubDate>Sat, 23 Aug 2008 20:47:53 +0000</pubDate>
		<dc:creator>Laci</dc:creator>
				<category><![CDATA[Hacking]]></category>
		<category><![CDATA[My Code]]></category>
		<category><![CDATA[My HOWTOs]]></category>

		<guid isPermaLink="false">http://monda.hu/blog/2008/08/23/how-to-make-konsole-tab-names-always-reflect-the-hostname-of-the-current-host/</guid>
		<description><![CDATA[
Put this script to some directory that precedes /usr/bin in $PATH, like /usr/local/bin to wrap ssh:

#!/bin/bash

if [ &#34;x$KONSOLE_DCOP_SESSION&#34; = &#34;x&#34; ]; then
    exec ssh $*
fi

function restore_old_session_name {
    dcop $KONSOLE_DCOP_SESSION renameSession &#34;$old_session_name&#34;
}

if [ &#34;x$KONSOLE_DCOP_SESSION&#34; != &#34;x&#34; ]; then
    old_session_name=`dcop $KONSOLE_DCOP_SESSION sessionName`
    hostname=&#34;${!#}&#34;  # [...]]]></description>
			<content:encoded><![CDATA[<p>
Put this script to some directory that precedes /usr/bin in $PATH, like /usr/local/bin to wrap ssh:
</p>
<pre>#!/bin/bash

if [ &quot;x$KONSOLE_DCOP_SESSION&quot; = &quot;x&quot; ]; then
    exec ssh $*
fi

function restore_old_session_name {
    dcop $KONSOLE_DCOP_SESSION renameSession &quot;$old_session_name&quot;
}

if [ &quot;x$KONSOLE_DCOP_SESSION&quot; != &quot;x&quot; ]; then
    old_session_name=`dcop $KONSOLE_DCOP_SESSION sessionName`
    hostname=&quot;${!#}&quot;  # we expect the last arg to ssh to be the hostname
fi

trap &quot;restore_old_session_name&quot; SIGINT SIGTERM

if [ &quot;x$KONSOLE_DCOP_SESSION&quot; != &quot;x&quot; ]; then
    if [ &quot;x$hostname&quot; != &quot;xecho FISH:; /bin/sh&quot; ]; then
        dcop $KONSOLE_DCOP_SESSION renameSession &quot;$hostname&quot;
    fi
fi

/usr/bin/ssh $*

if [ &quot;x$KONSOLE_DCOP_SESSION&quot; != &quot;x&quot; ]; then
    restore_old_session_name
fi
</pre>
<p><script type="text/javascript"><!--
google_ad_client = "pub-9739048726949699";
/* 468x60, created 2/26/08 */
google_ad_slot = "2835350041";
google_ad_width = 468;
google_ad_height = 60;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></p>
]]></content:encoded>
			<wfw:commentRss>http://monda.hu/blog/2008/08/23/how-to-make-konsole-tab-names-always-reflect-the-hostname-of-the-current-host/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Make Apple Trailers work with MPlayer plugin on Linux</title>
		<link>http://monda.hu/blog/2008/08/23/make-apple-trailers-work-with-mplayer-plugin-on-linux/</link>
		<comments>http://monda.hu/blog/2008/08/23/make-apple-trailers-work-with-mplayer-plugin-on-linux/#comments</comments>
		<pubDate>Sat, 23 Aug 2008 01:17:18 +0000</pubDate>
		<dc:creator>Laci</dc:creator>
				<category><![CDATA[Hacking]]></category>
		<category><![CDATA[My Code]]></category>

		<guid isPermaLink="false">http://monda.hu/blog/2008/08/23/make-apple-trailers-work-with-mplayer-plugin-on-linux/</guid>
		<description><![CDATA[
I&#039;ve just written a Greasemonkey script that does the above job.
]]></description>
			<content:encoded><![CDATA[<p>
I&#039;ve just written <a href="http://userscripts.org/scripts/show/32311" title="http://userscripts.org/scripts/show/32311">a Greasemonkey script</a> that does the above job.</p>
]]></content:encoded>
			<wfw:commentRss>http://monda.hu/blog/2008/08/23/make-apple-trailers-work-with-mplayer-plugin-on-linux/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Kill Right Click Blocking Copyright Monkeys!</title>
		<link>http://monda.hu/blog/2007/08/28/kill-right-click-blocking-copyright-monkeys/</link>
		<comments>http://monda.hu/blog/2007/08/28/kill-right-click-blocking-copyright-monkeys/#comments</comments>
		<pubDate>Tue, 28 Aug 2007 21:58:37 +0000</pubDate>
		<dc:creator>Laci</dc:creator>
				<category><![CDATA[Hacking]]></category>
		<category><![CDATA[My Code]]></category>

		<guid isPermaLink="false">http://monda.hu/blog/2007/08/28/kill-right-click-blocking-copyright-monkeys/</guid>
		<description><![CDATA[
Has it ever occured to you that you visited a site, wanted to do some mouse gestures and a nasty pop-up window said to you: &#034;This page is copyrighted.  You are not allowed to copy from my page.&#034;?


If your answer is yes, it&#039;s time to install my Greasemonkey extension.  Works well against most [...]]]></description>
			<content:encoded><![CDATA[<p>
Has it ever occured to you that you visited a site, wanted to do some mouse gestures and a nasty pop-up window said to you: &#034;<em>This page is copyrighted.  You are not allowed to copy from my page.</em>&#034;?
</p>
<p>
If your answer is yes, it&#039;s time to install <a href="http://userscripts.org/scripts/show/11694" title="http://userscripts.org/scripts/show/11694">my Greasemonkey extension</a>.  Works well against most of such pages.</p>
]]></content:encoded>
			<wfw:commentRss>http://monda.hu/blog/2007/08/28/kill-right-click-blocking-copyright-monkeys/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Goodbye Feedy, Greetings Google Reader!</title>
		<link>http://monda.hu/blog/2007/07/26/goodbye-feedy-greetings-google-reader/</link>
		<comments>http://monda.hu/blog/2007/07/26/goodbye-feedy-greetings-google-reader/#comments</comments>
		<pubDate>Thu, 26 Jul 2007 21:29:01 +0000</pubDate>
		<dc:creator>Laci</dc:creator>
				<category><![CDATA[Hacking]]></category>
		<category><![CDATA[My Code]]></category>

		<guid isPermaLink="false">http://laci.monda.hu/blog/2007/07/26/goodbye-feedy-greetings-google-reader/</guid>
		<description><![CDATA[
I&#039;ve recently trashed my feed reader, Feedy.  I started it about a half year ago, but it took too much time to maintain it.  I knew about Google Reader for a long time, but I didn&#039;t like it&#039;s interface.  Now that I use it for two weeks I have no doubts about [...]]]></description>
			<content:encoded><![CDATA[<p>
I&#039;ve recently trashed my feed reader, Feedy.  I started it about a half year ago, but it took too much time to maintain it.  I knew about Google Reader for a long time, but I didn&#039;t like it&#039;s interface.  Now that I use it for two weeks I have no doubts about its superior usability.  I&#039;m very satisfied with it.
</p>
<p>
Although I doubt anyone would use Feedy, I put it out, because I think it has a nice UI and a good database layout that prevents feed duplication pretty effectively so it may be a good base for developing a more robust feed reader.<br />
<script type="text/javascript"><!--
google_ad_client = "pub-9739048726949699";
/* 468x60, created 2/26/08 */
google_ad_slot = "2835350041";
google_ad_width = 468;
google_ad_height = 60;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
</p>
<p>
<a href="http://monda.hu/blog/wp-content/feedy.tar.bz2" class="wikilink2" title="feedy.tar.bz2">feedy.tar.bz2</a> is not a release.  A release is a carefully compiled end product that is easy to install.  Feedy is not easy to install, but check out the README file for some information.
</p>
<p>
Lastly but not leastly here are some screenshots:
</p>
<p>
<center><br />
<a href="http://monda.hu/blog/wp-content/feedy-news-items.png"><img style="margin:10px auto; display:block;" src="http://monda.hu/blog/wp-content/feedy-news-items-thumb.png" alt="Image" /></a><br />
The news items screen
</p>
<p>
<a href="http://monda.hu/blog/wp-content/feedy-config.png"><img style="margin:10px auto; display:block;" src="http://monda.hu/blog/wp-content/feedy-config-thumb.png" alt="Image" /></a><br />
The config screen<br />
</center></p>
]]></content:encoded>
			<wfw:commentRss>http://monda.hu/blog/2007/07/26/goodbye-feedy-greetings-google-reader/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to Make Firefox Restore Your Session under Linux</title>
		<link>http://monda.hu/blog/2007/07/25/how-to-make-firefox-restore-your-session-under-linux/</link>
		<comments>http://monda.hu/blog/2007/07/25/how-to-make-firefox-restore-your-session-under-linux/#comments</comments>
		<pubDate>Tue, 24 Jul 2007 23:22:19 +0000</pubDate>
		<dc:creator>Laci</dc:creator>
				<category><![CDATA[Hacking]]></category>
		<category><![CDATA[My Code]]></category>
		<category><![CDATA[My HOWTOs]]></category>

		<guid isPermaLink="false">http://laci.monda.hu/blog/2007/07/25/how-to-make-firefox-restore-your-session-under-linux/</guid>
		<description><![CDATA[
When you restart your GNOME / KDE session, Firefox asks you the same boring question once again:





Seems familiar?


The reason it happens is that Firefox doesn&#039;t implement the X session protocol so every time you log out from your Linux desktop, Firefox gets mercilessly killed.  I don&#039;t plan to patch Firefox to implement X session [...]]]></description>
			<content:encoded><![CDATA[<p>
When you restart your GNOME / KDE session, Firefox asks you the same boring question once again:
</p>
<p>
<a href="http://monda.hu/blog/wp-content/firefox-restore-previous-session.png"><img style="margin:10px auto; display:block;" src="http://monda.hu/blog/wp-content/firefox-restore-previous-session-thumb.png" alt="Image" /></a>
</p>
<p>
Seems familiar?
</p>
<p>
The reason it happens is that Firefox doesn&#039;t implement the X session protocol so every time you log out from your Linux desktop, Firefox gets mercilessly killed.  I don&#039;t plan to patch Firefox to implement X session protocol, because I don&#039;t have the special knowledge and it&#039;d took too much time for me, but I present you a pretty good hack that works really nice.
</p>
<p>
Edit <code><strong>{your-firefox-directory}</strong>/components/nsSessionStartup.js</code> as follows:
</p>
<p>
<!--adsense-->
</p>
<p>
Original code:
</p>
<pre>// prompt and check prefs
this._doRestore = this._lastSessionCrashed ? this._doRecoverSession() : this._doResumeSession();
</pre>
<p>
Updated code:
</p>
<pre>// prompt and check prefs
var ignoreSessionCrash = this._getPref(&quot;sessionstore.ignore_session_crash&quot;, false);
this._doRestore = !ignoreSessionCrash &amp;&amp; this._lastSessionCrashed
                      ? this._doRecoverSession()
                      : this._doResumeSession();
</pre>
<p>
From now on if you want to always restore your session upon startup, you have to set the <code>sessionstore.ignore_session_crash</code> variable to <code>true</code> within the <code>about:config</code> page of Firefox (you have to type <code>about:config</code> in the address bar).
</p>
<p>
if Firefox keeps crashing due to an evil web page that is saved in your session, then you have to manually set the <code>sessionstore.ignore_session_crash</code> variable to <code>false</code> by editing the <code><strong>{your-home-directory}</strong>/.mozilla/firefox/{your-profile-dir}/prefs.js</code> file as follows:
</p>
<p>
original line: <code>user_pref(&#034;browser.sessionstore.ignore_session_crash&#034;, true);</code><br />
updated line: <code>user_pref(&#034;browser.sessionstore.ignore_session_crash&#034;, false);</code>
</p>
<p>
Good luck hacking your Firefox until the X session protocol gets implemented in it!</p>
]]></content:encoded>
			<wfw:commentRss>http://monda.hu/blog/2007/07/25/how-to-make-firefox-restore-your-session-under-linux/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to Automatize HTTP Requests Using Greasemonkey</title>
		<link>http://monda.hu/blog/2007/05/31/how-to-automatize-http-requests-using-greasemonkey/</link>
		<comments>http://monda.hu/blog/2007/05/31/how-to-automatize-http-requests-using-greasemonkey/#comments</comments>
		<pubDate>Thu, 31 May 2007 13:23:34 +0000</pubDate>
		<dc:creator>Laci</dc:creator>
				<category><![CDATA[Hacking]]></category>
		<category><![CDATA[My Code]]></category>
		<category><![CDATA[My HOWTOs]]></category>

		<guid isPermaLink="false">http://laci.monda.hu/blog/2007/05/31/how-to-automatize-http-requests-using-greasemonkey/</guid>
		<description><![CDATA[
There are some sites that I use daily.  The sad thing is, many of them don&#039;t provide me any mechanisms to log in automatically, so I have to always do it manually.  I also had to fill the same form in on these sites and carry on the same operation over and over [...]]]></description>
			<content:encoded><![CDATA[<p>
There are some sites that I use daily.  The sad thing is, many of them don&#039;t provide me any mechanisms to log in automatically, so I have to always do it manually.  I also had to fill the same form in on these sites and carry on the same operation over and over again.  This was very frustrating for me so I decided to come up with a solution.  <a href="http://www.greasespot.net/" title="http://www.greasespot.net/">Greasemonkey</a> seemed to have the potential to solve my burning need.
</p>
<p>
I want to share the core function I&#039;ve written that can help you in such scenarios.  It&#039;s a simple, but very useful one.
</p>
<p>
<!--adsense-->
</p>
<pre>function submit_form(method, action, elements, target)
{
    var form = document.createElement('form');
    document.body.appendChild(form);
    form.method = method;
    form.action = action;
    for (element_i in elements) {
        var element = document.createElement('input');
        element.setAttribute('type', 'hidden');
        element.setAttribute('name', element_i);
        element.setAttribute('value', elements[element_i]);
        form.appendChild(element);
    }
    if (target) {
        form.target = target;
    }
    form.submit();
}
</pre>
<p>
Requests are typically triggered based on the content of <code>window.location.href</code> or <code>document.referrer</code>.
</p>
<p>
Greasemonkey has some <a href="http://userscripts.org/forums/1/topics/499" title="http://userscripts.org/forums/1/topics/499">ugly annoyances</a>, but fortunately most of them can be <a href="http://www.oreillynet.com/pub/a/network/2005/11/01/avoid-common-greasemonkey-pitfalls.html" title="http://www.oreillynet.com/pub/a/network/2005/11/01/avoid-common-greasemonkey-pitfalls.html">worked around</a>.  The <a href="http://livehttpheaders.mozdev.org/" title="http://livehttpheaders.mozdev.org/">LiveHTTPHeaders</a> add-on can also help you tremendously constructing the fields of the forms.</p>
]]></content:encoded>
			<wfw:commentRss>http://monda.hu/blog/2007/05/31/how-to-automatize-http-requests-using-greasemonkey/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Symlinker 0.0.2 Released</title>
		<link>http://monda.hu/blog/2007/05/20/symlinker-002-released/</link>
		<comments>http://monda.hu/blog/2007/05/20/symlinker-002-released/#comments</comments>
		<pubDate>Sun, 20 May 2007 19:55:45 +0000</pubDate>
		<dc:creator>Laci</dc:creator>
				<category><![CDATA[Hacking]]></category>
		<category><![CDATA[My Code]]></category>

		<guid isPermaLink="false">http://laci.monda.hu/blog/2007/05/20/symlinker-002-released/</guid>
		<description><![CDATA[
It&#039;s a small bugfix release.
]]></description>
			<content:encoded><![CDATA[<p>
It&#039;s a small bugfix <a href="http://laci.monda.hu/symlinker" title="http://laci.monda.hu/symlinker">release</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://monda.hu/blog/2007/05/20/symlinker-002-released/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Symlinker 0.0.1 Released</title>
		<link>http://monda.hu/blog/2007/05/09/symlinker-001-released/</link>
		<comments>http://monda.hu/blog/2007/05/09/symlinker-001-released/#comments</comments>
		<pubDate>Wed, 09 May 2007 12:21:34 +0000</pubDate>
		<dc:creator>Laci</dc:creator>
				<category><![CDATA[Hacking]]></category>
		<category><![CDATA[My Code]]></category>

		<guid isPermaLink="false">http://laci.monda.hu/blog/2007/05/09/symlinker-001-released/</guid>
		<description><![CDATA[
I&#039;ve just released Symlinker 0.0.1.  Symlinker is a minimalistic PHP file manager that is built to primarily operate with symlinks.  Read more about it on its project page.
]]></description>
			<content:encoded><![CDATA[<p>
I&#039;ve just released Symlinker 0.0.1.  Symlinker is a minimalistic <acronym title="Hypertext Preprocessor">PHP</acronym> file manager that is built to primarily operate with symlinks.  Read more about it on <a href="http://laci.monda.hu/symlinker" title="http://laci.monda.hu/symlinker">its project page</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://monda.hu/blog/2007/05/09/symlinker-001-released/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Power 0.2.2 Released</title>
		<link>http://monda.hu/blog/2007/03/16/power-022-released/</link>
		<comments>http://monda.hu/blog/2007/03/16/power-022-released/#comments</comments>
		<pubDate>Fri, 16 Mar 2007 00:39:44 +0000</pubDate>
		<dc:creator>Laci</dc:creator>
				<category><![CDATA[Hacking]]></category>
		<category><![CDATA[My Code]]></category>

		<guid isPermaLink="false">http://laci.monda.hu/blog/2007/03/16/power-022-released/</guid>
		<description><![CDATA[
I&#039;ve just released Power 0.2.2.  It&#039;s a small bugfix release.  Although this bug was small, it was an irritating one.
]]></description>
			<content:encoded><![CDATA[<p>
I&#039;ve just released <a href="http://laci.monda.hu/power" title="http://laci.monda.hu/power">Power</a> 0.2.2.  It&#039;s a small bugfix release.  Although this bug was small, it was an irritating one.</p>
]]></content:encoded>
			<wfw:commentRss>http://monda.hu/blog/2007/03/16/power-022-released/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
