Saturday, July 19, 2008

Tweaking XDG Settings on Ubuntu

More of a remember this for later post, but the content took over an hour to figure out, even though it was remarkably simple.

XDG allows you to alter the default directories for a number of commonly used locations found on a users desktop.

This file is stored in $HOME/.config/user-dirs.dirs, you can change -- for example, Videos to be My Videos (making it more like Windows), or hide the Templates directory by changing it to .config/nautilus/Templates (which, you'll need to create first)

However, after editing this file and logging out/in, the GNOME panel and filechooser may show duplicates of these directories (once for the old directory, once for the new one).

The solution, is to remove the $HOME/.gtk-bookmarks file, then log out and re-log in, the file gets generated at login if it doesn't exist and will read the contents of your $HOME/.config/user-dirs.dirs file in order to get the correct locations.

Thursday, July 10, 2008

Encoding Videos for your PS3 with Avidemux

Sometimes, the interscnitzel is helpful -- sometimes, it leaves you without hair while you try every conceivable setting to make things work.

My better half wanted to watch some IPTV we'd downloaded on the big TV (Standard Def), which is hooked up to my Playstation 3. IPTV comes down as .AVI in SDTV and .MKV for HDTV stuff, but the PS3 decided all of that was 'Unsupported Data'

Checking the list of supported video files (please Sony, add .MKV to your list), we found that AVI files should be supported.

For those interested, there's a more detailed examination of what AVI files (DivX or XviD) the PS3 will play, over here.

After some searching, we fired up Avidemux (2.4.2, Linux -- but the Windows one would work too, if you didn't have anything else available) and played with Settings -- the best set the we came up with was:

Video: MPEG-4 ASP (lavc)
Audio: MP2 (lavc)
Format: AVI

To make the whole process a little easier, I also went into Edit/Preferences/Automation and switched on Automatically build VBR map, Automatically rebuild index and Automatically remove packed bitstream (as all the AVI files come as "AVI, pack VOP", which needs to be unpacked first before you can change the output format type).

Now, save your file -- put it on a USB stick or DVD and watch TV on your PS3 :)

note: if you're using DVD-RW's to watch movies from (my personal preference), the Sony DVD-RW (Gold, in Green cases) work flawlessly and seem much more reliable than the TDK or Imation ones (My 40GB PS3 has yet to successfully read an Imation DVD, for example).

important note about USB sticks: After some headscratching over why videos don't play from USB sticks, I discovered the USB device should be FAT32 formatted (default on SANDISK drives, if you've got access to a Linux box, mkfs.vfat will do the job. Then, on the device, you need to create a directory called "VIDEO" (all caps, without the quotes) and put your videos in that directory, then the PS3 will see them properly.

Wednesday, July 2, 2008

Fixing Printer Scaling on Ubuntu 8.04 (bug: 217151)

During a recent rollout of "Ubuntu on the Desktop" I ran foul of this bug in Epiphany.

The symptoms, as the bug describes -- are the headers and footers of a document are printed, but no body text -- we tested this on various printers and came out with the same result.

To fix it, we applied a hack at login-time to manually set people's preferences to Scale=100, by editing the ~/.gnome2/epiphany/print-settings.ini file and changing:

--- Scale=1


+++ Scale=99

(note: I never use 100, because it makes badly-designed websites like Online Banking websites sometimes print outer-borders on a second page, 99 fixes that with no user-discernable difference to the print quality)

It fixed the problem, but hacks are never elegant, break easily and are not good to apply over a 400-workstation installation, so this morning -- my task was to track it down and fix it.

Turns out, it's an innoculous little bastard in the Epiphany gecko code that caused it.

In the embed/mozilla/GeckoPrintService.cpp file, there's a line (around 737-739) that reads:

" gtk_print_settings_set_scale (aGtkSettings, 1.0); "

But this states:

" scale : the scale in percent "

So, the solution turned out to be changing:

gtk_print_settings_set_scale (aGtkSettings, 1.0);


gtk_print_settings_set_scale (aGtkSettings, 99.0);

The bug has now been noted, with a patch that fixes the issue here