Showing posts with label Tweaks. Show all posts
Showing posts with label Tweaks. Show all posts

2014-06-20

Dropbox Icon missing in Ubuntu

On Ubuntu 12.04 as well as 14.04 with recent versions of compiz, dropbox or whatever other module the Dropbox icon may be missing in the upper right corner (system tray) after login.

This is in general just an annoyance because Dropbox is still running in background (you can check this by opening your Dropbox folder and you will see the checkmark icons and the dropbox context menu entry when right-clicking a file - which are only visible when Dropbox is running).

However, I found several forum and blog posts mentioning that
sudo apt-get install libappindicator1
solves the issue or
sudo apt-get install nautilus-dropbox
solves it. I already had libappindicator1 However in reality the latter is obsolete as the nautilus integration is no separate thing any more. So both did not solve the issue for me.

I solved it permanently only by writing a short shell script (which i put into /opt directory):
 #!/bin/bash  
 sleep 60s  
 dropbox stop && dropbox start -i &  
(mark as executable) and then click on the Ubuntu button on the left upper corner, type "startup" and there add an entry to call that start that shell script /opt/dropboxrestart.sh.

2013-10-12

LibreOffice v4.1.* and Ubuntu 12.04 Unity-Integration

As I use Ubuntu on my productive work+private machine, I prefer to use stable versions - so I switched to use LTS versions only. However, for LibreOffice I have enabled the LibreOffice repository using

# Adding repository for getting most current LibreOffice # (taken from https://wiki.ubuntu.com/LibreOffice) add-apt-repository -y ppa:libreoffice/ppa
 That slurps the current LibreOffice release into my Ubuntu 12.04 LTS stream of updates (the poor Windows users don't have an idea of such a comfort).

The reason for this was mainly to get the latest additions for Microsoft Office formats support (Microsoft is still good in their attempt to squeeze people into staying with MS Office).

Unfortunately with LibreOffice v4.1.* a unity-related problem (users of other flavors of Ubuntu can stop reading here) was introduced that has not been addressed yet by the Ubuntu folks - at least not for 12.04 LTS:

When opening several documents in Writer, Calc etc the windows are not grouped to a single Unity icon.

As you might know from earlier posts I like the Unity desktop very much (and it also has become very stable) and so I am very glad for the workaround that has been posted to the according bug report at https://bugs.launchpad.net/bamf/+bug/1026426 (comment #166 by Marco Trevisan) which is just one command in the terminal window:
sudo sed '/StartupWMClas
s=.*/d' -i /usr/share/applications/libreoffice-*.desktop
(all one line).

Problem solved, thank you very much, Marco!

Related posts: Open Office and Libre Office starts slow, Normal.dot in OpenOffice or LibreOffice, Default Paper Size in Open Office.

2013-10-04

Maintaining multiple Calendars

While I have to put the Outlook Calendar entries into the office calendar I do have my own private calender on Google that I share with my wife and vice versa. I want my wife to know when I am at customers or in foreign countries. That enables her to make appointments for us without the need to call me several times a day.

There are two problems:
  1. And this is a general problem of the crappy Outlook*): With version 2007 or 2010 they changed the style how invitations are sent and this means: When on an Android phone for example or you do not allow HTML display in your mails due to security reasons you don't see the Outlook appointment information on your phone or mail-client. Both is given in my case.
     
  2. I need to create each work-related calendar entry twice - once in the Outlook Office 2010 calendar and one on my Google calendar.

Solution for problem 1: Install Invitation Processor Pro on your Android device as unfortunately by default Microsoft Outlook inviations cannot be processed by Android (while gmail invitations and those sent with Thunderbird+Lightning which are also distributed as .ics file are displayed fine so this is not a general problem with event invitation mails). Say thanks to Microsoft.

Solution for problem 2: I thought of several possible solutions, but a) I am not using the Desktop Outlook at all (so all Outlook plugins for syncing calendars are irrelevant for me) and b) I do not want extra hosting for calendar syncing. You might be in a similar annoying situation so here is another still a little annoying, but acceptable way:
  1. Create two rules via Outlook web access 2010:
    a) Forward all mails of type meeting request to your private gmail address:
    Rule Name: Forward event invitation
    After the message arrives and...
    the message is Meeting Request.
    And my name is in the To or Cc box
    Do the following...
    forward the message to 'you@gmail.com'
    and
    b) Delete your own meeting responses from yourself (confirming events on GMail side):
    Rule Name: Meeting response from Google Calendar
    After the message arrives and...
    the message was received from 'calendar-notification@google.com'
    And the message is Meeting Response.
    And the message includes specific words in the subject '(YourFirstName YourLastName)'
    Do the following...
    delete the message
    And stop processing more rules on this message
  2. Use Outlook (web-access) 2010 to confirm appointment requests (at work for me the 90% case). When creating appointments on your own then invite yourself (your private or your work email address).
And the good thing when solving problem 2 this way: You also solve problem 1 as GMail is able to display the invitation details (date and time) even for the .ics files originating from Outlook. I installed the Invitation Processor Pro anyway to see the event details also when currently in K-9 Mail on Android.

There are four different use cases:
  1. Co-Worker sends me a meeting request:
    => I confirm in the same way using Outlook web access 2010 and GMail. This way I have to confirm two times, but don't have to recreate the appointment twice manually (and using wrong dates or times) so I can be sure they match. And just to see it in GMail I don't even have to respond to the meeting request because on arrival in GMail I can see it in Google Calendar.
     
  2. I have to create a private appointment:
    => I simply create this event in my private Google Calendar.
     
  3. I have to create a work appointment that is completely irrelevant to my private time planning (maybe just a time blocker or reminder):
    => Just create this event in my office Calendar (using Outlook Web access).
     
  4. I have to create a work related appointment:
    => Create the appointment in my private calendar and invite myself (send invitation to my work/office email address) and
    => confirm the incoming message with the Outlook web access.
    OR
    => Create the calendar entry in Outlook web access calendar and invite myself (send invitation to private email-address) and
    => Confirm invitation in GMail.
The remaining little annoyance with this solution is: As I usually use Thunderbird to access my Microsoft Exchange Mail account from the office, I need to switch to Outlook web access for confirming meeting requests.

Related posts: Outlook Calendar Meetings, Outlook 2010 Meeting Requests, Thunderbird and the Outlook global address book.

2013-01-13

Firefox and RSS feeds in Google Reader

Update: Google Reader will be closed down at July 2013 so this article is quite obsolete - read the newer article "Why RSS Feeds and alternatives to Google Reader".

However, here is the old story:

Lately I explained RSS feeds to someone and wondered why Firefox is not behaving the same way as on my machine when subscribing to RSS feeds. I did not remember what I exactly did on my machine to get it to work because it is so long ago that I created my profile for new that I first started searching the internet. Interestingly I could not get it to work so - back home - I investigated my own settings. Interestingly they do not match what I found on the net so I think it could be worth writing this article.

Preamble: Google Reader is an online RSS news reader that is also available for Android phones which is very fine when you (as I do) use your phone a lot to read news (for example while on the bus or waiting for it). What you read on your phone is synchronized with what you see when you are back on your laptop or PC. What I show here is how to get subscriptions with Firefox:

  1. Newer Firefox versions do not show the RSS feed symbol by default any more. - Right click next to your tabs or somewhere between your toolbars and choose "Customize...". Look for the "Subscribe..." button and drag it onto your toolbar (I have it next to the refresh and abort button).
     
  2. Type "about:config" into your url location bar and search for "feeds".
     
  3. Change "browser.feeds.handler" to "reader"
  4. Change "browser.feeds.handler.default" to "web"
  5. Change "browser.feeds.handlers.webservice" to "http://fusion.google.com/add?feedurl=%s"
  6. You might also need to change "browser.contentHandlers.auto.application/vnd.mozilla.maybe.feed" to "http://fusion.google.com/add?feedurl=%s"
  7. You might also need to change "browser.contentHandlers.types.0.title" to "Google"
  8. You might also need to change "browser.contentHandlers.types.0.type" to "application/vnd.mozilla.maybe.feed"
  9. You might also need to change "browser.contentHandlers.types.0.uri" to "http://fusion.google.com/add?feedurl=%s"
Now when you are on a site that offers RSS feeds the "Subscribe" button should be active (sometimes, when there are many different RSS feeds available on a site they are available through separate links on the site while the main RSS subscribe button is inactive so you might need to dig a little for the RSS  subscription link) - however in both cases you should get the option to put the RSS feed onto your iGoogle page or subscribe with Google Reader then.

Related post: Efficiently following web news with RSS, Why RSS Feeds and alternatives to Google Reader.

2012-06-22

Ubuntu 12.04 LTS Precise Pangolin - Optimized


Preamble:
If you are a recent Linux convert, just new to Linux or only a casual computer user, you don't have to worry: Whatever of the main Linux desktop distributions you are choosing (be it Ubuntu, Zorin OS, Linux Mint, Fedora, ... - whatever flavor of those) to use or try out - you are ok. The following is for power users who want to save clicks and mouse-miles to the absolute minimum required.

This article partly applies also for other distributions that offer compiz.


Introduction:
Since Ubuntu 11.04 which first introduced the new Unity interface for the main desktop instead of Gnome, I was testing many different Linux desktop alternatives because I worried about the future of the Ubuntu desktop. After testing several distributions (see preamble above) and all the main desktop environments including XFCE, LXDE, KDE, Gnome3+AWN, Gnome3+Cairo Dock I came back and settled with Unity on the current Ubuntu 12.04 LTS (Precise Pangolin) production work desktop. I do consider myself as a Linux Desktop power user on a daily basis at home and work and I focus on usability, efficiency and stability. On 10.04 I was experimenting with Gnome 2 plus AWN or Cairo Dock finding a more efficient desktop configuration. Basically I ended up with something similar to Unity. Except: I was doing hard work on configuration ending up with several small but annoying problems (including crashes of particular applets now and then).

Honestly, I find Unity on Ubuntu 12.04 (not so in the versions before) very stable and useful out-of-the box. There are still a few very first actions, but anyway far less post-install-configuration work than everywhere else (not to talk about Windows which is the OS with the most-post-install work ever existed).

First actions after install (applies to debian based distributions such as Ubuntu, Mint or Zorin OS):
  1. Click Settings/Power Icon in the right upper corner, then "System Settings"->"Appearance"->reduce "Launcher icon size" to 32. Default size is just too big to get most icons fully displayed that I need on a daily basis (ok this first one is only for Ubuntu users with Unity).
     
  2. Start Nautilus (Windows/Ubuntu/Super key + 1), move mouse to top of screen (new way to get to the active application's menu) and choose "Edit"->"Preferences" and change "default view" to "List View".
    And in tab "Display" I also change the date format to ISO (yyyy-mm-dd) - you might want to keep the default.
     
  3. Start Firefox and under "View"->"Toolbars" check "Bookmarks Toolbar".
     
  4. On the commandline (open a terminal):
    sudo apt-get install synaptic

    I now, there is a nice app store now - pretty fine for the normal user and even for me if I want to look around for interesting stuff. But I still like to see the original package names, have overview and full control about the repositories and the like. therefore I still like synaptic - in addition to what comes with Ubuntu.
     
  5. On the commandline (if on Ubuntu or other distribution with Desktop environment that offers/works with compiz):
    sudo apt-get install compizconfig-settings-manager compiz-plugins-extra

    That's for configuring my desktop to get the best usability and efficiency.
     
  6. Enable partner repositories:Press ALT+F2 and type synaptic then press Enter.
    In the menu select Settings->Repositories.
    Enable the partner and independent repositories.
    Close the sources dialog and on the synaptic main window click on the reload button (this is the same as the commandline "sudo apt-get update" - without the quotes).
     
  7. Managing passwords:
    It is always recommended to use different passwords on different sites where you register and login. After several registrations nobody can remember all the passwords. Therefore it is helpful to use a password manager. My current favorite is keepass2. It can be installed this way:
    sudo apt-add-repository -y ppa:jtaylor/keepass
    sudo apt-get update
    sudo apt-get install keepass2
     
  8. And then I install a lot of other tools - such as (on the commandline again - this is all one line):
    sudo apt-get install ubuntu-restricted-extras ubuntu-restricted-addons adobe-flashplugin ffmpeg vim cups-pdf gnome-utils thunderbird k3b p7zip-full gufw libdvdcss2 xdotool gthumb vlc shutter gtk-recordmydesktop openjdk-6-jre icedtea-plugin openjdk-7-jre grsync galternatives soundconverter winff asunder ogmrip thoggen k9copy google-talkplugin skype pidgin emesene mc htop traceroute secure-delete pdftk imagemagick rar unrar jhead what-utils ttf-linux-libertine ttf-isabella ttf-dejavu-extra ttf-inconsolata ttf-sil-gentium ttf-junicode ttf-rufscript ttf-radisnoir remmina remmina-plugin-gnome remmina-plugin-xdmcp remmina-plugin-nx freerdp-x11rem chmsee jxplorer mdbtools-gmdb nautilus-filename-repairer smbclient clamav clamav-freshclam clamtk libmotif4 curl network-manager-openconnect-gnome network-manager-openvpn-gnome network-manager-vpnc-gnome openconnect ttf-mscorefonts-installer acroread
    Note: You need to enable a few repositories before:
    #Adding medibuntu (all the next on one line)
    wget --output-document=/etc/apt/sources.list.d/medibuntu.list http://www.medibuntu.org/sources.list.d/$(lsb_release -cs).list && apt-get --quiet update && apt-get --yes --quiet --allow-unauthenticated install medibuntu-keyring && apt-get --quiet update

    #For Google-Talk-Plugin (2 lines)
    wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | sudo apt-key add -

    sudo sh -c 'echo "deb http://dl.google.com/linux/talkplugin/deb/ stable main" >> /etc/apt/sources.list.d/google.list'

     
  9. On Ubuntu with Unity? - Then these help:
    sudo apt-get install classicmenu-indicator lo-menubar unsettings myunity indicator-weather
     
  10. For the professional IT guys (continue on the commandline - again all one line):sudo apt-get install gparted dconf-tools gconf-editor gisomount bum vim-gnome gedit-plugins geany geany-plugins scite meld diffutils diffuse diffpdf gitg bless ghex build-essential xmlcopyeditor
     
  11. For the developers or server guys more might be highly relevant (on the commandline one line again):
    sudo apt-get install mysql-server mysql-client mysql-query-browser mysql-gui-tools-common mysql-admin pgadmin3 gsql
     
Enhanced usability:
Now - if you are on Unity or using a desktop environment with compiz - here are the tweaks to maximize usability:
  1. Start ccsm (e.g. Press ALT+F2 and type ccsm and press Enter). This is the compizconfig-settings-manager.
     
  2. Choose "Desktop Wall Plugin" under "Bindings" category and set "Move Left" to "Bottom Edge + Button 1" and "Move Right" to "Bottom Edge + Button 3. - That let you switch the desktop left and right easily with the mouse on the bottom edge.
     
  3. Still in "Desktop Wall Plugin" go to "Edge Flipping" and uncheck "Edge flip move" as well as "Edge Flip DND".
     
  4. Go back to main screen and select "Scale plugin". Go to "Bindings" and set the "Initiate Window picker" to "BottomRight" and/or "TopLeft".
     
  5. Go back and switch to "Application Switcher" plugin. Under "Bindings" choose for "Next Window" the TopEdge+Button 1.
     
  6. Set "Next Window (all Windows)" to "TopEdge+Button3".
Related posts: Locale configuration on Ubuntu, Firefox change default page format, OpenOffice and LibreOffice starts slow, Default paper size in Open Office, Normal.dot in OpenOffice or LibreOffice.

2012-03-12

Efficient desktop environment

I consider myself as a power user. Every day (and sometimes also nights ;-) ) I make intensive use of computers to get things done. Of course I am not a farmer - I am working in IT business. - However, intensive use of computers is by far not limited to IT people.

Of course, for people spending a major part of their time in front of a computer lousy software has a bigger impact on efficiency. While many people can live with the fact to reinstall their Windows PC every 6 months, I get angry when some of my most often used features take two clicks to much as it could be.

There are two major kinds of computer users: Those who are using one or two applications most of the time and those who use a larger set of applications. To the first group people belong who will respond to the question "Which operating system are you using?" with something like "Word - Microsoft Word". ;-) - While for the first group the underlying OS is of minor relevance, for the latter group of people using a bunch of applications, the underlying operating system can be a critical factor.

I am an Ubuntu user and in the Ubuntu world the last months were full of discussions about the new desktop environment developed by Canonical, namely Unity. Many argued about bad user experience. I myself did play around with a lot of additional components to bump up my desktop. I tested several dock components like Cairo-Dock, AWN and others. Although I finally did not use any of those due to other reasons (stability, performance or simply no time to tweak it to fit my needs perfectly), I had a quite nice configuration with Gnome 2 and AWN on my Ubuntu 10.04 machine. Surprisingly that configuration looked quite similar to Unity.

Many of my peers switched to Linux Mint which is Ubuntu-based but is going for a different strategy regarding desktop look and feel. If you like Ubuntu, but don't like Unity, you can either use "classic" Gnome3 or install Cairo-Dock which then offers an option to go with Classic Gnome + Cairo Dock right on login (at least starting with 12.04 beta 1) and I even managed to create an AWN session with the help of TuxGarage. (The example there is outdated - you need to look at your current ubuntu.session file and take this as a sample or look below in the comments on that post).

However I found - after testing a while - that Unity fits best for me - at least with the least effort to put into getting it efficient. Important from my point of view is that with mouse OR keyboard everything can be reached quickly, that includes: Virtual desktops, Launchers, Open Application Windows, Menus, File system.

Out-of-the-box Unity offers a lot of cool hotkeys, besides ALT+TAB for switching between open applications you can use ALT+^ to switch between open windows/instances of the same application or after ALT+TAB you can collapse and expand application windows with the UP/DOWN keys. Pressing and releasing ALT offers the HUD menu (F10 still brings you to the normal menu). STRG+ALT+LEFT/RIGHT switches between virtual desktops. The only thing I immediately missed was a quick way to switch desktops with the mouse. My former way of configuring this was installing compizconfig-settings-manager and configuring desktop wall accordingly to switch to next and previous desktop doing a right-click on the left or right edge on the screen. That does not work any more when Unity is active on the left. I did not change that to now use left and right mouse button on the bottom edge and that works. In addition to that I reduced the icon size to 32 (can be done using compizconfig Unity plugin, installing MyUnity or also via commandline).

People who don't like Unity have different reasons but one might be the dock-style (which even Windows adopted later). The dock with launcher and window list in combination has one big advantage: The icons are always on the same position - no matter in what order you launch them. This is essential if you open a lot of applications during the day and end up in continously searching your app windows. Although I used to hate window grouping, Unity behaves differently whether you click on a different application launcher or not - which I found reduces necessary clicks.

These and a few other things I missed in all the other desktop environments - like e.g. configuring different times - not just one (I like to see New York or other time zones when clicking on the clock). Although other dock components have a lot more customizing options and features, I find Unity simpler and I found minor bugs in Cairo-Dock and AWN which resulted in my decision that I do not want to bother with finding my own fully customized X-Session and then probably experiencing more troubles. Would have tried longer if I would have found Unity unacceptable. But: After all my tests I still find Unity the best.

I definitely find that the time of a classic task bar (as known from Windows XP, KDE, XFCE or LXDE) is over - mostly because of the unsure icon position in a classical taskbar and the fact that the first thought always needed to be: "Did I already start this or not?" - depending on the answer a different icon had to be clicked. And even on larger screens it is annoying to waste screen space with additional panels (quickstart and windows). My attempts to get a combination of XFCE or LXDE with Cairo-Dock or AWN working well together failed because I either had some crashes, or too many panels remaining. BTW: XFCE comes with a bottom launcher which only is set to autohide by default.

There are still a few things I would like to see in Unity - like easier configuration of the unity launchers or including a classic Gnome menu launcher by default, but I think that Unity is on a good way - I got familiar with it quite fast and so new users will, I think. Of course many people find many things to tweak after a first installation of Ubuntu. I probably will come up with my one set of tweaks after the final Ubuntu 12.04 LTS came out...

Related posts: Popular Ubuntu desktop myths, Why companies do not use Linux on the desktop, Ubuntu 12.04 LTS Precise Pangolin optimized.

2011-10-28

Virtualbox vmdk image to vdi

One of my VirtualBox virtual machines used the vmdk disk format (From VMWare). Somehow it seemed to be slower than another machine I had running in VDI format (default for VirtualBox >= 4.0).

I had to search the internet a while to find the right solution and it was not complete, so here is my description on how to migrate the virtual machine disk format from vmdk to vdi:

cd <folder where your disk image is>
vboxmanage clonehd somename.vmdk somename.vdi --format VDI

That takes a while. After finished you need to start virtualbox and go into the settings of your virtual machine. Under "Storage" you will still find the old HD file attached to SATA (or IDE) controller. Remove the old one and attach the new .vdi file.

Try starting the virtual machine to see if everything works as intended.

Then shutdown your virtual machine, go to File->Virtual Media Manager and remove the old vmdk file even there. Now you can delete the .vmdk.

2011-10-04

Failed user lock-down

Have been on a Citrix Windows 2008r2 server machine where the admins really tried to lock down everything.

The other side is: Some stuff is not working well and I do not wonder because I am pretty sure that a lot of features that have been disabled are required by several pieces of software.

And the funny thing is: You can't really lock out the user on Windows - just to show one simple way to open the command prompt if disabled:

  1. Start Microsoft Word
  2. Press ALT + F11
  3. Press CTRL+G
  4. Type: vba.shell "cmd.exe"
  5. Press Enter
  6. Voila here it is the commandline window.
In the particular case C: drive was disabled and command prompt -  now everything is at hand form the command prompt. You can either try:
vba.shell "explorer C:\Windows"
works either. :-)

2011-10-03

Smart Backup on Linux

About two years ago after setting up a Linux server I was asked to create a backup of the last seven days. Reason for this was the idea that if something gets deleted or corrupted it might not be noticed immediately.

The problem was: The hard disk did not have enough free space to hold 7 times the data and at the moment there was no external hard disk available.

I searched the Internet and found a really smart solution - you can find details here on mikerubel.org (rsync snapshots). My final script looks like this:

 #!/bin/bash  
 rm -rf /data/autobackup/backup.7  
 mv /data/autobackup/backup.6 /data/autobackup/backup.7  
 mv /data/autobackup/backup.5 /data/autobackup/backup.6  
 mv /data/autobackup/backup.4 /data/autobackup/backup.5  
 mv /data/autobackup/backup.3 /data/autobackup/backup.4  
 mv /data/autobackup/backup.2 /data/autobackup/backup.3  
 mv /data/autobackup/backup.1 /data/autobackup/backup.2  
 cp -alv /data/autobackup/backup.0 /data/autobackup/backup.1 > /data/autobackup/0to1.log  
 rsync -av --delete /data/live/ /data/autobackup/backup.0/ > /data/autobackup/last-rsync.log  


If you want to go more into detail - Michael Jakl has posted a variant here (rsync time machine).

Currently in my use case the live part takes 149GB and the whole backup of 7 days takes 161 GB (instead of more than a TB!)

I know, disk space is quite cheap, but the rising amount of data also requires a lot! - In my case:
  1. I already have several external drives (2 HDs where HD images of my work notebook are saved alternating).
  2. Two separate external drives where data only is saved with rsync (to one disk more often to other about once in two months).
  3. I have a 500GB external HD where data is outsourced that I do not need that much or simply consumes too much of my primary HD. That one was not saved in the early times. In the meantime I do sync it to a second one from time to time (people have a lot of external HDs these days but I am not sure if they backup those too...).
Guess what, if I would decide to keep snapshots of several days - way too much for a normal copy x7!

2011-09-22

Google Maps issues

A while ago I had problems using Google Maps - I had a slow loading issue which ran into an error.

I found a discussion about this problem where many people were angry at Google because they don't fix this problem.

I found out that the problem was due to my browser security plugins Adblock Plus and NoScript. At least one of those (I think it was NoScript) was blocking the site gstatic.com (and google.com of course or at least maps.google.com). No need to completely disable (which was mentioned also in the discussion), just whitelist relevant sites in those plugins (Check site media information to see loaded images for example).

Some other people mentioned different reasons causing the same problem like:
  • Check your orther privacy or security plugins for blocking maps.google.com or gstatic.com
  • Delete cookies for maps.google.com as well as all temporary internet files (clear cache).
  • Skype extension for Firefox causing the problem.
  • DNS problems (that usually temporarily - to separate this reason from others check availability of maps.google.com and gstatic.com using nslookup and check if it works using a different browser without any plugins - if both works then DNS is not the reason for your problem).
  • if2k (if on Mac).
  • Badly written router firewalls (try deactivating IPv6).
  • Turn off inprivate filtering (if on Windows IE).
  • Windows only: Uninstall Java and reinstall launching as Administrator (Win 7).
  • Your mobile web service provider might have implemented an accelerator reducing image quality - check and turn off on the provider's website.

I am posting this because there were many responses to this and still some are posting without reading the earlier answers offering solutions and it seems that plenty of people experiencing problems with google maps.

2011-09-21

Normal.dot in OpenOffice or LibreOffice

Some time ago I was asked where the normal.dot is in Open Office and I was stuck. I don't open the writer and write. I have copied all my templates to ~/Templates. The first action I take when I want to create a new document is to go in the folder where I want to save it, click the right mouse-button, hover on "Create new document" and choose the template of my choice. That way I neither have to think about what type of document (text, graphic, spreadsheet) my template needs to be.

However, most people are just used to just firing up MS Word or if they are on Windows with Open Office they miss the nice template folder and to create a new document from a template within Open Office for me is definitely too many clicks away (3 clicks and 2 double-clicks).

When I was asked for the "normal.dot" I searched a lot and I searched the internet to finally find out, that it is described very well in the Open Office help:

To Create a Default Template
  1. Create a document and the content and formatting styles that you want. 
  2. Choose File - Templates - Save.
  3. In the New Template box, type a name for the new template
  4. In the Categories list, select "My Templates", and then click OK.
  5. Choose File - Templates - Organize.
  6. In the Templates list, double-click the "My Templates" folder.
  7. Right-click the template that you created, and choose Set as Default Template.
  8. Click Close.
It's the same in LibreOffice by the way.

Related posts: Default paper size in Open Office, Firefox change default page format, Locale configuration on Ubuntu.

Default Paper Size in Open Office

Under Linux (or at least under Gnome or Ubuntu) we already had the issue with default paper size in Firefox. Now on my older Ubuntu 10.04 workstation where I have not yet upgraded from Open Office to LibreOffice my wife has a permanent problem with wrong default paper size when using Open Office.

I have examined the situation and found out that in Ubuntu system administration under Printing the default paper size has not been set to A4. OK, but didn't help for OpenOffice.

Finally I gave up finding the problem and started to google. After a while I found a blog entry at "Starry Hope": OpenOffice Default Paper Size for Printing - here the important part:
1. Change the default paper size in /etc/papersize
This is the first place to look and solved the problem most of the time. Simply edit /etc/papersize and change “letter” to “a4″ then restart OpenOffice.


2. Check for settings in ~/.cups
In some cases, CUPS saves printer settings for individual users in their home directory (don’t ask me why). If you see a .cups directory in your home directory, open it and see if “Letter” isn’t set as the default paper size in there. (In my case, I just deleted the .cups directory all together).

3. Check for poorly formatted PPD files
Check the PPD file for your printer in /etc/cups/ppd/ to see if it has errors. Apparently, some PPD files are incorrectly formatted and cause an error. This problem is most commonly discussed in relation to Brother printers. You can find more info in this bug report. - Seems to be fixed.

4. Change DefaultPageSize in SGENPRT.PS
It appears that OpenOffice gets its default media size for some printers from the DefaultPageSize line in the /usr/lib/openoffice/basis3.2/share/psprint/driver/SGENPRT.PS file. More info here.
In my case indeed, changing "letter" to "A4" in /etc/papersize already solved the issue - thanks so much!

Related post: Firefox change default page format, Normal.dot in OpenOffice or LibreOffice.

2011-05-24

OpenOffice and LibreOffice starts slow

Sometimes there can be even annoying problems with Open Source software.

A few days ago I got annoyed by OpenOffice starting slow. Then I decided to switch to LibreOffice and first thought it helped. Then a day after it was slow again.

Finally I found out that it starts slow whenever I have the VPN connection open (using SonicWall NetExtender).

After searching the internet a lot without finding anything that helped I landed at LinuxQuestions at this thread: http://www.linuxquestions.org/questions/linux-software-2/double-clicking-on-open-office-files-leads-to-very-slow-opening-808048/

Running
sudo tcpdump -nnl -i any -s 1536 dst port 53

on the commandline discovered that LibreOffice was searching for .(none) via DNS and the VPN inserts it's DNS servers right in front of every other DNS entry in /etc/resolv.conf - grmpf!

So similar to what is mentioned in the thread above, I had to add
127.0.0.1    myhostname.(none)

to the file /etc/hosts - done. This and some other small, but annoying changes in reality need to be done at each install of a new system. - Of course, there are even more of those annoyances on Windows, but it seems you can't get rid completely of those... :-(

Related posts: Ubuntu 10.04 & docking station part 1 + part 2, Locale configuration on Ubuntu, Firefox change default page format.

2011-04-22

Thunderbird and the Outlook Global Address book

As I mentioned in an earlier post, I have switched job and while I initially had to use the Outlook Web Access (OWA) in the version of 2010 to access my mailbox. At this point I want to be fair and say: Microsoft really improved the web client. You can work with it. I prefer that interface over several others (Hotmail/Live). The other option was to use the real Outlook over a terminal server session or using a virtual machine. I tried both (in version 2007 and 2010) too so I have used all variants. The result is: Outlook still completely sucks! I talked to other people who ever used something different than Outlook in their work (e.g. Thunderbird or Notes) and everybody confirms, that Outlook sucks. People often wonder why I have problems with Outlook when "the whole rest of the world" is fine with it. The reason is: Most people don't know anything else and they got used to suffer. But enough, I want to help out everybody who is in the lucky situation that IMAP protocol got activated in their Exchange branded workplace (in my case they activated it just for me :-) - this is cool). I tried several alternatives for directly accessing the Exchange server without success and I could not occupy the internal IT for hours to figure out, what goes wrong. Opening up the IMAP protocol was the simplest and straight-forward-option.

So I can use the loved Thunderbird again!

But opening up the IMAP is only half the way. You also need to get access to the address book. And here I ran against brick walls in the first step:
  1. Trying to open an LDAP address book pointing to the Exchange server failed in getting no connection (neither port 389 nor 3268 worked).
  2. I figured out the AD (Active Directory) server of the Windows world and used that. It connected immediately to port 389, however then had problems loading the contacts. As I know now, it is a matter of filtering to the correct entry set. However, after failing continously during my first attempts I tried
  3. exporting the global address list from within Outlook into ... well ... anything, I was about to even accept any CSV file, however styled. Completely failed in that too - you can export contacts but not the global address list. You can imagine how happy I was...
Fast forward to my final solution which now supports
  • directly using the global address book via LDAP directly from the server or
  • use a local copy (export+import which you need to do manually from time to time to be up-to-date).
How it is done:
  1. Get the Apache Directory Studio or another LDAP browser tool of your choice that supports an LDIF export. In the Apache Studio case, just extract the package and start it (yes, it's that simple, it's a Java application that runs on Linux and Windows). You need this to first test your LDAP access, if you are not sure about the correct criteria.
  2. Now you need to find out where the AD is hosted. In my case I promised not to ask boring questions to IT (they were already nice enough to open up the IMAP just for me), so I had to find out on my own. I simply checked in to the Terminal Server Session and wrote a little batch file (directly going to the console is forbidden in the terminal server session due to security policies) of the content:
    set
    pause

    and just double-clicked it to find the entry "LogonServer", "UserDNSDomain" and "UserDomain".
  3. Now start the Apache Directory Studio and create a new LDAP connection. The connection parameters would be something like:
    hostname=fulldnsmachinename

    (using the information from LogonServer and UserDNSDomain, so e.g. "myserver.mycompany.com").
    Port = 389

    (default LDAP port).
    Logon with UserDomain\yourUserName and your password.
    Click on "Fetch base DNs" to find out the base DN to use - or guess it, it usually is:
    dc=yourCompany,dc=internetsuffixlikecomnetorgetc

    so for example dc=microsoft,dc=com.
  4. Now you would find a lot of stuff browsing through the AD (assuming you have enough read permissions). To find the entries that are displayed in the Outlook address book, you need to filter the information. To do so, create a new search using the base DN above and the following search filter (click on "Filter Editor..." for better formatting):
     (&
    (showInAddressBook=*)
    (mail=*)
    (mailNickname=*)
    (|
      (objectClass=person)
      (objectClass=group)
      (objectClass=groupOfNames)
    )
    )

    Here is the filter again as one-liner - this is how to use it in your Thunderbird:

    (&(showInAddressBook=*)(mail=*)(mailNickname=*)(|(objectClass=person)(objectClass=group)(objectClass=groupOfNames)))

    In the Apache Directory Studio you can now set the option to "Follow referrals manually" or ignore them completely. Leaving it to automatic can produce errors - especially if AD not well configured (in my case loops are generated when automatically following all referrals). Search scope should be the complete subtree. Check the results by executing the search.
  5. Start Thunderbird and create a new IMAP account (if you didn't already) and create a new LDAP address book (Tools-Address book; File-New-LDAP Directory). Enter Hostname, Port, Base DN as in step 3 and in the "Advanced" tab choose subtree and enter the one-liner version of the filter as in step 4.
    Now you have the direct access version. You now could change settings in Thunderbird (Edit-Preferences-Composition-Addressing) or even configure it for a single account (under Composition and Addressing) to use the LDAP directory for autocompletion, but I found that to be annoying because of the slow Exchange server in my particular case (YMMV). Hence I did not do this but pressed F9 in a new mail to show the contacts sidebar. There I switched to the LDAP address book and can now search and choose addresses if they are not already among my collected addresses. This is BTW the same you get, using Outlook - only those addresses, you already used get auto-completed and the others you need to search manually. A second annoyance is that Thunderbird takes a longer time to really disappear from memory when the LDAP search was used during runtime. So I was not really satisfied with that solution.
  6. Just for performance and to have all autocompleted, I wanted to have a local copy of the address book. I found that the Apache Directory Studio offers an LDIF export feature, which is really the best you can get. Even phone numbers and other properties from the LDAP directory finds the way into the imported address book in Thunderbird. Just right-click the search (it's in the tree on the left-hand side) and choose "Export-LDIF" from the context menu within the Studio and in Thunderbird you go to "Tools-Address Books" and choose "Tools-Import..." - done.
Now you have both - full autocompelete and you can actively search the current LDAP at the server for the case new employees joined the train without the need to export-import all the time. However from time-to-time it makes sense to do a re-import just to have the current entries in the local cache. Fortunately the search is saved in the Apache Directory Studio for later reuse. Thanks to the Apache team for this great piece of software!

Oh, BTW: The local download of the LDAP directory did not work for me (it started but never finished - maybe because of the internal loops).

Hope this helps!

Related posts: Ignorance of the different, Popular Ubuntu Desktop myths, Apple worse than Microsoft, Outlook Calendar meetings, Maintaining multiple calendars.

2010-12-16

Ubuntu 10.04 & docking station part 2

As you might already know, I am using my Ubuntu laptop also with a docking station and external monitor. When I am in the office I dock it in leaving it closed and use only the external monitor (that is by the way a behaviour I can see at several customers also - having no fixed machine any more and dock in the closed notebook).

I had an issue I already described earlier - see part 1: Ubuntu 10.04 with docking station.

Since then I had several issues of having TV1 noticed by accident even when doing nothing or same with my internal laptop screen (LVDS1) when I am working with the external monitor only. The annoying things are three when this happens:
  • I can accidently move the mouse out of the window taking a while to bring it back.
  • In my compiz I have defined that right-clicking on the border of the screen switches to the next desktop. That does not work any more as the border is not reached when I move the moust to the border of the visible screen.
  • Windows may be displayed on the invisible part of the screen so I have them in the task bar but don't see them on screen.

Now I am pretty sure that it is the screensaver that is the culprit here. Disabling the screensaver never brought the issue back again. Only drawback: When I leave the machine I manually have to lock the screen pressing CTRL+ALT+L.

Same thing of second monitor accidently recognized happened in about 75 % when starting TeamViewer (which is my favorite remote assistence tool). Today I finally filed a bug and guess what - problem already solved (thanks to Daniel Stiefelmaier at TeamViewer support)!
Dear Martin,

I found a possible solution to that. Please open a console and run
WINEDEBUG=xrandr teamviewer&
Then take a look at the log:
cat ~/.teamviewer/6/winelog
You should see some xrandr lines. Then run
/opt/teamviewer/teamviewer/6/bin/.regedit
Create the key HKEY_CURRENT_USER\Software\Wine\X11 Driver
there, create a String "UseXRandR" and set its value to "N".
Close the registry, and repeat the other commands:
WINEDEBUG=xrandr teamviewer&
cat ~/.teamviewer/6/winelog
Now, there should be no xrandr lines.
Yeah, that did it!

Related posts: Ubuntu 10.04 with docking station (part 1), Ubuntu 10.04 experiences, OpenOffice and LibreOffice starts slow.

2010-10-18

Locale configuration on Ubuntu

OK, first I was annoyed that changing the date format to ISO (yyyy-mm-dd) is not so easy on Ubuntu as it was on Windows. Yes, but - as usual in the Linux world - you are much more flexible on Ubuntu.

I am a special case: I want my menus and environment in english, I am located in Austria (so I want currency in Euro, thousands separator is dot and not comma, ...) but the date format I like to have in ISO format (and not the german default dd.mm.yyyy) because I find the ISO format simple the most practical (well, I am working in IT and the ISO format is the best to sort if you have just plain text). Under Windows I had a german OS (because I needed to support mostly users with german version) and changed the date format in the international settings.

Situation under Ubuntu is different: You install an english base system and install whatever languages you like through:
  1. "System - Administration - Language Support"
  2. Click "Install/Remove languages..."
  3. Choose the language(s) you want to support - every user can choose the language he/she likes at login (last used language is remembered as preselection).
  4. In the "Language for menus and windows" list you can drag and drop languages to specify priorities. The language the user chooses at login is taken first of course, but usually the language dragged to first place here is the default for new users. Attention: When installing a new language, it is usually put on top and somehow the system tries now logging in all existing users with that language (if they don't change it at login) - so doing changes here overwrites the last remembered language for the users. This behavior might be desired or not...
  5. In the text tab you can change the country you are in (this is similar to the Windows international settings - but you can't override parts of the country settings here.
So first, I found that I have less options than under Windows - until I discovered these options that you can set in your /etc/default/locale (a plain text file):
 LANG="en_US.UTF-8"  
 LC_CTYPE="en_US.UTF-8"  
 LC_NUMERIC="en_US.UTF-8"  
 LC_TIME="en_US.UTF-8"  
 LC_COLLATE="en_US.UTF-8"  
 LC_MONETARY="en_US.UTF-8"  
 LC_MESSAGES="en_US.UTF-8"  
 LC_PAPER="en_US.UTF-8"  
 LC_NAME="en_US.UTF-8"  
 LC_ADDRESS="en_US.UTF-8"  
 LC_TELEPHONE="en_US.UTF-8"  
 LC_MEASUREMENT="en_US.UTF-8"  
 LC_IDENTIFICATION="en_US.UTF-8"  
 LC_ALL=  
So you can really define the behavior of plenty of formattings!
The content of my etc/default/locale is now (LANG and LANGUAGE was set when I changed settings in the GUI, LC_DATE and LC_TIME I have added manually:
 LANG="de_DE.utf8"  
 LANGUAGE="en"  
 LC_DATE="en_DK.utf8"  
 LC_TIME="en_DK.utf8"  

I have added LC_DATE myself (just a wild guess because it is not mentioned in the list above - which I found on the internet), for Thunderbird for example LC_TIME was sufficient.

Probably this obsoletes post "Firefox change default page format" (but did not check).

Related posts: Firefox change default page format, OpenOffice and LibreOffice starts slow, Default paper size in Open Office, Normal.dot in OpenOffice or LibreOffice.

    2010-09-26

    Install NetBeans on Ubuntu 10.04

    Why should one do a description of installing NetBeans on Ubuntu - it's in the repositories and just a few clicks?

    The reason is: Installing it through the repositories you will get problems later when trying to upgrade NetBeans with the builtin-update tool. Apart from this I prefer to download the full package from http://netbeans.org/downloads/index.html and deactivating the modules I do not need - at the moment. I always make sure that the sun (or now Oracle) JDK is installed (there were problems in the past with OpenJDK - and although they should be solved I still go with the Sun/Oracle one.

    Preparations:
    • You can install the Sun/Oracle JDK through the repositories or do the manual install.
    • To make sure, the correct Java is used, install galternatives (then available through Applications-System Tools-Alternatives Configurator) and then go through each item in the list on the left. There are quite many Java related tools that - after installing the Sun/Oracle JDK now offer that one as second alternative. For all the Java related tools select the new alternative from Sun/Oracle JDK.
    • If you manually installed new JDKs - e.g. after an update has been released, you might have to change the symlink accordingly at /usr/lib/jvm/java-6-sun using the ln command, eg:
      cd /usr/lib/jvm
      sudo ln -s java-6-sun-1.6.0.20 java-6-sun

    So here are my steps for the NetBeans installation:
    1. I create a folder under opt for NetBeans:
      sudo mkdir /opt/netbeans
      I don't use the profile folder for installation because this reminds me too much of Windows. In the profile folder there should only go data and I backup this folder more often than other ones. It does not make sense backup the programs all the time.
       
    2. Then I set the permissions for the normal user:
      sudo chgrp theuser /opt/netbeans
      sudo chmod ug+rwx /opt/netbeans
      If you want to have more users work with NetBeans then replace theuser with a group that all the users are member of - however this solution is only if you trust those users regarding updating and activating plugins etc. Otherwise install as a user with sudo permissions and do not set the permissions above to prevent other users from updating.
       
    3. Then I install all NetBeans components (running the installer as normal user) in that folder (/opt/netbeans). There will be usually a subfolder for netbeans (including version in the folder name) and also for Tomcat and Glassfish.
       
    4. I also extract the javadoc downloaded from http://www.oracle.com/technetwork/java/javase/downloads/index.html into /opt/netbeans as jdk-6-docs or so. In former times I put it under the jdk folder but as I upgrade the JDK itself more often than the documentation this always needed additional work to move the doc to the new folder or change links when they got broken after deleting older javadoc.
       
    5. To make the javadoc available in NetBeans launch NetBeans and go to Tools-Java Platforms, switch to the javadoc tab and add the javadoc root folder - in my case /opt/netbeans/jdk-6-docs.
       
    6. When I add external libraries (Tools-Libraries) I also save/extract them previously to another folder - not within my profile (for reasons I mentioned earlier) - of course an option would be /opt/libs or so - I have a completely different separate folder for shared data and libraries that I backup from time to time (less often than profile data).
    Related posts: The IDE and the libraries, The programming language.

    2010-09-10

    Shell scripting your desktop windows

    In Java my limits are often what is offered in every OS - and what is inside the JVM.

    One thing, I often needed in the past under Windows is to get the title (or other information) of the active window. I was using Windows API to get the information needed. Under Linux/Ubuntu things are different - and more complicated due to different desktop environments, I thought. And how to access those APIs with Java?

    Well, it turned out, that I am completely wrong and once again was trapped in my old habits from Windows.

    Linux offers commandline tools - not only to get window information - no, also to manipulate windows, move them to different desktop etc. As I could start an application on a different machine and showing the window on my machine, I can either see the machine name in window lists. A commandline program can be easily used from within Java and output can be retrieved easily. Awesome!

    It again turns out, that Microsoft Windows is totally poor in commandline tools. However, I could implement a similar small exe that gets me the active window title through API on windows and does console output that can be retrieved by a Java application or can be used in batch files.

    If you are a Linux user, have a look at the following commands:
    • wmctrl
    • xprop
    • xwininfo
    All these tools can be used even from within shell scripts - awesome!

    With xprop -root you get exhaustive information about windows.
    Using xprop -root | grep _NET_ACTIVE_WINDOW\(WINDOW\) you get the active window handle. You can then use the address in wmctrl -l | grep theaddress. The only quirks is that in wmctrl the address might have an additional 0 after 0x so you should search for the part after 0x only in the output of wmctrl.

    2010-08-05

    Screencast recording on Ubuntu 10.04 (and 9.10)

    Creating screencasts is not only modern - often a short 2-minute video can be more helpful as a 2 page documentation.

    There are two major screencast recording tools available in Ubuntu. That said, I always had troubles with them because I do want sometimes different behaviour or I had issues with the sound. I want to give a very short overview to make it more easy for you to choose the right tool in the right moment and to get the output you want:
    • gtk-recordmydesktop
      +
      Very easy interface
      + Works out-of-the-box
      - Option to follow mouse available and keeps the mouse always in the center of the frame (I think, this disturbs, when watching the video).
      - Cannot export/save as MPEG-4 or AVI or anything else - just .ogv (the open format)
       
    • XVidCap
      + Can produce different formats (MPEG-4 is the default, but you can switch to .ogv also)
      + Option to follow mouse available and keeps the frame steady until you move the mouse near the frame border (this way it is more easy for the user to follow the video instructions - you should only make sure that the border of the video is not to near to your primary working area otherwise you get a similar effect as with gtk-recordmydesktop)
      - The GUI is slightly less intuitive
      - Using the package from the Ubuntu 9.10 or 10.04 repository does not bring you sound support (at least not when trying to create MPEG-4). You have to install the .deb package manually by downloading it from sourceforge (current version is yet 1.1.7 - although the same version seems to be in the repository, that is a different one and does not work - strange, but fact).

    I basically use both applications. When I produce local screencasts for end-users that I just save on their local machine for later reference I use gtk-recordmydesktop and just leave it as ogv. That used to work even when Skype + TeamViewer is running and I did the recording remotely. It even recorded my sound coming through Skype! When I want to upload a video to YouTube (or vimeo and others), XVidCap is better because it immediately produces MPEG-4 which fits better for YouTube and similar services (I tried uploading an ogv file from gtk-recordmydesktop to YouTube which failed to replay correctly - indeed it is not mentioned on the appropriate help page).

    Especially for the case(s) you prefer gtk-recordmydesktop you might need to convert the created video to the finally desired format. I have seen many ways (reading blog posts and watching screencasts), e.g. using WinFF, VLC Media Player and using Devede. Using Devede was the only one that worked for me (see http://vodpod.com/watch/3665200-converting-your-ogv-files-to-mpeg4-).

    In any case you should have the ubuntu-restricted-extras installed (using synaptic package manager or sudo apt-get install ubuntu-restricted-extras) for doing video or audio stuff. I would also install ffmpeg.

    I also usually have to put the sound input to a high level otherwise when replayed on several machines (e.g. notebooks or external monitors with poor speaker power), even putting the volume to highest level brought only low level sound.

    Final note: It might be necessary to quit Skype (if you have it running) to avoid sound or video juddering.

    Related post: Ubuntu 10.04 with docking station.

    2010-08-02

    Ubuntu 10.04 with docking station

    After installing Ubuntu 10.04 I lost proper dual monitor handling for my use case. Basically I want to use my notebook on the road as is and in the office I want to put it into the docking station while having the lid always closed.

    Ubuntu 10.04 Lucid Lynx does not handle this properly any more. I found out that also in 9.10 it was probably pure luck for me because I upgraded from 9.04 and had some fixed entries in the xorg.conf.

    But anyway, the xorg.conf file is legacy and there is now gdm with xrandr.

    I found out that many have the same use case as I have and have problems. Some solutions are particular to NVidia cards, but I have an Intel. Thanks to Nylex in the Linuxquestions-Forum + Ubuntu XOrg documentation, I could find the solution:

    I had to put this into the file /etc/gdm/Init/Default before the line starting with /sbin/initctl (why the TV1 is there also look below in update 3):
    xrandr | grep "HDMI1 connected "
    # 0 is returned on success
    if [ $? -eq 0 ]; then
    xrandr --output HDMI1 --mode 1680x1050 --rate 60 --primary --output LVDS1 --off --output TV1 --off --output VGA1 --off --output HDMI2 --off --output DP1 --off --output DP1 --off --output DP2 --off --output DP3 --off
    else
    xrandr --current | grep "VGA1 connected "
    if [ $? -eq 0 ]; then
    xrandr --output VGA1 --mode 1680x1050 --rate 60 --primary --output LVDS1 --off --output TV1 --off --output HDMI1 --off --output HDMI2 --off --output DP1 --off --output DP1 --off --output DP2 --off --output DP3 --off
    else
    xrandr --current | grep "TV1 connected "
    if [ $? -eq 0 ]; then
    xrandr --output LVDS1 --mode 1440x900 --rate 60 --primary --output HDMI1 --off --output TV1 --off --output VGA1 --off --output HDMI2 --off --output DP1 --off --output DP1 --off --output DP2 --off --output DP3 --off
    fi
    fi
    fi

    What it does is: Using xrandr it probes whether an external monitor is attached (whether HDMI or VGA) and if so it turns off the LCD display of the laptop so it is not used. You need to adapt the resolution to fit your needs.

    [Update]
    I had some cases when (maybe because of timing at startup) it did not work (sometimes it worked after gdm service restart then but not always) added --preferred and --primary to the xrandr call above and I added the script below to System->Preferences->Startup applications:
    #!/bin/sh
    xrandr --current | grep "HDMI1 connected "
    # 0 is returned on success
    if [ $? -eq 0 ]; then
    sleep 5s
    xrandr --output HDMI1 --mode 1680x1050 --rate 60 --primary --output LVDS1 --off --output TV1 --off --output VGA1 --off --output HDMI2 --off --output DP1 --off --output DP1 --off --output DP2 --off --output DP3 --off
    else
    xrandr --current | grep "VGA1 connected "
    if [ $? -eq 0 ]; then
    sleep 5s
    xrandr --output VGA1 --mode 1680x1050 --rate 60 --primary --output LVDS1 --off --output TV1 --off --output HDMI1 --off --output HDMI2 --off --output DP1 --off --output DP1 --off --output DP2 --off --output DP3 --off
    else
    xrandr --current | grep "TV1 connected "
    if [ $? -eq 0 ]; then
    sleep 5s
    xrandr --output LVDS1 --mode 1440x900 --rate 60 --primary --output HDMI1 --off --output TV1 --off --output VGA1 --off --output HDMI2 --off --output DP1 --off --output DP1 --off --output DP2 --off --output DP3 --off
    fi
    fi
    fi


    [Update 2]:
    It still did not work 100%. Sometimes when I moved the mouse outside the desktop it was gone so I found the laptop monitor being still active (so I could move windows over there and they were gone). I could immediately notice that after login when the workspace icons on the bottom right were displayed with increased width. It helped, explicitly turning of LVDS1 display (the laptop screen) in the script (see appropriate options in the updated script above).
    [Rest of update 2 removed because of update 3]

    [Update 3]:
    It turned out that (occasionally) on boot it recognized another monitor to be active, after first being the LVDS1 it happened also being the TV1 (occassionally) - and I don't know why because I never attached a TV to it. Anyway, I have added the options to turn that off explicitly also to the scripts (see updated gdm default script portion and startup script above).

    Apart from that sometimes occassionally a re-evaluation of available displays might be triggered by an application (e.g. opening and closing the laptop lid or manually calling xrandr without parameters or starting arandr or other applications when started the first time). Such a re-evaluation can also occur right after graphical login and then your initial gdm xrandr modifications are forgotten. Therefore it helps having that script at hand (I have it in /opt) and added to the gnome menu under "Other" to run it when necessary on demand.

    Apparently also a timing issue remained (I assume that because of the fact, that the startup applications are started in no particular order and all asynchroneously). However, adding a line with "sleep 5s" to the script (only to the additional script and not to the gdm init!!!) helped. I currently use a 10 seconds delay (subject to change maybe) but in your case less might be sufficient or more might be required (for me 5 seconds was not enough to make it work each boot).

    For you it might be necessary to switch additional displays explicitely off (as I did with TV1 for example).

    Oh, and BTW:
    In System->Preferences->Power Management make sure that lid closed action is "Blank Screen". I made a lot of tests with setting to nothing (only possible via gconftool-2) but after all maybe the above setting is the better one.

    If in your case the resolution(s) are not set correctly you can do this here in this script also. Use man xrandr or look at https://wiki.ubuntu.com/X/Config/Resolution#Adding%20undetected%20resolutions for more information on the appropriate xrandr commands.
    I noticed some flickering and login screen displayed in lower resolution, so I added --mode 1680x1050 to the xrandr call in both cases (in both scripts) which is the resolution of my external monitor.

    Honestly, using this script, I feel better than previously on Ubuntu 9.04 or 9.10 where I got it to work by accident after moving around monitors in the config (although in reality they were positioned the other way round). As I found out today, I wasn't either the only one with that experience (see http://ubuntuforums.org/showthread.php?t=1110407) although I am used to be the non-standard user. - With my use case of having the lid closed all the time when in the docking station I am by far not alone as I noticed and some either downgraded to 9.10 because they did not get it to work.

    Many, many thanks again to Nylex and the Ubuntu documentation team!

    Related links:
    Related posts: Ubuntu 10.04 with docking station part 2, Firefox change default page format, Ubuntu 10.04 Experiences, OpenOffice and LibreOffice starts slow.