# GNOME Workspace Wraparound

I found out yesterday that GNOME (or more correctly, the GNOME window manager, Metacity) only allows you to switch to a specific workspace. You cannot cycle through workspaces, wrapping around to the first when on the last. There is a long-standing upstream bug report, about this issue, but sadly it is marked as wontfix.

I have, however, found a workaround using wmctrl. These commands could obviously be much nicer if they were placed in a proper script, but I wanted a one line snippet that I could add to my xbindkeys config. This allows me to execute these commands using keyboard shortcuts.

# Workspace Increment
wmctrl -s $(($(( $(wmctrl -d | sed -n 's/^ *\*.*/\1/p') + 1 )) & 3 )) # Workspace Decrement wmctrl -s$(( $(($(wmctrl -d | sed -n 's/^ *\*.*/\1/p') - 1 )) & 3 ))


Note: In order to minimise the calls to wmctrl, I've hardcoded my number of workspaces (4 in my case) as a bitwise AND in the last portion of these commands.

# Debian /etc/ Cleanup

After upgrading a Debian system, it is a good idea to clean up any old configuration files that remain in /etc/. The following one-liner should find most of them for you:

find /etc/ -name "*.dpkg-dist" -o -name "*.dpkg-new" -o -name "*.dpkg-old" -o -name "*.ucf-dist" -o -name "*.ucf-new" -o -name "*.ucf-old" | sort

Running it on my desktop yields the following files:

root@lambda:/etc# find /etc/ -name "*.dpkg-dist" -o -name "*.dpkg-new" -o -name "*.dpkg-old" -o -name "*.ucf-dist" -o -name "*.ucf-new" -o -name "*.ucf-old" | sort
/etc/ca-certificates.conf.dpkg-old
/etc/gdm3/greeter.gconf-defaults.dpkg-old
/etc/modprobe.d/alsa-base.conf.dpkg-old
/etc/munin/munin-node.conf.dpkg-dist
/etc/munin/plugin-conf.d/munin-node.dpkg-old
/etc/mysql/my.cnf.dpkg-old
/etc/pam.d/sshd.dpkg-dist
/etc/pulse/daemon.conf.dpkg-dist
/etc/samba/smb.conf.ucf-old
/etc/smsd.conf.ucf-old
/etc/sudoers.dpkg-old

# New packages in Debian 7.0 Wheezy

Given that Debian 7.0 Wheezy will be released in a few hours, I thought it would be a good time to take part in Michael Prokop's #newinwheezy effort to publicise the new packages that have uploaded to Debian as part of Wheezy. I have introduced two new packages to Debian for this release:

• nyancat - nyancat is a program to display an animated poptart cat in your terminal
• transmission-remote-cli - ncurses interface for the Transmission BitTorrent daemon

I've also have become (co-)maintainer of the following packages, updating them for this release:

• dhex - ncurses based hex editor with diff mode
• figlet - Make large character ASCII banners out of ordinary text
• lcd4linux - Grabs information and displays it on an external lcd
• libconfig - Parsing and manipulation of structured configuration files
• wavemon - Wireless Device Monitoring Application

I hope you find them useful. Enjoy!

# WordPress IPv6 Issues

In recent days I noticed that my site, and other WordPress sites were failing to properly load. I've debugged the issue, and found that recent versions of Jetpack require this javascript file on every page load. This file is served from a WordPress content distribution network run by Edgecast. While Edgecast claim to support IPv6, in reality, they don't.

As shown below, they have major issues with MTU size on their IPv6 network. This is a major inconvenience and affects IPv6 users regardless of whether the site they are visiting is IPv6 enabled or not. In addition, it affects other Automattic sites hosted on Edgewall such as Gravatar and Akismet.

Ping6 works ok:

jmccrohan@lambda:~$ping6 s0.wp.com PING s0.wp.com(2606:2800:234:1922:15a7:17bf:bb7:f09) 56 data bytes 64 bytes from 2606:2800:234:1922:15a7:17bf:bb7:f09: icmp_seq=1 ttl=55 time=34.9 ms 64 bytes from 2606:2800:234:1922:15a7:17bf:bb7:f09: icmp_seq=2 ttl=55 time=21.6 ms 64 bytes from 2606:2800:234:1922:15a7:17bf:bb7:f09: icmp_seq=3 ttl=55 time=25.9 ms 64 bytes from 2606:2800:234:1922:15a7:17bf:bb7:f09: icmp_seq=4 ttl=55 time=21.7 ms ^C --- s0.wp.com ping statistics --- 4 packets transmitted, 4 received, 0% packet loss, time 3004ms rtt min/avg/max/mdev = 21.600/26.050/34.968/5.438 ms  Wget over IPv6 fails: jmccrohan@lambda:~$ wget -6 http://s0.wp.com/wp-content/js/devicepx-jetpack.js
--2012-11-12 01:05:08--  http://s0.wp.com/wp-content/js/devicepx-jetpack.js
Resolving s0.wp.com (s0.wp.com)... 2606:2800:234:1922:15a7:17bf:bb7:f09
Connecting to s0.wp.com (s0.wp.com)|2606:2800:234:1922:15a7:17bf:bb7:f09|:80... connected.
HTTP request sent, awaiting response...


There is, however, a httpd listening on tcp6/80:

jmccrohan@lambda:~$telnet s0.wp.com 80 Trying 2606:2800:234:1922:15a7:17bf:bb7:f09... Connected to cs82.wac.edgecastcdn.net. Escape character is '^]'. GET /index.html HTTP/1.1 host: s0.wp.com ^]quit telnet> quit Connection closed.  This leads me to believe there is a MTU issue somewhere. Thankfully I'm not the only one who is experiencing this. It has been discussed here and here too. If you are having issues, please get in touch via the comments below. I'd like to compare traceroutes. EDIT: Edgecast have gotten back to me and are investigating the issue. EDIT 2: Edgecast have followed up via email to confirm that they have fixed the issue. Thanks Edgecast. # recode recode is a simple program for performing conversions between many different character sets. I often use it to encode HTML and other code snippets before uploading them to the web. jmccrohan@lambda:~$ echo '<strong>Hello, World!</strong>' | recode utf8..html
&lt;strong&gt;Hello, World!&lt;/strong&gt;


# XML reindent

XML is designed to be human-readable. However, to minimise data transfer, the indentation and newline characters are often discarded during transmission. This results in a difficult-to-read XML file such as the one below:

<?xml version="1.0" encoding="ISO-8859-1"?><note><to>Tove</to><from>Jani</from>
<heading>Reminder</heading><body>Don't forget me this weekend!</body></note>

This XML file can be both checked for validity, and reindented using xmllint. Debian/Ubuntu users can find this as part of the libxml2-utils package.

xmllint --format input.xml > output.xml


This results in the following, more-sane output:

<?xml version="1.0" encoding="ISO-8859-1"?>
<note>
<to>Tove</to>
<from>Jani</from>
<body>Don't forget me this weekend!</body>
</note>


# MATLAB R2012a system() function

MATLAB does not integrate nicely with Linux operating systems, and instead, provides its own copies of binaries, and libraries. These libraries are often outdated, which can cause problems such as the one below.

When calling external C++ compilers though the system() function, I found myself running into an eglibc error. This occurred when running MATLAB R2012a on a Debian Wheezy machine with eglibc 2.13 and gcc 4.7.1.

/tmp/hello-world: /opt/matlab/bin/glnxa64/libstdc++.so.6: version
GLIBCXX_3.4.15' not found (required by /tmp/hello-world.so)

The solution is to override GNU Standard C++ Library version used by MATLAB, and force it to use the system version of the library by using LD_PRELOAD. Start MATLAB using the following command from the terminal which should solve your issues:

LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libstdc++.so.6 matlab`