Random snippets of all sorts of code, mixed with a selection of help and advice.
MongoDb mongoTemplate for multiple databases
5 March 2026 @ 1:31 pm
I have 2 databases:
test: contains a collection called people which holds documents representing the Person and Author class
test2: contains a collection called somethingElse which holds documents representing the SomethingElse class
My issue is that when using an autowired MongoTemplate, I can only interact with the collections held inside of test. Saving a new SomethingElse entity creates the collection and inserts it into the test database. How can I ensure that class SomethingElse documents are only fetched,mapped and saved to/from the test2 database?
Below is the code showing how the test data is generated, queried as well as the classes they are being mapped to.
MongoConfig.java
Get list of All Azure DevOps project users using REST API with TypeScript
5 March 2026 @ 1:24 pm
I am developing an Azure extension. I found this documentation in Azure REST API. I wonder if there is any actual way to list the users in a project in a clean way, something like:
export async function getAllProjectMembers(): Promise< foo > {
const projectId = await getCurrentProjectId();
const teamMembers = await getClient(GraphRestClient).listUsers(projectId);
...
return membersInfo;
}
Of course,`listUsers()` doesn't exist, unfortunately.
I haven't found anything in MS repo for Azure API for that.
Is there any nice way to do that? Maybe I missed something in the repo? If not, how should I code the HTTP request in Typescript?
Flutter Text Glitches
5 March 2026 @ 1:22 pm
I'm receiving notifications from certain users about text glitches in a Flutter app. On the total of installations the problem is almost irrelevant, but those customers are doing "much noise" in the customer assitance team.
Flutter I'm using is 3.32.5, I believe impeller is enabled by default on this version. The font we are using is Circe from Adobe Fonts. Any idea where to look for a solution?
Flutter I'm using is 3.32.5, I believe impeller is enabled by default on this version. The font we are using is Circe from Adobe Fonts. Any idea where to look for a solution?claude code chrome extension keep disconnecting (not reliable)
5 March 2026 @ 1:20 pm
I am using claude code and I try to use it with chrome extension. It is not reliable. usally I prompt something like use /chrome to check design. Sometime it does work and times he tells me that he is unable to connect to the extension. I open and close chrome sometimes it help sometimes it does not. Usally restarting claude code helps but it really interrupts the workflow. The extension is installed and I can see the chat panel for quering during the browsing but still claude code say it is disconnected.
I wonder if anyone else has this issue and if someone was able to solve itt
Here are some technical details (I asked claude code to provide):
Environment:
- OS: Ubuntu 25.10 (Questing Quokka), kernel 6.17.0-14-generic
Why does Apache PDFBox use SHA-1? Is it still secure?
5 March 2026 @ 1:20 pm
I noticed that Apache PDFBox is using SHA-1 in some parts of its implementation (for example via MessageDigest.getInstance("SHA1")).
Since SHA-1 is considered deprecated and insecure for cryptographic purposes, Iām wondering:
Why does PDFBox still use SHA-1?
Is it used for digital signatures or just internal hashing?
Is this safe in a production environment?
Should I override it to use SHA-256 instead?
For context, I am using PDFBox for digital signing. A security scanner flagged SHA-1 as a weak algorithm, so I want to understand whether this is a real security risk or just a false positive.
Cursor shows "wrong format API key" when connecting to v0 MCP even though the API key is valid
5 March 2026 @ 1:19 pm
I am trying to connect to the v0 MCP server using Cursor, but I keep getting an error saying the API key is in the wrong format, even though the key itself is valid.
The API key works correctly when used in other contexts, so I believe the key itself is not the issue.
Issue:
When configuring the MCP connection in Cursor and entering the API key, Cursor returns an error indicating that the API key format is invalid.
Questions:
Has anyone encountered this issue before when connecting to v0 MCP with Cursor?
Is there a specific format required for the API key when configuring MCP in Cursor?
Are there any additional configuration steps needed that might cause this error?
Any insights or suggestions would be greatly appreciated.
Is Semantic Versioning (SemVer) actually useful for an internal, single-instance backend API?
5 March 2026 @ 1:16 pm
I am debating whether to adopt SemVer (Major.Minor.Patch) for our internal backend API. While it is the industry standard for libraries and public APIs, I have doubts about its practicality in a private backend environment where
Single Latest Instance: Unlike a library (npm, PyPI), the client doesn't "pick" a version. We deploy a single instance, and all internal clients must use the latest version.
Fast Iteration: We deploy multiple times a day. Manually deciding between a Minor and Patch for every CI/CD trigger feels like unnecessary overhead.
Alternative (HeadVer/CalVer): I am considering systems like HeadVer (Head.YearWeek.Build) or date-based versioning to improve traceability.
My questions are
Does SemVer provide any real-world benefit for internal teams who share th
How to Limit the Usage of Key Tokens
5 March 2026 @ 12:38 pm
Can anyone tell me or give some suggestions on how to limit the usage of tokens? I can see that just for small messages that are being generated, a huge amount of tokens is being used. I would appreciate any suggestions or best practices.
Trace UI warning in shiny
5 March 2026 @ 12:27 pm
The below shiny app will raise the following warning:
Warning: Navigation containers expect a collection of `bslib::nav_panel()`/`shiny::tabPanel()`s and/or `bslib::nav_menu()`/`shiny::navbarMenu()`s. Consider using `header` or `footer` if you wish to place content above (or below) every panel's contents.
The reason for this warning is clear.
I'm wondering if there is a way to trace the origin (a linenumber) of this warning.
The usecase is a much bigger app calling shinydashboard::tabBox several times.
I tried using devmode and different debugging options in RStudio, but so far without a viable reference.
library(shiny)
devmode()
options(warn = 2, shiny.error = browser, shiny.fullstacktrace = TRUE, shiny.trace = TRUE)
ui <- function(request){
fluidPage(
tabsetPanel(
div("This will raise a warning. What is my linenumber?")
)
)
}
server <- functi
CardLayout calculates wrong minimum size
5 March 2026 @ 12:26 pm
There's a problem (a real, high-priority production problem): a CardLayout for some reason calculates the minimum width regardless of which component is showing. See java.awt.CardLayout#minimumLayoutSize.
Steps to reproduce:
Expand the window.
Switch the left component to the pink one (it's narrower).
Exit the full-screen mode.
Bam ā the divider is positioned in a weird place, as if the wider component is set.
This GUI mimics the actual layout in our app. It has a split pane, its left component is dynamically changed with the help of CardLayout (which seems to be the most appropriate layout in this case). The container has two components whose sizes vary greatly. The divider location should reflect that (while still being enabled).
How do I work-around this issue?
MRE:
import javax.swing.JButton;
import javax.swing.JF