<?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/"
	xmlns:georss="http://www.georss.org/georss" xmlns:gml="http://www.opengis.net/gml"
>

<channel>
	<title>inz&#039;s blog &#187; geeky</title>
	<atom:link href="http://inz.fi/blog/category/geeky/feed/" rel="self" type="application/rss+xml" />
	<link>http://inz.fi/blog</link>
	<description>inz&#039;s blog about life, universe and everything</description>
	<lastBuildDate>Wed, 12 Sep 2012 16:29:04 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.5.1</generator>
		<item>
		<title>Unsigned long long and gmplib</title>
		<link>http://inz.fi/blog/2011/09/23/unsigned-long-long-and-gmplib/</link>
		<comments>http://inz.fi/blog/2011/09/23/unsigned-long-long-and-gmplib/#comments</comments>
		<pubDate>Fri, 23 Sep 2011 15:19:22 +0000</pubDate>
		<dc:creator>inz</dc:creator>
				<category><![CDATA[geeky]]></category>

		<guid isPermaLink="false">http://inz.fi/blog/?p=189</guid>
		<description><![CDATA[While doing some projecteuler's, I wanted to convert an unsigned long long (64-bit unsigned integer on an 32-bit machine) to mpz_t (and possible vice versa). The API does not have a convenient method for this, but it is possible using the mpz_import and mpz_export; it goes something like this: mpz_t mp; unsigned long long ull [...]]]></description>
				<content:encoded><![CDATA[<p>
 While doing some projecteuler's, I wanted to convert an unsigned long long (64-bit unsigned integer on an 32-bit machine) to mpz_t (and possible vice versa). The API does not have a convenient method for this, but it is possible using the mpz_import and mpz_export; it goes something like this:
</p>
<div class="codecolorer-container c twitlight" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;"><div class="c codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">mpz_t mp<span style="color: #339933;">;</span><br />
<span style="color: #993333;">unsigned</span> <span style="color: #993333;">long</span> <span style="color: #993333;">long</span> ull <span style="color: #339933;">=</span> <span style="color: #0000dd;">42</span><span style="color: #339933;">;</span><br />
<br />
mpz_init<span style="color: #009900;">&#40;</span>mp<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<br />
<span style="color: #808080; font-style: italic;">/* mp = ull */</span><br />
mpz_import<span style="color: #009900;">&#40;</span>mp<span style="color: #339933;">,</span> <span style="color: #0000dd;">1</span><span style="color: #339933;">,</span> <span style="color: #0000dd;">1</span><span style="color: #339933;">,</span> <span style="color: #993333;">sizeof</span><span style="color: #009900;">&#40;</span>ull<span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <span style="color: #0000dd;">0</span><span style="color: #339933;">,</span> <span style="color: #0000dd;">0</span><span style="color: #339933;">,</span> <span style="color: #339933;">&amp;</span>ull<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<br />
<span style="color: #808080; font-style: italic;">/* ull = mp; note: this needs bondary checking */</span><br />
<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span>mpz_sizeinbase<span style="color: #009900;">&#40;</span>mp<span style="color: #339933;">,</span> <span style="color: #0000dd;">256</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&lt;=</span> <span style="color: #993333;">sizeof</span><span style="color: #009900;">&#40;</span>ull<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; mpz_export<span style="color: #009900;">&#40;</span><span style="color: #339933;">&amp;</span>ull<span style="color: #339933;">,</span> NULL<span style="color: #339933;">,</span> <span style="color: #0000dd;">1</span><span style="color: #339933;">,</span> <span style="color: #993333;">sizeof</span><span style="color: #009900;">&#40;</span>ull<span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <span style="color: #0000dd;">0</span><span style="color: #339933;">,</span> <span style="color: #0000dd;">0</span><span style="color: #339933;">,</span> mp<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
mpz_clear<span style="color: #009900;">&#40;</span>mp<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></div></div>
<p>
 For signed integers you'll need some additional tricks, as mpz_import and mpz_export do not support negatives; just negate before and after conversion (hint: mpz_neg()). The boundary checking in export case is slightly more problematic then, and is likely easier to do after export.</p>
]]></content:encoded>
			<wfw:commentRss>http://inz.fi/blog/2011/09/23/unsigned-long-long-and-gmplib/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Git branch in prompt</title>
		<link>http://inz.fi/blog/2011/03/07/git-branch-in-prompt/</link>
		<comments>http://inz.fi/blog/2011/03/07/git-branch-in-prompt/#comments</comments>
		<pubDate>Mon, 07 Mar 2011 09:48:38 +0000</pubDate>
		<dc:creator>inz</dc:creator>
				<category><![CDATA[geeky]]></category>

		<guid isPermaLink="false">http://inz.fi/blog/?p=164</guid>
		<description><![CDATA[While creating set of bash_completion rules for mc-tool, I read some other rule files to see how things are done. I happened to spot some useful functions from git's completion, mainly __git_ps1, which prints the name of the current branch. Having the name of the current branch can save some mistakes every now and then, [...]]]></description>
				<content:encoded><![CDATA[<p>
 While creating set of <a href="https://bugs.freedesktop.org/show_bug.cgi?id=34973">bash_completion rules</a> for mc-tool, I read some other rule files to see how things are done. I happened to spot some useful functions from git's completion, mainly __git_ps1, which prints the name of the current branch.
</p>
<p>
 Having the name of the current branch can save some mistakes every now and then, and with environment variable GIT_PS1_SHOWDIRTYSTATE you can even make it show if there are non-staged and/or non-committed changes in your tree.
</p>
<p>
 This is how I used it:
</p>
<div class="codecolorer-container text twitlight" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">PS1='\u@\h \w$(GIT_PS1_SHOWDIRTYSTATE=1 __git_ps1)\$ '</div></div>
<p>
By default the output of __git_ps1 is " (name-of-branch)", or "" if current directory does not belong to a git tree. The format string can be given on command line, like " (%s)".
</p></div>
<p>
 The current version seems to have a small glitch that causes it to print give (unknown) for home directory, if you use git global settings.</p>
]]></content:encoded>
			<wfw:commentRss>http://inz.fi/blog/2011/03/07/git-branch-in-prompt/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Context aware bash environment</title>
		<link>http://inz.fi/blog/2011/03/04/context-aware-bash-environment/</link>
		<comments>http://inz.fi/blog/2011/03/04/context-aware-bash-environment/#comments</comments>
		<pubDate>Fri, 04 Mar 2011 11:03:11 +0000</pubDate>
		<dc:creator>inz</dc:creator>
				<category><![CDATA[geeky]]></category>

		<guid isPermaLink="false">http://inz.fi/blog/?p=160</guid>
		<description><![CDATA[While mixing hobby and work development on the same machine, I've every now and then longed for a way to set environment variables depending on the current directory. Up to now had I been too lazy to do anything about it, but finally did it. What the snippet does, it finds all current user owned [...]]]></description>
				<content:encoded><![CDATA[<p>
 While mixing hobby and work development on the same machine, I've every now and then longed for a way to set environment variables depending on the current directory. Up to now had I been too lazy to do anything about it, but finally did it.
</p>
<p>
 What the snippet does, it finds all current user owned .env files from current directory and it's parent directories, checks if the topmost has changed and if it has, reads them all in reverse order. If home directory was not a parent of current directory, the ~/.env is read before others.</p>
<p><p>
 If you want this too, look at <a href="http://inz.fi/p/env.bash">the code</a>. Include these in your .bashrc, and you should be good to go.
</p>
<p>
 Examples of environment variables I've found useful are DEB_EMAIL and DEB_FULLNAME used by dpkg tools and the equivalents in git world, GIT_COMMITTER_EMAIL, GIT_COMMITTER_NAME.</p>
]]></content:encoded>
			<wfw:commentRss>http://inz.fi/blog/2011/03/04/context-aware-bash-environment/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Future of MeeGo</title>
		<link>http://inz.fi/blog/2011/02/24/future-of-meego/</link>
		<comments>http://inz.fi/blog/2011/02/24/future-of-meego/#comments</comments>
		<pubDate>Thu, 24 Feb 2011 11:15:00 +0000</pubDate>
		<dc:creator>inz</dc:creator>
				<category><![CDATA[maemo]]></category>
		<category><![CDATA[meego]]></category>

		<guid isPermaLink="false">http://inz.fi/blog/?p=155</guid>
		<description><![CDATA[My interest in the future of MeeGo is quite intense, both professionally and personally. Today the CEO of my employer wrote his thoughts into his blog. It was quite interesting read, and hopefully gives new hope for those in doubt.]]></description>
				<content:encoded><![CDATA[<p>
 My interest in the future of MeeGo is quite intense, both professionally and personally. Today the CEO of my employer wrote <a href="http://cannedbypasi.blogspot.com/2011/02/meego-qt-alive-and-kicking.html">his thoughts</a> into his blog. It was quite interesting read, and hopefully gives new hope for those in doubt.</p>
]]></content:encoded>
			<wfw:commentRss>http://inz.fi/blog/2011/02/24/future-of-meego/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>qmake and D-Bus</title>
		<link>http://inz.fi/blog/2011/02/18/qmake-and-d-bus/</link>
		<comments>http://inz.fi/blog/2011/02/18/qmake-and-d-bus/#comments</comments>
		<pubDate>Fri, 18 Feb 2011 18:58:37 +0000</pubDate>
		<dc:creator>inz</dc:creator>
				<category><![CDATA[geeky]]></category>

		<guid isPermaLink="false">http://inz.fi/blog/?p=143</guid>
		<description><![CDATA[Something I did not find documented anywhere: a sensible way to generate QtDBus adaptor and interface classes from introspection data with qdbusxml2cpp. I only found hacks using system() and custom targets to accomplish the feat. I though to myself that there must be a saner, better way, and while looking at the qmake generated Makefile, [...]]]></description>
				<content:encoded><![CDATA[<p>
 Something I did not find documented anywhere: a sensible way to generate QtDBus adaptor and interface classes from introspection data with qdbusxml2cpp. I only found hacks using system() and custom targets to accomplish the feat.
</p>
<p>
 I though to myself that there must be a saner, better way, and while looking at the qmake generated Makefile, I noticed some interesting includes. After some investigation, I found "magic" variables DBUS_INTERFACES and DBUS_ADAPTORS. The introspect files should be named servicename.xml and listed in the variables, and qmake will do all the magic for you.
</p>
<p>
 With these variables, it is really easy to generate the helper classes on-demand. Just remember to include the generated header in some code file, otherwise compilation will choke.
</p>
<div class="codecolorer-container text twitlight" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">TEMPLATE = app<br />
QT = core dbus<br />
TARGET = qtdbus<br />
DBUS_ADAPTORS = fi.inz.hello.xml<br />
SOURCES = hello.cpp main.cpp<br />
HEADERS = hello.h</div></div>
<p>
 With this simple .pro file qmake autogenerates the adaptor on build.
</p>
<p>
 To see other files from the example, see <a href="http://inz.fi/p/fi.inz.hello.xml">fi.inz.hello.xml</a> <a href="http://inz.fi/p/hello.cpp">hello.cpp</a> <a href="http://inz.fi/p/hello.h">hello.h</a> <a href="http://inz.fi/p/main.cpp">main.cpp</a> <a href="http://inz.fi/p/qtdbus.pro">qtdbus.pro</a></p>
]]></content:encoded>
			<wfw:commentRss>http://inz.fi/blog/2011/02/18/qmake-and-d-bus/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>More scratchbox x86_64 goodness</title>
		<link>http://inz.fi/blog/2009/03/06/more-scratchbox-x86_64-goodness/</link>
		<comments>http://inz.fi/blog/2009/03/06/more-scratchbox-x86_64-goodness/#comments</comments>
		<pubDate>Fri, 06 Mar 2009 11:49:39 +0000</pubDate>
		<dc:creator>inz</dc:creator>
				<category><![CDATA[maemo]]></category>

		<guid isPermaLink="false">http://inz.fi/blog/?p=133</guid>
		<description><![CDATA[On 64-bit platform and willing to try the new fremantle SDK? Look no further, following the previous release, now here are the debs for scratchbox as needed by fremantle. As last time, the debs are, again, available with apt, just add: deb http://www.ipi.fi/~pablo/maemo5-sdk_amd64 / to your sources.list and apt-get yourself out!]]></description>
				<content:encoded><![CDATA[<p>
 On 64-bit platform and willing to try the new fremantle SDK? Look no further, following the previous release, now <a href="http://www.ipi.fi/~pablo/">here are the debs</a> for scratchbox as needed by fremantle.
</p>
<p>
 As last time, the debs are, again, available with apt, just add:</p>
<div class="codecolorer-container text twitlight" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">deb http://www.ipi.fi/~pablo/maemo5-sdk_amd64 /</div></div>
<p>to your sources.list and apt-get yourself out!</p>
]]></content:encoded>
			<wfw:commentRss>http://inz.fi/blog/2009/03/06/more-scratchbox-x86_64-goodness/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Scratchbox on AMD64</title>
		<link>http://inz.fi/blog/2009/02/27/scratchbox-on-amd64/</link>
		<comments>http://inz.fi/blog/2009/02/27/scratchbox-on-amd64/#comments</comments>
		<pubDate>Fri, 27 Feb 2009 09:07:38 +0000</pubDate>
		<dc:creator>inz</dc:creator>
				<category><![CDATA[maemo]]></category>

		<guid isPermaLink="false">http://inz.fi/blog/?p=127</guid>
		<description><![CDATA[Following yesterday's vdso32 hack. The same colleague now built amd64 packages for maemo4 scratchbox. Also with debian repo; just add deb http://www.ipi.fi/~pablo/sbox_amd64 / to your apt sources.]]></description>
				<content:encoded><![CDATA[<p>
 Following yesterday's <a href="http://inz.fi/blog/2009/02/26/vdso32-disabler-kernel-module/">vdso32 hack</a>. The same colleague now built <a href="http://www.ipi.fi/~pablo/">amd64 packages</a> for maemo4 scratchbox.
</p>
<p>
 Also with debian repo; just add</p>
<div class="codecolorer-container text twitlight" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">deb http://www.ipi.fi/~pablo/sbox_amd64 /</div></div>
<p>to your apt sources.</p>
]]></content:encoded>
			<wfw:commentRss>http://inz.fi/blog/2009/02/27/scratchbox-on-amd64/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>VDSO32 disabler kernel module</title>
		<link>http://inz.fi/blog/2009/02/26/vdso32-disabler-kernel-module/</link>
		<comments>http://inz.fi/blog/2009/02/26/vdso32-disabler-kernel-module/#comments</comments>
		<pubDate>Thu, 26 Feb 2009 10:16:08 +0000</pubDate>
		<dc:creator>inz</dc:creator>
				<category><![CDATA[maemo]]></category>

		<guid isPermaLink="false">http://inz.fi/blog/?p=125</guid>
		<description><![CDATA[Scratchbox needs vdso disabled, which can be done run-time with 32-bit kernels. With 64-bit kernels, however, this is not possible... until now. A colleague of mine wrote a (hacky) kernel module to do exactly that, it seeks the vdso-flag and writes 0 to it. I helped him with dkms/deb packaging, and now it's available for [...]]]></description>
				<content:encoded><![CDATA[<p>
 Scratchbox needs vdso disabled, which can be done run-time with 32-bit kernels. With 64-bit kernels, however, this is not possible... until now. A colleague of mine wrote a (hacky) kernel module to do exactly that, it seeks the vdso-flag and writes 0 to it. I helped him with dkms/deb packaging, and now it's available for <a href="http://www.ipi.fi/~pablo/">download</a>.
</p>
<p>
 Note that this does not help with any other annoyances with sbox on 64-bit system, but at least it is something.</p>
]]></content:encoded>
			<wfw:commentRss>http://inz.fi/blog/2009/02/26/vdso32-disabler-kernel-module/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Blobby Volley 2 extra AI package</title>
		<link>http://inz.fi/blog/2008/10/14/blobby-volley-2-extra-ai-package/</link>
		<comments>http://inz.fi/blog/2008/10/14/blobby-volley-2-extra-ai-package/#comments</comments>
		<pubDate>Tue, 14 Oct 2008 08:56:11 +0000</pubDate>
		<dc:creator>inz</dc:creator>
				<category><![CDATA[maemo]]></category>

		<guid isPermaLink="false">http://inz.fi/blog/?p=123</guid>
		<description><![CDATA[Blobby Volley 2 is a nice volley ball game in the spirit of clbuttic arcade volleyball. However, the default AIs are beatable by jumping in certain point, definitely too easy. Found some AIs over at esnips, and for convenience packaged them for maemo. .install file available as usual. Just install the package, start the game, [...]]]></description>
				<content:encoded><![CDATA[<p>
 Blobby Volley 2 is a nice volley ball game in the spirit of clbuttic arcade volleyball. However, the default AIs are beatable by jumping in certain point, definitely too easy. Found some AIs over at <a href="http://www.esnips.com/web/BlobbyVolley2Bots">esnips</a>, and for convenience packaged them for maemo. <a href="http://maemo-hackers.org/blobby-ai.install">.install file</a> available as usual. Just install the package, start the game, go to options and select some AI.
</p>
<p>
 <b>Warning:</b> these AIs aren't easy to beat.</p>
]]></content:encoded>
			<wfw:commentRss>http://inz.fi/blog/2008/10/14/blobby-volley-2-extra-ai-package/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>VirtualBox on ubuntu intrepid</title>
		<link>http://inz.fi/blog/2008/09/17/virtualbox-on-ubuntu-intrepid/</link>
		<comments>http://inz.fi/blog/2008/09/17/virtualbox-on-ubuntu-intrepid/#comments</comments>
		<pubDate>Wed, 17 Sep 2008 19:54:49 +0000</pubDate>
		<dc:creator>inz</dc:creator>
				<category><![CDATA[geeky]]></category>

		<guid isPermaLink="false">http://inz.fi/blog/?p=120</guid>
		<description><![CDATA[Never mind. It works now.]]></description>
				<content:encoded><![CDATA[<p>
 Never mind. It works now.</p>
]]></content:encoded>
			<wfw:commentRss>http://inz.fi/blog/2008/09/17/virtualbox-on-ubuntu-intrepid/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
