Saturday, October 31, 2009

AWK dictionary, second version

A newer version of the 'awk dictionary' program: you can store string pairs, and ask for any of them. The program will give you back its pair. (In this version it does not matter, that the questioned string is the first or second one of the pair.)



BEGIN {
ARGC = 2; ARGV[1] = "-"
do {
printf("prompt>")
while ((input = getline) > 0)
if ($0 ~ "exit") {
print "Exit!"
input = 0;
break
} else if(NF > 1)
{
a[$1] = $2;
b[$2] = $1;
break
} else if(NF == 1)
{
printf $1 " ";
print a[$1] b[$1];
break
}
} while (input > 0)
}



A sample output:
D:\Awk>awk talk
prompt>He Helium
prompt>Ne Neon
prompt>He
He Helium
prompt>Neon
Neon Ne
prompt>exit
Exit!

Thursday, October 29, 2009

Indigo

http://opensource.scitouch.net/indigo/
Not geology-related, the above link directs to a chemical open-source toolkit. I'm wondering if there exists something similar to geography as well.

International Space Station animation

http://i.usatoday.net/tech/graphics/iss_timeline/flash.htm
I didn't know, that some parts were moved from one place to another while building.

Tuesday, October 27, 2009

Pi with awk

The other day I needed to find a good rational estimation for pi - don't ask why.
Awk was at hand, and with this few lines I found, what I forgot: 22/7, and 355/113 are the most 'famous' estimations for pi. The next - more precise - approximation is 52.163/16.604, which is not that 'nice.'

Here are the lines:
BEGIN{
x = 3;
y = 1;
pi = 3.1415926535897932384626433832795;
diff = 1;
searchfor = pi;

for(f = 0; f < 100000; f++){
if(x / y < searchfor){x = x + 1;}else{y = y + 1;}
diffnew = abs(searchfor - x / y);
if(diffnew < diff){
printf ("%d/%d=%10.20f\n",x,y, x/y);
diff = diffnew;
}
}
}

function abs(number){
if(number < 0){return -number;}else{return number;}
}

Monday, October 26, 2009

Strange Maps

At this place you can find strange - sometimes funny, sometimes interesting - maps.
Worth checking...

The good thing with these maps is that they can easily give you some insight without having to read linear text.. you can learn visually, concentrate on the characteristics of the information.
So, they can provide some kind of small paradigm-shift without a lot of mindwork.

[Here is one (not fun, but interesting map) for those, who have read The Man In The High Castle (by Philip K. Dick): http://strangemaps.files.wordpress.com/2007/10/uusieurooppa.png ]

Saturday, October 17, 2009

Bad memories written with lasers

"Researchers have devised a way to write memories onto the brains of flies, revealing which brain cells are involved in making bad memories."......uhhh that shocked me....clean memories......
I am not fly, that is a good point :)


http://news.bbc.co.uk/2/hi/science/nature/8310365.stm

2008 AFE ANALYST OF THE YEAR

Save cost and save time with feature analyst! A very good ArcGIS extension.



http://www.featureanalyst.com/feature_analyst/publications/success/sansouci.ppt