<?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>codebyko.se</title>
	<atom:link href="http://codebyko.se/feed/" rel="self" type="application/rss+xml" />
	<link>http://codebyko.se</link>
	<description>N/A</description>
	<lastBuildDate>Tue, 08 May 2012 06:19:12 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>Set mtime with part of filename</title>
		<link>http://codebyko.se/2012/05/08/set-mtime-with-part-of-filename/</link>
		<comments>http://codebyko.se/2012/05/08/set-mtime-with-part-of-filename/#comments</comments>
		<pubDate>Tue, 08 May 2012 06:17:37 +0000</pubDate>
		<dc:creator>karloskar</dc:creator>
				<category><![CDATA[Okategoriserade]]></category>

		<guid isPermaLink="false">http://codebyko.se/?p=32</guid>
		<description><![CDATA[Needed to go through a directory of backuped files and set the mtime. The files had the format x-yymmdd.sql.gz A recent copying of the directory had removed the original mtime attributes (note to self: use rsync with -a flag next &#8230; <a href="http://codebyko.se/2012/05/08/set-mtime-with-part-of-filename/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Needed to go through a directory of backuped files and set the mtime. The files had the format <em>x-yymmdd.sql.gz</em> A recent copying of the directory had removed the original mtime attributes (note to self: use rsync with -a flag next time).</p>
<p>This one liner did the trick of converting them back to what they had:</p>
<pre>for f in *.sql.gz; do touch -d $(echo $f | \
sed "s/^\w\+-\([0-9]\{2\}\)\([0-9]\{2\}\)
\([0-9]\{2\}\).*/20\1-\2-\3/") $f; done</pre>
<p>Could this be improved? Most certainly. I havent figured out how to do repetitions in a good manner in regex</p>
]]></content:encoded>
			<wfw:commentRss>http://codebyko.se/2012/05/08/set-mtime-with-part-of-filename/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>MySQL round half even emulation</title>
		<link>http://codebyko.se/2011/10/05/mysql-round-half-even-emulation/</link>
		<comments>http://codebyko.se/2011/10/05/mysql-round-half-even-emulation/#comments</comments>
		<pubDate>Wed, 05 Oct 2011 13:17:16 +0000</pubDate>
		<dc:creator>karloskar</dc:creator>
				<category><![CDATA[Okategoriserade]]></category>

		<guid isPermaLink="false">http://codebyko.se/?p=15</guid>
		<description><![CDATA[I needed to emulate php&#8217;s PHP_ROUND_HALF_EVEN behaviour in mysql and did this: SELECT IF(MOD(col,2)=1.5), FLOOR(col), ROUND(col)) Where col is a float value. Edit: It seems as mysql&#8217;s ROUND() function does this per default. I should have read TFM.]]></description>
			<content:encoded><![CDATA[<p>I needed to emulate php&#8217;s PHP_ROUND_HALF_EVEN behaviour in mysql and did this:</p>
<p><code>SELECT IF(MOD(col,2)=1.5), FLOOR(col), ROUND(col))</p>
<p></code></p>
<p>Where <em>col</em> is a float value.</p>
<p><em>Edit: It seems as mysql&#8217;s ROUND() function does this per default. I should have read TFM.</em></p>
]]></content:encoded>
			<wfw:commentRss>http://codebyko.se/2011/10/05/mysql-round-half-even-emulation/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Bring focus to Empathy in Unity</title>
		<link>http://codebyko.se/2011/05/03/bring-focus-to-empathy-in-unity/</link>
		<comments>http://codebyko.se/2011/05/03/bring-focus-to-empathy-in-unity/#comments</comments>
		<pubDate>Tue, 03 May 2011 07:40:00 +0000</pubDate>
		<dc:creator>karloskar</dc:creator>
				<category><![CDATA[Okategoriserade]]></category>

		<guid isPermaLink="false">http://codebyko.se/?p=12</guid>
		<description><![CDATA[Thanks to xdotool and this blog post I&#8217;ve managed to bring up an IM conversation with a simple key binding. Totally awesome!]]></description>
			<content:encoded><![CDATA[<p>Thanks to <em>xdotool</em> and <a href="http://www.webupd8.org/2010/03/script-to-focus-pidgin-empathy.html">this blog post</a> I&#8217;ve managed to bring up an IM conversation with a simple key binding. Totally awesome<em>!<br />
</em></p>
]]></content:encoded>
			<wfw:commentRss>http://codebyko.se/2011/05/03/bring-focus-to-empathy-in-unity/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>tracd with upstart on Ubuntu</title>
		<link>http://codebyko.se/2010/11/26/tracd-with-upstart-on-ubuntu/</link>
		<comments>http://codebyko.se/2010/11/26/tracd-with-upstart-on-ubuntu/#comments</comments>
		<pubDate>Fri, 26 Nov 2010 12:10:41 +0000</pubDate>
		<dc:creator>karloskar</dc:creator>
				<category><![CDATA[Okategoriserade]]></category>
		<category><![CDATA[trac]]></category>
		<category><![CDATA[ubuntu]]></category>

		<guid isPermaLink="false">http://codebyko.se/?p=5</guid>
		<description><![CDATA[After spending too many hours trying to get tracd running as a daemon on Ubuntu 10.04 I might as well share my experiences. At first I begun with  some init.d scripts I found googling for tracd init.d. The problem with &#8230; <a href="http://codebyko.se/2010/11/26/tracd-with-upstart-on-ubuntu/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>After spending too many hours trying to get tracd running as a daemon on Ubuntu 10.04 I might as well share my experiences. At first I begun with  some init.d scripts I found <a href="http://www.google.com/search?q=trac+init.d">googling for tracd init.d</a>. The problem with them was that they were made to run <em>tracd</em> as <em>root</em> which frankly didn&#8217;t feel that great. I tried to modify them to use the &#8211;user/&#8211;chuid options to no avail. In the end I understood that the problem was not those options but that the pid file I was trying to use with the <em>tracd</em> command for some reason couldn&#8217;t be written.</p>
<p>These mishaps wasn&#8217;t only bad as I therefor started fiddling with <em>upstart</em>. <em>upstart</em> is a much more pleasant experience than classical init scripts. All I had to do was to create the file</p>
<pre>/etc/init/tracd.conf</pre>
<p>and put</p>
<pre>description "tracd server"
author "KO"

start on startup
stop on shutdown

expect daemon

script
        exec sudo -u www-data /usr/bin/tracd --daemonize --port=8000 \
	--hostname=127.0.0.1 -s /path/to/trac/project
end script
</pre>
<p>in it.</p>
<p>The key here was the <em>expect daemon </em>stanza which saved my day. After that you can use start|stop|status <em>processname</em> like:</p>
<pre>sudo start tracd</pre>
<p>Now you might wonder why I wanted to run tracd as a daemon. I was about to switch to <em>nginx</em> on the server running <em>trac</em> and the daemon way seemed the easiest.</p>
]]></content:encoded>
			<wfw:commentRss>http://codebyko.se/2010/11/26/tracd-with-upstart-on-ubuntu/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

