# All Questions

76,170 questions
Filter by
Sorted by
Tagged with
12 views

### Project euler #3 in python - prime factorization

My program is written in python and I have tested it with small numbers like 21 and 35, but i tried running it with 600851475143 but it is taking forever to spit out my answer. Anyways, my code is as ...
5 views

### Refactored ternary conditional to a function feedback

I am currently working on a custom TabBar component for my expo project using React Navigation V6. However, the example code that I used on the React Navigation docs to add in a custom tab bar shows ...
7 views

### Query builder with alternative approaches

The function alternative_computations below should produce a query using potentially different approaches (for brevity, I have provided just one). The caveat is ...
• 941
26 views

### Attempting an OOP approach for PDF Paranoia - Automate the Boring Stuff CH 15

This exercise is called PDF Paranoia and it comes from CH 15 of the book Automate the Boring Stuff With Python - second edition. There are two parts to the exercise, which I've separated into two ...
• 139
16 views

### Why while(is >> x) works but not if(is >> x) [closed]

In C++ using input stream, while(is >> x) returns false when the stream cannot read more, but if(is>>x) does not ...
1 vote
12 views

### JavaScript Drag & Drop Sortable List

I'm building a drag and drop sortable list in Javascript. This is what I have so far. Is this a good way to solve the problem? How can I improve my code? ...
26 views

### Simple ID Generator

Task Write a program that can generate and manage collections of IDs. The user should determine how long the IDs have to be and what symbols they are composed of. Design choices made by me The ...
• 2,036
9 views

### First Lua program - Print external IP and VPN status

I started learning Lua yesterday and wanted to write a quick program as a practice. It queries an external service for the IP address and country code, and naively check for the existence of network ...
• 21
89 views

### Sum of FizzBuzz numbers with modern C++

I am learning to write more modern C++, since my C++ is from the 1990s (I'm a C# programmer). I need to get used to the STL algorithms and such. So I tried some kata, summing up numbers in a given ...
12 views

### Exception handling for list of events

I am looking for a better way of using exceptions while querying some events. It is used as filtering some parameters over a JSON source and returns a list of events. The result is the format of the ...
• 11
18 views

### Reading a dynamic data resource

I need to read a dynamic data source from such as https://daten.berlin.de/datensaetze/berliner-stra%C3%9Fen-und-volksfeste-2022 In my current application, I have started writing a static parsing, I ...
• 11
15 views

### React : render one screen inside another when one screen component needs almost everything from another screen component?

Im using react native and I have (among others) 2 screens. SearchScreen Component and ReportScreen Component. In my ReportScreen I basically need everything from SearchScreen (I render the search ...
19 views

### I create too many vectors to draw a small cylinder

The goal is to draw a cylinder and rotate it by -30° around the y-axis (i.e., towards me). This should be done as large and performant as possible. But the drawing should look reasonable, otherwise I ...
• 177
20 views

### Optimizing barycentric triangle rendering algorithm

I created this piece of Go code that renders a shaded triangle using a Barycentric algorithm ...
• 193
18 views

### Counting the number of elements common in both the arrays. It is not able to pass all test cases [closed]

I have written NumberofElementsInIntersection function code, other code was by default available in editor. My logic to find number of common element is, i will store elements of first array and its ...
52 views

### Print sums of pairs from 1 to 10

This takes the sum of pairs of numbers from 1 to 10 and outputs the sum, the original numbers, and some connecting text. Output: intArray.length 10 {Sum of + 1 and 2 =3, Sum of + 3 and 4 =7, Sum of +...
32 views

### Simple selection_sort in C

I study algorithms, and I try to implement each algorithm in C (Perhaps it would be better to choose C++, but okay) Here is my implementation of sorting by choice. How would you rate it? To be honest, ...
37 views

### LED matrix controller - Verilog

I'm an ECE student. My experience in Verilog and FPGAs is mainly from my digital logic design class. To practice Verilog, I decided to implement a controller for Adafruit LED matrices. It interfaces ...
• 103
49 views

### Identical big methods except the return type, Make it more lookable?

ㅤ Hello. As an amateur coder, i'm doing some game mods etc. I have these almost identical and kind of spacious methods, and i wonder if there is any way to make them less bloaty? ㅤ I'm curious about ...
27 views

### Destructive quick and merge sort

I've implemented a destructive merge and quick sort in common lisp, but the code feels verbose and highly imperative. I was wondering if anyone could offer guidance on idioms that could make the code ...
• 121
8 views

### Redis Output Cache Store refactoring

This code incorporates the new .NET 7 Output Caching. I would like to get some refactoring tips on the RedisOutputCacheStore class. How to use ...
• 427
87 views

### Interrupts in C (PIC, APIC, timer, IRQ 1)

In my kernel i have implemented basic interrupts with the PIC, and the timer with LAPIC, and also set up keyboard interrupts. kbd.c ...
1 vote
33 views

### Movie library system

I want to implement a crud movie library system and also some filtering capabilities. Since it is so big, I have added the link to the code. https://github.com/neslihanbozer/Movie-Library. I am aware ...
• 11
1 vote
61 views

### Parsing: Сollecting data from a book site

A task: Сollect data from the site in the following format: book; user; book_rating; comment_rating; publication_date; comment For one book at once several pages of ...
• 57
11 views

...
28 views

### Sending and receiving files in C win32 using a socket

I have a piece of code to send and receive files on Windows with C. Is this the right way to do it? And am I guaranteed that the full file will be sent and received? Receiving function: ...
• 83
21 views

### Simple goroutines to make multiple http calls

I have a program which calls a lot of URLs with the help of a goroutine and assigns the result to a mapping. As a beginner in go I chose the simplest implementation as possible. I have ended up ...
• 131
36 views

### Palingram finder running in worst time than source material [closed]

This code I wrote from chapter 2 of 'Impractical Python Projects' by Lee Vaughan. I got a dictionary.txt file from: https://inventwithpython.com/dictionary.txt The program 1. Loads the dictionary. 2. ...
37 views

### Recipe website with API and JSON using vanilla JS

I'm training JavaScript and using APIs. So I'm building a recipe website that lets you search ingredients and finds you recipes with it. Here is the link: https://www.themealdb.com/ I found some code ...
• 41
26 views

### Is there a better way to update the related data in Entity framework core 6.0.7?

Role Entity has multiple SkillRoleRequirement, Education & Experience ...
25 views

### Making button work again after refreshing a section with ajax

I would like to use JQuery to update some sections after clicking on a button. Below is the code I am developping. If I click on the div tag with the class ...
• 101
88 views

### yet another fizz buzz

FizzBuzz is a well known Exercise among programmers, but I wanted to add an aspect called "openClosed" principle (from SOLID) FizzBuzz is a very simple programming task, used in software ...
• 2,526
62 views

### Is there a way to simplify this code snippet? [closed]

I have inherited a piece of code which is itchy for my eyes and am trying to revamp it ASAP. It is built with .NET Framework 4.5. The application has multiple connection strings for different purposes ...
50 views

### Coin Change in Java

Inspired by a leetcode exercise, I wrote my own coin changer: You are given an integer array coins representing coins of different denominations and an integer amount representing a total amount of ...
• 2,526
54 views

### A constexpr, const correct matrix class with compile-time checks

I've expanded, and enhanced my matrix class which uses, aside from dynamic memory for the elements, only 3, const literals. These are rows, cols, and a ptr. The methods are all constexpr and the ...
• 173
28 views

### rust: Set configs from env and reuse it during app's lifetime

After writing a basic API with rocket, I'm trying to improve it, but I'm not sure how to follow up. Each time a new request comes in, the code keeps looking for the variable from the environment. <...
37 views

### Rock, Paper, Scissors scoreboard [closed]

I just started coding and made my first Rock, Paper, Scissors game. ...
55 views

### Basic Linked List C implementation

I've written a singly-linked list of characters. This is my 3rd C program and I'd like some feedback on what I can improve on in any aspect whatsoever. If you'd prefer to look at the repo directly it'...
37 views

### ConfigurationManager to access entry assembly's config settings from within any other dependent assembly

I inherited a solution with many projects, and one of them contains hard coded database connection parameters. These are referenced in a number of other projects, and many of those are dependencies of ...
• 101
19 views

### Features of prefix increment in comparison operators in C# [closed]

What will the user see on the screen as a result of the application? int x; x = 7; Console.WriteLine("{0} + {1}", 5>6 && 6<++x, x); The ...
56 views

### generate combinations from list of numbers

generate all combinations from list of numbers,the combinations can be pair of two numbers example 1 : list of 2 numbers [1,2] [ [[1],[2]], [[1,2]] ] example 2 : ...
10 views

### Tkinter Not Responding After Running Some Time [closed]

I have this UI Created in Tkinter but after running sometimes it shows Not Responding I don't know why but it seems like a threading issue. Also, CPU usage is around 30%-80%. It runs fine when closing ...
29 views

### EF Core code-first "many-to-many-to-many" (Books with many credits with many people)

Let's say you have a book. A book can have an author, an editor, a proof reader, or several other credits. Which credits are available should be dynamic (someone might not want to have the "proof ...
• 141
59 views

### Duplicate a folder tree over a network in C#

I have been tasked in creating a method that would replicate a full directory tree to a remote server using C#. The problem there is that I can only create the folder or the file if it has a parent. I'...
• 473
20 views

### Project that retrieves data from API's and ends up in SQLalchemy

I've already posted an earlier (and less involved) portion of this project and have now gotten far enough to look for some more feedback with regard to approach and structure. Building a large project ...
• 151
13 views

### Volumetric Calculation Request for Guidance [closed]

I am trying to figure out volume calculation from gridded data. I know the area of the cell and the "Z" volumetric value of the cell. It just seems my numbers are inflated. Any review or ...
65 views

### Currency Converter - removal of warnings [closed]

How could I improve my below program? I do have some warnings. For example: toString() may produce a null pointer exception. I tried to get around that, by ...
• 21
27 views

### SortedIntSet: a set of integers that can be iterated in ascending order in O(N) time

I needed a set with the following properties: can be iterated in ascending or descending order in $O(N)$ time the usual set operations (contains, add, remove, discard) can still be done in $O(1)$ ...
• 330
39 views

### Pivoting and then Padding a Pandas DataFrame with NaN between specific columns - Case Study

This question is about pivoting and padding columns, two very frequent activities in Pandas. I have a raw dataframe. I need to manipulate from long to ...
• 521
I created the code for the problem description below. It works for $N\le10^6$ but after that it gives a time out error. What I don't understand is how to optimize the code using dynamic programming. ...