Rails find case sensitive search

Email this to someoneShare on Google+Share on FacebookTweet about this on TwitterShare on LinkedIn

Problem
You want to use find in Rails for a case sensitive search. For example in your authentication logic you have something to find the user to login as in:
u=User.find_by_login(‘username’)
If you don’t want to limit the available logins with case insensitive validation in the model, then the above code will not work if you have ‘Username’ and ‘username’ as available logins, as the find will only return one of them.

Solution
Change the find method to use the BINARY keyword in your database (only used with MySQL), as in the following:
u=User.find(:first, :conditions => [“BINARY login = ?”, login])

ATI Radeon HD-4350 Mandriva 2010 Dual Monitor

Email this to someoneShare on Google+Share on FacebookTweet about this on TwitterShare on LinkedIn

Problem
Trying to get Mandriva 2010 to work on a dual monitor with an ATI Radeon HD 4350. Desktop used is a Dell Vostro 430 and two BenQ G920WL monitors.

Solution
After reading the articles here and here, the steps required were:

  • Select driver ATI Radeon HD 2000 and later (radeon/fglrx)
  • Don’t select proprietary driver from next screen
  • Run xrandr -q to find out the name of the monitors
  • From the output find out the current resolution (1440×900), names (VGA_1,DVI-I_2/analog) and maximum resolution (1440×900)
  • Edit the xorg.conf file (/etc/X11/xorg.conf) and add the Virtual 2880 900 (without quotes) underneath the Modes line in the Display Subsection
  • Save the file and restart the X server
  • Run again the xrandr -q command and make sure the maximum resolution has changed to 2880×900
  • Run xrandr –output DVI-I_2/analog –auto –right-of VGA_1 to put one screen next to the other
  • Follow the description here to set it up permanently on login