Skip to content

Archive / page 78

All articles

Every practical article from the Nalar archive, newest first.

Tech Updated 15 Sep 2026 7 min read

How Auto-Rotate Knows Which Way You Are Holding Your Phone

Turn a phone sideways while watching a video or looking at a photo and the screen may switch from portrait to landscape. Turn it upright again and the interface usually follows. The phone is not looking at the room to decide which edge should be at the top. It is using motion-sensor data to estimate how the device is positioned relative to gravity. That sounds simple, but it explains several familiar quirks: a screen that rotates while you are lying down, a short delay before the interface turns, or an app that stays in portrait even though auto-rotate is enabled.

Tech Updated 15 Sep 2026 8 min read

How a Phone Hotspot Shares Your Mobile Internet

A phone hotspot can give a laptop, tablet, or another device internet access when ordinary Wi-Fi is unavailable. You turn on the hotspot, connect the other device, and it appears to work much like a small portable Wi-Fi router. But the phone is doing two different jobs at once. It connects to the internet through its mobile network, then shares that connection with another device. That split explains several common hotspot quirks: performance can differ from normal Wi-Fi, battery use can rise quickly, and a connected laptop can lose internet access even while it still shows a strong Wi-Fi signal.

Linux 04 Sep 2026 9 min read

Handle Linux Signals in Event Loops with signalfd

Unix signals are asynchronous by design: a signal can interrupt a program between ordinary instructions and transfer control to a signal handler. That model is useful, but it creates an awkward boundary for event-driven programs. A network server may already spend most of its time inside poll(), epoll_wait(), or another readiness API. Its sockets, pipes, and timers appear as file-descriptor events, while SIGTERM and SIGHUP arrive through a separate execution path with much stricter rules about what code may safely run.

Artificial Intelligence 04 Sep 2026 9 min read

Handle Class Imbalance in Machine Learning

A classifier can achieve impressive accuracy while failing on the cases you care about most. If only 1% of transactions are fraudulent, a model that predicts “not fraud” for every transaction is 99% accurate and still useless for detecting fraud. This is the practical problem of class imbalance: some target classes appear much less often than others. Imbalance does not automatically make a dataset bad, and it does not imply that every model needs special treatment. It does mean that accuracy can hide important errors and that the training objective may give rare examples too little influence.

Artificial Intelligence 04 Sep 2026 10 min read

Gradient Noise in Mini-Batch Training

Neural network training usually updates model parameters from a small batch of examples rather than computing a gradient over the entire training set. That makes each update cheaper, but it also means the update direction depends on which examples happened to enter the batch. This variation is often called gradient noise. It is not necessarily a bug. It is a consequence of estimating a dataset-wide gradient from a sample, and it creates an important trade-off between computation per update, update variability, and training throughput.

Artificial Intelligence 04 Sep 2026 9 min read

Focus Classification Training with Focal Loss

A classifier can spend much of its training signal on examples it already handles confidently. This is especially noticeable when a dataset contains a large number of easy examples and a much smaller set of difficult ones: the easy cases can dominate the aggregate loss simply because there are so many of them. Focal loss changes that balance. It starts from cross-entropy and reduces the contribution of examples the model already predicts confidently, leaving difficult examples with greater relative influence. The idea is simple, but using it well requires understanding what “hard” means, how its parameters affect optimization, and why focusing too aggressively can amplify noisy labels.

Software Engineering 04 Sep 2026 9 min read

Feature Flags as Temporary Control Points

Deploying code and exposing new behavior do not have to happen at the same moment. That distinction matters when a change is difficult to reverse quickly, needs a gradual rollout, or should be available only to a small group while engineers observe its behavior. A feature flag provides a runtime decision point: the deployed code can contain both behaviors while configuration chooses which one is active for a particular request, user, tenant, or environment.

Cybersecurity 04 Sep 2026 9 min read

Fail Closed Without Creating an Outage Bypass

An application may make access decisions with help from a policy service, identity provider, entitlement database, or another remote dependency. That design works until the dependency times out. At that moment, the application still has to answer a security question: should this request be allowed? A dangerous fallback is to treat “I could not check” as “allow.” A temporary outage can then become an authorization bypass. But denying every operation whenever any security-related dependency is unavailable can create unnecessary outages and may push teams toward unsafe emergency workarounds.

Cybersecurity 04 Sep 2026 10 min read

Fail Closed at Authorization Boundaries

An application can have carefully designed roles and permissions and still expose protected actions through one small mistake: treating an authorization error as permission to continue. This problem appears when access control depends on code, policy data, or another service that can fail. A timeout, malformed response, missing record, or unexpected exception creates uncertainty. If the application converts that uncertainty into allow, a reliability failure becomes an access-control failure. A useful defensive rule is to fail closed at an authorization boundary. In plain language, perform the protected action only when the system has enough trustworthy information to make an explicit allow decision. If it cannot establish that decision, do not grant the access.

Artificial Intelligence 04 Sep 2026 9 min read

Estimate Model Uncertainty with Monte Carlo Dropout

A neural network can produce a confident-looking prediction without telling you how sensitive that prediction is to uncertainty in the learned model. This matters when an application must decide whether to trust a prediction, request more information, or route a case for review. Monte Carlo dropout, often shortened to MC dropout, provides one practical uncertainty signal for networks trained with dropout. Instead of disabling dropout for inference, it keeps dropout stochastic and evaluates the same input repeatedly. Variation across those predictions reveals how strongly the result depends on the sampled dropout masks.

Tech Updated 15 Sep 2026 8 min read

Download vs Upload Speed: What Each Direction Affects

An internet connection moves data in two directions. When you stream a film, open a website, or receive a photo, data travels to your device. When you send a photo, back up files, or transmit your camera feed during a video call, data travels from your device. Those two directions are measured separately as download speed and upload speed. A connection can have plenty of capacity in one direction and much less in the other, which is why a fast-looking internet plan can still struggle with some tasks.

Artificial Intelligence 04 Sep 2026 10 min read

Detect Out-of-Distribution Inputs Before Trusting a Model

A model can produce a confident-looking prediction for an input that is unlike anything it was designed to handle. A product classifier trained on shoes, shirts, and bags still has to return some class when given a photo of a bicycle. The classifier’s output layer does not automatically gain an unknown class just because the input is unfamiliar. This is the problem addressed by out-of-distribution detection, usually shortened to OOD detection. The goal is to recognize inputs that differ meaningfully from the data the model is expected to handle, before the application treats an ordinary model prediction as trustworthy.

Artificial Intelligence 04 Sep 2026 10 min read

Detect Distribution Shift Before Model Quality Fails

A model can pass offline evaluation and still become less useful after deployment. The model may not have changed at all. Instead, the data reaching it may have changed. A fraud classifier trained on last year’s transactions may encounter a new payment pattern. A support-ticket model may see terminology introduced by a new product. An image model deployed to different hardware may receive images with different lighting or compression. These are forms of distribution shift: the statistical conditions seen in production differ from those represented by the data used to develop or evaluate the model.

Software Engineering 04 Sep 2026 10 min read

Designing for Reversible Decisions

Software teams make decisions with incomplete information. A library looks suitable until production traffic exposes a limitation. A pricing rule changes after customers use it. A component boundary that seemed natural becomes awkward when a new workflow arrives. The problem is not that developers sometimes choose incorrectly. The harder problem is making an uncertain choice so expensive to change that the system must live with it long after the assumptions behind it have failed.

Software Engineering 04 Sep 2026 10 min read

Designing Failure Containment Boundaries

A component fails. Soon unrelated requests become slow, worker queues stop moving, and healthy features begin returning errors. The original defect may be small, but the system has allowed its effects to spread. Failure containment is the design practice of limiting how far a fault can propagate. The goal is not to prevent every failure. That is unrealistic. The goal is to make a local failure stay local enough that the rest of the system can continue useful work or fail in a controlled way.

Cybersecurity 04 Sep 2026 10 min read

Design Rate Limits Around Security Identities

A rate limit sounds simple: allow only a certain number of requests during a period. The difficult security question is not the number. It is what you count together. Suppose a login endpoint allows five failed attempts per minute from each IP address. That can slow one client, but an attacker using many addresses can still make many guesses against the same account. Change the rule to five failures per account and another problem appears: anyone who knows a username may be able to keep that user’s account throttled.

Artificial Intelligence 04 Sep 2026 10 min read

Design Model Abstention for Uncertain Predictions

A model does not have to make a decision on every input. In many applications, forcing a prediction is exactly what turns an uncertain case into an expensive mistake. Consider a classifier that routes support tickets to billing, account, or technical teams. Most tickets are straightforward, but some are vague or combine several problems. If the application automatically accepts every prediction, the model must act even when its evidence is weak. A better system can automate clear cases and send uncertain ones to a fallback such as human review.

Cloud Computing 04 Sep 2026 11 min read

Design Dead-Letter Queues for Poison Messages

Retries are useful when a failure is temporary. A database may be unavailable for a few seconds, a downstream service may return an overload response, or a network connection may disappear and recover. Retries become harmful when the message itself cannot succeed. A malformed payload, an unsupported schema version, a reference to permanently missing data, or a deterministic application bug can make the same message fail on every delivery. If the broker keeps returning that message to consumers indefinitely, the system spends capacity repeating work that has no chance of succeeding.

Python 04 Sep 2026 10 min read

Decode Streaming Text Safely in Python with Incremental Codecs

Network sockets, compressed streams, subprocess pipes, and chunked file reads often deliver bytes in arbitrary pieces. If those bytes represent text, it is tempting to decode each piece immediately: for chunk in byte_chunks: text = chunk.decode("utf-8") process(text) That works only when every chunk happens to end on a character boundary.

CSS 04 Sep 2026 10 min read

Debug CSS z-index with Stacking Contexts

A z-index bug often looks irrational. You give a menu z-index: 9999, yet a header still covers it. Increasing the number to 999999 changes nothing. The natural conclusion is that z-index is unreliable. It is not. The mistake is usually comparing numbers that belong to different stacking contexts. A stacking context is a local coordinate system for painting overlapping elements. Descendants are ordered inside that context, and then the entire context participates as one unit in its parent’s stacking order. A child with a huge z-index cannot escape a parent that is painted below a sibling context.

Software Engineering 04 Sep 2026 9 min read

Creating Seams for Safe Legacy Changes

Legacy code is often difficult to change for a reason that has little to do with the business rule you need to edit. The code may create its own database client, read the clock directly, call a remote service in the middle of a calculation, or depend on another component that is expensive or unreliable in tests. You may understand the desired change and still be unable to test it in isolation.

Go 04 Sep 2026 10 min read

Coordinate Shared State with sync.Cond in Go

A goroutine sometimes cannot make progress until shared state changes. A worker may need to wait until a queue contains an item. A producer may need to wait until that queue has free capacity. Several goroutines may need to sleep until a service becomes ready. Polling the state in a loop wastes CPU or forces you to invent arbitrary sleep intervals. Channels solve many coordination problems more directly, but they are not always a natural fit when several goroutines already share state protected by a mutex and need to wait for predicates over that state.

Artificial Intelligence 04 Sep 2026 9 min read

Contrastive Learning with Positive and Negative Pairs

An embedding model turns an input into a vector so that useful relationships can be measured numerically. The difficult part is not producing vectors. It is teaching the geometry of the vector space: which inputs should be close, which should be far apart, and what “similar” should mean for the application. Contrastive learning provides a practical answer. Instead of training only from a class label such as billing or technical support, it trains from relationships between examples. A positive pair contains examples that should have similar representations. A negative pair contains examples that should not.

Tech Updated 15 Sep 2026 8 min read

Cloud Sync vs Backup: Different Jobs, Different Recovery

Saving files in a cloud-synced folder can feel like having a backup. Your documents appear on several devices, changes reach the cloud automatically, and a replacement computer may be able to download them again. But sync and backup solve different problems. Sync is mainly designed to keep a set of files consistent across locations. Backup is designed to preserve recoverable copies when the working data is lost, damaged, or changed in a way you did not intend.