« first day (3065 days earlier)      last day (27 days later) » 

12:02 AM
REFRESH! There are 7831 unanswered questions (89.3061 answered)
12:30 AM
If you have working code that you're looking to have peer-reviewed, you should ask on Code Review instead - it was created just for that purpose. Make sure you read and understand their site guidelines before posting there. This site is for questions about specific problems you're having with code or use of a programmer's tool. — Ken White 14 secs ago
1:22 AM
Q: This code removes repeated numbers repeated on a list

fabinfabinfabinSo, I just managed to finish a problem that was proposed to me, and I find it very difficult since I started learning looping with for and using lists recently, I thought about sharing the problem and my solution with you guys so you could give me some advice on how I should make my code better o...

3 hours later…
3:57 AM
This is a question more suited to Code Review. That said, the latter is better to write tests for and the like. — t56k 19 secs ago
4:44 AM
5:28 AM
Have a look at thisHarshit Rastogi 56 secs ago
Q: Remove Duplicate Lines Without Sorting or Removing Empty Lines

bluerayI am using the following oneliner to remove duplicate lines without sorting or removing empty lines perl -ne 'if ( /^\s*$/ ) { print } else { print if ! $x{$_}++}' However, this code seems bulky, specially the $x{$_}++ part. Is there any way I can make this code more readable and understandable.

Post a representative minimal reproducible example that you need help with, and identify a specific issue. This is not a code review site. — Mad Physicist 57 secs ago
5:59 AM
If it works then it's better suited to CodeReview StcjExchange — Caius Jard 23 secs ago
2 hours later…
7:56 AM
Q: converting serial read from python2 to python3

mikeI'm new to python and am trying to convert a very old utility I have from python2 to python3. I've searched and searched for answers, but I've yet to find an explanation for the behavior that I'm seeing or how to fix it... I'm grabbing data from a USB(serial) device like this: class TED(object):...

8:46 AM
Question better suited to codereview.stackexchange.compmg 46 secs ago
9:39 AM
If your code gives the correct answer, post it to Code Review to ask for improvements. Otherwise, please tell us what your code is doing wrong. — jsheeran 11 secs ago
10:23 AM
Q: Python type Optional[type] vs Union[type, None] vs type | None

Daniel MorellWith Python 3.10 there is an additional way to explicitly define a possible None type. I can think of three ways to do it currently. My question has two parts... Is there any inherent value of one over the other? Would you recommend using them to indicate different things? A. Optional[type] fro...

Q: Shorthand of compiling min and max values from an array with object into new object

BreadcrumbPieI'm wondering if there is a nicer way to acomplish what I want: I do have an array with object like that: let data = [ {val1: [1,2,3,4], val2:[6,7,8,9] } ] What I want is an object like: let limit = { minX: 1, maxX: 4, minY: 6, maxY: 9 }; My Code works but once more I'm wondering if there i...

10:48 AM
Q: Python 3 script to phonetically transliterate written English to Cyrillic and/or Greek

Xeнεi ΞэnвϵςThis is a Python 3 script I have written over three days that transliterates (not translating) English orthography written in Latin alphabet to the Cyrillic alphabet, the Greek alphabet or a mixed of those two above. The script transliterates the text, meaning it doesn't translate the meaning of ...

Q: C# test threads and synchronized methods

user122222I have to check unsynchronized and synchronized methods and I decided to do that with following problem: let's say there're two purses and I am adding money to one, changing coin, adding to other. When thread is not synchronized I expect not correct values inside purses, then I synchronize them, ...

1 hour later…
12:01 PM
Q: Functional tests of downloadpdf, a python CLI app

Anit Shrestha ManandharShared below is a functionality test. I would love to get some review from the community. Thank you. The idea of the system is a simple CLI application which can be used to download PDF from a given URL. For more information please visit https://github.com/PythonCheatsheet/downloadpdf. Test Code ...

12:26 PM
Q: How can I make this cython function faster?

Frederick ReynoldsI have this cdef function that is being called over 4 million times, and I need to speed it up as it's taking up 50% of my program's time. cdef int cdetermine_win(int[16] state) nogil: for con in cwin_conditions: if state[con[0]] == state[con[1]] == state[con[2]] == state[con[3]] != 0...

12:51 PM
@CaptainObvious I would like some opinions on this question before I VTC, I think it is MRC.
@pacmaninbw You should be ok with the update?
possible answer invalidation by martin on question by martin: codereview.stackexchange.com/posts/268288/revisions
possible answer invalidation by martin on question by martin: codereview.stackexchange.com/posts/268288/revisions
1:06 PM
@Peilonrayz Amazing how one comment can improve a question.
Ah good good :)
Q: Remove Duplicate Lines Except Blank Lines

bluerayI have written the following cli tool. import sys import argparse parser = argparse.ArgumentParser(prog='remove-duplicate-lines-except-blank-lines', usage='%(prog)s [options] [files...]', description='Remove duplicate line except ...

1:39 PM
Q: C++11 Custom Vector Implementation

David TóthThis was my solution to an interview question: Q: Implement an std::vector style container (does not have to be exactly compatible) with a fixed buffer and the following requirements and restrictions: The fixed buffer size should be provided by a template parameter. No dynamic memory allocations...

1 hour later…
2:53 PM
Q: Unsupervised competitive learning algorithm from scratch in javascript

Giuliano CantinaI'm a mathematician who is new to programming and I'm currently reading the book "Theory of Neural Networks" by Rojas. To become better, I try to program every algorithm that is described in the book using javascript (to be precise: the p5js editor). Let \$X=\{x_{1},\ldots,x_{N}\}\subset\mathbb{R...

Monking - Happy Friday!
3:16 PM
Q: Creating Pivot Table taking time at average vales

Mani233I need help with VBA code. I have created a macro to create pivot table automatically. But taking 15 to 20 minutes of time to complete the macro. Especially at the point of below code taking half of the time. Review Code below With .PivotFields("NTS USD ACT Previous Year") .Orientation = xlDa...

Q: Migration in a bioinformatics application that changes a column name and explains the rationale

Timur ShtatlandThis very short piece of code is a migration in which a column name is changed to be more descriptive. It is part of a larger bioinformatics application written in RoR that parses the output of multiple bioinformatics tools, then summarizes and stores the results in PostgreSQL database. The goal ...

@CaptainObvious I closed user's first question for being too hypothetical - despite having some concrete code but it seemed to focus on generic best practices, and now it is RBA; the code in this question seems to not have holes but is quite brief
@SᴀᴍOnᴇᴌᴀ That's not what a GBP is.
"What is the best way to write comments" not "Is the way I've written my comments adhering to best practices".
@Peilonrayz are you referring to the new question and/or the deleted one?
4:03 PM
@BCdotWEB @TobySpeight Do we really need to chase away new users?
(I don't think BCdotWEB is pingable - you can type the text but a ping won't go through)
Yeah, I was worried about that.
I think you can invite to the 2nd through the chat profile or comment on main somewhere.
@Peilonrayz Invited, thanks.
No problem :)
4:56 PM
Q: Tic Tac Toe in C++ with classes

Random_Pythoneer59My first language is Python and I learned considerably a good amount of it. So now I started learning C++. I know the basics of C++ and about classes and inheritance. This is my first serious project with classes. (I am thinking of adding an ai) I wanted to know where I could - Optimize the perf...

Please post your optimization requests on Codereview Stack ExchangeRojo 34 secs ago
5:20 PM
Q: Javascript - On mouseup check if any of the parents has/includes specific id

RubioliOn my page I have a mouseup eventlistener on document. I want to be able catch if the clicked elements has a specific id in any of their parents. What I'm doing now is to loop over the e.path and only push the ids to an array and from there check if the array includes that id (the id is: getme). ...

5:45 PM
Q: Is it considered bad code/style to use built-in libraries to solve a programming problems?

Preston_JarvisBack at Uni I recall several teachers forcing students not to use built-in libraries, and instead have us build things from scratch like data structures/algorithms. My question is in the real-world and in programming interviews is it considered bad to use built-in libraries? For example (using it...

6:34 PM
Welcome to stack overflow! If you have code that works but you want to improve the efficiency, the the Code Review stack site is the site for you. "Please code this for me" is otherwise off-topic for stack overflow, where we ask for specific questions with specific answers, for which you can provide a minimal reproducible exampleG. Anderson 1 min ago
6:48 PM
lol ^
7:36 PM
@skiwi I was thinking about this today... lol
8:04 PM
8:20 PM
@pacmaninbw Asking for an edit is "chasing away"? ? I would have edited it myself, but I couldn't work out what the code is for - definitely needs help from the OP.
@TobySpeight I agree that when it was first posted it had major problems, but there was more code added with an explanation.
@TobySpeight tbf with the amount of votes and comments (saying I'm wrong) from different people on the question, if I were the OP I would feel like I'm being dogged on
I don't know who voted to close, but it wasn't that bad to require a VTC IMHO.
@pacmaninbw Sadly not enough explanation for me to be able to summarise with a new title - that's why I asked the OP to do that.
@TobySpeight I think an experienced user (1800+) called you pedantic yesterday. I'm just saying it might be better to edit the title.
8:30 PM
So the only purpose of using [ref] is to force function calls to use the actual parameter name to ease you code reviews? — Dennis 11 secs ago
At least some of the time.
@pacmaninbw Yes, being pedantic is important in a reviewer; not sure how that's relevant to this question. As I say, I went to edit the title, but found I couldn't (it seems to be for some kind of game, but no description of the rules or anything).
huh, what happened?
@TobySpeight OK, true.
Q: Prime number finder in Python3

Canadian LukeThe problem I am working towards improving my Python coding. I am checking that I am doing the best in terms of the Python code, not necessarily the algorithms. Having looked at one of my previous attempts in C++, I learned about Sieves for prime numbers. I want to know that I am following the pr...

Q: Database schema for discussion forum scraping

Dan TonyI'm scraping posts from various discussion forums and storing those posts, along with some metadata, into a relational database (SQL). My actual use case is a bit more complex, but I think I can give you the idea by using just two fictitious forums, one focusing on fishing ("Fish Forum") and anot...

@TobySpeight when I see a comment I agree with it, 1 comment should be good enough.
I do appreciate your attention to detail.
8:40 PM
@pacmaninbw I assumed the comment with a datestamp before the edit was referring to the original title; I was explaining that the edited title wasn't an improvement. Was that the wrong thing to do?
@TobySpeight I think at that point it might have been better to ask is this a game, and if so what game?
@pacmaninbw Yes, that might have been a useful question to ask.
OK. Thanks for listening.
9:31 PM
Hindsight is a wonderful thing!

« first day (3065 days earlier)      last day (27 days later) »