« first day (2862 days earlier)      last day (1140 days later) » 

12:00 AM
RELOAD! There are 7369 unanswered questions (89.5840% answered)
 
 
2 hours later…
1:34 AM
0
Q: Optimising Prefix Sum

JackI have a question: Starting with a 1-indexed array of zeros and a list of operations, for each operation add a value to each the array element between two given indices, inclusive. Once all operations have been performed, return the maximum value in the array. Given some queries in the form [a,b,...

0
Q: Mastering PHP procedural style

user13477176I have been using PHP for a while now. I thought I had the basics already down pack but someone told me that I am not skilled or have enough knowledge yet. Does anyone know a good place to start over with the basics ? I have been on w3schools and tutorial republic is that a good place to start ? ...

 
 
2 hours later…
3:41 AM
0
Q: After removing text from file, how to remove empty lines from file using python

chitraI am removing content from file and rewriting using python This is the initial script [Property file] username=admin pwd=admin host1=0.0.0.0 host2=1.1.1.1 I am changing host values.After changing through python script script, white spaces are creating [Property file] username=admin pwd=admin h...

 
4:15 AM
Please review stackoverflow.com/help/minimal-reproducible-example. I answered your questions below, if it was helpful accept & upvote, then create a new question if you need more help. Post error messages in-line rather than screen shots. This is not a forum for code review, so when you post a lot of irrelevant code like you did most people will tune out or downvote the question. — Allan Wind 58 secs ago
 
4:41 AM
Monking
 
 
1 hour later…
6:14 AM
0
Q: Bar chart - can we simplify?

user3225309I have a dataframe: >>> import pandas as pd >>> import plotly.express as px >>> df = pd.DataFrame({ ... 'P': ['P1', 'P2', 'P3'], ... 'Q1': [1, 2, 3], ... 'Q2': [3, 1, 2], ... }) >>> df P Q1 Q2 0 P1 1 3 1 P2 2 1 2 P3 3 2 >>> For each row, I should sort Qx columns ...

 
7:05 AM
0
Q: Doing a qsort function to compare strings, case insensitive

David542How does the following C program look to compare to strings and return a case-insensitive sort? The following is what I have so far: int main(void) { char* strings[4] = {"Onus", "deacon", "Alex", "zebra"}; for (int i=0; i<4; i++) printf("%d. %s\n", i+1, strings[i]); qsort(strings, 4, ...

 
7:56 AM
0
Q: JavaScript: A drawing program in OOP

JojiI made a little drawing program in OOP. The game consists of a canvas which is basically a 2d array where the user can draw various shapes on it. There can be multiple shapes overlapped on top of each other at the same spot. The shape that was drawn the last would appear on the top of the canvas ...

 
possible answer invalidation by Bebert Beberr on question by Bebert Beberr: codereview.stackexchange.com/posts/256728/revisions
 
8:47 AM
0
Q: Vanilla JS Tic Tac Toe

LearningPythonI would appreciate a code review - specifically of the javascript - for a tic tac toe game that I have built. I am looking for feedback on where improvements can be made in the overall structure, syntax, and style of code. View the whole app on codepen here, with html/css included: https://codepe...

 
9:12 AM
0
Q: How to write a dictionnary of object instances describing geometrical shapes

HcNMy current position implies a lot of programming but I lack formal knowledge concerning how to properly code, and this is the object of my question. I believe the form of my code could be improved. As a result, here is a much simplified version of the program I am writting, that shares the same s...

 
10:03 AM
0
Q: Javascript Factory Pattern - am I doing it right?

kabaneriI would like to ask more experienced people with Javascript about Factory pattern and am I doing it right? The code that I've written is basically doing some function async based on input files and gives the output; Is my code good regarding the Factory Pattern? What improvements can be done in m...

 
10:55 AM
0
Q: Simple sort in c

Ashiful Islam PrinceProblem : Read three integers and sort them in ascending order. After, print these values in ascending order, a blank line and then the values in the sequence as they were inputted. input: 7 21 -14 output: -14 7 21 7 21 -14 I have solved this problem in...

0
Q: Software-implemented Phase-shifted PWM for Heater

KodiakThe provided code controls a 3-phase heater by generating a PWM signal (in software) which controls 3 triacs that are connected to the heater. Between the MCU (running Zephyr RTOS) and the triacs is a PCF8574 IO extender. The idea is to simply tell the heater module which percentage of power is d...

 
"Please can you help me opimize it better because it's too slow" if you're looking for code review then you should have posted your question at Code Review Stack Exchange. You'll probably find more people engaging there. — Definitely not Rafal 33 secs ago
 
11:20 AM
0
Q: Optimize my PHP function

s_a_i_di made this function to test if the content has 301 redirections.. Please can you help me opimize it better because it's too slow function contains_http_301_link($content, $current_site){ $pattern = '~<a(.*?)href="([^"]+)"(.*?)>~'; $links = array(); // Check if there is a url in the content if(pr...

 
11:46 AM
0
Q: Safe implementation of conditional variable

MaximIs my implementation of conditional variable safe? It was too hard to implement, and I still not sure I'm correct. The main problem is "atomic mutex unlock". I tried to implement a kind of "notification queue" is order to get all notifications. (Notification won't be send until the queue is not e...

 
 
1 hour later…
12:55 PM
Greetings, Programs.
 
0
Q: Fast bruth force numpy array combination

snowflakeI want to extract combinations of numpy arrays in that way: from itertools import combinations import numpy as np X = np.array(np.random.randn(4, 6)) combination = np.array([X[:, [i, j]] for i, j in combinations(range(X.shape[1]), 2)]) Is there a way to speed? My array has a shape of 200x50000.

 
 
1 hour later…
2:03 PM
What is the question? Does this work as intended? Are you simply looking to improve the look and execution of your code? If so, please use [CodeReview][codereview.stackexchange.com] — wundermahn 32 secs ago
 
posted on March 05, 2021 by CommitStrip

 
3:11 PM
0
Q: High code complexity SonarLint

new_here6432I am a beginner coder and SonarLint tells me code is too complex. I tried recursion, iterators, slicing but had not luck making this code any simpler. Can someone help me? txt = "A **A** is *italic* **bold** but some are *a* *b* **B**" def fun(text=None): if text: bold_splits = text.split('*...

0
Q: scatter subplot for iris dataset

shahab shahroodiI'm new to data science. I wrote this script for plotting all different kinds of iris data set scatter plot. trying not to plot something with itself . how can I optimize my code ? '''python from sklearn.datasets import load_iris import matplotlib.pyplot as plt import numpy as np ...

 
3:27 PM
Try codereview, but imho if it works it works, I personally like to keep a cached state and only fetch the newly requested data and append when required but sometimes that is extra work as well. KISS. — Xorifelse 57 secs ago
 
0
Q: How do I fetch data (via GET) after some React state updates?

devwalWhen a user clicks one of the orderBy buttons (by name/email/date) - the user should get a new rendered result from the server (sending a new get request) - and the same goes for the page pagination. setting this.setState({ [thestate]: [newStateVar] }) doesn't do the job by itself ;) So is it "a ...

 
3:44 PM
Medi Madelen Gwosdz on March 05, 2021
Welcome to ISSUE #63 of the Overflow! This newsletter is by developers, for developers, written and curated by the Stack Overflow team and Cassidy Williams at Netlify. This week, Part 2 of our Level Up series digs into Python libraries, a passionate article argues Java is great for low latency systems, and the podcast team discusses the security…
 
4:04 PM
Happy Friday!
 
4:27 PM
0
Q: Semaphores: What makes these java version faster than its c++ equivalent?

Antonin GAVRELThese functions are answers from other users for this problem from leetcode. Both functions use the same algorithm and semaphore, yet java outperform its c++ equivalent by a wide margin (14ms for java, 228 ms for c++). Is there something that was left unoptimized in the C++ functions ? c++ #include<

0
Q: change input value simultaneously when modifying one of them

wilbert palaciosthe following code lists multiple data which must be multiplied by the number that is added in Nbatida, but my code lists all the data separately since to each one I must add how many times it must be multiplied and I would like to do it only adding once and it takes that value and implements it ...

 
@CaptainObvious AOC
@CaptainObvious CNWAI - now RBA after my comment
 
Might be better asked on codereview.stackexchange.com. I don't see anything particularly LINQ-y about this code, although the empty list aggregation is neat. A shorter version: pastebin.com/cSyhSBkXIan Kemp 1 min ago
 
Tomorrow will be day 365 that I've logged into code review in a row.
 
4:42 PM
@SᴀᴍOnᴇᴌᴀ Thanks
@pacmaninbw Congrats for tomorrow, maybe we need a platinum badge Ultra Fanatic
 
@SᴀᴍOnᴇᴌᴀ That's old.
 
I know... I'm a necromancer
 
Nothing wrong with mancing necros and killing zombies.
2
 
5:18 PM
0
Q: Linq query to merge overlapping elements

ArcordI have this class representing a period of time: public class Period { public Period(DateTime dateFrom) { DateFrom = dateFrom; } public Period(DateTime dateFrom, DateTime? dateTo) { DateFrom = dateFrom; DateTo = dateTo; } public Period() { } ...

 
6:09 PM
@Peilonrayz It's a nice idea, but the more I think about it, it's changing one big problem for many smaller ones.
 
@Mast I recall hearing; problem solving is breaking big problems into smaller ones, and fixing the smaller ones. But if you can solve the big problem another way great :)
 
6:28 PM
If the code is not too long, maybe ask on codereview.stackexchange.com ? — Guillaume 58 secs ago
 
6:54 PM
@Peilonrayz That's true.
Grmpf
Why must improving personal workflow always be this involved.
 
7:24 PM
@Mast The more exposure to IT I get the more I think that.
 
0
Q: "Digit Queries" CSES Solution giving TLE

t.y.lerI really need a more accurate way to size inf_string. This code works but gets exponentially more inefficient the bigger max(queries) is, and therefore just can't hold up to the gargantuan numbers that CSES throws into it. Problem: Consider an infinite string that consists of all positive integer...

 
7:51 PM
0
Q: What could be better?

Mohamed TawousThis is my first ever python program and I wanted to get everyone's opinions on it. The goal of the program is to separate an email address into its username and domain name. import sys import getopt argv = sys.argv[1:] # -------Error Handling-Start---------- try: opts, args = getopt.getopt...

0
Q: Implementation of a contour plot [Python]

WaneI am trying to make a contour plot using meshgrid with Python. My dependent variable is not a direct function of the two, but I enter the values by hand. Consider the following example code: import numpy as np import matplotlib.pyplot as plt Array1 = np.arange(-5,5,0.5) Array2 = np.arange(-5,5,0...

 
@CaptainObvious pizza?
@CaptainObvious AOC
 
@Peilonrayz I feel like I'm going about this all wrong too. Years ago, when I first ran into virtual desktops on openSUSE, I'd log into multiple machines at once, effortless, network them together and keep all windows, graphical or not, on the host computer. I'd set apart multiple desktops per machine, but none of that was actually enforced because they all showed on the host anyway.
It worked perfectly.
And that was years ago.
The current situations feels like a couple steps back.
 
8:10 PM
@Mast I assume you'd be using X forwarding? Windows doesn't allow you to forward the display server like X so you have to have the window in a window pattern
 
0
Q: Slow Node dropping Linked List

cdecompiladorI've been experimenting with data structures in rust with the guide of "Learning rust by writting too many linked lists", first implementing it by myself and then like the page says. Doing this I've found something weird, my implementation for the drop of the List (needed otherwise its tail recur...

 
8:42 PM
0
Q: DOI name validation with pydantic

political scientistI'm trying to understand how to use pydantic for data parsing & validation. The idea I had in mind was following: I have a list of DOI names for which I need to collect metadata I could use pydantic to test if the DOI name is valid if it's valid, I proceed with making a request to scite api if ...

 
 
2 hours later…
10:24 PM
0
Q: LeetCode: range sum query mutable c#

Giladhttps://leetcode.com/problems/range-sum-query-mutable/ I am trying to solve this question using dynamic programming. I guess the guys in leetcode wants to limit us to use segment tree or one of the other solutions. using Microsoft.VisualStudio.TestTools.UnitTesting; using System; namespace Dynam...

 
10:50 PM
0
Q: Export/Import Rubberduck VBA Virtual Folder Structure with Library References to/from Project Folder on Hard Drive

PChemGuyRubberduck VBA permits creation of virtual project hierarchy within the IDE, but the project is imported/exported as a single folder with all files. Sometimes, direct access to the project folder is useful, in which case having materialized project structure on hard drive is helpful. For example,...

 

« first day (2862 days earlier)      last day (1140 days later) »