Skip to content

Archive / page 72

All articles

Every practical article from the Nalar archive, newest first.

Tech 05 Sep 2026 8 min read

RAM vs Storage: What the Difference Means for Your Device

A phone may be advertised with 8 GB of RAM and 256 GB of storage. A laptop might offer 16 GB of RAM and a 512 GB solid-state drive. Both numbers describe places where digital information is kept, but they serve very different purposes. The distinction matters when choosing a device and when diagnosing one that feels slow or keeps running out of space. More storage does not give running apps more working room, and more RAM does not give you much more permanent space for photos and downloads.

Cybersecurity 05 Sep 2026 9 min read

Publish a security.txt That Researchers Can Trust

A vulnerability can be discovered before your monitoring detects it. When that happens, the person who found it needs a reliable way to reach the team that can investigate. If the only visible contact is a general support form, an abandoned mailbox, or a guessed employee address, a useful report can be delayed or lost. security.txt addresses this narrow problem. It is a machine-readable text file published at a well-known HTTPS location so a researcher can discover your vulnerability-reporting contact and related disclosure information without guessing.

Software Engineering 05 Sep 2026 9 min read

Protecting Your Model with an Anti-Corruption Layer

Integrating another system often starts with a small amount of mapping code. Then its field names appear in business logic. Its status values enter conditionals. Its error codes shape application decisions. Months later, changing providers or even upgrading the integration requires edits across the codebase. The problem is not simply that the application has an external dependency. The deeper problem is that the external system’s model has become part of the application’s own model.

Cybersecurity 05 Sep 2026 8 min read

Protect Security Logs from the Systems They Observe

Logs are most valuable during a security incident, exactly when the system producing them may no longer be trustworthy. If an attacker gains administrative control of an application server and its only audit trail is stored on that same server, the attacker may be able to alter or remove both the activity and the evidence of it. The defensive problem is therefore not just what to log. It is also who can change the log after it is created.

Artificial Intelligence 05 Sep 2026 9 min read

Prevent Target Leakage in Machine Learning Evaluation

A machine learning model can score extremely well in offline evaluation and fail as soon as it reaches production. Sometimes the model is not the main problem. The evaluation accidentally gave it information that would not exist when a real prediction is made. This failure is called target leakage: information related to the outcome enters the model inputs in a way that makes the target easier to predict than it will be at inference time. Leakage can produce impressive metrics because the model is solving an easier, unrealistic problem.

Cybersecurity 05 Sep 2026 10 min read

Prevent Log Injection with Structured Events

Security logs are useful only when their meaning survives the journey from an application to the people and systems that read them. If untrusted text can change where one event appears to end, create convincing fake fields, or confuse a downstream parser, an attacker may be able to make suspicious activity harder to interpret. This problem is commonly called log injection or log forging. It happens when data controlled by an external party is treated as part of the log format rather than as data inside a log event.

Cybersecurity 05 Sep 2026 8 min read

Prevent Dependency Confusion with Explicit Package Sources

A dependency declaration can look precise and still leave an important security question unanswered: where is this package allowed to come from? This matters when an organisation uses both private packages and a public package registry. If a package manager or build configuration can resolve the same package name from more than one source, an attacker may be able to publish a public package that competes with the intended private one. A build that selects the wrong source can then run attacker-controlled package code inside a trusted development or build environment.

Software Engineering 05 Sep 2026 10 min read

Ports and Adapters for Testable Application Boundaries

A business rule often begins as a few lines of code and gradually becomes entangled with everything around it. A pricing decision reads directly from a database. An order workflow calls a payment SDK from the middle of its logic. Tests need a web server, network access, and several configuration files just to exercise one decision. The problem is not that databases, frameworks, or SDKs are bad. The problem is that application decisions have become dependent on details that change for different reasons.

Artificial Intelligence 05 Sep 2026 8 min read

Pooling Token Embeddings into Sequence Representations

Transformer encoders usually produce one vector for every input token. Many downstream tasks, however, need one vector for the whole input: a classifier may need a single representation of a support ticket, and a retrieval system may need one vector for an entire passage. The step that converts a variable number of token vectors into one fixed-size vector is pooling. It looks simple, but the choice of pooling rule changes what information survives, how padding must be handled, and whether the resulting vector matches the way a model was trained.

Artificial Intelligence 05 Sep 2026 8 min read

Pool Token Embeddings into Text Representations

A Transformer usually produces one contextual vector for every input token. Many downstream tasks, however, need one vector for the whole text. Semantic search may need one vector per document, clustering needs one vector per item, and similarity scoring often expects two fixed-size vectors to compare. Pooling is the step that turns a variable number of token vectors into one fixed-size representation. The operation looks simple, but small implementation choices can change the resulting geometry. Averaging padding tokens, assuming the first token is meaningful for every model, or changing pooling at deployment time can make an otherwise correct embedding pipeline behave poorly.

Linux 05 Sep 2026 12 min read

Pass Open File Descriptors Between Linux Processes with SCM_RIGHTS

Processes often need to hand each other access to an already-open resource. A supervisor may accept a client connection and delegate it to a worker. A privileged helper may open a protected file, then give an unprivileged process access without revealing broader filesystem permissions. A service may create an anonymous in-memory file and transfer it to another process. Sending the integer value of a file descriptor does not solve this problem. File descriptor numbers are meaningful only inside one process’s descriptor table. Descriptor 7 in one process can refer to a socket while descriptor 7 in another process refers to an unrelated file.

Python 05 Sep 2026 12 min read

Parse Binary Records Safely in Python with struct

Binary files and network messages often begin with fixed-width fields: a four-byte signature, a one-byte version, a two-byte payload length, or a four-byte identifier. Those fields are easy to describe on paper but surprisingly easy to parse incorrectly in code. The difficult part is not converting bytes to integers. It is preserving the binary layout contract: exactly which byte belongs to which field, which byte order is used, how wide each value is, and what should happen when the input is incomplete or malformed.

Artificial Intelligence 05 Sep 2026 10 min read

Pack Training Sequences to Reduce Padding Waste

Language-model training often processes sequences in fixed-size tensors. When examples have very different lengths, padding makes those tensors easy to batch but can leave many token positions doing little useful work. A batch that physically contains 8,000 positions may contain far fewer than 8,000 real training tokens. Sequence packing reduces this waste by placing multiple shorter examples into the same fixed-length training sequence. The idea is simple; the semantics are not. If packing accidentally lets one example attend to another, predicts across boundaries that should be independent, or assigns incorrect position IDs, the training objective changes rather than merely becoming more efficient.

Tech 05 Sep 2026 9 min read

Optical vs Electronic Image Stabilization: What Changes in Phone Cameras

A phone can be perfectly still on a table, but most photos and videos are made while you are holding it. Your hands make small movements even when you try to stay steady. In dim light, while walking, or when using a longer zoom, those movements can become visible as blur or shaky video. Image stabilization is the set of techniques a camera uses to reduce the effect of that unwanted motion. Phone specifications often mention optical image stabilization (OIS) and electronic image stabilization (EIS), but the names do not explain what actually moves, what software changes, or why a phone may use both.

Artificial Intelligence 05 Sep 2026 9 min read

Normalize Embeddings Before Dot-Product Similarity

Embedding systems often compare vectors with cosine similarity or a dot product. The formulas look similar enough that it is easy to treat the two metrics as interchangeable. They are not interchangeable for arbitrary vectors. A dot product depends on both the angle between two vectors and their magnitudes. Cosine similarity removes magnitude and compares direction only. That difference can change nearest-neighbor rankings, retrieval results, and similarity thresholds. This article builds a practical mental model for deciding whether to normalize embeddings. You will see why L2 normalization makes dot product equivalent to cosine similarity, how inconsistent normalization breaks comparisons, and when preserving vector magnitude may be intentional.

Software Engineering 05 Sep 2026 9 min read

Moving Behavior Closer to the Data It Uses

A function often starts in a reasonable place and becomes awkward as the system grows. It reads several fields from another object, interprets those fields, applies rules to them, and repeats the same pattern whenever a new requirement appears. The problem is not simply that the function is long. The deeper problem is responsibility placement: one part of the system owns the data, while another part knows too much about what that data means.

Linux 05 Sep 2026 10 min read

Move Data Between Linux File Descriptors with splice()

A conventional file-copy loop reads bytes into a user-space buffer and then writes those bytes somewhere else. That pattern is portable and easy to understand, but sometimes the program does not need to inspect or transform the data at all. It only needs to move bytes from one file descriptor to another. On Linux, splice() can handle that case differently. It transfers data between file descriptors while keeping the transferred data out of a user-space buffer. At least one endpoint must be a pipe, so a pipe can act as the kernel-side bridge between a source and a destination.

Artificial Intelligence 05 Sep 2026 10 min read

Model Ensembling for Combining Predictions

A machine learning model can fail because of patterns specific to its training run: its initialization, sampled batches, training data, architecture, or hyperparameters. Training another model may produce different mistakes. Ensembling uses that disagreement by combining predictions from multiple models instead of trusting one model alone. The idea is simple, but useful ensembles require more than averaging everything available. Models that make nearly identical errors provide little complementary information, while diverse models can improve predictions at the cost of additional training, memory, and inference work.

Artificial Intelligence 05 Sep 2026 10 min read

Measure Attention Concentration with Entropy

Transformer attention is often inspected as a matrix of weights. That works for a few examples, but it becomes difficult when you need to compare many heads, layers, tokens, or model runs. A useful summary is attention entropy: a number that describes how concentrated or spread out one attention distribution is. Entropy can answer a narrow but practical question: does this query place most of its attention mass on a few available positions, or distribute that mass broadly? It does not tell you whether the model is correct, whether a token caused the prediction, or whether a head is important. Used with those limits in mind, it is a compact diagnostic for attention behavior.

Artificial Intelligence 05 Sep 2026 9 min read

Mask Padding Tokens in Transformer Attention

Transformer batches often contain sequences with different lengths. To store them in one rectangular tensor, shorter sequences are usually extended with padding tokens. Padding solves a shape problem, but it creates a modeling problem: those extra positions are not part of the original input. If attention treats padding like ordinary content, real tokens can assign probability to positions that carry no useful information. The result may be wasted attention, representations that depend on how much padding was added, and training behavior that differs unnecessarily across batches.

Cybersecurity 05 Sep 2026 10 min read

Make Sensitive Operations Safe to Retry

A client sends a request to create a refund. The server completes the refund, but the response is lost when the connection closes. The client cannot tell whether the operation succeeded, so it retries. If the server treats the retry as a new operation, one uncertain network failure can become two refunds. The same pattern appears in credit transfers, invitation acceptance, provisioning, job submission, and other state-changing actions where repeating an effect has security or financial consequences.

Cybersecurity 05 Sep 2026 10 min read

Limit Secret Exposure in Process Memory

A secret can be well protected at rest and still become exposed after an application starts using it. A database password retrieved from a secret manager, a private key loaded for signing, or an access token received from an identity service usually has to exist somewhere in process memory before the program can act on it. That creates a different security problem from secret storage. If sensitive values remain readable in memory longer than necessary, appear in many copies, or are captured in diagnostic artifacts, a memory disclosure can reveal credentials that were never written intentionally to a file or log.

Software Engineering 05 Sep 2026 9 min read

Keeping Framework Code Humble at System Boundaries

A user clicks Save. The handler reads text fields, validates an order, calculates a discount, writes data, chooses an error message, and updates the screen. Testing one business rule now requires constructing a UI framework and arranging several unrelated details. The rule itself is not difficult. It is difficult to reach because it is mixed with code that must talk to the outside world. The Humble Object pattern addresses this problem by keeping framework-dependent code deliberately small and moving important decisions into ordinary code that can be exercised directly. This article explains the mental model, shows how to find a useful boundary, and examines where the pattern helps and where it only adds indirection.

Cybersecurity 05 Sep 2026 9 min read

Keep Untrusted Paths Inside an Intended Directory

Applications often need to turn input into a file operation: download a report, store an attachment, load a template, or unpack an archive. A dangerous mistake is treating an input path as if it were only a name. Paths contain structure, and that structure can redirect the operation somewhere the application did not intend. If an application expects a file under one directory but lets untrusted input influence the resolved location, a path traversal flaw can expose or overwrite files outside that directory. The consequence depends on what the process can access: configuration, application data, credentials, or other users’ files may fall within reach.