Archive for Computer Tips

Wine vs. Windows Vista

After reviewing my previous post regarding benchmarks between Wine and Windows, I decided the conclusions needed updating for multiple reasons:

  1. Wine has evolved quite a bit — we now have a “stable” 1.0 release as well as other new releases.
  2. Windows has been updated since Windows XP — namely, Windows Vista.
  3. Hardware has changed drastically

The machine I am running these benchmarks on (my machine):

  1. Core i7 920
  2. 3x1GB DDR3 1333 RAM
  3. MSI X86 Platinum
  4. XFX GTX 260 Black Edition

Benchmarks were ran on Ubuntu Intrepid and Windows Vista, all with every available (default) updates (including service packs) and no other applications running. I disabled desktop effects in Ubuntu, and I disabled Aero (I set the theme “Windows Classic”) in Vista. I used Cinebench R10 in WINE version 1.1.17.

Results were as follows:

Test Vista Ubuntu Percent
Single CPU Rendering 3190 3197 0.2% for Linux
Multiple CPU Rendering 13039 11060 15.2% for Windows
OpenGL 4873 7634 36.2% for Linux

A few interesting things to note:

  1. WINE and Windows have almost exactly the same performance for running processes that only use one CPU (single thread.)
  2. Windows scales better then WINE scales. WINE will fall behind when running processor-intensive multi-threaded applications, but the application would be far from unusable.
  3. WINE is substantially better then Windows (36.2%) at running OpenGL applications, which means games and other software that use OpenGL may actually run better in WINE then in Windows.

Leave a Comment

Ubuntu with two graphics cards

As many of you may know, the newest NVidia drivers (181.22) added support for using a secondary graphics card (8 series or above) as a dedicated PhysX processor… and, if you add another graphics card, you get some more VGA/DVI ports as well.

Anyway, NVidia hasn’t yet been kind enough to provide a driver update for Linux, but it is still possible to use both your graphics cards (as well as multiple monitors!) with Ubuntu. I dove into the process this weekend, finding minimal-to-none documentation about how to do it… very annoying.

However, it is actually rather easy. First of all, start with a new installation of Ubuntu with all updates downloaded and installed (EXCLUDING video drivers). Then, boot up your computer into Ubuntu… you’ll probably have a graphical login screen on whatever monitor is connected to your primary graphics card.

If you do:

  1. Log in
  2. Open a new terminal from Applications -> Accessories -> Terminal

If you don’t:

  1. Press control + alt + F1 to get a fresh console
  2. Log in

Now, at this point you should be able to execute a few simple commands. The first thing we need to do is stop X from starting when the system boots up. Run this command:

sudo update-rc.d -f gdm remove

Now, reboot your computer. If you are in a console and don’t know how to do so, just enter this command:

sudo shutdown -r now

Upon reboot, you should be presented with a standard console-based login prompt. Go ahead and login, and download the lastest NVidia drivers for Linux by using this command:

cd
wget http://us.download.nvidia.com/XFree86/Linux-x86/180.22/NVIDIA-Linux-x86-180.22-pkg1.run

Next, start the NVidia installer. Make sure you accept the license agreement, try to download the kernel module, and if one can’t be found, tell the installer to compile one (you’ll be prompted.) Here’s the command:

sudo sh NVIDIA-Linux-x86-180.22-pkg1.run

After the installation is complete, you’ll have to run the nvidia-xconfig program to set up your /etc/X11/xorg.conf file to run a separate X server on each of your graphics cards. To do this, simply run this command:

sudo nvidia-xconfig -a

Once the command completes (should not take long at all), re-enable Xorg/GDM with this command:

sudo update-rc.d -f gdm defaults

Restart your computer with this command:

sudo shutdown -r now

This time, you should get a graphical login screen. Go ahead and login, and open a terminal. Run this command:

sudo nvidia-settings

… and set up your displays. You’ll want to enable Xinerama.

Comments (6)

Java: Scrolling a JScrollPane (JEditorPane) to the bottom

Recently, I’ve stumbled upon a difficult issue in Java. If you’ve got a JEditorPane contained in a JScrollPane, and you add text to the JEditorPane and then, on the next line, try to scroll the JEditorPane to the bottom, you’ll still end up with the scroll bar at the top. The reason is quite simple: Threading. When you call JEditorPane.setText(), you cause Java to do some stuff behind the scenes in a different thread — not the main thread. When you then try to set the scroll position on the next line, the scroll bar position will change — however, Java’s behind the scenes thread will move it back to the top — pretty standard concurrency bug. Anyway, there is a simple fix:

private void scrollPaneToBottom() {

SwingUtilities.invokeLater(new Runnable() {

public void run() {

jScrollPane1.getVerticalScrollBar().setValue(

jScrollPane1.getVerticalScrollBar().getMaximum());

}

});

}

SwingUtilities.invokeLater runs a Runnable (which is pretty much a thread, for this extent and purpose.) after all of Java's behind-the-scenes stuff finishes.

Comments (4)

Mumble, a free (as in speech) TeamSpeak/Vent alternative

For the past couple of weeks, I’ve been using Mumble to replace a TeamSpeak server one of my friends was paying for. We’re all quite pleased with the results.

Server installtion could not be easier. If you’ve got an Ubuntu server, you can simply install the ‘mumble-server’ package and change a couple of configuration files, you’ll be up and running in no time.

The client side interface is really where Mumble shines. For the first time ever, configuring an audio application on Linux was as simple and painless as it was on Windows and Mac. The voice activation features were more advanced then I’ve ever seen — not just a simple threshold. Echo cancelation seems to be done incredibly well too.

All in all, a very good, very solid application… give it a shot: http://mumble.sourceforge.net/Main_Page

Leave a Comment

Automatically mounting internal hard drives in Ubuntu

As I am sure anyone with their music on a different internal drive has noticed, not all of your internal hard disks are mounted automatically at boot. However, getting an internal hard drive to automatically mount is fairly easy.

First, reboot your computer to make sure that no other drives are mounted. Then, mount the internal drive you wish to have mount automatically. You can do this by selected the drive from the “Places” menu and entering your password.

Now, open a new terminal and enter this:

df

Look for the drive mounted at /media/disk. For me, this was /dev/sdb1.

Filesystem           1K-blocks      Used Available Use% Mounted on
/dev/sdc1            152333348  24986968 119608276  18% /
tmpfs                  1036224         0   1036224   0% /lib/init/rw
varrun                 1036224       104   1036120   1% /var/run
varlock                1036224         0   1036224   0% /var/lock
udev                   1036224      2856   1033368   1% /dev
tmpfs                  1036224       384   1035840   1% /dev/shm
lrm                    1036224      2000   1034224   1% /lib/modules/2.6.27-7-generic/volatile
/dev/sdb1 240362656 219662284   8490572  97% /media/disk

Quit any applications that may be using that disk (Music players, file browsers, etc.) and enter this:

sudo umount /media/disk

Once the drive is unmounted (which is should be after you enter your password) enter this:

sudo mkdir /media/disk

Then, open your fstab file:

sudo gedit /etc/fstab

In the new gedit window (which will appear after you enter your password), enter this at the bottom of the file:

/device/path /media/disk    fs_type rw    0    0

Make sure to replace /device/path with the device mounted in /media/disk when you ran df. fs_type should be the file system type of the drive, probably ext3. Those are TABS, not spaces, between each item.

Save the file, and restart to make sure your drive auto-mounts.

Leave a Comment

Nvidia control panel crashes when trying to save Xorg in Ibex

If you use dual-screens, Ubuntu Ibex, and the Nvidia drivers, you were probably just as mad as I was when you configured your dual-screen setup, clicked the handy “Save to X Configuration” button, and saw your nvidia-settings window disappear.

Ya, its a bug. Luckily, it is easy to fix. Apparently nvidia-settings doesn’t like overwritting the default Xorg file. In order to make it happy, open a new terminal and type:

sudo mv /etc/X11/xorg.conf /etc/X11/xorg.conf_backup
sudo /usr/bin/nvidia-settings

Set up your dual-screen settings, click the “Apply” button, and then click the “Save to X Configuration” button. You’ll be prompted to enter a path. Enter this:

/etc/X11/xorg.conf

And press “Save.”

Restart your computer/Xorg to make sure it worked. If something went wrong, restore the xorg.conf_backup file to its previous glory and try again.

Leave a Comment

Ubuntu 8.10: First impressions

I’ve been using Ibex for about a week now (since the release, so I suppose more like 8 days) and I figure I could bless you all with a semi-extensive review ;) .

Look and feel: The first thing I noticed was the new default desktop — a drastic move away from KidPix orange to a much more professional, darker, and more abstract look. The darker desktop compliments the Human theme quite well, and adds a better feel to the desktop.

OpenOffice: Despite normally being on top of software updates, Ubuntu was slacking in a very noticable place: OpenOffice. Currently, the repo’s contain version 2.4 of OpenOffice. This was a big disspointment for me, so I did a little Googleing and found out it was really easy to install OpenOffice 3 in Ibex.

Graphic User Interface: There were quite a few noticable GUI changes in 8.10. The first you may notice is the new shutdown menu. It is now a pull-down with options that don’t have confirmation messages. Be careful! I’d still say it is an improvment over the old screen. If you press your computer’s power button, you’ll be prompted with a very nice looking window. And, as an extra added bonus, Pidgin will intergrate into your shutdown menu, so you can change your status and your computer’s status from the same place.’

You’ll also notice that the restircted driver manager is much, much nicer.

Restricted Drivers: If you install the “restricted” drivers for your Nvidia or ATI graphics card, you’ll notice that the control centers for both are also installed. The ATI control center can be found under Applications -> Accsessories, and the Nvidia control panel can be found under System -> Administration. This makes dual-monitor setup much, much faster, and much, much easier.

Currently, suspend and hibernate are broken on my Dell Latitude D531 (it worked in 8.04), but other then that, everything is working great. More to come.

Leave a Comment

Ubuntu on a Dell XPS M1530

My friend just bought a Dell XPS M1530 and wanted to put Linux on it, and, of course, I felt obligated to help. The installer worked fine, but after booting into Linux for the first time, we ran into a problem.

The machine was running BIOS revision A09 (you can see what revision your machine is running when you boot the computer) and the first problem we had to solve was getting the touchpad to work. In order to this, we had to do a couple of things.

First, we had to add an option when we booted the kernel. To do this, boot into Ubuntu (you don’t need to login) and at the login screen press Control + Alt + F1. This will give you a text-based shell to your system. Login using the username and password you set during the installation.

Next, enter:

sudo pico /boot/grub/menu.lst

Once you get the file open, scroll down until you see the end of all the comments. You should then see a GRUB menu item that looks something like this:

title Ubuntu 8.04
root (hd2,0)
kernel /boot/vmlinuz-2.6.24-19-generic root=UUID=d7e165c2-5123-4034-b714-e9066d724f58 ro quiet splash
initrd /boot/initrd.img-2.6.24-19-generic

At the end of the kernel line, add:

i8042.nomux=1

So that, in the end, the entire kernel line looks like this:

kernel /boot/vmlinuz-2.6.24-19-generic root=UUID=d7e165c2-5123-4034-b714-e9066d724f58 ro quiet splash i8042.nomux=1

Close pico by pressing control + X. Make sure to save the file to the same name it was before. If you get a permission denied error, you forgot to run the command with sudo.

Next, reboot the computer by typing:

sudo shutdown -r now

Once your computer is rebooted, you should be able to use your touchpad. You will have to do this every time you install a new kernel.

On my friend’s Dell, there were still problems. If you opened up mouse preferences, (System -> Preferences -> Mouse) there was no “Touchpad” tab like there is on most computer. In order to fix this, open up your xorg.conf file by opening a new terminal and typing:

sudo gedit /etc/X11/xorg.conf

Once the gedit window opens, scroll down until you see an InputDevice with a Identifier of “Configured mouse.” Delete this section. Chances are, you installed Ubuntu with a USB mouse plugged in, so the laptop treated that mouse as your default. Save your file and reboot.

Comments (1)

Starcraft in WINE with a widescreen/dual screen setup on Ubuntu

For anyone who has tried running Starcraft in WINE in either a dual-screen setup or on a widescreen monitor has probably ran into this problem: The resolution doesn’t work.

Because of Starcraft’s lovely static 640×480 resolution, TwinView, as well as a wide screen monitor, aren’t going to like it very much. The solution, surprisingly, is rather simple.

Let’s get started. Like all WINE applications, let’s create our WINE prefix. Open a new shell from Applications -> Accessories -> Terminal. Once the shell appears, enter these commands:

mkdir .wine_sc
env WINEPREFIX=”/home/YOURUSERNAME/.wine_sc” winecfg

Replace your YOURUSERNAME with the name of your home folder. If you don’t know the name of your home folder, type “cd && pwd”. Whatever is after “/home/” is the name of your home folder.

Once the wine configuration window opens, set your default Windows version to Windows 98 (from the popup menu.) Then click on the audio tab. Click on “Apply” if it is enabled, and then “OK”.

Now that we’ve got our WINE prefix setup, let’s install Starcraft into it. If you are installing from a CD, insert it. If you are installing from an ISO, mount it using the way you are accustom to. Either way, open up the disc. You should now see a Nautilus window with a file named “INSTALL.EXE” in it.

Open up a terminal so that both the Nautilus window and the terminal are visible. In the terminal, enter the following but do not press return. There is a space at the end.

env WINEPREFIX=”/home/YOURUSERNAME/.wine_sc” wine

Next, click and drag INSTALL.EXE into the Terminal window. This will put the path to the EXE into the terminal, at the cursor. The line should now look something like this:

env WINEPREFIX=”/home/YOURUSERNAME/.wine_sc” wine /path/to/your/INSTALL.EXE

Press enter, and go through the Starcraft installation. Make sure to create all of the shortcuts it suggests.

Now, for the fun part. Open up your xorg.conf file (you may want to back it up first) by pressing Alt + F2 and entering:

gksudo gedit /etc/X11/xorg.conf

Go to the bottom of the file, and then add this:

Section “ServerLayout”
Identifier “SCLayout”
Screen 0 “StarCraft Screen”
InputDevice “Keyboard0″ “CoreKeyboard”
InputDevice “Mouse0″ “CorePointer”
EndSection

Section “Screen”
Identifier “StarCraft Screen”
Device “Device0″
Monitor “StarCraft Monitor”
DefaultDepth 24
SubSection “Display”
Virtual 640 480
Depth 24
Modes “640×480@60″
EndSubSection
EndSection

Section “Monitor”
Identifier “StarCraft Monitor”
VendorName “Plug ‘n’ Play”
ModelName “Plug ‘n’ Play”
Gamma 1
ModeLine “640×480@60″ 25.2 640 656 752 800 480 490 492 525 -hsync -vsync
EndSection

Keyboard0, Mouse0, and Device0 should be the defaults. If they are not, I will assume you changed them and know what they are.

Now, we need to allow user access to Xorg. Edit /etc/X11/Xwrapper.config, and the change the line:

allowed_users=console

To:

allowed_users=anybody

Save your xorg.conf file, and restart your X session by either rebooting or pressing control + alt + backspace. Once you’ve logged in again, we’ll create the shortcut to run Starcraft.

Open gedit or your favorite text editor (Applications -> Accessories -> Text Editor) and copy and paste the following into a new document:

#!/bin/sh
X :1 -layout SCLayout -ac &
XPID=$!
sleep 2
DISPLAY=:1 env WINEPREFIX=”/home/YOURUSERNAME/.wine_sc/” wine “c:\Program Files\Starcraft\starcraft.exe” — /usr/bin/X :1 -layout SCLayout
sleep 1
kill $XPID

Save the document as sc.sh in your home folder. Make sure to replace YOURUSERNAME with the name of your home folder. Close your text editor.

Open a new terminal window. In it, type the following:

chmod +x sc.sh
mv sc.sh .wine_sc

You may now close the terminal. Next, right click on the Ubuntu logo in the upper left hand corner of your screen and select “Edit menus”. Click on the triangle next to Wine, then the triangle next to Programs. Select the Starcraft folder. On the right side of the window, right click on the Starcraft icon and select Properties. In the command field, enter:

/home/YOURUSERNAME/.wine_sc/sc.sh

Click on the Close pushbutton. Now, click and drag the Starcraft icon into your Games menu. Close the “Main Menu” window.

Ta da! If you go to Applications -> Games -> Starcraft, Starcraft will open in its own X session, allowing you to play it like normal. To switch back to your main X session while in a game, press Control + Alt + F7. To then go back to Starcraft, press Control + Alt + F8. When you quit Starcraft, you will automatically go back to your standard X session.

Comments (12)

TeamSpeak in Linux with Logitech (or other) USB desktop microphone on Ubuntu

Teamspeak seems to be one of those applications that is just needed. You don’t raid without it. You don’t shot without it. You don’t live without it. Therefore, if it is so needed, should Linux users be excluded from the fun?

The Linux version of Teamspeak is crap. Total crap. You can only select on audio interface, and despite my hours of screwing around with padsp, I still could not get it to work with my desktop microphone. But there is a solution. Use the Windows version of Teamspeak in WINE!

I assume that if you are a Linux gamer who wants to user Teamspeak that you already have WINE installed. If not, follow the instructions here.

Once you have WINE installed, we need to install the native Linux version of Teamspeak (why?) to get the icon so our WINE launcher looks pretty. Go to Applications -> Add/Remove… and search for Teamspeak. Install it.

Once the Linux version of Teamspeak is installed, open a new terminal by going to Applications -> Accessories -> Terminal. Enter the following commands:

cd
mkdir .wine_ts
cp /usr/share/pixmaps/teamspeak.xpm ./.wine_ts

Don’t close your terminal just yet. Now, go to Applications -> Add/Remove… and uninstall Teamspeak by searching for it, unchecking the box, and clicking apply. Switch back to that Terminal.

Time for the tricky part. Well, kind of. A monkey’s common sense should get you through here. Enter this command:

cat /proc/asound/cards | grep USB

This will give you something that looks like this:

1 [default ]: USB-Audio – AK5370

If it does not, Linux is not even seeing your USB microphone. This guide can’t help you, sorry.

Find the number next to the USB device you want to use as your microphone. In my case, this was “1″. In that same terminal window, enter:

cd
gksudo gedit .asoundrc

Into the new gedit window that opens, copy and paste the following:

pcm.headset {

type hw

card 1

}

ctl.headset {

type hw

card 1

}

Replace the 1s with the number you had.

Now, run winecfg on our new wine prefix.

env WINEPREFIX=”/home/YOURUSERNAME/.wine_ts” winecfg

Replace your YOURUSERNAME with the name of your home folder. If you don’t know the name of your home folder, type “cd && pwd”. Whatever is after “/home/” is the name of your home folder.

Once winecfg opens, click on the audio tab. Ignore any errors and click “Ok” to close winecfg. Now, open the wine registry editor by entering the following into the terminal:

env WINEPREFIX=”/home/YOURUSERNAME/.wine_ts” wine regedit

Once again, replace YOURUSERNAME with the name of your home folder.

  1. Click on the plus next to “HKEY_CURRENT_USER”
  2. Click on the plus next to “Software”
  3. Right click on the “Wine” folder and go to New -> Key. Name the new key “Alsa Driver” (without quotes.)
  4. Right click on the newly created “Alsa Driver” folder and select New -> String value.
  5. Set the name to “AutoScanCards” (without quotes)
  6. Double click on the row of the new value. Enter “N” (without quotes) in the value field.
  7. Repeat step 4 to 6 for the following name/value pairs:
    • Name: DeviceCount Value: 2
    • Name: DevicePCM1 Value: default
    • Name: DevicePCM2 Value: headset
  8. Click the close button on the Registry Editor window.

Now, time to go back to winecfg window. Run this command, in case you have forgotten:

env WINEPREFIX=”/home/YOURUSERNAME/.wine_ts” winecfg

Click on the audio tab, and set “Hardware Acceleration” to “Emulation”, and check the “Driver Emulation” check box. Click on the apply button, then the OK button. Now, we need to download Teamspeak and install it in WINE.

First we need to download Teamspeak. For the newest version, go to http://goteamspeak.com and download the Windows installer. Move it into your home folder. If you would like to use a version that I know works, run this:

wget ftp://ftp.freenet.de/pub/4players/teamspeak.org/releases/ts2_client_rc2_2032.exe

… and wait for the download to finish. Once you’ve got the Teamspeak installer downloaded, run it with this command:

cd
env WINEPREFIX=”/home/YOURUSERNAME/.wine_ts” wine ts2_client_rc2_2032.exe

If you downloaded a newer version, replace ts2_client_rc2_2032.exe with the name of your installer.

Click through the installer (yes, yes, accept, you own my soul, accept…) and ignore the error about codecs not installing. Make sure to create a desktop shortcut! Close the Teamspeak installer.

Now, making it all a nice part of the Ubuntu system is something I always like doing. Right click on your little Ubuntu logo (in the upper left of your screen. Yes, that one.) and select “Edit menus”.

Click on “Internet” and click and drag the Teamspeak launcher on your desktop into the pane on the right. Once it is there, right click on it, and select “Properties.” In the window that appears, click on the icon button (which is probably currently a bottle of wine.), and enter this into the field at the top:

/home/YOURUSERNAME/.wine_ts/teamspeak.xpm

… and press enter. Close the “Main Menu” and “Launcher Properties” windows.

Now you can open Teamspeak! Go to Applications -> Internet -> Teamspeak 2 RC2. Once it opens, go to Settings -> Options. You should be able to select “USB Audio” as your input method and the only option for output. Set the sound driver to Wave and check the force 8 bit recording box. Click apply and then close.

My configured Teamspeak settings

Ta da!

Comments (4)

Older Posts »