642
questions
0
votes
0
answers
9
views
Use versioned Formatter, Inspections and Code Cleanup Configs in IntelliJ
I have configured an IntelliJ Formatter, Code Cleanup and Inspections Profile. I want to check in these profiles so my team members can use them. The problem is: They have to import these settings ...
1
vote
0
answers
108
views
JetBrains Rider removing space between delegate keyword and parenthesis
On my team, some of us use Rider, others use Visual Studio 2022. When they run code cleanup, VS 2022 adds a space between delegate and () as seen here:
var cat = this.ExecuteAFunction("Function ...
0
votes
0
answers
23
views
How can I get to VBA code that copies values & pastes them into a tblStaging, pastes those values into a tblTarget, & appends the tblTarget thereafter
I have values in a work report that need to essentially get copy & pasted into tblStaging & tblTarget, and allow for the same thereafter. So, e.g., a team "Ravens" and city "...
0
votes
1
answer
235
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 ...
0
votes
0
answers
38
views
Getting "MissingReferenceException: The object of type 'GameObject' has been destroyed but you are still trying to access it." after I stop play mode
I'm still learning Unity. I have quite a few objects and scripts in the scene and they interact with each other. I'm getting "MissingReferenceException: The object of type 'GameObject' has been ...
-1
votes
1
answer
135
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
...
-1
votes
0
answers
83
views
Jetpack Compose and code clean up: Move funtions outside of my Composable into a view model or helper class?
I have the following code, and would like to clean it up to have better separation of responsibilities.
Do I move the logic outside into a view model, create a class called AccountSummaryFormatter, or ...
1
vote
2
answers
1k
views
React-query infiniteQuery - how to fix additional pageParam type checking
i have bumped into following issue, i'm trying to implement infiniteQuery by using react-query tanstack, but i can't do it without additional checking of pageParam on it's type of number.
Could you ...
2
votes
2
answers
483
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 ...
0
votes
0
answers
598
views
How to use Playwright locators to replace evaluateAll and querySelector?
I'm trying to get data from a webpage using Playwright in TypeScript. I have a section of code where I want to extract information from multiple elements matching a certain locator.
However, I'm ...
4
votes
0
answers
198
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
130
views
I want to read in a csv file to a .NET datatable with respect to data column datatypes
I have a way to do this that works as shown below, but I really want to see if there is a cleaner way to do this without using a CSV library or package.
public static void Read(string ...
0
votes
1
answer
82
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) =&...
1
vote
1
answer
515
views
How to Organize Compose Imports by Moving Them to Another File and Importing in Another Screen?
I'm working on an Android project using Jetpack Compose, and I have a screen with a long list of imports at the top. I want to clean up the code and make it more organized. Is there a way to move ...
2
votes
1
answer
96
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
1
answer
49
views
Need to update referenced value in generic method - how to make it cleaner?
I have to update ~30 parameters.
Update depends on LastUpdated field.
Every parameter has it's own LastUpdated field.
This is an ETL process for IoT Device Twin (it means that I cannot change the ...
0
votes
0
answers
60
views
Remove unnecessary imports or usings, looking inside 'false' #if blocks
I was just adding code style and cleanup to my program, looks pretty nice, but my cleanup options include "Remove unnescessary Imports or usings". It turns out that this option removes ...
0
votes
1
answer
142
views
Delete sensitive string from all Git commits
I have internal github in our organization. There is a particular git repo where I need to replace a sensitive string from all commits. There are around 2000 commits and the sensitive string is there ...
0
votes
0
answers
55
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
271
views
Checkstyle for unused member variables?
Need the checkstyle configuration for unused member variables.
There exists a checkstyle like below, but's just for local variables.
<module name="UnusedParameterCheck"/>
( Needed a ...
1
vote
1
answer
217
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 ...
0
votes
0
answers
931
views
How to identify unused methods, codes, libraries and references in VScode
Team,
I need to identify & remove unused variables (arguments, local variables, class member variables), Libraries, and references that are unused in VS code.
I have also tried to find out some ...
-2
votes
1
answer
36
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&...
1
vote
0
answers
84
views
Refactor validation with return if statement
I have lots of method and on each method I have to do a validation. Currently, my code look like this and it works fine.
@Service
public class UserService {
@Autowired
private UserValidation ...
0
votes
0
answers
102
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
1
answer
1k
views
How can I remove unused code from a nx workspace project libs (Most libs are in Angular - typescript)?
We already have set up eslint rules (no-unused-vars) to detect unused vars and also unused imports.
What we are struggling to find is unused components, state management codes, css styles and unused ...
-2
votes
2
answers
244
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 ...
1
vote
0
answers
26
views
How can I group and name the incoming values in the request according to the standards in the config-repo with Springboot?
In the request, I will receive a Solr-name field of type List. I need to group by solr-name name. For example, gender_s, age_f and job_s came. If these three come, I have to assign them as ...
-3
votes
2
answers
102
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
1
answer
159
views
Is there anyway to detect or intercept if a program is forcbily quit/terminated in a injected DLL?
I want to perform a cleanup procedure for my injected DLL before the injected application terminates. So I'm looking for a way to intercept ExitProcess, TerminateProcess or any termination in general.
...
0
votes
0
answers
25
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)...
5
votes
0
answers
816
views
Code-Cleanup in VS2022 applies different tab/space formatting rules for closed solution files
Why would the VS2022 Code-Cleanup feature apply different keep-tabs formatting preferences depending on whether a source file is being viewed in VS2022 or is closed?
I have a new VS2022 install on a ...
0
votes
1
answer
63
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 ...
0
votes
2
answers
405
views
Remove ")" from cells in list if ")" exists
Could you please tell me how can I remove ")" from strings in a list without converting the list to a string? Example:
Input:
list =[
'ABDDDDC 1,000 IWJBCKNBCDVV',
'BDISJBJ 2,000 ...
7
votes
1
answer
1k
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 ...
0
votes
1
answer
602
views
How to clean up function that is outside useEffect?
I have a resend code button and will disable it for 30sec after pressed. Here is my function.
const time = useRef(30);
function disableResendBtn() {
time.current = 30;
...
-2
votes
1
answer
215
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
1
answer
72
views
How can I refactor these two functions with repeating code?
I'm trying to refactor my code for higher readability and I'm new to this.
I have two functions called UpFirst() and RightFirst() and they include common lines of code and I want to clean the ...
0
votes
0
answers
29
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 ...
4
votes
2
answers
2k
views
Python tempfile.TemporaryDirectory() cleanup crashes with PermissionError and NotADirectoryError
Premise
I'm trying to convert some PDF to images via pdf2image and poppler, to then run some computervision tasks on.
The conversion itself works fine.
However, the conversion creates some artifacts ...
1
vote
0
answers
403
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 ...
0
votes
1
answer
271
views
nodejs check multiple constants and give specific error message for the missing constants
I am currently creating an API for posting in backend with nodejs.
My data object, which gets provided from the frontend contains multiple objects.
My first step is to check if these multiple consts ...
1
vote
1
answer
4k
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
485
views
Best way to reset a ruby on rails project
We have a ruby rails project which we normally get from our enterprise github repository. Recently, I've added dependencies that for some reason breaks my other projects that are not related to the ...
0
votes
1
answer
27
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
432
views
What is the most efficient way to write this retry logic for a try-catch? C# [closed]
I have a C# task that I'd like to re run if a certain exception type is thrown.
This is what I have currently:
bool retry = true;
int numOfRetries = 3;
int tries;
while (retry = true && tries ...
0
votes
1
answer
297
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?
-2
votes
1
answer
199
views
What pattern should be used, strategy?
I do have a service which needs to handle two types of meal.
@Service
class MealService {
private final List<MealStrategy> strategies;
MealService(…) {
this.strategies = ...
7
votes
0
answers
580
views
How do I disable the "undo code cleanup?" prompt in JetBrains Rider?
My team has configured ReSharper/Rider to automatically run code-cleanup every time we save. I save a lot, which means code-cleanup runs a lot. Every time I try to Ctrl+Z past a point where code-...
1
vote
4
answers
66
views
How to make below bash script clean and less repetitive?
I'm making birthday tracker for only a few people and was wondering how to combine all if statements into one since date and name are the only different things in every if statement, rest is same ...