« first day (2214 days earlier)      last day (1807 days later) » 

12:00 AM
RELOAD! There are 6058 unanswered questions (89.8714% answered)
 
12:35 AM
0
Q: Use of Javascript Promises

ThomasI have created a small static site generator (for learning purposes) in Javascript ES6, using Promises, however, I am not certain of how to use them well. The code below works fine, but I wonder if i can't write my promises a better way. I call my promises in SSG.start(); const yaml = require('...

 
 
2 hours later…
2:46 AM
0
Q: Python Hangman Problems

KreyulI've been trying to create Hangman in Python for a school assessment but I don't understand what is going wrong. My problem here is that after the user guesses the final letter, it keeps on repeating. import random import time name = input("What is your name? ") print(name + ", ay?") time.sleep...

 
3:26 AM
-1
Q: Anyone can tell me what i'm wrong in the code below?

Phd2dAs my understanding, I have tried refactor below code. Do you think I should sequence promise. Is it ok if we keep using result of first response. After refactor const sql = require('mssql'); const connectionString = 'somecnnstring'; const query1 = 'some-query-1'; const query2 = 'some-query-...

0
Q: Classic Tetris implementation for windows console - OO design exercise

NorthernSageSome context: Let me start by saying that until very recently procedural was the paradigm of choice for about 100% of my programming activity, and I was a complete stranger to C++ and OOP concepts. Since a few weeks ago, I have been studying C++ and today I decided to take some random procedural...

 
4:02 AM
This should be posted to Code Review instead of Stack Overflow. — rmaddy 1 min ago
Since you seem new to programming, you could start by reading and understanding other implementations of this, such as here: google.com/…, codereview.stackexchange.com/questions/151800/snake-in-javaf‌​xtkruse 12 secs ago
 
4:37 AM
I think bellow link might help you to fulfill you requirement codereview.stackexchange.com/questions/156208/…Mashhad Saleem 25 secs ago
 
5:01 AM
Monking
 
5:21 AM
0
Q: Simple Socket Server in C for Windows

Ángel BarriosI have taken the code from a tutorial of Microsoft webpage. Of course, the example is for illustration only but I wanted to organize it and make it clear in order to understand it a little more. Here the link: https://docs.microsoft.com/en-us/windows/desktop/winsock/complete-server-code It almo...

 
5:39 AM
0
Q: Automating the solution of pairs of polynomial inequalities as a bound

Kristada673Let's consider the following pair of quadratic inequalities: $$x^2+x \geq a$$ and $$x^2-x < a$$ The solution of the first inequality is $$x \geq \frac{-1+ \sqrt{1+4a}}{2}$$ or $$x \geq \frac{-1- \sqrt{1+4a}}{2}$$. Now, the first one is always going to be larger than the second one, as $$\s...

 
 
1 hour later…
6:51 AM
Monking
 
0
Q: Simple ring/circular buffer c++ class V4

HexSo as the title states, this is my 4th revision of this class. Here is the previous post if needed. I'm hoping someone experienced with things such as noexcept, [[nodiscard]], etc can go over the uses in the class below any make sure I'm on the right track? Further more, I've attempted to imple...

 
 
2 hours later…
8:27 AM
0
Q: Python program for Word Search II

JustinThis is a Leetcode problem - Given a 2D board and a list of words from the dictionary, find all words in the board. Each word must be constructed from letters of a sequentially adjacent cell, where "adjacent" cells are those horizontally or vertically neighboring. The same letter ...

 
9:17 AM
What do you mean by a "better way"? More performant, more concise? Your question is kinda subjective right now. Also, as your code works as intended, it would have been better to post it on codereview.stackexchange.com instead (too late for that now). — Georgy just now
 
9:56 AM
It is a threading bug, an extremely unhealthy one. Painting must only ever occur on the program's main thread. The stack trace is normal but what you can't see is that another thread is also busy painting. Odds to see this crash while testing is very low, if you ever noticed the program deadlocking then that's also caused by this bug. Hard to set a breakpoint, this occurs in framework code. A code review is warranted, look at the places where you start a thread. — Hans Passant 39 secs ago
 
1
Q: Python program to remove invalid parentheses

JustinThis is a Leetcode problem - Remove the minimum number of invalid parentheses in order to make the input string valid. Return all possible results. Note - The input string may contain letters other than the parentheses ( and ). def remove_invalid_parentheses(s): removed...

 
10:20 AM
0
Q: Return number of paths to an exit in matrix maze

PakussMy task is to check if we can get from Starting Position to exit(there can be multiple exits) and to display amount of steps of shortest path. S-Starting postion O-Walkable space X-Wall (can't walk through it) W-Exit I managed to get above part to work but theres still 1 more thing to do, I ...

 
10:45 AM
possible answer invalidation by Minkizz on question by Minkizz: codereview.stackexchange.com/posts/220943/revisions
 
10:58 AM
@Duga Nah, that's ok.
 
11:16 AM
0
Q: 2048 game in Python 3

Oliver BakI wrote this 2048 game using Python 3 and pygame a few weeks ago. Since I'm getting into CS this summer, I would like to get some review on how I can improve my code in generel. Any tips and improvements are welcome, and highly appreciated. The code is found below: import pygame import random ...

 
11:33 AM
Code Review is focused on improving working code, so you might get better answers from there. — vonPryz 39 secs ago
 
11:54 AM
0
Q: How to speed up Collections.sort in java8

Thuriya ThwinI am implementing Least Constraining values of CSP. private List<Object> applyLeastConstrainingValueHeuristic(Variable var, CSP csp) { List<Pair<Object, Integer>> pairs = new ArrayList<Pair<Object, Integer>>(); for (Object valu...

 
12:38 PM
If your code works as intended and you want to get a code review (and possible suggestions on a better algorithm), it's better if you post it on codereview.stackexchange.com instead. Another option would be to post your question on cs.stackexchange.com as it's better suited for questions about algorithms. If you do post it elsewhere, please, remove this copy of the question. (I'm not saying that your question is off-topic but just on those websites you will probably get better feedback) — Georgy 19 mins ago
possible answer invalidation by JosefZ on question by JosefZ: codereview.stackexchange.com/posts/221082/revisions
@LightnessRacesinOrbit I'm working on it, but the problem here is that it breaks. I'll put the code in code review once it is working. Thanks for the feedback. Could you please elaborate more on the abstracting all that substringing? — WooWapDaBug 10 mins ago
Welcome to Stack Overflow! I think you're better off with this question on Code Review. You don't have a real programming question, but rather you're asking for reviews and feedback. — iBug 3 mins ago
 
12:50 PM
@Duga thats ok. Juast adding code to make the question on-topic
 
0
Q: Yandex Programming Contest: Alarms

maksadbekI've tried to solve this challenge about 4 hours during the contest, but all my attempts exceeded the time limit. I tried to solve it with min-heap, but can't pass all the tests. How it can be solved within given time and space requirements ? Problem statement Programmer Alexey likes to ...

 
1:13 PM
0
Q: Generating a list (or a string) with random elements

Martin BuchmannDuring implementation and testing of different small hobby projects I often reach the point where I need (at least I like it more) some random data beyond the usual foo-bar strings or lists. Random here does not mean really mathematical random data but just something that looks random to humans. ...

 
1:26 PM
Ages ago I created this post on CodeReviews, but this will help you. Do refer — Rajesh 24 secs ago
 
1:39 PM
@rolfl why weren't the comments just moved to the chat but the question locked at the same time? I've never seen such an action before. I can understand doing this after repeated lengthy chats but locking it instantly without a warning is highly questionable.
@rolfl it'd be great if you could unlock it again - now, I cannot even post a self-answer with an updated code. How about other reviewers? Are they allowed to post answers? Locking the entire question just for a couple of comments is an entirely new standard on CR.
 
2:01 PM
It also has the inconvenient of building useless lists (py2) or range (py3) objects and doing a totally inefficient sequential lookup. This would not pass a code review or merge request here, definitly. — bruno desthuilliers 32 secs ago
There is a place dedicated for code reviews: codereview.stackexchange.com — Darjan Bogdan 58 secs ago
 
0
Q: Questions should not be locked when off-topic comments are moved to chat for the first time

t3chb0tI my opinion, it's to early to lock a question when moving off-topic comments to the chat for the first time. It's understandable when it repeats two or three times... and it certainly did in the past (that I'm pretty sure did not end with locking) but the first time should definitely leave the ...

 
0
Q: Slice an Array Without Using .Slice() Method - Why Are StartIdx and EndIdx Not Their Original Inputs?

HappyHands31The original question is here: https://codepen.io/FullstackAcademy/pen/aYNpBe?editors=0010 You'll have to click on the "Readme" tab to get the instructions, but the idea is to return a "slice" of an array without using the .slice() method. This code is working: function mySlice(originalArra...

0
Q: allow type only whitelisted product codes

KLDesignsIm figuring out how to make it universal for different type of product codes. "CODE" is whitelist of product codes what is allowed to type in textarea so you cant type random codes or random texts. "reg" is end of product code like how many manifactured products have made.. but its static 6 dig...

 
2:32 PM
0
Q: Solution to Kickstart's Wiggle Walk

Eugene YarmashI'm trying to optimize my solution to Wiggle Walk for Kickstart's round 1C. Here's my current solution: def main(): T = int(input()) # the number of test cases for case in range(1, T+1): N, R, C, r, c = map(int, input().split()) instructions = input() # string of N, S,...

 
posted on May 27, 2019 by CommitStrip

2
 
2:52 PM
The Code Review task is logically a sub-task of the main task (a sub-task of a task). So it is already a sub-task. We can't create a sub-task for a sub-task, right? — embedc 41 secs ago
 
0
Q: Python program to print all permutations of a string in lexicographic order using recursion

JustinAn assignment at school required me to print all permutations of a string in lexicographic or dictionary order. Here is my solution to the task - from math import factorial def print_permutations_lexicographic_order(s): seq = list(s) for _ in range(factorial(len(seq))): print...

 
3:51 PM
0
Q: Simple collection type with two iterators (only 60 lines of code)

wozarAs part of the practice, I created minimalist linked list named SimpleList which can be iterated in two different ways: one element after another or by every second element. Because I'm beginner I would really appreciate your opinion about my solution. Is it correct? What should I change? ...

 
Monking
 
4:11 PM
1
Q: Target number sum finder

system123456This is a Target number solution finder which I made with tkinter and is where the user enters a number they want and enters 4 other numbers to find the sum to make the number they want. This is a screenshot on what the GUI looks like: This is the code for the project: from tkinter import Tk,...

 
4:45 PM
possible answer invalidation by Justin on question by Justin: codereview.stackexchange.com/posts/221122/revisions
 
1
Q: Python Function to get numbers around another number

Myzel394I made a function to get a list with numbers around another number. Example: I want to get in a range of 2 numbers around 4. This will return: [2, 6] import sys def get_numbers_around(number: int, min_num: int = None, max_num: int = None, range: int = 2, double_range: bool = True) -> list: ...

 
5:08 PM
Consider asking on Code ReviewJeppe 49 secs ago
 
0
Q: Node.js "race condition" when deleting array content

sivan shaniThe question is essentially about the asynchronous behavior of Node.js: The following code snippets summarize the structure of one of the functions of a working Node.js based back-end application. myArray = []; myArray = populateMyArray(); doSomethingWithMyArray(); myArray = []; First myArr...

 
Consider asking on Code Review - It looks like you want to create 101 random arrays and count the occurrences of each. Is that correct? — Jeppe 52 secs ago
 
5:50 PM
2
Q: Python 3 simple external sort with heapq

RomainL.I've implemented a minimal external sort of text file using heapq python module. On the few tests I did it seems to works well, but I would like to have some advice to have a cleaner and faster code. I do not know much of good practices and I want to learn (May wish to go from academics to indus...

 
possible answer invalidation by walter nuñez on question by walter nuñez: codereview.stackexchange.com/posts/220670/revisions
 
6:01 PM
@RMunroe I know exactly how high the sky is. I can see it. My sight underwater though...
@Duga Oh, wow.
Rolled back.
@Duga Adds context, although it's a bit iffy since it's in response to an answer.
 
6:25 PM
@Mast I'm interested in your change to my answer. "You don't need all three" - IIRC they don't have many overlaps in tools they provide.
 
@Peilonrayz Either would be a good start. Starting with all 3 would be overwhelming. So I thought I adjusted it to what you had in mind.
 
@Mast Wasn't this broken before? That means edit to make the code on-topic are valid?
 
If I was wrong, feel free to rollback if you liked the original better.
@bruglesco Depends on how wrong it was and whether OP knew it.
 
0
Q: Python simple type checking decorator

user8426627How about this minimal type- checking decorator (with @, kinda annotations, ) to make type checking of a method while debugging like : def typecheck(*tuples, **kwtuples): def decorator(func): def function_wrapper(*args, **kwargs): #print('tuples : ' , tuples) #print('kwtupl...

 
@Mast Makes sense, I was more confused by the edit comment. The difference between "and" and "or" there is AFAIK negligible. But I may be wrong on that
 
6:38 PM
@Mast Yeah I am not really sure. hence the equivocating question marks
 
It's not clear what you want exactly. Is your code giving wrong answers? Tell us what's wrong. Saying “any way that I can improve my algorithm” is rather broad. Does it do what you want? Perhaps you could submit it to Code Reviews. — Dour High Arch just now
 
6:57 PM
@bruglesco I think the edits do more harm than good and OP should try again with a new question. But given his record...
 
@Mast In retrospect I agree. After all the question wasn't closed so it is not as if the edits are done to save topicallity.
 
0
Q: A cleaning robot that cleans dirty cells in a 5x5 grid using the least number of moves possible

BenWornesI have been working my way through the Artificial Intelligence course on https://www.hackerrank.com but I got stuck on a challenge called BotClean. The challenge is to get a cleaning robot to each dirty cell in a 5 by 5 grid, in the least number of moves possible. It doesn't matter how long the ...

0
Q: Enhancing search using Fuzzy Logic in NodeJS

Sudarshana DayanandaBrief Description: In my NodeJS Application, I have a model called User. User.js module.exports = { attributes: { name: { type: 'string' } } }; My application consists users searching functionality using name attribute. For that I used find users using exact name as below...

0
Q: What is the faster alternative to SIMILAR TO in PostgreSQL?

Nina I am using PostgreSQL 11.0 and I wrote a plpgsql function to test if a word is contained within a phrase. This function is called several times within another function to extract some words from a paragraph. The execution of the calling function is slow, and i suspect it is because of this functi...

0
Q: Fun crypto problem: Exploiting a vulnerable encryption scheme with Python

tjt263I came across a question asked here and here on the Crypto Stack Exchange site, and decided to analyze it as a kind of case study. To demonstrate the concept, I wrote a short python script depicting the proposed encryption scheme. It's mostly list comprehensions or generator expressions and bitwi...

 
8:03 PM
@CaptainObvious Is deleting a question and then posting it again allowed?
@CaptainObvious And this
 
8:30 PM
0
Q: Trying to Show a Message inside a container On hover of specific pictures via JQuery

Ryan StoneTrying to build a tool-tip style Information box, I know that I could use the generic hover state tool tips which are available from Css & html but I'm looking to create something a bit more dynamic. Their are multiple images this is the code for just one Icon The Code I have written so far is ...

 
@Peilonrayz seems like they didn't get an answer within 15 days and they decided to delete and reask.
AFAIK there's no explicit SE-wide rule against such behaviour.
I know that it's highly frowned upon in SO
 
@Vogel612 Ah ok, it didn't seem right to me. Thank you
 
If they keep deleting their own questions and reasking them, they will hit an automatic question ban
 
Ah yes, in that case I'll just ignore it when it happens. The system will deal with it anyway
 
for whatever it's worth, the new question was answered just now :D
 
8:42 PM
Yeah I just noticed that XD
 
This sounds like a better fit for codereview.stackexchange.comDavid just now
 
9:06 PM
The second question is for Stack Overflow Code Review. — Evg 38 secs ago
 
0
Q: Finding Longest Word in a String - Need a more efficient solution

DreamVision2017Challenge: Return the length of the longest word in the provided sentence. I've made a solution that works but it is kinda bad since the time complexity is O(nlogn) and it involves mutation. function findLongestWordLength(str) { let strSplit = str.split(" "); let wordLengthArray = []; for...

 
9:23 PM
If this is working code then it may be a better fit for codereview.stackexchange.comDavid 10 secs ago
 
0
Q: Spring boot - where to put a single utility method for a model?

SMCI'm working on a blog rest api and I would like to get some opinions on where to place the logic for a single operation to filter posts. I have Category and Post in the model package. A category has a list of posts and a post has a single category. The wrinkle is that posts can be hidden, mea...

 
9:45 PM
possible answer invalidation by Jamal on question by Naphstor: codereview.stackexchange.com/posts/220941/revisions
 
@Duga Looks fine
 
10:30 PM
0
Q: Responsibility of caller or callee for knowing array shape

ErebusI'm integrating my app with a payment gateway, and have the following code which returns an array to populate the transaction info: function populate_transaction_info($data) { extract($this->extract_model_data($data)); // set to empty array to ensure run-able code $transaction_info = []; ...

 
10:50 PM
-1
Q: What would be the best way to accomplish this If-else check?

Deepak SinghI have an if-else statement in a php class, which works perfectly. I want to know if there could be an any better or faster way to accomplish this? if( !empty($value_1) && empty($value_2)){ function_1(){ } } elseif( !empty($value_2) && empty($value_1) ){ function_2(){ } } elseif (!empty(...

 
11:03 PM
Which I more attribute to design with compatibility than good. For performance critical code I'd prefer if operator[] were changed and at_unsafe() were added. That aside: There is a second aspect: std::array carries the type around in its declaration making it readily available (both in code review and for lookup), the pointer returned by data() loses that. — johannes 52 secs ago
 
11:50 PM
-2
Q: Extraction of decimal number from a string

kutkutThe output of below code is (13, 2, 12) What should I do if I want to extract the 0.2 from the string? What should I add? #include <stdlib.h> #include<string.h> int main() { int val; char c []="13.2x+12y"; char*p=c; while(*p){ if( isdigit(*p)||((*p=='-'||*p=='+') &&...

 

« first day (2214 days earlier)      last day (1807 days later) »