## Trois champignons

J’ai compris plus longtemps que, pour apprendre une langue (comme le français), il ne suffise pas d’exercices purement textuels. Il y a trois choses importantes, en ordre :

1. Lire, lire, lire. Quantité, pas de qualité. Il est mieux de lire dix bandes dessinées pour des enfants que de lire aucun de textes plus complexes.
2. Écouter. Lire est bonne pour le vocabulaire, mais pour comprendre le langue on besoin de langue orale.
3. Créer. Écrire, parler… c’est plus difficile.

Inspiré par les bandes dessinées, je vous présente trois champignons. Le premier champignon est en belle forme. Le deuxième champignon a bu. Le troisième champignon a utilisé du LSD ou de quelque chose.

## Troubleshooting Your Network Connection: Power Off!

A few months ago the network connection on my desktop computer stopped working. I tried what I considered to be the obvious troubleshooting methods: a different network cable, connecting the network cable to my laptop to see if it worked, forwarding the wireless Internet from my laptop to my desktop… all of which pointed to one unavoidable conclusion: the network port in my desktop had to be busted. As a last resort, completely expecting it to do nothing, I turned it off for about ten minutes. Subsequently, everything was working the way it should.

Of course I’m familiar with the 30-30-30 rule for routers, but I didn’t realize some variety of the process might be helpful on desktops as well. Just to clarify, I hadn’t changed anything about my networking setup as it had been for years. I can only imagine some kind of static charge snuck in somehow.

## SSH publickey denied?

I was suddenly having trouble connecting to GitHub, after pulling in an OpenSSH update to version 7. Chances are that means the problem is security-related, meaning it’s worthwhile to take the time to investigate the cause.

$git pullPermission denied (publickey).fatal: Could not read from remote repository.Please make sure you have the correct access rightsand the repository exists. A little debugging showed the following: $ ssh -vT git@github.comOpenSSH_7.1p2 Debian-2, OpenSSL 1.0.2f  28 Jan 2016debug1: Reading configuration data /etc/ssh/ssh_configdebug1: /etc/ssh/ssh_config line 19: Applying options for *debug1: Connecting to github.com [192.30.252.130] port 22.debug1: Connection established.[…]debug1: Skipping ssh-dss key /home/frans/.ssh/id_dsa for not in PubkeyAcceptedKeyTypes[…]debug1: No more authentication methods to try.Permission denied (publickey).

Of course I could quickly fix the problem by adding PubkeyAcceptedKeyTypes ssh-dss to ~/.ssh/config, but checking OpenSSH.com tells me that “OpenSSH 7.0 and greater similarly disables the ssh-dss (DSA) public key algorithm. It too is weak and we recommend against its use.” So, although I could obviously re-enable it easily, I guess I’ll have to generate a new key. I hope GitHub’s guide is accurate for generating something sufficiently secure, because I’m kind of ticked off that something I generated in 2013 is already considered “legacy.” I hope I’m to blame and not an earlier version of GitHub’s guide.

Incidentally, to change the passphrase one would use the -p option, e.g.:

ssh-keygen -f id_rsa -p

## LuaLatex Font Hassles

The TeX Gyre Pagella font I was using turned out not to contain Cyrillic characters. Unfortunately, fontspec doesn’t seem to have an easy means of setting a fallback font — I checked the manual, I swear! So I found a lookalike font named Palladio Uralic and used it instead. Before you can use a newly installed font, you have to run luaotfload-tool --update.

%So is Palladio. Used as fallback. Thanks to http://tex.stackexchange.com/a/37251/32003
\DeclareTextFontCommand{\textpalladio}{\palladio}

## PulseAudio: How to Decouple Application Volumes And Global Volume

I wondered why e.g. my VLC volume kept getting lowered. As it turns out, there was a change.

PulseAudio seems to have copied one of Windows 6+’s most annoying features, at least in terms of the media framework: flat volumes.

Quick refresher: This is that annoying thing that Windows (and now, PulseAudio, by default) does, where turning up the volume in an application will increase the master system volume alongside it. This has the side-effect that any application which sets its own volume can commandeer the master volume of your system. Why is this bad? The short answer is headphones.

It’s not as if it’s only headphones that can blare at ridiculously loud volumes. Anyway, a quick search came up with this helpful suggestion regarding the flat-volumes setting.

PulseAudio supports per-application volume control, but by default this doesnt do much as you can only control these volumes from the pulseaudio volume control utility. Meaning that in an application like Audacious, when the output device is set to PulseAudio, and the volume control is set to hardware, it will adjust the master volume control, not the per-application volume control.

To fix this behavior, set the following in /etc/pulse/daemon.conf

flat-volumes = no

Now whenever Audacious goes to adjust the volume, it will adjust the audacious only volume and thus you wont have multiple applications fighting over the master volume control.

What a horribly annoying new default.

## Working around the broken Creative HS-720 headset

A few years ago I received a Creative HS-720 as a gesture of good will. I wasn’t displeased, but since I didn’t need it I didn’t really investigate. Recently I’ve been wanting to use it as a headphone and noticed that even at the lowest possible volume, it was still significantly too loud. What’s really crazy is that there are actually positive reviews for the product out there. Read this negative one instead. That’s all you need to know. Avoid this product. Ideally I’d acquire something like an Asus Xonar U3, a Creative Sound Blaster Play! 2 or a Creative Sound Blaster E1 in combination with proper headphones (although the HS-720 certainly doesn’t make me want to buy another Creative product), but I figured there just had to be a software solution.

Some searching gave me “Fix for USB Audio is Too Loud and Mutes at Low Volume in Ubuntu.” The title isn’t quite accurate, because it’s a workaround. No matter. It requires modifying the file /usr/share/pulseaudio/alsa-mixer/paths/analog-output.conf.common. But we might as well take a look at what else there is to play with while we’re at it.

/usr/share/pulseaudio/alsa-mixer/paths$ls analog-input-aux.conf analog-input-mic.conf analog-output-lineout.conf analog-input.conf analog-input-mic.conf.common analog-output-mono.conf analog-input.conf.common analog-input-mic-line.conf analog-output-speaker-always.conf analog-input-dock-mic.conf analog-input-rear-mic.conf analog-output-speaker.conf analog-input-fm.conf analog-input-tvtuner.conf hdmi-output-0.conf analog-input-front-mic.conf analog-input-video.conf hdmi-output-1.conf analog-input-headphone-mic.conf analog-output.conf hdmi-output-2.conf analog-input-headset-mic.conf analog-output.conf.common hdmi-output-3.conf analog-input-internal-mic-always.conf analog-output-desktop-speaker.conf iec958-stereo-output.conf analog-input-internal-mic.conf analog-output-headphones-2.conf analog-input-linein.conf analog-output-headphones.conf As you can see there’s a bunch of PulseAudio profiles. In my case I might be able to adjust one of the headphones files without changing the entire system, but as luck would have it I use a digital IEC958 output for my main sound system, so I could afford mess up all handling of analog output for the sake of these headphones. I’ll quote part of Chris Jean’s guide in case linkrot ever strikes. Search for the text “Element PCM”. You should see the following text: [Element PCM] switch = mute volume = merge override-map.1 = all override-map.2 = all-left,all-right Update this section of text to look like the following (changes are in bold): [Element PCM] switch = mute volume = ignore volume-limit = 0.01 override-map.1 = all override-map.2 = all-left,all-right Note that the value 0.01 can be adjusted as needed to change how quiet and loud the volume is. Making the number smaller reduces the max volume while making the number larger increases the max volume. I tested out 0.05 and found that the max volume was much louder than I would ever use. I also decided that 0.01 was technically louder than I’d ever use. I ended up with a value of 0.0075 (0.005 was too quiet) which I felt gave a good maximum volume and resulted in better overall control over the volume range. I’d add that it seems to work fine with volume-limit = 1.0 as well. After making that change run killall pulseaudio (or pulseaudio -k, but why bother with something non-generic) to get it to work. You can do some more volume play using alsamixer, but you’ll have to figure out which device to use first. $ pacmd list-sources | grep -e device.string -e 'name:'
name: <alsa_output.pci-0000_01_00.1.hdmi-stereo.monitor>
device.string = "1"
name: <alsa_input.usb-046d_0990_E1C9E823-02-Q9000.analog-mono>
device.string = "hw:2"
name: <alsa_output.pci-0000_00_14.2.iec958-ac3-surround-51.monitor>
device.string = "0"
device.string = "3"

As you can see the headset is device 3. You can print some more info using amixer.

\$ amixer -c 3
Simple mixer control 'PCM',0
Capabilities: pvolume pswitch pswitch-joined
Playback channels: Front Left - Front Right
Limits: Playback 0 - 38
Mono:
Front Left: Playback 9 [24%] [-21.67dB] [on]
Front Right: Playback 9 [24%] [-21.67dB] [on]
Simple mixer control 'Mic',0
Capabilities: cvolume cvolume-joined cswitch cswitch-joined
Capture channels: Mono
Limits: Capture 0 - 16
Mono: Capture 14 [88%] [20.83dB] [on]
Simple mixer control 'Auto Gain Control',0
Capabilities: pswitch pswitch-joined
Playback channels: Mono
Mono: Playback [on]

And using alsamixer -c 3 you can play around with the volume a bit more, too.

My only regret is that I haven’t been able to find something like Identifier for xorg.conf. Oh well, it’ll save me some money in the short term.

PS On Windows, try EqualizerAPO (source).

## Just a Star

Messing about a little in Inkscape with my wife’s Wacom CTH-680S tablet on Linux 4.1, after first trying it in Xournal. It seems to be functioning a fair bit better than a few kernel versions ago.

The tablet is really good. I’d recommend it.

## Alt + Print screen in Xfce

Perhaps it’s merely a fluke of Debian Xfce, but the Print screen key does nothing by default. If you just want to use Print screen that’s easy to rectify through Settings > Keyboard > Application Shortcuts > Add. Use the command xfce4-screenshooter -f or -w for respectively full screen and window. As it turns out that interface doesn’t support the key combination of Alt + Print screen thanks to some kernel feature. The suggestion is to disable the kernel feature, but interestingly enough it works when you add the shortcut manually. Remember how we regained control of Ctrl + F1F12? Once again, edit ~/.config/xfce4/xfconf/xfce-perchannel-xml/xfce4-keyboard-shortcuts.xml. Look for the custom section, which should look a little something like this:

    <property name="custom" type="empty">
<property name="XF86Display" type="string" value="xfce4-display-settings --minimal"/>
<property name="&lt;Primary&gt;&lt;Alt&gt;Delete" type="string" value="xflock4"/>
<property name="&lt;Alt&gt;F2" type="string" value="xfrun4"/>
<property name="override" type="bool" value="true"/>
<property name="&lt;Super&gt;p" type="string" value="xfce4-display-settings --minimal"/>
</property>

Next, we add in our custom setting:

      <property name="&lt;Alt&gt;Print" type="string" value="xfce4-screenshooter -w"/>

Now it should look like this.

    <property name="custom" type="empty">
<property name="XF86Display" type="string" value="xfce4-display-settings --minimal"/>
<property name="&lt;Primary&gt;&lt;Alt&gt;Delete" type="string" value="xflock4"/>
<property name="&lt;Alt&gt;F2" type="string" value="xfrun4"/>
<property name="override" type="bool" value="true"/>
<property name="&lt;Super&gt;p" type="string" value="xfce4-display-settings --minimal"/>
<property name="&lt;Alt&gt;Print" type="string" value="xfce4-screenshooter -w"/>
</property>

You’re going to have to log out and log in again (or restart) for the changes to take effect. I have to admit it’s probably more useful to bind Print screen to take window screenshots by default, but on the other hand it might be a good idea to stick to the global standard so you can still use desktop environments other than your own without feeling hampered.

## Custom page number count in Prince

Prince makes it really easy to do all of the usual things with page numbers, like a different numbering scheme in the front matter and whatnot. Unfortunately you can’t counter-increment on @page, but thanks to Prince.addScriptFunc() you’ve got something better.

h2 {counter-reset: page 50}

@page {
@bottom-left {
content: prince-script(fixpagenum, counter(page));
margin-left: 2cm;
}
}

In this CSS, instead of passing regular generated content, we’re passing a prince-script. That script has to be defined somewhere, like this.

Prince.addScriptFunc("fixpagenum", function(pagenum) {
pagenum = Number(pagenum);
pagenum = pagenum + pagenum - 50;
return pagenum;
});


The rationale in this case was to generate two separate documents, starting at page 50, one only left pages and the other only right pages. (Of course, the other one started at page 51.) I combined them with pdftk’s shuffle command.

pdftk left.pdf right.pdf shuffle output combined.pdf

I don’t think there’s a way to do something like this purely in Prince using CSS, but I’d love to be proved wrong.

## LaTeX: combining added margins with hanging indents

Since I’m using KOMA, the obvious method would seem to be:

\begin{addmargin}[1cm]{0cm}

\parindent=1cm\hangindent=2cm Yada.