SShortSingh.
Back to feed

Flutter App Uses Bitmask Logic to Solve Timezone-Safe Booking Slot Availability

0
·1 views

A developer building Drivers Lesson, a driving instructor booking app, faced complex scheduling challenges involving recurring availability, multiple block types, and timezone mismatches. Instead of using a list of 48 booleans per day, the developer represented each day's slot availability as a single integer bitmask, enabling fast bitwise operations to merge and filter slots. When an 'extra sessions' feature was added, availability data from two separate API sources had to be merged and deduplicated before being shown to users. A timezone bug — where slots generated in an instructor's local time landed on a different calendar date for students — was fixed by storing and comparing all slots in UTC internally. The final mask logic sits behind a Riverpod provider, exposing only a clean availability result to the UI without exposing the underlying complexity.

Read the full story at DEV Community

This is an AI-generated summary. ShortSingh links to the original source for the complete article.

Discussion (0)

Log in to join the discussion and vote.

Log in

Related stories

0
ProgrammingDEV Community ·

Why Blocking Accounts Over Temp Emails Alone Creates More Risk Than It Solves

Fraud and support systems often flag accounts using temporary emails as abusive, but treating a single signal as definitive proof leads to poor outcomes. Legitimate users — including privacy-conscious individuals, testers, and automated integrations — can trigger the same flags as bad actors. Cloudflare's analysis of recent abuse campaigns highlights the need to correlate multiple signals rather than react to one in isolation. Ambiguous decisions made without full context overload support queues, confuse legitimate users, and leave on-call teams unable to reconstruct what happened. A more effective approach evaluates the attempted action, activity velocity, decision explainability, and the cost of falsely blocking a real user.

0
ProgrammingDEV Community ·

How a One-Line Security Fix Nearly Silently Broke Mermaid Diagram Labels on Forem

A developer shipping Mermaid diagram support to Forem, the open-source platform behind DEV Community, discovered that a seemingly straightforward security fix flagged by GitHub's CodeQL analysis would have quietly broken labels on most common diagram types without triggering any errors or test failures. The issue arose because applying DOMPurify sanitization with an SVG profile strips attributes like aria-label and title that Mermaid uses to render diagram labels. Forem's existing HTML scrubber also posed challenges, as the standard class attribute used by Mermaid is not on its allow list, requiring the developer to use data-lang instead. Additional complications included Forem's post-processors converting emoji shortcodes and @mentions inside diagram source, which was resolved by wrapping source text in a code node that post-processors skip. The developer ultimately implemented explicit DOMPurify sanitization with a carefully configured profile rather than relying solely on Mermaid's internal sanitization, avoiding a silent but damaging regression.

0
ProgrammingDEV Community ·

OpenAI Launches ChatGPT Ads Across 31 European Markets for Free-Tier Users

OpenAI began showing advertisements to free and Go-plan ChatGPT users across 31 European countries on 24 August 2025, marking its largest advertising expansion to date. The rollout follows a pilot that started in the United States in February, which has since extended to roughly 40 markets in total. Users on paid plans — Plus, Pro, and Enterprise — will continue to receive an ad-free experience. While free users can opt out of personalised ad targeting, they cannot disable ads entirely; only a paid subscription removes them. OpenAI has built out a full advertising infrastructure including geo-targeting, custom audiences, and conversion tracking tools similar to those used across the broader online ad industry.

0
ProgrammingDEV Community ·

Go 1.27 Adds Generic Methods After 5-Year Community Push and Initial Rejection

Go 1.27, released in late August 2026, introduced generic methods — a feature the Go team once declared would likely never be added to the language. The limitation dated back to Go 1.18 in February 2022, when generics were first introduced but restricted to package-level functions and types, preventing methods from declaring their own type parameters. A community proposal filed in October 2021 accumulated over 900 upvotes as developers highlighted real-world use cases such as stream-processing DSLs, fluent test assertions, and method chaining patterns. The core technical hurdles involved complexity around type dictionary passing through method values and interfaces, which co-designer Ian Lance Taylor had cited as blockers. After five years of sustained community pressure and engineering work, the feature was resolved and is already reflected in the standard library's math/rand/v2 package.

Flutter App Uses Bitmask Logic to Solve Timezone-Safe Booking Slot Availability · ShortSingh