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.

Microsoft Entra ID user management with multiple domains

2 December 2025 @ 3:36 pm

In our Azure tenant we have multiple domains (Ex: xyz.onmicrosoft.com and 123.grantapp.com) Is it possible to let a group of users (or single user) to manage their domain of users? For example, [email protected] (user admin) can only reset password or update properties of [email protected] and her colleagues. Or Allow password reset for XYZ domain users only?

FastAPI: /v1/modules returns {"detail": "Not Found"} even though router is defined

2 December 2025 @ 3:35 pm

I have a FastAPI app that I start with: uvicorn app.main:app --reload In the code I have (simplified): # routers.py API_PREFIX = "/v1" def register_routers(app: FastAPI) -> None: api_router = APIRouter(prefix=API_PREFIX) api_router.include_router(modules.router) app.include_router(api_router) # modules.py router = APIRouter(prefix="/modules") @router.get("") async def list_modules(...): ... However, I always get: {"detail": "Not Found"} when I go to http://127.0.0.1:8000/v1/modules, and the endpoint does not appear in docs. Question: What could cause app.main:app to run without this router actually being registered, and what should I check (imports, paths, virtual environment, working directory, etc.) to make /v1/modules show up in Swagger and stop returning 404?

Why is App crashing while lunching PayStack SDK

2 December 2025 @ 3:33 pm

i am trying to use Paystack, but all is working perfectly on iOS, but Android keep crashing, crash log D/FirebaseSessions( 6563): App backgrounded on com.xxx.xxx D/OneSignal( 6563): [main] ApplicationService.onActivityPaused(1,APP_OPEN): com.xxxx.xx.MainActivity@30cd887 D/OneSignal( 6563): [main] ApplicationService.onActivityCreated(1,APP_OPEN): com.paystack.android.ui.paymentsheet.PaymentSheetActivity@a6e5f82 I/AppStateListener( 6563): onActivityStarted for activity : com.paystack.android.ui.paymentsheet.PaymentSheetActivity isForegound : true D/OneSignal( 6563): [main] ApplicationService.onActivityStarted(1,APP_OPEN): com.paystack.android.ui.paymentsheet.PaymentSheetActivity@a6e5f82 D/OneSignal( 6563): [main] ApplicationService: current activity=com.paystack.android.ui.paymentsheet.PaymentSheetActivity@a6e5f82 D/FirebaseSessions( 6563): App foregrounded on com.reflexpay.reflex_pay D/OneSignal( 6563): [main] ApplicationService.onActivityResumed(2,APP_OP

How to Use Coding AIs and Services (e.g. Github Copliot) to Achieve the Best and Closest Results?

2 December 2025 @ 3:29 pm

I have recently started using many coding-specific AIs and services in my projects, as they are very useful and functional, however, for some projects or tasks, it will not achieve what I want, and makes a mess. One other thing is that they do not listen to instructions that easily, and will keep asking for confirmation here and there, even if asked not to. There were many times when these coding engines have corrupted my code or rendered it unusable or made it completely out of my goals, even with the best models such as GPT-5. How should I use these AIs and engines for them to listen to my instructions and do what I say accurately? Is there a specific way I should format my questions, or should I bite-size my tasks?

Garbled characters appear under windows

2 December 2025 @ 3:28 pm

Garbled message: PS D:\build\workspace\xxx> svn info 璺緞: . 宸ヤ綔鍓湰鏍圭洰褰? D:\build\workspace\xxx ... system info: function Verify-Registry-Settings { Write-Host "=== 验证注册表设置 ===" -ForegroundColor Cyan $regPath = "HKLM:\SYSTEM\CurrentControlSet\Control\Nls\CodePage" $acp = Get-ItemProperty -Path $regPath -Name "ACP" -ErrorAction SilentlyContinue $oemcp = Get-ItemProperty -Path $regPath -Name "OEMCP" -ErrorAction SilentlyContinue $maccp = Get-ItemProperty -Path $regPath -Name "MACCP" -ErrorAction SilentlyContinue Write-Host "ACP (ANSI代码页): $($acp.ACP)" -ForegroundColor $(if($acp.ACP -eq '65001'){'Green'}else{'Red'}) Write-Host "OEMCP (OEM代码页): $($oemcp.OEMCP)" -ForegroundColor $(if($oemcp.OEMCP -eq '65001'){'Green'}else{'Red'}) Write-Host "MACCP (Mac代码页): $($

Algorithm regex to minDFA not working properly

2 December 2025 @ 3:25 pm

When implementing algorithms that convert between NFAs, DFAs, and regular expressions, a common issue is unexpected failure or non-termination when the automaton becomes large. This usually happens because each transformation step can drastically increase the number of states or transitions. For example, the subset-construction algorithm used to convert an NFA to a DFA can, in the worst case, produce 2n2^n2n DFA states from an NFA with nnn states. If your NFA includes many branching transitions, ε-moves, or repeated patterns, the state explosion becomes significant. As a result, programs may run out of memory, exceed recursion depth, or take an extremely long time to complete. Another frequent point of failure occurs in the DFA-to-regular-expression step, often implemented using state elimination. Eliminating states requires repeatedly updating transition labels by combining and nesting regular expressions. When many states are present, these expressions can grow exponential

Compile python object detection app relying on OpenCV with PyInstaller

2 December 2025 @ 3:22 pm

I have written a python script that captures a video stream from a camera and performs object detection. I am using opencv for that. opencv-python-headless 4.12.0.88 pypi_0 pypi pyinstaller 6.17.0 pypi_0 pypi pyinstaller-hooks-contrib 2025.10 pypi_0 pypi This script works well on my machine when ran in the IDE. However, after compiling it with PyInstaller, I get DLL import errors like below: Traceback (most recent call last): File "main.py", line 13, in <module> File "C:\Users\APU\AppData\Local\Temp\_MEI336202\cv2\__init__.py", line 181, in <module> bootstrap() File "C:\Users\APU\AppData\Local\Temp\_MEI336202\cv2\__init__.py", line 153, in bootstrap native_module = importlib.import_module("cv2") ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "importlib\__init__.py", line 90, in import_module I

The emulator fails to start after compiling the AOSP source code

2 December 2025 @ 3:17 pm

I downloaded and compiled the latest AOSP source code: repo init -u https://mirrors.tuna.tsinghua.edu.cn/git/AOSP/platform/manifest -b android16-qpr1-release lunch aosp_cf_x86_64_phone make -j128 Then I executed: emulator Prompts: ERROR | bad workspace: cannot find prebuilt ranchu kernel in: /home/user/AOSP/prebuilts/qemu-kernel/x86_64/ranchu/kernel-qemu ERROR | This AVD's configuration is missing a kernel file! Please ensure the file "kernel-ranchu" is in the same location as your system image. ERROR | ANDROID_SDK_ROOT is undefined

Visual Studio Code uses wrong paths when looking for includes

2 December 2025 @ 3:17 pm

I'm using VSCode to write and navigate the code in some C++ project. This project uses an SDK generated with Yocto "bitbake populate_sdk" command. SDK is installed to the path /home/user/yocto_sdk/ on the remote machine. I'm connecting to that remote machine using VSCode via ssh and browsing the C++ code that must be built by this yocto sdk. Problem is not with building but with code navigation and IntelliSense work. I have a following *c_cpp_properties.json* that is placed to the .vscode subfolder of the project: { "configurations": \[ { "name": "Linux", "includePath": \[ "/home/user/yocto_sdk/sysroots/armv7ahf-vfpv4d16-yocto-linux-gnueabi/usr/include/\*\*", "${workspaceFolder}/\*\*" \], "defines": \[ "DEBUG", "MY_

Allow camera access to sandboxed iframe without using allow-same-origin

2 December 2025 @ 3:16 pm

I am displaying user generated code (which wants to use the device camera) in an iframe on my website. To make it secure I have my iframe sandboxed like this: <html> <iframe src="code_that_uses_camera.html" width="100%" height="100%" sandbox="allow-scripts allow-popups allow-modals allow-downloads" allow="camera; microphone;"></iframe> </html> The Problem is, that this does not seem to work as my Browser only asks for camera access when I also set allow-same-origin as sandbox attribute. But I explicitly don't want to set this as it would defeat the whole purpose of my sandbox. Now I wonder if this is just a fix limitation. Is it really that you can't use camera/microphone without granting full allow-same-origin? As the code in the iframe is user generated, users could alter the main site and use its cookies etc. when I grant a