Wednesday, 27 January 2010

Ubuntu 9.10 display resolution problem

1,5 years ago I switched from a Windows laptop to a MacBook Pro and haven't really looked back since, ... except at home I still have a water cooled desktop PC that's about 7 years old and still runs Windows XP and I absolutely loathe that operating system. In my honest opinion Windows 2000 Professional was the best OS Microsoft ever made. My desktop PC ran on it for 4 years without the dreaded BSOD and within a week of installing XP it started presenting me all too frequently with them.

Since I wasn't really using the PC that much I tolerated this for some time, but two weeks ago 2 of the 3 hard drives in it failed and while repairing it I decided to install Ubuntu 9.10 which completed my goal of getting rid of Windows. The installation of Ubuntu went pretty painless and quick, with just one hitch: I couldn't configure a higher screen resolution than 800x600. That really sucks ass, especially on a 19inch CRT.

Installing the hardware drivers didn't really solve the problem, in fact it only made it worse, because afterwards I could only select 640x480 as the highest resolution. After reverting to the previous settings I started farting around with the xorg.conf file, but it turned out that that wasn't really my forté as I fucked up the configuration in such a way that in the end I just got a black screen.

You'd think that after all these years a desktop linux distro such as Ubuntu would get configuring your screen resolution as good/user friendly/easy as it is in Windows! So I pretended I wanted to be a millionaire and phoned a friend. He came over and also messed around a bit with the xorg.conf, but also couldn't get a better resolution. What we did discover however was that Ubuntu recognized my ancient Geforce2 M X400 without a problem, but not my CRT. It's some cheap piece of crap from some long-defunct Taiwanese manufacturer and that doesn't help autodiscovering settings one bit.

So I almost gave up, but decided to Google one last time and found a forum post with a possible solution: download a different linux live cd, check if that one provides better resolutions and if it does find the xorg.conf and copy the contents of that one into Ubuntu. I tried several, Knoppix, Linux Mint and CentOS, and with the last one I hit pay dirt! In CentOS I was able to change my monitor and resolution to a significantly better one by using some menu's in System > Preferences and System > Administration.

So I emailed myself the file /etc/X11/xorg.conf from within the livecd, rebooted back into Ubuntu, got the file from my email, put it in the correct location and a log off/log on later I had the resolution I wanted.


And so others won't have to go through the same troubles, I present to you the xorg.conf I got:


# Xorg configuration created by system-config-display

Section "ServerLayout"
Identifier "single head configuration"
Screen 0 "Screen0" 0 0
InputDevice "Keyboard0" "CoreKeyboard"
EndSection

Section "InputDevice"
Identifier "Keyboard0"
Driver "kbd"
Option "XkbModel" "pc105"
Option "XkbLayout" "us"
EndSection

Section "Monitor"

### Comment all HorizSync and VertSync values to use DDC:
Identifier "Monitor0"
ModelName "Monitor 1024x768"
### Comment all HorizSync and VertSync values to use DDC:
HorizSync 31.5 - 61.0
VertRefresh 50.0 - 75.0
Option "dpms"
EndSection

Section "Device"
Identifier "Videocard0"
Driver "nv"
EndSection

Section "Screen"
Identifier "Screen0"
Device "Videocard0"
Monitor "Monitor0"
DefaultDepth 24
SubSection "Display"
Viewport 0 0
Depth 24
Modes "1280x800" "1152x864" "1152x768" "1024x768" "800x600" "640x480"
EndSubSection
EndSection

Friday, 22 January 2010

Eurostar Oopsie

It seems that forgetting to translate that one message happens to everyone, even Eurostar:

Thursday, 21 January 2010

Liferay + FancyBox + IE8 = problems

The last few days I've been trying to integrate PDF in a nice way into Liferay by showing them in a Lightbox alike way (more on the full integration in a future post). I first tried to use the Liferay.Popup, but that just gave me a headache. So finally I settled on using FancyBox 1.2.6.

Getting it to work on OSX/Safari wasn't a problem, Firefox also was a breeze, but IE8 was a different story. It was the first browser to cause a real problem, a Javascript error to be exact: Object doesn't support this property or method. The strange thing was that the examples on the FancyBox website would work correctly in IE8. So what to do now?

The error line and column pointed to some browser detection code (if you can call IE a browser) in the FancyBox Javascript file:
var ieQuirks = null, IE6 = $.browser.msie && $.browser.version.substr(0,1) == 6 && !window.XMLHttpRequest, oldIE = IE6 || ($.browser.msie && $.browser.version.substr(0,1) == 7);
This is default JQuery browser detection code, so I couldn't figure out why this would cause a problem? But some Googling turned up a comment of Nate Cavanaugh to a post about Liferay/IE/Browser detection problems. In his comment he mentions that Liferay has had its own Javascript browser detection code since ages. So I decided to change the FancyBox code to use the Liferay browser detection instead of the JQuery one:
var ieQuirks = null;
var IE6 = Liferay.Browser.isIe() && Liferay.Browser.getMajorVersion() == 6 && !window.XMLHttpRequest;
var oldIE = IE6 || (Liferay.Browser.isIe() && Liferay.Browser.getMajorVersion() == 7);

And what do you think: the error disappeared. I'm no Javascript expert and so I can't explain what exactly causes the Javascript error, maybe a strange Liferay/JQuery/browser interaction (it's not the first one we've encountered), but frankly I don't care since it works now and I don't have to time to investigate further. On to the next problem...