All Questions

Filter by
Sorted by
Tagged with
-3 votes
0 answers
29 views

How to use variables and declare values in classes [closed]

I am new at writing production code, and I want inspiration on how to use variables when I write classes. I use Python here but this can be generilzed to other languages. What is good programming ...
economist101's user avatar
1 vote
0 answers
66 views

comment-monk - Comment hosting script for static blogs and websites

So few days ago, I had created another review request for sqlite database schema for a comment hosting system. Now that the app development is complete, I have pushed the initial version on github. As ...
Prahlad Yeri's user avatar
3 votes
0 answers
92 views

An Attempt at Creating a Type-Safe, Generic Swap Macro With Compile Time Error Checking

Properties: It evaluates each of A and B only once (sizeof is special, as it doesn't ...
Harith's user avatar
  • 8,704
1 vote
1 answer
53 views

Clear the temp folder with Python script

I am addicted to cleaning the %temp% folder, so I went ahead and tried with pyautogui at first by making it click ...
Giannis Tsakas's user avatar
8 votes
1 answer
484 views

Battleship vs. computer with Python

I am still pretty new to Python. After spending time on Code Wars and copying a handful of projects from Al Sweigart's Big Book of Small Python Projects, I wanted to build something completely from ...
Jessica Monnier's user avatar
8 votes
5 answers
1k views

Python matrix class

To prepare for my studies in linear algebra, I've decided to write a simple matrix class. This is the initial program, with functions to find the determinant and decomposition(s) to follow. I wanted ...
Linny's user avatar
  • 10.2k
10 votes
8 answers
992 views

Print all correct parenthesis sequences of () and [] of length n in lexicographical order

Given a number n, print all correct parenthesis sequences of parentheses and square brackets of length \$n\$ in lexicographical order. You must enter an integer \$n\$ from 0 to 16 inclusive. The ...
Dmitry's user avatar
  • 317
2 votes
2 answers
145 views

CSV Data Plotting Program in C#

I am trying to implement a CSV data plotting program in C#. In the plotting part, I use ScottPlot.NET to perform plotting operation. There are five column in the given CSV file, therefore, I use ...
JimmyHu's user avatar
  • 5,204
0 votes
1 answer
43 views

Optimize for compute/timespace - substring matching STD pk / sk format

BUSINESS CASE For users of my application I need to manage a granular list of grants. I'm using an aws dynamodb backend with lite Single Table Design (STD) strategies. A common syntax for STD keys ...
Jamie Marshall's user avatar
0 votes
0 answers
26 views

Flat serialization of single-value Java records used as strong types with Gson v2.11.0

Introduction I am currently developing a REST client in Java v21 and got the foundation basically working. In my project the Immutables and Gson library are currently used. Both libraries integrate ...
Florian Wolters's user avatar
1 vote
1 answer
47 views

Generic Min() for Integer Types (including Boolean)

This is a follow-up to Generic Max() for Integer Types (including Boolean) and An Attempt at Creating Generic Min()/Max() for Fundamental Types. What's new: MIN(), ...
Harith's user avatar
  • 8,704
2 votes
1 answer
53 views

Combining multiple regexps using the `|` operator and grouping the regexps by their flags

I've implemented a function that creates a multiple regular expressions predicate. The idea behind the predicate is combining regular expressions using the disjunction operator ...
terrorrussia-keeps-killing's user avatar
4 votes
3 answers
261 views

Connect4.java - The Connect Four game against an Alpha-beta pruning -based AI bot

I have this GitHub repository. It implements the command-line version of the Connect Four game. The AI bot is implemented via Alpha-beta pruning. Code ...
coderodde's user avatar
  • 28.7k
8 votes
3 answers
2k views

Why/How is Matlab's circshift function so efficient?

I have the following function in Matlab: ...
drakon101's user avatar
  • 357
1 vote
1 answer
35 views

Listening to bootstrap 5 events in a vuejs application

Starting out with VueJS, making a small fun project. The project is a simple static portfolio website, with a navigation bar at the top and a bootstrap scrollspy, jumping to the different sections (I ...
Roland Deschain's user avatar
8 votes
2 answers
165 views

Generic Max() for Integer Types (including Boolean)

This is a follow-up to An Attempt at Creating Generic min()/max() for Fundamental Types. What's Changed: MIN() has been forsaken for the time being. Mixed types ...
Harith's user avatar
  • 8,704
-1 votes
0 answers
10 views

Best Approach to implement UseCase in Domain Layer [closed]

I am implementing Uncle Bob Clean Architecture in my app. Currently working on Domain layer that is purely kotlin. I added Kotlin Flows to it. In order to make UseCases testable I create ...
Zar E Ahmer's user avatar
0 votes
0 answers
49 views

String replacements based on a range of start/end indexes [closed]

I have a question about splitting and replacing strings based on an array of start and end points. I have a dynamic string like this ...
dekron's user avatar
  • 111
4 votes
2 answers
885 views

Simple load balancer

I would like to know the possible improvements in design and concurrency of the following load balancer: ability to add/register new instance keep max of 10 instances for load balancer forbid ...
tinyzero4's user avatar
7 votes
8 answers
2k views

Convert string name to uppercase

As part of an assignment, I wrote this helper function to convert a specified name to a required format. This function simply converts a string in the format "this-string" to "This ...
Linny's user avatar
  • 10.2k
0 votes
0 answers
15 views

Stub-Based Unit Testing 5 Read Routines (revision)

This is a follow up to: Stub-Based Unit Testing 5 Read Routines. What's Changed: OP's goal of reducing the source files' count has been achieved. There is now a single test source instead of 18 ...
Harith's user avatar
  • 8,704
0 votes
2 answers
40 views

Slicing or Extended unpacking [closed]

I have a MQTT topic: topic = "namespace/group_id/message_type/edge_node_id/device_id" I want to get the first node and the rest of the topic in a ...
Dorian Turba's user avatar
1 vote
1 answer
77 views

Rewriting the java.util.concurrent.ConcurrentSkipListMap to a version without concurrency constructs

I have essentially rewrote the java.util.concurrent.ConcurrentSkipListMap into a version without concurrency constructs (...
coderodde's user avatar
  • 28.7k
5 votes
1 answer
84 views

Unrendering a Component of an embedded C++ Graphics Library

This is an extra short one, since I need some guidance on best practice for C++. It's been a while since I did some C++ in general, and its the first time for me developing on a microcontroller. I am ...
monamona's user avatar
  • 475
5 votes
2 answers
147 views

Python script to change monitor refresh rate

I recently overclocked my monitor and I am trying to create a script to just click and do the work for me so whenever I want to change my refresh rate I dont have to open windows settings. I think ...
Giannis Tsakas's user avatar
1 vote
1 answer
126 views

Find the join of two set partitions

Two partitions of a set have a greatest lower bound (meet) and a least upper bound (join). See here: Meets and joins in the lattice of partitions (Math SE) The meet is easy to calculate. I am trying ...
Watchduck's user avatar
  • 138
2 votes
1 answer
51 views

Sensored BLDC commutation controller testbench code

This is testbench code for a combinational logic circuit with 6 input variables and 6 output variables. The 3 binary HS (hall sensor) input variables are signals given by the BLDC motors' sensors that ...
Mister Moron's user avatar
4 votes
2 answers
760 views

Database schema for an upcoming comment hosting system

I'm working on a small and simple comment hosting platform in PHP (SQLITE database) to host comments for my static blog https://prahladyeri.github.io/. No login, sign-ups or third party OAuth, just ...
Prahlad Yeri's user avatar
3 votes
1 answer
63 views

Number of partitions of (a,b) into k distinct parts which sum up to (a,b)

Problem set This is somewhat a generalization of the famous partition of integer n into k parts. Given two integers ...
linuxbeginner's user avatar
0 votes
0 answers
29 views

Idiomatic SwiftUI, a combination picker and presenter

I am learning Swift & SwiftUI after 15 years doing VBScript & PowerShell. My current learning project is Stewart Lynch's BookList based on SwiftData. And as part of that project he has a View ...
Gordon in Ukraine's user avatar
3 votes
2 answers
314 views

Makefile to build and test a C program

Requirements: make shalt build read_file program in the root directory of the project from all the files in the ...
Harith's user avatar
  • 8,704
12 votes
4 answers
2k views

C++ static vector implementation

This is my custom static vector implementation similar to Boost’s StaticVector. Basically the idea is that the container should have a fixed compile time capacity, ...
ALLAN ZHANG's user avatar
7 votes
2 answers
1k views

A thread-safe performant URL Shortener in Java

This is a popular interview question. It is meant to be done within 45 minutes. The task is to implement a thread-safe performant in-memory URL Shortener. My implementation is based on two maps that ...
Sasha Shpota's user avatar
2 votes
1 answer
218 views

Python using generators with Excelwriter - Performance

I'm looking to understand if my code has an obvious blockage or performance pain point that will cause it to operate slower or use more memory than it should. The current Excelfile i am processing ...
sayth's user avatar
  • 131
4 votes
2 answers
147 views

C# items that don't follow rest of interface

I'm working on a game with unity, and I've created a state manager for the in-game state of certain organisms. Each state implements a ISimpleStateManager interface,...
Abdul Ahmad's user avatar
3 votes
1 answer
256 views

Transferring dataframe columns into dataframe rows

I have the following data: ...
mahmoud988's user avatar
1 vote
1 answer
62 views

Chess suggestions/ advice [closed]

Let me know if I'm going about this in an efficient way. I also tried to incorporate some hash tables that I picked up from YouTube but not sure if it's needed due to the way I created my board. I'm ...
user avatar
13 votes
4 answers
2k views

C - CHIP8 Interpreter

I want to get into emulator development, so I tried to write a CHIP-8 interpreter in C. I implemented it using this guide, and tested it using the test programs provided here (the test cases pass). ...
wed1may's user avatar
  • 195
-3 votes
0 answers
27 views

Draggable folding panel (second thought) [duplicate]

This is an enhanced version of draggable folding panel that additionally to fold unfold when clicked tapped and move around view port edges using the mouse it is moody by supporting changing its CSS ...
user283373's user avatar
3 votes
1 answer
102 views

Benchmark for loop and deque/map/methodcaller

While discussing with some colleagues, one argued that a for loop over a list of objects to call a method is a bad practice because it has bad performance compared ...
Dorian Turba's user avatar
0 votes
0 answers
47 views

Draggable folding panel

A responsive folding panel supporting repositioning around the view port edges using the mouse. It supports fold and unfold by clicking or tapping. ...
user283371's user avatar
4 votes
3 answers
134 views

Stub-Based Unit Testing 5 Read Routines

Requirements: Following are the functions I need to test, along with the cases where they can fail: ...
Harith's user avatar
  • 8,704
3 votes
1 answer
76 views

Sensored BLDC Commutation Controller code

For context, I'm using a maxII epm240 cpld, and I want to be able to program this to FPGAs too. I know I could build this in a typical state machine fashion since a sensored BLDC motor controller is a ...
Mister Moron's user avatar
4 votes
2 answers
278 views

Simple size difference measuring tool

Simple tool I wrote in an hour or two (I'm not very fast, but I eventually get there - also for the "spending 6 hours to save 6 seconds" meme). Would've written this in shellscript given ...
404 Name Not Found's user avatar
0 votes
1 answer
70 views

DIY memmove(). (Asking for a friend, kinda...) [closed]

A few days ago, this answer was posted to a 2y.o. Stack Overflow question (public domain). (The question about a presumed requirement of an intermediate buffer to implement ...
Fe2O3's user avatar
  • 808
4 votes
1 answer
59 views

Array Math to Calculate Ice Thickness -- Need Help Simplifying

I posted this on Stack but since it's working code, it was suggested I post it here. I wrote this code to calculate ice thickness using the following equation from Stephenson, 2011. It's a daily ...
emmahaggerty's user avatar
8 votes
2 answers
1k views

Aho-Corasick algorithm implemented in C

I've been reimplementing the fgrep utility in C for fun & study, and so had to implement the Aho-Corasick algorithm. I'm ...
Knogger's user avatar
  • 255
2 votes
1 answer
30 views

Open Source Disposable Email Filter PHP Package

I’ve recently developed an open-source PHP package called Disposable Email Filter and would greatly appreciate a thorough code review. The purpose of this package is to filter out disposable email ...
sint's user avatar
  • 21
5 votes
1 answer
170 views

Implementation of a `shared_any`

Below is an implementation of a shared_any: ...
user877329's user avatar
12 votes
4 answers
3k views

Python secrets command-line tool

I'm building a command-line tool that lets you use Python's secrets module. Here are some commands you can run with this tool: ...
code writer 3000's user avatar

15 30 50 per page