Dan Q posted a note for GC531M9 Walk by the Firehouse #1

This checkin to GC531M9 Walk by the Firehouse #1 reflects a geocaching.com log entry. See more of Dan's cache logs.

Out for a walk with the 5-y/o geokid we decided to check up on this cache to ensure it was still accessible in spite of the ongoing work to rearrange the footpaths around here. Yup, it’s still accessible (and as devious as ever!).

Nginx Caching for Passenger Applications

Suppose you’re running an application on a Passenger + Nginx powered server and you want to add caching.

Perhaps your application has a dynamic, public endpoint but the contents don’t change super-frequently or it isn’t critically-important that the user always gets up-to-the-second accuracy, and you’d like to improve performance with microcaching. How would you do that?

Where you’re at

Diagram showing the Internet connecting to an Nginx+Passenger webserver, connecting to an application written for Ruby, Python, or NodeJS.
Not pictured: the rest of the Internet.

Your configuration might look something like this:

1
2
3
4
5
6
7
server {
  # listen, server_name, ssl, logging etc. directives go here
  # ...

  root               /your/application;
  passenger_enabled  on;
}

What you’re looking for is proxy_cache and its sister directives, but you can’t just insert them here because while Passenger does act act like an upstream proxy (with parallels like e.g. passenger_pass_header which mirrors the behaviour of proxy_pass_header), it doesn’t provide any of the functions you need to implement proxy caching of non-static files.

Where you need to be

Instead, what you need to to is define a second server, mount Passenger in that, and then proxy to that second server. E.g.:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# Set up a cache
proxy_cache_path /tmp/cache/my-app-cache keys_zone=MyAppCache:10m levels=1:2 inactive=600s max_size=100m;

# Define the actual webserver that listens for Internet traffic:
server {
  # listen, server_name, ssl, logging etc. directives go here
  # ...

  # You can configure different rules by location etc., but here's a simple microcache:
  location / {
    proxy_pass http://127.0.0.1:4863; # Proxy all traffic to the application server defined below
    proxy_cache           MyAppCache; # Use the cache defined above
    proxy_cache_valid     200 3s;     # Treat HTTP 200 responses as valid; cache them for 3 seconds
    proxy_cache_use_stale updating;   # (Optional) send outdated response while background-updating cache
    proxy_cache_lock      on;         # (Optional) only allow one process to update cache at once
  }
}

# (Local-only) application server on an arbitrary port number to act as the upstream proxy:
server {
  listen 127.0.0.1:4863;

  root               /your/application;
  passenger_enabled  on;
}

The two key changes are:

  • Passenger moves to a second server block, localhost-only, on an arbitrary port number (doesn’t need HTTPS, of course, but if your application detects/”expects” HTTPS you might need to tweak your headers).
  • Your main server block proxies to the second as its upstream, and you can add whatever caching directives you like.

Obviously you’ll need to be smarter if you host a mixture of public and private content (e.g. send Vary: headers from your application) and if you want different cache durations on different addresses or types of content, but there are already great guides to help with that. I only wrote this post because I spent some time searching for (nonexistent!) passenger_cache_ etc. rules and wanted to save the next person from the same trouble!

×

Dan Q couldn’t find GC6FD5Y Cumnor Minions – Bob

This checkin to GC6FD5Y Cumnor Minions - Bob reflects a geocaching.com log entry. See more of Dan's cache logs.

0/2 for the geokids and I this morning. Hunted a long while on and around the obvious place, later reassured by the hint, but eventually expanded our search based on recent logs (which suggest the hint is wrong). Interrupted by a suspicious local we decided to make an excuse to leave. Hint, possibly coordinates, maybe more needs looking at by CO.

Printing Maps from Dungeondraft

I really love Dungeondraft, an RPG battle map generator. It’s got great compatibility with online platforms like Foundry VTT and Roll20, but if you’re looking to make maps for tabletop play, there’s a few tips I can share:

Screenshot showing Dungeondraft being used to edit a circular tower. The Export window is visible.
Tabletop players can’t zoom in and will appreciate you printing with good contrast.

Planning and designing

Dungeondraft has (or can be extended with) features to support light levels and shadow-casting obstructions, openable doors and windows, line-of sight etc… great to have when you’re building for Internet-enabled tabletops, but pointless when you’re planning to print out your map! Instead:

  • Think about scale: I’m printing to A4 sheets and using inch-size squares, so every 11 x 8 squares equates to one sheet of paper. Knowing this, I can multiply-up to a whole number of sheets of paper and this informs my decisions about how to best make use of the maps (and what will and won’t fit on my dining table!).
  • Focus on legibility: Your printer probably won’t have the same kind of resolution as your screen, and your players can’t “zoom in” to get details. Play with the grid styles (under Map Settings) to find what works best for you, and try not to clash with your floor patterns. If you’re printing in monochrome, use the “Printer-Friendly” camera filter (also under Map Settings, or in the Export Options dialog) to convert to gorgeous line-art. Make sure critical elements have sufficient contrast that they’ll stand out when printed or your players might walk right over that chest, campfire, or bookshelf.
  • Think about exposure: You don’t get digital “fog of war” on the tabletop! Think about how you’re going to reveal the map to your players: plan to print in multiple sections to put together, jigsaw style, or have card to “cover” bits of the map. Think about how the tool can help you here: e.g. if you’ve got multiple buildings the players can explore, use a higher “level” or roof layer to put roofs on your buildings, then print the relevant parts of that level separately: now you’ve got a thematic cover-up that you can remove to show the insides of the building. Go the other way around for secret doors: print the empty wall on your main map (so players can’t infer the location of the secret door by the inclusion of a cover-up) and the secret door/passage on the overlay, so you can stick it onto the map when they find it.
Monochrome map showing a crane tower and attached dwelling.
If you’re printing in black and white, line art can be a gorgeous look.

Printing it out

There’s no “print” option in Dungeondraft, so – especially if your map spans multiple “pages” – you’ll need a multi-step process to printing it out. With a little practice, it’s not too hard or time-consuming, though:

Screenshot showing a cavern map in Gimp, with the Export Image dialog open and PDF selected as the output format.
Gimp makes light work of converting a PNG into a PDF.

Export your map (level by level) from Dungeondraft as PNG files. The default settings are fine, but pay attention to the “Overlay level” setting if you’re using smart or complex cover-ups as described above.

To easily spread your map across multiple pages, you’ll need to convert it to a PDF. I’m using Gimp to do this. Simply open the PNG in Gimp, make any post-processing/last minute changes that you couldn’t manage in Dungeondraft, then click File > Export As… and change the filename to have a .pdf extension. You could print directly from Gimp, but in my experience PDF reader software does a much better job at multi-page printing.

Foxit print dialog showing a preview of a map printed across 6 sheets of A4 paper.
Check the print preview before you click the button!

Open your PDF in an appropriate reader application with good print management. I’m using Foxit, which is… okay? Print it, selecting “tile large pages” to tell it to print across multiple sheets. Assuming you’ve produced a map an appropriate size for your printer’s margins, your preview should be perfect. If not, you can get away with reducing the zoom level by up to a percent or two without causing trouble for your miniatures. If you’d like the page breaks to occur at specific places (for exposure/reveal reasons), go back to Gimp and pad one side of the image by increasing the canvas size.

Check the level of “overlap” specified: I like to keep mine low and use the print margins as the overlapping part of my maps when I tape them together, but you’ll want to see how your printer behaves and adapt accordingly.

Multiple sheets of A4 paper joined with a slight overlap by long strips of sticky tape.
The overlap provides stability, rigidity, and an explanation as to exactly what that character tripped over when they rolled a critical fail on a DEX check.

If you’re sticking together multiple pages to make a single large map, trim off the bottom and right margins of each page: if you printed with cut marks, this is easy enough even without a guillotine. Then tape them together on the underside, taking care to line-up the features on the map (it’s not just your players who’ll appreciate a good, visible grid: it’s useful when lining-up your printouts to stick, too!).

I keep my maps rolled-up in a box. If you do this too, just be ready with some paperweights to keep the edges from curling when you unfurl them across your gaming table. Or cut into separate rooms and mount to stiff card for that “jigsaw” effect! Whatever works best for you!

Miniatures on a cave map, with the D&D Player's Handbook acting as a paperweight.
Any hefty tome, e.g. the 5e Player’s Handbook, can act as a paperweight.
× × × × × ×

The Revenge of the Hot Water Bottle

This is a repost promoting content originally published elsewhere. See more things Dan's reposted.

Imagine a personal heating system that works indoors as well as outdoors, can be taken anywhere, requires little energy, and is independent of any infrastructure. It exists – and is hundreds of years old.

A hot water bottle is a sealable container filled with hot water, often enclosed in a textile cover, which is directly placed against a part of the body for thermal comfort. The hot water bottle is still a common household item in some places – such as the UK and Japan – but it is largely forgotten or disregarded in most of the industrialised world. If people know of it, they usually associate it with pain relief rather than thermal comfort, or they consider its use an outdated practice for the poor and the elderly.

Imagine my surprise to discover that not only are hot water bottles confined almost-entirely to the UK and Japan (more-strictly, I suppose the article should say “the British Isles”; friends in Ireland tell me that they’re popular there too), but that they’re so distinctly confined to these isles that English speakers elsewhere in the world need this article to explain to them what a hot water bottle is and why they’d want one!

I’m a fan of hot water bottles; I’ll sometimes take one – or even two, during a cold snap – to bed. But reading this article feels like reading a guide for aliens living on Earth: explaining everyday things as if you’d never come across them before.

Geohashing expedition 2022-02-20 52 -1

This checkin to geohash 2022-02-20 52 -1 reflects a geohashing expedition. See more of Dan's hash logs.

Location

Outside a warehouse full of sheet aluminium, Kitts Green Road, Birmingham.

Participants

Plans

I’m hoping to find the 2022-02-19 52 -2 hashpoint one day earlier and one graticule over, and I think I can stretch the range on the electric car enough to be able to return home via this hashpoint too.

Update: managed to change the car after finding the 2022-02-19 52 -2 point, so I can make this. Probably be there about midday, weather-permitting.

Expedition

Following my successful expedition to 2022-02-19 52 -2 (which completed level 6 of my minesweeper grid) I stayed overnight in a delightful converted hayloft near the hashpoint before pressing on the following morning to this hashpoint (via a whole series of delightful geocaches in and around the village of Blakedown).

I didn’t expect much of this hashpoint, but I wanted the excuse to recharge the car before going for another leg of my journey – either a trip up to visit a friend in Lichfield or else a hashing expedition one graticule further East where today’s hashpoint seemed to be in a graveyard! But more on that later.

I parked at the Morrisons car park at (52.757778, -1.752222) at 14:48 and hooked up to the charger there (once I eventually found it). I had some difficulty making it work, but it seemed to get started eventually. Then I began my walk to the hashpoint. This was far from the picturesque walk of yesterday, taking me through a series of housing estates that were nondescript at best, unpleasantly scuzzy at worst. Shooting video as I walked, I was at one point loudly mocked by a group of young men passing in an artificially-loud car, but it was an activity that soon had to end anyway as the rain began to pour down. At around 15:11 my GPSr ran out of battery power (I’d failed to find its charging cable the night before) and there’s a clear gap in my tracklog: fortunately I was also equipped with not one but two backup devices (my phone, of course, and my watch), so I was able to continue heading in the right direction, and when I found a convenience store near (52.739167, -1.998333) I bought some AA batteries (my GPSr can have its rechargeable battery removed and 3 × AA batteries put in its place to allow it to continue) and pressed on to the hashpoint.

As anticipated, the hashpoint was on a road dividing a light industrial park from a housing estate, right outside a plant specialising in bending plate aluminium; I reached it at 15:23:48. I walked back the same route as the rain began to fall more and more heavily: by the time I reached the car it had become torrential. The dubious charging point I’d used had taken £16 from my bank card but provided only enough charge to take the car from 66% to 67% battery, which – combined with the rapidly-worsening weather – made me rethink my plans to visit Lichfield or explore further East and I instead used my remaining distance to take a long (slow, wet, diversion-filled) drive home. Ugh.

Tracklog

My GPSr kept a tracklog of my entire two-day expedition:

Download tracklog.

Photos

I shot video of most of this expedition but don’t have time to edit it, so here are stills from the video instead:

×

Dan Q found GC8V990 NANOBLITZ You’ve got some Rattle

This checkin to GC8V990 NANOBLITZ You've got some Rattle reflects a geocaching.com log entry. See more of Dan's cache logs.

A hard walk to an easy find, but this cache has definitely caught the worst of the stormy conditions. Its hiding place has flooded and the container is drenched. Dried as best I could, but it needs CO attention. TFTC.

Dan Q found GC8V997 NANOBLITZ Ground

This checkin to GC8V997 NANOBLITZ Ground reflects a geocaching.com log entry. See more of Dan's cache logs.

Getting down the muddy bank (picture attached) to this one was a bit spicy! Like those before me, I found the cache wedged tight into its hiding space. But unlike them, I was able to construct a crude lever with which to set it free! SL, TFTC.

×

Dan Q found GC8RWDN NANOBLITZ C Log

This checkin to GC8RWDN NANOBLITZ C Log reflects a geocaching.com log entry. See more of Dan's cache logs.

Found after an extended hunt, not where the hint would suggest. Looks like it blew quite a way away! Returned to pave specified by coordinates and hint. Log extremely wet, hard to sign.

You were right about the views from up here, though!

×