Racer audio problem under Ubuntu 10.10 (maverick) resolved

Racer Logo

Since Ubuntu 10.10 (Maverick) removed OSS, “Racer”, in its default configuration has since become rather broken; when you fire Racer up, you’ll get the following error:

Audio: setting speakermode to -1081005172 (<unknown_speakermode>, system default is <unknown_speakermode>)
FMOD: audio hardware acceleration is OFF. This is really bad for latency; adjusting audio buffers.
Can't init FMOD (audio system)

The solution? Simply replace the old libfmodex.so with the latest one!

# Download and extract the latest version of fmod
wget http://www.fmod.org/index.php/release/version/fmodapi43208linux.tar.gz
tar -zxf fmodapi43208linux.tar.gz
# Replace the existing libfmodex.so with the latest version
mv fmodapi43208linux/api/lib/libfmodex-4.32.08.so /usr/lib/libfmodex.so
Posted in Games, Tips. 1 Comment »

Connecting to corporate (business) Gmail chat (IM) through Pidgin

Ever since my workplace migrated over to Gmail, I’ve been finding ways to use the various Gmail features without actually having to use the web UI of Gmail.

One of the features I wanted to use was chat (IM), but since the usual configuration won’t work, I had to do some trail and error on my own to get it working.

Without further ado, here’s how, in 2 simple screenshots:

Account configuration - Basic tab Account configuration - Advanced tab

Hope you find it useful!

Posted in Tips. 10 Comments »

Re-applying OpenOffice Impress Notes view template (Fix for blank (empty/missing) slide preview in “Notes” page view)

If the following issues are driving you nuts in OpenOffice Impress (like it has done for me…):

  • Impress no longer display / displays a white slide thumbnail in the "Notes" page view
  • You’ve accidentally deleted the slide thumbnail in the "Notes" page view and would like to get it back
  • You’ve changed the notes master but the note pages retains their layout

I have got just the fix for you:

Impress apply notes layout click actions

To apply this layout over all your slides, simply select all slides, then click on the Notes layout template (as above).

It’s so simple I know, but it took me a while to find it… Guess I’m still retarded!

Posted in Tips. 2 Comments »

Generating /etc/shadow passwords

If you want to generate shadow passwords (e.g. to be used in "useradd -p"):

openssl passwd -1 -salt 'sUktuv56' 'somePa55w0rd'
# This will give you '$1$sUktuv56$lbUdWixmJBKNsi4r2XEN91'

For more information on the openssl parameters, see "openssl passwd –help".

Oh, and in case you need to decode a shadow password entry, here’s how:

 ^ ^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^
 | |        |- The password hash
 | |- Salt
 |- Hash type - in this case, it's md5

Fixing Firefox 3.5 flash video full-screen hang and blurry font on Linux

If you have just upgraded to Firefox 3.5 and have noticed the blurry fonts, and, or Firefox hangs if you put flash video on full-screen, I’ve got 2 workarounds for you.

Blurry font fix

cd /etc/fonts/conf.d
ln -s ../conf.avail/10-hinting-full.conf .
rm 10-hinting-slight.conf 10-hinting-medium.conf

Then restart Firefox – you should see the font changes.

Please note I am using full hinting – change the above to your hinting level as per your configuration.

I found the above solution from this page.

Flash video full-screen hang fix – This also applies to Firefox 3.0 as well!

Insert the following line to the Firefox startup script (/usr/bin/firefox):

export LD_PRELOAD=/usr/lib/libGL.so.1

I got this fix from this page.

URI decode script

Ever seen a URI like "http%3a%2f%2fklo-2k.spaces.live.com%2fdefault.aspx"? Wish you can decode it or paste it into your address bar? Well, I’ve got just the script for you:



# Idea from http://www.linuxquestions.org/questions/linux-software-2/bash-scripting-pipe-input-to-script-vs.-1-570945/#post2998640
if (( $# > 0 )); then
	param=$1	# Read from 1st parameter
	param=$(cat)	# Read from pipe

eval "echo $(echo $param|sed -e "s/&/\&/Ig" -e "s/%([a-z0-9][a-z0-9])/$'\x1'/Ig")"

Call it "uridecode", chmod +x it, then you can do something like:

firefox $(uridecode http%3a%2f%2fklo-2k.spaces.live.com%2fdefault.aspx)

Nice eh!?

ASP.NET ODBC Oracle error “ORA-01008: not all variables bound” solved

The other day I decided to try my hands on using named parameters in a query to query an Oracle database using ODBC when I got this message:

ERROR [07001] [Microsoft][ODBC driver for Oracle][Oracle]
ORA-01008: not all variables bound

From what I’ve found, it looks like if you are querying an Oracle database using the System.Data.Odbc class, you can only use unnamed parameters (defined by "?"). In order to use named parameters, you’ll need to use the System.Data.OracleClient class instead (note you’ll need to add that reference manually to your project).

Here’s what I mean:

public DataTable queryDatabase_odbc () {
	OdbcConnection con = new OdbcConnection("Driver={Microsoft ODBC for Oracle};server=DBSERVER;uid=xxUserxx;pwd=xxPwdxx");
	OdbcCommand ps = new OdbcCommand("alter session set current_schema = xxdbschemaxx", con);

	OdbcCommand ps2 = new OdbcCommand("select * from aTable where field = :AParam", con);
	ps2.Parameters.Add("AParam",OdbcType.VarChar).Value="Some String Value";
	DataSet rs = new DataSet();
	OdbcDataAdapter da = new OdbcDataAdapter(ps2);
	da.Fill(rs);	// This will throw an exception
	return rs.Tables[0];

// The exact same code as above, just using the the OracleClient class
public DataTable queryDatabase_ora () {
	OracleConnection con = new OracleConnection("server=DBSERVER;uid=xxUserxx;pwd=xxPwdxx;");
	OracleCommand ps = new OracleCommand("alter session set current_schema = xxdbschemaxx", con);

	OracleCommand ps2 = new OracleCommand("select * from aTable where field = :AParam", con);
	ps2.Parameters.Add("AParam",OracleType.VarChar).Value="Some String Value";
	DataSet rs = new DataSet();
	OracleDataAdapter da = new OracleDataAdapter(ps2);
	return rs.Tables[0];

However, I do have to point out there is one draw-back with using the OracleClient class – you can no longer use unnamed parameters

But in a way, you do get more out of using named parameters than unnamed parameters (like when you have a query looking up the same value on multiple fields). Besides, you can always (sort of) hack named parameters to act like unnamed parameters by using an integer string as name…

Here a page I found with details in using parameterized queries in different DBMS: