Posts

Easy copy-pasting in X

Check what the clipboard contents are: xsel -b Put foo in the primary X selection: echo foo | xsel -p Copy the clipboard to the primary X selection: xsel -b | xsel -p This is just a hint on how to copy/paste between X programs that cannot agree on which X buffer to use. Say you have the xterm which uses the primary selection, and you have some silly java program program which only uses the clipboard. What do you do if middle click doesn't want to paste your console output. An ugly workaround is to fire some editor that supports both and keep pasting with one method and copying with the other before pasting in the final destination. Middle click in gvim to paste what you selected in your xterm, then select the text in gvim and copy it to the clipboard. Or, you can use xsel . The simple features of xsel are to put something in one of the selections (if there is anything coming on STDIN) or to output the content of a buffer. So, to put the primary (the one you get when you selec...

Fixing stupid mojibake Japanese forms

I just had a very hard time trying to change my address on the JAL Mileage Bank page. They still had my address from about 4 years ago which changed at least a couple of times since then. When I tried to change it I realized why. I submitted the form, properly filled with full-width characters (including the digits) and on the confirmation screen I get the same form filled with mojibake asking me to complete it correctly. You have guessed already - nothing I type in there would actually help. Firebug to the rescue! I opened the form in Firebug, added an enctype="multipart/form-data" to the form element and surprise, surprise - my input was accepted.

Console fonts with good looking Japanese and Cyrillic

Image
Finally! A set of fonts that look good and properly display Japanese and Cyrillic. That is, the Cyrillic is half-width as it is supposed to be. For Gentoo users the package is media-fonts/efont-unicode or there is the official page for everyone else. Some characters like the lowercase б and д are oddly designed but that's a very small price to pay for the pleasure of not having to mix and match different fonts in my terminal configuration. I wish I'd known that a little earlier.

Incredibly slow built-in SD card reader on Thinkpad x60

The built-in SD card reader on my Thinkpad x60 has been always giving me headaches. It works reliably well, but when copying files my system becomes very unresponsive. The mouse is jerky and the CPU usage jumps through the roof. Obviously, DMA is not being used. I couldn't find much about it for a while but just today, when I included the chip id R5C822 of the reader in the search I found this thread . However, instead of patching the source itself, it is quite easy to force the quirk when loading the sdhci module. Put the following in modprobe.conf or /etc/modprobe.d/local.conf and everything will be fine after you reboot. options sdhci debug_quirks=2 You can also reload the module to check if it is fine even now. umount any SD cards that you have mounted modprobe -r sdhci-pci modprobe -r sdhci modprobe sdhci-pci That's all folks. Enjoy a true multitasking Linux.

grub2 cannot read core.img

When trying to install grub2 (whatever snapshot was current as of today) I kept getting the following error: $ sudo /sbin/grub-setup -v --directory=/media/sysrescd/boot/grub \ --device-map=/media/sysrescd/boot/grub/device.map -r '(hd1,1)' '(hd1)' .... snip ... grub-setup: error: Cannot read `/media/sysrescd/boot/grub/core.img' correctly The error was not very descriptive because grub was apparently able to read other important files like boot.img and such. The filesystem on my USB stick was identical (feature wise) to the /boot on my HDD -- ext2. And the same command worked just fine for installing to my hard disk. Digging through the code revealed where the problem is. The error was caused by grub-setup being unable to embed core.img in the MBR. The core.img prepared by grub-mkimage was 25k big. That is about 50 sectors. The first partition on my hard disk starts on sector 63. The first partition on my USB stick was starting on sector 32 (or was it 31?). 32 <...

Bloody OpenBSD syslogd

I spent quite some time today trying to figure out why, oh why, syslogd doesn't want to log to a remote log host. The config file on the machine was identical to that on other machines that worked just fine. Long story made short, that particular version on that particular system didn't like having an IP address after that @ sign. A hostname worked fine. The syslog on our other redhat machines didn't care. I don't know what the reason is yet. Could it be that syslog works the same way on both machines and just does a gethostbyname on whatever is after the @ sign, and glibc gives an answer for the IP address while libc on BSD does not? Whatever the reason, bloody syslogd should at least log an error somewhere. Or a warning. Or whatever.

Switching to Gnome

Me, a long-term Windowmaker user, recently switched to Gnome. There main reason is that I had wanted to drop Windowmaker for a while now. There has been no development for a while now and I don't really like the fonts or the lack of themability of window borders and such. I decided to give Gnome a try because I've always liked the appearance of Gtk applications and a full Gnome desktop can run without having to run a zillion processes in the background. I have looked at KDE but it just doesn't feel right. One feature I really liked in Gnome was the automounting of removable media. It didn't work smoothly because there are a few prerequisites: Your user must be in the plugdev group You must not have an entry for the device in /etc/fstab The last one is mostly speculation, but when I removed the lines in /etc/fstab (leftovers from the windowmaker era) it all started working. I still prefer the Windowmaker style Alt+<Right Click and Drag> to resize a window. With...