All Questions

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

Best practice for function structure and return pattern in safety critical code in C [closed]

We are working on a product that we aspire to make safety critical grade and where my personal aim is to write as clear and easy to read code as possible. Sometimes I get a PR review that some code ...
Krzysztof Bracha's user avatar
2 votes
0 answers
15 views

Compute shader based Particle System

I'm experimenting with compute shaders and wrote the particle system. The emit shader now takes particle data from the constant buffer because I don't have randomizing functions implemented yet. That'...
Edziju's user avatar
  • 319
-3 votes
0 answers
15 views

Turning a table with months and days and adding the month with total number of days into a dict for each month [closed]

What is the better way to do this? I was having issues where when I used one loop it would only contain the last addition rather than the total. Ex. August will have 4, 3, 5 and it would end with 5. ...
user282488's user avatar
-1 votes
0 answers
10 views

Concerns regarding Angular website scalability

I have a couple of concerns regarding code I wrote in the past on whether it is scalable and maintainable. While I am focused on maintaining scalable and maintainable code, I would appreciate any ...
Yousef's user avatar
  • 1
0 votes
0 answers
17 views

cloneNode then reset the controls

I wrote this code below to get the template-input-group and cloneNode the data. I then have to reset all the select and input ...
Jefferson's user avatar
  • 361
2 votes
1 answer
24 views

Executing method with time limit restrictions

I've created a method which allows to run tasks where results might not be fully computed but still are considered valid. ExecuteFor method can be used if you have ...
FlameHorizon's user avatar
-2 votes
1 answer
39 views

I wrote a O(log N) code for largest element in an array today but is this an already existing way to find max element in an array?

Largest element in an array's most optimal approach. The code I have written has passed all test cases in https://www.naukri.com/code360/problems/largest-element-in-the-array-largest-element-in-the-...
im3shn's user avatar
  • 1
0 votes
0 answers
21 views

Testing whether parenthesis are correct in a string in functional JS

This is a homework exercise and therefore has no further purpose. The writing to me feels clunky, and the typescript types on addParenthesisFactory are unreadable, ...
Tomer Kandel's user avatar
0 votes
0 answers
26 views

The Wacky World of ANSI Escape Sequences?

I just finished creating my first npm package (for learning, not competition) and published it. Now I want to ask some questions, for example: Is my method of writing code good (for later maintenance ...
Maysara Elshewehy's user avatar
-4 votes
0 answers
17 views

Request for Assistance with DFS, PMI, and Pairwise Constraints Implementation (Python) [closed]

I've been working on a Python implementation combining Depth-first Search (DFS depth = 2), Pointwise Mutual Information (PMI), and Pairwise Constraints (ML must link and CL cannot link). While I've ...
Zoge13's user avatar
  • 1
0 votes
0 answers
24 views

Construction Permit Web App

I have a Next.js + Node.js + TypeScript + Tailwind + tRPC project whose objective is to allow a construction manager to figure out what permits are required for his renovation based on if it's an ...
Jason's user avatar
  • 1
1 vote
0 answers
48 views

initializing a timezone database and getting all timezone names (before main())

I have written the below small program that tries to initialize a tzdb before the main() runs. So once the main function runs, it checks the two global variables (...
digito_evo's user avatar
2 votes
1 answer
39 views

Basic rust Celsius to Fahrenheit conversion

I've been following the rust book, and I made a Celsius to Fahrenheit converter as it advised me. After a bit, I came up with this code; however in my opinion, there's a lot of unnecessary parts that ...
icy icy's user avatar
  • 23
2 votes
1 answer
45 views

Python sklearn rolling yearly validation

I am trying to implement a simple modelling pipeline with rolling c.v., making use of the TimeSeries split. The code is provided below with a working example dataset. (please don't pay too much ...
Lucas Morin's user avatar
2 votes
1 answer
142 views

Which is faster: Unhide rows during IF or Unhiding them all at once in another macro?

I have process where I am generating workbooks from a list. One of the tabs has varying height and I have a formula that my macro uses to determine whether to hide a row. As I move to the next ...
Mark S.'s user avatar
  • 211
-2 votes
0 answers
34 views

Learning some functional programming - would like your input on code readability [closed]

These are three different exercises I was working on. I'm new to JS and FP as well, and I'm not sure what guidelines to follow to make my code readable. My tabs got a bit borked. All code has: ...
Tomer Kandel's user avatar
-3 votes
0 answers
21 views

Sending data twice a second with HC-12 [closed]

I'm currently working on a project that involves two stations: a transmitter and a receiver. Please keep in mind that I'm a beginner. On the transmitter side, I'm using an ESP32, HC-12 433MHz module, ...
pepin's user avatar
  • 1
4 votes
4 answers
1k views

Stack - implementation in Java

I implemented a stack data structure without using any libraries or Java API code. ...
Mardson Diego's user avatar
1 vote
1 answer
68 views

CPU emulation library

I've started to work on a JavaScript library called vCPU with the purpose of providing a framework for emulators. vCPU is designed to be able to emulate multiple types of CPUs, with setup only ...
themirrazz's user avatar
5 votes
3 answers
589 views

Password checker using Decorator Pattern

I'm currently trying a Password checker for password in Decorator Pattern, which will point out what the current password missing to be a strong password (my example will check for 8 characters, at ...
DEF ABC's user avatar
  • 53
2 votes
0 answers
38 views

A new Dictionary for VBA

The latest version of the Dictionary class presented in this question is available in the VBA-FastDictionary repository under the latest release. Motivation I ...
Cristian Buse's user avatar
1 vote
0 answers
31 views

Simple CRUD server in rust

This is my first rust application. I tried to pick somewhat low level dependencies to get a feel for the language particulars. I'm especially interested in control flow/error patterns in rust as I ...
intentionally-left-nil's user avatar
3 votes
1 answer
116 views

Binary heap based priority queue implementation in C#

I made this Priority Queue implementation for C# since it doesn't support updating priorities in logarithmic time complexity. I did some tests and it seems that it's correct. However, I'm not sure ...
Programmer's user avatar
4 votes
2 answers
282 views

Optimizing Multiple Subplot Visualization and Navigation in Matplotlib

I have implemented a class in Python using Matplotlib for visualizing multiple subplots along with navigation buttons to move between different subsets of data. Each subplot displays a contour plot ...
Cold Fire's user avatar
5 votes
1 answer
457 views

C++ - Find all duplicate files (follow-up)

What's changed since the first version: Instead of hashing each and every file, the sizes of the files are first compared, and if those are equal, the files are then hashed. A more collision resistant ...
Harith's user avatar
  • 5,669
2 votes
0 answers
48 views

Optimizing even more a C++ matrix class with expression templates using variadic templates

I looked at Bowie Owens' cppcon 2019 talk (the slides can be found here) where he shows how to implement a tridiagonal matrix classes using expression templates but without resorting to the CRTP. (It ...
11house's user avatar
  • 21
3 votes
0 answers
34 views

Created client server with read and write from both side

I have created client and server which can read and write from both side in client as well server. So what more improvement can be done so the code should be performant and better? Following are three ...
i_am_learning's user avatar
17 votes
3 answers
3k views

A tic-tac-toe game in C

I am (trying) to learn the C programming language for fun with my father's book "The C Programming Language". I tried writing a tic-tac-toe game in C. I have no professional experience, so ...
Uriel's user avatar
  • 171
5 votes
1 answer
111 views

Creating random music covers using Conways Game of Life algorithm

(A sample cover art follows.) I'm currently working on replacing all the covers of my music files to have a unified theme, and I've started this project in Java to refresh my knowledge after a gap of ...
Zipity's user avatar
  • 51
-3 votes
0 answers
25 views

Retrieving n bits signed integers stored contiguously in memory [closed]

I'm trying to implement the minecraft protocol in TS/Node, and for the Position data type, the doc here says "x as a 26-bit integer, followed by z as a 26-bit integer, followed by y as a 12-bit ...
Fayeure's user avatar
  • 95
-4 votes
0 answers
28 views

Trying to create full-duplex tcp server [closed]

I am trying to create full duplex server, I have implemented this rust code but it is not working, so what could be modification need to be done to make it works. client.rs ...
i_am_learning's user avatar
6 votes
2 answers
728 views

A word counter (wc) utility clone

I was practicing Java by building some of the challenges on this website: https://codingchallenges.fyi/challenges/challenge-wc/ I've built a word counter clone and I wanted to know if my solution is ...
Reacher's user avatar
  • 63
6 votes
4 answers
247 views

Simplified VarDumper in PHP

I wrote a simplified VarDumper and wanted to get feedback on areas I can improve on my code. My biggest area of concern is the captureContext method making sure I get the correct file and line ...
CodeWithPhpX's user avatar
3 votes
1 answer
269 views

C++ - Find all duplicate files

It requires no explanation, so here's the code. Code: ...
Harith's user avatar
  • 5,669
4 votes
1 answer
89 views

Hangman game in JavaScript

I have attempted to create a hangman game in JavaScript. Some parts of my code is a bit DRY. Basically, the Hangman class is a wrapper for all of the available actions in a typical hangman game: setup ...
Napoleon Bonaparte's user avatar
3 votes
1 answer
62 views

Rust Wake-on-LAN CLI

I'm new to writing rust code, and looking for any alternate approaches to writing this code or changes to make it more idiomatic, and readable. My use of traits, specifically, I dislike. It feels like ...
freebie's user avatar
  • 181
4 votes
2 answers
156 views

Matrix Factorisation class packaging methods for factorisation of explicit & implicit data matrices using Gradient Descent, SGD and ALS

Attached below, and also as this GitHub gist, is code for a Python class I wrote as part of a personal learning/portfolio project on collaborative-filtering recommender systems via matrix ...
Cosmic Fan's user avatar
-3 votes
0 answers
30 views

It is good practice to use the setState callback to ensure that the state is updated [closed]

I have a situation where I am fetching a list from the backend. For each item in the list, I need to display a dropdown, which also needs to be fetched from the backend. I then need to check if the ...
Programmer's user avatar
-1 votes
2 answers
94 views

Breadth-first search [closed]

there are some problems in this code that I can't think of a solution. It does work for print(real_path,count) but the real thing I want is return real_path,count and for doing this I need to make the ...
tumr's user avatar
  • 51
-1 votes
0 answers
72 views

Simple C++ Program: Enter Golf Scores, Calculate Average, and Display Results using Arrays [closed]

I'm a beginner in C++, and this is an exercise I did after I learned functions. This C++ program prompts the user to input up to 10 golf scores, with an option to exit early. It then calculates and ...
zonkler's user avatar
5 votes
1 answer
154 views
+200

Sand simulation in Rust

I am working on this project to learn Rust and a bit of Web Assembly. The rendering is done in JavaScript which I do not really care about so I will not post. I would like to receive some harsh ...
Doruk's user avatar
  • 191
8 votes
1 answer
566 views

Command-line parser that takes a command in C

Explanation The reason I post this is that I am worried this code is clever, which is usually a bad sign. The command-line parser considers the following synopsis. ...
Schilive's user avatar
  • 243
0 votes
0 answers
28 views

How can I optimize ChatInputBar component in react/next?

I have a chat input bar component where user can type text messages, emoji as well as select images and then send it. Currently it's a bit messy as I only finished working on it, so I guess what I can ...
Andrian's user avatar
2 votes
1 answer
109 views

2D tile map game: Calculate room tiles a furniture item was placed at

I'm developing for a 2D tile map game. I'm trying to generate a list of tiles a furniture item has been placed at, also supporting multi tile furniture that cover more than one tile. I've written a ...
Josh Hallow's user avatar
  • 1,325
3 votes
1 answer
1k views

How can I make this code more DRY

So I have some POCO classes like this: ...
LonelySemicolon's user avatar
-1 votes
0 answers
30 views

Efficient way to solve word scramble

I wrote this code below to automatically find all possible arrangements of letters of a word whose letters are randomly mixed up. All letters of the word are stored in an array. For example, when the ...
John's user avatar
  • 47
-3 votes
0 answers
28 views

How do i change this code to better, using ReactJS with useMemo hook? [closed]

This is a good code practice? ...
Dev Marcell's user avatar
4 votes
1 answer
328 views

Is this a sane (as in lacking UB) implementation of a ref-counted subscription cleanup?

AutoCancel is a class which wraps a Cancel (aka void()) function. The purpose of wrapping ...
smac89's user avatar
  • 1,509
5 votes
3 answers
305 views

Find highest number of swaps within a set of possible duty swaps with networkx and PuLP

With huge help from Stack Overflow, I have created code which takes possible swap matches with given weights as an input and outputs a set of matches which gives the highest weight with the highest ...
Oehoe's user avatar
  • 53
3 votes
2 answers
90 views

Data Base Management System in C++ mimicking SQL based DBMS's (not for parsing SQL syntax)

I'm building a DBMS similar to SQL based DBMS's (like mySQL for example) currently implemented creating a table and reading from a table. no user input yet implemented for testing I create std::string ...
Ellie's user avatar
  • 549

15 30 50 per page
1
2 3 4 5
1552