Search Results: "xam"

15 November 2005

Steve Kemp: Lua annoyance

Lua Directory Handling
Arrrgggghhhhh!!!! OK maybe lua is not love. I just realised that Lua has no concept of directory handling (opendir, readdir, etc). Indeed it isn’t possible to tell whether something is a directory or a file. So I added some more primitives to the Lua socket extension library. Most usefully a readdir call. This means the sample webserver can now serve directory contents if index.html isn’t found. It can also now fall back to serving a “default virtual host” if the requested one doesn’t exist. The webserver code is now very stable and complete. The only omission is CGI handling, but I’m not going to bother unless prompted strongly. I’ve added some simple examples to the documentation and I think things are looking good. The Debian package has been downloaded a few times, but no real feedback - feel free to share, don’t be shy!

Steve Kemp: Things I have never written: #4

Weblog Software
I’ve been keeping an online journal over at LiveJournal since 23rd February 2002. To support them I actually bought a “Permanent Account” a while back, an example of putting money behind companies and/or services which are useful - even when it isn’t required. After getting into the swing of things there I started the blog which is used upon Planet Debian and have also been enjoying that. Livejournal is a nice service, and they have great software powering the site. The Livejournal code is available and it is reasonably simple to install. (I’ve setup a few installations of the codebase, and played with them. I admit I’ve never run it in anger). Obviously it is completely overkill to run your own installation of Livejournal - unless, perhaps, you’re a school or a large company. So for my personal blog I use Wordpress. I don’t particularly enjoy using wordpress. To be honest I need only four features/abilities of weblog software:
  • The ability to create posts.
  • The ability for users to be able to leave comments upon entries.
  • The ability to search previous entries.
  • The ability to export the blog entries as a feed.
Everything else is utterly overkill. The downside of using Wordpress is threefold:
  • Because it is popular there are multiple bots crawling the web and leaving spammy comments.
  • Because it uses some funky addressing system any replacement would leave lots of broken links.
  • It has historically had a couple of security issues.
I’ve been telling mysefl for the past few months:
  • This software has got to go.
  • I’ll wait until there is another security hole discovered.
So .. HTML::Template & CGI::Application will at some point come to the rescue. I’m just not sure when. I guess this means I’ve not yet written a bloggin system…. ;) I want to only cover the basics:
  • Multiple users.
  • Multiple catagories/tags.
  • Comments with a sane anti-spam system.
PS - The Sisters of Mercy rock.

14 November 2005

Wouter Verhelst: Automatic networking

A long time ago, I wrote:
In these days of VPN, IPsec, dynamic routing, tunnels, IPv6, and autoconfiguration protocols, one would expect that it would be possible to configure a laptop to find all kinds of hosts automatically, both for those that are network-specific (proxy servers, NNTP-servers), and for those that are not (mail servers, version control systems, ...).
I then went on to say that I could not, at the time, expect my laptop to find those networks by itself; every time I logged on to some network, I had to set up at least two SSH tunnels. I received a lot of feedback to that post, and I now do have my laptop set up so that it configures itself automatically if necessary. Well, almost; see below. This is what I've done: I don't use ifupdown on my laptop anymore. The package is installed and configures my lo interface, but that's it—nothing else. Instead, I'm using whereami to configure my network cards. Whereami is an excellent piece of software that is configured through two configuration files: detect.conf and whereami.conf. The former has a pretty peculiar syntaxis, which you'll need to get used to at first; but it's very powerful. There are a few things you can do in detect.conf:
  1. Run tests. A test will check whether a condition is true, and set a location based on the result. An example of a test could be
    testmii eth0 lan
    
    which checks whether the MII detects a cable (testmii) on eth0, and will set the lan location if that is true. Tests are the raison d' tre of detect.conf; the point is to run as many relevant tests as possible, to get as much information as possible about the location where you are; that way, you can configure the system later on from whereami.conf (see below). There's other things like testdhcp (check for the presence and/or the returned IP address of a DHCP server), testap (test for the presence of an Access Point), testmodule (check whether something loaded a given kernel module), or even testarp if you're desperate (to test whether a node with a given MAC address lives on the network).
  2. Checking locations. For instance, you might want to run testdhcp on eth0 only if the location lan is set already. This way, you don't get timeouts if you're on the train or anything. Checking locations is done with if <location> ... elif <location> ... else ... fi. Which is to say, you get a multi-line block of if structures, in which you can then run other tests conditionally. I'm just too lazy to write it out here :-)
    Unfortunately, it is not possible to nest if structures in detect.conf; but I don't think it's actually necessary for the detection (it might be nice for whereami.conf later on, but there the issues can be worked around).
  3. There's also the possibility to do things like setting environment variables, default locations, and some similar housekeeping things.
It is possible to set more than one location from detect.conf; for example, right now my laptop claims it's at werk,dhcp,lan. At home, it detects it's at thuis,dhcp,lan—unless I use my wireless interface, in which case it detects it's at zd1211,thuis,wlan,dhcp,wdhcp After whereami finished the tests in detect.conf, your network should be working (provided you have a network cable plugged in, or are in the vicinity of an AP that you can connect to). Next, it will process whereami.conf. The genius of whereami probably lies in whereami.conf: this is a simple shellscript, but every line can be preceded by one of +, -, or =, followed by a location. For example, I have (amongst other things) this set up in my whereami.conf:
+lan ln -sf /etc/news/leafnode/config.generic /etc/news/leafnode/config
+werk ln -sf /etc/news/leafnode/config.werk /etc/news/leafnode/config
+thuis ln -sf /etc/news/leafnode/config.thuis /etc/news/leafnode/config
Whereami will check this file for any lines that start with '+' followed by a location it's going to, or '-' followed by a location it's leaving from, or '=' followed by a location it's either leaving from, going to, or staying at. It then removes the +/-/= plus the location, and dumps the rest of the line to a file; that file is then ran as a shell script. In other words, the above code will overwrite my /etc/news/leafnode/config with an appropriate configuration, depending on what network I'm entering. I don't have to reconfigure NNTP servers anymore. Nor do I need to set up any tunnels—whereami does all of this for me, and more. Next, since a few weeks, I've also added ifplugd. Previously, when I would get my laptop to resume from swsusp, I would need to manually run whereami afterwards; with ifplugd, this is no longer necessary—I just removed the ifupdown script in /etc/ifplugd/action.d, and replaced it with a whereami script that I quickly wrote myself (not as if it's hard, obviously). There's just one thing left: the proxy server. There are just way too many programs that one needs to configure to use a proxy server (or not) in Linux; and though it's possible to configure a proxy server by letting firefox "detect" it, I have no clue how that's done. Additionally, programs that use proxy servers through environment variables can not be reconfigured, unless one logs off and on again. I guess I'm looking for something that will do transparent proxying if there's a proxy server on the network, or just forward the requests to the remote server if not. But that's for another time.

13 November 2005

Matthew Palmer: Working as a Witness

(A continuation of my reminiscences as an expert witness.) In an earlier post, I made brief mention of the unpleasant realities of being a witness in a trial. More details, ahoy! Most witnesses aren't allowed in the courtroom except when they're giving evidence (to avoid bias) and have to sit out in the hallway. Bring a fat book, because you could be out there for days. I don't think much compensation is provided for your time, either. And, as a final indignity, the lawyers might not even end up calling you to the stand. For example, one of the prosecution witnesses in the case I was involved with was called to appear, and sat outside the court for eight (count them, 8!) days, before being told he wasn't needed after all, and he could go home. I don't know about you, but if that had been me, I would have ended up in the dock myself on a charge of mayhem. Another witness, after having been through her time on the stand, made a comment along the lines of "I'm going to make sure I'm overseas next time". Expert witnesses (as I was) get treated a little better. We can watch most of the bantering in court, while we evaluate the technical evidence presented by other witnesses (experts and non-experts alike), and at least the pay is sensible. As an occupation, "expert witness" would be OK. The hours are pretty sweet, the pay is good, and the conditions quite reasonable. For a regular geek like myself, though, it was fairly close to agony by the end of it. I've had three big projects on indefinite hold while I was at court, unable to give my clients a firm date when I could resume work for them. They were all understanding, bless them, but I could have lost out badly. The complete uncertainty as to what is going to happen and when means that you basically end up camping out at the courthouse for umpteen days. At least, in my case, I was being paid regular consulting rates for my camping. When I say uncertainty, I really do mean it. I was originally told I'd be needed for a day or two -- a quick look at what the other witnesses were saying, maybe jump in the box for a bit, and then I'm off. Then the first witness in the stand was there for nearly three days (along with a day or two of procedural stuff in amongst it so I had been there a week before he was finished). Then the defence was going to make a motion for dismissal, because the prosecution were being pummeled by his honour for their lack of case preparation, so I would have been out of there. That never materialised. Then more procedural faffage, another witness that ended up in the box for about 4 days -- each day of which I thought was the last -- and then it was my turn, which lasted nearly four days. At no stage did I have any indication of when it was going to be over, either, so I couldn't say with any sort of certainty when I could start helping anyone else out. While the legal system has a vital part to play, I'm wondering if something could be done to improve the running of trials to reduce this sort of pummeling of witnesses. On the sweet hours: court convenes each morning at 10am. There's usually half and hour to an hour of transcription correction (although I get the impression that isn't a standard thing) then witnesses start going through. There's a half hour morning tea break around 11 or 11:30, and then an hour lunch at 1pm. Usually there will also be an afternoon break of 10 to 15 minutes, before court adjourns for the day at 4pm (if not a bit earlier). I presume that the reason for the short days is that it's mentally very tiring, and there's lots of prep work for the lawyers mornings and afternoons, but it's a lot better life when you've got none of that to do. Unfortunately, the day isn't short enough that I could get a lot of other work done, so it's effectively just a short-paid day.

12 November 2005

Steve Kemp: Things I have never written : #2

KDE
I have never once written anything using Qt. Why not? I have no real dislike of the toolkit, license, or implementation language. It just hasn’t ever been necessary or appropriate for me to use it. Generally speaking I only dabble with coding online applications in Perl/PHP (Perl is my preference, sometimes I get suckered into using PHP). Any software which I’ve needed to write with a GUI usually ends up being coded using the raw X11 libraries (xlib, etc). A few times I’ve needed to have something be stable, sharable, and GUI-driven and xlib didn’t cut it I’ve chosen to use the GTK libraries. Mostly that has been down to three reasons:
  • Finding small examples of code is very simple; as it is well-used.
    • By contrast many Qt applications are larger pieces of code. Finding examples using the functions you’re interested in is harder.
  • I love C++, but generally I develop in Perl, or C.
  • I don’t have to worry about the moc preprocessor, writing Makefiles, etc.
I’m sure that sometime in the future I will experiment with Qt, and possibly even install KDE to try it out. But it won’t be soon. (I think that desktop environments are a good thing, and can be attractive, productive, and useful. However I’ve only used Gnome briefly and tend to stick with the more lightweight IceWM environment). Once upon a time I did install and tinker with KDevelop, but nothing much came of it. When I lost my desktop machine due to hardware failure I didn’t feel the need to re-install it. Instead I stuck to using GNU Emacs + Vim for editing code.
Right now I’ve written that I shall go back to shaving my head. To make me look more like my avatar.

Radu Spineanu: New Faithless Fan

I recently discovered Faithless sounds pretty nice. By some weird circumstances i got my hands on a Faithless Live At Alexandra Palace DVD.
Knowing only a couple of their songs, i was pretty convinced the show would be boring. I was so totally wrong. I've watched it about 10 times already, and i'm not bored yet.

In other news, i had to take an asm test thursday. It was pretty weird, since i woke up that morning not having read any of the material. Thank God for Google, and the couple of asm tutorials out there. The subjects were easy (count the number of times a character appears in a string, reverse a string).
Still, I didn't make everything perfect. Having little time, i just read through the tutorials and didn't actually write any code until the test. In the end i remembered something wrong from the examples, and the program was not ending properly...

About having great ideas in weird moments. In my case it usually happens right before i fall asleep. At least with showers you can take as many as you want :).

11 November 2005

Matthew Palmer: Do we need a licence to *use* our software?

Note: All of this is specific to Australian law. Similar principles may apply elsewhere, but I've got no idea where, if any, they might apply. Also, I'm not a lawyer, nor do I play one on TV, and my writings here (and for that matter, everywhere else) are for entertainment purposes only. If swallowed, do not induce vomiting. In the middle of a cogitation this morning, my thoughts turned (as they occasionally do) to the much loathed EULA for Nobody's Favourite OS. As we all know, this EULA is pretty brutal in the things you agree to allow other people to do to your machine, and the rights you agree to give up. As I was, in general, thinking about issues of copyright law, the EULA got looked at through copyright-coloured glasses. And it was... weird. As we all (probably) know, copyright law is about limiting the actions that can be performed with a work of creation, and giving the author of the creative work the ability to be the sole arbiter of who can perform those actions. The Australian Copyright Council has a nice information sheet on Copyright and Computer Software if you'd like to get the full story. The set of actions which the Copyright holder has exclusive rights to is fairly well proscribed. The statement "All Rights Reserved" doesn't mean "every possible right is reserved", it means "those rights which I can control (by virtue of the legally-protected monopoly of copyright law) are reserved". As far as I can tell, there is no right which allows the copyright holder to control the use of the creative work. It's important to think about what "use" actually means. The Copyright Act and the above info sheet tend to apply the word "use" to include the act of making copies, as well as other dealings (protected or otherwise) in the copyright work, but that doesn't seem particularly useful for this discussion, because I can't think of another appropriate word to use to describe a non-copying action involving the work. So I'll stick with "use" for that, and go with "copying" for any duplication. Obviously, the type of work that we're looking at determines what "using" that work means. A book is read, or perhaps burnt for warmth. A picture is stared at. A computer program is run. I can't find anything in Copyright law that covers reading, burning, or staring, but section 47B of the Copyright Act 1968 (Cth) deals with the "normal use or study" -- basically, the act of using the thing. It says that users are allowed to copy the program into RAM to run it[1]. Goody. So far, it looks like there's no way the copyright holder can stop us from running our legally acquired copies. There are two flies in the ointment, though. The first is s47(2)(b) of the Act:
(2) Subsection (1) does not apply to the making of a reproduction of a computer program:
[...]
(b) contrary to an express direction or licence given by, or on behalf of, the owner of the copyright in the computer program to the owner or licensee of the copy from which the reproduction is made when the owner or licensee of that copy acquired it.
Aaaargh! Does this mean that the copyright holder can force a licence on us, against our will? I really don't know the answer to that. Hopefully, at the very least, the protections of contracts law[2] would apply to such licences. If licences can be treated as contracts, then they can be rejected. If the copyright holder can't restrict the running of a legally obtained copy of the program, then how can they compel the acceptance of a licence? One idea that comes to mind is the process of installation. That is neither an incidental nor an automatic copy, and hence doesn't fall under the allowances of s47. So, without the permission of the copyright holder, making an installation from CD to your hard drive would seem like an infringemnet. On the other hand, the installation program usually runs directly from (for example) the CD, and if it wants to make copies of other copyright material owned by the same person or company as part of it's ordinary operation, then who are we to stop it? But back to the idea of compelling acceptance. Looking at the XPToy Retail EULA for a moment, part of the agreement is that you agree to be bound by the terms by the action of installing, copying, or "otherwise using" the software. But if you don't agree to any of the EULA, I'm not sure how you can agree that you agree to be bound by the EULA by performing an action which the copyright holder cannot restrict you from doing. On the other hand, perhaps I've drunk too much of the GPL "You don't have to accept this licence, but nothing else gives you the right to copy this software" inplied-licence-acceptance kool-aid, and there is provision in law for licences to specify other positive means of signifying acceptance. I know that contracts can be accepted by written agreement between the parties, and with a suitable verbal exchange, so perhaps you can add "Installing, copying, or otherwise using" to that list. I wonder if "You agree to the acceptance of this agreement to give me your first-born child by blinking within 15 metres of me" would be valid? No, I didn't think so either. Does anyone know where the descriptions of permissible means of agreeing to a contract are defined in Australian law? To get back on track, let's assume for a moment that we can refuse the EULA. Can we still use the software? s47(2)(b) says we can't contravene licence terms, but if we can refuse the EULA then it doesn't look like there are any licence terms. So we're back to relying on s47(1), which says copying for running the program isn't a problem. If you can avoid accepting the EULA, and don't do anything otherwise naughty with the software, I can't see how anyone can have any complaint, in Copyright law, with your actions. Of course, the next trick is to avoid clicking-through the EULA "you accept" notice without falling foul of any other provisions, but if we've already knocked the paper-EULA on the head with contracts law or something, then I don't think that your click-through acceptance (coerced, as it were) is going to worth a hell of a lot more. I know the DMCA in the US did a lot to strengthen the power of click-wrap licences; perhaps those provisions got written into AusNSFTA. Of course, this whole thing is based around a lot of conjecture and a lack of real, detailed knowledge of the law. Perhaps there's even some bits of the Copyright Act I've missed. I'd be interested to hear your thoughts on the matter. Do we need a licence to use software we've legitimately purchased? I'm interested in your comments. E-mail me at mpalmer@hezmatt.org.
1. I'm not quite sure why this is so majorly different to a person with an eidetic memory reading a book, but I guess it's better to cover the issue to stop lawyers getting richer. 2. There's all sorts of goodies in contracts law, from what I recall -- prohibitions against coercive contracts, and contracts presented as a fait accompli (AKA "take it or leave it") without any ability or intention to negotiate. Certainly sounds like a EULA to me...

8 November 2005

Erich Schubert: On a binary driver interface for Linux

Some japanese companies have requested that the Linux kernel gets a "stable" (whatever) kernel interface for binary drivers. The obvious reason is, that they want to be able to add (illegal!) closed source drivers to the linux kernel. This is a bad idea for a couple of reasons, that have been discussed in a couple of places. Instead I want to show you a couple of examples to illustrate that. First of all, let me name the binary, closed-source drivers of ATI and Nvidia. They totally suck. They are unreliable, cause system crashes, don't work with power management and so on. Is this the type of driver you want? Commercial driver development is not capable of supporting the development speed and models of opensource. Other examples to show you the problems with all the closed source stuff include many wireless access points such as the isl3893 platform or broadcoms AR7. They duefully released the kernel code they used and maybe some drivers, but even the kernel code they touched is broken to large extends (that's why Intersil/Conexant doesn't support https on their isl3893 accesspoints, because they broke their libc in a way they can't get SSL to work on it any more). Now let me give you a good example: USB. There the interface to the hardware was openly and clearly specified, also for many many uses. The result is, that today basically any memory stick and digital camera adhers to this standard, and there is only one driver for it. Thats why they "just work". So instead of requesting a binary driver API in the kernel, these japanese manufacturers should instead start an industry initiative just like USB to standardize on a common stable hardware interface so we don't need a different driver for every hardware. Our real problem is that no hardware is like the other, and nothing is properly documented. And hardware manufacturers earn their money with hardware and haven't got much expertise on software...

Clint Adams: Feel the zsh of the rhythm of the night

Say, for example, that you were a rabid Miami Sound Machine fan, but you were subjected to grave trauma, and now you are so emotionally handicapped that a mere reminder will send you into hysterics. Perhaps you keep your diary in multiple files in a directory somewhere, and you decide that you want to revise history and wipe out any files that mention Gloria Estefan.
rm $(grep -l "Gloria Estefan" diary/*)
That's pretty easy, but, maybe you want to preserve as much as you can stomach, and you've learned that you can handle seeing Gloria Estefan every once in a while. So you only want to delete files that have Gloria Estefan more than once.
rhythmisgonnagetyou()  
[[ $(grep -c "Gloria Estefan" $REPLY) -gt 1 ]] 
 
rm *(+rhythmisgonnagetyou)
Of course, you can make it much more complex.

Steve Kemp: Things I have never written #1

Coding Mistakes
I broke my debian administration website yesterday. Predictably enough I’d woken up around 9AM and thought that it would be a good time to make significant refactering changes. Tested them on my laptop, committed them to CVS, then updated the live site. Had a quick play to make sure nothing had obviously broken - but didn’t try to leave a comment on an article. Went to sleep and woke up around 4pm to find 15 emails telling me things were broken. Most mails on the site in a single day! Should be fixed now. But I’ll never again make changes before lunchtime, I’m just not good with the whole sleepy-coding thing.
Things I have never coded: 1
Inspired by Joey Hess’s “Ten years of free software”. Things I have never coded part 1. I have never coded a text editor. *shock* In the past I have written simple wrappers around the various text controls in different environments - for example under Windows I once coded a tabbed text editor called MyNotepad, which featured a novel dockable tree-control to the side which allowed navigation and loading of files easily. When I first started working with Java I coded a similar thing, but with the ability to load external Java .class files as plugins. This editor was called Rosetta, inspired by the band Rosetta Stone (who were in turn inspired by the actual Rosetta stone ) At times I think about text editors. I use them daily, obviously, and I love working with some more than others. My editor is usually GNU Emacs but I’m also partial to Vim. I will use both happily; although neither is pleasant without my personal customizations. Simple text editors are a traditional project for coders, and freshmeat is littered with their discared corpses. Probably the only reason I’ve not started - that and apathy. My ideal editor would be:
  • Both curses and x11 based.
  • Scriptable (Lua is love?)
  • Extensible.
  • Portable between (at least) GNU/Linux and Solaris.
  • Modeless.

6 November 2005

Andrew Pollock: [code] Obfuscating email addresses with JavaScript

So I got pet peeved by Carlos Laviola in relation to by recent pondering about how MacOS X's SSH agent starts up on login. Perfectly reasonable grounds for complaint. I have had people contact me in relation to blog posts in the past, so it's obviously not impossible. People know I'm a Debian developer and can put two and two together and wind up at db.debian.org. Anyway, I'm the first to admit that my blog probably has too many of the Weblog Usability Top Ten Design Mistakes (something for me to work on). To date, I've been avoiding plastering my email address on my website because I didn't want to get it harvested. I try and use a per-list email address for this reason as well, and I haven't enabled blog comments because of comment spam, and because I haven't been clever enough to implement comments with Blosxom full stop. So I started getting an idea for reversibly encrypting my email address on my blog after reading about Hashcash for Wordpress the other day. I first started playing around with the Vernam cipher in High School, when I wanted to easily reversibly obfuscate some data for something. I'd read about this cipher in a magazine or something and seen it implemented in Pascal (it's not exactly hard). So I happened upon the idea of encrypting my email address with the Vernam cipher. Turns out another chap's already got a page for encrypting and decrypting on the fly with JavaScript. It even generates the JavaScript for putting in your own web pages. I had to use a different key to avoid getting dollar signs in the encrypted string, as this confused the tripe out of Blosxom (and me for a while when I tried to figure out what was going wrong). Then I thought it'd be nice to explain to people who had JavaScript disabled what they might be missing out on, so I fiddled around with some DOM stuff, and had some text get displayed if JavaScript was disabled. When JavaScript is enabled, this text is replaced by the decrypted text. So of course, like the Wordpress Hashcash, this is largely relying on the inability of spam bots to grok JavaScript. Once they can, this obfuscation technique is all for naught. Meanwhile, you can email me bit more easily now if you get the urge. View the source of my blog for an example of the implementation.

5 November 2005

Mike Hommey: Nasty bugs

Recently, I’ve been going through mozilla-firefox’s list of bugs and took a look to some of them. I got interested in #336411, since I’m regularly hit by this one myself (remember ? I said I got strange crashes with 1.5beta1). It appears that this strange crasher is in fact due to extensions using binary components. ColorZilla was the one killing my firefox. Why does it crash on debian’s firefox and not on upstream’s ? Simple : upstream’s is built with gcc 3.4, debian’s with gcc 4.0. Both C++ ABIs are incompatible. Now the question is : what can we do for that ? A quick fix could be to check before loading the component, if it’s linked to the incompatible libstdc++.so.5, but it’s almost as nasty as the bug itself… I’ve not really investigated possible solutions yet, but if you have some better ideas, you’re welcome. Another bug I got interested in is #211010 and its dupe, #256384. This one was really nasty. One of the kind I hate : bad programming practices. The interesting thing with this bug, though, was that it’s been revealed because of 3 other issues in 2 separate programs. The first issue is that autoconf decides to use echo 'something\c' over echo -n something when both ‘\c’ and -n are understood by echo. The second issue is that when giving some options with spaces to configure (like in --enable-optimize="-pipe -w -O2"), the associated variable gets backslashed spaces (i.e. "-pipe\ -w\ -O2") (thus, being an autoconf feature) The third issue is that the mozilla configure.in script tries to get rid of these backslashed spaces with echo $enableval sed -e 's \\\ g', triggering the nasty dash bug. A simple workaround, as stated in #256384 is to quote $enableval Now, for the dash bug itself. What happens with dash is that whenever you echo a ‘\c’ escape sequence, all subsequent echo commands stop printing after the first argument containing a backslash. For example echo test1 'test2\ttest3' test4 outputs test1 test2<tab>test3. In the case of our echo $enableval, since its value was -pipe\ -w\ -O2, it printed -pipe\ without any space after the backslash, so that it was not removed by the sed call. This value was then substitued in config/autoconf.mk.in to create config/autoconf.mk, where the ending backslash was interpreted as its shell meaning (continue on next line), thus breaking the variable, and build command lines. And for the bad programming practice ? The dash bug is due to a global variable that never got re-initialized, leaving the “terminate echo” (kinda) flag turned on (which is only checked when there is a backslash in the argument, since it is used to stop printing after, guess what… ‘\c’). No wonder why one of the first things you learn in programming classes is : never use global variables. (or at least, be very very very careful about what you do with them)

4 November 2005

Adam Rosi-Kessel: randomplay 0.48 released

I’ve released randomplay 0.48. randomplay is my command-line ‘itch a scratch’ music player. It is most useful for maintaining a random shuffle over many sessions—for example, I use it to make sure I don’t ever hear the same song in any three month period. The new version fixes a bug that prevented randomplay from advancing to the next track when the player subprocess itself spawned a child process (e.g., with ‘play’ which spawns ‘sox’). I use a bit of a hack to kill the child task and it’s children, but the standard way of doing this in perl—kill HUP => -$$ doesn’t seem to work when randomplay is called from a shell script and the child process’ output is redirected to null. Here’s the code in question (with the fix to kill children and grandchildren recursively):
# KillAll recursively kills the request process ID and all of its children/grandchildren/etc.
# This is a bit of a hack--there should be a better way to do this, but I haven't found one.
# Normally, kill HUP => -$$ should do the job, except this doesn't work when randomplay itself
# is called from a shell script and all output from child processes is redirected to null.
# This subroutine assumes that shelling out to ps is going to work, which may not be totally
# safe--at the very least, it reduces the portability of the script.
# Any suggestions for a better way to do this are welcome.
sub KillAll  
  my $pid = shift;
  local $SIG HUP  = 'IGNORE';   # don't want to kill ourselves here--shouldn't happen, but just in case.
  if (open PS, "ps -o pid,ppid  ")  
     eof PS; # Force ps to run now. Otherwise it would run at the first read operation.
     kill HUP => $pid;
     foreach my $line (<PS>)  
       KillAll($1) if ($line =~ /^\s*(\d+)\s*(\d+)\s*$/ and ($2 eq $pid));
      
     close PS;
    else                  # if we can't read the process table, just try killing the child process group
    kill HUP => -$$;
   
 
Thanks to Christopher Zimmermann for the patch to kill children recursively.

3 November 2005

Junichi Uekawa: cvs-commitinfo for cvs on alioth.

After searching and googling and testing, I finally figured out how to do CVS log message mails.In commitinfo file, add a line withDEFAULT /usr/bin/cvs-mailcommit --mailto mail-address --from mail-address --diff --full --root %r --dir %p % sVv .There are many different ways to write it, but most examples on the web were wrong, since apparently --cvs option no longer works with newer cvs releases.

2 November 2005

Andrew Pollock: [tech] The quest for IPMI LAN access over down interfaces continues

Today I upgraded daedalus to 2.6.14. I had to backport yaird to stable, which wasn't a big deal. It's available here if you're interested. The kernel package for 2.6.14 from unstable worked fine otherwise. I had two motivations behind upgrading - inotify and another look to see if the situation with IPMI had changed. Well inotify just works, and is the bomb. I'm going to have lots of fun with it. IPMI, on the other hand is still broken, which makes me sad. As I've previously pointed out by way of example, LAN access to the base-board management controller via IPMI is impossible after Linux shuts down the interface. It's supposed to work, but the way Linux does it seems to stop it from working. I'd read that the problem was resolved in 2.6.12, and so dutifully tested it out on daedalus to my detriment. I also tested it on 2.6.14, but again, had the same problem (I remembered to schedule a deferred reboot this time). So IPMI with a box running Linux is all good as long as the box is actually running. I suspect if the box panicked and/or hung itself, it'd also be useful for rebooting it, but if you shut the box down and remove power, IPMI won't allow you to turn it back on again.

1 November 2005

MJ Ray: Audiovisual

itv4 launches tonight on freeview and ntl cable, but it seems that Sky have an administrative problem that will stop it being on Sky until next week. Anyone else suspicious? To compensate, itv4 launch night is being broadcast on Men and Motors too (which is visible across Europe, I think). The talk on the newsgroups suggests that itv4 is on satellite and it's only the non-standard Sky EPG which won't be updated. If you want it sooner, you may be able to use a standard DVB-S receiver or "Add Channels". Eutelsat float price falls. The report suggests it's because of other floats, people not wanting to invest so much in communications and bad bank practices. BBC World closes 10 radio services, opens 1 TV service which might suggest how much more expensive TV is to make. Meanwhile, a report says:
"Public service broadcasters are compromising quality to compete with commercial channels, and many of them depend on Governments or political parties. Meanwhile, ever-larger concentrations are developing in the commercial sector, often with clear political affiliations."
(Television across Europe report from OSI EUMAP) There's a guide to what I'm planning to do Real Soon Now: konekti la komputilon al televido If you want to get involved with radio instead, you could answer this call for help with rampART radio, from ram radio. I think they were interesting listening during G8 and on 7 July, but maybe they need a different approach for the rest of the time. RampART broadcast over the internet, which was how I listened. Many of the documents describing the internet are non-free, which is a silly silly pain. I've supported the petition about Problems with the IETF's copying permissions, by Simon Josefsson (author of libidn and gnutls) but I haven't done more yet. Moving to games, Sam Hocevar's post about Monsterz is unhappy with the difficulty of finding items for it:
"it makes me feel like coders are years ahead in terms of sharing their digital work for everyone to use and improve."
He's not alone. Want a big example? Stuart Yeates noticed that ibiblio's torrents have poor copyright info. I've also spotted Sourceforge and BerliOS hosting non-free data in the past. That's really annoying: you can't adapt everything you download from them and you have to read the terms really closely if you want to develop free software. It surprises me that Sourceforge and BerliOS stick so closely to the FSF's software=programs myth. It might be surprising that ibiblio's torrents seem blind to copyright metadata, but it's probably little surprise that a European Commission group assumes that strong, standardised, zealously-enforced copy controls are The Only Way and has meant the EFF Urges Fresh Inquiry Into Ramifications of DRM. There's news of a peer-to-peer technology that honours copyright law, by Derek Sooman. Will it work? Will it support liberal copyright terms as well as Big Media Grabs? Might Big Media outdo ibiblio? I doubt it.

Joey Hess: isolated hardware downpours

The shuttle xpc that I decided to get as a media server / d-i test machine instead of buying a second used laptop arrived today. Just after I'd gotten that Asus router that seemed to die in Oldenburg back to working. I didn't really spend much time choosing it on ebay from amoung the other used shuttle machines on there. For example, I had thought this was a new enough AMD chipset to be an amd64, but it's not, it's a k7. This probably shows how out of touch I am with current hardware. Since I didn't buy based on wanting an amd64 particularly, I'm pretty happy with it just the same. Especially since it already has a 4 in one memory stick reader that includes a compact flash reader, so I can stop messing around with compact flash on pcmcia for work and just set up boot disks for my arm machines using the shuttle pc on my desk. And it can also serve as the terminal server for my arm boards. I think it'll run vmware fast enough to do some good d-i development, and it can also boot from USB, although not using d-i (yet). And netboot, so if vmware feels pokey and I can do without the music that's the only other thing it is likely to be doing, I can reboot it for d-i tests too. Reasonably quiet too, although it'll probably be turned off at night. Anyway, I christen thee.. dodo.

Gunnar Wolf: Lateness, angst, addiction - Trying to get hold of my life

This is by far the most stressful long period I can remember in my life. I was quite in control of things approximately until around June. Since then, things have been falling over me in a quick and heavy sucession - First of all, being co-organizer at Debconf was quite hard. I had run conferences before, but nothing ever like this - And, I should add, I never had a German boss running the show. [friend="Stockholm"], as a project leader, you really rule... But whoever works with you should be warned: It is not easy.
Gunnar's Rule of Future Life No. 2: It's easier to be the coordinator (remember I was officially the Tyrant for three years at CONSOL? :) ) than to be in the immediately subordinate team.
Back home, I expected the regular post-vacation rush, so having a hard August -trying to make everything on time- was expectable and OK. I don't remember exactly what projects was I in during August/September (I remember some minor stuff, but I think adding it all together was the mistake). There is one thing I did, though: Accepting way too many invitations as a speaker, at least one every two weeks. And, as many of you know, you cannot just travel somewhere and keep working - When I am at a conference, I want to get to talk with the people there, I want to know what are they interested in (why they invited me in the first place), and make friends with them. But this time it was (as it happens every year - Why are most conferences stuck together September-November?) just way too much.
Gunnar's Rule of Future Life No. 2: Be careful on what you accept. It's easy saying "yes" to a conference. It's hard keeping sanity afterwards.
Ok... I have been going places. For example, two weeks ago I was to San Luis Potos . Instead of staying there for two days, I left my office at 7PM, took the metro to the bus station, got the bus at 9PM, arrived at 2AM, went to my hotel, woke up at 7:30AM, had breakfast, coded for ~1hr, went to the conference theater, delivered my talk at 11AM, went for a quick lunch (which became a takeaway order) at 1:15PM, got on my bus at 2PM, arrived back in Mexico City at 7PM, got to a (fucking long) meeting at 8PM, left the meeting at 12AM, and finally got back home at 1AM. Fun, huh?
Gunnar's Rule of Future Life No. 3: Yes, it's fun to travel. It is much more fun to travel when you actually get to know the place!
...And pressure has not given way. As soon as I finish with one project, there is another one demanding my attention right away. October has been more than hectic. I had to cancel two invitations (on which I was to go to two cities each time) I was quite looking forward to, in Peru - I am very sorry, friends at Lima, Moquegua, Tacna and Arequipa... But I won't make it there this year. I am specially frustrated by not being able to make it to Concladeb in Arequipa - I really want to see DebianPeru/DebianArequipa's good work! And I am specially sorry on canceling today my trip to Moquegua, after they had already booked (and paid) for the tickets... It seems the money will not be lost after all, but I was such a pain in the ass for them, it is not fair I am cancelling... But anyway.
Gunnar's Rule of Future Life No. 4: Remember to learn from past experiences - It feels incredibly as a deja-vu from last year.
I hope I am not spoiling any surprises: Today, instead of blogging, I am supposed to be setting up the Comas server for Debconf6. Even with all of my worries, yes, I am still determined to be the man behind the show for Debconf. It will be in Oaxtepec, don't worry, and it will be a huge success. So let me finish this post quick, and it will be sooner you can register for it ;-) There are still too many points to work on Comas, though. I am setting up a tweaked version, against my will, but with the commitment to fix it transparently and soon. Oh... Yes, and I still have to coordinate with the locals here, as it's taking forever for us to open the fscking bank account so we can start receiving funds and paying money. Did I mention Debconf would be in Mexico? Ok, I will do my best not to make lateness the norm.
Gunnar's Rule of Future Life No. 5: Try not to bore your audience with too many details. Remember you have to work, and somebody might complain you lose too much time blogging!
But before I leave you alone: You might ask why do I mention the addiction in my post title... Well, because I have started treating my main addiction. It is really not easy, and I don't ever want to know what is it like to have a chemical addiction, like people who abuse drugs. If you have seen me face to face, it should be obvious: I have a very strong addiction to food. For one month already, I have been as conscious as I can every time I open my mouth - And, yes, it was not just three times a day. I have made some advances (sorry, I cannot really measure it, as home scales make it only to 120kg). Today is a big day for me: I was admitted in a pilot obesity control follow-up treatment at my University's sports health direction. I am very happy about this, as I do need mentoring and hand-holding. This is a seriously difficult process to follow, and I really hope to carry it thoroughly. Fortunately, my health has been perfect until now - But I cannot abuse myself forever.

31 October 2005

Eric Warmenhoven: Selling options

There are lots of cases where you can have a positive view of a stock, but still want a bit of investment protection. A fairly typical way of getting some protection against a drop in price is to place a stop-loss order with your broker, so that if a stock hits a certain price that you set, the broker will automatically sell the stock. This limits your loss (known as downside protection), and if the price doesn’t go down, then you keep all the stock, and you get to take full advantage if the price goes up (known as upside participation). Also, it should be free to place a stop-loss order with your broker, unless the price is hit and the stock is sold. So, stop-loss orders have three benefits: downside protection, upside participation, and no up-front cost. Unfortunately, there are a couple downsides (no pun intended) to stop-loss orders. The first is that if a stock is really plummeting (there aren’t any buyers at all), then it may be difficult or impossible for your broker to get the price that you’ve specified. That’s sort of an extreme situation though and only happens about once every thirty years (think October 19, 1987). The other, much more likely, scenario is that the stock goes through a temporary decline (causing your stock to be sold), but then recovers. In that case, you’ve sold for a loss and you miss out on the recovery. So instead of placing a stop-loss order with your broker, you can purchase what’s called a protective put. A “put” is a contract that says the buyer of the put has the right (not an obligation; it’s the buyer’s choice) to sell stock on (or before, in most cases) a predetermined day at a predetermined price to the person who sold (”wrote”) the put. For example, today RHAT closed at $23.22; you can buy an option to sell 100 RHAT shares at $22.50 (the strike price) anytime between today and November 18, 2005 (the option expiration date) for $55 (as reported by Yahoo!). So you get downside protection and full upside participation, for a price. (There’s also a married put, which is the same thing as a protective put, except you buy the stock at the same time as the put; a protective put implies that you already own the stock.) But there is still the annoying up-front cost. If you’re willing to risk missing out on some of the potential upside though, you can offset the costs. A collar is when you buy a protective put and at the same time selling a call option. By selling (writing) a call, you give someone else the right (again, not the obligation) to buy shares on a predetermined date for a predetermined price. For example, say you do buy the protective put above, and at the same time, write a call option for 100 RHAT shares that expires on November 18, 2005 for a strike price of $25. The proceeds from this sale will be $30 (again, minus fees). So for a cost of $25 ($55 to buy the put minus $30 to write the call), you’ve got downside protection, and upside participation up to about 7.7%. All of this assumes that your preference is to keep the stock. But say that your stock has done very well and it’s gotten to be a sizeable part of your portfolio, and you’d like to diversify a bit. That means that you’re serious about selling it, regardless of what you think the price is going to do. (There are lots of good reasons to sell a stock that’s enjoyed nice gains, not the least of which is that nice gains are generally caused by nice growth, and a company can only grow so big.) Selling the stock outright is one technique; another is a variant of dollar-cost averaging, but instead of buying a fixed dollar amount, sell a fixed number of shares. But you can combine either of these with writing call options to potentially achieve even better results. A covered call is when you own a stock and write a call option on it (like a married put, a buy-write is when you buy the stock and write the call at the same time). Instead of selling the stock immediately, you give someone else the option to buy it from you at a predetermined future date. Because the date is in the future, there’s a bit of a premium that buyers will pay (which means more money for you). For example, November 18, 2005 calls for RHAT with a strike price of $22.50 are selling for $120 for 100 shares; that means that if the option is exercised, you make $22.50 from the sale, plus $1.20 per share from the option, for a total of $23.70 as your effective sale price. If the option is not exercised though, then your shares are not sold, but you get to keep the $120, and do the whole thing over again. (Unfortunately for me, Brocade has a company policy prohibiting collars and covered calls. But fortunately for me, I don’t own very much BRCDE stock.)

Steve Kemp: Lua annoyance

Lua Directory Handling
Arrrgggghhhhh!!!! OK maybe lua is not love. I just realised that Lua has no concept of directory handling (opendir, readdir, etc). Indeed it isn’t possible to tell whether something is a directory or a file. So I added some more primitives to the Lua socket extension library. Most usefully a readdir call. This means the sample webserver can now serve directory contents if index.html isn’t found. It can also now fall back to serving a “default virtual host” if the requested one doesn’t exist. The webserver code is now very stable and complete. The only omission is CGI handling, but I’m not going to bother unless prompted strongly. I’ve added some simple examples to the documentation and I think things are looking good. The Debian package has been downloaded a few times, but no real feedback - feel free to share, don’t be shy!

Next.

Previous.