Skip to content

Archive / page 37

All articles

Every practical article from the Nalar archive, newest first.

Go 13 Sep 2026 4 min read

Filter a Slice In Place with slices.DeleteFunc in Go

Filtering a Go slice often starts as a small loop that keeps selected elements and discards the rest. slices.DeleteFunc expresses the inverse operation directly: a predicate marks elements for removal, the retained elements stay in their original order, and the existing backing array is reused. That last property matters. DeleteFunc is not a copying filter. It mutates the supplied slice storage and returns a slice header with the resulting length.

Software Engineering 13 Sep 2026 6 min read

Fencing Tokens Make Expired Leases Observable

A process can hold a distributed lease, pause long enough for that lease to expire, then resume with local state that still says it owns the resource. Another process may already have acquired a newer lease during the pause. At that point, mutual exclusion in the lock service is not enough: two processes can each act as if they have authority, even though only one lease is current. This is a boundary problem between coordination and the resource being protected. A lease service can decide which holder is current according to its own state. It cannot retroactively erase instructions already held by an old process, nor can it stop that process from sending a request after a long pause.

Tech 13 Sep 2026 6 min read

External Drive Write Caching and Safe Removal

A file copy to a USB drive can appear finished before every related change has reached the storage medium. The progress window may close, the file may appear in a folder, and the drive can still have pending writes. This gap between an application finishing its work and storage completing every write is central to safe removal. Operating systems use several layers of caching and buffering around storage. These layers can reduce repeated work and let applications continue without waiting for each individual write to finish. They also mean that “the copy dialog disappeared” and “all data is durable on the removable device” are not necessarily the same event.

Tech 13 Sep 2026 5 min read

Ethernet Link Speed and Auto-Negotiation

A computer connected by Ethernet can show a 1 Gbps link while an internet speed test reports far less. Another connection may unexpectedly settle at 100 Mbps even though the router and computer both support faster Ethernet. These readings describe different parts of the connection. The Ethernet link rate is the signaling mode established between two directly connected interfaces. For a typical home setup, that pair might be a computer and a router, or a computer and an Ethernet switch. Auto-negotiation is the process that lets compatible interfaces advertise capabilities and select a mode they can both use.

Tech 13 Sep 2026 6 min read

eSIM Profiles Separate a Subscription from the Physical Card

A removable SIM card combines two ideas in one small object: a secure subscriber identity and a physical item that can be moved between compatible phones. An eSIM separates those ideas. The secure function remains inside the device, while carrier information can be installed as a digital profile. That distinction affects setup, switching, travel, device replacement, and troubleshooting. An eSIM is not simply a virtual copy of a plastic card. It relies on embedded secure hardware plus a provisioning system that can place an operator profile onto that hardware.

Cybersecurity 13 Sep 2026 8 min read

DNS Rebinding Turns Browser Reachability Into a Security Boundary

A service bound to a private address often feels insulated from the public web. An administrative panel on a home router, a development daemon on a laptop, or an internal HTTP endpoint may have no public route at all. Yet a browser on the same network can often reach it, and that browser also processes content from arbitrary public sites. DNS rebinding exploits the seam between those facts. A hostile site can use a domain it controls, arrange for that name to resolve to different addresses over time, and attempt to make browser requests under one web origin reach a service that was never intended to receive traffic from public content.

Cybersecurity 13 Sep 2026 6 min read

DNS Rebinding Crosses the Browser Network Boundary

A browser tab can begin its life talking to a public server and, moments later, send requests under the same hostname to a device on a private network. No browser exploit is required for that transition. DNS can supply the change. That property sits at the center of DNS rebinding. The attack is easy to reduce to a slogan about DNS answers changing, but the security consequence comes from a deeper mismatch. Browsers identify web origins primarily through scheme, host, and port. Network services often make trust decisions from the destination address, interface, or apparent local reachability. Rebinding creates a point where those two models no longer describe the same security boundary.

Tech 13 Sep 2026 7 min read

DNS Cache and Record TTL

A domain can point to a new server and still resolve to its previous address for some people. The change may already be present on the authoritative DNS server, yet a resolver that received the older record earlier can continue returning that cached answer until its permitted lifetime runs out. That lifetime is expressed through DNS time to live, usually shortened to TTL. It gives caching resolvers a limit for retaining record data. TTL makes repeated lookups less dependent on contacting authoritative servers, but it also means a DNS change is not necessarily visible to every resolver at the same moment.

Tech 13 Sep 2026 6 min read

DNS Cache and Delayed Address Changes

A website can move to a new server while one device still reaches the old address and another reaches the new one. The site itself may be healthy in both places. The difference can come from DNS caching: a resolver is reusing an answer it received earlier instead of asking the authoritative DNS service for the current record. This behavior is part of normal DNS operation. Caching reduces repeated queries and lets resolvers answer familiar names without starting a fresh lookup each time. It also means a DNS record change does not become visible to every client at the same instant.

Artificial Intelligence 13 Sep 2026 7 min read

Diversify Retrieval Results with Maximum Marginal Relevance

A retriever can fill its top positions with passages that are individually relevant but nearly interchangeable. Several chunks from one document may repeat the same fact, leaving little room for other evidence in a fixed context budget. Maximum marginal relevance, commonly abbreviated MMR, addresses this at the selection stage by considering both query relevance and redundancy with items already chosen. MMR does not change the embedding model or recover candidates that retrieval missed. It reranks a candidate pool. That boundary matters: the method can improve variety among available candidates, but it cannot compensate for poor candidate recall.

Artificial Intelligence 13 Sep 2026 7 min read

Diagnose Embedding Anisotropy in Vector Retrieval

A vector retriever can return stable nearest neighbors even when its embedding space uses only a narrow set of directions. In that case, high cosine similarity may reflect shared global structure as well as query-specific semantic alignment. This geometric concentration is commonly described as embedding anisotropy. Anisotropy matters at the retrieval boundary because nearest-neighbor search operates on the geometry it receives. An index can reproduce cosine or inner-product rankings correctly while those rankings still have weak separation between relevant and irrelevant candidates. Treating every retrieval issue as an indexing problem can therefore hide a representation problem upstream.

Tech 13 Sep 2026 5 min read

DHCP Leases and Local IP Address Changes

A phone can disconnect from home Wi-Fi overnight and reconnect in the morning with the same local IP address. On another day, it may come back with a different one. Neither result necessarily indicates a fault. On networks that use DHCP, an address is commonly assigned as a lease rather than permanently attached to a device. DHCP, or Dynamic Host Configuration Protocol, supplies network configuration to clients. The assigned IP address is only one part of that configuration. A client can also receive information such as the subnet mask, default gateway, and DNS server addresses.

Artificial Intelligence 13 Sep 2026 6 min read

Detect Out-of-Distribution Inputs with Classifier Energy Scores

A classifier can assign high softmax confidence to an input that does not resemble the data used to fit its parameters. Softmax normalizes scores across the available classes; it does not add a separate class for unfamiliar inputs. As a result, a large maximum probability is not evidence that an input belongs to the expected data distribution. Energy-based out-of-distribution detection uses the full logit vector to produce a scalar score before a deployment policy decides whether an input looks familiar enough to accept. The score is simple to compute for an existing classifier, but its interpretation depends on the model, temperature, data regime, and threshold calibration.

Cybersecurity 13 Sep 2026 8 min read

Deserialization Can Turn Data Into Execution

Deserialization Can Turn Data Into Execution A serialized object can look like inert application state right up to the moment a runtime reconstructs it. At that boundary, a compact sequence of bytes may stop behaving like ordinary data and begin selecting classes, invoking reconstruction hooks, resolving references, allocating complex object graphs, or activating framework machinery. That distinction matters whenever serialized state crosses a trust boundary. The risky property is not simply that an attacker can submit malformed input. Many native serialization systems preserve enough information about program objects that decoding carries semantics far beyond parsing JSON fields into a plain record. In the wrong context, deserialization becomes a mechanism for asking the application to assemble behavior chosen partly by the input.

Cybersecurity 13 Sep 2026 9 min read

Dangling DNS Records Preserve Authority After Services Disappear

A product team deletes an old hosted application, the cloud resource disappears, and the monthly bill stops. The public hostname often survives. Months later, preview.example.com still resolves through a CNAME to a provider-specific name associated with a resource that no longer exists. From the organisation’s perspective the application is gone. From DNS’s perspective, authority is still being delegated. That mismatch creates the conditions associated with subdomain takeover. The important detail is not simply that a DNS record points at a dead destination. Exploitation also depends on the external service allowing another party to claim the referenced name, tenant, site, bucket, project, or equivalent routing identifier. A dangling record is therefore evidence of stale control; whether it is directly exploitable depends on the provider’s ownership model.

Go 13 Sep 2026 4 min read

Copy Slice Storage with slices.Clone in Go

A slice assignment copies a slice header, not its elements. After b := a, both slice values can still refer to the same backing array, so an element update through one value can appear through the other. slices.Clone provides a compact standard-library operation for the cases that need a copy of the slice elements instead. The function is part of the slices package. Its result has the same length as the input and contains the same elements, but later replacement of an element in one slice does not replace the corresponding element in the other.

Artificial Intelligence 13 Sep 2026 6 min read

Control Token Repetition with Logit Penalties

A language model can assign high probability to a token that has already appeared several times in the generated text. If the decoder keeps selecting that token or a short pattern containing it, the output may settle into repetition even though each individual choice is plausible under the model. A repetition penalty changes this behavior at decoding time. It modifies candidate scores according to token history before the next token is selected. The model parameters stay fixed, but the effective distribution used by the decoder no longer matches the model’s unmodified next-token distribution.

Artificial Intelligence 13 Sep 2026 7 min read

Control Sequence Length Bias in Beam Search Scoring

Beam search keeps several partial sequences alive while decoding, but the score used to compare those sequences can create a systematic preference for particular lengths. With the common sum of token log probabilities, each additional token contributes a value at or below zero. A completed sequence can therefore lose score simply by continuing, even when the continuation is plausible. This is not only a property of beam width. It comes from the objective used to rank hypotheses. Changing the beam size changes how much of the search space is explored; changing the scoring rule changes which sequences the search considers preferable.

Artificial Intelligence 13 Sep 2026 7 min read

Control Sequence Length Bias in Beam Search

Beam search can return a shorter sequence even when a longer candidate contains locally plausible tokens at every position. The behavior follows directly from sequence scoring: autoregressive models multiply conditional token probabilities, or equivalently add their log probabilities. Since token probabilities are at most one, each additional token contributes a non-positive log term. That arithmetic makes sequence length part of decoding. Beam width changes which candidates survive, but it does not remove the scoring effect. A decoder therefore needs a deliberate policy for comparing hypotheses of different lengths and for deciding when a completed hypothesis is good enough to stop the search.

Artificial Intelligence 13 Sep 2026 6 min read

Contrastive Decoding with Expert and Amateur Models

A language model can give high next-token probability to text that is fluent but generic. Contrastive decoding changes the ranking by asking for a second signal: does a weaker model also find the same candidate easy to predict? A candidate favored by the expert but not by the amateur receives stronger relative support than one both models score highly. This is an inference-time mechanism. It does not alter either model’s parameters, and it does not convert the amateur model into a verifier. The decoder combines two token distributions and then selects from the resulting scores.

Artificial Intelligence 13 Sep 2026 7 min read

Contrast Expert and Amateur Models During Decoding

A language model can assign high probability to a token for two different reasons: the token may fit the prompt particularly well, or it may simply be common under many contexts. Contrastive decoding tries to separate those effects by comparing the next-token distributions of two models. A stronger expert supplies the main distribution, while a weaker amateur supplies a signal for patterns that do not require the expert’s extra capability.

Cybersecurity 13 Sep 2026 7 min read

Content Security Policy Turns Script Trust Into an Explicit Boundary

A web application can escape database queries correctly, authenticate every API request, and still hand an attacker code execution in the browser through one unsafe rendering path. The browser is unusually permissive by design: HTML can load scripts from remote origins, inline blocks can execute code, and dynamic DOM operations can turn strings into active content. Content Security Policy, or CSP, gives an application a second control plane for that execution environment.

Go 13 Sep 2026 4 min read

Compare Slices with Custom Equality in Go

slices.EqualFunc compares two slices position by position while leaving the definition of equality to a supplied function. That makes the operation useful when plain == is unavailable or does not express the relation the program needs. The function also permits the two slices to have different element types: func EqualFunc[S1 ~[]E1, S2 ~[]E2, E1, E2 any]( s1 S1, s2 S2, eq func(E1, E2) bool, ) bool The result still describes sequence equality. Length, order, and every corresponding pair matter.

Artificial Intelligence 13 Sep 2026 6 min read

Compare RMSNorm and LayerNorm in Transformers

LayerNorm and RMSNorm can occupy the same structural position in a transformer while applying different operations to the residual stream. LayerNorm subtracts the feature mean before scaling by a measure of spread. RMSNorm skips the centering operation and scales directly from the root mean square of the features. That small algebraic difference changes which transformations of an activation vector are removed by normalization. It also means that replacing one operation with the other is not, in general, a function-preserving edit to an existing model.