« first day (2468 days earlier)      last day (1554 days later) » 

12:00 AM
RELOAD! There are 6382 unanswered questions (90.0927% answered)
 
 
3 hours later…
3:16 AM
0
Q: JS, TS, handle 3 consecutive ifs / ternaries

manuelBetancurtI need to compare a title for 3 strings here what I'm doing var textMessage = "" props.screen == 'dd' ? textMessage = "Next, select the dd " : null props.screen == 'ff' ? textMessage = "Next, select the ff " : null props.screen == 'ss' ? textMessage = "Next, select the ss " : null

0
Q: Get a random member of a container

Martin YorkIt was not obvious how to get a random member of a container. So I wrote a function to retrive it given a generator. namesapce ThorsAnvil { namespace Util { using Distribution = std::uniform_int_distribution<int>; /* Get a distribution from [0, max) */ /* None ...

 
3:32 AM
@SᴀᴍOnᴇᴌᴀ oops. can't believe I didn't see that that question was a C# question and they posted Python code....lol
 
3:56 AM
0
Q: Shared memory class

GiulianoI wrote a class that opens a shared memory communication to use in my project, and would like a review. mylib_com.hpp #ifndef __MYLIB_COM_HPP #define __MYLIB_COM_HPP #include <sys/mman.h> /* For mmap */ #include <fcntl.h> /* For O_* in shm_open */ #include <unistd.h> /* For ftruncat...

 
4:34 AM
I'm voting to close this question as off-topic because it's asking for code review, and as such belongs on codereview.stackexchange.comMad Physicist 1 min ago
 
4:59 AM
0
Q: Clojure depth first search maze problem from Classic CS Problems in Python Book

user5293I am an experienced self-taught professional Python programmer working my way through the book Classic Computer Science Problems in Python to try to catch myself up on some of the things I missed by not going to school for this. I am also currently trying to learn Clojure, and I thought why not k...

 
5:12 AM
Monking
 
 
2 hours later…
6:44 AM
@Malachi That answer was the third late answer by that user today so I had noticed that the third one finally had something more than a code dump...
Stephen beat me to reviewing that one and I noticed he reviewed it but it didn't appear that he upvoted it
so then I looked at the OPs code and saw it was a c-based language
I was re-reading the answers in that link I shared in my comment - I forgot about the second paragraph of Elias's:
> Just allowing different language answers would, perhaps, put us at risk of becoming a half-arsed codegolfing site (which already exists).
 
7:20 AM
0
Q: Calculator with PyQT5

ZarkosRecently I started to learn Python and PyQT5. So here is my code for a calculator. Personally I don't like how doMath() function is looking but I don't now how to make it more readable and pythonic. Please review, any corrections and suggestions are welcomed. import operator import sys from func...

 
8:06 AM
Monking
 
8:40 AM
0
Q: Permutations with replacement in Python

SrivathsMany a times, I've had the need to use a permutations with replacement function. So, I've written a function to do just that: from sys import setrecursionlimit setrecursionlimit(10 ** 9) def permutations_with_replacement(n: int, m: int, cur=None): if cur is None: cur = [] if n...

 
9:14 AM
This might be better suited to Code Review since it's working code. I would use Dictionary<string, int> to store the words. — John 41 secs ago
 
0
Q: Jquery tooltip with callback hover more tooltips displays delayed content

sachadI have an html table with multiple rows and columns. <table> <tr> <td id="td1" class="my_tooltip"></td> <td id="td2" class="my_tooltip"></td> <td id="td3" class="my_tooltip"></td> </tr> </table> Using Jquery UI - Tooltip, each td element should load different tooltip data with ...

 
This is likely a better question for codereview.stackexchange.comLiam 36 secs ago
 
10:01 AM
0
Q: Multi-threaded vectorized 3d image convolution-python

bullseyeThis code takes an array of 3d images and applies the convolution function through multi-threaded image processing with padding, stride, pad values ... as parameters. I need suggestions on how to improve performance and maybe get rid of the for loops used(if that is possible). Use this photo tig...

0
Q: Mars Rover challenge in Python - general feedback

statsgirl123I have given the Mars Rover challenge a go in Python as DSA practice. Here is the challenge: A rover’s position and location is represented by a combination of x and y co-ordinates and a letter representing one of the four cardinal compass points. The plateau is divided up into a grid to sim...

 
10:39 AM
@Heslacher @Vogel612 Do either of you happen to know the answer to this question on German.SE perhaps? About preferred word usage in industrial context.
 
I'd guess that HALT doesn't imply the electricity is cut
n.b. that's a guess, though
 
@Vogel612 That's possible. Considering the only function of the emergency stop is to start the emergency stop procedure though, the English equivalent doesn't imply that either.
 
but AUS does imply the electricity is cut to the machine attached to it
NOT-AUS is "EMERGENCY OFF"
instead of STOP :)
 
Right.
 
for the person needing to hit the button, the distinction is probably meaningless either way :)
 
10:50 AM
Absolutely, but for whoever engineers the machine it's a little different.
 
true.
 
An emergency stop can be either a category 0 or 1 stop. A 0 immediately cuts power. A 1 cuts power eventually, but not immediately. A user probably won't notice the difference, but I imagine we can't put NOT-AUS on a cat 1 emergency stop.
While NOT-HALT is basically true enough either way.
A category 2 stop would allow power to remain, but those are not permitted for emergency stops. So with an emergency stop, the power will be cut eventually, one way or another.
Monking @Zeta
 
11:10 AM
This really really sounds like it should be posted at Code Review. — usr2564301 43 secs ago
I'm voting to close this question as off-topic because as pointed out by usr2564301 this belongs here: codereview.stackexchange.comezdazuzena just now
@Osialek generally when talking about code, "optimize" means efforts to reduce the runtime, memory usage, or stability of a program. If you mean just improving the code in general, that can mean a whole spectrum of different things, and different people will have different priorities, opinions and tastes that will take different or even contrary directions. As mentioned here already, it is more appropriate to take these types of questions to codereview — Hymns For Disco 7 secs ago
 
 
2 hours later…
1:02 PM
0
Q: Converting dictionary into a classlike object

EmilI want to simplify dict usage. Sometimes, when dictionary structure is quite well known, let's say: d = { 'a': 1, 'b': 2, 'c': [ 1,2,3] } it would be nice to access this using d.a, d.b, d.c[0]..., not d['a'], d['b'], d['c'][0]. For this purpose I used this and wrote a function: f...

 
1:22 PM
0
Q: Parse JSON in Swift

spacefloraI am working on a project that has to load a lot of data from JSON files. For this I have written the following struct. struct JsonHelper { static func parseJsonFile(file: String) -> Any? { if let filepath = Bundle.main.path(forResource: file, ofType: "json") { if let con...

 
@CaptainObvious Not sure if this is ready for review or not, is the users test good enough to say it is working?
 
1:35 PM
possible answer invalidation by Mast on question by cody.codes: codereview.stackexchange.com/posts/181696/revisions
 
0
Q: Best way to pass a 2d array to functions which size is unknown at compile time in pure C

Papa GrishaI've been wondering for some time what the best way to pass a 2d array to functions is. I know that arrays, passed to functions, decay into pointers, so int arr[25] would become int *arr inside a function. The problem is with 2d arrays, int arr[5][5] would not become int **arr. Instead I've been ...

 
2:03 PM
0
Q: Simple multiple producer and single consumer concurrency pattern

cslrnrAnyone please review and share your feedback for the following code. Multiple consumers generate random integer numbers and a single consumer receives it to display only odd numbers out of it. package main import ( "fmt" "time" "math/rand" "sync" ) var msgs = make(chan int) var dummy = make(c...

 
2:43 PM
0
Q: Asynchronous array methods chaining

Yann BertrandI am trying to check that a list of files are all images using functional programming. Some actions I go through are asynchronous, so I have to wait for them to completely finish before passing to a new one. const filteredFiles = ['favicon.ico', 'site.webmanifest', 'browserconfig.xml']; const f...

 
Bring this to codereview, you'll get better help there. — leinaD_natipaC 55 secs ago
 
3:23 PM
0
Q: Write a wrapper to REST API with asyncio

PabloI want understand how to correctly structure a functional asyncio-based program. The code below wraps two external APIs to provide the client a simple send_weather() function. Its structure reflects my current understanding of ansynchronous programming and the very little I've grasped of functio...

 
3:43 PM
0
Q: Find the smallest number of perfect squares that sum to a target

Somya AgrawalGiven a positive integer n, find the smallest number of perfect squares (for example, 1, 4, 9, 16, ...) that sum to n. sums = {0:0, 1:1} def numSquares(n: int) -> int: if n in sums: return sums[n] else: s = 2**31 squares = [i**2 for i in range(1, int(n**(1/2)) + 1...

 
4:00 PM
possible answer invalidation by Webucator on question by Webucator: codereview.stackexchange.com/posts/236604/revisions
 
4:24 PM
-1
Q: Multiple semi-colons in ES2015 Arrow Function Syntax

RouninTLDR: Does the javascript community regard it as poor syntax to include a terminating semi-colon inside an anonymous function inside an Event Listener / Event Assignment statement, when the terminating semi-colon of the statement itself will be following not long after? I'm currently writing a...

 
I'm voting to close this question as off-topic because it should be migrated to codereview.stackexchange.comNicktar 27 secs ago
 
@Nexevis OP asked for a codereview, that's the place to get one working code or not. Over here I'd only suggest to burn the book he's using because it promotes the use of static methods. — Nicktar 41 secs ago
@Nicktar The rules of the codereview stackechange specifically require the code to be working as intended. See here. "Code Review aims to help improve working code. " This question would be closed quickly and downvoted on that exchange in the current state. — Nexevis 56 secs ago
 
5:04 PM
0
Q: What is the best practice between second assignment or dict's value call?

Dorian TurbaI want to store a value in a dict (to behave like a cache) but I care about performances. I wonder if it is better to create a second variable in order to store the result of the sum compared to retrieving the value from the dict where the result is already stored. Real code: @property def tota...

 
MOnkking
 
5:24 PM
0
Q: Are DataTable/DataAdapters really 100x faster than Linq.DataContext.ExecuteCommand and/or SqlCommand.ExecuteCommand?

TerryI can't believe DataTable/SqlDataAdapter massively beat out System.Data.Linq.DataContext.ExecuteCommand and ExecuteNonQuery (tried with both Stored Procedures and command text) and just straight SqlConnection/SqlCommand ExecuteCommand and ExecuteNonQuery called during looping. I was going to fin...

 
5:36 PM
Stack overflow is not a code-writing or tutorial service, and we ask that you provide a minimal reproducible example including code for what you've already tried. If you have fully working code that you want to improve in efficiency, then Code Review might be a better fit — G. Anderson 25 secs ago
 
0
Q: A Matrix Library in C++;

HBatalhaI have written a Matrix library that contains all the main properties of matrices. It's a relatively long project, I am hoping it is ok to post here since I really want to have it reviewed. The project is compiled in GCC 9.2.0 and Boost 1.71.0, from https://nuwen.net/mingw.html, environment cod...

 
5:57 PM
No, you just mix up too many topics, Joins, and Groups and Sums and List-flatening. If you do have a solution that works, it would be easier to understand. You said, you have one with foreach- but you don't want to use foreach. So present your bad but working solution, then we can improve it. (Might be better on CodeReview, cause this is not of common interest). — Holger 49 secs ago
 
6:15 PM
possible answer invalidation by Rounin on question by Rounin: codereview.stackexchange.com/posts/236721/revisions
 
6:44 PM
If your code is workable then your question should probably be valid for codereview.stackexchange.comeyllanesc 56 secs ago
 
0
Q: Object oriented behavioural project structure in Typescript

HalhexThis code structure allows me to quickly create and manage behaviours on p5.js sketches. I'm planning to move to Java but wanted feedback beforehand. The behaviour interface: interface Behaviour<Element> { apply(...elements: Element[]): void; } interface LinearBehaviour<Element> extends Be...

 
6:57 PM
Please fix your code style. --- If the code works as intended, then it may be better suited for CodeReview. — Turing85 51 secs ago
 
@Duga What style
 
0
Q: A storage bin thingy for Repl.it projects

Haaruun II have a Repl.it account that I use for my projects, and I don't really want to make a new api for storage every time, I've seen some like EasyDB and Jsonstore (I use Jsonstore in the background as storage here) but it doesn't have some of the features i want. It isn't done, but its working. I ju...

 
7:21 PM
posted on February 05, 2020

On February 12, 2020, we will be ending our support for the legacy 1.0 and 1.1 versions of TLS, which are no longer used except by some very old client software. For more details, see our announcement on Meta.

 
-1
Q: Best Travel Kata C++

CharlieKeithhttps://www.codewars.com/kata/best-travel From what I understand of the problem, one must basically enumerate and the compare all the possible combinations of k elements from the vector. My solution works, but times out, so it isn't accepted. I've basically tried to create a sliding window that ...

0
Q: Immutable c++ object, defensive check parameters after setting const variables?

EvanComing back to C++ after a hiatus in Java. Attempting to create an immutable object. Defined A in header as public: const int A; Want to defensive check that A is positive in the constructor. Is this sane? MyObj::MyObj(int a) : A(a) { if (b < 0) throw invalid_ar...

 
8:00 PM
possible answer invalidation by Vogel612 on question by Webucator: codereview.stackexchange.com/posts/236604/revisions
 
@Vogel612 Sounds like an expiring authcode would be all that's needed?
@Duga Fine
 
@SᴀᴍOnᴇᴌᴀ I did notice that they had 3 answers that raised flags, one of them is now deleted.
 
@Peilonrayz it might, yea, but I honestly don't know whether there's something I've missed around things like throughput and queue filtering
 
Ok, I don't understand how those would play a part here. So, eh.
 
-1
Q: Lotto 6/49 program

wollyI need some help creating an program which selects 6 numbers from 49 and picks the winning and the losing numbers. How do you create that? All I have found is a video from youtube but that program selects 6 numbers continously and you don't use the break command to stop the selection. This is the...

0
Q: Most repeated string in a list and gives the index of where each instance begins

Frank HorriganSo I wanted to write a script that would essentially print out the longest repeated string within the entire list. Here is what I got so far: import re import collections #----------------- def Rep_String(inp): words = re.findall(r'\w+', open(inp).read().upper()) commons = collections....

 
8:05 PM
caching, concurrency and "duplicated" reviews
 
If it's a per user auth then there's an increased cost to caching, but concurrency and duplicate reviews I don't think would matter as you make the function idempotent per user. As once you have one code back you ignore all others
 
8:25 PM
0
Q: Access a database and an API, uses python generators, and matches the results based on names, interview assignment

Daniel RThanks in advance if you are reading this code. I recently submitted this code as part of an interview (took about 4-5 hours). Unfortunately, they did not like the code and I received a form rejection email without any sort of feedback. However, I am committed to improving my code and I would li...

0
Q: Autofiltering and deleting rows two times too slow

JamesFor Each MyIndex In Worksheets If MyIndex.Name = "Inv_IB" Or MyIndex.Name = "Inv_MP" With Sheets(MyIndex.Name) nFilasActual = .Cells(Rows.Count, 4).End(xlUp).Row Set dataRng = .Range("A2", .Range("N" & nFilasActual)) ...

 
possible answer invalidation by Dave on question by Dave: codereview.stackexchange.com/posts/236435/revisions
If everything works and you're just looking for optimization, you should post this over on the Code Review site. — sous2817 13 secs ago
 
8:45 PM
-1
Q: How to map person and addres

Siva RSuppose I have two classes Person and Address public class Person { private String fullName; private Address address; //getters and setters } public class Address { private String street; private int pinCode; private Person person; //getters and setters } Is it o...

0
Q: Find a file in current or parent directories

yolenoyerAs a Rust beginner, I would like to know how I could improve the following points considering the function below: Handling Path and PathBuf types correctly; Performance; Rust writing style in general. Here is the function, decorated with a full working example: use std::env; use std::path::{...

 
 
2 hours later…
10:18 PM
 
10:42 PM
If it's working code, it belongs on Code Review. Even if it's not, it's too broad for SO. — madreflection 9 secs ago
@C-Love511 if you're interested, do a search for a custom class based approach. That's my favorite solution. Create a custom class that automatically restores events, screen updates, calculation mode, etc. in it's Class_Terminasearch: event. Then create a new instance of the class in a sub and when that sub ends, the class instance scopes out and settings are restored. Check out this CodeReview post: codereview.stackexchange.com/q/182278/115996ChrisB 35 secs ago
 
10:54 PM
Generally speaking, if your code works and you're looking for someone to review it, you would want to ask on codereview.stackexchange.com. Please read their On Topic before posting, if you choose to do so. — Tieson T. 52 secs ago
 

« first day (2468 days earlier)      last day (1554 days later) »