<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
  
  <title>digip.org blog</title>
  
  <link href="http://www.digip.org/blog/" />
  <updated>2016-08-31T00:00:00Z</updated>
  <author>
    <name>Petri Lehtinen</name>
    <uri>http://www.digip.org/</uri>
  </author>
  <id>http://www.digip.org/blog/feed.atom</id>

  
  <entry>
    <title>No more posts about Jansson releases</title>
    <link href="http://www.digip.org/blog/2016/08/no-more-posts-about-jansson-releases.html" />
    <id>http://www.digip.org/blog/2016/08/no-more-posts-about-jansson-releases.html</id>
    <updated>2016-08-31 00:00:00</updated>
    
    <category term="jansson" />
    
    <category term="announcement" />
    
    <content type="html">
      &lt;p&gt;
  &lt;a href=&#34;/jansson/&#34;&gt;Jansson&lt;/a&gt; 2.8 was released yesterday. Because
  of lack of time, I haven&#39;t written blog posts about changes after
  the 2.6 release, and I&#39;m not planning to do so in the future,
  either.
&lt;/p&gt;
    </content>
  </entry>
  
  <entry>
    <title>Jansson 2.6 released</title>
    <link href="http://www.digip.org/blog/2014/04/jansson-2.6-released.html" />
    <id>http://www.digip.org/blog/2014/04/jansson-2.6-released.html</id>
    <updated>2014-04-01 00:00:00</updated>
    
    <category term="jansson" />
    
    <category term="announcement" />
    
    <content type="html">
      &lt;p&gt;
  &lt;a href=&#34;/jansson/&#34;&gt;Jansson&lt;/a&gt; 2.6 was released already on
  2014-02-11, but I totally forgot to blog about it or even update
  Jansson&#39;s web page. Sorry about that!
&lt;/p&gt;
&lt;p&gt;
  Jansson 2.6 is mainly a security release, changing the hash function
  that is used by Jansson&#39;s hashtable implementation. Other changes
  include minor documentation and build system corrections. For a more
  comprehensive list of changes, see
  the &lt;a href=&#34;http://jansson.readthedocs.org/en/2.6/changes.html#version-2-6&#34;&gt;release
  notes&lt;/a&gt;.
&lt;/p&gt;

&lt;h3&gt;New hash function&lt;/h3&gt;
&lt;p&gt;
  Jansson&#39;s old hash function was vulnerable to a denial of service
  attack. By using specially crafted keys, the attacker could reduce
  the performance of most object operations. For example, decoding a
  JSON text with such crafted keys would take tens of seconds for a
  relatively small file.
&lt;/p&gt;
&lt;p&gt;
  Jansson 2.6 changes the hash function to Bob Jenkins&#39; lookup3, which
  supports &lt;em&gt;seeding&lt;/em&gt;. As no non-cryptographic hash function is
  immune to the key crafting problem, the hash function is seeded by
  random data when the first JSON object is created, either by
  explicitly calling
  &lt;a href=&#34;https://jansson.readthedocs.org/en/2.6/apiref.html#json_object&#34;&gt;&lt;code&gt;json_object()&lt;/code&gt;&lt;/a&gt;,
  or by implicitly creating a new object e.g. by decoding a JSON text
  or
  calling &lt;a href=&#34;https://jansson.readthedocs.org/en/2.6/apiref.html#json_pack&#34;&gt;&lt;code&gt;json_pack()&lt;/code&gt;&lt;/a&gt;.
&lt;/p&gt;
&lt;p&gt;
  The purpose of seeding is to make the hash function yield different
  results on each program run. This makes it virtually impossible to
  launch a DoS attack anymore.
&lt;/p&gt;
&lt;p&gt;
  The hardest part of seeding is how to actually generate random data
  in a thread-safe manner. Jansson uses &lt;code&gt;/dev/urandom&lt;/code&gt; if
  it&#39;s available, or &lt;code&gt;CryptGenRandom()&lt;/code&gt; on Windows. If
  neither are available, a combination of a microsecond precision
  timestamp and process ID are used as the seed. Seed generation is
  guarded by architecture dependent lock-free operations to ensure
  thread safety.
&lt;/p&gt;
&lt;p&gt;
  A new
  function, &lt;a href=&#34;https://jansson.readthedocs.org/en/2.6/apiref.html#json_object_seed&#34;&gt;&lt;code&gt;json_object_seed()&lt;/code&gt;&lt;/a&gt;,
  is also exposed, to make it possible for the user to initiate the
  seeding, e.g. before spawning any threads.
&lt;/p&gt;
    </content>
  </entry>
  
  <entry>
    <title>Jansson 2.5 released</title>
    <link href="http://www.digip.org/blog/2013/09/jansson-2.5-released.html" />
    <id>http://www.digip.org/blog/2013/09/jansson-2.5-released.html</id>
    <updated>2013-09-23 00:00:00</updated>
    
    <category term="jansson" />
    
    <category term="announcement" />
    
    <content type="html">
      &lt;p&gt;
  &lt;a href=&#34;/jansson/&#34;&gt;Jansson&lt;/a&gt; 2.5 was released a few days ago. It
  was almost a year since last release, and a lot has happened during
  this time. In this post, I&#39;ll sum up the most important new
  features. For a more comprehensive list of changes, see
  the &lt;a href=&#34;http://jansson.readthedocs.org/en/2.5/changes.html#version-2-5&#34;&gt;release
  notes&lt;/a&gt;.
&lt;/p&gt;

&lt;h3&gt;New format specifiers&lt;/h3&gt;
&lt;p&gt;
  &lt;a href=&#34;http://jansson.readthedocs.org/en/2.5/apiref.html#json_pack&#34;&gt;json_pack()&lt;/a&gt;
  and friends learned new format
  specifiers: &lt;code&gt;s#&lt;/code&gt;, &lt;code&gt;+#&lt;/code&gt; and &lt;code&gt;+#&lt;/code&gt;.
  All of them deal with packing strings, and they work with both
  object keys and string values.
&lt;/p&gt;
&lt;p&gt;
 The &lt;code&gt;s#&lt;/code&gt; format lets you define a length of a substring to
  be packed. Example:
&lt;/p&gt;
&lt;div class=&#34;pygments&#34;&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&#34;k&#34;&gt;const&lt;/span&gt; &lt;span class=&#34;kt&#34;&gt;char&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;*&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;data&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;=&lt;/span&gt; &lt;span class=&#34;s&#34;&gt;&amp;quot;abcdef&amp;quot;&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;;&lt;/span&gt;
&lt;span class=&#34;n&#34;&gt;json_pack&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;s&#34;&gt;&amp;quot;{s#: s#&amp;quot;&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;,&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;data&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;,&lt;/span&gt; &lt;span class=&#34;mi&#34;&gt;3&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;,&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;data&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;+&lt;/span&gt; &lt;span class=&#34;mi&#34;&gt;3&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;,&lt;/span&gt; &lt;span class=&#34;mi&#34;&gt;3&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;);&lt;/span&gt;
&lt;span class=&#34;cm&#34;&gt;/* ==&amp;gt; {&amp;quot;abd&amp;quot;: &amp;quot;def&amp;quot;} */&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;
  The &lt;code&gt;+&lt;/code&gt; format makes it possible to concatenate strings
  on the fly easily. It only works after a &lt;code&gt;s&lt;/code&gt; or
  a &lt;code&gt;+&lt;/code&gt;, and has the effect of joining the given string to
  the previous string:
&lt;/p&gt;
&lt;div class=&#34;pygments&#34;&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;json_pack&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;s&#34;&gt;&amp;quot;{s+: s++}&amp;quot;&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;,&lt;/span&gt; &lt;span class=&#34;s&#34;&gt;&amp;quot;abc&amp;quot;&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;,&lt;/span&gt; &lt;span class=&#34;s&#34;&gt;&amp;quot;def&amp;quot;&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;,&lt;/span&gt; &lt;span class=&#34;s&#34;&gt;&amp;quot;foo&amp;quot;&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;,&lt;/span&gt; &lt;span class=&#34;s&#34;&gt;&amp;quot;bar&amp;quot;&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;,&lt;/span&gt; &lt;span class=&#34;s&#34;&gt;&amp;quot;baz&amp;quot;&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;);&lt;/span&gt;
&lt;span class=&#34;cm&#34;&gt;/* ==&amp;gt; {&amp;quot;abcdef&amp;quot;: &amp;quot;foobarbaz&amp;quot;} */&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;
  And &lt;code&gt;+#&lt;/code&gt; is of course for concatenating a substring.
  Here&#39;s a more complex example that shows that the new format
  specifiers can be mixed in any way you can think of:
&lt;/p&gt;
&lt;div class=&#34;pygments&#34;&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&#34;k&#34;&gt;const&lt;/span&gt; &lt;span class=&#34;kt&#34;&gt;char&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;*&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;data&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;=&lt;/span&gt; &lt;span class=&#34;s&#34;&gt;&amp;quot;abcdef&amp;quot;&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;;&lt;/span&gt;
&lt;span class=&#34;n&#34;&gt;json_pack&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;s&#34;&gt;&amp;quot;{s+#+: s#+#&amp;quot;&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;,&lt;/span&gt; &lt;span class=&#34;s&#34;&gt;&amp;quot;fed&amp;quot;&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;,&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;data&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;,&lt;/span&gt; &lt;span class=&#34;mi&#34;&gt;3&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;,&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;data&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;+&lt;/span&gt; &lt;span class=&#34;mi&#34;&gt;3&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;,&lt;/span&gt;
                         &lt;span class=&#34;n&#34;&gt;data&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;,&lt;/span&gt; &lt;span class=&#34;mi&#34;&gt;1&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;,&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;data&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;,&lt;/span&gt; &lt;span class=&#34;mi&#34;&gt;2&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;);&lt;/span&gt;
&lt;span class=&#34;cm&#34;&gt;/* ==&amp;gt; {&amp;quot;fedabcdef&amp;quot;: &amp;quot;aab&amp;quot;} */&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;
  The new format specifiers are a response for two types of user needs
  that are discussed regularly
  on &lt;a href=&#34;https://github.com/akheron/jansson&#34;&gt;GitHub&lt;/a&gt;
  and &lt;a href=&#34;http://groups.google.com/group/jansson-users&#34;&gt;mailing
  list&lt;/a&gt;: Creating string values from non-NUL terminated buffers by
  specifying a length, and making it easier to work with strings
  directly in Jansson without having to do the C level plumbing
  yourself. &lt;code&gt;s#&lt;/code&gt; solves the first need, and &lt;code&gt;+&lt;/code&gt;
  and &lt;code&gt;+#&lt;/code&gt; help with a common use case of concatenating two
  strings, although they&#39;re definitely not a magic bullet for every
  string manipulation need.
&lt;/p&gt;
&lt;p&gt;
  There&#39;s also a good reason why these operations were implemented as
  an extension to &lt;code&gt;json_pack()&lt;/code&gt; and not API functions of
  their own. Creating a new API function for every combination of
  possible string operations, encoding control, allocation schemes,
  etc. would need a vast amount of string functions. Extending all of
  this to object keys would make the situation three times worse.
&lt;/p&gt;

&lt;h3&gt;CMake build system&lt;/h3&gt;
&lt;p&gt;
  Support for &lt;a href=&#34;http://www.cmake.org&#34;&gt;CMake&lt;/a&gt; was perhaps the
  single most requested feature for a long time. While GNU Autotools,
  Jansson&#39;s default build system, generally works well on Unix-like
  platforms, many people find CMake generally better and easier to
  use. It also has better support for non-Unix systems, namely
  Windows.
&lt;/p&gt;
&lt;p&gt;
  GNU &lt;a href=&#34;http://www.gnu.org/software/autoconf/&#34;&gt;Autoconf&lt;/a&gt;,
  &lt;a href=&#34;http://www.gnu.org/software/automake/&#34;&gt;Automake&lt;/a&gt;
  and &lt;a href=&#34;http://www.gnu.org/software/libtool/&#34;&gt;Libtool&lt;/a&gt; still
  stay the default build system for Jansson. However, the CMake build
  system is complete in a sense that it does everything that the
  autotools build system does (generates documentation, runs tests,
  etc.).
&lt;/p&gt;
&lt;p&gt;
  Many thanks to &lt;a href=&#34;https://github.com/paulharris&#34;&gt;Paul
  Harris&lt;/a&gt; for initially developing the CMake support, and
  to &lt;a href=&#34;https://github.com/JoakimSoderberg&#34;&gt;Joakim Söderberg&lt;/a&gt;
  for finishing the work and correcting many bugs and feature requests
  afterwards.
&lt;/p&gt;

&lt;h3&gt;Smaller features&lt;/h3&gt;
&lt;p&gt;
  A new decoding flag &lt;code&gt;JSON_DECODE_INT_AS_REAL&lt;/code&gt; was added.
  It makes the decoder return all numbers as reals, regardless of
  whether their text representation
  contains &lt;code&gt;.&lt;/code&gt;, &lt;code&gt;e&lt;/code&gt; or &lt;code&gt;E&lt;/code&gt;.
&lt;/p&gt;
&lt;p&gt;
  &lt;a href=&#34;https://jansson.readthedocs.org/en/2.5/apiref.html#json_array_foreach&#34;&gt;&lt;code&gt;json_array_foreach()&lt;/code&gt;&lt;/a&gt;
  macro was added, paralleling
  &lt;a href=&#34;https://jansson.readthedocs.org/en/2.5/apiref.html#json_object_foreach&#34;&gt;&lt;code&gt;json_object_foreach()&lt;/code&gt;&lt;/a&gt;.
  Even though a loop over an array is easier to create, this macro
  makes it even simpler and better looking to iterate over an array:
&lt;/p&gt;
&lt;div class=&#34;pygments&#34;&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;json_t&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;*&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;array&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;;&lt;/span&gt;  &lt;span class=&#34;cm&#34;&gt;/* holds an array */&lt;/span&gt;
&lt;span class=&#34;kt&#34;&gt;size_t&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;index&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;;&lt;/span&gt;
&lt;span class=&#34;n&#34;&gt;json_t&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;*&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;value&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;;&lt;/span&gt;
&lt;span class=&#34;n&#34;&gt;json_array_foreach&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;array&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;,&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;index&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;,&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;value&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;)&lt;/span&gt; &lt;span class=&#34;p&#34;&gt;{&lt;/span&gt;
    &lt;span class=&#34;cm&#34;&gt;/* index is the current position of iteration,&lt;/span&gt;
&lt;span class=&#34;cm&#34;&gt;       value is the JSON value at that position.&lt;/span&gt;
&lt;span class=&#34;cm&#34;&gt;    */&lt;/span&gt;
&lt;span class=&#34;p&#34;&gt;}&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;
  The &lt;code&gt;struct json_t&lt;/code&gt; can now be forward declared. This
  makes it possible to avoid including &lt;code&gt;&amp;lt;jansson.h&amp;gt;&lt;/code&gt;
  in header files that declare global &lt;code&gt;json_t *&lt;/code&gt; variables
  or funtions whose signature uses &lt;code&gt;json_t *&lt;/code&gt;.
&lt;/p&gt;
    </content>
  </entry>
  
  <entry>
    <title>Jansson's documentation moved to Read the Docs</title>
    <link href="http://www.digip.org/blog/2013/08/jansson-s-documentation-moved-to-read-the-docs.html" />
    <id>http://www.digip.org/blog/2013/08/jansson-s-documentation-moved-to-read-the-docs.html</id>
    <updated>2013-08-21 00:00:00</updated>
    
    <category term="jansson" />
    
    <category term="readthedocs" />
    
    <content type="html">
      &lt;p&gt;
  &lt;a href=&#34;/jansson/&#34;&gt;Jansson&#39;s&lt;/a&gt;
  &lt;a href=&#34;https://jansson.readthedocs.org/&#34;&gt;documentation&lt;/a&gt; has
  been moved to &lt;a href=&#34;https://readthedocs.org/&#34;&gt;Read the Docs&lt;/a&gt;,
  an amazing service for hosting
  &lt;a href=&#34;http://sphinx-doc.org/&#34;&gt;Sphinx&lt;/a&gt;-powered documentation.
  The documentation of many popular open source projects are already
  hosted on RTD (e.g. &lt;a href=&#34;https://pip.readthedocs.org/&#34;&gt;pip&lt;/a&gt;,
  &lt;a href=&#34;https://south.readthedocs.org&#34;&gt;South&lt;/a&gt;,
  &lt;a href=&#34;www.tornadoweb.org/&#34;&gt;Tornado&lt;/a&gt;), and it seems to be quite
  popular especially among open source Python projects.
&lt;/p&gt;
&lt;p&gt;
  The main motivation for me to do this change was the mobile aware
  Sphinx theme. For a long time I&#39;ve been aware of the the fact that
  Jansson&#39;s documentation cannot be viewed nicely with mobile devices,
  so it was about time to fix it. The docs look a bit different now,
  but I think it&#39;s a change for the better.
&lt;/p&gt;
&lt;p&gt;
  In addition to mobile support, I also got automatic documentation
  builds for all branches. It was as easy as pointing RTD to Jansson&#39;s
  &lt;a href=&#34;https://github.com/akheron/jansson&#34;&gt;git repo&lt;/a&gt; and
  selecting tags and branches that get built automatically. GitHub has
  a built-in service hook that rebuilds changed docs each time I push.
  Could it be easier than this?
&lt;/p&gt;
&lt;p&gt;
  I hope you like &lt;a href=&#34;https://jansson.readthedocs.org/&#34;&gt;the new
  documentation&lt;/a&gt; as much as I do!
&lt;/p&gt;
    </content>
  </entry>
  
  <entry>
    <title>Jansson 2.4 released</title>
    <link href="http://www.digip.org/blog/2012/09/jansson-2.4-released.html" />
    <id>http://www.digip.org/blog/2012/09/jansson-2.4-released.html</id>
    <updated>2012-09-23 00:00:00</updated>
    
    <category term="jansson" />
    
    <category term="announcement" />
    
    <content type="html">
      &lt;p&gt;
  &lt;a href=&#34;/jansson/&#34;&gt;Jansson&lt;/a&gt; 2.4 has been released. This release
  adds new features and fixes a few bugs and documentation issues. It
  also adds support for building the library on Microsoft Visual
  Studio. The full release notes are
  available &lt;a href=&#34;https://jansson.readthedocs.org/en/2.4/changes.html#version-2-4&#34;&gt;here&lt;/a&gt;.
&lt;/p&gt;

&lt;h3&gt;New features&lt;/h3&gt;
&lt;p&gt;
  A new macro, &lt;a href=&#34;https://jansson.readthedocs.org/en/2.4/apiref.html#json_boolean&#34;&gt;json_boolean()&lt;/a&gt;,
  was added. It returns either the JSON true or JSON false value based
  on its argument. It&#39;s useful in situations like this:
&lt;/p&gt;
&lt;div class=&#34;pygments&#34;&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;json_t&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;*&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;value&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;;&lt;/span&gt;
&lt;span class=&#34;kt&#34;&gt;int&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;yes&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;=&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;read_value_from_somewhere&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;();&lt;/span&gt;
&lt;span class=&#34;n&#34;&gt;value&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;=&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;json_boolean&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;yes&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;);&lt;/span&gt;  &lt;span class=&#34;cm&#34;&gt;/* false if yes == 0, true otherwise */&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;
  It&#39;s now possible to decode JSON with a callback providing the
  source JSON text. The
  new &lt;a href=&#34;https://jansson.readthedocs.org/en/2.4/apiref.html#json_load_callback&#34;&gt;json_load_callback()&lt;/a&gt;
  function calls a callback repeatedly to read the source JSON. This
  is useful when the JSON data is received from a custom stream, for
  example.
&lt;/p&gt;
&lt;p&gt;
  JSON allows, but doesn&#39;t require, escaping &lt;code&gt;/&lt;/code&gt; characters
  with &lt;code&gt;\/&lt;/code&gt;. This is useful when JSON is embedded in a
  HTML &lt;code&gt;&amp;lt;script&amp;gt;&lt;/code&gt; tag, because the
  string &lt;code&gt;&amp;lt;/&lt;/code&gt; must not occur inside
  a &lt;code&gt;&amp;lt;script&amp;gt;&lt;/code&gt; tag. When using the
  new &lt;code&gt;JSON_ESCAPE_SLASH&lt;/code&gt; encoding flag, Jansson now
  escapes &lt;code&gt;/&lt;/code&gt;&#39;s for you.
&lt;/p&gt;

&lt;h3&gt;Bug fixes&lt;/h3&gt;
&lt;p&gt;
  Until now, it has been possible to make Jansson produce invalid JSON
  by creating a real value with an Inf or NaN special
  value. &lt;a href=&#34;https://jansson.readthedocs.org/en/2.4/apiref.html#json_real&#34;&gt;json_real()&lt;/a&gt;
  and &lt;a href=&#34;https://jansson.readthedocs.org/en/2.4/apiref.html#json_real_set&#34;&gt;json_real_set()&lt;/a&gt;
  now check for these special values and refuse to accept them,
  returning -1 to signal an error. (As a matter of
  fact, &lt;code&gt;json_real_set()&lt;/code&gt; returned 0 even on other errors,
  and this was fixed, too.)
&lt;/p&gt;

&lt;h3&gt;Windows support&lt;/h3&gt;
&lt;p&gt;
  It&#39;s now possible to build Jansson on Windows with Microsoft Visual
  Studio. All the build errors have been fixed, and solution and
  project files for Visual Studio 2010 are included in
  the &lt;code&gt;win32/vs2010/&lt;/code&gt; directory in the source distribution.
&lt;/p&gt;
    </content>
  </entry>
  
  <entry>
    <title>Sala 1.3 released</title>
    <link href="http://www.digip.org/blog/2012/06/sala-1.3-released.html" />
    <id>http://www.digip.org/blog/2012/06/sala-1.3-released.html</id>
    <updated>2012-06-13 00:00:00</updated>
    
    <category term="sala" />
    
    <category term="python" />
    
    <category term="announcement" />
    
    <content type="html">
      &lt;p&gt;
  &lt;a href=&#34;/sala/&#34;&gt;sala&lt;/a&gt; 1.3 is now available
  on &lt;a href=&#34;http://pypi.python.org/pypi/sala/1.3&#34;&gt;PyPI&lt;/a&gt;!
&lt;/p&gt;
&lt;p&gt;
  New features:
&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;
    Support for hooks, with a post-set hook initially supported.
    Patch by Jyrki Pulliainen.
  &lt;/li&gt;
  &lt;li&gt;
    Bash completion script for tab-completion
    in &lt;code&gt;$SALADIR&lt;/code&gt;.
  &lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
  Other changes:
&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;
    Move the repository state to the &lt;code&gt;.sala&lt;/code&gt;
    subdirectory. &lt;code&gt;.salakey&lt;/code&gt; becomes &lt;code&gt;.sala/key&lt;/code&gt;
    and &lt;code&gt;sala.conf&lt;/code&gt; becomes &lt;code&gt;.sala/config&lt;/code&gt;.
    These files are moved when sala 1.3 is run the first time on an
    old repository. Initial patch by Jyrki Pulliainen.
  &lt;/li&gt;
  &lt;li&gt;
    Respect SALADIR when creating subdirectories with &lt;code&gt;set&lt;/code&gt;.
  &lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
  When writing this post, I noticed that there was no announcement
  whatsoever for sala 1.2 last December. Even
  sala&#39;s &lt;a href=&#34;/sala/&#34;&gt;homepage&lt;/a&gt; wasn&#39;t updated! I&#39;ll try to pay
  more attention from now on :)
&lt;/p&gt;

    </content>
  </entry>
  
  <entry>
    <title>Jansson 2.3.1 released</title>
    <link href="http://www.digip.org/blog/2012/04/jansson-2.3.1-released.html" />
    <id>http://www.digip.org/blog/2012/04/jansson-2.3.1-released.html</id>
    <updated>2012-04-20 00:00:00</updated>
    
    <category term="jansson" />
    
    <category term="announcement" />
    
    <content type="html">
      &lt;p&gt;
  &lt;a href=&#34;/jansson/&#34;&gt;Jansson&lt;/a&gt; 2.3.1 has been released. This
  release fixes some minor bugs and documentation issues. The full
  release notes are
  available &lt;a href=&#34;https://jansson.readthedocs.org/en/2.3/changes.html#version-2-3-1&#34;&gt;here&lt;/a&gt;.
&lt;/p&gt;

    </content>
  </entry>
  
  <entry>
    <title>Jansson 2.3 released</title>
    <link href="http://www.digip.org/blog/2012/01/jansson-2.3-released.html" />
    <id>http://www.digip.org/blog/2012/01/jansson-2.3-released.html</id>
    <updated>2012-01-27 00:00:00</updated>
    
    <category term="jansson" />
    
    <category term="announcement" />
    
    <content type="html">
      &lt;p&gt;
  &lt;a href=&#34;/jansson/&#34;&gt;Jansson&lt;/a&gt; 2.3 has been released. This release
  adds new features and fixes some minor bugs and documentation
  issues. The full release notes are
  available &lt;a href=&#34;https://jansson.readthedocs.org/en/2.3/changes.html#version-2-3&#34;&gt;here&lt;/a&gt;.
&lt;/p&gt;

&lt;h3&gt;New features&lt;/h3&gt;
&lt;p&gt;
  New syntax for optional object keys was added
  to &lt;a href=&#34;https://jansson.readthedocs.org/en/2.3/apiref.html#parsing-and-validating-values&#34;&gt;unpacking
  functions&lt;/a&gt;. For example, this call:
&lt;/p&gt;
&lt;pre class=&#34;highlight c&#34;&gt;/* obj is a JSON object */
json_unpack(obj, &#34;{s?i}&#34;, &#34;foo&#34;, &amp;myint)
&lt;/pre&gt;
&lt;p&gt;
  only writes to &lt;code&gt;myint&lt;/code&gt; if the key &lt;code&gt;foo&lt;/code&gt; exists
  in &lt;code&gt;obj&lt;/code&gt;.
&lt;/p&gt;

&lt;p&gt;
  New
  functions, &lt;a href=&#34;https://jansson.readthedocs.org/en/2.3/apiref.html#json_object_update_existing&#34;&gt;&lt;code&gt;json_object_update_existing()&lt;/code&gt;&lt;/a&gt;
  and &lt;a href=&#34;https://jansson.readthedocs.org/en/2.3/apiref.html#json_object_update_missing&#34;&gt;&lt;code&gt;json_object_update_missing()&lt;/code&gt;&lt;/a&gt;
  were added. They work
  like &lt;a href=&#34;https://jansson.readthedocs.org/en/2.3/apiref.html#json_object_update&#34;&gt;&lt;code&gt;json_object_update()&lt;/code&gt;&lt;/a&gt;,
  but only update existing object keys or add new keys, respectively.
&lt;/p&gt;

&lt;p&gt;
  &lt;a href=&#34;https://jansson.readthedocs.org/en/2.3/apiref.html#json_object_foreach&#34;&gt;&lt;code&gt;json_object_foreach()&lt;/code&gt;&lt;/a&gt;
  macro was added for convenient iteration over objects. For example,
  the following code prints all keys in an object:
&lt;/p&gt;
&lt;pre class=&#34;highlight c&#34;&gt;/* obj is a JSON object */
const char *key;
json_t *value;

json_object_foreach(obj, key, value) {
    printf(&#34;Found key: %s\n&#34;, key);
}
&lt;/pre&gt;
&lt;p&gt;
  The macro expands to an ordinary for loop, and its performance is
  comparable to hand-written iteration code. It&#39;s now also used
  internally in many places to replace old hand-written loops. Thanks
  to Marco Aurélio for the idea and initial implementation!
&lt;/p&gt;
&lt;p&gt;
  When decoding JSON, the number of bytes read from the input is now
  stored to &lt;code&gt;error.position&lt;/code&gt; even if on success. This makes
  it possible to use the &lt;code&gt;JSON_DISABLE_EOF_CHECK&lt;/code&gt; to decode
  multiple JSON texts from a single input also when decoding from
  string
  with &lt;a href=&#34;https://jansson.readthedocs.org/en/2.3/apiref.html#json_loads&#34;&gt;&lt;code&gt;json_loads()&lt;/code&gt;&lt;/a&gt;
  or &lt;a href=&#34;https://jansson.readthedocs.org/en/2.3/apiref.html#json_loadb&#34;&gt;&lt;code&gt;json_loadb()&lt;/code&gt;&lt;/a&gt;.
  Before this change, it was only possible when decoding from a file
  stream
  using &lt;a href=&#34;https://jansson.readthedocs.org/en/2.3/apiref.html#json_loadf&#34;&gt;&lt;code&gt;json_loadf()&lt;/code&gt;&lt;/a&gt;,
  because the file position could be used to determine where reading
  stopped.
&lt;/p&gt;
&lt;p&gt;
  Jansson can now decode any JSON value, not only arrays or objects.
  This support can be enabled with the
  new &lt;code&gt;JSON_DECODE_ANY&lt;/code&gt; decoding flag. Note that this
  violates strict &lt;a href=&#34;http://www.ietf.org/rfc/rfc4627&#34;&gt;RFC
  4627&lt;/a&gt; conformance, so it should be used with caution. There are
  also some caveats when dealing with decoding errors. See
  the &lt;a href=&#34;https://jansson.readthedocs.org/en/2.3/apiref.html#decoding&#34;&gt;documentation&lt;/a&gt;
  for details. Patch by Andrea Marchesini.
&lt;/p&gt;

&lt;h3&gt;Bug fixes&lt;/h3&gt;
&lt;p&gt;
  Each JSON object has an internal serial number that is used to
  record the addition order of keys. It&#39;s now reset
  when &lt;a href=&#34;https://jansson.readthedocs.org/en/2.3/apiref.html#json_object_clear&#34;&gt;&lt;code&gt;json_object_clear()&lt;/code&gt;&lt;/a&gt;
  is called to avoid it growing out of bounds for long-living objects.
  Handling of large serial numbers also now works better when
  encoding.
&lt;/p&gt;
&lt;p&gt;
  All decoding functions now properly return &lt;code&gt;NULL&lt;/code&gt; when
  the first argument is &lt;code&gt;NULL&lt;/code&gt;. Patch by Andrea Marchesini.
&lt;/p&gt;
&lt;p&gt;
  Obsolete leading &lt;code&gt;+&lt;/code&gt; and zeros in exponents aren&#39;t
  written anymore when encoding real numbers. Jansson now also
  compiles and runs correctly
  on &lt;a href=&#34;http://www.mingw.org/&#34;&gt;MinGW&lt;/a&gt;.
&lt;/p&gt;

    </content>
  </entry>
  
  <entry>
    <title>Jansson 2.2.1 released</title>
    <link href="http://www.digip.org/blog/2011/10/jansson-2.2.1-released.html" />
    <id>http://www.digip.org/blog/2011/10/jansson-2.2.1-released.html</id>
    <updated>2011-10-06 00:00:00</updated>
    
    <category term="jansson" />
    
    <category term="announcement" />
    
    <content type="html">
      &lt;p&gt;
  &lt;a href=&#34;/jansson/&#34;&gt;Jansson&lt;/a&gt; 2.2.1 has been released. This
  release fixes a major bug and little documentation and style issues.
&lt;/p&gt;
&lt;p&gt;
  The bug has to do with locales: Jansson&#39;s encoder and decoder both
  failed hard on real numbers when the locale&#39;s decimal separator was
  not the standard one. Furthermore, the decoder issued invalid error
  messages in some cases under non-UTF-8 locales.
&lt;/p&gt;
&lt;p&gt;
  The full release notes are
  available &lt;a href=&#34;https://jansson.readthedocs.org/en/2.2/changes.html#version-2-2-1&#34;&gt;here&lt;/a&gt;.
&lt;/p&gt;

    </content>
  </entry>
  
  <entry>
    <title>Jansson 2.2 released</title>
    <link href="http://www.digip.org/blog/2011/09/jansson-2.2-released.html" />
    <id>http://www.digip.org/blog/2011/09/jansson-2.2-released.html</id>
    <updated>2011-09-03 00:00:00</updated>
    
    <category term="jansson" />
    
    <category term="announcement" />
    
    <content type="html">
      &lt;p&gt;
  &lt;a href=&#34;/jansson/&#34;&gt;Jansson&lt;/a&gt; 2.2 has been released. This release
  adds one new encoding
  function, &lt;a href=&#34;https://jansson.readthedocs.org/en/2.2/apiref.html#json_dump_callback&#34;&gt;&lt;code&gt;json_dump_callback()&lt;/code&gt;&lt;/a&gt;,
  and fixes some minor bugs and documentation glitches. The full
  release notes are
  available &lt;a href=&#34;https://jansson.readthedocs.org/en/2.2/changes.html#version-2-2&#34;&gt;here&lt;/a&gt;.
&lt;/p&gt;
&lt;p&gt;
  The new encoding function makes it possible to send encoder&#39;s output
  to a callback function. Here&#39;s an example:
&lt;/p&gt;
&lt;pre class=&#34;highlight c&#34;&gt;
#include &amp;lt;jansson.h&amp;gt;

/* Print the buffer&#39;s contents. */
int callback(const char *buffer, size_t size, void *x) {
    printf(&#34;%.*s\n&#34;, size, buffer);
    return 0;
}

int main() {
    json_t *root = json_pack(&#34;{s:s, s:i}&#34;, &#34;greeting&#34;, &#34;Hello, World!&#34;, &#34;number&#34;, 42);
    json_dump_callback(root, callback, NULL, 0);
    return 0;
}
&lt;/pre&gt;
&lt;p&gt;
  The third parameter to &lt;code&gt;json_dump_callback()&lt;/code&gt;
  (&lt;code&gt;NULL&lt;/code&gt; in this case) is passed through to the callback
  as &lt;code&gt;x&lt;/code&gt;.
&lt;/p&gt;
&lt;p&gt;
  Thanks to Jonathan Landis for the initial patch!
&lt;/p&gt;

    </content>
  </entry>
  
  <entry>
    <title>Jansson is two years old</title>
    <link href="http://www.digip.org/blog/2011/08/jansson-is-two-years-old.html" />
    <id>http://www.digip.org/blog/2011/08/jansson-is-two-years-old.html</id>
    <updated>2011-08-25 00:00:00</updated>
    
    <category term="jansson" />
    
    <category term="pyconfi" />
    
    <content type="html">
      &lt;p&gt;
  Today is &lt;a href=&#34;/jansson/&#34;&gt;Jansson&#39;s&lt;/a&gt; birthday. The first
  release, Jansson 1.0, was released on August 25, 2009. At that time,
  I thought the library was substantially ready, and there would be
  only few or no new features to be added anymore. I was wrong.
&lt;/p&gt;
&lt;p&gt;
  Because I thought that the library was ready and mature, I was bold
  and gave it the version number 1.0. In open source software, it&#39;s
  quite common to have 0.x versions for years and years. The safety of
  0.x versions lies in the illusion that you can break backwards
  compatibility in new versions. In my opinion it&#39;s like pulling the
  carpet from under the users&#39; feet.
&lt;/p&gt;
&lt;p&gt;
  Quite soon it turned out that Jansson wasn&#39;t so mature and
  featureful after all. On Jansson&#39;s first birthday, version 1.3 had
  been out for two months and there were plenty of new features
  compared to 1.0. But there were a few problems that bugged me, and
  fixing them was not possible without breaking backwards
  compatibility.
&lt;/p&gt;
&lt;p&gt;
  It took a long time to make, but version 2.0 was finally released on
  February 28, 2011. It was the first, and hopefully last, backwards
  incompatible version, fixing design mistakes in the 1.x series. For
  the first time, I also tried to prepare for the future; the decoding
  functions got an extra, unused &lt;em&gt;flags&lt;/em&gt; parameter for future
  needs. The preparing paid off, as version 2.1 already uses the new
  parameter, and we didn&#39;t need another backwards incompatible change
  to make it happen.
&lt;/p&gt;
&lt;p&gt;
  What&#39;s most remarkable, though, is that there are people out there
  who actually use Jansson to make awesome things happen! The library
  started out as a project to replace existing JSON libraries for C,
  just because none of them was appropriate for my needs. As time
  passed, it turned out that other people had similar needs, and that
  was the driving force for me to fix bugs, add new features, review
  patches, etc. Thank you everyone, without you there wouldn&#39;t be
  Jansson as we know it!
&lt;/p&gt;
&lt;p&gt;
  To celebrate the birthday, I was planning to release version 2.2
  today. However, I&#39;ve been extremely busy
  organizing &lt;a href=&#34;http://fi.pycon.org/2011/&#34;&gt;PyCon Finland
  2011&lt;/a&gt; for the last weeks and months. I really hope to get 2.2 out
  soon.
&lt;/p&gt;

    </content>
  </entry>
  
  <entry>
    <title>Jansson 2.1 released</title>
    <link href="http://www.digip.org/blog/2011/06/jansson-2.1-released.html" />
    <id>http://www.digip.org/blog/2011/06/jansson-2.1-released.html</id>
    <updated>2011-06-11 00:00:00</updated>
    
    <category term="jansson" />
    
    <category term="announcement" />
    
    <content type="html">
      &lt;p&gt;
  &lt;a href=&#34;/jansson/&#34;&gt;Jansson&lt;/a&gt; 2.1 was released yesterday. This
  release adds a few new features and fixes some minor bugs. The full
  release notes are
  available &lt;a href=&#34;https://jansson.readthedocs.org/en/2.1/changes.html#version-2-1&#34;&gt;here&lt;/a&gt;.
&lt;/p&gt;

&lt;h3&gt;New features&lt;/h3&gt;
&lt;p&gt;
  A new decoding
  function, &lt;a href=&#34;https://jansson.readthedocs.org/en/2.1/apiref.html#json_loadb&#34;&gt;&lt;code&gt;json_loadb()&lt;/code&gt;&lt;/a&gt;,
  was added for decoding buffers with length. The most important thing
  is that the input buffer need not be null terminated. In the future,
  it may also help to implement the support for zero bytes inside
  strings.
&lt;/p&gt;
&lt;p&gt;
  &lt;code&gt;json_loadb()&lt;/code&gt; is
  like &lt;a href=&#34;https://jansson.readthedocs.org/en/2.1/apiref.html#json_loads&#34;&gt;&lt;code&gt;json_loads()&lt;/code&gt;&lt;/a&gt;,
  except that it takes an additional &lt;em&gt;length&lt;/em&gt; argument:
&lt;/p&gt;
&lt;pre class=&#34;highlight c&#34;&gt;
value = json_loadb(buffer, length, 0, &amp;error);
&lt;/pre&gt;
&lt;p&gt;
  This version also introduces two new decoding flags and one new
  encoding flag:
&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;
    &lt;code&gt;JSON_REJECT_DUPLICATES&lt;/code&gt;: Issue a decoding error if any
    JSON object in the input contins duplicate keys.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;JSON_DISABLE_EOF_CHECK&lt;/code&gt;: Stop decoding after a valid
    JSON input. This allows other data after the JSON data.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;JSON_ENCODE_ANY&lt;/code&gt;: Allow encoding any JSON value.
    Without this flag, only arrays and objects can be encoded as the
    root value.
  &lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;Bugfixes&lt;/h3&gt;
&lt;ul&gt;
  &lt;li&gt;
    Fix a memory leak when memory allocation fails in
    &lt;a href=&#34;https://jansson.readthedocs.org/en/2.1/apiref.rst#json_object_set&#34;&gt;json_object_set()&lt;/a&gt;
    and friends.
  &lt;/li&gt;
  &lt;li&gt;
    Clear &lt;code&gt;errno&lt;/code&gt; before calling &lt;code&gt;strtod()&lt;/code&gt; for
    better portability (MINGW in this case).
  &lt;/li&gt;
  &lt;li&gt;
    Avoid set-but-not-used warning/error when building with the newest
    GCC.
  &lt;/li&gt;
&lt;/ul&gt;

    </content>
  </entry>
  
  <entry>
    <title>Jansson 2.0.1 released</title>
    <link href="http://www.digip.org/blog/2011/04/jansson-2.0.1-released.html" />
    <id>http://www.digip.org/blog/2011/04/jansson-2.0.1-released.html</id>
    <updated>2011-04-01 00:00:00</updated>
    
    <category term="jansson" />
    
    <category term="announcement" />
    
    <content type="html">
      &lt;p&gt;
  Jansson 2.0.1 is out. This release fixes a few bugs, some of them
  major and some minor.
&lt;/p&gt;
&lt;p&gt;
  The most important bug fixes are:
&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;Fix strict key checking in &lt;code&gt;json_unpack()&lt;/code&gt; code. The
    strict mode (&lt;code&gt;JSON_STRICT&lt;/code&gt; flag and the &lt;code&gt;!&lt;/code&gt;
    format character), checking that every object key is unpacked,
    didn&#39;t really work at all.&lt;/li&gt;
  &lt;li&gt;Fix the return value of &lt;code&gt;json_object_size()&lt;/code&gt;. On
    error, it now returns 0, as documented. This may affect users if
    someone is relying on the buggy old return value
    of &lt;code&gt;(size_t)-1&lt;/code&gt;.&lt;/li&gt;
  &lt;li&gt;Fix a few segfaulters when custom memory management is
    used.&lt;/li&gt;
  &lt;li&gt;Make the &lt;code&gt;JANSSON_VERSION_HEX&lt;/code&gt; constant usable (by
    fixing the number of closing parentheses).&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
  For full details,
  see &lt;a href=&#34;https://jansson.readthedocs.org/en/2.0/changes.html#version-2-0-1&#34;&gt;the
  changelog&lt;/a&gt;. Special thanks to Eric Roy, Akos Polster and others
  who found bugs and provided patches!
&lt;/p&gt;

    </content>
  </entry>
  
  <entry>
    <title>New features of Jansson 2.0, part 3</title>
    <link href="http://www.digip.org/blog/2011/03/new-features-of-jansson-2.0-part-3.html" />
    <id>http://www.digip.org/blog/2011/03/new-features-of-jansson-2.0-part-3.html</id>
    <updated>2011-03-08 00:00:00</updated>
    
    <category term="jansson" />
    
    <content type="html">
      &lt;p&gt;
  This post is the last one in a series of articles that give insight
  to the new features of Jansson 2.0; see &lt;a href=&#34;{{
  entry_url(&#39;new-features-of-jansson-2.0-part-1&#39;) }}&#34;&gt;part 1&lt;/a&gt; and
  &lt;a href=&#34;{{ entry_url(&#39;new-features-of-jansson-2.0-part-2&#39;) }}&#34;&gt;part
  2&lt;/a&gt;.
&lt;/p&gt;

&lt;h3&gt;Integer type&lt;/h3&gt;
&lt;p&gt;
  Up to version 1.3, the underlying type of JSON integer values
  was &lt;code&gt;int&lt;/code&gt;. This approach limited the available numeric
  range and caused problems when using
  the &lt;a href=&#34;http://dev.twitter.com/&#34;&gt;Twitter API&lt;/a&gt;, for example,
  as it uses 64 bit integer IDs.
&lt;/p&gt;
&lt;p&gt;
  To overcome these issues, the underlying integer type was changed to
  the widest signed integer available in the system, i.e.
  &lt;code&gt;long long&lt;/code&gt; if it&#39;s supported, falling back to
  plain &lt;code&gt;long&lt;/code&gt; for older systems.
  The &lt;code&gt;json_int_t&lt;/code&gt; typedef defines the actual type. The
  preprocessor constant &lt;code&gt;JSON_INTEGER_IS_LONG_LONG&lt;/code&gt; is set
  to 1 if &lt;code&gt;long long&lt;/code&gt; is supported,
  and &lt;code&gt;JSON_INTEGER_FORMAT&lt;/code&gt; can be used for
  printing &lt;code&gt;json_int_t&lt;/code&gt; values:
&lt;/p&gt;
&lt;pre class=&#34;highlight c&#34;&gt;
json_t *myint = json_integer(123);
printf(&#34;%&#34; JSON_INTEGER_FORMAT &#34;\n&#34;, json_integer_value(myint));
&lt;/pre&gt;
&lt;p&gt;
  &lt;code&gt;int&lt;/code&gt; should still be used in most cases when dealing
  with smallish JSON integers, as the compiler handles implicit type
  coercion. Only when the full 64-bit range is
  needed, &lt;code&gt;json_int_t&lt;/code&gt; should be explicitly used.
&lt;/p&gt;

&lt;h3&gt;Error reporting enhancements&lt;/h3&gt;
&lt;p&gt;
  New fields were added to the &lt;code&gt;json_error_t&lt;/code&gt; struct that
  is used to pass error information to the caller. The following table
  lists all the fields. New fields in version 2.0 are marked
  with &lt;em&gt;(new)&lt;/em&gt;.
&lt;/p&gt;
&lt;table&gt;
  &lt;tr&gt;
    &lt;th&gt;&lt;code&gt;char text[]&lt;/code&gt;&lt;/th&gt;
    &lt;td&gt;UTF-8 error message&lt;/td&gt;
    &lt;td&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;th&gt;&lt;code&gt;char source[]&lt;/code&gt;&lt;/th&gt;
    &lt;td&gt;Error source (e.g. file name)&lt;/td&gt;
    &lt;td&gt;&lt;em&gt;(new)&lt;/new&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;th&gt;&lt;code&gt;int line&lt;/code&gt;&lt;/th&gt;
    &lt;td&gt;Input line&lt;/td&gt;
    &lt;td&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;th&gt;&lt;code&gt;int column&lt;/code&gt;&lt;/th&gt;
    &lt;td&gt;Character column on the input line&lt;/td&gt;
    &lt;td&gt;&lt;em&gt;(new)&lt;/new&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;th&gt;&lt;code&gt;int position&lt;/code&gt;&lt;/th&gt;
    &lt;td&gt;Number of bytes from the beginning of the input&lt;/td&gt;
    &lt;td&gt;&lt;em&gt;(new)&lt;/new&gt;&lt;/td&gt;
  &lt;/tr&gt;
&lt;/table&gt;
&lt;p&gt;
  &lt;code&gt;column&lt;/code&gt; is the Unicode character column on which the
  error was encountered, i.e. a multi-byte UTF-8 character in input is
  treated as one character column. This may make it hard to debug
  Unicode problems. To remedy this, &lt;code&gt;position&lt;/code&gt; gives the
  byte position of the error from the start of the input.
&lt;/p&gt;
&lt;p&gt;
  &lt;code&gt;source&lt;/code&gt; is a string that contains the source of the
  error. When decoding, it is &lt;code&gt;&#34;&amp;lt;string&amp;gt;&#34;&lt;/code&gt; when
  using &lt;code&gt;json_loads()&lt;/code&gt;, &lt;code&gt;&#34;&amp;lt;stream&amp;gt;&#34;&lt;/code&gt; when
  using &lt;code&gt;json_loadf()&lt;/code&gt;, and the input file name when
  using &lt;code&gt;json_load_file()&lt;/code&gt;.
&lt;/p&gt;
&lt;p&gt;
  The &lt;code&gt;json_error_t&lt;/code&gt; struct is also used to return errors
  from &lt;a href=&#34;{{ entry_url(&#39;new-features-of-jansson-2.0-part-1&#39;)
  }}&#34;&gt;&lt;code&gt;json_unpack_ex()&lt;/code&gt;&lt;/a&gt; and &lt;a href=&#34;{{
  entry_url(&#39;new-features-of-jansson-2.0-part-2&#39;)
  }}&#34;&gt;&lt;code&gt;json_pack_ex()&lt;/code&gt;&lt;/a&gt;. In this
  case, &lt;code&gt;line&lt;/code&gt;, &lt;code&gt;column&lt;/code&gt;
  and &lt;code&gt;position&lt;/code&gt; point to the position in the format string
  on which the error occured. &lt;code&gt;source&lt;/code&gt;
  is &lt;code&gt;&#34;&amp;lt;format&amp;gt;&#34;&lt;/code&gt; when the format string is
  invalid, &lt;code&gt;&#34;&amp;lt;args&amp;gt;&#34;&lt;/code&gt; when there are problems with
  the variadic arguments (e.g. &lt;code&gt;NULL&lt;/code&gt; string argument or
  invalid UTF-8 string), &lt;code&gt;&#34;&amp;lt;validation&amp;gt;&#34;&lt;/code&gt; when the
  value being unpacked doesn&#39;t validate against the format string,
  or &lt;code&gt;&amp;lt;internal&amp;gt;&lt;/code&gt; when an internal error occurs (e.g.
  out of memory).
&lt;/p&gt;

&lt;h3&gt;Library version&lt;/h3&gt;
&lt;p&gt;
  Preprocessor constans defining the Jansson library version were
  added:
&lt;/p&gt;
&lt;dl&gt;
  &lt;dt&gt;
    &lt;code&gt;JANSSON_VERSION_MAJOR&lt;/code&gt;,
    &lt;code&gt;JANSSON_VERSION_MINOR&lt;/code&gt;,
    &lt;code&gt;JANSSON_VERSION_MICRO&lt;/code&gt;
  &lt;/dt&gt;
  &lt;dd&gt;
    Integers specifying the major, minor and micro versions, respectively.
  &lt;/dd&gt;

  &lt;dt&gt;&lt;code&gt;JANSSON_VERSION&lt;/code&gt;&lt;/dt&gt;
  &lt;dd&gt;
    A string representation of the current version,
    e.g. &lt;code&gt;&#34;1.2.1&#34;&lt;/code&gt; or &lt;code&gt;&#34;1.3&#34;&lt;/code&gt;. When micro
    version is zero, it&#39;s omitted from the version string.
  &lt;/dd&gt;

  &lt;dt&gt;&lt;code&gt;JANSSON_VERSION_HEX&lt;/code&gt;&lt;/dt&gt;
  &lt;dd&gt;
    A 3-byte hexadecimal representation of the version, e.g. 0x010201
    for version 1.2.1 and 0x010300 for version 1.3. This is useful in
    numeric comparisions, e.g.:

    &lt;pre class=&#34;highlight c&#34;&gt;#if JANSSON_VERSION_HEX &amp;gt;= 0x010300
/* Code specific to version 1.3 and above */
#endif
&lt;/pre&gt;
  &lt;/dd&gt;
&lt;/dl&gt;

&lt;h3&gt;Custom memory allocation&lt;/h3&gt;
&lt;p&gt;
  A function to set custom memory allocation functions was added. For
  example, to use
  the &lt;a href=&#34;http://www.hpl.hp.com/personal/Hans_Boehm/gc/&#34;&gt;Boehm&#39;s
  conservative garbage collector&lt;/a&gt;, use
&lt;/p&gt;
&lt;pre class=&#34;highlight c&#34;&gt;json_set_alloc_funcs(GC_malloc, GC_free);
&lt;/pre&gt;
&lt;p&gt;
  Quite obviously, &lt;code&gt;json_set_alloc_funcs()&lt;/code&gt; needs to be
  called before any other Jansson API function to make sure that all
  values are allocated and freed with the same set of functions.
&lt;/p&gt;

    </content>
  </entry>
  
  <entry>
    <title>New features of Jansson 2.0, part 2</title>
    <link href="http://www.digip.org/blog/2011/03/new-features-of-jansson-2.0-part-2.html" />
    <id>http://www.digip.org/blog/2011/03/new-features-of-jansson-2.0-part-2.html</id>
    <updated>2011-03-02 00:00:00</updated>
    
    <category term="jansson" />
    
    <content type="html">
      &lt;p&gt;
  This post continues a series of articles that give insight to the
  new features of Jansson 2.0; see &lt;a href=&#34;{{
  entry_url(&#39;new-features-of-jansson-2.0-part-1&#39;) }}&#34;&gt;part 1&lt;/a&gt;.
&lt;/p&gt;
&lt;p&gt;
  This article is about
  the &lt;a href=&#34;https://jansson.readthedocs.org/en/2.0/apiref.html#building-values&#34;&gt;&lt;code&gt;json_pack()&lt;/code&gt;&lt;/a&gt;
  API. It allows the user to build arbitrary JSON values using a
  simple format string-based approach. As with
  &lt;code&gt;json_unpack()&lt;/code&gt;, the idea has been stolen from
  &lt;a href=&#34;http://docs.python.org/c-api/arg.html&#34;&gt;Python&#39;s C API&lt;/a&gt;.
&lt;/p&gt;
&lt;p&gt;
  Here are some examples:
&lt;/p&gt;
&lt;pre class=&#34;highlight c&#34;&gt;json_pack(&#34;i&#34;, 42);
/* -&gt; JSON integer 42 */

json_pack(&#34;{s: s, s: i}&#34;, &#34;foo&#34;, &#34;bar&#34;, &#34;baz&#34;, 123);
/* -&gt; JSON object {&#34;foo&#34;: &#34;bar&#34;, &#34;baz&#34;: 123} */

json_pack(&#34;{s: [{s: i}, {s: i}]}&#34;, &#34;data&#34;, &#34;value&#34;, 15, &#34;value&#34;, 16);
/* -&gt; JSON object {&#34;data&#34;: [{&#34;value&#34;: 15}, {&#34;value&#34;: 16}]} */
&lt;/pre&gt;
&lt;p&gt;
  The first argument is a &lt;em&gt;format string&lt;/em&gt; that describes the
  type and structure of the value that&#39;s being built. The
  format &lt;code&gt;i&lt;/code&gt; creates an integer and &lt;code&gt;s&lt;/code&gt; means a
  string (both as a value and an object key). &lt;code&gt;{}&lt;/code&gt;
  and &lt;code&gt;[]&lt;/code&gt; are used to build objects and arrays.
  Whitespace, &lt;code&gt;:&lt;/code&gt; and &lt;code&gt;,&lt;/code&gt; are ignored. As the
  last example shows, objects and arrays can be nested, there is no
  limit on the nesting depth. &lt;code&gt;json_pack()&lt;/code&gt; returns the new
  JSON value, or &lt;code&gt;NULL&lt;/code&gt; on error.
&lt;/p&gt;
&lt;p&gt;
  &lt;code&gt;json_pack_ex()&lt;/code&gt; is also available. It makes it possible
  to get error messages and pass flags, although currently no flags
  are defined. Example:
&lt;/p&gt;
&lt;pre class=&#34;highlight c&#34;&gt;json_t *value;
json_error_t error;

value = json_pack_ex(&amp;error, 0, &#34;[iii]&#34;, 1, 2, 3);
if(!value) {
    fprintf(stderr, &#34;Error: %d:%d: %s\n&#34;, error.line, error.column, error.text);
    return -1;  /* error */
}

/* ... */

json_decref(value);
&lt;/pre&gt;
&lt;p&gt;
  The errors that may occur are problems with the format string (e.g.
  unbalanced &lt;code&gt;}&lt;/code&gt; or an invalid format character), out of
  memory errors and invalid UTF-8 in strings, so this function is
  mainly useful for debugging format strings.
&lt;/p&gt;
&lt;p&gt;
  &lt;code&gt;json_pack()&lt;/code&gt; provides a powerful means of creating JSON
  values, both simple and complex. Without it, you might need tens of
  lines of code with ugly temporary variables to make nested objects
  or arrays. I think this is a great addition to Jansson&#39;s API and
  will make it a whole lot easier to create JSON data in C.
&lt;/p&gt;
&lt;p&gt;
  For full details of format characters, see
  the &lt;a href=&#34;https://jansson.readthedocs.org/en/2.0/apiref.html#building-values&#34;&gt;documentation&lt;/a&gt;.
&lt;/p&gt;

    </content>
  </entry>
  
  <entry>
    <title>New features of Jansson 2.0, part 1</title>
    <link href="http://www.digip.org/blog/2011/03/new-features-of-jansson-2.0-part-1.html" />
    <id>http://www.digip.org/blog/2011/03/new-features-of-jansson-2.0-part-1.html</id>
    <updated>2011-03-01 00:00:00</updated>
    
    <category term="jansson" />
    
    <content type="html">
      &lt;p&gt;
  This post starts a series of articles that give insight to the new
  features of Jansson 2.0.
&lt;/p&gt;
&lt;p&gt;
  First up is
  the &lt;a href=&#34;https://jansson.readthedocs.org/en/2.0/apiref.html#parsing-and-validating-values&#34;&gt;&lt;code&gt;json_unpack()&lt;/code&gt;&lt;/a&gt;
  API. I think it&#39;s the most powerful new feature, allowing the user
  to perform two things on a JSON value: data extraction, and
  validation against a simple schema. The idea has been stolen from
  &lt;a href=&#34;http://docs.python.org/c-api/arg.html&#34;&gt;Python&#39;s C API&lt;/a&gt;.
&lt;p&gt;
&lt;p&gt;
  Example:
&lt;/p&gt;
&lt;pre class=&#34;highlight c&#34;&gt;/* Assume that obj is the following JSON object:
 *   {&#34;x&#34;: 15.4, &#34;y&#34;: 99.8, &#34;z&#34;: 42}}
 */
json_t *obj;
double x, y, z;

if(json_unpack(obj, &#34;{s:f, s:f, s:f}&#34;, &#34;x&#34;, &amp;x, &#34;y&#34;, &amp;y, &#34;z&#34;, &amp;z))
    return -1;  /* error */

assert(x == 15.4 &amp;&amp; y == 99.8 &amp;&amp; z == 42);
&lt;/pre&gt;
&lt;p&gt;
  The &lt;em&gt;format string&lt;/em&gt; passed to &lt;code&gt;json_unpack()&lt;/code&gt;
  describes the structure of the object. The &lt;code&gt;s&lt;/code&gt; format
  denotes an object key, and the &lt;code&gt;f&lt;/code&gt; format means a real
  number value. Whitespace, &lt;code&gt;:&lt;/code&gt; and &lt;code&gt;,&lt;/code&gt; are
  ignored, so &lt;code&gt;{sfsfsf}&lt;/code&gt; would be an equivalent format
  string to the one above.
&lt;/p&gt;
&lt;p&gt;
  After the format string, there&#39;s one argument for each
  format character. For object keys, a string specifies what key is
  accessed, and for real numbers, a pointer to double gives an address
  where to store the value.
&lt;/p&gt;
&lt;p&gt;
 The equivalent code without &lt;code&gt;json_unpack()&lt;/code&gt; would be
 something like this:
&lt;/p&gt;
&lt;pre class=&#34;highlight c&#34;&gt;json_t *obj, *tmp;
double x, y, x;

tmp = json_object_get(obj, &#34;x&#34;);
if(!json_is_real(tmp))
    return -1;  /* error */
x = json_real_value(tmp);

/* repeat for y and z */
/* ... */

printf(&#34;x: %f, y: %f, z: %f\n&#34;, x, y, z);
/* ==&gt; x: 15.4, y: 99.8, z: 42 */
&lt;/pre&gt;
&lt;p&gt;
  The code that uses &lt;code&gt;json_unpack()&lt;/code&gt; is much shorter and
  cleaner, and it&#39;s easier to see what it&#39;s doing.
&lt;/p&gt;
&lt;p&gt;
  Nested values are supported, too:
&lt;/p&gt;
&lt;pre class=&#34;highlight c&#34;&gt;/* Assume that nested is the following JSON object:
 *   {&#34;foo&#34;: {&#34;bar&#34;: [11, 12, 13]}}
 */
json_t *nested;
int i1, i2, i3;

if(json_unpack(nested, &#34;{s:{s:[iii]}}&#34;, &#34;foo&#34;, &#34;bar&#34;, &amp;i1, &amp;i2, &amp;i3))
    return -1;  /* error */

assert(i1 == 11 &amp;&amp; i2 == 12 &amp;&amp; i3 == 13);
&lt;/pre&gt;
&lt;p&gt;
  This time, the format string has two nested objects and a nested
  array. There&#39;s no limit on the nesting levels. The variable
  arguments are used in the &#34;flat&#34; order in which they appear in the
  format string.
&lt;/p&gt;
&lt;p&gt;
  The same API can also be used in a validation-only mode, i.e.
  without extracting any values. Error messages are also available:
&lt;/p&gt;
&lt;pre class=&#34;highlight c&#34;&gt;/* Assume the same JSON object as in the previous example */
json_t *nested;
json_error_t error;

if(json_unpack_ex(nested, &amp;error, JSON_VALIDATE_ONLY,
   &#34;{s:{s:[iii]}}&#34;, &#34;foo&#34;, &#34;bar&#34;))
{
    fprintf(stderr, &#34;Error: %d:%d: %s\n&#34;, error.line, error.column, error.text);
    return -1;
}
&lt;/pre&gt;
&lt;p&gt;
  The &lt;code&gt;json_unpack_ex()&lt;/code&gt; function is the extended version
  of &lt;code&gt;json_unpack()&lt;/code&gt;. It takes an error parameter, similar
  to decoding functions, and optional flags to control the behaviour.
  The &lt;code&gt;JSON_VALIDATE_ONLY&lt;/code&gt; flags tells it to only validate
  and not to extract anything. Extra arguments after the format sting
  are only required for object keys. The available validation is quite
  simple, only the object/array structure and value types can be
  checked, but usually this saves a lot of code.
&lt;/p&gt;
&lt;p&gt;
  I strongly believe that this feature, along with
  the &lt;code&gt;json_pack()&lt;/code&gt; API described in the next part, will
  make it an order of magnitude more pleasant to manipulate JSON data
  in C. Many thanks to &lt;strong&gt;Graeme Smecher&lt;/strong&gt; for suggesting
  this and providing the initial implementation.
&lt;/p&gt;
&lt;p&gt;
  This article only gave a few examples. For full details, all
  available format characters and flags, see
  the &lt;a href=&#34;https://jansson.readthedocs.org/en/2.0/apiref.html#parsing-and-validating-values&#34;&gt;documentation&lt;/a&gt;.
&lt;/p&gt;

    </content>
  </entry>
  
  <entry>
    <title>Jansson 2.0 released</title>
    <link href="http://www.digip.org/blog/2011/02/jansson-2.0-released.html" />
    <id>http://www.digip.org/blog/2011/02/jansson-2.0-released.html</id>
    <updated>2011-02-28 00:00:00</updated>
    
    <category term="jansson" />
    
    <category term="announcement" />
    
    <content type="html">
      &lt;p&gt;
  Jansson 2.0 is finally out. This is a new major release that is
  (slightly) backwards incompatible with the older versions.
&lt;/p&gt;
&lt;p&gt;
 See
 the &lt;a href=&#34;https://jansson.readthedocs.org/en/2.0/changes.html#version-2-0&#34;&gt;changelog&lt;/a&gt;
 for more details, and the documentation chapter
 &lt;a href=&#34;https://jansson.readthedocs.org/en/2.0/upgrading.html&#34;&gt;Upgrading from 1.x&lt;/a&gt; for
 instructions on how to upgrade from older versions.
&lt;/p&gt;

    </content>
  </entry>
  
  <entry>
    <title>Sala 1.1 released</title>
    <link href="http://www.digip.org/blog/2011/02/sala-1.1-released.html" />
    <id>http://www.digip.org/blog/2011/02/sala-1.1-released.html</id>
    <updated>2011-02-02 00:00:00</updated>
    
    <category term="sala" />
    
    <category term="announcement" />
    
    <content type="html">
      &lt;p&gt;
  I just uploaded &lt;a href=&#34;http://pypi.python.org/pypi/sala/1.1&#34;&gt;sala
    1.1&lt;/a&gt; to PyPI. This release adds
    &lt;code&gt;~/.config/sala.conf&lt;/code&gt; (or, more
    specifically, &lt;code&gt;$XDG_CONFIG_HOME/sala.conf&lt;/code&gt;) to the list
    of configuration locations that are read, as per
    the &lt;a href=&#34;http://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html&#34;&gt;XDG
    Base Directory Specification&lt;/a&gt;. Python 2.5 is also now
    supported.
&lt;/p&gt;
&lt;p&gt;
  I&#39;m also planning to package sala for Ubuntu in the near future.
  Stay tuned.
&lt;/p&gt;

    </content>
  </entry>
  
  <entry>
    <title>Generating data files in setup.py</title>
    <link href="http://www.digip.org/blog/2011/01/generating-data-files-in-setup.py.html" />
    <id>http://www.digip.org/blog/2011/01/generating-data-files-in-setup.py.html</id>
    <updated>2011-01-28 00:00:00</updated>
    
    <category term="python" />
    
    <category term="distutils" />
    
    <content type="html">
      &lt;p&gt;
  In a work project, I have a few JavaScript files that are generated
  from a bunch of other files. The project is
  a &lt;a href=&#34;http://www.djangoproject.com/&#34;&gt;Django&lt;/a&gt; website, so I
  just have views that generate the files on-the-fly when running in
  debug mode, and everything works nice and smooth.
&lt;/p&gt;
&lt;p&gt;
  For production, though, I needed the flat files that would be served
  from disk. I figured out that the best approach would be to generate
  the files in &lt;code&gt;setup.py&lt;/code&gt; upon installation, but I could
  only
  find &lt;a href=&#34;http://docs.python.org/distutils/extending.html#integrating-new-commands&#34;&gt;very
  superficial documentation&lt;/a&gt; on how to do that.
&lt;/p&gt;
&lt;p&gt;
  A brief intro to &lt;code&gt;setup.py&lt;/code&gt;: In every
  project&#39;s &lt;code&gt;setup.py&lt;/code&gt; file, the &lt;code&gt;setup&lt;/code&gt;
  function, from Python standard library&#39;s &lt;code&gt;distutils.core&lt;/code&gt;
  module, is used to define the project&#39;s files and metadata.
  (&lt;code&gt;setup&lt;/code&gt; can also be imported from
  from &lt;a href=&#34;http://pypi.python.org/pypi/setuptools&#34;&gt;setuptools&lt;/a&gt;
  or &lt;a href=&#34;http://pypi.python.org/pypi/distribute&#34;&gt;distribute&lt;/a&gt;,
  but they&#39;re compatible with distutils.) With the standard commands
  that &lt;code&gt;setup.py&lt;/code&gt; provides, the files and metadata can be
  compiled to an egg, distributed as a source tarball, uploaded
  to &lt;a href=&#34;http://pypi.python.org/&#34;&gt;PyPI&lt;/a&gt;, and so on.
&lt;/p&gt;
&lt;p&gt;
  The entry point to altering &lt;code&gt;setup.py&lt;/code&gt;&#39;s behaviour is the
  optional &lt;code&gt;cmdclass&lt;/code&gt; argument to the &lt;code&gt;setup&lt;/code&gt;
  function. It&#39;s value is a &lt;code&gt;dict&lt;/code&gt; from command names
  to &lt;code&gt;distutils.command.Command&lt;/code&gt; subclasses that implement
  the commands. The &lt;code&gt;build_py&lt;/code&gt; command is where the package
  data files are installed, so to override &lt;code&gt;build_py&lt;/code&gt;, I
  created the class &lt;code&gt;my_build_py&lt;/code&gt; and registered it, like
  this:
&lt;/p&gt;
&lt;pre class=&#34;highlight python&#34;&gt;from distutils.core import setup
from distutils.command.build_py import build_py

class my_build_py(build_py):
    # ...

setup(
    # Define metadata, files, etc.
    # ...
    cmdclass={&#39;build_py&#39;: my_build_py}
)
&lt;/pre&gt;
&lt;p&gt;
  The &lt;code&gt;run&lt;/code&gt; method of &lt;code&gt;build_py&lt;/code&gt;, along with
  copying and compiling the Python source files, is responsible for
  copying the packages data files to the build directory
  &lt;code&gt;build/lib.&amp;lt;platform&amp;gt;&lt;/code&gt;. (The actual directory name
  is stored in the &lt;code&gt;build_py&lt;/code&gt;
  instance&#39;s &lt;code&gt;self.build_lib&lt;/code&gt; variable.)
&lt;/p&gt;
&lt;p&gt;
  To install your own files, just override the &lt;code&gt;run&lt;/code&gt;
  method. Remember to call the superclass after you&#39;re done with your
  own files.
&lt;/p&gt;
&lt;pre class=&#34;highlight python&#34;&gt;def generate_content():
    # generate the file content...
    return content

class my_build_py(build_py):
    def run(self):
        # honor the --dry-run flag
        if not self.dry_run:
            target_dir = os.path.join(self.build_lib, &#39;mypkg/media&#39;)

            # mkpath is a distutils helper to create directories
            self.mkpath(target_dir)

            with open(os.path.join(target_dir, &#39;myfile.js&#39;), &#39;w&#39;):
                fobj.write(generate_content())

        # distutils uses old-style classes, so no super()
        build_py.run(self)
&lt;/pre&gt;
&lt;p&gt;
  And that&#39;s it! A later phase of the installation copies everything
  from &lt;code&gt;build/lib.&amp;lt;platform&amp;gt;&lt;/code&gt; to the correct place,
  so your generated file gets in, too.
&lt;/p&gt;

    </content>
  </entry>
  
  <entry>
    <title>Sala 1.0 released</title>
    <link href="http://www.digip.org/blog/2011/01/sala-1.0-released.html" />
    <id>http://www.digip.org/blog/2011/01/sala-1.0-released.html</id>
    <updated>2011-01-19 00:00:00</updated>
    
    <category term="sala" />
    
    <category term="announcement" />
    
    <content type="html">
      &lt;p&gt;
  For some time now, I&#39;ve been unsatisfied with the state of user
  names and passwords for the numerous services I use in the web. I&#39;m
  having hard time to remember all the services I have singed up to
  and a bad habit of using a few common passwords for all of them.
&lt;/p&gt;
&lt;p&gt;
  So, I hacked for a while, and yestreday, I pushed the first release
  of &lt;a href=&#34;http://pypi.python.org/pypi/sala&#34;&gt;sala&lt;/a&gt; to PyPI. It&#39;s
  is a simple, filesystem based, encrypted password storage system
  that uses &lt;a href=&#34;http://www.gnupg.org/&#34;&gt;GnuPG&lt;/a&gt;&#39;s symmetrical
  encryption. As usual, a git repository
  is &lt;a href=&#34;https://github.com/akheron/sala&#34;&gt;available at
  GitHub&lt;/a&gt;.
&lt;/p&gt;
&lt;p&gt;
  The main idea of sala is to store passwords (or other tiny,
  plain-text secrets) in encrypted plain-text files in a directory
  hierarchy, like this:
&lt;/p&gt;
&lt;pre class=&#34;plain&#34;&gt;/path/to/passwords
|-- example-service.com
|   |-- +webmail
|   |   |-- @myuser
|   |   `-- @otheruser
|   `-- +adminpanel
|       `-- @admin
`-- my-linux-box
    |-- @myuser
    `-- @root
&lt;/pre&gt;
&lt;p&gt;
  As sala is a command line utility and there&#39;s one file per password,
  tab completion and other shell goodies are available. The custom of
  prefixing user names with &lt;code&gt;@&lt;/code&gt; and
  category/group/subservice names with &lt;code&gt;+&lt;/code&gt; is my own
  preference and not enforced by the program. You may come up with
  your own scheme, for example if you want to protect user names as
  well as the actual passwords. For more information, see
  &lt;a href=&#34;http://pypi.python.org/pypi/sala&#34;&gt;the PyPI page&lt;/a&gt;.
&lt;/p&gt;
&lt;p&gt;
  Use &lt;code&gt;pip install sala&lt;/code&gt; to install,
  or &lt;a href=&#34;http://pypi.python.org/pypi/sala#downloads&#34;&gt;download the
  source&lt;/a&gt;, unpack, and invoke &lt;code&gt;python setup.py install&lt;/code&gt;.
  In addition to Python 2.5 or newer, requires &lt;code&gt;gpg&lt;/code&gt;
  and &lt;a href=&#34;http://py-gnupg.sourceforge.net/&#34;&gt;GnuPGInterface&lt;/a&gt;.
  Currently, Python 3 is not supported because GnuPGInterface doesn&#39;t
  support it.
&lt;/p&gt;
&lt;p&gt;
  &lt;b&gt;Update:&lt;/b&gt; While writing this blog entry, I found a few
  packaging bugs, and released version 1.0.1.
&lt;/p&gt;

    </content>
  </entry>
  
  <entry>
    <title>Old Jansson news</title>
    <link href="http://www.digip.org/blog/2011/01/old-jansson-news.html" />
    <id>http://www.digip.org/blog/2011/01/old-jansson-news.html</id>
    <updated>2011-01-04 00:00:00</updated>
    
    <category term="jansson" />
    
    <content type="html">
      &lt;p&gt;
  All the project news are now gathered in this blog, and I don&#39;t want
  old &lt;a href=&#34;/jansson/&#34;&gt;Jansson&lt;/a&gt; news to disappear, so here you
  go:
&lt;/p&gt;
&lt;table class=&#34;news&#34;&gt;
  &lt;tr&gt;
    &lt;th&gt;2010-06-13&lt;/th&gt;
    &lt;td&gt;
      Jansson v1.3 released! This release adds one new encoding flag,
      enhances the documentation a bit and fixes a few bugs. See
      the &lt;a href=&#34;https://jansson.readthedocs.org/en/1.3/changes.html#version-1-3&#34;&gt;changelog&lt;/a&gt;
      for full details.
    &lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;th&gt;2010-04-03&lt;/th&gt;
    &lt;td&gt;
      Jansson v1.2.1 released! This is a bugfix release in the 1.2
      series. See
      the &lt;a href=&#34;https://jansson.readthedocs.org/en/1.2/changes.html#version-1-2-1&#34;&gt;changelog&lt;/a&gt;
      for full details.
    &lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;th&gt;2010-01-21&lt;/th&gt;
    &lt;td&gt;
      Jansson v1.2 released! This release adds new features and fixes
      some bugs. See
      the &lt;a href=&#34;https://jansson.readthedocs.org/en/1.2/changes.html#version-1-2&#34;&gt;changelog&lt;/a&gt;
      for full details.
    &lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;th&gt;2009-12-18&lt;/th&gt;
    &lt;td&gt;
      Jansson v1.1.3 released! This is a bugfix release in the 1.1
      series. See the &lt;a href=&#34;/jansson/releases/CHANGES&#34;&gt;changelog&lt;/a&gt;
      for details.
    &lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;th&gt;2009-11-08&lt;/th&gt;
    &lt;td&gt;
      Jansson v1.1.2 released! This is a bugfix release in the 1.1
      series. See the &lt;a href=&#34;/jansson/releases/CHANGES&#34;&gt;changelog&lt;/a&gt;
      for details.
    &lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;th&gt;2009-10-26&lt;/th&gt;
    &lt;td&gt;
      Jansson v1.1.1 released! This release only fixes some
      documentation packaging issues present in v1.1. For details, see
      the &lt;a href=&#34;/jansson/releases/CHANGES&#34;&gt;changelog&lt;/a&gt;.
    &lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;th&gt;2009-10-20&lt;/th&gt;
    &lt;td&gt;
      Jansson v1.1 released! This release adds lots of new features
      and fixes a few bugs. For details, see
      the &lt;a href=&#34;/jansson/releases/CHANGES&#34;&gt;changelog&lt;/a&gt;. In
      addition to tar.bz2, the source is now also distributed in
      tar.gz form.
    &lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;th&gt;2009-10-11&lt;/th&gt;
    &lt;td&gt;
      Jansson v1.0.4 released! This is a bugfix release in the 1.0
      series. See the &lt;a href=&#34;/jansson/releases/CHANGES&#34;&gt;changelog&lt;/a&gt;
      for details.
    &lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;th&gt;2009-10-09&lt;/th&gt;
    &lt;td&gt;
      Jansson now has a mailing
      list: &lt;a href=&#34;http://groups.google.com/group/jansson-users&#34;&gt;jansson-users&lt;/a&gt;.
    &lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;th&gt;2009-09-14&lt;/th&gt;
    &lt;td&gt;
      Jansson v1.0.3 released! This is a bugfix release in the 1.0
      series. See the &lt;a href=&#34;/jansson/releases/CHANGES&#34;&gt;changelog&lt;/a&gt;
      for details.
    &lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;th&gt;2009-09-12&lt;/th&gt;
    &lt;td&gt;
      Ubuntu packages available
      in &lt;a href=&#34;https://launchpad.net/~petri/+archive/ppa&#34;&gt;Jansson
        PPA&lt;/a&gt; at &lt;a href=&#34;http://launchpad.net/&#34;&gt;Launchpad&lt;/a&gt;. See
      below for details.
    &lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;th&gt;2009-09-08&lt;/th&gt;
    &lt;td&gt;
      Jansson v1.0.2 released! This is a bugfix release in the 1.0
      series.
    &lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;th&gt;2009-09-04&lt;/th&gt;
    &lt;td&gt;
      Jansson v1.0.1 released! This is a bugfix release in the 1.0 series.
    &lt;/td&gt;
  &lt;/tr&gt;
&lt;/table&gt;

    </content>
  </entry>
  
  <entry>
    <title>Blog created</title>
    <link href="http://www.digip.org/blog/2011/01/blog-created.html" />
    <id>http://www.digip.org/blog/2011/01/blog-created.html</id>
    <updated>2011-01-04 00:00:00</updated>
    
    <category term="digip.org" />
    
    <category term="stango" />
    
    <content type="html">
      &lt;p&gt;
  I decided to start a blog. At first, I will publish news and info
  for my projects here. Later, I might also write something else.
&lt;/p&gt;
&lt;p&gt;
  As the whole site is developed using &lt;a href=&#34;/stango/&#34;&gt;Stango&lt;/a&gt;,
  this blog is actually a Stango application, the first one. It&#39;s an
  early work in progress.
&lt;/p&gt;
&lt;p&gt;
  The site was also redesigned. I hope you like the result.
&lt;/p&gt;

    </content>
  </entry>
  
</feed>