Search Results: "eric"

15 February 2006

Erich Schubert: When XSLT gets really messy...

XSLT is an outright ugly language. Thats why I often just hate it. In some (rare) cases it's very elegant, but most often incredibly clumsy. I've been redoing my homepage completely, and I'm using XSLT to render my data XML files to the XHTML output. That works quite well so far, but I hit more and more special cases. First I wanted to add a language chooser. This required finding out which lanuages my document supports (read: blocks with that language attribute exist) and check for uniqueness. Some things where rather easy to solve (with some experience in XSLT), so where extremely ugly. First of all, I want my template file to be a valid XHTML file, I don't want to have any layout parts in XSLT. Then I have a separate sitemap, needed for generating the menu. So I have to process three documents at the same time in XSLT. Ouch. But doable, using variables. Basically I have three modes - in one mode, the template is mostly copied over, unless I've specified some special rule, e.g. to insert the page title, meta information or content. A second mode uses the current chunk of the template document as template for the contents a couple of times to iterate over data chunks from the data source file (read: put text blocks from my source files into the output template format). The third mode does the same for the sitemap. Unfortunately, it started to get even messier... Big problem number one: Make a list of the available languages for the current page. Make this information reuseable throughout the page transformation. Part one: make a list of available languages by finding unique (!) @lang attributes. (usual approach: grab all nodes with @lang attributes, check if they have the same node id like the first occurence with this @lang value for uniquness, then output. Ugly as hell, but string magic sucks as much.) Big issue number two: Assume we now have a variable with en in there, access these nodes to transform them. Unfortunately, the generated nodes are "result nodes", and you cannot iterate over them with for-each. Luckily the exslt node-set extension to solve this. But now came the third big issue along... this is where I give up. I want my pages to have a nice modification date... my data pages are stored in subversion... Subversion has keywords expansion like CVS, which I can use nicely to automatically update the last modification date of the file. Unfortunately, the date will look like this: $Date: 2006-02-15 21:29:10 +0100 (Mi, 15 Feb 2006) $ Whereas in a web page meta information it's recommended to use ISO8601. Now if I only had regular expressions and proper date handling functions... I guess I'll stop writing ugly, hackish XSLT code and chose pretty Python code instead. Maybe use TAL or KID for XMLish templating...

14 February 2006

Eric Dorland: Firefox definitely could be better

Martin F. Krafft writes about Firefox's un-UNIX-like behavior. I mostly agree with him. Aside from the X forwarding bug in the remote implementation (which has been reported numerous times already), the main problem is the inconsistency in the interface. If I run firefox from the command line everything works fine and it behaves like a normal UNIX application (ie taking over the terminal unless I background it). If I go to another terminal and run firefox file:///tmp/foo.html, this will open a new window or tab in Firefox and immediately exits. This is very un-UNIX-like, there's no way to know if the program is actually exiting or if it's just launching a new window. These leads to fun bugs with programs that call firefox as an external viewer (see #278990 and #284174). If running firefox causes it to connect to an already running instance, it should wait(2) on that process, since that would make a lot more sense from the UNIX perspective (and perhaps a -remote flag to have the "fire-and-forget" functionality we have now, because that does make sense in some situations too).

As far as I'm concerned the whole profile mechanism is a waste of code and a hold over from the old Netscape days, for people without multiuser systems. It should be dropped completely. Although we'd probably need to be able to run multiple Firefox processes on the same profile before it could be stripped out.

There is definitely a strong Windows mentality that pervades Firefox. I still remember when the extension mechanism was first introduced back in 0.9 and you needed to run as root (or the Administrator under Windows) for it to work properly. Madness. Although UNIX does seem to be more suited to an environment where processes are lightweight and short-lived. Big, monolithic applications are a more recent phenomenon.

Erich Schubert: <tt>make bug</tt> with SERefpolicy

Aargh. Yesterday I spend hours trying to find out why SERefpolicy would not build. There was a suspicious message in the build process, about a circular dependency being removed, and it was obviously due to this dependency that the build did not work. But: I couldn't find anything like a circular dependency. The dependencies for this file were trivial, just two input files that are not being modified or generated or anything. Today I decided to downgrade make to the stable version (which unfortunately conflicts with current kernel-package...) - and now it compiles. Smells like "make bug" to me... You can grab the completely untested (last build didn't work, and my test machine is currently down) packages at http://selinux.alioth.debian.org/serefpolicy/ in case you want to try SERefpolicy yourself. I'd love to have a SELinux policy system which does not involve any such make and m4 black magic. The makefiles are a PITA to read, the whole thing is totally unmanageable IMHO.

Erich Schubert: Quote of the day.

Have you seen Shrek 2? Remember when he has to win back his beloved? "We're gonna need flour. Lots and lots of flour." Unfortunately, this joke doesn't translate into other languages - "flour" and "flower" rarely sound the same... (e.g. "Mehl" and "Blumen" in German)

13 February 2006

Erich Schubert: PHP crap of the day: b2evolution

My father wanted to try out b2evolution. Oh my god... He was not able to login. With the help of ethereal we found out that b2evolution uses the following line of code to determine your cookie domain:
$cookie_domain = ($basehost == 'localhost') ? '' : '.'. $basehost;
which will not work when you have a local net with hostnames such as "linux1" because this tries to restrict the cookie to .linux1. Changing it to
$cookie_domain = '';
worked like a charm. Why is there not a single PHP program that just works? Is it the language that invites you to write crappy code, or is it the users of PHP that have no clue?

Erich Schubert: SELinux hack of the day: disable history when not sysadm_r

zsh: can't write history file /root/.zsh/history You'll get this error message on logout when your ssh login is to a userid which may not write your home directory (such as staff_t, when logging into root whose files usually are sysadm_home_r). Here's a simple workaround for you zsh users:
if id   grep -q sysadm_r; then
        export SAVEHIST=1500
        export HISTFILE=~/.zsh/history
        export HISTSIZE=1500
fi
This will only enable history when you are sysadm_r. Bash users probably can use
if ! id   grep -q sysadm_r; then
       shopt -u cmdhist
fi

11 February 2006

Andrew Pollock: [life/americania] The Social Security Administration strikes again

I'd been planning on waiting to blog about the issuing of my Social Security number until I actually received the card, but as it seems that it has been lost in the mail, I could be waiting a while... So I was doing my regular weekly "what the fuck is going on with my Social Security number application?" phone call to the San Jose Social Security Administration office on January 12, when for a change, they couldn't actually find my application by the reference number that they'd given me. Lo and behold, my number had been allocated two days earlier. They told me that my card would be mailed out in 10 working days from the date of allocation, or that I could come into the office and get a bit of paper that told me what the number was. Let's just say that I'm glad I didn't wait for the card, or I'd still not be getting paid... So ten working days passed, and then some, and no card. This made me somewhat concerned, since everyone's been telling me how the SSN is the Primary Key of All Things, and that if it gets stolen, you're screwed as your identity can be stolen, with all the bad things that accompany that. So I rang the San Jose office back, to see if they had anything useful to say for themselves, and of course, they didn't. They couldn't tell me anything. They couldn't even tell me what address they had on record to ship the card to. They couldn't offer any postal tracking information, and they said that if it bounced for some reason, it would go back to Baltimore, where it would be destroyed. Oh goody. So after the trip to the DMV today, I thought I'd drop into the Mountain View Social Security office to request a new card. Well, let me just say that I can see why they zip-tie the chairs together... After waiting for over an hour and a half to get to speak to someone, they said that they would need to request secondary verification of something or other before they could issue me a card, and that it could take up to four weeks (the same secondary verification that took nearly 2 months in the first place). Or I could go to the San Jose office, where they already had the verification on file, and they could request a new card for me immediately. I was so flabbergasted that I just walked out of there. In hindsight, I should have told them to just go ahead and request the secondary verification, as so far I haven't actually needed to present the card to anyone wanting my SSN, and it's a lot more convenient (I think) to have to deal with the Mountain View Social Security office than the San Jose one. What absolutely blows me away is that there is no trust, no communication between offices. The fact that one Social Security office has already requested (and received) secondary verification of my existence from Immigration isn't sufficient for another office. They can't even ship a copy of that from one office to another? The mind boggles at the inefficiencies. I want that hour and a half of my life back.

Andrew Pollock: [life/americania] Licensed!

Last Monday, Sarah and I visited the fine institution that is the California Department of Motor Vehicles, so that we could get ourselves California drivers licences. We had to do both a written test and a behind the wheel test. The written test was your standard multiple-guess exam (36 questions, maximum of 6 incorrect answers to pass). Annoyingly, all the material on the exam was not in the California Driver Handbook, which the handbook tried to make out was the case. Fortunately it was largely a case of common sense. I got two wrong. The funniest thing was that Sarah and I both got the same exam paper, and Sarah did her test just after I finished mine, and we were allowed to keep the paper, so she could see which two I got wrong. One of the more unusual things I found about the process was that they allocated me a licence number before I'd even sat the test. Last Thursday Sarah had her behind the wheel test, and today I had mine. It was pretty easy. No reverse-parking, no emergency stopping. I just had to drive around for 15 minutes. I passed without any faults. Given it took me four attempts to get my original licence in Australia, I was pretty pleased with this. (I failed my Queensland licence a number of times due to nerves). The other thing that I was amazed to discover was that I don't get the licence for another four to six weeks! They mail it out. The DMV processes over here are just mind boggling. The fact that you can't get a licence on the spot, and that it takes something like three months to get licence plates for a new car just blows me away. It's nothing like the process in Australia.

Erich Schubert: IBM/Lenovo Thinkpad X60 (Intel Core Duo ultraportable) not sufficient for running Vista?

According to the specs I read from IBM/Lenovo and from Microsoft, a current top-notch Thinkpad X60 (with Core Duo CPU, 12" display, 1.3 kg) ultraportable is not "sufficient" for running Windows Vista. The laptop only has 512 MB RAM, parts of which are used for graphics. Windows Vista requires full 512 MB RAM for the System and a graphics card with at least 64 MB (for the rather low resulution of the 12" display, make it 128 MB for bigger ones, and 256 MB for 1600x1200) Oh, the current "high end" Thinkpad T43/T43p models are not sufficient either. They both have too little video memory for their display size, too. But the specs say they at least should be fine if you disable the glass UI. Sometimes I think if that's worth the benefits (?) of Vista... Hmm... how about an Intel Mac? Can at least an Intel Mac run Vista?

10 February 2006

Erich Schubert: SELinux backports updated

I've recently done a couple of updates to my SELinux backports for Debian stable. The backports are mostly "No changes" backports; recent improvements include (finally) a SELinux enabled shadow package. Approximately tomorrow I'll also have a new sysvinit package which makes my modifications hopefully obsolete thanks to the maintainers fixing my reported bugs. ;-) The packages are largely untested, though. I havn't rolled them out on my main SELinux enabled boxes yet. There also is no SeRefPolicy package yet.

Erich Schubert: Gnome hack of the day: notifications

My father asked me how to setup an alert to remind him of the evening news. (The serious ones in the public channel, not the sensational in the private channels...) My first suggestion was to use evolution, but it cluttered his calendar view. I guess you could avoid that by using a separate calendar file, though. Still, these alerts are of very low priority, so I considered that the new notifications should actually suit better. Sending notifications from the command line is supposedly easy - if you're in the same session. Otherwise, you have to find out which socket to send it to. (Btw: what happens when the dbus daemon is restarted ungracefully? will notifications be broken until the session is restarted, too?) Anyway, here's the solution I came up with:
#!/bin/sh
pids= pgrep -u $USER gnome-session 
title="$1"
text="$2"
for pid in $pids; do
        # find DBUS session bus for this session
        DBUS_SESSION_BUS_ADDRESS= grep -z DBUS_SESSION_BUS_ADDRESS \
           /proc/$pid/environ   sed -e 's/DBUS_SESSION_BUS_ADDRESS=//' 
        # use it
        DBUS_SESSION_BUS_ADDRESS=$DBUS_SESSION_BUS_ADDRESS \
           notify-send -u low -t 7200 "$title" "$text"
done
This will send a notification with a lifetime of 3 minutes to all running gnome-sessions of the current user. Supposedly works fine from cron (not yet tested, though). Error handling isn't perfect yet, either (but again, this is a very low priority notification). P.S. hint of the day: use a line like
apt-get install libnotify-bin && notify-send 'Yay! Completed!'
To get a fancy notification when your long-running process of the day is completed. Sweet.

Erich Schubert: Why a blog software should be XML based

Simple answer: because RSS and Atom are XML formats. So please generate valid output. Adhere to the standards! The RSS feeds of Planet Gnome and Planet Ubuntu, for example, are currently broken. (Planet Gnome due to a bug in Planetplanet AFAICT, Planet Ubuntu due to a broken RSS feed from Wordpress... Yes, you must escape single < characters in XML...) Templating systems such as the default templating of the Django Framework, or the popular Clearsilver templating engine are unfortunately not suited for XML output. Oh, and please never ever write XML using 'print' commands either. Use a proper XML writer, which can handle charset issues and escaping properly. Good examples for XML-enabled templating engines include TAL and METAL used by Zope (but available for a variety of languages), and KID (again python, used by the Turbogears Framework). Closely related is the "HTML fragments" issue, which basically is why I want XML to be used internally, too (you could also store StructuredText only, and convert it to XML just for transformation to the output): HTML fragments in my blog should be valid slices of an XHTML file, to avoid issues when generating both the web pages as well as when integrating the feed into other pages. With RSS, the HTML code is AFAICT escaped in one big data chunk, so it doesn't matter there. It probably does for Atom. So what a good blog tool (including a rewrite of planetplanet which has way too many bugs) needs to do is to parse it's input data (plain text, HTML provided by a web browsers WYSIWYG edit component, mail, structured text, XML, ...) and either reject broken entries or try to guess whats intended, but guarantee that the output is valid XML. Then generate proper feeds and output from that. Thanks to all those who already replied to my previous posting. One thing I was pointed at, and I'll probably look into is Apache Forrest. Although I likely will use KID instead, if I happen to write my own tool after or despite my upcoming final exams.

9 February 2006

Erich Schubert: Anyone knows of a nice XML-based blog software?

Dear Lazyweb, Anyone aware of a nice blog software that And I bet I forgot some additional restrictions... Thanks for any suggestions..

John Goerzen: My new podcast: The Sound of History

Well, it's finally time to announce my new podcast, Sound of History! The Sound of History is a weekly podcast featuring full-length, unedited, and uncut historic audio. You'll hear speeches, broadcasts, and events from around the world. Sometimes you'll hear famous people, sometimes not. Episode 1 is up now. On this episode, you'll find John F. Kennedy cracking jokes about Marx in front of a bunch of newspaper publishers, Ronald Reagan talking about the Challenger, some blues from 1922, and an Edison recording from 1902. Thanks to Cliff for mentioning that Reagan speech in a comment. That prompted me to go find it. I'm finding material for this podcast from around the Internet. Some of that music comes from archive.org, and there are various sources for presidential speeches. I'd like to find some British prime minister's speeches as well, but I'm having difficulty with that. If any of you Brits reading this know of a good site for uncut audio, accessible to Americans, please do let me know.

Erich Schubert: I'm no longer a math student now.

Today I "quit" (formally) my math studies and became a computer science student instead. While my next term will officially be my 6th term in CS, I will be doing my finals and then start writing my thesis (which you usually do somewhere in your 9th-11th term). I have in fact been studying CS longer than that, but I also wanted to do math (mostly because CS was too boring for me most of the time, and math provided a higher challenge) - and instead of formally doing both (which would have required finding out specific formalities noone knows, and maybe paying some extra money) I went with math for a long time. Now that I was approaching final exams for both math and computer science, I had to decide: do math, do CS or do both. Being lazy (and wanting to finish as soon as possible now) I decided to pick the easiest - computer science. My diploma topic will be very mathematical, though - a special logic for reasoning on the web, so it's logic, web 3.0 and theoretical computer science combined. Sweet. I guess it really doesn't matter that I don't end up with two degrees, given all my other qualifications. :-)

8 February 2006

Erich Schubert: Nuke your thumbnails day.

I wondered where all my diskspace had gone to... Using Baobab, I discovered it was my ~/.thumbnails directory containing 1.1 GB of data. I definitely have way to many pictures... (there were thumbnails of at least of all pictures I shot during my US trip in there) So when you are running out of diskspace, check your Trash and thumbnails folders... ;-)

Ian Murdock: Intelligent design, European style

Geoffrey Moore: “Taking the shuttle from the train station I met a European executive and his wife who commented to me about how odd America’s denial of evolution and preference for intelligent design seems to a European sensibility. […] Today, as I participated in a series of economic workshops, I was struck by an ironic reversal: In the world of economics, it is the U.S. that believes in natural selection, and it is Europe, specifically the EU and its leading countries, which clings to an outmoded ideology of intelligent design.”

Aigars Mahinovs: Superball/bowl. So ... I tried to understand what ...

Superball/bowl.
So ... I tried to understand what this american football thing is all about. What got me interested in it was an anime from Japan called Eyeshield 21 where a boy that ran errants for bullies his whole school life goes into american football as a runner with his great speed and agility. That get me thinking about looking into that sport - it looked quite interesting in the anime.
Boy was I wrong.
So I watched the Superbowl XL - the biggest and most important event in the american football year. The first half was absolutely empty - nothing happened at all. The ads were much more interesting then the game. The halftime show was ok, not as good as ads.
And the second half just showed why this is the definitive american sport in the worst meaning of that - legalese. Steelers would have lost it the judges would have not interfered so much with the game. This sport has like hundreds of tiny rules that are very dependent on interpretation by the judges - that is what I call a sport for all the american lawyers to like. Cancelling several good Seahawks trows just because some guy was holding someone on the other part of the field, that must be givin an ecstasy for every law student. Not for me though.
And even without all that dilation with ridiculous rules (what's that stupidity with running clock and two minute warning ?!?) the game itself is kind of dumb - there are just too many people in the field for anything that a regular person can really understand. Strategies that almost never work out because of the other team interfering with their strategy. Too much chaos and still each person only does a one single thing. Even more - many of the players never will get any attention in the game just because they are on a supporting position, but the quarterback will always be the center of attention.
A very unbalanced game that is even more screwed by a ton of ads, a very heavy leaning on judging nitpicks and just 3-4 nice moments in the whole 1 hour game. I'll just stick back with hockey and anime :)

7 February 2006

Erich Schubert: More on P2P obfuscation

Julien Danjou and others replied to my "please don't obfuscate BitTorrent" post, pointing out providers in France, Canada that already filter BitTorrent one way or another. I've read similar things about some DSL providers in Germany (Telekom however is proud that they don't do that). But basically this only shows my point: by having the major p2p filesharing protocols use non-standard ports and non-detectable protocols, more and more providers take measures like doing QoS for non-standard ports or filtering them altogether. And just as you reported, this has bad side effects on the ability of other users to e.g. use VoIP or play online games. Remember: my point is to make P2P protocols easy to filter/limit by routers, so provider do NOT block/throttle all non-HTTP connections, but can selectively throttle only P2P filesharing when they think they need to. Because otherwise they'll break other stuff such as online games and VoIP. Now by putting your BitTorrent on ports such as 80 or some VoIP port which isn't throttled, you only cause these providers to e.g. install a transparent proxy for these services. You make it only worse. I agree that you don't have that much choice in countries where there is some kind of monopoly there. But then this increase in filtering will probably allow new companies to enter the market.

Mike Hommey: xulrunner 1.8.0.1-1

Checking Signature on .changes
(…)
Good signature on /home/mh/pbuilder/sid/result/xulrunner_1.8.0.1-1_i386.changes.
Checking Signature on .dsc
(…)
Good signature on /home/mh/pbuilder/sid/result/xulrunner_1.8.0.1-1.dsc.
Uploading via ftp xulrunner_1.8.0.1-1.dsc: done.
Uploading via ftp xulrunner_1.8.0.1.orig.tar.gz: done.
Uploading via ftp xulrunner_1.8.0.1-1.diff.gz: done.
Uploading via ftp libnspr4-dev_1.8.0.1-1_all.deb: done.
Uploading via ftp libmozjs-dev_1.8.0.1-1_all.deb: done.
Uploading via ftp libsmjs1_1.8.0.1-1_all.deb: done.
Uploading via ftp libsmjs1-dev_1.8.0.1-1_all.deb: done.
Uploading via ftp libxul-dev_1.8.0.1-1_all.deb: done.
Uploading via ftp libnss3-dev_1.8.0.1-1_all.deb: done.
Uploading via ftp xulrunner_1.8.0.1-1_i386.deb: done.
Uploading via ftp xulrunner-gnome-support_1.8.0.1-1_i386.deb: done.
Uploading via ftp libnspr4-0d_1.8.0.1-1_i386.deb: done.
Uploading via ftp libmozjs0d_1.8.0.1-1_i386.deb: done.
Uploading via ftp spidermonkey-bin_1.8.0.1-1_i386.deb: done.
Uploading via ftp libxul0d_1.8.0.1-1_i386.deb: done.
Uploading via ftp libnss3-0d_1.8.0.1-1_i386.deb: done.
Uploading via ftp xulrunner_1.8.0.1-1_i386.changes: done.
Successfully uploaded packages. I wonder how long it will take to the ftp-masters to accept it. It seems the NEW queue is not as fast as it used to be. It’s been a week I’ve been waiting for libxml2 and libxslt to get through, and they still haven’t made it. If enough people is interested in the package before it comes out of NEW, I’ll probably upload it in my repository. I have a patch for epiphany-browser that I’ll send soon to the BTS. I’ll come up with a patch for yelp as well. Then, bye bye mozilla-browser. I’m also going to build an unofficial firefox on top of xulrunner, and maybe upload it to experimental, so that we can have some feedback about that. I’ll see with Eric about that.

Next.

Previous.