From: Roland Hieber Date: Thu, 19 Sep 2013 05:04:01 +0000 (+0200) Subject: blag: convert (and slightly improve) blogposts from rohieb.wordpress.org X-Git-Url: https://git.rohieb.name/www-rohieb-name.git/commitdiff_plain/73e39f64a32cdae99744de147a3d7002a461dbc4 blag: convert (and slightly improve) blogposts from rohieb.wordpress.org --- diff --git a/blag/post/af9015-bulk-message-failed-switch-usb-ports.mdwn b/blag/post/af9015-bulk-message-failed-switch-usb-ports.mdwn new file mode 100644 index 0000000..489061f --- /dev/null +++ b/blag/post/af9015-bulk-message-failed-switch-usb-ports.mdwn @@ -0,0 +1,46 @@ +[[!meta title="af9015 bulk message failed: Switch USB Ports?"]] +[[!meta date="2009-08-24 01:00"]] +[[!meta author="rohieb"]] +[[!meta license="CC-BY-SA 3.0"]] + +Yesterday, I suddenly wasn’t able to use my AF9015-based DVB-T USB stick +anymore. It only worked for about a minute, then the image froze and +`dmesg` said the following: + + [10633.166371] usb 1-3: USB disconnect, address 5 + [10633.186247] af9015: bulk message failed:-22 (8/-339951920) + [10633.186254] af9013: I2C read failed reg:d417 + [10633.186258] af9015: bulk message failed:-22 (8/-1067461161) + [10633.186265] af9013: I2C read failed reg:d417 + [10633.186279] af9015: bulk message failed:-22 (9/-339951284) + [10633.186282] mt2060 I2C write failed + +I was not even able to `rmmod` the dvb-usb-af9015 kernel module, the +rmmod process just hung itself up. + +After two hours of compiling a new driver version, experimenting with +kernel parameters and getting a new [firmware +version](http://www.otit.fi/~crope/v4l-dvb/af9015/af9015_firmware_cutter/firmware_files/4.95.0/), +I finally booted into my rarely used Windows system. The first thing I +saw was the “USB 2.0 device on USB 1.1 bus”, and as I also could not get +a movie stream, I tried to plug the DVB-T stick into a different USB +port. And voilà, suddenly everything worked again, as well on Windows as +later on Linux. No more error messages in the kernel log, everything +just fine as before. + +But I wonder if I have been using this USB port before — as far as I can +remember, the DVB-T stick had always been on the other port… Yet another +proof for me to never trust yourself :D + +**Update:** Unfortunately, this solution did not help for long. After +about two weeks, the error is still there, and also occurs more +frequently, near to once an evening (until I reboot). So maybe, it +hasn’t even to do with switching USB ports, and my hardware is beginning +to fail… :( + +**Update:** Seems it is fixed now, using revision dca0fed8d68b (Sat Sep +26 19:27:52 2009 +0200) of +[anttip’s](http://linuxtv.org/hg/~anttip/af9015) repository. At least it +worked for over 4 hours now :-) + +[[!tag AF9015 driver DVB-T USB Linux Ubuntu]] diff --git a/blag/post/bluetooth-tethering-via-pan-with-windows-mobile-and-ubuntu.mdwn b/blag/post/bluetooth-tethering-via-pan-with-windows-mobile-and-ubuntu.mdwn new file mode 100644 index 0000000..0157fef --- /dev/null +++ b/blag/post/bluetooth-tethering-via-pan-with-windows-mobile-and-ubuntu.mdwn @@ -0,0 +1,100 @@ +[[!meta title="Bluetooth tethering via PAN with Windows Mobile and Ubuntu"]] +[[!meta date="2010-11-08"]] +[[!meta author="rohieb"]] +[[!meta license="CC-BY-SA 3.0"]] +[[!img defaults size=x200]] + +I was on the train today, needed some of the [Boost][0] manuals, and had +no internet connection. So I wanted to use my phone (an old HTC Prophet +with Windows Mobile 6.1) as a network access point to browse over +GPRS/EDGE. As I found out, it is fairly simple with [Blueman][1] and it +even provides [NetworkManager][2] integration, so all +NetworkManager-capable applications can be notified about the +connectivity. Windows Mobile 6.1 allows tethering over a Bluetooth PAN +([Personal Area Network][3]); but there is another method called DUN +([Dial Up Networking][4]), which I will not describe here. So here is a +step-by-step tutorial what I did for my PAN approach, with a few +(german) screenshots, tested on Ubuntu 10.04 Lucid: + +* Since my laptop was running on Ubuntu Lucid, there was already a + recent Blueman version in the Ubuntu repos available. On older + systems, you may want to add the [Blueman Launchpad PPA][5]. + + $ sudo apt-add-repository ppa:blueman/ppa # only necessary on pre-lucid systems + $ sudo aptitude update + $ sudo aptitude install blueman + +* Note that this also removes possibly installed `gnome-bluetooth` + packages since Blueman is an adequate replacement for the GNOME + Bluetooth UI. + +* After the installation has finished, I had to enable the NMPANSupport + plugin for NetworkManager 0.8 by right-clicking on the Blueman icon in + the GNOME notification area and selecting “Plugins”. For older + NetworkManager versions, there is also a plugin for NetworkManager + 0.7, called NMIntegration. + + + +* Then I activated tethering on my phone (“Programs” → “Internet + Sharing” on my Windows Mobile 6.1, but YMMV). Apparently this was + neccesary with my model, because without tethering enabled I could not + get a Bluetooth PAN connection in the next step. + + + +* I paired the phone and my laptop via Bluetooth, and created a PAN + (Personal Area Network) by connecting to the “Network Access Point” + service on the phone. In Blueman, all you have to do after pairing is + right-click on the device and select “Connect To: Network Access + Point”. This creates a new network device `bnep0` which is + automagically configured through NetworkManager (using [stateless + address autoconfiguration][6]). + + + + (Yes, my phone is called [Leia][7]… I also have a yet another HTC + Prophet for testing purposes, which is called [Luke][8] :-)) + +* However, in my setup, though I was able to ping certain IP adresses on + the internet, DNS lookups timed out for some reason. It got better + when I explicitly set an IP address for the Bluetooth PAN driver on my + phone, and did the tethering process all over again. + + + +* And off I went with mobile internet access. Woo-hoo! \o/ + +I may also add that the NetUsage plugin in Blueman is very reasonable to +use ;-) After activated, the network usage can be viewed by +right-clicking on the Blueman icon and selecting “Network Usage”. + +[0]: http://www.boost.org/ +[1]: https://launchpad.net/blueman +[2]: http://projects.gnome.org/NetworkManager/ +[3]: http://en.wikipedia.org/wiki/Personal_area_network +[4]: http://en.wikipedia.org/wiki/Bluetooth_profile#Dial-up_Networking_Profile_.28DUN.29 +[5]: https://launchpad.net/~blueman/+archive/ppa +[6]: http://en.wikipedia.org/wiki/Link-local%20address +[7]: http://en.wikipedia.org/wiki/Leia_Skywalker +[8]: http://en.wikipedia.org/wiki/Luke_Skywalker + +[[!tag Blueman bluetooth mobile_internet_access network NetworkManager + Ubuntu Ubuntu_Lucid Windows_Mobile]] diff --git a/blag/post/bluetooth-tethering-via-pan-with-windows-mobile-and-ubuntu/blueman-menu.png b/blag/post/bluetooth-tethering-via-pan-with-windows-mobile-and-ubuntu/blueman-menu.png new file mode 100644 index 0000000..f457530 Binary files /dev/null and b/blag/post/bluetooth-tethering-via-pan-with-windows-mobile-and-ubuntu/blueman-menu.png differ diff --git a/blag/post/bluetooth-tethering-via-pan-with-windows-mobile-and-ubuntu/blueman-pan.png b/blag/post/bluetooth-tethering-via-pan-with-windows-mobile-and-ubuntu/blueman-pan.png new file mode 100644 index 0000000..50b879a Binary files /dev/null and b/blag/post/bluetooth-tethering-via-pan-with-windows-mobile-and-ubuntu/blueman-pan.png differ diff --git a/blag/post/bluetooth-tethering-via-pan-with-windows-mobile-and-ubuntu/blueman-plugins.png b/blag/post/bluetooth-tethering-via-pan-with-windows-mobile-and-ubuntu/blueman-plugins.png new file mode 100644 index 0000000..7571504 Binary files /dev/null and b/blag/post/bluetooth-tethering-via-pan-with-windows-mobile-and-ubuntu/blueman-plugins.png differ diff --git a/blag/post/bluetooth-tethering-via-pan-with-windows-mobile-and-ubuntu/winmo-bluetooth-ip.png b/blag/post/bluetooth-tethering-via-pan-with-windows-mobile-and-ubuntu/winmo-bluetooth-ip.png new file mode 100644 index 0000000..7c9fcc1 Binary files /dev/null and b/blag/post/bluetooth-tethering-via-pan-with-windows-mobile-and-ubuntu/winmo-bluetooth-ip.png differ diff --git a/blag/post/bluetooth-tethering-via-pan-with-windows-mobile-and-ubuntu/winmo-connection-sharing.png b/blag/post/bluetooth-tethering-via-pan-with-windows-mobile-and-ubuntu/winmo-connection-sharing.png new file mode 100644 index 0000000..0dd5f9b Binary files /dev/null and b/blag/post/bluetooth-tethering-via-pan-with-windows-mobile-and-ubuntu/winmo-connection-sharing.png differ diff --git a/blag/post/bluetooth-tethering-via-pan-with-windows-mobile-and-ubuntu/winmo-connections.png b/blag/post/bluetooth-tethering-via-pan-with-windows-mobile-and-ubuntu/winmo-connections.png new file mode 100644 index 0000000..aabac50 Binary files /dev/null and b/blag/post/bluetooth-tethering-via-pan-with-windows-mobile-and-ubuntu/winmo-connections.png differ diff --git a/blag/post/bluetooth-tethering-via-pan-with-windows-mobile-and-ubuntu/winmo-networkdrivers.png b/blag/post/bluetooth-tethering-via-pan-with-windows-mobile-and-ubuntu/winmo-networkdrivers.png new file mode 100644 index 0000000..8f94d5c Binary files /dev/null and b/blag/post/bluetooth-tethering-via-pan-with-windows-mobile-and-ubuntu/winmo-networkdrivers.png differ diff --git a/blag/post/bluetooth-tethering-via-pan-with-windows-mobile-and-ubuntu/winmo-program-menu.png b/blag/post/bluetooth-tethering-via-pan-with-windows-mobile-and-ubuntu/winmo-program-menu.png new file mode 100644 index 0000000..525fb1e Binary files /dev/null and b/blag/post/bluetooth-tethering-via-pan-with-windows-mobile-and-ubuntu/winmo-program-menu.png differ diff --git a/blag/post/change-partition-type-without-reformatting.mdwn b/blag/post/change-partition-type-without-reformatting.mdwn new file mode 100644 index 0000000..5915e60 --- /dev/null +++ b/blag/post/change-partition-type-without-reformatting.mdwn @@ -0,0 +1,25 @@ +[[!meta title="Change partition type without reformatting"]] +[[!meta date="2011-01-02 17:29"]] +[[!meta author="rohieb"]] +[[!meta license="CC-BY-SA 3.0"]] + +Note to myself: it is possible to change the partition type of a already +formatted (and used) partition. For example, if you have already +formatted the partition with NTFS, but accidentally had created it with +partition type `0x83` (Linux), so Windows can’t read it, since it expects +`0x07` (HPFS/NTFS). On Linux, you can use sfdisk for that purpose: + + # Be root + # dd if=/dev/sdb of=sdb-bootsector count=1 # backup boot sector + # sfdisk -d /dev/sdb | sed -e 's/Id=83/Id=07/' > /tmp/sdb.txt + # sfdisk /dev/sdb < /tmp/sdb.txt + +(fill in the right values for your case) + +Of course, good old fdisk works also, use the `t` command. + +[(Source)](http://serverfault.com/questions/46758/can-you-change-the-partition-type-on-a-linux-server-without-starting-up-fdisk/46840#46840) + +[[!tag hacking howto useless_bits_of_information fdisk Linux + Master_Boot_Record NTFS partition partition_table partition_type + sfdisk]] diff --git a/blag/post/dell-latitude-e5500-and-magic-sysrq.mdwn b/blag/post/dell-latitude-e5500-and-magic-sysrq.mdwn new file mode 100644 index 0000000..96a56c5 --- /dev/null +++ b/blag/post/dell-latitude-e5500-and-magic-sysrq.mdwn @@ -0,0 +1,21 @@ +[[!meta title="Dell Latitude E5500 and Magic SysRq"]] +[[!meta date="2009-11-17"]] +[[!meta author="rohieb"]] +[[!meta license="CC-BY-SA 3.0"]] + +At work I’m using the Dell Latidude E5500 notebook, running on Debian +testing. Today, I had some issues with Xorg which could not detect my +keyboard and mouse, so I tried to do the Magic SysRq tricks (you can +read about it at [Wikipedia][1]). Unfortunatley, to press `SysRq` (on +`F10`), I had to use the `Fn` key, so if I pressed e. g. +`Alt`+`Fn`+`SysRq`+`U`, the `U` was detected as `keypad 4` because of +the `Fn` key. Luckily, it works as intended if you release the `Fn` key +after having pressed `Fn`+`SysRq`, so to remount all mounted filesystems +in read-only mode, you would actually hold `Alt`, hold `Fn`, hold +`SysRq`, release `Fn`, press `U`. + +Never thought notebook keyboards were so smart :-) + +[1]: (http://en.wikipedia.org/wiki/Magic_SysRq) + +[[!tag Debian howto Debian_testing Dell_Latitude Linux SysRq]] diff --git a/blag/post/flattr-me.mdwn b/blag/post/flattr-me.mdwn new file mode 100644 index 0000000..9ef5824 --- /dev/null +++ b/blag/post/flattr-me.mdwn @@ -0,0 +1,36 @@ +[[!meta title="Flattr me!"]] +[[!meta date="2010-11-14 15:55"]] +[[!meta author="rohieb"]] +[[!meta license="CC-BY-SA 3.0"]] +[[!flattrthing id=83947]] + +Some of you may have noticed that I have put Flattr buttons below my +posts. For those who are not familiar with Flattr: It is a micropayment +service which allows you to show your appreciation for (free) content by +making small donations to its author. Basically it works by spending +only a fixed (but adjustable) amount of money per month, so you don’t +have to worry about how much you can afford; and clicking Flattr buttons +for things you like. At the end of the month, the money you decided to +spend is divided by the number of Flattr buttons you clicked in this +month, and the fractions are given to the respective authors. So if +you decide to spend $4 each month, and you click four Flattr buttons +of four different authors, every author gets $1. There is also a +nice video on the [Flattr homepage][0] that explains the idea: + +[0]: http://flattr.com/ + + + +So, from now on, if you like, you can flattr me. Just sign up on +flattr.com and click the buttons below each post :-) + +<commercial /> + +**Note:** The standard +click-on-the-fly-and-show-how-many-users-have-flattrd-this button needs +JavaScript, which is bad and takes away your privacy, so I only use the +static button which directs you to the thing on the flattr site. + +[[!tag Flattr micropayment video]] diff --git a/blag/post/gnu-screen-start-with-multiple-windows-and-commands.mdwn b/blag/post/gnu-screen-start-with-multiple-windows-and-commands.mdwn new file mode 100644 index 0000000..b0b8466 --- /dev/null +++ b/blag/post/gnu-screen-start-with-multiple-windows-and-commands.mdwn @@ -0,0 +1,34 @@ +[[!meta title="GNU screen: start with multiple windows and commands"]] +[[!meta date="2010-07-30"]] +[[!meta author="rohieb"]] +[[!meta license="CC-BY-SA 3.0"]] + +I wanted to restart my IRC bot on reboot, but I also wanted to have +control over it and see its log output, so I wanted to start it inside a +`screen` session. This is nearly trivial, `screen -dmS yoursessionname +yourcommand` is your friend, and you can later on reattach using `screen +-r yoursessionname`. + +But what if I want to start multiple commands, each in its own screen +window? My first solution used `screen -dmS` followed by something like +`screen -r sessionname -X screen; screen -r sessionname -X next; screen +-r sessionname -X title "my window title"; screen -r sessionname -X exec +"my command line"`, but it seems that the `next` command fails in this +context, and I ended up with all the mess in one single window. + +My next approach (okay, it took me half an hour of reading [the +manual][0] until here ;-)) was more succesful: I created a session +command file which contained screen commands like this: + + screen + select 1 + title "my window title" + exec mycommand arguments ... + +[0]: http://www.gnu.org/software/screen/manual/ + +And, voilà, I could paste the single command line into my crontab: +`screen -dmS sessionname && screen -r sessionname -X source +sessioncommandfile` + +[[!tag hacking howto cron GNU screen]] diff --git a/blag/post/google-earth-and-ipv6-dns-lookups.mdwn b/blag/post/google-earth-and-ipv6-dns-lookups.mdwn new file mode 100644 index 0000000..b5f1df8 --- /dev/null +++ b/blag/post/google-earth-and-ipv6-dns-lookups.mdwn @@ -0,0 +1,35 @@ +[[!meta title="Google Earth and IPv6 DNS lookups"]] +[[!meta date="2011-01-22 13:02"]] +[[!meta author="rohieb"]] +[[!meta license="CC-BY-SA 3.0"]] + +Apparently the combination of a WLAN router that blocks IPv6 DNS queries +of type `AAAA` (in my case, it was a Siemens S1621-Z220-A sold as [Alice +Modem 1121 WLAN][0]) and the current version of Google Earth for Linux (I am +using 5.1.3533.1731 from [Medibuntu][1]) do not work well together. The +problem is that the router simply throws away `AAAA` queries (or +generally, any type it does not know), so the DNS query times out. +However, Google Earth does not seem to fall back to IPv4 queries (type +`A`) in this case, and shows a message about network connectivity errors. +I don’t know if it’s Google Earth’s fault or if the underlying eglibc +resolver of my Linux system does something wrong, anyhow there is a +fairly well-commented [bug report][2] on Launchpad for Ubuntu Karmic and +Lucid which explains the issue. + +Anyway, I got rid of the problem by manually configuring a nameserver on +my local machine (for example the nameserver(s) of your internet +provider, or the ones of OpenDNS), and not using the WLAN router as a +resolver. NetworkManager allows you to do this by editing a connection +and choosing “Automatic DHCP (Addresses only)” on the IPv4 register tab; +or you can write the settings directly to your `/etc/resolv.conf` (here +for the OpenDNS servers): + + nameserver 208.67.222.222 + nameserver 208.67.220.220 + +[0]: http://www.alice-wiki.de/Alice_Modem_1121_WLAN +[1]: http://www.medibuntu.org/ +[2]: https://bugs.launchpad.net/ubuntu/+source/eglibc/+bug/417757 + +[[!tag Ubuntu workaround Alice_DSL DNS eglibc Google_Earth HanseNet IPv4 + IPv6 Ubuntu_Karmic Ubuntu_Lucid]] diff --git a/blag/post/greetings-from-gnome.mdwn b/blag/post/greetings-from-gnome.mdwn new file mode 100644 index 0000000..87e3997 --- /dev/null +++ b/blag/post/greetings-from-gnome.mdwn @@ -0,0 +1,16 @@ +[[!meta title="Greetings from GNOME"]] +[[!meta date="2009-12-27"]] +[[!meta author="rohieb"]] +[[!meta license="CC-BY-SA 3.0"]] + +Now this is really useful: there is a [GNOME panel applet][1] for +writing blog posts (for the Debian/Ubuntu folks: it’s in the package +`gnome-blog`). Just gotta try it out :-) + +**Edit:** Unfortunately, there is no possibility to assign tags or +categories this way :-( + +[1]: http://www.gnome.org/~seth/gnome-blog/ + +[[!tag Debian Ubuntu useless_bits_of_information applet blog desktop + GNOME Linux]] diff --git a/blag/post/hello-world.mdwn b/blag/post/hello-world.mdwn new file mode 100644 index 0000000..ef8f3ab --- /dev/null +++ b/blag/post/hello-world.mdwn @@ -0,0 +1,9 @@ +[[!meta title="Hello World!"]] +[[!meta date="2009-08-24"]] +[[!meta author="rohieb"]] +[[!meta license="CC-BY-SA 3.0"]] + +Yeah. So this is my new blog. I thought, it would be a nice place to +collect various bits of information that I noticed during my work that +could be useful to other people too (as well as me, having a head like a +sieve). So enjoy it, if you like! diff --git a/blag/post/kaffeine-0-8-7-in-ubuntu-karmic.mdwn b/blag/post/kaffeine-0-8-7-in-ubuntu-karmic.mdwn new file mode 100644 index 0000000..7a88db8 --- /dev/null +++ b/blag/post/kaffeine-0-8-7-in-ubuntu-karmic.mdwn @@ -0,0 +1,13 @@ +[[!meta title="Kaffeine 0.8.7 in Ubuntu Karmic"]] +[[!meta date="2010-03-07"]] +[[!meta author="rohieb"]] +[[!meta license="CC-BY-SA 3.0"]] + +As I [[recently mentioned|ubuntu-karmic-upgrade-issues]], Kaffeine in +Ubuntu Karmic is the (nearly) unusable version 1.0~pre2. I have +backported the Jaunty version 0.8.7 to Karmic and put it into my +[Launchpad PPA][1]. + +[1]: https://launchpad.net/~rohieb/+archive/kaffeine-0.8 + +[[!tag backport Kaffeine Ubuntu Ubuntu_Karmic]] diff --git a/blag/post/libdvdread-and-iso-9660-file-systems.mdwn b/blag/post/libdvdread-and-iso-9660-file-systems.mdwn new file mode 100644 index 0000000..6232122 --- /dev/null +++ b/blag/post/libdvdread-and-iso-9660-file-systems.mdwn @@ -0,0 +1,22 @@ +[[!meta title="libdvdread and ISO 9660 file systems"]] +[[!meta date="2011-03-03 22:33"]] +[[!meta author="rohieb"]] +[[!meta license="CC-BY-SA 3.0"]] + +Apparently libdvdread only works with UDF file systems. I tried to point +VLC to an ISO 9660 image file, but libdvdread only complained: + + $ vlc dvd://foo.iso + libdvdread: Using libdvdcss version 1.2.10 for DVD access + libdvdnav:DVDOpenFileUDF:UDFFindFile /VIDEO_TS/VIDEO_TS.IFO failed + libdvdnav:DVDOpenFileUDF:UDFFindFile /VIDEO_TS/VIDEO_TS.BUP failed + libdvdread: Can't open file VIDEO_TS.IFO. + $ file foo.iso + foo.iso: # ISO 9660 CD-ROM filesystem data 'CDROM + +However, after I extracted the image file to a folder, everything went +as expected. (Of course also with an image file containing an UDF file +system :-)) + +[[!tag useless_bits_of_information debugging DVD ISO9660 libdvdread UDF + vlc]] diff --git a/blag/post/netcat-your-friendly-network-sniffer.mdwn b/blag/post/netcat-your-friendly-network-sniffer.mdwn new file mode 100644 index 0000000..b70deba --- /dev/null +++ b/blag/post/netcat-your-friendly-network-sniffer.mdwn @@ -0,0 +1,59 @@ +[[!meta date=2009-09-24]] +[[!meta title="netcat, your friendly network sniffer"]] +[[!meta license="CC-BY-SA 3.0"]] +[[!meta author=rohieb]] + +I was bored today and started to play around with this Windows Mobile +Messaging application (I think it’s called Outlook Mobile or sort of +thing), and I found out that I was not able to connect to my IMAP +mailbox on my root server, though it worked with my Freemail account. So +I wanted to see what makes Outlook Mobile bother about my IMAP server. + +If you are familiar with Linux (which I suppose you are ;-)), you +certainly know `netcat`. With this little tool, you can talk directly to +servers on a byte-oriented basis, and this can be very useful if you +have to debug programs which use character-oriented protocols like IMAP, +SMTP, IRC and so on. + +But I’ve realised that I can not only use `netcat` to talk to a server +myself, but even to build a transparent proxy server that displays all +the data that comes over it. After a while — okay, it was about 2 hours +— I got the following nice command: + + $ mkfifo pipe + $ tty=`tty`; netcat -l 1234 < pipe | tee $tty | + netcat myserver.com 143 | tee pipe + +I could now set up Outlook Mobile to talk to port 1234 on my home +computer and the bytes went straight to my console and also to port 143 +(the IMAP port) on my server. + +The first direction was straightforward: the first `netcat` process +listens to the local port and pipes its output first to the console +(using `tee`) and then to a second `netcat` instance that does the +communication with the remote server. Now, the commands from the server +have to get back to the client, so I created a named pipe using `mkfifo` +(of course, your filesystem has to support it, so you better not do this +on FAT) and used this as the input to the first `netcat` process that +sends it back to the original client. + +Of course, I could have used Wireshark, but I hate that it does not +allow to copy&paste the contents of a packet so I have only the bytes of +the protocol that I need — which can be quite useful if you want to +reuse parts of the content, especially in character-oriented protocols. +Also, the filter settings in Wireshark can be annoying, there is no +simple way to only have packets from one network connection (or I +haven’t found it yet). + +So, finally I found out that is has something to do with the IMAP +capabilities that Outlook Mobile bothers about. I suppose I will write +something about it if I have traced the problem back. + +**Update:** Note: You can also rewrite the server and/or client messages +using `sed`, but be sure to use unbuffered output with `-u` like that: + + $ tty=`tty`; netcat -l 143 < pipe | tee $tty | netcat myserver.com 143 | + sed -u 's/^\* CAPABILITY.*/* CAPABILITY IMAP4 STARTTLS/' | tee pipe + +[[!tag hacking howto debugging IMAP Linux netcat network_protocols + proxy_server shell]] diff --git a/blag/post/qt-nearly-synchronous-qnetworkaccessmanager-calls.mdwn b/blag/post/qt-nearly-synchronous-qnetworkaccessmanager-calls.mdwn new file mode 100644 index 0000000..373d583 --- /dev/null +++ b/blag/post/qt-nearly-synchronous-qnetworkaccessmanager-calls.mdwn @@ -0,0 +1,37 @@ +[[!meta title="Qt: (Nearly) synchronous QNetworkAccessManager calls"]] +[[!meta date="2010-07-08"]] +[[!meta author="rohieb"]] +[[!meta license="CC-BY-SA 3.0"]] + +The [QNetworkAccessManager][0] class is very user-friendly, but it makes +asynchronous calls. I was in the need for synchronous calls to handle my +HTTP communication, but I did not want the overhead of another thread, +so I googled a bit and finally came up with a short call to an event +loop that processed the request. Like this: + +[[!format c """ +QNetworkAccessManager * pnam = new QNetworkAccessManager(this); +// the slot was declared at another place +connect(pnam, SIGNAL(finished(QNetworkReply *)), this, + SLOT(loginFinished(QNetworkReply*))); +QNetworkRequest req(QUrl("http://foo.bar")); +pnam->post(req, postData); + +// execute an event loop to process the request (nearly-synchronous) +QEventLoop eventLoop; +// also dispose the event loop after the reply has arrived +connect(pnam, SIGNAL(finished(QNetworkReply *)), &eventLoop, SLOT(quit())); +eventLoop.exec(); +"""]] + +This way my user-defined slot for the `pnam->finished()` signal was +called immediately, and I could be sure to have the HTTP reply at the +end of this code snippet. + +Found here: [Qt-Interest Mailing List: QNetworkAccessManager and +QNetworkReply, synchronous][1] + +[0]: http://doc.qt.nokia.com/4.6/qnetworkaccessmanager.html +[1]: http://lists.qt.nokia.com/public/qt-interest/2010-April/022031.html + +[[!tag howto programming multithreading network Qt signals slots]] diff --git a/blag/post/qt-throw-exceptions-from-signals-and-slots.mdwn b/blag/post/qt-throw-exceptions-from-signals-and-slots.mdwn new file mode 100644 index 0000000..89a31a8 --- /dev/null +++ b/blag/post/qt-throw-exceptions-from-signals-and-slots.mdwn @@ -0,0 +1,50 @@ +[[!meta title="Qt: Throw exceptions from signals and slots"]] +[[!meta date="2010-07-08"]] +[[!meta author="rohieb"]] +[[!meta license="CC-BY-SA 3.0"]] + +By default, you can not throw exceptions from signals and slots, and if +you try it, you get the following message: + +> Qt has caught an exception thrown from an event handler. Throwing +> exceptions from an event handler is not supported in Qt. You must +> reimplement QApplication::notify() and catch all exceptions there. + +So, what to do? The answer is simple: Overwrite the function `bool +QApplication::notify(QObject * receiver, QEvent * event)` so that it +catches all thrown exceptions. Here is some sample code: + +[[!format c """ +#include +#include +class MyApplication : public QApplication { +public: + MyApplication(int& argc, char ** argv) : + QApplication(argc, argv) { } + virtual ~MyApplication() { } + + // reimplemented from QApplication so we can throw exceptions in slots + virtual bool notify(QObject * receiver, QEvent * event) { + try { + return QApplication::notify(receiver, event); + } catch(std::exception& e) { + qCritical() << "Exception thrown:" << e.what(); + } + return false; + } +}; +int main(int argc, char* argv[]) { + MyApplication app(argc, argv); + // ... +} +"""]] + +Of course, you can also inherit from `QCoreApplication` to get rid of +the `QtGui` dependency, or display a nice dialog box instead of printing +the messages to the console, or… + +Found at: [Stack Overflow: Qt and error handling strategy][1] + +[1]: http://stackoverflow.com/questions/1578331/qt-and-error-handling-strategy + +[[!tag howto programming exceptions Qt signals slots]] diff --git a/blag/post/ssh-key-authentication-with-encrypted-home-directories.mdwn b/blag/post/ssh-key-authentication-with-encrypted-home-directories.mdwn new file mode 100644 index 0000000..1b4a2da --- /dev/null +++ b/blag/post/ssh-key-authentication-with-encrypted-home-directories.mdwn @@ -0,0 +1,79 @@ +[[!meta title="SSH key authentication with encrypted home directories"]] +[[!meta date="2010-10-09"]] +[[!meta author="rohieb"]] +[[!meta license="CC-BY-SA 3.0"]] +[[!flattrthing id=80700]] + +Yesterday, I ran into an interesting problem: I tried to set up [SSH +public key authentication][0] between two of my machines, `c3po` and +`r2d2`, so I could log in from `rohieb@r2d2` to `rohieb@c3po` without a +passphrase. However, everytime I tried to login to `c3po`, I was +prompted to enter the passwort for `rohieb@c3po`, and the debug output +mentioned something that the key could not be verified. More +astonishing, when I established a second SSH connection while the first +was still running, I was *not* prompted for a password, and debug output +said that key authentication had been sucessful. I googled a bit, and +after a while got to [this comment][1] on Launchpad, mentioning problems +when the user on the remote machine had its home directory encrypted +through ecryptfs – which was the case for me. Of course, since ecryptfs +only encrypts the user’s home *after* he has been authenticated, the SSH +daemon cannot read his `~/.ssh/authorized_keys` at the first time, and +falls back to password authentication. + +[0]: http://www.openbsd.org/cgi-bin/man.cgi?query=ssh&sektion=1#AUTHENTICATION +[1]: https://bugs.launchpad.net/ubuntu/+source/openssh/+bug/362427/comments/12 + +The Launchpad comment proposes to first unmount the ecryptfs filesystem, +then store `~/.ssh/authorized_keys` unencrypted, and then mount the +encrypted home again (**note** that no program should be running that +could try to access your home directory): + + $ ecryptfs-umount-private + $ cd $HOME + $ chmod 700 . + $ mkdir -m 700 .ssh + $ chmod 500 . + $ echo $YOUR_REAL_PUBLIC_KEY > .ssh/authorized_keys + $ ecryptfs-mount-private + +This works indeed, but has the drawback that key authentication only +works for the *first* login, because ecryptfs hides the unencrypted +files when it mounts the encrypted directory on login; and you had to +synchronize the encrypted and the unencrypted version of +`authorized_keys` everytime you add a new key. To circumvent that, I +simply moved the file to `/etc/ssh/authorized_keys/rohieb` (with the +file only readable and writable by me, and `/etc/ssh/authorized_keys` +writeable for all users) and adjusting `/etc/ssh/sshd_config` +appropriately: + + $ sudo vi /etc/ssh/sshd_config # or use your favorite editor instead of vi + [... some lines ...] + AuthorizedKeysFile /etc/ssh/authorized_keys/%u + [... some more lines ...] + $ sudo /etc/init.d/ssh restart + +## Update + +There is yet a better approach instead, which doesn’t need the SSHd +config to be edited at all: + +1. login to the user on the remote machine +2. create `/home/.ecryptfs/$USER/.ssh` and put your `authorized_hosts` there +3. symlink your encrypted version there: + + $ ln -s /home/.ecryptfs/$USER/.ssh/authorized_hosts ~/.ssh/authorized_hosts + +4. symlink your unencrypted version there (as above, **make sure** no + process wants to write to your home directory in the meantime): + + $ ecryptf-umount-private + $ mkdir ~/.ssh + $ ln -s /home/.ecryptfs/$USER/.ssh/authorized_hosts ~/.ssh/authorized_hosts + $ ecryptfs-mount-private + +The paths are for Ubuntu 9.10 (Karmic Koala) and later. On other +systems, you might want to replace `/home/.ecryptfs` with +`/var/lib/ecryptfs`. + +[[!tag Debian howto Ubuntu workaround eCryptfs encrypted_home Linux + OpenSSH]] diff --git a/blag/post/standby-with-lenovo-thinkpad-sl510-on-ubuntu-lucid.mdwn b/blag/post/standby-with-lenovo-thinkpad-sl510-on-ubuntu-lucid.mdwn new file mode 100644 index 0000000..5884de3 --- /dev/null +++ b/blag/post/standby-with-lenovo-thinkpad-sl510-on-ubuntu-lucid.mdwn @@ -0,0 +1,13 @@ +[[!meta title="Standby with Lenovo Thinkpad SL510 on Ubuntu Lucid"]] +[[!meta date="2010-07-30"]] +[[!meta author="rohieb"]] +[[!meta license="CC-BY-SA 3.0"]] + +…note to myself: Remove a potentially mounted SD card before suspending +your SL510, otherwise the kernel gets stuck… + +**Update:** Turned out the SD card was a bit buggy, the driver mostly +got a timeout when trying to speak with it. + +[[!tag Ubuntu broken_hardware driver failure laptop Linux standby + Thinkpad_SL510 Ubuntu_Lucid]] diff --git a/blag/post/sync-your-windows-mobile-5-6-pda-with-your-linux-pc.mdwn b/blag/post/sync-your-windows-mobile-5-6-pda-with-your-linux-pc.mdwn new file mode 100644 index 0000000..1f4d972 --- /dev/null +++ b/blag/post/sync-your-windows-mobile-5-6-pda-with-your-linux-pc.mdwn @@ -0,0 +1,19 @@ +[[!meta title="Sync your Windows Mobile 5/6 PDA with your Linux PC"]] +[[!meta date="2009-10-30"]] +[[!meta author="rohieb"]] +[[!meta license="CC-BY-SA 3.0"]] + +I recently bought a new (ok, a rather old ;-)) PDA, and I got used to +the calendar and task features in Windows Mobile. Of course, I also +wanted to synchronise all the tasks, appointments, contacts and files +with my PC, but whatever I tried, it didn’t work somehow on my Ubuntu +9.04 machine… So, I’ve got it now: I had do blacklist the `ipaq` kernel +module which wrongly handled the PDA when I plugged it in (i.  e. +edit `/etc/modprobe.d/blacklist.conf` and insert the line `blacklist +ipaq`), and then the [manual from ubuntuusers.de][1] suddenly worked +like a charm :-) + +[1]: http://wiki.ubuntuusers.de/Archiv/Synchronisation_mit_Windows_Mobile + +[[!tag howto Ubuntu blacklist Evolution iPAQ kernel_module Linux PDA + synchronisation Ubuntu Windows_Mobile]] diff --git a/blag/post/tell-xorg-to-re-grab-the-keyboard.mdwn b/blag/post/tell-xorg-to-re-grab-the-keyboard.mdwn new file mode 100644 index 0000000..8f88008 --- /dev/null +++ b/blag/post/tell-xorg-to-re-grab-the-keyboard.mdwn @@ -0,0 +1,20 @@ +[[!meta title="Tell Xorg to re-grab the keyboard"]] +[[!meta date="2011-12-29 23:45"]] +[[!meta author="rohieb"]] +[[!meta license="CC-BY-SA 3.0"]] + +OK, I was doing some debugging with Xorg, and thought I had to use the +[Magic SysRq][0] key to kill it. But when I had pressed Alt-SysRq-R to +give the keyboard control from Xorg back to the kernel, it turned out +that I not longer needed to do another SysRq because my Xorg magically +worked again… ;-) Unfortunately now, everytime I pressed Alt-F4 to close +a window, I found myself on tty4… rather poor. So I needed some way to +tell Xorg to grab the keyboard again, and [there it is][1]: Just open an +xterm and execute + + sudo kbd_mode -s + +[0]: http://en.wikipedia.org/wiki/Magic_SysRq_key +[1]: https://learninginlinux.wordpress.com/2010/06/16/debugging-notes-to-self/ + +[[!tag fix howto debugging Linux shell SysRq Xorg]] diff --git a/blag/post/ubuntu-karmic-upgrade-issues.mdwn b/blag/post/ubuntu-karmic-upgrade-issues.mdwn new file mode 100644 index 0000000..49b37bd --- /dev/null +++ b/blag/post/ubuntu-karmic-upgrade-issues.mdwn @@ -0,0 +1,61 @@ +[[!meta title="Ubuntu Karmic upgrade issues"]] +[[!meta date="2010-01-17"]] +[[!meta author="rohieb"]] +[[!meta license="CC-BY-SA 3.0"]] + +Thinking of the phrase “never change a running system” I am usually not +very keen on updating my Ubuntu system to a new distribution. However, +not every new software version is available from the backports, so +finally, I saw myself forced to upgrade to Karmic Koala. + +I instantly regretted it. Of course, I appreciate all the new software, +but as in every upgrade I ever made (and I probably should know by now +-.-), there are a few things that were annoying me or are still doing +it: + +* kaffeine-1.0~pre is not even as useful as 0.8.7 from jaunty: While + staying in touch with the main KDE (4) line, the developers seemed to + completely remove the Playback -> Video menu, so it is not possible + anymore to toggle deinterlacing, or any other video filter, which is + very annoying for DVB-T. I filed a [bug report][1] on that. + Futhermore, my DVB-T channels were lost, so I had to rescan them. + +* The notifications displayed by notify-osd somehow have wandered from + the upper right edge towards the middle right. This seems to be fixed + now, as pointed out in the [bug report][2], but somehow this fix never + got onto my system, though the changelog of notify-osd says so… + Additionally, the notifications for received messages in Pidgin do not + hide anymore if I actually read the messages, they persist until their + default timeout has elapsed. And they even show up now when my IM + status is on “Do not Disturb” – this was not the case (just as I + expected it) in jaunty. + +* Icons in GTK menus are now hidden by default, which seemed very + unfamiliar to me, since I always used them as an orientation guide, + especcially in the Firefox search plugin menu. You can show them again + in the System -> Preferences -> Appearance applet on the Interface tab + by selecting “Show icons in menus”. + +* GDM is no longer custumizable through themes. It just doesn’t support + it, as it seems to be a [complete rewrite][3]. IMHO just another + Unmature Software Thing. + + **Edit:** I just found out that it is also not able to start GDM in + Xnest, as I usually did for testing: + + $ gdmflexiserver --xnest + ** (gdmflexiserver:5916): WARNING **: Not yet implemented + +* And finally, my customized GNOME window theme (based on Clearlooks) + was broken :-( I am very confident that the color of selected text was + not the same color in the title bar, but now both seem to be the same + color. This is really bad, as for the title bar, I used to have a + darker shade of orange than for selected text. OK, changing to another + theme may be simple, but until now, I haven’t found anything I like + best. + +[1]: https://bugs.launchpad.net/ubuntu/+source/kaffeine/+bug/499938 +[2]: https://bugs.launchpad.net/ubuntu/+source/notify-osd/+bug/419894 +[3]: http://ubuntuforums.org/showthread.php?p=7854130 + +[[!tag Ubuntu fix rant Ubuntu Ubuntu_Jaunty Ubuntu_Karmic upgrade]] diff --git a/blag/post/use-ghostscript-to-convert-pdf-files.mdwn b/blag/post/use-ghostscript-to-convert-pdf-files.mdwn new file mode 100644 index 0000000..7d1e292 --- /dev/null +++ b/blag/post/use-ghostscript-to-convert-pdf-files.mdwn @@ -0,0 +1,24 @@ +[[!meta title="Use Ghostscript to convert PDF files"]] +[[!meta date="2012-06-09 19:06"]] +[[!meta author="rohieb"]] +[[!meta license="CC-BY-SA 3.0"]] + +If you have a PDF file and want it to be in a specific PDF version (for +example, the print shop where you just ordered some adhesive labels +wants the print master in PDF 1.3, but your Inkscape only exports PDF +1.4), Ghostscript can help: + + gs -sDEVICE=pdfwrite -dCompatibilityLevel=1.5 -dNOPAUSE -dQUIET \ + -dBATCH -sOutputFile=new-pdf1.5.pdf original.pdf + +(this converts the file `original.pdf` to PDF 1.5 and writes it to +`new-pdf1.5.pdf`) + +Also, if you have a huge PDF of several megabyte because there are many +high-resolution pictures in it, Ghostscript can minify it (and shrink +the pictures to 96 dpi) if you use the parameter +`-dPDFSETTINGS=/screen`. + +[0]: http://www.ghostscript.com/ + +[[!tag howto desktop_publishing Ghostscript PDF]] diff --git a/blag/post/windows-device-manager-code-39-with-cdrom-drive.mdwn b/blag/post/windows-device-manager-code-39-with-cdrom-drive.mdwn new file mode 100644 index 0000000..a92214e --- /dev/null +++ b/blag/post/windows-device-manager-code-39-with-cdrom-drive.mdwn @@ -0,0 +1,34 @@ +[[!meta title="Windows Device Manager: Code 39 with CDROM drive"]] +[[!meta date="2010-11-14 14:29"]] +[[!meta author="rohieb"]] +[[!meta license="CC-BY-SA 3.0"]] + +My sister asked me to have a look at her notebook (a Medion Akoya P6612 +with Windows Vista) because the CDROM drive wouldn’t work, and it was +not even displayed in the Windows Explorer. I looked into the Device +Manager and noticed that the CDROM device (TSSTCorp SN-S083a) was +displayed with a small yellow exclamation mark besides its icon, and it +said on the Properties page that the device could not be started and +referred to Code 39. Reinstalling the drivers had no effect, but after I +had a little chat with [Big Blue G][0], I found a [howto entry][1] which +suggested the following: + +1. Be logged in with an administrator account +2. Open the Registry Editor (choose it from the Start Menu or press + Win+R and type `regedit`) +3. Navigate to + `HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Class\{4D36E965-E325-11CE-BFC1-08002BE10318}` +4. Then, in the right pane, delete all of the following keys: + * UpperFilters + * LowerFilters + * UpperFilters.bak + * LowerFilters.bak +5. Restart your computer + +This worked fine for us. + +[0]: http://google.com/ +[1]: http://www.pchell.com/hardware/cd_drive_error_code_39.shtml + +[[!tag howto useless_bits_of_information Windows CDROM Device_Manager + driver Medion_Akoya_6612 registry TSSTCorp_SN-S083a Windows Vista]] diff --git a/blag/post/wireless-usb-keyboards-and-delayed-keystrokes.mdwn b/blag/post/wireless-usb-keyboards-and-delayed-keystrokes.mdwn new file mode 100644 index 0000000..162b138 --- /dev/null +++ b/blag/post/wireless-usb-keyboards-and-delayed-keystrokes.mdwn @@ -0,0 +1,37 @@ +[[!meta title="Wireless USB keyboards and delayed keystrokes"]] +[[!meta date="2012-04-29 01:09"]] +[[!meta author="rohieb"]] +[[!meta license="CC-BY-SA 3.0"]] + +Everytime I was using my wireless USB keyboard with my laptop while the +power cable was not connected, the keyboard behaviour was lousy, and +keystrokes tend to be delayed by several seconds. The kernel logs said +something like + + [23302.802096] uhci_hcd 0000:00:1a.0: setting latency timer to 64 + [23302.842177] uhci_hcd 0000:00:1a.1: PCI INT B -> GSI 21 (level, low) -> IRQ 21 + [23302.842190] uhci_hcd 0000:00:1a.1: setting latency timer to 64 + [23302.882145] uhci_hcd 0000:00:1a.2: PCI INT C -> GSI 19 (level, low) -> IRQ 19 + [23302.882158] uhci_hcd 0000:00:1a.2: setting latency timer to 64 + [23302.929065] uhci_hcd 0000:00:1d.1: PCI INT B -> GSI 19 (level, low) -> IRQ 19 + [23302.929079] uhci_hcd 0000:00:1d.1: setting latency timer to 64 + +Searching on Google, I found [a forum post][0] which suggested to +disable USB auto-suspend in the [laptop-mode][1] configuration files. +The relevant file on my Ubuntu 12.04 is +`/etc/laptop-mode/conf.d/usb-autosuspend.conf`, which is fairly well +documented, and has an option `AUTOSUSPEND_USBID_BLACKLIST` which +allowed me to blacklist my USB keyboard, so the device was no longer put +in auto-suspend mode. (The USB ID needed for +`AUTOSUSPEND_USBID_BLACKLIST` can be found in the output of [lsusb][2]) + +After editing that file, I had to restart the laptop-mode daemon (`sudo +/etc/init.d/laptop-mode restart`), and keystrokes from my wireless +keyboard arrived again without any delay. + +[0]: https://bbs.archlinux.org/viewtopic.php?pid=898114#p898114 +[1]: http://packages.ubuntu.com/laptop-mode +[2]: http://packages.ubuntu.com/usbutils + +[[!tag fix Ubuntu auto-suspend battery_power laptop-mode Linux Linux_3.2 + powersave timing Ubuntu_Precise USB wireless_keyboard]] diff --git a/blag/post/x-screen-shots-from-the-console.mdwn b/blag/post/x-screen-shots-from-the-console.mdwn new file mode 100644 index 0000000..187c5d5 --- /dev/null +++ b/blag/post/x-screen-shots-from-the-console.mdwn @@ -0,0 +1,20 @@ +[[!meta title="X screen shots from the console"]] +[[!meta date="2011-03-24 19:10"]] +[[!meta author="rohieb"]] +[[!meta license="CC-BY-SA 3.0"]] + +I had to debug a machine that was behind a DSL-2000 connection, and had +about 20 KB/s of upstream. For that, I needed to see what was going on +on the X screen, but due to the low bandwidth (and a screen resolution +of 1920×1080), VNC was about as fast as 2 frames per minute. + +But I found a [comparable replacement][0]: The [ImageMagick suite][1] +has a program called `import` that allows you to dump the contents of +the X screen to a image file. So I took a few screen shots from the +console via `DISPLAY=:0 import -window root foo.png` and then copied the +files to my machine. + +[0]: http://www.mysql-apache-php.com/website_screenshot.htm +[1]: http://www.imagemagick.org/ + +[[!tag howto ImageMagick Linux VNC X X11 Xorg]] diff --git a/blag/post/xulrunner-rocks-.mdwn b/blag/post/xulrunner-rocks-.mdwn new file mode 100644 index 0000000..4eb9736 --- /dev/null +++ b/blag/post/xulrunner-rocks-.mdwn @@ -0,0 +1,83 @@ +[[!meta title="XULRunner rocks!"]] +[[!meta date="2011-03-15 22:16"]] +[[!meta author="rohieb"]] +[[!meta license="CC-BY-SA 3.0"]] + +For [[one of my projects|projects/infopoint-html]], I needed an +application to display a web page in full screen mode. At first, I used +Firefox with the [AutoHide extension][0], but this solution was more of +a hack and not easy to deploy to multiple machines — I worked with a +pre-configured user profile that was copied every time the application +started. Furthermore, after each update, Firefox would check for +compatibility of installed plugins and displayed a nasty dialog in the +meantime. + +So I tried to move away from Firefox and do something on my own, +something slim which did just what I wanted, nothing more, and do it +good — according to the [UNIX philosophy][1]. But writing another +C/C++/Python/whatever application from scratch was not an option +(implementing an HTML renderer would be a pain, and I didn’t fancy +reading extensive manuals about WebKit, Gecko or any other rendering +engine). + +After a while of thinking, which included thought fragments of +[Songbird][2] and [Conkeror][3], I decided to give [XULrunner][4] a shot +(for those who do not know, XUL is the XML-based user interface language +used by the Mozilla applications and the Firefox and Thunderbird +extensions, and XULRunner is an interpreter and run-time environment for +XUL documents). + +So after a while of hacking (there is a good [tutorial on the Mozilla +Developer Network][5]), I ended up with a few lines of code: + +[[!format xml """ + + + + + + +