Search Results: "undef"

3 October 2006

Pierre Habouzit: My commitment in Debian, dunc-tank, and related matters

I've chosen debian because it fulfills an ideal. For me Debian is about to build an Universal OS , and when decisions has to be taken, it's based: To live decently, I do work also in a start-up company that also happen to write closed-source software. That gives me enough money to eat and live well, and beeing able to dedicate my free time on Debian and free software. That means I've done the choice on purpose not to mix my paid work with Debian, because I don't want to balance the decisions I take in Debian I against my well-beeing. That said, I'm completely OK with people having paid works intimately related to their DD work. And if their work is intimately related to etch beeing released in time, then well, I wish them a lot of courrage. I wouldn't have the guts. I'm OK with this because we are talking about people that are not able to impose decisions to me that I judge irealist or bad. And still, I can dismiss such decision thanks to the CTTE if needed. Though, when it comes to delegates, it's a full different story, because I do have to interact with those guys in my allday Debian work, and that undoing their decisions needs a GR as per constitution. It's way less easy than going in front of the CTTE. And if Delegates are paid whichever the entity that pays them is, they will have to balance technical choices against beeing able to eat tonight (or reimburse their house, or ). Obviously, one will say that it's OK here, it's not a salary, and that the currently discussed[1] contract is not about doing the RM releasing Debian in time, but helping toward that goal, or trying to release in time not sacrificing the release quality. I answer bullshit! to that. Our RM have at least I happen to hope so more higher standards than that. If they accept that mission it's to see it completed. I'm already fearing for them getting down if they can't achieve that.
I also know that at least one of the dunc-tank board member[2] would like to see a structure able to fund DD's to work on Debian, and be able to live from that. I'm sorry, but that's an option I don't want the project to take. And if dunc-tank is a prelude to that, so please don't even think of starting it. When there is money in the game, the donator,employer,boss, and the guy accepting that money have at least a moral contract if not a legally binding one of results. And I see no investor that would happen to be interessed into a contract where the due in line is undefined. Thinking otherwise looks like complete naivety to me. So either it won't work, either people will have to take into account other parameters than technical quality when the will have to make choices. I see in my paid work what such things mean, and I do consider me lucky, I'm in a company where people do know what quality means. Though the company also has to live, and that sometimes makes us take choices that I don't like at all. I never want have to even consider such choices in Debian. I'm sorry, but putting such considerations in the project is jeopardizing what the project means and represent to me. The sole structure that would maybe fit would be some bounty board, with the following things done: And even with that some kind of checking that the job has been done correctly has to be done somewhere, and I don't see clearly who could do that, but I suppose that's doable to find some fair reviewers plus the donator(s) for that.
That said dunc-tank does not meet any of the previous requirements, is driven by delegates, and works around the thorny problem of finding a consensus among the DD's in the worst possible way. Those are the reasons[4] why I think dunc-tank is a bad idea.
And to the people offended that I seconded the recall, this is about the fact that I found the way dunc-tank has been imposed to us after having asked for our opinion, and heard the acute opposition of some of us hideous, and about the fact that beeing the DPL, or even a delegate and in dunc-tank at the same time is a conflict of interests. It's not a matter of beeing pro or against dunc-tank, matter against which there is no course of action for me anyway, as it has been on purpose and artificially kept outside of Debian.
Notes [1] I should say imposed upon us [2] And I fear more people would like to see this happen [3] even if someone already started that bounty [4] maybe there is more, I tried to lay down the more important to me

26 August 2006

Enrico Zini: evaluating-languages

Evaluating programming languages for playing with Debtags Since having workable bindings for the C++ Debtags libraries seems to be still a bit in the future, I'm planning to build a bit of native infrastructure in some higher level language. First step is seeing what language I could start playing with. The problem At the most basic level, in Debtags we have a number of packages, each of which have a set of tags. The way I usually save tags is a file with the format:
package1, package2: tag1, tag2, tag3
package3: tag1, tag2
That is, every line has a list of packages with the same tags, and the list of their tags. Since any script I'm going to write has to at least be able to parse the data into something like a package -> tags hash, then print it out. Let's see how perl, python and ruby perform. Tests C++ The reference point for the experiment will be the C++ implementation, tagcoll:
$ time tagcoll copy package-tags > /dev/null
real    0m0.421s
user    0m0.412s
sys     0m0.000s
Perl First attempt is with Perl, creating the script that parses into a hash of package => set of tags and prints the result. There are set modules for Perl on CPAN, but I have none handy at the moment. However, since they are implemented using hashes, I can approximate them by using a hash. Note that I also want to have a different copy of the tag set for every package, so that I can manipulate them in the future without unwanted side effects. Here is the code:
#!/usr/bin/perl -w
use strict;
my %db;
# Read the tag database
while (<>)
 
    chop();
    my ($pkgs, $tags) = split(': ');
    # Create the tagset using keys of a hash
    my %tags = map   $_ => undef   split(', ', $tags);
    for my $p (split(', ', $pkgs))
     
        # Make a copy of the tagset
        $db $p  =  %tags ;
     
 
# Write the tag database
while (my ($pkg, $tags) = each %db)
 
    print $pkg, join(', ', keys %$tags), "\n";
 
Here is the running time:
$ time ./parse.pl package-tags > /dev/null
real    0m0.448s
user    0m0.436s
sys     0m0.008s
Not so bad, comparable with tagcoll. Python Then comes Python. I'm not much of a Python fancier, but I'm rather attracted by the new set native type introduced with Python 2.4, which seems to have most of what I need nice and done. Here is the script:
#!/usr/bin/python
import sys
input = sys.stdin
if len(sys.argv) > 1:
    input = open(sys.argv[1],"r")
# Read the tag database
db =  
for line in input:
    # Is there a way to remove the last character of a line that does not
    # make a copy of the entire line?
    line = line.rstrip("\n")
    pkgs, tags = line.split(": ")
    # Create the tag set using the native set
    tags = set(tags.split(", "))
    for p in pkgs.split(", "):
        db[p] = tags.copy()
# Write the tag database
for pkg, tags in db.items():
    # Using % here seems awkward to me, but if I use calls to
    # sys.stdout.write it becomes a bit slower
    print "%s:" % (pkg), ", ".join(tags)
Here is the running time:
$ time ./parse.py  package-tags  > /dev/null
real    0m0.418s
user    0m0.376s
sys     0m0.036s
I'm pleased, very pleased. Using the native set seems to be not only handy, but efficient. Ruby Finally, Ruby. I like to use Ruby. In this case, however, it lacks a native set implementation, although it has a set module which is implemented using a hash. Here is the script:
#!/usr/bin/ruby
require 'set'
infile = ARGV[0] ? File.new(ARGV[0]) : $stdin
# Read the tag database
db =  
infile.each_line do  line 
    line.chop()
    pkgs, tags = line.split(": ")
    # Create the set using the Set module
    tags = Set.new(tags.split(", "))
    pkgs.split(", ").each do  p 
        # Is this a copy or a reference?  I need to find out.
        db[p] = tags
    end
end
# Write the tag database
db.each do  key, tags 
    # Ouch, Set does not do join by itself
    print key, ": ", tags.to_a.join(", ")
end
Here is the running time:
$ time ./parse.rb package-tags > /dev/null
real    0m1.637s
user    0m1.572s
sys     0m0.052s
I hope I got something wrong in the script, but I can't see what. Results As much as I don't fancy Python, it looks like it's currently the best choice for playing around with Debtags. I hope the native sets will bring me joy. If in the future I'll be asked "how come you chose Python for this Debtags thing?", I can point to this page.

8 April 2006

Martin F. Krafft: Restless travellers

We've been busy travelling, never spending more than a night in the same place. Leaving Bangkok on the "3rd class" train for Ayuthaya was an experience of its own kind. The platform was full with people waiting for the train to arrive, and when it did, we witnessed something totally unexpected for the Thai: they almost quarelled to get into the train first to catch a seat. Fortunately we got lucky in the otherwise crowded wagons. We stopped frequenly, and a glance out of the window would give you a peek into the lowest end of Thai civilisation: barracks built along the tracks with large numbers of people vegetating along. Inside the train it was hot and sticky, and we were surely happy to disembark in Ayuthaya about an hour later than planned. Ayuthaya was the Siamese royal capital between the 14th and the 18th century (the name derives from Sanskrit and means "undefeatable") and a bunch of temples and ruins, most with strong Khmer influence, survived the various Burmese attacks until today, making the city a nice attraction for those who like "stone piles" (as I've heard them described). We had made arrangements from Bangkok with the Baan Lotus Guesthouse, run by a lovely lady who spoke good English. Apart from the broken light in our room, the setting, the friendliness of our host, and the cleanliness of the rooms were definitely worth the price. After visiting Wat Phra Mahathat, the temple home to a Bhudda's head embedded in twisted roots, we had a guide escort us to a remote Elephant camp to witness the preparations for the upcoming New Year celebration (Songkran) in a week from now -- we are definitely looking forward to that. Later that night, we met some locals at a bar for chatting and went to bed late, thanks to our host handing over the keys and making an exception to the 11pm curfew. We got up to meet the guide from the night before, who took us around three temples before dropping us off at the boat stop for a short cruise around the island (Ayuthaya is encircled by a river). Our train to Khorat (Nakhon Ratchasima) was scheduled for 12:23, and so we had to forgo most of the temples due to time constraints; Ayuthaya is close enough to Bangkok to come back here again during a future trip. Reaching the station with ample time, we found the (express) train to be full, but did not feel like waiting for the slower train an hour later, so we talked the station ward into getting us on anyway. Interestingly, I think he would have tried his best even if I had not slipped him 100 Baht (2 EUR) under the table. We got on, and even had two seats in an air-conditioned wagon, so the trip was quite relaxing -- to the point that we almost missed our stop. Shortly before reaching Khorat, we rode through a thunderstorm, and there was a light drizzle as we stepped out of the station. The distance from Bangkok showed, the Tuk Tuk drivers (Tuk Tuks are the infamous three-wheeled taxis you find all over Southeast Asia) didn't hassle us, it was in fact not at all easy to find one, and when we did, he did not know where the Tokyo Hotel, our chosen home for the night, was located. With a map in hand, we thus simply started walking, but had to run for shelter at an ice factory when the rain picked up and sent cats and dogs onto the streets that really aren't made to take that much liquid. Eventually, a Tuk Tuk picked us up and got us to the hotel safely, and an hour later, the rain stopped. We did not miss a beat to get outside and ended up at "The Mall", a magnificent American-style "shopping paradise" (as Aline would call it) which clearly showed that shopping is one of the top passtimes for Thais. We ended the evening at Khorat Texas, a very nice bar in the centre of the town, with decent food and live music. As I was rolling a cigarette, a local from the next table curiously came over, and shortly thereafter, the two of us joined the three of them at their table for some cultural exchange in broken English. We picked up quite a few handy Thai expressions but also came to the conclusion that the Thai don't really know how to say things themselves and would often disagree with each other over the endings of words. But as the beer kept flowing, we seemingly got better at Thai intonation, although the language is definitely very hard for Europeans. I could not help but notice though that it seems to be better suited for cell phone conversations in noisy places while one of the three men we met kept chatting away to his wife for an hour while the band was playing in the background. This morning, we weren't motivated to get up before 11, checked out, made travel arrangements for our next destination -- Phimai -- dropped off some laundry, and then headed for the national museum, which we only found through the technique of circling and spiralling inwards. Not much to see otherwise here. The Lonely Planet guide says this city is unexciting, but it grows on you if you spend longer periods of time. Sure, like most cities, I say. As it stands, we have reason enough to abandon the place and spend tonight in Phimai, close to the famous and beautifully restored Khmer temples of the area, so that we can hopefully spend as much time as possible in the temple area before the heat gets unbearable. Nevertheless, speaking of heat, yesterday's rain shower cooled the air by 5 or 10 degrees, and it's very bearable right now. I have to point this out because in general, the month of April is not a month during which to travel Northern Thailand due to the temperatures approaching 40 degrees during the day. I know for sure that next time, I will be looking into clothing made out of fabric better suited to handle large amounts of sweat than cotton. We hope to leave Phimai on a bus to Udon Thani. I expect that shall be the next time I get to write. Thanks for reading along.

4 April 2006

Simon Richter: Threading

Yuck, my pthread-fu has sucked today. In fact, it still does. I'm currently trying to call a library that has a number of low-overhead calls, and two that hog the CPU for undefined amounts of time. Obviously I'd like to call these two from a separate thread. Good, but the spec asks me to not switch threads between calls. Okay, so the master thread does the calls, and another thread checks the sockets. Good, now it can happen that I get an interrupt from a socket. In this case, I'm supposed to invoke a signal handler in the library thread (which calls a function telling the library to shut down), and then jump back into the library and wait for it to return.

17 March 2006

Dirk Eddelbuettel: Small fix for beancounter 0.8.5

Yesterday I announced version 0.8.5 of beancounter. My testing over the last few days must have been with a, ahem, preceding version as the daily cronjob today promptly aborted when some of the data came with incomplete fields. [ This is common for e.g. mutual funds which do not have high, low, or open values but just closes and previous close. ] This quick patch fixes the issue by inserting proper undef values which PostgreSQL groks much better. A revised beancounter version 0.8.6 should be forthcoming in a few days. My apologies for any inconveniences caused.

7 February 2006

David Pashley: Perl Style and readability

Which of these two fragments is more readable?
$self-> catalina_base  = $ENV 'CATALINA_BASE' ;
if (!defined $self-> catalina_base )  
    $self-> catalina_base  = $self->getTomcatHome() ;
 
if (!defined $self-> catalina_base )  
    CCM::Util::error ("CATALINA_BASE unset and TOMCAT_HOME undefined", 3);
 
or
$self-> catalina_base  = $ENV 'CATALINA_BASE'    $self->getTomcatHome()
     CCM::Util::error ("CATALINA_BASE unset and TOMCAT_HOME undefined", 3);
Update: or
$self-> catalina_base  = ( 
   $ENV 'CATALINA_BASE'  
   or $self->getTomcatHome()
   or CCM::Util::error ("CATALINA_BASE unset and TOMCAT_HOME undefined", 3) 
);

30 January 2006

Antti-Juhani Kaijanaho: Counting lines

Insipired by Daniel Burrows’ tests, I decided to do mine. The object is to come up with a Haskell program that performs the job of wc -l as efficiently as possible. My test material is a randomly generated file with all lines less than 80 characters long. Summary: my final idiomatic version is twice as slow as wc -l, and my final nonidiomatic version is as fast as wc -l, or at least within the margin of error. First, the baseline:
$ time wc -l testfile
7798137 testfile
real    0m12.127s
user    0m0.765s
sys     0m0.399s
Then the most idiomatic program. Honestly, I expect it to suck performance-wise:
main = getContents >>= print . length . lines
And it does:
$ time ./wcl1.hs < testfile
7798137
real    1m14.993s
user    0m54.182s
sys     0m0.573s
But only by a factor of six. My first hypothesis is that garbage collection is the culprit. And, indeed:
$ time ./wcl1.hs +RTS -sstderr -RTS < testfile
./wcl1.hs +RTS -sstderr
7798137
25,236,174,340 bytes allocated in the heap
5,070,193,924 bytes copied during GC
117,484 bytes maximum residency (3750 sample(s))
96274 collections in generation 0 ( 26.36s)
3750 collections in generation 1 (  0.74s)
2 Mb total memory in use
INIT  time    0.00s  (  0.00s elapsed)
MUT   time   27.17s  ( 42.72s elapsed)
GC    time   27.10s  ( 33.72s elapsed)
EXIT  time    0.00s  (  0.00s elapsed)
Total time   54.27s  ( 76.44s elapsed)
%GC time      49.9%  (44.1% elapsed)
Alloc rate    928,824,966 bytes per MUT second
Productivity  50.1% of total user, 35.5% of total elapsed
real    1m16.616s
user    0m54.278s
sys     0m0.700s
As you can see, GC takes half of the processing time. Unfortunately, minimizing GC time does not have as big an effect as I hoped:
$ time ./wcl1.hs +RTS -H100M  -RTS  < testfile
7798137
real    1m1.354s
user    0m44.371s
sys     0m1.171s
Here, I’m effectively telling it to use a 100-megabyte heap. A separate GC profiling run tells me that GC time has dropped from 50 % to 1 %. The memory problem seems to be a red herring. What we’re doing here is creating four separately allocated memory cells for each character in the input. Of course, the cells are generated lazily, that is, a cell pair is allocated when the lines function demands another character; it then creates another cell pair to denote the same character in a list of lines. As soon as each line has been counted, the four cells become garbage. This sounds like a lot of work! But apparently it isn’t; I tried a few variations that did away with the stream of input altogether, not much unlike what Daniel did in his tests. Surprisingly, the performance worsened a lot. The lesson: functional programming language implementations, unlike typical imperative ones, are built on the assumption that you’ll be doing a lot of allocation. What I suspect is taking a lot of the time is arithmetic. Haskell’s Int is boxed, and lazy by default, adding a lot of overhead. I hand-fused length and line, yielding a tail-recursive countLines function, and I added the command-line switch -funbox-strict-fields, which enables a few significant optimizations of the laziness of Int. The results were nice:
ajk@kukkamaljakko:~/scratch$ cat wcl4.hs
module Main (main) where
main :: IO ()
main = getContents >>= print . countLines 0
countLines :: Int -> String -> Int
countLines n ('n':r) = countLines (n + 1) r
countLines n (_:r) = countLines n r
countLines n [] = n
ajk@kukkamaljakko:~/scratch$ ghc -O -Wall -funbox-strict-fields --make wcl4.hs -o wcl4
Chasing modules from: wcl4.hs
Compiling Main             ( wcl4.hs, wcl4.o )
Linking ...
ajk@kukkamaljakko:~/scratch$ time ./wcl4 < testfile
7798137
real    0m37.961s
user    0m29.853s
sys     0m0.495s
ajk@kukkamaljakko:~/scratch$ time ./wcl4 +RTS -H100M < testfile
7798137
real    0m25.153s
user    0m13.497s
sys     0m0.803s
ajk@kukkamaljakko:~/scratch$
With a large heap, the program is only twice as slow as the baseline. This is pretty good, considering that the code is still idiomatically functional. The following rather ugly, imperative program does away with the lazy stream and carefully avoids any laziness without doing any too dirty tricks:
ajk@kukkamaljakko:~/scratch$ cat wcl7.hs
module Main (main) where
import Data.Word
import Data.Array.IO
import IO (stdin)
count :: Int -> (Int, Int) -> IOUArray Int Word8 -> IO Int
count 0 _ _   False = undefined -- force ac evaluation
count ac (l,u) _   l > u = return ac
count ac (l,u) ar
    = do a < - readArray ar l
         let ac' = case a of 10 -> ac + 1
                             _  -> ac
         count ac’ (l+1, u) ar
maxn :: Int
maxn = 4096
main :: IO ()
main = do
  arr < - newArray (0,maxn) 0
  let loop :: Int -> IO Int
      loop acc = do n < - hGetArray stdin arr maxn
                    if n == 0
                       then return acc
                       else do acc' <- count acc (0,n) arr
                               loop acc'
  res <- loop 0
  print res
ajk@kukkamaljakko:~/scratch$ ghc -O  -Wall -funbox-strict-fields --make wcl7.hs -o wcl7
Chasing modules from: wcl7.hs
Compiling Main             ( wcl7.hs, wcl7.o )
Linking ...
ajk@kukkamaljakko:~/scratch$ time ./wcl7 < testfile
7798137
real    0m13.431s
user    0m10.342s
sys     0m0.467s
Of course, this program is not Haskell 98, but the nonstandard things it uses are fairly common. As can be seen, this version’s performance is, considering the margin of error, equal to the baseline. The compiler used in this test is The Glorious Glasgow Haskell Compilation System, version 6.4.1, as packaged in Debian sid.

21 January 2006

Bartosz Fenski aka fEnIo: preparing to upload new fuse

I'm working on new fuse (filesystem in userspace) packages and I really wonder if I should simplify their postinstallation procedure as it was mentioned in #337572. That would make my life much easier, cause there's quite many bugreports against undefined behaviour of post-debconf tasks, which are pretty hard to track for me. In fact I suppose that most users simply accept default answers so asking them about anything seems to be overhead.
Let's assume I will remove these superflous questions... now the problem is that if someone answered for them in some previous installation then I could leave unneded group and some config files on their systems. On the other head removing this group could even lead to nonworking system because of one of these bugs: #307624, 307627, 306281.
I'm quite confused what to do now. Both solutions have some advantages and disadvantages. First one at least could lead to less bugs in the future. Hints welcome.

20 December 2005

Bartosz Fenski aka fEnIo: preparing to upload new fuse

I'm working on new fuse (filesystem in userspace) packages and I really wonder if I should simplify their postinstallation procedure as it was mentioned in #337572. That would make my life much easier, cause there's quite many bugreports against undefined behaviour of post-debconf tasks, which are pretty hard to track for me. In fact I suppose that most users simply accept default answers so asking them about anything seems to be overhead.
Let's assume I will remove these superflous questions... now the problem is that if someone answered for them in some previous installation then I could leave unneded group and some config files on their systems. On the other head removing this group could even lead to nonworking system because of one of these bugs: #307624, 307627, 306281.
I'm quite confused what to do now. Both solutions have some advantages and disadvantages. First one at least could lead to less bugs in the future. Hints welcome.

12 November 2005

Bartosz Fenski aka fEnIo: preparing to upload new fuse

I'm working on new fuse (filesystem in userspace) packages and I really wonder if I should simplify their postinstallation procedure as it was mentioned in #337572. That would make my life much easier, cause there's quite many bugreports against undefined behaviour of post-debconf tasks, which are pretty hard to track for me. In fact I suppose that most users simply accept default answers so asking them about anything seems to be overhead.
Let's assume I will remove these superflous questions... now the problem is that if someone answered for them in some previous installation then I could leave unneded group and some config files on their systems. On the other head removing this group could even lead to nonworking system because of one of these bugs: #307624, 307627, 306281.
I'm quite confused what to do now. Both solutions have some advantages and disadvantages. First one at least could lead to less bugs in the future. Hints welcome.

Next.

Previous.