Skip to content

Archive / page 40

All articles

Every practical article from the Nalar archive, newest first.

Tech 12 Sep 2026 9 min read

Sleep, Hibernate, and Shutdown: What Each Power Mode Does

Closing a laptop lid can make the screen go dark almost instantly, yet the computer may still be running in a low-power state. Choosing Hibernate can preserve the same open work while using even less power. Shutdown takes a different approach and ends the current operating-system session. These options solve different problems. The useful distinction is not simply whether the screen is off. It is where the computer keeps the working state of your open apps and documents, how much hardware remains powered, and what must happen before you can continue.

Tech 12 Sep 2026 6 min read

Sleep and Hibernate Preserve a Computer Session Differently

Closing a laptop lid can leave every open window ready for a quick return, but that does not mean the computer is fully off. Depending on its power mode, the machine may keep the active session in memory, save it to storage, or use a platform-specific low-power state that behaves differently from older forms of sleep. Sleep and hibernate both preserve an operating-system session, yet they store that state in different places. That distinction affects power use, resume time, resistance to power loss, and the amount of storage involved.

Cybersecurity 12 Sep 2026 9 min read

Service Identity Does Not End at mTLS

A successful mutual TLS handshake can establish that both endpoints hold credentials accepted by their respective trust policies. In modern service platforms, that often happens inside sidecars, node agents, gateways, or transparent proxies rather than inside application code. The connection is encrypted, a workload identity has been authenticated, and the transport looks secure. That is still only part of the security decision. The authenticated peer may be the wrong workload for the requested operation. A proxy may know the peer identity while the application sees only a local connection. A certificate may remain valid after the workload’s authority has changed. A broad trust bundle may allow credentials from an environment that was never meant to reach a production service.

Go 12 Sep 2026 6 min read

Search Sorted Go Slices with slices.BinarySearch

Searching a slice often starts with a loop, and for unsorted data that can be the right choice. When the slice is already sorted, slices.BinarySearch gives you a more specific operation: it finds a target without scanning every element from the beginning, and it also tells you where a missing target belongs in the current order. That second result is easy to overlook. It makes the function useful not only for membership checks, but also for maintaining sorted collections without writing separate insertion-point logic.

Tech 12 Sep 2026 8 min read

Screen Resolution and Display Scaling: What Each Setting Changes

A high-resolution laptop or monitor can show very sharp text yet still use large icons and comfortable menus. Another screen can use the same resolution while fitting much more on the desktop. That can seem contradictory until you separate two settings that are often treated as the same thing: screen resolution and display scaling. Resolution describes the pixel grid available to the display. Scaling controls how large interface elements are intended to appear within that grid. Keeping those jobs separate makes it easier to fix tiny text, blurry applications, cramped workspace, and confusing monitor specifications without changing the wrong setting.

Software Engineering 12 Sep 2026 12 min read

Saga Transactions: Coordinate Multi-Service Changes with Compensation

Saga Transactions: Coordinate Multi-Service Changes with Compensation A business operation can cross several services even when no single database transaction spans them all. An order flow might reserve inventory, authorize payment, create a shipment, and confirm the order. Each service owns its data and commits independently. That independence creates a difficult failure case. Inventory can be reserved successfully, then payment authorization can fail. A database rollback in the order service cannot undo a committed reservation in the inventory service.

Go 12 Sep 2026 5 min read

Run Cancellation Callbacks with context.AfterFunc in Go

context.AfterFunc attaches a callback to context cancellation without adding a goroutine that waits only on ctx.Done(). When the context becomes done, the callback starts in its own goroutine. The small API hides a concurrency boundary that matters when the callback mutates shared state, interrupts blocking I/O, or competes with normal completion. The function arrived in Go 1.21 and returns a stop function. That return value is not a general cancellation handle for the callback. It controls the association between the context and the callback, with precise behavior once cancellation and callback startup begin to race.

Artificial Intelligence 12 Sep 2026 10 min read

Route Uncertain Classifier Predictions with Selective Classification

Route Uncertain Classifier Predictions with Selective Classification A classifier does not have to answer every request. In systems where a bad prediction is costly, forcing a label on every input can be a poor product decision even when the model has strong average accuracy. Selective classification adds a reject option. The system returns a model prediction only when an acceptance rule considers the case suitable; otherwise it abstains and sends the case to a fallback such as human review, a second model, or a request for more information.

Software Engineering 12 Sep 2026 8 min read

Retry Amplification and the Role of Jitter

Retry Amplification and the Role of Jitter A failed request can create more traffic than a successful one. If a caller immediately repeats an operation after a transient error, the original unit of demand becomes two attempts. Add another retrying layer above that caller, and a single logical request can fan out into several physical attempts before any component has recovered. Retries are often described as a way to tolerate temporary faults. That description is incomplete because retry behavior also changes load. The mechanism sits inside a feedback loop: failure triggers another attempt, another attempt consumes capacity, and consumed capacity can affect the conditions that produced the failure.

Software Engineering 12 Sep 2026 10 min read

Request Coalescing at Hot Cache Misses

Request Coalescing at Hot Cache Misses A cache entry expires at 22:00:00.000. Ten milliseconds later, two hundred requests ask for the same key. A cache-aside implementation sees two hundred misses. If every caller independently reads the backing service, a single expiration event becomes two hundred concurrent backend operations. Nothing is wrong with the cache lookup itself. The amplification comes from treating identical in-flight work as unrelated. Request coalescing changes that boundary. Callers that need the same absent key share one active load, while requests for other keys continue independently. The mechanism is small, but its semantics reach beyond a mutex: it defines which operations may share a result, how failures fan out, what cancellation means, and when another load may begin.

Go 12 Sep 2026 4 min read

Repeat Slice Patterns in Go with slices.Repeat

Repeated slice patterns show up in test fixtures, cyclic configuration data, padding schemes, and small generated sequences. slices.Repeat handles that shape directly: it returns a new slice containing the input sequence repeated a specified number of times. The result has a defined size and separate slice storage. Its boundary cases also matter, especially when the repeat count comes from external input or arithmetic. Build a repeated pattern with slices.Repeat A count of three copies the complete input sequence three times:

Go 12 Sep 2026 6 min read

Remove a Range from Go Slices with slices.Delete

Removing one or more adjacent elements from a Go slice used to mean writing the reslicing and append expression by hand. slices.Delete gives that operation a direct name and handles the vacated tail slots for you. The call uses the same half-open range convention as slicing: slices.Delete(s, i, j) removes indexes i through j-1. The returned slice is shorter, so keep the return value. Remove a range with slices.Delete A basic deletion looks like this:

Cybersecurity 12 Sep 2026 9 min read

Reject Native Object Deserialization from Untrusted Inputs

Native object serialization can be convenient inside a trusted process boundary. A runtime can preserve object types, references, inheritance details, and other implementation state with very little application code. That convenience becomes dangerous when serialized bytes cross a trust boundary. Many native object formats do more than decode passive data. Their decoders may resolve classes, allocate arbitrary object graphs, invoke constructors or callbacks, restore proxies, or trigger other runtime behavior. An attacker who controls the input can then influence operations that were never intended to be part of parsing.

Go 12 Sep 2026 5 min read

Reject Cross-Origin State Changes with http.CrossOriginProtection

A browser can send credentials with a request that was initiated from another site. For state-changing endpoints, accepting that request without checking its origin can expose an application to cross-site request forgery. Go’s net/http package includes CrossOriginProtection for placing that check at an HTTP handler boundary. The type does not attempt to identify every browser request. It applies a specific policy based on request method and cross-origin signals, while allowing requests that lack those browser-origin signals. Its behavior is narrow enough that endpoint semantics still matter.

Cybersecurity 12 Sep 2026 8 min read

Reject Ambiguous HTTP Message Framing

Modern web requests often cross several HTTP-speaking components before reaching application code. A request may pass through a CDN, load balancer, reverse proxy, API gateway, service mesh, and application server. Each component must agree on exactly where one request ends and the next begins. If two components interpret message boundaries differently, bytes that one component treats as part of a request can become a second request for another component. This parser disagreement is the foundation of HTTP request smuggling.

Artificial Intelligence 12 Sep 2026 8 min read

Reduce Neural Network Inference Cost with Early Exits

Reduce Neural Network Inference Cost with Early Exits A deep neural network normally applies every block to every input, even when an intermediate representation already supports a confident prediction. Early-exit inference changes that fixed-depth path. It attaches prediction heads at intermediate points and lets selected inputs stop before the final block. The appeal is conditional computation: easy cases can consume less compute while ambiguous cases retain access to the full network. The difficult part is deciding when an intermediate prediction is reliable enough to return. A poor exit policy can save computation by silently moving errors toward the shallow heads.

Cybersecurity 12 Sep 2026 7 min read

Prototype Pollution Turns Object Shape Into Shared State

A configuration object arrives with ordinary JSON fields, passes schema checks for the values the application expects, and is merged into defaults. Later, code in another part of the process reads a property that was never present on its own object. The value still exists. It came through the prototype chain. That separation between the write and its eventual effect is what makes prototype pollution unusually awkward to reason about. The vulnerable operation can look like routine object plumbing: recursive merge logic, path-based assignment, query parsing, or a helper that copies attacker-controlled keys. The security consequence appears only when another component treats inherited state as if it were local, trusted configuration.

Software Engineering 12 Sep 2026 10 min read

Prevent Write Skew with Serializable Transactions

Database transactions make many state changes easier to reason about, but transaction boundaries alone do not guarantee that every business invariant survives concurrency. A particularly subtle failure is write skew: two transactions read overlapping state, update different rows, and both commit even though their combined result violates a rule. This anomaly matters because each transaction can look correct in isolation. The defect appears only when valid decisions are made from snapshots that become incompatible once both writes are accepted.

Go 12 Sep 2026 6 min read

Preserve Equal-Item Order in Go with slices.SortStableFunc

A sort can produce the correct key order and still damage information you meant to keep. Suppose records already arrive in creation order, and the UI groups them by status. If records with the same status should remain in creation order, an unstable sort doesn’t provide the contract you need. slices.SortStableFunc handles that case. It sorts with a custom comparator and preserves the original relative order of elements that the comparator treats as equal.

Go 12 Sep 2026 5 min read

Preserve Cancellation Causes in Go Contexts

A canceled Go context normally reports one of two broad states through ctx.Err(): context.Canceled or context.DeadlineExceeded. That is enough to stop work, but it can discard the event that triggered cancellation. A worker failure, shutdown request, quota rejection, and explicit abort can all collapse into the same context.Canceled value. Go provides cause-aware context functions for cases where the cancellation signal and the diagnostic error need to travel together. context.WithCancelCause creates a derived context whose cancel function accepts an error, while context.Cause retrieves the recorded cause.

Cybersecurity 12 Sep 2026 6 min read

Pin JWT Verification Algorithms

A JSON Web Token can carry an alg header that names a signing algorithm. That field describes the token, but it must not control the verifier’s security policy. An attacker can edit untrusted token bytes before verification, including header fields. The safe model is: the application chooses acceptable algorithms and keys from trusted configuration, then checks whether the token fits that policy. Put policy outside the token Suppose an API expects tokens signed with RS256. Its verifier should be configured for RS256 and the issuer’s trusted public key. It should not inspect alg and dynamically choose any cryptographic routine the token requests.

Tech 12 Sep 2026 5 min read

Phone Charge Limits and Battery Aging

A phone set to stop charging below 100 percent can spend hours connected to power without filling the last part of its battery gauge. That behavior is deliberate. A charge limit gives up some available runtime on that charge so the battery spends less time at a high state of charge. For a device that often has access to a charger, that exchange can reduce one source of lithium-ion battery aging. It does not stop aging, and the best limit depends on how much unplugged runtime the device actually needs.

Software Engineering 12 Sep 2026 10 min read

Phantom Rows and the Limits of Row-Level Locking

A transaction can lock every row it reads and still leave a business rule exposed. The gap appears when the rule is about a set described by a predicate, not only the rows that currently satisfy it. Suppose an application limits a small allocation group to four active reservations. A transaction queries the active rows, sees three, and decides that one more reservation is valid. If another transaction inserts a new matching row before the first transaction commits, both decisions may have been based on a set that no longer represents the committed state.

Cybersecurity 12 Sep 2026 6 min read

Passkeys Change the Shape of Account Recovery Risk

Passkeys can make the primary sign-in path markedly harder to phish while leaving an older recovery path almost untouched. That asymmetry matters. An account protected by a device-bound or synced passkey may still accept a password reset through email, a support-assisted identity check, or a fallback factor with weaker resistance to social engineering. The result is not a flaw in passkeys. It is an architectural shift: once routine authentication stops depending on a reusable secret, attackers have more incentive to target the mechanisms that restore access after credentials are unavailable. Security teams that evaluate only the sign-in ceremony can miss the route that now carries much of the residual account-takeover risk.