Skip to content

Archive / page 43

All articles

Every practical article from the Nalar archive, newest first.

Go 12 Sep 2026 6 min read

Compare Go Slices with Custom Rules Using slices.CompareFunc

Two slices can represent the same ordered data even when their element types differ. One side might contain integers while another contains numeric strings, or two struct types might expose the same key through different fields. Plain slices.Compare can’t express those cases because it relies on the element type’s built-in ordering. slices.CompareFunc lets you supply the element comparison. It still compares the slices lexicographically, so the first unequal pair decides the result; the custom function only defines how each pair is ordered.

Go 12 Sep 2026 4 min read

Clone Go Maps with maps.Clone

A Go map variable refers to mutable map state. Assigning that variable to another variable does not create an independent map: writes through either name affect the same map. When code needs a separate top-level map with the same entries, maps.Clone makes that boundary explicit. The function is deliberately narrow. It copies map entries using ordinary assignment. The resulting map can be changed independently at the key-value entry level, but reference-like data stored inside keys or values can still share underlying state.

Software Engineering 12 Sep 2026 9 min read

Circuit Breakers as Admission Control for Failing Dependencies

Circuit Breakers as Admission Control for Failing Dependencies A remote call that has little chance of succeeding still consumes something: a connection slot, a worker, a deadline budget, memory for request state, or capacity in the dependency itself. When repeated failures indicate that a downstream service is currently unable to serve useful work, continuing to admit every call can preserve the very pressure that callers need to escape. A circuit breaker changes that admission decision. Instead of treating each call as independent, it retains a small amount of state about recent outcomes. That state can temporarily reject new calls before network I/O begins, then permit controlled probes after a recovery interval.

Go 12 Sep 2026 5 min read

Check Custom Slice Order in Go with slices.IsSortedFunc

Code that depends on binary search, ordered output, or merge-style processing often assumes a slice is already sorted. For built-in ordered values, slices.IsSorted can check that assumption. Structs and domain-specific orderings need a comparator, which is where slices.IsSortedFunc fits. The function doesn’t rearrange anything. It answers a narrower question: does this slice already follow the order described by this comparator? Check a struct slice by one field slices.IsSortedFunc accepts a slice and a comparison function:

Cybersecurity 12 Sep 2026 6 min read

Certificate Transparency Turns Issuance Into an Observable Event

A public TLS certificate can be perfectly valid and still be operationally alarming. A certificate authority may have followed its validation rules, the signature chain may verify, and browsers may accept the credential without complaint. Yet the organization named in that certificate may never have intended the hostname to exist. That gap matters because certificate issuance is an authorization event with security consequences. Certificate Transparency makes much of that event visible. Publicly trusted certificate authorities submit certificate information to append-only logs, giving domain operators and the wider ecosystem a record that can expose unexpected issuance soon after it occurs.

Tech 12 Sep 2026 6 min read

Captive Wi-Fi Portals and Internet Access

A phone can show a solid Wi-Fi connection at a hotel or airport while web pages still refuse to load. The radio link is working, and the device may already have a local network address. Internet access is being held behind a captive portal. A captive portal adds an access-control stage after a device joins the local network. The network can require a sign-in, payment, room number, voucher, or acceptance of terms before it permits ordinary traffic to reach the wider internet. This creates a useful distinction between being connected to Wi-Fi and having usable internet connectivity.

Artificial Intelligence 12 Sep 2026 7 min read

Calibrate Neural Classifier Confidence with Temperature Scaling

A neural classifier can choose the correct class often enough for an application while assigning probabilities that are too concentrated or too diffuse. Accuracy alone does not expose this mismatch. A system that acts differently at confidence thresholds also depends on the numerical probabilities attached to its predictions. Temperature scaling is a post-training calibration method that adjusts the sharpness of classifier logits with one positive scalar. For a fixed input, it preserves the ordering of logits, so the predicted class remains unchanged when ordinary argmax decoding is used. What changes is the probability distribution produced after softmax.

Software Engineering 12 Sep 2026 10 min read

Cache Stampede Control with Early Refresh

Cache Stampede Control with Early Refresh A cache can remove enormous amounts of repeated work, yet a popular entry creates a sharp risk at expiry. If ten thousand requests depend on the same key and that key expires, many requests can discover the miss at nearly the same moment. Each request may then start the same database query, computation, or remote call. This event is commonly called a cache stampede. The cache works well during the entry lifetime, then abruptly stops protecting the dependency exactly when demand is high.

Go 12 Sep 2026 5 min read

Cache Concurrent Initialization Results with sync.OnceValue in Go

sync.OnceValue turns a function into a concurrency-safe, one-time computation whose result is returned on every call. The first caller performs the computation. Concurrent callers wait for that call to finish, and later callers receive the stored result without running the function again. This differs from using sync.Once with a separate result variable. The value and its one-time initialization are packaged behind a function, which makes the lifetime of the cached result explicit in the place where that function is stored.

Software Engineering 12 Sep 2026 11 min read

Bulkhead Isolation: Contain Failures with Separate Capacity Pools

Bulkhead Isolation: Contain Failures with Separate Capacity Pools A service can have enough total capacity and still become unavailable because one dependency consumes all of it. Imagine an API that calls a payment service and a recommendation service. Both outbound calls use the same worker pool. Recommendations become slow during a traffic spike. Their requests occupy every worker while waiting for responses. Payment requests now have no worker available, even though the payment service itself is healthy.

Tech 12 Sep 2026 5 min read

Browser Cache and Stale Web Files

A website can change on its server while one browser still shows an older image, script, or page response. Opening the same address in another browser may show the new version immediately. That difference often comes from the browser’s HTTP cache, which can reuse stored responses instead of downloading the same bytes again. The browser cache is not simply a folder of files that are either present or absent. HTTP gives cached responses a freshness state and provides validators that can check whether stored content still matches the server. Those rules determine when reuse avoids a network transfer and when the browser has to contact the server again.

Artificial Intelligence 12 Sep 2026 7 min read

Bound KV Cache Growth in Streaming LLM Inference

Autoregressive transformer inference normally keeps key and value states from earlier tokens so each new token can attend to prior context without recomputing those states. The cache grows with sequence length. For a long-running stream, that growth eventually becomes a memory constraint even when generation itself continues one token at a time. KV cache eviction puts a bound on that state by discarding selected cached positions. The memory effect is straightforward: fewer retained key-value pairs occupy less cache space. The model effect is more subtle. Once a position is removed, later attention layers cannot use its cached key and value in the ordinary attention calculation. An eviction policy therefore changes both resource use and the effective attention history.

Tech 12 Sep 2026 6 min read

Bluetooth Pairing and Active Connections

A pair of wireless headphones can appear in the saved-device lists on a phone, tablet, and laptop, yet play audio from only one of them. Nothing is necessarily broken. Bluetooth pairing and an active Bluetooth connection describe different states. Pairing establishes information that lets compatible devices recognize and authenticate each other later. A connection is the live communication link used at a particular moment. Some products can maintain suitable links with more than one source device, but that capability is not implied merely because several devices have been paired.

Tech 12 Sep 2026 5 min read

Bluetooth Audio Codecs and What They Change

A phone can show a premium Bluetooth codec while the listening experience still depends on much more than that label. The codec controls how digital audio is represented for the wireless link, but it sits inside a larger chain that includes the source app, operating system, radio connection, headphone electronics, amplifiers, and drivers. That makes codec names useful technical information, but poor stand-ins for overall sound quality. They can affect compression, data rate, latency, and resilience to changing radio conditions. The actual result depends on what both devices support and how the connection is operating at that moment.

Software Engineering 12 Sep 2026 10 min read

Backpressure: Match Producer Speed to Consumer Capacity

Backpressure: Match Producer Speed to Consumer Capacity A pipeline is stable only when work enters at a rate its downstream stages can sustain. That sounds obvious, yet many systems let producers run at full speed until a queue fills, memory grows, latency explodes, or a downstream service starts rejecting requests. The visible failure appears late. The actual mismatch began earlier: one stage could create work faster than the next stage could finish it.

Cybersecurity 12 Sep 2026 7 min read

Archive Extraction Is a Filesystem Security Boundary

Archive Extraction Is a Filesystem Security Boundary An archive extractor can receive a destination directory, join each stored name beneath it, and still write somewhere else. The gap appears when archive metadata is treated as harmless naming information even though extraction ultimately asks a filesystem to resolve paths, links, and object types with its own semantics. The familiar ../ traversal is only the most visible form of the problem. Absolute paths, symbolic links, hard links, platform-specific path syntax, pre-existing filesystem objects, and replacement races can all affect where a write lands. A robust design therefore cannot reduce extraction safety to a string check performed once before files are created.

Artificial Intelligence 12 Sep 2026 10 min read

Align LLMs with Direct Preference Optimization

Align LLMs with Direct Preference Optimization Supervised fine-tuning works well when you can provide a target response for each prompt. It becomes less natural when the signal is comparative: one answer is preferred over another, but neither is a perfect target to copy. Direct Preference Optimization (DPO) turns those preference pairs into a training objective for a language model without requiring a separately trained reward model or an online reinforcement step.

Tech 11 Sep 2026 9 min read

Why Wi-Fi Gets Slower Farther From the Router

A phone can show that it is still connected to Wi-Fi in a distant room while websites load more slowly, video quality drops, or a download takes much longer than it did beside the router. The connection has not necessarily failed. Wi-Fi can remain connected while becoming less capable of moving data quickly and reliably. The key idea is that Wi-Fi speed depends on more than the internet plan coming into your home. Your device and the Wi-Fi access point first have to exchange radio signals successfully. As those signals become weaker or harder to distinguish from interference, the connection can use more conservative transmission methods and may need to repeat data that did not arrive correctly.

Tech 11 Sep 2026 8 min read

Why Webcams Look Grainy in Low Light

A webcam can look clean and detailed during the day, then become grainy, soft, or strangely smeared in the evening. The camera has not necessarily developed a fault. In many cases, it is trying to make a usable picture from too little light. That matters because a webcam cannot simply make darkness disappear. When less light reaches its image sensor, the useful image signal becomes weaker. The camera can brighten that weak signal electronically, expose each video frame for longer, combine information across frames, or apply heavier noise reduction. Each choice helps in one way and creates a trade-off somewhere else.

Tech 11 Sep 2026 8 min read

Why Keyboard Keys Can Type the Wrong Characters

You press a key marked with one character, but a different character appears on screen. Perhaps @ and " seem to have swapped places, punctuation has moved, or familiar letter keys no longer produce the letters you expect. It can look like a faulty keyboard, but the hardware is often working exactly as intended. The missing piece is the keyboard layout. A keyboard sends information about which key was pressed; software then interprets that key according to the active layout. If the software layout does not match the physical labels on the keyboard, the result on screen can differ from what is printed on the keycap.

Tech 11 Sep 2026 8 min read

Why Higher Refresh Rates Make Screens Feel Smoother

A phone or laptop with a 120 Hz screen can feel noticeably smoother than one running at 60 Hz, even when both displays have the same resolution. Scrolling follows your finger more closely, animations can look more continuous, and moving a pointer or window may feel more immediate. The reason is not that a higher refresh rate adds detail to each image. It changes how often the display can present a new image. That distinction also explains why a 120 Hz screen does not guarantee 120 frames per second, why some videos look unchanged, and why devices sometimes lower their refresh rate to save power.

Tech 11 Sep 2026 7 min read

Why File Size and Space Used on Disk Can Differ

A file manager may show two different numbers for the same file: its size and the space it uses on disk. A folder containing thousands of tiny files can make the difference even more noticeable. The files may add up to one amount while the storage consumed is larger. Those numbers are measuring different things. File size describes how much data belongs to the file. Space used on disk describes how much storage the file system has allocated to hold it. They often end up close, but they don’t have to match.

Tech 11 Sep 2026 8 min read

What USB-C Cable Labels Tell You

Two USB-C cables can look almost identical and behave very differently. One may charge a laptop quickly but transfer files at a modest rate. Another may handle fast storage and an external display. A third may work well for a phone yet fail to provide the capability a dock expects. The connector shape does not define the cable’s complete feature set. USB-C is a connector system that can support several levels of data performance, power delivery, and other functions. The cable is one part of that system.

Tech 11 Sep 2026 9 min read

What Local Dimming Changes on LCD TVs and Monitors

A dark movie scene can expose a basic limitation of an LCD screen. The picture may show a bright lamp against a black night sky, yet the supposedly black parts look grey. On another LCD, the same scene can have much deeper dark areas while the lamp stays bright. One feature that can create this difference is local dimming. Instead of running the entire backlight at one brightness, a local-dimming LCD can reduce the light behind dark parts of the picture while keeping other areas brighter. This can improve contrast, especially in high dynamic range (HDR) video, but the result depends heavily on the backlight design and the system that controls it.