# All Questions

76,348 questions
Filter by
Sorted by
Tagged with
23 views

### Calculate score of rock-paper-scissors (Advent of Code 2022: Day 2)

Advent of code, Day 2. Here is my code. Less verbose version of the question follows. ...
• 483
13 views

### Random Name Selection from a "Hat" in Python

Background/context: This program randomly selects predefined items ("Names" as strings) according to 2 rules: #Rule 1: Each name/item in the list can only be selected once. #Rule 2: Single ...
• 101
10 views

### ATM updating balance

I am still a beginner in Python yet I would like to set up my code so that the user in this simulation can use more than one feature and have their account balances updated. So far, I just have it so ...
13 views

### Payment platform that takes in two types of cards and checks for authorization and pin verification

This is a payment platform that takes in two types of cards and checks for authorization and pin verification. I'm particularly interested in finding any semantic/logical errors I've overlooked. ...
22 views

### My Upsert endpoint needs some changes [closed]

I've made a controller that has an Upsert endpoint. ...
12 views

### Display Knight's Tour via Tkinter by changing button colors (location) through time [closed]

The below code goes through the Knight's Tour (touching every square once); however, I want to display the results graphically using tkinter. No matter how I adjust the code, the board displays with ...
1 vote
19 views

### Cleaner way to work with 2D arrays of Maybes?

I'm solving the Advent of Code in Haskell, and I started on Day 1. While the problem itself is fairly simple, I found it a little difficult to figure out how to parse the input format, which is a list ...
• 121
35 views

### Finding children and grand-children (managed Employees) from a List

In my CacheManager I have this code that parses AllEmployees to get a list of employees that you manage: ...
• 481
15 views

### Component-wise double precision multiplication in Go

I'm working on porting the bullet3 physics engine to Go to learn more about physics simulations. I'm working through some of the convex hull computing code, and I've reached a component-wise, double ...
• 453
11 views

### Configuring SQLite3 for best efficiency as a persistent cache

I'm using SQLite3, via php's extension module, to create a persistent object cache for WordPress. It's intended for use on modestly sized sites that don't have access to redis or memcached. Why use ...
• 301
5 views

### Cousins in binary tree [closed]

So i'm doing leetcode #993 and i tried writing a code for it but i get a wrong answer for some reason. question: Given the root of a binary tree with unique values and the values of two different ...
• 1
13 views

### Show entire current line in popup over current line in no-wrap text

Eventually, I've come up with a solution to a question I asked on vi.stackexchange. Here I come to review it. My intention is to show, everytime the cursor is not moved, the whole text of the current ...
• 527
28 views

### How to write this code snippet cleaner with less returns [closed]

I have the following code: ...
• 93
20 views

### Pillow plugin adding support for the QOI image format

Pillow is a popular library for handling images in Python. My code adds support for the QOI image format to Pillow. Aside from loading and saving QOI images, my goal was to write a streaming decoder ...
• 1,800
1 vote
26 views

### Restaurant Management follows MVC pattern

I am writing the Restaurant Management homework which must be following the MVC pattern. My Menu model has two parts: Drink menu and Food menu. With Food menu, it separates into three different types ...
1 vote
38 views

### Chain of Responsibility pattern for updating coordinates of moving objects

PrimaryCoordinates are the coordinates in meters. SecondaryCoordinates are the coordinates in decimeters, with the origin ...
• 1,179
10 views

### A continuous increase seen in the brightness when a FITS file is opened. How can this be removed?

I am trying to open a FITS file using the AstroPy package in Python. In the code I have basically opened the fits file, and displayed the corresponding FITS object. For some reason a continious ...
• 303
19 views

### How to add simple memoization to the sequential graph coloring algorithm? [closed]

I have the following graph coloring algorithm, which uses the sequential (and slow) technique to find if a given graph is k-colorable (with a plus of also returning a mapped graph if it is). ...
56 views

### minimax algorithm optimization for connect 4

I made a minimax algorithm for a connect 4 and I would like to optimize it to improve the calculation time. I have already done the classic optimization such as alpha beta pruning and a variable where ...
• 31
42 views

### Happy Eyeballs with Scala Futures

This is my take on Happy Eyeballs in Scala, but I don't like the outcome. However, I was unable to come up with something "better". The requirements for the code are must close all created, ...
• 103
45 views

### An encryption/decryption program with two different algorithms, Caesar Cipher and a Unicode Cipher

This project was part of the JetBrains Academy Java course. The project was about implementing an Encryption program that uses either a simple Caesar Cipher (or) a Unicode Cipher depending on the ...
• 133
1 vote
44 views

### Algorithm to draw a patterned line by traversing the path through points

So I was in need of a way to draw a patterned line that passes through several points on a 2D space, something that no Python library seems able to do out of the box (at least, the ones I've been ...
• 277
84 views

### Looping through asset types from Dictionary [closed]

I have some code that needs to branch depending on if a value from a database is absent. Essentially our database contains some key value pairs from a dictionary. If the key is absent from a set, we ...
• 111
17 views

### Programming Error [duplicate]

I have a programming error that I can't resolve. The issue stems from the void addContact function. What is my mistake in addContact function? Any help would be appreciated! ...
• 1
30 views

### My C program won't run [closed]

I keep getting all types of errors. I don't know how to fix it. When I try to fix it I get more errors. It says I'm missing a declaration. Also, error with using printf. ...
• 1
27 views

### Elegant solution for a conditional stackalloc/ArrayPool.Shared buffer creation [closed]

I'm dealing with some intensive char processing application and I found the following block repeating too much. Any ideas to improve it ? ...
• 131
33 views

### How can I fix my code so that it can run much more effciently? Currently I am checking all sides of every pixel on the screen, is there a better way?

Basically I am making a small game where at the current stage I click somewhere and color will spread out like a wave. Currently it does that, but I am bad at life, so my system is that it checks each ...
57 views

I have implemented some basic functionalities of task manager wherein whenever a new process is created it will be added to list of processes. Also if any process creates thread(s) it will get added ...
• 319
556 views

### RAII POSIX process created by fork

By analogy with std::thread, I've written an RAII POSIX process: ...
• 73
1 vote
57 views

### Note book program

The following snippet is for a basic notebook. You can take a note. You can delete a note. You can see all your notes. You can change a note. You can also see a see a specific note; for this you will ...
• 11
20 views

### Python context manager for importing modules outside my local directory

I implemented this context manager for importing modules from arbitrary directories. Good? Bad? - Keen to get thoughts: Implementation ...
• 141
1 vote
58 views

### Return a random integer with a probability progression

A function random_int_with_probability that returns a random number within a range, where the chance to get a bigger value decreases linearly towards the maxima. In ...
• 1,526
20 views

### Json file send batches to Hubspot api [closed]

I tried many ways and tested many scenarios I did R&D a lot but unable to found issue/solution I have a requirement, The HubSpot API accepts only 15k rec every time so we have large json file so ...
1 vote
12 views

### Raytracing in Julia

This is my first project in julia. It is a raytracer based on spheres. ...
• 316
54 views

### Statically allocated buffer using templates

I want to have some classes that would contain arrays of different sizes. I want this to be statically allocated because it is intended for an embedded system. The only good solution I can think of is ...
25 views

### find words with specific pattern and replace with its equivalent from a table list [closed]

I need to find words with the following pattern in one go: started to [infinitive verb] began to [infinitive verb] started [progressive verb] began [progressive verb] For example: started to arise ...
• 93
1 vote
64 views

### Having a separate validation util for common checks

I am working on a project where I see the following methods wrapped in a Util class ...
• 608
18 views

### Is there a way to shorten this roman to int program?(python) [closed]

I'm writing a roman numeral to integer program and was testing some preexisting code with a few modifications I made. ...
1 vote
88 views

### Replacing banned words from a given text

The following algorithm is used to find a word from Blacklisted words in a string (called text) and replace these words with censored text, as shown in the example. Example: ...
27 views

### Find characters from same homeworld as Chewbacca [closed]

The problem is Find the names of all characters which are from the same homeworld as Chewbacca My code is ...
16 views

### React.JS - working with Forms in React [closed]

I have a complex form that contains uploading files, drop-down, and free text. here are the steps when the user clicks on submit the form. Step one validate input manually with a method called ...
• 527
103 views

### Display volume of a song as something that looks like a volume bar

I've created something that looks like a volume bar that changes based on how high the user has the volume. Here I've set it to 63 as a example but it actually gets it from the Spotify API. Is there a ...
• 29
74 views

### VHDL code for synchronous mini-router

I have finished my router and would like your thoughts about my code. I think it works well, but I'm not sure since I'm new to the VHDL world. Could someone please help me? Is my code correct? SOURCE ...
• 21
1 vote
36 views

### Modelling mathematical expressions in Rust

I've been trying so hard to come up with a data model that works for mathematical expressions (like x^2 + 2x - y * 4, no equals sign) in Rust. It's very different to other languages I'm most familiar ...
• 525
1 vote
59 views

### Numpy segmented Sieve Of Eratosthenes

For the segmented Sieve Of Eratosthenes, I have devised the following code provided. And I understand that it is not the best implementation; However, it should be much quicker than what it is now. ...
42 views

### Alarm system for the door

Task: When a player walks through the door the sound turns on and gets louder every second. When the user leaves the door the alarm stops. Door.cs component: ...
• 39
24 views

### Improove particle simulation loop [closed]

I'm currently working on my third Java project. At the moment it's just a particle simulation with window collision but I try to understand the code base of a good simulation. Here some of my code: ...
21 views

### I have a code, which compares two workbooks, copies new data and works, but I need it to copy entire rows, instead of only column A values [closed]

Credit for code is for few editors in Mr . Excel forum. This code works like a charm, but I need it to copy the entire row of the new data, rather than only values from column A. Now I tried to play ...
66 views

### Is this a watertight javascript sandbox?

I am making a sandbox environment for javascript. For this I create a webworker with this function: (self is a webworkers global context) ...
1 vote