Random snippets of all sorts of code, mixed with a selection of help and advice.
Firebase push notifications
9 December 2025 @ 10:02 am
I have a web app sending notifications to users when a message is sent. I think I have set up the Firebase worker correctly, but I don't receive the notifications when the tab of the browser is not active. Below is my worker code:
// firebase-messaging-sw.js
importScripts('https://www.gstatic.com/firebasejs/9.22.0/firebase-app-compat.js');
importScripts('https://www.gstatic.com/firebasejs/9.22.0/firebase-messaging-compat.js');
firebase.initializeApp({
apiKey: "",
authDomain: "",
projectId: "",
storageBucket: "",
messagingSenderId: "",
appId: ""
});
const messaging = firebase.messaging();
messaging.onBackgroundMessage((payload) => {
console.log('Background message received:', payload);
const notificationTitle = payload.notification?.title || 'New Notification';
const notificationOptions = {
body: payload.notification?.body |
How to bypass or disable Cloudflare Turnstile during Playwright automation for internal testing?
9 December 2025 @ 10:01 am
I’m trying to automate a login flow using Playwright with my valid credentials, but Cloudflare’s Turnstile challenge keeps appearing and blocks the automation. This automation is strictly for an internal testing use case, and I’d like to know if there is any way to disable the Turnstile challenge or CAPTCHA only for specific IPs, internal domains/environments. Has anyone dealt with this before, or is there a recommended approach from Cloudflare or Playwright for handling Turnstile during internal automation?
Exception in PluginGradle: This method is forbidden on EDT because it does not pump the event queue
9 December 2025 @ 10:01 am
After updating my Android Studio to Feature Drop | 2025.2.2, when I open my project I receive this error:
java.lang.IllegalStateException: This method is forbidden on EDT because it does not pump the event queue. Switch to a BGT, or use com.intellij.openapi.progress.TasksKt.runWithModalProgressBlocking. at com.intellij.openapi.progress.CoroutinesKt.assertBackgroundThreadAndNoWriteAction(coroutines.kt:577)
I haven't been able to fix it, and the problem is that this error prevents the "Android View" of my project from loading.
show recomposition counts disabled for ConstraintLayout having composeview - Android Studio Ladybug
9 December 2025 @ 9:54 am
I'm facing issue "show recomposition counts" is disabled (No source information found).
I have a ConstraintLayout having multiple ComposeViews and using - Android Studio Ladybug
Things I tried:
add debuggable true,
adding following to gradle.properties
kotlin.compose.sourceMaps=true androidx.compose.compiler.report.show=true
Invalidate cache and restart
How do I disable the AI Assist integration in Stackoverflow? [migrated]
9 December 2025 @ 9:53 am
I do not want to be prompted to use AI Assist.
I do not want my data to be sent to OpenAI.
There is no preference in my profile to turn it off.
Can PostgreSQL carry `ORDER BY` out of `JOIN` subquery?
9 December 2025 @ 9:53 am
There is a "theoretical" query:
SELECT * FROM a
JOIN (
SELECT b.pk, b.not_pk
FROM b
ORDER BY b.not_pk
) AS b2
USING (pk)
and EXPLAIN shows Sort on the whole b.
Can it be carried out of the join, theoretically?
If so, why it isn't?
Why when posting empty array is mapped to List of string with count 1 and first value is null? [closed]
9 December 2025 @ 9:52 am
I have this code in jQuery:
_itemSerialsService
.getItemSerialsToExcelWithLocations({
columnsToBeExported: exportedcolumns.length > 0
? exportedcolumns
: []
})
.done(function (result) {
abp.ui.clearBusy();
app.downloadTempFile(result);
});
Now exportedcolumns is empty array;
I have class in the server side
public class GetAllItemSerialsForExcelInput
{
public List<string> ColumnsToBeExported { get; set; } = new List<string>();
}
It comes in the backend as ColumnsToBeExported with count 1 and the first value is null?
Any reason?
Enable script injection on particular page in nuxt using routeRules not working
9 December 2025 @ 9:52 am
I'm using Nuxt 3.10.3 for a static build
Mostly, the pages are static and do not require JavaScript, so I have set the following in the nuxt.config.js.
features: {
noScripts; true
}
This prevents injecting Nuxt JavaScript in the static build when generated using
nuxt generate --dotenv .env.production
However, now there is a requirement to use Nuxt.js on a specific page, /blog, where JavaScript is required for filtering and some other functionalities like API calls. So, updated the configuration to
// features: {
// noScripts; true
// }
routeRules: {
'/**': { noScripts: true }, // ❌ No JS everywhere
'/blog': { noScripts: false } // ✅ JS ONLY on /blog
}
However, the Nuxt scripts are still being injected into all pages, i
How to fix issue with QtPdf in Conda environment?
9 December 2025 @ 9:51 am
I needed to use python occ so I installed anaconda and now I'm not sure why QtPdf is not working while everything else seems to be fine. I haven't used anaconda before.
Steps:
conda create -n xxxx python=3.10.19
conda activate xxxx
conda install -c conda-forge pythonocc-core
conda install -c conda-forge pyside6
conda install -c conda-forge pandas
conda install -c conda-forge openpyxl
After that I opened my vs studio with code . and checked if right interpreter is in use and ran my script.
It states:
Traceback (most recent call last):
File "PATH", line 1, in <module>
from PySide6.QtPdf import QPdfDocument
ModuleNotFoundError: No module named 'PySide6.QtPdf'
This is minimal reproducible example:
from PySide6.QtPdf import QPdfDocument
print("
Android Studio Otter 2 Feature Drop | 2025.2.2 Lost "Android View"
9 December 2025 @ 9:51 am
I updated Android Studio to Android Studio Otter 2 Feature Drop | 2025.2.2, and now the "Android View" is no longer displayed when I open my project. To get the "Android View" to appear, I have to delete the .idea folder from the project, but this only works the first time I open the project. I also receive the following error:
java.lang.IllegalStateException: This method is forbidden on EDT because it does not pump the event queue. Switch to a BGT, or use com.intellij.openapi.progress.TasksKt.runWithModalProgressBlocking.
If I open my project in an earlier version of Android Studio, it works without any problems, and the Android View is displayed.
My android Studio intallation Details:
Android Studio Otter 2 Feature Drop | 2025.2.2
Build #AI-252.27397.103.2522.14514259, built on December 1, 2025
Runtime version: 21.0.8+-14196175-b1038.72 amd64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
Toolkit: sun.awt.windows.WToolkit
W