Tag Archives: blog

Es ist vollbracht!

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

Yes, finally Linux
2.6.19
has been released. So you wonder why is this something to blog about? — Because
it is the first Linux version that contains my super-cool MSI
Laptop driver
, one of the most impressing attainments of mankind, only
excelled perhaps by KRYPTOCHEF,
the only tool in existence which does fullbit encryption.

Es ist vollbracht!

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

Yes, finally Linux
2.6.19
has been released. So you wonder why is this something to blog about? — Because
it is the first Linux version that contains my super-cool MSI
Laptop driver
, one of the most impressing attainments of mankind, only
excelled perhaps by KRYPTOCHEF,
the only tool in existence which does fullbit encryption.

Chasing A Light

Post Syndicated from Lennart Poettering original http://0pointer.net/blog/chasing-light.html

Last friday I posted a little Lazyweb experiment,
a hunt for information about a certain kind of lamp sold by a street dealer in
Mexico City. A quick followup on the results:

Surprinsingly many people responded, mostly by email, and partly by blog comment.
As it appears I am not the only one who’s looking for this specific type of
lamp. Furthermore, a non-trivial set of Planet Gnome readers actually already
owns one of these devices. Apparently counterfeit versions of this lamp are
sold all around the world by street dealers and on markets.

The lamp seems to be a modified version of the “IQ Light”, a self
assembly lighting system made up of interlocking quadrilaterals. It is
a scandinavian design, by Holger Strøm, 1973. It is nowadays
exclusively distributed by Bald & Bang,
Denmark. The lighting system has a very interesting web site of its own, which even includes an
HOWTO for
assembling these lamps. The Bald & Bang web site has a
very stylish video which also shows how to assemble an IQ lamp.

Fake IQ Light from Mexico

While my mexican specimen and the official design are very similar, they
differ: the mexican design looks – in a way – “tighter” and … better (at
least in my humble opinion). For comparison, please have a look on the photo I took from the mexican version which is shown
above, and on the many photos returned by Google
Images
, or the one from the IQ Light homepage. It
appears as if the basic geometrical form used by the mexican design is somehow
more narrow than the official danish one.

So, where can one buy one of those lamps? Fake and real ones are sold on
eBay
, every
now an then
. The Museum
Store of the New York MoMA
sells the original version for super-cheap $160.
If you search with Google you’ll find many more offers like this one, but all
of them are not exactly cheap – for a bunch of thin plastic sheets. All these
shops sell the danish version of the design, noone was able to point me to a shop
where the modified, “mexican” version is sold.

Given the hefty price tag and the fact that the fake, mexican version looks
better then the original one, I will now build my own lamps, based on the
mexican design. For that I will disassamble my specimen (at least partially)
and create a paper stencil of the basic plastic pattern. I hope to put this up
for download as a .ps file some time next week, since many people
asked for instructions for building these lamps. Presumably the original
design is protected by copyright, hence I will not publish a step-by-step guide
how to build your own fake version. But thankfully this is not even necessary, since the vendor already published a HOWTO and a video for this, online.

Thank you very much for your numerous responses!

Chasing A Light

Post Syndicated from Lennart Poettering original http://0pointer.net/blog/chasing-light.html

Last friday I posted a little Lazyweb experiment,
a hunt for information about a certain kind of lamp sold by a street dealer in
Mexico City. A quick followup on the results:

Surprinsingly many people responded, mostly by email, and partly by blog comment.
As it appears I am not the only one who’s looking for this specific type of
lamp. Furthermore, a non-trivial set of Planet Gnome readers actually already
owns one of these devices. Apparently counterfeit versions of this lamp are
sold all around the world by street dealers and on markets.

The lamp seems to be a modified version of the “IQ Light”, a self
assembly lighting system made up of interlocking quadrilaterals
. It is
a scandinavian design, by Holger Strøm, 1973. It is nowadays
exclusively distributed by Bald & Bang,
Denmark. The lighting system has a very interesting web site of its own, which even includes an
HOWTO for
assembling these lamps. The Bald & Bang web site has a
very stylish video which also shows how to assemble an IQ lamp.

Fake IQ Light from Mexico

While my mexican specimen and the official design are very similar, they
differ: the mexican design looks – in a way – “tighter” and … better (at
least in my humble opinion). For comparison, please have a look on the photo I took from the mexican version which is shown
above, and on the many photos returned by Google
Images
, or the one from the IQ Light homepage. It
appears as if the basic geometrical form used by the mexican design is somehow
more narrow than the official danish one.

So, where can one buy one of those lamps? Fake and real ones are sold on
eBay
, every
now an then
. The Museum
Store of the New York MoMA
sells the original version for super-cheap $160.
If you search with Google you’ll find many more offers like this one, but all
of them are not exactly cheap – for a bunch of thin plastic sheets. All these
shops sell the danish version of the design, noone was able to point me to a shop
where the modified, “mexican” version is sold.

Given the hefty price tag and the fact that the fake, mexican version looks
better then the original one, I will now build my own lamps, based on the
mexican design. For that I will disassamble my specimen (at least partially)
and create a paper stencil of the basic plastic pattern. I hope to put this up
for download as a .ps file some time next week, since many people
asked for instructions for building these lamps. Presumably the original
design is protected by copyright, hence I will not publish a step-by-step guide
how to build your own fake version. But thankfully this is not even necessary, since the vendor already published a HOWTO and a video for this, online.

Thank you very much for your numerous responses!

Dear Lazyweb!

Post Syndicated from Lennart Poettering original http://0pointer.net/blog/mexico-lamp.html

Let’s see how well Lazyweb works for me!

One of the nicest types of lamps I know is depicted on this photo:

mexico lamp

This lamp is built from a number (16 or so, it’s so difficult to count) of
identical shapes which are put together (a mano) in a very simple, mathematical
fashion. No glue or anything else is need to make it a very robust object. The
lamp looks a little bit like certain Julia fractals, its geometrical structure
is just beautiful. Every mathematical mind will enjoy it.

This particular specimen has been bought from a street dealer in Mexico
City, and has been made of thin plastic sheets. I saw the same model made from
paper on a market near Barcelona this summer (during GUADEC). Unfortunately I
didn’t seize the chance to buy any back then, and now I am regretting it!

I’ve been trying to find this model in German and US shops for the last
months (Christmas is approaching fast!) but couldn’t find a single specimen. I
wonder who designed this ingenious lamp and who produces it. It looks like a
scandinavian design to me, but that’s just an uneducated guess.

If you have any information about this specific lamp model, or could even
provide me with a pointer where to buy or how to order these lamps in/from
Germany, please leave a comment to this blog story, or write me an email to
mzynzcr (at) 0pointer (dot) de! Thank you very much!

Dear Lazyweb!

Post Syndicated from Lennart Poettering original http://0pointer.net/blog/mexico-lamp.html

Let’s see how well Lazyweb works for me!

One of the nicest types of lamps I know is depicted on this photo:

mexico lamp

This lamp is built from a number (16 or so, it’s so difficult to count) of
identical shapes which are put together (a mano) in a very simple, mathematical
fashion. No glue or anything else is need to make it a very robust object. The
lamp looks a little bit like certain Julia fractals, its geometrical structure
is just beautiful. Every mathematical mind will enjoy it.

This particular specimen has been bought from a street dealer in Mexico
City, and has been made of thin plastic sheets. I saw the same model made from
paper on a market near Barcelona this summer (during GUADEC). Unfortunately I
didn’t seize the chance to buy any back then, and now I am regretting it!

I’ve been trying to find this model in German and US shops for the last
months (Christmas is approaching fast!) but couldn’t find a single specimen. I
wonder who designed this ingenious lamp and who produces it. It looks like a
scandinavian design to me, but that’s just an uneducated guess.

If you have any information about this specific lamp model, or could even
provide me with a pointer where to buy or how to order these lamps in/from
Germany, please leave a comment to this blog story, or write me an email to
mzynzcr (at) 0pointer (dot) de! Thank you very much!

ZeroConf in Ubuntu

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

(Disclaimer: I am not an Ubuntu user myself. But I happen to be the lead developer of Avahi.)

It came to my attention that Ubuntu is
discussing
whether
to
enable Zeroconf/Avahi in default installations. I would like to point out a few
things:

The “No Open Ports” policy: This policy (or at least the
way many people interprete it) seems to be thought out by someone who
doesn’t have much experience with TCP/IP networking. While it might make sense
to enforce this for application-level protocols like HTTP or FTP it doesn’t
make sense to apply it to transport-level protocols such as DHCP, DNS or in
this case mDNS (the underlying protocol of Zeroconf/Avahi/Bonjour):

Even the simplest DNS lookup requires the opening of an UDP port for a
short period of time to be able to recieve the response. This is usually not
visible to the administrator, because the time is too short to show up in
netstat -uln, but nonetheless it is an open port. (UDP is not
session-based (like TCP is) so incoming packets are accepted regardless where
they come from)

DHCP clients listen on UDP port 68 during their entire lifetime (which in
most cases is the same as the uptime of the machine). DHCP may be misused for
much worse things than mDNS. Evildoers can forge DHCP packets to change IP
addresses and routing of machines. This is definitely something that cannot be
done with mDNS.

All three protocols, DNS, DHCP and mDNS, require a little bit of trust in
the local LAN. They (usually) don’t come with any sort of authentication and
they all are very easy to forge. The impact of forged mDNS packets is clearly
less dangerous than forged DHCP or DNS packets. Why? Because mDNS doesn’t
allow you to change the IP address or routing setup (which forged DHCP allows)
and because it cannot be used to spoof host names outside the .local
domain (which forged DNS allows).

Enforcing the “No Open ports” policy everywhere in Ubuntu would require that
both DNS and DHCP are disabled by default. However, as everybody probably
agrees, this would be ridiculous because a standard Ubuntu installation
couldn’t even be used for the most basic things like web browsing.

Oh, and BTW: DNS lookups are usually done by an NSS plugin which is loaded
by the libc into every process which uses gethostbyname() (the function for doing host name resolutions). So, in
effect every single process that uses this function has an open port for a
short time. And the DNS client code runs with user priviliges, so an exploit
really hurts. dhclient (the DHCP client) runs as root during the entire
runtime, so an exploit of it hurts even more. Avahi in contrast runs as its own user and
chroot()s
.

It is not my intention to force anyone to use my
software
. However, enforcing the “No Open Ports” policy unconditionally is
not a good idea. Currently Ubuntu makes exceptions for DHCP/DNS and so
it should for mDNS.

I do agree that publishing all kinds of local services with Avahi in a
default install is indeed problematic. However, if the “No Open Ports” policy
is enforced on all other application-level software, there shouldn’t be any
application that would want to register a service with Avahi.

Starting Avahi “on-demand” is not an option either, because it offers useful
services even when no local application is accessing is. Most notably this is
host name resolution for the local host name. (Hey, yeah, Zeroconf is more than
just stealing music.)

Remember: Zeroconf is about
Zero Configuration. Requiring the user to toggle some obscure
configuration option before he can use Zeroconf would make it a paradox.
Zeroconf was designed to make things “just work”. If it isn’t enabled by
default it is impossible to reach that goal.

Oh, and I enabled commmenting in my blog, if anyone wants to flame me on this…

ZeroConf in Ubuntu

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

(Disclaimer: I am not an Ubuntu user myself. But I happen to be the lead developer of Avahi.)

It came to my attention that Ubuntu is
discussing
whether
to
enable Zeroconf/Avahi in default installations. I would like to point out a few
things:

The “No Open Ports” policy: This policy (or at least the
way many people interprete it) seems to be thought out by someone who
doesn’t have much experience with TCP/IP networking. While it might make sense
to enforce this for application-level protocols like HTTP or FTP it doesn’t
make sense to apply it to transport-level protocols such as DHCP, DNS or in
this case mDNS (the underlying protocol of Zeroconf/Avahi/Bonjour):

  • Even the simplest DNS lookup requires the opening of an UDP port for a
    short period of time to be able to recieve the response. This is usually not
    visible to the administrator, because the time is too short to show up in
    netstat -uln, but nonetheless it is an open port. (UDP is not
    session-based (like TCP is) so incoming packets are accepted regardless where
    they come from)
  • DHCP clients listen on UDP port 68 during their entire lifetime (which in
    most cases is the same as the uptime of the machine). DHCP may be misused for
    much worse things than mDNS. Evildoers can forge DHCP packets to change IP
    addresses and routing of machines. This is definitely something that cannot be
    done with mDNS.

All three protocols, DNS, DHCP and mDNS, require a little bit of trust in
the local LAN. They (usually) don’t come with any sort of authentication and
they all are very easy to forge. The impact of forged mDNS packets is clearly
less dangerous than forged DHCP or DNS packets. Why? Because mDNS doesn’t
allow you to change the IP address or routing setup (which forged DHCP allows)
and because it cannot be used to spoof host names outside the .local
domain (which forged DNS allows).

Enforcing the “No Open ports” policy everywhere in Ubuntu would require that
both DNS and DHCP are disabled by default. However, as everybody probably
agrees, this would be ridiculous because a standard Ubuntu installation
couldn’t even be used for the most basic things like web browsing.

Oh, and BTW: DNS lookups are usually done by an NSS plugin which is loaded
by the libc into every process which uses gethostbyname() (the function for doing host name resolutions). So, in
effect every single process that uses this function has an open port for a
short time. And the DNS client code runs with user priviliges, so an exploit
really hurts. dhclient (the DHCP client) runs as root during the entire
runtime, so an exploit of it hurts even more. Avahi in contrast runs as its own user and
chroot()s
.

It is not my intention to force anyone to use my
software
. However, enforcing the “No Open Ports” policy unconditionally is
not a good idea. Currently Ubuntu makes exceptions for DHCP/DNS and so
it should for mDNS.

I do agree that publishing all kinds of local services with Avahi in a
default install is indeed problematic. However, if the “No Open Ports” policy
is enforced on all other application-level software, there shouldn’t be any
application that would want to register a service with Avahi.

Starting Avahi “on-demand” is not an option either, because it offers useful
services even when no local application is accessing is. Most notably this is
host name resolution for the local host name. (Hey, yeah, Zeroconf is more than
just stealing music.)

Remember: Zeroconf is about
Zero Configuration. Requiring the user to toggle some obscure
configuration option before he can use Zeroconf would make it a paradox.
Zeroconf was designed to make things “just work”. If it isn’t enabled by
default it is impossible to reach that goal.

Oh, and I enabled commmenting in my blog, if anyone wants to flame me on this…

Avahi Support for Apache

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

The first release of mod_dnssd is now available. It adds DNS-SD based Zeroconf support to Apache 2.0 using Avahi.

This work has been inspired by Sander Temme’s and Sebastien Estienne’s mod_zeroconf module, but supersedes it in every way. MacOSX ships with mod_rendezvous/mod_bonjour, but mod_dnssd is much more powerful than this piece of software as well. In short: mod_dnssd is definitely the greatest way to add Zeroconf support to Apache available today.

A few examples just to show how great mod_dnssd is:

DNSSDEnable On

This is everything you need to enable DNS-SD support in Apache after loading the module. It will publish all virtual hosts and all existing mod_userdir directories (i.e. ~/public_html) as services of type _http._tcp.

In case you want to publish some subdirectory of the web server as service, just place DNSSDServiceName inside a <Location> section for that path:

<Location /foobar>
DNSSDServiceName “A special service called foobar”
</Location>

You can even use it to publish WebDAV shares using Apache’s mod_dav module:

<Location /webdav>
Dav On
DNSSDServiceName “A WebDAV folder”
DNSSDServiceTypes _webdav._tcp
</Location>

This especially cool since we now have a free software server counterpart for Gnome’s and KDE’s WebDAV client functionality.

Or to publish your blog as RSS service:

<Location /blog.cgi?rss>
DNSSDServiceName “The blog”
DNSSDServiceTypes _rss._tcp
</Location>

Get it while it is hot!

Avahi Support for Apache

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

The first release of mod_dnssd is now available. It adds DNS-SD based Zeroconf support to Apache 2.0 using Avahi.

This work has been inspired by Sander Temme’s and Sebastien Estienne’s mod_zeroconf module, but supersedes it in every way. MacOSX ships with mod_rendezvous/mod_bonjour, but mod_dnssd is much more powerful than this piece of software as well. In short: mod_dnssd is definitely the greatest way to add Zeroconf support to Apache available today.

A few examples just to show how great mod_dnssd is:

DNSSDEnable On

This is everything you need to enable DNS-SD support in Apache after loading the module. It will publish all virtual hosts and all existing mod_userdir directories (i.e. ~/public_html) as services of type _http._tcp.

In case you want to publish some subdirectory of the web server as service, just place DNSSDServiceName inside a <Location> section for that path:

<Location /foobar>
	DNSSDServiceName "A special service called foobar"
</Location>

You can even use it to publish WebDAV shares using Apache’s mod_dav module:

<Location /webdav>
	Dav On
	DNSSDServiceName "A WebDAV folder"
	DNSSDServiceTypes _webdav._tcp
</Location>

This especially cool since we now have a free software server counterpart for Gnome’s and KDE’s WebDAV client functionality.

Or to publish your blog as RSS service:

<Location /blog.cgi?rss>
	DNSSDServiceName "The blog"
	DNSSDServiceTypes _rss._tcp
</Location>

Get it while it is hot!

Avahi Gains "Wide-Area" Support

Post Syndicated from Lennart Poettering original http://0pointer.net/blog/projects/avahi-wide-area.html

Yesterday in the late evening I commited “Wide Area” support to
Avahi SVN, i.e. “DNS-SD over Unicast DNS”. Only browsing, no
“Long-Lived Query” support and no publishing for now, but it is a
start.

To show off how cool this is, here is a “screenshot” of
avahi-browse showing all services defined in the domain
0pointer.de:

$ avahi-browse -a -d 0pointer.de
Browsing domain ‘0pointer.de’ on any.-1 …
Browsing for services of type ‘_http-rss091._tcp’ (Web Syndication RSS 0.91) in domain ‘0pointer.de’ on any.-1 …
Browsing for services of type ‘_http-rss20._tcp’ (Web Syndication RSS 2.0) in domain ‘0pointer.de’ on any.-1 …
Browsing for services of type ‘_http._tcp’ (Web Site) in domain ‘0pointer.de’ on any.-1 …
Found service ‘Lennart’s Blog’ of type ‘_http-rss091._tcp’ (Web Syndication RSS 0.91) in domain ‘0pointer.de’ on any.-1.
Found service ‘Lennart’s Blog’ of type ‘_http-rss20._tcp’ (Web Syndication RSS 2.0) in domain ‘0pointer.de’ on any.-1.
Found service ‘Lennart’s Homepage’ of type ‘_http._tcp’ (Web Site) in domain ‘0pointer.de’ on any.-1.
Found service ‘Avahi mDNS/DNS-SD’ of type ‘_http._tcp’ (Web Site) in domain ‘0pointer.de’ on any.-1.
Found service ‘Lennart’s Photos’ of type ‘_http._tcp’ (Web Site) in domain ‘0pointer.de’ on any.-1.
Found service ‘Lennart’s Blog’ of type ‘_http._tcp’ (Web Site) in domain ‘0pointer.de’ on any.-1.
Service data for service ‘Lennart’s Blog’ of type ‘_http-rss091._tcp’ (Web Syndication RSS 0.91) in domain ‘0pointer.de’ on any.-1:
Host 0pointer.de (217.160.223.3), port 80, TXT data: [‘path=/blog/index.rss’]
Service data for service ‘Lennart’s Blog’ of type ‘_http-rss20._tcp’ (Web Syndication RSS 2.0) in domain ‘0pointer.de’ on any.-1:
Host 0pointer.de (217.160.223.3), port 80, TXT data: [‘path=/blog/index.rss2’]
Service data for service ‘Lennart’s Homepage’ of type ‘_http._tcp’ (Web Site) in domain ‘0pointer.de’ on any.-1:
Host 0pointer.de (217.160.223.3), port 80, TXT data: [‘path=/lennart/’]
Service data for service ‘Avahi mDNS/DNS-SD’ of type ‘_http._tcp’ (Web Site) in domain ‘0pointer.de’ on any.-1:
Host freedesktop.org (131.252.208.82), port 80, TXT data: [‘path=/Software/Avahi’]
Service data for service ‘Lennart’s Photos’ of type ‘_http._tcp’ (Web Site) in domain ‘0pointer.de’ on any.-1:
Host 0pointer.de (217.160.223.3), port 80, TXT data: [‘path=/photos/’]
Service data for service ‘Lennart’s Blog’ of type ‘_http._tcp’ (Web Site) in domain ‘0pointer.de’ on any.-1:
Host 0pointer.de (217.160.223.3), port 80, TXT data: [‘path=/blog’]

Avahi Gains "Wide-Area" Support

Post Syndicated from Lennart Poettering original http://0pointer.net/blog/projects/avahi-wide-area.html

Yesterday in the late evening I commited “Wide Area” support to
Avahi SVN, i.e. “DNS-SD over Unicast DNS”. Only browsing, no
“Long-Lived Query” support and no publishing for now, but it is a
start.

To show off how cool this is, here is a “screenshot” of
avahi-browse showing all services defined in the domain
0pointer.de:

$ avahi-browse -a -d 0pointer.de
Browsing domain '0pointer.de' on any.-1 ...
Browsing for services of type '_http-rss091._tcp' (Web Syndication RSS 0.91) in domain '0pointer.de' on any.-1 ...
Browsing for services of type '_http-rss20._tcp' (Web Syndication RSS 2.0) in domain '0pointer.de' on any.-1 ...
Browsing for services of type '_http._tcp' (Web Site) in domain '0pointer.de' on any.-1 ...
Found service 'Lennart's Blog' of type '_http-rss091._tcp' (Web Syndication RSS 0.91) in domain '0pointer.de' on any.-1.
Found service 'Lennart's Blog' of type '_http-rss20._tcp' (Web Syndication RSS 2.0) in domain '0pointer.de' on any.-1.
Found service 'Lennart's Homepage' of type '_http._tcp' (Web Site) in domain '0pointer.de' on any.-1.
Found service 'Avahi mDNS/DNS-SD' of type '_http._tcp' (Web Site) in domain '0pointer.de' on any.-1.
Found service 'Lennart's Photos' of type '_http._tcp' (Web Site) in domain '0pointer.de' on any.-1.
Found service 'Lennart's Blog' of type '_http._tcp' (Web Site) in domain '0pointer.de' on any.-1.
Service data for service 'Lennart's Blog' of type '_http-rss091._tcp' (Web Syndication RSS 0.91) in domain '0pointer.de' on any.-1:
        Host 0pointer.de (217.160.223.3), port 80, TXT data: ['path=/blog/index.rss']
Service data for service 'Lennart's Blog' of type '_http-rss20._tcp' (Web Syndication RSS 2.0) in domain '0pointer.de' on any.-1:
        Host 0pointer.de (217.160.223.3), port 80, TXT data: ['path=/blog/index.rss2']
Service data for service 'Lennart's Homepage' of type '_http._tcp' (Web Site) in domain '0pointer.de' on any.-1:
        Host 0pointer.de (217.160.223.3), port 80, TXT data: ['path=/lennart/']
Service data for service 'Avahi mDNS/DNS-SD' of type '_http._tcp' (Web Site) in domain '0pointer.de' on any.-1:
        Host freedesktop.org (131.252.208.82), port 80, TXT data: ['path=/Software/Avahi']
Service data for service 'Lennart's Photos' of type '_http._tcp' (Web Site) in domain '0pointer.de' on any.-1:
        Host 0pointer.de (217.160.223.3), port 80, TXT data: ['path=/photos/']
Service data for service 'Lennart's Blog' of type '_http._tcp' (Web Site) in domain '0pointer.de' on any.-1:
        Host 0pointer.de (217.160.223.3), port 80, TXT data: ['path=/blog']

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.