<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">

  <title>Emanuele Rocca</title>
  <link href="http://www.linux.it/~ema/atom.xml" rel="self"/>
  <link href="http://www.linux.it/~ema/"/>
  <updated>2017-05-29T22:53:42+02:00</updated>
  <id>http://www.linux.it/~ema/</id>
  <author>
    <name>Emanuele Rocca</name>
    
  </author>

  
  <entry>
    <title>systemd is your friend</title>
    <link href="http://www.linux.it/~ema/2015/10/07/systemd-is-your-friend/"/>
    <updated>2015-10-07T14:45:00+02:00</updated>
    <id>http://www.linux.it/~ema/2015/10/07/systemd-is-your-friend</id>
    <content type="html">&lt;p&gt;Today I want to talk a bit about some cool features of &lt;a class=&quot;reference external&quot; href=&quot;https://en.wikipedia.org/wiki/Systemd&quot;&gt;systemd&lt;/a&gt;, the default
Debian init system since the &lt;a class=&quot;reference external&quot; href=&quot;https://www.debian.org/News/2015/20150426&quot;&gt;release of Jessie&lt;/a&gt;. Ubuntu has also adopted
systemd in 15.04, meaning that you are going to find it literally everywhere.&lt;/p&gt;
&lt;div class=&quot;section&quot; id=&quot;logging&quot;&gt;
&lt;h2&gt;Logging&lt;/h2&gt;
&lt;p&gt;The component responsible for logging in systemd is called journal. It collects
and stores logs in a structured, indexed journal (hence the name). The journal
can replace traditional syslog daemons such as rsyslog and syslog-ng, or work
together with them. By default Debian keeps on using rsyslog, but if you don&#39;t
need to ship logs to a centralized server (or do other fancy things) it is
possible to stop using rsyslog right now and rely on systemd-journal instead.&lt;/p&gt;
&lt;p&gt;The obvious question is: why would anybody use a binary format for logs instead
of a bunch of tried and true plain-text files? As it turns out, there are quite
a lot of &lt;a class=&quot;reference external&quot; href=&quot;https://docs.google.com/document/pub?id=1IC9yOXj7j6cdLLxWEBAGRL6wl97tFxgjLUEHIX3MSTs&quot;&gt;good reasons to do so&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;The killer features of &lt;cite&gt;systemd-journald&lt;/cite&gt; for me are:&lt;/p&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li&gt;Index tons of logs while being able to search with good performance:
O(log(n)) instead of O(n) which is what you get with text files&lt;/li&gt;
&lt;li&gt;No need to worry about log rotation anymore, in any shape or form&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The last point in particular is really critical in my opinion. Traditional log
rotation implementations rely on cron jobs to check how much disk space is used
by logs, compressing/removing old files. Log rotation is usually: 1) annoying
to configure; 2) hard to get right; 3) prone to DoS attacks. With journald,
there is pretty much nothing to configure. Log rotation is built into the
daemon disk space allocation logic itself. This also allows to avoid
vulnerability windows due to time-based rotation, which is what you get with
logrotate and friends.&lt;/p&gt;
&lt;p&gt;Enough high-level discussions though, here is how to use the journal!&lt;/p&gt;
&lt;p&gt;Check if you already have the directory &lt;cite&gt;/var/log/journal&lt;/cite&gt;, otherwise create it
(as root). Then restart &lt;cite&gt;systemd-journald&lt;/cite&gt; as follows:&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;sudo systemctl restart systemd-journald&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;You can get all messages produced since the last boot with &lt;strong&gt;journalctl -b&lt;/strong&gt;.
All messages produced today can get extracted using &lt;strong&gt;journalctl
--since=today&lt;/strong&gt;. Want to get all logs related to ssh? Try with &lt;strong&gt;journalctl
_SYSTEMD_UNIT=ssh.service&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;There are many more filtering options available, you can read all about them
with &lt;strong&gt;man journalctl&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;journald&#39;s configuration file is &lt;cite&gt;/etc/systemd/journald.conf&lt;/cite&gt;. Two of the most
interesting options are &lt;cite&gt;SystemMaxUse&lt;/cite&gt; and &lt;cite&gt;SystemKeepFree&lt;/cite&gt;, which can be used
to change the amount of disk space dedicated to logging. They default to 10%
and 15% of the /var filesystem respectively.&lt;/p&gt;
&lt;p&gt;Here is a little cheatsheet:&lt;/p&gt;
&lt;pre class=&quot;literal-block&quot;&gt;
journalctl -b                # Show all messages since last boot
journalctl -f                # Tail your logs
journalctl --since=yesterday # Show all messages produced since yesterday
journalctl -pcrit            # Filter messages by priority
journalctl /bin/su           # Filter messages by program
journalctl --disk-usage      # The amount of space in use for journaling
&lt;/pre&gt;
&lt;p&gt;Further reading:&lt;/p&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li&gt;&lt;a class=&quot;reference external&quot; href=&quot;http://0pointer.de/blog/projects/systemctl-journal.html&quot;&gt;http://0pointer.de/blog/projects/systemctl-journal.html&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;cite&gt;journalctl(1)&lt;/cite&gt;&lt;/li&gt;
&lt;li&gt;&lt;cite&gt;journald.conf(5)&lt;/cite&gt;&lt;/li&gt;
&lt;li&gt;&lt;cite&gt;systemd-journald(8)&lt;/cite&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;containers&quot;&gt;
&lt;h2&gt;Containers&lt;/h2&gt;
&lt;p&gt;A relatively little known component of systemd is &lt;cite&gt;systemd-nspawn&lt;/cite&gt;. It is a
small, straightforward container manager.&lt;/p&gt;
&lt;p&gt;If you don&#39;t already have a chroot somewhere, here is how to create a basic
Debian Jessie chroot under &lt;cite&gt;/srv/chroots/jessie&lt;/cite&gt;:&lt;/p&gt;
&lt;pre class=&quot;literal-block&quot;&gt;
$ debootstrap jessie /srv/chroots/jessie http://http.debian.net/debian/
&lt;/pre&gt;
&lt;p&gt;With systemd-nspawn you can easily run a shell inside the chroot:&lt;/p&gt;
&lt;pre class=&quot;literal-block&quot;&gt;
$ sudo systemd-nspawn -D /srv/chroots/jessie
Spawning container jessie on /srv/chroots/jessie.
Press ^] three times within 1s to kill container.
/etc/localtime is not a symlink, not updating container timezone.
root&amp;#64;jessie:~#
&lt;/pre&gt;
&lt;p&gt;Done. Everything works out of the box: no need for you to mount &lt;cite&gt;/dev&lt;/cite&gt;, &lt;cite&gt;/run&lt;/cite&gt;
and friends, systemd-nspawn took care of that. Networking also works.&lt;/p&gt;
&lt;p&gt;If you want to actually boot the system, just add the &lt;strong&gt;-b&lt;/strong&gt; switch to the
previous command:&lt;/p&gt;
&lt;pre class=&quot;literal-block&quot;&gt;
$ sudo systemd-nspawn -b -D /srv/chroots/jessie
Spawning container jessie on /srv/chroots/jessie.
Press ^] three times within 1s to kill container.
/etc/localtime is not a symlink, not updating container timezone.
systemd 215 running in system mode. (+PAM +AUDIT +SELINUX +IMA +SYSVINIT +LIBCRYPTSETUP +GCRYPT +ACL +XZ -SECCOMP -APPARMOR)
Detected virtualization &#39;systemd-nspawn&#39;.
Detected architecture &#39;x86-64&#39;.

Welcome to Debian GNU/Linux jessie/sid!

Set hostname to &amp;lt;orion&amp;gt;.
[  OK  ] Reached target Remote File Systems (Pre).
[  OK  ] Reached target Encrypted Volumes.
[  OK  ] Reached target Paths.
[  OK  ] Reached target Swap.
[  OK  ] Created slice Root Slice.
[  OK  ] Created slice User and Session Slice.
[  OK  ] Listening on /dev/initctl Compatibility Named Pipe.
[  OK  ] Listening on Delayed Shutdown Socket.
[  OK  ] Listening on Journal Socket (/dev/log).
[  OK  ] Listening on Journal Socket.
[  OK  ] Created slice System Slice.
[  OK  ] Created slice system-getty.slice.
[  OK  ] Listening on Syslog Socket.
         Mounting POSIX Message Queue File System...
         Mounting Huge Pages File System...
         Mounting FUSE Control File System...
         Starting Copy rules generated while the root was ro...
         Starting Journal Service...
[  OK  ] Started Journal Service.
[  OK  ] Reached target Slices.
         Starting Remount Root and Kernel File Systems...
[  OK  ] Mounted Huge Pages File System.
[  OK  ] Mounted POSIX Message Queue File System.
[  OK  ] Mounted FUSE Control File System.
[  OK  ] Started Copy rules generated while the root was ro.
[  OK  ] Started Remount Root and Kernel File Systems.
         Starting Load/Save Random Seed...
[  OK  ] Reached target Local File Systems (Pre).
[  OK  ] Reached target Local File Systems.
         Starting Create Volatile Files and Directories...
[  OK  ] Reached target Remote File Systems.
         Starting Trigger Flushing of Journal to Persistent Storage...
[  OK  ] Started Load/Save Random Seed.
         Starting LSB: Raise network interfaces....
[  OK  ] Started Create Volatile Files and Directories.
         Starting Update UTMP about System Boot/Shutdown...
[  OK  ] Started Trigger Flushing of Journal to Persistent Storage.
[  OK  ] Started Update UTMP about System Boot/Shutdown.
[  OK  ] Started LSB: Raise network interfaces..
[  OK  ] Reached target Network.
[  OK  ] Reached target Network is Online.
[  OK  ] Reached target System Initialization.
[  OK  ] Listening on D-Bus System Message Bus Socket.
[  OK  ] Reached target Sockets.
[  OK  ] Reached target Timers.
[  OK  ] Reached target Basic System.
         Starting /etc/rc.local Compatibility...
         Starting Login Service...
         Starting LSB: Regular background program processing daemon...
         Starting D-Bus System Message Bus...
[  OK  ] Started D-Bus System Message Bus.
         Starting System Logging Service...
[  OK  ] Started System Logging Service.
         Starting Permit User Sessions...
[  OK  ] Started /etc/rc.local Compatibility.
[  OK  ] Started LSB: Regular background program processing daemon.
         Starting Cleanup of Temporary Directories...
[  OK  ] Started Permit User Sessions.
         Starting Console Getty...
[  OK  ] Started Console Getty.
[  OK  ] Reached target Login Prompts.
[  OK  ] Started Login Service.
[  OK  ] Reached target Multi-User System.
[  OK  ] Reached target Graphical Interface.
         Starting Update UTMP about System Runlevel Changes...
[  OK  ] Started Cleanup of Temporary Directories.
[  OK  ] Started Update UTMP about System Runlevel Changes.

Debian GNU/Linux jessie/sid orion console

orion login:
&lt;/pre&gt;
&lt;p&gt;That&#39;s it! Just one command to start a shell in your chroot or boot the
container, again zero configuration needed.&lt;/p&gt;
&lt;p&gt;Finally, systemd provides a command called &lt;cite&gt;machinectl&lt;/cite&gt; that allows you to
introspect and control your container:&lt;/p&gt;
&lt;pre class=&quot;literal-block&quot;&gt;
$ sudo machinectl status jessie
jessie
           Since: Wed 2015-10-07 11:22:56 CEST; 55min ago
          Leader: 32468 (systemd)
         Service: nspawn; class container
            Root: /srv/chroots/jessie
         Address: fe80::8e70:5aff:fe81:2290
                  192.168.122.1
                  192.168.1.13
              OS: Debian GNU/Linux jessie/sid
            Unit: machine-jessie.scope
                  ├─32468 /lib/systemd/systemd
                  └─system.slice
                    ├─dbus.service
                    │ └─32534 /usr/bin/dbus-daemon --system --address=systemd: --nofork --nopidfile -...
                    ├─cron.service
                    │ └─32539 /usr/sbin/cron
                    ├─systemd-journald.service
                    │ └─32487 /lib/systemd/systemd-journald
                    ├─systemd-logind.service
                    │ └─32532 /lib/systemd/systemd-logind
                    ├─console-getty.service
                    │ └─32544 /sbin/agetty --noclear --keep-baud console 115200 38400 9600 vt102
                    └─rsyslog.service
                      └─32540 /usr/sbin/rsyslogd -n
&lt;/pre&gt;
&lt;p&gt;With machinectl you can also reboot, poweroff, terminate your containers and
more. There are so many things to learn about systemd and containers! Here are
some references.&lt;/p&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li&gt;systemd-nspawn(1)&lt;/li&gt;
&lt;li&gt;machinectl(1)&lt;/li&gt;
&lt;li&gt;&lt;a class=&quot;reference external&quot; href=&quot;http://0pointer.net/blog/systemd-for-administrators-part-xxi.html&quot;&gt;http://0pointer.net/blog/systemd-for-administrators-part-xxi.html&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;This stuff is pretty exciting. Now that all major distributions use systemd by
default, we can expect to have access to tools like journalctl and
systemd-nspawn everywhere!&lt;/p&gt;
&lt;/div&gt;

</content>
  </entry>
  
  <entry>
    <title>A (very) brief history of Australia</title>
    <link href="http://www.linux.it/~ema/2014/05/23/a-very-brief-history-of-australia/"/>
    <updated>2014-05-23T15:35:00+02:00</updated>
    <id>http://www.linux.it/~ema/2014/05/23/a-very-brief-history-of-australia</id>
    <content type="html">&lt;p&gt;This post is mostly a sum-up of the Wikipedia page &lt;a class=&quot;reference external&quot; href=&quot;http://en.wikipedia.org/wiki/History_of_Australia&quot;&gt;History of Australia&lt;/a&gt;,
with some content taken from &lt;a class=&quot;reference external&quot; href=&quot;http://en.wikipedia.org/wiki/History_of_the_British_Empire&quot;&gt;History of the British Empire&lt;/a&gt;. Both texts are
available under the &lt;a class=&quot;reference external&quot; href=&quot;https://en.wikipedia.org/wiki/Wikipedia:Text_of_Creative_Commons_Attribution-ShareAlike_3.0_Unported_License&quot;&gt;Creative Commons Attribution-ShareAlike License&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;I do not seem to be able to learn about a new topic without taking notes: in
this case I have decided to publish my work, hoping that someone will find it
useful. Some very important themes such as the Gold Rush and Australian History
during the World Wars have been impudently ignored.&lt;/p&gt;
&lt;div class=&quot;section&quot; id=&quot;indigenous-australians&quot;&gt;
&lt;h2&gt;Indigenous Australians&lt;/h2&gt;
&lt;p&gt;The ancestors of Indigenous Australians are believed to have arrived in
Australia 40,000 to 60,000 years ago, and possibly as early as 70,000 years
ago.&lt;/p&gt;
&lt;p&gt;By 1788, the population of Australia existed as 250 individual nations, many
of which were in alliance with one another, and within each nation there
existed several clans, from as few as five or six to as many as 30 or 40.
Each nation had its own language and a few had multiple, thus over 250
languages existed, around 200 of which are now extinct.&lt;/p&gt;
&lt;p&gt;Permanent European settlers arrived at Sydney in 1788 and came to control most
of the continent by end of the 19th century. Bastions of largely unaltered
Aboriginal societies survived, particularly in Northern and Western Australia
into the 20th century, until finally, a group of Pintupi people of the Gibson
Desert became the last people to be contacted by outsider ways in 1984.&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;european-explorers&quot;&gt;
&lt;h2&gt;European explorers&lt;/h2&gt;
&lt;p&gt;Terra Australis (Latin for South Land) is one of the names given to a
hypothetical continent which appeared on European maps between the 15th and
18th centuries. Although the landmass was drawn onto maps, Terra Australis was
not based on any actual surveying of such a landmass but rather based on the
hypothesis that continents in the Northern Hemisphere should be balanced by
land in the south.&lt;/p&gt;
&lt;p&gt;The first documented European landing in Australia was made in 1606 by a Dutch
ship led by Willem Janszoon. Hence the ancient name &amp;quot;Nova Hollandia&amp;quot;.  The
same year, a Spanish expedition had landed in the New Hebrides and, believing
them to be the fabled southern continent, named the land: &amp;quot;Terra Austral del
Espiritu Santo&amp;quot;. Hence the current name &amp;quot;Australia&amp;quot;.&lt;/p&gt;
&lt;p&gt;Although various proposals for colonisation were made, notably by Pierre Purry
from 1717 to 1744, none was officially attempted. Indigenous Australians were
less able to trade with Europeans than were the peoples of India, the East
Indies, China, and Japan. The Dutch East India Company concluded that there
was &amp;quot;no good to be done there&amp;quot;.&lt;/p&gt;
&lt;p&gt;In 1769, Lieutenant James Cook tried to locate the supposed Southern
Continent. This continent was not found, and Cook decided to survey the east
coast of New Holland, the only major part of that continent that had not been
charted by Dutch navigators.&lt;/p&gt;
&lt;p&gt;Cook charted and took possession of the east coast of New Holland. He noted the
following in his journal:&lt;/p&gt;
&lt;pre class=&quot;literal-block&quot;&gt;
&amp;quot;I can land no more upon this Eastern coast of New Holland, and
 on the Western side I can make no new discovery the honour of
 which belongs to the Dutch Navigators and as such they may lay
 Claim to it as their property, but the Eastern Coast from the
 Latitude of 38 South down to this place I am confident was never
 seen or viseted by any European before us and therefore by the
 same Rule belongs to great Brittan.&amp;quot;
&lt;/pre&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;colonisation&quot;&gt;
&lt;h2&gt;Colonisation&lt;/h2&gt;
&lt;p&gt;The American Revolutionary War (1775-1783) saw Great Britain lose most of its
North American colonies and consider establishing replacement territories.&lt;/p&gt;
&lt;p&gt;The British colony of New South Wales was established with the arrival of the
First Fleet of 11 vessels in January 1788. It consisted of over a thousand
settlers, including 778 convicts (192 women and 586 men). A few days after
arrival at Botany Bay the fleet moved to the more suitable Port Jackson where
a settlement was established at Sydney Cove on 26 January 1788. This date
later became Australia&#39;s national day, Australia Day.&lt;/p&gt;
&lt;p&gt;Between 1788 and 1868, approximately 161,700 convicts (of whom 25,000 were
women) were transported to the Australian colonies of New South Wales, Van
Diemen&#39;s land and Western Australia. Early colonial administrations were
anxious to address the gender imbalance in the population brought about by the
importation of large numbers of convict men.&lt;/p&gt;
&lt;p&gt;In 1835, the British Colonial Office issued the Proclamation of Governor
Bourke, implementing the legal doctrine of terra nullius upon which British
settlement was based, reinforcing the notion that the land belonged to no one
prior to the British Crown taking possession of it and quashing any likelihood
of treaties with Aboriginal peoples, including that signed by John Batman. Its
publication meant that from then, all people found occupying land without the
authority of the government would be considered illegal trespassers.&lt;/p&gt;
&lt;p&gt;A group in Britain led by Edward Gibbon Wakefield sought to start a colony
based on free settlement and political and religious freedoms, rather than
convict labour. The South Australia Act [1834], passed by the British
Government which established the colony reflected these desires and included a
promise of representative government when the population reached 50,000
people.  Significantly, the Letters Patent enabling the South Australia Act
1834 included a guarantee of the rights of &#39;any Aboriginal Natives&#39; and their
descendants to lands they &#39;now actually occupied or enjoyed&#39;.&lt;/p&gt;
&lt;p&gt;In 1836, two ships of the South Australia Land Company left to establish the
first settlement on Kangaroo Island. The foundation of South Australia is now
generally commemorated as Governor John Hindmarsh&#39;s Proclamation of the new
Province at Glenelg, on the mainland, on 28 December 1836. By 1851 the colony
was experimenting with a partially elected council.&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;development-of-australian-democracy&quot;&gt;
&lt;h2&gt;Development of Australian democracy&lt;/h2&gt;
&lt;p&gt;Traditional Aboriginal society had been governed by councils of elders and a
corporate decision making process, but the first European-style governments
established after 1788 were autocratic and run by appointed governors.&lt;/p&gt;
&lt;p&gt;The reformist attorney general, John Plunkett, sought to apply Enlightenment
principles to governance in the colony, pursuing the establishment of equality
before the law.&lt;/p&gt;
&lt;p&gt;Plunkett twice charged the colonist perpetrators of the Myall Creek massacre
of Aborigines with murder, resulting in a conviction and his landmark Church
Act of 1836 disestablished the Church of England and established legal
equality between Anglicans, Catholics, Presbyterians and later Methodists.&lt;/p&gt;
&lt;p&gt;In 1840, the Adelaide City Council and the Sydney City Council were
established. Men who possessed 1,000 pounds worth of property were able to
stand for election and wealthy landowners were permitted up to four votes each
in elections. Australia&#39;s first parliamentary elections were conducted for the
New South Wales Legislative Council in 1843, again with voting rights (for
males only) tied to property ownership or financial capacity. Voter rights
were extended further in New South Wales in 1850 and elections for legislative
councils were held in the colonies of Victoria, South Australia and Tasmania.&lt;/p&gt;
&lt;p&gt;Women became eligible to vote for the Parliament of South Australia in 1895.
This was the first legislation in the world permitting women also to stand for
election to political office and, in 1897, Catherine Helen Spence became the
first female political candidate for political office, unsuccessfully standing
for election as a delegate to the Federal Convention on Australian Federation.
Western Australia granted voting rights to women in 1899.  Early federal
parliamentary reform and judicial interpretation sought to limit Aboriginal
voting in practice, a situation which endured until rights activists began
campaigning in the 1940s.&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;road-to-independence&quot;&gt;
&lt;h2&gt;Road to independence&lt;/h2&gt;
&lt;p&gt;Despite suspicion from some sections of the colonial community (especially in
smaller colonies) about the value of nationhood, improvements in
inter-colonial transport and communication, including the linking of Perth to
the south eastern cities by telegraph in 1877, helped break down
inter-colonial rivalries.&lt;/p&gt;
&lt;p&gt;New South Wales Premier Henry Parkes addressed a rural audience in his 1889
Tenterfield Oration, stating that the time had come to form a national
executive government:&lt;/p&gt;
&lt;pre class=&quot;literal-block&quot;&gt;
&amp;quot;Australia [now has] a population of three and a half millions,
 and the American people numbered only between three and four
 millions when they formed the great commonwealth of the United
 States. The numbers were about the same, and surely what the
 Americans had done by war, the Australians could bring about in
 peace, without breaking the ties that held them to the mother
 country.&amp;quot;
&lt;/pre&gt;
&lt;p&gt;Though Parkes would not live to see it, his vision would be achieved within a
little over a decade, and he is remembered as the &amp;quot;father of federation&amp;quot;.&lt;/p&gt;
&lt;p&gt;The Commonwealth of Australia came into being when the Federal Constitution
was proclaimed by the Governor-General, Lord Hopetoun, on 1 January 1901.&lt;/p&gt;
&lt;p&gt;Australia took part in WWI. The contributions of Australian and New Zealand
troops during the 1915 Gallipoli Campaign against the Ottoman Empire had a
great impact on the national consciousness at home, and marked a watershed in
the transition of Australia and New Zealand from colonies to nations in their
own right. The countries continue to commemorate this occasion on ANZAC Day.&lt;/p&gt;
&lt;p&gt;Australia achieved independent Sovereign Nation status after World War I,
under the Statute of Westminster, which defined Dominions of the British
empire in the following way:&lt;/p&gt;
&lt;pre class=&quot;literal-block&quot;&gt;
&amp;quot;They are autonomous Communities within the British Empire, equal
 in status, in no way subordinate one to another in any aspect of
 their domestic or external affairs, though united by a common
 allegiance to the Crown, and freely associated as members of the
 British Commonwealth of Nations.&amp;quot;
&lt;/pre&gt;
&lt;p&gt;The parliaments of Canada, Australia, New Zealand, the Union of South Africa,
the Irish Free State and Newfoundland (currently part of Canada) were now
independent of British legislative control, they could nullify British laws
and Britain could no longer pass laws for them without their consent.&lt;/p&gt;
&lt;p&gt;The Australia Act 1986 removed any remaining links between the British
Parliament and the Australian states.&lt;/p&gt;
&lt;/div&gt;

</content>
  </entry>
  
  <entry>
    <title>Antifeatures and Antibugs</title>
    <link href="http://www.linux.it/~ema/2014/01/29/antifeatures-and-antibugs/"/>
    <updated>2014-01-29T16:02:00+01:00</updated>
    <id>http://www.linux.it/~ema/2014/01/29/antifeatures-and-antibugs</id>
    <content type="html">&lt;p&gt;Software Engineering distinguishes between &lt;em&gt;software features&lt;/em&gt; and &lt;em&gt;software
bugs&lt;/em&gt;.&lt;/p&gt;
&lt;p&gt;It is usually understood that features are positive, expected characteristics
of a computer program. Features make users happy by allowing them to do
something useful, interesting, or fun. Something &lt;em&gt;good&lt;/em&gt;, anyways. Bugs are
instead undesirable and annoying. You&#39;re sitting there at your computer writing
a long email and the software crashes right before your email is sent. &lt;em&gt;Bad
stuff&lt;/em&gt;.&lt;/p&gt;
&lt;p&gt;Features are generally implemented by programmers on purpose, whereas bugs are
purely unintentional. They are &lt;em&gt;mistakes&lt;/em&gt;. You don&#39;t make a mistake &lt;em&gt;on
purpose&lt;/em&gt;.&lt;/p&gt;
&lt;p&gt;We might at this point be inclined to think that: i) what is good for users is
done on purpose by software manufacturers; ii) what is bad for users was not
meant to be. It happened by mistake.&lt;/p&gt;
&lt;p&gt;Here is a handy table to visualize this idea:&lt;/p&gt;
&lt;table border=&quot;1&quot; class=&quot;docutils&quot;&gt;
&lt;colgroup&gt;
&lt;col width=&quot;29%&quot; /&gt;
&lt;col width=&quot;35%&quot; /&gt;
&lt;col width=&quot;35%&quot; /&gt;
&lt;/colgroup&gt;
&lt;thead valign=&quot;bottom&quot;&gt;
&lt;tr&gt;&lt;th class=&quot;head&quot;&gt;&amp;nbsp;&lt;/th&gt;
&lt;th class=&quot;head&quot;&gt;On purpose&lt;/th&gt;
&lt;th class=&quot;head&quot;&gt;By mistake&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody valign=&quot;top&quot;&gt;
&lt;tr&gt;&lt;td&gt;&lt;strong&gt;Good&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Feature&lt;/td&gt;
&lt;td&gt;&amp;nbsp;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;strong&gt;Bad&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&amp;nbsp;&lt;/td&gt;
&lt;td&gt;Bug&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;It seems to make a lot of sense. But you might have noticed that two cells of
the table are empty. Right!&lt;/p&gt;
&lt;p&gt;In a great talk titled &lt;a class=&quot;reference external&quot; href=&quot;http://mako.cc/copyrighteous/when-free-software-isnt-better-talk&quot;&gt;When Free Software isn&#39;t better&lt;/a&gt;, Benjamin Mako Hill
mentions the concept of &lt;strong&gt;antifeatures&lt;/strong&gt;, and how they relate to &lt;a class=&quot;reference external&quot; href=&quot;https://en.wikipedia.org/wiki/Free_software&quot;&gt;Free
Software&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Antifeatures are features that make the software do something users will hate.
Something they will hate &lt;em&gt;so much&lt;/em&gt; they would pay to have those features
removed, if that&#39;s an option. Microsoft Windows 7 is used in the talk to
provide some examples of software antifeatures: the Starter Edition &lt;a class=&quot;reference external&quot; href=&quot;http://superuser.com/questions/69601/how-do-i-change-the-wallpaper-of-windows-7-starter-edition&quot;&gt;does not
allow users to change their background image&lt;/a&gt;. Also, it limits the amount of
usable memory on the computer to 2GBs, regardless of how much memory the system
actually has.  Two antifeatures engineered to afflict users to the point that
they will purchase a more expensive version of the software, if they have the
means to do that.&lt;/p&gt;
&lt;p&gt;I have another nice example. The Spotify music streaming service plays
advertisements between songs every now and then. To make sure users are annoyed
as much as possible, Spotify automatically pauses an advertisement if it
detects that the volume is being lowered. A poor Spotify user even &lt;a class=&quot;reference external&quot; href=&quot;http://community.spotify.com/t5/Newcomers-and-Contribution/Pausing-when-lowering-volume/td-p/251718&quot;&gt;tried to
report the bug on The Spotify Community forum&lt;/a&gt;, only to find out that what she
naively considered as a software error was &amp;quot;intentional behavior&amp;quot;. A
spectacular antifeature indeed.&lt;/p&gt;
&lt;p&gt;Whenever a piece of technology does something you most definitely do not want
it to do, such as &lt;a class=&quot;reference external&quot; href=&quot;http://www.pcworld.com/article/2083460/report-nsa-developed-software-for-backdoor-access-to-iphones.html&quot;&gt;allowing the NSA to take complete control of your Apple
iPhone&lt;/a&gt;, including turning on its microphone and camera against your will,
that&#39;s an antifeature.&lt;/p&gt;
&lt;table border=&quot;1&quot; class=&quot;docutils&quot;&gt;
&lt;colgroup&gt;
&lt;col width=&quot;29%&quot; /&gt;
&lt;col width=&quot;37%&quot; /&gt;
&lt;col width=&quot;34%&quot; /&gt;
&lt;/colgroup&gt;
&lt;thead valign=&quot;bottom&quot;&gt;
&lt;tr&gt;&lt;th class=&quot;head&quot;&gt;&amp;nbsp;&lt;/th&gt;
&lt;th class=&quot;head&quot;&gt;On purpose&lt;/th&gt;
&lt;th class=&quot;head&quot;&gt;By mistake&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody valign=&quot;top&quot;&gt;
&lt;tr&gt;&lt;td&gt;&lt;strong&gt;Good&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Feature&lt;/td&gt;
&lt;td&gt;&amp;nbsp;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;strong&gt;Bad&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Antifeature&lt;/td&gt;
&lt;td&gt;Bug&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;Both bugs and antifeatures are bad for users. The difference between them is
that antifeatures are &lt;em&gt;engineered&lt;/em&gt;. Time and money are spent to make sure the
goal is reached. A testing methodology is followed. &amp;quot;Are we really sure
customers cannot change their wallpaper even if they try very very hard?&amp;quot;&lt;/p&gt;
&lt;p&gt;Engineering processes, of course, can fail. If the poor devils at Microsoft who
implemented those harassments would have made a mistake that allows users to
somehow change their wallpaper on Windows Starter... Well, I would call that a
glorious &lt;strong&gt;antibug&lt;/strong&gt;.&lt;/p&gt;
&lt;table border=&quot;1&quot; class=&quot;docutils&quot;&gt;
&lt;colgroup&gt;
&lt;col width=&quot;29%&quot; /&gt;
&lt;col width=&quot;37%&quot; /&gt;
&lt;col width=&quot;34%&quot; /&gt;
&lt;/colgroup&gt;
&lt;thead valign=&quot;bottom&quot;&gt;
&lt;tr&gt;&lt;th class=&quot;head&quot;&gt;&amp;nbsp;&lt;/th&gt;
&lt;th class=&quot;head&quot;&gt;On purpose&lt;/th&gt;
&lt;th class=&quot;head&quot;&gt;By mistake&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody valign=&quot;top&quot;&gt;
&lt;tr&gt;&lt;td&gt;&lt;strong&gt;Good&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Feature&lt;/td&gt;
&lt;td&gt;Antibug&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;strong&gt;Bad&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Antifeature&lt;/td&gt;
&lt;td&gt;Bug&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;There is no place for antifeatures in Free and Open Source Software. Free
Software gives users &lt;em&gt;control&lt;/em&gt; over what their software does. Imagine Mozilla
adding a feature to Firefox that sets your speakers volume to 11 and starts
playing a random song from the black metal artist &lt;a class=&quot;reference external&quot; href=&quot;https://en.wikipedia.org/wiki/Burzum&quot;&gt;Burzum&lt;/a&gt; every time you add
a bookmark, unless you pay for &lt;em&gt;Mozilla Firefox Premium Edition&lt;/em&gt;. The source
code for Firefox is available under a free license. People who are not into
Burzum&#39;s music would immediately remove this neat antifeature.&lt;/p&gt;
&lt;p&gt;I have spent many years of my life advocating Free and Open Source Software,
perhaps using the wrong arguments. &lt;a class=&quot;reference external&quot; href=&quot;http://mako.cc/copyrighteous/when-free-software-isnt-better-talk&quot;&gt;Mako&#39;s talk&lt;/a&gt; made me think about all this
(thanks mate!). All these years I&#39;ve been preaching about the technical
superiority of Free Software, despite evidence of thousands of bugs and
usability issues in the very programs I am using, and contributing to develop.&lt;/p&gt;
&lt;p&gt;Free Software is not better than Proprietary Software per se. Sometimes it is,
sometimes it&#39;s not. But it gives you control, and freedom. When it annoys you,
when it doesn&#39;t do what you expect and want, you can be sure it&#39;s not on
purpose. And we can fix it together.&lt;/p&gt;

</content>
  </entry>
  
  <entry>
    <title>Useful tools for Python developers</title>
    <link href="http://www.linux.it/~ema/2013/07/04/useful-tools-for-python-developers/"/>
    <updated>2013-07-04T18:56:00+02:00</updated>
    <id>http://www.linux.it/~ema/2013/07/04/useful-tools-for-python-developers</id>
    <content type="html">&lt;p&gt;Python is a great language with an impressive number of tools designed to make
developers&#39; life easier. Sometimes, however, the problem is getting to know
that these tools exist in the first place. By contributing to projects like
OpenStack&#39;s &lt;a class=&quot;reference external&quot; href=&quot;https://github.com/openstack/python-novaclient&quot;&gt;Nova client&lt;/a&gt; and &lt;a class=&quot;reference external&quot; href=&quot;https://github.com/racker/falcon&quot;&gt;Falcon&lt;/a&gt;, I have recently come across some useful
tools that can seriously improve the quality of your code.&lt;/p&gt;
&lt;p&gt;The first one is called &lt;a class=&quot;reference external&quot; href=&quot;https://pypi.python.org/pypi/pyflakes&quot;&gt;pyflakes&lt;/a&gt;,  a &lt;cite&gt;passive checker&lt;/cite&gt; of Python programs
developed by Phil Frost. What it does is parsing your source files and checking
for possible errors such as undefined names and unused imports. Let&#39;s consider
the following example:&lt;/p&gt;
&lt;figure class=&quot;code&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;table&gt;&lt;tr&gt;&lt;td class=&quot;gutter&quot;&gt;&lt;pre class=&quot;line-numbers&quot;&gt;&lt;span class=&quot;line-number&quot;&gt;1&lt;/span&gt;
&lt;span class=&quot;line-number&quot;&gt;2&lt;/span&gt;
&lt;span class=&quot;line-number&quot;&gt;3&lt;/span&gt;
&lt;span class=&quot;line-number&quot;&gt;4&lt;/span&gt;
&lt;/pre&gt;&lt;/td&gt;&lt;td class=&quot;code&quot;&gt;&lt;pre&gt;&lt;code class=&quot;python&quot;&gt;&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;kn&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;urllib&lt;/span&gt;
&lt;/span&gt;&lt;span class=&quot;line&quot;&gt;
&lt;/span&gt;&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;k&quot;&gt;print&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;pyflakes example&amp;quot;&lt;/span&gt;
&lt;/span&gt;&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;n&quot;&gt;urlib&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;urlopen&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;#39;http://www.linux.it&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;/div&gt;&lt;/figure&gt;&lt;p&gt;The code above contains a typo, we have misspelled &lt;em&gt;urllib&lt;/em&gt;. Here is what
&lt;strong&gt;pyflakes&lt;/strong&gt; thinks about our program:&lt;/p&gt;
&lt;pre class=&quot;literal-block&quot;&gt;
$ pyflakes example.py
example.py:1: &#39;urllib&#39; imported but unused
example.py:4: undefined name &#39;urlib&#39;
&lt;/pre&gt;
&lt;p&gt;On line 4 we try to use &lt;em&gt;urlib&lt;/em&gt; which is not defined. Also, we import
&lt;em&gt;urllib&lt;/em&gt; on line 1 and we do nothing with it. Our typo has been spotted!
Notice that, even though our program contains a print statement, &#39;pyflakes
example&#39; has not been printed. That is because pyflakes &lt;em&gt;parses&lt;/em&gt; the source
files it checks, without &lt;em&gt;importing&lt;/em&gt; them, making it safe to use on modules
with side effects.&lt;/p&gt;
&lt;p&gt;pyflakes can be installed with pip or apt-get.&lt;/p&gt;
&lt;p&gt;The second tool I want to talk about is Ned Batchelder&#39;s &lt;a class=&quot;reference external&quot; href=&quot;http://nedbatchelder.com/code/coverage&quot;&gt;coverage.py&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;No doubt you write unit tests for your programs. Right? Good. coverage.py is
out there to help you checking how much of your program is &lt;a class=&quot;reference external&quot; href=&quot;https://en.wikipedia.org/wiki/Code_coverage&quot;&gt;actually covered&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Let&#39;s use as an example &lt;a class=&quot;reference external&quot; href=&quot;https://crate.io/packages/codicefiscale&quot;&gt;codicefiscale&lt;/a&gt;, a Python project of mine.&lt;/p&gt;
&lt;p&gt;First we install &lt;strong&gt;coverage&lt;/strong&gt;:&lt;/p&gt;
&lt;pre class=&quot;literal-block&quot;&gt;
pip install coverage
&lt;/pre&gt;
&lt;p&gt;Then we run our unit tests:&lt;/p&gt;
&lt;pre class=&quot;literal-block&quot;&gt;
$ coverage run --source=codicefiscale tests.py
.......
----------------------------------------------------------------------
Ran 7 tests in 0.003s
&lt;/pre&gt;
&lt;p&gt;We pass the module we want to test with &lt;strong&gt;--source=codicefiscale&lt;/strong&gt; so that
coverage will only report information about that specific module.&lt;/p&gt;
&lt;p&gt;Now that our tests have been performed successfully it is time to check how
much of our code is covered by unit tests:&lt;/p&gt;
&lt;pre class=&quot;literal-block&quot;&gt;
$ coverage report -m
Name            Stmts   Miss  Cover   Missing
---------------------------------------------
codicefiscale      73      4    95%   61, 67, 95, 100
&lt;/pre&gt;
&lt;p&gt;Not bad, 95% of our module is covered! Still, coverage let us know that 4 lines
have not been touched by the unit tests. With this information, we can go write
some meaningful test cases that will also cover the missing lines.&lt;/p&gt;

</content>
  </entry>
  
  <entry>
    <title>Story of a bug in Ubuntu</title>
    <link href="http://www.linux.it/~ema/2012/09/02/story-of-a-bug-in-ubuntu/"/>
    <updated>2012-09-02T00:00:00+02:00</updated>
    <id>http://www.linux.it/~ema/2012/09/02/story-of-a-bug-in-ubuntu</id>
    <content type="html">&lt;p&gt;Some months ago I have run into a pretty interesting bug while working on a Ubuntu-based remote desktop system. The whole OS was installed on a server somewhere and users could access their desktop remotely. Some call this stuff &lt;em&gt;Desktop-as-a-Service&lt;/em&gt;.&lt;/p&gt;
&lt;p&gt;The operating system we chose was Ubuntu Oneiric (11.10) and the remote access part was implemented with &lt;a href=&quot;http://www.x2go.org&quot;&gt;x2go&lt;/a&gt;, which uses nxagent to provide NX transport of X sessions. Users could access their Ubuntu machines remotely, with sound, video, youtube, and all you would expect from a desktop machine. The whole thing was working quite well.&lt;/p&gt;
&lt;p&gt;Now, as I said that was in May. Ubuntu 12.04 &lt;span class=&quot;caps&quot;&gt;LTS&lt;/span&gt; was available, and the choice of upgrading to it sounded pretty much obvious. So we upgraded our test system to Precise and everything seemed to work smoothly. Till we tried to open a &lt;span class=&quot;caps&quot;&gt;PDF&lt;/span&gt; document, actually. It took &lt;strong&gt;evince&lt;/strong&gt; about 50 seconds to display a relatively small document. Same story with images opened with the default image viewer, &lt;strong&gt;eog&lt;/strong&gt;. The fix delivered to our users was simple: we have set &lt;strong&gt;shotwell-viewer&lt;/strong&gt; as the default image viewer, and &lt;strong&gt;epdfview&lt;/strong&gt; as the default &lt;span class=&quot;caps&quot;&gt;PDF&lt;/span&gt; viewer. Everybody happy.&lt;/p&gt;
&lt;p&gt;In the meantime, obviously, I was interested in this issue so I&amp;#8217;ve tried to run run evince from a terminal, getting the following output:&lt;/p&gt;
&lt;pre&gt;
(evince:15833): GRIP-WARNING **: Failed to initialize gesture manager.
&lt;/pre&gt;
&lt;p&gt;Funny. On another test system running Debian Sid (unstable) everything was working smoothly.&lt;/p&gt;
&lt;p&gt;The diff between Ubuntu&amp;#8217;s version of evince and Debian&amp;#8217;s is a 6MB monster. Among other changes, I noticed that Ubuntu&amp;#8217;s version build-depends on libgrip-dev, which depends on libutouch-geis. Multitouch stuff.  Why should multitouch support break my remote session? So on May the 10th I &lt;a href=&quot;https://bugs.launchpad.net/ubuntu/precise/+source/geis/+bug/997630&quot;&gt;filed a bug on launchpad&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;How this issue got handled is in my opinion one of the many fine examples of the inherent superiority of free software, coupled with a &amp;#8220;we won&amp;#8217;t hide problems&amp;#8221; mindset. For an example of how bad is the proprietary approach, just check a random bug in &lt;a href=&quot;https://bugbase.adobe.com/index.cfm?event=bug&amp;amp;id=2968177&quot;&gt;Adobe&amp;#8217;s bug tracking system&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;But let&amp;#8217;s go back to the evince bug.&lt;/p&gt;
&lt;p&gt;Other users reported that their &lt;a href=&quot;https://bugs.launchpad.net/ubuntu/precise/+source/geis/+bug/997630/comments/3&quot;&gt;&lt;span class=&quot;caps&quot;&gt;VNC&lt;/span&gt; sessions were also affected&lt;/a&gt; by the same problem. After a few days it was clear that the culprit was utouch-geis, and a patch appeared. Unfortunately &lt;a href=&quot;https://bugs.launchpad.net/ubuntu/precise/+source/geis/+bug/997630/comments/13&quot;&gt;it did not actually address the issue&lt;/a&gt;. Somebody else reported that &lt;a href=&quot;https://bugs.launchpad.net/ubuntu/precise/+source/geis/+bug/997630/comments/16&quot;&gt;&lt;span class=&quot;caps&quot;&gt;RDP&lt;/span&gt; sessions were broken too&lt;/a&gt;. At the beginning of June &lt;a href=&quot;https://bugs.launchpad.net/ubuntu/precise/+source/geis/+bug/997630/comments/14&quot;&gt;Precise was still affected&lt;/a&gt;. Finally, on August the 6th &lt;a href=&quot;https://bugs.launchpad.net/ubuntu/precise/+source/geis/+bug/997630/comments/19&quot;&gt;a working patch was submitted&lt;/a&gt; by Bradley M. Froehle and included by Chase Douglas (thank you guys). End of August, fixed version of geis &lt;a href=&quot;https://bugs.launchpad.net/ubuntu/precise/+source/geis/+bug/997630/comments/28&quot;&gt;accepted into precise-updates&lt;/a&gt;, case closed.&lt;/p&gt;
&lt;p&gt;Now for some considerations. The problem was clearly of a certain importance. A Long Term Support, stable version of Ubuntu shipped with broken &lt;span class=&quot;caps&quot;&gt;PDF&lt;/span&gt; and image viewing functionalities. It got fixed properly, even though 3 good months are quite a long time for such a bug to get solved. However, the issue only affected a pretty limited number of users, also certainly not Ubuntu&amp;#8217;s main target audience.&lt;/p&gt;
&lt;p&gt;This bug never affected Debian, simply because &lt;a href=&quot;http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=663882&quot;&gt;utouch-geis has not made its way into the archive yet&lt;/a&gt;. It takes longer to make changes like this in Debian, but for some categories of users stability is more important than new, cool features. Choice is a good thing.&lt;/p&gt;</content>
  </entry>
  
  <entry>
    <title>First steps with Sinatra on Heroku</title>
    <link href="http://www.linux.it/~ema/2011/12/14/first-steps-with-sinatra-on-heroku/"/>
    <updated>2011-12-14T18:21:00+01:00</updated>
    <id>http://www.linux.it/~ema/2011/12/14/first-steps-with-sinatra-on-heroku</id>
    <content type="html">&lt;p&gt;Lately I have been playing a little bit with different Platform as a Service providers. So far, the most developer-friendly one seems to be &lt;a href=&quot;http://www.heroku.com&quot;&gt;Heroku&lt;/a&gt;. In particular, Heroku provides an incredibly straightforward way to get started. After creating an account on their website, you just have to install the appropriate gem:&lt;/p&gt;
&lt;p&gt;&lt;code&gt;sudo gem install heroku&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;The command &lt;code&gt;heroku help&lt;/code&gt; will then show you all the possible invocations of the command line client, just to give you an idea of what you can do with it (everything).&lt;/p&gt;
&lt;p&gt;Alright, that&amp;#8217;s not particularly interesting without an application to play with, is it? So let&amp;#8217;s create a new &lt;a href=&quot;http://www.sinatrarb.com/&quot;&gt;Sinatra&lt;/a&gt; application. In order to do that, we need a new directory containing a file like the following one:&lt;/p&gt;
&lt;pre&gt;
# webapp.rb
require &#39;rubygems&#39;
require &#39;sinatra&#39;
# Add other gems you might need here

get &#39;/&#39; do
  &quot;Your Sinatra app is working!&quot;
end
&lt;/pre&gt;
&lt;p&gt;Also add a Gemfile with all the required dependencies, in our trivial example &lt;code&gt;sinatra&lt;/code&gt; is actually the only gem you need:&lt;/p&gt;
&lt;pre&gt;
source :rubygems
gem &quot;sinatra&quot;
&lt;/pre&gt;
&lt;p&gt;Lastly, you need a &lt;code&gt;config.ru&lt;/code&gt; file where you can require our newly created Ruby program and specify that it is a Sinatra application. In this example, the Ruby file is called &lt;code&gt;webapp.rb&lt;/code&gt;.&lt;/p&gt;
&lt;pre&gt;
require &#39;./webapp&#39;

run Sinatra::Application
&lt;/pre&gt;
&lt;p&gt;A very useful program when developing a Sinatra application is &lt;a href=&quot;http://rtomayko.github.com/shotgun/&quot;&gt;shotgun&lt;/a&gt;. &lt;code&gt;gem install shotgun&lt;/code&gt; and you will be able to run your new shiny app by executing the command &lt;code&gt;shotgun&lt;/code&gt;. While developing on your machine, shotgun will take care of reloading the application for every request, so that you don&amp;#8217;t have to restart the server after every modification to the source code.&lt;/p&gt;
&lt;p&gt;Run &lt;code&gt;bundle install&lt;/code&gt; to easily install all the required dependencies in your development environment, and &lt;code&gt;shotgun&lt;/code&gt; to start the app locally. Pointing your browser to &lt;a href=&quot;http://127.0.0.1:9393/&quot;&gt;http://127.0.0.1:9393/&lt;/a&gt; you can check if everything works as expected. If nothing went wrong, you can create a git repository to track changes to the source code:&lt;/p&gt;
&lt;pre&gt;
git init
git add . 
git commit -m &quot;Initial commit&quot;
&lt;/pre&gt;
&lt;p&gt;Perfect! Now, how do you create and deploy your application on Heroku?&lt;/p&gt;
&lt;pre&gt;
heroku create
git push heroku master
&lt;/pre&gt;
&lt;p&gt;Heroku will automatically find out that you deployed a Sinatra application, it will install all the required dependencies and start serving requests. A few interesting commands you might want to run to see what&amp;#8217;s going on are &lt;code&gt;heroku info&lt;/code&gt;, &lt;code&gt;heroku ps&lt;/code&gt; and &lt;code&gt;heroku logs&lt;/code&gt;. The client also provides a command, &lt;code&gt;heroku open&lt;/code&gt;, that opens your browser at the right production &lt;span class=&quot;caps&quot;&gt;URL&lt;/span&gt;.&lt;/p&gt;
&lt;p&gt;So, you now have a working application under revision control. Dependencies are handled by specifying them into the Gemfile, and the required gems can be installed locally using &lt;a href=&quot;http://gembundler.com/&quot;&gt;bundle&lt;/a&gt;. Shotgun is our friend when it comes to use the application for development purposes. A &lt;code&gt;git push heroku master&lt;/code&gt; is all we need to deploy a new version of the code.&lt;/p&gt;
&lt;p&gt;Of course there is way much more about Sinatra and Heroku than what I&amp;#8217;ve covered in this mini-intro. Please refer to the &lt;a href=&quot;http://sinatra-book.gittr.com/&quot;&gt;Sinatra Book&lt;/a&gt; and the &lt;a href=&quot;http://devcenter.heroku.com/&quot;&gt;Heroku Dev Center&lt;/a&gt; for more information!&lt;/p&gt;</content>
  </entry>
  
  <entry>
    <title>A neat VLC extension to download subtitles</title>
    <link href="http://www.linux.it/~ema/2011/10/10/neat-vlc-extension-to-download-subtitles/"/>
    <updated>2011-10-10T00:00:00+02:00</updated>
    <id>http://www.linux.it/~ema/2011/10/10/neat-vlc-extension-to-download-subtitles</id>
    <content type="html">&lt;p&gt;As somebody who often watches movies and TV shows I  have the recurring problem of finding the right English subtitles for the video I am about to enjoy. Now, that is really a tedious thing to do. You go on a website such as &lt;a href=&quot;http://www.opensubtitles.org/en&quot;&gt;opensubtitles.org&lt;/a&gt; and type the title of what you are looking for. Then you usually have to choose from a plethora of results, download the archive, unzip it, fire up &lt;span class=&quot;caps&quot;&gt;VLC&lt;/span&gt;, go to Video &amp;#8594; Subtitles Track &amp;#8594; Open File, and finally open your subtitles file. And what you typically find out at that point is that the subtitles are completely out of sync with the audio, but rather than doing the whole process again you prefer to just sync them with a bit of &lt;span class=&quot;caps&quot;&gt;VLC&lt;/span&gt;-fu. Which always takes longer than you thought, but hey.&lt;/p&gt;
&lt;p&gt;Now, what if there was an extremely simple way to just choose the subtitles for a given movie &lt;strong&gt;directly from &lt;span class=&quot;caps&quot;&gt;VLC&lt;/span&gt;&lt;/strong&gt;?&lt;/p&gt;
&lt;p&gt;The good news is that somebody wrote a beautiful &lt;span class=&quot;caps&quot;&gt;VLC&lt;/span&gt; extension that does exactly that. He also wrote an &lt;a href=&quot;http://jpeg.dinauz.org/blog/index.php?post/2010/01/30/Extensions-in-VLC&quot;&gt;introductory article about &lt;span class=&quot;caps&quot;&gt;VLC&lt;/span&gt; extensions&lt;/a&gt;. Thank you, Jean-Philippe André.&lt;/p&gt;
&lt;p&gt;Installing the thing is as simple as downloading &lt;a href=&quot;http://addons.videolan.org/CONTENT/content-files/141787-subtitles-mod.lua&quot;&gt;the subtitles extension&lt;/a&gt; and putting it in the &lt;span class=&quot;caps&quot;&gt;VLC&lt;/span&gt; scripts folder. On Linux machines, the extensions folder can be found at ~/.local/share/vlc/lua/extensions/, on Windows &lt;span&gt;&lt;span class=&quot;caps&quot;&gt;APPDATA&lt;/span&gt;&lt;/span&gt;\&lt;span class=&quot;caps&quot;&gt;VLC&lt;/span&gt;\lua\extensions. But seriously, don&amp;#8217;t use Windows.&lt;/p&gt;
&lt;p&gt;Once the extension is installed you can start watching a movie and then click View &amp;#8594; Subtitles to open the subtitles search interface.&lt;/p&gt;
&lt;p&gt;This is how it looks like:&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;http://i.imgur.com/lvpSa.png&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;
&lt;p&gt;Now that the practical problem is solved, please take some time to look at &lt;a href=&quot;http://addons.videolan.org/CONTENT/content-files/141787-subtitles-mod.lua&quot;&gt;the source code&lt;/a&gt;. &lt;span class=&quot;caps&quot;&gt;VLC&lt;/span&gt; uses Lua as the language for writing extensions. I certainly cannot say that the web is full of resources about how to extend &lt;span class=&quot;caps&quot;&gt;VLC&lt;/span&gt; using Lua, but the piece of code I wrote about in this post is certainly a good way to start hacking, and maybe scratch yet another itch.&lt;/p&gt;</content>
  </entry>
  
  <entry>
    <title>Gospel according to Tux</title>
    <link href="http://www.linux.it/~ema/2011/10/05/gospel-according-to-tux/"/>
    <updated>2011-10-05T00:00:00+02:00</updated>
    <id>http://www.linux.it/~ema/2011/10/05/gospel-according-to-tux</id>
    <content type="html">&lt;p&gt;Some years ago I came across a really peculiar newsgroup post. It was not about technicalities of any sort. It was about history. A beautifully written history of computers. From the Turing machine to the Free Software world, the original author managed to capture all the important events of the computer revolution with a great deal of humor. Re-posting it here, it is just brilliant.&lt;/p&gt;
&lt;h3&gt;The Gospel of Tux (v1.0)&lt;/h3&gt;
&lt;p&gt;In the beginning Turing created the Machine.&lt;/p&gt;
&lt;p&gt;And the Machine was crufty and bodacious, existing in theory only. And von Neumann looked upon the Machine, and saw that it was crufty. He divided the Machine into two Abstractions, the Data and the Code, and yet the two were one Architecture. This is a great Mystery, and the beginning of wisdom.&lt;/p&gt;
&lt;p&gt;And von Neumann spoke unto the Architecture, and blessed it, saying, &amp;#8220;Go forth and replicate, freely exchanging data and code, and bring forth all manner of devices unto the earth.&amp;#8221; And it was so, and it was cool. The Architecture prospered and was implemented in hardware and software. And it brought forth many Systems unto the earth.&lt;/p&gt;
&lt;p&gt;The first Systems were mighty giants; many great works of renown did they accomplish. Among them were Colossus, the codebreaker; &lt;span class=&quot;caps&quot;&gt;ENIAC&lt;/span&gt;, the targeter; &lt;span class=&quot;caps&quot;&gt;EDSAC&lt;/span&gt; and &lt;span class=&quot;caps&quot;&gt;MULTIVAC&lt;/span&gt; and all manner of froody creatures ending in AC, the experimenters; and &lt;span class=&quot;caps&quot;&gt;SAGE&lt;/span&gt;, the defender of the sky and father of all networks.  These were the mighty giants of old, the first children of Turing, and their works are written in the Books of the Ancients. This was the First Age, the age of Lore.&lt;/p&gt;
&lt;p&gt;Now the sons of Marketing looked upon the children of Turing, and saw that they were swift of mind and terse of name and had many great and baleful attributes.  And they said unto themselves, &amp;#8220;Let us go now and make us Corporations, to bind the Systems to our own use that they may bring us great fortune.&amp;#8221; With sweet words did they lure their customers, and with many chains did they bind the Systems, to fashion them after their own image. And the sons of Marketing fashioned themselves Suits to wear, the better to lure their customers, and wrote grave and perilous Licenses, the better to bind the Systems. And the sons of Marketing thus became known as Suits, despising and being despised by the true Engineers, the children of von Neumann.&lt;/p&gt;
&lt;p&gt;And the Systems and their Corporations replicated and grew numerous upon the earth. In those days there were &lt;span class=&quot;caps&quot;&gt;IBM&lt;/span&gt; and Digital, Burroughs and Honeywell, Unisys and Rand, and many others. And they each kept to their own System, hardware and software, and did not interchange, for their Licences forbade it.  This was the Second Age, the age of Mainframes.&lt;/p&gt;
&lt;p&gt;Now it came to pass that the spirits of Turing and von Neumann looked upon the earth and were displeased. The Systems and their Corporations had grown large and bulky, and Suits ruled over true Engineers. And the Customers groaned and cried loudly unto heaven, saying, &amp;#8220;Oh that there would be created a System mighty in power, yet small in size, able to reach into the very home!&amp;#8221; And the Engineers groaned and cried likewise, saying, &amp;#8220;Oh, that a deliverer would arise to grant us freedom from these oppressing Suits and their grave and perilous Licences, and send us a System of our own, that we may hack therein!&amp;#8221; And the spirits of Turing and von Neumann heard the cries and were moved, and said unto each other, &amp;#8220;Let us go down and fabricate a Breakthrough, that these cries may be stilled.&amp;#8221;&lt;/p&gt;
&lt;p&gt;And that day the spirits of Turing and von Neumann spake unto Moore of Intel, granting him insight and wisdom to understand the future. And Moore was with chip, and he brought forth the chip and named it 4004. And Moore did bless the Chip, saying, &amp;#8220;Thou art a Breakthrough; with my own Corporation have I fabricated thee. Thou thou art yet as small as a dust mote, yet shall thou grow and replicate unto the size of a mountain, and conquer all before thee. This blessing I give unto thee: every eighteen months shall thou double in capacity, until the end of the age.&amp;#8221; This is Moore&amp;#8217;s Law, which endures unto this day.&lt;/p&gt;
&lt;p&gt;And the birth of 4004 was the beginning of the Third Age, the age of Microchips. And as the Mainframes and their Systems and Corporations had flourished, so did the Microchips and their Systems and Corporations. And their lineage was on this wise:&lt;/p&gt;
&lt;p&gt;Moore begat Intel. Intel begat Mostech, Zilog and Atari. Mostech begat 6502, and Zilog begat Z80. Intel also begat 8800, who begat Altair; and 8086, mother of all PCs. 6502 begat Commodore, who begat &lt;span class=&quot;caps&quot;&gt;PET&lt;/span&gt; and 64; and Apple, who begat 2.  (Apple is the great Mystery, the Fruit that was devoured, yet bloomed again.) Atari begat 800 and 1200, masters of the game, who were destroyed by Sega and Nintendo. Xerox begat &lt;span class=&quot;caps&quot;&gt;PARC&lt;/span&gt;. Commodore and &lt;span class=&quot;caps&quot;&gt;PARC&lt;/span&gt; begat Amiga, creator of fine arts; Apple and &lt;span class=&quot;caps&quot;&gt;PARC&lt;/span&gt; begat Lisa, who begat Macintosh, who begat iMac. Atari and &lt;span class=&quot;caps&quot;&gt;PARC&lt;/span&gt; begat ST, the music maker, who died and was no more. Z80 begat Sinclair the dwarf, &lt;span class=&quot;caps&quot;&gt;TRS&lt;/span&gt;-80 and CP/M, who begat many machines, but soon passed from this world. Altair, Apple and Commodore together begat Microsoft, the Great Darkness which is called Abomination, Destroyer of the Earth, the Gates of Hell.&lt;/p&gt;
&lt;p&gt;Now it came to pass in the Age of Microchips that &lt;span class=&quot;caps&quot;&gt;IBM&lt;/span&gt;, the greatest of the Mainframe Corporations, looked upon the young Microchip Systems and was greatly vexed. And in their vexation and wrath they smote the earth and created the &lt;span class=&quot;caps&quot;&gt;IBM&lt;/span&gt; PC. The PC was without sound and colour, crufty and bodacious in great measure, and its likeness was a tramp, yet the Customers were greatly moved and did purchase the PC in great numbers. And &lt;span class=&quot;caps&quot;&gt;IBM&lt;/span&gt; sought about for an Operating System Provider, for in their haste they had not created one, nor had they forged a suitably grave and perilous License, saying, &amp;#8220;First we will build the market, then we will create a new System, one in our own image, and bound by our Licence.&amp;#8221; But they reasoned thus out of pride and not wisdom, not forseeing the wrath which was to come.&lt;/p&gt;
&lt;p&gt;And &lt;span class=&quot;caps&quot;&gt;IBM&lt;/span&gt; came unto Microsoft, who licensed unto them &lt;span class=&quot;caps&quot;&gt;QDOS&lt;/span&gt;, the child of CP/M and 8086. (8086 was the daughter of Intel, the child of Moore). And &lt;span class=&quot;caps&quot;&gt;QDOS&lt;/span&gt; grew, and was named MS-&lt;span class=&quot;caps&quot;&gt;DOS&lt;/span&gt;. And MS-&lt;span class=&quot;caps&quot;&gt;DOS&lt;/span&gt; and the PC together waxed mighty, and conquered all markets, replicating and taking possession thereof, in accordance with Moore&amp;#8217;s Law. And Intel grew terrible and devoured all her children, such that no chip could stand before her. And Microsoft grew proud and devoured &lt;span class=&quot;caps&quot;&gt;IBM&lt;/span&gt;, and this was a great marvel in the land. All these things are written in the Books of the Deeds of Microsoft.&lt;/p&gt;
&lt;p&gt;In the fullness of time MS-&lt;span class=&quot;caps&quot;&gt;DOS&lt;/span&gt; begat Windows. And this is the lineage of Windows: CP/M begat &lt;span class=&quot;caps&quot;&gt;QDOS&lt;/span&gt;. &lt;span class=&quot;caps&quot;&gt;QDOS&lt;/span&gt; begat &lt;span class=&quot;caps&quot;&gt;DOS&lt;/span&gt; 1.0. &lt;span class=&quot;caps&quot;&gt;DOS&lt;/span&gt; 1.0 begat &lt;span class=&quot;caps&quot;&gt;DOS&lt;/span&gt; 2.0 by way of Unix. &lt;span class=&quot;caps&quot;&gt;DOS&lt;/span&gt; 2.0 begat Windows 3.11 by way of &lt;span class=&quot;caps&quot;&gt;PARC&lt;/span&gt; and Macintosh. &lt;span class=&quot;caps&quot;&gt;IBM&lt;/span&gt; and Microsoft begat OS/2, who begat Windows NT and Warp, the lost OS of lore.  Windows 3.11 begat Windows 95 after triumphing over Macintosh in a mighty Battle of Licences. Windows NT begat NT 4.0 by way of Windows 95. NT 4.0 begat NT 5.0, the OS also called Windows 2000, The Millenium Bug, Doomsday, Armageddon, The End Of All Things.&lt;/p&gt;
&lt;p&gt;Now it came to pass that Microsoft had waxed great and mighty among the Microchip Corporations; mighter than any of the Mainframe Corporations before it had it waxed. And Gates&amp;#8217; heart was hardened, and he swore unto his Customers and their Engineers the words of this curse:&lt;/p&gt;
&lt;p&gt;&amp;#8220;Children of von Neumann, hear me. &lt;span class=&quot;caps&quot;&gt;IBM&lt;/span&gt; and the Mainframe Corporations bound thy forefathers with grave and perilous Licences, such that ye cried unto the spirits of Turing and von Neumann for deliverance. Now I say unto ye: I am greater than any Corporation before me. Will I loosen your Licences?  Nay, I will bind thee with Licences twice as grave and ten times more perilous than my forefathers. I will engrave my Licence on thy heart and write my Serial Number upon thy frontal lobes. I will bind thee to the Windows Platform with cunning artifices and with devious schemes. I will bind thee to the Intel Chipset with crufty code and with gnarly APIs. I will capture and enslave thee as no generation has been enslaved before.  And wherefore will ye cry then unto the spirits of Turing, and von Neumann, and Moore? They cannot hear ye. I am become a greater Power than they. Ye shall cry only unto me, and shall live by my mercy and my wrath. I am the Gates of Hell; I hold the portal to &lt;span class=&quot;caps&quot;&gt;MSNBC&lt;/span&gt; and the keys to the Blue Screen of Death. Be ye afraid; be ye greatly afraid; serve only me, and live.&amp;#8221;&lt;/p&gt;
&lt;p&gt;And the people were cowed in terror and gave homage to Microsoft, and endured the many grave and perilous trials which the Windows platform and its greatly bodacious Licence forced upon them. And once again did they cry to Turing and von Neumann and Moore for a deliverer, but none was found equal to the task until the birth of Linux.&lt;/p&gt;
&lt;p&gt;These are the generations of Linux:&lt;/p&gt;
&lt;p&gt;&lt;span class=&quot;caps&quot;&gt;SAGE&lt;/span&gt; begat &lt;span class=&quot;caps&quot;&gt;ARPA&lt;/span&gt;, which begat &lt;span class=&quot;caps&quot;&gt;TCP&lt;/span&gt;/IP, and Aloha, which begat Ethernet. Bell begat Multics, which begat C, which begat Unix. Unix and &lt;span class=&quot;caps&quot;&gt;TCP&lt;/span&gt;/IP begat Internet, which begat the World Wide Web. Unix begat &lt;span class=&quot;caps&quot;&gt;RMS&lt;/span&gt;, father of the great &lt;span class=&quot;caps&quot;&gt;GNU&lt;/span&gt;, which begat the Libraries and Emacs, chief of the Utilities. In the days of the Web, Internet and Ethernet begat the Intranet &lt;span class=&quot;caps&quot;&gt;LAN&lt;/span&gt;, which rose to renown among all Corporations and prepared the way for the Penguin.&lt;/p&gt;
&lt;p&gt;And Linus and the Web begat the Kernel through Unix. The Kernel, the Libraries and the Utilities together are the Distribution, the one Penguin in many forms, forever and ever praised.&lt;/p&gt;
&lt;p&gt;Now in those days there was in the land of Helsinki a young scholar named Linus the Torvald. Linus was a devout man, a disciple of &lt;span class=&quot;caps&quot;&gt;RMS&lt;/span&gt; and mighty in the spirit of Turing, von Neumann and Moore. One day as he was meditating on the Architecture, Linus fell into a trance and was granted a vision. And in the vision he saw a great Penguin, serene and well-favoured, sitting upon an ice floe eating fish. And at the sight of the Penguin Linus was deeply afraid, and he cried unto the spirits of Turing, von Neumann and Moore for an interpretation of the dream.&lt;/p&gt;
&lt;p&gt;And in the dream the spirits of Turing, von Neumann and Moore answered and spoke unto him, saying, &amp;#8220;Fear not, Linus, most beloved hacker. You are exceedingly cool and froody. The great Penguin which you see is an Operating System which you shall create and deploy unto the earth. The ice-floe is the earth and all the systems thereof, upon which the Penguin shall rest and rejoice at the completion of its task. And the fish on which the Penguin feeds are the crufty Licensed codebases which swim beneath all the earth&amp;#8217;s systems.  The Penguin shall hunt and devour all that is crufty, gnarly and bodacious; all code which wriggles like spaghetti, or is infested with blighting creatures, or is bound by grave and perilous Licences shall it capture. And in capturing shall it replicate, and in replicating shall it document, and in documentation shall it bring freedom, serenity and most cool froodiness to the earth and all who code therein.&amp;#8221;&lt;/p&gt;
&lt;p&gt;Linus rose from meditation and created a tiny Operating System Kernel as the dream had foreshewn him; in the manner of &lt;span class=&quot;caps&quot;&gt;RMS&lt;/span&gt;, he released the Kernel unto the World Wide Web for all to take and behold. And in the fulness of Internet Time the Kernel grew and replicated, becoming most cool and exceedingly froody, until at last it was recognised as indeed a great and mighty Penguin, whose name was Tux. And the followers of Linus took refuge in the Kernel, the Libraries and the Utilities; they installed Distribution after Distribution, and made sacrifice unto the &lt;span class=&quot;caps&quot;&gt;GNU&lt;/span&gt; and the Penguin, and gave thanks to the spirits of Turing, von Neumann and Moore, for their deliverance from the hand of Microsoft. And this was the beginning of the Fourth Age, the age of Open Source.&lt;/p&gt;
&lt;p&gt;Now there is much more to be said about the exceeding strange and wonderful events of those days; how some Suits of Microsoft plotted war upon the Penguin, but were discovered on a Halloween Eve; how Gates fell among lawyers and was betrayed and crucified by his former friends, the apostles of Media; how the mercenary Knights of the Red Hat brought the gospel of the Penguin into the halls of the Corporations; and even of the dispute between the brethren of Gnome and &lt;span class=&quot;caps&quot;&gt;KDE&lt;/span&gt; over a trollish Licence. But all these things are recorded elsewhere, in the Books of the Deeds of the Penguin and the Chronicles of the Fourth Age, and I suppose if they were all narrated they would fill a stack of DVDs as deep and perilous as a Usenet Newsgroup.&lt;/p&gt;
&lt;p&gt;Now may you code in the power of the Source; may the Kernel, the Libraries and the Utilities be with you, throughout all Distributions, until the end of the Epoch. Amen.&lt;/p&gt;</content>
  </entry>
  
</feed>
