Total Pageviews

Thursday, April 18, 2013

VirtualBox - Let Host-Only mode access the internet

In an earlier post I described networking modes in VirtualBox. Combining those modes you'll get some kind of swiss knife in realizing somehow exotic networking modes in your VMs.
What if you want your VM that is configured for Host-Only mode access the internet?
Port forwarding using NAT is an option. But for me that sounded to complicated. I had the following requirements:
  1. The host should be able to access services like Apache or GlassFish on the guests (the virtual machine)
  2. The guests should be able to access the outside world (intranet/internet)
  3. The guests should be able to talk to each other using fixed IP adresses
  4. The host should be able to talk to the guests using fixed IP adresses
A working solution for these requirements is described in this blog article.

Sunday, March 10, 2013

Using symbolic links under Windows

Since Windows Vista it is possible to use symbolic links just like you know it under Linux/Unix systems.
Warning: You have to use the command line to use this tool ;-)
The syntax is as follows:

 mklink [[/d] | [/h] | [/j]] <Link> <Target>  

Most of the time I use it with the /d option. This lets the link point to a directory.

Sunday, February 17, 2013

Fixing poor performance (lagging) on Samsung Galaxy Nexus GSM (i9250) phones

Woohoo, I can't believe it. My Galaxy Nexus phone is affected by a bug which causes the phone to slow down and to behave very laggy after a while. Some users reported this might happen when they uploaded or downloaded huge files (e.g. movies).
I can't tell whether huge files caused this problem on my Galaxy Nexus, but from one day to another the phone was reacting very slow. It was no longer usable for me. Typing a single character on the keyboard was a pain in the ass ...
I started to google around and found this posting on XDA which saved my phone's life ;-)
If you are experiencing the same behavior on your Galaxy Nexus you might consider following the steps there. But be careful not to HARD BRICK your phone, because your phone must have a special chipset.
My phone was produced in 08/2012 and really has the "suspicious" V3U00M chipset mentioned in the XDA posting. I checked it using the eMMC Brickbug Check app from the play store.
If your phone is not rooted you can't fix the problem. Either you root it now, or you send it to Samsung and let them repair/swap it. It's up to you.
The next thing to do was to run the LagFix (fstrim) free app or paid version. I now use the paid version, because it has a built in scheduler which runs fstrim every night.
The script mentioned in the posting isn't necessary if you use the paid version of LagFix.
After running the LagFix app my phone was reacting as fast as on the day I bought it and it remains fast until now.

Thursday, February 7, 2013

Multi Line Table Cells in Vaadin 6

I had a hard time figuring out how to wrap content in a table cell using Vaadin 6.7.
Content in row headers can be forced to wrap using a simple "<br/>" tag in the string. Unfortunately it isn't that simple with non-header cells.
I found a working solution in this Vaadin forum post.
You simply have to create your own CSS stylesheet definition and add the following code to it:

 .v-table-cell-wrapper {   
  white-space: normal;   
 }  

Tuesday, February 5, 2013

Howto compress and uncompress a Java byte array using JDK Deflater/Inflater

If you ever came across the requirement to store binary data somewhere (e.g. filesystem or database) it might be handy to compress those data.
Besides the common ZIP algorithm Java offers the Deflater and Inflater classes that uses the ZLIB compression library. ZLIB is part of the PNG standard and not protected by any patents.
Here is a small code snippet which shows an utility class that offers two methods to compress and extract a Java byte array.

 package de.qu.compression.demo;  
   
 import java.io.ByteArrayOutputStream;  
 import java.io.File;  
 import java.io.FileInputStream;  
 import java.io.FileOutputStream;  
 import java.io.IOException;  
 import java.io.InputStream;  
 import java.util.List;  
 import java.util.Map;  
 import java.util.zip.DataFormatException;  
 import java.util.zip.Deflater;  
 import java.util.zip.Inflater;  
   
 public class CompressionUtils {  
  private static final Logger LOG = Logger.getLogger(CompressionUtils.class);  
    
    
  public static byte[] compress(byte[] data) throws IOException {  
   Deflater deflater = new Deflater();  
   deflater.setInput(data);  
   
   ByteArrayOutputStream outputStream = new ByteArrayOutputStream(data.length);   
       
   deflater.finish();  
   byte[] buffer = new byte[1024];   
   while (!deflater.finished()) {  
    int count = deflater.deflate(buffer); // returns the generated code... index  
    outputStream.write(buffer, 0, count);   
   }  
   outputStream.close();  
   byte[] output = outputStream.toByteArray();  
   
   deflater.end();

   LOG.debug("Original: " + data.length / 1024 + " Kb");  
   LOG.debug("Compressed: " + output.length / 1024 + " Kb");  
   return output;  
  }  
   
  public static byte[] decompress(byte[] data) throws IOException, DataFormatException {  
   Inflater inflater = new Inflater();   
   inflater.setInput(data);  
   
   ByteArrayOutputStream outputStream = new ByteArrayOutputStream(data.length);  
   byte[] buffer = new byte[1024];  
   while (!inflater.finished()) {  
    int count = inflater.inflate(buffer);  
    outputStream.write(buffer, 0, count);  
   }  
   outputStream.close();  
   byte[] output = outputStream.toByteArray();  
   
   inflater.end();
   
   LOG.debug("Original: " + data.length);  
   LOG.debug("Uncompressed: " + output.length);  
   return output;  
  }  
 }  
   

It is also possible to receive better compression results by calling the method setLevel of the Deflater class and specify the constant Deflater.BEST_COMPRESSION.

Thursday, January 3, 2013

Howto install icinga with the new PHP based web interface on Ubuntu 12.04

I had a hard time finding good articles about how to install icinga with the new web based PHP interface on Ubuntu 12.04.
I didn't want to grab the sources and compile it. Not that I am not able to do that, but in my opinion it should be an easier way to install it. We are living in 2013 and not in the last century ...
Anyway, to make a long story short I found a very good step by step guide on askubuntu which worked for me exactly the way it was described.
Kudos!

Tuesday, January 1, 2013

Google Kontakte in Roundcube Webmail nutzen

Die Einbindung von Google Kontakten in das Adressbuch von Roundcube ist mittels eines Plugins problemlos möglich.
Diese Anleitung beschreibt das Verfahren genau und ausführlich. Der dort aufgeführte Link auf die Zend GData API funktioniert aber nicht mehr.
Ich habe die aktuelle Version (1.12.1) von dieser URL heruntergeladen. Damit funktioniert es einwandfrei.

Sunday, December 30, 2012

Friday, December 28, 2012

Pure-FTP Daemon unter Ubuntu Linux installieren und konfigurieren

Und noch eine Perle der Installationsdokumentationen zum Aufsetzen eines FTP Servers (hier Pure FTP unter Ubuntu/Debian). Unter diesem Link findet sich eine schnelle und wie ich finde gut geschriebene, verständliche Anleitung zum Aufsetzen eines FTP Servers.

Mailserver für einen Homeserver unter Linux einrichten

Wer schon immer mal einen Mailserver auf seinem eigenen Server zu Hause betreiben möchte (Stichwort DynDNS), der sollte sich mal diese wirklich gute Anleitung durchlesen.
Die dort beschriebenen Komponenten

  • Postfix
  • Dovecot
  • Fetchmail
  • Sieve

harmonieren sehr gut zusammen.
Generell ist das komplette Wiki dort sehr gut aufgebaut und enthält einige sehr nützliche und tolle Anleitungen.

Wednesday, December 26, 2012

Networking modes in VirtualBox explained

VirtualBox offers different networking modes. Sometimes it's a little bit confusing to understand what each mode is doing exactly and which mode you should choose.
So this posting is a very quick and good overview of the various networking modes.
For those who wants the virtualized guest OS operating as a full member in a network the Bridged Networking mode is the way to go.
With this mode each network member can see and access the guest OS.

Saturday, December 22, 2012

Remove all unused Ubuntu Kernel images, headers and modules

Seeing that my linux box is running low on free space I decided to remove all unused Linux kernel images on my Ubuntu 10.04 system.
For some unknown reason Ubuntu Tweak refused to install properly so I decided to go a different way and used the command from this blog article.

The command mentioned in the blog is

dpkg -l 'linux-*' | sed '/^ii/!d;/'"$(uname -r | sed "s/\(.*\)-\([^0-9]\+\)/\1/")"'/d;s/^[^ ]* [^ ]* \([^ ]*\).*/\1/;/[0-9]/!d' | xargs sudo apt-get -y purge  


If you don't understand what this command does I recommend to dig into the topic. I must admit it is a little bit complex, but the command is working well.

Use it at your own risk!

Now my system is cleaned up and still boots the correct and latest kernel. All other kernel images, headers and modules are completely removed.

Thursday, December 20, 2012

Slider widget in Android allowing minimum and maximum (range) values

Can you believe it? There is no standard slider widget in Android available allowing to set a minimum and a maximum value. There is in fact the Seekbar widget that allows to set one value with a thumb.
Either you implement it yourself or you use one of the free available alternatives.

  1. Range Seekbar project on Google Code
  2. Double handled slider for Android referenced on Stackoverflow


In addition you can customize the look and feel of the slider. Take a look at these tutorials:

  1. Custom styled UI Slider
  2. Seekbar your way

Sunday, December 16, 2012

Search box gadget in my Blogger blog does not work

The Search Box Gadget in my Blogger blog does not work reliable. Some search terms show results others not, though the search terms are present in my blog.
Using the Blogger navbar searches the blog as well and produces correct search results.
It seems the Search Box Gadget has a bug.
I found a solution from 2009 that still works around this problem.
So the real question is, is it a bug or a feature? And if it's a bug, why does it take Google so long to fix it?

Thursday, December 13, 2012

SU not working for newly added "root" apps on rooted Nexus 7 and Galaxy Nexus

Recently I installed CatLog on my rooted Nexus 7 device which needed root to work properly. With astonishment I saw that CatLog did not gain root privileges. Superuser refused to do so.
Taken a look into superuser, I saw that already a few apps had root privileges and were doing fine. Just to be sure I started Titanium Backup and the app obtained root privileges without any problems.
Hm, what could be the problem with CatLog?
Seems that newly added apps can not obtain root privileges...

To be sure my device was still rooted properly (I used OTA Rootkeeper in the past when upgrading to new Android versions) I installed Got Root from the Play market and run it on my device.

One of the tests failed saying:

Failed to obtain root privileges through 'su'.

Ok, not sure why, but somehow my device lost its proper root attribute.
It may have something to do with OTA Rootkeeper but I am not sure. I used it when upgrading from 4.1.2 to 4.2 and to 4.2.1.

Anyway, I rerooted it with the Nexus 7 Toolkit. This is an incredible great piece of software and it works on devices running Android 4.2.1.

No surprise that my Galaxy Nexus phone had the same problems. I used to use OTA Rootkeeper there as well ...


Wednesday, December 12, 2012

Numbered Headings in Confluence

Ever wanted to have numbered headings in Confluence? Either on the wiki page or in PDF exports?
The Numbered Headings plugin can do this.
In its simplest form you just go with the default values and get decimal numbers prefixing the headings.


The plugin offers a variety of options and I highly recommend to read the documentation.
Really awesome is that you now have numbered headings in PDF exports, so readers or reviewers of the PDF version can refer to the numbers instead of citing the whole heading.

Tuesday, December 11, 2012

Generating a title page in Confluence PDF export

Well, in a previous posting I already mentioned the possibility to generate a great looking PDF export title page for a wiki page created in Confluence Wiki.
Unfortunately the article mentioned in the posting was written in german. So here is - in short - a manual in english to get great looking PDF exports.
The steps described here are tested and verified in Confluence 4.1.9. I expect it to work with newer Confluence versions but there is no guarantee.

Step 1: Define the user macro in Confluence that defines the dynamic content of the title page



The code in the template textfield:
 
 ## Body processing: Selected body processing option
 ## Output: Selected output option  
 ##  
 ## Developed by:   
 ## Date created:   
 ## Installed by:  
 ## @param Titel:required=true|type=string|desc=Dokumenttitel  
 ## @param Thema:required=true|type=string|desc=Unterthema des Dokuments  
 ## @param Autor:required=true|type=string|desc=Dokument Autor  
 ## @param Datum:required=true|type=string|desc=Dokument Datum  
 ## @param Version:required=true|type=string|desc=Dokument Version  
 <style type="text/css">  
 .KonzeptTitel:before { content: '$paramTitel'; }  
 .KonzeptThema:before { content: '$paramThema'; }  
 .KonzeptAutor:after { content: '$paramAutor'; }  
 .KonzeptDatum:after { content: '$paramDatum'; }  
 .KonzeptVersion:after { content: '$paramVersion'; }  
 </style>  

Step 2: Declare a custom PDF Layout for exporting the title page

You can change the PDF Layout either globally or local for each space. In this example the space version is used.
In Confluence go to

Space - Browse - Space Admin - PDF Layout

and edit the section

PDF space export title page.

Enter the following content:

 <div style="text-align:center; padding:0px; padding-top: 50px;">  
 <img src="/download/attachments/3407974/Logo.jpg" width="70%" height="70%"/>  
 </div>  
 <div style="padding:0px">  
  <div class="KonzeptTitel pdfTitelblattTitel"></div>  
  <div class="KonzeptThema pdfTitelblattThema"></div>  
  <span class="pdfTitelblattText" style="display:inline-block; width:30mm; margin-bottom:2mm; padding-left: 200px;"><b>Autor:</b></span>  
  <span class="KonzeptAutor pdfTitelblattText"></span><br/>  
  <span class="pdfTitelblattText" style="display:inline-block; width:30mm; margin-bottom:2mm; padding-left: 200px"><b>Datum:</b></span>  
  <span class="KonzeptDatum pdfTitelblattText"></span><br/>  
  <span class="pdfTitelblattText" style="display:inline-block; width:30mm; margin-bottom:2mm; padding-left: 200px"><b>Version:</b></span>  
  <span class="KonzeptVersion pdfTitelblattText"></span><br/>  
  <br/>  
 </div>  

The file Logo.jpg is an image attachment somwewhere in the space. This image appears on top of the title page in the PDF export. You can get the url of the attached image when you go to the page where the image is attached and click on Tools - Attachments and then on the image you would like to see on the title page.

Step 3: Declare a custom PDF stylesheet for the PDF layout

The above layout references CSS stylesheets you must declare.
Still in the Space Admin section click on PDF Stylesheet and Edit PDF Export Stylesheet
Enter the following code:
 
@page  
 {  
 @top-right  
   {  
    content: page:title;  
   }  
 @bottom-left  
   {  
     content: element(Datetime);  
     font-family: ConfluenceInstalledFont, Helvetica, Arial, sans-serif;  
     font-size: 8pt;  
   }  
 @bottom-right  
   {  
     content: "Page " counter(page) " of " counter(pages) ;  
     font-family: ConfluenceInstalledFont, Helvetica, Arial, sans-serif;  
     font-size: 8pt;  
   }  
 @bottom-center  
   {  
     content: "Copyright © 2012, My Company LTD";  
     font-family: ConfluenceInstalledFont, Helvetica, Arial, sans-serif;  
     font-size: 8pt;  
     color:#595959;  
   }  
 }  
 .KonzeptTitel {   
 font-size: 36px !important;  
 text-align: center;  
 padding-top: 150px !important;  
 }  
 .KonzeptThema {   
 font-size: 24px !important;  
 text-align: center;  
 padding-top: 100px !important;  
 padding-bottom: 200px !important;  
 }  
 .KonzeptAutor {   
 font-size: 16px !important;  
 text-align: left;  
 }  
 .KonzeptDatum {   
 font-size: 16px !important;  
 text-align: left;  
 }  
 .KonzeptVersion {   
 font-size: 16px !important;  
 text-align: left;  
 }  
 .pdfTitelblattText {   
 font-size: 16px !important;  
 text-align: left;  
 }  
 .noprint  
 {  
 display: none ;  
 }  
 div.pagebreak  
 {  
   page-break-before:always;  
 }  
 .pagetitle h1 { display: none; }  

This stylesheet declares the CSS definition that was already mentioned in step 1 and 2. Furthermore it adds page numbering at the bottom (right) of the page and adds a footer at the bottom (center).
Customizing PDF exports is described in detail on this official Confluence documentation.

Step 4: Use the macro in a wiki page

The last thing to do is to insert the macro in a confluence page. Choose the macro with name konzept from the macro browser and fill in the required fields.
The following screenshot shows an example:

That's it.
One important thing to mention: You will not get the title page in your export using the PDF export from the page tools. It only works when using the PDF export method of the space.
Click on Advanced - PDF Export and select the page you would like to export. The resulting export should look something like this:



Tuesday, November 27, 2012

OTA Rootkeeper still works when updating to Android 4.2.1

Note (2013-02-18):
There is a newer blog entry available which says that OTA Rootkeeper did not properly reroot the device after upgrading to Android 4.2.1.
The observations I made when I wrote this post seem to be false.

Original blog posting:
And surprise, surprise OTA Rootkeeper has helped me once again to keep root on my Nexus 7 device.
BTW, Google rolled out Android 4.2.1 today and I already received the OTA update :-)

Sunday, November 25, 2012

Remove the page title in Confluence PDF export


Confluence always adds a page title when you export a page to PDF format.
If you want to get rid off the title do the following:

Go to

 Browse -> Space Admin -> Look and Feel -> PDF Stylesheet -> PDF Export Stylesheet -> Edit  

and add the following line:

 .pagetitle h1 { display: none; }  

Now PDF exports don't show the title anymore.

Thursday, November 22, 2012

Pagebreaks in Confluence PDF Export

It is often necessary to export a wiki page to PDF so managers, customers or other people who can't (or don't want to) access the wiki can read documents.
One thing that embarrasses me the most is that you don't have control over page breaks in Confluence PDF exports. There is - at least to my knowledge - no predefined macro available.
But there is a community macro which solves the problem. Take a look at the pagebreak user macro and try it.
With this macro you are in full control over page breaks in PDF exports.