Convert mkv files to xvid for Xbox 360

Ushare is an excellent media server that allows you to watch videos, listen to music and view pictures on your Xbox 360 that are stored on another computer. Unfortunately, the Xbox can be somewhat finicky about which formats it supports – and it doesn’t support mkv files. To convert it to a file that the Xbox does support, you can use mencoder as follows:

mencoder inputFile.mkv -ffourcc XVID -ovc lavc -lavcopts vcodec=mpeg4:threads=8:vbitrate=1000:cmp=2:subcmp=2:trell=yes:v4mv=yes:mbd=2 -oac lavc -lavcopts acodec=ac3:abitrate=128 -channels 2 -o outputFile.avi

If the original file is high quality, you’ll probably want to increase the vbitrate parameter to prevent the quality from degrading. If you have surround sound, you should set the number of channels to 6 and set the audio bitrate higher (384 is probably a good choice) as well.

Posted in Uncategorized | Tagged | Leave a comment

Using Javadoc with Eclipse in Ubuntu

When you’re using Eclipse to program in Java and you hover over a keyword (like a function name, a package, or a class), some Javadoc will be displayed, showing what the keyword does and how it is used. The default installation of Eclipse did not include Javadoc, so hovering over keywords only gave me a message that Javadoc wasn’t installed. Here’s how to get Javadoc installed and working.

First, enter
sudo apt-get install sun-java6-doc
The installer will prompt you to download a zip file containing the documentation from Sun. Bring up Firefox and head to Sun’s website. Click the Download link next to Java SE 6 Documentation, agree to the terms and click Continue. Click the zip file to download the documentation.

When the download finishes, in another terminal, enter
sudo mv /path/to/zip/file/documentation.zip /tmp/jdk-6-doc.zip
You need to rename the file to jdk-6-doc.zip for the installer to work. Enter
sudo chown root:root /tmp/jdk-6-doc.zip
to change the file permissions.

Back in the first terminal, hit enter, and the installer should continue. When it finishes, in Eclipse, click Window – Preferences – Java – Installed JREs, and click the JRE (mine was called java-sun-1.6.0.07). Click Edit, and use Shift+Click to select all the JRE system libraries. Click Javadoc Location, and enter file:/usr/lib/jvm/java-6-sun/docs/api/ in the box. Click Validate to test it (you can open it in your browser to double check), and click OK out of all the dialogs. Javadoc should now be working!

Posted in Uncategorized | Tagged , | Leave a comment

Booting multiple LiveCD’s from a single USB stick

I love LiveCD’s – they let you try out an operating system or Linux distro without messing with your current installation. Recently, I’ve become hooked on LiveUSB distro’s that allow you to boot off of a USB stick rather than a CD. I tried putting Backtrack on a 1 GB stick, and then DamnSmallLinux on a 64 MB stick. I started wondering if it would be possible to put several distributions on a larger stick, and then boot from one of your choice. It turns out that it is possible, and here’s how.

Things you will need

  • an i386 computer running Linux (other architectures won’t work with the bootloader)
  • ISO images of LiveCDs (or LiveUSBs) you want to run
  • a large USB stick that can hold all the images
  • Optional: QEmu can be installed to test the stick, or boot LiveCD’s from within your host OS.

I started off by downloading five ISO images: Belenix, Backtrack, Freesbie, Knoppix, and NimbleX.

Insert your USB stick. In a console, enter
dmesg | tail
You should see something similar to
sd 9:0:0:0: [sdc] Attached SCSI removable disk
My USB stick is therefore attached at /dev/sdc, although yours will probably be different. From here on out, I’ll refer to your drive as driveName. To make sure you have the right drive, as root, enter:
fdisk -l /dev/driveName
It should report the size of your USB stick.

We’re going to partition the USB stick for use with each LiveCD. This will destroy all data on the stick! Make sure you’re using the correct drive from above too, or you might accidentally wipe your hard drive!
As root, enter
fdisk /dev/driveName
You can enter p to show the current partitions. It should list a number of partitions. Delete each of them by entering d and entering each number.
When you’ve deleted them all, enter n for a new partition. Choose p for a primary partition, hit enter for the default, and enter +16M to make a 16 MB partition at the beginning of the drive. Enter a to make the partition bootable, and enter t to change the partition type. Enter 6 for the partition type.
Now you’re going to make an extended partition, and logical partitions for each of your ISO images. First, note the size in MB of all of your ISO images. Mine were 696, 784, 672, 697, and 200. You can find these in another terminal by running
ls -lh *.iso
in the directory containing your ISO images. When you use these numbers, you’ll want to add 5 MB to them to make sure they fit in the partition.
In fdisk, enter n for new partition, e for extended, and enter twice to fill the rest of the drive. Enter n, l for logical, enter for the default, and +sizeM, where size is the size of your first ISO image plus 5 MB. In my case, I ran +701M. Repeat this procedure for the remainder of your ISO files.
When you are done, enter p to make sure everything looks right. Your output should look similar to this:


Device Boot Start End Blocks Id System
/dev/sdc1 * 1 3 24066 6 FAT16
/dev/sdc2 4 488 3895762+ 5 Extended
/dev/sdc5 4 97 717824+ 83 Linux
/dev/sdc6 98 203 809984+ 83 Linux
/dev/sdc7 204 294 693248 83 Linux
/dev/sdc8 295 388 718848+ 83 Linux
/dev/sdc9 389 416 209920+ 83 Linux

If everything looks good, enter w to write the changes to the USB stick. If you messed up, you can enter q to quit and try again

Now we’re going to install the bootloader. Most Linux distributions use GRUB or LILO, which are great, but since we’re trying to boot ISO images off of a USB stick, we’re going to use something a little different. Gujin is an alternative bootloader that can boot all sorts of things, and will automatically scan your partitions to look for Linux kernels. It’s a handy piece of software, and if you find it useful, you should consider donating. (Disclaimer: I don’t know the author and make no money off of your donation)

First, format the first partition on your USB stick by entering
mkfs.msdos -F 16 /dev/driveName1
Then, download the
Gujin installer
and unzip it. Enter the gujin-install directory and run
./instboot boot.bin /dev/driveName1 --disk=BIOS:0x80 -w
This will install the bootloader to the first partition. The -w option prints out useful debugging information.

At this point, your USB stick should be bootable. You can test it in another terminal by running
qemu -usb /dev/diskDrive
Your output should look similar to this:

Now, you’re ready to copy the ISO images onto your disk. Enter
fdisk -l /dev/diskDrive
and find the number of the first partition under ‘extended’ block. For example, mine above was sdc5. This is where the first ISO image will go. Make sure you’re using the right ISO image for the partition size, and enter
cat nameOfImage1.iso > /dev/diskImage5
to copy the ISO image to partition 5. When that finishes, similarly copy the other ISO images onto the other partitions.
cat nameOfImage2.iso > /dev/diskImage6
cat nameOfImage3.iso > /dev/diskImage7
...

You can test your USB stick in another terminal again by running
qemu -usb /dev/diskDrive
The full Gujin menu should now be displayed!

At this point, I had to scroll down a page (using Page Down). The options you want are listed with the code 0x80 and the ‘El Torito‘ option:

Press the appropriate key (F1, F2, etc.) to boot and you should see that CD’s particular GRUB screen!

If everything works, you should be able to boot any of your LiveCDs from USB.

Posted in Uncategorized | Tagged | 5 Comments