All Questions

Filter by
Sorted by
Tagged with
0
votes
0answers
4 views

How to refactor this method with unknown number of parameters?

I have an API which makes calls to another API, in turn. I have some code that, at the moment, is duplicated in all my methods. It essentially is below: ...
0
votes
0answers
7 views

I have wrote a python code to check the null values and the code was working fine but I need to simplify the code

I want to check null values in excel files where there are many sub folders. I have wrote a python code to check the null valuesin excel files in each and every folder and the code was working fine ...
0
votes
0answers
4 views

This code replaces each element of an array with the product of every element of the array except the current one. Suggestions for improvement?

This code replaces each element in an array with the product of every other element in the array but the current element. So, for the array [5,2,3], the program outputs [6,18,108]. The code is below, ...
0
votes
1answer
10 views

Online Judge 10189: Minesweeper (C++)

I'm new to C++ (not to programming in general), which I want to learn to participate in some programming contests. I solved the Online Judge Minesweeper Challange. Since I'm not familiar with C++, any ...
0
votes
0answers
13 views

Use formats phone numbers into XXX-XXX-XXX

I created an input that accepts and formats phone numbers into XXX-XXX-XXX. The user should be able to type numbers and the dashes should insert themselves automatically. Example #1: The user types 1 ...
0
votes
0answers
8 views

How to avoid getting a duplicate entry in the slice of slices in this Go solution?

I'm trying to solve this Go problem - 3Sum in Leetcode with Go. Have obtained the result almost right, but facing a problem with duplication of one of the slice entries, though I've added a logic to ...
1
vote
2answers
33 views

C++ Minimal CSV parser

I wrote a minimal CSV parser for my machine learning toy project. ...
-1
votes
0answers
11 views

I made a win function but now i can only place 1 tile, [closed]

So i made a hangman game using pygame and following a tutorial, now i am trying to make Tic Tac Toe on my own but the check win statement now only lets me place down 1 tile before stopping the game. ...
1
vote
2answers
35 views

Is it possible to remove some code to make the macro run faster?

My code runs exactly as it should. However, I would like to make it run a bit faster. I have tried defined some variables to 'Long' to run it faster but it still a bit slow. ...
1
vote
2answers
29 views

A circle in a circle

Just experimenting some things with css, I made a centered circle div (inner) which is inside a circle div (outer). ...
2
votes
1answer
34 views

Is there any way to speed up my dictionary/map search?

I am once again attempting another CP problem, and I have ONCE AGAIN run into an optimization issue because of the time limit of one second: https://open.kattis.com/problems/doctorkattis It is common ...
0
votes
0answers
6 views

Socket.io: Pairing from two rooms without repeated pairing?

I'm working on a user-pairing algorithm using socket.io, and it is running on Node.js. I want to make sure that no repeated pairings will happen when people connect in. The steps of the algorithm as ...
0
votes
0answers
10 views

Extendable Validation Library

I'm looking to develop a validation library which can be extended by adding custom validation rules. To write a custom rule, simply write a class and apply the ValidationRule decorator like so: ...
2
votes
0answers
10 views

Reliable separation of Steam users

I wrote this bash script to try to make sure save games don't get mixed between different steam users using the same Ubuntu account. It uses inotify to try to figure out when a user changes and a soft ...
0
votes
1answer
29 views

Concatenate two vectors and store the result

I code in Rust, but one doesn't need to be familiar with Rust to understand the question. We are given the two vectors, first and res. Our goal is to append res to first, and then to assign the result ...
0
votes
1answer
50 views

Whats the best way to refactor a POCO class

In work I was asked to fix a bug which involved me making changes in a class. To fix the bug I needed to add a collection of a class that looks like this. ...
1
vote
1answer
37 views

Comparison of 2 different ways of writing Merge Sort Algorithm

I have recently learned Merge Sort algorithm in C++ with 2 ways of writing it. 1st Way: ...
1
vote
0answers
7 views

golang http.Client wrapper with rate and concurrency limiting

My goal is to safely consume an API without getting 429 Too Many Requests error, activating DDoS protection or going over system limit of maximum open file ...
-2
votes
0answers
28 views

Performance optimization of nested dict

I have been currently working on which way is the fastest way to get a nested dict. By spending few hours with researching aswell as asking people I have ended up creating my own test which I do not ...
5
votes
5answers
1k views

Adding Odd numbers in C++

I have written following code for the this C++ Problem: Write a program to add only odd numbers between one to ten. ...
1
vote
0answers
23 views

Event handling with async await in Python

Recently, I had to write a code to classify and rename lots of image files based on their content. So, I wrote a Python script which displays all those images as a slideshow to the me, and I can ...
2
votes
1answer
39 views

Python: lru_cache make leetcode's dungeon game more slower

I'm trying to implement a recursive+momoize version for leetcode's dungeon game question. I tried to use @lru_cache(): ...
0
votes
0answers
40 views

Unwinding in Python [closed]

My scenario is as follows: I need to write a Python script that does a series of steps. Specifically what it does is: Clone a git repo Change some tokens in this repo Create a remote repo in our ...
0
votes
0answers
43 views

Gilded Rose with pure functions in C#

Gave myself the challenge of solving the Gilded Rose with pure functions in C#. All one-line lambdas, all static, all the time. The original kata assumed the code would mutate the given array-- I've ...
-1
votes
0answers
36 views

making this nested for loop more pythonic [closed]

I have a clunky (but working) piece of code as shown: ...
-2
votes
0answers
45 views

Best format to store user informations [closed]

I want to store user informations such as their names, lang ... I'm currently using Yaml format. This is an example: ...
2
votes
1answer
30 views

Find ALL duplicate subtrees. using recursion

This is just a practice exercise, I'm trying to understand dynamic programming as deeply as I can. I solved this using recursion, though I am not sure if it will always work. If anyone could tell me a ...
1
vote
0answers
16 views

Wrangling and reading several xlsx files from sftp server and concatenating them into a single dataframe

Please find below my code. Any recommendations/suggestions on how to improve it and make it more readable will be hugely appreciated. I've tried to comment it as much as possible so everyone can ...
-2
votes
0answers
9 views

ProgressDialog Not Visiable [closed]

I use different Progress Dialogs in two activities. First, This is a box that works normally. ...
4
votes
0answers
29 views

The python code simulates an environment of a disease and calculates how many people get infected

The python code simulates an environment of an X number of persons with an Y number of places they can go to, puts the persons randomly in the places and calculates how many persons get infected, die ...
6
votes
2answers
233 views

Time duration conversion with units

I recently was asked to upgrade some C++11 code to add a feature by which the user can set a time duration from the command line of the program. The requirement was to have a default time of 1500 ms ...
0
votes
0answers
12 views

Solving the Knapsack Problem With a Genetic Algorithm Simulation in Python

I was watching Computerphile's video on using genetic algorithms to solve the Knapsack problem, and I decided to give it a whack. For anyone running the code, the ...
3
votes
0answers
13 views

Arm Assembly Tokenize String (strtok()), Load Move, Add Efficiency

Dabbling a bit more with arm assembly, I wrote a few functions to handle string splitting. The goal was to write a few reusable functions that could be combined to emulate (roughly) what C ...
1
vote
1answer
33 views

template function for conditional dereference

I don't know why there's no such function in std (at least I didn't find one). I need a conditional template function to return a reference to an object of T. ...
0
votes
2answers
46 views

Improving Project Euler code problem #10

So, I just finished Problem 10 on Project Euler, but it took about 3 to 4 minutes for my output to come out, due to bad coding, I guess, any suggestions on how could I optimize my code? Question The ...
0
votes
0answers
37 views

Better Approach for the House Robbery Problem (LeetCode 198)?

The problem states that you have to rob the maximum money stashed in the houses but you cannot rob two adjacent houses. array[i] denotes the money in the (i)th house. I got the following code ...
2
votes
1answer
40 views

Garden simulator [closed]

I tried to write the program so that it runs without error but I want to improve the program so that it follows the Single Responsibility Principle. What changes can I make to improve this program? I ...
2
votes
1answer
20 views

Simple Vanilla JS Todo app

I'm a Kotlin engineer looking to get into web dev. I thought it'd be fun to make a Todo app w/o help from the internet. Just looking for some critiques and feedback, as I'm new-ish to the language. ...
1
vote
1answer
41 views

Database schema for discussion forum scraping

I'm scraping posts from various discussion forums and storing those posts, along with some metadata, into a relational database (SQL). My actual use case is a bit more complex, but I think I can give ...
3
votes
2answers
71 views

Prime number finder in Python3

The problem I am working towards improving my Python coding. I am checking that I am doing the best in terms of the Python code, not necessarily the algorithms. Having looked at one of my previous ...
0
votes
0answers
45 views

Using itertools to find all combinations of length 2 in a list [closed]

Back at Uni I recall several teachers forcing students not to use built-in libraries, and instead have us build things from scratch like data structures/algorithms. My question is in the real-world ...
1
vote
2answers
35 views

Javascript - On mouseup check if any of the parents has/includes specific id

On my page I have a mouseup eventlistener on document. I want to be able catch if the clicked elements has a specific ...
4
votes
4answers
491 views

Tic Tac Toe in C++ with classes

My first language is Python and I learned considerably a good amount of it. So now I started learning C++. I know the basics of C++ and about classes and inheritance. This is my first serious project ...
1
vote
1answer
36 views

Migration in a bioinformatics application that changes a column name and explains the rationale

This very short piece of code is a migration in which a column name is changed to be more descriptive. It is part of a larger bioinformatics application written in RoR that parses the output of ...
0
votes
0answers
26 views

Creating Pivot Table taking time at average vales

I have created a VBA macro to create a pivot table automatically. But taking 15 to 20 minutes of time to complete the macro. Especially at the point of below code taking half of the time. Review Code ...
2
votes
0answers
21 views

Unsupervised competitive learning algorithm from scratch in javascript

I'm a mathematician who is new to programming and I'm currently reading the book "Theory of Neural Networks" by Rojas. To become better, I try to program every algorithm that is described in ...
4
votes
5answers
1k views

C++11 Custom Vector Implementation

This was my solution to an interview question: Q: Implement an std::vector style container (does not have to be exactly compatible) with a fixed buffer and the following requirements and restrictions: ...
2
votes
1answer
28 views

Template For a CLI Application

I have written the following cli tool. ...
1
vote
0answers
15 views

Functional tests of downloadpdf, a python CLI app

Shared below is a functionality test. I would love to get some review from the community. Thank you. The idea of the system is a simple CLI application which can be used to download PDF from a given ...
3
votes
1answer
55 views

Python 3 script to phonetically transliterate written English to Cyrillic and/or Greek

This is a Python 3 script I have written over three days that transliterates (not translating) English orthography written in Latin alphabet to the Cyrillic alphabet, the Greek alphabet or a mixed of ...

15 30 50 per page
1
2 3 4 5
1466