Questions tagged [duplication]
181 questions
2
votes
1 answer
Python class instances are duplicating attributes
Relatively new to OOP, just messing around trying to make an NPC class for a game that should generate different instances of NPC's based on random values unless specified. Just proof-of-concept really.
However the age, gender and race attributes…
![](../../users/profiles/5054683.webp)
DMcDonald
- 89
- 13
2
votes
2 answers
Code duplication issue inside an if
I have a code duplication that I want to avoid but I cannot create a method containing the code because there is a slight difference in a line inside an if. Here's what I mean :
Code 1 :
If case1 ()
{
same code
if()
{
same code
…
![](../../users/profiles/4761032.webp)
AnasB
- 21
- 2
2
votes
1 answer
Dealing with duplication between unit and integration tests
I have an algorithm implemented by a number of classes, all covered by unit test.
I would like to refactor it, which will change behavior of two classes.
When I change one class and its tests, all unit tests pass, though the algorithm becomes…
![](../../users/profiles/1882010.webp)
eugene82
- 7,017
- 2
- 19
- 28
2
votes
2 answers
Check if a dialog/widget/window still open to prevent the duplication
How to prevent open a window many times.
See the following image:
What I want is if the window still open does not open the same window once again except after closure the open window.
Finally, the code:
void Widget::on_search_btn_clicked(){
…
![](../../users/profiles/459943.webp)
Lion King
- 28,712
- 21
- 69
- 128
2
votes
1 answer
Duplicate Magento Store View
I have a Magento with many Store Views, one for every language.
Every Store View has custom settings (preferences, attribute and categories translations...) that differs from the default store values.
If I create a new Store View, the newly one uses…
![](../../users/profiles/361573.webp)
Riccardo
- 949
- 1
- 18
- 31
2
votes
0 answers
Removing duplicate chess games and then storing unique games in Postgresql
I have a very large number of chess games(around 5 million) stored in several pgn files(portable game notation). If you aren't familiar with PGN, the result will basically be a csv file when parsed, with several fields containing info about the…
![](../../users/profiles/2564651.webp)
kempchee
- 450
- 1
- 4
- 15
2
votes
5 answers
What is the best way to apply these changes to an object without duplicating code?
I am trying update a number of properties of one object from another and I wind up repeating this same code over and over again (i am showing an example with Name and LastName but i have 15 other properties with similar code).
But its important to…
![](../../users/profiles/4653.webp)
leora
- 163,579
- 332
- 834
- 1,328
2
votes
2 answers
SONAR: config duplicate line for java project
Maybe it is a stupid question, but I cannot find out where can I config the minimal lines of code for duplication check in SONAR. In project settings there is only a switch to turn on cross project check. Any ideas?
B.R.
![](../../users/profiles/2010259.webp)
Skywolf
- 653
- 9
- 20
2
votes
2 answers
How to duplicate current process?
What's the easiest way to duplicate the current process, to spawn another instance in Windows? I know Linux has fork(), but all I need is to run main in the same process again, probably using CreateProcess() with the correct arguments.
![](../../users/profiles/87973.webp)
Jonas Byström
- 22,233
- 21
- 93
- 137
2
votes
1 answer
INSERT SELECT query when one column is unique
I need to call INSERT + SELECT to import user data to different table and I need to filter user_name duplications, So I need something like this:
INSERT INTO new_table SELECT email, distinct user_name, password from old_table
but distinct works…
![](../../users/profiles/387194.webp)
jcubic
- 51,975
- 42
- 183
- 323
1
vote
3 answers
how to check if array has a duplicated values?
I'm making a small userControl library that searches for active server on a specific port [LAN].
I'm using [.Net 4.0] TCP sockets (IPV4)
so first i get the IPAddresses of my computer from :
string sHostName = Dns.GetHostName();
IPHostEntry ipE =…
![](../../users/profiles/1015648.webp)
Murhaf Sousli
- 10,769
- 18
- 103
- 170
1
vote
2 answers
how to avoid this duplicate code using templates in C++
I would like to eliminate duplicity of code in this problem:
class PopulationMember
{
public:
vector x_;
vector y_;
}
class Population
{
vector members_;
void doComputationforX_1(); // uses the…
![](../../users/profiles/1097451.webp)
Martin Drozdik
- 11,712
- 12
- 69
- 133
1
vote
1 answer
ASP.NET with disabled button having duplicate postbacks
I have an asp.net page that allows credit card information and a payment amount to be entered to authorize a payment. All of the sudden about 2 weeks ago, we started getting reports of double charges but we had not made any changes to the page. The…
![](../../users/profiles/263832.webp)
xr280xr
- 10,471
- 6
- 68
- 110
1
vote
2 answers
Eliminate duplicate code that builds similar copies of the same object
I have two classes that both build an object, and at the moment there is duplicate code in both these classes, e.g this code exists in class 1:
new Object("a", "b", "c");
Only one of the arguments to the constructor varies. So this code exists in…
![](../../users/profiles/274426.webp)
per_jansson
- 1,923
- 3
- 27
- 45
1
vote
2 answers
Facebook post being duplicated multiple times on a page
I have an article posted on a Facebook Page.
However the article seems to keep reposting itself on the page at random intervals. Sometimes this will happen 3 or 4 times in a single day, and sometimes it won't happen at all. The post doesn't say it's…
![](../../users/profiles/356372.webp)
diggersworld
- 11,830
- 21
- 77
- 115