The trick is to use vmstat and look at the number for “wait on acknowledge”.
Look under “cpu” and the “wa” column. If this number is high, it is bad. It should be zero. Some sample output from vmstat looks like this:
procs -----------memory---------- ---swap-- -----io---- -system-- ----cpu----
r b swpd free buff cache si so bi bo in cs us sy id wa
0 0 0 406 83 3062 0 0 1 5 1 4 0 0 99 1
0 0 0 406 83 3062 0 0 0 0 2020 49 0 0 100 0
0 0 0 406 83 3062 0 0 0 0 2020 41 0 0 100 0
0 0 0 406 83 3062 0 0 0 0 2018 53 0 0 100 0
Look at the column furthest to the right.
Warning: This is a description of how to create a OpenStreetMap WMS with GeoServer. It works fine up to the point where the layers published as an unstyled WMS. This is where I’ve not been able to produce a good result, because of lack of a good Styled Layer Descriptor (SLD). If you have hints about a good SLD, feel welcome to submit a comment!
The idea is/was to first create a good general purpose OpenStreetMap WMS, and then use GeoWebCache to generate tiles from this WMS source in a custom projection, epsg:25832 in our case.
Continue reading “OpenStreetMap tiles in EPSG:25832 projection using GeoServer”
If you have an ESRI Shapefile (.shp) that you want to reproject, you can use ogr2ogr
ogr2ogr -t_srs <EPSG-CODE> newfile.shp oldfile.shp
The EPSG code could be for instance epsg:28532.
Warning: This is not the hardest way to create a word cloud from pdf-documents, but it’s up there.
Say you have directory containing pdf documents:
Continue reading “Creating a word cloud from PDF documents”
Show a very long list of details about your machine and kernel (verbose output)
Continue reading “Show system info on a Mac”
Found this nice post on good commands to know appart from the obvious top
Basically they are
Continue reading “How to monitor system stuff on Mac”
I have a text file containing article references. It looks like this
- Miller HJ (2004) Tobler’s First Law and spatial analysis. Ann Assoc Am Geogr 94:284–289.
- Onsrud H, ed (2007) Research and Theory in Advanced Spatial Data Infrastructure Concepts (ESRI Press, Redlands, CA).
- Egenhofer M (2002) Toward the geospatial semantic web. Advances in Geographic Information Systems International Symposium, eds Makki Y, Pissinou N (Association for Computing Machinery, McLean, VA), pp 1–4.
- Anselin L, Florax R, Rey S, eds (2004) Advances in Spatial Econometrics: Methodology, Tools and Applications (Springer, Berlin).
- Wang S, Armstrong M (2009) A theoretical approach to the use of cyberinfrastructure in geographical analysis. Int J Geogr Inf Sci 23:169–193.
- Wang S (2010) A cyberGIS framework for the synthesis of cyberinfrastructure, GIS, and spatial analysis. Ann Assoc Am Geogr 100:535–557.
- Penninga F, Van Oosterom PJM (2008) A simplicial complex-based DBMS approach to 3D topographic data modelling. Int J Geogr Inf Sci 22:751–779.
- Baker KS, Chandler CL (2008) Enabling long-term oceanographic research: Changing data practices, in- formation management strategies and informatics. Deep-Sea Res II 55(18–19):2132–2142.
I wanted to find out what the most common first author is in that long list of articles, and this is what I did:
cat refs-2009+.txt | \
sed -e '/^ *$/d' -e 's/^- //' | \
cut -d"(" -f1 | \
cut -d, -f1 | \
cut -d' ' -f1 | \
sort | \
uniq -c | \
sort -r > \
The result is this:
The following assumes a linux command line to be present (or Mac OS X terminal in my case).
I want to wrangle text from the internet, turn it into JSON data, and ultimately stick it in CouchDB. Here I’m trying to turn a random text file containing prime numbers into structured JSON data that looks like this:
The original file is here: http://primes.utm.edu/lists/small/1000.txt. It is fairly structured to begin with, but it’s not JSON.
The First 1,000 Primes
(the 1,000th is 7919)
For more information on primes see http://primes.utm.edu/
2 3 5 7 11 13 17 19 23 29
31 37 41 43 47 53 59 61 67 71
73 79 83 89 97 101 103 107 109 113
The following line does turns it into JSON:
curl http://primes.utm.edu/lists/small/1000.txt | \
tail +4 | \
tr -cs "[:digit:]" "," | \
sed -e 's/^,/\[/' -e 's/,$/\]/' \
Let’s look at it with cat to make sure:
$ cat primes.json
Explanation of the command
curl is used to download the file and print it on standard output in the terminal. With no arguments it issues a HTTP GET for http://primes.utm.edu/lists/small/1000.txt.
tail +4 discards the first four lines.
tr -cs "[:digit:]" "," converts the text into digits followed by commas. The new text has a comma before the first digit, and a comma after the last one. No linebreaks or spaces: ,2,3,5,7...,7919,
sed -e 's/^,/\[/' -e 's/,$/\]/' is perhaps a bit hard to read. It replaces the comma before the first digit with '[', and replaces the comma after the last digit with ']'.
Today I installed the utility shp2geocouch on Mac OS X 1.6.
First I needed to update RubyGems…
Then I could install shp2geocouch
sudo gem install shp2geocouch
Next I downloaded OSM data for Copenhagen, Denmark
Finally I used shp2geocouch to upload one of the shape files to iriscouch.com (database gd.iriscouch.com/cphosm).
shp2geocouch europe_northern_europe_denmark_copenhagen_highway.shp gd.iriscouch.com/cphosm
This takes a while and the job is still running on my MacBook Pro (after ~10 minutes 16000 documents have been loaded into iriscouch.com). The final count was 33306 documents.
As a final touch, the script replicates geocouch-utils + map browser and tells me
view your data on a map at http://gd.iriscouch.com/cphosm/_design/geo/_rewrite
Your browser does not support IFRAME
The map uses OSM tiles from cloudmade as background, and fetches clickable road data from iriscouch using XHR:
Clicking the link, gives you this:
Your browser does not support IFRAME