Archive

Posts Tagged ‘Ubuntu’

Quick workaround for missing “switch-display”-key or “lcd/crt”-key on Ubuntu

May 21st, 2010

gnome-keybinding-propertiesWhat a wonderful day it is, sir

It’s been a while since I wrote something, but I liked to share this with you all. I bought a new Dell Studio 1558 and all the fn-keys were working except the one to switch the displays…

I enjoy switching between dual-screen, using only my external 22″ or using only my laptop, when I’m on the road. So I was looking for a workaround.

This laptop, is my first machine with Ubuntu that uses an ATI graphics chip, so this was all quite new to me. But I have to say; I’m very very pleased with it.

Ok, so what do you have to do to get things working?

1. Create the script
Create the script, I called it toggleDisplay.sh and this is how it looks in my case:

#!/bin/bash
# Script to toggle display configuration on Dell Studio 1558
# author: Ruben Verhack
 
config="/tmp/display.conf"
current=`cat $config`
 
# Check if config exists
if [ ! -a $config ]
then
   # Empty file executes default
   touch $config;
fi
 
# Check if CRT2 is connected
if xrandr -q | grep "CRT2 connected"
then
   # Toggle between states
   case "$current" in
   '')
      # default
      xrandr --output LVDS --auto --output CRT2 --left-of LVDS --output CRT2 --auto
      echo "dual" > $config
      ;;
   'dual')
      # was dual, now external only
      xrandr --output LVDS --off --output CRT2 --auto
      echo "external" > $config
      ;;
   'external')
      # was external, now laptop only
      xrandr --output LVDS --auto --output CRT2 --off
      echo "laptop" > $config
      ;;
   'laptop')
      # was laptop, now both
      xrandr --output LVDS --auto --output CRT2 --left-of LVDS --output CRT2 --auto
      echo "dual" > $config
      ;;
   esac
else
   xrandr --output LVDS --auto
fi

This toggles your displays from dual screen to external only to laptop only, and from there to dual screen again. Note that my monitors were called LVDS and CRT2, you can easily check how your monitors are called by executing:

xrandr -q

Read more…

ruben Ubuntu , ,

Use CodeIgniter on localhost with Ubuntu Jaunty

May 2nd, 2009

Hi,

As a PHP developer it comes in handy to run your websites without having to upload them to your server. You can run them on your own computer if you want to, there isn’t much to it. I also like using the CodeIgniter framework for my projects, this is a really speeds up the whole process!

I will take you through the basic steps to set up your localhost to get CodeIgniter running.

1) Use Synaptic package manager to install “apache2″, “php5″ and “mysql-server”.

During the installation you will be asked to enter the password for the root user for your mysql-server.

2) Create a symbolic link, so that when you go to localhost in your browser, you get the website you want.

sudo cd /var/
sudo rm -r www/
sudo ln -s /path/to/website www

Always look before you delete something with “rm -r”, normally there should only be a index.html file in your www/ folder.

I prefer creating a link to my website that I put somewhere in my home directory, as this is being back-upped frequently, and is on another partition.

Read more…

ruben PHP, Tutorials, Ubuntu, Xampp , ,

Photoshop CS4 on Ubuntu 9.04

April 20th, 2009

Photoshop 9.04 on UbuntuYes, it is possible! To my own suprise, I was able to install Photoshop CS4 on Ubuntu.

I did it on a fresh install of Ubuntu 9.04 RC. It has known to work on Ubuntu 8.10, but it gave me a segmentation fault, probably because I had been messing around ;) . I tested it with the trial version downloaded from adobe.com.

To do so, you need Wine. I will take you through the steps that I’ve taken:

Read more…

ruben Photoshop, Ubuntu ,

Fix random crashes Firefox, Thunderbird and Evolution on Ubuntu 8.10

April 12th, 2009

What do you expect of a decent modern OS? A great browsing experience and a decent mail client. Since I upgraded to Ubuntu 8.10 I had troubles with random crashes of Firefox when loading pages, and entirely random crashes of Evolution mail client.

So I switched to Thunderbird. But then same symptoms started showing. Giving me 5-10 crashes of Thunderbird a day, and serious troubles on heavy browsing.

The first things to do when getting crashes of Mozilla products are:

  1. 1. Make sure you don’t have a lethal combination of add-ons
  2. 2. Check if Flash isn’t the evil spirit haunting your browser, try the Flashblock add-on
  3. 3. Make a new profile for Firefox and Thunderbird, by renaming your old configuration. You can find the configuration folders in your home. Mostly ~/.mozilla for Firefox, and ~/.mozilla-thunderbird for Thunderbird.
  4. 4. Completely remove Firefox (make a backup of your configuration) and reïnstall it

I tried every possible thing I could do to fix Thunderbird or Firefox. But then again, why was Evolution suffering as well? Well the deal was that I had WINS resolution enabled in Samba. Found it in this bug report.

When upgrading to 8.10, Samba was upgraded too. This bug has been reported and hopefully will be solved in Ubuntu 9.04, launching 23rd of April.

So how do we fix this?

Read more…

ruben Ubuntu , , , ,

Ubuntu: backup to USB drive on mount

March 25th, 2009

Hi everyone,

I always was sloppy with my backups and I really needed to do something about it. I bought a new Freecom HDD 500GB and what I wanted to do is quickly backup my files every time I plug the device in, and it should give me a proper notice when the backup is done.

Doesn’t sound that hard, or does it?

It became clear that I needed a little thingy called “udev”. And with big help from unutbu from ubuntuforums.org I managed to get a very nice script up and running.

First thing you have to do is to know how your system recognizes your USB drive.

I followed this great tutorial here. (Don’t bother the fstab!)

My rules look like these.

1
2
 
SUBSYSTEMS=="usb", KERNEL=="sd?1", ATTRS{product}=="Freecom Network Drive", NAME="freecomHD", RUN+="/usr/bin/usb_backup.sh"

Note that I have saved them under “/etc/udev/rules.d/81-local.rules”, because /etc/udev/rules.d/README says. It would also be safer I you select your device using UUID.

Files should be named xx-descriptive-name.rules, the xx should be
chosen first according to the following sequence points:

80 rules that run programs (but do not load modules)

After adding your rule, you need to restart udev.

$ sudo /etc/init.d/udev restart

Next install libnotify-bin through synaptic. This will make it possible for us to show notifies as if it were GNOME itself ;)

Next we’ll need to hack the script a little bit:

Read more…

ruben Ubuntu , ,