Archive

Archive for March, 2011

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

Advertisements
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