SShortSingh.
Back to feed

Developer Ditches Haversine for Karney's Algorithm to Build Precise Qibla Finder

0
·1 views

A developer building a Qibla Finder for Quranbookk, a Quran-focused web platform, found that the commonly used Haversine formula introduced unacceptable directional errors when calculating bearings toward Mecca. The Haversine formula treats Earth as a perfect sphere, but the planet is actually an oblate spheroid, causing bearing errors of several degrees for users in regions like North America or Northern Europe. To fix this, the developer switched to Charles Karney's geodesic algorithm using the WGS84 ellipsoid model, which calculates shortest paths on an ellipsoidal surface and achieves sub-millimetre accuracy. The application was built with Next.js 15 and uses the HTML5 Geolocation API alongside the DeviceOrientation event to read the device's magnetometer for compass functionality. The developer argues that for any location-critical web application, Karney's algorithm is worth the added mathematical complexity over the simpler but less accurate Haversine approach.

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 ·

WordPress Email Confirmation Prompt Can Silently Break Playwright Automation Scripts

Since WordPress 5.3, wp-admin periodically displays a prompt asking admins to confirm their registered email address, appearing roughly every six months. Browser automation scripts using Playwright can stall at this screen because they follow a fixed login-to-update sequence with no logic to handle unexpected prompts. The script's subsequent navigation either gets redirected or times out waiting for selectors that never appear, making the root cause difficult to trace. Developers can fix this by checking whether the post-login URL contains 'adminhash=' and programmatically clicking 'I'll wait' as a standard step after every login. Adding this detection function ensures the automation continues working reliably whether or not the confirmation screen appears.

0
ProgrammingDEV Community ·

Solon Offers 20+ Validation Annotations Without javax or jakarta Dependencies

Solon's solon-security-validation plugin provides a lightweight validation framework for Java developers that avoids the dependency overhead of JSR 380, javax.validation, and jakarta.validation. The plugin supports over 20 built-in annotations covering common constraints such as @NotNull, @Email, @Min, @Max, and @Pattern, applicable at the method, parameter, or field level. Validation is split into two phases: context validation that runs before parameter injection and parameter validation that runs after, each backed by a distinct internal mechanism. Developers can validate nested DTOs and apply group-based validation for scenarios like create versus update operations using @Validated. The framework is also extensible, allowing custom validator annotations to be created by implementing a Validator interface and registering the class with the plugin.

0
ProgrammingDEV Community ·

Freelancer Builds AI Tool to Draft Overdue Invoice Reminder Emails

A freelancer has developed Invoice Chaser, an AI-powered tool designed to help independent workers follow up on unpaid invoices without the social awkwardness. The tool allows users to input client details, invoice amounts, and due dates, after which AI drafts tone-appropriate reminder emails based on how overdue the payment is. Reminders range from friendly nudges for invoices 3–7 days late to firm, professional notices for those overdue by 22 or more days. Emails are never sent automatically — users review and approve each one before it goes out. The developer is currently seeking 10 freelancers to test the tool for free in exchange for honest feedback, with no payment or credit card required.

0
ProgrammingDEV Community ·

Developer Builds AI Tool That Converts Plain-English Queries Into Stock Searches

A developer has created EasyStock, an AI-powered stock screening tool that allows users to search for stocks using plain-language descriptions instead of manual financial filters. Users can type requests such as finding profitable companies with low debt, and the tool interprets these inputs into screening criteria. EasyStock then returns matching stocks along with explanations for each match, financial data, and trend insights. The developer has made the tool publicly accessible and is actively seeking feedback on result relevance, explanation clarity, and missing features. EasyStock is positioned as a research aid and not a source of financial advice.

Developer Ditches Haversine for Karney's Algorithm to Build Precise Qibla Finder · ShortSingh