PAE kernel breaks NVidia Drivers (Ubuntu)

May 19th, 2011

I’m running on a ThinkPad T410 with 4GB RAM. I need to stay on 32-bit as I have some dependency on 32-bit applications that I couldn’t get running on 64-bit. Thus I’ve installed the PAE kernel to access all the RAM. Problem is, this broke the graphics.

After booting up the first time, I was presented with the option of running Ubuntu in low graphics mode – great.

Anyway, the fix is nice and quick. Go into the Hardware Drivers tool and disable the NVidia driver. Reboot – you should now be back to normal resolution, just no acceleration. Re-enable the NVidia drivers and reboot again and everything should be back to normal.

HTC Incredible S, internet over Wifi not working

May 14th, 2011

After recently buying an HTC Incredible S, one of the first requirements was to get it connected to the home Wifi. For security I use WPA-PSK and also MAC address filtering. After adding the MAC address to the router and configuring the password, the phone connected to the Wifi with no issues. But after trying to use the market and the internet it was apparent that the connection wasn’t working.

After a little bit of troubleshooting, I discovered I could actually access other computers on the home network, but could not access anything on the internet. This didn’t seem to be a DNS issue as using straight IP addresses didn’t help either. After reading a few posts, it seemed this might be an issue with my SpeedTouch router (and/or the combination of the SpeedTouch with an Android 2.2 device).

Anyway, the current solution (or workaround) is to use a static IP address on the home network. Once configured, everything works as expected. But, this is a workaround, and I wouldn’t want to have to do this on other Wifi networks (which I’m yet to test).

Fixing the aspect ratio on Canon camcorder *.MOD files

April 2nd, 2011

I have a Canon FS200 digital video camera which creates MOD files.  These are playable on Linux by simply changing the file extension to “mpg”.  The only issue is that the video displays in 4:3 aspect ratio, whereas it should be 16:9.

On many players, you can override the display aspect ratio during playback and then the files display correctly.  The problem is when you want to edit these files or create overlay text/graphics, as the editing program will process them in 4:3 ratio, and then when displayed in 16:9, the overlays will look stretched (while the video looks correct).

Although I have tried to solve this a number of ways, the actual fix is remarkably simple and fast.  The clue to this fix was in the error message “ODML: Aspect information not (yet?) available or unspecified, not writing vprp header.“.  Searching in the mencoder man page for “vprp” provided the solution.  Mencoder has a command line option “-force-avi-aspect” that can be used with the “-ovc copy” option, so you don’t need to re-encode (and potentially loose quality).  As this is only updating the meta data in the file, the fix is almost instantaneous.

The following command will perform the fix:

mencoder -oac copy -ovc copy -force-avi-aspect 1.777 input-4_3.mpg -o output-16_9.mpg

Ubuntu upgrade breaks LIRC

January 8th, 2011

I recently upgraded my Ubuntu 10.04/XBMC based media center box (not a dist. upgrade, just a sudo apt-get upgrade).  After the update finished, I realised that the remote control (StreamZap) wasn’t working any more.

Quickly scanning the relevant files (i.e. /etc/lirc/* and /dev/lirc*) didn’t show up any obvious issues.

It turns out, all that is required is to run the following reconfiguration on lirc:

sudo dpkg-reconfigure lirc

Select your appropriate control and (if this doesn’t fix everything) then reboot and the remote should be working again.

UPDATE:

Unfortunately this seems not to be a permanent fix.  After rebooting, more often than not, the remote is not working again.  Performing the step above does seem to fix it for the current boot though.

A bit of further research found this post.  The post explains, that when the lirc_imon module is loaded (i.e visible when running an lsmod) the remote doesn’t work.  Performing the dpkg-reconfigure as stated above actually ends up removing the module lirc_imon – this is what actually fixes it.

So, to make the fix permant, you need to add lirc_imon to your modules blacklist.  The cleanest way to do this is to create another file called blacklist-lirc.conf in the /etc/modprobe.d/ directory with the following content:

blacklist lirc_imon

This will stop the module loading on boot, and your remote should remain working.

Install WordPress on Ubuntu/Debian (or where’s my WordPress install and why isn’t it working)

January 5th, 2011

I recently wanted to play with a local instance of WordPress (I am running Ubuntu 10.04 i386, but this should apply to all Debian based distros). I already had apache2, mysql and php up and running so decided to just try:

sudo apt-get install wordpress

WordPress installed and everything looked promising. But I could not find a URL that worked, or any configuration files in the /etc/apache2/conf.d directory (where most web applications usually put them).

It turns out there are a few more manual steps required. Hopefully this will be automated on later packages, but it doesn’t hurt to understand what’s going on under the hood sometimes. There are two main steps that need to be done:

Create apache configuration

Following the examples of other web applications, we can create a file in /etc/apache2/conf.d called wordpress.conf. This file should have the following (or similar) content:

Alias /blog /usr/share/wordpress
<Directory /usr/share/wordpress>
Options FollowSymLinks
AllowOverride Limit Options FileInfo
DirectoryIndex index.php
</Directory>

You can change /blog to whatever you want your WordPress install to be served under. As it is, you will find it at http://localhost/blog. Following this, restart apache to load the new configuration.

sudo /etc/init.d/apache2 restart

Run the mysql setup script

Next we need to run the setup-mysql script to create the right database users, tables etc. To do this, change directory to the /usr/share/doc/wordpress/examples folder where you will find the setup-mysql script. If you run:

sudo bash setup-mysql

you will get a simple explanation of how to use the script, as shown below:

setup-mysql [-n NAME] [-h | -d | -b] FQDN

Creates by default a WordPress mysql configuration depending on required fully
qualified domain name(FQDN).

Options:
-n name for the mysql user and database
-h help
-d destroy and purge
-b backup

Example: You want your blog to be served from http://blog.example.com
for user ‘wordpress’.

Then run:
sudo bash setup-mysql -n wordpress blog.example.com

Following this lead, you can just run:

sudo bash setup-mysql -n wordpress localhost

Assuming everything works without issues, navigate to http://localhost/blog and step through the 1 step process of the WordPress web based setup.

Connecting to MySQL database from OpenOffice.org Base

January 2nd, 2011

Quick one here… if you want to connect to a MySQL database from OpenOffice.org Base, you need to install the openoffice.org-mysql-connector package:

sudo apt-get install openoffice.org-mysql-connector

After this is complete, make sure OpenOffice is completely restarted (i.e. not just the Base app, if you have a Writer window open, this needs to be closed too). Then just follow the prompts for connecting to an existing database (choose “MySQL” and “Connect directly” as you work through the wizard).

Running scripts on network connection (if-up.d, if-down.d,if-pre-up.d,if-post-down.d)

November 19th, 2010

On my previous post I described how to authenticate against web based logons after connecting to a particular SSID.  One of the problems I had was getting the script to actually run.  You should just be able to put a script in the /etc/network/if-up.d directory (on Debian based systems) and it should run when a network interface connects.  This wasn’t working for me and it seemed some other people were having issues too.

The solution to the problem turned out to be removing the file extension.  So the script that was named testscript.sh didn’t run, but the script named testscript did.  So if you are having similar problems you may want to try removing the file extension.

I am not sure if this is documented and expected behavior, or a bug.

Auto logon to web-authenticated wireless

November 18th, 2010

At my current workplace I am using a guest wireless network.  After connecting, I need to open any web page and I am redirected to the login page and need to enter my provided username and password.  After submitting, I can browse any page and use the connection for email and other tasks.

Whilst this is only a minor inconvenience, it is definitely a candidate for automation.

A single line wget command is all we really need.  I have wrapped it up into a shell script below:

#!/bin/sh

username=XXXX
password=XXXX

wget -O /dev/null --no-check-certificate --post-data "username=$username&password=$password&buttonClicked=4&err_flag=0&redirect_url=google.com" https://1.1.1.1/login.html

-O /dev/null throws any downloaded content away, --no-check-certificate is fairly self-explanatory (wget wouldn’t connect to the https address without this), --post-data wraps up the various name/value pairs that the login form is expecting.

For most of these login forms, you only need a username and password, but I found with this one it also needed a few extra parameters.

So, the next step is to get this script to run automatically after connecting to the wireless network.  On Ubuntu (or any Debian based distro), there is a directory structure under /etc/network that includes an if-up.d directory.  Any scripts in here will be run after a network interface is brought online.  These scripts don’t have access to the SSID (as far as I know), but this can be obtained with the following command:

iwgetid --raw

Wrapping it all together, we can put the following script in the “if-up.d” directory:

#!/bin/sh

username=XXXX
password=XXXX
ssid=XXXX

if [  "`iwgetid --raw`" = "$ssid" ]
then
wget -O /dev/null --no-check-certificate  --post-data "username=$username&password=$password&buttonClicked=4&err_flag=0&redirect_url=google.com" https://1.1.1.1/login.html
fi

Remember to change the values of username, password and ssid.  Set the URL to the forms action value and add remove parameters as necessary.  Also, another point I learned the hard way is that the script can’t have a “.sh” extension, so name it “something” not “something.sh” (and remember to chmod +x it).

If you need to then connect to a VPN, this can also be added to the script.

Import contacts to Android (Sony Ericsson t650i to HTC Hero)

October 23rd, 2009

I am now the proud owner of an HTC Hero Android powered phone.  One of the first tasks to sort out was getting my contacts migrated.  What looked liked a problematic task at first has turned out to be quite simple.

My first instinct (as I had done this successfully with other phone migrations) was to backup my contacts to my SIM and then import them on the new phone.  This kind of worked, but was not too successful (i.e. surname, firstname back to front, other notes in weird places, not all numbers copied across).

Now to what did work.

From within the Sony Ericsson phone, I was able to back up my contacts to the memory card.  Following this I plugged in the SE phone via USB to my laptop, and copied the “PB_Backup.vcf” file across (found in the /media/PHONE CARD/system/pim directory).

Now to Gmail contacts.  Choose “import” and select your “PB_Backup.vcf” file.  If, after importing, this all looks ok, then sync your Hero (or other Android phone) and your done.  Contacts with the firstname first.

Fixing ThinkPad Trackpoint scrolling on Ubuntu 9.04

May 11th, 2009

Recently after upgrading my Thinkpad R52 to Ubuntu 9.04 I had some trouble configuring the trackpoint scrolling (one of the Thinkpad features that is hard to live without once you get used to it).

There are a number of blog posts and a good article on ThinkWiki that explain the cause of this (a move away from Xorg based input configuration to evdev).  But these solutions didn’t work for me.

After poking round for a bit, I started to realise there were some inconsistencies in the solution offered for evdev.  This was mainly in relation to the “axis” settings.  So I tried taking the solution offered on ThinkWiki and changing the  “Y” axis mapping to “Z” axis mapping as shown below. This file should be saved as “/etc/hal/fdi/policy/mouse-wheel.fdi".

<match key=”info.product” string=”TPPS/2 IBM TrackPoint”>
<merge key=”input.x11_options.EmulateWheel” type=”string”>true</merge>
<merge key=”input.x11_options.EmulateWheelButton” type=”string”>2</merge>
<merge key=”input.x11_options.ZAxisMapping” type=”string”>4 5</merge>
<merge key=”input.x11_options.XAxisMapping” type=”string”>6 7</merge>
<merge key=”input.x11_options.Emulate3Buttons” type=”string”>true</merge>
<merge key=”input.x11_options.EmulateWheelTimeout” type=”string”>200</merge>
</match>

Problem fixed!

I’m not sure if I also need the “Y” axis line in the file also (or the “X” asix line for that matter), but everything seems to be working as expected.  On top of this, Firefox was also working exactly as expected with horizontal and vertical trackpoint scrolling working (without any changes on the about:config page).