cloudfront-viewer-country-name stopped working in AWS

Summary Between November 18th and 21st, Lambda functions behind CloudFront stopped receiving CloudFront-Viewer-Country-Name headers while CloudFront-Viewer-Country continued to function. The root cause was a change in how CloudFront handles country header formatting. AWS silently changed the format of geolocation headers from hyphenated (CloudFront-Viewer-Country-Name) to lowercase with spaces replaced by underscores (CloudFront-Viewer-Country-Name became CloudFront-Viewer-Country-Name). The Viewer … Read more

Performance of square root calculation – expectation versus reality

Summary A user-level benchmark suggests that math.sqrt(x) is approximately 20% faster than x**0.5 for calculating square roots in Python. While both operations are mathematically equivalent for positive numbers, the performance difference stems from how the Python interpreter and underlying C libraries handle these operations. math.sqrt maps directly to a low-level C library call optimized specifically … Read more

How to swap multiple variables using multiple assignment?

Summary The problem revolves around understanding how multiple assignment works in Python, particularly when swapping values of multiple variables. The key takeaway is that Python’s multiple assignment is a simultaneous operation, meaning all assignments happen at the same time. Root Cause The root cause of confusion lies in misunderstanding the order of operations during multiple … Read more

Handling text input width and making it responsive

Summary The core problem is a mismatch between a fixed-size CSS container and dynamic user input. The developer used a width: 25vw rule on the input, which is a rigid measurement. When the user enters numbers with many digits, the input container stays the same physical width, but the font size is large. Since text-wrap: … Read more

Some users cannot type anything

Summary A critical input failure occurs where some users cannot type into a JTextArea within a JAR deployment, while the same code works in development environments. The root cause is a blocking EDT (Event Dispatch Thread) behavior triggered by the heavy KeyListener logic, causing the UI thread to freeze intermittently or under specific system conditions … Read more

Autodesk Forge Viewer: setGhosting() + isolate() not making elements transparent – topography transparency issue

Summary During a feature implementation for a “Transparent Topography” button in Autodesk Forge Viewer v7.x, the expected ghosting behavior failed. The goal was to make FBX topography elements transparent while keeping Revit (RVT) and Navisworks (NWD/NWC) elements opaque. The implementation relied on setGhosting(true) combined with isolate() on non-FBX elements. The result was inconsistent: sometimes FBX … Read more

Dapper fails calling a Stored Procedure that builds a Dynamic SQL statement

Summary A .NET REST API using Dapper fails to execute a specific Azure SQL Stored Procedure that constructs a dynamic SQL string in a single statement. The Stored Procedure works correctly when called via SSMS, OLEDB, and an older Entity Framework-based API. Splitting the string concatenation for the dynamic SQL into multiple statements resolves the … Read more