Sunday, June 22, 2008

Laptop Hacking - Just a little more space

Like any geek, I have a ton of old drives. They are mostly used in external cases for backups or to run a VM on to do some work that I don't need on all the time.

The other day, I was digging through a drawer and I came across a 100GB PATA notebook drive that I had replaced in my personal laptop with a 100GB 7200RPM. I pondered the thought of putting it into an external case so I could do some Ubuntu package deployment testing when I realized it would be really very cool if I could make the drive fit IN the laptop.

So, I pulled the notebook apart and began walking through hacking my spare drive into it.

Here's the laptop before I did any work to it, as you can see it's just a run of the mill Compaq notebook. Single core AMD 3500 socket 939 w/ 2GB of DDR memory and a 100GB 7200 PATA drive. Once completed this laptop will have 200GB of total storage; 100GB 7200 RPM connected to the primary master, and 100GB 4200RPM connected via USB.

I kept track of each screw by storing each type in a small pile which I kept together with scotch tape. I labeled each pile to whatever the screws belonged to like case, display, keyboard, etc. This allowed me to completely disassemble and reassemble the laptop very quickly without error. I was sure to use the utmost caution whenever I was connecting and disconnecting double checking everything before continuing. Once I had the laptop open, I had to select an interface to connect to. The options were: Primary Slave, Secondary Slave, and USB. I ruled the first two out pretty quickly. While they weren't impossible, they involved significantly more effort as I would have had to de-solder the connections (44 pin header on the primary, and a 50 pin header on the secondary) and solder 44 individual connections in addition for finding a way to re-route the cables so the connections still worked for their native devices. Using the USB bus, I was able to drop the disk inline with the USB port by soldering connections directly to the motherboard. I added a small switch to I could turn the drive off when it wasn't in use to save power. Additionally, I can also use the USB port for other devices while the second hard drive is powered off. On the motherboard I soldered a total of 4 connections to USB (Pinout: 1: VCC, 2: Data+, 3: Data -, 4: Ground). I ran the connection from pin 1 (VCC) to a single pole single throw (SPST) mini-toggle switch which I mounted in an open area on the opposite side of the laptop from the hard drive and then ran the connection back to the USB input on the 2.5" drive adapter. I then connected the rest of the data and ground connections using the bundled USB cable without it's connectors because it's USB 2.0.

In order to make the drive fit properly, I needed to cut some of the metal on the right side of the laptop that protruded from the Kensington lock. Using a dremel and metal cutting tip I sliced about 1/2 of the two small sections away which allows me to retain complete functionality of the lock and doubles as a mount for the drive itself. Additionally, I shaved some of the plastic from an unused screw mount which was probably there from supporting an earlier model (there was nothing connected to it). Once I had the metal and plastic trimmed, I mounted the hard drive into the case and ensured that my newly added cables were not in the way of the DVD sled. Once I had the drive in place, I used a non-conductive heat shield from an old power supply to protect the drive electronics from the top of the DVD (note: the drive only looks upside down, the keyboard is actually on the other side so when complete it is mounted upright). I then began to re-assemble the notebook without bolting anything down to ensure that the computer still booted, and that it did see the drive (success woot!). Once tested, I completely re-assembled the notebook and was pleased to see that everything fit perfectly, and worked. If it wasn't for the toggle switch, you wouldn't know that there were two hard drives hacked into the laptop, as it looks just like it did before I started.

UPDATE: I found a great little rocker switch to replace the toggle, and I've installed it this morning. (June 28). Pics below.








Friday, June 6, 2008

HOW-TO: Get Office 2003 running in Wine on Linux

I've gotten Microsoft Office 2003 working pretty well, if you would like to get Office working in Ubuntu 8.04, here's what you need to do.

First, you'll need to install wine. This can be done using the Add/Remove applet on your menu, or by entering this command in a terminal window:

sudo apt-get install wine

Now that Wine's installed, you'll need to download the core Windows fonts and set them aside for later, so go grab each of the MS Core fonts .exe packages from sourceforge [ HERE ]. You can safely skip wd97vwr32.exe which is the Microsoft Word 97 viewer.

Now, insert your Office 2003 CD and execute SETUP.EXE. I recommend browsing to the setup directory, and then performing the following action in nautilus:

Right Click SETUP.EXE
Select "Open With"
Click the arrow next to "Use a custom command"
Type "wine" in the textbox (without quotes)
Press "Open"


You may see your hard drive light start to flash, but no notification that it's doing anything. That's OK, it's working and the installer will start momentarilly.

Install Microsoft Office normally, note that Outlook currently does not work with the version of Wine that ships with Ubuntu 8.04.

Once the Office installation completes, perform the following actions (Note: For Office 2007, change OFFICE11 to OFFICE12):

Press Alt-F2 (this brings up a RUN prompt)
Type "regedit" (without quotes)
Click "Run"
Browse to: HKLM\Software\Microsoft\Office\11.0\Common\FilesPaths
Change the path to MSO.DLL to: C:\Program Files\Common Files\Microsoft Shared\OFFICE11\MSO.DLL
Close Regedit

Press Alt-F2
Type "winecfg" (without quotes)
Click the Libraries tab
Click the "New override for library" dropdown box
Select "gdiplus"
Click "Add"
Click "Ok"


This tells Office where to find the MSO dll, and sets GDI to native mode. Now we need to install those fonts.

Open a terminal by clicking Applications -> Accessories -> Terminal
Change to the directory containing your exe files downloaded earlier. I'll assume they are in ~/Desktop (the default download path)
Type: "cd ~/Desktop" (without quotes)
Type: "for item in *exe; do wine $item; done" (without quotes)


For each of the dialog boxes, accept the license or click through the OK when prompted.

Now that you have Office installed, we'll need to associate it in GNOME. We'll do this by creating shell scripts which will perform actions based on how it's called. We'll need to repeat this step for Word, Excel, Powerpoint, etc. In our example we'll use Word and Excel.

In your terminal window:
Type: "cd"
Type: "mkdir bin"
Type: "cd bin"
Type: "gedit"


This brings up the Gnome Text Editor. Paste the following code blocks into gedit and save as the appropriate "NAME".

Paste the following and save in your bin directory as "word":
#!/bin/bash
COMMAND=`echo $* | sed -e s#\/#\\\\\\\#g`
if [ ${COMMAND} ]; then
COMMAND='Z:'$COMMAND
fi
wine "C:\Program Files\Microsoft Office\OFFICE11\WINWORD.EXE" "${COMMAND}"


Paste the following and save in your bin directory as "excel":
#!/bin/bash
COMMAND=`echo $* | sed -e s#\/#\\\\\\\#g`
if [ ${COMMAND} ]; then
COMMAND='Z:'$COMMAND
fi
wine "C:\Program Files\Microsoft Office\OFFICE11\EXCEL.EXE" "${COMMAND}"


Repeat this for any other Office applications you would like to use, be sure to change the .EXE to the appropriate Office executable (I've tested with Word, Excel, Powerpoint, and Access which all seem to work OK.

Next, we'll need to make icons for your new Word, and Excel installation. Do a quick Google search for Icons to use for your Office applications I found some cool ones on deviant art icons like these linked [ HERE ] should work great. Rename each of them to Word.{extension}, Excel.{extension}, etc substituting "{extension}" with the actual file's real extension (Example: Word.png). To create icons on the Gnome menu we'll perform the following actions:

Close Gnome Editor
In your Terminal window, type: "gksu gedit"
Enter your password when prompted.


Paste the following text into Gnome Editor, and save it to the /usr/share/applications directory with the name "word.desktop". Be sure to change the name of the Icon in the "Icon" line below to match your downloaded icon. Don't change the directory to the Icon.

[Desktop Entry]

Version=1.0
Terminal=false
Exec=wine "c:/Program Files/Microsoft Office/OFFICE11/WINWORD.EXE" %U
Icon=/usr/share/pixmaps/Word.png
Type=Application
Categories=Application;Office;WordProcessor;
StartupNotify=false
InitialPreference=5
Name=Microsoft Word
GenericName=Word Processor


Paste the following text into Gnome Editor, and save it to the /usr/share/applications directory with the name "excel.desktop". Be sure to change the name of the Icon in the "Icon" line below to match your downloaded icon. Don't change the directory to the Icon.

[Desktop Entry]

Version=1.0
Terminal=false
Exec=wine "c:/Program Files/Microsoft Office/OFFICE11/EXCEL.EXE" %U
Icon=/usr/share/pixmaps/Excel.png
Type=Application
Categories=Application;Office;Spreadsheet;
StartupNotify=false
InitialPreference=5
Name=Microsoft Excel
GenericName=Spreadsheet


Now that you have desktop files, we need to put the icons into the /usr/share/pixmaps directory. Copy them from wherever they were downloaded and renamed to your home directory. Once they are there, lets close Gnome Editor and go back to your Terminal window.

Type: "cd"
Type: "sudo mv *{extension} /usr/share/pixmaps" where {extension} is the real extension of your files. IE: "sudo mv *png /usr/share/pixmaps"

Now, click Applications -> Office, and you should see Word and Excel. Open each of them to verify they are working correctly.

Lastly, we need to associate .doc and .xls files with Word and Excel. Browse to those types of files in your home directory (or your thumb drive, wherever you store them).

In nautilus, right click a .doc file
Select "Open with Other Application"
Click the arrow next to "Use a custom command"
Click "Browse"
Click your home directory in the left pane
Click bin
Click "word"
Click "Open"
Click "Open"


Your word document should open in Microsoft Word 2003. This also saves this configuration, associating .doc files with Word permanently. If you are installing Office 2007 update to the latest version of Wine from winehq.

Repeat for Excel, and any other Office programs.

Performance Tuning VMWare Server on Ubuntu Linux

This write-up aims to provide detail into building and tuning Linux and VMWare for a Virtual Server solution using 64bit Ubuntu by discussing my experiences in building this system.

Here are the example specs for the new VMWare Server:
AMD x2 4200+ 65nm CPU
4GB PC2-6400 DDR2 RAM (Dual Channel)
2x Seagate Barracuda 7200RPM 250GB SATA 3.0Gb drives
ASRock ALiveNF6P-VSTA System Board
580W Power Supply

Operating System: Ubuntu 7.10 Server 64bit

Drives configured as follows:

/dev/sda
1 - Swap (1GB)
2 - md0 (250MB)
3 - md1 (231GB)

/dev/sdb
1 - Swap (1GB)
2 - md0 (250MB)
3 - md1 (231GB)

/dev/hda
1 - ext3 (100GB)

All MD devices are configured as RAID-1 using Linux Software Raid

Device md0 was formatted as ext3 and exists as /boot
Device md1 was added to volume group vg00, then Logical Volume ROOT and mounted on /

LILO was used, and it is written to both sda and sdb (so the system remains bootable if sda fails)

Using Logical Volume Manager (LVM) for / provides flexability in that I can add two more 250GB drives as md2, and grow / to 500GB with a few simple commands (vgextend, lvextend, resize2fs). In addition, using LVM also provides capabilities to mirror or snapshot volumes. Using Software Raid instead of the integrated NVidia MediaShield provides better RAID management flexability, and as both devices are CPU backed since there is no internal RAID processor on the MCP chips there is really no performance gain by using the integrated card.

Tuning:
After building the system, and installing VMWare I started creating Virtual Machines. Something that I immediately noticed was that during even small IO, wait states climbed to 100% CPU and network dropoffs occured, it was causing connections to the web server VM to drop for even static content performance was absolutely terrible. I initially thought that the problem was the Software Raid devices, but I quickly identified that the problem child was actually problem children and that the RAID wasn't one of them. I installed a product called monitorix and started collecting data which was instrumental in identifying the performance bottlenecks.

Virtual Machine configuration:
When creating virtual machines on this platform I elected to us pre-allocated disks. Using pre-allocated disks reduces disk fragmentation, and improves overall performance. Additionally, I always remove the floppy device. Here is an overview of the configurations:

Generic base configuration:

Linux 32bit and 64bit VMs:
384MB Ram 20GB SCSI disk pre-allocated 1 Ethernet device (bridged)

Windows VMs:
256MB Ram 8GB SCSI disk pre-allocated 1 Ethernet device (bridged)

It's recommended by VMWare that Windows VMs be configured to use IDE, however in my experience the Virtual IDE devices use tons more CPU time than the SCSI device. This is due to the emulation level done and lack of I/O threading in VMWare's IDE controller. I have to assume that this is a problem with IDE in general, as it's never been very good at multithreaded I/O (this is one big reason it's never been used for servers). Additionally, I recommend using the LSILogic controller is it supports multithreaded IO while the Buslogic controller doesn't.

One of my virtual machines was destined to become a print server, printing to a USB printer directly connected to the VMWare server. Ubuntu 7.10 doesn't configure USBFS out of the box. This can be corrected by editing a few files:

Add to fstab:
usbfs /proc/bus/usb usbfs auto 0 0

Edit /etc/init.d/mountdevsubfs.sh, and uncomment the following lines:

#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


This is done by removing the # from the front of each line. Once this is done, go ahead and run the script.

/etc/init.d/mountdevsubfs.sh start

In the Virtual Machine configuration, I needed to ensure that the printer was always connected on startup so I inserted the following configuration into that Virtual Machine's VMX file:

usb.present = "TRUE"
usb.generic.autoconnect = "FALSE"
usb.autoConnect.device0 = "0x0000:x0000"
usb.autoConnect.device1 = "0x04e8:0x327e"
usb.generic.skipsetconfig = "TRUE"


You can get the IDs for your devices by issuing an lsusb on the VMWare Server, this command will output similar to the following:

Bus 002 Device 002: ID 04e8:327e Samsung Electronics Co., Ltd
Bus 002 Device 001: ID 0000:0000
Bus 001 Device 001: ID 0000:0000


Additionally, I had to blacklist usblp on the VMWare Server so the host didn't connect to the printer making it unavailable to the guest.

echo "blacklist usblp" >>/etc/modprobe.d/blacklist

As you can see above I have used the device ID for the Samsung printer, as well as the USB hub that it's connected to (0000:0000). Now, whenever the Virtual Machine restarts, it scans the USB bus on the host and automatically connects those devices. Printing now "just works" after rebooting. Of course for it to "just work" you also need to configure CUPS or Windows printer shareing, but that is out of the scope of this article ;-).

After I installed monitorix, I identified multiple significant performance bottlenecks. I resolved these bottlenecks by tuning both VMWare and the Linux kernel itself. The difference in performance is astronomical, and it's a very visible improvement in the graphs as seen below.



To resolve the bottlenecks, I made all of the following changes to both VMWare Server, the Virtual Machines and the Linux host itself:

Add each of these to /etc/vmware/config:

mainMem.useNamedFile tells VMWare where to put it's temporary workspace file. This file contains the content of the Virtual Machine memory which is not used. By default it is placed in the directory with the virtual machine, however that can seriously impact performance so we'll turn it off.

mainMem.useNamedFile = FALSE

tmpDirectory is the default path for any temp files. We need to change that to be a shared memory filesystem (in RAM).

tmpDirectory="/dev/shm"

prefvmx.useRecommendedLockedMemSize and prefvmx.minVmMemPct tell VMWare to either use a fixed sized memory chunk or balloon and shrink memory as needed. Since I have 4GB of memory in this "server" I want to make sure that I use a fixed chunk of memory to reduce disk IO.

prefvmx.useRecommendedLockedMemSize="TRUE"
prefvmx.minVmMemPct="100"



To tune each Virtual Machine, I installed VMWare tools and then made the following changes to each VMX file:

Set the time in the Virtual Machine to the hosts time (I use NTP on the host):

tools.syncTime = "TRUE"

When I reboot the host, I want to gracefully stop each VM instead of just powering it off:

autostop = "softpoweroff"

I don't care about collapsing memory into a shared pool, this tells the VM to not share which saves CPU cycles:

mem.ShareScanTotal=0
mem.ShareScanVM=0
mem.ShareScanThreshold=4096
sched.mem.maxmemctl=0
sched.mem.pshare.enable = "FALSE"


This basically performs the same action as the configuration I put in /etc/vmware/config by telling the VM to eliminate the temp files and not to balooning and shrink memory, however it doesn't hurt anything to have it in both locations:

mainMem.useNamedFile = "FALSE"
MemTrimRate = "0"
MemAllowAutoScaleDown = "FALSE"


Additionally, by default Ubuntu writes an access time stamp to every inode that's accessed. This is pretty accessive and known to cause bottlenecks in high I/O scenarios. It doesn't negatively impact the filesystem unless you care about access time stamps, so in each VM and the VMWare host host I add "noatime" as an option to all of my mounted disks in /etc/fstab.

In order for the VMWare configuration to work properly with shared memory, you'll need to increase the default shared memory size for tmpfs to match the amount of memory in your system. This can be done by editing /etc/default/tmpfs:

SHM_SIZE=4G

You can use 'mount -o remount /dev/shm' and 'df -h' to implement and verify the change.

Last, I configure /etc/sysctl.conf on the VMWare Server which configures the kernel to perform better as a Virtual Server by inserting the following configuration:

vm.swappiness = 0
vm.overcommit_memory = 1
vm.dirty_background_ratio = 5
vm.dirty_ratio = 10
vm.dirty_expire_centisecs = 1000
dev.rtc.max-user-freq = 1024

Lastly, I disable the tickless kernel option in kernel 2.6.22 which further reduces the Virtual Machine I/O constraints by reverting back to using ticks which is better supported by VMWare. This can be done by adding the following option to the kernel options line in /boot/grub/menu.lst or /etc/lilo.conf:

nohz=off

With all of these options configured, the VMWare server now performs wonderfully at under 20% host CPU utilization with 6 Virtual Machines all running various flavors of Windows and Linux.

Embed RDP sessions between GNOME panels

A few months back I had (and still have) a need to run Windows terminal sessions from my notebook, this includes a connection to my Windows Virtual Machine locally. Being that it's a notebook I tend to switch resolutions based on my location. I quickly realized that I neither wanted a managed window, or a full screen terminal session because both were either klunky or just hard to manage with other windows around it. I devised this script which detects the current screen size, and then looks in gconf at the panel size. It then executes rdesktop to the host you specify (command line, or gui box) and fits the window in between the panels without the title bars.

The myrdp script allows easy window management of other applications while eating just enough of the windows desktop to display your panels. Its a great compromise.

Changing configuration options is a breeze, edit the script and change the options variable to suit.

The default rdesktop options are as follows (fine for most cases):

-K This option allows alt-tab etc to stay in Linux and not focus to Windows.
-D This option removes the title bar, and the window frame.
-0 This option connects to the console session of the RDP host.
-z Enables RDP compression
-xl Configures the RDP5 experience to LAN.

Download Download My RDP script (DEB) - [LINK]
Download My RDP script (TAR.GZ) - [HERE ]

SimCity 3000 on Linux HOW-TO

A few weeks back I worked up a tarball of libraries that allow SimCity 3000 to run on Ubuntu 7.10. I posted a link to it with a short how-to on Ubuntu forums [ LINK ] in hopes that it would help others with the same problem. It seemed largely a success, so I've gone a step further and built a deb package for Gutsy that will put the libraries into /usr/local/Loki_Compat and set the proper permissions.

Once you've installed my compat package, you'll need to cd into /usr/local/games/SC3U and rename the sc3u binary to sc3u.dynamic. Next, create the following shell script to start SimCity:
#!/bin/bash
PATH=/usr/local
SCPATH=$PATH/games/SC3U
LANG=english
cd $SCPATH
export LD_LIBRARY_PATH=$PATH/Loki_Compat/
LD_ASSUME_KERNEL=2.2.5 $PATH/Loki_Compat/ld-linux.so.2 $SCPATH/sc3u.dynamic
Name the script sc3u, and ensure that it's in the path /usr/local/games/SC3U. Set it's permission and ownership to 755 and root:root. Run SimCity 3000 as you normally would.

UPDATE:
I've created the SimCity 3000 gutsy patch, this patch will do the work above for you. To get it all working, just follow this process:

Install Sim City 3000 as root to /usr/local

Download the Sim City 3000 2.0a patch [ HERE ]

Install the patch by issuing:
sudo bash ./sc3u-2.0a-x86.run

Install the Loki compat libraries below

Install the SimCity Gutsy patch

Create a menu item to /usr/local/bin/sc3u

Download the Sim City Gutsy patch (DEB) - [ LINK ]
Download the compat package (DEB) - [ LINK ]
Download the tarball (TAR.GZ) - [ HERE ]

Background Buddy Wallpaper Software

Once upon a time, I wrote software for the Windows platform. Then Vista came along, and with it's high pricetag I decided that since I wasn't making enough money on the software that I'd release it free. As soon as I have more time, I will migrate the source to sourceforge.net and it will no longer require a license key. Here is some information about the application, and download links. At the bottom of the page you'll find a free license. Please note that it's not supported in any way on the Windows platform (If it doesn't install, or work; *SHRUG*).

What Background Buddy does:
Select a folder, and it will increment or randomly choose wallpaper based on a configurable timer. Windows edition includes systray support, Linux edition runs as daemon without the need for a GUI. Professional edition adds many features including wallpaper management and comments!

Windows Edition Screenshots:



> Windows Edition
- Smart Image rotation
- Smart Background color picker
- Support for fast user switching
- Multiple configuration options not available in the "Lite" edition
- Comment Editor
- Now available as free software, get a license key below.
- Product support EOL August 1, 2007

> Linux Edition
- Window Manager Support: Gnome, Fluxbox, WindowMaker, and XFCE
- Orientation Support: Zoom, Centered, Stretched, Scaled, and Wallpaper
- Searches subdirectories, and randomizes wallpaper displayed
- CLI Daemon, just start it with your X session

Get Background Buddy:
Background Buddy Linux v1.23 (deb) - [HERE]
Background Buddy Linux v1.23 (tgz) - [HERE]
Background Buddy Windows XP v3.05 - [HERE]

Get EUS Working in Ubuntu

I've gotten Erics Ultimate Solitaire working in Ubuntu, here is how to get it going. It was much easier to get EUS working than SimCity 3000, unfortunately it isn't really pretty since it's dependent on older Gnome libs.

Download eus-lib.tar [ HERE ]
tar -xvf eus-lib.tar
sudo mv libstdc++-libc6.1-1.so.2 /usr/lib

Insert the EUS installation CD
sudo bash /media/cdrom/setup.sh
sudo cp /media/cdrom/bin/x86/EricsSolitaire.dynamic /usr/local/games/EUS/EricsSolitaire.dynamic

Download the EUS 1.0a patch [ HERE ]
sudo bash eus-1.0a-x86.run
sudo ln -sf /usr/local/games/EUS/EricsSolitaire.dynamic /usr/local/bin/eus

Then you can just run eus, or put an icon in your panel for it manually.

Switch from Windows to Linux and KEEP Windows

Converting to Linux can be a painful process. Something that you can do to make the transition easier would be to virtualize your existing Windows system, making it so that you can not only dual boot Windows and Linux, but you could also boot that very same Windows instance inside a virtual machine.

Note: If you are running XP home, or pro and you are not using a corporate edition, you will need to re-authorize your copy of Windows. Be sure to do that within 3 days, however wait until the end of the process to ensure that it doesn't have to be done more than once.

There are a few things that need to be done to prepare your Windows desktop for it's new dual role. Before we begin, this HOW-TO assumes that you split your primary master IDE (hda) hard drive into two or more partitions when you installed Ubuntu. It also assumes that your first partition (hda1) is Windows XP.

First, in Windows; go to the Hardware Profile screen. You can get there by performing the following steps.

* Right Click My Computer, and select Properties
* Click the Hardware tab
* Click Hardware Profile

Create a new Hardware profile, and label it Virtual.

Next, reboot Windows selecting the new hardware profile "Virtual". Open Internet Explorer, and go to Microsoft.com. Search for knowledge base article 314082 (or click [ HERE ] for a direct link). Follow the instructions at the bottom of the page to create the Mergeide.reg file. Double click that file allowing it to write to the registry. What this does is insert generic IDE drivers into Windows which will allow it to boot on alternate hardware rather than what you have on your system board. Without this, Windows will just blue screen when you attempt to boot it in a VM.

Reboot the system and select Linux.

Now, we need to add your user account to the disk group so VMWare will have access to your partitions.

This can be done by opening a terminal window and entering the following commands:

* Open the terminal by clicking Applications -> Accessories -> Terminal
o sudo usermod -a -G disk $USER
* Once your user account is in the disk group, log out and back in. You can verify that your account was added successfully by issuing:
o grep disk /etc/group

Then looking for your username to be at the end of the line returned.

Next we need to find a way to bootstrap Windows without touching the boot sector. For this we'll use xpquick from bootdisk.com [ LINK ] which provides the NT boot sector and will locate your Windows partition that we define in a later step. Download xpquick.exe, and unzip it. This can be done by following these steps:

* Open a terminal by clicking Applications -> Accessories -> Terminal
o apt-get install unzip
o unzip xpquick.exe

Once you have xpquick.IMA, delete xpquick.exe.

Install VMWare server from the partner repositories by enabling that repository in Synaptic Package Manager which is located under System -> Administration.

In Synaptic Package Manager, select Settings -> Repositories -> Third-Party Software, and check the boxes for the partner repos. It's often handy to also select the Universe, Multiverse, and restricted repositories under the Ubuntu Software tab. After hitting close, press the Reload button to refresh packages. Once that completes, search for VMWare Server and mark it for installation. Once it's marked, click Apply and VMWare server will be installed.

In VMWare Server, create a new virtual machine. This can be accomplished by following these steps:

Open VMWare Server by clicking Applications -> System Tools -> VMWare Server Console.

* Connect to "local host
* Click "Create a New Virtual Machine"
* Select Custom Configuration
* Select the defaults other than those specified below:
o One CPU
o 512MB RAM
o Networking
+ Create a NAT Network device.
* Use a physical disk
o Use individual partitions
o Select the HPFS/NTFS partition

Close out of VMWare server for the next few steps.

Using a text editor, browse to the new virtual machine path and open the .vmx file. Change every reference of scsi0 including scsi0.0 to ide0 or ide0.0. Save changes, and close the file.

Still using the text editor, open the .vmdk file. Change "buslogic" to "ide". Save your changes and close out of the editor.

Now we need to copy the xpquick.IMA file to the folder containing the virtual machine. Rename it in the process to xpquick.img.
Re-open VMWare Server and select your virtual machine. Go to the settings of the VM, and change the floppy location to image, and set the image to xpquick.img. Also, make sure that the floppy drive is configured to connect at power on.

Boot your newly created VM, and select the "Virtual" hardware profile. You'll need to reboot a few more times to get through all of the hardware detection, then you should be at a desktop. Unfortunately, you'll have no mouse yet.

Press control-alt to get out of the VM context, and tell VMWare to install VMWare Tools. This can be done by clicking VM -> Install VMWare tools. You'll need to click in the window again to give keyboard control back to the VM. Walk your way through the installation using the tab and enter keys. Once it's complete, reboot when prompted.

Once you are back into Windows using your "Virtual" hardware profile, go ahead and re-activate Windows if necessary. Also, go through and disable some of the hardware specific services that were installed to support the non-virtual hardware.

So, there it is you now have a dual mode Windows XP. If you are running Pro, you can tell the virtual machine to start up when you boot your computer, then you can just RDP into it using Terminal Server Client which is located under Applications -> Internet, or you can download my RDP script which can be found in the Linux section.

Check back often, next up is how to configure Virtual Windows XP Pro to use Samba, and share My Documents with the Linux host!

Stream ABC.com on Linux with Wine

This HOW-TO will help you if you have interest in watching the full episodes of TV shows that are provided on sites like ABC, CBS, etc by showing you how to install MovePlayer for Windows on Linux with some help from WINE.

WARNING: This requires lots of horse power. I've been monitoring load when I watch media, and it looks like it's mostly xorg which leads me to believe that some work needs to be done in Wine to better integrate with XV or OpenGL for media playback. I hope to script this, and get that up here for everyone to download, but until then here are the steps involved. Note, I did this on Gutsy so your mileage on other platforms will probably vary. If you are successful though, please leave a comment with anything that you did differently.

Step 1:
First, grab the MS Core fonts .exe packages from sourceforge
[ HERE ]. These are Windows core fonts so I recommend installing all of them.

Download them all to a temp directory, Open a shell and CD to that directory, then run the following:
for item in *exe; do wine $item; done
For each of these, click through the EULA, and click the close button. They will all start automatically one by one. If you accidently downloaded the MS Office 97 Viewer (wd97vwr32.exe), you can skip that one.

Step 2:
Grab the latest Mozilla Firefox for Windows [ HERE ]
Install Firefox using wine

Step 3:
Go to [ http://dynamic.abc.go.com/streaming/landing ]
Click the watch now button

Step 4:
Install flash using the link provided by ABC.

Step 5:
Return to [ http://dynamic.abc.go.com/streaming/landing ]
Click the watch now button
Install Move Media Player by following the on screen instructions.
Restart when prompted

Step 6:
Watch TV Shows

PhotonBBS for Unix and Linux

PhotonBBS is a stable BBS platform for Linux which allows for infinite customization. The software is written in Perl, and leverages the PhotonAPI. This platform supports unlimited nodes, a multi-user teleconference, BBS doors and much much more. The default theme emulates the look and feel of MajorBBS.

Menu Breakdown (Information not contained in the readme.txt)
Menu Choice|Description|Executable|Security Level|Disabled|Special|Type|Number of users

1: Menu choice, typically 1-X or A-Z. Can be more than one character.
2: Description of the item (for display on the menu)
3: Executable, What to execute when called
4: Security level (0-X)
5: Disabled? Yes 1 or No 0
6: Special: One of the following.
External -> Shell out and execute Executable
Menu -> Go to Menu
Bye -> Exit and log off
Internal -> Internal BBS command
Oneliners -> Show BBS oneliners
Bulletins -> Show BBS bulletins
Who -> Who's online
Help -> Display Help
Rlogin -> Rlogin to Executable
Telnet -> Telnet to Executable
SendPage -> Sends a page to user X

User commands are defined in the example useredit.mnu which is called from Global.mnu as a sub menu.

7: Type (unused, set to 0)
8: Number of users, Sets the number of concurrent users allowed to run the defined external command

Download PhotonBBS - [ HERE ]
Download ChatBOT - [ HERE ]

Home Theater installation

As we decided on a house we agreed that we should build out a theater room. After months of research while waiting for our house to close, we decided on a 7.1 surround system, and a 720P native LCD projector.

Since we were building the house, we went ahead and made some modifications to the great room including adding 7.1 wiring, an electrical outlet in the ceiling for the projector, as well as a PVC chase pipe that runs from the projector area down to where the Dish receiver and DVD player sit in front of the screen.

Once we moved in, we ordered all of the parts for the job including a 100" screen from DA-Lite. All the parts came in at various times, and I was installing them pretty much as they arrived. Once we hung the screen, we realized that we wanted more than 100" and that the DA-Lite
high contrast screen didn't really do much in that room so we decided to return it.

One afternoon we agreed that we needed something different, so we set out to find something better to do with the wall. A few days went by, and I spent most of it researching the best approach to have a 120" or better projection on this wall. We ended up deciding that paint was the best option, and after looking at theater goo, and several home grown approaches like "mississippi mud" we figured we'd start with pure white and see how that worked out.

The next day, we headed off to home depot where I bought a can of Behr primer, and a can of Behr premium ultra white flat. We also picked up sandpaper, a pole sander head, painters tape, painting paper, 1/4" nap rollers, etc. While we were there we hit the molding section, and picked up all the wood we needed for the frame. After finding wood for the frame, we picked out another color of paint for the frame (dark so that it "pops") and set off home to begin painting the wall the next day.

Sunday morning, I rolled out of bed and I started painting the molding before I even had coffee! I was pretty stoked to get my project completed. Once I taped off the wall (118" long, 66" tall, 135" diagonal) I sanded, and that took FOREVER! Once I had a smooth surface, I wiped it down to remove any left over dust and I applied a coat of primer. The primer took about 2 hours to dry, but once it was done I had to sand it again. After sanding, I applied the first coat of ultra white paint. That took another 3-4 hours before I could sand it. While I waited I applied another coat of paint to the moulding. Once the paint dried, I sanded it again and applied the final coat. After the final coat dried, I started assembling the frame which once completed was approximately 132" diagonal. The whole project took about 13 hours, but it's so well worth it! The pictures just don't do it justice. It's got to be the single coolest thing I've ever put together.

Update: We've added blackout panels and have found the ideal entertainment shelf. I've also updated the article with more information on what I did during each step for those that would like to build their own frame.


Taping off the wall, be sure that you measure out the anticipated widths, and add about an inch total (1/2 inch on each side of overlap, so the paint lines will be hidden behind the moulding.

Sand the wall using a pole sander, and 180 grit wallpaper,try to make the wall as smooth as possible. Wipe off access sand with a slightly damp cloth.


Prime the wall with a 1/4" nap roller. When the paint dries (about 4 hours) re-sand the wall and apply a coat of paint while still using a 1/4" nap roller. Allow this coat to dry, then sand down and apply a final coat.

When dry, gently remove the painters tape by pulling it straight tearing the paint. Do not pull it quickly, as it could peal paint off of the wall. Apply the moulding (pre-paint and allow to dry before starting the wall), the moulding should cover around 1/2" of the paint. This will allow you to hide any paint problems from removing the painters tape.

Tack the moulding to the wall using finish nails, be sure to fill the holes and touch up with a small brush.

This is what the theater looked like when the frame was completed.


We later added blackout curtains. We used 4 panels, and attaching them in pairs, and using velcro to hold them together.

This is the theater at 9AM, as you can see it looks just as good as it would at night.

Updated pictures (June 08):
Added fake plants to hide the wall sockets, a Wii, and the HTPC. Playing Wii on this thing with 4 people is insane.

Lowered the Projector, and eliminated the -2 keystone. This also allowed the image to be projected without software scaling internal to the projector, this sharpened the projection noticably especially in HD resolutions.

RAID - In a spreadsheet?

A few years ago I was asked how RAID5 was able to re-create data when a drive failed. I created a spreadsheet to show visually how it was done. I've stumbled on that spreadsheet again, so I thought I'd put it here in case anyone else would like to know just how RAID-5 works.

RAID-5 protects data by using an amount of storage equivalent to one physical disk in your array to write the parity or checksum information of the data on the rest of the storage area. Parity is calculated using XOR. Hardware RAID controllers calculate parity when writes are made to the array, and the read from the parity to reconstruct the data of a failed drive on failure. Software RAID controllers use CPU time to do parity calculation which can incur a significant amount of overhead.

The formula for parity of one stripe of data (one row in the table above) is:

P1 = (((D1 XOR D2) XOR D3))

Download the "How Raid Works" spreadsheet which implements RAID-5 in a group of cells.

Spreadsheet: How Raid5 Works - [HERE]

Note: Spreadsheet requires Gnumeric [LINK].

Chizzle BBS Style Chat server

Chizzle is a robust telnet or ssh based chat system built on the Photon API. Chizzle is a multiuser teleconference like chat system that is designed to be a complete interface for multiuser chat sessions. It supports enforcing encrypted chat rooms (by determining that a user is connected by telnet or ssh), and now in the latest revisions, it even supports door games. Chizzle is updated whenever I get the urge to add a feature, or when I spot a bug.

Download Chizzle - [ DOWNLOAD ]

Network Dumper - Log data on a given socket

This script basically redirects all traffic sent to a given port to a text file before passing the traffic along a socket. I wrote this years ago to use in troubleshooting socket connections for TCP/Anywhere.

The script listens on a defined socket, establishes a new socket to the defined destination, and dumps packets captured to disk. It will run on any OS with Perl.

Download Network Dumper - [HERE]

TCP/Anywhere - TCP transport through HTTP proxies

I recently had a question about how to get an application without support for a network proxy through a firewall. This is a challenge I met and beat back a few years ago (winning a bet in the process haha). See below for detail on how to use my TCP/Anywhere application to get services that don't support proxies out to the internet.

TCP/Anywhere makes non-proxy friendly applications work like they do back home. (Note: some proxy servers disable CONNECT rendering this method inoperative)

Windows users will want to download Cygwin and Cygwin Perl (link), though TCP/Anywhere may work with recent versions of ActivePerl(untested). Grab a copy of TCP/Anywhere (link) Next, extract TCP/Anywhere someplace in your cygwin path.

Ex.
"c:/documents and settings/$USERNAME%"


You'll then want to know what TCP ports that your application talks on. Here are a few "common" ports:

POP3: 110
SMTP: 25
SSH: 22
Telnet: 23
FTP: 21
NNTP: 119
VNC: 5900
RemoteDesktop: 3389

Next, open one of the TCP/Anywhere INI files (or create a new one) with your favorite editor. Be sure to give it everything that you need to connect to. (Note: only one INI per TCP/Anywhere instance)

Set this option to one of the remote ports in the above table (Note: you may also set this to your own TCP port, on some systems the local port must be over 1024)

port=REMOTE_PORT

Set this tag to the host you would like to connect to, followed by theport (use a : to separate)

remote=REMOTE_HOST:REMOTE_PORT

Set the proxy address to your internal proxy server (check your browser settings for this information).

proxyaddress=proxy.server.yourco.com

Configure the proxy port to the internal proxy servers service port (check your browser settings for this information).

proxyport=PROXY_PORT

Configure the connection pool to the maximum number of concurrent connections you would like to service. This will not cause the application to exit at MAX_NUM_CONNECTIONS, it will just throttle the application to only use up to MAX_NUM_CONNECTIONS connections at a time. The default of 20 is usually sufficient.

connections=MAX_NUM_CONNECTIONS

Lastly, the local tag tells the application to listen locally or globally. If set to global, other persons on your network will be able to access this application from their computers. Typically set to 0.

local=NUMBER

Once configured, save your changes and exit your editor. From the command line, execute the application.

./tcpawmyconfig.ini

When TCP/Anywhere returns the prompt, open your favorite application. Configure the application to connect to your local network IP address on whatever port you set as "port=" in the ini file. Ask your application to connect, and if all goes as planned you'll have access! It's that easy.

Get TCP/Anywhere (5KB) - [HERE]
Get TCP/Anywhere Server (5KB) - [HERE]

Quickswitch - ATI FGLRX manipulation utility

Recently, I've started moving my computer around a lot more connecting and disconnecting it from the monitor constantly. I wanted an easy method of switching from my laptop display to my LCD monitor and back quickly. With that goal in mind I started googling which before long left me realizing that many other people had the same desire, but there wasn't really any easy way to "make it so". Digging into the device driver for my card (an ATI Xpress 200) I figured out that I can make the display shift from monitor to laptop display with one command:

aticonfig--enable-monitor=X

The supported modes(X) for the FGLRX driver are defined as follows:
  • CRTmonitors (tube) 1 and 2 (CRT1,CRT2)
  • LaptopDisplay (LVDS)
  • Television (TV)
  • HDMI (LCD)1 and 2 (LVDS1, LVDS2)
In the future I'd like to completely automate this process, but for now I have created a script that detects and switches screens and resolutions. Today, it must be configured for both screens and resolutions.

To configure it, edit it with your favorite editor:

vi quickswitch.pl

Change the following variables to match your configuration:
  • $default{'monitor'}
  • $default{'resolution'}
  • $alternate{'monitor'}
  • $alternate{'resolution'}
Save your changes, and place it or a link to it in a directory that is accessible in your path:

sudo mv

quickswitch.pl/usr/bin


Once you have completed this step, create a shortcut to it or if you are using the GNOME desktop; create a shortcut to it:

gconf-editor

Expand:

Apps\Metacity\Global_Keybindings

Open:

run_command_1

Set it to something like:

F8

Expand:

Apps\Metacity\Keybinding_Commands

Open:

command_1

Set it to:

/path/to/your/quickswitch.pl

Close gconf-editor. Test your new command by holding control-shift and pressing the F8 key.

Download Quickswitch - [HERE]