Search Results: "ean"

8 June 2006

Matthew Palmer: [Ruby] Blocks as Resource Management

One of the really neat things about Ruby is the extensive use of blocks (closures, I think the rest of the world calls them) in the standard library to control the allocation and deallocation of resources. Take the following snippet:
 File.open('something.txt') do  fd 
   # Manipulate the file through 'fd'
 end
 # File handle is now closed
There's no way that you can escape from that block without the file being closed (well, in theory, you could lose the file handle if there was an exception thrown in the block, but the File::open method can take care of that internally by catching, closing, then rethrowing). I've loved this feature since I first saw it -- "holy crap!" I thought to myself, "I never have to call close again!". And I was pretty well right -- I think I can count (in unary, not binary!) on one hand (well, I'd use grep wc) the number of times I've used IO#close in my Ruby code. The funny thing is, though, that I don't think I've used this pattern in my own code enough. But I just had an epiphany whilst waiting for a train home -- and I think I'm cured. Take this hideous piece of test code I had laying around in an app I'm working on at the moment:
 def test_something_funny
   faux_path_on
   d = Domain.new('127.0.0.1', 'somethingfunny.com')
   faux_path_off
   
   # assert writ large
 end
Domain::new calls out to a shell command (dig(1) to be precise -- take a guess at what I'm writing <grin>, and yes, it will be released shortly) but for test purposes I can't run dig (because I'm not guaranteed to have all the infrastructure available for a real dig to succeed). So I have a flimsy mock of dig in a directory in my test suite, which is where faux_path_on sets ENV['PATH'] to look at. This is, of course, pretty untidy, because when (not if!) I forget to call faux_path_off, everything goes to complete poop, and my children will have two heads or something. The much cleaner version is like this:
 def test_something_funny
   d = faux_path   Domain.new  
 
   # Assert ahoy!
 end
And my faux_path method (I've even saved a method!) is as simple as simple can be:
 def faux_path
   realpath = ENV['PATH']
   ENV['PATH'] = my_fake_path
   rv = yield
   ENV['PATH'] = realpath
   return rv
 end
I also have a trickier faux_* method, which sets a couple of environment variables which tell my mock nsupdate(8) where to write the data it gets sent from my application -- again, it's a block-taking method that sets the environment, yields, reads in the data from the temporary file, cleans it up, and returns the contents of the aforementioned file. The power of the Ruby is growing within me, I can feel it. And I like it.

Matthew Palmer: Inadvertantly Appropriate

Seen on the way to work this morning (for some sort of art show):
From the affordable... to the collectable!
I'm not sure that what they meant was "the stuff you can afford isn't worth keeping", but I'm pretty sure that it's the truth.

Junichi Uekawa: To those who care about build-dependency being satisfied in clean target.

pbuilder already does some reasonable work withpdebuild --use-pdebuild-internal, which is not default (it's still lacking some features).If pbuilder starts unconditionallychecking for build-dependencies outside of chrootfor building source packages, that's bad news, because you need to have all the dependencies installed outside of chroot.You either have them installed because you have done debuildbefore, or haven't since you can't build it outside ofchroot (running stable Debian release, maybe).So it's a bad idea either way to let pdebuild satisfy builddependencies outside of chroot.pdebuild --use-pdebuild-internal solves that problem by building the source package inside the chroot.

7 June 2006

Joey Hess: please don&#39;t

Please don't use Planet Debian to discuss techinical topics like adding a "-" in front of dh_clean calls. There are numerous reasons not to do that, but Planet Debian is not the place to disucss them. I'd be glad to elaborate in a proper forum.

Martin F. Krafft: Build dependencies and the clean target

I find it rather annoying that some packages require their build-dependencies to be satisfied to run fakeroot debian/rules clean. Those packages include:
  • all packages using debhelper (hm...)
  • all packages using cdbs
  • packages cooking with Python distutils
  • ...
I think they all should fail gracefully when asked to clean themselves, even if the build dependencies aren't satisfied. Rationale: if the build dependencies aren't there, there's probably nothing to clean. Otherwise it's a royal pain to quickly build packages on production systems with pbuilder or the like -- those clean first (rightly so), then try to package. Of course, an alternative would be to tell pbuilder to ignore failures from the clean process. But I'd much rather fix causes than symptoms. Also, this would mean that the clean target may actually not finish, because commands after the failed one get ignored. So please, prefix your dh_* or similar lines with a - (minus sign) in the clean target of debian/rules today. That minus will make ignore the errors. Thanks. /me now awaits the flame flood. Update: the discussion is going on (#debian-devel/irc.debian.org). It has been claimed that pbuilder must be fixed. I'd like to point out that dpkg-buildpackage does not check for build dependencies when asked to build a source package (which is when you need the clean target) with the -S switch. Update ^2: I could be coerced into accepting dpkg-buildpackage fixed to check for build dependencies before it cleans the source tree in the process of creating a source package. Note that it does this unless you pass -S, because then you're actually asking it to build the binary package, not just the source. The real question I guess is whether build dependencies need to be satisfied to "build" a source package. Update ^3: Junichi, the pbuilder author, has since followed up.

Peter Van Eynde: stupid CL errors

  • Do not assume :always does a check on an empty list:
    [1]> (loop :for x :in '() :always (oddp x))
    T
    is the correct result. But deep inside logic involving "have all entries that property?" it can be surprising.
  • 0 is not NIL. Stop laughing, it took me 2 days to find that one part of the program thought it was talking T/NIL while the other talked 0/1 or 2. One (declare (type boolean result)) and a few runtime errors later the program gives sane results again.

John Goerzen: Usenix

Well, we're back from the Usenix '06 Annual Technical Conference. Overall, a very nice conference. This is the first Linux/Unix conference I've been to since the old LinuxExpo (NOT LinuxWorld) events in the late 90s.

I must say it was quite fun to be around so many intelligent *nix folks. I learned quite a bit, and learned how much I had in common with some (and how little with others). A very nice social at the New England Aquarium Friday night.

Some very interesting speakers, too, with lots of experience to share. I'm glad I was there.

I have only one main complaint about Usenix -- they tried to cram too much into too few days. The conference sessions ran till as late at 6:45PM, with BoFs after that. That left almost no time to see anything of Boston and meant that very few people could actually stick around for all the BoFs. Next year, they should use more days and schedule fewer things in the evenings.

The highlight of the trip, though, wasn't Usenix at all, but instead getting to meet some Boston-area Debian folks Saturday night. Lots of fun, and Mako is as crazy in person as he looks online :-)

Our train trip in each direction was nice, too.

More to come...

Mike Beattie: I speak proper england!

(... well, I like to think I can!) So, on a completely unimportant website that I frequent, I've ended up being a moderator on the site forums. Something about knowing *nix and PHP apparently.. Anyway, I've always had a beef with the way english is used and abused on the Internet. You know, all those abbreviations, and incorrect word usage that just seethes "I'm an illiterate prick." U, 2, ur, da, r, etc etc.. and also the so incredibly common misuse of your/you're and they're/there/their. GAH. Yech. Anyway, this particular site is no exception. Some of the users have appalling habits. (Ab)using my powers as a moderator, I've started to demand some care and attention to the most glaring errors - mainly towards my most intense pet peeve, misuse of "your" and "you're". Looking for a place that describes all this stuff well, I stumbled across this site. I couldn't have said it better. Thank you Sarah D. Bunting! (I especially liked, and agree with this:
And no, in fact, I don't know what you mean when you write me a hate mail that reads, "You're site sucks," because that doesn't mean anything. Because it's grammatically incorrect. Because you've substituted a contraction of a verb phrase for an adjective, thus rendering the sentence nonsensical. And it makes you look stupid, and therefore I cannot take you seriously.
)

6 June 2006

Steve Kemp: Learning to cry for fun and profit

I saw on Planet Debian that Enrico Zini had some trouble using xen-tools:
Installing the base system.   This will take a while!
	
Copying files from host to image.
Finished
Something went wrong with the debootstrap installation
Aborting
This basically means that the invocation of debootstrap failed to leave the system with a /bin/ls present - meaning it failed for some reason. My immediate mad debugging skillz suggest retrying with either –verbose, or –cache=no. The first will hopefully show the problem, the second will most likely fix the problem. I’ve seen this a few times, but haven’t updated the code to check for it. When creating a new Xen instance of, say 4gb, we copy all the packages from the host systems /var/cache/apt/archives so that debootstrap doesn’t redownload things and use up bandidth. If these cached files are >4gb then the new image is 100% full and debootstrap won’t run successfully! In related news I’m currently working on a system called image-server - this is a distributed xen-create-image script. The idea is that you have a central host which is responsible for creating Xen images of Debian, RedHat, Gentoo, and serving them to clients. This isn’t much use for a home user, but as a hosting company wanting to provide Xen instances of semi-arbitary Linux distributions it should come in handy. In other news I want to work on modularising the Xen tools scripts and moving them onto xen-tools.org.

Simon Richter: Leipzig, the aftermath

Bah, while I was hanging out with some guys from London, somebody stole my tent, and the stuff in it. Obviously, I shall be watching eBay, although I have only little hope (and I don't care for the most stuff anyway, I'm mostly annoyed about the CDs and the sleeping bag, and I feel slightly inconvenienced by the headset and the charger for my phone being gone. I'm still hopping mad about it (even if just to use the term "hopping mad"). No the upside, I don't have to clean the tent now.

Lars Wirzenius: Rant: SMS and e-mail tax in the EU

The European Union wants to tax SMS and e-mail messages (see digitoday news in Finnish). Or at least the French MEP Alain Lamassoure has suggested that, it seems. The tax would be 1.5 cents per SMS, and 0.00001 (one hundred thousandth) cent per e-mail. Current prices in Finnish operators seem to be around 7-10 cents per SMS message. A 1.5 cent tax on top of that seems pretty high. Collecting it would be simple: all SMS messages go through operators. For e-mail, however, the thing is going to be a nightmare. Much e-mail goes not via operators, and there is no good way of tracking it. This could be fixed (from the tax collecting viewpoint) by requiring all e-mail servers to be registered for proper accounting (nevermind freedom and privacy). Update: This paragraph is rubbish, due to my inability to calculate simple things; I'll keep it here in the interest of historical accuracy (randomly changing already published log entries is impolite, to say the least). Anyone operating a busy mailing list will want to move it outside the EU. Even at such a low price, a list with a thousand subscribers and a hundred messages a day is going cause a tax burden of around four hundred euros a year. A company might be willing to pay that; a free software project would probably not.

5 June 2006

Alex de Landgraaf: Debtags AI web interface

Hacked up a quick REST-style webinterface for the debtags AI classifier, try for example: http://alextreme.org/ai/emacs/use::editing to get the chance emacs is used for editing. My server had to train all night to process all tags, so a central debtags-ai-webservice makes sense. An issue is that it's not very clear which tags are available (an ajax-like interface would be much more human-friendly), but then again this interface is meant to be easily parseable. Next step is to actually use the classifier for approving suggested tags...

Jacobo Tarr&#237;o Barreiro: Decorative clauses

In a recent message to debian-legal (may have not appeared yet when you read this) I said that I didn’t believe in oh, this clause in this license is not relevant, since it’s already implied by law . I believe that if it’s there, it’s for a reason, and I don’t want to be surprised when I find out what it is for. Furthermore, implied by law means nothing, since laws change, and different countries have different laws (really!). In other words, I don’t think lawyers go around putting decorative clauses in license statements. If they had such an artistic inclination, the results would rather look like this:
[…] construed as a distribution of this Package. 9.
      If you intend to advertise,
      our name you may not utilise.
      Get our written permission first,
      or in jail you’ll die of thirst. 10. THIS PACKAGE IS PROVIDED “AS IS” AND WITHOUT ANY EXPRESS OR […]
I found it fitting to do this to the Artistic License :-) (Yes, I know it’s hideous. Think of it as lawyer-poetry.)

Erich Schubert: Upgrading unstable notes

From the "using unstable on my desktop" department: Just two things to point out: liferea-mozilla has been superseded by liferea-xulrunner; so if liferea is held back at your upgrade, do an apt-get install liferea-xulrunner. The old file manager of XFCE has been replaced with "thunar". Just do an apt-get install xfce4 to get the latest xfce4 suite. You might want to install the recommends, too. And remember, don't just blindly run dist-upgrade. This is meant for upgrading e.g. from woody to sarge. For daily use, upgrade is much better, since it's less aggressive at uninstalling applications you might miss afterwards. Aptitude may also offer you alternatives in conflict situations.

4 June 2006

Erich Schubert: Optimize your ext2/ext3 filesystem

You might have read that ext2/ext3 has support for so called "directory indexes", which supposedly speed up operations on directories with many files. For example your /usr/share/doc directory, your packages database, or your home directory (use ls -la wc -l to count the number of files). However, this feature is not enabled on most machines, since up to now you needed to pass a flag when creating the filesystem. The 1.39 upload of e2fsprogs (in Debian unstable as of May 29) made this default. So you probably didn't enable this when creating your filesystem. To check, first find out what your filesystem device is (use mount). Mine is /dev/hda5, so my example will use this device. In traditional terms, this is the first extended partition on the IDE primary master drive. Now use tune2fs -l /dev/hda5 grep features to get a list of your filesystem features. If you have "dir_index" in there then you're all set. Ignore any "needs_recovery" - that is good for mounted filesystems (it just means "not cleanly unmounted") To add dir_index, do the following.

3 June 2006

David Welton: Details, details

While working on Hecl, it has sometimes really surprised me how much it's possible to delve into seemingly trivial details. Just for starters, we've been talking about what to call string commands. Originally, I'd used names like slen and sindex to have something quick and easy to write, but no one seemed to like them that much. Wolfgang implemented a bunch of new string commands (very much appreciated!), and took the Tcl approach of command subcommand, like string index, and also suggested some other things like str.index. I am strongly opposed to the string length style commands though, because I think that's just too much typing for a language that's supposed to get you up and running quickly. The compromise I proposed and implemented was to use more 'C style' commands like strlen, strindex, strfind, and so on. I'm not a big PHP fan, but they seem to have taken a similar approach. It's not too verbose, but you can tell more or less what the command is for. Even more seemingly trivial - indexes for strings and arrays. Hecl takes the Lisp approach rather than the C approach, and utilizes commands instead of syntax, even for list and string access, so to get the second character of the string "foo", you would do: strindex "foo" 1 . Like C, Hecl indexes start at 0. Where things get tricky is in calculating indexes "from the end" - how do you tell the language to "fetch the last character from the string 'foo'"? Tcl lets you write a string like "end" or "end-1", which is handy compared to the process you would go through in a language that doesn't help you out: take the length of the string, and subtract from that as needs be. I prefer the approach that I first saw in Python, though, use -1 for the last character:
>>> "abcde"[-1]
'e'
Ruby takes the same approach. It's nice to be able to just insert a -1 rather than have "end-1", which sort of looks like an expression, but isn't really (Hecl doesn't even have normal infix expressions), especially because you can easily calculate the -1 and insert it as is, instead of having to do some string interpolation like "end-$foo". Where things get tricky is when you want to do something like specify a range, say from the 3rd letter to the end of the string. In Python, they use syntax, specifically by simply not including the end of the range:
>>> "abcde"[3:]
'de'
That doesn't work really well with Hecl - I suppose we could pass in a blank string instead of a number, like so:
strrange "abcde" 3 ""
But that's not very clear, and IMO it's slighly ugly to pass in a string where you want to use a number. I had a look at Ruby's behavior, and found it more to my liking:
irb(main):001:0> "abcde"[3..-1]
=> "de"
The difference with Python is that the second index is inclusive, whereas Python includes the character at the first index, and excludes the second:
>>> "abcde"[3:-1]
'd'
I decided the Ruby approach worked best for Hecl, so now we have:
hecl> strrange abcde 3 -1
de
If you're still reading this, I guess you see what I mean by how much one must delve into what must seem like very unimportant minutiae to... well... normal people!

2 June 2006

Evan Prodromou: 13 Prairial CCXIV

The Globe and Mail had an article today about a new Ubuntu version in the works. (I think the headline writer screwed up.) It's good to see a Linux distribution's release covered in the mainstream press.

Wouter Verhelst: ...

Finally, EMILE, the Early Mac Image LoadEr, is part of Debian. It had been in the works for quite a while; First Stephen Marenka filed an ITP for the thing a bit over a year ago; and then I did the same, not noticing Stephen had the ITP out for a few weeks already when I did so. ITP bugs were merged, we set up an SVN repository, and then nothing happened for a long time, mainly because while I could get it to build, I did not succeed in actually booting a kernel off my own-built emile. In the mean time, another version was released—one with wonderful features, such as an ELF loader and gunzip implementation (so that I could ditch the script that I'd written to throw kernels through objdump), the ability to boot off of CD-ROM drives (would be great for d-i), and more. Finally, about a month and a half ago, I got the thing to actually boot on barok, my IIci, when I compiled it myself. And there was much rejoicing. It's spent the last month in NEW, but now Joerg and/or Jeroen are back, so it's been ACCEPTed. Whee! If you're interested in giving emile a try on your m68k machine, then feel free (once you can, after the next mirror pulse), but beware: EMILE does not have the ability to install more than one kernel yet, and you can't boot from EMILE to MacOS yet, either, should you make a mistake. I recommend trying it out on a floppy disk first, or to use a second hard disk which you can place as the second disk in your system, should it be required. In other, only slightly related, news, there's a new release for belpic about to come out, too. But more on that later.

Gerfried Fuchs: Back in the worng timezone

After two weeks and a bit it finally happened: I hit austria again. But, first things first. I guess everyone noticed by now that at the start the network wasn't our best strengths. I helped as much as possible, collected network cable back from one path to lay it out at a different one just to find that the about 200 m were a bit too short (or rather, me was lying the cable with too much safety). Though, it was too long anyway to be relyable, to it was cut in the middle and a small access point was put in. Later it had to be replaced because we were running a bit short of specific power supplies. But it wasn't too bad, waiting for some more rj45 plugs and other things even allowed Ganneff to spend some time in the pool and relax a bit. And given that there seem to have been a few (vegetarian) people less than registered for sponsored meals allowed stockholm and Vagrant to get extra dishes to get fed. People during the debcamp mostly enjoyed themself, mao was played, fights for the gay vegetarian sign, tetrinetx on homer when only local network was available, and I managed to translate the new wesnoth tutorial into german. It wasn't clear by then that the new release will be delayed due to other problems until after the debconf, but in my opinion the tutorial is one of the most important parts of any games because it explains the basics, so I wanted to be sure that there won't be another release without a fully translated one. About enjoying oneself: I tried out the skirts I brought with me and considered them absolutely comfortable. You'll find me more with one, especially when it gets warmer. It helped me to be more "myself". Also I enjoyed the weird looks and repeated questions about my shoes — although it was often that I was walking barefooted; but that got a bit of a pain, especially after noon when you were able to boil eggs on the stones. And given that I forgot myself when I switched from blue/red shoes to red/blue ones you don't have to send in your guesses when it was done because I can't tell who would be the winner anyway. ;) The end of the week came, the Debian Day was here. Closer to its happening more and more people arrived and it was becoming more crowded in the hacklab. The network became more and more stable, the video streaming setup got finalized, and everything looked alright. Some of the mexico city people stayed for the night and enjoyed the friendly atmosphere (and a beer or two ;)). The debconf started for real, the talks started, people were busy all around, zack added me to the alioth pkg-vim project to continue helping with the hijacked debian specific syntax files. Haven't done much yet beside a checkout, still pondering where I can bug around most ;) I was looking forward to bubulle's BoF about the i18n infrastructure. It was really inspiring, and I collected some ideas for what the tool-to-be-created should support. The second BoF later the week just showed that others were mostly thinking along the same lines, so I hadn't much to add. Still I am looking forward to join the effort to make it happen — I was playing with the idea about such a tool for ages now, and I guess this is what it will make it happen, finally. Christian is so much more able to get people interested and together for making it happen than me... :/ There were some more talks I could mention, like Enrico's talk about Advanced tools for wasting time (yes, I have submitted my gnu.cow file in the meantime), or Erin's and aj's Debian's Debugging Debacle: the Debrief (in which I finally got around to fix a RC bug incidentally), and the talk by bubulle and jfs about State of the art for Debian i18n/l10n of course, which features some of the conclusions of the two part BoF. Some of the evening featured interesting things too, like a cheese BoF, the everywhere featured formal dinner with its mariachis, the waterfall and the blackout; special effects you wouldn't be able to plan as well as they happened — though Martin Ferrarri had a small accident with it when water rushed down onto his plate and spilled the sauce over his white shirt and the table. And then there was the hard liquour BoF where I quit after the eggnogg. The week passed, I got my hair dyed and rid of my beard right in time for the group photo. Thank you nattie, a thousands time, it went better than I expected! Really like it. I didn't attend the fun photo in the pool the next day, was a bit late after the talk, didn't had my bathing slip with me, was worried about my newly dyed hairs and was nervous... because a person I was looking forward to meet again was late. But gladly only late, so I got rid of my nervousness and enjoyed the last official talk (formerly mentioned i18n talk) of the week, and explained to some attendee that even in languages like French, German and English (yes, no mistake) there are still areas we have to struggle with all of this, like when keeping things up to date and the likes. It was the last evening in Oaxtepec for me because I refused to leave by bus at 4 in the morning, rather wanted to spend the night in Mexico City to at least be able to have seen a tiny bit of it and eat something my tummy enjoys completely. :) I guess I don't need to point at sandino's gallery about that evening anymore, thanks to Gunnar. And yes, I'm mentally disturbed, but that shouldn't be anything new to people who know me for a while, or is it? ;) This night was too long (less than 4 hours of sleep is even for debconf not much), so I rather went to bed early after a small walk (just 2 blocks or such) in the city and a nice dinner with friends who are missing the nice time too and was wearing too big sort-of shoes. Went to the airport in the morning by taxi whose driver gladly was able to speak english. Met zack and Martin Ferrari again there, and some other people with whom I was taking the same plane with. They were hacking along on the airport, found the open wifi, using power supplies from different spots. Bubulle already wrote about the two loud guys, gladly I wasn't too close to them, and plugged myself into the music and movie channels from the plane. The showed Last Holiday (which I really liked, although in the ending I started to cry — mostly because I started to realize what I was leaving...) and two spanish movies of which I don't remember the titles. People started to hack away in the temporarily set up hacklab and we started to wonder how much power they might have, though they cheated: They used two battery packs... In Madrid some more people parted and we were down to 5 people. I bought totally overpriced playingcards so we could play Mao, had a short nice session and spread the word. We did hack the baby room power supply and hacked along a bit more, and then Peter and me were off heading to vienna, finally. All in all I really enjoyed it. Although there were its down times, sunburned, my butt hurting a bit because in the end I did jump from the 10m platform into the pool, it still was a really nice event and even though I guess many people tried to enjoy themselfes quite some things were acomplished. If not really codewise, then at least social-wise, which will benefit quite well in the future, I'm sure. Hope to see you all next year, wherever that might be.

Michael Janssen: Been a long time coming.

Life has taken a turn for the busy lately, which means of course that this space loses a lot of content. Things have slowed down a bit now. Things which were taking up my time before were being basically one of the only technical staff for ICRA2006 (with one other who helped enormously), a new job at Honeywell Labs, and actually getting some research done on my thesis.

ICRA2006 was basically amazing and horrible at the same time. The amazing parts: meeitng people who are famous (a.k.a. "respected in their field"), eating a ton of fancy food on the dime of the conference, being at the first conference of my academic career. The horrible: working 18 hour days, being the go-to guy for practically everything, painful feet from walking most of those 18 hours. All in all, the amazing outways the horrible by a long shot. I also couldn't make it to DebConf6 because of it, and it was in a country that I might have actually made it to this time. Next year I guess.

The new job at Honeywell is going decently. We have a target in July which is probably going to have me pulling long hours. The best thing about the new job is of course pay-related though - I am going to be consumer-debt free by the end of this year. I hope that I can finish the nameless financial web application before my finances improve enough that I don't need it anymore.

I have narrowed in on my thesis more, which is an improvement at least. Now I need to actually write papers and do research while avoiding too many duties in other areas. I've got a couple of blog postings in the queue which should show up soon, and hopefully I will re-enable myself on Planet Debian.

I also bought a present for our apartment, and she hasn't guessed exactly what it is yet. This is me taunting Di a little. :-)

Next.

Previous.