The One with the Thoughts of Frans

Archive for July, 2013

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.

Comments

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.

Comments

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.

Comments (1)Tags:

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.

First I looked at the most obvious source. These are some icons Mozilla put out there to promote feeds: the very same icons that for unfathomable reasons they no longer display in their browser by default.
I made some quick modifications to integrate it better with my theme.
I tried a few different looks. I realized this was opposed to the (not legally binding) guidelines for this icon. Partially because of that and partially because I still wasn’t happy with the visuals, I moved on.
I took a quick peek on openclipart, or rather in my local copy that integrates with Inkscape, and found this beautiful icon. So I took it as a new starting point.
And finally, I ended up with this. I’m still debating whether it needs a stroke on the outside, but I’m happy with it for now. Because it’s SVG it scales beautifully, and it’s only 600 bytes after some quick manual optimization. A 24×24 PNG image is twice that. Finally, to be a good net citizen and all that, I uploaded it to openclipart as a remix of the original.

Comments (1)Tags:

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.

Comments

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.

Comments (3)

Font Antialiasing: Don’t Overlook LCD Filtering

For some reason, the Xfce Appearance configuration dialog doesn’t write a ~/.fonts.conf for Qt-based applications. Duplicating the obvious settings was simple enough, but still Qt applications looked a tad fuzzy. Turns out I prefer the legacy LCD filter or even no LCD filter over the default and light LCD filters. So if you’re like me, don’t overlook this setting. Many thanks to the ArchWiki, which incidentally links to this very useful set of sample images. You might also want to look at the contents of man fonts-conf. Here’s my final configuration:

<?xml version='1.0'?>
<!DOCTYPE fontconfig SYSTEM 'fonts.dtd'>
<fontconfig>
	<match target="font">
		<edit mode="assign" name="hinting">
			<bool>true</bool>
		</edit>
	</match>
	<match target="font">
		<edit mode="assign" name="hintstyle">
			<const>hintfull</const>
		</edit>
	</match>
	<match target="font">
		<edit mode="assign" name="antialias">
			<bool>true</bool>
		</edit>
	</match>
	<match target="font">
		<edit mode="assign" name="rgba">
			<const>rgb</const>
		</edit>
	</match>
	<match target="font">
		<edit mode="assign" name="lcdfilter">
			<const>lcdlegacy</const>
		</edit>
	</match>
</fontconfig>

Comments