Search Results: "ema"

24 November 2005

Martin F. Krafft: Bug squashing bounties

I just sent this to debian-devel-announce. Hopefully it will be a success!
Dear fellow developers and contributors, My publisher, Open Source Press, and I were pondering ways to help the F/OSS community (and Debian in particular) over a beer the other day, and the following idea is the result:
We are announcing a bug squashing period, starting now, and ending 14 Dec 2005, 11:59 CET. Squashing a bug gets you a certain number of points (depending mostly on triviality and severity). At the end of the three weeks, the 25 bug squashers with the highest score shall receive a copy of my book, The Debian System, donated by the publisher. If this turns out to be a success, we'll lather-rinse-repeat sometime soon.
Bug squashing is to be done according to the rules listed on the wiki. In particular, everyone is expected to make proper use of usertags to communicate to others that s/he is working on a particular bug. If you are working on a bug, you are expected to send status updates to the bug report at least once in four days, or someone else may announce the intent to lock the bug and take it over after 24 hours. Fixing a bug also involves augmenting the bug report with any relevant information as you go along, and testing the fix with which you came up.
Points will be given to those whose contributions fix a bug. A bug will be considered fixed if a patch addressing the problem has been sent to the BTS and the package's maintainer has not vetoed the patch within five days. Please do not actually close bugs in the BTS (unless you really know what you are doing). Points will only be awarded to patches for bugs which have been reported before this announcement (but you are, of course, welcome to fix any bug -- if it's obvious you aren't trying to cheat and you are otherwise very actively fixing bugs, you may even get points for those too). After submitting a patch to the BTS, please send a short note to book-bsp t pobox.madduck.net with the bug number in the subject, and from the email address you used to interact with the BTS. In the message, list any contributors who have helped with the bug, as well as an approximation of the time each of you spent on fixing this bug. Also, document how you have tested your patch. The amount of points to be awarded depends on the severity of the bug report, as well as the triviality of the patch you came up with. Put differently: while a one-line patch for a wishlist bug might get you 1 point, I could award 100 points for a clean yet elaborate patch to an important bug. Bonus points can be given if you provide reasonable proof of thorough testing of your fix (you could use test-driven development techniques..., also see here), ideally by a third party. Please be aware that bugs fixed by the reporter him/herself will be especially scrutinised.
Anyway, there are no strict rules for the amount of points a patch will get you. In fact, I reserve the right to announce the scores only after the end of the bug squashing period, and I will not answer questions about scores, or address complaints from people who think they have not received enough. However, I shall act as objectively as possible, fair, and honest; for that, I give you my word. I realise this is sketchy and if you don't trust me on this, it's your choice not to participate -- there is no point to argue at this stage. If you have a better suggestion, I would be interested in trying it the next time 'round. Maybe we can establish a good scoring system for the future, but at the moment, no such system exists. If you have any questions or suggestions, please do not hesitate to speak up (Reply-To set). Do note, however, that my tendonitis forces me to take things slow. For this reason, I would like to apologise in advance should the evaluation of all your contributions extend into the new year. Thanks to Markus Wirtz of Open Source Press for supporting this idea, and to Steve Langasek and Frank Lichtenheld for their advice.

Grzegorz B. Prokopski: 23 Nov 2005

SableVM SDK for Java is back with 1.13-pre1 ! Guess what---a new shiny prerelease of SableVM SDK suite for Java is out for you to have some serious fun with it! The main point of this release is getting new GNU Classpath 0.19 integrated. Tests show that with the updated class library Swing apps look waaaay better. Kudos to the GNU Classpath hackers and contributors! Installation of SableVM SDK is as simple as it can be. As usual you need recent GTK and a few other libraries and tools available as packages for most distributions. The non-commonly used elements (like libffi, libpopt) are included in SableVM SDK to cut the hassle of installing it to minimum. Basically all you need to do is to fetch the SableVM SDK 1.13-pre1 tar archive, unpack it, run ./configure && make and su; make install. With the default settings in /usr/local/lib/sablevm you'll find a fairly complete JAVA_HOME like environment. Enjoy! And please let us know of your successes and problems by sending as an email to sablevm-user@sablevm.org. This will ensure future SableVM SDK releases work better for you! In other news SableVM Project team has been silently working since many months on new JVM features that will start showing up in upcoming releases after 1.13. Stay tuned!

23 November 2005

Antti-Juhani Kaijanaho: Blosxom and dates

This entry is mostly for the benefit of Martin-Éric Racine, who is having trouble with Blosxom and dates. I'm forced to use this arcane method of communication, since Martin-Éric threatens to charge for any incoming email. I would like to direct your attention to Blosxom plugins for indexing. They allow, for example, to preserve entry dates even when the entries are modified later.

Antti-Juhani Kaijanaho: Safety is the beginning of wisdom, not its end

I wrote a couple of days ago about safety in programming languages. A certain comment reminded me that people (even programmers) misinterpret technical terms from the area of programming languages. It reminds me of that old joke about the C programmer who is very hurt when somebody claims that C is not a functional programming language - of course it is functional, our hero says, as it functions perfectly. It also reminds me of a quote Christopher Strachey has been said to have written in the 1960's:
It has long been my personal view that the separation of practical and theoretical work is artificial and injurious. Much of the practical work done in computing, both in software and in hardware design, is unsound and clumsy because the people who do it have not any clear understanding of the fundamental design principles of their work. Most of the abstract mathematical and theoretical work is sterile because it has no point of contact with real computing.
In programming languages jargon, safety is the property of a language that all well-formed programs have a well-defined semantics. That is, in a safe language, programs that the compiler does not reject, do not go beserk (corrupt the stack or heap or otherwise invoke nasal demons). A well-defined semantics might be a forcible halt of the program, which is often not the ideal way of dealing with problems (sometimes it is even harmful), but it is beyond the scope of safety to specify a programmer-friendly semantics for such occurrences. Safety is the minimum requirement, not by any means sufficient for all contingencies. There is a related slogan attributed to Robin Milner:
Well-typed programs do not go wrong.
(Wrong, in this case, is an abstraction denoting nasal demons, heap corruption and other such nasty things.)

Antti-Juhani Kaijanaho: C++ exceptions revisited

I wrote two days ago:
Is there a mechanism to figure out what exception it is that fails to be caught by any exception handler on the stack? Of course, it can be caught by using catch (...), but that just tells me as much as G++'s default handler: that some exception was thrown.
Matus Telgarsky later pointed out to me in private mail that G++ does have a better terminate() handler, used by default in G++ 3.4. I could also invoke it in older G++ by adding
std::set_terminate( __gnu_cxx::__verbose_terminate_handler );
which I did. Based on the information it gives I eventually tracked the problem to my use of safe_ptr<AbSyn::AST>::release in my safe_ptr-downcasting functions in ast.hh. I had written that code originally using std::auto_ptr but due to problems I then implemented a reference-counted replacement for it. I had tried to make safe_ptr's interface to look as similar to std::auto_ptr's interface as possible, which now turned out to be a mistake. It turned out that there were four active aliases for things I passed to release at the time, which quite appropriately triggered an exception. However, unfortunately, I had given the downcasting functions exception specifications not listing that particular exception. Now, the semantics of an exception not listed being thrown in such a situation is that the program is immediately terminated. This problem highlights a C++ exception misfeature: it allows calling a function without an exception specification (which essentially means that it might throw anything) from a function with an exception specification (where throwing an exception not listed invokes immediate termination) without so much as a warning to guide the programmer!

Antti-Juhani Kaijanaho: How I will be spending March

I just sent the following email to certain mailing lists and individuals on campus:
Did you ever wonder how computers could be made prove theorems? Did you ever look at logic and tell yourself, wow, this should be automated? Are you... ... an IT student interested in logic or software/hardware verification? ... a math student with a taste for logic and the foundations of mathematics, and with an interest in computer science? Starting on Tuesday, 2 March 2004, I will give a series of lectures on *** Automated Reasoning (TIE 329, 2 cr) *** We will look at how logical information can be processed on a computer. We will discuss (both in theory and in practice) fundamental automated reasoning methods such as unification, resolution and semantic tableaux. In the end, we will have constructed a simple automated reasoning system. A familiarity with first-order (predicate) logic is necessary. Other prerequisities are the Automata and formal language course (or equivalent) and programming experience. Enroll via Korppi. The course has a home page at http://www.mit.jyu.fi/antkaij/opetus/ap/2004/. For the benefit of our foreign students, we will use the English language.

Antti-Juhani Kaijanaho: On build-essential

The build-essential package is not a definition of the build-essential policy. The actual definition is given in the policy manual:
It is not necessary to explicitly specify build-time relationships on a minimal set of packages that are always needed to compile, link and put in a Debian package a standard "Hello World!" program written in C or C++. The required packages are called build-essential, and an informational list can be found in /usr/share/doc/build-essential/list (which is contained in the build-essential package).
The build-essential package is an informational list, it is documentation. The idea of the build-essential package is to document which packages are always needed to compile, link and put in a Debian package a standard "Hello World!" program written in C or C++. The build-essential package maintainer's main job is to make sure that the informational list is correct. When I maintained build-essential, I got multiple bug reports asking (and sometimes demanding) that debhelper be added to the list of build-essential packages. I closed all such reports (#64827, #70014, I thought there were more but can't find them) with a suggestion that the proper place to make this request is the policy list, not the build-essential package bug list. In fact, when I asked for a new maintainer (Colin Walters ended up taking the package), I specifically listed the following requirement:
I consider the capacity to deal with stupid requests (like "plz add debhelper"; lately, there have been not so many of these) and an understanding of the relationship between this package and Policy as essential qualities of the maintainer of this package.
I'm a little concerned that the current build-essential maintainer apparently does not understand the relationship between the package and policy. For the build-essential package maintainer, it is irrelevant whether debhelper is used by 92 % of the archive. That argument might be a good one, but the proper place to make that argument is the policy list, seeking to amend policy in such a way that debhelper is included in the set of build-essential packages. But it is not the job of the build-essential package maintainer to decide it!

22 November 2005

Andres Salomon: My self-worth is based upon you.

According to this page, my blog is worth $2,822.70. Now, I have no idea what metric they use to determine that, but that’s not really important. What is important is that you freeloaders start paying up. For far too long, I’ve put my blood and sweat into producing this fine verbiage, without any sort of compensation for my labor. As we all know, if humans aren’t compensated for their art (and trust me, this blog is pure art), they have absolutely no incentive to continue creating it. So, I demand payment in return for my hard work, or Toby gets it! I hereby announce that this blog is for sale. Once purchased, you may claim ownership over any past and future ideas, anecdotes, and pictures presented on here. I will entertain the best offer. I am such a whore. For the humor impaired: yes, this is a joke.

Ian Murdock: The writable web

Who says a web-based office suite doesn’t make sense? I’m writing this post in Writely, a web-based word processor that supports posting to weblogs (complete with preview mode) as well as real-time collaboration, basic document management, and several other very nice features. It even does auto-save, and there’s a spell checker too, complete with squiggly lines underneath misspelled words. I decided to give Writely a try after Steve Rubel explained how he uses it to draft blog posts, thinking it might make a nice alternative to the antiquated TEXTAREA widget that is, remarkably enough, still the primary interface for editing the web after all these years. Now that I’m using it, though, I’m beginning to see how it could grow into more than that, at least for me. Sure, it’s fairly simplistic, but it does all the basics reasonably well, so that’s actually a feature (Steve says: “Think of it as Microsoft Word for the Web - except with just the parts you need!”). Combine that with the ability to access my documents from any computer, as well as the collaboration facilities (which look interesting and appear to go above and beyond the heavyweight email-based collaboration features found in more traditional office suites, though I haven’t tried them yet), and I’m intrigued. Now, if there were only a Writely component I could include in other web applications, or maybe even graft in as a substitute for the TEXTAREAs on arbitrary webpages using some sort of Firefox extension or Greasemonkey script. I’d love to see support for the Open Document Format too, so I could use Writely as a sort of document store and pass documents between thin client and fat client seamlessly. Then we’d be getting into really intriguing territory. (While I’m at it, a way to pull down the templates and style sheets from my weblog for a true WYSIWYG editing experience would be very nice too. Heck, as long as we’re thinking outside the box, why not just allow me to edit the page directly?) (As I’m writing this, I can’t help but think of the Innovator’s Dilemma, i.e., market leaders continuing to stuff more and more features into products that fewer and fewer people actually need to fuel the relentless drive upmarket, opening themselves up to attacks from below by providers of “good enough” products..) Update: I couldn’t get the blog posting feature of Writely to work, so I ended up copying-and-pasting the HTML into Wordpress. Oh, well. On a brighter note, while I was fiddling with the blog posting feature, CNET News.com reported that Writely is adding support for the Open Document Format and intends to add support for PDF too. Suite!

Steve Kemp: The Chronicles of Steve

Apathy
I’m sleeping a lot more than I should be which is making me pretty apathetic at the moment. Even checking email is a real effort. Let alone replying.
Last Post
As previously mentioned I’m utterly unfranchised with WordPress. This will be my last post using it. All future updates will be made using Chronicle, a simple Perl-based application I’ve been working on for a while. (The best part is the name!) So far I’ve got code to : TODO:
  • Import old comments.
  • Add code to handle displaying/editting/deleting comments.
  • Add some mod_rewrite magic so that all my old links still work.
The application is pretty nice, comprised of several perl modules and built using the CGI::Application base-class. I realise this contradicts the apathetic stanza above …

Antti-Juhani Kaijanaho: Driving While Intoxicated &ndash; A Glimpse of Finnish Criminal Justice, Part One

This posting is part of my Finnish criminal court series. See the introductory essay for more information and an overview of the Finnish criminal court system. The following is a fictional account of a criminal case, one of the most frequent ones, written in the form of a play script. A PDF is also available. There is also an OpenOffice-generated XHTML renderition, which may be more pleasant to read than the version below (but lacks most of its logical markup). DRIVING WHILE INTOXICATED
A glimpse of Finnish criminal justice
Part One Dramatis personae
Presiding judge
Prosecutor
Defendant Extras
Three lay judges
Court reporter Sets
Courtroom
Courthouse lobby DISCLAIMER This is a work of fiction. Although this play is based in general terms on real life, all the specific characters and events portrayed or described in this play are fictitious, and any resemblance to real people or events is purely coincidental. The verdict presented is fictitious, and while it is based on the author's understanding of the law, it may be erroneus. No legal advice should be inferred from this work of fiction. Scene One: And so it begins The courtroom is about the size of a large school classroom, and shaped as a rectangle in terms of floor layout. The judges' bench, a long wooden table, lays near one of the short walls; the space between the bench and the wall is enough to give the judges and the court clerks comfortable room to sit and to move behind the sitting judges. At the center of the bench is the seat of the presiding judge, who has easy access to a telephone, a public address system and a panel for controlling the LED display visible in the lobby above the courtroom door. To his or her right is the court reporter's seat in front of a PC and in control of recording equipment. To the reporter's right there is room for one additional individual. To the presiding judge's left, there are three chairs for the lay judges. If one were to stand directly opposite the presiding judge, on the other side of the bench, one would find an open Bible. In front of the bench, disregarding the Bible, there is some room, approximately two meters or so. Along each long wall there is a small table, and those two tables face each other, and are therefore turned sideways from the bench's point of view. By the desk on the bench's right is the seat of the prosecutor, and the other, facing desk is reserved for the witness being examined. Facing the bench, separated from it by that empty space, are two rows of tables with chairs. Beyond them there are two rows of seats for the audience without tables; the farther row is right at the other short wall. The long wall to the judges' right contains one double door leading to the court building lobby, and the other long wall contains two sets of double doors at each end of the wall, leading to a part of the building not accessible to the public. We'll call the door closer to the bench the judges' door. The PRESIDING JUDGE is a 50-something man dressed formally in black and blue. The three LAY JUDGES are more casually but still essentially formally clothed. LAY JUDGE ONE is a sixty-something male, LAY JUDGE TWO is a female in her fourties and LAY JUDGE THREE is a female just under thirty. The COURT REPORTER is a female in her fifties, also dressed formally. It is 9:00. The four JUDGES and the COURT REPORTER are sitting on the bench. Each JUDGE has papers in front of him or her, the PRESIDING JUDGE's stack being by far the thickest. The PROSECUTOR, fourty-something man, enters through the judges' door, carrying law books and a large stack of paper. He sits down at his desk. PRESIDING JUDGE (Nodding to the prosecutor.) Okay. Let's start. (Enters codes on the LED machine. Then picks up the public address microphone.) The criminal case 'prosecutor against Matti Meik l inen' begins in room three. Parties to room three. Scene Two: Main hearing The DEFENDANT enters through the double door from the lobby. He feels a little lost. PRESIDING JUDGE (To the defendant:) Matti Vihtori Meik l inen? (DEFENDANT nods.) Please, take a seat in the front row. (He waits for the defendant to comply.) This case will be tried as follows. First, the prosecutor will read the charge. You will then respond by telling us if the charge is correct or not, that is, if you in fact did commit the acts specified in the charges, and if you did not, or the charge is only partially correct, you should state briefly why the charge is in error. The prosecutor will then present the case, he will describe us his understanding of the events in question. When he is finished, you will again have opportunity to state if the prosecutor is correct or not, and if not, in what way is he wrong. If there is disagreement between you and the prosecutor, we will hear the evidence. After that, the prosecutor will state his or her concluding opinion of the case as presented here. Again, you will have the opportunity to respond. We will conclude with discussion of what punishment, if any, would be appropriate. The court will then discuss the case alone, and will finally announce the verdict. Is this understood? (DEFENDANT nods.) Okay. Prosecutor? PROSECUTOR (Reads the charge from a paper everyone has in front of his or her.) I demand punishment to Matti Vihtori Meik l inen for driving while intoxicated. Matti Vihtori Meik l inen had on the first of May this year operated his car while his exhaled air contained 0,597 milligrams of alcohol per liter. Matti Vihtori Meik l inen's driving license must be suspended. PRESIDING JUDGE (To the defendant.) Is the charge correct? DEFENDANT Yes, it is. PRESIDING JUDGE Okay. The prosecutor will now tell us the circumstances and events in detail. PROSECUTOR Thank you. It was to my understanding late evening on May day, and the defendant had come from a bar and was apparently trying to move his car to a cost-free parking space. A police patrol happened to observe this and the defendant had apparently been a little shaky in his walking, so the officers gave him a breathalyzer test, which showed significant alcohol content. The defendant was brought in the station where a precision test was performed. The first reading was 0,597 and the second reading was 0,617; the mean of these two is 0,607, and after performing the confidence subtraction, the reading 0,597 milligrams per liter was obtained. PRESIDING JUDGE (To DEFENDANT) Well then, is what the prosecutor just said true? DEFENDANT (Speaking in a colloquial manner and very somberly. He is ashamed and wishes this would be over soon.) Yeah, it is. PRESIDING JUDGE All right. It seems to me that there are no points of disagreement, so we don't need to hear witnesses. (The PROSECUTOR nods.) Okay, it's time for the concluding statements. I think we will hear consequence opinions at the same time. Prosecutor? PROSECUTOR Thank you. I don't think there is much to say. The case has been shown beyond reasonable doubt, in my opinion. We have the precision test readings and the defendant's admission. As to the penalty... the amount of alcohol we are talking about is just below the limit for serious intoxication, so this is no small deal. On the other hand, the circumstances were not very dangerous. I think suspended imprisonment could well be considered, though a stiff fine would probably be more appropriate. The driving ban must be fairly long, obviously. PRESIDING JUDGE All right. (To the defendant.) Do you have anything to say before we adjourn to consider the case? DEFENDANT Well, I suppose it's clear that something is going to be given to me. I prefer a fine, naturally. PRESIDING JUDGE Naturally. The court will consider all options. Do you have any special requests concerning a driving ban? DEFENDANT As short as possible, of course. PRESIDING JUDGE Do you have a particular need for a car, do you need it for work, for example? DEFENDANT No. PRESIDING JUDGE Okay. Now, your income. We have here the last completed tax report for you, it says you earned 500 euros a month and had no children. Has this changed? DEFENDANT No change. PRESIDING JUDGE Okay, thank you. If you will then go outside to wait while we consider this case, thank you. The DEFENDANT exits to the lobby, the PROSECUTOR exits through the judges' door. Scene Three: Deliberation We are now in the lobby outside the courtroom. There are many doors that lead to many courtrooms. Above each door, attached to the wall, is a display showing the current case number; there is also a light saying do not enter, which is lit for most of the rooms, including Three. Also there is a numeric display which is out at the moment for most of the rooms. For some rooms, they indicate when the session will resume. Each courtroom door also has a paper pasted to the door frame listing the cases for the day. The door leading outside is separated from the lobby by a routine security check area, and one of the courthouse police guards stands there waiting for people to enter. Some other guards and janitors sit in their glass booth. There are many people sitting on the chairs, waiting for their turn to enter one of the courtrooms. DEFENDANT enters from the Courtroom Three door and sits down, waiting. It takes about fifteen minutes. During this time, announcements from other courtrooms could be occasionally heard, and people would enter or exit other courtrooms. Then... PRESIDING JUDGE (Over the PA) Verdict in the case 'prosecutor against Matti Meik l inen' in Courtroom 3. DEFENDANT exits through the Courtroom Three door. Scene Four: The Verdict The DEFENDANT enters from the lobby and sits down. After a minute, the PROSECUTOR rushes through the judges' door. PRESIDING JUDGE (Announcing to all people present.) The District Court has examined this case and has decided that Matti Vihtori Meik l inen did in fact commit the crime he was accused of in the way specified in the charge. The justification is the combination of the measured alcohol content in Meik l inen's breath and his own admission of guilt. Matti Vihtori Meik l inen is therefore sentenced to pay sixty-five day-fines, that is three hundred and ninety euros. Penal code, Chapter 23, Section 3. His driving license is suspended until the first of November this year. Road Traffic Act Section 75 Paragraph 1. One who is dissatisfied with this verdict can appeal it to the Vaasa Apellate Court within thirty days. Dissatisfaction must be declared, however, either right now to me or within a week to the Office of this District Court. (To DEFENDANT) Come and take the fine ticket and written appeal instructions (DEFENDANT takes those from the COURT REPORTER.) This hearing is concluded. The DEFENDANT leaves, as the court and the prosecutor prepare for the next case. TO BE CONTINUED
(with the next case)

21 November 2005

Ian Murdock: Really Simple Synchronization too

Ray Ozzie: “As an industry, we have simply not designed our calendaring and directory software and services for this ‘mesh’ model. The websites, services and servers we build seem to all want to be the ‘owner’ and ‘publisher’; it s really inconsistent with the model that made email so successful, and the loosely-coupled nature of the web.” Great stuff. Can’t wait to see what comes of this. Personally, I think synchronization is going to be one of the key platform features of Web 2.0. As I’ve said before, I simply don’t buy that we’re just around the corner from ubiquitious network connectivity, and absent that, we’re going to have to deal effectively with the disconnected operation problem.

Erich Schubert: Are social network services worth a dime?

Social network services (Wikipedia) such as Friendster, Linkedin, OpenBC are one of the top "web 2.0" hypes. I'm very sceptical about them, because I don't see the real benefits for me. (I'm referring to the pure "keep contact with your schoolmates" thing, not stuff which does much more such as serious blogging - e.g. livejournal - or planets such as planet.debian) The typical use case I've heard is much like "Imagine you have made a cool product, and want to sell it to some company. Now you can search for people at that company you know (or a friend of yours knows) and call them, this will help you get a feet in the door", as well as "you can use it for finding a job". I think that's bullshit, and to a large extend because I'd neither be willing to update my information in these services all the time, nor would I be willing to help just everybody here - most likely I'd just delete and ignore the email, and be really annoyed by a call (I'm annoyed by calls anyway)... It's not that I despise social networking per se. But I despise quantity instead of quality. I care a lot for my friends, and I'm in several groups grown around some technical issues; when someone is looking for a job I pay attention for suiteable offers around me; if someone needs something else I do try to help. But I'll only do that for people I'd really call friends. If you just want a quantitative number, last I checked my ranking was #36 in the global PGP keyring, meaning I have the 36th shortest average distance worldwide to verify a cryptographical key. So what? Of course I also tried one of the social networing services given above, joined a group for a university I was at. Even before the adminstrator of that group added me, I got an "invitation" by one "linkaholic". I rejected it, and even considered to report it as "spam" to the operator. I did indeed know that person, but all we had was a flamewar on a mailinglist, and I found him highly unsympatic. So why should I add him to my network? Where are the benefits for me (except that I'll maybe get an annoying call sometime in the future, when I could have forgotten about him)? No, in my opinion this social networking hype is built entirely on a hype, basically saying "look how well-connected I am, everybody knows me, and I know everybody", even when these relationships are only present on the computer, without anything worth being called a "relationship" behind. The flame-war I mentioned earlier was btw. on the topic of Resume/CV books. Which are even worse than this social networking thing, IMHO.

20 November 2005

Matthew Palmer: The Fun Never Stops With Ruby

Well, there's nothing like posting a really rubbish program to your blog to find out the right way to do it. Firstly, Philipp Kern has come up with another, even shorter version than his version I posted in the update to my original Ruby post, this time blowing me away with the strangeness of explicit casts in Ruby. Apparently, casting an input stream to an array produces an array with one-line-per-element, as in this example:
 STDIN.to_a.sort_by rand .each l puts l 
As Philipp warns, however: "Ruby is full of fun and power; one must watch out that the scripts remain readable". For a fairly toy example, this solution is still fairly readable, however I can see hair growing on this thing if your program grows large. Next, Pierre-Charles David showed his qualifications for becoming a co-author of the next edition of the Pickaxe (AKA "Programming Ruby: The Pragmatic Programmers' Guide"), with his example and explanation. He's kindly given permission for me to reproduce his e-mail in it's entireity, since it's too good to chop up:
Here is the shortest and most readable version of your "randomize stdin" script I can think of:
  #!/usr/bin/env ruby
  print ARGF.readlines.sort_by   rand  
 
ARGF is a special variable representing either stdin or, in the case where file names are passed on the command line, the content of these files (think of Perl's <>). ARGF behaves like an IO object (although I think it is not one). In particular, it responds to the #readlines method which splits the receiver's content into lines and returns an array. In other words,
  lines = ARGF.readlines
 
is the idiomatic way of doing
  lines = []
  while line = gets() do
    lines << line
  end
 
in your example. The next part (sort_by) uses a new form of the sort method, which I think is not documented in the Pickaxe. It implements the Schwartzian transform technique. In essence, a random number is associated to each element of the array, which are then sorted based on this index. As a general style remark, note that although Ruby supports "while" and "for x in y" loops, they are rarely used, in favor of iterators and/or higher order methods. For example, to gather all the input lines in an array without using readlines, one might write
  lines = Array.new
  ARGF.each_line    l  lines << l  
 
or
  lines = ARGF.inject([])    lines, l  lines << l  
 
Hope it helps, and welcome to Ruby!
Pierre, your explanation definitely helped, and I hope it helps others too. The third person to help me out is Decklin Foster, through a post in his blog. What particularly caught me about his solution was the neat demonstration of another feature of Ruby which I think I will really learn to love: the ability to dynamically add methods to an existing class. "Aiee!" I hear all the purists scream -- and I can see the potential for severe misuse, too. But, since every good idea seems to get deeply perverted, we may as well have some real useful features to pervert while we're at it. Decklin has the clever idea of adding methods to the Array class that shuffle the elements of the array in a random fashion. His code is beautiful in it's simplicity:
 class Array
    def swap!(a, b)
        self[a], self[b] = self[b], self[a]
        self
    end
    def shuffle!
        each_index do  i 
            j = i + rand(length - i)
            swap!(i, j)
        end
        self
    end
 end
He then goes on to rewrite my bumbling example in probably the most comprehensible manner I've yet seen:
 STDIN.readlines.shuffle!.each    line  puts line  
Decklin writes, "Now that is cool.". I couldn't have put it better myself. My thanks to Philipp, Pierre-Charles, and Decklin, for helping me along the Ruby path. So, two new Ruby Rules for me to live by: Hmm, is it possible that Ruby is nothing more than Functional Programming by Stealth? Aiee!

Andres Salomon: obey your master

I missed a bus to Boston by about 5 minutes on thursday (I seem to be doing that a lot lately), so I went up to 8th Ave to find some internet access. The coffee shop I entered was packed, so I sat down at an already occupied table. The guy sitting across from me was in a wheelchair, reading the newspaper. After a few minutes of me typing away at my computer, and him reading his newspaper, he started up a conversation with me. “So, I was just reading that they’re going to have a feature in DVRs that has a video camera that watches over your home.” I have no idea why he thought I might know what a DVR is, or why he chose that topic. Maybe I just exude geek pheromones or something. “Oh?” “Yeah, they want to be able to have you be able to see watch it over your cell phone. How’s that for security? Being able to monitor your home through your cell phone?” “Ok, I guess…” “I’d want that, it seems like an excellent idea.” “Sure, but who else might be able to look into your home?” “What do you mean?” He seemed genuinely confused by my remark. I thought maybe he hadn’t heard me; I tend to mumble. “Who else might have access to see your home?” “Oh, I see. So if someone else gets access to your cell phone, they can watch?” At this point he went off about cell phone IDs and PIN numbers. I cut in, “Well, yea, there’s that. But what about people with direct access to the video feed? People who work for the DVR company, and people who work for the cell phone companies. They’ll be able to watch the video. Not to mention people who manage to access the networks of these companies. If it’s in a DVR, is there a way to turn it off, or is it a video of your living room, 24 hours a day, 7 days a week?” He pondered that for a minute, and responded with, “Yeah, I guess it’s a double edged-sword..” He made a few more comments about the DVR and how he had never thought about it that way, but I had already started tuning him out. My work there was done; another happy citizen infected with my special brand of distrust and cynicism. Big Brother is unnecessary in a world where all the high-tech consumer garbage you buy comes equipped with built-in security flaws. I’m hoping the next time I go there, I see him wearing a tin foil hat.

19 November 2005

Edd Dumbill: The Web as it was meant to be used

Since giving XTech 2006 the tagline "Building Web 2.0", I've received a few questions as to how wise this was. The Web 2.0 label has been accused in some quarters of being a vague, marketing-oriented, term. Perhaps an attempt to kickstart a new bubble. I was going to write further, defending my choice: that, practically speaking, Web 2.0 encapsulates a combination of technologies and practices driving the web forward. Yes, it's a label of convenience, but the implementation trends are real. The maturation of XML, a revival in browser technology, a willingness to share data openly and new web development frameworks. Just as I embarked on distilling these thoughts into a fuller form, Paul Graham published an excellent essay on Web 2.0. In it he analyses the Web 2.0 term:
Does "Web 2.0" mean anything? Till recently I thought it didn't, but the truth turns out to be more complicated. Originally, yes, it was meaningless. Now it seems to have acquired a meaning. And yet those who dislike the term are probably right, because if it means what I think it does, we don't need it.
So what's the reasoning that means we don't need the term? Graham writes: "Web 2.0 means using the web the way it's meant to be used." There's nothing fundamentally new, but there is a groundswell of understanding of what's been there all along. For me, that's a wonderful encapsulation of both current web trends and my aspirations for XTech. "Web 2.0" is a just a handy label for this. "The Web as it was meant to be used" will strike a chord with many web practitioners today--whether it's sensible use of web services with REST, improving user interaction in web design, or open semantics and data interchange. If you're involved in using the web as it's meant to be used, consider submitting an XTech proposal.

Erich Schubert: Memory management issues

Dear Lazyweb,
,
Nothing is perfect, but on Linux you can at least improve it and tune it. I just ran into memory problems on my development box - I had tons of applications open, and since this is a laptop I prefer to have swap disabled. I then started to build bind9 for a sarge backport, which meant that a long sequence of C compiler processes were launched, each allocating some memory, working with it, terminating, next. Being really at the limit of the available memory, the system became unresponsive - and that behavious is really bad... I thought that sooner or later it will really run out of memory, and decided to watch some TV in the meantime. One hour later when I returned, it was still torturing my HD and still unresponsive. Apparently the compile process has been all the time just below the memory limit, causing the kernel to remove pages from memory and load them back from the disk later, which slowed everything down just horribly. So now I'm searching for a way to prevent such situations. The traditional ulimit approach won't help - no single process was responsible for using all the memory, but each one had its reasonable share. So dear lazyweb, is there a way to tell the kernel to reserve a share of the memory (lets say, 64 MB) for buffers and caches only? I can live with out-of-memory errors a bit early (and the just enable swap), but a massive slowdown as described above (where the kernel is apparently reading some data from the HD, then forgetting it again and replacing it with the next) must not happen that easily... Right now I fear that you could bring down any Linux system easily with a "slow" forkbomb where each forked process allocates 100 MB and starts writing some random data to its memory, forking a new child every 50 MB or so. Neither the OOM killer, ulimit nor traditional forkbomb detectors will be able to counter that, since already a couple of processes will cause the system to become completely IO-bound. Oh, and I have no idea how Windows would react on that either. So don't assume any OS is better, just because I say Linux isn't doing perfectly well here. If you have any tips for me, send me an email.

17 November 2005

Romain Francoise: The mysterious birth of an icon

Emacs has a new icon, included in emacs-snapshot 20051117-1:



... and I don't like it. Bah.

MJ Ray: Scheming

Linux Gazette have a (non-free) article on learning to program with DrScheme which was announced to the scheme-uk mailing list. A few critical comments there, but all good awareness-raising. I quite like the new lisp logo by Conrad Barski.

Martin 'Joey' Schulze: Documenting problems is bad - privately demanding is ignored

After I publically complained about how things are still working (or how they are rather not working) in the LinuxTag organisation, I am now attacked at raising my voice in public. That's quite interesting, because at the end of last month, I raised my voice in private already. However, the items I mentioned or demanded have not been approved yet. I have to admit, though, that when the press release was sent to the group, it shouldn't have been published yet. That it was, was a communication problem with a third party. However, there is still the question why the third party (who wrote it) could publish the press note before it was sent to the internal group. Something is definitively wrong when things are sent there so late in the process. As a result, a lot of people who should be happy and working hard to get LinuxTag 2006 organised are frustrated. Frustrated, because it doesn't seem to be possible to work in a team or to save LinuxTag. Frustrated, because they demand things that should be a matter of course, which seem to be more or less ignored. Frustrated, because their work is ignored. Frustrated, because I dare to make things public. To me it looks as if people only see the symptoms and complain about the symptoms instead of trying to understand the cause of the problem. However, and to make this article look a bit positive at least, I still see a small chance to get LinuxTag 2006 organised, but a lot of things have to change before. To me it is obvious that it doesn't work the way it is currently.

Next.

Previous.