« first day (2866 days earlier)      last day (1134 days later) » 

12:00 AM
RELOAD! There are 7384 unanswered questions (89.5709% answered)
 
1:00 AM
0
Q: Generic Class for a GSON LinkedHashMap

FireController1847I originally posted this on Stack overflow and was told to post it here, so here it is. Here's the stack overflow question: https://stackoverflow.com/posts/66528393/edit I have been working on this solution for months and I have come to the conclusion that there is no clean way to achieve what I ...

0
Q: Find the index of a tuple in a list of tuples in Python

RichardI'm a Python beginner I have the following array of unique tuples I'm playing with: array = [(1, 2), (1, 7), (1, 5), (2, 5), (2, 7), (2, 9), (3, 4), (3, 5), (4, 5), (4, 7), (5, 8), (6, 7), (8, 9)] I want to find the index of a given tuple (u, v) in this array. I wrote the following line which I ...

 
1:28 AM
This question is probably better suited to codereview.stackexchange.com. However be sure to take their tour and read their How to Ask page before posting. — Nick 1 min ago
 
2:16 AM
0
Q: Enhanced Caesar Cipher

tinstaaflThis cipher takes a byte array and applies a relatively 'random' offset for each byte. In order to keep track of the offsets, to allow the encryption to be reversed, I decided against maintaining a list of offsets, like the old school one-time pads, and went with using the modulus of the hash of ...

 
Usually, when you have working code that you want feedback on, it's better to ask on codereview.stackexchange.com (provided the question follows their rules, of course). — Brian McCutchon 40 secs ago
 
2:49 AM
 
3:48 AM
 
4:35 AM
possible answer invalidation by Setris on question by Richard: codereview.stackexchange.com/posts/256903/revisions
 
5:06 AM
Monking
 
5:31 AM
Asking for feedback on code that works is discourage on SO, it leads to highly opinionated responses, instead you should post this on codereview.stackexchange.comChris Schaller 22 secs ago
 
"Do you see anything wrong in my implementation?" -- Stack Overflow is not the place for open-ended code review. — JaMiT 41 secs ago
 
6:29 AM
0
Q: Is this idiomatic modern C++ for counting word frequencies?

Ben HoytI'm writing a comparison of a simple word-counting program in various languages. The task is to count the frequencies of unique, space-separated words in the input, and output the results most frequent first. Case should be normalized to lowercase (ASCII is okay). But it's been a long time since ...

 
7:11 AM
Monking
 
0
Q: Refactoring Help for a go-gin + mongo rest api

Ayush SinghI am making a rest api using the gin-gonic framework in golang and mongodb. Here is the GitHub Repo. I have created a config.go file in the handler directory that is responsible for initiating the routes, dialing up the connection to the mongodb as well as storing the live mongo client in a stru...

 
8:10 AM
0
Q: health care program

XusIn this program, I'm going to take some information about student's height, weight, and age and return the average of all of them to compare. there are 2 classes to compare and the program works fine but I want to know, is there any way to improve this program and make it better? Class_List =...

 
8:36 AM
0
Q: FtpEasyTransfer - .NET5 Worker Service for Easy FTP Sync'ing

Gary MacGregor-ManziI've created a simple worker service, which uses FluentFTP to sync either files or directories from one ftp client to another, or simply to a local machine, depending on how appsettings.json is configured. Overall I'm pretty happy with the code, but there's certain points I find the code repeats ...

 
 
1 hour later…
9:52 AM
-1
Q: Best practice to craft API response

Harsh MakadiaI want to understand the best practices that we need to consider while designing API responses. Problem Statement Let's assume I have an endpoint /v1/projects/all which return the list of projects and it response look something like this { "projects": [{ "id": "001", "name": "...

 
10:20 AM
possible answer invalidation by Anarchy on question by Anarchy: codereview.stackexchange.com/posts/256803/revisions
possible answer invalidation by Anarchy on question by Anarchy: codereview.stackexchange.com/posts/256803/revisions
The query can't produce nested arrays, so you have to restructure the result yourself one way or another. With that being said, working solutions where you are looking for improvements would be a better fit over at Code review. — El_Vanja 14 secs ago
 
10:42 AM
0
Q: How can you sort 2 vectors depending only on one in C++?

Tommy0404I need to sort 2 vectors in C++. The first must be in ascending order and the second must be sorted in the exact same way as the first one, as the entries of each vector at a given index i correspond to each other without being paired. Does anybody have a way to do that without using extra struct...

 
11:29 AM
domElement(child) doesn't modify child, it creates something new and returns it. So when you do domEl.append(child) afterward, you're appending the object, not the result of domElement. Instead, append the result of domElement: domEl.append(domElement(child)). (But I haven't done a thorough code review to see whether there are other issues.) — T.J. Crowder just now
 
12:13 PM
Thank you @Vogel612
 
ahhh ... you can see which mod kicked something off the HNQ, right?
 
Yeah, we can
Also an educated guess about time zones may help ;)
 
12:40 PM
possible answer invalidation by Your Common Sense on question by Anarchy: codereview.stackexchange.com/posts/256803/revisions
For what purpose? What security and code reviews will be performed before your code will be used? How many years are you planning to support your TLS implementation? As you can see implementing TLS on your own is a bad idea especially when it will be used later in devices accessible via Internet. — Robert 30 secs ago
Hi @CGO, welcome to the site. It's not very clear what your question is here. Can you clarify if you think you're getting the wrong answer or something? If your code is working fine, and you just want feedback on it, you probably want to ask on the Code Review stack, not here. As for your code itself, it's not clear to me from the question wording if you're supposed to be counting the total number of streaks, or if you are supposed to only count a list with a streak once (that is, you're counting the number of lists that have streaks, not the number of streaks). — Blckknght 13 secs ago
 
1:16 PM
0
Q: Number Guessing Game in Lua

Dexter ThornSome time ago I found out that there is a scripting language called "Lua" and I thought "Wow, this seems to be a nice alternative to Python. Why I've never heard of this language that also seems to be there for decades?". I then read something about this language and implemented the famous Number...

0
Q: Python: convert procedural script to class and object (oop) style

Rajarshi ChowdhuriI am still learning to code in python and I am struggling to code object-oriented way. I have written a code using pytessarct library and with the extracted words I have tried to make a simple detector by using keywords as a filter. I want to redo it in class and object format strictly as a learn...

 
2:01 PM
codereview.stackexchange.com for working code. Even there, you will need a clearer definition of "better". — jmargolisvt 1 min ago
 
2:35 PM
0
Q: Sorting a nested list with two criteria without lambda function

JonI have a line of code that sorts a nested list numerically (2 index) in descending order and then alphabetically (1 index) Just wondering if there is a simpler solution to achieve the same thing without using the lambda function since I find it hard to read. nested_list = [['update', 'C', '2'], [...

 
2:54 PM
Hi! Yeah I'm looking for the answer, really. I tried including my code for feedback on it too, but I see now I might have posted it to the "code review" stack. I'll try editing the post. — C G O 25 secs ago
 
0
Q: Python - referring to containers inside a dataclass by various names

paboukI need to refer to containers inside a dataclass using various name aliases. In this example code I store the alias mapping for container1 and container2 inside the container_map dictionary. from __future__ import annotations from typing import Any import dataclasses @dataclasses.dataclass class...

0
Q: sorting vector of pair in efficient way

Blue339I'm trying to solve the sorting problem but I always get TLE(Time Limit Exceeded/ 1s) so... can you guys suggest a more efficient way to solve this problem? (i can't link the exercise because it is on the closed server) code reads test count t , <int, string> pairs then sorts by integer in asce...

 
3:10 PM
@Peilonrayz I feel this question is more of a how to question and therefore does not belong on code review.
It isn't really asking for a code review.
 
@pacmaninbw Why have you VTC and commented for MRC if you think the question is more of a how to?
 
Because if it is a review question it needs more basis for review.
 
What do you mean by basis? Context?
 
I added a second comment to the question, yes context.
 
Lets say the user edits in a 30 line long program and keeps the same question "how can I stop using lambda (in the sorted)" would there be enough context?
 
3:22 PM
Can you answer the question as it is? You are a python expert.
 
Yes
 
Do so, I'll remove my comments and upvote your question. However, do you really think the question belongs on code review and not SO?
 
My answer would be "I can't make your code better", because you have to use icky lambdas or make a named function (which seems pointless here) when sorting.
 
Which might be my point.
 
If I have a perfect 1k long program would that be off-topic on Code Review for MRC too?
 
3:25 PM
appreciate your effort for answering my question +1 for that, I did think about this approach, but its not actually limit to this, what I'm really trying to do is store those urls in values ex. {'baduker':['https://stackoverflow.com/users/6106791/baduker‌​','https://https://c‌​odereview.stackexcha‌​nge.com/users/163501‌​/baduker']} in a neat way. — Hans 31 secs ago
 
1
Q: Indexing and searching an list of rectangles to see if they contain a point

PureferretI have a flat list of rectangles, in the following format (id, x co-ord, y co-ord, height and width): [ { id: 4206, x: 360, y: 700, width: 60, height: 50 } , { id: 6621, x: 1260, y: 1100, width: 60, height: 50 } ] I want to index this by range of X values, and then use that indexed object to ...

 
@Peilonrayz What in this question indicates they are asking for a code review?
 
@pacmaninbw We're talking about MRC not "asking for a code review".
 
So what reason should I use to close?
@Peilonrayz ^^
 
None of the standard ones, because the question isn't MRC, CNIONWAI, AoC, etc. If you think the question should be migrated and the question isn't a duplicate or "crap" you can pick "This question belongs on another site in the Stack Exchange network" ("do you really think the question belongs on code review and not SO") or use a custom reason "Other - add a comment" and say the question is a "how to question" / "not asking for a code review"
 
3:36 PM
Will do next time, thanks for the recommendation.
 
Thank you
 
Welcome @Jon
 
This probably belongs on Code Reviewpilchard 16 secs ago
 
@pacmaninbw FWIW I'm not going to answer because I don't want another how-to question to go hot today, and I seem to be a hot magnet lately.
5
 
@Peilonrayz Hopefully the poster has seen your answer since he is now in the room.
@Jon ^^
 
3:52 PM
0
Q: Wrapping the procedure of a HTTP request done by the Windows API

chwba#include <windows.h> #include <wininet.h> #include <string> #include <unordered_map> #include <stdexcept> #include <strsafe.h> #include <iostream> #include <unistd.h> #include <vector> #include <tchar.h> HMODULE H_WININET = GetModuleHandle(_T("wininet.dll")); HANDLE L_WININET = LoadLibrary("wini...

 
@pacmaninbw If not there's a comment saying a similar thing.
It's hard to review a single line, but my review would be "That looks fine - no need to change". Your suggestion that it would be simpler another way (e.g. a named function) would likely make it harder to read. But it's hard to be sure without the full program, or at least an entire function. — Toby Speight 4 mins ago
 
Yes, already up voted Toby's comment.
@Peilonrayz How do we get rid of the tumbleweed?
 
Sorry tumbleweed to me means "question with low user interaction for 2 weeks" (may be slightly wrong) old badge on SE. What do you mean by tumbleweed?
 
@Peilonrayz I doubt it will get the necessary VTCs but it won't get answered.
 
4:04 PM
@pacmaninbw If you mean the comments, I'm happy to delete if one of us post a new "this question seems like a how-to not a code review question". As for the question IDK I prefer a policy of just moving on, not much point dwelling since the site will handle things the way the site wants to.
 
@Peilonrayz Take a look at the last comment and notice that my first 2 comments have been removed.
 
@pacmaninbw What comments ;)
Nice I +1ed your comment
 
@Peilonrayz I better get my eyes checked, I've been seeing things.
 
Ehh, ignore my comment I had to post one to VTC
 
4:38 PM
@Peilonrayz +1, better than my comment.
 
1
Q: Weather app using es6 modules

refat alsakkai have recently built this simple weather-app. I would be happy to get some criticisms to improve my code. Structure: app.js: import '../sass/style.scss'; import '@fortawesome/fontawesome-free/js/all.min'; import 'regenerator-runtime/runtime'; import elements from './modules/elements'; import ...

0
Q: Model Pipeline to run multiple Classifiers for ML Classification

PluviophileAs a general rule of thumb, it is required to run baseline models on the dataset. I know H2O- AutoML and other AutoML packages do this. But I want to try using Scikit-learn Pipeline, Here is what I have done so far, from sklearn.linear_model import LogisticRegression from sklearn.naive_bayes impo...

0
Q: What do you think of my Swift code?

Russ JSo I received the following prompt for a code interview: "Please create an iOS app that downloads a text file from our server, parses the contents, and displays the results. The file is a standard Apache web server access log. We’re interested in knowing the most common three-page sequences in t...

 
is... is something not working? or are you just asking for a code review — Kevin B 35 secs ago
 
Monking
 
This same question was recently posted on Code Review by a (different?) user. — 1201ProgramAlarm 32 secs ago
 
4:56 PM
@Duga @Peilonrayz What's going on?
 
@Mast a horrible mess is going on...
 
@Mast Today, not much really. I rolled back YCS edit (edited code) with a comment to YCS. Then YCS rolled back twice, each with a comment to me. Nothing else really happened afaik, except wiped comments.
If you want to handle any AI I'll leave that to you, but you're not really missing any context AFAIK
 
5:21 PM
I’m voting to close this question because it is asking for advice optimizing code; it should be asked on Code Review instead. — Pika the Master of the Whales just now
 
 
1 hour later…
6:43 PM
@Peilonrayz YCS also helped me improve my answers as I took out 1 zombie and offered advice to DRY out code
I am hoping we can rollback the change in rev 2 on this JS drawing post ... I left a comment to the OP but don't want to make any assumption about the OPs desires...
Hmm... did you intentionally wipe out the majority of the code in revision 2? — Sᴀᴍ Onᴇᴌᴀ 11 hours ago
 
in Theme Decisions, 16 hours ago, by Mark Giraffe
Invite any users who are interested in creating styles for SE sites.
@all are welcome ^^
 
@SᴀᴍOnᴇᴌᴀ My comment was just about the post Mast linked to. I was getting Mast up to speed as we both had been following the question and had two discussion around the question.
 
6:59 PM
@Peilonrayz sorry... I was going off on a tangent to mention other things YCS did
the revision history on that post is ... demeaning, discouraging...
 
Oh sorry, I didn't notice you were just going off on a tangent
@SimonForsberg SE backed themes or user themes?
 
@Peilonrayz SE backed I assume. But if you're interested go in and ask the question there :)
 
7:18 PM
0
Q: Sanitize user-supplied HTML with Python and Regular Expressions

CraigI have a product that needs to have users put content in a form that potentially contains HTML and display it back to other users. I'd like to mitigate the risk as much as possible, and I can limit users to a subset of html. My primary goal is to make sure that users can't compromise each other, ...

 
7:48 PM
I’m voting to close this question because it's more of a Code Review question, than a SO question. The OP clearly states the code compiles and runs correctly and is asking for advice on code style. — jwdonahue 57 secs ago
 
@Vogel612 That sums it up quite nicely.
 
@Peilonrayz room description suggests user themes
 
@Vogel612 Yeah. I also skimmed through the messages and came to the same conclusion
 
8:12 PM
Welcome to StackOverflow. Perhaps codereview.stackexchange.com would be a better place for this kind of questions. — ETO 5 secs ago
 
8:35 PM
0
Q: Java: How to associate any number of employees with a location, but only one location per employee?

karobarIntroduction & Test I would like to create an object which associates employees to X/Y coordinates. Multiple employees can be associated to each coordinate, but each employee can only be associated with one coordinate. Also critically: employees must be able to have identical externally-configura...

 
Ben Popper on March 09, 2021
Rather than dig into complex math or over-simplify by using a pre-written function, we’ll write our own binomial test function, primarily using base Python. In the process, we’ll learn more about how hypothesis testing works and build intuition for how to interpret a p-value.
 
9:01 PM
1
Q: minmax evaluation with alpha beta pruning

rdar1999I'm making some small board game and wanted to code a very simple greed AI with this algorithm. It turns out it doesn't play the most greedy moves, it is simply not working. I'd appreciate any comments around this code. First, the position evaluation functions are: uint8_t get_piece_value(PKind k...

0
Q: How can I implement the SMTP protocol better in my Server and Client “SMTP” code?

Jimmy665566I've been assigned a tast to implement an SMTP client-server protocol providing limited functionality and the Solution for this is to execute a typical execution simiilar to this transcription: S: 220 [ip] C: HELLO [email] S: 250 Hello [email], pleased to meet you C: MAIL FROM: <email1@email.com>...

 
@Duga should complain about AI. Please can someone check I haven't. I'm pretty sure adding a new code-block for output is fine. If she doesn't here is a link.
 
possible answer invalidation by Peilonrayz on question by Anarchy: codereview.stackexchange.com/posts/256803/revisions
 
@Duga @Peilonrayz I don't see any AI...
 
@SᴀᴍOnᴇᴌᴀ Nice thanks :)
 
I considered adding output to that python question about parsing text formatting yesterday that I edited while VTRing but figured it wasn't worth the hassle (partly since it had an answer already)
 
9:24 PM
@SᴀᴍOnᴇᴌᴀ ugh, I'm still not used to seeing editors as answerers... Why didn't SE fix that, I swear I saw SE would.
Yeah, I can understand you
 
10:18 PM
0
Q: Filtering FASTQ file based on read names from other file (how to increase performance) Python

ThothI have some code here that basically takes in a list of IDs (sequencing read names) using STDIN, and then filters fin (a gzipped FASTQ file) to just those reads with a read name which matches one of the IDs, and then writes the name and sequence to fout (a gzipped FASTA file). Fairly standard dat...

 
10:44 PM
0
Q: How can I raise the performance of this recursive function for a chess engine?

KieranIntroduction I am making a chess engine in C++. I have a search function which is recursive, and I time the search within main. Currently, I achieve 72,762,064 nodes per second with the code below. I am new to C++, so before I develop further, I would like to know if I am doing anything wrong, or...

 

« first day (2866 days earlier)      last day (1134 days later) »