« first day (2404 days earlier)      last day (1612 days later) » 

12:00 AM
RELOAD! There are 6282 unanswered questions (90.0755% answered)
 
12:13 AM
0
Q: Solving Pentomino puzzles by using Knuth's Algorithm X

MiniMaxI wrote a program which solves Pentomino puzzles by using Knuth's Algorithm X. My priorities were: readability, straightforwardness and brevity of the solution, so I didn't try to squeeze as much performance as possible by eliminating function calls in some places or similar tricks. I am interes...

 
 
2 hours later…
1:56 AM
0
Q: Binary Search Trees and Iterators in Java

user214274I am working on creating a binary search tree for an assignment in college. So far, I've created the basic structure of the search tree and an iterator for it. I'm having problems when it comes to calling on the iterator and creating a toString method. I am getting NullErrorException and I'm st...

0
Q: Temporary queue to prevent duplication

docyodaI am making a Reddit bot and to prevent my bot from posting to the same comment twice, instead of making a database, I decided I would rather create a temporary list (or "queue") that once appended to, checks to ensure the maximum length of the queue hasn't been exceeded. Once exceeded, however, ...

 
2:16 AM
0
Q: Naive SCP module in Elixir

Rodrigo Ce MorettoI'm trying to do a simple implementation of a scp wrapper in Elixir. The code is working as intended, but I got a feeling that the error conditions can be simplified. Besides error handling, I don't the best way to append the -r flag if the source_path is a directory with a cond keyword. defmod...

 
 
2 hours later…
4:42 AM
0
Q: i need help me solve python code

Gideon Agyemang Prempehevery time i run my program it just says i got a d but when i remove the total it say define total, help i'm new to coding and completely lost. import sys print("Please answer these questions, Enter yes if true and no if not") print("Enter quit if you want to end the program") total = 0 def y...

 
Monking
 
 
1 hour later…
5:54 AM
Ben Popper on December 03, 2019

This week we chatted with Charlton McIlwain, a professor of media, culture, and communication at NYU. He is the author of the new book, Black Software: The Internet & Racial Justice, from the AfroNet to Black Lives Matter. We discuss how a demand for more diverse clip art helped lay the foundation for some of the first black owned and operated software companies in the United States, and the ways in which social media has helped to empower a new generation of voices to demand change in the tech industry and beyond.  …

 
0
Q: Hide same row value based on condition in angular 6?

DharamChauhan code for popup,how to write *ngIf condition to hide same row group and display other group .Here i am passing and displaying group, i just need to hide respective request group. GroupRequestDesc have all group values. <tr> <td *ngFor="let value of GroupRequestDesc;let $index=index...

 
6:44 AM
0
Q: allocation of values in a 2D array using malloc, prints garbage in the final array

Roger Almengor I want to create a raster dataset by calculating the average value of every pixel, for 14 images. The images are 10980 * 10980, and they are 14 in total. The main program is: //Main program int main() { char path[100]; char suffix[100]; printf("Enter path to list files: "); ...

 
 
3 hours later…
9:15 AM
 
9:28 AM
I'm voting to close this question as off-topic because it looks more fitting in CodeReview — justhalf 48 secs ago
 
0
Q: How to optimize if statement in python from a parsing script

LeelouhI have a part of my code I want to optimize. I use if statement to skip the analyze if the values are not the one I want. Just to help the comprehension, in my data, R1 is between range(6,15); mis in range(0,1); spacer in range (0,10). My code is working, but it would be better if it will run f...

0
Q: opposite access to enums

user2516457consider I have many enums (Java) that looks somewhat like this: @AllArgsConstructor @Getter public enum PopularPeriod { MONTHLY ("MON"), BIMONTHLY ("BMN"), QUARTERLY ("QTR"), SEMI_ANNUALLY ("SMA"), ANNUALLY ("ANL"); private final String value; } Now, a usual use, I'd think, w...

0
Q: Managing user defined and default values for instance attributes

uhohThe following works as expected but I wonder if there is a more idiomatic way to check the input kwargs against the user-required (non-defaulted) arguments. It is written in this way: so that as I continue to develop and modify my script and add attributes, I simply need to add them to the class...

 
I'm not sure this would be on topic on Code Review either, its hard to say if theres a better way of writing it without fully understanding what output its supposed to be giving — Sayse 32 secs ago
 
10:04 AM
Code Review is the proper place to ask about coding style for working programs. — Barmar 5 secs ago
 
10:29 AM
0
Q: Simplify chained comparison: 8x8 Chess Board

AdamI'm writing a program for a chess board in python and I'm wondering if there is a way to simplify this comparison to check for a valid move. I'd appreciate any advice as to how I can improve this line. Currently I have: # check if row and col are valid if row >= 0 and row < 8 and col >

 
11:29 AM
As for your question, does the code work? If it works (that's a hard requirement) it seems like part of your question should be a better fit on the Code Review SE. And if the question could be split up like that, then it's probably to broad and need to be more focused or asked as multiple separate questions. — Some programmer dude 41 secs ago
 
0
Q: Disabling a form button while there's an http request running

PeribackI have a form built with react, formik and yup, and this form has some async validations. Apparently, some users were able to bypass these validations, and to prevent some errors, I wanted to disable the submit button when there's a pending http request. Many years ago, I used to handle this ver...

 
11:51 AM
0
Q: React context API + GraphQL codegen hooks

Danielltype AuthState = "logged in" | "logged out" | "loading"; interface IAuthContext { auth: { user: User | null; state: AuthState; }; setAuth: Dispatch<SetStateAction<IAuthContext["auth"]>>; logout: () => Promise<void>; } export const AuthContext = createContext<IAuthContext | null>...

 
12:11 PM
0
Q: Can someone please check this Unit Test class from iOS and tell me if I am using the correct approach?

Vishal SonawaneI am learning to write test cases in iOS using Swift. I was stuck at testing static functions from my Utilities class, so I tried to mock that class and then test the cases. Please let me know if its the correct approach or else tell me how to do that. Here is my code: import XCTest @testable im...

 
1:07 PM
You could replace the for loop with a while loop and break when you have a correct guess. But these types of questions shouldn´t be asked on SO. better ask in Code reviewUli Sotschok 24 secs ago
 
1:24 PM
For suggestions on improving code, you may be better off at codereview.stackexchange.com . — 0 0 55 secs ago
 
1:46 PM
The question is somewhat vague and also opinion-based. What you could maybe do is write a short but non-trivial program which illustrates the pattern you are currently using, and then post it to Code Review. That should get you the sort of feedback you are looking for. — John Coleman 45 secs ago
actually this question belongs to CodeReviewMong Zhu 35 secs ago
 
2:04 PM
If your code works and you just want someone to look it over and see it there's a better way, please post it in Code Review instead. — Magnus Eriksson 33 secs ago
 
0
Q: How can I make the canny edge detection more robust to detect all the edges in OpenCV code?

mvr950I have a Canny Edge Detection Code written in C++. I would like to know how can I make it more robust in terms of detecting all the edges correctly and save it? Is this the best possible edge detection possible? Can the coders find any error in my code? Below is a picture of how the code looks li...

0
Q: Python code debug - Phase difference of a transfer function

YokeshI have attached the code below which I beleive has some error in finding the phase difference of a transfer function. I'm trying to code to reproduce results of Fig 4 in Pg 7 of this research paper. (credit: Schuller) As you can see from my result, Gain appears to be correct but not the phase...

 
2:37 PM
codereview.stackexchange.com since it looks like your code is already working — sleepToken 24 secs ago
if it's working then it might fit better on Code Reviewphuclv 46 secs ago
 
2:50 PM
@ phuclv - Thank you for raising this, I think you are right. I was not aware of the Code Review forum. Will move my question over there. — P.D. 17 secs ago
Also, I'm not sure whether this question is better suited for codereview.stackexchange.com than here; perhaps someone more experienced can shed some light on the matter. — OthmanEmpire 48 secs ago
 
3:15 PM
0
Q: 6 subdivided windows on same window with different colored live single web camera image how to make the code minimalistic?

mvr950I have a live webcam windows which means there are six subdivided windows in a single window live. And show pictures in colored and black and white. Is there anyway I can make the code minimalistically minimized? I believe the code is considerably long. import cv2 import cv import numpy as np i...

1
Q: PHP OOP classes used for building web applications

David MachadoThe following classes are used for web development. And I was wondering if I'm implementing them correctly specially the Base class. This is a version 2.0 of the question the classes are as follows: MyPDO Session Security Base Examples: <?php //using the autoloader require "../classes/autol...

0
Q: Rotate images using QT and C++

GreyDollsI am working on an image editing program for a class and I seem to be stuck at this part. I can manipulate the colors just fine when it comes to the images, but I cannot quite figure out how to define the pixels as a matrix and then rotate them. The goal is to rotate them 90 degrees, then 180, an...

 
We don't do code reviews here. However, Code Review does. — Adriaan 1 min ago
 
3:35 PM
0
Q: Simulation of residual bootstrap takes two days to execute

P.D.Problem: My code is too slow. I need to run a simulation which will take me a few days if I don't find a way to speed it up. Context: The code is for a school project, which is due in ten days. I am relatively new to Python and under normal circumstances, I would invest the required time to unde...

0
Q: Writing array to vector slows down program after each iteration

JosephI have a C++ program where the input are 2 arrays, each containing a and z number of elements. The program then creates all possible combinations using all elements in both arrays. For example, if one array had 2^4 elements and the other had 2^7 elements, the total possible combinations would be ...

 
3:47 PM
I get defensive programming, and I agree in principle about it, but as a code reviewer, I think this would get flagged for introducing arbitrary data that isn't part of the actual logic flow because you already have all the information needed to stop infinite recursion by checking for null as it is impossible to recurse up a tree infinitely. Sure you could forget to update the parent and have an infinite loop, but you could just as easily forget to update that arbitrary variable. In other words, it is defensive programming to check for null without the introduction of new, unrelated data. — MarqueIV 22 secs ago
 
@CaptainObvious 2 more close votes. Code not implemented
 
0
Q: Worksheet_Change Event Sends Email

Zack EI have functioning code that I wrote what seems like a long time ago in a Worksheet_Change event, and even though this works I'm sure that it can be written better. I'm thinking passing the items like CustName = Split(cell.Offset(0,-1).Value, "-")(0) to a variable in a Sub or Function for genera...

0
Q: Python - weaving multiple lists into one

NickI have this code to weave the split_input ['5,4 4,5 8,7', '6,3 3,2 9,6 4,3', '7,6', '9,8', '5,5 7,8 6,5 6,4'] together. However I feel like this can be done more efficient (especially the weave function) but I have no clue how to improve it without importing any modules. class Class1: def __...

 
0
Q: PyOpencv code that displays color, b/w and canny images input from single live webcam camera: canny edge scrollbar necessary or extraoneous?

mvr950I have e single live webcam camera. I have displayed one color image, black and white image and canny edge image. Do you think I should put a scrollbar for the canny edge detection amount to make it a standard program or current threshold is fine? import cv2 import cv import numpy as np import m...

 
 
1 hour later…
5:18 PM
0
Q: Conditional sorting of a list using python

eeraAny person in the queue can swap the person directly in front of them to swap positions. If two people swap positions, they still wear the same sticker denoting their original places in line. One person can swap at most twoothers. For example, if n=8 and person 5 swap with person 4 , the queue wi...

 
@CaptainObvious PHPOOP :D
5
 
5:37 PM
Got a downvote on a 4-year-old answer today. ?????
 
6:06 PM
some people...
 
6:19 PM
0
Q: Basic LinkedList implementation

peterjwolskiPlease bear in mind, I've only started learning c++ this week, and as such, would love topic suggestions for which I should master, to become better at C++. Below, is my code for a singly linkedlist. It doesn't have complete functionality, just the ability to print, append, and add a node at a s...

 
6:39 PM
0
Q: How could I refactor this code to reduce the code complexity and number of lines?

Tom BritoHow could I refactor this code to reduce the code complexity and number of lines? My A.java file: @Entity public class A { private List<Item> items = new ArrayList<>(); // and other attributes, and getters, and setters public void addItem(String v1, int v2, Another v3) { Item i = n...

 
@user253751 Ah, so I'd actually get a better review of my code here than on Code Review? — JL2210 58 secs ago
If you can post the real (working) code, I suggest asking this on codereview.stackexchange.com. It's a better venue for this type of question. — jaco0646 32 secs ago
 
7:00 PM
0
Q: Ruby eliminating duplicates in a hashes array while keeping count of the times the element was present

Sebastian DelgadoI have an array of hashes (price_params['items']) where each item has a key called quantity what I'm trying to do is to clean every duplicate of each item but keeping the count of the times the item was found in the array in the unique one that I'm leaving (using the quantity key to keep that val...

 
Same 4-year-old answer got an upvote today, too??????
 
7:22 PM
Hi! I think your question is off-topic here, but on topic on the Code Review site. — Michele Dorigatti 46 secs ago
Think this would fit better on codereview SE. — Sombrero Chicken 19 secs ago
 
7:45 PM
I see. In light of that information you should try codereview.stackexchange.com because your question is off-topic for Stack Overflow. — MonkeyZeus 12 secs ago
@MonkeyZeus Okay gotcha, sorry I'm still kind of new to Stack Exchange in general. Is it still off-topic for Stack Overflow if I'm looking for a way to do the match and replace in one pass? And I can take out the part of my question that asks about what is best practice / most efficient – if that's more of a question for code review. Thanks for your help and for your patience! — A Poor 26 secs ago
This question may get better answers on codereview.stackexchange.comJacobIRR 33 secs ago
 
8:01 PM
0
Q: The aim of below code is calculating the term of dfdeta. It contains some variables such as sum. sum is also is summation

amirI am trying to improve the time running of the below code. In this code, some dummies variable is defined. It is just some part of a big lines of codes. But i try it with dummies variables. It takes too much in higher size of etas and Nx. I would be appreciate if a better way suggest for calculat...

-1
Q: How can I make this 8 bit assembly code loop 3 times?

Zephram FosterI am working with an 8-bit assembly online simulator for an assignment. I have the program at the point that it can print my name as output, but I do not know how to make it loop the "print" function 3 times, outputting my name 3 times. Can anyone help me out with that? The site I am using is thi...

 
8:42 PM
-1
Q: C# Expression body definition Readability

m5cI have a function private int CalculatePageSize(int totalNumberOfJobs, int deleteBatchSizeMax) => totalNumberOfJobs % deleteBatchSizeMax != 0 ? (totalNumberOfJobs / deleteBatchSizeMax) + 1 : totalNumberOfJobs / deleteBatchSizeMax; I am hearing complaints that appar...

 
9:02 PM
0
Q: C++ Mandelbulb-set generator; How to increase performance for high resolutions?

EVARATEThis mandelbulb-set generator creates a .xyz file which contains all the points that are in the set which lie on a 3d-grid. It does what it is supposed to. However the amount of calculations done is proportional to the third power of the resolution* which means that the script takes very long if...

 
9:23 PM
0
Q: Using composition instead of inheritance and abstract classes

vesiiI have a tool that displays data in some format. For example, it can display a list of dogs in a CSV or JSON formats. In the code, I had a lot of places where I had to check the format and display the data in that format. The only difference between the code blocks is the calls to the data. Some...

 
10:03 PM
0
Q: PowerShell script to execute Docker maintenance, optionally non-interactively

msanfordProblem Developers in my team are new to Docker. I wanted to provide a way to accomplish general Docker housekeeping tasks (like pruning unused images and compacting the Hyper-V volume) largely automatically. Solution The PowerShell script below is designed to be run either interactively or as...

0
Q: Multitasking in NASM Win16 Assembly

T145Obviously, on older, single-core processors true multi-threading is impossible. An illusion of such an ability can be created by rapidly switching between tasks. Below is my attempt at this: any critique is welcome! [org 100h] section .text main: lea si, [task_a] call spawn_new_...

 
 
1 hour later…
11:20 PM
Better, but still not a good fit for Stackoverflow. You're asking for a better way, which is generally a question for codereview.stackexchange.com, but you haven't posted any code, so... Not sure what you want here. — Tim Lewis 9 secs ago
 
0
Q: Smartest way to handle Stripe's Payment Intent and Paypal's Payment in Laravel

AlbertoSinigagliaSo my situation is this: I have a controller method pay which will generate a Stripe\PaymentIntent and saves it's id in a order which will be stored in the session. Then to the user will be displayed the payment form, where he can choose between Stripe and Paypal: if he choose the Paypal payme...

 

« first day (2404 days earlier)      last day (1612 days later) »