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.

Don't understand a warning issued from PyTensor

27 March 2026 @ 9:58 pm

From this article HERE, published in "PeerJ Comput. Sci." I took the last code (page 28): import pymc as pm import pytensor import pytensor.tensor as pt a = pm.Uniform.dist() b = pm.Normal.dist(mu=a, sigma=1) x = b + pt.as_tensor([2, 3, 4]) x_draws = pm.draw(x, draws=1_000) x_logp = pm.logp(rv=x, value=[x_draws]).eval() This gives way to a long warning which I don't uderstand: --------------------------------------------------------------------------- NotImplementedError Traceback (most recent call last) ~\anaconda3\lib\site-packages\pymc\distributions\logprob.py in logp(rv, value) 176 try: --> 177 return logp_logprob(rv, value) 178 except NotImplementedError: ~\anaconda3\lib\site-packages\pymc\logprob\abstract.py in logprob(rv_var, *rv_values, **kwargs) 52 """Create a graph for

Azure Maps plane icon not following route direction when using snakeline + moveAlongPath

27 March 2026 @ 9:45 pm

I’m using Azure Maps Web SDK to animate a flight path. The route line is drawn using snakeline, and a plane icon is animated using moveAlongPath. The problem: The route line animates correctly.The plane icon sometimes points the wrong direction or appears to move opposite the route, depending on the coordinate set This works correctly for some paths (e.g. westbound), but for others (e.g. curved east/southwest routes), the plane appears to face or move in the wrong direction even though it is following the same coordinates. I have tried rotationAlignment: 'map', //Lock icon rotation to the map. rotation: ['get', 'heading'], //Rotate the icon based on the heading property of each data point. and that doesnt work either Setup Plane icon faces north by default One DataSource with: LineString

How are cache line and next-page prefetchers made aware of page sizes?

27 March 2026 @ 9:06 pm

I have done some tests and verified that on more-"recent" Intel and AMD processors, the cache line prefetcher behaves differently when a line belongs to a base page vs a huge page. How is the hardware exactly passed down this information since the information is process-specific? What bits are reserved on the hardware for this purposes, and does anyone know what algorithm is used to train the stride-prefetcher?

Get next n dates based on pattern from time diff

27 March 2026 @ 8:57 pm

I have a vector of dates where I want to get the next n (any integer) dates. dates <- structure(c(18946L, 18947L, 18948L, 18949L, 18950L, 18951L, 18953L, 18954L, 18955L, 18956L, 18957L, 18958L, 18960L, 18961L, 18962L, 18963L, 18964L, 18965L, 18967L, 18968L, 18969L, 18970L, 18971L, 18972L, 18974L, 18975L, 18976L, 18977L, 18978L, 18979L, 18981L, 18982L, 18983L, 18984L, 18985L, 18986L, 18988L, 18989L, 18990L, 18991L, 18992L, 18993L, 18995L, 18996L, 18997L, 18998L, 18999L, 19000L, 19002L, 19003L, 19004L, 19005L, 19006L, 19007L, 19009L, 19010L, 19011L, 19012L, 19013L, 19014L, 19016L, 19017L, 19018L, 19019L, 19020L, 19021L, 19023L, 19024L, 19025L, 19026L, 19027L, 19028L, 19030L, 19031L, 19032L, 19033L, 19034L, 19035L, 19037L, 19038L, 19039L, 19040L, 19041L, 19042L, 19044L, 19045L, 19046L, 19047L, 19048L, 19049L, 19051L, 19052L, 19053L, 19054L, 19055L, 19056L, 19058L, 19059L, 19060L, 19061L, 19062L, 19063L, 19065L, 19066L, 19067L, 19068L, 19069L, 19070L, 1907

What Color Model is This?

27 March 2026 @ 8:13 pm

I make pixel art pretty often, and work in an HSV color picker while spriting in GIMP. When Animal Crossing: New Horizons came out, I set up a spreadsheet that would allow me to color match based on my HSV numbers and convert them into the scales present in Animal Crossing to make color accurate outfits. When Kirby Air Riders came out, I did the same thing, though that game uses an HSL colorspace (so the spreadheet there is translating from hexcodes to RGB values to HSL values to the game's color scales). Nintendo just released the Tomodachi Life: Living the Dream demo, and the color picker there is something I've never seen before. I've tried several models at this point, but am at a loss. The only thing I'm fairly certain of is that it's a version of HSV where the value and possibly saturation are perceptually driven. I've prepared a couple example images to showcase what I mean. In both cases, the first image is Tomodachi Life, and the second is GIMP (rotated to ha

Speeding up SPSC Queue on C++

27 March 2026 @ 5:17 pm

I started learning C++ recently and I am working on SPSC Lock-Free queue. Full code of my benchmark can be found here: GitHub. What I do, is basically pinning my Producer and Consumer threads to CPU's. With that I have avg latency around 7ms with p99 13,5ms. When I set the thread priority for each thread (on 70) like this: inline int setThreadPriority() { sched_param param{}; param.sched_priority = 70; int policy = SCHED_FIFO; return pthread_setschedparam(pthread_self(), policy, &param); } My latency is getting 2x worse. With AI I came up with understanding that I am facing RT Throttling and that slows my threads. If so, what are my possibilities with improving this benchmarks? Work on isolation for my CPU ? Which is more like setti

Extending class and assigning different value to an existing property

27 March 2026 @ 2:25 pm

I'm trying to extends a class and assign a different value for a property that has been already defined in the parent class. The new value is from the allowed values: class X { constructor() { /** @type {'a'|'b'|'c'} */ this.property = 'a'; } } class Y extends X { constructor() { super(); this.property = 'b'; } } I get error: Class 'Y' incorrectly extends base class 'X'. Types of property 'property' are incompatible. Type 'string' is not assignable to type '"a" | "b" | "c"'. What an I not understanding? Am I forced to redefine the property type on child class? Here is

Dart/Flutter hook bundles lib code assets into macOS framework without dot characters

27 March 2026 @ 12:41 pm

my environment details: === dart info === - Dart 3.11.1 (stable) (Tue Feb 24 00:03:07 2026 -0800) on "macos_arm64" - on macos / Version 26.3.1 (a) (Build 25D771280a) - locale is en-US #### Project info - sdk constraint: '^3.11.1' - dependencies: code_assets, dart_ipc, data_assets, ffi, flutter, hooks, logging, native_toolchain_c, path - dev_dependencies: ffigen, flutter_lints, test ============= My question: I am integrating my macOS Flutter app with third party dynamic libs using the Dart Hook functionality. My Hook build.dart script adds those libs as DynamicLoadingBundled() code assets. PROBLEM: At runtime those lib code assets cannot be found. CAUSE: the 3rd party lib file paths include dot characters, but the Flutter build removes them during bundling. For instance, the 3rd party code wants to load the dynamic lib Frameworks/bare-dns.2.1.4.framework/bare-dn

Is this modular scikit-learn pipeline design correct for a binary classification task?

27 March 2026 @ 5:27 am

I'm building a modular machine learning pipeline for a binary classification problem using scikit-learn. I structured the code into separate functions for preprocessing, scaling, and model training. I would like to verify whether this design follows good practices, especially regarding preprocessing and model selection. Key concerns: Is my modular structure appropriate for ML workflows? Is my feature selection approach using correlation threshold valid? Is the order of normalization and train-test split correct? Is it appropriate to use LinearRegression for a binary classification problem? Full code: # import packages import numpy as np import pandas as pd import matplotlib.pyplot as plt from sklearn.model_selection import train_test_split from sklearn.linear_model import LinearRegression from sklearn.tree import DecisionTreeClassifier from sklearn.neighbors

How do I clear a stream?

27 March 2026 @ 5:03 am

I want to replace a text file's content. Set stream = CreateObject("ADODB.Stream") stream.Mode = 3 stream.Type = 2 stream.Charset = "UTF-8" stream.Open stream.LoadFromFile p stream.Position = 0 strContent = stream.ReadText re.IgnoreCase = False re.Global = False re.Pattern = ",""beautifybuttonstate"":""[^""]+""" strContent = re.Replace(strContent, ",""beautifybuttonstate"":""USER_HIDE""") stream.Position = 0 stream.WriteText strContent stream.SaveToFile p, 2 stream.Close p is a string with the full path to the text file. re is a