<?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>dennogumi.org &#187; Linux</title>
	<atom:link href="http://www.dennogumi.org/tag/linux/feed" rel="self" type="application/rss+xml" />
	<link>http://www.dennogumi.org</link>
	<description>On the web since 1999</description>
	<lastBuildDate>Fri, 06 Jan 2012 14:56:54 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>PyKDE4: Queries with Nepomuk</title>
		<link>http://www.dennogumi.org/2011/06/pykde4-queries-with-nepomuk</link>
		<comments>http://www.dennogumi.org/2011/06/pykde4-queries-with-nepomuk#comments</comments>
		<pubDate>Wed, 29 Jun 2011 19:27:42 +0000</pubDate>
		<dc:creator>Einar</dc:creator>
				<category><![CDATA[KDE]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[pykde]]></category>
		<category><![CDATA[python]]></category>

		<guid isPermaLink="false">http://www.dennogumi.org/?p=924</guid>
		<description><![CDATA[In one of my previous blog posts I dealt with tagging files and resources with Nepomuk. But Nepomuk is not only about storing metadata, it is also about retrieving&#160;and interrogating data. Normally, this would mean querying the metadata database directly, &#8230; <a href="http://www.dennogumi.org/2011/06/pykde4-queries-with-nepomuk">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>In one of my previous blog posts I dealt with <a href="http://www.dennogumi.org/2010/10/pykde4-tag-and-annotate-files-using-nepomuk">tagging files and resources with Nepomuk</a>. But Nepomuk is not only about storing metadata, it is also about <i>retrieving</i>&nbsp;and <i>interrogating </i>data. Normally, this would mean querying the metadata database directly, using queries written in SPARQL. But this is not intuitive, can be inefficient (if you do things the wrong way) and error prone (oops, I messed up a parameter!).&nbsp;
<p>Fortunately, the Nepomuk developers have come up with a high level API to query already stored metadata, and today&#8217;s post will deal with querying tags in Nepomuk. As per the past tutorials, the full source code is available <a href="https://projects.kde.org/projects/kde/kdeexamples/repository/revisions/master/changes/bindings/python/nepomuk/nepomuk_tag_query_example.py">in the kdeexamples module</a>.</p>
<p>Let&#8217;s start off with the basic imports:</p>
<pre class="brush: python; title: ; notranslate">
import sys

import PyQt4.QtCore as QtCore

import PyKDE4.kdecore as kdecore
import PyKDE4.kdeui as kdeui
from PyKDE4.kio import KIO
from PyKDE4.nepomuk import Nepomuk
from PyKDE4.soprano import Soprano
</pre>
<p>Then let&#8217;s create a simple class that wil be used for the rest of this exercise:</p>
<pre class="brush: python; title: ; notranslate">
class NepomukTagQueryExample(QtCore.QObject):

    def __init__(self, parent=None):

        super(NepomukTagQueryExample, self).__init__(parent)
</pre>
<p>__init__ is just used to construct the instance, nothing more. The bulk of the work is in the query_tag() function, which we&#8217;ll take a look at in parts.</p>
<pre class="brush: python; title: ; notranslate">
    def query_tag(self, tag):

        &quot;&quot;&quot;Query for a specific tag.&quot;&quot;&quot;

        tag = Nepomuk.Tag(tag)
</pre>
<p>First of all we convert the tag we want to query into a proper Nepomuk.Tag() instance. Of course we should use an already existing tag: even if Nepomuk.Tag() automatically creates new tags, it makes little sense to query for a newly created tag, doesn&#8217;t it?</p>
<p>For our job, we need to use <i>properties</i>&nbsp;which define the terms of our query. As we&#8217;re looking for tags, we&#8217;ll use Soprano.Vocabulary.NAO.hasTag():</p>
<pre class="brush: python; title: ; notranslate">
        soprano_term_uri = Soprano.Vocabulary.NAO.hasTag()
        nepomuk_property = Nepomuk.Types.Property(soprano_term_uri)
</pre>
<p>The first call generates an URI pointing to a specific RDF resource for this specific term, which is then wrapped as a Nepomuk.Types.Property in the second call. While the C++ API docs don&#8217;t show this, I found it to be necessary, or the Python interpreter would raise a TypeError. Notice that this is not the only term we can use: aside for tags, there are a lot of other URIs we can use for querying, <a href="http://api.kde.org/kdesupport-api/kdesupport-apidocs/soprano/html/namespaceSoprano_1_1Vocabulary_1_1NAO.html">listed in the Soprano API docs</a>.</p>
<p>Once we have our property set up, it&#8217;s time to define which kind of query we&#8217;re going to use. In this case, since we want to check for the presence of tags, we use a Nepomuk.Query.ComparisonTerm, which is a query term used to match values of specific properties (in our case, tags):</p>
<pre class="brush: python; title: ; notranslate">
        comparison_term = Nepomuk.Query.ComparisonTerm(nepomuk_property,
                Nepomuk.Query.ResourceTerm(tag))
</pre>
<p>Our tag is wrapped in a ResourceTerm, which is used exactly for the purpose. Now we make the proper query: in this specific case, we want to look up <i>files </i>tagged, so we use a FileQuery. We could also get other items, such as mails (in Akonadi): in that case we could use a a Nepomuk.Query.Query():</p>
<pre class="brush: python; title: ; notranslate">
        query = Nepomuk.Query.FileQuery(comparison_term)
</pre>
<p>Lastly, we want to get some <i>results</i> out of this query. There are different methods, but for this tutorial we&#8217;ll use the tried-and-tested KIO technology:</p>
<pre class="brush: python; title: ; notranslate">
        search_url = query.toSearchUrl()
        search_job = KIO.listDir(kdecore.KUrl(search_url))
        search_job.entries.connect(self.search_slot)
        search_job.result.connect(search_job.entries.disconnect)
</pre>
<p>First we convert the query to a nepomuksearch:// url, which then we pass to KIO.listDir, to list the entries. Unlike <a href="http://www.dennogumi.org/2011/01/pykde4-retrieve-data-using-kio">my previous post on KIO</a>, this job emits entries() every time one is found, so we connect the signal to our search_slot method. We also connect the job&#8217;s result() signal in a way that it will disconnect the job once it&#8217;s over.</p>
<p>Finally, let&#8217;s take a look at the search_slot function:</p>
<pre class="brush: python; title: ; notranslate">
    def search_slot(self, job, data):

        # We may get invalid entries, so skip those
        if not data:
            return

        for item in data:
            print item.stringValue(KIO.UDSEntry.UDS_DISPLAY_NAME)
</pre>
<p>Entries are emitted as <a href="http://api.kde.org/4.x-api/kdelibs-apidocs/kio/html/classKIO_1_1UDSEntry.html">UDSEntries</a>: to get something at least understandable, we turn them into the file name, which is obtained by the stringValue() call using KIO.UDSEntry.UDS_DISPLAY_NAME.</p>
<p>That&#8217;s it. As you can see, it was pretty easy. Of course there&#8217;s more than that. For further reading, take a look at <a href="http://api.kde.org/4.x-api/kdelibs-apidocs/nepomuk/html/namespaceNepomuk_1_1Query.html">Nepomuk&#8217;s Query API docs</a>, and <a href="http://api.kde.org/4.x-api/kdelibs-apidocs/nepomuk/html/examples.html#examples_query">Query Examples</a>. Bear in mind however that to the best of my knowledge, the &#8220;fancy operators&#8221; mentioned there will not work with Python.</p>
<p>Happy Nepomuk querying!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.dennogumi.org/2011/06/pykde4-queries-with-nepomuk/feed</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Access multiple Google Calendars from KOrganizer</title>
		<link>http://www.dennogumi.org/2011/06/access-multiple-google-calendars-from-korganizer</link>
		<comments>http://www.dennogumi.org/2011/06/access-multiple-google-calendars-from-korganizer#comments</comments>
		<pubDate>Sat, 11 Jun 2011 10:06:29 +0000</pubDate>
		<dc:creator>Einar</dc:creator>
				<category><![CDATA[KDE]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[akonadi]]></category>
		<category><![CDATA[korganizer]]></category>

		<guid isPermaLink="false">http://www.dennogumi.org/?p=919</guid>
		<description><![CDATA[Recently, a question came up on the KDE Community Forums regarding the use of multiple Google Calendars with KOrganizer. The preferred access up to now has been with googledata Akonadi resource, however that doesn&#8217;t support more than one calendar, and &#8230; <a href="http://www.dennogumi.org/2011/06/access-multiple-google-calendars-from-korganizer">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Recently, a question came up on the KDE Community Forums <a href="http://forum.kde.org/viewtopic.php?f=20&amp;t=91324">regarding the use of multiple Google Calendars with KOrganizer</a>. The preferred access up to now has been with googledata Akonadi resource, however that doesn&#8217;t support more than one calendar, and (at least from my unscientific observation) seems to be rather unmaintained these days.&nbsp;
<div>Luckily, not all&#8217;s lost. Akonadi recently gained the opportunity of accessing CalDAV resources, and Google Calendar also offers a CalDAV interface, hence this is possible.&nbsp;</div>
<div>This post will briefly describe how (thanks go to PIMster krop, which casually mentioned the possibility on IRC and prompted me to investigate).</div>
<p><span id="more-919"></span></p>
<div><b>Notice</b>: I am running trunk (4.7) so I have no idea if the steps posted below are possible in 4.6. Also, this worked for <i>me</i>&nbsp;with my particular setup. YMMV.</div>
<div>First of all, you need to obtain the <i>calendar IDs</i>&nbsp;you want to use. This is done in the web version of Google Organizer, in the settings page of your specific calendar, near the private links: it&#8217;s a string of alphanumeric characters followed by <i>@gmail.com</i>. Copy it in full (even the address part) as you will need it later, and do it for every calendar you want to use.</div>
<div>Next, open KOrganizer, locate the list of the calendars, right click on an emtpy spot and select <i>Add Calendar:</i></div>
<div><i><br /></i></div>
<div style="text-align: center;"><i><img width="299" height="409" src="http://www.dennogumi.org/wp-content/uploads/2011/06/korgtut1.png?cda6c1"/></i></div>
<div><i><br /></i></div>
<div>In the next screen, select &#8220;DAV Groupware resource&#8221;, then a wizard will come up. Fill in username and password (apologies for the language! I haven&#8217;t found a quick way to switch these dialogs to English) and click on Next:</div>
<div></div>
<div></div>
<div style="text-align: center;"><img width="566" height="445" src="http://www.dennogumi.org/wp-content/uploads/2011/06/korgtut2.png?cda6c1"/></div>
<div style="text-align: left;"></div>
<div><i><br /></i></div>
<div>In the following screen, choose <i>Configure the resource manually:</i></div>
<div><i><br /></i></div>
<div style="text-align: center;"><i><img width="566" height="445" src="http://www.dennogumi.org/wp-content/uploads/2011/06/korgtut3.png?cda6c1"/></i></div>
<div><i><br /></i></div>
<div>Click on <i>Finish</i>, but you&#8217;re not finished yet. In fact, we will have to add more stuff here. In the new window, select the display name (here shown as <i>Nome visualizzato</i>)&nbsp; of the calendar, then click on Add (which is translated as <i>Aggiungi</i>&nbsp;in this screen):</div>
<div></div>
<div style="text-align: center;"><img width="446" height="467" src="http://www.dennogumi.org/wp-content/uploads/2011/06/korgtut4.png?cda6c1"/></div>
<div></div>
<div>In the next screen we&#8217;ll have to add what&#8217;s needed for our calendar to work. In <i>Remote URL</i>&nbsp;put <i>https://www.google.com/calendar/dav/YOURCALENDARID/events</i>&nbsp;(https,<b>&nbsp;not</b>&nbsp;http)&nbsp;then put (again) your Google account credentials in the relevant places. Then click on &#8220;Download&#8221; (<i>Scarica</i>&nbsp;here) and you will see (after a while) your Calendar being loaded in the &#8220;Found collections&#8221; pane, with the name you set in Google Calendar. Click OK to save the configuration.&nbsp;</div>
<div></div>
<div style="text-align: center;"><img width="365" height="637" src="http://www.dennogumi.org/wp-content/uploads/2011/06/korgtut5.png?cda6c1"/></div>
<div></div>
<div>This will bring you back to the previous window. For more calendars, repeat the steps (click on Add, insert URL, Download, OK) for all the calendars you have to display.</div>
<div>That&#8217;s it. If you encounter trouble, have a look at ~/.xsession-errors to see whether Akonadi managed to connect and download your existing items correctly. And don&#8217;t forget to <a href="http://bugs.kde.org">file bugs!</a></div>
<div><i><br /></i></div>
<div><i><br /></i></div>
]]></content:encoded>
			<wfw:commentRss>http://www.dennogumi.org/2011/06/access-multiple-google-calendars-from-korganizer/feed</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>Taking video snapshots quickly: KDE VLC Snapper</title>
		<link>http://www.dennogumi.org/2011/04/taking-video-snapshots-quickly-kde-vlc-snapper</link>
		<comments>http://www.dennogumi.org/2011/04/taking-video-snapshots-quickly-kde-vlc-snapper#comments</comments>
		<pubDate>Sun, 10 Apr 2011 12:40:26 +0000</pubDate>
		<dc:creator>Einar</dc:creator>
				<category><![CDATA[Anime]]></category>
		<category><![CDATA[KDE]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[vlc]]></category>

		<guid isPermaLink="false">http://www.dennogumi.org/?p=823</guid>
		<description><![CDATA[Some of the oldest readers of this blog are well aware of a certain hobby of mine. Over the years I&#8217;ve always wanted to write more about that, including the stuff I&#8217;m viewing nowadays, but I found a hassle to &#8230; <a href="http://www.dennogumi.org/2011/04/taking-video-snapshots-quickly-kde-vlc-snapper">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Some of the oldest readers of this blog are well aware of <a href="http://www.dennogumi.org/category/anime">a certain hobby of mine</a>. Over the years I&#8217;ve always wanted to write more about that, including the stuff I&#8217;m viewing nowadays, but I found a hassle to collect snapshots from videos / DVDs, selecting them, and so on.&nbsp;
<div>Recently I learnt that VLC has <a href="http://wiki.videolan.org/Python_bindings">some rather complete Python bindings</a>, and I thought, <i>why not make the process automated?</i>&nbsp;Yesterday I had some free time on my hands and a quick session of hacking brought some results already.</div>
<div>As the stuff is somewhat past prototypal stage, I thought I would push somewhere for others to use. &nbsp;Lo and behold, here I present you <i>KDE VLC Snapper</i>.</div>
<div></div>
<div style="text-align: center;"><img width="300" height="313" src="http://www.dennogumi.org/wp-content/uploads/2011/04/vlcsnapper_resized.png?cda6c1"/></div>
<div style="text-align: left;">As you can see, it&#8217;s a minimal dialog: just select your source video file (any file supported by VLC will do), the number of screencaps, the destination directory, and the program will do the rest. Currently it works <i>somewhat</i>&nbsp;OK (see caveats below) and is good enough for my use cases.</div>
<h2>How do I get it?</h2>
<div>Just clone this repository:
<pre class="brush: plain; title: ; notranslate">git clone http://git.gitorious.org/kde-vlc-snapper/kde-vlc-snapper.git</pre>
<p> followed by
<pre class="brush: bash; title: ; notranslate">sudo python setup.py install</pre>
<p> You can then invoke the program with
<pre class="brush: plain; title: ; notranslate">kdevlcsnapper</pre>
</div>
<div></div>
<div><b>Requirements</b>&nbsp;include PyKDE4 (tested on KDE Dev Platform 4.6), numpy (just for its &#8220;linspace&#8221; function, alternatives are welcome) and VLC installed (you don&#8217;t need the bindings, however: I provide a local copy).</div>
<div>What about <b>bugs</b>? Well, currently there are two issues that I&#8217;m unsure on how to fix: the first is a crash on exit, the second is that certain media files make VLC crash in the background when called from the bindings.</div>
<div>In any case, if you try it out, let me know what you think in the comments!</div>
]]></content:encoded>
			<wfw:commentRss>http://www.dennogumi.org/2011/04/taking-video-snapshots-quickly-kde-vlc-snapper/feed</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Improvements to the Git hooks</title>
		<link>http://www.dennogumi.org/2011/01/improvements-to-the-git-hooks</link>
		<comments>http://www.dennogumi.org/2011/01/improvements-to-the-git-hooks#comments</comments>
		<pubDate>Wed, 26 Jan 2011 11:59:04 +0000</pubDate>
		<dc:creator>Einar</dc:creator>
				<category><![CDATA[KDE]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[git]]></category>
		<category><![CDATA[review board]]></category>

		<guid isPermaLink="false">http://www.dennogumi.org/?p=816</guid>
		<description><![CDATA[As you may already know, recently the KDE sysadmins completely overhauled the commit hooks used with the Git infrastructure. Written in Python, they have already brought significant improvements to the current workflows. These hooks include keywords that when specified trigger &#8230; <a href="http://www.dennogumi.org/2011/01/improvements-to-the-git-hooks">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>As you may already know, recently the KDE sysadmins completely overhauled the commit hooks used with the Git infrastructure. Written in Python, they have already brought significant improvements to the current workflows. These hooks include keywords that when specified trigger particular actions: the most used are &nbsp;to CC specific email addresses (CCMAIL), to CC bug reports (CCBUG) or to close bug reports (BUG).</p>
<p>With the adoption of <a href="http://www.reviewboard.org/">Review Board</a>&nbsp;to facilitate code reviews, there were also requests for a REVIEW keyword that could close the review requests without asking the submitters to do so manually (which is slow and not always effective). Since the hooks for Git were written in Python, I thought I could give a hand there.</p>
<p>I looked into the Review Board API, which is a simple REST API: tasks are performed with HTTP GET, POST, or PUT. As I didn&#8217;t want to dive too much into the technicalities, I decided to use a wrapper that would make things easier: <a href="http://code.google.com/p/python-rest-client/" title="Python REST client">python-rest-client</a>. Once that was in place, it was just a matter of adding some sugar to handle replies, errors and logging. All in 78 lines of code.</p>
<p>Now that the &#8220;field tests&#8221; passed with flying colors, I&#8217;m happy to announce that such a hook exists and is operational for KDE&#8217;s Git infrastructure. By using the REVIEW keyword at the start of a line, followed by a number, the hook will notify the Review Board instance and close the request. It will also publish a comment stating the commit&#8217;s SHA1 and the person who did it.</p>
<p>You can take a look at the finished results <a href="http://git.reviewboard.kde.org/r/100270/">in this review request.</a></p>
<p>Credits for this also go to Ben &#8220;bcooksley&#8221; Cooksley for helping with testing and fixes, and Eike &#8220;Sho&#8221; Hein for helpful suggestions.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.dennogumi.org/2011/01/improvements-to-the-git-hooks/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>What&#8217;s cooking at the KDE Community Forums?</title>
		<link>http://www.dennogumi.org/2010/06/whats-cooking-at-the-kde-community-forums</link>
		<comments>http://www.dennogumi.org/2010/06/whats-cooking-at-the-kde-community-forums#comments</comments>
		<pubDate>Sat, 05 Jun 2010 11:56:51 +0000</pubDate>
		<dc:creator>Einar</dc:creator>
				<category><![CDATA[KDE]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[forums]]></category>

		<guid isPermaLink="false">http://www.dennogumi.org/?p=783</guid>
		<description><![CDATA[In the past weeks and days, the KDE Community Forums staff has been working to bring new features to improve even more the user experience. A few months ago, the staff was discussing the idea of finding a way to &#8230; <a href="http://www.dennogumi.org/2010/06/whats-cooking-at-the-kde-community-forums">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>In the past weeks and days, the KDE Community Forums staff has been working to bring new features to improve even more the user experience. A few months ago, the staff was discussing the idea of finding a way to guide users to the most appropriate forum to post their questions or discussions. Now, thanks also to the return in service of one of our admins (welcome back, sayakb!) the feature is now being implemented, as the screenshots below will show.</p>
<p>Bear in mind that everything for now is running on a testing server, to make sure it doesn&#8217;t break anything. Once the tests and the implementation are complete, we&#8217;ll integrate the feature in the forums. How soon we are not sure, but it won&#8217;t be too long.</p>
<h2>&quot;Help me post a topic&quot;</h2>
<p>Upon logging in, you will be greeted by a new &quot;New Post&quot; button:</p>
<p align="center"><img src="http://www.dennogumi.org/wp-content/uploads/2010/06/new1.png?cda6c1" /></p>
<p align="left">You can either click on the arrow to quickly post an idea for Brainstorm, a new discussion, access the &quot;getting started&quot; forum or contact the staff:</p>
<p align="center"><img src="http://www.dennogumi.org/wp-content/uploads/2010/06/new2.png?cda6c1" /></p>
<p align="left">Or if you just click on the button itself, you access the guided post section:</p>
<p align="center"><img src="http://www.dennogumi.org/wp-content/uploads/2010/06/new3_small.png?cda6c1" /></p>
<p align="left">The &quot;Share an idea&quot; and &quot;Chat and discuss&quot; buttosn will bring you to the relevant forums (Brainstorm and Discussions and Opinions), while &quot;Ask a question&quot; will bring about an additional screen:</p>
<p align="center"><img src="http://www.dennogumi.org/wp-content/uploads/2010/06/new4_small.png?cda6c1" /></p>
<p align="left">You&#8217;ll be able to select your favorite application and you&#8217;ll be able to post directly in the relevant forum. </p>
<h2 align="left">Open Collaboration Services</h2>
<p align="left">But that&#8217;s not all. Thanks to the hard work of Ben Cooksley (fellow admin and System Settings maintainer) there is also an implementation of the <a href="http://www.freedesktop.org/wiki/Specifications/open-collaboration-services" title="OCS page on the freedesktop.org wiki">Open Collaboration Services (OCS)</a>, the same system that powers the well-known Get Hot New Stuff connected to <a href="http://opendesktop.org" title="OpenDesktop">OpenDesktop.org</a>. This will mean, in principle, that you could access forum posts and discussions in a programmatic way, using a REST API. This opens up possibilities like Brainstorm plasmoids, other means to access the forum (like an Akonadi resource &#8211; there&#8217;s some ongoing work in KDE SVN). If you&#8217;re interested in testing the OCS for the forum (or if you want to develop some kind of application that ties to the forums themselves), let us know on IRC (#kde-forum on freenode).</p>
]]></content:encoded>
			<wfw:commentRss>http://www.dennogumi.org/2010/06/whats-cooking-at-the-kde-community-forums/feed</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>The world of KIO metadata &#8211; checking the HTTP response from a server</title>
		<link>http://www.dennogumi.org/2010/02/the-world-of-kio-metadata-checking-the-http-response-from-a-server</link>
		<comments>http://www.dennogumi.org/2010/02/the-world-of-kio-metadata-checking-the-http-response-from-a-server#comments</comments>
		<pubDate>Thu, 18 Feb 2010 21:42:46 +0000</pubDate>
		<dc:creator>Einar</dc:creator>
				<category><![CDATA[KDE]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[python]]></category>

		<guid isPermaLink="false">http://www.dennogumi.org/?p=753</guid>
		<description><![CDATA[Recently, I investigated how to perform some checks on web addresses using KIO for Danbooru Client. My old code was synchronous, so it blocked the application while checking, thus causing all sort of troubles (UI freezing, etc.). Therefore, making the &#8230; <a href="http://www.dennogumi.org/2010/02/the-world-of-kio-metadata-checking-the-http-response-from-a-server">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Recently, I investigated how to perform some checks on web addresses using KIO for <a href="http://kde-apps.org/content/show.php/Danbooru+Client?action=content&#038;content=114343" title="kde-apps page">Danbooru Client</a>. My old code was synchronous, so it blocked the application while checking, thus causing all sort of troubles (UI freezing, etc.). Therefore, making the switch to KIO was the best solution. However, I had one problem: <em>how could I check the HTTP response?</em></p>
<p>I knew already that the various ioslaves can store metadata, consisting of key-value pairs which are specific on the slave used. Normally you can get the whole map by accessing the <a href="http://api.kde.org/4.4-api/kdelibs-apidocs/kio/html/classKIO_1_1Job.html#a631cbc61c70e512ad91b2cf2c23ef029" title="API docs on metaData()"><em>metaData</em></a> function of the job you have used, in the slot connected from the <em>result</em> signal.  For some reason, however, in PyKDE4 calling metaData() triggers an assert in SIP, which ends in a crash (at least in my application; I stil need to debug further).  KIO  jobs have also the <a href="http://api.kde.org/4.4-api/kdelibs-apidocs/kio/html/classKIO_1_1Job.html#aafd31b4d9643bffb4cd75f3a31242bd4" title="API docs on queryMetaData"><em>queryMetaData</em></a> function, which returns the value of the key you have queried. Unfortunately, there was no way I could find the name.</p>
<p>Thus began my search for the right key. Googling didn&#8217;t help, and on IRC I got the first answers I needed but not enough to reach the goal. Until I saw a commit by David Faure in trunk/kdelibs/kio/ which touched a file called <a href="http://websvn.kde.org/branches/KDE/4.4/kdelibs/kio/DESIGN.metadata?revision=1070858&#038;view=markup" title="Link to the branch version">DESIGN.metadata</a> (link is for the branch version). After checking with webSVN, that was exactly the thing I was looking for! It lists all the keys for the metadata, indicating also to which ioslave they begin.  After that, the solution was easy.</p>
<p>Of course I&#8217;m not leaving you hanging there and now I&#8217;ll show you how, in PyKDE4, you can quickly check for the server response:</p>
<pre class="brush: python; title: ; notranslate">
from PyKDE4.kio import KIO
from PyQt4.QtCore import SIGNAL
[...]

class my_widget(QWidget):
[...]

    def check_address(self, url):

        # You can add optional flags such as KIO.HideProgressInfo
        job = KIO.get(KUrl(url))
        self.connect(job, SIGNAL(&quot;result (KJob *)&quot;), self.slot_result)

    def slot_result(self, job):

        if job.error():
            # Bail out if there's an error
            return    

        # Get the HTTP response through queryMetaData
        http_response = job.queryMetaData(&quot;responsecode&quot;)
        print &quot;Got response: %s&quot; % unicode(http_response)
</pre>
<p>This snippet does a few things. Firstly, it gets the specified URL, using KIO.get (KIO.stat doesn&#8217;t set the required metadata). Notice that the call is not wrapped in the  new-style PyQt API because <em>result (KJob *)</em> isn&#8217;t wrapped like that (<a href="https://bugs.kde.org/show_bug.cgi?id=211070" title="Bug 211070">there&#8217;s a bug open for that</a>). In any case, the signal passes to the connecting slot (slot_result) where we first check if there&#8217;s an error (perhaps the address didn&#8217;t exist?) and then we use <em>queryMetaData(&quot;responsecode&quot;)</em> to get the actual response code. </p>
<p>If you want to do error checking basing on the result, bear in mind that KIO operates asynchronously, so you should use a signal to tell your application that the result is what it expected or not.</p>
<p>I wonder if this should be documented in Techbase&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.dennogumi.org/2010/02/the-world-of-kio-metadata-checking-the-http-response-from-a-server/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Danbooru Client 0.5 is out</title>
		<link>http://www.dennogumi.org/2009/12/danbooru-client-0-5-is-out</link>
		<comments>http://www.dennogumi.org/2009/12/danbooru-client-0-5-is-out#comments</comments>
		<pubDate>Sun, 27 Dec 2009 08:54:54 +0000</pubDate>
		<dc:creator>Einar</dc:creator>
				<category><![CDATA[Anime]]></category>
		<category><![CDATA[KDE]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[danbooru client]]></category>
		<category><![CDATA[python]]></category>

		<guid isPermaLink="false">http://www.dennogumi.org/?p=738</guid>
		<description><![CDATA[Sometimes answering apparently harmless questions on instant messaging can have unexpected results. In particular, I was telling about Danbooru Client to someone and a question popped up &#34;Why don&#8217;t you support pages?&#34;. It seemed a nice idea, so I branched &#8230; <a href="http://www.dennogumi.org/2009/12/danbooru-client-0-5-is-out">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Sometimes answering apparently harmless questions on instant messaging can have unexpected results. In particular, I was telling about Danbooru Client <a href="http://www.clorophilla.net/blog" title="NRK's blog">to someone</a> and a question popped up &quot;Why don&#8217;t you support pages?&quot;. It seemed a nice idea, so I branched off the code (yay for git!) and started working on it.</p>
<p>Well, it took me more than a <em>month</em> to get this thing done&#8230; I didn&#8217;t spend every day coding, but it was a challenge. Glad it&#8217;s over now, which means that Danbooru Client 0.5 is finally available. Grab it <a href="http://kde-apps.org/content/show.php/Danbooru+Client?content=114343" title="kde-apps page">at the usual place on kde-apps.org</a>. </p>
<p>Changes in this version:</p>
<ul>
<li>Massive code refactoring and documentation</li>
<li>Support for multiple pages: the same query can be repeated multiple pages (shown in a tabbed interface), kind of like browsing the actual Danbooru board;</li>
<li>Rating information added to the API;</li>
<li>Support for translations (thanks to Pino &quot;pinotree&quot; Toscano for the help): the tarball now contains a .pot file which can be used for translating Danbooru Client. If you make a translation, send the .po file my way and I&#8217;ll include it in the next version.</li>
</ul>
<p>Improvements that I have in the queue:</p>
<ul>
<li>Suppport for pools (every board out there changes the API, so it will require some work);</li>
<li>Support for storing password/username using KWallet (through <a href="http://pypi.python.org/pypi/keyring" title="keyring at PyPi">python-keyring</a>, so it works even without KWallet installed);</li>
<li>Review usability of the dialogs (I have a separate branch for that);</li>
<li>Improve the image download dialog.</li>
</ul>
<p>On recent KDE SC versions (4.4 beta 2 and onwards) there are some painting issues with regards to the thumbnails, but I&#8217;m not sure if the fault is in PyKDE4 or in the underlying libraries. Nothing too bad, luckily: hovering the thumbnails or giving focus to the thumbnail view should be what&#8217;s needed. </p>
<p>Here&#8217;s a screenshot of the new interface (click to enlarge):</p>
<p align="center"><a href="http://www.dennogumi.org/wp-content/uploads/2009/12/danbooru_new.png?cda6c1"><img src="http://www.dennogumi.org/wp-content/uploads/2009/12/danbooru_new_resized.png?cda6c1" title="The new interface" alt="Screenshot of the new interface" /></a></p>
<p>Comments and suggestions are always welcome, so don&#8217;t hesitate to drop me a line.</p>
<p>As a final word, some thoughts on the work required to get this out of the door. My largest issues are related to garbage collection: Python&#8217;s reference counting based GC got a lot in the way, at least because of how the underlying C++ structures work. I had to work a bit to keep references to objects around so I wouldn&#8217;t get crashes (accessing an already deleted object). All is well now, and I think my Python/PyQt/PyKDE4 knowledge gained from it. I keep telling myself that I should be writing some tutorials one day&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.dennogumi.org/2009/12/danbooru-client-0-5-is-out/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>After a hiatus, Klassrooms continue!</title>
		<link>http://www.dennogumi.org/2009/11/after-a-hiatus-klassrooms-continue</link>
		<comments>http://www.dennogumi.org/2009/11/after-a-hiatus-klassrooms-continue#comments</comments>
		<pubDate>Sun, 29 Nov 2009 22:25:34 +0000</pubDate>
		<dc:creator>Einar</dc:creator>
				<category><![CDATA[KDE]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[kdeforum]]></category>
		<category><![CDATA[klassroom]]></category>

		<guid isPermaLink="false">http://www.dennogumi.org/2009/11/after-a-hiatus-klassrooms-continue</guid>
		<description><![CDATA[Do you like KDE? Did you ever find yourself in a position of wanting to help, but you didn&#8217;t know what to do, or who to talk to? Do you feel you could use help to get started? Today, the &#8230; <a href="http://www.dennogumi.org/2009/11/after-a-hiatus-klassrooms-continue">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Do you like KDE? Did you ever find yourself in a position of wanting to help, but you didn&#8217;t know what to do, or who to talk to? Do you feel you could use help to get started?</p>
<p>Today, the KDE Community Forums would like to provide the opportunity to answer those questions by annoucing the continuation of the tutorial courses known as <em>Klassrooms</em>.</p>
<h2>What are Klassrooms?</h2>
<p>Klassrooms are tutorial &#8220;lessons&#8221; held in a specific area of the forum. Held by one or more &#8220;mentors&#8221;, they are focused in guiding people through helping KDE by tackling a particular problem. Examples of such problems include:</p>
<ul>
<li>Fixing simple bugs in an application</li>
<li>Taking junior jobs in a specific project</li>
<li> Helping with documentation</li>
<li> Promotion work (for example, screencasts)</li>
<li> Helping with translations</li>
</ul>
<p>As you can see, Klassrooms are not limited to coding at all.</p>
<p>Usually the sessions last from one to two weeks, with a maximum of 5 &#8220;students&#8221; participating. The work is coordinated in a specific area of the forum.</p>
<h2>Public call for mentors</h2>
<p>The key to hold Klassrooms is having mentors. Their role is to present the problem and guide students through the course. Compared to a live session, using the forum requires less time, and both the students and the mentor can set their most convenient schedule.</p>
<p>That is why <em>we need you! </em>You don&#8217;t need to be a developer: non-coding courses are as welcome as coding ones. How do you become a mentor? <a href="http://forum.kde.org/viewtopic.php?f=71&#038;t=84115">These guidelines</a> explain everything that is needed to apply. </p>
<p>If you feel like helping, this is the perfect opportunity. Let us know!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.dennogumi.org/2009/11/after-a-hiatus-klassrooms-continue/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>KDE Marketing Sprint &#8211; Day 2(?)</title>
		<link>http://www.dennogumi.org/2009/11/kde-marketing-sprint-day-2</link>
		<comments>http://www.dennogumi.org/2009/11/kde-marketing-sprint-day-2#comments</comments>
		<pubDate>Sat, 14 Nov 2009 23:26:28 +0000</pubDate>
		<dc:creator>Einar</dc:creator>
				<category><![CDATA[KDE]]></category>
		<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://www.dennogumi.org/2009/11/kde-marketing-sprint-day-2</guid>
		<description><![CDATA[Well, there wasn&#8217;t a Day 1 for me (I got to the hotel too late to follow the first day of the meeting), so that is why I&#8217;m starting on day 2. To start, I need to say that I &#8230; <a href="http://www.dennogumi.org/2009/11/kde-marketing-sprint-day-2">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Well, there wasn&#8217;t a Day 1 for me (I got to the hotel too late to follow the first day of the meeting), so that is why I&#8217;m starting on day 2. To start, I need to say that I had never been to a sprint before: I am already accustomed to meeting for real someone from online, but for all the attendants, they had been just names or nicks on IRC. That means I was a bit nervous.</p>
<p>The first encounter worked out pretty well, actually. I went with the others to have a dinner out, and I got to talk to &#8220;famous&#8221; KDE people such as Troy, Lydia, or Jos. I also had the nice opportunity to meet up with my fellow forum administrator neverendingo, and we discussed a bit on how to improve the forums. In short, the evening was really nice. I even got to see a N900! I thought I&#8217;d never see that. A very nice piece of hardware, I&#8217;d say.</p>
<p>The following morning, aside a little incident (the other people forgot about me!) I walked up to KONSEC where the meeting was held. While Cornelius led the discussion (the Dot will have more details in due time), I worked on helping out with a promo booklet the team is making. I&#8217;m used to writing, but writing in an appealing way to a less specialized audience is much harder. Thanks go to Jos who got me on the right track.</p>
<p>Then  part of the people moved to another room to discuss about getting new contributors to KDE while I stayed with Jos and Stuart to work on other material. It was a little draining, but very productive overall. I am actually happy to be part of this, for a change, rather than passively reading about it on the web. It&#8217;s nice to give something back to your favorite project, as little as may be. </p>
<p>Lastly, we went out for a dinner in an Indian restaurant (nice food, not too much though), and we went back (with Eckhart showing us innovative ways to get back by changing multiple subway trains). And here I am, writing a small report of this day.</p>
<p>It&#8217;s been a very positive experience so far. I finally saw more people who use KDE, and they&#8217;re also both fun and nice. Now it&#8217;s time for bed, I still have a good half of a day for work before I get back.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.dennogumi.org/2009/11/kde-marketing-sprint-day-2/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>danbooru2Nepomuk &#8211; a Nepomuk tagger for Danbooru images</title>
		<link>http://www.dennogumi.org/2009/10/danbooru2nepomuk-a-nepomuk-tagger-for-danbooru-images</link>
		<comments>http://www.dennogumi.org/2009/10/danbooru2nepomuk-a-nepomuk-tagger-for-danbooru-images#comments</comments>
		<pubDate>Fri, 02 Oct 2009 20:25:00 +0000</pubDate>
		<dc:creator>Einar</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Anime]]></category>
		<category><![CDATA[danbooru]]></category>
		<category><![CDATA[KDE]]></category>

		<guid isPermaLink="false">http://www.dennogumi.org/?p=681</guid>
		<description><![CDATA[If you dabble with anime and related things like I do, you may have heard about imageboards. A known variant, which powers sites such as moe.imouto (some links may be NSFW) or Konachan, is Danbooru, a Ruby on Rails application. &#8230; <a href="http://www.dennogumi.org/2009/10/danbooru2nepomuk-a-nepomuk-tagger-for-danbooru-images">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>If you dabble with <a href="http://www.dennogumi.org/category/Anime" title="Anime">anime</a> and related things like I do, you may have heard about <a href="http://en.wikipedia.org/wiki/Imageboard" title="Article on WIkipedia">imageboards</a>. A known variant, which powers sites such as <a href="http://moe.imouto.org" title="moe.imouto">moe.imouto</a> (some links may be NSFW) or <a href="http://konachan.net" title="Konachan.net">Konachan</a>, is <a href="http://en.wikipedia.org/wiki/Imageboard#Danbooru-style_boards" title="Definition on Wikipedia">Danbooru</a>, a Ruby on Rails application. One of the characteristics of this software is that images stored there can be tagged to be identified as precisely as possible: common tags are for example the magazine where the image was taken from, the characters depicted, and so on. </p>
<p>Once you save the file, however, all the tags are just present in your file name, and nowhere else. LIke that, they&#8217;re not that informative. That&#8217;s where <strong>danbooru2nepomuk</strong> comes into play. danbooru2nepomuk is a small Python program that can turn the tags present into the filenames into real semantic tags.</p>
<h3>Requirements</h3>
<p>As of this post, danbooru2nepomuk works only on Linux, so if you are a Windows user, you&#8217;re out of luck. Also, it requires a <a href="http://www.kde.org" title="KDE">KDE</a> (tested with version 4.3.1).</p>
<p>danbooru2nepomuk is a Python program, so it requires first of all the <a href="http://python.org" title="Python.org">Python interpreter</a>, version 2.5 or later. It has been developed to use the <a href="http://nepomuk.semanticdesktop.org" title="Nepomuk home page">Nepomuk semantic desktop</a> framework present in KDE, so you&#8217;ll also need <a href="http://riverbankcomputing.com" title="Riverbank Computing (makers of PyQt4)">PyQt4</a> and <a href="http://techbase.kde.org/Development/Languages/Python">PyKDE4</a>, along with a working Nepomuk installation. Most distributions use the broken Soprano redland backend, which will not work, so I suggest you to switch to the sesame2 backend, which (although dependent on Java) works reasonably well.</p>
<h3>Download and installation</h3>
<p>Simply get <a href="http://www.dennogumi.org/files/danbooru2nepomuk.zip?cda6c1" title="Download link">danbooru2nepomuk.zip</a>, rename it to .py from .zip, save it in your PATH, and make it executable. Nothing more than that.</p>
<h3>Usage</h3>
<p>danbooru2nepomuk is a command line appplication. Its syntax is simple:</p>
<p>
<pre class="brush: plain; title: ; notranslate">danbooru2nepomuk.py [-r] &lt;file or directory&gt;</pre>
</p>
<p>If you specify a file, it will be tagged directly; if you specify a directory, it will be scanned for files, and those in turn will be tagged. If you add the -r switch to a directory, it will be scanned recursively, while it will be simply ignored if you use it with a file.</p>
<h3>Configuration</h3>
<p>You can specify a tag blacklist for tags in the filename that you don&#8217;t want to get in. To do so, edit the TAGS_BLACKLIST variable on line 41, and add more tags you don&#8217;t want Nepomuk to pick up. </p>
<h3>Known issues</h3>
<p>None that I know of, at least! If you find any, let me know. </p>
<p>danbooru2nepomuk is licensed under the GNU General Public License, version 2.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.dennogumi.org/2009/10/danbooru2nepomuk-a-nepomuk-tagger-for-danbooru-images/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Minified using xcache (Feed is rejected)
Page Caching using xcache
Database Caching 1/38 queries in 0.025 seconds using xcache
Object Caching 751/829 objects using xcache

Served from: www.dennogumi.org @ 2012-02-05 04:52:16 -->
