« first day (2259 days earlier)      last day (1766 days later) » 

12:00 AM
RELOAD! There are 6240 unanswered questions (89.7277% answered)
 
0
Q: Simple protocol client library

Woodrow BarlowOverview I got rubber-stamped in code review today even though I called out specific concerns about my own code and asked for advice, so I'm turning to this community for advice. Thank you for taking a look! I'm implementing a simple protocol in C. The protocol is composed mostly of fixed-width...

 
12:21 AM
0
Q: std::function alternative with no dependencies

TaylorAn alternative to std::function for when compile time is more important than runtime performance. Doesn't pull in any headers. (#include <functional> pulls in 19k lines of code.) This satisfies my needs, but I'm curious how it could be improved (without adding any dependencies). template<typename

 
@RobertHarvey yes it would be failing my code review with a note saying dont do this again :P — TheGeneral 50 secs ago
 
 
2 hours later…
2:01 AM
0
Q: Functional CSV Parser

tay10rI've been starting to migrate some C++ code from imperative to more of a functional style. I'm new to functional programming so I'm trying to get a sense of how well this code fits into the functional programming paradigm. The purpose of the code is to scan tokens from CSV files, and currently p...

 
 
1 hour later…
3:01 AM
1
Q: Text-Based fighting game with classes - python 3.0

TelekeyI have beagn to practice python after a couple of years and for my first Project, i decided to make a fighting/rpg-like game with different characters. So far, i am only familiar with loops and functions, not classes or OOP. Please give me any feedback on how i could improve my code, through debu...

 
3:21 AM
0
Q: Report time on whole hours

AlgebraReport time at whole hours #!/usr/bin/python3 import time from datetime import datetime from pydub import AudioSegment from pydub.playback import play bell_sound = AudioSegment.from_wav("/home/me/Music/audio/bell.wav") while True: now = datetime.now() # repeats = 1 if now.hour % 3 == ...

 
3:41 AM
0
Q: Optimization Of Code To Auto-Email Past Due Accounts

user2676140I am using this syntax to query a table and return a record set and if the number of times total the customer has been emailed is less than 5, send an email with a canned response. If the number of times emailed is >= 6 then the draft is saved with bold text so the user knows to review this (cas...

 
 
1 hour later…
4:45 AM
@dfhwze edited my questions.
 
@Heslacher I noticed, thanks :) Not sure if it makes sense I also review the updates. I would have the same feedback on all of them (use a lookup table)
 
If you just want general feedback then codereview.stackexchange.com is a better fit — Anthony Kong 41 secs ago
 
btw it was another question I answered where I noticed I was reviewing an older version, not yours =D
 
5:10 AM
possible answer invalidation by 200_success on question by AuXDubz: codereview.stackexchange.com/posts/223807/revisions
 
5:43 AM
2
Q: Reducing using/foreach/using nesting with a helper extension

t3chb0tProblem statement There are sometimes foreach scenarios that require deep nesting due to multiple disposable objects involved that look like this: using(..) { foreach(..) { using(..) { } } } or a real-world example from one of my applications: using (_...

 
 
1 hour later…
6:51 AM
Sorry, this is off-topic here, as this question doesn't deal directly with programming. The question is also a little bit vague and assumes that the code review process by itself is broken everywhere, which isn't true. Perhaps, with a more targeted question, you can try your luck on softwareengineering.se. You might want to look through the similar questions there first, e.g.: softwareengineering.stackexchange.com/q/113593, softwareengineering.stackexchange.com/q/333853default locale 10 secs ago
 
7:03 AM
0
Q: Java program to detect the Java class File Format magic number, in a given file

SenthilDescription: I wrote a Java program that checks whether the content of the given file begins with the Java class File Format magic number 0xCAFEBABE, in big-endian byte order. It prints a success message if: The first 4 bytes match the magic number It prints an error message if: The file ...

 
7:15 AM
possible answer invalidation by adem on question by adem: codereview.stackexchange.com/posts/223899/revisions
Hi, the thing is that I don't know how to test the parser either so I didn't try anything. I can show you the grammar part but it looks like the one from Python (codereview.stackexchange.com/questions/223868/…). Actually, I just need some help to get started on the parser writting. — Jérôme 57 secs ago
 
7:44 AM
-2
Q: How to Keep alive code?

Rajat Kumar SahgalI've a code for merge multiple txt files into a single txt file from click on start button. Now I want to keep this code alive till code stopped by the user. namespace FILEOPNER { public partial class Form1 : Form { public Form1() { InitializeComponent(); ...

 
7:56 AM
@Duga On request by author of single answer.
 
8:12 AM
If the code works, then it is a question for codereview — mplungjan just now
 
8:24 AM
1
Q: Coding Interview — Maximum charterer insertion

styxI would like to know any suggestions about to improve my code and/or get a better approach for this problem solution and your rating of my approach to the problem.(besides removing the if statements where the amount+= 0; I'm aware that it should be there) Description Write a function that, g...

 
This question might be better suited for codereview.stackexchange.com than in here, but check their site guidelines — Andreas 19 secs ago
 
8:44 AM
0
Q: To use TryCatch or If when creating custom exceptions?

Jack TylerI have two versions of a function that performs the same task, however I'm not sure which one to use. Speed is something to take into consideration, but I also want to know what the best practice is. Below is the same function, except one uses an If statement to throw an exception where as the ot...

 
9:24 AM
0
Q: HTTP request method PATCH vs POST when appending document in mongodb array

Prakash PandeyLet's say I have this following structure in my MongoDB database. Collection name: class { "name": "Name of the class", "id": "class-01", "students": [ { "id": "student-001", "name": "nameof student" }, { "id": "student-0...

 
9:38 AM
@RobOhRob I have added more details on the security vulnerability here - codereview.stackexchange.com/questions/223934/…. Please check. Thanks — Sandeepan Nath just now
 
0
Q: Remediation for security vulnerability due to storing sensitive information in strings

Sandeepan NathSecurity assessment of our codebase reported the following vulnerability - Vulnerability Description The method x() in xyz.java stores sensitive data in a String object, making it impossible to reliably purge the data from memory. Vulnerability Risk Sensitive data (such as ...

 
Any Mathjax guru willing to convert this image into a quote block?
1
Q: Performance issues with double for loops, EM-algorithm

armaraThe alpha that I create is not created in a crazily efficient way I know, but the main bottleneck in this code is in what I call the "Maximization step" (see comments in code). There are double for-loops twice (with list comprehensions inside), and the reason for this is that I need to use the co...

 
10:04 AM
0
Q: Number to Words in JavaScript using a Single Loop String Triplets

Mohsen AlyafeiFor a start, I am new to JavaScript. I have reviewed 2 extensive articles https://stackoverflow.com/questions/14766951/convert-digits-into-words-with-javascript and https://stackoverflow.com/questions/5529934/javascript-numbers-to-words and the answers therein using various methods for spelling ...

 
10:21 AM
@VGR I have added more details on the security vulnerability here - codereview.stackexchange.com/questions/223934/… Please check. Thanks — Sandeepan Nath just now
 
10:44 AM
0
Q: forward content of an observable and future refreshes to an output

bvdb@Component({ selector: 'app-quickfilter', templateUrl: './quickfilter.component.html', styleUrls: ['./quickfilter.component.scss'] }) export class QuickfilterComponent { @Input() filterConfig; userInput: string; tableData$: Observable<TableData>; @Output() tableData = new EventEmitter

 
11:17 AM
Use of cout or nullptr doesn’t make it C++, because you can trivially translate that to C’s printf and null. C++ provides abstractions that would take pages of code to translate to C, and those are the ones that should be used. When I do code reviews, the use of low level networking socket apis is pretty much always a mistake. You end up stuck with synchronous spaghetti that never handles errors correctly, that usually leaks something, and takes 10-100x as long to write. Idiomatic C++ looks more like typesafe python than like C. — Kuba Ober just now
 
@MathiasEttinger
 
12:01 PM
@Vogel612 Thanks
 
0
Q: Clean up nodeJS function

CurtisI'm currently writing an activity reporting system based on users; upon looking through a lot of files I'm noticing that I do a lot of if statements that clearly can be rewritten; How would you improve this structure of file? I can then take any ideas/improvements from this file & apply them to ...

 
12:21 PM
This code doesn't seem to work unless you're using Python 2 and are abusing input's eval behavior. Also, reviews of code belong on Code Review; although this is too incomplete of code to be appropriate there. — Carcigenicate 10 secs ago
 
0
Q: Registering Named services and resolving themy by T

t3chb0tProblem statement I have an application that needs to get files from various sources (disk, embedded, http, ftp, ...) so I use a common API for them: interface IResourceProvider { } Then I just provide implementations: class PhysicalFileProvider : IResourceProvider { } class HttpProvider ...

 
If the code works this should probably be on codereview not SO — Error - Syntactical Remorse 50 secs ago
There a section for fast execution at initd.org/psycopg/docs/extras.html#fast-execution-helpers and for code quality you need to move to codereview.stackexchange.comzety 23 secs ago
There is a section for fast execution at initd.org/psycopg/docs/extras.html#fast-execution-helpers and for code quality you need to move to codereview.stackexchange.com — zety 36 secs ago
 
1:04 PM
0
Q: local lambda: capture value or pass as parameter?

Werner HenzeAs described in CppCoreGuideline ES.28 I am using local lambdas for complex initialization or when I want a local function. Here is a simple example. There is a C API that I need to implement, thus the char* and strdup. In this first version the lambda captures necessary parameters. char* get_v...

 
1:24 PM
0
Q: Java Perlin noise implementation

JacobI've decided to code Perlin noise generator in Java. It works pretty well, I just want to know If I am doing everything right and if it is a valid implementation! Thank you PS : The metaVector2f and metaVector2i are just 2D vector classes public class PerlinGenerator { public float[][] gen...

 
1:40 PM
people like to downvote over small things. Don't let it put you off. It's probably because you're asking for a code review rather than asking a specific question. Just ignore it. — Dan 23 secs ago
Since it's working code, this question rather belongs on Code Review. — jay.sf 47 secs ago
 
0
Q: Port the data from a TEXT file to Postgres table using Python

linuI have written the below code to read a huge text file of size 20+ MB and insert the values to a PostgreSQL table. The code is working fine, but I'm facing below issues in the code. 1) The code is taking too long to complete (nearly 2 hour). Is there a way to make it faster? 2) I wrote a conditi...

0
Q: React js, simple navigation buttons choice

NickI am currently making a simple navigation in react, the code works, but I think it came out to be a bit bigger than it has to be. Currently my nav works like this: I have an array of objects in App.js's state variable: navButtons: [ { name: "Business Tracking", icon: "ng ng-trac...

 
1:54 PM
Greetings, Programs.
 
0
Q: A polymorphic union in C++

sudo rm -rf slashSometimes I use std::unique_ptr<BaseClass> when all I really want is polymorphism. For fun, I made this container that skips the heap allocation. The downside is that it needs to know all possible derived types it will store in order to know how much space to reserve. Any feedback is appreciat...

 
2:32 PM
Relationships are your best friend for this. When setup, you could do something like $availableCars = Car::whereHas("city", function($subQuery) use($place){ $subQuery->where("name", "=", $place); })->whereDoesntHave("bookings", function($subQuery){ ... /* logic to determine overlapping bookings */ })->get(); That being said, this question might be a better fit for CodeReview, and otherwise it's a little broad to provide a answer to. — Tim Lewis 49 secs ago
possible answer invalidation by dariogithub on question by dariogithub: codereview.stackexchange.com/posts/223872/revisions
 
0
Q: VBA root finder algor

NewbieI did two simple functions in VBA (see below). When a user calls TirNoPer360 in Excel he must select cashflows and dates (as range), then he will get a rate (through iterations according to the second function TirNoPer360). Function Opt(Caja, Fecha As Range, tasa As Double) Dim i As Integer ...

 
3:00 PM
If you want help improving working code you should post that on CodeReview.SE. If you do decide to do so please delete the question here. — NathanOliver 37 secs ago
 
3:13 PM
@pacmaninbw 1 car-length per 10MPH is the rule-of-thumb we learned.
Or, about 1.4 seconds at 60Mph, if you're into that.
 
My rule-of-thumb is about 2.5 seconds between the car in front of me and myself.
My new car actually has adaptive cruise-control, so I can actually set that distance.
 
@DerKommissar mine too
its like one hardly needs to do anything except steer when using CC
 
Mine has LKAS, so I don't even need to steer lmao
 
but if the vehicle in front of you is going slower than your CC-set speed, then you can move to an open lane and then it will adapt back up to your CC-set speed
 
3:24 PM
0
Q: Refactoring an if statement within a higher order function in Swift

user204513Using Swift, I am sorting through some objects first date order, then secondly by title if the date is the same, as per the extract below: .sorted { if $0.date != $1.date { return $0.date < $1.date // Date object } else { return $0.title < $1.title // String } } Thi...

 
We're getting closer and closer to self driving cars with all the automated-this and safety-feature-that. I like my manual transmission thankyouverymuch
 
@DerKommissar sounds about right.
 
@SᴀᴍOnᴇᴌᴀ Yeah, that's how mine works. It also analyzes the speed of the vehicle in front of me. So if I'm in a lane doing my full CC speed, and a vehicle cuts right in front of me but is going faster then my vehicle doesn't slow down because it knows the gap is being made back up.
 
I'm voting to close this question as off-topic because it is asking for a code review (and this thus too broad / opinion based). It could probably be adjusted to be on topic for the code review stackexchange. — Quentin 14 secs ago
 
3:52 PM
@Jason, please provide your own solution first and explain how exactly it doesn't work. If it does, then you'd better post at Code Review. — ForceBru 39 secs ago
@ForceBru, thanks for the hint. I now know there is a Code Review. — jason 20 secs ago
"My attempt is to use at least for loop, but it is not effective" - please post your code that attempts to solve this and explain how exactly it doesn't work. If your code works, you're looking for Code Review. — ForceBru 25 secs ago
You'd be better off posting this on CodeReview — Tom 31 secs ago
 
Monking
 
4:24 PM
-1
Q: sum leaves binary tree recursion

OfeksI wrote this code and when i use print i see that i get the leaves, but the final return from the function returns None and not the sum of the leaves, which suppose to be 2 in this example. I'll be happy to know whats wrong here. My wish is that the function will return finally the sum of them. T...

 
possible answer invalidation by Woodrow Barlow on question by Woodrow Barlow: codereview.stackexchange.com/posts/223905/revisions
A more generic solution to view closed code reviews is posted here: stackoverflow.com/questions/16146666/…riQQ 17 secs ago
 
@Duga appears to be correction in response to comment and not mentioned in the one answer
 
4:44 PM
-2
Q: What are the key issues with this implementation?

Avantika PThis function generates the nth fibonacci number. An exam recently asked me this question: What are some issues of this implementation (Asks for 4 issues!) I'm thinking maybe a potential issue is that it only begins to compute from the 3rd term. It cannot really generate 0, 1 or 1. So if n= 5,...

 
4:59 PM
 
@FreeMan Heh, same here. Less likely too break if there's less components too.
@DerKommissar Fails to compensate for stopping distance being exponential though.
 
@FreeMan some vehicles offer Adaptive cruise control and have a manual transmission...
 
6:04 PM
0
Q: loop code through each slicer value selection

aNobleNoobI have a PivotTable with a slicer that has 5 filters. I'm looking to have these filters to each be selected individually one by one and run a copy/paste code for every filter selected. I've set up the code to work for each filter so far with completely rewriting/copying each code for each filter...

 
6:35 PM
possible answer invalidation by Woodrow Barlow on question by Woodrow Barlow: codereview.stackexchange.com/posts/223905/revisions
 
@Mast Sure. It's an over-estimate at low speeds, and an under-estimate at high speeds. Still better than the alternative of no "rule of thumb" and having people cause more frequent accidents because of a lack of common sense.
 
-1
Q: Fixed-Size Floating-Point Types

NergalI have created my own personal data structure libraries for C and I've re-engineered it about two times now and I've added alot of preprocessor checks and defines concerning OS type and compiler type. One thing I've wanted to add to my personal libraries is having an informal "standard" fixed-si...

 
@DerKommissar 2 seconds distance is what they taught us.
A bit better than nothing.
 
6:50 PM
@SᴀᴍOnᴇᴌᴀ true. I like me some features in my cars, but it seems there are so many "safety" features these days that people feel that they can fiddle with their phones instead of driving.
 
One hand on the wheel and one on the gear stick (especially in busy traffic) leaves me no hands to play with the phone.
 
7:03 PM
Besides, looking at a tiny screen really takes your focus from traffic, even if you can do it hands-free.
 
7:18 PM
@Mast a car length of 20ft boils down to 1.4s delay at one car per 10MPH
 
@DerKommissar I don't know, my current car's length is about 3/4 of the previous one.
 
7:55 PM
@Mast I got a more fuel-efficient car and it got bigger.
 
0
Q: Is there a better way to expose NPM production dependencies without including source files?

Jacob StammI have an ASP.NET application for which we're trying to use NPM to manage client-side packages. The simplified folder structure is as follows: gulpfile.js node_modules/ package.json package-lock.json wwwroot/ ├──lib/ └──... Only files inside wwwroot/ are accessible to the app's routing, everyt...

 
8:24 PM
0
Q: A regex pattern that matches all forms of integers and decimal numbers in Python

darkhorseThe question is pretty self-explanatory. I wrote a regex pattern which should (in theory) match all possible integers and decimal numbers. The pattern is as follows: import re pattern = '^[+-]?((\d+(\.\d*)?)|(\.\d+))$' re.compile(pattern) How foolproof is this pattern? I tested out quite a fe...

 
If this code works, head over to Code Review to ask this question. — Andy Turner 22 secs ago
 
8:44 PM
1
Q: Build multiple groups in an array

user11767153I have written a function buildGroupRequests() to build an array of multiple groups. It checks the size of the request group. If a request group is greater than MAXSIZE = 50 then it will create another group in an array. The logic seems to be complicated, is there a way to rewrite this to be mo...

0
Q: Python Count on if Loops

Michael HandI would like to make this super beginner factoring calculator in Python3 without the use of lists or other data structures. How do I get the count to successfully number the iterations of the print function within the factor function? I might be placing the return incorrectly, I think. n = int(i...

0
Q: Node Express App - Create structure around incoming payload

SBBI am working on a simple NodeJS express app that accepts an incoming payload from a few different systems. There is a single route that ships the data off to another method and waits for the promise. I am trying to make the incoming endpoint more secure to at least define an expected schema of t...

 
9:05 PM
0
Q: Some questions about a simple asynchronous socket client

MatzeI am having a hard time to come up with a simple TCP client, that should use one socket and two threads (one for sending and one for receiving). As using TPL tasks is the way asynchrony should be handled in C#, I am trying to use the *Async methods provided by the SocketTaskExtensions class. T...

 
9:28 PM
Why not fetch the components needed from the external API beforehand and pass them to the constructor? In conjunction with a Builder pattern, this can lea to pretty readable code. Besides that, this question seems to be better suited for Code Review. — Turing85 22 secs ago
 
9:45 PM
0
Q: Extremely Fast Prime Numbers Generator Implementation in Java

MC From ScratchI'm trying to implement an extremely fast primes generator in Java, efficiently generating (and sieving) all primes <= x. Numerous places on the internet suggest that optimized variants of the sieve of Eratosthenes are the fastest and most efficient, even when compared to sieve of Atkin. Hence ...

 
 
1 hour later…
10:48 PM
Generally speaking, calling the constructor of a class should only ever return an instance of that class. So in your example I would expect first sampleInstance = SampleClass() and then output = sampleInstance.method1(input_var). Also try codereview.stackexchange.com for style and review questions like this. It seems like a better place for this kind of question. — Daniel W. 56 secs ago
 
11:45 PM
0
Q: shared_ptr alternative with no dependencies

TaylorAn alternative to shared_ptr to minimize compile time. Intrusive. Reference count changes are not thread safe. (#include<memory> pulls in 17k lines of code) This satisfies my needs, but I'm curious how it could be improved (without adding any dependencies). It's not particularly good at handli...

 

« first day (2259 days earlier)      last day (1766 days later) »