Software

If you’re like me, you love to try out new software—especially if it’s free!

Here I talk about my experiences, moments of triumph and frustrations with, well, software.

Introducing BitButcher — An Open-Source NDS ROM Trimmer

I’ve always wanted to make a software headline like that.  Eee!

Welcome to BitButcher, a small program designed to do one thing and one thing well: trim Nintendo DS ROMs.

I got a bit fed up of the ones already out there, most because they were either closed-source or they had bad GUI design combined with clashing backgrounds.  Search as I may, I couldn’t find anything that fit my demands.

So I did what any self-respecting programmer would do — code my own!

This program is rather simple, but it’s designed to be just that.  Oh, and fast.  Very fast.

Trimming the excess fat off of DS ROMs isn’t exactly a hardest task in the world, but I figured that people would still be interested in what I have made.  As such, I have made the code entirely open-source under GPLv3.

It’s coded in Java, meaning I get cross-platform support for free!  It is however command-line only, so don’t expect any amazing GUI.

If you want to get hold of the program, or would like to help contribute to a better trimmer, then just head over to GitHub:

http://github.com/XanderXAJ/BitButcher

Any help improving the program would be welcome and awesome.  In addition, you can also report any issues you have at GitHub, on the Issues tab.

That’s it for this time — hope you manage to shave off some bytes!

Take Control of Your Settings — Configuring Synaptics Touchpads and Making GNOME Respect Them

The Problem

Today I’ve been trying to configure the touchpad on my Eee PC 901 to my liking.  It’s a Synaptics touchpad, and supports tracking multiple fingers, and I wanted to take more advantage of that.

GNOME does have support for configuring multiple finger gestures out of the box, with gnome-mouse-properties (or System » Preferences » Mouse) and then selecting the Touchpad tab.  This is all good and works fine — if you like what GNOME gives you.

Unfortunately I wasn’t.  When you enable clicking on the touchpad, GNOME sets one finger taps to left-click, two to right, and three to middle.  I tend to use middle-click more often than right-click, thanks to browsing the web and liking making new tabs, plus I already have a dedicated right-click button.

So I set off to change it.  After reading material courteousy of Arch Linux’s wiki, I found (and remembered from attempting the same thing ages ago) that configuration is done through the HAL using fdi policies, which are just specifically formatted XML files.  (The old xorg.conf way is deprecated and isn’t as flexible, not that it matters for configuring the trackpad.)

It sounds scary and involves more typing, but in the end it’s just as simple as process as it used to be, even if it involves jumping through an extra hoop or two.

Configuration

First you have to create a file with the fdi extension in /etc/hal/fdi/policy/.  I’ve named my file 99-synaptics.fdi, following example from /usr/share/hal/fdi/policy/10osvendor/, but you can name yours whatever you like.

sudo gedit /etc/hal/fdi/policy/99-synaptics.fdi

Note: You need root permissions to be able to create and edit this file.  If you run Ubuntu (or are in the /etc/sudoers file), this can be accomplished using the sudo command as shown above. You can use whatever editor you like, too. vi, emacs, nano, kate

Once the file is created, it’s time to get messy!  The fdi file contains a match rule, which tells HAL which device you want to configure, and then a series of merge rules which apply your desired configuration into the HAL.  The easiest way to show this is by example, so here’s my prospective configuration:

<?xml version="1.0" encoding="utf-8"?>
<deviceinfo version="0.2">
 <device>
 <match key="info.product" contains="Elantech Touchpad">
 <merge type="string" key="input.x11_driver">synaptics</merge>
 <merge type="string" key="input.x11_options.VertTwoFingerScroll">true</merge>
 <merge type="string" key="input.x11_options.HorizTwoFingerScroll">true</merge>
 <merge type="string" key="input.x11_options.TapButton1">1</merge>
 <merge type="string" key="input.x11_options.TapButton2">2</merge>
 <merge type="string" key="input.x11_options.TapButton3">3</merge>
 <merge type="string" key="input.x11_options.ClickFinger1">1</merge>
 <merge type="string" key="input.x11_options.ClickFinger2">3</merge>
 <merge type="string" key="input.x11_options.ClickFinger3">2</merge>
 </match>
 </device>
</deviceinfo>

Starting from the top, here’s a quick description of each part:

  • The <?xml part is the XML declaration required in any valid XML file.  Nothing interesting here.
  • The <deviceinfo> and <device> are just boilerplate code that tell the HAL to expect rules relating to devices. Again, nothing interesting here.
  • Now things start getting good!  The <match> line describes how to find the device you want to configure:
    • Simply put, the HAL searches for the contains string inside the key field.  Whatever matches that search it’ll apply the merge rules to.
    • There are other ways to match aside from contains, but this is all you need to know to get things working.
  • The <merge> lines are the meat of the file, describing each and every configuration change you want to make.

You’re probably thinking this is all good and well, but how did I come up with this stuff in the first place?  Well, the answer lies in the HAL itself.

The lshal command lists all the devices the HAL can detect (that’s “ls hal”, get it?).  You might want to pipe the contents to less, to be able to scroll and search through the large amount of text that’s returned:

lshal | less

In less, type /synaptics to search for the string “synaptics”.  less should automatically scroll to the point we’re interested in; your touchpad.  If it cannot be found, you either don’t have a Synaptics touchpad or the synaptics driver isn’t being loaded.  Try searching for Touchpad or similar words, but anything more than that is beyond the scope of this article.

Once you have found the device on your list, you’ll be able to see a list of keys and their values.  You want to pick one of these fields that will not change between boots to place as the match rule inside your fdi file.  I chose info.product, but you can choose something else like input.product if it strikes your fancy.  Either way, fill in the <match> line with the key that you chose and the string that’ll match it.  Ideally this search will only match your touchpad and nothing else.

Next is the fun part — configuration. To do this simply open up the man page for synaptics:

man synaptics

This’ll give a detailed list of everything that can be changed within the synaptics driver.  For each value that you want to change, find its name on the manpage, and add a new merge rule with the appropriate key.  Note that every key in the fdi begins with “input.x11_options.” followed by the synaptics key you want to change.  (The exception to this in my file is the first merge rule, which just makes sure that the synaptics driver has been loaded for my touchpad.)

If you want to test an option before making it permanent, use the synclient key=value command, filling in key and value with the option you want to change.

Once you’ve added all the merge rules you like, close all the tags and save the file.  Now just restart the HAL (or your computer) and your settings will be applied.  Almost.

GNOME Respect

Now that you have your configuration all set up, you need to stop GNOME from changing your carefully crafted settings to ones of its choosing.

To do this, simply run the following command:

gconftool-2 --type bool --set /apps/gnome_settings_daemon/plugins/mouse/active false

If you get cold feet and want to enable GNOME’s control over mouse and trackpad settings, run this command:

gconftool-2 --type bool --set /apps/gnome_settings_daemon/plugins/mouse/active true

That’s really it.  Thanks to jan for finding this value.

I’ve written this to be as generalised as possible, so it should work for many different distros so long as they are using the latest HAL/Xorg/kernel.  I’m running Fedora 11 and have added my name to the /etc/sudoers file, allowing me to run sudo.

If you have any questions or just want to say thanks, feel free to leave a comment or contact me!

<?xml version=”1.0″ encoding=”utf-8″?>
<deviceinfo version=”0.2″>
<device>
<match key=”info.product” contains=”Elantech Touchpad”>
<merge type=”string” key=”input.x11_driver”>synaptics</merge>
<merge type=”string” key=”input.x11_options.VertTwoFingerScroll”>true</merge>
<merge type=”string” key=”input.x11_options.HorizTwoFingerScroll”>true</merge>
<merge type=”string” key=”input.x11_options.TapButton1″>1</merge>
<merge type=”string” key=”input.x11_options.TapButton2″>2</merge>
<merge type=”string” key=”input.x11_options.TapButton3″>3</merge>
<merge type=”string” key=”input.x11_options.ClickFinger1″>1</merge>
<merge type=”string” key=”input.x11_options.ClickFinger2″>3</merge>
<merge type=”string” key=”input.x11_options.ClickFinger3″>2</merge>
</match>
</device>
</deviceinfo>

Stop Exact Audio Copy Crashing on Windows 7

When I tried to rip a disc using Exact Audio Copy on Windows 7 x64, I found it kept crashing as soon as the rip tried to start.  Bummer.

Remembering the previous times I’ve used EAC, when you click a button to start a rip, it asks you where you want to save the ripped files.

Turns out if you set EAC to save into a predetermined location instead of asking, EAC manages to rip perfectly fine!

So, here’s a step-by-step guide to stop it crashing:

  1. Open Exact Audio Copy.
  2. Go to File > EAC Options.
  3. Click the Directories tab.
  4. Instead of “Ask every time”, choose Use this Directory, and pick a directory of your choosing.
    • I personally use C:\Users\<Username>\Music\Extracted
  5. Click OK.

That’s it!  Good luck.

Adding your most recent Twitter tweet to your Pidgin status

This guide is intended to be a more up-to-date mirror of the guide you can find at Tech Jawa.  All credit to them for the original instructions!

Basically nothing changes, but I just like to be comprehensive.

  1. Download the TwitterStatus plugin.  It’ll be a file ending in .pl.
  2. Move this file to your Pidgin plugins folder.  If any folders don’t exist, create them:
    • Linux: ~/.purple/plugins/
    • Windows Vista/7: C:\Users\<Username>\AppData\Roaming\.purple\plugins
  3. Install Perl:
  4. Install  the XML::XPath module into perl:
    1. Open a command line.
    2. Run perl -MCPAN -e shell.
    3. Type install XML::XPath and then hit Return.  Wait for the install to finish.
    4. Type quit and hit Return, then close your command line
  5. Start (or restart) Pidgin.
  6. From the contact list, go to Help > About.  At the very bottom of the textbox that appears it should say “Perl: Enabled”.  If it does not, repeat steps 3 and 4.
  7. From the contact list, go to Tools > Plug-ins.  Find Twitter Status on the list, check the checkbox next to it, and then click Configure Plug-in.
  8. In the configuration window that appears, type in your username in the top textbox (labelled Username, surprise surprise).  Configure anything else you want to your liking.

That’s it!  You do not need to set this up again, it is a one-off set up for the computer.  Of course, you will need to go through this procedure again if you have multiple computers you use Pidgin on, or if you format and reinstall your OS.

Ogg Vorbis Encoder for Windows

I not so long ago made a post about using Ogg Vorbis for Ringtones on Android, as it considerably reduces the lag between getting a phone call and the phone actually playing the ringtone.  The same goes for music on the device–it just starts playing quicker.

Anyway, just now I realised that I didn’t link to any encoders for it.  So if anyone wondered what I used to accomplish the task, they’d be stuck!

So here’s a quick update to fill in in the gaps:

If you’re wanting to just convert some files you already have into Ogg Vorbis, I’d recommend oggdropXPd.  Open the program, right-click on the “dropbox” that appears to configure it, then when it’s all done, drad and drop the files you want to convert onto the dropbox, and wait!  It works fine under Windows Vista (32-bit) and Windows 7 (64-bit).

If you’re wanting to both edit a music track into a short ringtone and convert to Ogg Vorbis, Audacity did the job for me.  It’s open-source and supports a number of file types (including MP3 if you download a separate plug-in), so hopefully it’ll work for you too.  Again, it works fine in Windows Vista (32-bit) and Windows 7 (64-bit).

The settings I used for the Ogg Vorbis files on my G1 where 128kbps CBR.  You don’t need much quality because the phone’s speaker isn’t exactly an orchestra, and I used Constant Bitrate under the assumption it would take less CPU to decode.

http://audacity.sourceforge.net/

I’ll Modify You in to Next Week.

A couple of days ago I came across this interesting quirk, and I had to do a double-take before I realised what had happened.

Basically, I recently got a NAS and decided that I wanted my router to save its bandwidth usage statistics on it.  That way whenever I perform an upgrade to the firmware on the router I won’t erase all the stats.  This part is easy, as the firmware has the functionality for this.  (The firmware I keep mentioning is the Tomato firmware.  I highly recommend it if you happen to have a compatible Linux router!)

Now, after I set it all up, I went on to the network shares to see if the statistics were being saved properly.  What I saw I didn’t exactly expect:

A screenshot of my local network share...  And some interesting modified times

A screenshot from Directory Opus of my local network share... And some interesting modified times

Now, nothing may look wrong at first glance. But take another look at the screenshot, particularly the column titled “Modified”.

Got it yet? You have? That’s great! You haven’t? You’re probably just not as finnicky as I am, don’t worry.

Anyway, enough suspense: the thing that caught me out was that the modified time for the statistics file was “tomorrow“.

“So what?” I hear you cry!  “You probably just had the NAS set to the wrong timezone.”

Alright, I’ll give you that — I had set it to the wrong timezone.  However, that isn’t the strangest thing!

The strange part is the fact that Windows has provisions for files that have creation/modify/access times in the future.

When you have a file that you have modifed today, it says “Today”.  Nice.  If you then leave the file for 24 hours, Windows will say the file was modified “Yesterday”.  Again, a nice touch.

But now Windows, in its all-powerful, all-knowing ways, can tell me when a file will be modified, before it’s even happened!

At least, that’s the impression it gives me when I think of a developer including “tomorrow” on the list of English relative dates.

And before you complain that I wasn’t using Windows Explorer but rather a replacement called Directory Opus, here’s a screen from Explorer demonstrating the same behaviour, but slightly more hidden:

A screenshot from Windows Explorer of my local network share...  With the same interesting modified times

A screenshot from Windows Explorer of my local network share... With the same interesting modified times

So there you have it: Some crazy behaviour and me thoroughly confused.  With DOpus and Explorer both “predicting” the future for me, I’m beginning to wonder just how much control I have over these computers…

Reset iTunes Dimensions to Fit Resolution

Here’s a handy little feature that I find useful.  If you ever play around with the size or location of the iTunes window and want to make it fit the screen better, simply follow the instructions:

If you’re on Windows:
hold Shift and either double-click the title bar or single-click the maximise button  (The title bar is the small bar at the top that says “iTunes” in the middle.)
If you’re on Mac OS:
hold Option and click the Zoom (+) button

This’ll reset the size and position to its default for your screen resolution.  Assuming you haven’t changed screen resolution since installing it, it’ll look just as it did when you first installed it — nearly filling the entire screen, but not quite.  It’s also a very useful shortcut if you ever change your screen resolution.

Doing the operation a second time will move the iTunes window back to where it was before you started reading this article and messing with it.  Simple!