Sound problems on Ubuntu 8.04 Hardy Heron

Ubuntu 8.04 users have been facing lots of problems related to sound. This happens when you try to play an embedded flash video inside the browser. This application somewhat locks and doesn’t allow other applications like VLC, Amarok to play anything. Syslog shows

pulseaudio[5903]: module-alsa-sink.c: Error opening PCM device front:0: Device or resource busy

The bug has been reported on Launchpad, many other duplicates exist, one of which is here

A workaround is to kill the daemon and restart it again and again. Once I did these steps, it never locks again. The whole thing is still a mystery.

Kill the daemon:

pulseaudio -k

Restart the daemon

pulseaudio -D -vv

You can even try out installing libflashsupport package, but it didn’t do any magic on my system though people claim that it works. Don’t forget to restart the browser and restart the pulseaudio daemon after installing this package.

This whole killing, restarting the daemon is just a workaround. We hope that it gets fixed. This problem is faced the most in Hardy, though even if you are planning to upgrade to Intrepid, be ready to face this bug. I faced this on the desktop at my home.

5 Less Known PHP Functions

As all of you know that PHP has a large set of functions for the programmers. The list is so huge that we keep on learning each one of them day by day. There are some cases you would like to know them beforehand to use them in your app. These are those functions which may be famous for some, but largely people are ignorant about their existance. Here goes the list.

  1. highlight_string: When you want to give away some PHP code as example and want it syntax highlighted, what would be your next step? Get some highlighting plugin? Use this function, pass the string and the highlighted string is printed as the output. If you don’t want to print it, instead want to store in some variable, pass the second variable as true. Details
  2. htmlspecialchars: If you have a HTML code to show as an example and want to print it out on the page, simply echoing wont suffice, since the tags would be rendered by the browser as HTML tags. This function converts < to &lt; and > to &gt; and other such special chars into their respective representation. Details
  3. chr: It is used to convert a number to its ASCII character. The paramter of the function is the integer and output is the character from the ASCII table. Details
  4. ord: This is just the reverse of chr. It takes a single character as input and returns back the ASCII value of the character. It’s a reverse mapping of chr. Details
  5. xdiff_file_diff : Taking file differences is one of the oldest thing which existed on a computer. The *nix diffutils is a great source of diff for system admins. Let’s make it available on PHP too. this function takes 3 compulsory arguments – first is the old file, second is the new file and the third being the difference file where the diff is stored. You can use the xdiff_file_patch to patch the files. Details