KrisWillis.com

Flower

Terminal bell with gnome-terminal, screen and irssi

It’s been a while now that I have been using irssi and screen to connect to IRC, and I have always found it annoying that I could never get notifications for nick highlights working. I have since stumbled upon a couple of irssi and screen commands that now allow this set-up to ring the terminal bell on any of my configured highlights.

irssi
/set bell_beeps ON
/set beep_msg_level MSGS HILIGHT
/set beep_when_window_active ON
/set beep_when_away ON

screen (toggle visual/audible bell)
Ctrl+a Ctrl+g

gnome-terminal
Edit -> Profile Preferences -> General -> Terminal Bell

Failed to import current network settings into target system

I decided to try out some light-weight distros on some old hardware I had lying around, one such distro was ArchLinux, mainly because it would be interesting to try something that is not Debian based. During the installation process, at the “Configure System” stage I received the following error message:

Failed to import current network settings into target system

I thought nothing of it and hit the OK button to proceed. The next stage presented me with a bunch of system files to configure, except that they were all empty – I can’t imagine writing these files from scratch is part of the install process! After a bit of research, it turns out that this happens when the dhcpd package fails to download in the previous stage. All I had to do to fix this was to run the “Install Packages” step again, this time it only downloaded / installed what had previously failed, and my config files were no longer empty.

It turns out, ArchLinux is so light-weight, that all you end up with after installation is the CLI, you have to install Xorg, a window manager, and all of the related bits and pieces yourself – Which is nice, from a customization perspective.

ps_files_cleanup_dir: opendir(/var/lib/php5) failed: Permission denied (13)

When running PHP5 under Ubuntu, every ~100 times you call session_start() the following error is thrown:

ps_files_cleanup_dir: opendir(/var/lib/php5) failed: Permission denied (13) in ...

By default, session data is stored in /var/lib/php5 which has its permissions set to only allow data to be deleted by it’s owner (and root). It’s like this because there is a cron script that periodically clears the session data. To prevent PHP from also trying to do this, switch off the session garbage collection in php.ini (/etc/php5/apache2/php.ini) with the following:

session.gc_probability = 0

It is quite likely to be set to 1 by default. Save changes and restart apache.

sudo /etc/init.d/apache2 restart

Revo 3610 HTPC

I store all of my media on a file server (running Ubuntu Server 10.04) which currently contains a 6TB RAID5 array, then stream whatever I want to watch to a client device hooked up to my TV, up until yesterday this was a Popcorn Hour A-110. Although the A-110 plays back almost anything I throw at it, and generally flawlessly, the navigation is not the best, the UI is not the prettiest to look at and the network functionality is pretty slow. I’ve had my eye on Boxee for a while now and have been patiently waiting for the release of the Boxee Box, but they’ve recently announced on their blog that it has been delayed until November 2010 for the US release, and no mention of the Europe release. With this in mind, I decided to run Boxee on a low powered HTPC.

A couple of people in both forums and IRC have recommended the Acer Aspire Revo 3610 net-top machine as a candidate for running Boxee, so after a little research I picked on up from eBuyer at a bargain £180 for the N330 / 2GB / 250GB / Linpus configuration, delivered the next day for free. After firing it up for the first time, I spent less than 5 minutes poking around the pre-installed Linpus out of curiosity (the 250GB disk was oddly configured with a single 10GB partition), then promptly wiped it and installed Ubuntu 10.04 (x64) and the latest Boxee release.

Having previously read Liam Green-Hughes’ website, I was aware that I needed to tweak some settings to get the digital sound working, though there was a slight difference with my Revo in that I have three different S/PDIF levels within alsamixer – “S/PDIF”, “S/PDIF Default PCM” and “S/PDIF 1″. I un-muted all  of them but have yet to experiment to see what each of them does. I set my output device to “Digital Stereo (IEC958) Output” within the Ubuntu sound configuration as I want the audio to be sent to my amp over S/PDIF for decoding; after messing around with a few different combinations of settings within Boxee I was getting sound for files encoded with normal stereo sound, but silence for anything with multiple channels (DD / DTS). After a couple of hours of tinkering and research, it turns out that pulseaudio has a default sample rate of 44.1kHz and AC3 (Dolby Digital) is signed 16-bit little-endian 2-channel 48kHz PCM data, configuring pulseaudio to run with a sample rate of 48kHz appears to have fixed the issue, as I am now getting DD and DTS passed to my amp for every media file I have tested.

After playing around with the Revo / Boxee combination for about a day, it’s generally all positive; it plays back 720p/1080p content perfectly by passing the majority of the HD video decoding to the ION chip with the help of VDPAU available within GNU/Linux, the CPU is running at ~10% during all of this while managing perfectly with non-HD content too but with a little more strain on the N330. While “idling” on the Boxee home screen, one of the CPU’s threads is curiously always running at 100% load, though it is possible it is still indexing all of my media with it reporting “identifying” next to one of my sources. It has currently successfully identified 99% of my media requiring me to manually identify a handful of files, but this is perfectly acceptable considering the brilliant interface complete with covers and descriptions for all of my movies and TV shows. There is a slightly annoying wait when switching between the different areas of Boxee and sometimes a slight bit of lag when browsing through the media, but this could be down to it still indexing the content.

There appears to be plenty more to play with such as web content and applications, from what I have looked at, Flash video plays back fine in standard definition but HD Flash content is completely unwatchable – This is likely down to the lack of 64bit Linux support from Adobe. Other web based content such as the video made available within the Revision 3 application plays back perfectly, I’m pretty sure it’s HD too, but I couldn’t find an option to switch between the different encodings of their content.

Shorten URLs and post to Twitter with PHP and cURL

I recently had the task of automatically “tweeting” when a new article was posted to one of the websites I had built, it turns out to be a pretty simple operation thanks to both Twitter and Bit.ly providing a straight forward API. An account with Bit.ly does have to be opened to obtain an API key.

I decided to use the built-in cURL functionality of PHP for interacting with the APIs. This code uses some of the JSON functions introduced in PHP 5.2.0 so a recent install of PHP is required as the Bit.ly API responds with a JSON string. On to the code…
Read the rest of this entry »

mt-daapd transcoding failed after upgrading to Jaunty

After upgrading my media server to Jaunty recently I noticed that I could no longer play FLAC files from within iTunes under OS X. I couldn’t figure out why this was happening, but to solve it I configured mt-daapd to handle the transcoding with a script rather than with ffmpeg.

There are a few small issues that don’t make this reconfiguration as straight forward as you would hope. First of all, the required script (mt-daapd-ssc.sh) is not installed along with mt-daapd, so I had to pull it from the svn repository and drop it into /usr/bin. Also, mt-daapd-ssc.sh uses wavstreamer to encode the decoded FLAC file, so if that isn’t available on your system, you’ll need to install that too. I believe it is built along with the rest of mt-daapd when building from source.

Next up, mt-daapd.conf needs to be modified to change how the transcoding is handled, the following lines need to be uncommented:

ssc_prog = /usr/bin/mt-daapd-ssc.sh
ssc_codectypes = ogg,flac,alac

The following line needs the ssc-ffmpeg.so part removed:

plugins = rsp.so,ssc-ffmpeg.so

At this stage, I thought that this was all that was required, but I still couldn’t get it working. Upon searching the Ubuntu Forums, someone else had already been through this and pointed out that one component of this set-up (I’m unsure which) requires an older version of FLAC, so a symlink had to be created.

sudo ln -s /usr/lib/libFLAC.so.8.2.0 /usr/lib/libFLAC.so.7

After restarting mt-daapd, iTunes was again playing FLAC files!

Adding a printer within Ubuntu

One of our office printers decided to die the other day, a Brother multi-function laser printer, which I recall took quite a lot of messing around to get it printing from Ubuntu and once it was set-up it always took a while to send pages to the printer. Sometimes, it printed just a bunch of garbage instead of the document I sent too.

Our new printer, an HP 2727nf MFP, was a completely different experience. After hooking it up to the network and selecting to add a new printer within Ubuntu, it searched for printers, found the new HP, fetched and installed the required drivers and just worked! Pages are sent to the printer almost immediatly and have printed perfectly every time, so far.

Also, I set the same printer up on 6 machines in the office, 1 x Ubuntu, 2 x Xubuntu, 1 x OS X, 1 x Vista, 1 x XP Pro. By the time it was set-up on the first Windows machine I had already completed the set-up on all three Linux machines – Two thumbs up for Ubuntu and HP.

Overview of open tickets across multiple trac environments

I’ve recently started using Trac internally for managing the ever growing list of projects that I have built and am responsible for maintaining. There is currently no feature within Trac for displaying a list of all the environments and how many open tickets each one has, and I’m guessing this is down to the fact that each environment has it’s own SQLite database.

However, browsing the root of the Trac install does give a list of all the available environments, and there are RSS feeds available for any of the reports that have been created. So I wrote a quick script to pull information from both of these resources and display a list of all available environments and how many open tickets each one has. Read the rest of this entry »

Boss SD-1 not switching off

SD-1 InsideAlthough I hardly use my SD-1, due to my GT-8 having all of the overdrive settings I could possibly want, it was still annoying me that I had a faulty pedal sitting on my shelf. The problem I was experiencing was that the SD-1 was constantly stuck in its on position – Stomping on it did nothing but continue with the overdrive.

After taking it apart and hooking it back up to some power, a guitar and an amp, in its disassembled state it was working fine – Reassemble and the fault reappears. It was instantly obvious that something was shorting out against the metal casing. You’d have thought that there was some form of non-conductive coating on the base-plate – Maybe there is, but defective near the switching area of the circuit. Covering the base-plate with insulation tape fixed the issue and it’s now working perfectly again!

SiI-3114 and Ubuntu

My media server was getting to the stage where it required some extra discs, so I purchased another pair of 500GB SATA disks and a SiI-3114 based PCI to 4-port SATA controller card to hook them up to as I was out of spare SATA ports.

Upon booting there was no sign of the cards BIOS during POST and no sign of the disks attached to it either after booting into Ubuntu, though running lspci reported that the card was present. After poking around with a mixture of Google and the Ubuntu forums, a number of people were having issues with the card but no conclusive fix had been found.

So I head on over to the Silicon Image website to check if there are any new BIOS images available, and surprisingly there was! After downloading, and realising that the only flash tool available was DOS based along with my server not having a floppy drive or a CD drive to boot into a DOS shell with I managed to get a USB stick booting into DOS with the flash tool.

To cut the story short – Flashing the card with the latest non-RAID version of the BIOS fixed my issue. It was now displaying the BIOS upon boot, and the attached disks were visible when running lshw -C disk.