7 ms·
Marching Events: What does iCalendar have to do with ray marching?
- btown 1y agoI've thought of this a lot! Lots of hospitality booking and pricing engines, for instance, require materialization of complex rules: if suppliers have rules that say "if the checkin is on these 3 days of each week add a price multiplier, which stacks with the holiday pricing event that happens every year, but only if you're a certain number of days out from check-in" you need to be able to render this for arbitrary date ranges to provide pricing calendars. And you can use simple iteration if you want to render for a single property - but what if you want to render a queried week's pricing across a massive corpus of units, where every millisecond of latency is a lost conversion opportunity? And where any supplier could change their rules at any time? And where length-of-stay and per-guest pricing might come into play, adding more dimensions that make full materialization hard to do? (Google, for instance, has something akin to this problem, in how it integrates with hotel suppliers using https://developers.google.com/hotels/hotel-prices/dev-guide/ari-overview https://developers.google.com/hotels/hotel-prices/dev-guide/... .) You might even think, in this context: how can I represent the rules on a GPU or other system with limited working memory, and be able to render search results the way I'd render tiles? Then things like the OP's post become vital considerations, and far from just simple analogies!
- Patryk27 1y agoCuriously enough, I've used to work in hospitality! (https://pwy.io/posts/mimalloc-cigarette/ https://pwy.io/posts/mimalloc-cigarette/ & https://pwy.io/posts/memory-for-nothing/ https://pwy.io/posts/memory-for-nothing/) Our dataset wasn't so large as to warrant experimenting with GPUs - `cost(extraCpu) < cost(developerExperimentingWithGpus)` - but the CPU implementation got a lot of love; it was mostly engineering-based work, though ("how to load stuff from the disk effectively", "how to make it multi-threaded" etc.), not math-based work ("if we represented prices using $someFancyStructure, we could ..."). I like when seemingly engineering-oriented problems turn out to be way more approachable once you apply / invent / adjust some math foundations, e.g. like with Feldera (https://sigmodrecord.org/publications/sigmodRecord/2403/pdfs/20_dbsp-budiu.pdf https://sigmodrecord.org/publications/sigmodRecord/2403/pdfs...) - wouldn't figure something like this myself in a hundred years, I'd just probably apply maps on top of caches on top of whatever else I could pile until it works!
- btown 1y agoA channel manager using Rust for the caching layer? That's actually kind of incredible. Might want to pick your brain someday :) And Feldera/DBSP is absolute magic - definitely something I want to dig deeper into!
- reaperducer 1y ago"if the checkin is on these 3 days of each week add a price multiplier, which stacks with the holiday pricing event that happens every year, but only if you're a certain number of days out from check-in" you need to be able to render this for arbitrary date ranges to provide pricing calendars. Ugh. I did just this sort of "dynamic pricing" shenanigans for a travel company years ago. It made me feel dirty.
- ctippett 1y agoOne of the few remaining ubiquitous open formats of the web. Unfortunately Apple still refuses to recognise *.ics files unless they're included as a Mail attachment.
- imp0cat 1y agoUbiquitous and, unfortunately, almost always implemented with some bugs.
- kridsdale1 1y agoWhat do you mean? You can open them in Finder or iOS Files app and a calendar import UI will be shown.
- ctippett 1y agoOpening an .ics file on iOS from the Files app will show the events, but will not allow you to import/add them to your calendar.
- reaperducer 1y agoOpening an .ics file on iOS from the Files app will show the events, but will not allow you to import/add them to your calendar. Not true. I just tried it on an iPhone 14 with iOS 18.4, and it works fine. You tap on the ics icon, and it opens up the details. Tap "Done" and the event lands in the calendar you specified.
- ctippett 1y agoWhat can I say, other than we have very different experiences. Opening an .ics file from the Files app indeed shows its details, but selecting "Done" does nothing but dismiss its contents and adds nothing to the calendar. Contrast this with opening the same .ics file from an email attachment or viewing it online, which presents an "Add All" button.
- 1y ago
- jchw 1y ago> yes, this blog is a proud user of the european date format - if you don't want to see yyyy-mm-dd's, please press alt-f4 and go back to boycotting bud light or something Interesting to call this the "european date format", given that prior to ISO 8601 I'm pretty sure this date order was almost entirely used in East Asia and not Europe. To me day-month-year will always be the European date order.
- Patryk27 1y agoAh, you're right - I wanted to include a dunk, but forgot to actually fact-check it! -- gotta figure out something better.
- VoodooJuJu 1y ago[dead]
- DiggyJohnson 1y agoWhy would you want to do that? I don’t think Europeans realize how familiar technical and engineering minded Americans are with metric. It’s just so overplayed. GP is right my default reaction as a MM/DD/YYYY dumb American was that you didn’t make sense because that is the internationally standardized unambiguous format and what we all use for dates where sorting or i18n matters. Sorry for rant you probably don’t deserve it but for real that is the lamest joke imaginable and your content is good enough that it doesn’t need “dunks” Edit: get dunked on
- Philpax 1y agoSeems like the dig dug into you to make you respond like this.
- godelski 1y agoConspiracy theory: US will never switch to metric because then you'd sell half as many tools. I'm joking of course but there's a grain of truth. The meme of a lost 10mm socket is just as true in America and most tool sets come with both imperial and metric sizes. It's really annoying to have to double up. But wouldn't be America if we didn't have unnecessary complexity, right? Can't be a real programmer™ without facing that on a daily basis
- rgovostes 1y agoI was really hoping this was going to be a demonstration that the recurring event frequency field is Turing complete by implementing a ray tracer in it.
- Patryk27 1y agoGotta leave something for others to discover!
- UltraSane 1y agoWould this work for network ACLs?
- Patryk27 1y agoACLs are more like a binary function, right? f(packet, time, ...) = { reject, allow } In that case evaluating the function once is enough to know whether the packet should be let through or not, there's no way to sort of "differentiate" this function, no way to step through it. But this got me thinking about cases where policy _modifies_ the packet, like: f(packet, time, ...) = ({ reject, allow }, new-packet) In this case you'd be looking for a fixed-point, evaluating this function until new-packet = packet (or you exhaust some time and give up). Not sure on the potential utility, though - just a random thought.
- UltraSane 1y agoMakes sense. Advanced ACL analyzers translate them into first order logic and then use something like Z3 to find the packets that satisfy them but they rarely support the time based ACLs. But those are not used much in practice.
- toast0 1y agoFirst, thanks for this mental model; I've got a project with iCals where I haven't been happy with the logic, and maybe I can clean it up with this! But I don't think the text matches the examples... This seems like an error? > (day-of-month 12 2018-01-14) = 2018-02-14 > // 2018-01-12 is the closest 12th day of month starting from 2018-01-14 (-2d), > // but that corresponds to a negative span, so we jump to the next month Shouldn't the nearest 12th day of the month after the 14th of January be 2018-02-12 ? > Rule::DayOfMonth(31) > .next(date("2018-02-14")) > ... will say 2018-03-03 - which is legal, because the actual next occurrence happens on 2018-03-31, for which 2018-03-03 is a valid underapproximation. But I would expect curr.last_of_month().tomorrow().unwrap(), to return 2018-03-01 ???
- Patryk27 1y ago> Shouldn't the nearest 12th day of the month after the 14th of January be 2018-02-12 ? You're right, thanks - fixed! Small typos like those are the hill I'll die on. > But I would expect curr.last_of_month().tomorrow().unwrap(), to return 2018-03-01 ??? This case actually matches the `Ordering::Less` branch (14 < 31), so it hits this arm: Ordering::Less => curr + Span::new().days(day - curr.day()), ... yielding this calculation: 2018-02-14 + (31 - 14) = 2018-03-03 Since the actual next occurrence is on 2018-03-31, 2018-03-03 is a valid guess (just a suboptimal one). I've rephrased this section in the article to show the calculation more clearly now.
- Yhippa 1y agoThat page is the perfect density for mobile. I also liked the colors and the contrast. Well-written stuff to boot!
- tsuru 1y agocan't help but wonder if I'd like this syntax for system timers or cron...