<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Andreas Happe &#187; Linux</title>
	<atom:link href="http://snikt.net/index.php/category/linux-related-stuff/feed" rel="self" type="application/rss+xml" />
	<link>http://snikt.net</link>
	<description>Vi veri ueniversum vivus vici</description>
	<lastBuildDate>Tue, 06 Jul 2010 21:54:07 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Howto use cmake with C/C++ projects</title>
		<link>http://snikt.net/index.php/2010/04/01/howto-use-cmake-with-cc-projects</link>
		<comments>http://snikt.net/index.php/2010/04/01/howto-use-cmake-with-cc-projects#comments</comments>
		<pubDate>Thu, 01 Apr 2010 13:53:04 +0000</pubDate>
		<dc:creator>andy</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Software Development]]></category>

		<guid isPermaLink="false">http://snikt.net/?p=753</guid>
		<description><![CDATA[Writing code ain&#8217;t the end of a C/C++ software developer&#8217;s task, it&#8217;s merely the start of endless compile and debug sessions. Compiling is the build system&#8217;s job: Visual Studio users might just click on the &#8220;Build&#8221; button, UNIX users mostly depend upon Makefiles. The conventional way of creating Makefiles involves GNU&#8217;s autotools. They check the [...]]]></description>
			<content:encoded><![CDATA[<p>Writing code ain&#8217;t the end of a C/C++ software developer&#8217;s task, it&#8217;s merely the start of endless compile and debug sessions. Compiling is the build system&#8217;s job: Visual Studio users might just click on the &#8220;Build&#8221; button, UNIX users mostly depend upon <a href="http://en.wikipedia.org/wiki/Makefile">Makefiles</a>. The conventional way of creating Makefiles involves <a title="GNU autoconf" href="http://www.gnu.org/software/autoconf/">GNU&#8217;s autotools</a>. They check the computer system&#8217;s installed resources (mostly installed libraries and compilers) and generate system-dependant Makfiles. Being fed up with autotools wrt. readability and performance I searched alternatives and found <a title="cross-plattform make" href="http://www.cmake.org/">cmake</a>. The conversation from autotools to cmake did shred away thousands of lines of build code while improving the build performance tremendously. In addition creating distribution-dependent packages gets a lot easier.</p>
<p>Alas I did not find too many introductions so I thought that I&#8217;ll write a bit about my experience with cmake. As I continue to find out more stuff about cmake the post will be updated with new findings.</p>
<p>Read after the fold for an introduction into cmake. We&#8217;ll create a build system capable of creating debian or redhat (RPM) packages. It will include advanced stuff as automatically creating and installing documentation, subversion-derived version numbers and creating optional features.</p>
<h1><span id="more-753"></span>Basic Project Layout</h1>
<p>We have a fairly standard project layout (currently using autotools):</p>
<table>
<tbody>
<tr>
<th>Files</th>
<th>Location</th>
<th>Installed Location</th>
</tr>
<tr>
<td>boilerplate text files (README, LICENSE, etc.)</td>
<td><em>project root</em></td>
<td><em>/usr/share/doc/</em></td>
</tr>
<tr>
<td>Doxygen-generated docs</td>
<td><em>api-doc (after doxygen was called)</em></td>
<td><em>/usr/share/man/man3/</em></td>
</tr>
<tr>
<td>source code for executables</td>
<td><em>bin/*.c</em></td>
<td><em>/usr/bin</em></td>
</tr>
<tr>
<td>support libraries</td>
<td><em>/lib/*.c</em></td>
<td><em>/usr/libs</em></td>
</tr>
<tr>
<td>include files</td>
<td><em>/include/</em></td>
<td><em>/usr/include</em></td>
</tr>
</tbody>
</table>
<p>All files are stored within a <a title="Apache Subversion" href="http://subversion.tigris.org/">subversion software repository</a>. The final package should include the current subversion revision number in their package description (as well as output it from within the executable) to improve bug report&#8217;s quality.</p>
<p>The build system should generate the support library, the binary and utilize Doxygen to generate documentation. All those files need to find their way into automatically build distribution packages (Debian and Redhat packages in our case).</p>
<h1>Basic cmake setup</h1>
<p>We start with a skeleton cmake file that only tests various standard compile flags. We name our project, search for various default libraries (through <em>find_package</em>) and set various compile flags.</p>
<p>The simple boilderplate text files are also installed. At this time the destination directory is hard-coded, this will change in the future.</p>
<pre>project(test-program)
cmake_minimum_required(VERSION 2.6)

# check libs and packages (headers + lib)

# std C libraries
find_package(stdlibs REQUIRED)

# libpthread with pthread.h
find_package(pthread REQUIRED)

check_include_file(argp.h HAVE_ARGP_H)

# additional compiler flags
add_definitions(-Wall -Wextra -pedantic -Werror -std=c99 -D_BSD_SOURCE)

# 'other' documentation files
set(DOC_FILES AUTHORS NEWS README)
set(DOC_PATH "share/doc/testprogram-0.1")
install(FILES ${DOC_FILES}
        DESTINATION ${DOC_PATH})</pre>
<p>So far we have the skeleton outline of a cmake project that just sets some compile information about our project and finally installs some documentation. Let&#8217;s add some &#8220;real&#8221; stuff.</p>
<h1>Adding support libaries</h1>
<p>Our project contains one library that is needed for compilation of the executable file. To build the lib a new <em>CMakeLists.txt</em> was added to <em>/lib</em> and the <em>/lib</em> directory was added to the main CMakeLists.txt by:</p>
<pre>add_subdirectory(lib)</pre>
<p>The cmake library definition is pretty straightforward: we define the needed source files (through the <em>EXAMPLE_LIB_SRC</em> variable) and add a new shared library named &#8216;example-lib&#8217; to the build targets. The only &#8220;weird&#8221; thing is that we have to add the library to the linker flags manually (by setting <em>CMAKE_REQUIRED_LIBRARIES</em>): it would be nice if this could happen automatically.</p>
<pre># sources and linkage

# define the sources
set(EXAMPLE_LIB_SRC  lib_a.c lib_b.c)
add_library(example-lib SHARED ${QKD_APP_SRC})
target_link_libraries(example-lib ${CMAKE_REQUIRED_LIBRARIES})

# additional includes
include_directories(. ..)

# enable gcc specific stuff
if (CMAKE_COMPILER_IS_GNUCC)
    set_source_files_properties(${EXAMPLE_LIB_SRC} PROPERTIES COMPILE_FLAGS "-std=c99 -Werror -Wall -pedantic")
endif ()

set(CMAKE_REQUIRED_LIBRARIES "example-lib;${CMAKE_REQUIRED_LIBRARIES}")

# install
install(TARGETS example-lib LIBRARY DESTINATION lib)</pre>
<h1>Adding executables</h1>
<p>Now we add the executable file to the build. To achieve this we add a CMakeLists.txt to the <em>/bin</em> directory. Within it we define our executeable (consisting of <em>part_a.c</em> and <em>part_b.c</em>) and its compile flags. The <em>include</em> directive states where the compiler should search for header files. With the <em>install</em> command we define it&#8217;s final position when being installed as part of a package.</p>
<p>We also add a manual dependency of example-prog upon example-lib. Cmake now always builds example-lib before it attempts to build example-lib. Alas we still had to manually add the example-lib linker flags to <em>CMAKE_REQUIRED_LIBRARIES</em> at the <em>/lib</em> section</p>
<pre>include_directories(
    .
    ..
    ${CMAKE_CURRENT_BINARY_DIR}
    ${CMAKE_CURRENT_SOURCE_DIR}
    ${CMAKE_SOURCE_DIR}
    ${CMAKE_BINARY_DIR}
    ${CMAKE_SOURCE_DIR}/bin/
   )

# define the sources
set(EXAMPLE_SRC part_a.c part_b.c)

# define executable
add_executable(example-prog ${EXAMPLE_SRC})
target_link_libraries(example-prog ${CMAKE_REQUIRED_LIBRARIES})
add_dependencies(example-prog example-lib)

# compiler switches

# enable gcc specific stuff
if (CMAKE_COMPILER_IS_GNUCC)
    set_source_files_properties(${EXAMPLE_SRC} PROPERTIES COMPILE_FLAGS "-std=c99 -Werror -Wall -pedantic")
endif ()

# install binaries
install(TARGETS example-program RUNTIME DESTINATION bin)</pre>
<h1>Test it</h1>
<p>This would actually be a good time to test our build system. cmake supports two different ways of separating source code from build programs: out-of-tree builds and in-tree builds. With in-tree builds source code and generated files are always stored within the same project directories. This is the way of building that you might know from autotools. With out-of-tree builds all generated files are placed into a separated directory: this keeps your project directory clean (and you can do interesting stuff as speeding up build time by placing the out-of-tree build directory on a ramdrive/tmpfs). So we will try to do an out-of-tree build:</p>
<pre>$ cd $PROJECT_DIRECTORY
$ mkdir build
$ cd build
$ cmake ./..
$ make</pre>
<p>This will build all binaries within the <em>build</em> directory. Partey!</p>
<h1>Create debian and redhat packages</h1>
<p>We won&#8217;t distribute a tar-ball or plain pre-compiled binaries to our users but want distribution-specific packages. They provide a better user experience through features as dependency tracking (which other packages must be installed to run this program) or easy package management (install, reinstall, uninstall packages).</p>
<p>cmake provides <em>CPack</em> for package creation. To enable it our main <em>CMakeLists.txt</em> was adapted in the following way:</p>
<pre>set(CPACK_PACKAGE_DESCRIPTION "Do the example thingie")
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "A longer description about our example app.")
set(CPACK_PACKAGE_NAME "example-app")
set(CPACK_DEBIAN_PACKAGE_DEPENDS "libc6 (&gt;= 2.3.6), libgcc1 (&gt;= 1:4.1)")

set(CPACK_PACKAGE_CONTACT "Andreas Happe ")
set(CPACK_PACKAGE_VENDOR "Andreas Happe Inc.")
set(CPACK_PACKAGE_VERSION_MAJOR "0")
set(CPACK_PACKAGE_VERSION_MINOR "0")
set(CPACK_PACKAGE_VERSION_PATCH "1")
set(VERSION "${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}")

set(CPACK_GENERATOR "DEB;RPM;")
set(CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}-${CMAKE_SYSTEM_PROCESSOR}")

include(CPack)</pre>
<p>The variables contain package descriptions and version information that will be converted into the new packages meta-information. <em>CPACK_GENERATOR</em> specifies for which output types the generated packages should have. We have chosen DEB (Debian, Ubuntu) and RPM (Redhat, Suse, Fedora) packages to be generated. They should suffice for the vast majority of installed Linux distributions. We also added some package dependencies for debian distributions: this ensures that libc and libgcc1 will be installed with their correct versions before our package is installed.</p>
<p>To finally build our distribution packages just change into the build directory and enter <em>cpack</em>:</p>
<pre>$ cd build
$ cpack</pre>
<p>The resulting distribution packages will lie within the <em>build</em> directory.</p>
<p>Another advantage is that we can use those cpack variables throughout the whole <em>CMakeLists.txt</em> file. For example: instead of installing documentation files into a fixed directory through:</p>
<pre>set(DOC_PATH "share/doc/testprogram-0.1")</pre>
<p>we can install them into a properly versioned directory:</p>
<pre>set(DOC_PATH "share/doc/${CPACK_PACKAGE_NAME}-${VERSION}")</pre>
<h1>Add include files to distribution package</h1>
<p>Other programs might link against our <em>example-lib</em> but they will need some header files to learn about the lib&#8217;s available (exported) function signatures. To install them we add the &#8220;include&#8221; subdirectory to our build by adding the following to the main <em>CMakeLists.txt</em>:</p>
<pre>add_subdirectory(include)</pre>
<p>Now we need a &#8220;/include/CMakeLists.txt&#8221; that specifies which header files need to be installed into our distribution package. As we want this to happen for all existing header files we just add a catchall install statement:</p>
<pre>install(DIRECTORY example-lib-headers
        DESTINATION include
        FILES_MATCHING PATTERN "*.h"
                       PATTERN ".svn" EXCLUDE
       )</pre>
<p>This installs all &#8220;*.h&#8221; files (ie. header files) from the directory &#8220;/include/example-lib-headers&#8221; into the package&#8217;s <em>include</em> directory (which will later be installed into the system&#8217;s include files directories). Notice the <em>EXCLUDE</em>-pattern: as we are using Subversion as a SCM we do have various internal subversion files lying around in our source code tree. Those include copies of header files. Without this <em>EXCLUDE</em> those copies would also be installed into our distribution package what we do certainly not want.</p>
<h1>Add current subversion revision</h1>
<p>As all programs our example program contains bugs. To improve bug reports we want to include a reference to the exact subversion release this package was build from. This information should be included within the package meta-information as well as within the compiled program itself</p>
<p>First of all we need to gather the subversion revision information. To achieve this we utilize the <em>Subversion</em> module that is installed with cmake (you can find those modules under <em>/usr/share/cmake/modules*</em>, there are lots of useful tools within that directory). It&#8217;s configuration and usage within the main <em>CMakeLists.txt</em> can be seen in the following code snipplet:</p>
<pre>find_package(Subversion)
if(Subversion_FOUND)
  Subversion_WC_INFO(${CMAKE_CURRENT_SOURCE_DIR} ER)
  set(SUBVERSION_REVISION ${ER_WC_REVISION})
endif(Subversion_FOUND)</pre>
<p>Now we have the current subversion revision stored within the <em>SUBVERSION_REVISION</em> variable and can easily use it to set our packages patch level (the patch level is the most insignificant part of the whole package version):</p>
<pre>set(CPACK_PACKAGE_VERSION_PATCH "${SUBVERSION_REVISION}")</pre>
<p>To reference this information from within a compiled program we want a header file that contains a <em>#define</em> that acts as a placeholder for the current subversion revision string. To achieve this we utilize the cmake <em>configure_file</em> directive. The directive states a source and a destination file: the source file is read, processed and stored as the stated destination file. During processing all cmake variables can be accessed and output into the destination file, ie.:</p>
<pre>configure_file(${CMAKE_CURRENT_SOURCE_DIR}/cmake/revision.h.in ${CMAKE_CURRENT_BINARY_DIR}/revision.h)</pre>
<p>With an <em>config.h.in</em> file of:</p>
<pre>#ifndef __REVISION_H
#define __REVISION_H
#define SVN_REVISION "${SUBVERSION_REVISION}"
#endif</pre>
<p>The cmake variable <em>SUBVERSION_REVISION</em> is used as value for the <em>SVN_REVISION</em> #define. The <em>#ifndef</em> guards are just thrown in for good style and are not mandatory.</p>
<h1>Automatically create man pages/documentation with Doxygen</h1>
<p>We can utilize the same <em>configure_file</em>-mechanism to automatically generate documentation through <a href="http://www.doxygen.org/">Doxygen</a>. We already have a doxygen file describing the documentation extraction but need to adapt it to the actual build directory, ie:</p>
<pre>PROJECT_NAME           = ${CPACK_PACKAGE_NAME}
PROJECT_NUMBER         = ${VERSION}
OUTPUT_DIRECTORY       = api-doc
INPUT                  = ${CMAKE_CURRENT_SOURCE_DIR}</pre>
<p>Now we need to include Doxygen within our build configuration. We achieve this through including the following into our main <em>CMakeLists.txt</em>:</p>
<pre># check if doxygen is even installed
find_package(Doxygen)
if (DOXYGEN_FOUND STREQUAL "NO")
    message(FATAL_ERROR "Doxygen not found. Please get a copy http://www.doxygen.org")
endif (DOXYGEN_FOUND STREQUAL "NO")

# prepare doxygen configuration file
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile.in ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile)

# add doxygen as target
add_custom_target(doxygen ${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile)

# cleanup $build/api-doc on "make clean"
set_property(DIRECTORY APPEND PROPERTY
	     ADDITIONAL_MAKE_CLEAN_FILES api-doc)

# add doxygen as dependency to doc-target
get_target_property(DOC_TARGET doc TYPE)
if(NOT DOC_TARGET)
	add_custom_target(doc)
endif()
add_dependencies(doc doxygen)

# install HTML API documentation and manual pages
set(DOC_PATH "share/doc/${CPACK_PACKAGE_NAME}-${VERSION}")

install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/api-doc/html
         DESTINATION ${DOC_PATH}
       )

# install man pages into packages, scope is now project root..
install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/api-doc/man/man3
         DESTINATION share/man/man3/
       )</pre>
<p>First of all we verify that Doxygen is even installed. Afterwards we automatically adopt the Doxygen.in configuration file to our needs (<em>configure_file</em>). This makes sure that generated documentation is always placed within the <em>build</em> directory. To make sure that current documentation is always available we add a custom target called &#8220;doxygen&#8221; and let the &#8220;doc&#8221; target depend upon it. The &#8220;doc&#8221; target will automatically be called after compiling and through the dependence doxygen will be called then too. In addition we add the &#8220;api-doc&#8221; directory (which will contain all generated files as specified within <em>Doxygen.in</em>) to the lsit of files that should be removed after a &#8220;make clean&#8221; run.</p>
<p>This is sufficient to create documentation but we also want it to appear within the generated distribution packages. The two <em>install</em> statements at the end achieve exactly that: they install HTML documentation into the official /usr/share/doc/ directory and generated man pages into their corresponding directories.</p>
<h1>Add some optional parts</h1>
<p>So far our build environment has been pretty monolithic: it always builds everything. Sometimes you do not want that as some features are only needed in special circumstances. As an example we do not want to add header files to the distribution package all the time.</p>
<p>Optional features are supported by <em>cmake</em> through the <em>option</em> statement. An option consists of a variable name and a short description. The user is displayed the option description and if he enables it the option variable is set. A short example illustrates this far better:</p>
<pre>option(ADD_INCLUDE_FILES "Add include files to the generated distribution packages")
if (ADD_INCLUDE_FILES)
    add_subdirectory(include)
else(ADD_INCLUDE_FILES)
    message(WARNING "include files will not be included within the distribution packages")
endif(ADD_INCLUDE_FILES)</pre>
<p>The include directory is only processed if the user selects the option. But how can an user actually enable an option? cmake provides various user interfaces, i prefer the ncurses-based ccmake:</p>
<pre>$ cd build
$ ccmake ./..
# enable the wanted options and build it afterwards..
$ make</pre>
]]></content:encoded>
			<wfw:commentRss>http://snikt.net/index.php/2010/04/01/howto-use-cmake-with-cc-projects/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Nikon D40 NEF/RAW images with Linux</title>
		<link>http://snikt.net/index.php/2010/03/03/nikon-d40-nefraw-images-with-linux</link>
		<comments>http://snikt.net/index.php/2010/03/03/nikon-d40-nefraw-images-with-linux#comments</comments>
		<pubDate>Wed, 03 Mar 2010 18:30:10 +0000</pubDate>
		<dc:creator>andy</dc:creator>
				<category><![CDATA[Desktop-related]]></category>
		<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://snikt.net/?p=504</guid>
		<description><![CDATA[Caveat: I&#8217;m not too much into photography so everything I posted here might be wrong. It&#8217;s just my opinion as an end-user. I&#8217;ve bought myself a Nikon D40 some time ago and finally had enough spare time to shoot some images and post-process them. My environment of choice is Ubuntu Linux so the obvious image [...]]]></description>
			<content:encoded><![CDATA[<p><em>Caveat: I&#8217;m not too much into photography so everything I posted here might be wrong. It&#8217;s just my opinion as an end-user.</em></p>
<p>I&#8217;ve bought myself a <a href="http://www.dpreview.com/reviews/nikond40/">Nikon D40</a> some time ago and finally had enough spare time to shoot some images and post-process them. My environment of choice is <a href="http://www.ubuntu.com">Ubuntu Linux</a> so the obvious image management/edit tools were <a href="http://www.gimp.org">gimp</a> and <a href="http://www.f-spot.org">f-spot</a>.</p>
<p>An first attempt did show some strange behaviour: f-spot did display NEF/RAW images quite different than gimp. It seems as if the (gimp) NEF import step did something to the white-balance and gamma so that imported images did look worse. The worst thing is: while f-spot does display beautiful images it is not able to export them to a more sharable format as JPEG.</p>
<p>GIMP is using ufraw to convert the NEF images, after playing with its parameters I&#8217;ve discovered that using a downloaded color profile for the D40 and some custom Gamma and Continuity values does provice a near approximation of the f-spot results. The used values are:</p>
<table>
<tbody>
<tr>
<th>Gamma</th>
<td>0.4</td>
</tr>
<tr>
<th>Continuity</th>
<td>0.01-0.04</td>
</tr>
<tr>
<th>ICC</th>
<td><a href="http://ufraw.sourceforge.net/Colors/nkx-d40.icm">got it here</a></td>
</tr>
<tr>
<th>White-Balance</th>
<td>use camera</td>
</tr>
</tbody>
</table>
<p>A drawback of using ufraw is it&#8217;s slow processing speed. Interestingly using <em>ufraw-batch</em> on the command line does not exhibit this problem, so just use:</p>
<pre>ufraw-batch --gamma 0.4 --contuinity 0.02 --wb=camera *.NEF</pre>
<p>While not being a problem at all, this is something that should work out-of-the-box, ie. the user should not be irritated by photos being displayed differently between applications.</p>
]]></content:encoded>
			<wfw:commentRss>http://snikt.net/index.php/2010/03/03/nikon-d40-nefraw-images-with-linux/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Howto integrate Skype and Ubuntu&#8217;s indicator-applet</title>
		<link>http://snikt.net/index.php/2010/01/21/howto-integrate-skype-and-ubuntus-indicator-applet</link>
		<comments>http://snikt.net/index.php/2010/01/21/howto-integrate-skype-and-ubuntus-indicator-applet#comments</comments>
		<pubDate>Thu, 21 Jan 2010 16:41:10 +0000</pubDate>
		<dc:creator>andy</dc:creator>
				<category><![CDATA[Desktop-related]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[indication-applet]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[notifications]]></category>
		<category><![CDATA[skype]]></category>

		<guid isPermaLink="false">http://happiness-is-slavery.net/?p=457</guid>
		<description><![CDATA[Computers provide users with various communication channels (as facebook, twitter, chat programs like ICQ, jabber, Skype). Each channel usually provides an own program for interacting with other users using that channel. To prevent users from being overwhelmed Ubuntu added the notifier-applet. It unifies all different communication notifications into one simple panel applet. I am using [...]]]></description>
			<content:encoded><![CDATA[<p>Computers provide users with various communication channels (as facebook, twitter, chat programs like ICQ, jabber, Skype). Each channel usually provides an own program for interacting with other users using that channel. To prevent users from being overwhelmed Ubuntu added the <a title="Plans for the MessagingMenu within Ubuntu" href="https://wiki.ubuntu.com/MessagingMenu/">notifier-applet</a>. It unifies all different communication notifications into one simple panel applet.</p>
<p>I am using <a title="skype for linux" href="http://share.skype.com/sites/linux/">Skype</a> for most of my online communication, mostly because other people are using it and there are strange firewalls at work preventing most other protocols. Alas there&#8217;s no support for Skype out of the box and the skype linux crew is kinda slow (Skype 2.1, anyone?). Enters me who needed some diversion from master thesis writing..</p>
<div id="attachment_454" class="wp-caption alignright" style="width: 310px"><a href="http://happiness-is-slavery.net/wp-content/uploads/2010/01/screenshot.jpg"><img class="size-medium wp-image-454" title="Screenshot of the Indicator-Applet Skype plugin" src="http://happiness-is-slavery.net/wp-content/uploads/2010/01/screenshot-300x191.jpg" alt="Screenshot of the Indicator-Applet Skype plugin" width="300" height="191" /></a><p class="wp-caption-text">indicator-applet with skype</p></div>
<p>May I introduce <a title="indicator plugin for skype" href="http://github.com/andreashappe/indicator-applet-skype">indicator-skype-client.py</a>: it&#8217;s a small script, written in two or three hours (most of the time spent upon finding strange bugs in python-indicate). It currently provides a list of unread messages. When a username is clicked the corresponding skype window is opened or created. By clicking on the Skype label its main window is displayed. So far it works.. various updates will follow.</p>
<p><strong>How to install?</strong><br />
Just start the python script while skype is already running. Skype will ask if you want to allow the script to access its data, just answer yes. The script will do the rest. It does not install itself into the user session, so you&#8217;ll have to start it if you want skype notifications.</p>
<p><strong>TODOs</strong></p>
<ul>
<li>There are various workarounds in the code (for example I needed an empty callback to get things displayed), work out those bugs</li>
<li>currently there&#8217;s a hard refresh every 5 seconds (in addition to incoming message detection). This will have to go and be replaced with a more dynamic scheme.</li>
<li>detect if an unread conversation was openend within Skype and do not display this conversation</li>
<li>somehow automatically start the script when Skype or the indication-applet starts</li>
</ul>
<p>So some things are missing, but the script is already workable. Have fun (and please provide patches if you fix problems (: ).</p>
]]></content:encoded>
			<wfw:commentRss>http://snikt.net/index.php/2010/01/21/howto-integrate-skype-and-ubuntus-indicator-applet/feed</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
		<item>
		<title>blog is moving</title>
		<link>http://snikt.net/index.php/2009/10/26/blog-is-moving</link>
		<comments>http://snikt.net/index.php/2009/10/26/blog-is-moving#comments</comments>
		<pubDate>Mon, 26 Oct 2009 12:28:18 +0000</pubDate>
		<dc:creator>andy</dc:creator>
				<category><![CDATA[Admin-stuff]]></category>
		<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://happiness-is-slavery.net/?p=447</guid>
		<description><![CDATA[Or rather evolving into a new system. I just haven&#8217;t enough time at my hands to create regular blog posts. This might change after my master thesis will eventually be finished but letting a web page lying dormant ain&#8217;t best style. As I was down with the flu the last days I wrote a small [...]]]></description>
			<content:encoded><![CDATA[<p>Or rather evolving into a new <a href="http://github.com/andreashappe/narcissism">system</a>.</p>
<p>I just haven&#8217;t enough time at my hands to create regular blog posts. This might change after my master thesis will eventually be finished but letting a web page lying dormant ain&#8217;t best style.</p>
<p>As I was down with the flu the last days I wrote a small replacement system: it&#8217;s just around 150 lines of rails code that captures my twitter feed and allows me to write write longer posts/memos.</p>
<p>The idea is that tweets are aggregated through the day and presented as formatted RSS feed (so there should be no RSS spamming). Longer stuff (as the typical &#8220;how did I get x working under Linux&#8221; things that happen from time to time) will be integrated with the tweets (yeah, not done yet).</p>
<p>After all coding it was pretty straightforward and fun.. the only drawback is that the RSS feed URL will change, ie. your newsreader will loose my feed.</p>
]]></content:encoded>
			<wfw:commentRss>http://snikt.net/index.php/2009/10/26/blog-is-moving/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>New server and virtual machines</title>
		<link>http://snikt.net/index.php/2009/06/17/new-server-and-virtual-machines</link>
		<comments>http://snikt.net/index.php/2009/06/17/new-server-and-virtual-machines#comments</comments>
		<pubDate>Wed, 17 Jun 2009 15:28:45 +0000</pubDate>
		<dc:creator>andy</dc:creator>
				<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://happiness-is-slavery.net/?p=396</guid>
		<description><![CDATA[After three years it was time to move the server (under which this blog is hosted) again. Now we get eight times the memory for the same monthly price, not bad indeed. The newly setup environment makes heavy use of virtual machines and this is the topic of this post. A friend of mine and [...]]]></description>
			<content:encoded><![CDATA[<p>After three years it was time to move the server (under which this blog is hosted) again. Now we get eight times the memory for the same monthly price, not bad indeed. The newly setup environment makes heavy use of virtual machines and this is the topic of this post.</p>
<p>A friend of mine and I once already managed a server that consisted of virtual machines handled through Xen. Setting up the base hypervisor (the operating system under which the guest virtual machines run) was a major PITA, especially on a remote machine where you do not have access to the boot manager.</p>
<p>Now fast forward to today, I&#8217;m using Ubuntu 9.04. Most of the work was done by just installing <em>ubuntu-virtual-server</em> and <em>ubuntu-vm-builder</em>. The former setups a virtual environment (using KVM) with a virtual network hub where the new virtual machines will be connected on a private subnet. Adding a new virtual machine was more or less invoking <em>ubuntu-vm-builder</em> which states the name of the vm, its distribution and size and then starting it with <em>virsh start name-of-the-vm</em>. Afterwards you&#8217;re already able to login to the virtual machine through SSH, add some routing rules on the host machine so that the virtual machines are accessable from the internet and you&#8217;re done.</p>
<p>Later on I&#8217;ve found some other capabilties of the <em>virsh</em> tool: pool and volume management. Alas while it was able to detect and view my LVM partitions I was not able to dynamically attach one volume to a VM, but maybe this will function soon.</p>
<p>Another nice tool is <em>virt-manager</em>. This gtk-application allows to connect to a remote host running <em>ubuntu-virt-machine</em>. You&#8217;re then able to monitor and alter the settings of the network, guest virtual machines and volumes from a graphical tool, also there&#8217;s a VNC/console forwarding for accessing the remote machine even if the network dies or is misconfigured.</p>
<p>All after all I must say that I&#8217;m impressed with the usability progress..</p>
]]></content:encoded>
			<wfw:commentRss>http://snikt.net/index.php/2009/06/17/new-server-and-virtual-machines/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SECOQC: We&#8217;ve done it</title>
		<link>http://snikt.net/index.php/2008/10/12/secoqc-weve-done-it</link>
		<comments>http://snikt.net/index.php/2008/10/12/secoqc-weve-done-it#comments</comments>
		<pubDate>Sun, 12 Oct 2008 19:01:34 +0000</pubDate>
		<dc:creator>andy</dc:creator>
				<category><![CDATA[Life]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Software Development]]></category>

		<guid isPermaLink="false">http://happiness-is-slavery.net/?p=294</guid>
		<description><![CDATA[Over the last one and a half years I&#8217;ve been involved with the SECOQC project. It&#8217;s goal was to provide a prototype of a quantum key distribution network. Such a system would provide unconditional security, thus wouldn&#8217;t be isn&#8217;t vulnerable to improvements in computing power as traditional cryptography. The final presentation of the prototype happened [...]]]></description>
			<content:encoded><![CDATA[<p>Over the last one and a half years I&#8217;ve been involved with the <a href="http://www.secoqc.net">SECOQC</a> project. It&#8217;s goal was to provide a prototype of a quantum key distribution network. Such a system would provide unconditional security, thus <span style="text-decoration: line-through;">wouldn&#8217;t be</span> isn&#8217;t vulnerable to improvements in computing power as traditional cryptography.</p>
<p>The final presentation of the prototype happened this Wednesday. The last days and nights before that were filled with applying the last fixed but finally it was worth the time. But let the newspapers do the talking: <a href="http://futurezone.orf.at/it/stories/311988/">orf</a>, <a href="http://www.heise.de/newsticker/Erstes-Quantenkryptographie-Netz-in-Wien--/meldung/117082">heise</a>, <a href="http://derstandard.at/?id=1220460265474">der standard</a>, <a href="http://newsticker.sueddeutsche.de/list/id/213783">sueddeutsche</a>, <a href="http://www.telekom-presse.at/channel_computing/news_34403.html">Austrian Telekom News</a>. There was quite good news coverage in german-speaking Europe (and some eastern europe countries) but sadly the news didn&#8217;t seem to have jumped over the pond (at least some American physicists were at the presentation so it got noticed anyway).</p>
<p>Feels strange to know that something that big and cutting-edge is finally successfully finished.. and that I&#8217;m an unemployed student agai</p>
]]></content:encoded>
			<wfw:commentRss>http://snikt.net/index.php/2008/10/12/secoqc-weve-done-it/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>What makes a bug a remote hole?</title>
		<link>http://snikt.net/index.php/2008/05/02/what-makes-a-bug-a-remote-hole</link>
		<comments>http://snikt.net/index.php/2008/05/02/what-makes-a-bug-a-remote-hole#comments</comments>
		<pubDate>Thu, 01 May 2008 22:00:04 +0000</pubDate>
		<dc:creator>andy</dc:creator>
				<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://happiness-is-slavery.net/?p=285</guid>
		<description><![CDATA[From the BSD that claims of itself: Only two remote holes in the default install, in more than 10 years! from its latest changelog (4.3): Assorted improvements and code cleanup: .. TCP responses to highly fragmented packets are now constructed without risking corruption of kernel memory. Erm, colour me confused but a network-triggered memory corruption [...]]]></description>
			<content:encoded><![CDATA[<p style="text-align: left;">From the BSD that claims of itself:</p>
<p style="text-align: center;"><strong><span style="color: #e00000;">Only two remote holes in the default install, in more than 10 years!</span></strong></p>
<p>from its latest <a href="http://www.openbsd.org/43.html#new">changelog</a> (4.3):</p>
<p><em>Assorted improvements and code cleanup:</em></p>
<ul>
<li><em>..</em></li>
<li><em>TCP responses to highly fragmented packets are now constructed without risking corruption of kernel memory.</em></li>
</ul>
<p>Erm, colour me confused but a network-triggered memory corruption sounds like a remote hole. At least it shouldn&#8217;t have been placed in the &#8216;code cleanup&#8217; section.</p>
]]></content:encoded>
			<wfw:commentRss>http://snikt.net/index.php/2008/05/02/what-makes-a-bug-a-remote-hole/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Ruby on Rails vs. Java, part 1</title>
		<link>http://snikt.net/index.php/2008/02/17/ruby-on-rails-vs-java-part-1</link>
		<comments>http://snikt.net/index.php/2008/02/17/ruby-on-rails-vs-java-part-1#comments</comments>
		<pubDate>Sun, 17 Feb 2008 17:05:38 +0000</pubDate>
		<dc:creator>andy</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Ruby on Rails]]></category>
		<category><![CDATA[Software Development]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[ruby]]></category>
		<category><![CDATA[ruby on rails]]></category>

		<guid isPermaLink="false">http://happiness-is-slavery.net/index.php/2008/02/17/ruby-on-rails-vs-java-part-1</guid>
		<description><![CDATA[One of the components of the system developed here at Blackwhale is an fairly advanced web mail/campaigning and analytics system. The first iteration of that component was fully implemented in Ruby on Rails. Writing the front end was fairly easy and fast, a perfect opportunity for Rails to display its strengths. On the back end [...]]]></description>
			<content:encoded><![CDATA[<p>One of the components of the system developed here at <a href="http://www.blackwhale.net">Blackwhale</a> is an fairly advanced web mail/campaigning and analytics system. The first iteration of that component was fully implemented in <a href="http://www.rubyonrails.org">Ruby on Rails</a>. Writing the front end was fairly easy and fast, a perfect opportunity for Rails to display its strengths. On the back end and communication part on the other hand I stumbled into various problems:</p>
<ul>
<li>Compared to PHP, Python or Java there are just too few communication libraries. And even the libraries that exist are lacking fundamental features and almost all of them come without useable documentation. That there is no encryption (SSL or TLS) support in the whole Ruby 1.8 mail libraries is an outright shame. The IMAP library is so clumsy that a web company sells their own (still not perfect library) through their online store and they seem to make a good buck with it.
<p>On the Java side is just a completly different picture: Lots of libraries, even documented ones are available. After having to touch the <a href="http://tmail.rubyforge.org/">TMail</a> (rail&#8217;s MIME mail handler library) API using javax.mail is a heavenly gift. And it seems that the TMail generated MIME messages were invalid in a couple of cases. Not the best feature of a support library. Also the chance of finding unsolved known bugs and errors seems to be lot smaller in Java.</li>
<li>This brings me to another point: I might change my opinion on Java&#8217;s constraints on its users. Java tries hard to prevent errors (i.e. the forced exception catching). I always thought that that took too many stylish possibilities away from the user, but by now I must confess that I think that this is exactly what I want from something that I&#8217;m using on the network side. I&#8217;m a lazy programmer, I want to be reminded and forced to write secure and stable code. This is the quite different to Ruby and Rails &#8216;make it easy for the programmer&#8217; attitude.</li>
<li>Background processing is hard. As Ruby on Rails is not multi-thread safe you can&#8217;t just spawn a thread if you need to perform some longer running task. Another disadvantage of using a single-process model is that the long running request will occupy one rails worker (i.e. rails cluster process) until it has finished &#8211; in our case that costs us around 60MB of memory per long running request, even if it is just waiting for some simple SMTP feedback. If you can find a situation where you can delay the execution of a network related task (and if you don&#8217;t you&#8217;re not thinking) for two seconds, 6 requests per seconds will DoS a standard rails cluster.
<p>The only solution that&#8217;s actually usable is <a href="http://backgroundrb.rubyforge.org/">BackgroundRb</a>. But projects that just change their background communication system just don&#8217;t sound to production-grade ready for me. Also the admin start/stop scripts for their background server didn&#8217;t work too well for me.</li>
<li>For a language that interferes it&#8217;s object&#8217;s attribute types directly from the database the ActiveRecord layer is weak. Don&#8217;t get me wrong, I understand that the Simplicity is needed to make it easily usable but I ran into various situations where I&#8217;d love to have a full blown ORM behind me. One feature that is needed quite often by our application is inheritance. ActiveRecord only offers single table inheritance, and even there you have to make sure that each row is valid (ActiveRecord should have all needed information to do that by itself BTW) or you will run into problems later on. One problem is, that it tries to abstract too much functionality away from the database while not provided as advanced interfaces by itself. Data integrity handling? Abstracted away by rails, so all databases can be used the same. The drawback is, that the data constraints and relations are fully handled by rails and not passed on to the database. Any process that might produce invalid data (e.g. a faulty rails component) might corrupt the data. Rails is able to handle that cases by itself (due to ducktyping and very few default checks), but access that data with any other framework and it blows up directly into your face.</li>
<li>Transaction handling. Just try it. Then cry. Also I&#8217;m not sure if Transaction handling is even done on database level or in Rails (as done with constraints). If the later is true, it&#8217;s acutally not worth anything as soon as more processes try to access the database.</li>
</ul>
<p>The library and documentation problems where the main reason for me to reimplement the mailing and campaigning backend in Java. The front end is still a Rails application &#8212; which is exactly what Rails is for. As I&#8217;m no friend of blown-up EJB based solutions I&#8217;ve choosen a simple Spring and JPA based solution for that problem.</p>
<p>I&#8217;m currently testing the last features and replacing the Ruby code part by part. As soon as I&#8217;ve done that another blog post will examine the two implementations, how much time was spent on coding them and how they perform when compared to each other.</p>
]]></content:encoded>
			<wfw:commentRss>http://snikt.net/index.php/2008/02/17/ruby-on-rails-vs-java-part-1/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>to rockbox or not to rockbox..</title>
		<link>http://snikt.net/index.php/2007/12/04/to-rockbox-or-not-to-rockbox</link>
		<comments>http://snikt.net/index.php/2007/12/04/to-rockbox-or-not-to-rockbox#comments</comments>
		<pubDate>Tue, 04 Dec 2007 21:57:26 +0000</pubDate>
		<dc:creator>andy</dc:creator>
				<category><![CDATA[Desktop-related]]></category>
		<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://happiness-is-slavery.net/index.php/2007/12/04/to-rockbox-or-not-to-rockbox/</guid>
		<description><![CDATA[I own an iPod for the last three years, happiness fluctuated in that time (mostly because of Apple&#8217;s crappy customer service). Lately I became fed up with Apple&#8217;s proprietary stance, especially its repeated attempt to make the iPod unusable from platforms other than Windows and MacOS got on my nerves. I was able to circumvent [...]]]></description>
			<content:encoded><![CDATA[<p>I own an iPod for the last three years, happiness fluctuated in that time (mostly because of Apple&#8217;s crappy customer service). Lately I became fed up with Apple&#8217;s proprietary stance, especially its repeated  attempt to make the iPod unusable from platforms other than Windows and MacOS got on my nerves.</p>
<p>I was able to circumvent the other short comings as the iTunesDB which a little painful to use through Linux as well as the limited audio codec choice the firmware offered.</p>
<p>I knew about the alternative firmwares like <a href="http://www.rockbox.org">rockbox</a> and <a href="http://ipodlinux.org">iPodLinux</a> but my earlier attempts where rather frustrating installation was hard, usability not as good as Apple&#8217;s and the battery life-span suboptimal.</p>
<p>The day before yesterday I retried rockbox and am very positively surprised: I suspected another cryptic command line installation routine but got a graphical tool (<a href="http://www.rockbox.org/twiki/bin/view/Main/RockboxUtilityQt">rbutilqt</a>) which allowed a single-click installation. The same tool downloads all needed files and firmwares, also it used for installation of new themes. This is the first advantage above the normal iPod: rockbox has theming support.</p>
<p>The first impression isn&#8217;t too impressive for rockbox: it just shows a simple navigation list in a way to small font. I never thought that my iPod&#8217;s display would be that high-resolutioned..</p>
<p><img src="http://www.rockbox-themes.org/data/320x240x16/DockPod_Aqua.png" align="left" height="240" width="320" />The first configuration step was to select a better theme. I don&#8217;t want to hear the critics (you know who you are) that will claim that the only good looking and usable themes look like aqua-ish or media player-ish copies. At least they work better than the normal iPod GUI, which in hindsight now looks rudimentary. The theme that I currently use shows details as battery state in percent, estimated rest battery capacity in hours, acute volume information. Apple could copy that. The drawback is that while the &#8216;Currently playing&#8217;-screen is themeable (and some themes are great) the music selection screen is just the list, rendered in a way too small font (which is configurable, but changing it might break some themes). Rockbox could copy Apple&#8217;s simple music selection. I use my iPod as a music player, not as a small computer.</p>
<p>Are there other advantages from using rockbox? Quite a few! Crossfading and volume normalization are features that you can easily get used to. Also rockbox supports around 15 different audio formats (compared to the original iPod&#8217;s four), of which I use at least ogg and flac regularly. I can also get 10-12h of playback time out of my iPod &#8211; I don&#8217;t have the times ready for the original firmware as it didn&#8217;t really state it.</p>
<p>And desecrating an Apple product is also quite fun..</p>
]]></content:encoded>
			<wfw:commentRss>http://snikt.net/index.php/2007/12/04/to-rockbox-or-not-to-rockbox/feed</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Dell&#8217;s CompleteCare insurance</title>
		<link>http://snikt.net/index.php/2007/11/03/dells-completecare-insurance</link>
		<comments>http://snikt.net/index.php/2007/11/03/dells-completecare-insurance#comments</comments>
		<pubDate>Sat, 03 Nov 2007 15:48:09 +0000</pubDate>
		<dc:creator>andy</dc:creator>
				<category><![CDATA[Desktop-related]]></category>

		<guid isPermaLink="false">http://happiness-is-slavery.net/index.php/2007/11/03/dells-completecare-insurance/</guid>
		<description><![CDATA[As I tend to break hardware every now and then I bought Dell&#8217;s CompleteCare pack for my new notebook computer. It comes with an comparable price tag to common insurances: approx. Euro 250 for 3 years. Yesterday I got time to read the insurance policy  (which is issued by London General Insurance Company Limited), there [...]]]></description>
			<content:encoded><![CDATA[<p>As I tend to break hardware every now and then I bought Dell&#8217;s CompleteCare pack for my new notebook computer. It comes with an comparable price tag to common insurances: approx. Euro 250 for 3 years.</p>
<p>Yesterday I got time to read the insurance policy  (which is issued by London General Insurance Company Limited), there were some disappointments in it:</p>
<p>CompleteCare &#8211; accident protection part:</p>
<ul>
<li>While the insurance is world-wide the notebook will only be replaced in some countries. Those include most European ones but the United States are excluded. If an accident happens in one excluded country it is my task to get the notebook to an included country where London&#8217;s Insurance agent might do the repair.</li>
<li>The insurance is limited to three insurance claims</li>
<li>Buckles and scratches are excluded as well as damages done through fire</li>
<li>As soon as repair is done by anyone except an accepted agent the insurance warrant is void</li>
<li>no war or terror related damages will be repaired</li>
</ul>
<p>CompleteCare &#8211; burglary related part:</p>
<ul>
<li> The same country specific limitations occur &#8211; so I should be covered but wouldn&#8217;t get a new computer if I&#8217;m in the U.S.</li>
<li>The insurance only covers burglaries as long as there was an actually attack (against my person) or housebreaking is involved. If the notebook gets stolen at a airport the insurance won&#8217;t hold.</li>
<li>If I leave the notebook at work it&#8217;s not enough if the work room is secured, the notebook must be stored in a safe deposit box or such.</li>
</ul>
<p>Needless to say that I&#8217;m not really impressed.</p>
<p>I do understand that the computer is only replaced in countries where there&#8217;s Dell support available but why are the United States excluded?</p>
<p>The burglary insurance is next to useless as long as the &#8220;kingston lock security chain&#8221; is not a valid protection measure (as noted in the policy). But hey, what do expect of a company with a Ltd. in its name?</p>
]]></content:encoded>
			<wfw:commentRss>http://snikt.net/index.php/2007/11/03/dells-completecare-insurance/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
