Search Results: "erich"

8 December 2006

Erich Schubert: British now divide by zero?

British now divide by zero. Either this "Dr James Anderson, from the University of Reading's computer science department" is a crappy computer scientist (not to speak of his mathematical skills), or this is a case of really bad journalism. Apart from having some facts wrong (infinity and -infinity aren't numbers, they're symbols outside of the numbers), he basically defines "0/0 = Nullity". Well, some of us might prefer the name "NaN" for this. "Not a Number". In floating point calculations, 0/0 may (if you've disabled exceptions) return NaN. So it is nothing new. And it's not particularly useful either, because all it solves is not having to raise an exception, but being able to continue your calculations (which will continue to return NaN) and handle the error at the end. With modern languages designed around exception handling, this of course is rarely ever used anymore. Some simple calculations you might find convincing: 2 * Nullity = 2 * (0/0) = (2*0)/0 = 0/0 = Nullity Nullity + 1 = (0/0) + (1/1) = (0*1 + 1*0)/(0*1) = 0/0 = Nullity Nullity / Nullity = (0/0) / (0/0) = (0/0) * (0/0) = (0*0)/(0*0) = (0/0) = Nullity So if you ever have Nullity anywhere in your equation the whole equation equals nullity. There is no way to remove Nullity from your results, since even Nullity/Nullity is Nullity. So you could just call it "I divided by zero, so the result is invalid". Thats probably not as pretty as "Nullity", but as useful. Some simple calculation, why you must not be allowed to divide by zero (independently from any nullity or whatever):
1*0 = 0 = 2*0     (This equation is right, isn't it?)
1 = 2             (I divided by 0 on both sides, removing the *0 factor)
This works for any number, not only for 1 or 2. So: if you divide by zero, all your numbers are equal (if you keep standard calculus rules such as associativity, distributivity etc. used in above equations). If that is okay for you, then you can divide by zero. I do prefer having 1 life to 0 life. And if 1 = 1000000, can you give me $1000000, I'll give you $1 back tomorrow... But: Maybe it's just a bad piece of journalism. He's a computer science guy. Maybe he knows about NaN. Maybe he's just trying to teach kids to use NaN when calculating, instead of teaching them to never divide by zero. There might be didactic benefits from this approach. The 1200 year old problem (Pythagoras, cited in the article lived 2500 years ago, I have no idea how they made up this number) IS easy to solve, if the result is called "invalid" instead of just having no valid result... That won't make your airplane land better, if it notices it's current height is Nullity... and what if his heart pacemaker obtains a result of "nullity", what is it supposed to do (as opposed to noticing it miscalculated?) [Update: he has published papers on this, too. Unbelievable... So above theory that it maybe is good for educational purposes is incorrect. Anyway, journalists shouldn't have reported on this without talking to some serious mathematicians...] [Update: Zoy, thats why I wrote "if you keep standard calculus rules such as associativity, distributivity, etc. - and I find these exceptionally useful. The last example is not using his rules, but standard math, but treats zero like all other numbers, to show that a canonical extension will just not give useful results. My whole point is NOT that you can't define 0/0=Nullity, but that it's not compatible with the standard calculus we're used to and relying on.]

7 December 2006

Erich Schubert: Memory corruption during sleep

Yesterday I put my laptop to sleep (on AC power) while I went to the christmas party of a company I worked for. After returning, I couldn't read my email any more; dovecot would segfault after login. Restarting dovecot didn't help, but a reboot helped. Sounds to me as if during sleep, some kernel cache of the dovecot application was corrupted (read only memory; cached by the kernel, which is why it survived the restart of dovecot). Whoa, this is like Windows. Rebooting the computer actually fixed something!

4 December 2006

Erich Schubert: Software mixer with ALSA

The "high definition audio" in my laptop is rather minimal. Apart from the mic not yet working, it has a line out and a single volume control. Thats it. However, I'd like to have multiple applications use the sound card, for example my music player, eventually some video player or flash, and some system events. ALSA to the rescue. It's not easy to configure, but really powerful: Mixer screenshot with MPD volume control Yes, that is a separate volume slider in my regular mixer for MPD, my music player. Here's how to do that: First we'll need to create a huge /etc/asound.conf:
# the real device
pcm.realdev  
        type hw
        card 0
        device 0
 
# software mixing
pcm.dmixer  
        type dmix
        ipc_key 3129397
        ipc_key_add_uid false
        ipc_perm 0666
        slave.pcm "realdev"
        slave  
                period_time 0
                period_size 1024
                buffer_size 8192
                # we're enforcing 44100, since thats what most apps use
                rate 44100
         
        bindings  
                0 0
                1 1
         
 
# software volume
pcm.softvol  
        type softvol
        slave.pcm "dmixer"
        control  
                name "Software"
                card 0
         
 
pcm.mpdvol  
        type softvol
        slave.pcm "dmixer"
        control  
                name "MPD"
                card 0
         
 
# input
pcm.input  
        type dsnoop
        ipc_key 3129398
        ipc_key_add_uid false
        ipc_perm 0660
        slave.pcm "realdev"
 
# duplex device
pcm.duplex  
        type asym
        playback.pcm "softvol"
        capture.pcm "input"
 
# default devices
pcm.!default  
        type plug
        slave.pcm "duplex"
 
pcm.dsp0  
        type plug
        slave.pcm "duplex"
 
I won't go into all the details (I don't know all of them either), but the basic idea is that I setup the dmixer plugin for software mixing, and attach two software volume controls to it. I'm keeping the permissions to 0666, since my MPD is running as a different user, and I didn't find a way to say I'd like to have the permission set to group "audio". The default device is the regular microphone jack (untested, since there are driver issues with my chipset and recording) and the "Software" volume control. If you have an ~/.asoundrc you might want to move it out of the way. Next I need to configure MPD to use its own volume control via /etc/mpd.conf:
audio_output  
        type            "alsa"
        name            "my ALSA device"
        # 'mpdvol' is the device name I used in asound.conf
        device          "mpdvol"
 
You'll probably need to restart all applications currently accessing your audio devices to have them pick up the new config. The new volume control will also only appear after you've started an application using it AFAICT. Sometimes you need to restart them twice for the new volume control to be effective. When alsa-utils restores the volume controls after reboot it should work right away. The "Software" volume control is optional, but that way I can tune down the default applications volumes below the MPD volume if ever needed. Oh, and I think you can safely keep one or all of the software volume controls to maximum without distortion happening (this doesn't hold for all sound cards, where it's often best to keep the sliders at ~75% max to avoid distortion)

Erich Schubert: Penny Stock Spam

... is rather annoying these days. Apparently this known hacker group with their powerful Windows trojans is behind the latest spam wave: they use image obfuscation that makes the average Captchas look easy. In fact it took me a couple of seconds to understand what they're spamming about this time - the image just contained a highly unreadable stock symbol. I wonder if the big financial web sites (for non-experts) like Google Finance, Yahoo Finance or whatever you use for occassionally checking your stock quotes couldn't just add a warning if a penny stock is being spamvertised. Preventing naive users from falling for these frauds would certainly be a good service for their visitors, wouldn't it? And there are already websites listing spamvertised penny stocks. So dear big-financial-websites, start protecting your customers now (and reduce the amount of spam for all of us that way, since that will hopefully make penny stocks a lot less lucrative).

3 December 2006

Erich Schubert: Skype bastardized DBus

I've started playing around with DBus a little. It's somewhat cute, I was able to quickly write a script that monitors my wireless network connection going up and down, and after some searching for useful documentation, I'm now able to tell gaim to disconnect when my wireless goes down and reconnect when it comes back. All with just a few lines of Python. While searching for some docs on the Gaim API, I stumbled upon the Skype DBus API. But it's crap. Evil stuff. (And not working, from what I can tell; I read somewhere they're using a totally outdated DBus version, and to use it you have to downgrade and break lots of other stuff). They've totally bastardized DBus. First of all, the trace of a DBus API I've found is on a system level, not a user/session level. It should be per-session; you especially don't want others to mess with your Skype. Instead of offering an API with sane methods to invoke, they offer a single method, called "Invoke", and a single callback called "Notify". Ouch. With these methods you're expected to do a ascii protocol something like this:
-> NAME UltimateProgram
<- OK
-> PROTOCOL 5
<- PROTOCOL 5
Note that the name choice is up to the connecting application; so you can cloak yourself as a different application; it will be displayed to the user when asking for confirmation, apparently. Another example how crappy Skype dbus is: their "dbus example in C" links to the Python example and the other way round. The C example consists of 2.4 MB precompiled example and about 100k source code (the example of course is a graphical client). For comparison, this is a complete example on how to reconnect all your Gaim accounts via python-dbus:
import gobject, time, dbus, dbus.glib
# get DBus inteface
sesbus = dbus.SessionBus()
gaim_obj = sesbus.get_object("net.sf.gaim.GaimService", "/net/sf/gaim/GaimObject")
gaim = dbus.Interface(gaim_obj, "net.sf.gaim.GaimInterface")
for account in gaim.GaimAccountsGetAllActive(): gaim.GaimAccountDisconnect(account) time.sleep(5) for account in gaim.GaimAccountsGetAllActive(): gaim.GaimAccountConnect(account)

2 December 2006

Erich Schubert: Go Tagging!

Debtags made quite some progress the last months. Many thanks to Enrico Zini, who did most of the work. We now have a new database (on alioth), a new editing frontend (using Ajax, and accessing this database) and a couple of nice utils around it. Go Tagging is a page listing untagged packages - by popularity contest score. Just go there, click a package you are somewhat familiar with (sorry, the really popular ones are already gone :-) but there are still some well-known ones in there such as "rails") and edit the tags. Enrico also did some kind of AI to suggest tags. This is not based on the Google Summer of Code project, but something Enrico did using the Xapian search engine index he's been using for the main search function. A couple of good features have been proposed, but are not yet implemented. For example, a "similar packages" overview, so that when you've been tagging one package you could easily switch over to another similar package. Or a per-maintainer view. It was suggested that it should be added to the packages.qa.debian.org per-maintainer view page; this would be great, but will require some more work to be done. On a related base, it would be interesting to make a tag cloud (like this Debian package cloud) on one maintainers packages only. This would then be a view of one maintainers interests in Debian... Anyway, thanks to everybody who has been tagging packages and helping with the backend databases and applications.

28 November 2006

Erich Schubert: Say NO to voting machines

Voting machines produce results not verifyable by independent people watching the election. This must not be allowed! So if you are a resident of germany, please sign this Petition an den Petitionsausschuss des Deutschen Bundestags (or the equivalent Ersatzpetition, since we are apparently overloading their system) Votes must remain verifyable by everybody, not only a handful computer experts!

27 November 2006

Erich Schubert: web.archive.org back up

web.archive.org aka "the internet wayback machine", which gives you access to past versions of a web site, (and thus serves as a mirror for websites that didn't change too recently) is back up. For more than a year the publicly accessible archives were not update, but they're finally back now. It's a great tool.

26 November 2006

Erich Schubert: Nautilus and cowbuilder

When I run cowbuilder (or pbuilder), they mount /proc and /pts in their chroot. Nautilus notices this and places icons for proc and pts on my desktop, which actually is quite annoying... Dear Lazyweb, how can I tell nautilus to not display these "filesystems" on my desktop?

25 November 2006

Erich Schubert: How to delay the etch release...

Get enigma (new version 1.00 beta in incoming, should hit unstable soon) and you won't have time to work for the release anymore. It's a great game, and it has almost 1000 levels now. Please help test the beta, and lets delay etch! :-) This is also the first package I've built with cowbuilder. I don't know if its faster - my new laptop is much faster, and I've been setting up a new development environment. But it works for me.

Erich Schubert: Packaging one-liner

This is the shortest debian/rules file I've ever written:
#!/usr/bin/make -f
include /usr/share/cdbs/1/rules/debhelper.mk
Yes, that is the complete debian build file. CDBS can very clearly say "nothing special in this package". Everything else in this package is handled by debhelper defaults. Granted, this is a very simple package. But thats what I like about CDBS: don't waste my time (or the time by someone reading the debian/rules file) when it is standard stuff.

24 November 2006

Erich Schubert: BPM tag your music

When you DJ or - as I do - dance a lot, the beats-per-minute values of songs are interesting. However, counting them manually is a pain, especially if you have lots of them. GJay is a software that can calculate the BPM (using a clever algorithm from BpmDJ). However, it stores the information in it's own database. Whenever you move the file, you'll likely have to recalculate it. And so on. However, the ID3v2 format has a TBPM field for beats-per-minute information, so why not store it there? gjay from CVS (sorry, the Debian package doesn't include this yet; I also do not know if this works for Windows) has a standalone mode for analyzing. So I wrote a tiny python wrapper which can mass-process files, runs them through gjay, parses the XML output via ElementTree and tags the files with mutagen. So get the dependencies - gjay from CVS, python-elementtree and python-mutagen - then run my script. Or modify it to suit your needs, it's free software. [Yes, I am aware that there are songs which change speed. So what? I'm not expecting the BPM value to be exact, or to apply from the very first bit to the last...]

22 November 2006

Erich Schubert: JSF XML syntax for c:url in attributes?

Dear Lazyweb, What is the JSF 1.2 XML-Syntax equivalent for
<img src="<c:url value='/static/foo.png' />" />
(this will make the URL relative to your application root, not to your web server; so if the app is installed in /foobar, the resulting URL will be /foobar/static/foo.png) My preferred solution would have a useful src= value so an XHTML browser can still display the page. Same for CSS stylesheets, links and similar. Please send me an email at erich@debian.org, I'll update the entry. (Comments are intentially not enabled.) Thanks. [Update: at least in apache myfaces, this should work (untested):
<c:url value="/static/foo.png" var="url" />
<img src="$ url " />
However, the template file won't render approximately in a regular browser. For easy-to-edit templates it would be nice to have an actual value in the src property. I have an idea how that could work with custom tags...]

21 November 2006

Eric Dorland: So I missed one...

Erich, give me a break man :) There are definitely still some branding issues left, I'm working on them.

The reason Ubuntu, Red Hat, etc can use the icon is that they've struck deals with Mozilla Corporation to include the trademark, where they submit there patches back upstream for quality assurance or what have you. Even if we came to a similar bargain, the logo has a non-free copyright license, so it isn't going into main.

Erich Schubert: Iceweasel is the latest firefox

Debian unstable now has iceweasel. Running iceweasel presented me with the pretty message
You've Updated To The Latest Version of Firefox
Great. Note: Ubuntu has more patches to firefox than Debian, so if Debian is (or: was) violating Mozillas trademark, so is Ubuntu. And probably Fedora. And Redhat. And Gentoo (well, maybe not; from what I know Gentoo is closed to unmodified upstream usually, and not as anal about LSB and desktop integration etc. as the others), ... you name it. Anyway, go, iceweasel, go.

19 November 2006

Erich Schubert: Video transcoding

My camera has a video function. Nothing special, but it works okay. Actually the image quality maybe is even better than a typical PAL or NTSC camera. There are other drawbacks - tiny microphone, and I can't zoom while recording or handle light changes. So it can't replace a real camera, but it's okay for some limited use cases. Last weekend there was a Balboa workshop in Munich, with excellent teachers. At the end of the days we recorded the teachers repeating the moves they tought us during the day. A perfect situation to use my camera: good lighting, no lighting changes, no zoom changing needed. These videos are quite big, due to the limited compression capabilities of the camera. (the video codec they used is MJPG, i.e. the camera just saves 30 jpg images per second). So I decided to recompress them. I tried transcode first, but it messed up the audio (which played back at double speed). Mencoder worked like a charm. Size savings of a factor of 8-12 are easily possible (well, depending on your camera, YMMV) without much tuning or serious loss in image quality. Here's the commandline I used:
mkdir out
for nam in *.avi; do
  mencoder "$nam" -ovc lavc -oac lavc -vf hqdn3d \
  -lavcopts acodec=mp3:abitrate=48:vb_strategy=1:vbitrate=600 \
  -o "out/$nam"
done
Notice that I also enabled a noise filter. Due to the nature of MJPEG, there is a certain amount of noise in dark areas, which I don't really care about. Filtering noise both improves compression and image quality IMHO. Depending on your video, of course. Here the dancers are well-lit, just the background isn't; I don't want to see noise in the background amplified by a compression trying to adopt to it. :-)

18 November 2006

Sven Mueller: CBDS and kittens

Steinar H. Gunderson wrote about CDBS once again, and I couldn’t agree more. CDBS introduces a lot of complexity for non-trivial packages, and it especially is basically undocumented. So what is CDBS’s value? For non-trivial packages, it is hard to use, since you basically need to decipher the CDBS code. For trivial packages however, it doesn’t add much value over dh_make. That’s actually sad: I like the general idea behind CDBS, but it is implemented badly IMHO. What it should do, if implemented right is to automate anything you want done on an easy package while providing and documenting (which includes consistently named hooks and options) all the interfaces needed to maintain non-trivial packages. Ideally, this would even include packages which need multiple build runs (like providing two differently configured versions of the same binary in two packages). But as said: It would need consistent names and proper documentation, and CDBS fails both currently. I however hope this improves in the future. Don’t ask me to work on this however, since personally, I’m quite happy using debhelper on my packages, since it is removing complexity (not typing work or lines of code) from debian/rules while keeping it obvious from that file what is done during a build. I would really like to see the reasoning from Erich on why he thinks CDBS is NMU-friendly, since I don’t get why he thinks so from his blog post.

17 November 2006

Erich Schubert: Apple spam

One more reason not to buy Apple: they spam. Yesterday and today I received Spam from "insideapple.apple.com". The same mail twice I think; and to the same old old email address. I can even trace back that they bought the email address from the old uni.de student portal site (which has since been sold or relaunched, I don't know). I unsubscribed yesterday, but received the same mail again today. Apple, thats NOT the way to go.

16 November 2006

Stefano Zacchiroli: cdbs relevance

/me on the Relevance of CDBS Whoa, people discussing about CDBS, I can't help joining them. My position: I love CDBS. I started switching my packages to CDBS an year ago or so and nowadays I've almost finished. I understand that people not knowing CDBS might have trouble fixing bugs in my packages, but that's life and it's the same as having to fix a bug in a software written in a programming language you are not fond of. It's just a matter of setting a minimal standard: today people in the NM have to learn debhelper, tomorrow they will have to learn CDBS too. I think it's worth the effort, because CDBS, if used extensively in our archive, has the benefit of providing a single place where to massively make changes to potentially all packages of the archive. That's a huge win for QA in Debian. The same does debhelper, but it only takes care of technical aspects in the packaging process while CDBS also takes care of behavioural aspects. Of course CDBS has drawbacks and nuisances (the available hooks for examples are not properly standardized nor documented IMO), but I think it's a step in the right direction. In Debian we should push more and more toward the possibility of making changes in a centralized/batch manner, so that when maintainers tend to get MIA we have a quick and easy way to take over their unfulfilled duties. Collaborative maintenance is a social step in that direction, CDBS is a technical one.

15 November 2006

Erich Schubert: Eclipse just doesn't work

Eclipse just doesn't work right for me. I'm so pissed by this crap... I've been following this tutorial (whoever had the idea to use screenshots for the actual code parts... ever heard of copy'n'paste?). At one point you need to add a class. A new class. Derived from Object. So I chose the menu option in Eclipse to, well, add a new class. After pressing "Next" in the wizard, eclipse froze, using 100% CPU. After killing and restarting eclipse, it had only created an empty file. But since I have to type in the data from the Tutorial anyway, ok. Next step in the tutorial: edit the faces-config.xml file with the faces-config editor. Sounds easy. I click on the file, open with, faces-config editor. Boom. First some content type error message is displayed, but the details actually list a NullPointerException:
java.lang.NullPointerException
    at org.eclipse.wst.sse.ui.StructuredTextEditor.update(StructuredTextEditor.java:3047)
    at org.eclipse.jst.jsf.facesconfig.ui.FacesConfigEditor.addPages(FacesConfigEditor.java:396)
    at org.eclipse.ui.forms.editor.FormEditor.createPages(FormEditor.java:142)
    at org.eclipse.ui.part.MultiPageEditorPart.createPartControl(MultiPageEditorPart.java:276)
    [... 40 more lines of backtrace ...]
Error handling in Java sucks, too. Usually you just get a 50 lines+ stack trace. [Update: deinstalling XML buddy resolved the last problem, and I could add a second class without another crash]

Next.

Previous.