If you end up in a situation where your PHP installation gets ahead of your application (like fx. if your hosting provider deprecates PHP 7.4 without you having had the opportunity to update your WordPress 4.9.22 blog), here is a small tip if this results in errors related to the, in PHP 8 removed, function get_magic_quotes_gpc() (see PHP RFC from 2018 about this decision).
As this function has been a dummy function returning false since PHP 5.4 (see php-src commit removing the functionality) and emitting a deprecation warning since PHP 7.4 (see php-src commit deprecating function) in almost any case perceivable you would be able to fake this function and satisfy your application’s need for it to exist.
To fix this for WordPress add the following line to the wp-includes/load.php file (fx. at line 7 for v4.9.22);
function get_magic_quotes_gpc() {return false;}
And voila! WordPress will be functional again (please consider using the chance to upgrade).
Unless, of course, there are other problems related to the PHP upgrade…
This could fx. be ancient themes (like Ahimsa) that use deprecated associative array notation (unquoted string literal indexes). These needs fixing first by adding quotes to all of the indexing strings in sub-arrays of the $skin_fields array, like below;
$skin_fields = array ( array ( "name" => "skinpagebgtopbg", "desc" => "Page Background Top", "csssel" => "#bgtop", "attr" => "background-color" ), array ( "name" => "skinpagediv", "desc" => "Page Background Divider Colour", "csssel" => "#bgtop", "attr" => "border-bottom-color" ), array ( "name" => "skinpagebgbotbg", "desc" => "Page Background Bottom", "csssel" => "BODY", "attr" => "background-color" ), array ( "name" => "skinhyperlinks", "desc" => "Hyperlinks", "csssel" => "A", "attr" => "color" ), array ( "name" => "skincapsulebg", "desc" => "Default Bubble Background", "csssel" => ".capsule", "attr" => "background-color" ), array ( "name" => "skincapsulefg", "desc" => "Default Bubble Text Colour", "csssel" => ".capsule", "attr" => "color" ), array ( "name" => "skinheaderbg", "desc" => "Header Background", "csssel" => "#header", "attr" => "background-color" ), array ( "name" => "skinheaderfg", "desc" => "Header Text Colour", "csssel" => "#header, #header table, #header a", "attr" => "color" ), array ( "name" => "skinheadersepcolour", "desc" => "Colour of Separator Bar in Header", "csssel" => "#title", "attr" => "border-right-color" ), array ( "name" => "skinsidebarbg", "desc" => "Sidebar Background", "csssel" => ".sidebar, .tdsidebar", "attr" => "background-color" ), array ( "name" => "skinsbwidgetbg", "desc" => "Sidebar Widgets Background", "csssel" => ".sidebarlist", "attr" => "background-color" ), array ( "name" => "skinsbwidgetfg", "desc" => "Sidebar Widgets Text Colour", "csssel" => ".sidebarlist", "attr" => "color" ), array ( "name" => "skinsblegendbg", "desc" => "Sidebar Widget Title Background", "csssel" => ".sidebarlist > legend", "attr" => "background-color" ), array ( "name" => "skinsblegendfg", "desc" => "Sidebar Widget Title Text Colour", "csssel" => ".sidebarlist > legend", "attr" => "color" ), array ( "name" => "skinsblistdiv", "desc" => "Sidebar/Action Lists Divider Colour", "csssel" => ".sidebarlist li, #postaction li", "attr" => "border-top-color" ), array ( "name" => "skinsblink", "desc" => "Sidebar Widget Hyperlinks", "csssel" => ".sidebarlist a", "attr" => "color" ), array ( "name" => "skincalcaption", "desc" => "Sidebar Calendar Caption Colour", "csssel" => "#wp-calendar caption", "attr" => "color" ), array ( "name" => "skincalheaderbg", "desc" => "Sidebar Calendar Column Header Background", "csssel" => "#wp-calendar thead th, #wp-calendar tfoot td.pad", "attr" => "background-color" ), array ( "name" => "skincalheaderfg", "desc" => "Sidebar Calendar Column Header Text Colour", "csssel" => "#wp-calendar thead th", "attr" => "color" ), array ( "name" => "skincalcellfg", "desc" => "Sidebar Calendar Entries Text Colour", "csssel" => "#wp-calendar tbody td", "attr" => "color" ), array ( "name" => "skincalnpbg", "desc" => "Sidebar Calendar Next/Prev Links Background", "csssel" => "#wp-calendar #next, #wp-calendar #prev", "attr" => "background-color" ), array ( "name" => "skincalnpfg", "desc" => "Sidebar Calendar Next/Prev Links Text Colour", "csssel" => "#wp-calendar #next, #wp-calendar #prev, #wp-calendar tfoot a", "attr" => "color" ), array ( "name" => "skintextwdgtfg", "desc" => "Sidebar Text Widget Text Colour", "csssel" => ".textwidget", "attr" => "color" ), array ( "name" => "skincontentbg", "desc" => "Main Content Background", "csssel" => "#content", "attr" => "background-color" ), array ( "name" => "skinpostpagebg", "desc" => "Post or Page Entry Background", "csssel" => ".post > fieldset", "attr" => "background-color" ), array ( "name" => "skinpostpagefg", "desc" => "Post or Page Entry Text Colour", "csssel" => ".entry", "attr" => "color" ), array ( "name" => "skinpptitlebg", "desc" => "Post, Page, Comments Title Background", "csssel" => ".post .title, #comments > legend, .comment > legend, #responsebox > legend", "attr" => "background-color" ), array ( "name" => "skinpptitlefg", "desc" => "Post, Page, Comments Title Text Colour", "csssel" => ".post .title, .post .title a, " . "#comments > legend, .comment > legend, #responsebox > legend", "attr" => "color" ), array ( "name" => "skinmetabarbg", "desc" => "Post/Page/Comment Bottom Bar Background", "csssel" => ".postmetadata", "attr" => "background-color" ), array ( "name" => "skincattagbg", "desc" => "Category/Tag Lists Background", "csssel" => ".postcattags", "attr" => "background-color" ), array ( "name" => "skincattagfg", "desc" => "Category/Tag Lists Text/Link Colour", "csssel" => ".postcattags, .postcattags a", "attr" => "color" ), array ( "name" => "skin1cattagbubblebg", "desc" => "Single Post Cat/Tag Bubble Background", "csssel" => "#single .postcattags .capsule", "attr" => "background-color" ), array ( "name" => "skin1cattagbubblefg", "desc" => "Single Post Cat/Tag Bubble Text/Link Colour", "csssel" => "#single .postcattags .capsule, #single .postcattags .capsule a", "attr" => "color" ), array ( "name" => "skinbqbg", "desc" => "Blockquote Background", "csssel" => "blockquote", "attr" => "background-color" ), array ( "name" => "skinbqfg", "desc" => "Blockquote Text Colour", "csssel" => "blockquote", "attr" => "color" ), array ( "name" => "skinlistbg", "desc" => "Page/Post Ordered/Unordered List Background", "csssel" => ".entry UL, .entry OL", "attr" => "background-color" ), array ( "name" => "skinlistfg", "desc" => "Page/Post Ordered/Unordered Text Colour", "csssel" => ".entry UL, .entry OL", "attr" => "color" ), array ( "name" => "skinpost1stletterfg", "desc" => "Post First Letter Colour", "csssel" => ".entry > P:first-child:first-letter", "attr" => "color" ), array ( "name" => "skinactionbg", "desc" => "Action Bubbles (Edit, Reply, etc) Background", "csssel" => ".actbubble", "attr" => "background-color" ), array ( "name" => "skinactionfg", "desc" => "Action Bubbles (Edit, Reply, etc) Text Colour", "csssel" => ".actbubble, .actbubble a", "attr" => "color" ), array ( "name" => "skincommentsbg", "desc" => "Comments Block Background", "csssel" => "#comments", "attr" => "background-color" ), array ( "name" => "skincommentbg", "desc" => "Comment Background", "csssel" => "fieldset.comment, fieldset.comment .commenttext", "attr" => "background-color" ), array ( "name" => "skincommentfg", "desc" => "Comment Text Colour", "csssel" => "fieldset.comment .commenttext", "attr" => "color" ), array ( "name" => "skinresponsebg", "desc" => "Response Box Background", "csssel" => "#responsebox", "attr" => "background-color" ) );
So, recession is here making local and global companies alike feel the heat. Changes in consumer behaviour affects especially the global tech companies very quickly because of the way they have almost completely gobbled up all marketing spending of every seller and reseller with any digital outlet presence.
As the digital advertising chain is decoupled from anything physical this ripples from consumer spending to impacting big tech revenue with immense speed. This, of course will affect how these companies use their resources, and the workforce needed to run their businesses.
To try to quantify what is happening to global tech companies’ workforce, I’ve collected some numbers and below is an illustration of the announced lay-offs in five prominent big tech companies as of 2023-01-20. On this day, Google announced their
Note some trends;
Download spread sheet in ODS format
So, uberspace.de (which hosts this site at the time of writing) announced timely on 2022-10-27 that instances (aka. asteroids) using PHP 7.4 will automatically upgrade to PHP 8.0 on 2022-11-29 due to 7.4 going out of active support on 2022-11-28;
Ahoy, You have selected PHP 7.4 as the active version on your Asteroid. Support for this version will end on November 28, 2022. For your and our security we will upgrade your account to PHP 8.0 on November 29, 2022. Usually you will not notice anything and there is nothing else to do, because most tools and programs like WordPress and Nextcloud have been working with PHP 8.0 for a long time. If you want to be on the safe side, please check in advance if your tools are up to date. By the way: You can also set your PHP version yourself. You can find all the information you need about PHP in our manual: https://manual.uberspace.de/lang-php/#change-version For questions and feedback please contact our support team: https://uberspace.de/support/ Best regards Boni, Janto, Kim, Leah, luto, Moritz, Nati, Nico, Noah, Pelzi, Mo, Sabrina & Jonas
Ahoy,
You have selected PHP 7.4 as the active version on your Asteroid. Support for this version will end on November 28, 2022. For your and our security we will upgrade your account to PHP 8.0 on November 29, 2022.
Usually you will not notice anything and there is nothing else to do, because most tools and programs like WordPress and Nextcloud have been working with PHP 8.0 for a long time. If you want to be on the safe side, please check in advance if your tools are up to date.
By the way: You can also set your PHP version yourself. You can find all the information you need about PHP in our manual: https://manual.uberspace.de/lang-php/#change-version
For questions and feedback please contact our support team: https://uberspace.de/support/
Best regards Boni, Janto, Kim, Leah, luto, Moritz, Nati, Nico, Noah, Pelzi, Mo, Sabrina & Jonas
This went under my radar on migration day, and due to the site still being operational I did not think it caused any issues.
However, on 2023-01-09 the site suddenly went offline and investigating logs, PHP errors were thrown in one of the main WordPress includes;
[09-Jan-2023 19:41:58] WARNING: [pool www] child 19454 said into stderr: “[09-Jan-2023 18:41:58 UTC] PHP Fatal error: Uncaught Error: Call to undefined function get_magic_quotes_gpc() in <redacted>/wp-includes/load.php:651” [09-Jan-2023 19:41:58] WARNING: [pool www] child 19454 said into stderr: “Stack trace:” [09-Jan-2023 19:41:58] WARNING: [pool www] child 19454 said into stderr: “#0 <redacted>/wp-settings.php(333): wp_magic_quotes()” [09-Jan-2023 19:41:58] WARNING: [pool www] child 19454 said into stderr: “#1 <redacted>/wp-config.php(39): require_once(‘<redacted>’)” [09-Jan-2023 19:41:58] WARNING: [pool www] child 19454 said into stderr: “#2 <redacted>/wp-load.php(37): require_once(‘<redacted>’)” [09-Jan-2023 19:41:58] WARNING: [pool www] child 19454 said into stderr: “#3 <redacted>/xmlrpc.php(29): include(‘<redacted>/’)” [09-Jan-2023 19:41:58] WARNING: [pool www] child 19454 said into stderr: “#4 {main}” [09-Jan-2023 19:41:58] WARNING: [pool www] child 19454 said into stderr: ” thrown in <redacted>/wp-includes/load.php on line 651″
This is due to the PHP function get_magic_quotes_gpc(), which is already deprecated in 7.4, being completely removed in 8.0. However in WordPress before 5.3 (released 2019-11-12, see announcement or further details) this function is assumed to be present. The location throwing above is the first location in the code path hitting the use of this;
The quick fix to this was downgrading PHP by following the guide mentioned above, which was surprinsingly possible. However, this should only be regarded as a temporary solution as PHP out of security support is not a good solution. As the guide does not mention when PHP 7.4 is going out of support and being completely removed from uberspace, I tried pinging their support in their fediverse account, no resposnse as of ending this write-up.
This post is a rescue mission for a quite old comment I’ve made on the Danish computer science publication version2.dk. As the publication is beginning to put up pay-walls around their articles I’ll repost comments here to keep my own writing out in the open.
It is a comment to an article detailing how the Danish telecom company TDC (previous state driven monopoly Tele Danmark) fails to adhere to the GPL license when distributing a network device built on the GNU/Linux distribution OpenWRT containing large amounts of GPL licensed software.
Link to original comment: version2.dk/artikel/tdc-vi-har-dummet-os-med-open-source-licens-140230#comment-304571
Reproduction of original Danish text:
15. april 2015 kl. 12:05 “..som GPL V2 ellers lægger op til..” Kan ikke lade være med at finde det påfaldende at man er så skrigende subjektiv i rapporteringen når man forholder sig til brud på copyright. Virksomhedernes holdning skinner selvfølgelig igennem, men en neutral presse burde rapportere mere objektivt end dette. Den selvsamme forseelse ville man formentlig kalde pirateri og opfatte som vækst/samfunds/forretnings-undergravende, hvis det drejede sig om systematisk copyright-brud på proprietær software som et specifikt og veldefineret firma tjener penge på. Men fordi dette er fri software(/open source), som kun har potentiale til at komme hele menneskeheden til gode, så opfattes licensen som noget der er “lagt op til”. Det er jo hovedrystende forudindtaget. Bestemmelserne i GPL er selvfølgelig lige så gyldige som ethvert andet sæt betingelser en ophavsretsindehaver kunne finde på at videredistribuere sit værk under. Angående sagens substans er betingelserne i GPL v2 klare og veldefinerede og har været det siden 1991. Det kommer ikke bag på nogen der har fingrene i sovsen, heller ikke sagem/sagemcom som har været med længe, at brugeren skal gøres opmærksom på at et produkt indeholder GPL-software, og at kildekoden der anvendes i produktet skal gøres tilgængelig for brugeren. Alt andet er klaphatteri og klamp, usympatisk, undergravende og uden respekt for det arbejde der profiteres af ved at anvende fri software som grundlag for sin kommercielle eksistens. Man må følge reglerne eller lade være med at lege med hvis man ikke er i stand til at sætte sig ind i dem, det forlanger virksomhederne også selv af deres kunder. Godt at se at der er velvilje fra TDC, det burde bare have foregået på forkant i stedet for bagkant. Håber dog de får fat i nogle mere kompetente mennesker at spørge end dem der har svaret “Boksen kører BUSYBOX Linux”, ellers er det op ad bakke. Mikkel
“..som GPL V2 ellers lægger op til..”
Kan ikke lade være med at finde det påfaldende at man er så skrigende subjektiv i rapporteringen når man forholder sig til brud på copyright. Virksomhedernes holdning skinner selvfølgelig igennem, men en neutral presse burde rapportere mere objektivt end dette.
Den selvsamme forseelse ville man formentlig kalde pirateri og opfatte som vækst/samfunds/forretnings-undergravende, hvis det drejede sig om systematisk copyright-brud på proprietær software som et specifikt og veldefineret firma tjener penge på. Men fordi dette er fri software(/open source), som kun har potentiale til at komme hele menneskeheden til gode, så opfattes licensen som noget der er “lagt op til”. Det er jo hovedrystende forudindtaget. Bestemmelserne i GPL er selvfølgelig lige så gyldige som ethvert andet sæt betingelser en ophavsretsindehaver kunne finde på at videredistribuere sit værk under.
Angående sagens substans er betingelserne i GPL v2 klare og veldefinerede og har været det siden 1991. Det kommer ikke bag på nogen der har fingrene i sovsen, heller ikke sagem/sagemcom som har været med længe, at brugeren skal gøres opmærksom på at et produkt indeholder GPL-software, og at kildekoden der anvendes i produktet skal gøres tilgængelig for brugeren.
Alt andet er klaphatteri og klamp, usympatisk, undergravende og uden respekt for det arbejde der profiteres af ved at anvende fri software som grundlag for sin kommercielle eksistens. Man må følge reglerne eller lade være med at lege med hvis man ikke er i stand til at sætte sig ind i dem, det forlanger virksomhederne også selv af deres kunder.
Godt at se at der er velvilje fra TDC, det burde bare have foregået på forkant i stedet for bagkant. Håber dog de får fat i nogle mere kompetente mennesker at spørge end dem der har svaret “Boksen kører BUSYBOX Linux”, ellers er det op ad bakke.
Mikkel
EDIT 2021-08-31: add section about possible unexpected change of behaviour when using the simple (global) setup (fx. git)
There is this nifty OS project, GNU, which has this nifty piece of software for syntax highlighting, source-highlight (aka. src-highlite), together with which is distributed this nifty shell script, src-hilite-lesspipe.sh, meant for piping arbitrary text through the highlighter selecting and applying a sensible highlight language definition, before being paged in some nifty pager which is able to interpret ANSI escape codes (ISO/IEC 6429 or ECMA-48, previously ANSI X3.64/FIPS PUB 86) like fx. the nifty and ubiquitous less.
Sadly, even after having installed less and source-highlight on modern Ubuntu and Debian systems they are not inter-operating by default. You’d have to feel the itch of syntax highlighting, discover source-highlight and dig its documentation to find out about said script.
Below is a quick two-line shell HOW-TO which sets up environment variables for the current user to enable auto-detection of language and subsequent syntax highlighting pr. default in less using GNU source-highlight (here done on Ubuntu 20.04 LTS, should behave similarly on Debian and derived distributions);
$ sudo apt install source-highlight $ echo -e "\nexport LESSOPEN=\"| /usr/share/source-highlight/src-hilite-lesspipe.sh %s\"\nexport LESS=' -R '" >> ~/.bash_aliases
This setup will make fx. some C source code display as below in less.
environment set up for less to enable ANSI color codes and pass any text through source-highlighter for potential ANSI escape code addition
less showing highlighted C code, auto-detected and highlighted by GNU source-highlighter
One caveat of this global setup being active for any invocation of less, is that most programs will behave accordingly and some maybe different from expectations.
Notably, using the git command line client with the above setup will make git refrain from setting a default LESS=FRX environment (see core.pager of man git config) when invoking less. This turns off the less features “quit-if-one-screen” (F) and “no-init” (X) (see OPTIONS of man less) which usually makes less invisible in git contexts unless paging is actually needed. This could cause confusion for some, making git seemingly take over the terminal on even 1 line outputs (see this bug report on GNU src-hilite and my comment detailing the above).
One solution to this would of course be to add “FX” to the environment, another is making a little more elaborate, more conservative and less transparent setup, as below.
If you’d still like to have a “plain less” not messing with and amending you text unless you ask it to, you could make an alias to use specifically when you want syntax highlighting. Put these somewhere interpreted by you shell (for bash fx. ~/.bash_aliases);
# syntax highlight in less alias lesssh="LESSOPEN='|/usr/share/source-highlight/src-hilite-lesspipe.sh %s' LESS=' -R ' less" function lessurl() { wget -O- -q $1 |source-highlight -f esc -s html |less -R; }
Line two is a bonus shell function pulling some HTML from a webserver using wget, adding syntax highlighting and showing it in less.
For the brave, take a tour of the “info source-highlight” (or “man source-highlight”) manuals (also here) to become familiar with the tool. You can use it anywhere you’d like some colour on arbitrary text and where color are supported in various ways and encodings, for example HTML and latex;
source-highlight adding color encoding to C code using HTML and latex encoding
If you are a programmer wanting to add highlighting features to you own application, the command line utilities are building on a highlighting library which you can utilise (API documentation here).
Et lidt underligt spørgsmål måske, men er der nogen der har gjort sig erfaringer med Micro:bit i frostvejr – Er den stabil, og kan den starte op i f.eks. -20 grader ? Jeg har googlet – men søgeresultatet på de relevante søgning er temmelig forurenet af at der jo er en indbygget temperatursensor…
Ja, det ser da lidt underligt ud. Der er ikke opgivet nogen driftstemperatur (“oprarating temperature”) eller for så vidt opbevaringstemperatur (“storage temperature”) i specifikationerne for hverken V1.5 (https://tech.microbit.org/hardware/1-5-revision/) eller V2 (https://tech.microbit.org/hardware/). En søgning i dokumentationens git-arkiv bekræfter at der kun nævnes noget om temperaturer når den indbyggede sensor i nRF-SoC’en omtales (https://github.com/microbit-foundation/dev-docs/search?q=temperature+&type=). Ligeledes bruges ordet “operating” kun om spænding, strøm og system (=OS) (https://github.com/microbit-foundation/dev-docs/search?q=operating&type=). Så den oplysning er Micro:bit Foundation åbenbart ikke særligt vilde med at dele, hvilket tyder på at det ikke har været en prioritet under design og produktion (hvilket er forståeligt nok for et ikke-industrielt stykke undervisningsmateriale). Så du skal nok under alle omstændigheder ikke forvente en konsistent oplevelse. Hvis man skulle give et kvalificeret bud, kunne man kigger på hovedkomponenternes specificerede driftstemperaturer, hvilket i hvert fald siger noget om de øvre og nedre grænser, men komponenternes komplekse interaktioner med hinanden (mekanisk, termisk, elektrisk) i det færdige produkt har selvfølgelig betydning for de endelige grænser. V1.5: nRF51822 (primær SoC): -25 – 75 grader C (http://infocenter.nordicsemi.com/pdf/nRF51822_PS_v3.1.pdf#page=38) KL26 (USB-interfacechip): -40 – 105 grader C: (http://www.nxp.com/docs/pcn_attachments/16440_KL26P64M48SF5_Rev.4.pdf) V2: nRF52833 (primær SoC): -40 – 85 grader C (kan gå op til 105 grader C under specielle betingelser) (https://infocenter.nordicsemi.com/pdf/nRF52833_PS_v1.3.pdf#page=608) KL27 (USB-interfacechip): -40 – 105 grader C (https://www.nxp.com/docs/en/data-sheet/KL27P64M48SF6.pdf) Det giver da et fingerpeg, god fornøjelse med fryseren ;).
I took the chance on a summer day last year, 2019-06-20, to take a peek at the construction site of the Norwegian Bulk Infrastructure data center DK01 Campus being built in Kjersing, Esbjerg, Denmark. The pictures were stowed away until now but I think they deserve to be set free, so here goes.
The data center is a part of Bulk Infrastructure’s involvement in the Havfrue/AEC-2 subsea cable system (link to a previous blog post with details), built in cooperation with Google and Facebook, which is going to land on the Western shore of Jutland in the near future (ready for service expected in 2020-Q3). Bulk Infrastructure is going to build and operate an extension of the main cable trunk (with reduced capacity) to Norway and its datacenters present there.
It seems the DK01 Campus data center is going to act as an exchange point between other fiber networks Bulk is involved in and also landing in Esbjerg;
Havfrue
Havhingsten
Havsil
The location in Esbjerg is indicated by the orange area outline on the map below, courtesy of OpenStreetMap.
Arriving to the area from the highway driving along the Kjersing Ringvej the site is partly visible at your left hand.
Taking the 3rd exit in the roundabout onto Guldborgsundvej and turning the first left corner the site is just in front of you on the right.
Getting close the inner construction work is visible through the still open facade.
Stepping out and taking a snapshot closer to the fence.
Walking around the end of the building. Small compartments are visible.
At the other side there’s some foundation extending from the tall white wall barely visible. It is probably going to have lighter walls erected. Could be administration offices, where the high ceiling room with walls already standing is the main data center hall.
A lot of temporary arrangements on site for the construction period and site protection.
For the guests, like me, there is even a nice information board with outline map showing some details. As anticipated, offices on left side of the data center hall (right side of the building in the yellow marking, map is facing North, most pictures taken South-West). And also smaller rooms in the hall itself in the Northerne end of the building that we saw above. This is probably to be able to segment co-located equipment for restricting access.
My VCTA tracks pr. 2020-09-24 visualised by some hackish javascript on tools.mikini.dk/vcta (code).
The start of the Wadden Sea dykes at Roborg near Tjæreborg. National cycle route 1 (N1 – Vestkystruten) runs along here. Location: 55.45083;8.56325
In front of Sneum Sluse, where Sneum Å joins the sea. Location: 55.43321;8.60780
Along the dyke between Sneum Sluse and Darum. Approximate location: 55.42917;8.62244
Crossing Sneum Å again, this time in-land approximately 12 km upstream from Sneum Sluse. Location: 55.49637;8.69648
Following national cycle route 6 (N6 – Esbjerg-København) and regional cycle route 10 heading back towards Ålbæk, Opsneum and Tjæreborg. Location: 55.49874;8.69664
Outgoing track as recorded by OpenTracks.
Homegoing track as recorded by OpenTracks.
Looking at weather forecasts in my native Denmark I have always noticed a location reference used by DMI, Danmarks Meteorologiske Institut (en:Danish Meteorological Institute). Somehow I managed to not look into the details of that before now.
But this morning while scouting for rain showers and trying out the forecast on the new website of Yr (the long time open data weather service from Norwegian Broadcasting Corporation (NRK) and the Norwegian Meteorological institute (MET)), as kindly suggested by the YR main site which uses the old site by default, I saw the same reference included in the URL.
A closer look at different service’s forecast URLs for my usual whereabouts in Tjæreborg, Denmark, Europe, Earth reveals (se summary below) that they all share this reference and that it stems from the GeoNames.org (wikipedia article) database’s integer reference to the location:
This particular piece of data is described as a field in the “geoname” table of the GeoNames.org main database, and referred to as “geonameid” in the documentation:
geonameid : integer id of record in geonames database
The contents of the GeoNames.org database is licensed under the Creative Commons Attribution 4.0 International (aka. “CC BY 4.0”, SPDX ID:”CC-BY-4.0″) and available both for your own download and perusal (documentation here) or using web services on geonames.org.
Note, however, that GeoNames.org accumulates a wealth of data sources that according to the OpenStreetMap project might contain copyrighted data. Together with the attribution requirements of its CC BY license this causes OpenStreetMap to not accept data from GeoNames.org into the project’s, ODbL licensed, database.
Fun fact: in Norwegian “yr” actually means drizzle (da:støvregn) Practical hint: OpenSearch entry for GeoNames.org: http://www.geonames.org/opensearch-description.xml (to add in current browser: go here->find “Plugins”->click “opensearch plugin”)
$ wget -q -O- "https://secure.geonames.org/get?geonameId=2611610&username=demo" <?xml version="1.0" encoding="UTF-8" standalone="no"?> <geoname> <toponymName>Tjæreborg</toponymName> <name>Tjæreborg</name> <lat>55.46457</lat> <lng>8.57968</lng> <geonameId>2611610</geonameId> <countryCode>DK</countryCode> <countryName>Denmark</countryName> <fcl>P</fcl> <fcode>PPL</fcode> <fclName>city, village,...</fclName> <fcodeName>populated place</fcodeName> <population>2146</population> <adminCode1 ISO3166-2="83">21</adminCode1> <adminName1>South Denmark</adminName1> <asciiName>Tjaereborg</asciiName> <alternateNames>Tjaereborg,Tjæreborg</alternateNames> <elevation/> <srtm3>12</srtm3> <astergdem>11</astergdem> <continentCode>EU</continentCode> <adminCode2>561</adminCode2> <adminName2>Esbjerg Kommune</adminName2> <alternateName lang="post">6731</alternateName> <alternateName lang="unlc">DKTJA</alternateName> <alternateName lang="link">https://en.wikipedia.org/wiki/Tj%C3%A6reborg%2C_Denmark</alternateName> <alternateName>Tjæreborg</alternateName> <timezone dstOffset="2.0" gmtOffset="1.0">Europe/Copenhagen</timezone> <bbox> <west>8.57175</west> <north>55.46907</north> <east>8.58762</east> <south>55.46008</south> <accuracyLevel>0</accuracyLevel> </bbox> </geoname> $
$ wget -q https://download.geonames.org/export/dump/DK.zip $ unzip DK.zip Archive: DK.zip inflating: readme.txt inflating: DK.txt $ grep ^2611610 DK.txt 2611610 Tjæreborg Tjaereborg Tjaereborg,Tjæreborg 55.46457 8.57968 P PPL DK\ 21 561 2146 12 Europe/Copenhagen 2017-10-18 $
WARNING: as OSM user “mmd” wisely points out (in comment to OSM diary for this post) the sort of thing described here is dangerous to do by hand, and should not be done on the main production instances (there are testing instances for playing around with the API, a little documentation here). He also points out that the feature packed JOSM editor actually supports continuing a changeset regardless of where it has been initiated. So if you just need to continue working on a changeset (but remember the 1 hour idle timeout) be sure to check out the JSOM upload documentation. Thanks mmd, for being the sane voice ;).
During an editing session the Android OpenStreetMap editor Vespucci crashed on me, which made the mapping UI unusable (objects greyed out and unable to select or edit, had to purge all data to recover functionality). Luckly, I could still navigate the menus, upload changes and opt to not close the changeset. Now, I had long wondered whether the OSM API allowed to continue amending changes to an open changeset from some other editor, so the quest began.
I had the intention of adding a tag representing the name of a building in Esbjerg known as “ISC Huset” (ISC is an engineering consultancy, see wikipedia, and more about the construction), which houses a number of healtcare clinics. The building’s address is Borgergade 70, 6700 Esbjerg (current address node).
This blog post willl attempt to actually add the tag by hand on the command line.
References to OSM objects used:
Option summary for GNU wget used to do HTTP requests below:
NOTE: I’ve broken some long output lines replicated below to make it fit the blog, but inserted an escape character (\) before the inserted newline to help copy’n’pasting.
Lets start by looking at the changeset’s metadata.
This can be done by issuing an unauthenticated GET request to the “/api/0.6/changeset/<changeset id>” endpoint.
Note that the ‘changeset’ element has the attribute ‘open=”true”‘ required to be able to modify the changeset. The editor used to create the changeset needs to have done this without explicitly closing it (Vespucci & JOSM closes by default but can be configured not to, iD always closes).
$ wget -nv -O- http://api.openstreetmap.org/api/0.6/changeset/88490797 <?xml version="1.0" encoding="UTF-8"?> <osm version="0.6" generator="CGImap 0.8.3 (802 thorn-02.openstreetmap.org)" copyright="OpenStreetMap and contributors"\ attribution="http://www.openstreetmap.org/copyright" license="http://opendatacommons.org/licenses/odbl/1-0/"> <changeset id="88490797" created_at="2020-07-25T09:51:30Z" open="true" user="mikini" uid="2051"\ min_lat="55.4654072" min_lon="8.4378053" max_lat="55.5258532" max_lon="8.4639026" comments_count="0" changes_count="68"> <tag k="source" v="survey;research"/> <tag k="locale" v="da-DK"/> <tag k="created_by" v="Vespucci 14.1.4.0"/> <tag k="comment" v="Details at Klevestien & Borgergade in Esbjerg and Tarp."/> </changeset> </osm> 2020-07-25 14:26:52 URL:http://api.openstreetmap.org/api/0.6/changeset/88490797 [709] -> "-" [1] $
To test that the changeset is open, and that we can authenticate correctly, lets try amending it with an empty osmChange structure.
This can be done by issuing an authenticated POST request to the “/api/0.6/changeset/<changeset id>/upload” endpoint.
This also seem to reset the 60 minute timer used for auto-closing the changeset (see mention of “idle timeout” in changeset wiki article).
$ wget -nv -O- --user=mikini --ask-password https://api.openstreetmap.org/api/0.6/changeset/88490797/upload --post-data="<osmChange></osmChange>" Password for user ‘mikini’: Authentication selected: Basic realm="Web Password", charset="UTF-8" <?xml version="1.0" encoding="UTF-8"?> <diffResult version="0.6" generator="CGImap 0.8.3 (8531 thorn-03.openstreetmap.org)" copyright="OpenStreetMap and contributors"\ attribution="http://www.openstreetmap.org/copyright" license="http://opendatacommons.org/licenses/odbl/1-0/"/> 2020-07-25 14:27:20 URL:https://api.openstreetmap.org/api/0.6/changeset/88490797/upload [278] -> "-" [1] $
The API’s “changeset/<changeset id>/upload” method supports only modifications encoded in the osmChange format which requires changes to be described as complete way/node/relation objects. That is, you can not ask the API to “add this tag to this way”, you need instead to describe the modified way completely saying “this way now looks like this”, including anything (like node references or existing tags) that was not modified. So to make a modificatino to the building’s way we need to retrieve the current version, modify it as needed and upload the complete new way.
Thus the procedure contains these steps;
This can be done by issuing an unauthenticated GET request to the “/api/0.6/way/<way id>” endpoint.
The stdin splitter ‘tee’ is used here to both show the result in terminal and put it into file 185369466_v3.osc that we can use for amending the way with the wanted modifications.
$ wget -nv -O- http://api.openstreetmap.org/api/0.6/way/185369466|tee 185369466_v3.osc <?xml version="1.0" encoding="UTF-8"?> <osm version="0.6" generator="CGImap 0.8.3 (28697 thorn-01.openstreetmap.org)" copyright="OpenStreetMap and contributors"\ attribution="http://www.openstreetmap.org/copyright" license="http://opendatacommons.org/licenses/odbl/1-0/"> <way id="185369466" visible="true" version="3" changeset="84400254" timestamp="2020-04-30T09:35:21Z" user="mikini" uid="2051"> <nd ref="1959614623"/> <nd ref="1959614727"/> <nd ref="6299449794"/> <nd ref="1959614650"/> <nd ref="1959614630"/> <nd ref="6299449793"/> <nd ref="1959614765"/> <nd ref="7466482063"/> <nd ref="7466482064"/> <nd ref="7466482065"/> <nd ref="7466482062"/> <nd ref="1959614729"/> <nd ref="1959614623"/> <tag k="building" v="yes"/> </way> </osm> 2020-07-25 14:54:30 URL:http://api.openstreetmap.org/api/0.6/way/185369466 [769] -> "-" [1] $
Now we need to build an osmChange file out of the existing <way>…</way> element from the output above describing the wanted building. This involves;
Use your favorite editor (emacs would be my preference) to load the 185369466_v3.osm file, make the modifications and save it as 185369466_v4.osc. OSM tags are a XML empty-element tags containing the OSM tag’s key and value in the “k” and “v” attributes, thus the “name” tag of the building I needed to add would be ‘<tag k=”name” v=”ISC Huset”/>’, I also added some other related tags (“source:name” and “website”).
The finished .osc file now looks like this;
$ cat 185369466_v4.osc <osmChange> <modify> <way id="185369466" visible="true" version="3" changeset="88490797" timestamp="2020-04-30T09:35:21Z" user="mikini" uid="2051"> <nd ref="1959614623"/> <nd ref="1959614727"/> <nd ref="6299449794"/> <nd ref="1959614650"/> <nd ref="1959614630"/> <nd ref="6299449793"/> <nd ref="1959614765"/> <nd ref="7466482063"/> <nd ref="7466482064"/> <nd ref="7466482065"/> <nd ref="7466482062"/> <nd ref="1959614729"/> <nd ref="1959614623"/> <tag k="building" v="yes"/> <tag k="name" v="ISC Huset"/> <tag k="source:name" v="sign;website"/> <tag k="website" v="https://www.isc.dk/isc-huset-esbjerg/"/> </way> </modify> </osmChange> $
Wdiff’ing against the .osm source shows exactly what changed (additions between “{+” & “+}”, removals between “[-” & “-]”);
$ wdiff 185369466_v3.osm 185369466_v4.osc [-<?xml version="1.0" encoding="UTF-8"?> <osm version="0.6" generator="CGImap 0.8.3 (28697 thorn-01.openstreetmap.org)" copyright="OpenStreetMap and contributors"\ attribution="http://www.openstreetmap.org/copyright" license="http://opendatacommons.org/licenses/odbl/1-0/">-]{+<osmChange> <modify>+} <way id="185369466" visible="true" version="3" [-changeset="84400254"-] {+changeset="88490797"+} timestamp="2020-04-30T09:35:21Z" user="mikini" uid="2051"> <nd ref="1959614623"/> <nd ref="1959614727"/> <nd ref="6299449794"/> <nd ref="1959614650"/> <nd ref="1959614630"/> <nd ref="6299449793"/> <nd ref="1959614765"/> <nd ref="7466482063"/> <nd ref="7466482064"/> <nd ref="7466482065"/> <nd ref="7466482062"/> <nd ref="1959614729"/> <nd ref="1959614623"/> <tag k="building" v="yes"/> {+<tag k="name" v="ISC Huset"/> <tag k="source:name" v="sign;website"/> <tag k="website" v="https://www.isc.dk/isc-huset-esbjerg/"/>+} </way> [-</osm>-] {+</modify> </osmChange>+} $
Now, we’ll again use the changeset upload method but this time supplying our actual osmChange elemet in the .osc file.
The output is a bit elaborate, because I had enabled full output from wget while debugging what changes to the <way> element was needed for the server to accept the upload (only the “changeset” attribute needs to match the open changeset as outlined in the “Modify building data” above). I’ve highligted the actual server response telling that the changes were accepted and way #185369466 is now at v4.
$ wget -S -O- --user=mikini --ask-password https://api.openstreetmap.org/api/0.6/changeset/88490797/upload --post-file=185369466_v4.osc Password for user ‘mikini’: --2020-07-25 15:44:41-- https://api.openstreetmap.org/api/0.6/changeset/88490797/upload Resolving api.openstreetmap.org (api.openstreetmap.org)... 130.117.76.12, 130.117.76.13, 130.117.76.11, ... Connecting to api.openstreetmap.org (api.openstreetmap.org)|130.117.76.12|:443... connected. HTTP request sent, awaiting response... HTTP/1.1 401 Unauthorized Date: Sat, 25 Jul 2020 13:44:41 GMT Server: Apache/2.4.29 (Ubuntu) Strict-Transport-Security: max-age=31536000; includeSubDomains; preload Expect-CT: max-age=0, report-uri="https://openstreetmap.report-uri.com/r/d/ct/reportOnly" WWW-Authenticate: Basic realm="Web Password", charset="UTF-8" Cache-Control: no-cache Strict-Transport-Security: max-age=31536000; includeSubDomains; preload Expect-CT: max-age=0, report-uri="https://openstreetmap.report-uri.com/r/d/ct/reportOnly" Content-Length: 22 Content-Type: text/plain; charset=utf-8 Keep-Alive: timeout=5, max=100 Connection: Keep-Alive Authentication selected: Basic realm="Web Password", charset="UTF-8" Reusing existing connection to api.openstreetmap.org:443. HTTP request sent, awaiting response... HTTP/1.1 200 OK Date: Sat, 25 Jul 2020 13:44:42 GMT Server: Apache/2.4.29 (Ubuntu) Strict-Transport-Security: max-age=31536000; includeSubDomains; preload Expect-CT: max-age=0, report-uri="https://openstreetmap.report-uri.com/r/d/ct/reportOnly" Content-Encoding: identity Cache-Control: private, max-age=0, must-revalidate Strict-Transport-Security: max-age=31536000; includeSubDomains; preload Expect-CT: max-age=0, report-uri="https://openstreetmap.report-uri.com/r/d/ct/reportOnly" Vary: Accept-Encoding Content-Type: application/xml; charset=utf-8 Keep-Alive: timeout=5, max=99 Connection: Keep-Alive Transfer-Encoding: chunked Length: unspecified [application/xml] Saving to: ‘STDOUT’ - [<=> ] 0 --.-KB/s <?xml version="1.0" encoding="UTF-8"?> <diffResult version="0.6" generator="CGImap 0.8.3 (8537 thorn-03.openstreetmap.org)" copyright="OpenStreetMap and contributors"\ attribution="http://www.openstreetmap.org/copyright" license="http://opendatacommons.org/licenses/odbl/1-0/"> <way old_id="185369466" new_id="185369466" new_version="4"/> </diffResult> - [ <=> ] 353 --.-KB/s in 0s 2020-07-25 15:44:42 (20,3 MB/s) - written to stdout [353] $
That was it, the building is now named in OSM, in a changset amended by hand.
Take a look at https://www.openstreetmap.org/way/185369466/.