- <div class="title"><a href="http://people.skolelinux.org/pere/blog/UsingQR____Electronic__paper_invoices_using_JSON_and_QR_codes.html">UsingQR - "Electronic" paper invoices using JSON and QR codes</a></div>
- <div class="date">19th March 2016</div>
- <div class="body"><p>Back in 2013 I proposed
-<a href="http://people.skolelinux.org/pere/blog/_Electronic__paper_invoices___using_vCard_in_a_QR_code.html">a
-way to make paper and PDF invoices easier to process electronically by
-adding a QR code with the key information about the invoice</a>. I
-suggested using vCard field definition, to get some standard format
-for name and address, but any format would work. I did not do
-anything about the proposal, but hoped someone one day would make
-something like it. It would make it possible to efficiently send
-machine readable invoices directly between seller and buyer.</p>
-
-<p>This was the background when I came across a proposal and
-specification from the web based accounting and invoicing supplier
-<a href="http://www.visma.com/">Visma</a> in Sweden called
-<a href="http://usingqr.com/">UsingQR</a>. Their PDF invoices contain
-a QR code with the key information of the invoice in JSON format.
-This is the typical content of a QR code following the UsingQR
-specification (based on a real world example, some numbers replaced to
-get a more bogus entry). I've reformatted the JSON to make it easier
-to read. Normally this is all on one long line:</p>
-
-<p><img src="http://people.skolelinux.org/pere/blog/images/2016-03-19-qr-invoice.png" align="right"><pre>
-{
- "vh":500.00,
- "vm":0,
- "vl":0,
- "uqr":1,
- "tp":1,
- "nme":"Din Leverandør",
- "cc":"NO",
- "cid":"997912345 MVA",
- "iref":"12300001",
- "idt":"20151022",
- "ddt":"20151105",
- "due":2500.0000,
- "cur":"NOK",
- "pt":"BBAN",
- "acc":"17202612345",
- "bc":"BIENNOK1",
- "adr":"0313 OSLO"
-}
-</pre></p>
-
-</p>The interpretation of the fields can be found in the
-<a href="http://usingqr.com/wp-content/uploads/2014/06/UsingQR_specification1.pdf">format
-specification</a> (revision 2 from june 2014). The format seem to
-have most of the information needed to handle accounting and payment
-of invoices, at least the fields I have needed so far here in
-Norway.</p>
-
-<p>Unfortunately, the site and document do not mention anything about
-the patent, trademark and copyright status of the format and the
-specification. Because of this, I asked the people behind it back in
-November to clarify. Ann-Christine Savlid (ann-christine.savlid (at)
-visma.com) replied that Visma had not applied for patent or trademark
-protection for this format, and that there were no copyright based
-usage limitations for the format. I urged her to make sure this was
-explicitly written on the web pages and in the specification, but
-unfortunately this has not happened yet. So I guess if there is
-submarine patents, hidden trademarks or a will to sue for copyright
-infringements, those starting to use the UsingQR format might be at
-risk, but if this happen there is some legal defense in the fact that
-the people behind the format claimed it was safe to do so. At least
-with patents, there is always
-<a href="http://www.paperspecs.com/paper-news/beware-the-qr-code-patent-trap/">a
-chance of getting sued...</a></p>
-
-<p>I also asked if they planned to maintain the format in an
-independent standard organization to give others more confidence that
-they would participate in the standardization process on equal terms
-with Visma, but they had no immediate plans for this. Their plan was
-to work with banks to try to get more users of the format, and
-evaluate the way forward if the format proved to be popular. I hope
-they conclude that using an open standard organisation like
-<a href="http://www.ietf.org/">IETF</a> is the correct place to
-maintain such specification.</p>
-
-<p><strong>Update 2016-03-20</strong>: Via Twitter I became aware of
-<a href="https://news.ycombinator.com/item?id=11319492">some comments
-about this blog post</a> that had several useful links and references to
-similar systems. In the Czech republic, the Czech Banking Association
-standard #26, with short name SPAYD, uses QR codes with payment
-information. More information is available from the Wikipedia page on
-<a href="https://en.wikipedia.org/wiki/Short_Payment_Descriptor">Short
-Payment Descriptor</a>. And in Germany, there is a system named
-<a href="http://www.bezahlcode.de/">BezahlCode</a>,
-(<a href="http://www.bezahlcode.de/wp-content/uploads/BezahlCode_TechDok.pdf">specification
-v1.8 2013-12-05 available as PDF</a>), which uses QR codes with
-URL-like formatting using "bank:" as the URI schema/protocol to
-provide the payment information. There is also the
-<a href="http://www.ferd-net.de/front_content.php?idcat=231">ZUGFeRD</a>
-file format that perhaps could be transfered using QR codes, but I am
-not sure if it is done already. Last, in Bolivia there are reports
-that tax information since november 2014 need to be printed in QR
-format on invoices. I have not been able to track down a
-specification for this format, because of my limited language skill
-sets.</p>
+ <div class="title"><a href="http://people.skolelinux.org/pere/blog/A_program_should_be_able_to_open_its_own_files_on_Linux.html">A program should be able to open its own files on Linux</a></div>
+ <div class="date"> 5th June 2016</div>
+ <div class="body"><p>Many years ago, when koffice was fresh and with few users, I
+decided to test its presentation tool when making the slides for a
+talk I was giving for NUUG on Japhar, a free Java virtual machine. I
+wrote the first draft of the slides, saved the result and went to bed
+the day before I would give the talk. The next day I took a plane to
+the location where the meeting should take place, and on the plane I
+started up koffice again to polish the talk a bit, only to discover
+that kpresenter refused to load its own data file. I cursed a bit and
+started making the slides again from memory, to have something to
+present when I arrived. I tested that the saved files could be
+loaded, and the day seemed to be rescued. I continued to polish the
+slides until I suddenly discovered that the saved file could no longer
+be loaded into kpresenter. In the end I had to rewrite the slides
+three times, condensing the content until the talk became shorter and
+shorter. After the talk I was able to pinpoint the problem –
+kpresenter wrote inline images in a way itself could not understand.
+Eventually that bug was fixed and kpresenter ended up being a great
+program to make slides. The point I'm trying to make is that we
+expect a program to be able to load its own data files, and it is
+embarrassing to its developers if it can't.</p>
+
+<p>Did you ever experience a program failing to load its own data
+files from the desktop file browser? It is not a uncommon problem. A
+while back I discovered that the screencast recorder
+gtk-recordmydesktop would save an Ogg Theora video file the KDE file
+browser would refuse to open. No video player claimed to understand
+such file. I tracked down the cause being <tt>file --mime-type</tt>
+returning the application/ogg MIME type, which no video player I had
+installed listed as a MIME type they would understand. I asked for
+<a href="http://bugs.gw.com/view.php?id=382">file to change its
+behavour</a> and use the MIME type video/ogg instead. I also asked
+several video players to add video/ogg to their desktop files, to give
+the file browser an idea what to do about Ogg Theora files. After a
+while, the desktop file browsers in Debian started to handle the
+output from gtk-recordmydesktop properly.</p>
+
+<p>But history repeats itself. A few days ago I tested the music
+system Rosegarden again, and I discovered that the KDE and xfce file
+browsers did not know what to do with the Rosegarden project files
+(*.rg). I've reported <a href="http://bugs.debian.org/825993">the
+rosegarden problem to BTS</a> and a fix is commited to git and will be
+included in the next upload. To increase the chance of me remembering
+how to fix the problem next time some program fail to load its files
+from the file browser, here are some notes on how to fix it.</p>
+
+<p>The file browsers in Debian in general operates on MIME types.
+There are two sources for the MIME type of a given file. The output from
+<tt>file --mime-type</tt> mentioned above, and the content of the
+shared MIME type registry (under /usr/share/mime/). The file MIME
+type is mapped to programs supporting the MIME type, and this
+information is collected from
+<a href="https://www.freedesktop.org/wiki/Specifications/desktop-entry-spec/">the
+desktop files</a> available in /usr/share/applications/. If there is
+one desktop file claiming support for the MIME type of the file, it is
+activated when asking to open a given file. If there are more, one
+can normally select which one to use by right-clicking on the file and
+selecting the wanted one using 'Open with' or similar. In general
+this work well. But it depend on each program picking a good MIME
+type (preferably
+<a href="http://www.iana.org/assignments/media-types/media-types.xhtml">a
+MIME type registered with IANA</a>), file and/or the shared MIME
+registry recognizing the file and the desktop file to list the MIME
+type in its list of supported MIME types.</p>
+
+<p>The <tt>/usr/share/mime/packages/rosegarden.xml</tt> entry for
+<a href="http://www.freedesktop.org/wiki/Specifications/shared-mime-info-spec">the
+Shared MIME database</a> look like this:</p>
+
+<p><blockquote><pre>
+<?xml version="1.0" encoding="UTF-8"?>
+<mime-info xmlns="http://www.freedesktop.org/standards/shared-mime-info">
+ <mime-type type="audio/x-rosegarden">
+ <sub-class-of type="application/x-gzip"/>
+ <comment>Rosegarden project file</comment>
+ <glob pattern="*.rg"/>
+ </mime-type>
+</mime-info>
+</pre></blockquote></p>
+
+<p>This states that audio/x-rosegarden is a kind of application/x-gzip
+(it is a gzipped XML file). Note, it is much better to use an
+official MIME type registered with IANA than it is to make up ones own
+unofficial ones like the x-rosegarden type used by rosegarden.</p>
+
+<p>The desktop file of the rosegarden program failed to list
+audio/x-rosegarden in its list of supported MIME types, causing the
+file browsers to have no idea what to do with *.rg files:</p>
+
+<p><blockquote><pre>
+% grep Mime /usr/share/applications/rosegarden.desktop
+MimeType=audio/x-rosegarden-composition;audio/x-rosegarden-device;audio/x-rosegarden-project;audio/x-rosegarden-template;audio/midi;
+X-KDE-NativeMimeType=audio/x-rosegarden-composition
+%
+</pre></blockquote></p>
+
+<p>The fix was to add "audio/x-rosegarden;" at the end of the
+MimeType= line.</p>
+
+<p>If you run into a file which fail to open the correct program when
+selected from the file browser, please check out the output from
+<tt>file --mime-type</tt> for the file, ensure the file ending and
+MIME type is registered somewhere under /usr/share/mime/ and check
+that some desktop file under /usr/share/applications/ is claiming
+support for this MIME type. If not, please report a bug to have it
+fixed. :)</p>