7,976 questions
0
votes
0
answers
73
views
Integrating a complicated package layout into PyDev
I'm working on a project that has a somewhat complicated package layout. Specifically, there's a setup.py file at the top level of the project's directory tree that's as follows:
from setuptools ...
-2
votes
1
answer
75
views
How do you avoid AI model registry drift when one service hard-codes old model IDs and another defines the current provider registry? [closed]
I have a TypeScript service where one file defines the current AI provider registry and another file hard-codes model chains for a ranking engine.
The issue is that the ranking engine still references ...
3
votes
3
answers
82
views
Yanking multiple lines and replacing matches in (neo)vim
I would like to yank multiple lines in nvim and then paste what I've yanked into :%s,\V... to replace all occurrences in the file with a new string. For example,
foo([
"var1",
"...
2
votes
2
answers
165
views
How to simplify checking whether a reference variable is null?
I wrote a method that returns a reference to a variable (ref return), and sometimes the returned reference can be null. After calling this method I have to check if the reference is null, and I am ...
0
votes
1
answer
102
views
How to refactor all occurrences of a string into a variable in Python with VS Code
I want to do some refactoring of a single Python file in VS Code. I used a lot of hard-coded string literals, and I want to refactor them into constants so that I'm sure I'm using the correct keys.
...
0
votes
1
answer
49
views
Android Studio (Panda) refactor rename package breaks imports and project compilation in multi-module project with KSP/Hilt
I am experiencing a very frustrating issue when renaming packages in a large multi-module Android project.
Environment:
Android Studio Panda 1 | 2025.3.1 Patch 1
Gradle 9.x
Kotlin 2.x
KSP
Hilt
...
Best practices
0
votes
2
replies
31
views
How to create a type-specific and file-private reusable modifier for DatePicker in SwiftUI?
I am looking for a clean way to refactor redundant modifiers for DatePicker in SwiftUI.
In my ContentView.swift, I have multiple DatePickerviews that share the exact same styling. To keep my code DRY, ...
1
vote
2
answers
172
views
Detect existence of name in at least one base class
This code (reduced from the Chromium codebase) is accepted by Clang but rejected by GCC:
template<class T> concept Concept = requires {typename T::marker;};
#define INJECT_MARKER using marker = ...
3
votes
1
answer
172
views
How do I resolve this circular import?
Implementing a virtual file system I encounter a circular import problem.
common.py:
from typing import TYPE_CHECKING
if TYPE_CHECKING:
from .directory import Directory
from .archive import ...
Advice
0
votes
6
replies
158
views
Being too reliant on AI, roast the crap out of my coding please
Alright, I feel like this needs to be said. Lately I've become way too dependent on AI as a junior developer, and honestly, it's starting to hurt my growth. Instead of properly thinking through ...
Best practices
0
votes
6
replies
96
views
How to refactor code in C++? Make it more compact
Here is an example:
String^ var11 = Convert::ToBase64String(var1);
String^ var22 = Convert::ToBase64String(var2);
String^ var33 = Convert::ToBase64String(var3);
std::string var111 = marshal_as<std:...
Advice
0
votes
2
replies
87
views
Method-body equivalent of lambda expression
Following is a part of the execution sequence when a middleware gets configured in ASP.NET Core -
// my code
app.Use(some middleware);
// class UseExtensions / namespace Microsoft.AspNetCore.Builder
...
2
votes
3
answers
116
views
How to refactor repeated conditional logic for multiple similar elements in JavaScript?
I have a restaurant ordering app where I'm displaying order items. Currently, I have repetitive code for each menu item (pizza, hamburger, beer).
Current code (simplified):
function displayOrder(...
Advice
0
votes
5
replies
94
views
How to access variables from another import?
I have a main file in my Python program, in which I import many files. Is there any way to access in one import some variables defined in another import? Here's an example:
# file1.py
var1 = "foo&...
Tooling
0
votes
5
replies
100
views
A Clang tool to add extra line of code whenever a #define is true
I want to develop a tool that helps in transforming a code like this:
#ifdef MYLIB_ENABLE_DEPRECATED_CODE
... some deprecated code ...
#endif
into:
#ifdef MYLIB_ENABLE_DEPRECATED_CODE
...