# All Questions

75,566 questions
Filter by
Sorted by
Tagged with
14 views

### Pandas str.replace regex method on a series

I have a df where I'm cleaning raw data pulled from a data source. I apply a function to a series after. In order to get the data to fit the proper function parameters (a custom function) I need the ...
• 99
16 views

### How can I find the Fibonacci values for every index in the limit range and print the sum of all even Fibonacci numbers in Py3? [closed]

Hi I need to find all the corresponding Fibonacci values up to a given limit in a sequence and return / print the sum of all even Fibonacci numbers. this is the code I have so far: ...
17 views

### In python3/argparse module, how can I differentiate between action='store' args and action='append' args [closed]

I want to differentiate between argparse args marked as action='store' -vs- args marked as action='append'. Clearly they are very different in how they behave and are stored, but is there a way to ...
13 views

### JavaFX Spell Checker

I have a functional spell checker here. I'd like another set of eyes on this. Is there any way to reduce the memory footprint of this or improve the performance without sacrificing readability and ...
• 101
34 views

### Sieve of Atkin C#

I don't fully understand how to make the Sieve of Atkin faster than the most ancient sieve. All implementations I found online where slower than the one I made, but still It isn't faster than ...
5 views

### Feature extraction BoW with dende sift

I am trying to use the code proposed by [ https://github.com/gurkandemir/Bag-of-Visual-Words][1] and to compute a dense SIFT descriptor. The aim is to obtain a vocabulary building and a histogram ...
• 1
20 views

### R: Function to return the category that has the maximum in another variable

Is there a nice simple function to return which diet has the highest average? I can calculate the means from each diet using: ...
• 21
53 views

### The largest palindrome made from the product of two 3-digit numbers

Problem description: A palindromic number reads the same both ways. The largest palindrome made from the product of two 2-digit numbers is 9009 = 91 × 99. Find the largest palindrome made from the ...
2 views

### Barabási–Albert model : Exponent value is not coming right as suggested by theoretical suggestion [closed]

i'm writing code for Barabási–Albert(BA) model, i checked the degree distribution its power law but the exponent gamma is (1.5) and the condition it should be between (2-3), can anyone tell me what ...
1 vote
24 views

### Basic OpenGL application that renders multiple cubes on a textured plane, setup for a 3D game

I'm learning OpenGL and started work on a small 3D game (like Sokoban) for practice. I want to know if the design of my OpenGL code reflects a good understanding of the technology. For example, one ...
• 11
25 views

### Cows and bulls game in JavaScript

I've been working on this game the last 2 days. The game is working but I need a feedback for my code. Can it be made simpler? Sorry if my code is very complicated or not well written: I am in the ...
13 views

### Codeforces 1574B [closed]

The following Python code is my solution to this code forces problem: https://codeforces.com/problemset/problem/1574/B. I coded the same thing as the tutorial (https://codeforces.com/blog/entry/95188),...
19 views

### How to add RMSE to python code? [closed]

I want to add RMSE into the python code. I've tried inserting the rmse code below but i got error only. How do i insert rmse into the whole proper code ? ...
26 views

### Playing a game of ConHex in Python

Background ConHex is game by Michail Antonow where two players try to create a connected chain of cells from one side of the board to the other side. They do this by claiming one empty position each ...
• 401
13 views

### java String default value in for each loop [closed]

what is the default value in x in this for each loop ...
48 views

### AES GCM C++ implementation

I have written a C++ program that uses the Crypto++ library to encrypt files using AES-256Bit (in GCM mode). I am planning to eventually have the program store the keys for the files in a file e.g. ...
• 11
47 views

### improved "tee" utility

We have modified the tee program with your suggestions from the previous pull request. Did I implement well? I would like to optimize the program even more, what ...
• 179
15 views

### daemon in a producer-consumer

The daemon program is associated with a message queue with a predefined key, to be blocked later when waiting for messages. The two programs implement a producer-...
• 179
13 views

### Resources/Advice for Stochastic Simulation Python [closed]

I am quite new to writing code and I am trying to reproduce the simulations found in Fig.2 of this paper on the age incidence of CML (https://www.pnas.org/doi/pdf/10.1073/pnas.0607006103). I think I'...
36 views

### Can I optimize my implementation of generating Fibonacci series using recursion?

My function accepts a number, which generates total Fibonacci numbers. I am using recursion. Please follow the code below, ...
89 views

### Calculate the first largest factor of 600851475143

ٍProblem description: The prime factors of 13195 are 5, 7, 13 and 29. Largest prime factor 13195 is 29. What is the largest prime factor of the number 600851475143 ? Prime Factor: any of the prime ...
18 views

### Closing handles in Powershell; handling partial cases in a DRY fashion [closed]

Powershell contains no "goto" statement which is the normal way C++ code closes or 'frees' handles at the end of functions that use several or many handles (pointers). When interating with ...
• 109
15 views

### Rust program to print citations in Chicago author-date style

I have written a Rust program that lets you input a citation's metadata in a Bibtex-like format and generates a bibliography entry formatted in Markdown that conforms (more or less) to the Chicago ...
• 195
214 views

### Kosaraju's algorithm in C simple implementation

I am wondering can I please get some feedback for my simple implementation of the Kosaraju algorithm. More specifically how I de-allocate the things I allocated using ...
• 359
39 views

### Is this a correct implementation of factory method pattern? [closed]

Below, I have an implementation of the factory method pattern in Python. I don't like that I have to pass to get_instance the data object always with communities ...
21 views

### Basic authentication used to call a REST API, but how to determine if a wrong password is entered? [closed]

I'm using the following HTTP Basic Authentication with PHP to prompt the user for a username & password which is then passed to a REST API call to start or stop a process. As written this works ...
666 views

### A probability distribution function, to be called repeatedly during numerical integration

I am trying to speed up as much a possible this function in C++. As I explained in another post, Implementing multidimensional integral for a custom function in C++, this function will be used inside ...
• 289
41 views

### Correct usage of Java Generics for a simple cache holding objects of any particular type that contain an identifier of any particular type

The Stack Overflow question, I'm trying to create an inMemory database using Collections and generics, presents some code that attempts to use Java Generics for an in-memory cache of objects of any ...
34 views

### Magic Class Invoker for procedural script

I have inherited a project in bad conditions that contains the following class and I need your help to improve it, the truth is I don't know if it is correctly optimized or if it has security problems ...
• 111
23 views

### Python Data structure(Cannot understand one input in the solution) [closed]

You are analyzing sales data from a ticket office. The ticket for an adult is $20, while the ticket for a child under 18 is$5. The data you are given is in a dictionary format, where the keys are the ...
1 vote
48 views

### Hash game in C optimization

I developed this hash game in C for my college, but i need to optimize this code, can you help me? it works well, but I need it to be a little more organized and faster, the rand function is the only ...
27 views

### Python function that skews an image while preserving its aspect ratio using affine transformation

See this post for more details. I re-implemented my idea using affine transformations, and finally understood how transformation matrices are formed... Turns out it is stupidly simple, but nothing I ...
• 1,522
1 vote
24 views

### Process a binary file by chunk using a read stream in nodejs

I want to process a file chunk by chunk to prevent memory exhaustion. I need to consume the file using a read stream. When trying it, this implementation seems to work fine. I am asking your expert ...
• 143
1 vote
28 views

### Event handler for client webrtc video chat

This is my event handler for a videochat client that takes all the events that the server throws at us and routes them to different functions. All of the functions are imported and both settings and ...
• 11
81 views

### Calculate the sum of even Fibonacci numbers

This is my solution for problem 2 of Project Euler using Python: ...
18 views

### php flock with two instances [closed]

I am calling this script as "php flock.php" while logged in from ssh. for the past couple of days I've been trying to get the "Can't run, sorry" from one instance but both just ...
9 views

### Using Kotlin coroutines, is this the proper way to schedule a task whose result you don't care about inside a suspend function? [closed]

I'm kind of trying to simulate getting cached stuff from some cache and then update the UI and the cache with a webservice call. I'm wondering if this "skeleton" of doing it is fine. Is it ...
46 views

### Function that calculates the least amount of notes a ATM will dispense for a given amount

This is the code currently and it works. Currently have a DB with the type of note and the amount of that note available. This will, later on, remove the amounts of notes from the DB. I am happy with ...
23 views

### Validation rules for payment cards in a data set

I have the following part of code. I dislike this, because if I need to add additional validation rule, I have to make changes in loop and create a varaible to store boolean result. For example check ...
16 views

### pending signals using the sigpending() function

I used the sigpending () function in the next program to check the signals waiting at 1s intervals and display their numbers, then it ends with ...
275 views

### Project Euler - Problem #1 - Multiples of 3 or 5 - Python

This is my solution for problem 1 of the projectEuler with python: ...
41 views

### Changing the attributes of a file

I wrote a program that changes the attributes of a file. How can I make the program more efficient? Please find program problems. How can I improve the program? ...
• 51
69 views

### Recursively search directories and their subdirectories for images and videos, except system or locked folders

Search directories and their subdirectories for images and videos, except: Windows system folders, locked folders, and folders selected by me. For example, as a developer I have dozens of Visual ...
• 175
1 vote
32 views

### Multithreaded tcp server accepting two clients with task factory and graceful shutdown

as an exercise from multithreading and networking I have decided to create my own implementation of TCP server accepting connections from two clients (which is I think a pretty common case e.g. chess ...
• 11
1 vote
18 views

### Scala & Kafka: Getting the producer and consumer offset difference and log it

I'm looking to compare kafka's producer and consumer ...
• 111
6 views

### Getting "Cannot invoke "String.equalsIgnoreCase(String)" because "this.a" is null" error [closed]

enter code here package practice; import java.util.Scanner; import org.openqa.selenium.WebDriver; import org.openqa.selenium.chrome.ChromeDriver; import org.openqa....
28 views

### Integer array to string

This function creates takes an int * buffer and creates a neatly formatted string (useful for printing the contents of an array). Is the code easy to follow? Is it ...
• 155
154 views

### Dart Ioc Container

This package is on pub dev here It's on Github here ...
13 views

### How do I make this jQuery not wait for document [closed]

I'm trying to not make the document wait until it's completely finished loading, I just want the code to run normally, how can I modify this code so that the document isn't waiting? ...
1 vote