« first day (1844 days earlier)   

12:00 AM
RELOAD! There are 5312 unanswered questions (89.9938% answered)
12:46 AM
If you provide more context, this would be appropriate for Code Review. Right now though, it's vague and inappropriate for both Stack Overflow and Code Review. — Carcigenicate 46 secs ago
Wrong site, I'm afraid. If you have working code that you'd just like to have peer-reviewed, you should ask on Code Review instead. This site is for questions related to problem (non-working) code. — Ken White 29 secs ago
Please don't listen to the first two commentators and post this on Code Review. This is a snippet and there's no guarantee that it works. — Makoto 8 secs ago
2 hours later…
3:05 AM
Q: java.lang.OutOfMemoryError: Java heap space while trying to solve a 8 puzzle using DFBnB

Liana78I have the following code for DFBnB and I'm trying to solve a puzzle using it. The problem is that is gives me the exception from above,I know that there is a solution for the puzzle because i already solved it using BFS,A*,IDA* and IDDFS. the w(current,child.get(i)) function just gives out the c...

3:33 AM
I suggest you put all that aside and just write your code and make sure it works. Then post all your code on Code Review for review and ask if it can be improved and if it follows SOLID. — CodingYoshi 20 secs ago
4:28 AM
I'm voting to close this question as off-topic because this question belongs on Code Review. — zwer 49 secs ago
4:48 AM
Q: my begginer game java

joshI'm trying to make a game. it's a cop and robber game and I'm running into problems very early. the game does not wait for my input and it just continuously loops. please help import java.util.Random; import java.util.Scanner; public class Main { public static void main(String[] args) { ...

Q: Function to generate pyspark diff and return differences in line

shannona2013I have written a function that takes two pyspark dataframes and creates a diff in line. Here is the function. I am struggling to get it to scale with 100s of columns. IE get around the for loop calling .join() 100s of times...I am stuck, or maybe tired and looking for some suggestions! def di...

5:04 AM
Q: Simple Math Game in JavaScript

Lou BagelCreated a simple math (addition/subtraction) game to practice my JavaScript. Any feedback on the JavaScript appreciated. Can play in: CodePen Instructions: A math equation will show up and simply press the corresponding number on your keyboard to answer. Speed game so no need to press enter o...

5:20 AM
Q: Night Mode using css and javascript

Zeyad EtmanI just added a new feature to my portfolio, Night Mode, i created it with css and session storage in javascript, I want you to review my css of night files, i feel it filled with !important i'm sure this is a bad practice, Can anyone help me make them better? My second question, the default mode ...

5:51 AM
Q: Python task scheduler

yangmillstheorySubmit tasks to a scheduler, allowing them to be run at a future time. Tasks can be submitted in any order, and non-running tasks can be cancelled. I used a min-heap to prioritize the next task, and a threading.Condition to communicate between a "watcher" thread that sleeps until the next task...

6:40 AM
Q: Best approach for showing multiple d3js charts on the same page

Katherine MaurusI created two graphs in d3js: a bar chart and a donut chart. These two graphs use the same json object for data and share an input range and the radio button, however, are in two different pages. This is the code of the bar chart: <html lang='en'> <head> <meta charset='utf-8'> ...

6:55 AM
Q: What condition would be better to use? Switch vs if condition

user70960What do you think, what condition would be better to use in this context? What part of the code would you use? Switch-condition: switch (menu.prompt()) { case 1: system("title Test"); break; case 2: system("color f0"); break; case 3: menu.update("Change the console title;...

7:15 AM
Q: Refactoring callback hell in the function

Olga BI have a function which returns an array of datasets for a chart written with vue-chartjs. The getter getChartData returns an array with three objects with nested objects. I see that my function has a so called 'callback hell' and I want to refactor this. getDatasets() { let datasetLabels = [...

Then it sounds like you still want to send true in those cases, in which case a compiler error would be counter-productive. My advice is to go with the obsolete attribute below, change the signature and force everybody over on the new signature after a code review. — Lasse Vågsæther Karlsen 19 secs ago
7:43 AM
Q: VBA mid way dynamic range concatenate

jacobSheets("sht1").range("$B$"&Last_Used_Row&":$B$1047658").ClearContents Kept getting "expect list seperator" error. Anyone know whats wrong? Been at it for hours

8:15 AM
Q: Masks for image with OpenCV (Python)

LinkI made this code which create 2 masks. When applied, the result is this: Original image Output import cv2 import numpy as np frame = cv2.imread('image.jpg') h, w = frame.shape[:2] upper_value = int(h / 10) * 5 lower_value = -(int(h / 10) * 3) upper_mask = cv2.rectangle(frame, (0, 0), (w,...

9:11 AM
Q: update object property based on previous value Object.assign

pro.meanI have one object and its keys value initialized with 0, Now if I want to increase the value of that key from the previous value than how to do it in an efficient manner with the concept of Immutability const nameCounter = { ALPHA: 0, BETA: 0, CHARLIE: 0, PETER: 0 }; if(condtionToIncreaeAlphaC...

Q: Split string with adding separator to substring

HelloWorldI wrote my Split() extension, it's main goal is to save delimiters and add them to splitted strings. For example: I have a string "-1-2+3+4-5-6", and separators '+', '-' And I want to have following: "","-1","-2","+3","+4","-5","-6" or "-","1-","2+","3+","4-","5-","6" depends on input separator...

9:36 AM
gosh ... yesterday was a holiday, but not everywhere and now I've spent an hour to read up...
@Peilonrayz On it, could take a moment though.
@Mast Thanks :)
9:46 AM
> It also isn't an error with the code but the example-usage code.
If that's true, the question is lacking context to be reviewable. Should that be fixed, it could work.
> We have never required example input for code to be on-topic on Code Review.
No, but it does provide context and we do require context.
> And so with only a little amount of effort, changing the values to the ones on Project Euler, we would be able to tell the code works.
It's not as easy as that. That's putting the responsibility by the wrong person.
@Peilonrayz ^^
@Mast What context is it missing?
It definitely wasn't obvious the code was working. It looked a heck of a lot like it wasn't.
If the example usage takes forever to complete, it has all odds stacked against it.
@Mast It's our responsibility to check if something is off-topic when we vote to close. Yes it would be easier if the OP did this, however I don't see how it's the OP's responsibility.
@Peilonrayz I checked whether it worked as expected and it failed to complete on my machine. How long did it take on yours to run?
@Mast Did it "failed to complete" or did you decide that it took too long, and stop it?
I didn't run the code, I read it. And saw that it worked as intended. Why brute force when algebra works?
9:52 AM
@Peilonrayz My algebra was taking a holiday.
@Peilonrayz I recall giving it half an hour and had to go afterwards.
@Mast Lol, I get that way sometimes :)
Where do you want me to draw the line, 24h?
@Mast I changed the code to run in under a minute
@Mast We, Code Review, don't draw a line.
@Peilonrayz actually we do ..
@Vogel612 Source?
9:55 AM
stuff that provably doesn't terminate is off-topic
incorrect infinite loops
@Vogel612 That's "It can't finish" rather than "it takes ages to finish"
it can not
but there's cases where "it takes ages to finish" is equivalent to "it cannot"
Q: Numbers of length N and value less than K

Latika AgarwalI am solving interview question from here. Problem : Given a set of digits (A) in sorted order, find how many numbers of length B are possible whose value is less than number C. Constraints: 1 <= B <= 9, 0 <= C <= 1e9 & 0 <= A[i] <= 9 Input: A = [ 0 1 5], B= 1 , C = 2 ; Output: 2 (0...

Consider algorithms with really bad complexity. stuff like O(2^n)
and then OP asks about "how can I make this terminate for an input in the size of a few thousands?"
and the only answer you can give is: "Wait out the heat death of the universe"
Ok, and that's why you show it works on small input
> Time-limit-exceeded issues are a special kind of performance problem, where the code handles small test cases very well, but takes an unreasonable amount of time to complete for larger inputs. You may use this tag instead of performance when an online judge rejects your solution to a programming-challenge due to time constraints, or when you need to interrupt your computation because it appears to take much too long to finish.
Is the tag wiki wrong?
10:05 AM
@Peilonrayz Exactly. If it works on 10 and 50, I'll believe it should eventually complete for 500 a lot sooner.
And 10 usually doesn't take long for Euler solutions, even if their complexity is awful.
@Mast You can do that changif len(list) == 500: to if len(list) == 5:, the example on PE.

« first day (1844 days earlier)