That's right, MPDDP 2 is now functionally complete, it can do everything that regular MPDDP can, and more. The downside is that, currently, it's incredibly slow to start up, but I'm thinking of a solution for that.The whole routine for checking if a track is allowed by the rule is fairly inefficient currently, so that'll likely be rewritten completely soon and, for ease of parsing, I might change the rule syntax to S-expressions. Perhaps a MPDDP 2.1 already?
Barrucadu's Guide to MPDDP Version Numbers
Which number has changed?
- X.y.z: everything has changed completely. Your configuration file definitely won't work.
- x.Y.z: something big has changed more-or-less completely. Your configuration file probably won't work
- x.y.Z: something has changed, but not really that much; probably just a bugfix. Your configuration file should be fine.
Configuration
MPDDP 2 has a completely different configuration syntax to MPDDP, here's an example:
MPDDP
server = localhost
path:fred/
Connect to the MPD server at localhost and use all tracks in the path fred/.
MPDDP 2
rule fred {
path ~= "fred/"
}
host localhost
active fred
Connect to the MPD server at localhost, and use the rule fred, which matches all tracks with a path containing fred/.
While these two examples are functionally equivalent, the MPDDP 2 example is longer. In fact, my MPDDP 2 config file is a lot longer than my MPDDP config file, but that's because currently it's a direct translation of my MPDDP config file to MPDDP 2 syntax, and I'm not using many MPDDP 2 specific features yet. However, MPDDP 2 can do things that regular MPDDP can't, or can only do using the MPDSPL integration (which has been removed from MPDDP 2). Consider the following, for example:
rule firstfred {
artist = "fred"
album = "first"
}
A rule which matches all tracks by "fred" in the album "first", or the following:
rule fg {
artist = "fred" or \
artist = "george"
}
A rule which matches all tracks by "fred" or "george". Also, note that I split the line into two by putting a backslash before the newline. You can escape newlines like that anywhere in the config file. I suppose that's enough examples for now, now I shall go into more detail about how the rules work.
Rules
Each rule is more correctly known as a ruleset. Each ruleset is broken up into several rules (one line = one rule), and each rule is broken up into several conditions (eg: 'artist = "fred"'). A track matches the ruleset if it matches all of the rules.
Conditions have two forms, the first takes three parameters, the second only one.
'Normal' Conditions
These conditions are in the form "keyword comparison value" (or "value comparison keyword" (or even "keyword comparison keyword", or "value comparison value")), where the keyword is one of the following:
- artist
- album
- title
- path
- file
- genre
- time
Comparison is one of the following:
- = (A equals B)
- != (A does not equal B)
- ~= (A contains B)
- !~= (A does not contain B)
And the value is a string contained in quotes. The following are all valid conditions:
- album ~= artist
- artist ~= "Fred"
- path !~= "boring-music/"
'Rule' conditions
These conditions take only one parameter, the name of a rule. These conditions evaluate to true if the track matches the given rule. These are best explained through an example:
rule fred {
artist = "fred"
}
rule fredfoo {
rule "fred"
album = "foo"
}
The rule fredfoo would then match all tracks which have artist "fred" and album "foo".
Chaining conditions together
As I said, each rule can contain several conditions. These conditions are chained together with the boolean operations "and", "or", and "xor", for example:
- artist = "fred" or artist = "george"
- album = "foo" xor path ~= "bar/"
Putting it all together
So, now you can have rules like this, which would be impossible in MPDDP, even with the MPDSPL integration:
rule dark {
artist = "Nox Arcana" or \
artist = "Mortiis"
album != "Grimm Tales"
title !~= "Child"
}
A rule to return all tracks by Nox Arcana and Mortiis which do not contain "Child" in the title and are not in the album Grimm Tales.
Configuration Continued
So, what other than the rules and a bit of syntax is different for configuration? Well, MPDDP 2 can't save the playlist, or clear the playlist when it starts, any more. I never used those features, so I removed them, and MPDDP 2 now supports password-protected MPD servers! Also, as I'm sure you noticed, the "=" is gone. I might add that back…
So, here are all the configuration options for MPDDP 2:
- host
- port
- password
- changeafter
- playlistlen
- update
- active
The "active" option is a little special, it's a comma-delimited list of rules which should be used. This lets you specify many rules and, without commenting hundreds of lines out, indicate that only one or two of them should be used.
MPDDP 2 does have command-line parameters, which take priotity over the values in the config file, but I'm sure you can figure those out for yourself from the help text.
Well, one month tomorrow, but near enough.
School has ended for half term week—a whole 5 week days off, and what shall I do with this vast amount of free time on my hands? I have a couple of plans. Firstly, Erasmus. I'd like to hit version 0.1 and make a dent in 0.2 this week, as I have free time I can't really hit a snag and put off solving it indefinitely due to “schoolwork”.
Remaining 0.1 features:
- Working memory manager
- IDE driver
- ATA driver
The IDE and ATA drivers have sort of merged, which is ok, for now; I can separate them when I start on ATAPI. The memory manager is there, but doesn't work: I'm going to write one from scratch rather than just borrowing/editing code, as then I'll definitely know what's going on.
After Erasmus, fractalgen. I want to figure out how to create arbitrarily large images with gd; if I try to make one too big it complains about the size exceeding INT_MAX, or something like that. I refuse to believe gd has such a limitation that has no work-arounds when it comes to large images. I also want to start on my fviewer program, a GUI to display / zoom fractals. Smooth colour shading would be nice, but it's not really a high-priority feature currently.
Of course, there are always books. I've still got a heap of books from Christmas to read, and with 9 days before school again, I should be able to get through at least one, perhaps two. I make it sound like I try to read books as quickly as possible, which isn't entirely true: I just dislike having unread books lying around, when I re-read books, I do take my time and generally notice things I didn't the first time through.
Leading on to other forms of entertainment: anime. I have borrowed the first two seasons of Claymore which, hopefully, I'll enjoy. Claymore is about a world in which humans coexist with yoma, demons, where there exists a group of half-human half-yoma warriors, the Claymores, who protect the humans (for a fee).
Finally, after mpdspl was rewritten to be much better by sdelafond, I have been spurred into action to improve mpddp. A complete rewrite; a second version. It will be object-orientated and have much better code organisation (the current program is a mess: why I change it so very rarely), and I have a vague notion of wanting a “more powerful” config syntax. Currently each line of a config file acts as a boolean OR: including everything which matches this line, OR that line, OR another… I want to include more boolean operations, AND at the very least, perhaps NOT (that's currently worked-around by the “never” keyword) or XOR, too.
Of my plans, mpddp 2 is the one I'm most excited about implementing. I can barely remember how the current code works, so I'll most likely read through it to figure out which functions do what, and then just write version 2 from scratch.
Over the past couple of days I've been working on what started as a Mandelbrot Set generator, but has expanded into a Julia Set generator and, with the growing number of command-line parameters, can generate other stuff too, like Tricorn and Multibrot sets. Currently I'm using the simple escape-time algorithm for generating colours, which looks a bit rubbish, but it's a start to having wonderfully coloured fractals.
I plan to write a viewer program at some point, to provide a graphical interface to generate and zoom fractals generated by the current program. The source code can be found on github and is written in C.
My mandelbrot function is a slight variation of the original which allows an initial parameter.
Mandelbrot
Mandelbrot (b = -0.5 + 0.5i)
Julia (K = 0.5 - 0.3i)
Tricorn
Multibrot (d = 3)
Yesterday I had the idea of writing a cronjob to, every five minutes say, check things like the CPU load and temperature, and send me a message via Jabber is anything was amiss. I then realised that I could have this script send me a list of new posts in my RSS feeds, and a list of package updates, and even a notification when a torrent is done.
Today, I found sendxmpp, which, according to the website, “is a perl-script to send xmpp (jabber), similar to what mail(1) does for mail.” This seemed perfect for my needs, so I installed it, wrote the configuration file, ~/.sendxmpprc, which is in the following format and must be mode 0600:
# A comment
username@hostname password
The command itself is invoked as follows:
echo "message goes here" | sendxmpp jid
A subject can be given, but for my purposes that was unnecessary. I wrote a script to run be run by cron at 5 minute intervals to alert me if the fan speed, CPU and HDD temperatures, or load average crossed certain thresholds, as well as checking on my torrents and telling me if any had finished since the last message:
#!/bin/zsh
memmax=993.0
fanspeed=`sensors | grep fan1 | sed -e "s/fan1:\s*\([0-9]*\).*/\\1/"`
cputemp=`sensors | grep temp3 | sed -e "s/temp3:\s*+\([0-9]*\).*/\\1/"`
hddtemp=`sudo hddtemp -n /dev/sda`
memusage=`free -m | grep "buffers/cache" | sed -e "s/-\/+ buffers\/cache:\s*\([0-9]*\)\s*\([0-9]*\).*/\\1/"`
loadavg=`uptime | sed "s/.*load average: \(.*\)/\\1/"`
memcheck=$[ `free -m | grep 'buffers/cache' | sed 's/.*\([0-9][0-9][0-9]\).*[0-9].*/\1/'` / $memmax * 100 ]
loadcheck=`echo "$[\`uptime | sed "s/.*load average: \([0-9\.]*\)/\\1/" | sed "s/, .*//"\` * 100]" | sed "s/\..*//"`
# Add notifications about the system not acting as it should - 2 spaces after the ] to line up with torrent messages.
[ $fanspeed -ge 4750 ] && echo "[status] Northbridge fan speed too high: $fanspeed RPM" >> /tmp/xmppmessages
[ $cputemp -ge 50 ] && echo "[status] CPU temperature too high: $cputemp °C" >> /tmp/xmppmessages
[ $hddtemp -ge 45 ] && echo "[status] HDD temperature too high: $hddtemp °C" >> /tmp/xmppmessages
[ $memcheck -gt 33 ] && echo "[status] Memory usage too high: $memusage / $memmax MB" >> /tmp/xmppmessages
[ $loadcheck -ge 50 ] && echo "[status] Load averages too high: $loadavg" >> /tmp/xmppmessages
# Only show torrents whose status has changed
if [[ ! -f /tmp/torrentstatus ]]; then
w3m -dump "http://localhost/rtorrentinfo.php?seed=1" | awk '{print "[torrent] " $0}' > /tmp/torrentstatus
cat /tmp/torrentstatus >> /tmp/xmppmessages
else
w3m -dump "http://localhost/rtorrentinfo.php?seed=1" | awk '{print "[torrent] " $0}' > /tmp/torrentstatus2
comm -1 -3 /tmp/torrentstatus /tmp/torrentstatus2 >> /tmp/xmppmessages
mv /tmp/torrentstatus2 /tmp/torrentstatus
fi
# Send and clear the messages
sendxmpp mike@barrucadu.co.uk < /tmp/xmppmessages
echo > /tmp/xmppmessages
The reason I use a file to store the messages and then send them all in one go is because various other scripts append text to it—such as my hourly pacman database sync to notify me of new updates, and my hourly RSS sync, to notify me of new messages.
rtorrentinfo.php is a simple script I wrote to list seeding or leeching torrents, along with how much is complete (for leeching packages). I don't think it's overly relevent to the topic of the post, so if you want it, ask in the comments or send me an email.
A thread by opengl_cpp on the Ubuntu forums got me thinking about, well, why Hurd? Why Arch Hurd? I posted a short answer in that thread but now I'll try to answer more in depth here.
I always wonder why gnu project uses mach microkernel as its design basis. since there was a lot of advances to microkernel design such as l3 and l4 microkernels, it may not be a good decision to insist on old mach.
it has been proved that mach has some performance drawbacks in addition to its complex design, since l4 kernel is by far easier to understand and implement and also has performance superiority over mach.
Well, I don't know much about the variety of microkernels out there. In case you (reader, not opengl_cpp) didn't know, there have been ports of Hurd to different, or even completely new, microkernels, such as l4 and viengoos. They seem to have fallen out of favour with the Hurd dev community, though, so it seems we're stuck with Mach for the time being.
A reason for that could be inertia—so much effort has gone into writing Hurd for Mach it would be a pain to get everybody to learn the l4 or viengoos way of doing things. Which is a shame, really, if a different kernel could improve Hurd, it should really be given a fair try rather than just being an offshoot project with a handful of developers hoping it'll be an improvement.
blur xc asked a few questions about the Hurd and Mach itself:
1- What will the Hurd kernel offer than the Linux kernel lacks, besides the more fitting title "GNU Hurd" to the operating system?
Well, probably not much. The Hurd is a great idea, and they're doing brilliantly given the near-total lack of interest amongst open source users (not so amongst the Free Software crowd though). We can all, as Allan so brilliantly put it, bask in microkernally goodness. And, of course, we can play around with it—it's different, that's fun—but it probably won't offer much to us, for a while at least.
2- Driver support. Will the Hurd kernel need completely new drivers for all the hardware that's already running well under the Linux kernel? I understand the open source drivers could be ported across, but that's still a lot of work to do for a lot of hardware.
Currently, the Hurd uses drivers from Linux 2.6.0. Unfortunately, these are ancient, so it doesn't support fancy modern technology such as, oh I don't know… SATA. A problem, obviously, I can't even boot it on my laptop as it uses (to my surprise) a SATA HDD. I can boot it in a virtual machine, though.
There is work by Zheng Da to port DDE Linux26 to the Hurd from L4. This will, theoretically, bring support for Linux 2.6.29 drivers without any patching or rewriting needed. This also bring the possibility of, one day, having a DDE FreeBSD, or for any other OS, able to run their drivers in Mach.
OS-specific DDEs (Device Driver Environment) are a lower-level interface between what the OS drivers expect, and what DDEKit, the higher level driver abstraction layer, provides. As the OS-specific DDEs are only dependent on DDEKit, there is the possibility of porting DDEKit to another OS, and having all of the OS-specific DDEs come with it. Now that would be something wonderful.
3- w/ RMS being a FOSS zealot- does that mean there won't be any proprietary drivers permitted for hardware that doesn't have acceptable open source drivers?
I don't imagine RMS has supreme absolute control over the Hurd (well, I suppose he does, but you know what I mean…); third-party developers would still be able to develop non-free drivers, even if RMS did influence them away from the main Hurd distribution.
I don't imagine he'd be too happy about it… but I don't really imagine companies will begin porting their proprietary drivers to another OS, though in theory the DDE layer would allow you to run the Linux ones with Hurd just fine.
4- Same deal as above- but regarding Flash. Does this mean no adobe flash?
Heh, nor can I really see Adobe porting Flash any time soon.
5- in the end- what does that gain us?
A new kernel to play with, a new set of distributions to play with, and a great way to waste time. Isn't playing with the OS why most of us like Linux in the first place?





![[FSF Associate Member]](http://www.barrucadu.co.uk/images/fsf.png)


