HomeHome ArchiveArchive

SpatiaLite

Geodaten im SpatiaLite-Format

SpatiaLite Performance

Erste Resultate mit dem HSR Texas Geo Database Benchmark sind vorhanden, müssen aber noch verifiziert werden.

SpatiaLite auf Live-DVD

Zum Testen von SpatiaLite eignet sich die FOSS4G Live-DVD. Sourcepole hat die aktuelle Version sowie Testdaten zur DVD hinzugefügt.

Support

Sourcepole bietet Support beim Einsatz von SpatiaLite im professionellen Umfeld.

Testing complex Webapps with wget

How do you test web applications? You can use Selenium, but Selenium is very heavy.

I tried wget.

To find out what exactly to send to the app, I started Firebug inside Firefox, went to the “Network” section and recorded what I would do, to see, whether the application works. Then I took the accessed URLs together with the parameters and first tried to send them manually from the command line. Observe, that Firebug lets you copy the exact POST/GET parameter as was sent by the browser, when you right click on the POST/GET command in the Firebug Network log. Once I managed to redo all the steps manuall from the commandline I transferred what I did into a script and edited it until it was nice and would run through:

$ history > test_my_web_app

test\_my\_web\_app now looks as follows:

\#![](/bin/bash
#
# check availability of:
url="http://www.example.org/my-app"

# exit immediately if something goes wrong -> test fails)
set ~~e

echo “Testing \$url”

\# save an error log in case there’s an error so that
\# we can analyse it further
error\_log=\$
cookies=\$

echo “In case the tests fail, you’ll find the error log under \$error\_log”
\# send everything that goes to STDERR to the log
exec 2\>\$error\_log

echo “Getting a cookie…”
wget —save-cookies \$cookies “\$url”~~O /dev/null

1.  we could put username/password directly into the script but we’re cautuous and don’t
    echo ~~n “please enter user for \$url:”; read user
    echo~~n “please enter password for \$url:”; read ~~s pass
    echo
    
    echo “Logging in…”
    \# if we logged in successfully, then the webapp will send us an html page
    \# that contains the following string:
    to\_verify=“You’re logged in”
    \# POST to the webapp:
    wget —load-cookies \$cookies 
     —post-data “login=Login&user\_login=\$user&user\_password=\$pass” 
     —save-cookies \$cookies 
     —keep-session-cookies 
     “\$url/login” 
    ~~O - 
    | grep ~~q “\$to\_verify”
    
    \# now we’re logged in
    
    echo “Query component DB…”
    \# First search the DB 
    num\_components\_found=\$
    
    echo “Make sure that the app found something…”
    [ \$num\_components\_found~~gt 0 ]

echo “Generate and get picture…”
wget —load-cookies \$cookies 
 —save-cookies \$cookies 
 —post-data ‘index=0’ 
 “\$url/get-pic” 
 -O /dev/null

echo “Hooray, \$url successfully tested”

rm \$error\_log
rm \$cookies

Surprisingly easy, isn’t it?

munin plugin multi_http_responsetime doesn’t recognize dead servers

Here’s a patch:

# diff -u multi_http_responsetime.orig multi_http_responsetime
--- multi_http_responsetime.orig        2010-02-01 10:13:22.000000000 +0100
+++ multi_http_responsetime     2010-02-01 10:30:23.000000000 +0100
@@ -16,6 +16,9 @@
 use Time::HiRes qw( time );
 use IO::Socket;

+$FAILED=0;
+$INFINITE=999999;
+
 # ----- config -----
 push(@url_array, "http://www.google.de");
 push(@url_array, "http://www.t-online.de");
@@ -34,7 +37,7 @@
                                        PeerPort => 80,
                                        Proto => 'tcp'
                                        );
-       return(0) unless ($sock);
+       return($FAILED) unless ($sock);
        print $sock "GET $baseurl HTTP/1.1\nHost: $vhost\nConnection: close\n\n";
        while (<$sock>) {
                $data .= $_;
@@ -63,11 +66,16 @@
                $baseurl =~ s@^\w+://.+?(/)@\1@;

                $tick1 = time();
-               geturl;
+               $retval = geturl;
                $tick2 = time();

-               $tspent = $tick2-$tick1;
-               $msecs = ($tspent * 1000);
+               if ($retval == $FAILED) {
+                       $msecs = $INFINITE;
+                       }
+               else {
+                       $tspent = $tick2-$tick1;
+                       $msecs = ($tspent * 1000);
+                       }

                printf "timespent$i.value %.3f\n", $msecs;
                }