« first day (2880 days earlier)      last day (1136 days later) » 

12:00 AM
RELOAD! There are 7445 unanswered questions (89.5176% answered)
 
0
Q: Get default value from query params + repeating code

PaulThe main goal of this task is to take values from the query parameter and put it in inputu. The first problem is that I don't know much about how to do it so that the code doesn't repeat itself and I don't know how specifically I could improve the code so that multiple things don't happen again. ...

 
1:00 AM
0
Q: Guidance to implement Ordinary least squares more efficiently

Ryan McAleerI have implemented a program that carries out ordinary least squares in raw python (but using numpy arrays rather than lists). I would like for my code to be critiqued by the community. What is a faster/more efficient way to implement ordinary least squares than what I have done in my code snippe...

 
1:11 AM
There is a Stack site exactly for this:Code Review. You should read their help centre before posting: I'm pretty sure they wont take kindly to posted links instead of code. — Tangentially Perpendicular 35 secs ago
 
 
2 hours later…
3:06 AM
0
Q: Efficiently calculate value of Pascal's Triangle using memoization and recursion(updated)

Martin BorosFollow up to Efficiently calculate value of Pascal's Triangle using memoization and recursion Based on feedback given by jvwh in the answers def pascal(c: Int, r: Int): Int = { if (c < 0 || r < 0 || c > r) throw new IllegalArgumentException() // use a cache; map (c,r) pair to value // fill ...

 
 
1 hour later…
 
1 hour later…
6:03 AM
0
Q: A batch_recursive_count_if Function with Unwrap Level for Various Type Arbitrary Nested Iterable Implementation in C++

JimmyHuThis is a follow-up question for A recursive_count_if Function For Various Type Arbitrary Nested Iterable Implementation in C++ and A recursive_count_if Function with Unwrap Level for Various Type Arbitrary Nested Iterable Implementation in C++. The function recursive_count_if is Implemented with...

 
6:22 AM
While this is not a code review site, my basic advice is: (A) lay out your code correctly; (B) choose meaningful variable names so you don't need to describe them in comments; (C) lose the same-line comments -- prefer to write a single comment of 2 or 3 lines followed by a block of code that does whatever is described; (D) for(int k = 0; k < tcount; ++k); is the same as k = tcount;; (E) variable-length arrays are not standard C++; (E) you are not calculating a rolling average -- you're just finding unfiltered local maxima; (F) normalised is size k, so assigning normalised[k] is BAD. — paddy 15 secs ago
 
6:53 AM
0
Q: Rock-Paper-Scissor-Lizard-Spock in Kotlin

Kishore kichuI have made a simple Kotlin application called Rock-Paper-Scissor-Lizard-Spock. The application takes in user input and check if belongs to given set of array. If it belongs then it compares user input and random value from array to generate result. Else it prints error and asks for user input ag...

 
 
2 hours later…
8:42 AM
You are probably looking for Code Review community. — Daweed 30 secs ago
I would suggest moving this to codereview. — Ecto 37 secs ago
 
8:59 AM
0
Q: Any better way to rewrite my code inside viewset

Amine BouhaddiIs there any better way to re-write my code : class ContactView(viewsets.ViewSet): @action(methods=['get'], detail=False) def filter(self, request, pk=None): search = request.query_params.get('search') print(search) queryset = Contact.objects.all().filter( Q(first_name__iconta...

0
Q: From Hummingbirds to Ornithopters: Simulating the Aerodynamics of Flapping Wings

wingedNorthropiPtera Software A Flapping Wing Aerodynamics Simulator Written in Python Motivation About a year ago, I became fascinated by how animals fly. As an aerospace engineering student, it surprised me that natural flight was barely covered in my courses. I soon realized that the reason why flapping wi...

 
"code way more compact" - codereview. — Sinatr 41 secs ago
 
9:25 AM
0
Q: Finding the ' Multiplicative persistence ' of a number

LOHOI was trying to find the multiplicative persistence of a number(i.e.. How many iterations of creating a new number from multiplying the digits of a given number will end up in a single digit number?). I came up with the following code. I orginally meant it for giving a certain number for Multipli...

 
9:59 AM
 
10:46 AM
You would need to parse the string. One option for parsing the arithmetic expression is the shunting-yard algorithm. I have implemented the algorithm in C. — Andy Sukowski-Bang 6 secs ago
 
11:42 AM
Like before, this code contains many bad practices, starting from a REAL BAD one. This code doesn't verify the uploaded file type, hence allowing a blatant php file upload. including php files based on the users choice is also a security breach. You'd have better luck posting your code on codereview.stackexchange.com first, and asking for the suggestions — Your Common Sense 12 secs ago
 
12:23 PM
0
Q: Split fiunction using C and dynamic memory allocation

MajdI have programmed the Split function in C, and since i'm getting correct output. I am looking forward to write better code and I was told here is a good place to start. Here's my program: #include <stdio.h> #include <stdlib.h> #include <string.h> char **split(char *str) { int str_length = 0;...

 
12:48 PM
0
Q: Is this version of bubbleSort better than the original one?

Harwin Sodhirecently started data structures and did my version of bubbleSort. I just want to know if it is any good or should i[![enter image description here][1]][1]just stick to the original two for loop one ? public static void bubbleSort(int[] a) { int endPoint = a.length - 1; int cursor = 0; ...

0
Q: Java: GUI Guessing Game

A.F17when I press run and enter a number in the text box the whole program freezes. I think it is an issue with the actionListener for the 'Guessing Game' as without the code there it runs fine however I cannot see the issue. Any help would be really appreciated. class GuessingGameGUI extends JFrame {...

 
12:58 PM
It looks like my memory leak is coming from somewhere other than realloc then... I will post my code in codereview.SE — theonlygusti 26 secs ago
 
 
1 hour later…
2:13 PM
I would advise you to post your code on the Code Review Stack Exchange instead, as it already works and therefort doesn't fit on Stack Overflow. — Andy Sukowski-Bang 27 secs ago
 
2:26 PM
See codereview.stackexchange.com/a/47345/30683 for a slightly less efficient answer that is easier to implement / understand. — Gili just now
 
2:54 PM
0
Q: Game with shuffles set of cards and draw a card one at a time from a unique deck of cards

Mj _So I am trying to create a small C# application which generates a deck of cards, and ask to the user if they want to shuffle the deck, and then display 1 card at a time to the user. Would this be effective use of classes 4 rules of oop? Thanks using System; using System.Collections.Generic; using...

 
3:45 PM
0
Q: no output for existing substring is a main string python

ApexI build a code to print strings if a substring exists at a particular section of the main string. I have a file as below and I create 5 alphabet substrings (5mers) from the seq11_rv. >seq11_fw TCAGATGTGTATAAGAGACAGTTATTAGCCGGTTCCAGGTATGCAGTATGAGAA >seq11_rv GAGATTATGTGGGAAAGTTCATGGAATCGAGCGGAGATG...

0
Q: How to make this C code faster (modified BSF algo for weighted graphs)?

Данил ЧеркашинI have a C code, that takes edges of weighted graph and some point a It returns minimal distances from point a to others and previous point in way, which have minimal length (best way) for example if best way is a -> b -> c previous point for a is null/-1/-2 ... previous point for b is a previo...

 
Greetings, Programs.
 
Greetings
 
4:10 PM
0
Q: Is it bad practice to make get and set methods inline?

Argenis PieternellaI use this class to pass around information. Is it a bad practice if the getter and setter are inline? they are the only method of the class. #define DEVICEINFORMATION_H #include "DateInformation.h" #include "TimeInformation.h" enum class DEVICEMODE { SLEEP, CLOCK, STOPWATCH }; class Dev...

 
 
1 hour later…
5:11 PM
Code Review is the best place to ask for help improving working code. — Barmar 13 secs ago
 
Monk
 
First, please clean up your code so that it's easier to read. Use meaningful variable names and a clear description. Your logic has a gap at price 200. You're using bit logic (&) instead of Boolean (and), and ... well, this really belongs on StackExchange.CodeReview, rather than Stack Overflow. — Prune 31 secs ago
 
5:29 PM
The close percentage has gone up somewhat dramatically in the past 1-2 days... it almost seems like September again
 
5:47 PM
posted on March 23, 2021

We’ll be doing a planned failover of our SQL Servers at 1am UTC (March 27, 2021) / 9pm EDT (March 26, 2021) which will require us to go read-only for a few minutes. The disruption should be quick. For more details, see our post on Meta Stack Exchange.

 
0
Q: Reading stdout and stderr of a sub process using Win32, Overlapped I/O

user11693I'm writing C++ Windows code that will start a process, then read its stdout and stderr, separately, into buffers. If I try to just read the streams one at a time it may hang if the child process is trying to write to the other stream. So I learned I need to create named pipes, and then make call...

 
6:17 PM
0
Q: Improve my code with Python using constructor

Arturo RenteríaI would like to know, how could improve this coding using a constructor? This code works for a conversion factors in physic. This is my code: # physic_convertions.py import numpy as np class Length: global factors global units factors = np.array([[1.0, 1.0e2, 1.0e-3...

 
@CaptainObvious like I tell my 3.5 year-old son: That sounds like a command...
ah... migrated from SO... user not registered here (yet)
 
6:49 PM
Poor migration too...
@SᴀᴍOnᴇᴌᴀ I'm tempted to close it for lack of description.
 
should we ask the mod that migrated it to make such posts on topic before migrating?
 
@SᴀᴍOnᴇᴌᴀ Only if the question does indeed get closed.
 
Don't count your chickens before they hatch.
I've left a bunch of comments...
 
7:33 PM
0
Q: Radix Sort Speed

Sola SkyI have implemented a radix sort algorithm in Python 3. It first finds the maximum number of digits in the list, then changes them to strings and adds 0's. For example, [7, 23, 107, 1, 53] to ['007', '023', '107', '001', '053']. I then make a new matrix, [[] * 10]. I append the numbers with last ...

 
Ben Popper on March 23, 2021
In this session, we will turn our static drawings into animations!
 
8:23 PM
0
Q: Python shape detector code

mattsmith5I am writing an object oriented shape detector, first time in Python. I come from a Java background. Can you provide any coding advice? https://www.pyimagesearch.com/2016/02/08/opencv-shape-detection/ @dataclass(init=False) class ShapeModel(DrawingItem): drawingItemId: int vertices: List[...

 
8:48 PM
0
Q: HTML parser written in JavaScript that takes in strings and output a DOM tree object

JojiI wrote an HTML parser in JavaScript, where it takes an a string that represents the HTML const html = `<div> <div> foo </div> <div> bar </div> </div>` And it should output an object like this { children: [ { children: ['foo'], value: 'div' }, { children: ['bar'], value: 'div' }...

 
 
1 hour later…
10:05 PM
Please repeat on topic and how to ask from the intro tour. “Please rewrite my code” is not a Stack Overflow issue. We expect you to make an honest attempt, and then ask a specific question about your algorithm or technique. Stack Overflow is not intended to replace existing documentation and tutorials. Improvement of working code belongs on the CodeReview site -- but you need to read and follow their posting standards, just as ours. — Prune 31 secs ago
 
@Duga yet there are often users like Cute Panda to help :|
 
10:32 PM
@SᴀᴍOnᴇᴌᴀ I don't usually use the Mobile Browser often. I find that if I need the browser versus an App, that I would rather have a keyboard and mouse.
 
I've gotten used to it
sometimes I connect to my work PC over remote desktop from iOS - typically my iPad but occasionally on my iPhone
 
very cool
I haven't had the need to try and RDP into anything from my phone in quite some time.
I was able to do it with Azure when I was playing around with setting up a Minecraft Server about 2 years ago
 
I remember telling our lead developer about it the first time I did it ... maybe 8 years ago... he was joking about me sitting in the back of a meeting controlling servers... which we actually did a few times :)
4
that's probably as close as I will get to feeling like James Bond controlling his car from his phone
 
I've done Deployments from my phone during meetings (in meeting rooms before COVID)
that's always fun
like Tony Stark when he takes over the TVs in that hearing at the start of Iron Man 2 (iirc)
 
11:20 PM
You should post this to Code Review, not here. — postanote 29 secs ago
 
0
Q: PHP if else else if not working - only 1 statement works

twelvellI have been struggling with this code and only if ($per_unit_or_square == 'blank') { is working. Why? What I have done wrong here? $qty = $item->get_quantity(); $qty77 = wc_format_decimal($item->get_quantity(), 3 ); // quantity with decimal value $refunded_qty = $order->get_qty_re...

 
@postanote when suggesting users post on CR it would be great if there was also a suggestion like "Please read the relevant help center pages like 'What topics can I ask about here?' and 'How do I ask a good question?". In the current form the code above would likely be closed as off-topic because it is missing context which happens all too often. — Sᴀᴍ Onᴇᴌᴀ 40 secs ago
 

« first day (2880 days earlier)      last day (1136 days later) »