« first day (2393 days earlier)      last day (21 days later) » 

12:00 AM
RELOAD! There are 6259 unanswered questions (90.0822% answered)
Q: How do I implement these graph functions below to make sure I'm covering all test cases with the given constraints?

Shrenik RajI've recently gotten into discrete math and graphs. I'm trying to implement a few functions related to graphs and I'm not sure if I'm covering every test case that could possibly be thrown at my program. Input constraints: Graph is connected Graph is undirected Graph is unweighted Graph has ...

12:43 AM
@Malachi I haven't left yet...
Q: Sum all the two-digit numbers from an array

HeathcliffI saw this exercise in Codility some days ago and for some reason I couldn't get 100% in it. Some tests failed and I couldn't see which ones. As far as I know, this should work. You are given an array of N (N in [0, 100000]) integers between -2147483648 and 2147483647. You have to return the sum...

1:16 AM
@410_Gone thank God! I was about to Cry!
all y'all leaving is sad
any of you guys play Minecraft?
I'll occasionally (maybe four-five times a month) boot up an old Minecraft Alpha save that I've been playing on for a few years and have a little bit of fun.
@EthanBierlein do you play with Redstone creations at all? (I am leading into a question)
maybe I will hold off on this line of questioning......
I have vague memories from years ago of building a semi-functioning 8-bit ALU with redstone and hacking command-blocks into a declarative programming language (of sorts), but not much anymore.
It's somewhat difficult for me to wrap my mind around it sometimes. Never did too great with anything electronics-related... heh.
@EthanBierlein I know what you mean, sometimes it is tricky to understand some of the tutorials.
especially with the degree of simplicity in the pieces that you need to create a simple of if then else or a switch or filters, and then you have to learn another set of mechanics as well because stuff doesn't always behave the way you would think normally
@Malachi I did a lot of that in Minecraft
And pistons
1:33 AM
@Malachi Most definitely. It's a great example of emergent behavior in games though; a bunch of simple mechanisms interacting together to produce mightily complex contraptions.
maybe I will post more of my Minecraft to Twitter....
anyway, seriously....TTGH...lol later everyone
1:50 AM
This is really asking for a code review. But I'm curious what "works"? The foreach in GetCar is pointless as you continuously assign to car and return the last one; why loop at all? — ChiefTwoPencils 40 secs ago
looks at stars Yep, @Malachi is here.
2:05 AM
Share all the relevant code(includes custom classes like ReviewDTO and methods like ConvertToViewModel()) if you need a community code review or debug support. — Xueli Chen 30 secs ago
2 hours later…
4:09 AM
This should probably be migrated to codereview.stackexchange.comaquinas 38 secs ago
Q: Browser-editable SVG diagrams using JS & SVG.js

Atcrank[This is my first question to Code Review and it might be a bit too much.] I want to give users the means to draw a simple diagram in the browser, and because it is partly a self-education project about the low-level entities and relationships in the browser, I haven't used one of the bigger f...

4:39 AM
Consider posting on codereview.stackexchange.com since your code appears to be working fine — Mad Physicist 24 secs ago
4:56 AM
Q: Shifting bits in assembly (nasm)

the_endianI wrote a function which takes a byte and shifts the bits around. That is, there shall be the same number of 1 bits and 0 bits in the output but the bits will be shifted in position: global _main default rel section .text _main: ; Given 1 byte, shift the positions of the bits in the form 7...

5:17 AM
Q: Finding sequential recurrences in a list of numbers

Thiago LuizI have a list like this: seq = [-2,3-2,3,5,3,7,1,4,-5,1,4,-5,1,4,-5] I want to get all the sequential recurrences and where it happens, I feel the way I'm doing its too brute force and in reality I want this for several lists of len 300ish dic = {} for p1 in range(len(seq)): for p2 in ran...

5:35 AM
When you have code that works and you believe it can be made to work better, you should ask at Code Review. In general Stack Overflow is better at fixing code and Code Review is better at improving code. — user4581301 33 secs ago
Q: Summation Over Lines in a File (Rust - Advent of Code 2018 Day 1)

1ijkPreface: I am learning Rust through the Advent of Code The task is to read lines from a file, parse each as an integer, then provide a summation of all the numbers. My solution looks like this: use std::fs::File; use std::io::{self, prelude::*, BufReader}; fn main() -> io::Result<()> { let...

6:20 AM
possible answer invalidation by Thiago Luiz on question by Thiago Luiz: codereview.stackexchange.com/posts/232772/revisions
6:40 AM
possible answer invalidation by R4nc1d, Community on question by R4nc1d: codereview.stackexchange.com/posts/232699/revisions
7:10 AM
What's the design of your models? Show the relevant code if you need a community code review or debug support. — Xueli Chen 21 secs ago
Q: My custom implementation of MATLAB's imdilate

Saad SawashI have been assigned to implement the morphological dilation operation without using MATLAB's imdilate, and I came up with the following solution: % ------------------------------------------------------------------------- % -> Morphological Operations % -> Image Dilation % ---------------------...

Q: Tic Tac Toe with different level AI

SrivathsI've already created an almost similar code in python here: Tic-Tac-Toe with changeable board size (Part 1) Here's the code in C++. As I'm still a beginner in C++, I don't know many of the STL functions or such. Please help me on improving the code #include <bits/stdc++.h> #include <string.h> #...

7:31 AM
What's the design and the relationships logic of your models? The problem seems to be on the key ChoiceId you connect to Table PlotChoices and Table BookLinks . Show the relevant code if you need a community code review or debug support. — Xueli Chen 18 secs ago
Regarding Code Review - yes that is the best site to get general feedback on complete working code. It isn't off-topic here though, as long as the code is localized enough. — Lundin 46 secs ago
I'm voting to close this question as off-topic because its's code review request. — Sourav Ghosh 38 secs ago
Q: recursive function improvement

VishalI am creating routes from an array of menuItems. I have written a recursive function, which works fine but I think the code can be improved. So, I need you guys to review my code and suggest me some changes. Here is the code: const accumulator = []; const renderRoutes = (_menuItems) => { _men...

7:48 AM
Ok I'm gonna answer this just for the sake of it. It is more suitable for codereview.stackexchange.com but it is not off-topic here!Lundin just now
Stack Overflow is for specific programming problems - this may be more appropriate over on CodeReview.SE (do read the rules over there first though, I'm not active there to be sure it is suitable). — BoBTFish 45 secs ago
Q: ValueAnimator for IOS - Did I butcher it up?

Boober BunzI am trying to make an IOS tool similar to Android's ValueAnimator... more or less This is useful for situations where you simply want a value to "animate" over time, but rather than necessarily attaching that value to some view property, it is available to use as you wish. Imagine applying it ...

@BoBTFish thanks will check the codereview site out, but I needed specific C++ advice on this one and this seems to be a good place for it. Yes all in the same currency and all in the same precision — Sid 46 secs ago
1 hour later…
9:05 AM
In general ,it should not get this error. The most likely reason for this is your project itself. Such problems are not easy to reproduce.Could you share the project or a demo that can reproduce the issue if you want a community code review or debug support? — Xueli Chen 1 min ago
9:20 AM
Q: Should we improve the code to be reviewed in an edit?

L. F.I noticed this suggest edit: This suggested edit does two things: Replace using namespace std;, which is considered bad practice in C++, with std::. Fix a divide-by-zero bug by special-casing zero. This edit was rejected by πάντα ῥεῖ, and then approved by Mathieu Guindon ♦. I disagree wit...

Q: Redundant query?

NorgulI have the following query: SELECT * FROM "topic" WHERE "is_deleted" = 0 AND "topic_type" IN ('19','15','27','13','1','7','25','4','6','3','2','9','26','23','24','22') AND "id" IN (SELECT "record_id" FROM "notes" WHERE "record_id" IN (select "id" FROM "topic" ...

9:44 AM
Q: C# trading indicators calculation

Daniil KolesnichenkoI have a stream of stock prices and I want to design indicators calculation for them. Indicator can be imagined as an additional chart displayed next to the prices chart. More specifically, it is usually a function that takes current price and some prices berfore that and applies some function to...

10:04 AM
Q: Repetitive code for an event listener

mertjeSo I'm using the event emitter as some sort of an event bus(If I'm allowed to call it that). The problem I've stumbled upon is that my listeners might want different data than another listener. Since I don't want to add too much and listener specific information where things get emitted. I'm usi...

10:17 AM
I can see why that would cause a storage-based issue. However, it seems like madness to constantly decompress the same content over and over again for a lack of storage. You may find code review a better place to get an idea of the best way to achieve your aim? — Martin 27 secs ago
10:45 AM
Q: Time provider library using type safe handler - like chrono CPP

ranifischI'm trying to develop a c++ library that provide two kind of times: UTC time(self explainitory) System time(time since the system has went on) I have looked into the chrono library in cpp and im trying to implement my library, more of the same like chrono. the implementation is very complicat...

1 hour later…
11:46 AM
Q: Timer for scheduling tasks in C++11

NutCrackerI have made a simple Timer class used for scheduling tasks. While defining the interface, I have followed the interface of a java.util.Timer class. Class is being written by using only C++11. timer.hpp #include <atomic> #include <chrono> #include <future> #include <utility> template<typename ...

Q: C++ Solution for ProjectEuler Problem #5

golaWhat is the smallest positive number that is evenly divisible by all of the numbers from 1 to 20? Is there a more elegant solution in C++? #include <iostream> using namespace std; int main(){ long long num = 1; int divMin = 1; int divMax = 20; int tempDivMax = divMax; whi...

12:27 PM
This will work but it looks suspicious as hell. I would not let it pass a code review. Why not let the caller call B.create()? (factory) — One Man Monkey Squad 49 secs ago
Q: Make foreach with nested-if's more compact and readable

shhhCode works fine. What I'm looking for is C# syntax to make the foreach loop below more elegant, compact and readable. The foreach with the multiple if's takes up too much space and looks too ugly. I'm thinking LINQ syntax maybe? (Assume all the variables are strings. The final version will have ...

Q: N queens problem in python

SrivathsI just tried to create a program for the N queens problem. def print_board() -> None: """ Prints the board """ length = 3 * (SIZE - 1) + SIZE + 4 print() print('-' * length) for row in board: print('| ' + ' | '.join(row) + ' |') print('-' * length) pr...

@410_Gone You never know, I might have snuck in using a disguise ^^
1:04 PM
@Kaz @410_Gone And I might have done it as well.
Q: Update Google Sheet with Python

LinuBelow is a code to update a google sheet using the database values.The script is working fine but it is rather slow because of the sleep function which i have to put because of the "Quota exceeding error" below.If i remove the sleep time it would work much faster but after a certain number of row...

@skratchi.at Shady argument! I pointed you at a site full of C++ experts who recommend not to use it. codereview.stackexchange.comMartin York 13 secs ago
2:09 PM
Q: Neural network is not giving the expected output after training in Python

VASIHMy neural network is not giving the expected output after training in Python. Is there any error in the code? Is there any way to reduce the mean squared error (MSE)? I tried to train (Run the program) the network repeatedly but it is not learning, instead it is giving the same MSE and output. ...

2:25 PM
@pacmaninbw we talked about Neural Network questions a while back
I don't remember the guts of the conversation, but there was something about a certain degree of error always being present or something along those lines
I want to say that @200_success was involved in those conversations, maybe I can pull 200_success back into chat for a minute or 2???
Q: Expand compressed string range-

RamaMSay you have two strings :- exp->aaccbb comp-> aa2bb The above example will return true as there are 2 chars between aa and bb. I have written the code snippet. Just wondering if there is a better way do solve this problem and if I am missing any edge cases. Follow up -> either side can have co...

I think it was something like a percentage issue where it has to meet a certain threshold of passed tests or something like that
@Malachi Did I do something wrong in the review queue on that neural net question?
@pacmaninbw no, I don't think so.
Neural Network is a different kind of code, so we have to treat the working/not working thing a little differently. but I believe that you are correct
@Malachi I don't think it was me you were having the discussion with.
2:33 PM
@Malachi Watch your pronouns. =)
@200_success how about "youngin"?
I think this might be reminiscent of what I was thinking --> chat.stackexchange.com/transcript/message/33294739#33294739
now I just doubled up on the proper noun facepalm
@pacmaninbw they already received what looks like an extensive answer on SO
@Malachi It is the correct type of question for SO.
had they made changes to the code before posting, I would be more hesitant to close it
this makes me second guess the "doesn't work" -->
it's similar to what they expected, it would be nice if there were more data points though.
I can't see what the bottom is or what the graph is titled though
> I tried to train (Run the program) the network repeatedly but it is not learning, instead it is giving the same MSE and output.
it's not working, it's definitive
2:48 PM
Bloody ml questions
@Mast Can you fix that question with duct tape?
In fact, there are plenty of this conjecture review there. For example: codereview.stackexchange.com/questions/213357/…ihavenoidea 43 secs ago
If you always have exactly three files your solution is perfectly fine. You should put that in an answer and mark it accepted. Then, if you want more style advice or such you should go ask for that at Code Review. — Roope 25 secs ago
3:10 PM
possible answer invalidation by Groger on question by Groger: codereview.stackexchange.com/posts/232736/revisions
@Duga thats ok, question on hold
@Heslacher there is an answer on that question though
Doesn't matter IMO. Answers to off-topic questions are off-topic as well.
agreed, it is kind of a grey area to me. maybe we could suggest that the answer poster revisits their answer.
hey @Vogel612!
having a score of -2 should trigger that action itself
3:23 PM
This is a post for codereview.stackexchange.com since it is not a question. — sleepToken 43 secs ago
I'm voting to close this question as off-topic because it should be posted to codereview.stackexchange.comBenoit 28 secs ago
Thanks. I didn't know about the code review website. Thks — Edson Martins 10 secs ago
Q: Link list working

Dark deboI wrote this singly linked list and it worked fine,Now can anyone review my code.I want to do some more clean my delete and add function.And some abstraction. #include<stdlib.h> typedef struct q_9 { int data; struct q_9 *link; }*node; node head=NULL; node tail=NULL; node newnode(int x);...

Q: Make Haskell Imperative

arrynI am trying to make it possible to run a program like this in Haskell: factorial :: Integer -> Integer factorial n = def $ do result <- var 1 i <- var n while i (>0) $ do result *= i i -= lit 1 return result Below is my program. At this point, I cannot understand why ...

3:50 PM
Q: Decrypt multiple 10Mb files with defined password

Cliff BurtonOne operation of my Android project is to decrypt one file (chosen in a set of ~30 files for pagination1) of ~10 Mb each and I do this with the following: fun InputStream.cipherDecryptWithSessionPwd(password: String): String { var payloadArray: List<Byte>? = this.readBytes().toList() var...

Q: Safe static_cast in C++ in a codebase

bad_localityHow would you review this way of implementing a std::static_cast template <typename ToType, typename FromType> ToType safe_static_cast( const FromType &from ) { assert( from <= std::numeric_limits<ToType>::max() ); assert( from >= std::numeric_limits<ToType>::min() ); return static...

Q: large text extraction and parsing in python

kevbuntuI have the following code for reading a json file into pandas dataframe and parsing the fields, but it is too slow for large files. Is there a way to make the code more efficient? def extract_text(json_train_path): with open(json_train_path, 'r') as json_file: train = {'example_i...

4:11 PM
Q: Lex scheme in Rust

Simon BrahanI'm writing a scheme interpreter in rust, and the first step is the parser. I've finished the lexer, and would like to see what people think of it before I go any further. #[derive(Debug, PartialEq)] enum LexToken { Num(f64), Symbol(String), String(String), LeftBracket, Right...

Code reviews are more suitable here: codereview.stackexchange.comCDJB just now
I've downvoted and voted to close as "Needs more focus". SO questions should have a specific problem to address. General code reviews should be on codereview.stackexchange.com. — skrrgwasme 58 secs ago
This is not a "code-rating" site. If you want help solving a specific problem ("How to ignore strings"), then please provide a minimal reproducible example including sample input and how you want the output to look. If you want help improving the working parts of your code, you could post to Code ReviewG. Anderson 43 secs ago
4:31 PM
Q: 3 sum algorithm - Trying

Edson MartinsRecently I started looking and refreshing about algorithms and decided to try to do the 3 sum algorithm. I did the code below: public static int[] tripletSum(int[] A, int sum) { HashMap<Integer, Boolean> data = new HashMap<>(); for (int i = 0; i < A.length; i++) { data.put(A[i...

Q: How to check all moves in Tic-Tac-Toe in Python3

piteerI have a string "x-xoxoo--" which meeans a satge in a game Tic-Tac-Toe x|-|x o|x|o o|-|- I know how to check if that a stage is valid: def check(play): x=0 o=0 for item in paly: if item=="x": x=x+1 if item=="o": o=o+1 return (fabs(x-o)<=...

Q: Assign values to answers from a questionnaire, input into a formula and calculate score: can I make this Python code more concise?

Nathan WestI apologize in advance if this is the wrong place to ask for this type of help but I was wondering if anyone could make any suggestions to how I could write the following more concisely and reduce the number of IF statements? Is it at all possible to simultaneously assign values to variables and ...

@Malachi Doing a bit of searching between my phonology and Latin classes, found an implementation of a redstone Turing machine in Minecraft: reddit.com/r/Minecraft/comments/5js5je/…
@EthanBierlein WHAT!?
Might have to try something like this myself over the weekend...
implemented in survival even
That would be doubly intense, doing the resource gathering in survival and actually constructing such a complex contraption.
I think the OP in question probably implemented it in creative.
4:38 PM
@EthanBierlein this is the OP --> reddit.com/r/Minecraft/comments/5js5je/… but that graphic doesn't look like survival to me
Yeah, definitely not survival.
I am not at that level of Minecraftery yet
Nor am I. Might take a crack at an ALU again; last night's conversation seems to have somewhat re-ignited my interest in redstone creations.
What I'm curious about regarding this post specifically, is whether the OP implemented their Turing machine with a memory bank for a set of tape- and pointer-manipulation commands (Brainfuck in Minecraft???) or if there are just a set of controls that one can activate one at a time.
Hah, nevermind; seems I struggle to read things in the morning:
> This is my best design so far. It has 16 states and use 2 symbols ( 0 and 1 ). Very easy to set a program with just flipping levers at the top. Currently runs reliable on 16 redstone ticks clock ( 1.6 seconds per step ).
@EthanBierlein me too
@Heslacher I agree, answers to off-topic questions are off-topic. They happen because we can't close questions fast enough and the users that post those answers don't know any better.
4:49 PM
[proudly greeting the hotel manager at the door] "Did I do aa good job?"
The reopen queue tasks have come in waves... I did 9 in the past day, and before that there weren't any for a couple days, and prior to that there was a six day gap...
Well, TTG to my next class; I'll catch y'all later.
5:06 PM
@CaptainObvious I need some wiser heads to tell me if this question is LCC or not. There isn't a lot here.
This question may be better suited for Code Review, if the code works but just needs optimized. — BigBen 10 secs ago
"How do I improve this working code?" is generally off-topic here. Consider our sister site Code Review. — Charles Duffy 47 secs ago
If your code works, then this question may be better suited to codereview.stackexchange.comcybernetic.nomad 22 secs ago
5:30 PM
@SᴀᴍOnᴇᴌᴀ Usually, yes.
Q: Merge duplicated cells in bulk per each column VBA

ArtNeed to merge data per column if records in the first column are the same. I wrote a VBA code and it works but it works very slow as it executes "merge" function per each row no matter if consequent cells are the same or different. Sub DuplicateValues() 'Declare All Variables: Dim myCell As R...

@pacmaninbw Meh. Definitely not a great question, but it's answered now.
Odd answer too, but close enough.
6:13 PM
Q: Difference between two nested lists in python

deimosOkay so I am needing to find differences between to nested lists. I set the lists from CSV files, they look like so: list1 = [{"UniqueID": '123', "Name": "John Smith", "Date": "11/22/2019"}, {"UniqueID": '124', "Name": "Bob Smith", "Date": "11/22/2019"}, {"UniqueID": '125', "Na...

6:33 PM
Q: Meh performance RSA algorithm (Python 3)

PuzuruSo I have this code, but I want to improve its performance so it could handle 6 symbol length words without waiting 2 years for it to finish running. Right now it can handle 2 symbols (3 if you're willing to wait 5 minutes) I know my problem is in the cyphering/decyphering (calculating ct and dt...

7:10 PM
Q: Vote to Reopen Prompt Bug

LinnyIf any help, I'm using Google Chrome Version 78.0.3904.108 (Official Build) (64-bit) on a Mac. When I nominate a question to be reopened, the prompt window is still present after I click "Reopen". The queue moves on to the next question, but the prompt is still there. Clicking "Reopen" again sho...

@Feeds I noticed that as well
7:35 PM
Q: Timsort implementation in Python

SrivathsI wanted to implement a Timsort in python. Here's what I've come up with: from typing import List RUN = 32 def insertionSort(unsorted: List[int], left: int, right: int) -> None: """ Sorts the array using insertion sort """ for i in range(left + 1, right + 1): temp = unsorted[...

Q: Python - Add as newest ID to SQLite Database

K-Doeat our company we use an SQLite Database to manage our Drawing ID's (CAD Drawings). The code is written in Python and i need to update it. I think the code i have has some problems, but i am quite unsure so i hope to get feedback and critics from you all! 1. What does my code: It saves the ID,...

Q: Convert char array to number

NickFollowing is a take to convert non terminated char array (e.g. buffer, string_view etc) into signed or unsigned integer. #include <limits> #include <type_traits> #include <string_view> #include <utility> namespace impl{ template<typename T> T x10(T a){ return a * 10; } ...

7:55 PM
Q: new to react/javascript - would like feedback on patterns used for accessing geolocation API

ferguzzhere is how i am using my location component: <LocationContainer opts={{timeout: 5000}}> {(address, error) => { if (error) { return <div>Could not determine address (why...? <span style={{color: 'red'}}>{error.message}</span>)</div> } else if (address) { ...

codereview.meta.stackexchange.com/questions/5777/… ... in general, if your code is working, improvement requests go to CodeReview; StackOverflow is to repair failing code. — Prune 7 secs ago
8:15 PM
Q: Thread Safe Bank Transaction: Deposit, Withdrawal, Check Balance and Transfer in Java

JimI have made a class which is a thread-safe implementation supporting Deposit, Withdrawal, Check Balance Querying and Transferring of money. I have a class Account: public class Account { private int balance; private String address; private String userId; final ReentrantReadWriteL...

8:36 PM
Q: want to get a better performance in read / write data structure + byte

fastmen111SO I am writing the program to compress the image Huffman encoding, I need to write the data structure and the byte file. After that, I have to read/decode it. I realize that my read and write is very slow. I think in writetree I need to write either width, height, compress bits and the tree dat...

8:56 PM
Q: NodeJS find a way for synchronizing my asynchronous code

SzelekI have a simple code, but I receiving (sometimes) wrong results, it's because of NodeJS async, I know. So to solve the issue of async for NodeJS I used the require("async") library. But now my simple code got quite complex, and i'm still receiving a wrong result sometimes. then i figure that I...

9:24 PM
You'll probably have better luck at codereview.stackexchange.comasawyer just now
2 hours later…
11:39 PM
Q: Optimizing code that needs to run through a lot of different numbers for Project Euler

joelanbanks3I have been working on Project Euler problem number 12. I have code that will get me the right answer, however it takes too long. I know the code works because I have tested it multiple times with numbers that are smaller and take much less time to iterate through. I first wrote essentially the s...


« first day (2393 days earlier)      last day (21 days later) »