Post Aa8qwSD36PLp4aumGW by sayrer@mastodon.social
 (DIR) More posts by sayrer@mastodon.social
 (DIR) Post #Aa8UM6suiCj3WElGbY by simon@fedi.simonwillison.net
       2023-09-25T19:53:42Z
       
       0 likes, 1 repeats
       
       Geospatial SQL queries in SQLite using TG, sqlite-tg and datasette-sqlite-tg: https://til.simonwillison.net/sqlite/sqlite-tg @alexgarciaxyz built a SQLite extension that exposes functionality from the new TG library by @tidwall as custom SQL functions, and it's really cool!
       
 (DIR) Post #Aa8pSJ8w98UsJS3KC0 by simon@fedi.simonwillison.net
       2023-09-25T23:50:14Z
       
       0 likes, 0 repeats
       
       I genuinely feel like TG is not getting nearly the level of attention it deserveshttps://github.com/tidwall/tgA single C file that gives you extensively tested, threadsafe geospatial operations against GeoJSON, WKT and WKB with no external dependencies and two innovative new spatial indexing strategies?How often does something like that show up?
       
 (DIR) Post #Aa8pdrYCYo8oD9Nbyi by simon@fedi.simonwillison.net
       2023-09-25T23:51:53Z
       
       0 likes, 0 repeats
       
       I am by no means a C programmer but the code is giving me similar vibes to the first time I looked at Redis - it just feels so obviously right
       
 (DIR) Post #Aa8pyOAT04Y9AB48Dg by collin@ruby.social
       2023-09-25T23:56:37Z
       
       0 likes, 0 repeats
       
       @simon I am somewhat a C programmer, and this looks like a great API on first inspection. SQLite itself has a truly fantastic C API as well.
       
 (DIR) Post #Aa8qLplwX8sHRAm4rQ by sayrer@mastodon.social
       2023-09-26T00:00:29Z
       
       0 likes, 0 repeats
       
       @simon I think it's because it should be in Rust these days (and can still provide a C API). No shade on the author or the algorithms, but I saw enough C things to make me skeptical.
       
 (DIR) Post #Aa8qb6o9TgKecG5iHQ by simon@fedi.simonwillison.net
       2023-09-26T00:03:49Z
       
       0 likes, 0 repeats
       
       @sayrer I feel like implementing that kind of a library in Rust would reduce its potential impact, because integrating Rust libraries into other languages, while possible, still isn't nearly as well trodden a path as C
       
 (DIR) Post #Aa8qmCT0mIDfLvUXqa by simon@fedi.simonwillison.net
       2023-09-26T00:05:16Z
       
       0 likes, 0 repeats
       
       @sayrer plus the README seems to be making the right noises in terms of "100% coverage using memory sanitizer and Valgrind"
       
 (DIR) Post #Aa8qwSD36PLp4aumGW by sayrer@mastodon.social
       2023-09-26T00:07:07Z
       
       0 likes, 0 repeats
       
       @simon Mmm, I think you are wrong here. It is really not difficult to give a Rust library a C API. You give the structs a C layout via an annotation, and then provide functions as a C library would.
       
 (DIR) Post #Aa8rAtgPkjdMKqXMnI by sayrer@mastodon.social
       2023-09-26T00:09:16Z
       
       0 likes, 0 repeats
       
       @simon that's good, but I think he means "address sanitizer" (ASAN) and Valgrind.
       
 (DIR) Post #Aa8rLH1DqXKzbaDYzw by simon@fedi.simonwillison.net
       2023-09-26T00:09:35Z
       
       0 likes, 0 repeats
       
       @sayrer I didn't say it was hard, I just said it was a path less trodden - for something as fundamental as a base library for this kind of geospatial work C feels like a defensible choice to me
       
 (DIR) Post #Aa8rfVzVtAfZpi4Q4W by sayrer@mastodon.social
       2023-09-26T00:15:44Z
       
       0 likes, 0 repeats
       
       @simon Ah... true five years ago, but now totally trodden. Even back then, it would probably be C compiled with a C++ compiler.Now, even Android OS is doing it. Those are pretty cheap devices, so it must make sense.https://google.github.io/comprehensive-rust/
       
 (DIR) Post #Aa8sdJZVC35kgoQ0KO by IMGoph@thepit.social
       2023-09-26T00:26:02Z
       
       0 likes, 0 repeats
       
       @alexgarciaxyz @simon @tidwall uh-oh, how did most of Michigan and Indiana get left out of that time zone?
       
 (DIR) Post #Aa8t1WwR8UIz6bh0y0 by simon@fedi.simonwillison.net
       2023-09-26T00:29:59Z
       
       0 likes, 0 repeats
       
       @IMGoph looks like Indiana has its own weird collection of slightly different timezone codes https://timezones.datasette.io/timezones/timezones?_sort=id&tzid__startswith=America%2FIndiana
       
 (DIR) Post #Aa8tCL9NJekzikto9Y by simon@fedi.simonwillison.net
       2023-09-26T00:31:45Z
       
       0 likes, 0 repeats
       
       @IMGoph and Michigan has one called "America/Detroit" https://timezones.datasette.io/timezones/timezones?_sort=id&tzid__exact=America%2FDetroit
       
 (DIR) Post #Aa8tP85DD7c6xU3BGC by simon@fedi.simonwillison.net
       2023-09-26T00:34:17Z
       
       0 likes, 0 repeats
       
       @IMGoph hah, just found this on Wikipedia: "Attitudes began to change in the 1990s, as Indiana's time zone situation was seen as impeding the state's economic growth. Interstate travel and commerce were difficult as people wondered, "what time is it in Indiana?" https://en.m.wikipedia.org/wiki/Time_in_Indiana
       
 (DIR) Post #Aa8yoVkGs6IHM8B4YC by skybrian@mastodon.social
       2023-09-26T01:35:37Z
       
       0 likes, 0 repeats
       
       @simon It sounds great but also very specialized. We all use maps, but I how many programmers have done geo anything?I wonder what other under-appreciated specialist libraries there are?
       
 (DIR) Post #Aa90yRE8j0gQ9B0fLs by IMGoph@thepit.social
       2023-09-26T01:59:50Z
       
       0 likes, 0 repeats
       
       @simon that’s odd, because time in all those counties is Eastern Time Zone, same as New York, with the same DST rules, no difference.
       
 (DIR) Post #Aa919CKETAsP7DzRx2 by simon@fedi.simonwillison.net
       2023-09-26T02:01:30Z
       
       0 likes, 0 repeats
       
       @IMGoph the timezone codes take into account differences going back to 1970
       
 (DIR) Post #Aa9RrKq4m70X4Oak8u by djh@chaos.social
       2023-09-26T07:00:54Z
       
       0 likes, 0 repeats
       
       @simon the level of discipline and rigor it takes to pull this off is next level 👏
       
 (DIR) Post #Aa9Uj1yVKKrG6sGXK4 by kitten_tech@fosstodon.org
       2023-09-26T07:33:08Z
       
       0 likes, 0 repeats
       
       @simon it's possible to write good code in any reasonable language, and although some languages make it harder, it's all the nicer when people do it in those languages anyway!
       
 (DIR) Post #Aa9ey6ogbhwN0lVB8i by rcoup@mastodon.social
       2023-09-26T09:28:05Z
       
       0 likes, 0 repeats
       
       @simon would be great if it became a robust & small GeoPackage implementation: spatialite is a complex kitchen sink of stuff, libgpkg died, GDAL’s is internal…
       
 (DIR) Post #AaB55RdYO5gvZuPgNk by simon@fedi.simonwillison.net
       2023-09-27T01:55:15Z
       
       0 likes, 0 repeats
       
       @cliff For most languages it's a red flag, but for C it can be really useful as a way of making it as easy as possible to distribute and bundle somethingThe sqlite3.c amalgamation is 250,000 lines of C and it's fantastic(That file's built from a bunch of smaller files though)