Dojo : Script d'affichage de message temporaire

Je ne suis pas un partisan de Dojo Toolkit. Je l'utilise au travail parce que mon boss l'a choisi :p

Mais du coup, je développe quelques scripts dessus, et en voici un tout court tout simple qui permet d'afficher un message sur une certaine durée.

Je l'utilise pour indiquer à l'utilisateur le résultat d'une commande effectuée sans recharger la page.

Je le met ici, si ca peux servir ! :)

function showbox (sDiv, sMessage, iDuration) {
        dojo.byId (sDiv).innerHTML = '';

        if (iDuration == null)
                iDuration = 3000;

        if (typeof (_oFadeOut) != 'undefined')
                _oFadeOut.stop ();

        // On met la visibilité de l'élément à 0
        var _oFadeOut = dojo.fadeOut ({
                onEnd: function() {
                        // On met le texte de sMessage dans sDiv
                        dojo.byId (sDiv).innerHTML = sMessage;

                        // On fait un fadeIn
                        dojo.fadeIn ({
                                node: sDiv,
                                duration: 700,
                                // On attends x secondes
                                onEnd: function () {
                                        setTimeout (function () {
                                                // On fait un fadeOut
                                                dojo.fadeOut ({
                                                        node: sDiv,
                                                        duration: 700,
                                                        // Une fois finis on efface le contenu
                                                        onEnd: function () {dojo.byId (sDiv).innerHTML = '';}
                                                }).play ();
                                        }, iDuration);
                                }
                        }).play ();
                },
                node: sDiv,
                duration: 1,
        });

        _oFadeOut.play ();
}

Filed under  //  Development   Javascript   Scripts   affichage   box   dojo   message   temporaire   toolkit  
Posted by Cyril Nicodème 

How to setup a bridge between a virtual machine with VirtualBox and a Fedora host

Hi everybody, I will try to show you how it's easy to configure your virtual machine to be visible on the network, like another machine.

First, you need to install the bridge-utils package
yum install bridge-utils
and you need to create a bridge.
Go to /etc/sysconfig/network-scripts/ and create a new file (ifcfg-tap0 for example) :
vi /etc/sysconfig/network-script/ifcfg-tap0

IMPORTANT NOTE : NetworkManager load the scripts files in alphabetical order. If you set the name of your bridge with the first letter is before the first letter of your interface, it will not work ! (br0 connected to eth0 for example). Take care about that !

Put these lines :
DEVICE=br0
TYPE=Bridge
ONBOOT=yes
BOOTPROTO=static #or dhcp, and leave the next
IPADDR=192.168.0.10
NETMASK=255.255.255.0
GATEWAY=192.168.1.1
BROADCAST=192.168.0.255
then open your network configuration file (for example ifcfg-eth0) and add these lines (if they didn't exists) :
PEERDNS=no
TYPE=Ethernet
USERCTL=yes
IPV6INIT=yes
BRIDGE=tap0
Restart the network service by
su -lc 'service network restart'
Finally, and the most important, in root, you need to specify the bridge for VirtualBox with this command :
VBoxAddIf vbox0 {user} tap0

With {user} your current user, br0 the name of your bridge, and vbox0, it's the name of the network you will need to specify in the preferences of VirtualBox, network section. Select Host Network Adaptater, and specify vbox0.

Voilà ! You can launch your virtual machine in bridge mode ! :)

(See : http://forums.fedora-fr.org/viewtopic.php?pid=200600 for more info (in french))

You can have some issues after a reboot, with your virtual machine that cannot connect to the web. If it happens, stop your vm, remove the interface and re-add it to virtualbox (in root mode) and start your vm.

# Command to remove an interface :
VBoxDeleteIF vbox0

# And now, we add it:
VBoxAddIF vbox0  tap0

Filed under  //  Fedora   Howtos   Unix/Linux   box   bridge   virtual   virtualbox  
Posted by Cyril Nicodème