All Questions

Filter by
Sorted by
Tagged with
1 vote
2 answers
155 views

Strings to array

I've written a simple text tokenizer in JavaScript which works in my specific case, but I do not think it is maintainable (for example, if the requirement ever changed to allow newlines when ...
FromTheStackAndBack's user avatar
4 votes
2 answers
105 views

(Another) text formatting method with word wrapping in Java

Please take a look at my code for (simply) formatting/wrapping a text. Is there something to improve? Here are the properties the method should have: (updated) Every space character (i.e. ...
Tobias Grothe's user avatar
5 votes
2 answers
597 views

Generic multithreading solution for improving the performance of slow tasks

I'm currently in the process of replacing an archaic multithreading solution using some of the newer C++ standard library features now that our software has been updated to use C++20. Previously, most ...
Swepps's user avatar
  • 53
0 votes
0 answers
29 views

Efficient least-significant digit (LSD) radix sort for int and long keys in Java - iteration II

This post elaborates on Efficient least-significant digit (LSD) radix sort for int keys in Java. This time, I made mild corrections to my code and provided the radix sort for ...
coderodde's user avatar
  • 28.2k
0 votes
0 answers
24 views

Messaging correlation and syncing

We use masstransit and sagas. But I also wanted to correlate some messages without the need for a saga since the syntax for those are pretty verbose if all your need is to sync on a correlation id. ...
Anders's user avatar
  • 670
3 votes
2 answers
93 views

Referral Network & Rewards

I want to be able to distribute a total reward among network, where the distribution diminishes according to the depth of the network but the total sum of distributed rewards equals the initial total ...
Bob's user avatar
  • 149
3 votes
1 answer
121 views

Miller-Rabin implementation is very slow

I implemented the Miller-Rabin-Primetest in python3. But I have the feeling it is very slow. I know that there are faster version in gmpy2 package, but I want to compare it with another code I have in ...
Lereu's user avatar
  • 141
4 votes
1 answer
184 views

Looking for feedback on a flavour of Radix tree I wrote. The idea is speed on find() time if keys share common prefixes and are known ahead of time

My project explores some ideas i've had regarding alternate data structures to the unorderd_map and map, and aiming the exploration to key sets with a non uniform distribution and key sets with common ...
ver2's user avatar
  • 61
2 votes
2 answers
62 views

Minesweeper in React -- design for state management/data flow

I've pasted here a basic implementation I've done of a Minesweeper game. This is not the full functionality, only the populating/revealing of squares. The idea is that the user inputs ...
nickhealy's user avatar
  • 155
0 votes
0 answers
34 views

ParamInitializer framework: automatic provision of expected request parameters by Spring Cloud Gateway

I continue to share portions of my Dynamic Gateway project This time, I want to publish the types relating to its "parameter initializing" functionality. The idea is simple: if my gateway ...
Sergey's user avatar
  • 541
7 votes
3 answers
2k views

Shunting yard calculator in C

I'm new to C, and made this program that parses a string expression into a linked list post-fix expression, and then evaluates it, without parsing the string beforehand. Wondering if there is anything ...
expoodo's user avatar
  • 73
1 vote
1 answer
131 views

Need help condensing my code so it takes up less lines and it easier to interpret

Description is at the bottom Here is a link to all the code: Link ...
WartyWarthog123's user avatar
2 votes
1 answer
57 views

Return a set of geodetic coordinates for a particular moment in time

Use case The user is interested in supplying a timestamp of a particular moment in time. This python application will perform two astronomy calculations for a set list of planetary bodies: Calculate ...
Hunter's user avatar
  • 259
2 votes
1 answer
74 views

Need assistance in Optimizing the Recursive Query in Pyspark

I am trying to convert a SQL Server stored procedure to Pyspark code. This is my SQL Server query: ...
Data writer's user avatar
1 vote
1 answer
101 views

Detect a straight automatically in Texas Hold em Poker [closed]

I made a Poker-Hands tracker. The 52 cards of the game are in this program represented by their value and their type. For example Ace-heart is stored as "Ah" and 7-spades as "7h". ...
John's user avatar
  • 47
0 votes
0 answers
37 views

Retrieving resources of JWT-authenticated user Spring Boot Java

I have a Java Spring Boot Rest-API which is authenticated using JWT-tokens. Currently the API only contains Users and CashflowCategories. An user can have many CashflowCategories. When the user makes ...
O'Niel's user avatar
  • 197
0 votes
1 answer
201 views

Literate Programming in C

Inspired from Literate programming in Haskell. Below follows a Literate script filter. A literate script is a program in which comments are given the leading role, whilst program text must be ...
Harith's user avatar
  • 5,834
5 votes
1 answer
551 views

Calculate Earth-based planetary positions given a date, time, and timezone

I have a project where the user supplies a date, time, and timezone, and my code will calculate a bunch of coordinates on the Earth. There are four sets of coordinates setA, setB, setC, setD. ...
Hunter's user avatar
  • 259
3 votes
1 answer
122 views

Efficient least-significant digit (LSD) radix sort for int keys in Java

(This post has a continuation post.) This one is my attempt at LSD radix sort: Code com.github.coderodde.util.LSDRadixsort.java: ...
coderodde's user avatar
  • 28.2k
3 votes
1 answer
86 views

Sorting songs with the ability to save and resume partial sorts

I listen to a lot of music (~4k h/y) and managing thousands of songs is a bit of a challenging. To improve my listening experience I want to better organize my collection. One thing I want to do is ...
Peilonrayz's user avatar
  • 43.3k
8 votes
2 answers
877 views

Drawing a mathematical envelope with turtle graphics

I started coding a week ago. I played a bit with the turtle module and I am looking for ways to improve my code. Please feel free to share improvements. Here is the shape it creates: ...
Lorenzo's user avatar
  • 83
3 votes
1 answer
159 views

Sending only modified data from a table to the backend as form data

The frontend has a table with hundreds of rows. Each row consists of different inputs (text, file, ...
pileup's user avatar
  • 421
1 vote
0 answers
82 views

Feedback on a ThrottledInvoker class

State in a Fluxor app can be updated many times per second, with each change triggering a render in Blazor. I wanted to write a class that would throttle these notifications so they don't occur more ...
Peter Morris's user avatar
1 vote
2 answers
109 views

Miller-Rabin prime test

I have an implementation of the Miller-Rabin prime test, coded in Python 3. I want to use that as a comparison to a prime test which I coded myself. Unfortunately I have no idea how "fast" ...
Lereu's user avatar
  • 141
10 votes
2 answers
1k views

Beginner Rust Todo app

I am trying to use the practices that I have learnt from the rust book. Any advice is welcome. Please feel free to be as nitpicky as possible. ...
Doruk's user avatar
  • 203
0 votes
0 answers
33 views

Scaffolding through my own language (Rapid Application Development)

I'm developing a webapp where some parts that repeat, so I made source code to generate source code. I had a lot of fun using Spring-Roo and Grails in the past but was sad that the difference between ...
Grim's user avatar
  • 612
8 votes
2 answers
255 views

Filling a buffer with a repeating pattern of N bytes

My program will clear the screen to a 24bit RGB color; in other words, it will fill a buffer with a repeating pattern of 3 bytes. So I wrote patternMemcpy to perform this operation efficiently*. It ...
Vortex 2728182818's user avatar
1 vote
1 answer
39 views

Reduce Redundant event listeners and selectors to make navigation scrolling and clicks more concise

Inside of this navigation function, I have a click event that scrolls to sections which are offset by the fixed header height. I also have a scroll event which changes the links' color when the scroll ...
Tami8899's user avatar
0 votes
0 answers
35 views

Autocorrelation of a vector series (2)

Related: Autocorrelation of a vector series The given C# source code computes the autocorrelation of a vector series using a Fast Fourier Transform. Can you review this code for correctness? ...
user366312's user avatar
1 vote
1 answer
67 views

Find Method Implementation for Multidimensional Array in C#

I found that Array.Find(T[], Predicate) Method is only support one dimensional array. I am trying to generalize it to multi-dimensional array in this post. The experimental implementation The ...
JimmyHu's user avatar
  • 4,708
9 votes
4 answers
1k views

Reverse Engineering Data Files (Binary Visualization)

Binary Visualization based on Christopher Domas talk: youtube link and this Russian programmer where I discovered this talk: youtube link. Algorithm: Scan the pairs of bytes of a file with a sliding ...
Harith's user avatar
  • 5,834
1 vote
1 answer
72 views

Basic login form in React.js

I have made a very basic login/registration form in React.js. The inputted data is send to a Java Spring Boot Rest-API to create an user or to authenticate using JWT. But in this question I want to ...
O'Niel's user avatar
  • 197
8 votes
1 answer
314 views

Basic Ray Tracer

This is my first self-guided programming project, and all the math used in the program is self-taught. I wanted to get a better understanding of how computer graphics worked, but I just feel more ...
Jonas Banks's user avatar
1 vote
1 answer
51 views

pyqt6 UI for displaying streaming data to two plots and an image display

So I have a large application that I've been writing. One part of that application is responsible for displaying images taken from a camera and plotting two graphs. I've successfully stripped out the ...
Michael's user avatar
  • 303
2 votes
1 answer
179 views

Autocorrelation of a vector series

Related: Autocorrelation of a vector series (2) The given C# source code computed autocorrelation of a vector series. The listing gives accurate results, but is horribly slow. How can I optimize it to ...
user366312's user avatar
2 votes
1 answer
41 views

Any possible issues with my approach to Access Management where I'm associating the list of Departments with the User class?

I have a spring boot project with JWT being used for Spring Security. I want to implement Access Management in my project and I'm using this approach. In my project, whenever a user is created, a list ...
Joe's user avatar
  • 23
3 votes
2 answers
133 views

Copy and delete Pathlib.Path

I want to copy or delete a Path object, whether it is a file, a symlink, or a directory. I don't want to monkey patch Pathlib so I created some surrogate functions for those operations: ...
FTG's user avatar
  • 165
1 vote
1 answer
69 views

Multiple Producer and Multiple Consumer Implementation Using Locks and Semaphore

This solution has a total of four classes. Main.java: Class with main method. Execution starts here. ...
vvs14's user avatar
  • 111
2 votes
1 answer
30 views

Simple GAS assembly program to print out all of the command line arguments provided to it

Although I've used assembly quite a bit for some simply things, I feel like I've never properly learnt how to write it idiomatically, by which I mean: which variables to use where, how best to ...
Jacob Garby's user avatar
0 votes
0 answers
20 views

Deposit and Point accrual contract

I've created a smart contract in Solidity and would like to ask for some review to highlight any potential issues. The primary goals of this contract of this contract are to: Allow users to deposit ...
HudsonGraeme's user avatar
3 votes
1 answer
301 views

Implementation of java.util.stream.Stream (and friends) that reads lines from the internet without requiring you to manage the resources

This streams lines of information over the internet using BufferedReader::lines. However, what makes this special (and thus, extraordinarily complicated imo) is ...
davidalayachew's user avatar
0 votes
3 answers
80 views

Bash script to read csv, manipulate data, write csv

This is pretty horrible code, but it works. I don't code in bash 😭, usually code in Python. This is a learning exercise for me, so that's why I'm using bash + that's why I don't use libraries. I ...
M3RS's user avatar
  • 373
2 votes
3 answers
679 views

Step-by-step re-arranging of a string with randomized characters

A sloppy code featuring algorithms to efficiently randomize the characters of a string "Hello C" and then print out in the console the re-arrangement process for every character. ...
Edenia's user avatar
  • 1,568
3 votes
1 answer
79 views

Creating an array (temporary table) in SQL and iterating through each row within this table to preform a check on the data in each row

The SQL Server version I am using is SQL Server 2008. I've got an SQL query/script I've written which is to help simplify some things while our API is being rebuilt. Essentially, this script allows ...
level42's user avatar
  • 131
4 votes
2 answers
460 views

Leetcode: Steps to Make Array Non-decreasing

I was trying out leetcode's Steps to Make Array Non-decreasing As per the challenge's description: You are given a 0-indexed integer array nums. In one step, remove all elements nums[i] where nums[i ...
ccot's user avatar
  • 301
2 votes
2 answers
148 views

Is this a good pattern for handling late-initialized of class type?

Are there any issues with this class template? It is supposed to provide an easy-to-use object solution to initialize an object of class type after the declaration of the variable. One nuisance is the ...
Bolpat's user avatar
  • 233
1 vote
0 answers
34 views

HTML Treeview Code with JS for Search

I'm reaching out to share a recent project I've been working on – an HTML Treeview code with JavaScript integration for search functionality. This code enables users to search through the tree ...
pcinfogmach's user avatar
4 votes
1 answer
174 views

awk script to pivot long CSV into wide CSV

I've made an awk script that does the same operation and has the same parameters as Python's pandas.DataFrame.pivot, for 2D tables. It reshapes a table from "...
minseong's user avatar
  • 749
3 votes
2 answers
99 views

Calculate the count of top performers in SQL

I have a transaction table let's call it Offers Table. Please don't read too much into the business but let's say a customer wants to buy a car and the customer searches variety of websites but at the ...
Cody's user avatar
  • 31
1 vote
3 answers
196 views

LeetCode 856: Score of Parentheses

Given a balanced parentheses string s, return the score of the string. The score of a balanced parentheses string is based on the following rule: - "()" ...
jason's user avatar
  • 21

15 30 50 per page
1
3 4
5
6 7
1552