« first day (3136 days earlier)      last day (45 days later) » 

12:00 AM
REFRESH! There are 7957 unanswered questions (89.2419 answered)
4 hours later…
3:56 AM
Q: C++ Calendar Alignment

Sahid AdinHere is what it should look like I am having trouble aligning the first day of the month with the right weekday. The calendar is going to be for this year so January first will be on Friday but I cant seem to get any of firsts of each month off of the left side. I tried to change the setw but its...

4:39 AM
3 hours later…
7:32 AM
@NO_NAME I didn't know this is a common practice, but I'm sure it would piss off a lot of poor code reviewers. — MatG 44 secs ago
8:08 AM
Q: Is using OOP Router in FastAPI a good idea?

anotherChowdhurySo, I created base_route class for generic routing. I've also done the same for service and the repo. from fastapi import Depends, APIRouter from utils.service_result import handle_result from services.main import DBSessionMixin from routers.abstract_base import ABSRouter from services.base impor...

8:33 AM
Q: further optimizing 2d graph using slashes

Maghil vannanGiven a list of integers a 2D graph has to be plotted taking 1st, 3rd, 5th, ... numbers as upward slope and 2nd, 4th, ... numbers as downward slope I have used python list to do it. is there any further optimization possible with python? input integers : 3, 1, 2, 3, 6, 2, 3, 6, 2, 3, 6, 3, 2, 3,...

2 hours later…
10:13 AM
Q: API call scheduler for Python

LukeMy favourite 3rd party library isn't getting maintained so now I need to make my own library for interfacing with Riot Games' API. Epic. Problem is that there are rules, such as: 100 requests in 2 minutes 20 requests in 1 second So I made an API request scheduler. import asyncio import time fro...

10:38 AM
Q: Replace function for C++

ihsanI'm learning regex for c++, and tried to make a simple function. It is very small but I'm satisfied, because this is the first time I managed to pass function as argument. This is a replace function. Please give me tips on how to improve: std::string Replace(std::string text, std::regex reg, std:...

11:03 AM
Q: Where to free a dyynamically created array

user252524i am trying to solve the following exercise: "Consider a function ​ removePrimes() be a C function that takes as input an array of integers, removes all numbers that are prime, and returns the compacted version of the array. Create an array of 200 integers, with random values between 7 and 13, an...

1 hour later…
12:19 PM
Q: Is there a way to speed up the group stage of the MongoDB aggregation pipeline?

creyDI am trying to find all the "missing" devices in our database. Therefore I filter for the existing device ids and then prepare the data to be presentable and usable. The question I have is if there is any way to speed this up. Especially in the beginning existing_device_ids can even be empty and ...

1:08 PM
nope same thing, you are more looking for code review stack exchange, that said your question is not bad, just off topic so don't worry about it. see stackoverflow.com/help/on-topicStargateur just now
1:34 PM
1:59 PM
Q: Should I use classes instead of functions with a state needed for computation?

sshdI have implemented the cows and bulls game in C++. The code: #include <cstdio> #include <cstdlib> #include <ctime> struct DigitMatches { int matches_in_right_positions; int matches_in_wrong_positions; }; struct MatchesCounterData { int generated_number_left_digits[10]; int gues...

2 hours later…
4:05 PM
Q: Callback Url example with Okhtp

Code JunkieI have two rest application say a1 and a2 which is running on different containers. From a1 application i am calling the service exposed by a2 application for some processing. I am using okhttp to call the rest end point exposed by a2 and i am providing a callback url in request body. Once the re...

4:30 PM
Q: Carousel in react

georgeI implemented this carousel component in react: import React from "react"; import { AiOutlineArrowLeft, AiOutlineArrowRight } from "react-icons/ai"; import { useResizeDetector } from "react-resize-detector"; let arrowStyle = { background: "white", border: "1px solid lightgray", borderRadius:

Q: Bottom-up merge sort

AlphaHowlI think I programmed a bottom-up merge sort, but I'm a little sceptical that it will work under any data set. By now, I've tested it with many random arrays of massive lengths, and it seems to work; the only thing making me doubt my function is that whenever I look online for a non-recursive one,...

5:20 PM
Q: Snake doesn't move in Java snake game

NancyI have just started learning Java last month and started the java snake game program. I need to write a java snake game where the snake grows when it eats an apple, and dies when it touches itself. The goal of Snake is to create a snake as long as possible. When the snake reaches the end of the s...

6:10 PM
Q: How to make my code better that implements the bulls and cows game?

sshdI have implemented the bulls and cows game in C++. The code: #include <cstdio> #include <cstdlib> #include <ctime> struct DigitMatches { int matches_in_right_positions; int matches_in_wrong_positions; }; void CountNumberDigits(int (&counts)[10], int n) { while (n > 0) { cou...

Why would you have someone build something from the ground up when you have something that seems to clearly work? Dirty code can be cleaned up (please share and be willing to accept constructive criticism). Working code in particular can be reviewed by others at Code Review. — phentnil 22 secs ago
@phentnil Please don't refer to Code Review on questions with code which doesn't work as intended. Users can easily misunderstand you direction to CR as telling users to post off-topic questions on CR. — Peilonrayz 51 secs ago
6:31 PM
@SᴀᴍOnᴇᴌᴀ @pacmaninbw can you explain why you voted to leave it closed?
I.e. this
Q: Serve rescaled jpg images on demand with myphoto!500.jpg syntax (here 500px-width rescaled)

BasjOn web pages, obviously we cannot serve 4000x4000px photos and just let CSS do the resizing: it would be too slow for end users and too bandwidth-consuming for the server. So it's important to rescale photos to the desired size that will be actually used on the website. For this reason I usually ...

7:00 PM
Q: Idiomatic way to extract matches from rust Regex?

user38310I'm learning rust and doing an exercise where to parse a particular SGML document. Each line in a document can be either an opening tag "" , a closing tag "" or a scalar: " Val". I'm using a regex with named capture groups to detect and extract, and would like to return an enum afterwards. I came...

If you want a code review rather than looking for error fixes, ask at codereview.se please. — πάντα ῥεῖ just now
7:26 PM
Q: Parsing A Simple Matrix Definition In C

Semih ArtanIn one of my homework projects, I have to parse a matrix definition into a matrix data structure in C. The elements of the matrix will be given in a list of double. I need a simple tokenizer and parser for the task naturally, but I have not much experience in parsing. I implemented the tokenizer ...

7:48 PM
This is better suited to codereview.stackexchange.comkrmogi 30 secs ago
@Duga Did they really hardcode it all?
Q: Code advice needed | Inefficient Solution - Advent of Code 2021, Day 3, Part 1

zаѓатhᵾѕтѓаMy code is working but it is extremely long. So, I guess there is a way to make it shorter/more efficient. The problem solved here is from Advent of Code 2021, Day 3, Part 1: https://adventofcode.com/2021/day/3 binary_list = open("data.txt").read().split("\n") counter_1st_bit_0 = 0 counter_1st_b...

9:31 PM
Q: Generic Base Repository implementation with Unit of Work in C#

rTECHI have seen a lot of Repository pattern implementations with Unit of Work. The simplest way of implementing this I came across is using hard-coded repos (such as this one), while the way recommended by Microsoft improves on this with a generic repo interface, but the repos themselves are still st...

2 hours later…
11:16 PM
@SᴀᴍOnᴇᴌᴀ It seemed incomplete to me.
@pacmaninbw ?

« first day (3136 days earlier)      last day (45 days later) »