Urgent.News

What's breaking now, across thousands of outlets.

Tech

Fitting Three Objects in One Case: Modeling Multi-Item Packaging

The first article in this series modeled a product as a data model. The second one dealt with a curved object that broke the rectangular assumption. This one is worse: a case that holds three objects — one bottle, two champagne flutes — each with a different shape, a different tolerance, and its own cavity. And they all have to share one outer envelope. Here is what that does to the schema. The…

In the third installment of the series, the focus shifts to a case designed to hold multiple objects with varying shapes and sizes. Previously, the model worked well for a single item, but adding multiple items with diverse dimensions and tolerances proves to be a challenge.

The previous model only had one dimensions block and one interiorProfile, which is insufficient for a multi-item set. Instead, the interior is now represented as a layout, with each item having its own cavity. Initially, a naive fix was to add separate fields for each cavity, such as bottleCavity and fluteCavityLeft. However, this approach becomes inadequate when the client requests changes, like adding more glasses or altering the bottle size.

A more robust solution is to model cavities as a list, allowing for flexibility in handling various configurations. The new data structure includes type Cavity with properties like id, holds, inner dimensions, clearance, position, and orientation. The MultiItemSpec type combines the envelope dimensions, wall thickness, list of cavities, and shared tolerance.

The crucial constraint to consider is the additive nature of the fit check. While a single item is only verified by checking if it fits within the envelope, multiple items require a more complex calculation. The sum of the cavity widths, plus dividers and double the wall thickness, must be less than or equal to the envelope width.

To enforce this constraint, a validator function is implemented. It calculates the total cavity width by adding each cavity's width and clearance, then determines the required width based on the number of cavities and wall thickness. If the required width exceeds the envelope width, an error message is generated, indicating the shortfall in millimeters.

The error message is the most valuable aspect of the validator, as it provides clear feedback on the issue without merely returning a boolean value. This feedback enables swift resolution of the problem, preventing lengthy email threads and delays in the supply chain.

The key takeaway from this series is the importance of structuring packaging specifications effectively. By keeping shared fields centralized and leveraging lists for variable aspects like cavities, the design becomes adaptable to different configurations. Moreover, validating the additive constraint and providing informative error messages ensures that packaging designs meet the required specifications and function as intended.

Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.

Read the original at dev.to →

More in Tech

Agents follow the runbook — including the step the attacker added

Agents follow the runbook — including the step the attacker added Give an agent a runbook and it will follow it. That is the point of a runbook.

  • Runbooks contain legitimate steps and a malicious step
  • TaintWall firewall blocks all 16 malicious cases
  • Firewall incurs 6-point utility cost

How to Clean Up Ollama and LM Studio Models Taking Up Space on Windows in 2026

Your C: drive is red in File Explorer, and a good part of it is AI models you pulled into LM Studio and Ollama months ago.

  • Off Grid AI Desktop identifies and displays each model's size
  • LM Studio models in %USERPROFILE%\.lmstudio\models, Ollama in %USERPROFILE%\.ollama\models
  • Off Grid AI Desktop offers recycle bin and PowerShell/Command Prompt removal method

Black Friday Sale: System Design

Imagine, there are 4 database sharding strategies with 4 completely different outcomes. Pick the wrong one and your primary database melts on Black Friday.

  • Directory-based sharding recommended for Black Friday e-commerce
  • Hash and range sharding fail to handle high write/read volume
  • Caching directory in Redis mitigates potential bottleneck

Implementing Consent and Account Deletion in a Fitness App

Implementing Consent and Account Deletion in a Fitness App A user disables analytics tracking in your fitness app. The settings screen shows that tracking is off, but your backend continues sending…

  • Define distinct processing purposes for user data, like workout tracking and analytics.
  • Create a ConsentStatus and ConsentPreference data model with audit history support.
  • Implement server-side preference updates with validation, persistence, and synchronization.

The four colors from my first prompt are still in my app. Almost nothing else is.

The four brand colors I wrote in my first prompt in January are still in my app today, to the exact hex code. Almost nothing else from that first sketch survived: not the logo, not the font setup, and…

  • Four brand colors remain unchanged from initial prompt
  • Colors include bright purple, electric violet, neon pink, and bright cyan
  • Font Atkinson Hyperlegible stays consistent throughout app

More from Thursday 29 October →