shutdown -r now

November 10, 2013 Comments off

Hi,

This is the last post on this blog, I have moved to new site. Everything is still in flux, so it might not yet be as shiny and some features (like comments) are still missing. Nevertheless, the content is there and that’s the main point. I have also written a short post about the reasons why I wanted to move.

If you’re reading this post in a feed reader, you have to update the feed URL manually, unfortunately there is no way of telling wordpress.com to redirect the requests automatically.

Categories: Uncategorized

Use Ghostscript to convert PDF files

June 9, 2012 1 comment

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.

Categories: howto Tags: , ,

Wireless USB keyboards and delayed keystrokes

April 29, 2012 Comments off

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 Read more…

Tell Xorg to re-grab the keyboard

December 29, 2011 Comments off

OK, I was doing some debugging with Xorg, and thought I had to use the Magic SysRq 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: Just open an xterm and execute

sudo kbd_mode -s
Categories: fix, howto Tags: , , , ,

X screen shots from the console

March 24, 2011 2 comments

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: The ImageMagick suite 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.


Flattr this

Categories: howto Tags: , , , , ,

XULRunner rocks!

March 15, 2011 Comments off

For one of my projects, I needed an application to display a web page in full screen mode. At first, I used Firefox with the AutoHide extension, 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. 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 and Conkeror, I decided to give XULrunner 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), I ended up with a few lines of code:

File ./chrome/content/main.xul:

<?xml version="1.0"?>
<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
<?xml-stylesheet href="main.css" type="text/css"?>
<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
  id="viewer" windowtype="viewer" title="Infopoint HTML View" 
  hidechrome="true">

  <hbox flex="1">
  <iframe id="contentview" flex="1"
    src="chrome://infopointhtmlviewer/content/default.html" />
  </hbox>
  <script>
    // load URI given on command line
    var content = document.getElementById("contentview");
    var cmdLine = window.arguments[0].QueryInterface(
      Components.interfaces.nsICommandLine);
    var uri = content.getAttribute("src");
    alert("Default URL: " + uri);
    if(cmdLine.length > 0) {
      uri = cmdLine.getArgument(0);
    }

    if(content != null) {
      content.setAttribute("src", uri);
    }

    // resize to full screen
    window.resizeTo(screen.width, screen.height);
  </script>
</window>

The above code is in the public domain.

And that was basically all of it. I was surprised that there was nothing more to it.

You can get the source code of the full application on Github.


Flattr this

libdvdread and ISO 9660 file systems

March 3, 2011 Comments off

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. (OPf course also with an image file containing an UDF file system :-))


Flattr this

Google Earth and IPv6 DNS lookups

January 22, 2011 Comments off

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) and the current version of Google Earth for Linux (I am using 5.1.3533.1731 from Medibuntu) 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 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


Flattr this

Change partition type without reformatting

January 2, 2011 Comments off

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)

Flattr this

Flattr me!

November 14, 2010 Comments off

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 that explains the idea:

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, so I only use the static button which directs you to the thing on the flattr site.


Flattr this

Categories: Uncategorized Tags: , ,