Add “Clear Field” Control+U to Firefox

On a Unix system, especially Linux, when you've got an input form, you often have the option to hit Control+U keys combination to clear it. It's really useful as you sometimes have something in the clipboard which you'd like to paste with middle click, but don't want to lose by selecting the all field.To add the Control+U option to Firefox, and by the way to all the GTK2 apps, you just need to add to the file "~/.gtkrc-2.0" (You may have to create it first) the following line :


gtk-key-theme-name = "Emacs"

With that, just restart Firefox, and now, when the cursor is in a filled input field just hit Control+U and it will be erased. Note that it won't disable the default behavior of Control+U elsewhere in Firefox, which open the source code of the current page.

French accent on Qwerty keyboard, for X11

Here is a way to get a full French accent support in my X applications, and to keep the advantages (mainly programming ones) of the qwerty layout.Just append the following to your file "/etc/X11/xkb/symbols/us" (kubuntu breezy) :

  partial alphanumeric_keys  xkb_symbols "fr" {

name[Group1]= "U.S. English - International (with dead keys)";

include "us(basic)"

// Alphanumeric section

key { [ grave, asciitilde, dead_grave, dead_tilde ] };

key { [ 1, exclam, exclamdown, onesuperior ] };

key { [ 2, at, twosuperior, dead_doubleacute ] };

key { [ 3, numbersign, threesuperior, dead_macron ] };

key { [ 4, dollar, currency, sterling ] };

key { [ 5, percent, EuroSign ] };

key { [ 6,asciicircum, onequarter, dead_circumflex ] };

key { [ 7, ampersand, onehalf, dead_horn ] };

key { [ 8, asterisk, threequarters, dead_ogonek ] };

key { [ 9, parenleft, leftsinglequotemark, dead_breve ] };

key { [ 0, parenright, rightsinglequotemark, dead_abovering ] };

key { [ minus, underscore, yen, dead_belowdot ] };

key { [ equal, plus, multiply, division ] };

key { [ q, Q, adiaeresis, Adiaeresis ] };

key { [ w, W, aring, Aring ] };

key { [ e, E, eacute, Eacute ] };

key { [ r, R, registered, registered ] };

key { [ t, T, thorn, THORN ] };

key { [ y, Y, udiaeresis, Udiaeresis ] };

key { [ u, U, ugrave, Ugrave ] };

key { [ i, I, idiaeresis, Idiaeresis ] };

key { [ o, O, ocircumflex, Ocircumflex ] };

key { [ p, P, odiaeresis, Odiaeresis ] };

key { [ bracketleft, braceleft, guillemotleft, guillemotleft ] };

key { [bracketright, braceright, guillemotright,guillemotright ] };

key { [ a, A, agrave, Agrave ] };

key { [ s, S, ssharp, section ] };

key { [ d, D, eth, ETH ] };

key { [ l, L, oslash, Ooblique ] };

key { [ semicolon, colon, paragraph, degree ] };

key { [apostrophe, quotedbl, dead_acute, dead_diaeresis ] };

key { [ z, Z, ae, AE ] };

key { [ c, C, copyright, cent ] };

key { [ n, N, ntilde, Ntilde ] };

key { [ m, M, mu, mu ] };

key { [ comma, less, ccedilla, Ccedilla ] };

key { [ period, greater, dead_abovedot, dead_caron ] };

key { [ slash, question, questiondown, dead_hook ] };

key { [ backslash, bar, notsign, brokenbar ] };

include "level3(ralt_switch)"

};

All it does is just keeping the original qwerty layout, adding it the AltGr+vowel combinations of the common accentuated characters. AltGr+Accent followed by a letter add the accent to the given letter.

A new variant of the us layout is then available, called "fr" and accessible via the command "setxkbmap -model pc105 -layout us -variant fr"

Booting a system with qemu-system-sparc

This document is a report of my attemps to run and install some distributions under a sparc system using qemu-system-sparc.
The tests where made with the following configuration :


  • Kubuntu breezy with KDE 3.5.1

  • QEMU PC emulator version 0.8.0

  • /usr/share/proll/proll-qemu.elf from http://www.h7.dion.ne.jp/~qemu-win/. The version found in this archive works better than debian's default one.

  • A 2Gb raw disk image created with qemu-img, not really usefull here as you can't install anything...


I tried several distributions, but only two of them seemed to boot and do something. Here's the distributions I've attemped to run :

Among all of these, only two where actually doing something interresting. Suse 7.3, which crashes before being able to install, and Aurora linux 2.0 which fails to install as I wasn't able to find any working cdrom, nfs, http, ftp or hd drivers. The following will demonstrate the boot process of Aurora 2.0. Only the boot.iso file is needed to demonstrate, as the system fails to access to the cd files. But both boots the same way.

You first need to boot the system using qemu.

$ qemu-system-sparc -cdrom boot.iso -hda sparc.img -boot d

Here sparc.img is an empty 2Gb hard drive image. The system prompt with the Silo boot loader. Just press enter. After the system finishes loading kernel, you'll be asked your language. Any will work, so choose yours. Then you have to choose the installation method. This is where it fails. Whatever you're choosing, you'll not be able to go farther. One interesting thing needs to be quoted : If you choose CDROM (with the disc1 iso) and the second device driver proposed, Qemu crashes with a segmentation fault, indicating that it has been going a little farther than usual.

Here are some screenshots I've taken to show you how it behave :

Aurora booting :

aurora2.0-boot

Aurora installation method :

aurora2.0-install-method

Aurora device driver :

aurora2.0-device-driver

I hope Mr Bellard or the Linux community will be able to make it work, as it's definitively a great step for interoperability. Thanks for your great work !

Microsoft Windows default random number generator

This document present the way the random() and srandom() function work under MS Windows 2000/XP (maybe on others too).


  • srandom() : Simply initialise a static unsigned int by the value given in parameter. Lets call this variable holdrand.

  • random() : Modify holdran as though : holdrand = holdrand * 214013L + 2531011L. Returns a "random value" computed with the new holdrand value : return (holdrand >> 16) & 0x7fff;



The following code sample implements it :

class W32Rand {

private:

unsigned int holdrand;

public:

void srand(unsigned int seed) {

holdrand = seed;

}

public:

unsigned int rand(void) {

return ((holdrand = holdrand * 214013L + 2531011L) >> 16) & 0x7fff;

}

};