All Questions

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

Emulating C23's QChar * behavior for basename and strchrnul

To quote @Lundin from What is C23 and why should I care?: Bug fixes for a lot of library functions (search functions in particular): we can now pass a const-qualified pointer parameter to a library ...
Harith's user avatar
  • 6,812
2 votes
1 answer
17 views

A game where the player guesses the computer's number

I am fairly new to programming, and I recently finished part of one of my projects, a guessing game. The part I completed was the game mode where the player guesses the computer's number. I'm quite ...
ADAM WELLER-FAHY's user avatar
0 votes
0 answers
10 views

conv2 Template Function Implementation for Image in C++

This is a follow-up question for An Updated Multi-dimensional Image Data Structure with Variadic Template Functions in C++. I am trying to implement conv2 template ...
JimmyHu's user avatar
  • 4,958
-3 votes
0 answers
6 views

Image segmentation -unsupervised learning using python [closed]

I am running the following code on kaggle ...
Ayushi Yadav's user avatar
1 vote
0 answers
19 views

Generic overloading bitwise functions to manipulate the enum type

Thanks to G. Sliepen, who gave me a lot very meaningful & useful advice on my implementation about overloading bit operators for a special scoped enum. Now I have modified the code snippet to ...
John's user avatar
  • 353
-5 votes
0 answers
19 views

Android homework assignment fail [closed]

I have an assignment for applycation, and my github is https://github.com/tqdinh/Attractions @HiltAndroidApp ...
dinh trương quang's user avatar
1 vote
0 answers
22 views

Frida script to demangle C++ function name

I have this Frida JavaScript code to demangle a C++ function name. It calls a libc function to demangle the function name. But it needs to allocate a buffer and a pointer. I do not want every function ...
lucky1928's user avatar
  • 183
4 votes
1 answer
307 views

API Generator for Python [closed]

I'm currently working on my thesis to obtain a bachelor in software engineering, and i want to get some feedback from real developers of how useful this project can be in the real life. the project is ...
Hernandez Sinsel Jesus Emmanue's user avatar
-4 votes
0 answers
40 views

Two body collision written in SFML [closed]

This program shows two objects that can be controlled with arrow keys, It's 569 lines. I have an 8 core CPU and this simple program takes around 30% of my CPU. I don't understand if SFML is causing ...
Resfe's user avatar
  • 1
0 votes
0 answers
27 views

Simple drawing website using React

So I have recently started learning web dev (including React since a few days ago), and I have tried to implement a simple drawing website that lets you change the brush size, color, and save the ...
Tom Gebel's user avatar
  • 390
4 votes
1 answer
629 views

Using builder pattern and facade pattern in real project

The code below is used to upgrade the firmware of three different types of cameras. I am not good at design patterns. I wonder if it is suitable to use builder pattern and facade pattern here. Since ...
John's user avatar
  • 353
6 votes
1 answer
197 views

Reading a file into lines with mmap vs getline

I required a function to read a file into lines for a text editor, and ended up with two routines. One uses getline(), and the other uses ...
Harith's user avatar
  • 6,812
3 votes
0 answers
27 views

Benchmarking type generic algorithms on type heterogenous problem sets in Rust

I need to benchmark the different code generations of a generic function in rust, for different type parameters. I ran upon this when developing differential equation solvers using ...
LudvigH's user avatar
  • 131
6 votes
3 answers
1k views

fmap for containers in c++

I implemented a simple fmap for containers. However containers don't have a unified function to add elements. So I wrote different concepts for different containers. Is there a better way to implement ...
Yu Cong's user avatar
  • 63
3 votes
1 answer
34 views

Generating a Benchmarking Report for a Program

Objective: The script should pass each file present in the data directory to the read_file executable, and print its result and ...
Harith's user avatar
  • 6,812
-2 votes
1 answer
71 views

How can I reduce my code in time complexity?

My friends in the same project told me that I needed to improve this code's complexty, so I tried but couldn't figure out how to do more.. They also said that I needed to change my coding style and ...
김형찬's user avatar
5 votes
1 answer
595 views

Karatsuba algorithm in C

This is the Karatsuba algorithm I wrote: ...
Talete's user avatar
  • 53
2 votes
1 answer
177 views

Leetcode: Number of Islands - BFS (Queue vs Recursion)

I was playing around with leetcode's Number of Islands. As per the challenge's description: Given an m x n 2D binary grid grid which represents a map of '1's (land) and '0's (water), return the ...
ccot's user avatar
  • 331
1 vote
0 answers
25 views

Can I use only mutex and condition variable Instead of the Banker's Algorithm?

I've been studying the Banker's Algorithm and was curious if I could implement a similar resource management system using only Mutex and Condvar. The code I wrote is a synchronization program that ...
ybjeon01's user avatar
0 votes
0 answers
49 views

Add a Custom Billing Field to WooCommerce Checkout, Order Meta, and User Meta

I have implemented a custom WooCommerce checkout field to collect a Tax Exempt Number in the billing section. This field's value is stored in the user meta upon checkout to facilitate future orders. ...
intothevoid0's user avatar
1 vote
2 answers
66 views

Python - streaming file

I need to download and upload around 1000 files. The file is first downloaded from one webserver and then uploaded to another. My first approach was to save each file on disk and then upload - but as ...
John's user avatar
  • 241
-1 votes
0 answers
26 views

Unable to get names on a webpage [closed]

I have written some code to get the names on a webpage of car dealers at a postcode. But for some reason i am getting nothing. Not sure what i am doing wrong. As far as i can tell all my paths are ...
nevster's user avatar
  • 189
3 votes
1 answer
75 views

In Java, replace for loop with condition with lambdas [closed]

I want to replace a for loop with a break/return condition inside with a lambda. I think I have a good replacement, but I want ...
Oscar Besga Panel's user avatar
1 vote
1 answer
70 views

Sprinkler effect

Developed around visibility CSS property and HTMLElement#offsetHeight and ...
user avatar
3 votes
2 answers
259 views

Python - Text-based game about an escape room

This is my first project, a short text-based game. Does this code follow common best practices? Here is the code for the class file: ...
codexploit's user avatar
4 votes
3 answers
267 views

Implementing basename, stpcpy, asprintf, vasprintf, strchrnul, and strcasecmp

C23 standarized strdup()/strndup(), but left out stpcpy(). ...
Harith's user avatar
  • 6,812
2 votes
1 answer
26 views

Stored procedure with output parameters in MSSQL

I want a stored procedure that retrieves ID and PID from the invoice table with batchid as input parameter and based on the retrieved PID I want to retrieve sid from the log table. In total I want to ...
surya's user avatar
  • 21
4 votes
2 answers
229 views

ostream that counts and discards the characters written to it

The code below implements a class, CountingOStream, whose job is to count the number of characters written to it while also discarding those characters and ...
Scott McPeak's user avatar
1 vote
0 answers
27 views

A generic queue that transfers data from interrupt to main program

This code aims to implement a queue, which transfers data from interrupt to main program in a bare metal embedded system. There are two execution points, the main program and the irq handler. Both ...
Jackoo's user avatar
  • 11
1 vote
0 answers
25 views

Case Study: Database design help for a small app used to coach tennis players

I have a small SQL server database and VBA program that is used to automate tasks related to tennis students, programs, practices, performances, and student testing. I'm trying to learn db design and ...
Jason's user avatar
  • 11
2 votes
1 answer
36 views

Finding the Size of a File in a Portable Manner (revision 2)

This is a follow up to Find the Size of a File in a Portable Manner (revision). Changes made: The return value of fseek() and ...
Harith's user avatar
  • 6,812
3 votes
2 answers
501 views

Abstracting away ANSI escape sequences

I have an application that requires ANSI escape sequences, so I have attempted to abstract away the magic strings out of the code (they were previously macros) into a separate translation layer, ...
Harith's user avatar
  • 6,812
0 votes
0 answers
23 views

An example of a bootloader that changes color in a loop in assembly x86

In short, this bootloader code loads sectors from the disk into memory, sets the video mode and prints a message on the screen. After that, it goes into an infinite loop, keeping the system running. <...
Bruno Ciccarino's user avatar
2 votes
2 answers
57 views

Can I make my percolation in python function more efficient?

We've been tasked with finding out how many randomly distributed discs with radius = 1 it takes to form a chain of discs from the left side to the other of a square with side length = sqrt(n), and ...
Emilio's user avatar
  • 23
-1 votes
0 answers
28 views

Discriminator and Generator loss is constant in cGAN [closed]

I have a financial .csv dataset. After preprocessing, I converted it into a graph structure with nodes, edges, and labels. My plan is to apply Graph Attention Network (GAT) on the graph data. I ...
Girish's user avatar
  • 1
2 votes
1 answer
45 views

Overloading bit operators for scoped enum

The code snippet is used to record the status of several cameras. Since the enum class MODULE_ENABLED should not be used by the customers directly, I marked it as <...
John's user avatar
  • 353
2 votes
1 answer
89 views

Example of emacs setup code written in elisp

I'm still going to improve it but I left my emacs to my liking. I really liked having this freedom to leave the ide as I like, most don't give you that. I'm even thinking about making an IDE in the ...
Bruno Ciccarino's user avatar
3 votes
1 answer
32 views

simple express api for temperature conversion

...
Sayaman's user avatar
  • 446
0 votes
0 answers
59 views

Simulated Annealing Variant for Conway's 99 Conjecture

I have made an algorithm that simplifies the "temperature" aspect of simulated annealing in an attempt (for fun) to solve Conway's 99 Conjecture. A brief explanation of Conway's 99 ...
Dair's user avatar
  • 5,906
0 votes
0 answers
46 views

Securing microservices with Spring Security JWT

I would like to build a RESTful microservices architecture where each microservice acts as a resource server. Additionally, there will be an authorization server responsible only for user registration,...
yaroslav96's user avatar
2 votes
1 answer
50 views

Passing in method as func and using dynamic to circumvent type checking

I'm working on a side project. One of the design decisions is that components shouldn't do any database calling (if this is wrong or impractical then I'm open to disregarding this design policy). I'm ...
xtreampb's user avatar
  • 123
1 vote
1 answer
60 views

Calculate Prime Number using web workers and Web storage in HTML5

Take a number input (less than 100) from the user and save it to the web storage. Create a web worker to increment the number till it becomes prime. Provide two buttons of 'Start' and 'End' to start ...
user283073's user avatar
1 vote
5 answers
1k views

How do I speedup this simulation program

This is a program to solve a differential equation numerically using Euler method. As of now, it is very slow, and I need to run 10000 Monte Carlo simulations. The differential equation is called ...
Jonathan Wick's user avatar
1 vote
1 answer
61 views

FastAPI not full utilization

I have Django development in background for several years. Now I am practicing more framework this time is FastAPI. What program does: It is todo tasks with undo feature. I split the model into 2 ...
Sarit's user avatar
  • 113
-3 votes
0 answers
39 views

A function is to check for whether two objects are equivalent. When they are not, should it returns false or the reason why it's false? [closed]

Say we have two objects: const obj1 = {prop1: 1, prop2: 'a'} const obj2 = {prop1: 1, prop2: 'b'} And we want to check whether they are equivalent: ...
Ooker's user avatar
  • 195
4 votes
1 answer
342 views

Better way to add attributes to an enum in Rust for code scalability

I watched a YouTube video (https://www.youtube.com/watch?v=z-0-bbc80JM) talking about the power of enums in rust for data modelling. In the video, there's an example of a state machine of a simple ...
rafaelgdgs's user avatar
2 votes
0 answers
24 views

Alternative to Arc<Mutex> and clone() when using multiple variables in a callback

I'm new to Rust, and I'm working on an exercise to develop a parking lot system using the Raspberry Pi GPIO and socket.io. After some struggle, I managed to create a program that actually works, but I ...
Eduardo Rodrigues de Farias's user avatar
5 votes
2 answers
352 views

Brocard's Conjecture Candidate Finder

For fun I wanted to investigate Brocard's Conjecutre. That is, does there exist \$n, j\$ such that \$n! + 1 = j^2\$. The method I use takes inspiration from looking at divisibility rules which I ...
Dair's user avatar
  • 5,906
1 vote
0 answers
23 views

How can I optimize ProductCard component and its render method in React

ExclusiveOffers swiper: ...
Andrian's user avatar
  • 11
5 votes
1 answer
504 views

Create an address self-complete bar

I recently received the following code challenge in connection with a job interview. After submitting, I was rejected. I want to know what (if anything) I could have done better here. Task Your task ...
Russ J's user avatar
  • 201

15 30 50 per page
1
2 3 4 5
1553