« first day (2974 days earlier)      last day (1048 days later) » 

12:02 AM
REFRESH! There are 7659 unanswered questions (89.4028 answered)
 
12:41 AM
0
Q: Checking and creating a directory tree

user244080int CheckDir(const char *const Dirs[]) { struct stat Stat; const char *const Dir = *Dirs? *Dirs : HomeDir(); return (stat(Dir, &Stat) || !S_ISDIR(Stat.st_mode)) && (!*Dirs || CreateDir(Dirs+1) || mkdir(Dir, 0755))? -1 : 0; } I made HomeDir() to simply return the users home directory....

 
1:06 AM
0
Q: Text Based Minesweeper in C

a pThis is my first C program. The code works, however I'm not yet familiar with how to write idiomatic C. How should I improve this? #include <stdio.h> #include <stdlib.h> #include <time.h> #define UNCLICKED 0 #define CLICKED 1 #define FLAGGED 2 #define NOT_BOMB 0 #define BOMB 1 struct piece { ...

 
1:31 AM
1
Q: Rust Persistent Red Black Tree Implementation

SomeoneBelow is my implementation of a persistent red black tree in Rust. I have a few questions about potential improvements. Currently the data and nodes are stored in referenced counted pointers. Is this the best way to do it? On a similar note, the pattern matching statements for the balance functio...

 
1:56 AM
0
Q: Java. Using a generic call to access different distributions of random number

user02814In the code below, the primary purpose of class MyRNG is to create a single method getMyRandom() that will return a random number from any of several very different distributions and generators. The actual distribution and generator will be determined by information read from a file, although in ...

 
 
2 hours later…
3:35 AM
0
Q: Clarification on async await in C#

KimI am new to asynchronous programming in C#. In the following code, which is part of the asp.net web API, line # 13 has the await keyword. If it takes extra time, wouldn't the execution go to line #14? If it does, since the resp string will be null at this point, wouldn't it throw an error? When I...

 
4:07 AM
Monking
 
4:26 AM
0
Q: Looping through search results in Selenium

SatiThis is a follow-up of my question over here. I am extending the functionality of @Reinderien's suggested code to enable the automatic looping through of pages in the search result. I've mainly modified the final search() function (originally cnki_search) and added a number_of_articles_and_pages(...

0
Q: Killing a hydra

Mastermind817You can only kill off a given number of heads at each hit and corresponding number of heads grow back. The heads will not grow back if the hydra is left with zero heads. For example: heads = [135] hits = [25,67,1,62] growths = [15,25,15,34] Then you can kill off hits[i] heads but growths[i] head...

 
 
2 hours later…
6:55 AM
0
Q: SumList: sum of 2 numbers, rappresented with linked list, where digits are in backward order or forward order

UomolepreBackward order Example INPUT:(7->1->6) + (5->9->2) = 617+295 OUTPUT: 2->1->9 = 912 Forward order Example INPUT:(7->1->6) + (5->9->2) = 716+592 OUTPUT: 1>-3->0->8 = 1308 I'm starting with this method. I'm giving it list and size and I'm extrapolating each digit with base 10 notation. Time comp...

 
 
2 hours later…
9:22 AM
I think question about restructuring code would be a better fit for CodeReview. — maloomeister 58 secs ago
 
9:48 AM
Ok thx for the advice. But my question doesnt appear in CodeReview ?? — Cheg 62 18 secs ago
 
10:36 AM
That's why these sorts of questions aren't productive on SO. It turns into a community code review (which is off-topic for SO) for both the question and answer(s) — MickyD 43 secs ago
hello, I listened to you and posted the algorithm hereFER31 23 secs ago
 
0
Q: Java hangman rebuild OOP

Cheg 62I want to organize this code in OOP java program, what can i do for this please, have you got an advice please. Class LePendu : public class LePendu { Variable public static int NB_ERREURS_MAX=10; static ArrayList<Character> playerGuess = new ArrayList<Character>(); static ArrayList <String> wron...

 
 
2 hours later…
12:19 PM
1
Q: WPF (MVVM) - ObservableCollection does not immediately refresh DataGrid + is this adhering to MVVM design pattern?

Ole MHello! I am very confused. I am building a WPF application, trying to use the MVVM design pattern. It's fascinating and rewarding, even though it seems overly complex at times. I am new to programming, and I've only really dabbled in WinForms before this. I've been through so many changes and ada...

 
1:11 PM
@pacmaninbw A handful of my coworkers are in AZ and said that two or three weeks ago walking outside literally looked like a cinematic depiction of hell: it was hot, there were fires in the area so it was littered with smoke, and the sky and ground were an eerie red.
 
Where in Arizona?
 
Tempe, I think
 
Same area, I think Tempe is between Phoenix and Chandler.
 
When I was there for the summer in 1997 there were stack of old tires that caught fire.
Phoenix, Mesa, Tempe, Chandler and Scottsdale are all hell in the summer.
 
1:59 PM
0
Q: Python 3 script for statistiscal analysis of English vocabulary

Xeнεi ΞэnвϵςThis is a Python 3 script that statistically analyzes 105,230 words with a total of 913,935 characters, its results will be used for pseudoword generation purposes. You will need this file for it to run. This script analyzes the following things: 1, How many words contains each of the 26 letters...

 
2:23 PM
0
Q: Haskell - How to eliminate memory leak from Reinforcement Learning library

MikeRandBackground I have built a reinforcement learning library focused on playing perfect-information multiplayer games (e.g. multiplayer Nim, fantasy football drafts, etc.). Repository: gameshs At a high-level, the library works as follows: Games are represented in Rules as tuples of functions, allow...

 
2:43 PM
<onmking
 
Kaz
Monking
 
0
Q: Calculator for basic arithmetic operations

crazyrockySecond day coding so I'm new to this. I have made this simple calculator but I repeat the code in order to use the previous answer in the next calculation. I've been trying to simplify it but I can't seem to figure it out. Whatever I try breaks the code. Any feed back helps. Here is the code # Be...

 
3:05 PM
Monking
 
3:38 PM
0
Q: Optimize Javascript User Mentioning

Asakia DonateI want to replace every div with the class mention. The text should then be parsed and all the parts with @user should be replaced with a link. Here is what I have: function rstr(id){ text = id.innerHTML; replace = text.replace(/@([a-z\d_]+)/ig, '<a target="_blank" href="https://twitt...

 
4:28 PM
0
Q: Sharing an object between classes

OrryI'm trying to figure out the best way to do this and to my knowledge this is the best way I could come up with. However I think the code looks a bit too much for what is needed. Basically I need to be able to access sharedVar in class a and class b. Class a must be able to call methods from class...

0
Q: Calculate the minimum amount of billing hours. Is there any way of avoiding the nasty conditional?

devoured elysiumLet's say I'm implementing a method that calculates the number of hours I'm billing a client. I only work in blocks of K hours: public static int billing(int hours, int k) { return hours / k + (hours % k != 0 ? 1 : 0); } Is it possible to simplify this? I often find myself writing this same ...

 
5:17 PM
0
Q: Better way to accomplish linking a count to an object in SQLAlchemy?

n1c9I'm not sure if the problem here is how I'm wording the question or going about finding an answer, but I have what I think is a relatively trivial task: getting fact-check claims from the Google Fact Check API, saving them in a database and then using that database to get the counts of fact check...

 
6:15 PM
Ben Popper on June 25, 2021
We spent over a hundred hours in 1-on-1 interviews and collected thousands of survey responses to better understand what our community and customers wanted to see in this product. This feedback shaped everything from naming to moderation, and helped us evolve and iterate the concept into what it is today.
 
possible answer invalidation by Arnon De Paula on question by user4602966: codereview.stackexchange.com/posts/253162/revisions
 
7:02 PM
@Duga Didn't touch anything in the answer, slight reformatting of the code.
 
@pacmaninbw No AI for sure. However only OPs are allowed to edit code in questions.
 
7:22 PM
0
Q: How to print integer within a string. Keep getting error

crazyrockyI have a text adventure I'm working on and after a choice is made by the user that would result in damage the output isn't working. I've tried to float as well. I must be doing something very simple wrong. Here is the code that's relevant. I also included the error I am receiving. """ lvl = 1 kil...

 
@CaptainObvious 🔨
 
 
1 hour later…
8:36 PM
0
Q: Java Simple Stats Program

war crimeThis is a simple Java program I made that takes in any number, and when it gets to 0, it returns the quantity of the numbers, the min, max, sum, and average of the numbers. Are there any ways how I can make the code more readable or improve the performance? import java.util.Scanner; public class...

 
 
2 hours later…
10:16 PM
0
Q: ReactJS Conditional CSS Classes

BonteqI'm starting to learn React/NextJS and find the way to write conditional CSS very ugly compared to VueJS. I'm curious if someone could look over this code snippet and guide me in the right direction towards a cleaner way of designing my React code. <Link key={link.text} href={link.to}> <a cla...

0
Q: Ncurses listview control

766F6964I am currently developing a terminal-based listview control, that uses ncurses for rendering. The main goal for the listview was to be intuitive, performant, and reusable for other projects. An example, is shown below: listview.c #include "listview.h" #include <ncurses.h> #include <string.h> #in...

0
Q: Python script which sends telegram message if Raspberry Pi's temperature crosses 60 C

Aditya SahuI need to know if there is any way I can optimize my code so that it does not use 0.6% of my total memory - which is approx. 22.4MB. This is a really small script that runs for as long as the raspberry pi is ON. 22.4MB for this basic, simple, light code is too much. If less or no optimization is ...

 
 
1 hour later…
11:23 PM
 
11:35 PM
I’m voting to close this question because based on the request and the fact there are so many issues with the code, such a question is too broad and any re-write would essentially become a code review which is sadly off-topic for SO. How to AskMickyD 7 secs ago
 
@RMunroe Wat.... empty title???
 
11:57 PM
0
Q: Python app thats simulate simple Stock Exchange

Monty_emmaI wrote this simple app for creating a Stock Exchange platform. It is written with a flask framework. My main concerns are regarding the user_page route which feels too long and not DRY enough, But on the other hand, I can't find a pythonic elegant way to clean it. I would really appreciate your ...

 

« first day (2974 days earlier)      last day (1048 days later) »