2013-08-20

Trouble with Android and OpenBSD Access Points

This year started with trouble as I discovered that my Android tablet permanently lost the connection to my OpenBSD 5.2 access point (athn(4)). The connection was unuseable and I was frustrated that it did not work with my new gadget. I tried to find a solution and spend a lot of time studing all kind of online forums. However, without success. So, I decided use instead a Linux based of the shelf access point and my OpenBSD box went to my storage room.

Last week I gave OpenBSD a second chance. And after a few minutes searching the Internet I found a post to the Android issue. It seems that OpenBSD 5.2 did not support the energy saving features used by many mobile devices. However, they improved OpenBSD in the meanwhile and the update to 5.3 solved the issue.

Unfortunately, one point is still open. The connection hangs when Android awakes from sleep and the Wi-Fi sleep policy (keep Wi-Fi on during sleep) is set to "always".
Set it to 'never'. With that setting Android turns Wi-Fi of if it goes to sleep and automatically reconnects to the access point after wake-up. This way my Android tablet works fine with OpenBSD 5.3.

See also:

2012-05-13

Tipp: Steve McConnells Software Estimation Book

A few months ago, my boss asked me to provide some estimates for our software work. I realized that not just me but also most of my colleagues did hard dealing with this issues. A structured approach was needed. Spending some time with Google, I found the book Software Estimation: Demistifying the Black Art by Steve McConnell.

In his book, Steve McConnell starts with building up a basic understanding about the backgrounds of software estimating (e.g. cone of uncertainty). Then he describes various approaches for effort, size, and schedule estimates (e.g. expert estimates, t-shirt sizing). McConnell handles all estimates as probability distributions. This approach allows you to describe the impact of a setting a milestone a few weeks earlier or later in a very confortable way. Finally, the book ends with a section about presenting estimates to managers. Especially this last chapter is a must read for every engineer who is going to be asked to provide estimates.

The book offered me an much improved view on how to deal with estimates. McConnell created a very pratical orientated book which is easy to understand and implement. Just a little background knowledge about statistics may be helpful for fine grasp.

Finally, after reading this book I got a very good understanding what must be done to create good estimates and were we can optimize our processes. Therefore, I want to recommend it to all my readers.

http://www.stevemcconnell.com/est.htm

2010-08-09

Check Out Which Files Are Double

I wrote a little script to figure out which files are double inside a directory tree. You can see how many bytes are wasted by storing data twice.


#!/usr/bin/perl -w

# Permission is hereby granted, free of charge,
# to any person obtaining a copy of this software
# and associated documentation files (the
# "Software"), to deal in the Software without
# restriction, including without limitation the
# rights to use, copy, modify, merge, publish,
# distribute, sublicense, and/or sell copies of
# the Software, and to permit persons to whom
# the Software is furnished to do so, subject
# to the following conditions:
#
# This permission notice shall be included in
# all copies or substantial portions of
# the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT
# WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
# INCLUDING BUT NOT LIMITED TO THE WARRANTIES
# OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
# PURPOSE AND NONINFRINGEMENT. IN NO EVENT
# SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
# TORT OR OTHERWISE, ARISING FROM, OUT OF OR
# IN CONNECTION WITH THE SOFTWARE OR THE USE
# OR OTHER DEALINGS IN THE SOFTWARE.

use strict;
use File::Find;
use Digest::MD5;
use Digest::SHA;


# Debug
my $debug = 0;

# ARGV contains the basis directories
@ARGV = qw(.) unless @ARGV;
if(@ARGV > 1) {
print "Base directories: @ARGV\n\n";
} else {
print "Base directory: @ARGV\n\n";
}

# Save data in this structure
my %md5_sha_data;

# Process files
find(\&process_file, @ARGV);

# Create report
report();


sub process_file {
my $file = $_;
my $fullfile = $File::Find::name;
print "Processing: $file\n" if $debug;

my $skip = 0;

if(-d $file) {
$skip = 1;
} elsif(-l $file) {
$skip = 1;
}

if($skip) {
print "skipped\n\n" if $debug;
} else {
open(FILE,'<',$file) or die "Error: $!\n\n";
binmode(FILE);
my $md5 = Digest::MD5->new->addfile(*FILE)->hexdigest;
my $sha = Digest::SHA->new->addfile(*FILE)->hexdigest;
close(FILE);
my $size = -s $file;
print "$md5 $sha $size\n\n" if $debug;

save_data($fullfile, $md5, $sha, $size);
}
}


sub save_data {
my $file = shift;
my $md5 = shift;
my $sha = shift;
my $size = shift;
my $hash = "$md5$sha";

if(!exists($md5_sha_data{$hash})) {
$md5_sha_data{$hash}{"count"} = 1;
$md5_sha_data{$hash}{"size"} = $size;
push @{$md5_sha_data{$hash}{"filenames"}}, $file;
} else {
$md5_sha_data{$hash}{"count"} += 1;
push @{$md5_sha_data{$hash}{"filenames"}}, $file;
}
}


sub report {
my $total = 0;
for my $hash ( sort keys %md5_sha_data ){
if($md5_sha_data{$hash}{"count"} > 1) {
print "Multiple copies of equal file\n";
foreach (@{$md5_sha_data{$hash}{"filenames"}}){
print " $_\n";
}
my $sum = $md5_sha_data{$hash}{"count"} *
$md5_sha_data{$hash}{"size"} -
$md5_sha_data{$hash}{"size"};
$total += $sum;
print "$sum Bytes\n\n";
}
}

my $KBytes = $total / 1024;
$KBytes = sprintf("%.0f", $KBytes);
my $MBytes = $KBytes / 1024;
$MBytes = sprintf("%.0f", $MBytes);

print "$total Bytes ($KBytes KiB, $MBytes MiB) wasted space\n\n";
}

2010-08-03

Automatic FlightGear Scenario Downloader

FlightGear is a very nice open source flight simulator software. A major component of any flight simulator is the world scenery. The FlightGear project provides scenery files for the complete world on their FTP server. Unfortunately, the world scenery consists of more than 500 files. Each file approx 50 to 70 mega bytes in size.

A manual download of these files would require much endurance, as the server only permits four parallel downloads at the same time.

Therefore, I developed a script for automatic scenario downloading. Now, my computer can download the whole world scenery without any user interaction.

The script provides two interesting features:

It extracts a download list from the MD5SUM file that is available on the webserver. Thus, the downloader automatically detects which files are available. Later the MD5 sums are used to verify if the download was successful or not.

Furthermore, the scipt checks if files have been downloaded in the past. It skips these files to prevent downloading files twice. This way the user can easily interrupt and continue the downloading process.


#!/bin/bash

# Permission is hereby granted, free of charge,
# to any person obtaining a copy of this software
# and associated documentation files (the
# "Software"), to deal in the Software without
# restriction, including without limitation the
# rights to use, copy, modify, merge, publish,
# distribute, sublicense, and/or sell copies of
# the Software, and to permit persons to whom
# the Software is furnished to do so, subject
# to the following conditions:
#
# This permission notice shall be included in
# all copies or substantial portions of
# the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT
# WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
# INCLUDING BUT NOT LIMITED TO THE WARRANTIES
# OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
# PURPOSE AND NONINFRINGEMENT. IN NO EVENT
# SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
# TORT OR OTHERWISE, ARISING FROM, OUT OF OR
# IN CONNECTION WITH THE SOFTWARE OR THE USE
# OR OTHER DEALINGS IN THE SOFTWARE.


URL="ftp://ftp.ibiblio.org/pub/mirrors/flightgear/ftp/Scenery-1.0.1/"
MD5SUM="MD5SUM"

WGET="/usr/bin/wget"
MD5="/usr/bin/md5sum"

if [ ! -f $MD5SUM ]
then
echo "### Downloading MD5SUM file"
wget "$URL$MD5SUM"
fi

if [ -f $MD5SUM ]
then
FILELIST=$(cat $MD5SUM | awk '{print $2}')
MD5LIST=$(cat $MD5SUM | awk '{print $1}')
CNT=1;

for FILE in $FILELIST
do
if [ ! -f $FILE ]
then
echo "### Downloading $FILE"
wget "$URL$FILE"

MD5ORIG=$(echo $MD5LIST | cut -d ' ' -f $CNT)
MD5FILE=$($MD5 $FILE | awk '{print $1}')

if [ $MD5ORIG == $MD5FILE ]
then
echo "### Success"
else
echo "### Error"
fi
else
echo "### File $FILE exists!"
fi

let CNT=$CNT+1
done


else
echo "### ERROR: Can not find file $MD5SUM"
fi


If you are not interested in FlightGear, you maybe use this scipt to download other files based on a MD5SUM file provided on a Web or FTP site.

2009-12-31

Slow Eye of Gnome

Recently, Eye of Gnome (eog) was extremly slow during startup and when switching between images. Starting eog took around 4-8 seconds which is to much for an acceptable working performance.

Gnome Bug 500772 brought me to the following workaround: Simply remove ~/.recently-used.xbel

It seems that this XML file becomes very large and parsing will take much time. After removing this file eog starts in less than a second and also switching between images is really fast now.

2009-12-28

X-Man Brought Microsoft Flight Simulator X

Hurray, I survived X-MAS (christmas for the noobs)!!!

The X-Man (Santa Clause for the noobs) brought Microsoft Flight Simulator X. He knew that I like to play flight simulators but he forgot that I avoid to use the Windows OS. Regardless, I tryed to play it.

Installing MFSX on a Xeon 2,4 GHz system with 1 GB RAM took more than 1 hour and wasted 15 GB of my harddisk.

No Protection of Data Privacy with Microsoft Products

After the installation it is necessary to activate the game. Therefore the serial number must be entered and the game will connect to a Microsoft server and send all kind of data about your system.

Naturally, I denied sending information about MY SYSTEM! But, without activation I cannot use the game without limitations.

Finally, I decided to remove MFSX from my hard disk and to send the game back to Microsoft. Now, I will spend the money on X-Plane which works on my Linux OS and does not require activation.

ATI Radeon DRI and AGP Problem

The last weeks I have been fighting with my ATI Radeon 9700 Pro graphic card. 3D support won't work and glxgears -info listed at least 320 FPS. Too less for playing 3D games.
I was using the open source radeon driver because the closed source fglrx driver worked not at all.

I was trying all kind of options in my /etc/X11/xorg.conf but they did not change anything.
Yesterday I found the following line in my /var/log/Xorg.0.log:

(EE) RADEON(0): [agp] AGP failed to initialize. Disabling the DRI.

This information lead me to a bug listing of the Ubuntu distribution. They figured out that EDAC causes a problem with AGP.

EDAC (Error Detection and Correction) is a set of Linux kernel modules for handling hardware-related errors. Its major focus has been ECC memory error handling.

A workaround is to blacklist the EDAC module in the /etc/modprobe.d/blacklist file.

/etc/modprobe.d/blacklist:
blacklist e7xxx_edac

The exact name of the EDAC module depends on the chipset of your mainboard. So it is necessary to figure out which module relates to your board before blacklisting.

Now, 3D support works fine. And I get up to 4550 FPS with the open source radeon driver of my Lenny distribution.

I hope this bug will be fixed in future kernel releases because error detection is also a important feature and it would be fine to use it together with a working AGP bus.