maZZoo maZZoo's blog
very low frequency tech postings  -  code
    home
    blog
    feed
    eyes
    info

    code [12]
    dect [4]
    hard [8]
    meta [5]
    security [5]

jul 2009 (1)
jun 2009 (1)
jan 2009 (2)
dec 2008 (1)
oct 2008 (1)
jan 2008 (1)
oct 2007 (1)
jun 2007 (1)
feb 2007 (3)
jan 2007 (3)
nov 2006 (2)
aug 2006 (2)
jul 2006 (1)
may 2006 (1)
nov 2005 (2)
oct 2005 (1)
apr 2005 (2)
mar 2005 (2)
feb 2005 (1)
jan 2005 (1)
may 2004 (1)
jan 2004 (1)
apr 2003 (1)
jan 2003 (1)

Tue, 30 Jun 2009

NoWhere - yet another geocaching appilcation for mobile phones

geocaching is fun, GPS devices are cheap, and nowadays get integrated into mobile phones. But mobile SW is crap.
I had a WinCE5.0 based HTC device (o2 XDA Orbit/HTC Artemis/HTC P3300/T-Mobile MDA Compact III). While the HW sounded promising, the Win-SW is completely crap, often the phone traps into a state where everything still works, but the phone won't react on incoming calls. The good thing about the device is that starting TomTom almost turns it into another device. TomTom is a great navigation SW, that I like and I still use the device for that.
For geocaching however TomTom5.0 is also not very smart, as geocachers note their coordinates in such a form:

  DDD° MM.MMM',  DDD° MM.MMM'
 N 48° 12.345', E 12° 34.567'
whereas TomTom only shows coordinates in this style:
  DDD.DDDDD°,  DDD.DDDDD°
 N 48.20575°, E 12.57612
now for a normal geocache this is no problem - you calculate your destination coordinates at home and enter them in the format the device likes.
But for a multicache it becomes nasty, you only discover coordinates for the next hint on the way, and have to calculate them en route. Sitting with a calculator or the calculator SW in your mobile phone takes much of the fun of geocaching.

For some month I use a Nokia E71 - it was recommended to me, and I like it - the type of bugs and crashes is different, but its a revelation alone not to see random windows error message popups. Mobile SW still has a long way to go.
But the Nokia E71 is not any better, GPS wise. The shipped Nokia GPS application only shows coordinates in the same format as TomTom:
  DDD.DDDDD°,  DDD.DDDDD°
 N 48.20575°, E 12.57612°
So I started looking for a simple geocaching SW that met my requirements:
- runs on one of my 2 devices
- royalityfree
- coordinates displayed in the geocaching style DDD° MM.MMM', DDD° MM.MMM'
- works offline (I don't have a flatrate nor am I expecting every cache to have 2G/3G coverage, also I am unwilling to pay)
- opensource would be nice but is no must
I looked at like 10 different "solutions" which all failed for me. So I did something very unusual - and hopefully unique - I wrote a JAVA(tm) program:
It's very minimalistic, and has all features you need for a successfull sunday multi-cache.


you can download it here:

- NoWhere.jar
- NoWhere.jad
- sourcecode: git clone anongit@mazzoo.de:/git/NoWhere.git
  password: git-pub

For building I used the Sun Java Wireless Toolkit for CLDC

Update: obviously I couldn't have gone through all the pain of java without the help of a friend - thanks Simon!

posted in /code  |  link  |  comments [1]   
Tue, 05 Jun 2007

there's more to the picture than meets the eye

While the above statement is valid in real life, I'd disagree with it when brought in digital context.

here's a tiny patch for xpdf giving you back the descision whether to read your PDF documents on the screen or on paper.

xpdf-3.02-salvage-your-eye.patch

diff -Nur xpdf-3.02-orig/xpdf/SecurityHandler.cc xpdf-3.02/xpdf/SecurityHandler.cc
--- xpdf-3.02-orig/xpdf/SecurityHandler.cc      2007-02-27 23:05:52.000000000 +0100
+++ xpdf-3.02/xpdf/SecurityHandler.cc   2007-06-05 12:23:37.000000000 +0200
@@ -373,9 +373,6 @@
     return gFalse;
   }
   permFlags = (*xsh->authorize)(xsh->handlerData, docData, authData);
-  if (!(permFlags & xpdfPermissionOpen)) {
-    return gFalse;
-  }
   if (!(*xsh->getKey)(xsh->handlerData, docData, &key, &length, &encVersion)) {
     return gFalse;
   }
diff -Nur xpdf-3.02-orig/xpdf/XRef.cc xpdf-3.02/xpdf/XRef.cc
--- xpdf-3.02-orig/xpdf/XRef.cc 2007-02-27 23:05:52.000000000 +0100
+++ xpdf-3.02/xpdf/XRef.cc      2007-06-05 12:26:31.000000000 +0200
@@ -771,19 +771,19 @@
 }

 GBool XRef::okToPrint(GBool ignoreOwnerPW) {
-  return (!ignoreOwnerPW && ownerPasswordOk) || (permFlags & permPrint);
+  return gTrue;
 }

 GBool XRef::okToChange(GBool ignoreOwnerPW) {
-  return (!ignoreOwnerPW && ownerPasswordOk) || (permFlags & permChange);
+  return gTrue;
 }

 GBool XRef::okToCopy(GBool ignoreOwnerPW) {
-  return (!ignoreOwnerPW && ownerPasswordOk) || (permFlags & permCopy);
+  return gTrue;
 }

 GBool XRef::okToAddNotes(GBool ignoreOwnerPW) {
-  return (!ignoreOwnerPW && ownerPasswordOk) || (permFlags & permNotes);
+  return gTrue;
 }

 Object *XRef::fetch(int num, int gen, Object *obj) {

theres more to some open-source authors than others want.



posted in /code  |  link  |  comments [0]   
Wed, 24 May 2006

rndpic

rndpic is a small CGI which chooses a random jpg image from a directory and delivers it to a http server. You can see it live in my "eyes" section. Reload to see another picture.

rndpic-0.1.tar.bz2



posted in /code  |  link  |  comments [1]   


Thu, 10 Nov 2005

bluestep

/*
 * bluestep - locks your screen once you step out of the room,
 *            provided that you took your bluetooth enabled
 *            mobile phone with you.
 *
 * version 0.01
 *
 * usage: bluestep <bdaddr>
 *
 *      bdaddr  - MAC address of the remote bluetooth device
 *
 *
 * (c) 2005 by Matthias Wenzel, licensed under GPLv2
 *
 */

this tiny daemon peridically pings your bluetooth mobile, if doesn't get responses for a while it will lock your X desktop with "xscreensaver-command -lock".

hints:
figure out your <bdaddr> with:
# hciconfig hci0 up
# hcitool scan
Scanning ...
        00:11:22:33:44:55       my_left_foot
# 
try to ping your device (hciconfig/hcitool/l2ping come with your bluetooth libraries and tools):
# l2ping -c 3 00:11:22:33:44:55
Ping: 00:11:22:33:44:55 from 00:55:44:33:22:11 (data size 44) ...
0 bytes from 00:11:22:33:44:55 id 0 time 27.52ms
0 bytes from 00:11:22:33:44:55 id 1 time 32.05ms
0 bytes from 00:11:22:33:44:55 id 2 time 47.04ms
3 sent, 3 received, 0% loss

if the above command works you're probably set to run bluestep!

bluestep-0.01.tar.bz2



posted in /code  |  link  |  comments [0]   


Mon, 03 Oct 2005

fbskate - bouncing jpegs on framebuffer devices

a quick and dirty hack to display jpegs on a framebuffer device. images larger or smaller than the framebuffer will bounce off the edges in good old pong style. this code does not do any errorchecking, all is "works for me" quality!

BUGS:
 I don't do propper /dev/fb0 handling, just enough to run on my 32 bit
 framebuffer devices. Virtual resolutions are probably unsupported.
 I don't do propper JPEG decoding. BW images and somewhat rare color
 mappings won't work.


fbskate-0.01.tar.bz2


posted in /code  |  link  |  comments [0]   


Wed, 13 Apr 2005

Tendrils level viewer - a Perl/GTK2 tutorial

level viever screenshot


I was playing Tendrils. Too much of it - until I didn't get on in level 5. Actually level 5 was buggy on that release ;)
But I decided to continue the aventure in programming Perl/GTK2 and had my autodidactic tutorial in displaying the level maps. Having been there having done that, I consider GTK2 being very slow in Perl and Tendrils being a good reminder of my 8bit childhood.

showlevel-0.1.0.tar.bz2


posted in /code  |  link  |  comments [0]   


Mon, 11 Apr 2005

mplscan

mplscan are my first steps in libdnet. read from the source:

/*
 * mplscan 0.1.0
 * sends out MPLS packets over IPv4/GRE
 * packet format: [ IPa [ GRE [ MPLS [ IPb [ UDP ]]]]]
 *
 * actually i didn't test whether machines answer to this type of
 * packets, but rumors have it they do. i wrote this to keep my
 * fingers warm and get into libdnet, and i added GRE and MPLS support.
 *
 * (c) 2005 by Matthias Wenzel, mazzoo /at/ mazzoo.de
 * mplscan.c is licensed under GPLv2
 * the two files gre.h and mpls.h are "AS IS" and may make it into libdnet
 *
 */

mplscan-0.1.0.tar.bz2

posted in /code  |  link  |  comments [0]   


Mon, 07 Mar 2005

oldcalendar.pl

in the listed years you can use old calendars from the years printed on the right:

$ ./oldcalendar.pl 2005 2020 100
2005 :  1994 1983 1977 1966 1955 1949 1938 1927 1921 1910
2006 :  1995 1989 1978 1967 1961 1950 1939 1933 1922 1911
2007 :  2001 1990 1979 1973 1962 1951 1945 1934 1923 1917 1906
2008 :  1980 1952 1924
2009 :  1998 1987 1981 1970 1959 1953 1942 1931 1925 1914
2010 :  1999 1993 1982 1971 1965 1954 1943 1937 1926 1915 1909
2011 :  1994 1983 1977 1966 1955 1949 1938 1927 1921 1910
2012 :  1984 1956 1928
2013 :  2002 1991 1985 1974 1963 1957 1946 1935 1929 1918 1907
2014 :  2003 1997 1986 1975 1969 1958 1947 1941 1930 1919 1913
2015 :  1998 1987 1981 1970 1959 1953 1942 1931 1925 1914
2016 :  1988 1960 1932
2017 :  1995 1989 1978 1967 1961 1950 1939 1933 1922 1911
2018 :  2001 1990 1979 1973 1962 1951 1945 1934 1923 1917 1906
2019 :  2002 1991 1985 1974 1963 1957 1946 1935 1929 1918 1907
2020 :  1992 1964 1936 1908
sourcecode:

#!/usr/bin/perl -w

# oldcalendar.pl [startyear] [endyear] [recentyears]
#
# prints out the years of old calenders you could use
# in startyear (def=2005) through endyear (def=2010)
# considering calenderyears [startyear-recentyears .. startyear-1]
#
# (c) 2005 Matthias Wenzel


use strict;

sub weekday($$$){
	my ($day, $month, $year) = @_;
	# see
	# http://www.tondering.dk/claus/cal/node3.html#SECTION00360000000000000000
	my $a = int( (14 - $month) / 12 );
	my $y = $year - $a;
	my $m = $month + 12 * $a - 2;
	my $d = ( $day + $y + int($y / 4) - int($y / 100) + int($y / 400) + 31 * int($m / 12) ) % 7;
	return $d;
}

my $start = 2005;
my $end   = 2010;
my $old   =   50; # dump $start - $old calenderyears

$start    = $ARGV[0] if $ARGV[0];
$end      = $ARGV[1] if $ARGV[1];
$old      = $ARGV[2] if $ARGV[2];

$end = $start if $start > $end;

my $curr=$start;
while ($curr <= $end){
	print $curr . " : ";
	my $o = $start - 1;
	while ($o ne ($start - $old)){
		if (( weekday(1,1,$curr) eq weekday(1,1,$o) ) & ( weekday(31,12,$curr) eq weekday(31,12,$o) )){
			print " " . $o;
		}
		$o--;
	}
	$curr++;
	print "\n";
}



posted in /code  |  link  |  comments [0]   


Mon, 28 Feb 2005

dynamics mobile IP SNMP extension

Within the research project IPonAir Sascha Janz and Timo Drick from the University of Frankfurt extended the dynamics mobile IP package with SNMP. You will need net-snmp to get it running.




posted in /code  |  link  |  comments [0]   


Sat, 29 May 2004

crossgcc - ARM patch

Building crosscompilers was a pain in the ass. Up to gentoo's crossdev.sh script. Here's a patch for crossdev.sh for StrongARM CPUs - it should do for other ARMs either, just change the -mcpu and -mtune flags. It patches a tiny bug in glibc-2.3.2 and adds ARM support into crossdev.sh.

Actually the patch does one more thing: the original script copies (!) all source trees from /var/tmp/portage/[binutils|gcc|glibc|linux-headers] to /var/tmp/portage/crossdevbuild. The cp ist replaced by a mv (probably not the gentoo way, but saves me space on the HDD during build time).

The files are licensed under GPL v2.

o patch against crossdev 0.4-r1
o the standalone patched crossdev.sh-arm-move


posted in /code  |  link  |  comments [1]   


Fri, 25 Apr 2003

das clock fake 77

'das clock fake 77' is a radio transmitter.

dcf77 screenshot


This program paints black and white stripes on your screen. Your monitor will now emit electromagnetic waves. Basically a carrier frequency of 77500 Hz. In Europe commonly used DCF77-radio-clocks will tune into that frequency and listen ... to be honest, only if they're close enough to your monitor they may/might. The screen image will be modulated to emit the 59 information bits plus the one sync bit per minute. Actually we only need to switch between two static images once per second, but with a high timing precision of about 50ms. Nothing evil will happen to your monitor or LCD, we're not playing with your modelines or the sync of your monitor. The program uses the SDL-library to acess the screen, this can be a problem when you don't have HW-acceleration - I had to switch back to 16bpp on my X to get the required 20fps. The program now tests wether the screen performance is sufficient to achieve the required 20 fps.

See the README for more details. Get it here.


posted in /code  |  link  |  comments [1]   


Fri, 31 Jan 2003

ptrace() kernel vulnerabilities

There have been several bugs in the linux kernel 2.2 and 2.4 ptrace() syscall. I keep being conservative, I use old kernels and protect them with the no_ptrace kernel module npt.c (download)


posted in /code  |  link  |  comments [0]   


validate HTML