Odi's astoundingly incomplete notes
New entriesCode
back | nextmysql-5.1 and amarok conflict in Gentoo
With mysql-5.1 being unmasked now, your favourite Gentoo system will want to upgrade when you
emerge -uD world. Unfortunately this will conflict with amarok when using the embedded USE flag. The reason is that mysql-5.1 doesn't support embedded really yet. You have two options:- If you don't have to upgrade to 5.1, stick with 5.0. So simply add
=virtual/mysql-5.1
to/etc/portage/package.mask - If you really want 5.1, then the
embeddedUSE flag ofamarokcan't be used. Remove the embedded USE flag and re-emerge amarok. Then upgrade mysql. Connect Amarok to the MySql server and rebuild your collection.
Add comment
bluez pairing with Apple wireless keyboard
The new-style bluez utilities are a bit different than the old ones. Here is how to pair an Apple Wireless Keyboard with the command line utilities only:
You need two (SSH) shells. In the first one run
Remove and reinsert the batteries from the keyboard. Turn the keyboard on. The light should be flashing.
In the second shell do:
Type a PIN (any four numbers) followed by Enter on the keyboard. Enter the PIN into the simple-agent shell when prompted.
You need two (SSH) shells. In the first one run
simple-agent and answer yes to any upcoming authorization requests.Remove and reinsert the batteries from the keyboard. Turn the keyboard on. The light should be flashing.
In the second shell do:
hcitool scan
Scanning ...
11:22:33:44:55:66 Apple Wireless Keyboard
hcitool cc 11:22:33:44:55:66
hcitool auth 11:22:33:44:55:66
Type a PIN (any four numbers) followed by Enter on the keyboard. Enter the PIN into the simple-agent shell when prompted.
Gentoo: hal broken after glib upgrade?
If hald seems not to properly startup after a glib upgrade, make sure to re-emerge dbus-glib. See forum.
Why you never develop on a branch
I always tell my fellow coders: never develop new features on a branch.
By branch I mean a stable release CVS branch. That is usually a bit "old". HEAD is quite volatile. New concepts are introduced, old ones removed. Refactoring occurs on the HEAD.
So if you start to build something on the old branch and then port it to HEAD, your code may be based on old/deprecated concepts and will fail to support new features correctly.
Another factor is human errors: forgetting to port a patch between branches. If you develop on the branch, your customer is happy. But in the next release he will be unhappy when he notices that a change has been lost. If you develop on the HEAD you get immediate feedback from a customer when you forget to backport a change.
In general it's easier to write the code for HEAD and then backport it to the branch world. Also the backport should happen gradually and not as a big bang.
By branch I mean a stable release CVS branch. That is usually a bit "old". HEAD is quite volatile. New concepts are introduced, old ones removed. Refactoring occurs on the HEAD.
So if you start to build something on the old branch and then port it to HEAD, your code may be based on old/deprecated concepts and will fail to support new features correctly.
Another factor is human errors: forgetting to port a patch between branches. If you develop on the branch, your customer is happy. But in the next release he will be unhappy when he notices that a change has been lost. If you develop on the HEAD you get immediate feedback from a customer when you forget to backport a change.
In general it's easier to write the code for HEAD and then backport it to the branch world. Also the backport should happen gradually and not as a big bang.
Excel CSV WTF
ata failed command: FLUSH CACHE
I got bitten by this problem in a 2.6.31 and .32 Linux kernel:
The machine is a media PC with an nVidia Corporation nForce2 chipset. Two IDE disks are attached to the PATA bus and running as md RAID-1 volumes. The disks are really old and may not be the best quality (thus the RAID-1...).
There is a patch that may actually address exactly this problem, by simply retrying the command.The patch is in 2.6.34 and will be in 2.6.33.4 and 2.6.32.13.
Apr 28 16:21:53 kernel: ata2.00: exception Emask 0x0 SAct 0x0 SErr 0x0 action 0x6 frozen
Apr 28 16:21:53 kernel: ata2.00: failed command: FLUSH CACHE
Apr 28 16:21:53 kernel: ata2.00: cmd e7/00:00:00:00:00/00:00:00:00:00/a0tag 0
Apr 28 16:21:53 kernel: res 40/00:01:00:00:00/00:00:00:00:00/a0 Emask 0x4 (timeout)
Apr 28 16:21:53 kernel: ata2.00: status: { DRDY }
Apr 28 16:21:55 kernel: ata2: soft resetting link
Apr 28 16:21:55 kernel: ata2: soft resetting link
Apr 28 16:21:55 kernel: ata2: nv_mode_filter: 0x3f39f&0x3f39f->0x3f39f, BIOS=0x3f000 (0xc700c6c0) ACPI=0x3f01f (20:60:0x1f)
Apr 28 16:21:55 kernel: ata2: nv_mode_filter: 0x739f&0x739f->0x739f, BIOS=0x7000 (0xc700c6c0) ACPI=0x701f (20:60:0x1f)
Apr 28 16:21:55 kernel: ata2.00: configured for UDMA/100
Apr 28 16:21:55 kernel: ata2.00: configured for UDMA/100
Apr 28 16:21:55 kernel: ata2.01: configured for UDMA/33
Apr 28 16:21:55 kernel: ata2.01: configured for UDMA/33
Apr 28 16:21:55 kernel: ata2.00: device reported invalid CHS sector 0
Apr 28 16:21:55 kernel: ata2.00: device reported invalid CHS sector 0
Apr 28 16:21:55 kernel: end_request: I/O error, dev sdb, sector 58604962
Apr 28 16:21:55 kernel: md: super_written gets error=-5, uptodate=0
Apr 28 16:21:55 kernel: md: super_written gets error=-5, uptodate=0
Apr 28 16:21:55 kernel: raid1: Disk failure on sdb3, disabling device.
Apr 28 16:21:55 kernel: raid1: Operation continuing on 1 devices.
Apr 28 16:21:55 kernel: ata2: EH complete
Apr 28 16:21:55 kernel: ata2: EH complete
Apr 28 16:21:55 kernel: RAID1 conf printout:
Apr 28 16:21:55 kernel: RAID1 conf printout:
Apr 28 16:21:55 kernel: --- wd:1 rd:2
Apr 28 16:21:55 kernel: --- wd:1 rd:2
Apr 28 16:21:55 kernel: disk 0, wo:0, o:1, dev:sda3
Apr 28 16:21:55 kernel: disk 0, wo:0, o:1, dev:sda3
Apr 28 16:21:55 kernel: disk 1, wo:1, o:0, dev:sdb3
Apr 28 16:21:55 kernel: disk 1, wo:1, o:0, dev:sdb3
Apr 28 16:21:55 kernel: RAID1 conf printout:
Apr 28 16:21:55 kernel: RAID1 conf printout:
Apr 28 16:21:55 kernel: --- wd:1 rd:2
Apr 28 16:21:55 kernel: --- wd:1 rd:2
Apr 28 16:21:55 kernel: disk 0, wo:0, o:1, dev:sda3
Apr 28 16:21:55 kernel: disk 0, wo:0, o:1, dev:sda3
Apr 28 16:21:55 mdadm[5734]: Fail event detected on md device /dev/md1, component device /dev/sdb3
Apparently a cache flush timed out. This leads to a failure of the RAID and the disk goes offline. Just removing and re-adding it with mdadm of course fixes the RAID again. But it occurred a couple of times and is annoying.The machine is a media PC with an nVidia Corporation nForce2 chipset. Two IDE disks are attached to the PATA bus and running as md RAID-1 volumes. The disks are really old and may not be the best quality (thus the RAID-1...).
There is a patch that may actually address exactly this problem, by simply retrying the command.The patch is in 2.6.34 and will be in 2.6.33.4 and 2.6.32.13.
WS implementors
Next time you implement a webservice framework, please:
- make it difficult to produce invalid SOAP messages. Your generated SOAP messages should conform to the schema and mapping in the WSDL.
- make sure you escape XML correctly. Use an XML infrastructure, not string operations.
- support all features of XML schema, not just a subset
- make sure you handle namespaces correctly
- make sure you handle nil, empty elements and optional elements correctly and in a simple way for the user
- certain attributes in schema definitions have standardized defaults. Make sure you use them in the absence of these attributes.
- make sure you handle timezones in dates/times correctly
- generate code from WSDL. Never generate WSDL.
- issue useful error messages from your utilities instead of just crashing
- make the generated code look nice.
- use the documentation from the WSDL as API doc.
- make the generated code useful for a programmer
- don't try to hide something behind a mapping infrastructure. Someone will have to go down and do the dirty work one way or another. A mapping file is not better than code.
- give the programmer also access to the raw SOAP message. Preferably both as string and parse tree
- make message logging simple and let the programmer choose to log it in any other way
- east shit, poo gold
- if you fail to do that, don't call your product WS-capable. You can just as well use a proprietary binary protocol because your broken WS implementation will never be able interact with the real world.
Jack ok, but PulseAudio?
I heard a lot about PulseAudio. I have used Jack. I read Lennart's post about PulseAudio and Jack. Still I don't see why I "need" PulseAudio. I have never used it. And I am not missing a thing. Audio comes out of my Gentoo box just fine using plain ALSA. No KDE phonon. No arts. No esd. Just ALSA. So what's the point of having PulseAudio altogether? Maybe you can enlighten me.
Notes from readers, my comments appended:
Notes from readers, my comments appended:
- per application volume control: but you don't need PulseAudio for that. Applications are doing that fine without it.
- sane volume control (ALSA presents lots of sliders, most of them doing nothing): okay. I like the volume control on a Mac: there is a single control, period. Like on your stereo. Big round knob.
- seamless switching between different audio devices (think speaker -> bluetooth headset): okay. Fine for me, I have internal laptop speakers, and headphones.
- mixing audio in userspace where it belongs: whatever, that is a purely academic problem.
- and most important: fixing long-standing bugs in some ALSA drivers: what? when your car is broken, you buy a horse?
- sound over a network: okay, I can see uses for that in VMs and media servers. Again I have no use for it.
- per application volume control
- sane volume control (ALSA presents lots of sliders, most of them doing nothing)
- seamless switching between different audio devices (think speaker -> bluetooth headset)
- mixing audio in userspace where it belongs
and most important: - fixing long-standing bugs in some ALSA drivers...
- sane volume control (ALSA presents lots of sliders, most of them doing nothing)
- seamless switching between different audio devices (think speaker -> bluetooth headset)
- mixing audio in userspace where it belongs
and most important: - fixing long-standing bugs in some ALSA drivers...
- sound over a network
for example, PulseAudio help me to fix problem with flash plugin - there was no sound on my debian unstable.
No URL alias in Tomcat?
Is there seriously no way to create an arbitrary (i.e. cross-context) alias for an URL in Tomcat? I don't want a HTTP redirect, I don't want inefficient reverse-proxying, I don't care about cookie security (as cookies are not used), I don't want HTTPD in front. Just a simple stupid alias. That is the alias URL calls the same servlet code as the aliased URL. Also known as URL rewriting.
I want: http://localhost:8080/old-service -> http://localhost:8080/axis/services/new-service
Filters and not even Valves can do that, because implementations must not "change request properties that have already been used to direct the flow of processing control for this request". Seriously? 2010?
Reason: I have a webservice that has been migrated to a completely different infrastructure, and thus a different context. The clients should not need to be changed. And the clients don't support redirects.
I want: http://localhost:8080/old-service -> http://localhost:8080/axis/services/new-service
Filters and not even Valves can do that, because implementations must not "change request properties that have already been used to direct the flow of processing control for this request". Seriously? 2010?
Reason: I have a webservice that has been migrated to a completely different infrastructure, and thus a different context. The clients should not need to be changed. And the clients don't support redirects.
Why not run Tomcat in Apache 2.0 and then you can do your aliasing from Apache 2.0... ref aliasing in tomcat, I'm not sure on that (I assume from your rant that it isn't possible).
Best regards
Steve
Best regards
Steve
Change java process name
at least under Linux you can do that painlessly from bash:
And if you don't want to replace the current shell, execute it in a subshell by using parantheses:
back
|
next
exec -a myapp java com.example.MyAppAnd if you don't want to replace the current shell, execute it in a subshell by using parantheses:
(exec -a myapp java com.example.MyApp)