Saturday, August 30, 2008

iSCSI Enterprise Target via RPMs

This how to is handy. It doesn't end well for the author but my "yum install kmod-iscsitarget" was all I needed. It brought in a 2.6.25 Kernel as a dependency.
Downloading Packages:
(1/5): kmod-iscsitarget-2 100% |=========================|  37 kB    00:00     
(2/5): kmod-iscsitarget-0 100% |=========================| 4.3 kB    00:00     
(3/5): kernel-2.6.25.14-6 100% |=========================|  18 MB    00:34     
(4/5): iscsitarget-0.4.15 100% |=========================|  64 kB    00:00     
(5/5): iwl4965-firmware-2 100% |=========================| 237 kB    00:00    
Beware: This installs iscsitarget-0.4.15 which generates a broken pipe error for certain ietadm commands. This is not obvious until you run strace. 0.4.16 doesn't have this problem.

Tuesday, August 12, 2008

IronKey USB

IronKey Announces Linux Support. I wonder if this means the "windows initialization" is no longer required. Update Yes, "windows initialization" is not required. I plugged mine into Ubuntu and was up and running. No need for windows with this.

Python urlencode annoyance

O'Reilly has examples of how to urlencode a string for various languages. Every example has the same semantics -- a variable to define a string and a function to encode it -- except Python. Python's urlencode presumes you want to convert a dictionary whose key (which seems to be a name you should make up when you call this function) will be a GET variable that you would append to the tail of the URL. I think this presumes too much. I want to build a URL and simply encode the name of a file. I wish I could do this:
url = "http://foo.com/" + urlencode(file_name)
Instead I use a substring kludge since len("x=") is 2:
tmp = urlencode({'x':file_name})
url = "http://foo.com/" + tmp[2:]
Applying this back to O'Reilly's example:
from urllib import urlencode
artist = "Kruder & Dorfmeister"
tmp = urlencode({'x':artist})
artist = tmp[2:]
I guess Python is promoting a paradigm where URL values are arguments to methods and the syntax of a URL itself is abstracted away. But I still would have kept urlencode like the other languages and offered a variation of this function that does whatever Python is trying to promote.

Monday, August 11, 2008

Zimbra and LVM

The Zimbra Forum has some things to say about LVM:
  • LVM snaphots hurt performance. However they are handy for minimizing downtime if you want to do a full backup of /opt/zimbra. Zimbra's built-in backups seem a better trade-off to me. While reading through this there as a kernel trap post on replacing atime with relatime.
  • Someone who claims to be knowledge in storage and who posts to the forum every day on average suggested using LVM for the flexibility.
  • Someone using LVM suggests that zmvolume makes LVM less necessary.
  • There were plenty of posts mentioning LVM on the Forum which were answered by Zimbra employees or experienced admins where LVM was stated as something someone was using or were going to use and no one said not to use it. This included advice for partitioning new servers or I/O tuning (where the most popular thing you shouldn't do is use RAID5).
Update: LVM and multipathd conflict. I prefer Zimbra on ext3 directly on disk; no LVM.

Hadoop & NIST Algorithm Dictionary

The Register had a funny article about haddop. I also found a NIST Dictionary of Algorithms and Data Structures.

Sunday, August 10, 2008

CSS Positioning in Ten Steps

Patrick Fitzgerald's CSS Positioning in Ten Steps is a quick way to learn about most CSS positioning.

Tuesday, August 5, 2008

rsync in 10 seconds

It's like cp and the following produce the same results:
cp -a /tmp .
rsync -a /tmp .
Note the following benefits:
  • mirrors a directory along with meta data (like cp -a)
  • uses diffs to save time when run again
  • can cross servers over SSH
Here's the syntax for that SSH option:
rsync -a -e 'ssh' user@host:/tmp .
Which copies /tmp on a remote host over SSH like scp.

Read Jeremy Mates's tutorial next.

Monday, August 4, 2008

python http auth

Found useful article on HTTP Authentication with Python.

Friday, August 1, 2008

Python Emacs Whitespace Annoyance

Python whitespace slowed me down when I tried to add a conditional around something similar to the following block in emacs22:
cat = ""
list = ['foo', 'bar', 'baz']
for thing in list:
    cat += thing + ','
print cat
I indented everything the entire block under the conditional and ended up with:
if (1):
    cat = ""
    list = ['foo', 'bar', 'baz']
    for thing in list:
        cat += thing + ','
        print cat
instead of (the last line became part of the loop):
if (1):
    cat = ""
    list = ['foo', 'bar', 'baz']
    for thing in list:
        cat += thing + ','
    print cat
I'm used to just doing an M-x indent-region when coding and not having to see the details of the block I'm indenting. This is handy when I'm wrapping a block in a conditional and don't want to think of the details of the block at that moment. Perhaps this has been solved so I'll read more about Python Mode.

[FIX]: Don't indent the region, shift the region. Shifting preserves other indentations.

C-c <: Shift the region to the left
C-c >: Shift the region to the right