« first day (2239 days earlier)      last day (388 days later) » 

12:00 AM
RELOAD! There are 6124 unanswered questions (89.8468% answered)
12:20 AM
This question appears to be off-topic because it is a code review request. This might be better suited to the Code Review Stack Exchange site. Before posting there be sure to read their FAQ to ensure that your question meets their guidelines. In its current form it does not meet their requirements. — John Conde 29 secs ago
1 hour later…
1:22 AM
I think this might do better on code review. — gmds just now
1 hour later…
2:30 AM
Q: finding prime no. using Sieve of Eratosthenes

its_vinayaklink of promble i am try to solve this projecteuler question 7 but getting wrong answer. correct answer in "104743" but i am getting "104759" please help to find whats wrong . //using Sieve of Eratosthenes #include <bits/stdc++.h> using namespace std; vector<int> ans{}; int cprime(long l...

1 hour later…
3:44 AM
Thanks @gmds I'll try it on code review and delete here soon. — Jesse Reza Khorasanee 59 secs ago
Q: Python - Efficiently re-sample time series in python

Jesse Reza KhorasaneeI'm trying to create an efficient function for re-sampling timeseries data. Assumption: Both sets of timeseries data have the same start and end time. (I do this in a separate step.) Resample function (ineffecient) import numpy as np def resample(desired_time_sequence, data_sequence): dow...

4:17 AM
You may post the code in here for review codereview.stackexchange.comAdam 32 secs ago
5:12 AM
Q: Is my brute force / naive solution of the given Hacker Rank problem correct?

Deepak KumarJust help me with the brute force approach only. Problem Name: Game of Two Stacks Problem Link Note: I have converted vector to stack for twoStacks() function. Problem Description: Alexa has two stacks of non-negative integers, stack A and stack B where index 0 denotes the top of the ...

5:52 AM
Q: How to maintain data abstraction in the explained scenario?

Hari KrishnanI have two classes class A and class B. There is an API function aFun() inside class A which should be used by class B. class B is recursively calling itself to create some kind of child objects. All these recursively created class B objects need to be saved inside class A as a list As of no...

Q: Automate the Boring Stuff: Character Picture Grid

coderHow to improve this code? def print_rotate_grid(a_grid): rows = len(grid) cols = len(grid[0]) for col in range(cols): for row in range(rows): print(a_grid[row][col], end = '') print('\n') if __name__ == '__main__': grid = [['.', '.', '.', '.', ...

6:31 AM
10 this is not a code review service. 2) That's you who has to tell us if you have problems in your code. Does it work? 3) If your code has some problems - you have to tell what exactly is a problem with it. — Vladyslav Matviienko 7 secs ago
Q: Details/Dropdown toggler

darcherI haven't had a great deal of time to build components using some of the more fun items that have come since ES6+ started hitting the scene, but figured I'd share a dropdown snippet I created and get some feedback on the javascript approach. Still not a huge fan of the "one-liner" look but went f...

i know this is not code review service but i think if a someone is learning something and has implemented something so this is the best platform to review that code because professional are here to help us. (according to me) — Rohit Singh 43 secs ago
This is definitely not the "best platform" to review that code. If your code works, go to codereview.stackexchange.com — Sweeper 42 secs ago
I don't know about codereview.stackexchange.com. thank you @sweeper — Rohit Singh 53 secs ago
Q: Bitwise operation to check if any one of multiple specified flags are set

acraig5075Can this bitwise if conditional be expressed more succinctly in order to read better? int Func(UINT section) { // section should be one of these three to continue, else return. if (!(section & (TVHT_ONITEMICON | TVHT_ONITEMLABEL | TVHT_ONITEMINDENT))) return 0; // ... do som...

Q: State machine translates text into executable python code [v2]

TVSuchtyA few days ago I started writing my own compiler-like program which has the goal to compile plain text into executable python code. After I let my first version review here, I made huge changes to the overall code and added the possibility of adding rectangles. I try to add all the suggested impr...

8:12 AM
Q: Shopping cart with Ajax

adamanynI build a cart for an ecommerce website, and I want to know if I did well. I want to record the changes in the DB and display the information from the DB to the customer. To be sure that what he sees is the good information. I use an ajax request and JSON to do so. Please give me your comments....

If you are asking about reviewing your code , this question belongs to codereview.stackexchange.comDevesh Kumar Singh 48 secs ago
8:32 AM
Q: Is there a better way to check auth before executing the directive?

kalleI have made a BladeServiceProvider so I can make some custom blade directives. But, all of them required the user to be signed in. The application throws an error if the directive is executed without checking the auth()->check() before the actual check I want to do. This is the admin directive i...

9:12 AM
Q: Django: Better way to combine these two queries?

Joey CoderI combine two query sets (available_tickets_by_event and sold_tickets_by_event. My end goal is to combine it in ticket_stats_by_event. I wonder if there is a more efficient way to combine these`? print(available_tickets_by_event) [{'pk': 4, 'organizer': 1, 'available_tickets': 30}, {'pk': 6, 'o...

9:33 AM
Q: Getting redis sentinel info in Rust

Roger LipscombeI've cobbled together some Rust code to display Redis master/slave information. As a Rust newbie, I'd appreciate some review feedback. use std::collections::HashMap; fn main() { let url = "redis://sentinel.service.consul:26379"; let client = redis::Client::open(url).unwrap(); let co...

9:53 AM
Q: Repetitive then/catch method on Javascript

dkn15I have this function and looks ugly because there are a lot of "catch" doing the same. Any idea how to make it better? saveUser: function(){ let user_id = this.$route.params.user_id; let payload = this.user; updateUser(user_id, payload).then(response => { updateOrCreateAddre...

10:03 AM
Working code in need of optimization belongs to Code Review, I suggest you post your question there. — Vincent G just now
10:33 AM
Q: Proper code-to-comment ratio

SyncrossusI was wondering what the general wisdom was on comment-to-code ratio. What constitutes too much / too little? Of course that depends on the code itself, but I'm just trying to get a ballpark figure. Consider this python script for creating github-style identicons: """ This module contains a sim...

Q: Combining columns into one column for csv file using python

user6667312I have csv file which consist of 500 rows which contain text values. The number of columns vary for each row. Now want to read all columns and combine them into single column. How to do it? I have written code as follow: import csv newFile = open('T.csv', 'w') #file for converting all data to si...

I'm voting to close this question as off-topic because this community isn't intended for reviews of working code (maybe, just maybe: codereview.stackexchange.com would be a better place for your request) — GhostCat 13 secs ago
11:33 AM
Q: Add events on same class multiple times

Emilio ConteI'm not sure how to title this post as I'm a bit confuse here. My code updates a field in line. It's done in two separate functions. It works well but I wonder if it's possible to handle it in only one function? Here is the HTML code. The form is shown on hover only and value is updated on chang...

11:57 AM
@CaptainObvious @Mast so true in all programming languages.
@pacmaninbw Reminded me of this answer about code coverage.
12:20 PM
possible answer invalidation by brad999 on question by brad999: codereview.stackexchange.com/posts/222660/revisions
@Duga suggested by the sole answerer in a comment
@Peilonrayz Thanks for pointing that out!
1:26 PM
To me, this looks good. However, as stated @treyBake this question is off-topic. It may fit better the code review site of the networkCid 17 secs ago
Sorry I wasn't aware there was another section just for code review, I'll delete the post but thank you for the feedback. — Eric Garcia just now
Q: generalize 2 simple methods

dganIs there any I could I generalize following 2 methods? there is a lot of common code in them.. The point is to either return a valid FixedLenLine object (first method parseLine, or to return a list of errors (second method validateLine). public interface IFixedLenLineParser<T extends IFixedLenLine>

1:43 PM
Note: If you have working code and are looking for improvements, try Code Review. — Slaw 22 secs ago
1:53 PM
Just in case you aren't aware, if you have working code and are looking for ways to improve it, then Code Review may (read their guidelines) be a better fit. — Slaw 56 secs ago
2:14 PM
Q: Component based design in embedded systems

CuriousEngineeringI currently saw a company using this kind of software design which i have never seen before: The system is based on each class in the system is inheriting a class called Component which looks something like this: class Component { public: Component(char *Name, char *ID); char *Get...

Since the code is asserted to work (modulo possible locking issues), the question would probably be better suited for Code Review SE. As posed, it's a bit too broad for SO. — John Bollinger 11 secs ago
2:32 PM
Gotta feel kind of bad for nation-state hackers who spend years implanting and cultivating some hardware exploit, only to discover the entire target database is already exposed to anyone with a web browser.
Q: Complexity of code to find a pattern in a string

katya sorokPlease, help me to understand the complexity of this code. I have tried to calculate and did not find it to be close to \$\mathcal{O}(mn)\$ but rather closer to \$\mathcal{O}(m+n)\$. I have compared it to KMP (Knuth-Morris-Pratt string matching) and realized that in the case of str='cccccc' and p...

Q: Refactoring code for custom date component prompt

anny123I have created a date component (working GIF at the bottom). There isn't a problem with the working of the code but rather the code I wrote seems messy and something hard for any other person to comprehend. Note: Please look at the GIF below. Also, Ignore the styling This is what I am doing:...

2:55 PM
possible answer invalidation by shannon on question by shannon: codereview.stackexchange.com/posts/222463/revisions
@CaptainObvious Off-topic.
I'm voting to close this question as off-topic because it belongs to Code Review. Notice that both here and there you will need to post the code itself in the question, not just a link to it. — Bergi 50 secs ago
3:15 PM
Q: FormArray total of each formgroup via RxJS

Andrew AllenStackblitz - https://stackblitz.com/edit/angular-plp4rb-formarray-total-prs9ay I'm new to RxJS observables. I've created a form array where the total for a line is quantity * rate. Via valueChanges for the line form group I set the total via the calcTotal method. On form changes I emit all th...

Q: Policemen catch thieves - Python3

emadboctorHere's code for policemen catch thieves written in Python3, I need feedback/suggestions. The problem statement: Given an array of size n that has the following specifications: Each element in the array contains either a policeman or a thief. Each policeman can catch only one thief. A policeman ca...

Happy Friday
@Duga its okay- changes were rolled back by OP, which we considered doing Tuesday... see context from Tuesday's chat
3:35 PM
Q: Java Streams: Grouping to a Map

LandeiI was refactoring an ugly piece of code, and I'm unsure if there is a better way of doing this, and whether I'm overdoing it with streams. Basically I get a bunch of columns, which should be grouped by the name of the sheet they belong to, so that I can return a map of sheet names to a set of c...

3:56 PM
Q: Detecting deadlocks in thread safe linked list

shadi helfI recently got a homework to implement a thread safe singly linked list which locks elements in hand over hand method which means that there is a single lock for every element in the list.I implemented all the functions and tested them without having to deal with problematic thread situations an...

4:16 PM
Q: Throttling promise execution (api requests, etc)

erikdstockI was working on a client for a remote api and realized that i needed to throttle requests to < 4/second. I wrote a simple typescript class to do it and wanted to solicit code review- it basically should accept a () => Promise and return a Promise that resolves once executed by the queue. My pro...

4:36 PM
Q: try for yourself. what do you think?

Mikey Akamihe Story-based adventure program I coded by myself (forgive the length). It took a long time but it was fun. This includes loading times, changes in relationships, relationship levels, storyline and possible outcomes, user input with xbox-style options, function calling and more. import time ...

4:57 PM
Q: Mutex lock benchmark

tuketI'm trying to measure how many CPU cycles a mutex lock takes. Can you find any problems in my mutext lock benchmark? #include <iostream> #include <thread> #include <mutex> #include <chrono> #include <string> std::mutex twiceMutex; typedef std::int64_t i64; i64 twice(i64 x) { return 2 * x; ...

1 hour later…
6:25 PM
possible answer invalidation by Nevralgeek on question by Nevralgeek: codereview.stackexchange.com/posts/222664/revisions
@Duga failed attempt to fix code on a trainwreck-ish question
pretty much
7:05 PM
This question is borderline closed and is on HNQ at the moment, should something be done about this? — IEatBagels 3 hours ago
@Mast ~whistles
@Mast You saw this, right? Removed from Hot Network Questions by rolfl♦ 3 hours ago ... maybe you are just pointing out the "should something be done about this"...
"Suggested Edits" seems to be broken for me today. The notification icon for this queue glows red hot all the time, but whenever I click on it, there is nothing to be found.
7:23 PM
"This is all working through brute force programming. Is there a more efficient way to do this?" seems more like a question for codereview.stackexchange.comRufus L 29 secs ago
7:39 PM
Q: Convert an in-ordered and post-ordered array to a BST

EMLI am working on a Daily Coding Challenge to print the BST if given an in-ordered and post-ordered array. Below is my code in JavaScript ES6. Please can you review it. This is my first fully-featured JS program so I am very unaware of standard syntax or shortcuts in JS (The code has now been f...

Q: Printing to Console all properties of an Object using System.Reflection

DelfinoBelow I have setup an extension method that takes any object, cycles through its properties, and prints each out to a Console window in the format Name: Value. public static string PropertiesToString<T>(this T obj, int tabs = 0) where T : class { int initTabs = tabs; string result = stri...

The quality of questions is really low today :-s
It's friday... what did you expect? ;-)
That might also be the reason you experience problems with the site ;-)
@AlexV might be that you reviewed everything in the queue, but the items in the queue have not been cleared yet.
soo ... blame caching, I guess ..
I'm experiencing the same thing aws with "suggested edits" and "close votes"
7:52 PM
soo ... there's 11 items in the close queue, 5 in the suggested edit queue, 3 first posts and 2 reopen items
usually I don't touch the queues, because I can't vote :/
All the below-3k-queues show 0 for me.
@AlexV that is ... confusing..
@Vogel612 I can confirm the close and reopen votes. They are there.
but you have 10 completed reviews in the first posts queue, which means you have reviewed half of the posts that even were in there all day
in other words, take a break! :p
7:58 PM
Oh it's not that I'm terribly eager to do more reviews, I'm just a little bit obsessed with notifications/alerts that I cannot clear...
welcome to the club
IIRC we were one of the sites that was more vocal about the review indicator changes back then
poke @dfhwze I kicked this question out of the close queue
Just because a text adventure doesn't need more than a paragraph of explanation for the code that doesn't mean it lacks context
My comment is removed, what did I say? :)
8:13 PM
sth like "sounds interesting, but off-topic. lacks context" IIRC
even less than the actual close reason and a request to edit the title which was obsolete
note that the close reason "Lacks Concrete Context" is specificially about the way the code is written and not the "non-code" explanation we expect from questions
@Vogel612 To be fair: I started to edit the question title before his comment was posted, but finished it after the comment was posted.
Yes the Title was edited by Alex after my comment. The title bothered me the most.
It's clear how the code is used, it's not hypothetical, stub or obfuscated code nor asking about generic best practices
the LCC close-reason doesn't really apply
8:16 PM
@AlexV nothing terribly wrong with the comment aside from it being obsolete
see the recent comment .. =D
@dfhwze that is a significantly better comment. Note that it is also actionable
It clearly tells the user what they can do to improve the question :)
You are tough on me :) I did state in my comment to change the title ...
"Also provide a better title" doesn't help the user...
It just tells them you consider their title bad. It doesn't outline what's a good title :)
Ok I get your point ! :p
8:20 PM
Hey guys, long time no see.
Yaaaaaay :)
Nice to see you around these parts :)
I must say, I am disappointed at the general lack of stars ^^
I did work though... ;-)
8:22 PM
@Vogel612 Totally. Some things never change.
well, what can I say, Malachi has been promoted at work and it's been comparatively quiet in here
@Vogel612 should we tell him "Happy Friday"?
I've been hanging out in VBA Rubberducking and the first monitor (and Uni is starting to actually take a nontrivial contingent of my time nowadays)
@Vogel612 I can empathise. I've gone through a new job title pretty much every year, my company keeps growing crazy fast, and I decided to do a maths degree on top. Doesn't leave a lot of spare time these days.
8:26 PM
oh cool, a Maths degree.
Specializing into financial maths? Or something more general?
@Vogel612 Maths & Statistics. Might do a Masters in something financial, but I've no idea what I'll be doing in 2 years when I finish so I'll cross that bridge later.
@Kaz My former bachelor thesis supervisor sent me a chapter from his soon-to-be-finished phd thesis which had some math I did for the thesis and working as a student. I could not remember any of it :D
So, what have all of you been up to?
fighting zombies
8:33 PM
~hangs head in shame
I went to Ukraine in March for a week, to meet the developers of the company that bought mine and conduct some interviews
@SᴀᴍOnᴇᴌᴀ Sounds interesting. Good acquisition or bad acquisition?
@Kaz mostly good, although the other 3 developers and 1 tester I had been working with were let go... they did find jobs shortly after but we recently hired another developer in this office so its a shame not more of them could have been kept on
That sucks :(

We just finished buying a company where everyone who wanted to stay on was able to. The next one we're hoping to do is unfortunately not going to be so amicable.
C'est la vie
8:51 PM
So, what's new with CR? Judging by the continued existence of zombies, we haven't managed to kill the night king yet but are we currently winning or losing that war?
it's a bit of a stalemate now after we dropped to just below 90% answered
I'm glad to see I'm not the only person who (eventually) gets around to completing things that I put on my #Todo list years ago:
Q: Code Review questions must contain code

Shog9As requested by Kaz and approved by the voters here on meta, questions asked on Code Review that do not contain code are now blocked. I've configured this initially as a three-line minimum (or three separate bits of code-formatted text, or any combination of the two). This may be too much; it ma...

yea. Funnily enough a few weeks later there was a bug with that filter
Oct 4 '18 at 18:16, by Mast
Everything can be broken.
@SᴀᴍOnᴇᴌᴀ Corollary: If it doesn't seem to be broken, that just means you're not testing hard enough.
9:04 PM
9:19 PM
General requests for "how can I improve this working code" are too broad for SO, but they are the bread and butter of Code Review SE. — John Bollinger 34 secs ago
Q: Argument handling for subclasses that use both `__init__` and `__new__`

Brandon KuczenskiI am making a subclass of a well-established python class: pendulum.Period, which overrides both __new__ and __init__ (it does this because it is subclassing the python builtin class timedelta, which uses __new__). In my case, I want my class to handle a wider range of arguments than the super...

10:06 PM
@Kaz if only the wizard was available for new CR posts... :/
@SᴀᴍOnᴇᴌᴀ about that ...
if you want to write up a meta post why that would be really useful for CR, I can pass that along to the CMs that are involved with getting the wizard generalized
10:23 PM
@Vogel612 okay cool
btw, I tried to put Mast onto that quite a while ago. Even if the post is really great it might just share the fate of Kaz's feature request :D
would I have to actually ask a question (e.g. wouldn't it be nice to have a wizard like the SO wizard?) or just request it be added to the site?
@Kaz Mostly working and busy with personal things. I'm part way through Head First C# but haven't taken time to code lately
@SᴀᴍOnᴇᴌᴀ Oh I heard about that on the SO podcast a while back, that's very nice! I wonder how many people are actually using it
@Phrancis low-rep users have no other choice for the first few questions AFAIK
10:50 PM
@Vogel612 That's a great move. I wonder what kind of impact it has had
You might want to poke Julia Silge under one of her Data Science posts about that
she has a monthly not-quite-blogpost thing on MSO now
11:12 PM
at her? for her? So confusing
probably at?
after all it's " @ juliasilge"
Q: Matplotlib embedded in tkinter

Bruno VermeulenInvestigating how to use tkinter controls with buttons and sliders and to combine these with matplotlib, I have come to the following code. Suggestions for improvements and tips are most welcome. Ultimate goal is to make some apps showing behavior of pendulums, springs and other physical systems ...


« first day (2239 days earlier)      last day (388 days later) »