StackOverflow.com

VN:F [1.9.22_1171]
Rating: 8.5/10 (13 votes cast)

Random snippets of all sorts of code, mixed with a selection of help and advice.

boot_devices in terraform script not working

15 April 2026 @ 8:44 am

I am using the following snipplet to create a simple vm on libvirt ``` libvirt = { source = "dmacvicar/libvirt" version = "~> 0.9.7" } ..... resource "libvirt_domain" "vm" { name = local.config.name memory = local.config.memory memory_unit = "MiB" vcpu = local.config.vcpu type = "kvm" os = { type = "hvm" type_arch = "x86_64" type_machine = "q35" # boot_devices = ["hd"] } cpu = { mode = "host-passthrough" } devices = { disks = [ # Main system disk sda { source = { volume = { pool = libvirt_volume.sda.pool volume = libvirt_volume.sda.name } } target = { bus = "sata" dev = "sda" } driver = { type = "qcow2" }

How to draw an area around a set of points on a graph?

15 April 2026 @ 8:44 am

I need to draw this graph. I have the points as just x,y coordinates (values are irrelevant). I need some thing to help me draw the bounding area. There will be ability to add/remove points for different sets so I need to be able to redraw the boundary dynamically. I'm thinking D3.js. I need some help finding the right library. A scatter chart with a boundary line surrounding the points in a rectangular fashion

How to choose trucks based on cost/capacity in AnyLogic ResourcePool?

15 April 2026 @ 8:42 am

I am using AnyLogic with a ResourcePool of trucks (same type), but each truck has different attributes like fuel consumption and driver cost. Currently, the Seize block selects any available truck randomly. I want to select a specific truck based on attributes (e.g. lowest cost or best efficiency). How can I customize the selection logic in a ResourcePool or Seize block? Additionally, can anyone recommend a simple heuristic or rule-based approach to select trucks in a more optimal way (e.g. based on capacity, cost, or efficiency), without using complex optimization algorithms?

Reordering DOM results in some attributes being shifted between elements

15 April 2026 @ 8:31 am

I have a function which takes an array of SVG elements (polygons in this case), arranges them by a metric and appends them back into the SVG, the objective being to control the draw order of the polygons, given that SVG has no z-index attribute. At first, the function works as intended. But when I run it again, the order changes... sort of. The spooky part is, that even though the desired polygon is no longer on top, the fill colours change so that the polygon that is now (mistakenly) on top is the colour of the polygon that should be on top. In other words, only the fill attributes are being arranged correctly, divorces from their elements! What the heck is going on? Ok, details (paraphrased): class Model{ constructor(){ this.hiddenPolygons = []; // used for doing mathy stuff like determining draw order this.screenPolygons = []; // the actual polygons drawn to SVG } function createPolygon(){ // doStuff(); let mark

Distance gallery tags, name and header in Wordpress

15 April 2026 @ 8:26 am

I set up the following homepage in WordPress https://milana-fotografie.com/ There is only one issue. The gallery and gallery name overlapping with header and logo/company name. Especially if you look on a smartphone. I checked all boxes, but couldn't figure out how to settle this issue. I would appreciate any ideas. Thank you in advance!

Flutter can’t read GPS EXIF from image, but Windows properties shows latitude and longitude

15 April 2026 @ 8:26 am

Why would Flutter/Dart fail to read GPS EXIF data from an image that clearly has latitude and longitude in Windows properties? Is this a limitation of the EXIF package, a problem with the image picker returning a stripped copy, or an issue with how GPS tags are stored in the image? How to reliably extract GPS latitude/longitude in Flutter? Whether I should use a different package or a different import approach? How to debug what EXIF data Flutter is actually receiving I’m building a Flutter app that imports photos and reads EXIF metadata using Dart. The issue is that the same image clearly contains GPS data when I check it in Windows file properties, but my Flutter app cannot extract the latitude/longitude. import 'dart:developer' as dev; import 'dart:io'; import 'package:native_exif/native_exif.dart'; class ExifService { Future<void> extractMetadata(String filePath) async {

E5 Embedding model vertex AI endpoint not working anymore (429 errors)

15 April 2026 @ 8:13 am

I'm using this model endpoint: https://console.cloud.google.com/vertex-ai/publishers/intfloat/model-garden/multilingual-e5-large-instruct-maas But keep getting 429 errors since yesterday. Did google silently dropped this endpoint?

how to make a cell with a image that changes according to whats written in another cell in google sheets

15 April 2026 @ 8:11 am

for example I enter "hello" in a cell and it shows a waving photo but if I enter "goodbye" it shows a completely different photo I need it to call from a seperate sheet where it has all the icons and the name that goes with it I've tried =vlookup and it didnt work, I am very new to sheets

How to create a simple phishing detection and awareness system

15 April 2026 @ 7:32 am

I am a beginner student working on a mini project about a "Phishing Detection and Awareness System". I want to create a simple system that can: - Check whether a URL is safe or suspicious - Alert the user if the link is phishing I am not using advanced machine learning. I prefer a simple method using basic programming (Python or JavaScript). Can anyone suggest: Simple techniques to detect phishing URLs? Any beginner-friendly approach or example code? What features should I include in a basic project? Thank you.

Which is better - Java or python?

15 April 2026 @ 6:14 am

I have learned and worked as a web developer for two years. I know Javascript, TypeScript and ReactJS for frontend, NodeJS for backend. For databases I have worked on both MongoDB and postgreSQL. I also know about mongoose and prisma. Now I'm confused about which one is better, python or Java? I like AI systems and enterprise level softwares systems. Can anyone give me a suggestion?