jueves, 4 de octubre de 2007

VirtualBox y VMWare: convertir multiples vmdk a vdi

Referencias:

For multiple vmdk files, install the VMware Server then use:
vmware-vdiskmanager -r source_multiples.vmdk -t 2 single_file.vmdk
Now you have on single vmdk.

VirtualBox y VMWare: convertir un vmdk a vdi

Referencias:

Cito

"

  1. $ sudo apt-get install qemu
  2. $ wget http://www.virtualbox.org/download/testcase/vditool
  3. $ chmod +x vditool$ mv vditool /usr/local/bin/$ qemu-img convert -f vmdk /var/lib/vmware/Virtual\Machines/MCNLive/MCNLive.vmdk -O raw MCNLive.img
  4. $ vditool DD MCNLive.vdi MCNLive.img
  5. $ mv MCNLive.vdi .VirtualBox/VDI/
  6. On this article the compact step left:
  7. $ vditool SHRINK VirtualBox/VDI/MCNLive.vdi

This is necessary if your VMWare uses a 10 GB dynamic disks, but justhas 2 GB used. After qemu conversion, your image will be 10 GB.I use this steps once to convert a VMWare appliance to VirtualBox.

"

martes, 2 de octubre de 2007

Java: convertir un double a int

Referencias:
  • http://forum.java.sun.com/thread.jspa?threadID=609720
Para convertir un double a int, redondeando siempre hacia abajo, hacer lo siguiente:
  • int d = (int) x;
o bien
  • int d = (int) Math.floor(x);
Por ejemplo, si x fuese 2.75, con este método, d pasaría a valer 2. Podemos pensarlo como que se quitan los dígitos decimales.

VirtualBox: habilitar los puertos USB

Referencias:
  • http://paulsiu.wordpress.com/2007/11/20/tips-on-running-innotek-virtualbox/
  • https://bugs.launchpad.net/ubuntu/+source/virtualbox/+bug/151585

Pasos a seguir, cito y corrigo en bold al blog:

"

There are two issues:

  1. When you click attempt to open the settings on a virtual machine, you get the following error:

    Could not load the Host USB Proxy Service (VERR_FILE_NOT_FOUND). The service might be not installed on the host computer.

    The cause of this problem is that usbfs is not turned on in Ubuntu. To fix this, you need to edit the file /etc/init.d/mountdevsubfs.sh (remember to use sudo). Search and uncomment all of the code lines:

    #
    # Magic to make /proc/bus/usb work
    #
    #mkdir -p /dev/bus/usb/.usbfs
    #domount usbfs “” /dev/bus/usb/.usbfs -obusmode=0700,devmode=0600,listmode=0644
    #ln -s .usbfs/devices /dev/bus/usb/devices
    #mount –rbind /dev/bus/usb /proc/bus/usb
  2. Unfortunately, this does not solve the problem entirely. When I attempt to access the USB from the guest, I get the following error message.

    Failed to attach the USB device

    Even though you enabled usbfs, the user do not have permission to use USB. You can set up a rule to give each user access. Because everyone who use Virtualbox has to be in the group vboxusers. The easiest way to give every Virtualbox user access would be to give vboxusers access. Sudo edit the file /etc/udev/rules.d/40-permissions.rules, locate the following line:

    # USB devices (usbfs replacement)
    SUBSYSTEM==”usb_device”, MODE=”0664″

    Change the line to:

    # USB devices (usbfs replacement)
    SUBSYSTEM==”usb_device”, GROUP=”vboxusers”, MODE=”0664″
"