« first day (2900 days earlier)      last day (37 days later) » 

12:01 AM
RELOAD! There are 7499 unanswered questions (89.4811% answered)
2 hours later…
1:56 AM
Q: Cython Fibonacci Sequence

LinnyFor my current job, I've been told that soon I'm going to be porting our Python code to Cython, with the intent of performance upgrades. In preparation of that, I've been learning as much about Cython as I can. I've decided that tackling the Fibonacci sequence would be a good start. I've implemen...

2:13 AM
Hi, welcome to SO! Please only ask one question per post here. "check the following classes" Code review is off-topic, go to codereview.stackexchange.com for that. As for your other questions, you'd need to show your actual original research effort, what you've got so far, what doesn't work, etc --- we're not just going to write your code for you — Toastrackenigma 25 secs ago
2 hours later…
4:03 AM
Q: Is this a good way to achieve atomicity?

NoLongerBreathedInI noticed that Knuth's pipelined implementation of MMIX contains a serious bug in the implementation of CSWAP. The issue is that while the implementation ensures that CSWAP is uninterruptible, it fails to ensure atomicity. This is because it does not hold the memory lock at all times between load...

2 hours later…
6:10 AM
Q: Access nested dictionary from list of values

duaI have a json output like this : input= {"username": 'user_1', "data": [{"id": 4,"name": "email", "updated_data": {"score":5}}, {"id": 7, "name": "Spread","updated_data": {"assigned": "user_2"}}, {"id": 6,"name": "Losses", "updated_data": {"assigned": "user_3","score":5}}]}...

6:31 AM
If you wan't to have your code reviewed, post it one Code Review — Turo 33 secs ago
Q: How to append values into existed Vec with iterator

prehistoricpenguinI have a Vec with value default [0], and then I want to append into the vec with an iterator which is read from stdin, now my code is not performant since a use an insert to shift all the values behind index 0, how to improve this code with rusty style? #[allow(unused_imports)] use std::cmp::{max...

Q: How could I simplify this type of data-classes-bindings in Ruby?

KakarajiI have a library or gem that's a binding for a another library written in a native compiled language. In a gem there're many classes like this: # not a real class name class MyClass1 # not real attribute names attr_reader :attr1, :attr2, :attr3 # , there can be more of these # ...

2 hours later…
8:17 AM
Q: Get data from JSON values

ProtractorNewbieI have been working on where I want to improve my knowledge to do a safe JSON scraping. By that is that I could pretty much do a ugly workaround and wrap it into a try-except but that is not the case. I would like to know where it goes wrong and how I can improve the code I have been working with...

Since it seems you have working code and are looking for general improvements, this appears to more appropriate for CodeReview – be sure to check their question guide first, though. — MisterMiyagi 59 secs ago
Q: Tags for social platforms

MastWe have a tag for twitter (not to be confused with twitter-bootstrap). We also have questions about Whatsapp and Telegram, but don't questions don't have a specific tag yet. In my opinion, we have 2 options: We create tags for both Whatsapp and Telegram, to be used on questions involving code th...

9:06 AM
possible answer invalidation by jp207 on question by jp207: codereview.stackexchange.com/posts/259377/revisions
Q: Pure JavaScript infinite scroll

Razvan ZamfirI have a 4 list of posts. I am trying to load more posts (clones of the "original" ones) when I reach the bottom of the container. class InfiniteScroll { constructor() { this.observer = null; this.isLoading = false; this.postsContainer = document.querySelector('#postsContainer')...

Q: Parsing and Simple Shell in C

RedYoelI wrote this simple shell in C for a university assignment on operating systems (My guess is that it's just the begging and the next assignments will add to this code). The program prints the prompt to the user, receives an input and try to execute it. The program ends when the input is 'done', a...

9:33 AM
Q: Record status of http call to show in the UI

KeithWhat I am wanting to do, is record the status of a HTTP call, so that I can give the user some feedback in the UI, rather than either succeeding silently, or showing a grim error. What I have done is created a Result class. For ease, I will show the simple class, but I also have this as a generic...

9:48 AM
@Duga Seems fine.
10:31 AM
possible answer invalidation by prehistoricpenguin on question by prehistoricpenguin: codereview.stackexchange.com/posts/259391/revisions
10:48 AM
I’m voting to close this question because it belongs on codereview.stackexchange.com. — AVH 11 secs ago
11:19 AM
@Peilonrayz Agreed, I don't think any AI stuff happened either.
11:33 AM
If this is working code, you may be better posting it on codereview.stackexchange.comPete 55 secs ago
I will use the codereview next time. had no idea it even exists. — vilem cech 59 secs ago
12:06 PM
@Duga At the time, the only answer was their own.
Poor selfie though.
Q: Combine data from array of objects

ÁlvaroI got this data structure and I am checking to see which properties are true, then I am adding the key for all the properties that are true to that object on a new property called combined const data = [ { keyword: 'banana', yellow: true, sweet: true }, { keyword: 'pinea...

12:33 PM
Q: A class for full-text search the whole database

Minh NghĩaI'm writing an Android app that can search the whole database. More specifically I'm using Room (an abstraction over the in-app SQLite database) and trying to sticking to the official App architecture guide, which uses DAO and Repository pattern. All the data is offline. I have several models, e....

Q: Locale-independent float print function

Kirby KevinsonThe objective was to write a locale-independent function that prints floating-point numbers (i.e. one that always uses . as a decimal point regardless of the locale) that was going to be used in a library that was meant to produce JSON. I was aiming for the following: Implementation simplicity A...

1 hour later…
1:57 PM
Medi Madelen Gwosdz on April 12, 2021
Badges have been around since the beginning of Stack Overflow. They are our way of recognizing our contributors for engaging with the community in meaningful ways. They are a little bit of motivational fun that helped us create the largest place for programming knowledge with over 20M+ questions. But what badges do we have, and…
2:14 PM
Q: Preorder and Inorder into Binary Tree

Robertclass Node: def __init__(self, data, left=None, right=None): self.data = data self.left = left self.right = right def inorderTraversal(root): if root is None: return inorderTraversal(root.left) print(root.data, end=' ') inorderTraversal(ro...

2:25 PM
Of course. Writing your own perfectly functioning SQL injection protection is certainly possible, but it's also risky. If it's sufficient for you to check that a String contains A-Z characters, that's sufficiently simple that I wouldn't reject it from a code review. The more complex your custom validation is, the higher chance it will contain a bug that undermines the entire protection. — Michael 29 secs ago
2:49 PM
@CaptainObvious CNI
I think this question is more applicable to codereview.stackexchange.com rather than stackoverflow. — Alexey Rumyantsev just now
3:31 PM
Q: C++ object pool that returns a smart pointer on request

Symlinktemplate<typename T> class object_pool { public: explicit object_pool(std::size_t initial_size = 1048u); object_pool(const object_pool&) = delete; object_pool(object_pool&&) = delete; ~object_pool(); object_pool& operator=(const object_pool&) = delete; object_pool& operator=(obje...

3:50 PM
4:22 PM
Q: Dijkstra from scratch

LnzI implemented the Dijkstra algorithm from scrath and wonder if I can save some code? The whole algorithm is here. n is the number of nodes, and m the number of edges. 1 ≤ 𝑛 ≤ 10^4, 0 ≤ 𝑚 ≤ 10^5, 𝑢 ̸= 𝑣, 1 ≤ 𝑢, 𝑣 ≤ 𝑛, edge weights are non-negative integers not exceeding 10^8. def restore_he...

@Peilonrayz Is that a comment from Wonderland?
@Mast No all my comments are hand-written at the moment. I'm on my laptop rather than my desktop and haven't set up the comment CLI tool I built. I helpfully have a project called "SE Comments" and one called "CR Comments"... -.-
Hehe, spaghetti projects.
4:40 PM
Very much so... My system is a mess but cleaning up like 100+ projects is a lot of work
I know the feeling.
@Feeds Looks like there's consensus. If it's still going in the same direction, I'll start tagging in a day or two.
Q: Python, asyncio: without modifying function definition

Mr.EUMy normal code structure: urls=['','','','',...] for url in urls: downloadSaveData(url) Now, to make it async I did: urls=['','','','',...] loop=asyncio.get_event_loop() for url in urls: loop.run_until_complete(downloadSaveData(url)) loop.close() I do not have 'modify access' to downloadS...

Q: Finding the Euclidean distance between the vectors of matrix a, and vector b

Levon AvetisyanHere is the problem, Given a 2D numpy array 'a' of sizes n×m and a 1D numpy array 'b' of size m. You need to find the distance(Euclidean) of the 'b' vector from the rows of the 'a' matrix. Fill the results in the numpy array. Follow up: Could you solve it without loops? a = np.array([[1, 1], ...

@Mast Nice! If you want a hand just give me a shout
4:58 PM
Is this code working? If so, check out Code ReviewSuperStormer 10 secs ago
I’m voting to close this question because the question belongs on Code Review — Black Thunder just now
5:15 PM
Talking about helping hands, are you considering or have you considered running for moderator this election? @Peilonrayz
@Mast Yeah, I'll be running for moderator again
As sad as it is that there are two slots open, I hope we both get elected.
I'd like that.
We'd be a good team.
Heck, we already are.
@Mast If we can agree on anything ;)
5:23 PM
That's one of the reasons we're a good team. We don't always have the same view on things.
Yeah, I agree
Someone is gonna have to ping me when it's election time
@DerKommissar Nomination starts officially in 2h.
Election in 7 days.
I'm not running, don't care who get's nominated really
I just need someone to remind me when it's election time
We'll get you a ping if you're still pingable by then ;-)
5:32 PM
Pings stick around for 2 weeks IIRC
But I don't click through to main enough to get the notification
Q: Writing the scheme (functional programming) filter function

Joseph GutstadtI know this is a bit elementary, but I am highly uncomfortable writing scheme code, and I want to make sure that what I'm doing is good practice. I know mutation is frowned upon in scheme. I have no other source of review so I have come to you all (define (filter-lst fn lst) (if (not (null? ...

Q: Calling multiple clients from API controller methods?

chiru1983Hi I have a requirement where in I have to call two different client methods from same api in .NET Core and I have structured my code as follows. THis is working fine but Please give me your valuable inputs or suggestions for improvements. I am using HTTPClientFactory to create my clients as sh...

If your code works as expected, your question might be more on-topic on codereview.stackexchange.comThierry Lathuille 9 secs ago
6:05 PM
Q: Discord.py Bot : Sends with the loverate between 2 persons

JSuisEnPeignoirHello Stackoverflow users, I'm creating a Discord Bot and i made a !love command which is testing the love rate between 2 persons or entities. Example : !love Peignoir Emma Result: The loverate between Peignoir and Emma is x% Here's the code : @bot.command(name="love", aliases=["l"]) async def lo...

6:17 PM
This looks like you're asking for help with writing the code - technically, this is not on-topic for SO, since this is a site about general answers. If you can edit this to be a more general question, I will not move to close. If you really want help writing this function, you might want to try something like codereview.stackexchange.comJon Kiparsky 1 min ago
@JonKiparsky codereview isn't for help writing code. — Manuel 10 secs ago
7:21 PM
Q: string guessing game in java

Aesha Shah import java.util.Scanner; class Main { public static void main(String[] args) { int tries = 0; boolean iterated = false; String temp = ""; String holder = ""; System.out.println("Welcome to the guessing game! Guess one letter at a time. You have 5 incorrect guesses remain...

7:39 PM
@Duga Thought my computer broke when I clicked on the link in the answer...
Q: Mongoose virtual field declaration in Typescript interfaces

ostojanI'm recently started learning Node.js and I'm trying to write a simple Todo app using Mongoose. Since I'm also try to learn Typescript I wanted to combine my basic knowledge on both topics and I encountered a problem with defining interfaces for data models. I have a simple Todo model: export int...

@Peilonrayz Yes, that's a really odd way to mess up a link.
8:01 PM
There does not appear to be a direct question. You might have better luck over on codereview.stackexchange.com. :-) — Bobby Ocean 33 secs ago
Also note that you hardware division is slow compared to multiply, and you can use a multiplicative inverse to do exact division by 10. That makes the asm less "obvious", and is something a C compiler will do for you. But see Integer-to-ASCII algorithm (x86 assembly) for an x86 example, and Why does GCC use multiplication by a strange number in implementing integer division? for how it works. — Peter Cordes 7 secs ago
8:37 PM
Q: PHP filesystem on a shared file system

spectrumI have a project which we need to migrate from an on-prem solution to the AWS cloud. Currently, the software is running on a single instance. It's working fine but the business want the software to be Highly Available (HA). As part of the HA, the program will be installed on a shared file system ...

Questions like this simply aren't useful to SO. The short answer is "refactor", as you were apparently already thinking, and the long one is too specific to your code to be applicable for the next person with a similar question. Maybe try Code Review. — jonrsharpe 38 secs ago
Jon, thanks, I didn't know about "CODEREVIEW" who'd a thunk it. Thank you! — Peter The Angular Dude 7 secs ago
9:03 PM
Q: How to reduce the Cognitive Complexity of this code based on Thomas J. McCabe’s Cyclomatic Complexity

Peter BI know there are if, then, else and switch. But the code below is a mixture of if, then else, else if, else. @HostListener('document:keydown', ['$event']) onKeydown(event: KeyboardEvent) { let index = 0; if (this.selectedItemIndex === null || this.selectedItemIndex < 0) { this.changeAria....

9:14 PM
Q: 2021 Community Moderator Election

CommunityThe 2021 Community Moderator Election is now underway! Community moderator elections have three phases: Nomination phase Primary phase Election phase Most elections take between two and three weeks, but this depends on how many candidates there are. Please visit the official election page at ht...

9:28 PM
Q: Breadth First Search Block Puzzle

MperezI am creating a program that will be given a text file as output with the board's dimension and the piece id along with the piece width and length. The goal is to arrange all blocks in the board correctly. Currently, my program takes forever to come up with a solution. I need help optimizing or f...

Q: Generic concurrent bounded buffer in C

Samuele B.I just implemented a generic concurrent queue in C, and I'd like some feedback on my implementation, as well as the logic in handling generic data and concurrency. buffer.h #ifndef BOUNDED_BUFFER_H #define BOUNDED_BUFFER_H #include <stdlib.h> typedef struct _boundedBuffer BoundedBuffer; Bounde...

Q: C++ Simple Shared Pointer Implementaion

RagovI wrote an implementation of a shared pointer. I would like a review of it. It seems to work when I run it normally, but running it through Valgrind shows that that is leaks memory somewhere in my tests (Which I do not know how to fix ) Here is my .h file that I used #include <stdexcept> //Try ...

10:19 PM
Q: Looking for help on minecraft adventure server plugin

Ferre VekemansOkay, so I found this Bukkit plugin which gives administrators the ability to load community-made adventure maps and play them with a group of players on one single server instance. https://dev.bukkit.org/projects/adventureplugin https://github.com/smith61/AdventurePlugin This plugin is exactly ...

10:36 PM
11:10 PM
Q: C# how to code this roll dice "game"

Morgan AlexanderI've been trying to code this but I didn't do it right since my code wont let me use return, and also It stops after the first time and doesn't keep asking "Do you want to roll or quit:" when I type "roll". What it wants me to code Main method: Write a main method that asks the user to roll the d...

I'm not making a "No true Scotsman" argument here. I said it's "not something most professional developers do very often." So your statement actually supports what I said. My intention is to discourage the practice. If one finds something like this handy, I tremble to think what sort of code base they must work in that would causes such a thing to be "handy." I've never worked anywhere where this wouldn't be flagged immediately in a PR code review and require changing to be accepted. — Derrick Beining 30 secs ago
I’m voting to close this question because this question is more likely to get an answer on Code Review. — j3ff 14 secs ago
11:36 PM
Q: A simple encryption scheme similar to OTP

tinstaaflBasically this scheme uses a key the same length as the data, but it generates the bytes on the fly. They aren't truly random, but there aren't any obvious patterns and the output passes all the NIST tests. Since a simple password can be used to do the de/encryption it is much easier to hand off ...

11:47 PM
Tree Dev, in that case this question is probably off-topic for StackOverflow. You may want to direct this to CodeReview.SE instead. — Brian 30 secs ago

« first day (2900 days earlier)      last day (37 days later) »