Skip to content

Instantly share code, notes, and snippets.

From b61c1c20dad213eb57d039b0d12a031a5906a2a5 Mon Sep 17 00:00:00 2001
From: Andy Allan <andy@gravitystorm.co.uk>
Date: Tue, 21 Jan 2014 12:26:26 +0000
Subject: [PATCH] Quote the database and user strings when altering databases.
---
cookbooks/postgresql/providers/database.rb | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/cookbooks/postgresql/providers/database.rb b/cookbooks/postgresql/providers/database.rb
"without timezone" is used when the times literally have no timezone. For example, if I made a guide to "good times of the day to do exercise" and said
exercise | timestamp without timezone
----------
swimming | Sunday 5th May at 1400
running | Sunday 5th May at 1900
Then a client application would connect, and see "1400 without timezone" and present my user in california with an alert saying "Go for a swim at 1400 UTC+8" which is in the early afternoon in California, and a different client application would connect from London and say "Go for a swim at 1400 UTC+1" which is in the early afternoon in London.
"with timezone" is used when the times have a timezone, i.e. when that time refers to a particular instant in time for example in OpenStreetMap when a node is changed
@gravitystorm
gravitystorm / gist:5824793
Created June 20, 2013 17:29
UTFGrid example
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE Map[]>
<Map srs="+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0.0 +k=1.0 +units=m +nadgrids=@null +wktext +no_defs +over" background-color="#b8dee6" maximum-extent="-20037508.34,-20037508.34,20037508.34,20037508.34">
<Parameters>
<Parameter name="bounds">-180,-85.05112877980659,180,85.05112877980659</Parameter>
<Parameter name="center">0,0,2</Parameter>
<Parameter name="format">png</Parameter>
<Parameter name="interactivity_layer">countries</Parameter>
<Parameter name="interactivity_fields">NAME</Parameter>
@gravitystorm
gravitystorm / issues.md
Last active December 18, 2015 15:39
Andy's wishlist for mapnik 3.0
#0 0x00007ffff78a2f2c in mapnik::wkb_reader::read_polygon(boost::ptr_vector<mapnik::geometry<double, mapnik::vertex_vector>, boost::heap_clone_allocator, std::allocator<void*> >&) [clone .constprop.94] () from /usr/local/lib/libmapnik.so.2.2
#1 0x00007ffff78a4b82 in mapnik::geometry_utils::from_wkb(boost::ptr_vector<mapnik::geometry<double, mapnik::vertex_vector>, boost::heap_clone_allocator, std::allocator<void*> >&, char const*, unsigned int, mapnik::wkbFormat) () from /usr/local/lib/libmapnik.so.2.2
#2 0x00007fffeb6ac369 in postgis_featureset::next() () from /usr/local/lib/mapnik/input/postgis.input
#3 0x00007ffff76cbeab in mapnik::feature_style_processor<mapnik::agg_renderer<mapnik::image_32> >::render_style(mapnik::layer const&, mapnik::agg_renderer<mapnik::image_32>&, mapnik::feature_type_style const*, mapnik::rule_cache const&, std::string const&, boost::shared_ptr<mapnik::Featureset>, mapnik::proj_transform const&) () from /usr/local/lib/libmapnik.so.2.2
#4 0x00007ffff76cdc3d in mapnik::feature_s
Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7fffe8a85700 (LWP 21194)]
0x00007ffff78a27be in mapnik::wkb_reader::read_linestring(boost::ptr_vector<mapnik::geometry<double, mapnik::vertex_vector>, boost::heap_clone_allocator, std::allocator<void*> >&) [clone .constprop.90] () from /usr/local/lib/libmapnik.so.2.2
(gdb) bt
#0 0x00007ffff78a27be in mapnik::wkb_reader::read_linestring(boost::ptr_vector<mapnik::geometry<double, mapnik::vertex_vector>, boost::heap_clone_allocator, std::allocator<void*> >&) [clone .constprop.90] () from /usr/local/lib/libmapnik.so.2.2
#1 0x00007ffff78a50aa in mapnik::geometry_utils::from_wkb(boost::ptr_vector<mapnik::geometry<double, mapnik::vertex_vector>, boost::heap_clone_allocator, std::allocator<void*> >&, char const*, unsigned int, mapnik::wkbFormat) () from /usr/local/lib/libmapnik.so.2.2
#2 0x00007fffeb6ac369 in postgis_featureset::next() () from /usr/local/lib/mapnik/input/postgis.input
#3 0x00007ffff76cbeab in mapnik::feature_style_process
#0 0x00007ffff78a2f96 in mapnik::wkb_reader::read_polygon(boost::ptr_vector<mapnik::geometry<double, mapnik::vertex_vector>, boost::heap_clone_allocator, std::allocator<void*> >&) [clone .constprop.94] ()
from /usr/local/lib/libmapnik.so.2.2
#1 0x00007ffff78a5025 in mapnik::geometry_utils::from_wkb(boost::ptr_vector<mapnik::geometry<double, mapnik::vertex_vector>, boost::heap_clone_allocator, std::allocator<void*> >&, char const*, unsigned int, mapnik::wkbFormat) ()
from /usr/local/lib/libmapnik.so.2.2
#2 0x00007fffeb6ac369 in postgis_featureset::next() ()
from /usr/local/lib/mapnik/input/postgis.input
#3 0x00007ffff76cbeab in mapnik::feature_style_processor<mapnik::agg_renderer<mapnik::image_32> >::render_style(mapnik::layer const&, mapnik::agg_renderer<mapnik::image_32>&, mapnik::feature_type_style const*, mapnik::rule_cache const&, std::string const&, boost::shared_ptr<mapnik::Featureset>, mapnik::proj_transform const&) () from /usr/local/lib/libmapnik.so.2.2
#4 0x00007ffff76cdc3d in mapnik::
@gravitystorm
gravitystorm / gist:5582700
Created May 15, 2013 09:20
bt full from mapnik segfault
#0 0x00007ffff71298ed in mapnik::read_double_xdr (data=0x7fffdbfffff9 "", val=@0x7fff5c36dd90: 0) at include/mapnik/global.hpp:142
bits = 140737032992608
#1 0x00007ffff7129ee0 in mapnik::wkb_reader::read_coords (this=0x7fffe4dbb800, ar=...) at src/wkb.cpp:219
i = 5563352
#2 0x00007ffff712a3d8 in mapnik::wkb_reader::read_linestring (this=0x7fffe4dbb800, paths=...) at src/wkb.cpp:294
ar = {pt_ = 0x7fff56e8a010, size_ = 16777504}
line = {_M_ptr = 0x7fffe4dbb7a0}
num_points = 16777504
#3 0x00007ffff7129bdd in mapnik::wkb_reader::read (this=0x7fffe4dbb800, paths=...) at src/wkb.cpp:127
type = 2
@gravitystorm
gravitystorm / gist:5582101
Created May 15, 2013 06:57
segfault in mapnik 24913c4759db7 (debug)
Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7fffe4de8700 (LWP 23441)]
0x00007ffff71298ed in mapnik::read_double_xdr (data=0x7fffdbfffff9 "", val=@0x7fff5c36dd90: 0) at include/mapnik/global.hpp:142
142 boost::int64_t bits = ((boost::int64_t)data[7] & 0xff) |
(gdb) bt
#0 0x00007ffff71298ed in mapnik::read_double_xdr (data=0x7fffdbfffff9 "", val=@0x7fff5c36dd90: 0) at include/mapnik/global.hpp:142
#1 0x00007ffff7129ee0 in mapnik::wkb_reader::read_coords (this=0x7fffe4dbb800, ar=...) at src/wkb.cpp:219
#2 0x00007ffff712a3d8 in mapnik::wkb_reader::read_linestring (this=0x7fffe4dbb800, paths=...) at src/wkb.cpp:294
#3 0x00007ffff7129bdd in mapnik::wkb_reader::read (this=0x7fffe4dbb800, paths=...) at src/wkb.cpp:127
#4 0x00007ffff7129713 in mapnik::geometry_utils::from_wkb (paths=..., wkb=0x7fffd6b1c270 "", size=0, format=mapnik::wkbGeneric) at src/wkb.cpp:460
update regions set status = 'failed'
where (lat = 49 and lon in (18,19,20,21,22,23))
or (lat = 50 and lon in (14,15,16,17,18,19,20,21,22,23,24))
or (lat = 51 and lon in (14,15,16,17,18,19,20,21,22,23))
or (lat = 52 and lon in (14,15,16,17,18,19,20,21,22,23))
or (lat = 53 and lon in (14,15,16,17,18,19,20,21,22,23))
or (lat = 54 and lon in (14,15,16,17,18,19,20,21,22,23))