Main

Tips Archives

December 7, 2006

Windows SFU NFS Server Handle Timeouts

At work, I use the Services for Unix NFS server to share source hosted on my Windows XP box over to my Ubuntu box. In general the SFU NFS server performs well (way better than sharing over SMB) and doesn't cause any problems, except one.

When an nfs client accesses a file hosted on the windows machine, the NFS server opens up a file handle to the file on behalf of the client. The NFS protocol is stateless, however, so the server doesn't know how long it should keep the file handle open. The server uses a heuristic (a configurable timeout value in the registry) to decide how long it wait for another request from a client to the same file before releasing a handle.

This is all fine, except that while the NFS server has a file handle open, other programs on my Windows box start getting errors when I try to write to that file. The common scenario is code editing -- I'm editing a source file on windows, and an invocation of a build on the Linux side accesses that source file. It accesses it usually only very briefly, but now I have to wait for the timeout before the editor can write any changes out again (though issuing a :w! in vim appears to work).

The real solution is to reduce the timeout value. The registry keys are located in:

HKLM\System\CurrentControlSet\Services\NfsSvr\Parameters

Look for the keys:

RdWrHandleLifeTime
RdWrNfsHandleLifeTime
RdWrThreadSleepTime

On my machine they were all initially set to 5 (meaning 5 seconds). I set them all to 1, and now I rarely run into the problem. Thanks go to Ramesh for the original tip.

December 8, 2006

VMware vmmouse Xorg mouse driver in Ubuntu Edgy

I recently installed Edgy in a VMware Server 1.01 VM at work, and discovered that because it comes with Xorg 7.1.1, the vmmouse driver that gets included with the tools package doesn't get installed as part of the tools install.

But it turns out the Xorg 7.0.0 version that we do package works fine with Edgy's Xorg. All you have to do is, copy vmware-tools-distrib/lib/configurator/XOrg/7.0/vmmouse_drv.o to /usr/lib/xorg/modules/input/ and then in your /etc/xorg.conf, load the "vmmouse" driver instead of the "mouse" driver (don't forget to restart your X session) and that should do the trick.

December 15, 2006

Consolas, only for Vista

I've written about how you can use Consolas (A new font in office 2007 / Windows Vista) on Windows XP, and how to set it up as the font for powershell.

I even set it as my fixed width font in Internet Explorer 7.

All seemed well, until I RDP'ed in. It turns out these new fonts don't have the proper hinting of their forefathers (Arial, Lucida Console, Courier New). So if you RDP into an XP host, which doesn't support font smoothing over RDP, then you get really crappy non-smoothed versions of Consolas. I suppose you could switch the font every time you log in and out, but that's just too annoying.

Because of this, I've switched everything back to the old XP fonts. I'll have to wait until I install Vista to really benefit from the new fonts. With a Vista host, you can use the new MS RDP client to get font smoothing over RDP, then all will be kosher again.

December 21, 2006

Setting up a vnc server in Ubuntu 6.10

I can never find the exact answer I'm looking for, so I try to write it down when I finally figure it out. This episode? How to get a fast VNC server on Ubuntu 6.10.

First, get the right packages

% sudo apt-get install vnc4server

This gets you a 'vnc' module for your xorg X server, which can export an X session as a vnc host, and also let you use it on your local display as well (unlike Xvnc and vncserver commands).

Once you've installed the packages, you need to edit your /etc/X11/xorg.conf. In your "Module" section, add the line:

Load "vnc"

In your "Screen" section, add the line:

Option "PasswordFile" "/root/.vnc/passwd"

Now you need to create the actual password file. You need to switch to root and run the realvncpasswd utility:

% sudo su
% realvncpasswd
(enter password)

You should be all set. Restart your X server and give it a shot.

December 27, 2006

Flash Player 9

It seems they haven't quite worked out all the kinks out of Flash Player 9. My work machine started having an issue where sites couldn't detect that the player was installed. Instead they would offer a link to Adobe to install the player. Clicking on the link would show a page that indicated that the plugin was installed, but going back to another page that used Flash would still not work.

Pages would fail seemingly randomly. I was just ignoring it, until youtube stopped working.

I googled a bit, and found that all types of people were having this problem. At first I suspected IE7, but people reported the same problem with IE6. After a while, it seemed like the common thread was Flash 9, and I found a post that suggested uninstalling Flash 9 and installing Flash 8.

This worked for me. The steps are easy.

  • Get both the Flash 8 archive and the Flash uninstaller
  • Close down IE as well as any programs that use IE components (Rhapsody gave me problems, for example)
  • Run the uninstaller
  • Look inside the Flash 8 archive and find the r34 version of the flash installer. Run it.

These four steps fixed the problem. Not too many sites seem to require Flash 9 yet, so hopefully Adobe will get their act together by the time I really have to upgrade.

January 4, 2007

Sysinternals to the Rescue!

I've known about Sysinternals (now owned by MS) for a long time, but I didn't, and still don't have a full appreciation for the extreme value of their utilities.

For a long while now, I've been trying to revive Qian's computer. It's an old IBM thinkpad R series, with a 1.13Ghz P3, and 384 megs of RAM. And it's dog slow. With more than one app open, it starts thrashing. I poked around with task manager and even Process Explorer to see what's going on, but things seem pretty kosher.

Today, I tried the Autoruns utility as well as the PageDefrag utility, both from sysinternals. The former gives you a huge catalog of all the things that can automatically get loaded in your system. I disable a bunch of unnecessary startup items (qttask, and webcam related items). I also found that the "Logitech Desktop Manager" app had registered a bazillion protocol handlers (literally like 50 dlls) which I think were being loaded in to explorer.

The PageDefrag utility shows you the fragmentation state of the two big system files on your computer: the virtual memory swap file, and the hibernation file. In this case the swap file had only 5 fragments, which isn't cause for too much concern, but the hibernation file had 32,000+ fragments!

Because the system takes exclusive locks on these files, the PageDefrag utility gives you an option to defrag these files at next startup. As I write this, it's been working on the hibernation file for a good 5 minutes.

Of course, I know that the only real way to make this machine faster is upgrading its hardware -- maybe 700MB ram and at least a 5400rpm drive. But at least now I have a hope of getting its performance back to the fresh OS install level.

January 13, 2007

Technorati

Apparently, the correct way to use Technorati is to create an account, then claim your blog.

The claim process is interesting. You to embed a special link: Technorati Profile, and have their crawler pick it up.

Update: for Wordpress, apparently you can just provide a username and password, and they'll do a fake login and figure out the rest.

January 15, 2007

Tweaking the screen update rate on VMware Workstation/Player

I try to use VMs on my developer box at work, but I have been always annoyed with what I felt was "choppiness" or "chunkiness" in the guests' rendering rate. I asked around, and I found out that this was actually configurable.

The parameter is svga.maxChangeTick, and it can be set in the .vmx file of a VM (make sure to power off or suspend first). It controls the rate at which the host side polls the communication channel to the guest's virtual SVGA device to check for new screen changes from the guest.

The default value of this variable is 4. The value is divided into 100, and the result is used as a update frequency. So 100 / 4 = 25 hz.

Anyone who's played an FPS knows that you can feel the difference between 25hz and 50hz. It's unclear whether you can actually see more, but 50hz definitely feels more "smooth".

To set your update rate to 50 hz, try putting a svga.maxChangeTick = "2" in your .vmx file. You can also try "1" (it has to be a positive integer value) for very frequent updates, but I didn't really see too big of a difference in my experimentation.

The downside to this is that because you're polling for updates more frequently, you're more at risk of seeing "intermediate" drawing state. For something like WinXP, especially, because apps draw straight to the front buffer, you never know if at any point in time the contents of the screen are in a 'consistent' state (i.e. did a guest app just finish a complete rendering pass?). The more frequently you try to synchronize with the guest, the more likely that you may synch up with the guest while it's in the middle of drawing something.

But even in this case, this 'inconsistent' state only last for a mere 20ms (when updating at 50hz). Usually short enough that it's not bothersome. YMMV. I vastly prefer the effect that my VM feels like a native machine. The apps are still slower than native, but the rendering latency and general "smoothness" are much closer to real hardware.

You're also going to burn more CPU on the host, but when you're just dragging windows around, CPU is usually one of the last things you're worrying about.

January 17, 2007

Setting up an NFS server on Windows Server 2003 R2

For some reason, the setup process for the NFS server on Window Server 2003 R2 is very different than it is on XP. Note that what I'm about to describe is for sharing a directory hosted on my Windows box to another machine on my switch. No integration with active directory or anything like that.

First of all, make sure you have all the components installed. This can be done from the Add/Remove Windows Components option from within the Add or Remove Programs item in the control panel.

Other Other Network File and Print Services (click Details), there's another sub-window for Microsoft Services for NFS.

In the components list for Microsoft Services for NFS, I made the original mistake of checking only the things that I thought were required. In the end, I ended up installing everything, so it's really much easier to just install everything from the get go.

Once that's all done there should be a Microsoft Services for Network File System entry in your Administrative Tools list. Clicking on this brings you to a somewhat familiar looking (if you've done this on XP) window with a list of NFS related items on the left. The major difference from the XP version is that when you click on each item in the left, the larger right window pane only shows a help message. The way you get to the actual setting values is by right-clicking the items in the list on the left. Took me a while to figure this out, and I still don't understand why it was done this way.

Anyhow, here's the checklist:

  1. Make sure your username mapping service is running and configured correctly. You can start and stop it through the right click menu on list entry on the left of the configuration window.
  2. Make sure you set your nfs server to use the local username mapping server. You can do this by issuing the following command in a shell:
    c:\> nfsadmin mapping \\<yourhostname> config mapsvr=localhost
    
  3. Make sure you server for NFS is running, and set up exports. You can do the former through the standard Services mechanism, and sharing is set up almost like normal windows file sharing. Start by right-clicking on the folder you want to share. You can also use the nfsshare command line utility if you prefer.

That's it for the Windows side. The one last thing I'll mention is something I found out the hard way. Linux nfs clients have bad defaults (performance wise) for nfs mounts. Most importantly, the values of rsize and wsize default to 1024, which mean a request is made for each 1K that needs to be read or written. Obviously, this doesn't even fit all small files, so even for sharing source code this sucks.

Because I'm on my own switch, I bumped this up to rsize=16384,wsize=16384 and the performance improvement is like night and day. YMMV, but 1K is most likely too small for most situations (it even says so in the Ubuntu man pages). They probably didn't bump up the defaults for some archaic compatibility reason.

February 12, 2007

Don't use your blog software's integrated image management

As is the case where I'm put in any situation where there are multiple options, I've switched blog software many times. Mainly between Wordpress, Textpattern, and now Moveable type.

While the migrations for most of these are fairly well supported (well, WP to MT is a bit of work), the one thing that gets you every time is non-text content. While the various conversion routines understand mostly how to convert database schemas and textual content, they fall over on other things such as images. This is mainly because there's no standard way to store images in databases, and not even all blog software have built in management of images.

If you want to engineer your blog such that you're not locked into a platform, I'd recommend you use an external image management system, and just use <img> tags in your posts. Those will always work.

February 22, 2007

Notes on Google Indexing

I got a sudden spike in my regular daily traffic last week, and it's all from Google, and all for an article that I wrote quite a while ago.

After googling a bit, I discovered that Google apparently does a full rebuild of their indexes approximately once a month. That means that even if it knows about your site, chances are if you're a small site, it won't pick up new pages for a while.

That means keeping your URL's constant is really important. If you're like me and you switch blog systems way too often, then you're destroying your articles even before Google can get to them.

February 28, 2007

Deciphering Service Pack Release Numbers from Microsoft products

I've come to believe that the number of the Service Pack for any Microsoft product actually is code for how they feel about the release.

  • Initial Release = "Hey this doesn't crash for most people! Good luck getting any work done with it though!"
  • SP1 = "Ok, all the really broken crap is fixed. But it's still now how it should be"
  • SP2 = "This is about as good as it'll get. You can probably depend on it now"
  • SP3 = "You really should upgrade to our latest product, but here's an update in case you don't want to pay us"
  • SP4 = "Dude, this product is totally dead. Why are you even still using it?"

For different products, there might be a +/- factor of 1 SP release or so.

I'd point out that Apple loves to do the same thing. Someone should chart the MacOS 10.x.y releases in the same way. It seems like y is consistently greater than 5 before the series is retired.

The open source world is a little different. There, nothing ever reaches 1.0.

This post was inspired by the performance suckage that is Outlook 2007. I finally joined the downgrading bandwagon.

March 13, 2007

Using the Monaco font in gvim on Linux

I wrote a previous tip about how to use Monaco while running an xterm on OSX's X server. Here's a similar tip, except running on Linux this time.

I like Monaco for it's legibility at small screen sizes, so I wanted to use it in my gvim session.

The first step is to copy the font file over to your ~/.fonts directory. On a Mac system, you can find it under /System/Library/Fonts, called Monaco.dfont. The, run fc-cache to reload the fontconfig cache.

At this point, the font should already show up for any newly started GTK2/fontconfig-based program. You should also be able to say xterm -fa 'Monaco' to launch an xterm with the new font.

In gvim, you should also be able to select the font if you run the command :set guifont=* and select it from the menu.

Now here's the more complicated part. If you're fine with the antialiased version of the font, then stop here. If you want the pretty pixel-size based fonts, read on.

Modern linux systems, like Ubuntu, try to be really clever about your screen DPI. They know how big your monitor is, and what your resolution is set to, so they set calculate and store a DPI setting in the X server. The fontconfig and friends uses this information to map point sizes (what your apps ask for) to pixel sizes (what most hinted and bitmap fonts care about).

During this Process, if your DPI value is not one of the standard ones (i.e. 72), then trying to guess the point size that maps to a particular pixel size can be difficult. It could be 8.333333 or 8.3344 or some other very precise value (though fontconfig appears to be somewhat lenient)

Some programs let you control very precisely what parameters are asked of fontconfig. For example, for xterm, you can say xterm -fa 'Monaco:pixelsize=10' to get exactly the size that you want (change the value of pixelsize to see the different sizes). You can also say xterm -fa 'Monaco:pixelsize=10:antialias=off' to get exactly what I was looking for.

Ok, great, so how do we make gvim ask for this exact font. Well it turns out that gvim seems to hide the details of the font system from you, so only lets you specify things like :set guifont=Monaco\ 9 where the numeric value is the size of the font in point size. There's no way (as far as I could tell) to tell it to ask for a particular pixel size.

So what now? It's .fonts.conf to the rescue.

Here's the code I added:

  <match target="pattern">
    <test name="family">
      <string>Monaco10px</string>
    </test>
    <edit name="family">
      <string>Monaco</string>
    </edit>
    <edit name="antialias">
      <bool>false</bool>
    </edit>
    <edit name="pixelsize">
      <int>10</int>
    </edit>
  </match>

What does it mean? Well it looks for an application to request a font pattern with family 'Monaco10px' (which actually doesn't exist). When that pattern comes along, it secretly munges the pattern so that the "family" is now "Monaco", and it explicitly sets the pixelsize value to 10. So now an application just needs to ask for the "Monaco10px" font, and it will always get this exact font.

Back in gvim, now I can finish up by adding the line set guifont=Monaco10px to my .vimrc

And one final perfectionist touch. In the mac terminal, each line is spaced by one pixel. This is not done by default in gvim, but you can add this by adding set linespace=1. The end result is something that looks very close to what you get in a Mac Terminal.App.

One final caveat: Unfortunately, this trick only works when you can tell an application exactly what font family to request (usually by typing it in somehow). On apps that only give you access to the font picker dialog, Monaco10px will not show up as a candidiate, because it's not a real font.

March 20, 2007

Shell commands for Linux/Unix newbies

Normally, I don't write stuff like this, but Qian asked me for a reference of basic shell commands and I got really depressed about what I found. This page (top 10 linux commands for newbies) has over 1000 diggs, and what's in it's top 10? vi ! are you kidding me? Yea, that's sure a sure fire way to send someone crying back to Windows or OSX.

Part of the reason why computers remain so inaccessible to the vast majority of people is that it is a extremely difficult task to write documentation from the perspective of a user who doesn't know anything about what you're trying to tell them. In another shocking example from the above linked page, the author throws out words like "wildcards" and "pipes" without giving any explanation what they mean.

Sure, people can figure things out by experimentation, but the author seems to forget that the vast majority of newbies are hesitant to issue commands they they don't understand, not just because they don't know what's going on, but out of fear that they'll somehow screw something up, because they don't know what's going on.

That's an entirely reasonable reaction. I mean, what if someone just told you to go change that thingamajiggy to a whatchamacallit in that power generator over there. Would you just go in and do it without having any idea what's going on. With no hesitation?

Anyhow, enough ranting. Here's my list of top (maybe 10) shell commands that "newbie" users should get used to.

But before I start, lets start with even more basic terminology. What is a "shell"? The term shell actually refers to something quite abstract, and most people don't even bother explaining that.

Computer scientists love metaphors. They use metaphors to describe all kinds of complex relationships of various pieces in a computer system. "Shell" is such a metaphor.

If you imagine your computer software a being composed of many layers, like an onion, the "shell" is what is on the outer most layer. It is the layer that you, as a user, interact with. So when you're typing in commands, you're typing them into a piece of software known as the "shell".

Ok, now that we have that out of the way, here we go:

  1. pwd: Oh yea, computer scientists also love acronyms, and shortened forms of words and phrases. That's because they type all day, and shorter forms mean less typing.

    Anyhow, pwd is short for "print working directory". A "directory" just refers to a location on your computer. In Windows and Mac term's it's a folder. When the shell program is running, it's always running in a directory, and the directory it's running in is called the "working directory".

    On most Unix-based systems (where you're most likely to encounter a shell), a directory is identified by it's path. For example on my system, I may do something like this:

    % pwd
    /home/ken
    

    In this example /home/ken is what identifies my current working directory. The slashes in the path denote different levels of the hierarchy. Directories can contain other directories (just like folders contain folders)

  2. cd: This command is again, shorthand for "change directory". It let's you change the shell's current working directory to something else. You use it by specifying the directory you want to change to after you type the command name. For example:

    % pwd
    /home/ken
    % cd /home
    % pwd
    /home  
    

    You can see in this example that I first print my working directory, then I use "cd" to move to the /home directory, and then I print it out again to show that it has changed.

    You can also use cd to move to a directory that's located relatively to your current working directory. Let's say my directory /home/ken contained a directory called "foo" ("foo" is the favorite example name used by computer scientists). I could do something like:

    % pwd
    /home/ken
    % cd foo
    % pwd
    /home/ken/foo
    

    You can see that in this case, I moved to the "foo" directory inside the /home/ken directory, but I didn't have to specify /home/ken/foo in it's entirety. In this case "foo" is called a "relative path", because it is interpreted relative to my current working directory.

    Now there is a special relative path .. that refers to the directory containing the current working directory. With this, you can move up the hierarchy without knowing the name of the directory above you.

    % pwd
    /home/ken
    % cd ..
    % pwd
    /home
    % cd ..
    % pwd
    /
    

    In this example, I move up one directory level at a time, using the special .. pattern. Incidentally, the path with just "/" is called the 'root directory', and it is the highest point of the hierarchy. Issuing a "cd .." at this point would result in nothing, since you can't go any higher.

  3. ls: Ok, so this one isn't quite an acronym, but it's pretty close. "ls" stands for "list". Get it? No? Ok, whatever, doesn't matter.

    ls is used to view the contents of a directory. A directory, just like folders, can contain files, as well as other directories. Since your computer has many thousands of directories, it's not likely that you'll know how to get around without being able to inspect each directory. That's where ls comes in. It's usage is pretty simple. Just type 'ls' and return:

    % pwd
    /home/ken
    % ls
    foo
    myfile.txt
    

    That's it. You can now see that the /home/ken directory contains "foo" and "myfile.txt". Hurray!

Ok, that's all for now. Why you ask? well because this took longer that I thought, and also because these are the three basic commands that you can use to your hearts content without fear of screwing anything up. So try anything you want to and experiment. As long as you don't mis-type the command, it's impossible to do any damage.

There'll be more in following posts, but if you're really impatient, you can look at something like this reference, which is somewhat better than what I linked to at the top of this post, but still pretty terse.

April 15, 2007

Fighting the Feisty font battle

Just in case anyone was wondering, at least I'm not the only one that is annoyed by fonts on Ubuntu .

As described by that bug report, the most annoying aspect of it is that different applications seem to behave differently. And other reports claim that settings change even if only have a blank .fonts.conf..

Anyhow, I think I've finally managed to cook something up that works pretty well.

The first thing to note is that, apps that render using the Xft library appear to have problems with the hintmedium hintsyle setting that Ubuntu defaults to. The most prominent of these apps in a standard Gnome-based Ubuntu desktop are Firefox and gnome-terminal (gnome-terminal uses Xft for performance reasons, apparently). Doing anything that causes these apps to try to render in the medium hinting style causes them to use the "slight" style instead, causing inconsistency among your apps.

The solution to this is to simply use "full" hinting for everything. That is accomplished by putting the following bit in your ~/.fonts.conf.

  <match target="font">
    <edit name="hintstyle">
      <const>hintfull</const>
    </edit>
  </match>

This essentially means turn on "full hinting" for every font.

Now, that's not really necessarily what you want. A case that commonly comes up for me is that I actually don't want Japanese fonts to be hinted. But I choose to disable that selectively. I can do that with something like:

  <match target="font">
    <test name="family" qual="any">
      <string>UmePlus P Gothic</string>
    </test>
    <edit name="hinting">
      <bool>false</bool>
    </edit>
  </match>

It has to follow the previous block (because the edits get evaluated in order).

DPI settings

The other part that causes major problems in font rendering is the screen DPI setting. There are numerous places that this value can be set, and having different values in different places causes different apps to render fonts in different ways.

The first thing to do is to make sure your settings are consistent. For my laptop, I decided that I wanted to use a DPI setting of 72. (It's a 12 inch 1024x768). Here are the places I had to put this number in:

  1. In gnome-font-properties. Go in to the "details" screen and set the DPI to your desired value.
  2. In ~/.fonts.conf. Add the following bit:
       <match target="font">
        <edit name="dpi">
          <double>72</double>
        </edit>
      </match>
    

    This "edit" tag can be combined into the same "match" blog as the previous hintstyle setting if you prefer.


  3. Finally, the hardest one to find was for Firefox 2.0. Unfortunately, beginning in 2.0, Firefox no longer has a UI checkbox that determines whether the browser respects the system DPI setting when determining font sizes. Asside from this, the actual internal option that controls this value has changed three times from 1.0, to 1.5, and now 2.0. The magical value layout.css.dpi is described here. Set it to 72 using the the URL "about:config" in your browser

With these three settings, every app that I use regularly now has consistent font sizes and hinting settings.

I'm still not really sure why Ubuntu defaults to the "medium" hinting style, given the existence of these bugs. Maybe it was something introduced late in the cycle and nobody noticed.

Another interesting undocumented setting is MOZ_DISABLE_PANGO. This environment variable controls whether Firefox uses the pango module to render its text. It's meaning is negative, so if you want pango rendering, you say MOZ_DISABLE_PANGO=0. On Ubuntu, this value is set in the firefox wrapper script depening on your locale, since pango is required to render some of the more complex scripts. It is not turned on by default, because there are some performance issues and it breaks MathML rendering (who cares). I also found that it has some minor text rendering bugs, but with pango, Firefox does seem to respect the gnome font properties' hinting settings.

And a last note, if you do decide to use MOZ_DISABLE_PANGO=0, then make sure you set the layout.css.dpi value appropriately. For some reason, using pango makes the DPI calculation go really wonky. In my case every font was rendered much smaller than in other apps.

April 21, 2007

Installing VMware Workstation 5.5.3 on Ubuntu Feisty Fawn 7.04

I've been always kind of planning on running Linux on my desktop again, given that I now have pretty much unlimited access to vmware software ;-).

I had been running Windows for a while now, mainly because I couldn't get Ubuntu Edgy to install (jmicron driver bug). With the release of Feisty Fawn, that changed, and now I have a fully installed Feisty Desktop.

Great. Now time to install workstation. I know Workstation 6 is almost out, but I decided to go with 5.5.3 (trying to stay conservative with my home machine).

Immediately I hit the problem of not being able to build the vmmon kernel driver, same output as this VMware community discussion post. The reply on that post suggest's using the famous any-any patch. So I grab that and run it, and while my vmmon then builds, when I go to run a VM, I'm told that I have a vmmon version mismatch.

This probably just means that the any-any patch hasn't been updated to work with the Feisty kernel. Great, am I stuck?

Feisty comes with vmware-player packages (if you enable the multiverse) They appear to have the version number of 1.0.2, so something from the Workstation 5.5.x series should work. I asked Phil, and he mentioned that the Ubuntu provided vmmon modules should work fine with WS 5.5.3.

Sweet. Except that the standard install step of running vmware-config.pl always tries to build vmmon, and fails, so how am I supposed to install?

<BEGIN TOTALLY UNSUPPORTED HACK. PERFORM AT YOUR OWN RISK>

There are a few required steps:


  • Install Feisty's kernel modules.

  • Symlink the modules into the place that 5.5.3's startup scripts expect them

  • Hack vmware-config.pl so that it doesn't try to build vmmon and vmnet

First step is easy:

% sudo apt-get install vmware-player-kernel-modules

Second step is relatively easy too:

% cd /lib/modules/2.6.20-15-generic
% sudo mkdir misc
% cd misc
% sudo ln -s ../vmware-player/vmmon.ko vmmon.o
% sudo ln -s ../vmware-player/vmnet.ko vmnet.o

Just a few notes: 2.6.20-15 is what Feisty released with. If you're reading this by the time that Feisty has released an update kernel, then use the directory that it appropriate for your kernel.

Also, make sure that your module symlinks have the extension .o instead of .ko. This is what the /etc/init.d/vmware script looks for.

Finally, the last step is to modify your vmware-config.pl. Here's the diff for my modified version:

--- vmware-config.pl.backup     2007-04-21 18:05:58.000000000 -0700
+++ vmware-config.pl    2007-04-21 18:14:33.000000000 -0700
@@ -3649,9 +3649,9 @@
 
 # Configuration related to the monitor
 sub configure_mon {
-  if (configure_module('vmmon') eq 'no') {
-    module_error();
-  }
+  #if (configure_module('vmmon') eq 'no') {
+  #  module_error();
+  #}
 
   if (-e '/dev/.devfs' || -e '/dev/.udev.tdb' || -e '/dev/.udevdb' ) {
     # Either the devfs" or "udev" filesystem is mounted on the "/dev" directory,
@@ -8955,7 +8955,7 @@
     configure_mon();
     configure_pp();
     configure_net();
-    build_vmnet();
+    #build_vmnet();
   }
 
   # Create the directory for the UNIX domain sockets

Essentially you just have to comment out a few lines as the diff indicates. Then run vmware-config.pl as you normally would and you should be good to go.

</TOTAL HACK>

May 15, 2007

Disabling Arial in Ubuntu

Just because I don't use Ubuntu regularly at home, doesn't mean it's the same at work ;-)

For some reason, I just cannot get Arial to look good on my Ubuntu box at work. I've tried all the various fontconfig settings, and nothing looks as good as how it looks on Windows. The closes result I've gotten is to turn off anti-aliasing, and use full hinting. That makes it look like Arial from 1995. But even then, the spacing is wrong1.

Anyhow, so until they fix it, I want to turn off Arial, and use Bitstream Vera Sans instead. Sure I could delete the font, but this is exactly what .fonts.conf is for. Here's the little piece:

 <match target="pattern" >
   <test name="family">
     <string>Arial</string>
   </test>
   <edit name="family">
     <string>Bistream Vera Sans</string>
   </edit>
 </match>

You can pretty much use this trick with any font.

1 I believe this is a long standing freetype bug. It also appears when you try to use fonts like MS PGothic and MS PMincho using their embedded bitmaps.

May 20, 2007

A Website for Ubuntu Tips

I've decided to try starting a website dedicated to various Ubuntu tips. The "beta" version is available at:

http://ubuntutips.kendeeter.com

This is meant to serve the same purpose as MacOSXHints, but for the Ubuntu community.

I realize there is a lot of good info on ubuntuforums.org already, but the information there is unstructured and sometimes difficult to peruse. This new site is intended to filter out the noise and provide a concise archive of various tricks that can benefit all Ubuntu users.

Update 5/24: Still no website yet. No luck with drupal, and geeklog and joomla were both disappointing. I might have to spend the weekend to build something from scratch.

May 25, 2007

Announcing (again) Ubuntu Tips

To make up for my half-assed last attempt, I've decided to go all the way, and start a real community-driven site with its own domain.

www.ubuntutips.net.

I'm still calling it a beta, but feel free to register and comment or even send tip submissions to me through the link at the top of the page.

June 13, 2007

Make the Thinkpad's middle button scroll work on more apps

Most Thinkpad's that come with the trackpoint input device also come with a special middle mouse button that can be used to switch into 'scroll' mode. You hold down the middle button and push the trackpoint and it scrolls in the direction you push.

Most annoyingly, however, it doesn't work with many apps. But it turns out, it's configurable!

On my system, the magic configuration file lives at C:\windows\system32\tp4table.dat.† Towards the bottom of this file, right before the [AutoScrollTable] section, I added the following lines:

;iTunes/Safari Scroll Fix
*,*,itunes.exe,*,*,*,WheelStd,0,9
*,*,Safari.exe,*,*,*,WheelStd,0,9

This makes the scroll stuff work for both the Safari for windows as well as iTunes.

Now why they didn't default to this 'WheelStd' mode is beyond me. It would have saved a lot of headaches.

† I found this info on this thread which also has some config info for other Thinkpad models.

June 17, 2007

Resizable Form Fields for Firefox

I'm kind of on the fence about Safari for Windows, but one of the truly great features is to be able to resize the text fields in any form. Turns out there's a Firefox extension that lets you do exactly the same thing. It's not as 'pretty' as the Safari version, but it works just as well. Sweet. Update: It appears to do one odd thing in that it lets you resize drop down boxes, but in doing so, it changes them into list boxes, which is somewhat bizarre.

August 30, 2007

Feisty font battle, Round 3

I think I actually got somewhere this time.

The end result is:

Configuration details are available here.

Note that the above shot is just for arial. The other fonts available on the system often look much better. But the point of that shot is that arial actually looks semi-decent now.

November 9, 2007

Color Schemes for VIM

With Gvim, one can finally use the whole color space (not just 16-colors) to do nice code syntax highlighting and such.

Unfortunately, actually developing a good colorscheme is pretty difficult and tedious. That's where this page comes in. It lets you browse a bunch of canned color scheme files, rendered against some sample code. See one you like? click the link, download the .vim file into your ~/.vim/colors directory (create it if you don't have one), then in a gvim session, issue the command :colorscheme foo where foo is the name of the file you just downloaded, minus the .vim extension.

One quick note, sometimes these files are DOS formatted, and unix gvim doesn't seem to like them. To fix this, open the file in vim, and then issue the command :set fileformat=unix, and you should be good to go.

My personal favorite is 'camo'. It's a nice dark brown look that doesn't have any obnoxious neon colors.

November 18, 2007

Asus P5B Deluxe and Waking from S3 with a USB keyboard

I'm sure nobody cares about this. I'm just writing it down because it took me way too long to figure it out.

I've had my new PC for about a year and a bit now, and I've never been able to resume from S3 sleep using the keyboard. I originally thought it was an X64 problem. I briefly used a PS/2 keyboard which had a dedicated wake up button, and that worked, so I figured there must be some way to do this.

BIOS settings:

  • Standby Mode: S3 only
  • Plug'n'Play OS: Yes
  • USB Legacy Emulation: Disabled

Not really sure even if all of these actually matter. The first one definitely does.. setting this to Auto causes WinXP to do weird things (namely refuse to shutdown any time you have the "allow this devices to wake the computer" checkbox checked for any USB device).

Finally, the most important part is to add a registry key described in this Microsoft KB article. This tells XP that it's ok for it to enter S3 even if you have a USB device that's set to wake up the system. Why is this needed? Well according to the article, older bioses and devices were too crappy that this feature didn't work well. Going into S3 would sometimes kill the power altogether, or result in other undesirable side effects. They're solution was to say, "if you want to wake from a usb device, then you only get S1".

Well it turns out that without this special flag, and a BIOS that is set only to support S3, the device manager stops even showing you the "Power Management" tab for each USB device's properties screen. This is the part that the KB article doesn't tell you, and that had me stumped for a long time.

For posterity, here is a .reg file that you can use to add this key to your registry.

November 27, 2007

Avoiding Bittorrent traffic shaping

Found this as I was reading about the supposed Comcast Bittorrent shaping controversy. A quick guide to enabling protocol encryption in the most common bittorrent clients, so that the upstream shapers can't inspect packets to find bittorrent traffic.

December 4, 2007

Awesome: Windows batch file ugliness

So I got around to writing some startup batch scripts that try to mount some network drives. The net use command is easy enough to use, but I ran into a separate problem. If the machine starts up too fast, then the network isn't up yet, so net use fails.

So I started looking for a way to delay execution until I knew the network was up. Well pinging in a loop seemed like a good idea.

I'll start with the end result first:

:loop
echo pinging host
ping -n 1 host | find "TTL=" > NUL
if errorlevel 1 goto loop

So I'll forgive the fact that the batch command language doesn't really have a while construct. But apparently, not all versions of ping.exe return a exit code of 0 when a ping succeeds. So the recommended way to check for a successful ping is to look for TTL= in the output, which you can do with find. Which leads to the abomination above.

December 12, 2007

Drupal's "edit own" permission and Input Formats

I spent too much time tracking this one down today, so here's a note for posterity.

Drupal lets you create "roles" that are essentially permission sets for different kinds of users. One of the permissions in these roles is to allow users to edit content that they authored. I had this enabled for the "content admin" role on my ubuntutips website, but some content admin users were still not able to edit their own posts. What gives?

Turns out that there is a separate dimension to editing permissions, under Input Formats. Drupal allows you to provide different input formatting mechanisms, like Filtered HTML, Full HTML, and Full PHP. Each mode has an associated set of permissions, allowing you to specify which roles can edit each format.

It turns out that previously I had told my content admins to write using the Full HTML format because it supported the <pre> tag, but then later figured out how to add that tag to the Filtered HTML format, and at the same time disabled content admins from editing Full HTML. That meant that if a content admin had create a post in the past with Full HTML, they could no longer edit it, even if they had the "edit own content" permission.

Anyways, the quick fix was to change the content type on the content item in question, and all was well.

February 15, 2008

Bring back the good old Alt+Tab in Vista

A Vista tip? Blasphemy!

Well, I'm just trying it out at work, and it seems to be ok so far. But I got annoyed with the new Alt+Tab. I don't know what people's obsession with window thumbnails are, but to me they make all the choices look similar, where as icons clearly differentiate things.

Anyways, turns out you can just bring back the old alt+tab switcher with a registry hack. Just add a DWORD to \HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer called AltTabSettings and set it's value to 1.

April 4, 2008

Tracking Stocks using Google Documents Spreadsheet

Today I discovered a totally sweet feature of Google Document's Spreadsheet. You can hook it up with Google Finance to pull stock quotes in near real time. All you need is the following in a cell:

=GoogleFinance("VTI"; "price")

The "VTI" part can be a reference to another cell. I'm guessing the "price" part can be too.

April 21, 2008

A little closer, but still not quite there: Hardy Heron on my Thinkpad X60

I've reported my experiences on running previous versions of Ubuntu on the Thinkpad X60. Here are the notable updates with Hardy Heron:

  • Wireless: Ubuntu dropped the closed source ipw3945 driver from their restricted packages repository, instead, opting to use the iwl3945 driver that's included in upstream kernel sources. Unfortunately, the version that gets shipped with the kernel is way out-of-date and doesn't work well. Or in my case, not at all. The solution is to grab newer drivers from the compat-wireless project. They have a build system that can overlay newer drivers on top of an existing kernel module directory. I tried a snapshot from April, and it worked fine for me. After a reboot, the card came up and worked fine through the NetworkManager.

    One remaining gripe with the wireless is that the hardware kill switch only works half way. It will kill the wireless if you turn the switch off. However, turning it back on doesn't re-enable the wireless until you re-insert the iwl3945 driver. I can script it, but still a major pain in the ass.

  • Graphics: Compiz seems to work fine (though I don't care to use it). Metacity's compositing mode seems to work too, though it's disappointingly slow.
  • Battery: Battery life seems better than with Gutsy, provided that you're willing to do some work. First step is to install the powertop package, run the utility, and follow it's recommendations. Next, take a look at this guide on Thinkwiki, detailing a few more settings that can be tweaked. It still sucks that you have to do this all manually. Most of the settings are easily scriptable, and I'm sure there's a way to automatically trigger them when you go into battery-powered mode, but I haven't quite gotten there yet. Feels like I shouldn't have to do this much work.
  • Suspend/Resume: Seems to work. Only tried it about 5 times.
  • Temperature: This is still my biggest gripe. Even with all the tweaks described above, the laptop as a whole gets considerably hotter than when running windows. Particularly the bottom side and the right side of the palm rest. While it's better than before, it still annoys me enough that I'll run Windows most of the time. It's particularly bad when it's plugged in (and some of the power saving features get turned off)
  • Software: Overall, Gnome hasn't changed much (which is a good thing IMHO). Firefox 3 seems like a huge improvement, except for the fact that FoxMarks doesn't work yet (but I expect that to work before the temperature control does).

Progress I suppose. But less than I had hoped for. I know Lenovo sells these things with SuSE, but I don't think the experience is much better on those models. I made a feeble attempt at running the Emperor Linux Kernel, but couldn't get it to boot. I'm getting a little pessimistic that Linux will ever run completely fine on this machine (read: all the hardware works) during it's useful lifetime. Oh well.

May 10, 2008

Mapped Network Drives, an old enemy

Had a stupid problem with logging into Windows on my laptop for a while now. As soon as I finish entering my password and hit enter, the machine gets stuck at "Loading Personal Settings" for over a minute, with very little disk activity. I finally decided to try to fix it.

The most helpful bit of info I came across was a registry setting. Adding a DWORD at HKEY_LOCAL_MACHINE\ SOFTWARE\ Microsoft\ Windows\ CurrentVersion\ policies\ system\ verbosestatus

After adding the value, I saw that the delay was at the "reconnecting network drives" stage, which was a dead giveaway. After logging in, I checked My Computer and saw a mapped drive to a drive that was only available on the company network (not at home). Unmapped it, and now back to normal.

July 31, 2008

Synchronizing search folders in cached Exchange mode in Outlook 2007

I never really grokked the behavior until now. It seemed like only a subset of my search folders that I created while I was in cached mode were communicated to the server. This meant that whenever I set up a new Outlook client install, not all of my search folders (that I had set up on another machine) would show up automatically.

Furthermore, once you have more than one Outlook install pointed at the same account, their search folders list gets out of sync. Not useful when you're trying to maintain a big list of folders for reading mailing lists.

Well the trick seems to be to do something to cause your client to upload its search folder list to the server. One thing that seems to work for me is to edit the server side Rules list. Even just changing the name of a rule seems to work. Once I do that, it seems like any locally created search folder gets communicated to the server, and after a little delay, my other Outlook clients will pick it up.

I wish they could just sync it when I create a new folder. Oh well.

August 17, 2008

A quick review of notepad replacements

I started a thing at work where I keep a kind of TODO list in a text file. It's a little different from a standard TODO list in that it also has a history of updates for each todo item. It lets me quickly see the list of things that are going on, and what the latest state of each thing was.

I've been using notepad to edit this file, but I get a little annoyed with it.I think the biggest reason is that "ctrl+backspace" doesn't work, which seems bizarre. I mean, isn't it a standard thing in editor widgets?

Anyhow, so I've been mini-obsessed with notepad replacements. The three that I've found that are worth mentioning so far are metapad, notepad2, and notepad++.

Metapad is the most minimal of the bunch. Not really geared toward programmers, but still extremely handy. Aside from supporting Ctrl+backspace, it's other handiest feature is that it auto-linkify's URL's. When half of your state is on a wiki somewhere, this is extremely useful.

Notepad2 is more programmer oriented. It's based on Scintilla, but doesn't go as far as many other programmer-oriented editors go (i.e. no MDI). It's got most of the rest of the standard programming features like line numbers, syntax highlighting, regex search and replace, external file modification monitoring, etc.

Notepad++ takes another step beyond Notepad2 and adds multi-document support as well as some basic file analysis (parsing out function definitions in a side bar, for example). My main beef with it so far is that the default syntax highlighting setup really sucks. Not only does it use different fonts for comments, but the font is proportional. EW!

Anyhow, for my task list file, Metapad is most certainly the right answer. For programming, I think it's a toss up between the Scintilla based alternatives. It depends on your working style.

December 15, 2008

Restoring nice hinted fonts on Ubuntu 8.10

The Ubuntu folks seem to change around their default font settings every release. Whatever that's fine. But it is worth nothing that the default "subpixel" setting in the gnome appearance dialog now means "subpixel + slight hinting" whereas previously it meant "subpixel + full hinting"

Since 8.04, though, they've committed a crime, IMHO. There's some new fontconfig magic which automatically aliases "Times" to the "Nimbus Roman" family (or Liberation, if you have it installed), both which render like crap. Those fonts used to resolve to the DejaVu family, which while look different from Times and Helvetica and the like for which they serve as substitutes, still render acceptably under the "subpixel + full hinting" mode.

As far as I'm concerned, there are only five fonts that render well on Linux under this mode. Dejavu Sans, Serif, and Mono, and Droid Sans and Mono. Any settings that cause any fonts other than these to get picked should be avoided.

Thankfully, on 8.10, it's pretty easy to restore the old behavior. Go into your /etc/fonts/conf.d directory and delete 30-metric-aliases.conf and 30-urw-aliases.conf.

You can verify the settings are now correct by typing fc-match "Times" in a terminal, and making sure "DejaVu Serif" is returned.

Speaking of which, I thought Liberation fonts were supposed to look good under Linux. Why do they still look like crap?

About Tips

This page contains an archive of all entries posted to LevelsOfDetail in the Tips category. They are listed from oldest to newest.

Reviews is the previous category.

Many more can be found on the main index page or by looking through the archives.