« first day (2327 days earlier)      last day (36 days later) » 

12:00 AM
RELOAD! There are 6160 unanswered questions (90.0613% answered)
If you post on CR please read the on-topic page before doing so. — Sᴀᴍ Onᴇᴌᴀ 56 secs ago
12:13 AM
Q: I need to make the values unmodifiable after the 10th point added to the SPECIAL stats?

PeaceI need the values to be unmodifiable after the 10th value has been placed on one of the Special Stats. Until the person subtracts from the value using "2)Modify Value" . Are their multiple if statements I need to create in each one of the cases? Is there a simpler solution I am not seeing? Once t...

12:29 AM
@Mast Belated OHAI! How's it going?
Q: Suggestions for my Java coding challenge code? - "Surgical Strikes"

charlesgrubeI'm new to StackExchange and this section. I'm coming here looking for suggestions on how I can improve my conventions, structure, and etc. I've just recently completed this programming "challenge" called surgical strikes. Github: 1 Link to challenge information: 2 Here's my code if you can't a...

Q: Algorithm for competing cells of 0s and 1s. Can it be made faster?

LuxuryModeI'm working on a practice algorithm problem, stated as follows: There are eight houses represented as cells. Each day, the houses compete with adjacent ones. 1 represents an "active" house and 0 represents an "inactive" house. If the neighbors on both sides of a given house are either both activ...

1:13 AM
Q: Swift: extract string with regex and range

dengAproIn Swift, I have a string like this http://mnc-hdqp.oss-cn-shanghai.aliyuncs.com/user%2Fheat%2Fdefault.jpg?Signature=2BI%2BauSvy&Expires=1568682491&OSSAccessKeyId=LTAIQ8Lif1HHVkXd Need to extract 2BI%2BauSvy, the value of key Signature here is code: regex match, then use range to subtract...

1:45 AM
possible answer invalidation by LuxuryMode on question by LuxuryMode: codereview.stackexchange.com/posts/229152/revisions
Q: Computational Chemistry - is there a bug with my code?

ANZGC FlyingFalconHi Code Review Stack Exchange! I had originally posted this on Chemistry StackExchange, but they suggested I try here instead. Anyways: I was checking my RHF code and found a couple of bugs (which include getting incorrect eigenvalues and eigenvectors amongst other things). I suspect it's eith...

2 hours later…
4:16 AM
Q: "Block a website" script with vanilla JavaScript

JohnDoeaI use this working tested script (and with maybe a bit old by mean of EcmaScript syntax), which Marat Tanalin helped to develop, which uses to personally block access to a group of 1 or more websites with vanilla JavaScript: I use it to block some news websites which I feel an addiction-like beha...

4:34 AM
@Duga rolled back
Q: Polling an SFTP server to list files in a directory

trivial_tasksWhen is it better to instantiate the sftp client globally vs inside a function as shown below? What considerations favor one method over the other? For a long running service that polls indefinitely, would it better to instantiate globally so I don't need to instantiate a new client on each run?...

4:50 AM
possible answer invalidation by 200_success on question by LuxuryMode: codereview.stackexchange.com/posts/229152/revisions
1 hour later…
6:12 AM
Are you looking for a review or help with finding an error? The former is better suited at codereview.stackexchange.com. If it's about finding a bug, please specify, what exactly is not working. — Pavel Smirnov 10 secs ago
6:25 AM
6:38 AM
Here is a question on Code Review that may be of interest to you: Find a palindrome using Ruby. — Jörg W Mittag 16 secs ago
7:08 AM
Its better to ask this question on codereview.stackexchange.comMasoud Keshavarz 42 secs ago
Another disguised "how to pass data between classes/forms" question. Your best bet to get "best practices" answer is to post current solution and to ask for codereview, if you don't have code yet, well, that's about software engineering. — Sinatr 21 secs ago
possible answer invalidation by dengApro on question by dengApro: codereview.stackexchange.com/posts/229153/revisions
7:37 AM
Q: Double precision variance

19172281I have a motion profile generator which calculates a position 1000/sec. During the decelerating portion of the move, the following calculation is used: pos = pos - accel_2 + vel; vel = vel - accel; // Where all variables are doubles, pos is calculated position, accel is acceleration, vel is s...

7:54 AM
@PavelSmirnov - It is pretty clear (to me) that the OP is asking for help debugging his code. Which means this question would be a "close with prejudice" candidate on codereview. — Stephen C 20 secs ago
If you have a working code and is looking for specific review, you might want to check codereview.stackexchange.comAndreas 48 secs ago
Q: What is the Idiomatic way to handle error in go when populating a struct

user3755946Here is a simplified version of my code struct and the function that populates it. type Customer struct { Id string DiscountCode int } func GetCustomer() (*Customer, error) { err := errors.New("") p := &Customer{} p.Id, err = GetCustomerId() if err != nil { ...

8:17 AM
Q: How to make input numbers equal with minimum cost

Arshia RProblem description from an Iranian online course Uncle put his coins on N lines of equal height. One night he noticed that the coin layout had collapsed. After investigating he found out that a 5-year-old boy had moved his coins from column to column. Uncle wants to bring columns to the...

8:34 AM
@SᴀᴍOnᴇᴌᴀ Only within so many minutes. As RO, I can clear stars anytime.
It's a mostly useless feature, but helps against some trolls.

Roxy'ProI'm using entity framework to get data from a db, I'm also using linq to group the data and some stuffs linke that, and I've just wrote a method which is grouping data by it's status: var data = query.GroupBy(x => x.ProductStatusId) .Select(Product => new ProductsDTO { ...

@Phrancis Good, good. Still hacking at things I know nothing about, trying to automate things that aren't willing to be automated.
Was working with fractals the other day, made a Tri Force fractal. Reminded me of you somehow...
@Duga Your call @MartinR
Looks fine to me.
@Mast I think that's fine, the code for a missing method was added. It does not invalidate the answer.
8:54 AM
@CaptainObvious 2nd question from that user with code that doesn't work. Can we all agree not to answer question which do not fit the scope of the site? The previous question couldn't be fixed because it received an answer.
@MartinR Yea, didn't see a problem with it.
This may be more appropriate for Code ReviewJim Eisenberg 20 secs ago
Q: PHP, HTML dynamically create table and merge cells of class schedules

RaymondI have an array from my query result, i want to display the values in a table dynamically since every result may vary depends on the schedule of the student. The table has a fixed header of MONDAY-SATURDAY on and 7:00 AM-5:00 PM on the left side. my array is quite long so i just attached here th...

9:37 AM
Q: sql like operator %string% taking too much time on very few records

Mohd Maazi have a small database with 7 tables with 6 reference table i need to do search on the base of key word so i write a procedure as follows ALTER PROCEDURE [dbo].[GetByKeyWord] @Keyword NVARCHAR(60) = '', @PageNumber BIGINT = 1, ...

Hi. I asked a question and got a response suggesting improvements, but I am not sure of what to do next. Should I edit the question with the suggestions for getting a second pass (making the answer obsolete)? Should I just acknowledge by commenting on what I like in the answer, but without editing the question?
Just that I don't know what's the usual process here
@Jim making the answer obsolete is not the way to go. If you want to do a follow-up on your proposed changes, posting a second question (maybe linking back to the first) is the way to go
depending on how old your initial question was, maybe wait a bit to see if more reviews come in
@JAD Okay thanks, it's from yesterday so I'll wait a bit and not edit it
@Jim As soon as answers have come in, rule of thumb is not to edit your question. If you want a second pass, ask a second question. That's a follow-up question.
Q: For an iterative review, is it okay to edit my own question to include revised code?

JoelIs it okay to edit the question to include the improved code? I would like to do so for the following reasons: To share the improved code with others To show the answering persons that I take their feedback seriously To make sure that I understood (and implement) the feedback in the right mann...

@JAD Might be a good read for you as well.
@Mast Okay, as I understand it I can just edit it for improving / fixing things without changing its overall structure. Thanks
9:53 AM
@Jim No.
> If you incorporate advice from one or more answers, but are still unsure that the code is as good as it should be, then post a new question with your revised code.
> If you want to show everyone how you improved your code, but don't want to ask another question, then post an answer to your own question.
Keep in mind that self-answers should still be reviews, not code dumps.
> If you are unwilling to write a sufficient explanation to constitute a good Code Review answer, then it would be best to refrain from posting your follow-up on Code Review at all.
@Mast I'm aware of that rule. Maybe I should've worded my response a bit more strongly
> You must not edit the code in the question, as that would violate the question-and-answer nature of this site.
Q: Java refactoring - reduce cognitive complexity by extracting private methods

Amedee Van GasseThis is code, written by our dev team, and SonarQube tells me that the Cognitive Compexity is too high: 21, and the current (default, out of the box) metric limit is 15. I've had a go at reducing the complexity and would love some feedback. Original code /** * Gets the encrypted payload of thi...

@Mast Okay, I'd better finish reading the question you linked before saying anything else haha
10:15 AM
It's crystal clear now, thanks for the link. I see that I should have been able to find it myself
No problem, that's what this chat is for.
Feel free to ping me anytime you got questions.
10:37 AM
Q: How to clean and optimize this C# TcpListener code

LoLo2207So I have this code that I've been passed by a teammate and he copied from somewhere (maybe adapted from here https://docs.microsoft.com/es-es/dotnet/api/system.net.sockets.tcplistener?view=netframework-4.8). The full code has some synchronous methods for sending some data through senderSocket, ...

Q: Weapon class firing logic in JavaScript

Tiago MarinhoI'm making a program to compare Borderlands 3 weapon damage over time in a graphic. There's still some work to be done, like implementing elemental damage, but I'd like to know if I'm doing a good job for now regarding the main firing logic. My biggest concerns are: General readability. Weapon...

@Mast for that question no it doesn't. I wanted to say by putting the code what I have done. if it gave me the correct output I wouldn't ask the question. — Arshia R 1 min ago
@Mast I got your point. putting code like this is pointless. I have to share something that works or needs improvement. Thanks for your advice. — Arshia R 6 mins ago
There we go.
Looks like I've missed a lot of fun in the last 20 minutes.
11:37 AM
I'm working to a set of standards set out from a stakeholder, however, there is some flexibility, so it could be that setting the release to trigger from a pull request would be acceptable. One of the requirements is that the pipeline has completed before the code review takes place, so if the pipeline fails the code reviewer doesn't even need to look at it. Is this feasible, do you think? And if so are there any tutorials for achieving this you could recommend? Thanks — Dicky Moore 46 secs ago
11:58 AM
You described a problem - to include the arrival date in the map parameters - and that you had written code to manage it. So what exactly is your problem? This is NOT a validation service; perhaps you should consider posting to Code Review. — Tedinoz 22 secs ago
12:15 PM
@bob: while one hopes that point-free suddenly happens, I just did my umpteenth code review pointing out that callback(x => foo(x)) is better written callback(foo). So it doesn't necessarily happen to all developers, even when it should! — Scott Sauyet 11 secs ago
Q: Schelling's model of Segregation Python implementation with Geopandas (Repost)

Kartikeya SharmaThis is the repost of the following question as suggested by @HoboProber . Again, if you don't know what is Schelling's model of segregation, you can read it here. The Schelling model of segregation is an agent-based model that illustrates how individual tendencies regarding neighbors can l...

12:36 PM
Code review suggested I try here, so I figured I'd give this site a shot. — ANZGC FlyingFalcon 28 secs ago
@dfhwze can you elaborate on why you think there is a possible race condition in https://codereview.stackexchange.com/a/229136/209618 ?
I think that once run() is called, the thread is alive, and interrupting it even before super.run() is called will mark it as interrupted
1:07 PM
Hi Jim
There is a chance that in between releaseing the lock and calling super.run() interrupt is called from a different thread, setting the interrupt flag
@Jim it is possible in this case that super.interrupt(); gets called before super.run()
can this be a problem?
Q: Is a changeset reviewable?

Toby SpeightI'm looking at Java refactoring - reduce cognitive complexity by extracting private methods (note: the question has been edited since I wrote this. At that time, I was looking at Revision 4) and in response to my comment that it's lacking description of the code's purpose, the author replied: ...

1:24 PM
@dfhwze it's not a problem, if super.interrupt() is called before super.run() the thread is marked as interrupted as you said, and this will be reflected by isInterrupted() or interrupted() when checked from the Runnable (that is once super.run() started executing)
I just need to make sure that an already interrupted thread entering a wait/block statement immediately throws an interrupted exception
@dfhwze On side note:
- I agree with the fact that changing the spec is probably not a good idea
- I don't see why requestRun() is required, adding requestInterrupt() and overriding run() does not change the spec
- double-checked locking is for improving performance, I don't need that here so I'll just stick with the lock
- I agree with all the rest, thanks
@Jim ok good to have cleared that part about the possible race condition, which seems not to be an issue afterall
@pacmaninbw you added the comparative-review tag, but OP states: Please do not review the original code. It works, it does exactly what it is intended to do.
You think that tag should be included?
@dfhwze Yes, the OP is asking whether the code was improved by his edit or not.
@pacmaninbw ah well spotted
@dfhwze Are you planning on changing your answer?
@pacmaninbw I don't think I am
It's concise and I've addressed what I wanted to
1:38 PM
Not sure if anyone is looking for a new keyboard, but I just bought an ErgoDox EZ and I am starting to really like it. Takes some getting used-to, but once you warm up to it the keyboard is really pleasant to use.
@dfhwze No, I don't think you should either.
@DerKommissar looks expensive :O
@JAD It was $354 for the whole deal I bought (keyboard, tent kit, wrist wrests).
1:59 PM
This question needs a stake driven through it's heart codereview.stackexchange.com/questions/229164/…
@pacmaninbw yes it's both lacking context, and not working as intended
@dfhwze I beg to disagree about the context, there is a page text and a picture for context. There really is no code.
@DerKommissar I think that's more than I've ever spent on keyboards and mice in total :O
@pacmaninbw You should talk to Peilonrayz about context vs unclear what you are asking. Context is about insufficient code, and the other about insufficient description.
UWYA and LC are hard to distinguish in general around here
Q: What is "lacks concrete context" exactly?

PeilonrayzContext Recently I've seen an increase in people voting for LCC when I don't agree this is the correct reason. These all seem to be getting LCC VTC because they're lacking description. https://codereview.stackexchange.com/q/222407 Looping through this list takes time Displaying a paginated lis...

@JAD Wait a while, mice die after a few years, keyboards start having contact problems. It is more than I have spent for a single mouse keyboard combo.
@dfhwze I think we can agree to disagree.
2:16 PM
@pacmaninbw Yeah this topic has rendered the most disagreements I've seen so far around here :)
@dfhwze I have posted my own concerns about LCC in Meta.
got link?
Q: How do we train our self-moderators?

pacmaninbwOver the past few months I have found myself voting to Leave Open many questions that someone else voted to close as not concrete. A case in point is this question. While this question could have been improved in a number of ways the code was complete and I felt there was almost enough text to ex...

Oh yeah that one, I even answered that :p
@dfhwze :)
It's why you got the comment on the question
I'll be back, gotta fix bugs and implement a late feature request.
Q: How to differentiate web fonts font-face font-weights?

cbdev420What do you guys think: OPTION #1 (same font-face name and change font-weight) @font-face { font-family: ProximaNova; src: url('/fonts/ProximaNova-Regular.ttf'); font-weight: normal; // THIS IS NORMAL font-style: normal; } @font-face { font-family: ProximaNova; src: url('/fonts/Pro...

Q: Does google consider html comments in inside JSON Schema to be a violation of the "schema must match content" rule?

Felipe ValdesI currently have a small jobs website, which generates a json schema for google to publish it in google jobs: http://qkids.co/online-jobs/Illinois/Chicago/60629/127090/64 this url produces a JSON Schema that looks like this: <script type="application/ld+json">{ "@context" : "http://schema.org/...

Q: Splitting up a custom hook

dan-klassonI've got this custom hook that is suffering from a bad case of violation of SRI. This is a simple 5x5 board where a car can move around. Together with a server side check if the move is valid or not. I'm thinking of moving directions to a useReducer hook. But problem is that I'm calling that u...

Q: Leaflet search plugin fetched by $GetJSON function

Mariusz KrukarI have been fighting with running the leaflet plugin with $GetJSON function My code looks like this: var url1 = "Peterborough.json"; var job; // layer 1 $.getJSON(url1, function(data) { job = L.geoJson(data, { pointToLayer: function(feature, latlng) { return L.circle...

possible answer invalidation by Alex on question by Alex: codereview.stackexchange.com/posts/201661/revisions
3:13 PM
@JAD I don't disagree. For me, the ergonomics of it help my back and whatnot hurt less...
Q: Extract, filter and match three letters from the given arguments and predict the name

catufCase 1: rank1_naming This function takes two arguments list_proteins_pattern_available best_match_protein_name Objective: Extract the three letter pattern from the both arguments. Match the pattern and keep only the matched items. Extract the numbers from list_proteins_pattern_available a...

I needed to change #define NEW new ((char*)__FILE__, __LINE__, (char*)__FUNCTION__) and as pointed out to me on CodeReview size_t is defined in multiple headers so std::size_t should be more preferable. — Danilo 43 secs ago
3:54 PM
You may be interested in codereview.stackexchange.com because right now your question looks broad for SO. To make it concrete you can explain what issues have you already noticed. — sanyash 1 min ago
@Duga fixed misspelling per request in comment, and the existing answer doesn't contain the misspelled name
4:18 PM
Q: Java For Arraylist

user209698Good morning guys, I need help. I search the Internet for a way to read two values from the keyboard n and m then save the i values to an Arraylist. Subsequently, I intend to scan the arraylist for some data. Does anyone suggest a snippet of code? ArrayList<Integer> list = new ArrayList<Integer>...

4:38 PM
Q: Basic Pong game using C++ and SFML

AaySquareI am trying to make use of C++ and SFML to make a basic Pong game. So far I have made it so that there are two players who can control the paddle on each side and the ball will bounce off screen and paddles except the left and right sides of screen. My goal is to learn C++'s features such as po...

5:18 PM
Q: Adding a term to Polynomial class, approach with dynamic arrays

AnneI am trying to program a Polynomial class. I am kind of stuck on the coefficient adding. class Polynomial { public: typedef double value_type; typedef std::size_t size_type; static const size_type DEFAULT_CAPACITY = 10; Polynomial(); Polynomial(doubl...

2 hours later…
6:50 PM
it is not clear what your question is -- if you are asking for a code review (which is what it seems like to me) post your question here: codereview.stackexchange.comHogan 56 secs ago
You should check whether your question would be better suited to codereview.stackexchange.com . Here we mainly fix bugs and answer specific questions about code, rather than doing reviews or optimisation of something which otherwise works. — ADyson 39 secs ago
@Hogan If the question is to be asked at Code Review, I recommend adding more context to the question in order not to ping-pong the question. — dfhwze 27 secs ago
Just make sure to be on-topic on Code Review: codereview.stackexchange.com/help/how-to-ask. You might need to include a valid example card number. — dfhwze 52 secs ago
7:12 PM
@Hogan I said it's not directly addressed at you :) don't worry about it. It's a suggestion from me to OP, but I included you only because you suggested the code be posted on Code Review. — dfhwze 58 secs ago
Q: Mini-git class performance issue

JubickI want to build Git class where i can store int values (let's call them files). Number of files that are going to be stored passed to constructor of class with filesCount. I'll need an void Update(int fileNumber, int value) method, int Commit() method that saves current state of files and return...

Actually, on code review, I'd be looking askance at the whole size() construct, whether there are elements in a container that are iterated over, and why the code isn't using range-for. But let's assume that this is for example's sake. — DevSolar 51 secs ago
7:39 PM
Q: Recover a secret string from random triplets

haxorGot this problem from Codewars. There is a secret string which is unknown to you. Given a collection of random triplets from the string, recover the original string. A triplet here is defined as a sequence of three letters such that each letter occurs somewhere before the next in the giv...

Q: Functions using similiar LINQ queries is repeating the code?

PeterI'm using some very similiar LINQ queries. If i want to change one, i have to change the rest of them, yet all three are doing essentially something different. public class LINQDataAccessObject : IDataAccessObject { MyDataContext context; public LINQDataAccessObject(string connectionStr...

Q: Wrap a js function with a fixed this arg

ReedIf I use node.addEventListener('click',Wyg.Editor.nodeClickedEvent); then when node is clicked, nodeClickedEvent has this===node. Since nodeClickedEvent is a static function in a class, I want this to === Wyg.Editor, so I wrote a helper function to simplify it. Helper Function: function fixThis...

1 hour later…
9:22 PM
I'm not aware of any way to block migrations other than making sure everyone in the team knows not to use them, and use regular code reviews. If you're using automated builds / unit tests and something like NDepend or similar for convention/health checks you might consider a custom rule to look for calls to Database.Migrate() or Database.EnsureCreated(). — Steve Py 31 secs ago
9:54 PM
I would reject any code like this I saw in a code review. — chepner 40 secs ago
Q: Leet Speak - Replacing standard letters by special characters and symbols. Getting Undefined as an output

Jojo function translateLeet(str) { let newWord = ''; let leetSpeak = { a: '@', o: '0', e: '3', l: '1', s: '5', t: '7' }; for (let i in str) { newWord += leetSpeak[str[i]]; // trying to replace value in newWord } return newWord; } console.log(translateLeet("Hello")); // ...

10:40 PM
Q: rock paper scissor

vityaI just started to learn C++ and I decided to make a rock paper scissor game. It works very well but I would like to know how could I improve it further. Thank you very much in advance for your help. #include <iostream> #include <string> #include <time.h> int main() { using namespace std;...

11:25 PM
~sigh ... wish me luck for tomorrow

« first day (2327 days earlier)      last day (36 days later) »