Skip to content

Archive / page 74

All articles

Every practical article from the Nalar archive, newest first.

Python 05 Sep 2026 9 min read

Buffer Temporary Data in Python with SpooledTemporaryFile

Temporary data often has an awkward size profile. Most requests may produce a few kilobytes, while an occasional import, report, archive, or upload grows to hundreds of megabytes. Using io.BytesIO is convenient for the small case, but its contents stay in memory. Using a temporary file avoids keeping the whole payload in memory, but every payload uses file-system-backed storage even when it is tiny. Python’s tempfile.SpooledTemporaryFile gives you a middle ground. It behaves like a file object while keeping data in memory up to a configured threshold. When the data grows beyond that threshold, it rolls over to a temporary file and continues through the same interface.

Go 05 Sep 2026 8 min read

Bound Untrusted Stream Reads in Go with io.LimitReader

Reading an entire io.Reader is convenient, but convenience can become a resource problem when the reader is not fully under your control. A request body, uploaded file, decompressed stream, subprocess output, or protocol payload may be much larger than expected. Calling io.ReadAll directly asks Go to keep reading until EOF, growing memory as needed. The important mental model is that a size limit should sit in front of the consumer. Instead of trusting every caller to stop at the right point, wrap the source in a reader that exposes only a bounded prefix. Go’s io.LimitReader does exactly that.

Cybersecurity 05 Sep 2026 10 min read

Block Common and Compromised Passwords at Creation

A password can satisfy a length rule and still be a poor authentication secret. A familiar phrase, a predictable pattern, or a password exposed in an earlier breach may be among the first values an attacker tries against many accounts. This creates a practical problem for applications that allow users to choose passwords: checking only syntax does not tell you whether the chosen value is already widely known or unusually easy to predict.

Tech 05 Sep 2026 7 min read

Automatic vs Manual Mobile Network Selection: What Changes

Most phones have a mobile-network setting that can choose a network automatically or let you select one manually. The manual option can look like a way to choose the strongest signal or a particular cell tower, but that is not what it does. This setting controls mobile network operator selection: which carrier network your phone tries to register with. It does not normally let you choose an individual tower, and seeing an operator in the list does not mean your SIM is allowed to use it.

Artificial Intelligence 05 Sep 2026 10 min read

Attention Sinks for Stable Streaming LLM Inference

Autoregressive language models normally reuse the keys and values of earlier tokens while generating the next token. This KV cache avoids recomputing the entire prefix at every decoding step, but its memory use grows with the cached sequence. A long-running chat, agent, or stream can therefore accumulate more cached state than a serving system wants to keep. A tempting fix is a sliding window: retain only the most recent tokens and evict everything older. For models trained with ordinary dense attention, however, abruptly dropping all early tokens can damage generation quality even when those old tokens do not appear semantically important.

Linux 04 Sep 2026 8 min read

Write Files Atomically on Linux with rename and fsync

Updating a small file looks simple: open it, truncate it, write the new contents, and close it. That works when nothing interrupts the write. The failure mode appears when a process crashes, the machine loses power, or another process reads the file while it is being rewritten. A reader can observe an empty or partially written file, and a crash can leave the pathname referring to incomplete data. For configuration files, state snapshots, generated metadata, and similar single-file updates, a better pattern is to write a complete replacement beside the original file and then rename it into place.

Tech 04 Sep 2026 8 min read

Why Your Phone’s Compass Can Point the Wrong Way

A map app can know your location correctly while the direction arrow points sideways. A compass app can also appear accurate in one place and drift badly in another. These problems make more sense once you separate two questions that phones answer in different ways: Where am I? and Which way am I facing? Satellite navigation can help answer the first question. To estimate the second while you are standing still, a phone commonly relies on magnetic and motion sensors. Those sensors are useful, but the magnetic one can be disturbed by ordinary objects around you.

Tech 04 Sep 2026 9 min read

Why Your Phone Screen Turns Off During Calls

Put a phone to your ear during a call and its screen will usually go dark. Move the phone away and the display normally wakes again. This small behavior prevents your cheek or ear from pressing on-screen controls while you are talking. The feature depends on proximity sensing: the phone tries to determine whether something is very close to the front of the device. The basic idea is simple, but the exact sensor hardware and software behavior vary between phone models.

Tech 04 Sep 2026 7 min read

Why Touchscreens Do Not Work With Every Glove

A phone may respond instantly to a bare fingertip but ignore the same tap when you put on a pair of gloves. The screen is not measuring pressure in the way a physical button does, so pressing harder usually does not solve the problem. Most modern phones and tablets use a capacitive touchscreen. It detects small changes in an electrical property called capacitance near the surface of the display. A bare finger normally creates a change the touchscreen can recognize. A glove can weaken that interaction enough that the device no longer sees a valid touch.

Tech 04 Sep 2026 10 min read

Why Streaming Video Quality Changes While You Watch

A streaming video can look sharp for several minutes, suddenly become blurry, and then recover without you changing a setting. That behavior can be confusing when your device still shows a strong Wi-Fi connection or your internet plan advertises plenty of speed. In many cases, the change is deliberate. Modern streaming systems commonly provide several versions of the same video and let the player move between them as conditions change. The goal is usually to keep the video playing rather than insist on a quality level that the connection cannot sustain.

Tech 04 Sep 2026 8 min read

Why Restarting a Device Can Fix So Many Problems

Restarting is one of the most common suggestions when a phone, computer, router, or other digital device behaves strangely. It can sound like a generic response, yet there are good technical reasons why it often works. A restart does not magically repair every fault. What it does is end the device’s current running state and build a fresh one. That can remove temporary problems caused by stuck software, exhausted resources, failed connections, or hardware components that need to be initialized again.

Tech 04 Sep 2026 8 min read

Why Devices Slow Down When They Get Hot

A phone may feel fast when you start a game, then become less responsive after several minutes. A laptop may finish a short task quickly but slow during a long export. Sometimes the device is noticeably warm when this happens. That slowdown can be deliberate. Modern processors can produce substantial heat when they work hard, and devices have limits on how much heat they can safely handle and remove. When temperatures rise far enough, the system can reduce performance to control them.

Tech 04 Sep 2026 9 min read

Why Devices Need Free Storage Space to Work Properly

A phone or computer can have enough storage for all your important files and still start behaving badly when the drive is almost full. An update may refuse to install, an app may fail to save a file, or ordinary tasks may become less reliable. The reason is simple: free storage is not wasted storage. The operating system and applications need working room as they create temporary data, replace files, download updates, maintain caches, and perform other routine jobs.

Tech 04 Sep 2026 7 min read

Why a File Can Be Too Large for an Empty USB Drive

A USB drive can show tens or hundreds of gigabytes of free space and still refuse to accept a single large video, archive, or backup file. The error may say that the file is too large for the destination even though the drive clearly has enough room. The apparent contradiction comes from confusing two different limits: how much data the drive can hold in total and how large one individual file is allowed to be. The second limit is controlled largely by the drive’s file system, not by its remaining capacity.

Tech 04 Sep 2026 7 min read

What Wi-Fi Signal Bars Do and Do Not Tell You

A phone or laptop can show full Wi-Fi bars while a website barely loads. Another device may show only two bars yet stream video without trouble. This can seem contradictory if the Wi-Fi icon is treated as a general score for internet quality. It is not. The bars mainly describe the wireless link between your device and the nearby Wi-Fi network. They do not directly measure the speed of your internet service or every condition that affects data transfer.

Tech 04 Sep 2026 8 min read

What Photo Metadata Is and What Happens When You Share a Picture

A digital photo contains more than the pixels you see. The image file can also carry information about the picture, such as when it was taken, its dimensions, camera settings, orientation, and sometimes where it was captured. This extra information is called metadata: data that describes other data. It helps cameras, phones, photo libraries, and editing software organise and interpret images. It also explains why two copies of a picture can look identical while carrying different information behind the scenes.

Tech 04 Sep 2026 8 min read

What Internet Latency Means and Why Speed Is Not the Whole Story

A fast internet plan can download a large file quickly and still make a video call feel awkward. A game can react late even when a speed test reports plenty of bandwidth. Sometimes a website pauses before it starts loading, then finishes quickly once it gets going. These experiences make more sense when you separate speed from latency. Internet speed usually describes how much data a connection can move over time. Latency describes delay: how long data takes to travel from one point to another and, depending on the measurement, back again.

Tech 04 Sep 2026 7 min read

What Happens When You Leave Apps Running in the Background

You switch away from a messaging app, open a browser, and later return to find the message exactly where you left it. It is natural to assume the first app has been fully running the whole time. That assumption leads to a common question: should you regularly close every app to save battery or make your device faster? Usually, the answer is no. An app that appears to be open is not necessarily doing active work. Modern operating systems manage apps according to what they need, what the device can afford, and what background activity the platform allows.

Tech 04 Sep 2026 7 min read

What Data Saver Mode Changes on Your Phone

A phone can use mobile data even when you are not actively browsing or watching a video. Apps may refresh information, synchronize files, download media, or check for updates in the background. If your mobile plan has a limited allowance, those small transfers can add up. Data saver mode is a system setting designed to reduce this background data use. The exact name and behavior vary by operating system and device, but the basic idea is simple: foreground activity that you deliberately start usually keeps working, while some automatic network activity is delayed or restricted.

Tech 04 Sep 2026 8 min read

What Bluetooth Pairing Does and Why Devices Remember Each Other

The first time you connect new wireless headphones, a keyboard, or another Bluetooth accessory, your phone or computer may ask you to pair it. Later, the same devices often reconnect with little or no action from you. That can make pairing seem like another word for connecting, but the two ideas are different. Pairing is a setup process that lets compatible Bluetooth devices establish the information they need for an appropriate relationship. A connection is the active communication link they use when they are actually exchanging data.

Tech 04 Sep 2026 7 min read

What Battery Saver Mode Changes on Your Device

A phone or laptop can sometimes keep running noticeably longer after you turn on its battery-saving mode. Nothing has added energy to the battery, so where does the extra runtime come from? Battery saver modes work by changing how the device spends the energy it already has. They reduce or delay work that is not essential right now and may lower the power used by the display or processor. The exact changes depend on the device and operating system, which is why battery saver can feel almost invisible on one device and more restrictive on another.

Artificial Intelligence 04 Sep 2026 8 min read

Weight Decay in Neural Network Training

A neural network can keep reducing its training loss while learning parameter values that generalize poorly. Weight decay is one way to regularize training: it applies a small pressure that shrinks selected parameters as optimization proceeds. The idea sounds similar to adding an L2 penalty to the loss, and for plain stochastic gradient descent the two can be made equivalent by matching their scaling. With adaptive optimizers such as Adam, however, adding an L2 penalty to the gradient and directly decaying the weights are not generally the same operation. That distinction is why optimizers such as AdamW use decoupled weight decay.

Software Engineering 04 Sep 2026 10 min read

Versioning Contracts, Not Just Releases

A version number is useful only when its consumers can make a decision from it. Suppose a library changes from 2.4.1 to 2.5.0. A developer considering the upgrade wants to know something practical: can existing code keep working, or must it change? The answer does not come from how much code the maintainer edited. It comes from whether the release changed a contract that consumers depend on. That contract includes more than function names. It can include accepted inputs, returned values, error behavior, configuration, file formats, command-line options, extension points, and other observable behavior that the project promises to preserve.

Cybersecurity 04 Sep 2026 8 min read

Verify Dependency Integrity Before Installation

A dependency declaration such as library = 2.4.1 tells a package manager which release you intend to use. It does not, by itself, prove that the bytes being installed are the same bytes you previously reviewed, tested, or approved. That distinction matters when dependencies cross a trust boundary. Packages may come through registries, mirrors, caches, proxies, build systems, or internal artifact stores. If unexpected bytes are accepted somewhere along that path, a familiar package name and version can create false confidence.