Once again there is a discussion whether uClibc based systems should get their own architecture, or whether it would be more like Ubuntu -- they, too, have a different C library (with stack-protector support; this simplifies the gcc bootstrap sequence a bit).
Thinking further, why not have generic support for keeping different configurations for various derived distributions in a single source tree, so the same source package could be used on Debian, Ubuntu, emdebian and all the others which all build different binaries?
The gcc package does this, to some extent, but it looks at the build system to find out which configuration to use -- a standard mechanism, for example a DEB_BUILD_VARIANT environment variable would be nice.
You know the problem? Something happens, and all your systems go
down—scheduled or otherwise. When you boot them up, one box is
faster than the other; and as a result, some network mounts don't really
work correctly. While this doesn't really happen at work, I've seen it
after a power failure at home.
I thought this was a feature that Windows had but Linux
doesn't. I really should've known better...
wouter@country:~$ mount /dev/hda5 on / type ext3 (rw,errors=remount-ro,commit=0) tmpfs on /lib/init/rw type tmpfs (rw,nosuid,mode=0755)(...)
binfmt_misc on /proc/sys/fs/binfmt_misc type binfmt_misc (rw,noexec,nosuid,nodev) automount(pid15173) on /autofs type autofs (rw,fd=5,pgrp=15173,minproto=2,maxproto=4) wouter@country:~$ ls /mnt/stuff(lots of private data snipped...)
wouter@country:~$ mount /dev/hda5 on / type ext3 (rw,errors=remount-ro,commit=0) tmpfs on /lib/init/rw type tmpfs (rw,nosuid,mode=0755)(...)
binfmt_misc on /proc/sys/fs/binfmt_misc type binfmt_misc (rw,noexec,nosuid,nodev) automount(pid15173) on /autofs type autofs (rw,fd=5,pgrp=15173,minproto=2,maxproto=4) goa:/stuff on /autofs/stuff type nfs (rw,addr=192.168.119.23)And after I wait a minute, that last line is gone. Automounters are cool. And not too hard to set up, either, if only a bit confusing at first. My /etc/auto.master contains the following (not counting commented-out examples):
/autofs /etc/auto.autofs --timeout=60I then need to have a directory /autofs, on which the automounter mounts a special filesystem if it's started; this is the "automount" in the above mount output. The autofs needs a second automounter map, which looks like this in my case:
cdrom -fstype=iso9660,ro,nosuid,nodev :/dev/cdrom stuff -fstype=nfs goa:/stuff camerab -fstype=vfat,ro,umask=133,dmask=22 :/dev/disk/by-id/usb-GENERIC_USB_Storage-SDC_200606191719424ND-0:1-part1 floppy -fstype=auto :/dev/disk/by-id/usb-Y-E_DATA_USB_Floppy_DriveOccasionally, yes, from the above lines it can be inferred that this indeed also works for my USB floppy drive, my multicardreader, and my CD-ROM drive. Finally, I need a symlink into the automount filesystem, like so:
wouter@country:~$ ls -l /mnt/stuff lrwxrwxrwx 1 root root 13 2007-10-23 19:21 /mnt/stuff -> /autofs/stuffet voila: if I now try to access anything below /autofs/stuff, the automounter kicks in, transparently mounts the filesystem, and without any further delay or ado, I can get at my files. Well—unless the server is down, that is.
--type comman line option that allows to filter for package type. As
a starter I'll implement filtering for "game", "gui", "cmdline" or "editor".
If you feel like reimplementing my examples in another language, let me know
and I'll include it to the post.
The filters are implemented using Xapian queries. Xapian allows to build
queries as well as combine existing queries using a large amount of
operators.
This allows us to create a little database of ready made queries:
# This is our little database of simple Debtags filters we provide: the name # entered by the user in "--type" maps to a piece of Xapian query filterdb = dict( # We can do simple AND queries... game = xapian.Query(xapian.Query.OP_AND, ('XTuse::gameplaying', 'XTrole::program')), # Or we can do complicate binary expressions... gui = xapian.Query(xapian.Query.OP_AND, xapian.Query('XTrole::program'), xapian.Query(xapian.Query.OP_OR, 'XTinterface::x11', 'XTinterface::3d')), cmdline = xapian.Query(xapian.Query.OP_AND, 'XTrole::program', 'XTinterface::commandline'), editor = xapian.Query(xapian.Query.OP_AND, 'XTrole::program', 'XTuse::editing')) # Feel free to invent more
# Build the query by ORing together various terms query = xapian.Query(xapian.Query.OP_OR, termlist) # If a filter was requested, AND it with the query if extrafilter: query = xapian.Query(xapian.Query.OP_AND, query, filterdb[extrafilter])
axi-query-pkgtype.py --type=gui image editor
axi-query-pkgtype.py --type=cmdline image editor
axi-query-pkgtype.py --type=game image editor
you will see that the results change radically.
What are the games that match "image editor", you would ask?
74% xjig - An X11 jigsaw puzzle
69% wmpuzzle - WindowMaker dock app 4x4 puzzle
66% xflip - programs to mirror-image or melt your display
Jigsaws, of course :)
The code is now colourised thanks to Simon Ward who pointed me at the syntax
plugin for ikiwiki.
Next in the series: suggesting new terms for improving the query.
cssh machine1 machine2 machine3and clusterssh will open 3 xterms and one control window. Whatever you type into that control window is then send to all 3 machines.
As you can see in the picture I first executed one command on both
hosts, by typing it into the CSSH window, and then selected one host
directly, typing a command only this host sees.
Now, we are all lazy, so lets make cssh easier to use. Noone wants to
type hundreds of hostnames all the time. Luckily clusterssh has a
concept where you map tags to servernames. If you are the admin of your
machine and want to setup such a mapping for all of your users you edit
/etc/clusters, if you just want to do it for yourself edit
$HOME/.csshrc. Actually - do not edit it, but run
cssh -u >$HOME/.csshrcand edit the generated file. Ignore all of the config stuff for now, defaults are nice and good. Go to the bottom and add something similar to the following lines:
clusters = foo bar foo = miau wuff:2222 root@milk:98 root@elsewhere bar = root@miau:443 web@ftp:443Replace with hosts you can actually login to. The above defines two set of hosts, foo and bar. Now all I need to do to login to the defined machines is to type
cssh fooand clusterssh will open 4 xterms and login to the machines. At work I usually have up to 200-250 machines open with clusterssh, so it can handle large numbers of hosts at once. In such cases you might want to consider adding the -G parameter to the commandline, to not get clusterssh to resize the xterms. A last thing I like to do is - give the xterms opened by clusterssh a different layout. My window manager is setup to draw all my terminals maximized and also has some other settings that do not really help clusterssh terminals . But there is a simple way round this. Edit the following options in your .csshrc to look similar like
terminal_allow_send_events=-xrm '*.VT100.allowSendEvents:true' terminal_args=-class CSSHThis will put all xterms into the class CSSH. As your normal settings usually apply to class XTerm this already ignores them. If you want to setup some more things, like a blue background and red foreground in CSSH windows, just add the following into your $HOME/.Xdefaults file (or do whatever steps your window manager might like to configure such things):
CSSH*background: Blue CSSH*foreground: RedActivate with xrdb -load ~/.Xdefaults, done.
I really dislike posts like (sorry AJ, you are just one example) AJ Towns blog post
The last five days I've spent at the combined Debian Edu, FAI and CDD meeting in M rida in Extremadura, together with 17 others. The Debian Edu / Skolelinux crowd was the biggest, followed by FAI, followed by CDD people, though many were part of more than one project. "As usual" it was great to meet many known faces and some unknown ones and to be able to discuss stuff in RL. apt-cache search that:
python-xapian. Documentation on the Python Xapian API can be found in
/usr/share/doc/python-xapian.
import xapian
# Instantiate a xapian.Database object for read only access to the index db = xapian.Database("/var/lib/apt-xapian-index/index")
foo::bar, then it's a Debtags tag instead of a normal
keyword.
For normal keywords, we also search for the stemmed version, so that we can,
for example, find "editing" when the user searches for "edit".
# Stemmer function to generate stemmed search keywords stemmer = xapian.Stem("english") # Build the terms that will go in the query terms = [] for word in args: if word.islower() and word.find("::") != -1: # According to /var/lib/apt-xapian-index/README, Debtags tags are # indexed with the 'XT' prefix. terms.append("XT"+word) else: # If it is not a Debtags tag, then we consider it a normal keyword. word = word.lower() # The index stores keyword all in lowercase terms.append(word) # If the word has a stemmed version, add it to the query. # /var/lib/apt-xapian-index/README tells us that stemmed terms have a # 'Z' prefix. stem = stemmer(word) if stem != word: terms.append("Z"+stem)
# OR the terms together into a Xapian query. # query = xapian.Query(xapian.Query.OP_OR, terms)
xapian.Enquire object:
# Perform the query
enquire = xapian.Enquire(db)
enquire.set_query(query)
# Display the top 20 results, sorted by how well they match matches = enquire.get_mset(0, 20) print "%i results found." % matches.get_matches_estimated() print "Results 1-%i:" % matches.size() for m in matches: # /var/lib/apt-xapian-index/README tells us that the Xapian document data # is the package name. name = m[xapian.MSET_DOCUMENT].get_data() # Get the package record out of the Apt cache, so we can retrieve the short # description pkg = cache[name] # Print the match, together with the short description print "%i%% %s - %s" % (m[xapian.MSET_PERCENT], name, pkg.summary)
./axi-query-simple.py role::program image edit
./axi-query-simple.py role::program game::arcade
./axi-query-simple.py kernel image
You can search Debtags tags using debtags tagsearch. In a later blog post,
I'll show how to use apt-xapian-index to implement a
better-than-you-would-ever-have-thought-possible tag search.
Next in the series: adding simple result filters to the query.
Yesterday I was going through the plugins and widgets, if there are any updates or such. I realized again, that updating of plugins (and maybe searching for the relocated download source) makes me mad. Also testing and switching back is annoying much.
# mv /usr/share/wordpress23/wp-content/plugins/ /usr/share/wordpress23/wp-content/plugins.orig
# mv /usr/share/wordpress23/wp-content/themes/ /usr/share/wordpress23/wp-content/themes.orig
# ln -s /usr/share/wordpress23/wp-content/plugins /usr/share/wordpress/wp-content/plugins
# ln -s /usr/share/wordpress23/wp-content/themes /usr/share/wordpress/wp-content/themes
Remember that package updates of wordpress or wordpress23 may overwrite parts of /usr/share/wordpress/wp-content/[plugins themes] in such situation. BE CAREFULL!
You can get the stuff via apt-line:
deb ftp://ftp.cyconet.org/debian wordpress main non-free contrib
Or directly from: http://ftp.cyconet.org/debian/archive/wordpress/
The actual package list is:
wordpress-plugin-af-extended-live-archive
wordpress-plugin-ald-spa
wordpress-plugin-all-in-one-seo-pack
wordpress-plugin-exec-php
wordpress-plugin-google-sitemap-generator
wordpress-plugin-landingsites
wordpress-plugin-lightbox-2
wordpress-plugin-now-reading
wordpress-plugin-page-links-to
wordpress-plugin-photopress
wordpress-plugin-related-posts
wordpress-plugin-rolemanager
wordpress-plugin-sideblog
wordpress-plugin-spam-karma
wordpress-plugin-stats
wordpress-plugin-ubernyms
wordpress-plugin-utw
wordpress-plugin-utwgooglesitemaps
wordpress-plugins
wordpress-widget-category-cloud
wordpress-widget-samsarin-php
wordpress-widget-utw-cloud
wordpress-widgets
wordpress23
If you want a plugin or widget included and it makes sence to do so, drop me a mail, where to grab. Be aware that UTW isn’t supported since wordpress 2.3 anymore. A tag system was included into wordpress and you need to search replacements for all the nice UTW extension!
Stay tuned!
Debian, opensource, Packaging, planet, plugins, wordpress
Two recent print-media articles begging to be linked:
First, the Autumn of the Multitaskers in this month’s Atlantic. Despite the age-of-Internet theme, the full article is only available to subscribers. The thesis is one I’ve seen before (e.g., in GTD). Namely: although we might feel like we’re accomplishing more when multitasking, we actually end up less productive, and eventually we’ll lose our minds if we continue to overload our sense. The writer takes the idea further than I’ve seen before, incorporating several astonishing indicators from the zeitgeist, including this NSFW quote from Jennifer Connelly that I won’t reprint, and several foreign policy and domestic political examples of how multitasking is failing our culture and our country.
There is a generational divide at work here. Most in previous generations (say, people over 40) didn’t come online until the Internet was nearly full-blown with spam, entertainment news, popups, advertising, streaming stock quotes, rich media services, IM, Facebook, Flash, etc.. These people generally deal poorly with information and sensory overflow because they had no incremental introduction.
The younger generations (people under 25) don’t remember the world before the Internet and multipurpose portable devices, and thus think it entirely normal to watch TV, surf the web with a few open windows, talk on the phone (perhaps VoIP), and IM at the same time. At least. And they’re bored if they don’t have at least have three or four tasks going simultaneously. This isn’t to say that these gen-Yers are actually doing a good job at it — I find myself often answering computer-related questions from my younger siblings because they can’t actually read a focused page or two of dense text on the computer (e.g., a readme file) in one sitting — but rather that they don’t experience the flow as psychologically overwhelming.
That leaves my (in between) generation, generally people born in the 1970’s. Those of us who grew up with early low-bandwidth wide area networks — I started on BITNET, USENET, and BBS’s in the early- to mid-1980’s — have better mechanisms for coping and prioritizing. Perhaps because our multitasking options were relatively limited, we haven’t leaped on the bandwagon to the same extent as others. I personally don’t mind two simultaneous tasks — e.g., perusing RSS headlines and listening to MP3s — but more than that doesn’t interest me. (I don’t count it as “multitasking” in the same sense where one of the tasks is just waiting, e.g., for code to compile or a large upgrade to download).
Please feel free to destroy my broad generalizations here in the comments.
While we’re on the subject of multitasking, I fall into the “subtle exception” category described in Getting Things Done:
The Multitasking Exception There’s a subtle exception to the one-item-at-a-time rule. Some personality types really need to shift their focus away from some task for at least a minute in order to make a decision about it. When I see this going on with someone, I let him take two or sometimes three things out at once as he’s processing. It’s then easier and faster for him to make a choice about the action required.I find this trick particularly helpful in getting unstuck. Frequently, when drafting briefs, I’ve rewritten a sentence eight or nine times and it still doesn’t seem to get across the necessary idea efficiently and without making the reader do any hard work. Switching to another (usually simpler) task, if only for one or two minutes, is often enough to come back and do it right in one swoop. In this situation (and probably only in this situation), multitasking actually saves me time. Second, the Well Tempered Web (by Alex Ross, music critic with a blog) in this week’s New Yorker. This one is more naturally available in complete form online. Ross manages to weave together Wagner, Snakes on a Plane, the Long Tail, and Rick Rubin. Worth reading. (And while you’re at it, check out Adam Gopnik’s piece on abridgments, which unfortunately is not available online.) Lest you all think all I read is the New Yorker and the Atlantic: it’s not true. I’m just not at liberty to disclose my other sources at this time.
Dear lazyplanet, I follow two mediawikis via reading the changes with RSS, and I cannot really follow them well, as the diffs are not very readable. For moinmoin wikis this is no issue, there are nice diff mails one can subscribe to. Does anybody know a way to configure mediawiki, so that it's possible to read the diffs? Or, an example of such a setup? If you do, please contact me. Thanks.
/var/lib/apt-xapian-index/index.
The index is read-only, except for update-apt-xapian-index;
however, it is world-readable: every user can query it, all the time, at the
same time, even during index updates.
The index can contain more than package descriptions.
update-apt-xapian-index indexes data using plugins located in
/usr/share/apt-xapian-index/plugins, and any package can add their own. For
example, debtags will provide a plugin to
index tags.
Since Xapian can index numeric values as well, if anyone makes a
popcon package that downloads popcon information,
they can provide a plugin to index popcon values. If anyone makes an
iterating
package that downloads ratings, they can provide a plugin to index ratings.
Another plugin could be a specialised Debian stemmer that generates token such
as foo out of libfoo-dev.
I think you get the idea: it's very extensible. You can have a look at the
initial set of plugins in
subversion.
The index is also self-documenting, so that one can keep track of all the
intresting things that can be found in it. update-apt-xapian-index does not
only maintain the index, but also the file /var/lib/apt-xapian-index/README
that aggregates documentation provided by the plugins.
To query the index, you just use Xapian. Debian contains Xapian bindings for
various languages:
#!/usr/bin/python
# Copyright (C) 2007 Enrico Zini <enrico@debian.org>
# This software is licensed under the therms of the GNU General Public
# License, version 2 or later.
import libxml2, re
# What links we should filter out
unwanted = re.compile(r"^(http://feed1.example.com http://feed2.example.com)")
doc = libxml2.parseFile("-")
root = doc.getRootElement()
# Create an xpath context and register the namespaces
xpc = doc.xpathNewContext()
for d in root.nsDefs():
if d.name == None:
xpc.xpathRegisterNs("rss", d.content)
else:
xpc.xpathRegisterNs(d.name, d.content)
# Remove unwanted items from the channel list
for x in xpc.xpathEval("/rdf:RDF/rss:channel/rss:items/rdf:Seq/rdf:li"):
res = x.nsProp("resource", "http://www.w3.org/1999/02/22-rdf-syntax-ns#")
if unwanted.match(res):
x.unlinkNode()
x.freeNode()
# Remove unwanted items from the item list
for x in xpc.xpathEval("/rdf:RDF/rss:item"):
res = x.nsProp("about", "http://www.w3.org/1999/02/22-rdf-syntax-ns#")
if unwanted.match(res):
x.unlinkNode()
x.freeNode()
# Serialize the result
print doc.saveFormatFile("-", True)
Now, getting to this simple script took some spitting blood. Basically, in
Debian we seem to have lots of simple libraries for:
rss.channel.items doesn't seem to be a normal array anymore, and
I could not find any documentation on how to modify it.#!/usr/bin/perl -w
use strict;
use warnings;
use XML::RSS;
my $rss = new XML::RSS;
$rss->parsefile("/tmp/rss10.xml");
print $rss->as_string;
Update: Nemui Ailin told me that with the most recent upstream version it
works. I've reported the bugNext.