642 questions
2
votes
1
answer
100
views
How can I make my Node.js backend code cleaner without using an ORM when working directly with SQL?
I'm building a Node.js backend using plain SQL (no ORM, just mysql2 wrapped in a small helper).
However, as my project grows, my route handlers start looking messy — full of raw SQL strings embedded ...
0
votes
0
answers
41
views
Angular Global Same Logic Functions Refactoring
I am trying to atleast clean the component.ts using services or somthing in my angular i have many repetitive code that i trying to fix and refactor. I am trying to apply DRY as possible can i have a ...
0
votes
0
answers
41
views
How to structure a form with reusable components while maintaining proper validation management?
Description:
I'm working on a Vue/Nuxt project where we typically create a single component that handles all inputs, their state, validation, and submission to the API.
While this approach works, it ...
1
vote
0
answers
33
views
Cleaning up code with function or extension
I have texts and text fields with the same modifiers. Instead of copying and pasting them every time, is there a way to clean them up so they're called like functions or extensions?
Is there a way to ...
0
votes
1
answer
763
views
Visual Studio Code Cleanup: How to avoid removing unassgiend/unused variable when file is on save
I am using Code Cleanup in Visual Studio and noticed when file is on save.
The unused variable will be removed like:
I tried editing the .editorConfig file but it didn't seem to work with any of the ...
-2
votes
1
answer
345
views
Run cleanup function in Python when Jenkins job is aborted
I wrote a script in Python that is running for some time and performing a clean up as soon as it terminates regularly like:
import time
def cleanUp():
#delete some temporary files and so on
...
2
votes
2
answers
943
views
C# - VS2022: "global using" and code cleanup on save
In VS2022 I turned on the very useful feature "Run Code Cleanup profile on Save".
With this option on, every unneeded using statement in code gets removed automatically on save.
Now I would ...
4
votes
0
answers
302
views
In c# code cleanup, How to stop visual studio 2022 adding comments /* Unmerged change from project 'xxxx (net6.0)'
Environment:
Visual studio 2022, v17.8.3 with net8 support
I did cleanup to c# solution with 6 projects using profile2 .
I found that vs 2022 during code cleanup using profile2 add these like ...
0
votes
1
answer
126
views
Socket connection does not disconnect at useEffect cleanup function
I have this code :
useEffect(() => {
const init = async () => {
try {
socketRef.current = await initSocket();
socketRef.current.on("connect_error", (err) =&...
2
votes
1
answer
118
views
Code cleanup adds spaces in interpolated strings
I have a problem with Resharper code cleanup, it turns out that there is some collision/setting in my editor config that causes spaces to be added in the interpolated text, spoiling the result. The ...
0
votes
0
answers
67
views
Is there a way to optimize a triple nested loop for accessing and object
I need to build a application to extract data from multiple JSON-Files and store it into a Database.
The File looks like this and parsed results in a highly nested object.
To explain, i need to go ...
1
vote
1
answer
348
views
What's the order of operations of a cleanup function inside a useEffect to clean stale effects?
I’m currently learning about the cleanup function in useEffect but I’m stuck on how it works in this particular example. I’m specifically stuck in the order of operations.
Looking at the last three ...
-2
votes
1
answer
46
views
There is a way to create a sequence of "if"s with textBox and method changes programmatically (C#)?
I have a form with two groupBoxes with various radioButtons each;
When selecting one of them, I want to change the texts in textboxes (in each groupBox);
Currently using this sequence of "if's&...
2
votes
0
answers
185
views
Why does "dotnet_style_prefer_is_null_check_over_reference_equality_method = true" not recognize "foo == null"?
I decided to switch from foo == null checks to foo is null. Instead of having to search through all of my code, I set dotnet_style_prefer_is_null_check_over_reference_equality_method = true in my ....
-2
votes
2
answers
319
views
What is the best way to write a class with editable properties that becomes read-only after the method is called?
I have solved my problem in the way I will describe below but I want to find the best way.
Typescript has generic type Readonly that solved this problem.
Thanks for your suggests
I used folowing codes ...
-3
votes
2
answers
121
views
How to remove the amounts of ifs from the application? [closed]
The code I say has to complete these assignments:
Given an integer,N, perform the following conditional actions:
If N is odd, print Weird
If N is even and in the inclusive range of 2 to 5 , print Not ...
0
votes
0
answers
50
views
Is there any way to input a range of languages for the :lang() pseudo-class?
I'm targeting a bunch of different languages in my LESS/CSS with the :lang() pseudo-class. It looks like this (but even more languages):
:lang(af),
:lang(sq),
:lang(eu),
:lang(bs),
:lang(ca),
:lang(kw)...
0
votes
1
answer
74
views
Refactoring methods that use the same code but different input params
I have these two methods. Can someone help me to refactor and make them common?
public void method1(Map<String,String> map, String key, String value){
map.put(key, value);
}
public void ...
10
votes
1
answer
2k
views
Code Cleanup doesn't do Format document in Visual Studio 2022
I have the following settings regarding my Tab sizing in Visual Studio 17.4.1:
When I use Edit->Advanced->Format Document, I get this result:
I configured Code Cleanup which allegedly contains ...
-2
votes
1
answer
425
views
How I can make this messy code a little bit more clean?
I'm a newbie in coding javascript, to be honest there is a lot of things I don't understand but i always manage to make things work. I wrote something for odin project but i'm sure it's not as clean ...
0
votes
0
answers
32
views
Remove Redundant Python dependencies which are not used anywhere in the environment [duplicate]
I have an application with plenty of third-party packages in it, some of them are not required, and few packages have many versions installed in the environment.
Is there any tool or method to detect ...
1
vote
0
answers
438
views
How to cleanup Google AdSense errors in React 18 with new useEffect hook automatic remounting behaviour?
I am building a next.js website and intend to include Google AdSense at some point in the future. After following some examples and implementing the scripts as per a Next project I am hitting a wall ...
1
vote
1
answer
5k
views
How to apply styles to TabPane in new Antd Tabs component
This is my old implementation of the Tabs component in Ant Design.
const tabList = [
{
key: "tab1",
label: "Tab1",
children: <Tab1 />,
},
{
key: "...
0
votes
1
answer
30
views
how do i break this python loop in a efficent manner after ive entered a valid number
while True:
month_num = int(input("enter the month number: "))
if month_num == 1:
print("january")
elif month_num == 2:
print("February")
...
0
votes
1
answer
502
views
How Can I run automatic code cleanup in VS 2022 on just the modified lines on save?
I found the code cleanup options but I want to apply them only on lines that have been edited and not the entire file. Is this possible to achieve?