sabato 7 agosto 2010

Problem with Google Images and Firefox 3.6.8

EDIT: Solution here.

In my holidays house I cannot search Google Images. Recently Google changed the design of its image search engine and I have been experiencing a problem with Firefox and other browsers on Ubuntu and Windows.
If I try to search Google Images, Firefox hangs loading the results, no image is shown at all and Google related sites are unreachable for a little while (it's still possible to browse other sites) :



I think it's impossible to revert Google Images to its old design, so I  thought to use Google Mobile to search images because I can browse it with my smartphone without problems.
It's quite easy to use Google Mobile to search images: we can use a string formatted in this way:

"http://www.google.com/m/search?site=images&q=" + search terms

for example:

http://www.google.com/m/search?site=images&q=firefox+ubuntu

I wrote a simple search plugin for the Firefox Search bar to search images with Google Mobile.

Copy this text:


<OpenSearchDescription xmlns="http://a9.com/-/spec/opensearch/1.1/"
xmlns:moz="http://www.mozilla.org/2006/browser/search/">
<ShortName>Google Mobile Images</ShortName>
<Description>Search images with Google Mobile</Description>
<InputEncoding>inputEncoding</InputEncoding>
<Image width="16" height="16" type="image/x-icon">data:image/x-icon;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAA09JREFUOE8lk21sFFUYhd+ZKUaaStsfmBhAG6OIYGNM0G671CrExjYaMAhYEyAR5Y/48csPXI20bLUoUCxWWvxszEqRYFttYYMWFdBKmhaIRW2lX6JUdmm722ZhO7vz+M7448y9c+ee8573zL0iItgp6B4YJW9jiIxHPqP60FnSpEjGJjhRUkSfIcyYJmndmxaThL6P69zlSsoGB1hVdRRZF8bc1M2cp77lz3/i+iFF4tc+LmVlemTHsEgr2RWISgbDpgooF9u2uW1LB7KpC9nci1T8QNVX5zxl1WC4tJSkGKQsIWkYTIpFREWGXAdOWhV0kz/Qibn+J8zNXZhPnmTdrh5X2tXnwupVTGtFlJRW8pSOfyu537RcB65Cmsrmc8jqMBlPn8Z84jsqart0VS1cg5/vXMSPN11H68JcOvJy6c6ZxYjad7ORgZErXgZjsQSLtrQjjx9jzvow4d6L3npD634WvJiHvF+AVV+M1PmZXXMfRc/ks2NJNnLHhk841HleTThMxJN8enyQ/tErXvXg0Qak8i6sRj/WviKkvkBRiLFH53UlGG8tR+auPUDOyg9Z/kKI7U2d/6emvR/v/wXz5VuQ/fciDUpsLMDYu8yD7PZhvFOsAverg4om5q/5nOvLPyb34X0MjcVwHIeR6EUWNj6G7M3H/KBQ4de5D/M9P8buYkwVkBofcmvZLnwbPmLtG208X/s9vf3jnn1Hn5F4hNIDz2LszFfrWln796ACskOxXRE6dobIuJc3M5N9jF1oYbC3nqtTl71fOKMnrSz0nIosVrJWrPVr9ULkbRUMKty/OPXvGXpafAy1ZPJXuzB62OR882Ji0T+8TH4bG+aG6hIlF2K9uwyzRisHtf9timv2NN2hAia+0aN6ysQ+kUmiczaXDwoDLeVeHm6ut+9Zoz0vRXZqC9XFzNq2AuN1FYhHB/m9aR5XwznEwlnE27OZbMtm+ut5XPrybkhOkbAdFgTLlahhBh/UUV28+QDymjqxUw5DRzYS/SKLydYbibXN9cixgzczfjLgZdN8+gjWS/dgVOl5qNRW3MpbFa+ucG+kXufpKJFTASY6VhJrfUjHR0n01JG0E5wdGWT+K2VKWIoZUHLArazhbVUnyv0Pap2Kdp9xgc4AAAAASUVORK5CYII=</Image>
<Url type="text/html" method="GET" template="http://www.google.com/m/search?site=images&amp;q={searchTerms}" />
</OpenSearchDescription>

and paste into your preferred text editor, save as gm.xml in

~/.mozilla/firefox/xxxxxxxx.default/searchplugins

Restart Firefox and the plugin will be added to pre-loaded search engines:


It's possible to use it on windows too (Shortcut Win + R --> %appdata%\mozilla\firefox\profiles).

A best solution comes from my brother, Massimo: It's possible to bypass the problem using an anonymous web proxy like anonymouse.org. A bookmark with a link like this:

http://anonymouse.org/cgi-bin/anon-www.cgi/http://www.google.com/imghp

speeds up the process and works fine.

Best regards

venerdì 6 agosto 2010

Microsoft Wireless Comfort Keyboard 1.0a on Ubuntu Lucid Lynx 10.04

Many of the multimedia keys of my Microsoft Wireless Comfort Keyboard 1.0a are not predefined on Ubuntu Lucid Lynx 10.04


 


Unfortunately  KeyTouch doesn't work for me. Fortunately there are a number of good tutorials to fix this problem. I followed this one:


and it's a very good howto that I don't want to copy here. I want to report here my own parameters to fully take advantage of my keyboard.
Pressing  my multimedia keys one by one and using sudo dmesg -c in a gnome-terminal, I discovered the scancodes from outputs like this:

atkbd.c: Unknown key pressed (translated set 2, code 0xe002 on isa0060/serio0).
atkbd.c: Use 'setkeycodes e002 ' to make it known.

Now, before going on, a little explanation: my keyboard has a special button, called "F Bloc" (Function blocks), to enable/disable particular functions for F1, F2...F12  keys and I want to fully take advantage of it.
Here it is, my /etc/rc.local, you can see the new functions
for F1, F2...F12  keys in case of F Bloc disabled :

#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing

setkeycodes e00b 180 # Zoom in
setkeycodes e011 181 # Zoom out
setkeycodes e005 182 # Messenger
setkeycodes e015 183 # Calendar
setkeycodes e016 184 # Disconnect
setkeycodes e073 185 # Favorites 1
setkeycodes e074 186 # Favorites 2
setkeycodes e075 187 # Favorites 3
setkeycodes e076 188 # Favorites 4
setkeycodes e077 189 # Favorites 5
setkeycodes e078 190 # Favorites - Star
setkeycodes e03b 191 # Help  -> F1
setkeycodes e008 192 # Undo  -> F2
setkeycodes e007 193 # Redo  -> F3
setkeycodes e03e 194 # New   -> F4
setkeycodes e03f 195 # Open  -> F5
setkeycodes e040 196 # Close -> F6
setkeycodes e041 197 # Reply -> F7
setkeycodes e042 198 # Fwd   -> F8
setkeycodes e043 199 # Send  -> F9
setkeycodes e023 200 # Spell -> F10
setkeycodes e057 201 # Save  -> F11
setkeycodes e058 202 # Print -> F12
exit 0

after that, I added the missing keysyms to the right keycodes in /etc/xmodmap.conf:

clear Mod1
add Mod1 = Alt_L
clear Mod4
add Mod4 = Tab
clear Mod5
add Mod5 = Alt_R
keycode 188 = XF86ZoomIn NoSymbol XF86ZoomIn
keycode 189 = XF86ZoomOut NoSymbol XF86ZoomOut
keycode 190 = XF86Messenger NoSymbol XF86Messenger
keycode 191 = XF86Calendar NoSymbol XF86Calendar
keycode 192 = XF86LogOff NoSymbol XF86LogOff
keycode 193 = XF86Launch0 NoSymbol XF86Launch0
keycode 194 = XF86Launch1 NoSymbol XF86Launch1
keycode 195 = XF86Launch2 NoSymbol XF86Launch2
keycode 196 = XF86Launch3 NoSymbol XF86Launch3
keycode 197 = XF86Launch4 NoSymbol XF86Launch4
keycode 198 = XF86Launch5 NoSymbol XF86Launch5
keycode 199 = XF86Support NoSymbol XF86Support
keycode 200 = Undo NoSymbol Undo
keycode 201 = Redo NoSymbol Redo
keycode 202 = XF86New NoSymbol XF86New
keycode 203 = XF86Open NoSymbol XF86Open
keycode 204 = XF86Close NoSymbol XF86Close
keycode 205 = XF86Reply NoSymbol XF86Reply
keycode 206 = XF86Forward NoSymbol XF86Forward
keycode 207 = XF86Send NoSymbol XF86Send
keycode 208 = XF86Spell NoSymbol XF86Spell
keycode 209 = XF86Save NoSymbol XF86Save
keycode 210 = XF86Launch6 NoSymbol XF86Launch6

Note 1: If I put xmodmap.conf in my home directory, it doesn't work.
Note 2: I added some extra commands at the top of the file (clear ..., add ...): clear is used to remove all entries in the modifier map for the given modifier,  where valid name are: Shift, Lock, Control, Mod1, Mod2, Mod3, Mod4, and Mod5
add is a command to reassign all  keys containing the given keysyms to the indicated modifier map. 
If I don't use these commands, some functions keys (F5, F7, F8, F9) don't work as expected and gnome-keybindind-properties cannot detect them correctly.

Now I can use gnome-keybinding-properties or xbindkeys-config to bind actions to my fresh configured keys: 


I took a screenshot of xbindkeys-config to show my settings, but actually I'm using gnome-keybinding-properties because it allows me to zoom in and zoom out without extra configurations.
As for F1, F2...F12  keys in case of F Bloc disabled, they are used with an email client, according to their labels and Microsoft docs, so I thought to use xdotool to send predefined and existing shortcuts to Evolution.
I'm writing a script to handle these shortcuts. It's possible to pass arguments to the script in this way: "myEvolutionShortcuts new" to start a new message, "myEvolutionShortcuts reply", "myEvolutionShortcuts send" and so on:

#!/bin/sh

# Search and store Evolution - Mail window id
myEvolutionID=`xdotool search --title "In arrivo"`
# Search and store Evolution - Compose message window id
myComposeMessageID=`xdotool search --title "Componi messaggio"`

case $1 in

# New message
new)
sleep .3
xdotool windowactivate $myEvolutionID
xdotool windowfocus $myEvolutionID
xdotool key "Shift+Control+M" ;;

# Open message
open)
sleep .3
xdotool windowactivate $myEvolutionID
xdotool windowfocus $myEvolutionID
xdotool key "Control+O" ;;

# Close Evolution
close)
sleep .3
xdotool windowactivate $myEvolutionID
xdotool windowfocus $myEvolutionID
xdotool key "Control+W" ;;

# Reply message
reply)
sleep .3
xdotool windowactivate $myEvolutionID
xdotool windowfocus $myEvolutionID
xdotool key "Control+R" ;;

# Forward message
forward)
sleep .3
xdotool windowactivate $myEvolutionID
xdotool windowfocus $myEvolutionID
xdotool key "Control+F" ;;

# Send message
send)
sleep .3
xdotool windowactivate $myComposeMessageID
xdotool windowfocus $myComposeMessageID
xdotool key "Control+F" ;;

# Spell check
abc)
sleep .3
xdotool windowactivate $myComposeMessageID
xdotool windowfocus $myComposeMessageID
xdotool key "F7" ;;

# Save message
save)
sleep .3
xdotool windowactivate $myComposeMessageID
xdotool windowfocus $myComposeMessageID
xdotool key "Shift+Control+S" ;;

# Print message
print)
sleep .3
xdotool windowactivate $myComposeMessageID
xdotool windowfocus $myComposeMessageID
xdotool key "Control+P" ;;

esac

exit 0

The very early version of the script works in this way: it searches the evolution's window id using the first words of its window title, activates and gives focus to the window, finally send the window a predefined shortcut. It's easy to get info about a particular window using the xprop command.
At this time the script doesn't handle exceptions but it works fine for now and I can use all of my multimedia keys.

Best regards.

lunedì 2 agosto 2010

Getting Logitech Quickcam Express USB webcam to work with Skype on Ubuntu Lucid Lynx 10.04

As said before, this old & cheap camera is terrible. I have just installed Ubuntu 10.04 LTS on my computer in my holidays house and the camera doesn't work anymore. If I run Cheese or Skype in the way described in my previous article, this error message is displayed:

libv4l2: error turning on stream: Input/output error

Anyway, the Input/output error is suspicious: I've just thought the error is due to some unknown USB malfunction or device error. So I have unloaded gspca_STV06xx driver and unplugged the camera. After that, I have connected the camera to another USB port and here we are, now it works fine with Cheese:


and Skype (Options window):


The camera is filming the terrible panorama outside my holidays house.

We need to start Skype in the same way we did on Ubuntu 9.10.

I'd like to understand why the old USB port doesn't work after the upgrade.

Best regards.