Clint Adams: Not the Grace Hopper Conference
Do you love porting? For ideas on how to make GHC suck less on your favorite architecture, see this not-at-all ugly table.
Posted on 2016-11-28
FOSDEM 2016 is going to be great (again!) and you still have the chance to be one of the stars.
Have you submitted your talk to the Desktops DevRoom yet?
No?
Remember: we will only accept proposals until December 5th. After that, the Organization Team will get busy and vote and choose the talks.
Here is the full Call for Participation, in case you need to check the details on how to submit:
FOSDEM Desktops DevRoom 2017 Call for Participation
Topics include anything related to the Desktop: desktop environments, software development for desktop/cross-platform, applications, UI, etc
CRAN just accepted the newest release 0.1.1 of anytime, following the previous five releases since September.
anytime is a very focussed package aiming to do just one thing really well: to convert anything in integer, numeric, character, factor, ordered, ... format to POSIXct (or Date) objects -- and to do so without requiring a format string.
See the anytime page, or the GitHub README.md for a few examples, or just consider the following illustration:
R> library(anytime)
R> anytime("20161107 202122") ## all digits
[1] "2016-11-07 20:21:22 CST"
R> utctime("2016Nov07 202122") ## UTC parse example
[1] "2016-11-07 14:21:22 CST"
R> Date is simply passed through by anydate() or utcdate(). Last but not least we added code coverage support, which oh-so-predictably lead us to game this metric to reach the elusive 100% coverage.
The NEWS file summarises the release:
Courtesy of CRANberries, there is a comparison to the previous release. More information is on the anytime page. For questions or comments use the issue tracker off the GitHub repo.Changes in anytime version 0.1.1 (2016-11-27)
- Both
anydate()andutcdate()no longer attempt to convert an input value that is already of typeDate.- The string splitter (needed for the 'all-digits' formats extending Boost Date_time) is now more defensive about the input argument and more robust. Thanks to Bob Jansen for the heads-up (PR #30 closing issue #29).
- Code coverage reporting has been added (PR #31).
This post by Dirk Eddelbuettel originated on his Thinking inside the box blog. Please report excessive re-aggregation in third-party for-profit settings.
Since 2008 I use two monitors in my desktop. Yesterday I bought a new graphics interface and a third monitor. Some time I was looking for a low cost graphics interface. Ok, I am using GeForce GT 740 which has three output ports: VGA, DVI and HDMI. In Brazil this interface card can be found around R$ 400 (US$ 117, but my card was US$ 87 in Brazilian Black Friday). In Amazon.com, it is between US$ 51 and US$ 109. The chosen manufacturer was Zotac, but all GT 740 and 750 will work fine (I tested the GT 750 too).
The GeForce GT 740 was imediatelly recognised by Debian Jessie with kernel Linux 4.7.0 from Backports (it is my default, so I didn't test with original 3.16 kernel). The driver used was the default X.Org Nouveau. I use KDE and the management was easy.
I hope this post can help people interested in use 3 monitors. Enjoy!
This is now a little overdue, but here it is. On the 10th and 11th of November,
the second
vmdebootstrap sprint took place. Lars Wirzenius (liw),
Ana
Custura (ana_c) and myself were present. liw focussed on the core of
vmdebootstrap, where he sketched out what the future of vmdebootstrap may look
like. He documented this in a mailing list
post and also presented (video).
Ana and myself worked on live-wrapper, which uses vmdebootstrap internally for
the squashfs generation. I worked on improving logging, using a better method
for getting paths within the image, enabling generation of Packages and Release
files for the image archive and also made the images installable (live-wrapper
0.5 onwards will include an installer by default).
Ana worked on the inclusion of HDT and memtest86+ in the live images and
enabled both ISOLINUX (for BIOS boot) and GRUB (for EFI boot) to boot the
text-mode and graphical installers.
live-wrapper 0.5 was released on the 16th November with these fixes included.
You can find live-wrapper documentation at
https://live-wrapper.readthedocs.io/en/latest/. (The documentation still needs
some work, some options may be incorrectly described).
Thanks to the sponsors that made this work possible. You re awesome. (:
A new version of the RcppExamples package is now on CRAN.
The RcppExamples package provides a handful of short examples detailing by concrete working examples how to set up basic R data structures in C++. This version takes advantage of the updated date and datetime classes in Rcpp 0.12.8 (which are optional for now and being phased in while we deprecate the old ones).
A NEWS extract follows:
Courtesy of CRANberries, there is also a diffstat report for the most recent release.Changes in RcppExamples version 0.1.8 (2016-11-24)
- Updated DateExample to show vector addition available under Rcpp 0.12.8 when the (currently still phased in and optional) new Date(time) classes are used via the define in src/Makevars,.win; with fallback code for older versions
- Other minor edits to DESCRIPTION and README.md
This post by Dirk Eddelbuettel originated on his Thinking inside the box blog. Please report excessive re-aggregation in third-party for-profit settings.
Took me a hell of a long time to get my head out of my arse and dive again
into some Debian related work. Thanks to Nik for pushing me from time
to time.
So I've taken the time to upload LyX 2.2.2 to unstable and it's now
build with Qt5. Afterall the package is still missing a lot of love,
but I hope we've once again something for the upcoming stable release,
that is close to the latest upstream stable release. If you use LyX please
give it a try.
For myself it's now the 6th year that I stopped using LyX after maintaining
it for five years. And still I'm sponsoring the uploads and try to keep it
at least functional. Strange how we sometimes take care of stuff even if we
no longer have an active use for them.
/> ls
o- / ......................................................................................................................... [...]
o- backstores .............................................................................................................. [...]
o- fileio ................................................................................................... [0 Storage Object]
o- iblock .................................................................................................. [4 Storage Objects]
o- CENTOS ................................................................................................. [/dev/vdd, in use]
o- SAN1 ................................................................................................... [/dev/vdb, in use]
o- SAN2 ................................................................................................... [/dev/vdc, in use]
o- SANROOT .............................................. [/dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_drive-scsi0-0-0-0, in use]
o- pscsi .................................................................................................... [0 Storage Object]
o- rd_mcp ................................................................................................... [0 Storage Object]
o- ib_srpt ........................................................................................................... [0 Targets]
o- iscsi ............................................................................................................. [3 Targets]
o- iqn.1994-05.com.redhat:23d8eb7fa1fc ................................................................................. [1 TPG]
o- tpg1 ............................................................................................................ [enabled]
o- acls ............................................................................................................ [1 ACL]
o- iqn.1994-05.com.redhat:23d8eb7fa1fc .................................................................... [1 Mapped LUN]
o- mapped_lun0 ............................................................................................. [lun0 (rw)]
o- luns ............................................................................................................ [1 LUN]
o- lun0 ....................................................................................... [iblock/CENTOS (/dev/vdd)]
o- portals ..................................................................................................... [4 Portals]
o- 172.16.20.40:3260 ................................................................................. [OK, iser disabled]
o- 172.16.20.41:3260 ................................................................................. [OK, iser disabled]
o- 172.16.20.42:3260 ................................................................................. [OK, iser disabled]
o- 172.16.20.43:3260 ................................................................................. [OK, iser disabled]
o- iqn.2003-01.org.linux-iscsi.debian.sanboot .......................................................................... [1 TPG]
o- tpg1 ............................................................................................................ [enabled]
o- acls ............................................................................................................ [1 ACL]
o- iqn.2005-03.org.open-iscsi:fd2bc2f4652a-sanboot ........................................................ [1 Mapped LUN]
o- mapped_lun0 ............................................................................................. [lun0 (rw)]
o- luns ............................................................................................................ [1 LUN]
o- lun0 .................................... [iblock/SANROOT (/dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_drive-scsi0-0-0-0)]
o- portals ..................................................................................................... [4 Portals]
o- 172.16.20.40:3260 ................................................................................. [OK, iser disabled]
o- 172.16.20.41:3260 ................................................................................. [OK, iser disabled]
o- 172.16.20.42:3260 ................................................................................. [OK, iser disabled]
o- 172.16.20.43:3260 ................................................................................. [OK, iser disabled]
o- iqn.2003-01.org.linux-iscsi.debian.x8664 ............................................................................ [1 TPG]
o- tpg1 ............................................................................................................ [enabled]
o- acls ............................................................................................................ [1 ACL]
o- iqn.1993-08.org.debian:01:2972f6b5fc7 ................................................................. [2 Mapped LUNs]
o- mapped_lun0 ............................................................................................. [lun0 (rw)]
o- mapped_lun1 ............................................................................................. [lun1 (rw)]
o- luns ........................................................................................................... [2 LUNs]
o- lun0 ......................................................................................... [iblock/SAN1 (/dev/vdb)]
o- lun1 ......................................................................................... [iblock/SAN2 (/dev/vdc)]
o- portals ..................................................................................................... [4 Portals]
o- 172.16.20.40:3260 ................................................................................. [OK, iser disabled]
o- 172.16.20.41:3260 ................................................................................. [OK, iser disabled]
o- 172.16.20.42:3260 ................................................................................. [OK, iser disabled]
o- 172.16.20.43:3260 ................................................................................. [OK, iser disabled]
o- loopback .......................................................................................................... [0 Targets]
o- qla2xxx ........................................................................................................... [0 Targets]
o- tcm_fc ............................................................................................................ [0 Targets]
o- vhost ............................................................................................................. [0 Targets]
/>
/> ls
o- / ......................................................................................................................... [...]
o- backstores .............................................................................................................. [...]
o- block .................................................................................................. [Storage Objects: 4]
o- CENTOS ........................................................................... [/dev/vdd (2.0GiB) write-thru activated]
o- SAN1 ............................................................................. [/dev/vdb (1.0GiB) write-thru activated]
o- SAN2 ............................................................................. [/dev/vdc (1.0GiB) write-thru activated]
o- SANROOT ........................ [/dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_drive-scsi0-0-0-0 (8.0GiB) write-thru activated]
o- fileio ................................................................................................. [Storage Objects: 0]
o- pscsi .................................................................................................. [Storage Objects: 0]
o- ramdisk ................................................................................................ [Storage Objects: 0]
o- iscsi ............................................................................................................ [Targets: 3]
o- iqn.1994-05.com.redhat:23d8eb7fa1fc ............................................................................... [TPGs: 1]
o- tpg1 ............................................................................................... [no-gen-acls, no-auth]
o- acls .......................................................................................................... [ACLs: 1]
o- iqn.1994-05.com.redhat:23d8eb7fa1fc .................................................................. [Mapped LUNs: 1]
o- mapped_lun0 ................................................................................ [lun0 block/CENTOS (rw)]
o- luns .......................................................................................................... [LUNs: 1]
o- lun0 ........................................................................................ [block/CENTOS (/dev/vdd)]
o- portals .................................................................................................... [Portals: 4]
o- 172.16.20.40:3260 ................................................................................................ [OK]
o- 172.16.20.41:3260 ................................................................................................ [OK]
o- 172.16.20.42:3260 ................................................................................................ [OK]
o- 172.16.20.43:3260 ................................................................................................ [OK]
o- iqn.2003-01.org.linux-iscsi.debian.sanboot ........................................................................ [TPGs: 1]
o- tpg1 ............................................................................................... [no-gen-acls, no-auth]
o- acls .......................................................................................................... [ACLs: 1]
o- iqn.2005-03.org.open-iscsi:fd2bc2f4652a-sanboot ...................................................... [Mapped LUNs: 1]
o- mapped_lun0 ............................................................................... [lun0 block/SANROOT (rw)]
o- luns .......................................................................................................... [LUNs: 1]
o- lun0 ..................................... [block/SANROOT (/dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_drive-scsi0-0-0-0)]
o- portals .................................................................................................... [Portals: 4]
o- 172.16.20.40:3260 ................................................................................................ [OK]
o- 172.16.20.41:3260 ................................................................................................ [OK]
o- 172.16.20.42:3260 ................................................................................................ [OK]
o- 172.16.20.43:3260 ................................................................................................ [OK]
o- iqn.2003-01.org.linux-iscsi.debian.x8664 .......................................................................... [TPGs: 1]
o- tpg1 ............................................................................................... [no-gen-acls, no-auth]
o- acls .......................................................................................................... [ACLs: 1]
o- iqn.1993-08.org.debian:01:2972f6b5fc7 ................................................................ [Mapped LUNs: 2]
o- mapped_lun0 .................................................................................. [lun0 block/SAN1 (rw)]
o- mapped_lun1 .................................................................................. [lun1 block/SAN2 (rw)]
o- luns .......................................................................................................... [LUNs: 2]
o- lun0 .......................................................................................... [block/SAN1 (/dev/vdb)]
o- lun1 .......................................................................................... [block/SAN2 (/dev/vdc)]
o- portals .................................................................................................... [Portals: 4]
o- 172.16.20.40:3260 ................................................................................................ [OK]
o- 172.16.20.41:3260 ................................................................................................ [OK]
o- 172.16.20.42:3260 ................................................................................................ [OK]
o- 172.16.20.43:3260 ................................................................................................ [OK]
o- loopback ......................................................................................................... [Targets: 0]
o- vhost ............................................................................................................ [Targets: 0]
/>
I am a incorrigibly in picking non-mainstream, open smartphones, and then struggling hard. Back then in 2008, I tried to use the OpenMoko FreeRunner, but eventually gave up because of hardware glitches and reverted to my good old Siemens S35. It was not that I would not be willing to put up with inconveniences, but as soon as it makes live more difficult for the people I communicate with, it becomes hard to sustain.
Two years ago I tried again, and got myself a Jolla phone, running Sailfish OS. Things are much nicer now: The hardware is mature, battery live is good, and the Android compatibility layer enables me to run many important apps that are hard to replace, especially the Deutsche Bahn Navigator and various messengers, namely Telegram, Facebook Messenger, Threema and GroupMe.
Some apps that require Google Play Services, which provides a bunch of common tasks and usually comes with the Google Play store would not run on my phone, as Google Play is not supported on Sailfish OS. So far, the most annoying ones of that sort were Uber and Lyft, making me pay for expensive taxis when others would ride cheaper, but I can live with that. I tried to install Google Play Services from shady sources, but it would regularly crash.
/system/framework/framework.jar file, put it into the input folder of this project, run python main.py, select 2, and copy the framework.jar from output/ back. Great.
foo.odex in the Android system folder, runs some tool on them to create a classes.dex file, and adds that to the corresponding foo.jar or foo.apk file, copies this back to the phone and deletes the foo.odex file.
The annoying this is that one does not only have to do it for framework.jar in order to please tingle, because if one does it to one odex file, one has to do to all! It seems that for people using Windows, the Universal Deodexer V5 seems to be a convenient tool, but I had to go more manually.
So I first fetched smali , compiled it using ./gradlew build. Then I fetched the folders /opt/alien/system/framework and /opt/alien/system/app from the phone (e.g. using scp). Keep a backup of these in case something breaks. Then I ran these commands (disclaimer: I fetched these from my bash history and slightly cleaned them up. This is not a fire-and-forget script! Use it when you know what it and you are doing):
cd framework
for file in *.odex
do
java -jar ~/build/smali/baksmali/build/libs/baksmali.jar deodex $file -o out
java -jar ~/build/smali/smali/build/libs/smali.jar a out -o classes.dex
zip -u $(basename $file .odex).jar classes.dex
rm -rf out classes.dex $file
done
cd ..
cd app
for file in *.odex
do
java -jar ~/build/smali/baksmali/build/libs/baksmali.jar deodex -d ../framework $file -o out
java -jar ~/build/smali/smali/build/libs/smali.jar a out -o classes.dex
zip -u $(basename $file .odex).apk classes.dex
rm -rf out classes.dex $file
done
cd ..
The resulting framework.jar can now be patched with tingle:
mv framework/framework.jar ~/build/tingle/input
cd ~/build/tingle
./main.py
# select 2
cd -
mv ~/build/tingle/output/framework.jar framework/framework.jar
Now I copy these framework and app folders back on my phone, and restart Dalvik:
devel-su systemctl restart aliendalvik.service
It might start a bit slower than usually, but eventually, all the Android apps should work as before.
The final bit that was missing in my case was that I had to reinstall Signal: If it is installed before microG is installed, it does not get permission to use GCM, and when it tries (while registering: After generating the keys) it just crashes. I copied /data/data/org.thoughtcrime.secretsms/ before removing Signal and moved it back after (with cp -a to preserve permissions) so that I could keep my history.
And now, it seems, vanilla Signal is working just fine on my Jolla phone!
No man pages, but almost
The AWS Command Line Interface, which is available in Debian,
provides no man page. Instead, that tool has an integrated help system,
which allows you to run commands such as aws rds
help, that, for what I have seen, generates some
reStructuredText, then converts it to a man page in troff format, then
calls troff to convert it to text with basic formatting, and eventually
passes it to a pager. Since this is close to what man does, the
result looks like a degraded man page, with some features missing such
as the adaptation to the terminal width.
Well, this is better than nothing, and better than what many
under-documented tools can offer, but for several reasons, it still
sucks: most importantly, it does not respect administrators' habits and
it does not integrate with the system man database. You it does not
allow you to use commands such as apropos,
and you will get no man page name auto-completion from your shell since
there is no man page.Generate the man pages
Now, since the integrated help system does generate a man page
internally, we can hack it to output it, and save it to a file:
Description: Enable a mode to generate troff man pages
The awscli help system internally uses man pages, but only to convert
them to text and show them with the pager. This patch enables a mode
that prints the troff code so the user can save the man page.
.
To use that mode, run the help commands with an environment variable
OUTPUT set to 'troff', for instance:
OUTPUT='troff' aws rds help
Forwarded: no
Author: Tanguy Ortolo <tanguy+debian@ortolo.eu>
Last-Update: 2016-11-22
Index: /usr/lib/python3/dist-packages/awscli/help.py
===================================================================
--- /usr/lib/python3/dist-packages/awscli/help.py 2016-11-21 12:14:22.236254730 +0100
+++ /usr/lib/python3/dist-packages/awscli/help.py 2016-11-21 12:14:22.236254730 +0100
@@ -49,6 +49,8 @@
Return the appropriate HelpRenderer implementation for the
current platform.
"""
+ if 'OUTPUT' in os.environ and os.environ['OUTPUT'] == 'troff':
+ return TroffHelpRenderer()
if platform.system() == 'Windows':
return WindowsHelpRenderer()
else:
@@ -97,6 +99,15 @@
return contents
+class TroffHelpRenderer(object):
+ """
+ Render help content as troff code.
+ """
+
+ def render(self, contents):
+ sys.stdout.buffer.write(publish_string(contents, writer=manpage.Writer()))
+
+
class PosixHelpRenderer(PagingHelpRenderer):
"""
Render help content on a Posix-like system. This includes
This patch must be applied from the root directory with patch -p0, otherwise GNU patch will not
accept to work on files with absolute names.
With that patch, you can run help commands with an environment
variable OUTPUT='troff' to get
the man page to use it as you like, for instance:
% OUTPUT='troff' aws rds help > aws_rds.1 % man -lt aws_rds.1 lpGenerate all the man pages Now that we are able to generate the man page of any aws command, all we need to generate all of them is a list of all the available commands. This is not that easy, because the commands are somehow derived from functions provided by a Python library named botocore, which are derived from a bunch of configuration files, and some of them are added, removed or renamed. Anyway, I have been able to write a Python script that does that, but it includes a static list of these modifications:
#! /usr/bin/python3
import subprocess
import awscli.clidriver
def write_manpage(command):
manpage = open('%s.1' % '_'.join(command), 'w')
command.append('help')
process = subprocess.Popen(command,
env= 'OUTPUT': 'troff' ,
stdout=manpage)
process.wait()
manpage.close()
driver = awscli.clidriver.CLIDriver()
command_table = driver._get_command_table()
renamed_commands = \
'config': 'configservice',
'codedeploy': 'deploy',
's3': 's3api'
added_commands = \
's3': ['cp', 'ls', 'mb', 'mv', 'presign', 'rb', 'rm', 'sync',
'website']
removed_subcommands = \
'ses': ['delete-verified-email-address',
'list-verified-email-addresses',
'verify-email-address'],
'ec2': ['import-instance', 'import-volume'],
'emr': ['run-job-flow', 'describe-job-flows',
'add-job-flow-steps', 'terminate-job-flows',
'list-bootstrap-actions', 'list-instance-groups',
'set-termination-protection',
'set-visible-to-all-users'],
'rds': ['modify-option-group']
added_subcommands = \
'rds': ['add-option-to-option-group',
'remove-option-from-option-group']
# Build a dictionary of real commands, including renames, additions and
# removals.
real_commands =
for command in command_table:
subcommands = []
subcommand_table = command_table[command]._get_command_table()
for subcommand in subcommand_table:
# Skip removed subcommands
if command in removed_subcommands \
and subcommand in removed_subcommands[command]:
continue
subcommands.append(subcommand)
# Add added subcommands
if command in added_subcommands:
for subcommand in added_subcommands[command]:
subcommands.append(subcommand)
# Directly add non-renamed commands
if command not in renamed_commands:
real_commands[command] = subcommands
# Add renamed commands
else:
real_commands[renamed_commands[command]] = subcommands
# Add added commands
for command in added_commands:
real_commands[command] = added_commands[command]
# For each real command and subcommand, generate a manpage
write_manpage(['aws'])
for command in real_commands:
write_manpage(['aws', command])
for subcommand in real_commands[command]:
write_manpage(['aws', command, subcommand])
'sync', 'website']
This script will generate more than 2,000 man page files in the
current directory; you will then be able to move them to /usr/local/share/man/man1.
Since this is a lot of man pages, it may be appropriate to
concatenate them by major command, for instance all the aws rds together
I spent a few days in Cambridge for a minidebconf. This is a tiny
version of the full annual Debconf. We had a couple of days for
hacking, and another two days for talks.
I spent my hacking time on thinking about vmdebootstrap (my tool for
generating disk images with an installed Debian), and came to the
conclusion I need to atone my sins for writing such crappy code by
rewriting it from scratch to be nicer to use. I gave a talk about
this, too. The
mailing list post
has the important parts, and
meetings-archive
has a video.
I haven't started the rewrite, and it's not going to make it for
stretch.
I also gave two other talks, on the early days of Linux, and
Qvarn, the latter being what I do at work.
Thank you to ARM, for sponsoring the location, and the other sponsors
for sponsoring food. These in-real-life meetings between developers
are important for the productivity and social cohesion of Debian.
I don't often write on this blog, and when I do, it's either tech related,
or light life stuff.
Over the next few weeks, it's going to get a lot more political. If you
currently follow this blog for its technical content, you may be tempted to
tune out. I would encourage you to stay and listen. I'm passionate about
the technology that I work on; but the greatest problems facing our world
today are not ones that will be solved with software.
American democracy is in bad shape, and it's because of what we're doing to
it. This is not a problem of the Right or of the Left; it is not a problem
that began with the election of Donald Trump, and it's not a problem that
will go away at the end of his term. It is partly a structural problem with
the way our elections work, but more than that it's a problem of how we're
splitting into separate tribes, isolating ourselves from those who don't
agree with us.
As Russ Allbery
wrote the morning after the election, everything about how we organize
ourselves online today - and how we let Facebook and Twitter organize us -
leads us to surround ourselves with people who already think the same way we
do. That leaves all of us with huge blind spots for other people in our
country, and it stifles the free exchange of ideas that is so essential for
a healthy democracy. We need leaders who will work to make America a better
and more just place for all our neighbors, not just a two-party system
that plays tug-of-war using two different sets of voters that feel shut out.
And the way we organize ourselves today (online and off) does not let us
recognize those leaders.
There's a lot of talk now about Facebook changing how it decides what to
show people; and maybe they can manage to help everyone's online experience
be a little less of a bubble. But part of the change needs to come from us.
We need to be willing to engage, civilly, with people whose perspective is
different from ours, and make the effort to understand where the other is
coming from.
So for the next few weeks, I'm going to talk. And I'm going to listen.
I have no unique qualifications to speak about the country's issues. But I
do have a perspective of my own, which might be different enough from yours
to be useful. I was born and raised in Iowa, and graduated from college
there. This election cycle, I learned that Iowa holds the distinction of
being the state with the lowest percentage of college-educated whites. I'm
part of that statistic, because a few years after graduating I moved to
Portland, Oregon - a place that's notoriously so far to the left of what we
think of as the middle, that it actually has anarchists who would
shamefully use a peaceful protest as cover to commit property
crime.
So I know a few things about the people in each state, that I think the
other should hear.
I'm also that rarest of creatures, a Portlander who goes to church
(Catholic). But I still choose as my neighbors the weird, wonderful, and
welcoming community that we have here, whatever Glenn
Beck might think.
I have a son, and I worry about what kind of world he'll grow up to live in.
I work in software, which means I'm doing a lot better than a lot of people
in the country right now; it also means that from where I sit, I see trends
already in progress that will have an effect on the working class and the
middle class that makes NAFTA look like a gnat's fart in comparison. And so
I worry for what kind of world we will all live in, if we don't make some
changes fast.
Let's have a conversation. No comments enabled on this blog, but you can
find me on G+ or on
Facebook.
Like I wrote before, we at Collabora have been working on improving WebKitGTK+ performance for customer projects, such as Apertis. We took the opportunity brought by recent improvements to WebKitGTK+ and GTK+ itself to make the final leg of drawing contents to screen as efficient as possible. And then we went on investigating why so much CPU was still being used in some of our test cases.
The first weird thing we noticed is performance was actually degraded on Wayland compared to running under X11. After some investigation we found a lot of time was being spent inside GTK+, painting the window s background.
Here s the thing: the problem only showed under Wayland because in that case GTK+ is responsible for painting the window decorations, whereas in the X11 case the window manager does it. That means all of that expensive blurring and rendering of shadows fell on GTK+ s lap.
During the web engines hackfest, a couple of months ago, I delved deeper into the problem and noticed, with Carlos Garcia s help, that it was even worse when HiDPI displays were thrown into the mix. The scaling made things unbearably slower.
You might also be wondering why would painting of window decorations be such a problem, anyway? They should only be repainted when a window changes size or state anyway, which should be pretty rare, right? Right, that is one of the reasons why we had to make it fast, though: the resizing experience was pretty terrible. But we ll get back to that later.
So I dug into that, made a few tries at understanding the issue and came up with a patch showing how applying the blur was being way too expensive. After a bit of discussion with our own Pekka Paalanen and Benjamin Otte we found the root cause: a fast path was not being hit by pixman due to the difference in scale factors on the shadow mask and the target surface. We made the shadow mask scale the same as the surface s and voil , sane performance.
I keep talking about this being a performance problem, but how bad was it? In the following video you can see how huge the impact in performance of this problem was on my very recent laptop with a HiDPI display. The video starts with an Epiphany window running with a patched GTK+ showing a nice demo the WebKit folks cooked for CSS animations and 3D transforms.
After a few seconds I quickly alt-tab to the version running with unpatched GTK+ I made the window the exact size and position of the other one, so that it is under the same conditions and the difference can be seen more easily. It is massive.
Yes, all of that slow down was caused by repainting window shadows! OK, so that solved the problem for HiDPI displays, made resizing saner, great! But why is GTK+ repainting the window even if only the contents are changing, anyway? Well, that turned out to be an off-by-one bug in the code that checks whether the invalidated area includes part of the window decorations.
If the area being changed spanned the whole window width, say, it would always cause the shadows to be repainted. By fixing that, we now avoid all of the shadow drawing code when we are running full-window animations such as the CSS poster circle or gtk3-demo s pixbufs demo.
As you can see in the video below, the gtk3-demo running with the patched GTK+ (the one on the right) is using a lot less CPU and has smoother animation than the one running with the unpatched GTK+ (left).
Pretty much all of the overhead caused by window decorations is gone in the patched version. It is still using quite a bit of CPU to animate those pixbufs, though, so some work still remains. Also, the overhead added to integrate cairo and GL rendering in GTK+ is pretty significant in the WebKitGTK+ CSS animation case. Hopefully that ll get much better from GTK+ 4 onwards.
I run a couple of different sites that allow users to sign-up and use various
services. In each of these sites I have some minimal rules in place to detect bad signups, but these are a little ad hoc, because the nature of "badness" varies on a per-site basis.
I've worked in a couple of places where there are in-house tests of bad signups, and these usually boil down to some naive, and overly-broad, rules:
200 OK" or "403 Forbidden" based on some very very simple critereon. This is modeled on the spam detection service for blog-comments server I use - something that is itself becoming less useful over time. (Perhaps time to kill that? A decision for another day.)
Unfortunately this whole approach is very reactive, as it takes human eyeballs to detect new classes of problems. Code can't guess in advance that it should block usernames which could collide with official ones, for example allowing a username of "admin", "help", or "support".
I'm certain that these systems have been written a thousand times, as I've seen at least five such systems, and they're all very similar. The biggest flaw in all these systems is that they try to classify users in advance of them doing anything. We're trying to say "Block users who will use stolen credit cards", or "Block users who'll submit spam", by correlating that behaviour with other things. In an ideal world you'd judge users only by the actions they take, not how they signed up. And yet .. it is better than nothing.
For the moment I'm continuing to try to make the best of things, at least by centralising the rules for myself I cut down on duplicate code. I'll pretend I'm being cool, modern, and sexy, and call this a micro-service! (Ignore the lack of containers for the moment!)
Even though the World Chess Championship takes up
a lot of time these days, I've still found some time for Nageru,
my live video mixer. But this time it doesn't come in form of code; rather,
I've spent my time writing documentation.
I spent some time fretting over what technical solution I wanted. I explicitly
wanted end-user documentation, not developer documentation I rarely find
HTML-rendered versions of every member function in a class the best way
to understand a program anyway. Actually, on the contrary:
Having all sorts of syntax interwoven in class comments tends to be more
distracting than anything else.
Eventually I settled on Sphinx, not because
I found it fantastic (in particular, ReST is a pain with its bizarre
variable punctuation-based syntax), but because I'm convinced it has all
the momentum right now. Just like git did back in the day, the fact that the
Linux kernel has chosen it means it will inevitably grow a quite large
ecosystem, and I won't be ending up having to maintain it anytime soon.
I tried finding a balance between spending time on installation/setup
(only really useful for first-time users, and even then, only a subset
of them), concept documentation (how to deal with live video in general,
and how Nageru fits into a larger ecosystem of software and equipment)
and more concrete documentation of all the various features and quirks
of Nageru itself. Hopefully, most people will find at least something
that's not already obvious to them, without drowning in detail.
You can read the documentation at https://nageru.sesse.net/doc/,
or if you want to send patches, the right place to patch is
the git repository.
The BH package on CRAN was updated to version 1.62.0. BH provides a large part of the Boost C++ libraries as a set of template headers for use by R, possibly with Rcpp as well as other packages.
This release upgrades the version of Boost to the upstream version Boost 1.62.0, and adds three new libraries as shown in the brief summary of changes from the NEWS file which follows below.
Special thanks to Kurt Hornik and Duncan Murdoch for help tracking down one abort() call which was seeping into R package builds, and then (re-)testing the proposed fix. We are now modifying one more file ever so slightly to use ::Rf_error(...) instead.
Courtesy of CRANberries, there is also aChanges in version 1.62.0-1 (2016-11-15)
- Upgraded to Boost 1.62 installed directly from upstream source
- Added Boost property_tree as requested in #29 by Aydin Demircioglu
- Added Boost scope_exit as requested in #30 by Kirill Mueller
- Added Boost atomic which we had informally added since 1.58.0
diffstat report for the most recent release.
Comments and suggestions are welcome via the mailing list or the issue tracker at the GitHubGitHub repo.
This post by Dirk Eddelbuettel originated on his Thinking inside the box blog. Please report excessive re-aggregation in third-party for-profit settings.
Updates to Altos Lisp
I wrote a few days ago about a tiny lisp
interpreter I wrote for AltOS
Really, it's almost "done" now, I just wanted to make a few improvements
Incremental Collection
I was on a walk on Wednesday when I figured out that I didn't need to
do a full collection every time; a partial collection that only
scanned the upper portion of memory would often find plenty of free
space to keep working for a while.
To recap, the heap is in two pieces; the ROM piece and the RAM
piece. The ROM piece is generated during the build process and never
changes afterwards (hence the name), so the only piece which is
collected is the RAM piece. Collection works like:
chunk_low = heap base
new_top = heap base
For all of the heap
Find the first 64 live objects above chunk_low
Compact them all to new_top
Rewrite references in the whole heap for them
Set new_top above the new locations
Set chunk_low above the old locations
top = new_top
The trick is to realize that there's really no need to start at the
bottom of the heap; you can start anywhere you like and compact stuff,
possibly leaving holes below that location in the heap. As the heap
tends to have long-lived objects slowly sift down to the beginning,
it's useful to compact objects higher than that, skipping the
compaction process for the more stable area in memory.
Each time the whole heap is scanned, the top location is
recorded. After that, incremental collects happen starting at that
location, and when that doesn't produce enough free space, a full
collect is done.
The collector now runs a bunch faster on average now.
Binary Searches
I stuck some linear searches in a few places in the code, the first
was in the collector when looking to see where an object had moved
to. As there are 64 entries, the search is reduced from 32
to 6 compares on average. The second place was in the frame objects,
which hold the list of atom/value bindings for each lexical scope
(including the global scope). These aren't terribly large, but a
binary search is still a fine plan. I wanted to write down here the
basic pattern I'm using for binary searches these days, which avoids
some of the boundary conditions I've managed to generate in the past:
int find (needle)
int l = 0;
int r = count - 1;
while (l <= r)
int m = (l + r) >> 1;
if (haystack[m] < needle)
l = m + 1;
else
r = m - 1;
return l;
With this version, the caller can then check to see if there's an
exact match, and if not, then the returned value is the location in
the array where the value should be inserted. If the needle is known to
not be in the haystack, and if the haystack is large enough to accept
the new value:
void insert(needle)
int l = find(needle);
memmove(&haystack[l+1],
&haystack[l],
(num - l) * sizeof (haystack[0]));
haystack[l] = needle;
Similarly, if the caller just wants to know if the value is in the
array:
bool exists(needle)
int l = find(needle);
return (l < count && haystack[l] == needle);
Call with Current Continuation
Because the execution stack is managed on the heap, it's completely
trivial to provide the scheme-like call with current continuation,
which constructs an object which can be 'called' to transfer control
to a saved location:
> (+ "hello " (call/cc (lambda (return) (setq boo return) (return "foo "))) "world")
"hello foo world"
> (boo "bar ")
"hello bar world"
> (boo "yikes ")
"hello yikes world"
One thing I'd done previously is dump the entire state of the
interpreter on any error, and that included a full stack trace. I
adopted that code for printing of these continuation objects:
boo
[
expr: (call/cc (lambda (return) (set (quote boo) return) (return "foo ")))
state: val
values: (call/cc
[recurse...]
)
sexprs: ()
frame:
]
[
expr: (+ "hello " (call/cc (lambda (return) (set (quote boo) return) (return "foo "))) "world")
state: formal
values: (+
"hello "
)
sexprs: ((call/cc (lambda (return) (set (quote boo) return) (return "foo ")))
"world"
)
frame:
]
The top stack frame is about to return from the call/cc spot with a
value; supply a value to 'boo' and that's where you start. The next
frame is in the middle of computing formals for the +
s-expression. It's found the + function, and the "hello " string and
has yet to get the value from call/cc or the value of the "world"
string. Once the call/cc "returns", that value will get moved to the
values list and the sexpr list will move forward one spot to compute
the "world" value.
Implementing this whole mechanism took only a few dozen lines of code
as the existing stack contexts were already a continuation in effect.
The hardest piece was figuring out that I needed to copy the entire
stack each time the continuation was created or executed as it is
effectively destroyed in the process of evaluation.
I haven't implemented dynamic-wind yet; when I did that for nickle, it
was a bit of a pain threading execution through the unwind paths.
Re-using Frames
I decided to try and re-use frames (those objects which hold
atom/value bindings for each lexical scope). It wasn't that hard; the
only trick was to mark frames which have been referenced from
elsewhere as not-for-reuse and then avoid sticking those in the re-use
queue. This reduced allocations even further so that for simple
looping or tail-calling code, the allocator may never end up being
called.
How Big Is It?
I've managed to squeeze the interpreter and all of the rest of the
AltOS system into 25kB of Cortex-M0 code. That leaves space for the
4kB boot loader and 3kB of flash to save/restore the 3kB heap across
resets.
Adding builtins to control timers and GPIOs would make this a
reasonable software load for an Arduino; offering a rather different
programming model for those with a taste for adventure. Modern
ARM-based Arduino boards have plenty of flash and ram for this. It
might be interesting to get this running on the Arduino Zero; there's
no real reason to replace the OS either; porting the lisp
interpreter into the bare Arduino environment wouldn't take long.
Yesterday the eighth update in the 0.12.* series of Rcpp made it to the CRAN network for GNU R where the Windows binary has by now been generated too; the Debian package is on its way as well. This 0.12.8 release follows the 0.12.0 release from late July, the 0.12.1 release in September, the 0.12.2 release in November, the 0.12.3 release in January, the 0.12.4 release in March, the 0.12.5 release in May, the 0.12.6 release in July, and the 0.12.7 release in September --- making it the twelveth release at the steady bi-montly release frequency. While we are keeping with the pattern, we have managed to include quite a lot of nice stuff in this release. None of it is a major feauture, though, and so we have not increased the middle number.
Among the changes this release are (once again) much improved exception handling (thanks chiefly to Jim Hester), better large vector support (by Qiang), a number of Sugar extensions (mostly Nathan, Qiang and Dan) and beginnings of new DateVector and DatetimeVectors classes, and other changes detailed below. We plan to properly phase in the new date(time) classes. For now, you have to use a #define such as this one in Rcpp.h which remains commented-out for now. We plan to switch this on as the new default no earlier than twelve months from now.
Rcpp has become the most popular way of enhancing GNU R with C or C++ code. As of today, 843 packages on CRAN depend on Rcpp for making analytical code go faster and further. That is up by eightyfour packages, or a full ten percent, just since the last release in early September!
Again, we are lucky to have such a large group of contributors. Among them, we have invited Nathan Russell to the Rcpp Core team given his consistently excellent pull requests (as well as many outstanding Stackoverflow answers for Rcpp). More details on changes are below.
Thanks to CRANberries, you can also look at a diff to the previous release. As always, even fuller details are on the Rcpp Changelog page and the Rcpp page which also leads to the downloads page, the browseable doxygen docs and zip files of doxygen output for the standard formats. A local directory has source and documentation too. Questions, comments etc should go to the rcpp-devel mailing list off the R-Forge page.Changes in Rcpp version 0.12.8 (2016-11-16)
- Changes in Rcpp API:
- String and vector elements now use extended
R_xlen_tindices (Qiang in PR #560)- Hashing functions now return unsigned int (Qiang in PR #561)
- Added static methods
eye(),ones(), andzeros()for select matrix types (Nathan Russell in PR #569)- The exception call stack is again correctly reported; print methods and tests added too (Jim Hester in PR #582 fixing #579)
- Variatic macros no longer use a GNU extensions (Nathan in PR #575)
- Hash index functions were standardized on returning unsigned integers (Also PR #575)
- Changes in Rcpp Sugar:
- Changes in Rcpp unit tests
- A test for expression vectors was corrected.
- The constructor test for datetime vectors reflects the new classes which treats Inf correctly (and still as a non-finite value)
- Changes in Rcpp Attributes
- Updated Date and Datetime vector classes:
- The
DateVectorandDatetimeVectorclasses were renamed with a prefixold; they are currentlytypedef'ed to the existing name (#557)- New variants
newDateVectorandnewDatetimeVectorwere added based onNumericVector(also #557, #577, #581, #587)- By defining
RCPP_NEW_DATE_DATETIME_VECTORSthe new classes can activated. We intend to make the new classes the default no sooner than twelve months from this release.- The
capabilities()function can also be used for presence of this feature
This post by Dirk Eddelbuettel originated on his Thinking inside the box blog. Please report excessive re-aggregation in third-party for-profit settings.
Next.