shutdown -r now

November 10, 2013 Leave a comment

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 Leave a comment

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 Leave a comment

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 Leave a comment

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 Leave a comment

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

Follow

Get every new post delivered to your Inbox.