All Questions

Filter by
Sorted by
Tagged with
-1 votes
0 answers
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 ...
user avatar
-1 votes
0 answers
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: ...
user avatar
-1 votes
0 answers
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 ...
user avatar
0 votes
0 answers
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 ...
user avatar
  • 101
0 votes
0 answers
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 ...
user avatar
-1 votes
0 answers
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 ...
user avatar
  • 1
2 votes
1 answer
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: ...
user avatar
  • 21
2 votes
2 answers
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 ...
user avatar
0 votes
0 answers
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 ...
user avatar
1 vote
1 answer
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 ...
user avatar
  • 11
2 votes
0 answers
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 ...
user avatar
-1 votes
0 answers
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),...
user avatar
-1 votes
0 answers
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 ? ...
user avatar
3 votes
0 answers
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 ...
user avatar
  • 401
-2 votes
0 answers
13 views

java String default value in for each loop [closed]

what is the default value in x in this for each loop ...
user avatar
0 votes
2 answers
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. ...
user avatar
  • 11
3 votes
1 answer
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 ...
user avatar
  • 179
0 votes
0 answers
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-...
user avatar
  • 179
-1 votes
0 answers
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'...
user avatar
0 votes
0 answers
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, ...
user avatar
3 votes
2 answers
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 ...
user avatar
0 votes
0 answers
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 ...
user avatar
  • 109
0 votes
1 answer
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 ...
user avatar
  • 195
3 votes
1 answer
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 ...
user avatar
  • 359
0 votes
0 answers
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 ...
user avatar
-2 votes
0 answers
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 ...
user avatar
7 votes
7 answers
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 ...
user avatar
0 votes
1 answer
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 ...
user avatar
2 votes
0 answers
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 ...
user avatar
-4 votes
0 answers
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 ...
user avatar
1 vote
2 answers
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 ...
user avatar
0 votes
0 answers
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 ...
user avatar
1 vote
0 answers
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 ...
user avatar
1 vote
1 answer
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 ...
user avatar
  • 11
-3 votes
1 answer
81 views

Calculate the sum of even Fibonacci numbers

This is my solution for problem 2 of Project Euler using Python: ...
user avatar
-4 votes
0 answers
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 ...
user avatar
0 votes
0 answers
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 ...
user avatar
0 votes
2 answers
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 ...
user avatar
-1 votes
1 answer
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 ...
user avatar
  • 1
0 votes
0 answers
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 ...
user avatar
  • 1
2 votes
1 answer
275 views

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

This is my solution for problem 1 of the projectEuler with python: ...
user avatar
2 votes
1 answer
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? ...
user avatar
  • 51
0 votes
1 answer
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 ...
user avatar
  • 175
1 vote
0 answers
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 ...
user avatar
  • 11
1 vote
0 answers
18 views

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

I'm looking to compare kafka's producer and consumer ...
user avatar
  • 111
-4 votes
0 answers
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....
user avatar
0 votes
1 answer
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 ...
user avatar
  • 155
2 votes
0 answers
154 views

Dart Ioc Container

This package is on pub dev here It's on Github here ...
user avatar
-2 votes
0 answers
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? ...
user avatar
1 vote
0 answers
16 views

Unit tests for PNGme steganography exercise in Rust

I want to become proficient in Rust and I've followed the PNGme exercise. I've completed it up until Chapter 4 included, where I've written a lot of tests myself for verifying that the command line ...
user avatar
  • 111

15 30 50 per page
1
2 3 4 5
1512