Debian Packages of mod_dnssd and mod_mime_xattr

Post Syndicated from Lennart Poettering original http://0pointer.net/blog/projects/mod-dnssd-debian.html

Due to the great work of Sebastien Estienne there are now Debian
packages of mod_dnssd
and mod_mime_xattr
available from my little Debian
package repository
. They’ve been uploaded to Ubuntu as well, but
we are still looking for some Debian developer who would be willing to
upload them to Debian proper. Feel free to contact me if you are interested!

Adding Extended Attribute Support to Apache 2.0

Post Syndicated from Lennart Poettering original http://0pointer.net/blog/projects/mod-mime-xattr.html

I updated my little Apache module mod_mime_xattr to be compatible with Apache 2.0.

What is it useful for? Linux (2.4 with patch, 2.6 out-of-the-box) has been supporting extended attributes for files (EAs) for ages, but very few applications use them. To change that I wrote a small module for Apache which interpretes the EA user.mime_type and uses its value as MIME type for all files served by Apache. The EA has been standardized by the XDG MIME system, but apparently neither Gnome nor KDE support it right now.

Usage of mod_mime_xattr is simple. To enable interpretation of the EA on the entire tree use something like this in your Apache configuration file:

<Directory />
XAttrMimeType On
</Directory>

That’s all that is required to make use of user.mime_type on all files where it is set. To set the EA use a command like this one:

setfattr -n “user.mime_type” -v “text/html” foo.txt

And foo.txt will become a file with the MIME type of text/html, although its suffix is .txt!

Adding Extended Attribute Support to Apache 2.0

Post Syndicated from Lennart Poettering original http://0pointer.net/blog/projects/mod-mime-xattr.html

I updated my little Apache module mod_mime_xattr to be compatible with Apache 2.0.

What is it useful for? Linux (2.4 with patch, 2.6 out-of-the-box) has been supporting extended attributes for files (EAs) for ages, but very few applications use them. To change that I wrote a small module for Apache which interpretes the EA user.mime_type and uses its value as MIME type for all files served by Apache. The EA has been standardized by the XDG MIME system, but apparently neither Gnome nor KDE support it right now.

Usage of mod_mime_xattr is simple. To enable interpretation of the EA on the entire tree use something like this in your Apache configuration file:

<Directory />
XAttrMimeType On
</Directory>

That’s all that is required to make use of user.mime_type on all files where it is set. To set the EA use a command like this one:

setfattr -n "user.mime_type" -v "text/html" foo.txt

And foo.txt will become a file with the MIME type of text/html, although its suffix is .txt!

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 0.6.3

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

A few days ago we relased Avahi 0.6.3. This is an important bugfix release, everyone should update as soon as possible.

Avahi now has its own domain avahi.org and finally has a logo, thanks to the great work of Mathieu Drouet:

Avahi Logo

Avahi has moved from Debian
Experimental to Unstable. Ubuntu moved
it from Universe to Main since it successfully passed their security
auditing. The Fedora
Core
development distribution contains it too, as does SuSE‘s
and Gentoo‘s. But
where’s Mandriva? Apparently they are considering
it
, for whatever it is worth. FreeBSD Ports has it
too. I guess this means that Avahi has now been accepted by all major
distributions. Hurrah!

Avahi 0.6.3

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

A few days ago we relased Avahi 0.6.3. This is an important bugfix release, everyone should update as soon as possible.

Avahi now has its own domain avahi.org and finally has a logo, thanks to the great work of Mathieu Drouet:

Avahi Logo

Avahi has moved from Debian
Experimental to Unstable. Ubuntu moved
it from Universe to Main since it successfully passed their security
auditing. The Fedora
Core
development distribution contains it too, as does SuSE‘s
and Gentoo‘s. But
where’s Mandriva? Apparently they are considering
it
, for whatever it is worth. FreeBSD Ports has it
too. I guess this means that Avahi has now been accepted by all major
distributions. Hurrah!

Fractals with Python

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

It’s impressing how easy it is to draw fractals with Python. Using the ubercool Python Imaging Library and native complex number support in Python you can code an elaborate and easy to understand fractal generator in less than 50 lines of code:

#!/usr/bin/python
import Image, ImageDraw, math, colorsys

dimensions = (800, 800)
scale = 1.0/(dimensions[0]/3)
center = (2.2, 1.5) # Use this for Mandelbrot set
#center = (1.5, 1.5) # Use this for Julia set
iterate_max = 100
colors_max = 50

img = Image.new(“RGB”, dimensions)
d = ImageDraw.Draw(img)

# Calculate a tolerable palette
palette = [0] * colors_max
for i in xrange(colors_max):
f = 1-abs((float(i)/colors_max-1)**15)
r, g, b = colorsys.hsv_to_rgb(.66+f/3, 1-f/2, f)
palette[i] = (int(r*255), int(g*255), int(b*255))

# Calculate the mandelbrot sequence for the point c with start value z
def iterate_mandelbrot(c, z = 0):
for n in xrange(iterate_max + 1):
z = z*z +c
if abs(z) > 2:
return n
return None

# Draw our image
for y in xrange(dimensions[1]):
for x in xrange(dimensions[0]):
c = complex(x * scale – center[0], y * scale – center[1])

n = iterate_mandelbrot(c) # Use this for Mandelbrot set
#n = iterate_mandelbrot(complex(0.3, 0.6), c) # Use this for Julia set

if n is None:
v = 1
else:
v = n/100.0

d.point((x, y), fill = palette[int(v * (colors_max-1))])

del d
img.save(“result.png”)

Some example pictures:

Julia Set Mandelbrot Set.

Fractals with Python

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

It’s impressing how easy it is to draw fractals with Python. Using the ubercool Python Imaging Library and native complex number support in Python you can code an elaborate and easy to understand fractal generator in less than 50 lines of code:

#!/usr/bin/python
import Image, ImageDraw, math, colorsys

dimensions = (800, 800)
scale = 1.0/(dimensions[0]/3)
center = (2.2, 1.5)       # Use this for Mandelbrot set
#center = (1.5, 1.5)       # Use this for Julia set
iterate_max = 100
colors_max = 50

img = Image.new("RGB", dimensions)
d = ImageDraw.Draw(img)

# Calculate a tolerable palette
palette = [0] * colors_max
for i in xrange(colors_max):
    f = 1-abs((float(i)/colors_max-1)**15)
    r, g, b = colorsys.hsv_to_rgb(.66+f/3, 1-f/2, f)
    palette[i] = (int(r*255), int(g*255), int(b*255))

# Calculate the mandelbrot sequence for the point c with start value z
def iterate_mandelbrot(c, z = 0):
    for n in xrange(iterate_max + 1):
        z = z*z +c
        if abs(z) > 2:
            return n
    return None

# Draw our image
for y in xrange(dimensions[1]):
    for x in xrange(dimensions[0]):
        c = complex(x * scale - center[0], y * scale - center[1])

        n = iterate_mandelbrot(c)            # Use this for Mandelbrot set
        #n = iterate_mandelbrot(complex(0.3, 0.6), c)  # Use this for Julia set

        if n is None:
            v = 1
        else:
            v = n/100.0

        d.point((x, y), fill = palette[int(v * (colors_max-1))])

del d
img.save("result.png")

Some example pictures:

Julia Set Mandelbrot Set.

Introducing nss-myhostname

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

I am doing a lot of embedded Linux work lately. The machines we use configure their hostname depending on some external configuration options. They boot from a CF card, which is mostly mounted read-only. Since the hostname changes often but we wanted to use sudo we had a problem: sudo requires the local host name to be resolvable using gethostbyname(). On Debian this is usually done by patching /etc/hosts correctly. Unfortunately that file resides on a read-only partition. Instead of hacking some ugly symlink based solution I decided to fix it the right way and wrote a tiny NSS module which does nothing more than mapping the hostname to the IP address 127.0.0.2 (and back). (That IP address is on the loopback device, but is not identical to localhost.)

Get nss-myhostname while it is hot!

BTW: This tool I wrote is pretty useful on embedded machines too, and certainly easier to use than setterm -dump 1 -file /dev/stdout | fold -w 80. And it does color too. And looping. And is much cooler anyway.

Introducing nss-myhostname

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

I am doing a lot of embedded Linux work lately. The machines we use configure their hostname depending on some external configuration options. They boot from a CF card, which is mostly mounted read-only. Since the hostname changes often but we wanted to use sudo we had a problem: sudo requires the local host name to be resolvable using gethostbyname(). On Debian this is usually done by patching /etc/hosts correctly. Unfortunately that file resides on a read-only partition. Instead of hacking some ugly symlink based solution I decided to fix it the right way and wrote a tiny NSS module which does nothing more than mapping the hostname to the IP address 127.0.0.2 (and back). (That IP address is on the loopback device, but is not identical to localhost.)

Get nss-myhostname while it is hot!

BTW: This tool I wrote is pretty useful on embedded machines too, and certainly easier to use than setterm -dump 1 -file /dev/stdout | fold -w 80. And it does color too. And looping. And is much cooler anyway.

Avahi 0.6 in Beta

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

Unless we find any major bugs Avahi 0.6 will be released on friday. We ask everyone to do some testing for us:

Current Avahi SVN snapshort
Current libdaemon SVN snapshot

There have been a bunch of API changes. However, the API is now frozen, so feel free to start porting your application to the new API now.

A rough overview about the many improvements in Avahi 0.6.

Support for (read-only) wide area support. (i.e. DNS-SD over unicast DNS)
Ported to FreeBSD, NetBSD, Darwin/MacOSX and to some extent OpenBSD
Compatibility layers for HOWL and Bonjour
Support for registering/browsing abritrary records
Proper support for DNS-SD service subtypes
Native C implementations of the client utilities
Now passes the Bonjour conformance test suite without any exceptions
“Passive observation of failures”
chroot() support
Many traffic reduction improvements
Bugfixes, cleanups

GnomeMeeting Supports Avahi

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

Sebastien successfully completed porting GnomeMeeting to Avahi. Therefore I declare him the first one to port a “real world” application to Avahi. Hurrah! Screenshot here.

Shortly after, Sebestien – not lazy – announced his new Zeroconf service browser applet based on Avahi. It contains a drop down menu with all Zeroconf services found on your LAN. If you select a menu item the applet will execute the application that has been defined as Gnome URL handler for the specific protocol.

s-d-a

By continuing to use the site, you agree to the use of cookies. more information

The cookie settings on this website are set to "allow cookies" to give you the best browsing experience possible. If you continue to use this website without changing your cookie settings or you click "Accept" below then you are consenting to this.

Close