Tag Archives: data

Simplified "Draft" Plugin for pyblosxom

Post Syndicated from Lennart Poettering original http://0pointer.net/blog/projects/pyblosxom-ignore.html

The pyblosxom plugin registry links a plugin which allows hiding “draft” stories before publishing them, so that only you can see them. Unfortunately the link to this plugin is broken. So here’s my (simplified) reimplementation:

def cb_prepare(args):
request = args[“request”]
query = request.getHttp().get(‘QUERY_STRING’, ”)

if not query.endswith(“&ignore”) and not query == “ignore”:
data = request.getData()
data[“entry_list”] = filter(lambda e: not e.has_key(‘ignore’), data[“entry_list”])

To mark a story as “draft” simply insert this at line #2:

#ignore yes

To browse unpublished stories simply append ?ignore (or &ignore) to your blog URL.

Simplified "Draft" Plugin for pyblosxom

Post Syndicated from Lennart Poettering original http://0pointer.net/blog/projects/pyblosxom-ignore.html

The pyblosxom plugin registry links a plugin which allows hiding “draft” stories before publishing them, so that only you can see them. Unfortunately the link to this plugin is broken. So here’s my (simplified) reimplementation:

def cb_prepare(args):
        request = args["request"]
        query = request.getHttp().get('QUERY_STRING', '')

        if not query.endswith("&ignore") and not query == "ignore":
                data = request.getData()
                data["entry_list"] = filter(lambda e: not e.has_key('ignore'), data["entry_list"])

To mark a story as “draft” simply insert this at line #2:

#ignore yes

To browse unpublished stories simply append ?ignore (or &ignore) to your blog URL.

Linking pyblosxom to SVN

Post Syndicated from Lennart Poettering original http://0pointer.net/blog/projects/pyblosxom-svn.html

If you run a pyblosxom blog with auto-copied stories from SVN you are
probably interested in getting stable story dates that don’t change every time
you update a story. The date of the initial SVN log entry of a story is
something like the “day of birth” of a story, so it’s a good value to use.
Christopher Baus implemented a plugin for pyblosxom, which looks
overly complicated to me: it depends on memcached and comes in two large python
scripts.

To simplify things I wrote this minimal replacement:

import pysvn, os, sys, anydbm

from config import py

def get_mtime(fname):
cache_fname = os.path.join(py[‘datadir’], ‘SVNDATES’)
cache = anydbm.open(cache_fname, “c”)

if cache.has_key(fname):
d = float(cache[fname])
else:
client = pysvn.Client(fname)
l = client.log(fname)

if len(l) > 0:
d = l[0][‘date’]
cache[fname] = str(d)
else:
d = -1

del client

del cache
return d

def cb_filestat(args):
args[“mtime”] = list(args[“mtime”])
d = get_mtime(args[“filename”])
if d >= 0:
args[“mtime”][8] = d
return args

Since accessing SVN logs is quite slow the script caches the “date of birth”
in a dbm file. Make sure that your web server has enough priviliges to access
that database file which is stored in $datadir/SVNDATES by
default.

Linking pyblosxom to SVN

Post Syndicated from Lennart Poettering original http://0pointer.net/blog/projects/pyblosxom-svn.html

If you run a pyblosxom blog with auto-copied stories from SVN you are
probably interested in getting stable story dates that don’t change every time
you update a story. The date of the initial SVN log entry of a story is
something like the “day of birth” of a story, so it’s a good value to use.
Christopher Baus implemented a plugin for pyblosxom, which looks
overly complicated to me: it depends on memcached and comes in two large python
scripts.

To simplify things I wrote this minimal replacement:

import pysvn, os, sys, anydbm

from config import py

def get_mtime(fname):
        cache_fname = os.path.join(py['datadir'], 'SVNDATES')
        cache = anydbm.open(cache_fname, "c")

        if cache.has_key(fname):
                d = float(cache[fname])
        else:
                client = pysvn.Client(fname)
                l = client.log(fname)

                if len(l) > 0:
                        d = l[0]['date']
                        cache[fname] = str(d)
                else:
                        d = -1

                del client

        del cache
        return d

def cb_filestat(args):
        args["mtime"] = list(args["mtime"])
        d = get_mtime(args["filename"])
        if d >= 0:
                args["mtime"][8] = d
        return args

Since accessing SVN logs is quite slow the script caches the “date of birth”
in a dbm file. Make sure that your web server has enough priviliges to access
that database file which is stored in $datadir/SVNDATES by
default.

IBM xSeries EZ Swap Hard Drive Trays

Post Syndicated from Bradley M. Kuhn original http://ebb.org/bkuhn/blog/2005/05/04/ibm-xseries.html

A few days ago, I acquired a number of IBM xSeries servers — namely x206
and x226 systems — for my work at the The Software Freedom Law
Center
. We bought bare-metal, with just CPU and memory, with
plans to install drives ourselves.

I did that for a few reasons. First, serial ATA (S-ATA or SATA)
support under Linux has just become ready for prime time, and
despite being a SCSI-die-hard for most of my life, I’ve given in
that ATA’s price/performance ratio can’t really be beat, especially
if you don’t need hot swap or hardware RAID.

When I got the machines, which each came with one 80 GB S-ATA drive, I
found them well constructed, including a very easy mounting system
for hard drives. Drives have a blue plastic tray that looks like
this (follow link of image for higher resolution shot).


Image of the IBM xSeries Easy Swap Tray

These so-called “EZ Swap” trays are not for hot-swap; the big IBM swap
trays with the lever are for that. This is just to mount and unmount
drives quickly. I was impressed, and was sad that, since IBM’s goal
is to resell you hard drives, they don’t make it easy to buy these
things outright. You have to look on IBM’s
parts and upgrade site for the x206
, you’ll find that they offer
to sell 26K-7344, which is listed as a “SATA tray”, and a 73P-8007,
which is listed as a “Tray, SATA simple swap”. However, there is no
photo, and that part number does not match the part number on the item
itself. On the machines I got, the tray is numbered 73P-9591 (or
rather, P73P9591, but I think the “P” in the front is superfluous and
stands for “Part”).

I spoke to IBM tech support (at +1-800-426-7378), who told me the
replacement part number he had for that tray I had was 73P-8007.
Indeed, if you look at third
party sites, such as Spare Parts Warehouse
, you find that number
and a price of US$28 or so. Spare Parts Warehouse doesn’t even sell
the 26K-7344.

It seemed to me strange that we had two things described as SATA tray
could be that different. And the difference in price was
substantial. It costs about US$28 for the 73P-8007 and around US$7
for the 26K-7344.

So, I called IBM spare parts division at +1-800-388-7080, and ordered
one of each. They arrived by DHL this morning. Lo and behold, they
are the very same item. I cannot tell the difference
between them upon close study. The only cosmetic difference is that
they are labeled with different part numbers. The cheaper one is
labeled 26K-7343 (one number less than what I ordered) and the other
is labeled 73P-9591 (the same number that my original SATA drives
came with).

So, if you need an EZ Swap tray from IBM for the xSeries server, I
suggest you order the 26K-7344. If you do so, and find any difference
from the 73P-8007, please do let me know. Update: on 2005-06-22, a
reader told me they now charge US$12 for the 26K-7344 tray. Further
Update: The prices seem to keep rising! Another reader reported to me
on 2005-08-08 that the 26K-7344 is now US$84 (!) and the 73P-8007 is now
only US$15. So, it costs twice as much as it did a few months
ago to get these units, and the cheaper unit apperas to be the 73P-8007.
It’ll be fun to watch and see if the prices change big again in the months
to come.

When you call IBM’s spare parts division, they may give you some
trouble about ordering the part. When you call +1-800-388-7080,
they are expecting you to be an out-of-warranty customer, and make
it difficult for you to order. It depends on who you get, but you
can place an order with a credit card even without an “IBM
Out-of-Warranty Customer Number”. If you have a customer number you
got with your original IBM equipment order, that’s your warranty
customer number and is in a different database than the one used by
the IBM Spare Parts Division.

You can just tell them that you want to make a new order with a credit
card. After some trouble, they’ll do that.