Compiling pyinterval on Debian Wheezy

When installing pyinterval on my Debian Wheezy system via pip install pyinterval I hit this:

/usr/bin/ld: /usr/local/lib/libcrlibm.a(crlibm_private.o): relocation R_X86_64_32 against `.rodata.str1.8' can not be used when making a shared object; recompile with -fPIC

/usr/local/lib/libcrlibm.a: could not read symbols: Bad value

collect2: error: ld returned 1 exit status

error: command 'gcc' failed with exit status 1

The solution is to install crlibm with the -fPIC flag:

tar zxf crlibm-1.0beta4.tar.gz
cd crlibm-1.0beta4

sudo make install

sudo pip install pyinterval

Then you should be able to run Rump’s example (see Stefano Taschini’s SciPy 2008 paper on pyinterval):

carlo@x1 ~ $ python
Python 2.7.3 (default, Jan  2 2013, 13:56:14)
[GCC 4.7.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from interval import interval
>>> def f(x,y):
...     return (
...         (333.75 - x**2)* y**6 + x**2 *
...             (11* x**2 * y**2 - 121 * y**4 - 2)
...         + 5.5 * y**8 + x/(2*y))
>>> f(interval(77617.0), interval(33096.0))
interval([-3.541774862152234e+21, 3.5417748621522344e+21])

Disable X1 Carbon touchscreen

My Lenovo X1 Carbon has a touchscreen but I rarely use it. Sometimes on waking from suspend it generates spurious clicks that do things on my desktop like creating new folders. To disable the touchscreen completely, edit /etc/X11/xorg.conf.d/disable-touchscreen.conf as follows:

Section "InputClass"
    Identifier      "Annoying Touch Screen"
    Driver          "egalax"
    MatchProduct    "eGalax Inc. eGalaxTouch EXC7903-66v03_T1"

    Option          "DeviceEnabled" "0"

To work out the product name, use xinput:

$ xinput
⎡ Virtual core pointer                      id=2    [master pointer  (3)]
⎜   ↳ Virtual core XTEST pointer                id=4    [slave  pointer  (2)]
⎜   ↳ eGalax Inc. eGalaxTouch EXC7903-66v03_T1  id=9    [slave  pointer  (2)]
⎜   ↳ SynPS/2 Synaptics TouchPad                id=12   [slave  pointer  (2)]
⎜   ↳ TPPS/2 IBM TrackPoint                     id=13   [slave  pointer  (2)]
⎣ Virtual core keyboard                     id=3    [master keyboard (2)]
    ↳ Virtual core XTEST keyboard               id=5    [slave  keyboard (3)]
    ↳ Power Button                              id=6    [slave  keyboard (3)]
    ↳ Video Bus                                 id=7    [slave  keyboard (3)]
    ↳ Sleep Button                              id=8    [slave  keyboard (3)]
    ↳ Integrated Camera                         id=10   [slave  keyboard (3)]
    ↳ AT Translated Set 2 keyboard              id=11   [slave  keyboard (3)]
    ↳ ThinkPad Extra Buttons                    id=14   [slave  keyboard (3)]

If you want to disable the touchscreen temporarily, instead of the Xorg tweak try this command:

xinput --set-prop 'eGalax Inc. eGalaxTouch EXC7903-66v03_T1' 'Device Enabled' 0

Thanks to Ian on the CLUG mailing list for help with the Xorg configuration.

Strip Android Kindle DRM

I bought an ebook from Amazon using their Android Kindle app. Unfortunately the Android app is crippleware in that you can’t export your highlights and notes. So I looked into how to strip the DRM so that I could read the ebook on my Linux (Debian) laptop using a non-DRM-encumbered application. Also, past behaviour of Amazon doesn’t inspire confidence.

I tried using Apprentice Alf’s tools with Calibre on Debian but the decryption didn’t work. I’m not 100% sure but it seemed to be missing the PID of the ebook (the PRC file on my Android device). Some people have written patches for the Android Kindle app so that you can view the ebook’s PID, but they are not up to date. And frankly, patching an apk is a fairly involved process.

The work-around is to run Calibre and Apprentice Alf’s tools on Windows. Here are the details:

1. Install Calibre on Windows.

2. Install the Kindle PC application from Amazon.

3. Install Apprentice Alf’s tools in Calibre. You want to point Calibre at the
file DeDRM_calibre_plugin/ which is inside (don’t unzip!).
Local mirror:

4. Buy an ebook using the Android app (or any linked device).

5. In Kindle PC, sync the book.

6. In Calibre, import the book. You’ll find it in My DocumentsMy Kindle Content. When you import the book in Calibre, Alf’s plugin will automatically strip the DRM.

7. The file in My DocumentsCalibre can now be copied to another device, for example imported into Calibre on a Linux/Debian system.

Here are some screenshots for steps 3, 6, and 7:

Overall, this is a huge pain. At least with my music purchases I can support artists on a site that does not use DRM:

Archived Comments

Date: 2013-12-11 21:51:36.885022 UTC

Author: J

Man spent so much time trying to figure this out, but this made it so easy

Date: 2013-12-18 11:20:08.632469 UTC

Author: Tav

Sadly this doesn’t work for many eMags, the Kindle PC App won’t download them

Date: 2015-02-07 14:13:05.395909 UTC

Author: Brian J Hoskins

Ebook providers try to lock you in to their services; that’s their business model, and it’s how they make their money. But it’s extremely frustrating for the end-user. You end up financially committed to a provider because you’ve purchased many books from them. It happened to me with Google Books. Someone else could have come along with a much better Ebook provider, but I’d still feel like I was shackled to Google Books because I already ‘own’ significant content there.

The problem is then exascerbated when you find that a book you wanted isn’t available from your regular service provider, but it’s available at one of the others. So then you become locked in to *two* Ebook service providers! And you have to download their apps in order to read the books, which means you can’t always access the content on portable devices when you need it, and etc etc etc. The whole situation is a real pain in the back side.

I recently decided enough was enough. I now host my Ebooks myself! I still purchase them legitimately from Ebook service providers, but I strip the DRM using the methods highlighted in this article, then I manage the book in Calibre and host my Calibre library on my own server, thereby freeing me from the frustration of online Ebook service providers.

Date: 2015-05-18 19:56:46.732147 UTC

Author: bráulio

thanks, it worked! great free software (as in freedom!)

Access to water is a human right?

Here’s an interesting video by the Nestle CEO, talking about access to water:

In case the Youtube video doesn’t work, here’s a local mirror:

Transcript of the subtitles from 2:01 to 3:34 (thanks to AP):

There's that lovely old Austrian folk song
"The dear cattle need water, hollera, holleri!"
if you remember.
Water is of course ...
the most important raw material ...
we have today in the world.
It's a question of whether we should privatise ...
the normal water supply of the population.
And there are two different opinions on the matter.
The one opinion, which I think is extreme,
is represented by the NGOs,
who bang on about ...
declaring water ...
a public right.
That means that as a human being you should have a right ...
to water.
That's an extreme solution.
And the other view says ...
that water is a foodstuff like any other,
and like any other foodstuff it should have a market value.
Personally I believe it's better ...
to give a foodstuff a value ...
so that we're all aware that it has its price,
and then that one should take specific measures ...
for the part of the population that has no access to this water,
and there are many different possibilities there.

So he says that the NGOs push an “extreme” opinion that water is a public right.

Really? This sounds like the robber-baron business model: if you can’t afford it, too bad.

Here’s a quote from Australia’s Statement to the General Assembly on the human right to safe and clean drinking water and sanitation:

We do recognise that access to water and sanitation is fundamental
to the realisation of people’s human rights, as enshrined in the
Universal Declaration on Human Rights, the International Covenant on
Civil and Political Rights and the International Covenant on Economic,
Social and Cultural Rights.

Some time ago: UN General Assembly Adopts Resolution Recognizing Access to Clean Water, Sanitation as Human Right, by Recorded Vote of 122 in Favour, None against, 41 Abstentions.

“The dear cattle need water, hollera, holleri!”

Archived Comments

Date: 2013-09-06 09:06:20.155402 UTC

Author: andrej

There’s some dodgy thinking there..

Firstly, even if you take the questionable position that water is a foodstuff when we ingest it, this disregards all the other necessary personal uses of water. Personal washing, clothes washing, watering of plants, toilet systems, heating, cooling, as a solvent, in medicines, etc etc. It’s so sneaky to try to jam water into the category “foodstuffs” and then to argue that it should be priced in the same way as other items in that category.

2. Labelling the view that water is a human right as “extreme” is also a disingenuous ploy. It artificially sets up a “scale” of positions and then tries to place two positions (human right vs market-valued foodstuff) on that scale. Calling one of the positions ‘extreme’ is a completely unobjective value judgement. Even if such a scale made sense, one could easily construct far more extreme views (e.g. every person should have as much water as needed to for totally frivolous purposes).

Calling the human right position extreme is a rhetorical ploy to prime us to accept that the other view is moderate and more reasonable, which it may not be. (I say it isn’t but that’s my value judgement.)

3. Water has a cost now. All my family’s water usage costs over $1000 per year. But that is for many kilolitres. A rough calculaton gives an annualised unit cost of about 0.3 cents per litre. Bottled water costs about $3 for 330 ml, or $9 /litre, 3000 times the unit cost of municipal water! How much does Brabeck think water should cost the thirsty cattle?