## Get Back Control of Ctrl+F1-12 in Xfce

It’s quite simple. Go to ~/.config/xfce4/xfconf/xfce-perchannel-xml/xfce4-keyboard-shortcuts.xml and comment out the relevant properties.

## On Upgrading (X)Ubuntu

1. sudo do-release-upgrade doesn’t crash like the GUI and properly shows you errors. There’s probably a log you could hunt down somewhere, but why make life harder on yourself?
2. Removing a bunch of old linux-image-* and linux-headers-* files can literally free up gigabytes, in case you were wondering what happened to all your space.

## Pandoc Markdown Over Straight LaTeX

I familiarized myself with LaTeX because I like HTML better than word processors. In fact, I disprefer word processors. LibreOffice Writer can do a fairly decent job of WYSIWYM (What You See Is What You Mean), but in many ways I like it less than HTML. So why don’t I just use HTML, you ask? Quite simply, HTML isn’t necessarily the best option for print.

Prince does a great job generating printable PDFs, but even though writing straight HTML is easy enough and adds many benefits, I mostly only prefer it over your run of the mill text editing software. Besides, I wanted to profit from BibTeX reference management, which tends to come along with LaTeX.

Clearly then, LaTeX has some nice features. Unfortunately, it shares many of HTML’s flaws and adds some others: \emph{} is at best marginally easier to type than <em></em>, but I find it somewhat harder to read. Besides which, converting LaTeX to other formats like HTML can be a pain.

On the good side, LaTeX and HTML also share many features. Both depend on plain-text files, which is great because you can open them on any system, and because you can use versioning software. Binary blobs and compressed zip files are also more prone to data loss in case of damage. The great thing about versioning software isn’t necessarily that you can go back to a former version, but the knowledge that you can go back. Normally I’m always busy commmenting out text or putting it at the bottom, but when it’s versioned I feel much more free about just deleting it. Maybe I’ll put some of it back in later, but it lets the machine take the work off of my hands. I know, Writer, Word, et cetera can do this too, but did I mention I prefer plain text anyway?

Where LaTeX really shines is its reference management, math support without having to use incomprehensible gibberish like MathML or some odd equation editor, and its typographical prowess. On top of the shared features with HTML, those features are why I looked into LaTeX in the first place. So how can I get those features without being bothered by the downsides of HTML and LaTeX? As it turns out, the answer is Pandoc’s variant of Markdown.

In practice, I rarely need more than what Pandoc’s Markdown can give me. It’s HTML-focused, which I like because I know HTML, but you can insert math (La)TeX-style between $ characters. It also comes with its own citation reference system, which it changes to BibLaTeX citations upon conversion to LaTeX. As these things go, I wasn’t the first with this idea. Of course it won’t do to repeat myself on the command line constantly, so I wrote a little conversion helper script: #!/bin/bash #generate-pdf.sh BASENAME=your-text-file-without-extension # I compiled an updated version of Pandoc locally. PANDOC_LOCAL=~/.cabal/bin/pandoc if [ -x$PANDOC_LOCAL ];
then
PANDOC=$PANDOC_LOCAL else PANDOC=pandoc fi # Output to HTML5.$PANDOC \
$BASENAME.md \ --to=html5 \ --mathml \ --self-contained \ --smart \ --csl modern-language-association-with-url.csl \ --bibliography$BASENAME-bibliography.bib \
-o $BASENAME.html # Output to$BASENAME-body.tex
# $BASENAME.tex has this file as input$PANDOC \
$BASENAME.md \ --smart \ --biblatex \ --bibliography$BASENAME-bibliography.bib \
-o $BASENAME-body.tex # Pandoc likes to output p.~ or pp.~ in its \autocite, but I just want the numbers. sed -i 's/\\autocite\[p.~/\\autocite\[/g'$BASENAME-body.tex
sed -i 's/\\autocite\[pp.~/\\autocite\[/g' $BASENAME-body.tex # It would probably suffice to just do this but I don't want any nasty surprises: #sed -i 's/p.~//g'$BASENAME-body.tex
#sed -i 's/pp.~//g' $BASENAME-body.tex # If ever bored, consider adding something to change \autocite[1-2] into \autocite[1--2] # Generate the PDF. lualatex$BASENAME
biber $BASENAME lualatex$BASENAME
lualatex $BASENAME # Remove these files after the work is done. rm \$BASENAME.aux \
$BASENAME.bbl \$BASENAME.blg \
$BASENAME.bcf \$BASENAME.run.xml \
$BASENAME.toc \ #$BASENAME-body.tex

Something that may not be immediately obvious from the script is that I’ve also got a $BASENAME.tex file. This contains all of my relevant settings, but instead of the main content it contains \input{basename-body.tex}. There are some prerequisites for working with Pandoc-generated LaTeX, for instance: %for pandoc table output (needs ctable for 1.9; longtable for 1.10) \usepackage{longtable} I haven’t yet made up my mind on what to do about splitting up chapters in different files, but it hasn’t bothered me yet. There you have it. That’s my way of keeping thing simple while still profiting from LaTeX typesetting. ## Textarea Backup Localstorage v1.21 I figured I’d drop a note that I updated my Textarea Backup UserJS last month. What follows is the description from ExtendOpera. ## Textarea Backup Localstorage Retains what you type into textareas and contentEditable elements. This script is only compatible with Opera 10.50 and up. If you need to use it with an older version use Textarea Backup but be advised that it comes with some disadvantages. 1. Can automatically place previously typed text in textareas. 2. Can add an unobtrusive menu in the top right corner of textareas Actions menu screenshot (note the transparent object in the top right corner of the textarea): Development can be followed on GitHub. Don’t be shy, open an issue or send me a pull request if you think you have something to contribute! ### Changelog 1.21 July 25, 2013. Sorry, I was a bit hasty about that last one. I passed my testcase, but only noticed that many contentEditables work differently in practice on this very site. • Fixed a bug that occurred when BODY was contentEditable, as is typical in iframes. • Properly compare initial value of contentEditable element to backed up value so you’ll only get prompted to overwrite when relevant. • Full changelog. 1.20 July 25, 2013. I wasn’t going to make yet another release in three days, but these new features could be implemented much faster than I initially predicted. • Trustworthy old persistent preferences support added. I also uploaded a sample settings file. • Fixed the keep_after_submission bug, so setting it to false is safe again. • Removed the form requirement. • Support contentEditable. This is a pretty big one, seeing how it was the most obvious missing feature. 1.11 July 24, 2013. Added configuration switches for the new feature. • For Opera 11.6x and Opera 12.x it now defaults to off because of potential performance concerns. 1.10 July 23, 2013. Added support for dynamically added textareas. • This new feature will only work in Opera 11.6x and up. ## Cutting Corners With Linear Gradients Presumably unnoticed by all, back in December 2012 I replaced the image-based cut corners in post headings with pure CSS. Border-radius removed the need for images to round corners, but you don’t need images anymore to cut them either. Edited down to only the cutting of corners, this is what it looks like now: .posttitle a {background:#0b0; background:linear-gradient(225deg, transparent 8px, #0b0 8px)} .posttitle a:hover, .posttitle a:active {background:#6c0; background:linear-gradient(225deg, transparent 8px, #6c0 8px)} And this is how it used to be: .posttitle a {background:#0b0 url(images/posttitle.gif) no-repeat top right;overflow:hidden;}/*overflow:hidden for Webkit which insists on adding some kind of margin*/ .posttitle a:hover, .posttitle a:active {background:#6c0 url(images/posttitle.gif) no-repeat 100% -91px;} Size-wise the difference is small: the GIF was only 107 bytes. You’d pretty much make up the difference by adding prefixed versions of linear-gradient if desired, albeit you do still save an HTTP request and you avoid one of Webkit/Blink’s bugs. For scaling it matters only very little. But not having to open up an image editor for simple things like this? Fantastic. ## Only Literary Discourse? [I]n matters of race, silence and evasion have historically ruled literary discourse. […] The situation is aggravated by the tremor that breaks into discourse on race. It is further complicated by the fact that ignoring race is understood to be a graceful, even generous, liberal gesture. Toni Morrison, Playing in the dark: whiteness and the literary imagination. 1992. Harvard University: Cambridge. p. 14. ## How To Fix SVG Height in Webkit/Blink It’s pretty simple: also specify a height if you specify a width. To quote from the workaround in my stylesheet, which I added on account of my previous post: figure svg { width:100%; /*what follows is because Webkit/Blink is broken https://bugs.webkit.org/show_bug.cgi?id=68995*/ height:100% } I really shouldn’t have added that as I don’t cater to broken browsers anymore, but I have a bit of a soft spot for Opera—even if it’s never required any workarounds before. Presto is clearly superior, and so is Gecko. Chromium still doesn’t support SVG favicons. Gecko does. And just look at this table. Unfortunately Gecko doesn’t support SVG fonts, so it’s all looking pretty miserable without Presto. ## Feed Pick: My New Feed Icon Recently, it came to my attention that most browsers no longer visually notify users of the presence of newsfeeds. To rectify this gross negligence, I decided to add a little feed link on the top right. It was immediately obvious that an icon would go nicely with it. More specifically of course, an SVG icon. ## Unison: set times to true (if you want) I’ve been using Unison for a few years now, so I’m ashamed to admit I only just noticed it wasn’t syncing the date modified attribute. This is because I’ve always worked with my desktop as a central repository, which kept the dates. My other computers have been mostly used for data duplication for increased data security. The much smaller number of files I changed on those other computers obviously came with recent filestamps, so that the problem didn’t stand out. There’s a -times command-line option, but for something I always want that’s a bit inconvenient. Luckily you can change the same setting through the GUI, or you can add times = true to your profile manually. If my central HDD were ever to die suddenly, I’m sure I’d be glad I kept the last modified times. ## Dolby Digital 5.1 over SP/DIF with PulseAudio in Debian Wheezy Things are now significantly easier than they were a couple of years ago thanks primarily to improvements in PulseAudio. Chances are you’ll have to create /etc/asound.conf. Stick this in it: pcm.a52 { @args [CARD] @args.CARD { type string } type rate slave { pcm { type a52 card$CARD
}
rate 48000 #required somehow, otherwise nothing happens in PulseAudio
}
}
pcm.pulse {
type pulse
}
ctl.pulse {
type pulse
}
pcm.!default {
type pulse
}
ctl.!default {
type pulse
}

In /etc/pulse/daemon.conf, add default-sample-rate = 48000 and enable-lfe-remixing = yes. Okay, you got me. That last one is just my preference, but why wouldn’t you want your subwoofer to do its thing?

pavucontrol is instrumental in quickly seeing what’s going on and for e.g. application-specific volume settings. Not utilizing it would be a disservice to yourself if you’ve chosen to use PulseAudio.

Now that we’ve got all the configuration set up you could reboot the computer, but one of the great things about Linux is that you rarely have to do that other than to load a different kernel. pulseaudio --kill should be enough to make everything fall into place a few seconds later.

For testing a good option is the surround test ac3 file from Lynne Music (straight to directory). You can play it with mplayer -channels 6 to make sure everything is working correctly and to adjust the channel map if necessary.

Various adjustments might still be required in some applications. For instance, in Totem you have to explicitly set audio output to 5.1 in Edit > Preferences > Audio.
For MPlayer you can put channels=6 in ~/.mplayer/config (note that if you can’t get PulseAudio to work you could add the equivalents of mplayer -ao alsa:device=spdif -srate 48000 -ac hwac3 file.avi if you so desire).
VLC works fine if Dolby Surround is set to Auto in Tools > Preferences > Audio.

On a separate note, I set PulseAudio up so it can play audio from all over my local network, most notably my laptop.

Older Entries »