2010
01.27

One of the drives in my 3ware 9650SE card recently gave me cause for concern: it randomly began rebuilding and the raid went into degraded mode. There were no SMART errors issued, so I did some digging in the smartcl manual in order to run some self diagnostics. There’s a lot to smartctl to begin with, and the syntax for addressing a drive inside a 3ware RAID is cumbersome. So I thought I’d make note of the useful commands I came up with.

First, to address a drive in a 3ware RAID, pass “-d 3ware,X” to smartctl, where X is a drive number (starting with 0). To list all SMART output for the second drive, for example, run:

smartctl -a /dev/twa0 -d 3ware,1

The -a switch will print out everything. In order to run this on the first (in my case all) four drives, and filter on the temperature output, I run:

for drive in {0..3}
do
    smartctl -a /dev/twa0 -d 3ware,$drive | grep Temperature_Celsius
done

After the aforementioned drive issues, I issued a command to run extended self tests on all drives, like so:

for drive in {0..3}
do
    smartctl -T permissive /dev/twa0 -d 3ware,$drive -t long
done

These tests can be run while online. In order to see the results (including progress along the way):

for drive in {0..3}
do
    smartctl -T permissive -l selftest /dev/twa0 -d 3ware,$drive
done

So far no errors have turned up.

2009
09.30

I’ve been on a man-hunt lately to evict all ATI cards from my machines. ATI may make good cards — I won’t argue that — but their support for Linux is pathetic.

I replaced my old ATI Radeon x1650 with an Asus NVidia 9600 GT Silent. Asus’ Silent version of this card takes up two slots, the second being for its massive heatsink. The card uses no fans, only an enormous heatsink. Naturally, it is completely silent, but performs like a champion.

To drive my dual 24″ monitors, I set up my Xorg to use NVidia’s Twinview. I’ve read (and (disclaimer) this may be incorrect) that Twinview is a similar technology to Xinerama, with the difference being that Twinview presents a single display to Xorg encompassing both displays while Xinerama runs a separate Xorg on each display with some hacks to allow windows to be dragged back and forth, etc. (If anyone can elaborate or clarify here, please chime in.)

Anyhow, this tends to confuse some applications into thinking that there is only one display, and that it is only capable of one resolution. Whether this is full screen Youtube, mplayer, or a video game, it is quite a nuisance.

After some searching, I discovered that adding a “metamodes” option under my Screen section in xorg.conf could allow applications to think other resolutions were supported. Here is my xorg.conf:

Section "ServerLayout"
    Identifier     "Layout0"
    Screen      0  "Screen0" 0 0
	Option		   "OffTime" "10"
EndSection
Section "Files"
    FontPath        "unix/:7100"
    ModulePath      "/usr/local/lib/xorg/modules"
    ModulePath      "/usr/lib/xorg/modules"
    FontPath        "/usr/share/fonts/"
    FontPath        "/usr/share/fonts/misc"
    FontPath        "/usr/share/fonts/100dpi:unscaled"
EndSection
Section "Module"
    Load           "dbe"
    Load           "extmod"
    Load           "type1"
    Load           "freetype"
    Load           "glx"
	Load           "kbd"
	SubSection	"extmod"
		Option		   "omit xfree86-dga"
	EndSubSection
EndSection
Section "ServerFlags"
    Option         "Xinerama" "0"
EndSection
Section "Monitor"
    # HorizSync source: edid, VertRefresh source: edid
    Identifier     "Monitor0"
    VendorName     "Unknown"
    ModelName      "DELL 2407WFP"
    HorizSync       30.0 - 83.0
    VertRefresh     56.0 - 76.0
    Option         "DPMS"
EndSection
Section "Device"
    Identifier     "Device0"
    Driver         "nvidia"
    VendorName     "NVIDIA Corporation"
    BoardName      "GeForce 9600 GT"
EndSection
Section "Screen"
    Identifier     "Screen0"
    Device         "Device0"
    Monitor        "Monitor0"
    DefaultDepth    24
    Option         "TwinView" "1"
    Option         "metamodes" "DFP-0: nvidia-auto-select +1920+0, DFP-1: 1920x1200 +0+0; DFP-0: 1600x1200 +0+0,NULL; DFP-0: 1280x1024 +0+0,NULL; DFP-0: 1024x768 +0+0,NULL; DFP-0: 800x600 +0+0,NULL;"
    SubSection     "Display"
        Depth       24
		ViewPort 0 0
    EndSubSection
EndSection

If I remember correctly, the metamodes option was created by the nvidia-settings utility, but only contained the string, “DFP-0: nvidia-auto-select +1920+0″. I added the rest. The display specified (DFP-1) seems arbitrary, as do the coordinates. So just add something similar, replacing the resolutions as appropriate.

Hope this helps others who encounter similar issues, as I had a very difficult time finding anything useful on this matter.

2009
09.22

One thing that often frustrates me to no end is to see the declaration of a variable whose name is meaningless. More often than not, this is caused by laziness. For example, if a variable could be named “delegate” but is instead named “delg,” my blood pressure is likely to rise.

What the hell is delg? anm? lm? I’m trying to read through your code, I shouldn’t have to stop and look for clues as to what you might be doing! In a loosely typed language, this is particularly painful, as there’s not even such a clue from the object’s type to indicate what something is.

Now, I should take a step back. I say lazy like it’s a bad thing. As a programmer, laziness can be a valuable asset. Laziness entices you to find the most efficient way to accomplish a task. Laziness may also entice you take shortcuts; but an experienced programmer should have the discipline and foresight to know whether or not a shortcut is appropriate.

To illustrate my point, a programmer might think to himself, “I really don’t want to type out delegate. That’s a lot of typing.” The good programmer would then ask himself, “How can I avoid typing that much without making my code worthless?” The bad programmer would jump to the conclusion that abbreviating the word would save him time.

Fortunately, for either programmer, there are elegant solutions. Namely, word completion.

Have you ever known someone well enough that you frequently knew what it was that they were saying long before they finished speaking? This is precisely what a good text editor should do. A well made text editor should be able to examine what it is you’re typing and infer what word(s) you might intend to type.

There are many such text editors, but my favorite is vim. In vim, if you begin typing a word, you can (by default) hit ctl + p to bring up a list of words which match what you’ve typed. Typically these might be found in the current file, but might be found in other locations in your source tree, dictionary, and so on. So If I wanted to include “delegate” as a variable name, but didn’t want to type the whole thing out, I can type “del” and let my editor complete it for me.

When I see “delg,” I can only assume one of two things. (1) The programmer who typed that was being robbed by his poor choice of text editors, or (2) the programmer was robbing himself by not knowing his text editor well.

Search engine optimization by SEO Design Solutions