Skip to content

Archive / page 79

All articles

Every practical article from the Nalar archive, newest first.

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.

Artificial Intelligence 04 Sep 2026 8 min read

Choose Between Causal and Masked Language Modeling

Two language models can use similar transformer components yet learn from text in very different ways. One may predict the next token from everything to its left. Another may hide selected tokens and reconstruct them from surrounding text. That training choice changes what information is available during learning and strongly influences which tasks the resulting model naturally supports. These objectives are called causal language modeling and masked language modeling. Understanding the distinction helps when choosing a pretrained model, interpreting its outputs, or designing a training objective for a language task.

Cybersecurity 04 Sep 2026 10 min read

Cache Personalized Responses Without Cross-User Leaks

Caching can make an application faster by reusing a previous response instead of generating it again. That same reuse becomes a security problem when a response created for one user can be returned to another. Imagine /account renders the signed-in user’s email address and recent activity. The application checks authentication correctly at the origin server. A shared cache in front of it stores Alice’s response under a key based only on /account. Bob later requests the same path and the cache reuses Alice’s stored response without contacting the origin. The authentication code is correct, but it never gets a chance to run for Bob’s request.

Python 04 Sep 2026 10 min read

Build Portable Readiness Loops in Python with selectors

A network service can handle one connection with straightforward blocking calls: accept a client, read a request, write a response, and repeat. The model becomes awkward when one thread must manage many connections at once. The problem is not that sockets are slow. The problem is that a blocking operation can stop the thread while one connection waits, even though other connections are ready for useful work. Python’s selectors module provides a higher-level way to wait for I/O readiness across multiple file objects. Instead of asking one socket to block until something happens, you register many sockets and ask the selector which ones are currently ready.

Cybersecurity 04 Sep 2026 11 min read

Bind Security Tokens to Their Intended Purpose

Applications often use temporary tokens to authorize narrow actions: verify an email address, reset a password, accept an invitation, approve an account change, or continue an authentication flow. A token can be random, unexpired, and correctly signed yet still be dangerous if the application accepts it for a different action than the one for which it was issued. The practical problem is token confusion. One part of a system proves that a token is authentic, while another part assumes that authenticity means the token is valid for whatever operation is currently being requested. If different flows share token formats, validation code, or signing keys, that assumption can turn a limited credential into broader authority.

Artificial Intelligence 04 Sep 2026 9 min read

Batch Normalization in Neural Networks

A neural network can become harder to train when the scale and distribution of intermediate activations change as earlier layers update. One technique for controlling those activations is batch normalization, usually shortened to BatchNorm. BatchNorm looks simple: normalize a layer’s activations, then learn a scale and offset. The important detail is that its behavior depends on mode. During training it normally uses statistics from the current mini-batch. During inference it normally uses running statistics collected during training. Confusing those two paths can produce a model that trains normally but behaves poorly when deployed.

Python 04 Sep 2026 9 min read

Avoid Subprocess Pipe Deadlocks in Python

Launching a command from Python is easy. Capturing its output is also easy. The trouble starts when a parent process waits for a child while the child is waiting for the parent to read from a pipe. That circular wait is a deadlock: neither process can make progress even though neither has crashed. This problem is especially confusing because the same code may work during testing and hang only when a command produces more output. Small output fits in an operating-system pipe buffer. Larger output can fill that buffer and expose the incorrect coordination.

Linux 04 Sep 2026 8 min read

Avoid PID Reuse Races on Linux with pidfds

A process ID looks like an identity, but it is really a reusable number. That distinction matters in long-running supervisors, job managers, test harnesses, and other programs that observe a process and then act on it later. Between those two operations, the original process can exit and Linux can eventually reuse the same PID for an unrelated process. Traditional PID-based code can therefore have a time-of-check/time-of-use race: check PID 4242 -> original process exits -> PID 4242 is reused -> signal PID 4242 Linux PID file descriptors, usually called pidfds, provide another model. Instead of repeatedly identifying a task by a reusable integer, a program obtains a file descriptor that refers to a particular process and can use that descriptor with pidfd-aware APIs.

Cybersecurity 04 Sep 2026 8 min read

Authorize Every Object Access

A developer can correctly require login and still expose another user’s data. The mistake is simple: the application proves who made the request, then assumes that identity is enough to access whichever record the request names. Consider an endpoint that returns an invoice by identifier. A signed-in user requests invoice 1842, the application loads invoice 1842, and the response succeeds. If the application never checks whether that user is allowed to read that invoice, changing the requested identifier may cross an authorization boundary.

Software Engineering 04 Sep 2026 9 min read

Assertions That Expose Broken Assumptions

A program can produce the wrong result long after the code that caused the problem has run. A function corrupts an internal value, several operations accept it, and an unrelated component eventually fails. By then, the stack trace points at the consequence rather than the cause. Assertions help shorten that distance. An assertion states an internal condition that the programmer believes must be true at a particular point in the program. If the condition is false, the program reports a broken assumption immediately instead of continuing as though the state were valid.

Cybersecurity 04 Sep 2026 9 min read

Allowlist Writable Fields to Prevent Mass Assignment

An API endpoint may look harmless because it updates only the current user’s profile. The danger can appear one layer lower: if the framework automatically copies every supplied request field into the stored user object, the client may be able to change properties that the interface never intended to expose. For example, a profile request might legitimately accept display_name and timezone. The underlying user record may also contain role, account_status, or billing_limit. If the update path treats every recognized object property as client-writable, authorization decisions made elsewhere can be bypassed through an ordinary update operation.

Tech 03 Sep 2026 8 min read

Why USB Hubs Share Bandwidth Between Connected Devices

A USB hub can turn one computer port into several useful connections. You might plug in a keyboard, mouse, external drive, webcam, and card reader at the same time and expect each new socket to behave like a separate port on the computer. The important detail is that those devices usually still reach the computer through the hub’s single upstream USB connection. When several devices need to transfer substantial amounts of data at once, they can therefore compete for the capacity of that shared connection.

Tech 03 Sep 2026 7 min read

Why Storage Capacity Can Look Smaller Than Advertised

Buy a 1 TB drive and a computer may appear to show substantially less than 1 TB. A phone sold with 256 GB of storage also does not normally give you 256 GB of empty space for photos and apps on first use. Neither observation necessarily means storage is missing. Several different things can make the number you see smaller: storage makers and software may count bytes with different units, a device needs space for its own software, and a formatted drive needs structures that keep track of files.

Tech 03 Sep 2026 7 min read

Why Safely Ejecting USB Drives Still Matters

Copying a file to a USB flash drive can look finished before every related storage operation has completely settled. Modern operating systems use memory, caches, and background work to make storage feel fast, so the progress window is not always the whole story. That is why computers provide an eject, safely remove, or unmount command for removable storage. The command gives the operating system a chance to finish pending work and stop using the drive before you disconnect it.

Tech 03 Sep 2026 8 min read

Why Phones Get Warm While Charging

A phone that feels warm while charging is not necessarily malfunctioning. Moving energy from a charger into a battery is not perfectly efficient, so some of that energy becomes heat. The phone itself may also be using power at the same time. What matters is the difference between ordinary warmth and a device becoming hot enough that it has to protect itself. Modern phones monitor temperature and can reduce charging speed, limit performance, or pause charging when conditions become unsuitable.

Tech 03 Sep 2026 8 min read

Why a Higher-Wattage USB-C Charger Does Not Force More Power Into Your Device

A laptop may come with a 65 W charger while a phone normally uses much less. If both devices have USB-C ports, an obvious question follows: is it safe to plug the phone into the larger charger, and will the charger push 65 watts into it? With standards-compliant USB-C charging equipment, the wattage printed on a charger is primarily a statement of capacity. It tells you how much power the charger can provide under supported conditions. It does not mean every connected device must consume that amount.

Tech 03 Sep 2026 9 min read

What Virtual Memory Does When Your Computer Runs Low on RAM

You can sometimes open more applications than seem able to fit in your computer’s physical memory. At other times, opening one more browser tab makes the whole machine feel sluggish even though nothing has crashed. Virtual memory helps explain both situations. It lets the operating system manage memory without requiring every piece of an application’s active data to remain in physical RAM at the same time. When RAM becomes scarce, the system can reclaim space in several ways, including moving some memory contents to storage.

Tech 03 Sep 2026 8 min read

What Screen Refresh Rate Means and When Higher Hz Matters

A phone advertised with a 120 Hz screen may feel smoother than a 60 Hz model when you scroll, swipe between pages, or play a fast-moving game. The number sounds simple, but it is easy to misunderstand what it actually measures. Refresh rate describes how often a display can update the image it shows. A higher rate can make motion appear smoother and controls feel more immediate, but it does not automatically improve every video, game, or application. It can also affect power use.

Tech 03 Sep 2026 7 min read

What Private Browsing Does and Does Not Hide

Most modern browsers offer a mode called private browsing, incognito mode, or a similar name. The feature is useful, but its name can create the wrong expectation: it mainly changes what the browser keeps on your device after the private session ends. Private browsing is not an invisibility mode for the internet. Websites can still receive network information, online services can still associate activity with an account you sign in to, and the network carrying your traffic can still handle your connections.

Tech 03 Sep 2026 8 min read

What HDR Means on Screens and When It Makes a Visible Difference

A screen labelled HDR may promise brighter highlights, richer colours, and more realistic images. Yet turning on HDR does not automatically make every photo, game, or video look better. HDR stands for high dynamic range. In display use, the basic idea is to reproduce a wider range between dark and bright parts of an image while preserving useful detail across that range. Good HDR can make sunlight, reflections, lamps, and other highlights look more intense without forcing the rest of the picture to become equally bright.

Tech 03 Sep 2026 7 min read

What File Extensions Mean and Why They Matter

A photo might end in .jpg, a document in .pdf, and a compressed archive in .zip. These short endings are file extensions: parts of filenames that help people and software identify what kind of data a file is expected to contain. File extensions seem simple, but they explain several everyday puzzles. Why does double-clicking one file open a photo viewer while another opens a spreadsheet? Why can changing .jpg to .png make a file harder to open without actually converting the image? And why can a file sometimes open even when its extension is missing or wrong?

Cybersecurity 03 Sep 2026 11 min read

Verify TLS Server Identity Without Bypasses

A client can establish an encrypted TLS connection and still connect to the wrong server if it does not verify the server’s identity correctly. Encryption protects traffic from observation and modification only within the connection that was established. The client must also decide whether the endpoint at the other end is the service it intended to reach. This matters for browsers, API clients, background workers, mobile applications, service-to-service calls, update clients, and any other software that relies on TLS. A tempting workaround such as “disable certificate verification because the internal certificate is inconvenient” can turn a configuration problem into an authentication failure.