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.

How to resolve abydos version issue involving numpy.float and numpy.cfloat

29 January 2026 @ 12:59 pm

I am using the name matcher hmni for the first time. I am getting the error ImportError: cannot import name 'float' from 'numpy' (C:\Program Files\Python312\Lib\site-packages\numpy\__init__.py). Did you mean: 'cfloat'? I can see for myself that this is a version mismatch. This question tells me that numpy.float was deprecated in numpy 1.20 and removed in numpy 1.24. But I installed hmni and all its dependencies using pip so I don't expect to find a line in abydos trying to import a name only present in a previous version of numpy. Do I install an earlier version of numpy, overriding the stated dependency requirement of hdmi or abydos? Or is there a better approach?

How to scroll and select individual columns in Android DatePicker using uiautomator2 (Python)

29 January 2026 @ 12:58 pm

I’m developing a Python desktop application to control Android devices using uiautomator2. I’m having trouble interacting with an Android DatePicker that consists of three scrollable columns (day, month, year). The intended behavior is to select values by swiping each column vertically, but I haven’t been able to achieve this. What I’ve tried: Performing swipe gestures on the DatePicker and its child elements Attempting to focus the fields and input values via double-click / text input When I try to enter values manually, the input skips the first and second columns and writes the day, month, and year sequentially into the third column only. Is there a recommended way in uiautomator2 to reliably target and scroll individual DatePicker columns (e.g., NumberPicker components), or is there

How to prevent PowerShell command in Batch from displaying return value?

29 January 2026 @ 12:56 pm

Here is a minimal working example which turns off all screens: @echo off powershell (Add-Type '[DllImport(\"user32.dll\")]^public static extern int PostMessage(int hWnd, int hMsg, int wParam, int lParam);' -Name a -Pas)::PostMessage(-1,0x0112,0xF170,2) pause My problem is that it displays a 1 in the console. How to avoid this?

Golang Viper is not loading environment variables

29 January 2026 @ 12:56 pm

For testing purposes my system has the environment variable MY_APP_LOGGING_LEVEL=DEBUG I want to create a config package providing a function to retrieve the whole app configuration. The code should be as flexible as possible so viper should take care of env variables, config files etc. For the sake of simplicity I started with a server port and the log level and tried this simplified code package configuration import ( "log/slog" "strings" "github.com/spf13/viper" ) type Config struct { /* contains nested structures like - server - logging ...simplified: */ ServerPort string LogLevel slog.Level } func Load() (*Config, error) { viper := viper.New() // set env viper.SetEnvPrefix("MY_APP") viper.AutomaticEnv() viper.SetEnvKeyRe

Batch For loop issues 'the system cannot find the drive specified' message for EVERY line processed

29 January 2026 @ 12:55 pm

I have created a batch file that reads a portion of the Registry. If you run the code below the message "the system cannot find the drive specified" appears for every line read. If you uncomment out one of the Echo's then the message doesn't appear. But, now the screen is filed with the echo message. My solution was to use Echo to port to a text file. Is there another solution? @Echo Off :: 260124 Check MuiCache Title ProFile window Mode Con Cols=170 Lines=58 :: White on blue background Color 1F Cls Echo; Echo Reset Profile Window Echo; For /F "tokens=* USEBACKQ" %%F In (`Reg Query "HKCR\Local Settings\MuiCache"`) Do ( Set Rg=%%F ) Echo Searching %Rg% Set Rg="HKCR%Rg:~17,27%\52C64B7E" SetLocal EnableDelayedExpansion For /F "tokens=1,2*" %%A in ('Reg Query %Rg% /s 2^>nul') DO ( :: Check If the line is a value entry (starts with &

SAPUI5 – Best approach to dynamically render multiple tables based on Type and Sub-Type selection

29 January 2026 @ 12:47 pm

I am working on a SAPUI5 application where a single page needs to display different tables dynamically based on user selection. The page contains multiple Types, each Type has multiple Sub-Types, and each Sub-Type maps to a table. Some Sub-Types share the same table structure, while others require unique table layouts, resulting in around 12–15 different table variations overall. The expected behavior is that when a user selects a Type and then selects a Sub Type, the corresponding table for that specific Type and Sub-Type combination should be rendered, with only one table visible at a time. What is the recommended SAPUI5 design pattern for this scenario?

PowerShell variable not outputting property

29 January 2026 @ 12:46 pm

below my $IP variable doesn't output value of the .name property, and it just shows: " is Proxied via Cloudflare" instead of "mydomain.co.uk is Proxied via Cloudflare" $URLs = Get-Content -Path C:\\users\\admin\\Desktop\\url.csv # $Cloudflare = $IP4 = foreach ($url in $URLS) { Resolve-DnsName $URL | Format-List Name, ip4address } foreach ($IP in $IP4) { if ($IP.IP4Address -notcontains 172.67.214.35) { Write-Host $IP.Name is not in Cloudflare e } else { Write-Host "$($IP4.name) is Proxied via Cloudflare" } }

Is setInterval still inaccurate in modern browsers (2026)? [duplicate]

29 January 2026 @ 12:44 pm

Is setInterval really that inaccurate? I did the test below and it shows that setInterval is still 99% accurate after 30 minutes on my browser (Chromium 145.0.7632.18). const startTime = Date.now(); let count = 0; setInterval(() => { const timePassed = (Date.now() - startTime) / 1000; console.log("Actual time passed", timePassed, "count", ++count); if (Math.abs(timePassed - count) <= 0.02) console.info("Still accurate."); else console.warn("Not accurate."); }, 1000);

Razor Pages is not showing the ErrorMessage on asp-validation-for tag helper

29 January 2026 @ 12:44 pm

When using the asp-validation-for tag helper, it is displaying the default error message rather than the one specified in the attribute. [Required(ErrorMessage = "User Name is a required field.")] public String UserName { get; set; } = String.Empty; On the cshtml page: <div class="row mb-2"> <div class="form-floating col-12 col-md-8 col-lg-4 col-xl-2 gx-2"> <input id="userName" class="form-control" asp-for="UserName" placeholder="" /> <label for="userName">User Name</label> </div> <span asp-validation-for="UserName" class="text-danger"></span> </div> I assumed that it would show the error message "User Name is a required field" but it displays "The userName field is required."

Comparing two pdf files byte by byte for integration testing fails

29 January 2026 @ 12:38 pm

I am comparing two PDF files, I created them using SlapKit. I open them with the code below and compare them byte by byte. I create the pdf file same way every time. However every time a new pdf file created. Comparison fails.Somehow these files are not equal even though the compared file is just a previously created one with the same code. I do the comparison by byte because I want to compare drawn lines, letters and everything else. There are no random operations that can cause this failure. Nothing written inside of them change when tests are executed. string newlyCreatedFilePath = Path.GetFullPath(Path.Combine(AppDomain.CurrentDomain.BaseDirectory,"..", "IntegrationTesting","NewFile")); string integrationTestFilePath = Path.GetFullPath(Path.Combine(AppDomain.CurrentDomain.BaseDirectory,"..","IntegrationTesting","IntegrationFile")); byte[] byteArrNewFile = File.ReadAllBytes(newlyCreatedFilePath); by