Older blog entries for sab39 (starting at number 19)

Challenge to all perl gurus out there... can you make the following script any shorter?

Original (80 char) version:

$|=++$x;for(;;){$i+=$x;$x=-$x if$i>77|$i<1;print" "x$i."* \r";select$u,$u,$u,.1}

Current (58 char) version:

select$u,$u,$u,.1while$|=print" "x(abs 78-++$i%156)."* \r"

I'll permit changing the phase (starting at a different point in the cycle) because I already had to do that to get to 58, and changing the speed provided that the sleep is neither removed altogether or increased to 1s or greater. Beyond that, the output should be visually indistinguishable.

I was convinced that I couldn't get it shorter when I was at 80! Still, it really looks like it's close to optimum now - the 80 character version had lots of obvious redundancies, I just couldn't figure out how to remove them. This one doesn't.

caolan: That's cool, but I disagree that it can't be done smaller...
sballard@rainbow:~$ ./test; echo $?
42
sballard@rainbow:~$ wc -c ./test
     18 ./test

Of course, I cheated...

sballard@rainbow:~$ cat ./test
#!/bin/sh
exit 42
Badger: Someone on one of the Moz newsgroups posted a fast-update perl script - it would use the Bonsai webserver to identify the files that had changed, and then use CVS to download those only, bypassing the usual CVS negotiation of these issues. The discussion suggested that this really helped, although it seems to me that CVS really ought to be more efficient at this kind of negotiation if a *webserver* can provide the required information so much quicker. Try looking through n.p.m.builds (and ask if you don't find it).
lkcl: See EVE - a massively multiplayer space/strategy 3D game with the servers written in Stackless Python. Incredible screenshots, etc. No mention of whether it runs on Linux that I could find, which seems strange when they're using an open source language. Now if only { I had a decent graphics card || Xfree supported acceleration on the crap one I do have } ...

Election day! Of course, I can't actually vote, being only a permanent resident for the last 2 years and at least another few years away from even being eligible to consider thinking about applying for citizenship. The phrase "no taxation without representation" has a really delicious irony for me...

If anyone who wasn't planning on voting feels like rectifying this heinous situation by giving me their vote, please cast it for Nader :) And remember, this only helps Bush if you were going to vote for Gore otherwise...

Does anyone here know of any site with Nader's exit poll results? I'm not terribly interested in the Bore/Gush race (and I can see why releasing those results early is potentially unwise... so thanks to whoever is DoS'ing drudgereport.com) but being able to track how close Nader is to pulling in the 5% he needs would be great...

I'm reading "Stranger in a Strange Land" for the first time. Absolutely great book, and I'm amazed I've never read it before. The whole "life on Mars" premise is dated, of course, but it doesn't even matter.

The only reason I'm mentioning this on Advogato is that it's really weird to read the word "grok" and think that the reader wasn't supposed to understand what it meant right away. I'm just getting to the point in the book where I'm beginning to realize that I don't understand a fraction of what it means anyway, despite having been using it for a year or two...

Whatever you do, do not run the following command:

mv /lib /test-lib

Example...

# mv /lib /test-lib
# mv /test-lib /lib
/bin/mv: No such file or directory
# ln -s /test-lib /lib
/bin/ln: No such file or directory
# perl -e 'rename "/test-lib", "/lib"'
/usr/bin/perl: No such file or directory
# reboot
/sbin/reboot: No such file or directory

I think you can see where this is going...

Of course, on reboot you can't even get as far as running init, even if you set init=/bin/sh. I hope you have a good boot floppy.

6 Sep 2000 (updated 6 Sep 2000 at 18:59 UTC) »

My 2c on the KDE business: I've defended Debian in the past (in particular arguing the finer points of the licenses involved with ralsina) for not including KDE, but I will say this: If debian do not include KDE now (or in the near future), then I hereby retract all defending I have ever done of their position. Fortunately for my own faith in humanity, I see no indication thus far that they won't. Whether kmidi and kghostview get incorporated without rms's "forgiveness", I'm not sure, but I really don't see any of the rest being omitted.

As far as kdelibs still being in incoming after months and months - how many people actually want to install kdelibs without the rest of kde? It would have been nothing more than a symbolic gesture, and as such, I'm only a little disappointed that nobody decided to go ahead and make it anyway.

What would really do wonders for my faith in humanity would be for the authors of ghostview and timidity to come out of the woodwork now and grant "forgiveness" - regardless of whether it's needed and/or whether the KDE people want or accept it - just so that the flamewar can be over. It's interesting to me that there's been no comment from either group thus far...

I don't know whether I think this "forgiveness" is really needed or not - the GPL does seem to imply it, but AFAIK no previous GPL violator has ever been taken to task over it, which in itself might make that clause unenforcible. And at this point - does anyone really want anything other than for this to be over?

Raph wrote: 1. Not checking error codes. Virtually all invocations of functions or commands should be of the form of: status = invocation(...); if (status) { cleanup() }

UGH! In some ways I agree with you about code reuse, but after reading comments like that it makes me remember why I never use C anymore, in favor of Java. I could live without almost all of its features, but I can't imagine writing code without exceptions anymore. You can still be lazy and write bad code - just catch and discard all exceptions at the top level - but you have to work at it. And instead of having every useful line of code be followed by 3 lines of checking status, you can put it all in the exception handler.

I wish that it were possible to do real work in Java without resorting to non-free software, though... For my day job, I'll settle, but not for hacking. I look forward to the day when Kaffe, Classpath or libgcj are really up to the level of Sun's implementations and I can ditch that proprietary bulls**t. Unless Sun follow their StarOffice announcement with another one...

I don't think the other aspects of Java are completely useless, but I do agree that they're no kind of silver bullet. I find that (implementation) inheritance is most useful within a single project - making inheritability a part of your public interface is much harder than it looks. Even Sun's collections API, with its Abstract* objects which are designed to be inherited from, has problems here... you need to know altogether too much about the implementation of each method to know exactly what functionality you must override for your specific implementation. For example, if you override add(Object), will addAll(Collection) know to use your version, or is addAll implemented its own way? What about delete(Object) versus clear()? The issue is compounded by the way they handle threadsafety, which is far too complex to explain here, but isn't documented nearly well enough to understand exactly what you need to do if, for example, you can provide an optimized addAll().

Generics (real generics, not bloat-inducing templates) would really help java too, and a complete rethink from scratch of all of the core APIs. But the language itself is pretty nice for avoiding the more basic kind of quality pitfalls, and some of the APIs are too.

jeffs: Have you looked at GNU Classpath, Kaffe or gcj (part of gcc, but I don't know it's URL)? Those are the primary free software java projects that I know of, and I'm sure any one of them could use some help :)

10 older entries...

New Advogato Features

New HTML Parser: The long-awaited libxml2 based HTML parser code is live. It needs further work but already handles most markup better than the original parser.

Keep up with the latest Advogato features by reading the Advogato status blog.

If you're a C programmer with some spare time, take a look at the mod_virgule project page and help us with one of the tasks on the ToDo list!