All Questions
77,308
questions
4
votes
1
answer
38
views
ShareImage: Place Texts on Images to generate Social Media Preview Images
ShareImage is a project which lets you use an Image ("Template") and place text over it, to generate Social Media Preview Images, the ones used in the ...
0
votes
0
answers
12
views
Order Model for a Market Place Ruby on Rails Application
I've created a Marketplace application on ruby on rails and would like to request a review of my code (Order Model) to check if I am in the right track or not...please kindly understand that I am a ...
2
votes
1
answer
88
views
Minimalistic implementation of Leapfrog integration algorithm
Please review this C++ listing of an implementation of Leapfrog integration.
Was the algorithm implemented correctly?
...
0
votes
1
answer
28
views
Change the appearance of a log graph with two x axes
I would like to improve the overall look and feel of the two log graphs generated by the Python code below. The first graph represents the optimized methods while the second graph represents the ...
0
votes
1
answer
55
views
Spring Boot Azure Service Bus Listener
I would greatly appreciate your feedback and review of our Spring Boot Azure Service Bus listener implementation. Your insights and suggestions will help us ensure its efficiency and reliability. ...
8
votes
4
answers
2k
views
Plotting the Mandelbrot set efficiently
This is my Mandelbrot set program - it includes Smooth Coloring, perodicity checks, and my approach to biomorphs.
I know of Edge Detection, but I couldn't find a simple explanation that I can ...
2
votes
2
answers
117
views
Counting duplicate elements in two sorted arrays
I've been working on an assignment that involves optimizing a duplicate finding algorithm for sorted arrays, and I'd like to get your thoughts on the implementation. Here's the code I've come up with:
...
5
votes
1
answer
74
views
Bank account class simulator with possible exception
I'm a newbie to python object oriented programming, Unfortunately in all the ways, Classes that I write turn into a true mess.
I'd be glad if someone would be able to point me some of my mistakes.
<...
3
votes
1
answer
68
views
Scraping the Divar.ir
I've wrote a code to scrape the Divar, which is an equivalent of Ebay in Iran. I have a few questions:
Am I doing the error handling and logging ok?
Is there a better way to optimize this code? (note ...
1
vote
1
answer
44
views
safe numeric type converter
I have written a function for casting between built in numeric types. I built it to check if the source value is within the range of the destination value, and to provide a nicely legible error if not....
2
votes
1
answer
74
views
Project Euler Problem 1: Multiples of 3 or 5
The following is my solution to Project Euler Problem 1: Multiples of 3 or 5.
...
4
votes
2
answers
101
views
Find largest sum not involving consecutive values
There is a question to basically find the largest sum in an array, such that no two elements are chosen adjacent to each other. The concept is to recursively calculate the sum, while considering and ...
1
vote
1
answer
93
views
Positive Segments
I'm trying to solve the following question:
You have an array A of size n, containing −1 or 1 only, and s segments (not necessarily different). Each segment is defined by 2 integers li and ri (1 ≤ li ...
-2
votes
1
answer
54
views
Market Portfolio Binary Search Tree [closed]
I'm trying to solve the following problem here:
First line of input contains the number of days D. The next d lines contains a character c and a number x. If c is B, then buy stock . If c is S, then ...
6
votes
2
answers
84
views
Hangman game in C
I am a beginner who wrote this simple Hangman game in C for fun and to practice programming. I am looking for advice on optimizing this code and making it adhere to best practices. Are there too many ...
2
votes
1
answer
55
views
Reorganice (and style) form's output in HTML using JQuery: how to do it better?
To clarify: The code in "What I achieved" is working. I'm looking for suggestions so I can improve.
I'm quite new with JQuery (and javascript) and I've been learning while styling a forum. ...
0
votes
0
answers
18
views
Efficiently computing a batch of results given a batch assignment vector and series of corresponding matrices
I have a 1D tensor of tokens that belong to different batches. The batch sizes here are uneven. Each batch needs to be multiplied with a corresponding weight matrix. My current approach is using a ...
2
votes
2
answers
163
views
C++ std::shared_ptr implementation
Took a shot at implementing std::shared_ptr, with a thread-safe refcount and weak count. Didn't do weak_ptr, I'm doing this for ...
2
votes
1
answer
76
views
Simple Rust Todo List with auto incrementing ID
I have recently started learning Rust and thought I'd start out with the classic Todo List application.
The application simply loops forever asking the user to type a number to do specific actions, ...
1
vote
0
answers
40
views
Functional style dependency injection to make business logic unit-testable
My project is a blogging app, which is a recruitment assignment. It is now finished and working.
Following function handles updating a comment votes, very similar as on StackExchange sites, preventing ...
0
votes
0
answers
116
views
Chain of Responsibility in the game of Hangman
I tried to do the Hangman Refactoring Kata for the piece of code over here - https://www.youtube.com/watch?v=-0MeoFTj6DU
This is how the initial code looks like after first set of refactorings (i.e. ...
0
votes
0
answers
14
views
Typewriter component that updates span one char at a time in Next.js + TailwindCSS
I have created a Typewriter component that animates a span to display text for my portfolio website. The goal was to have an array of strings that are cycled through and an animation that types them ...
1
vote
1
answer
80
views
CPU emulator written in python (Adjustable Microcode!)
I've designed and implemented a CPU architecture in one day. Of key architectural details: Processor is supposed to support updatable microcode, Architecture extensions and Is designed to be ...
0
votes
1
answer
46
views
DDD Aggregate for seat booking in cinema - is my model correct?
I created a DDD aggregate for booking seats in cinema. Is it corect or it should be model in other way?
Business rules:
1.Seat can be booked at least 1h before screening
2.Screening can has only 1 ...
1
vote
1
answer
46
views
Process comma separated input and check format
I have to read console input and store data in the vector of structs. In case of any data format violation I have to print "Malformed Input" and return <...
2
votes
2
answers
105
views
A memory leak-free RAII wrapper around two raw pointers
As a practice of implementing RAII-enabled class, I prepared a class called DynamicWallet that wraps around two raw pointers. I am well aware that using smart ...
2
votes
4
answers
240
views
Generic type data storage
We have a module which can be used by user to store and load value of variables. Every variable has an index associated with it (in the shown code cample this is ommitted and index is instead the data ...
0
votes
2
answers
89
views
Improving performance of mandelbrot set calculation
I am making a hobby OS, and I thought about adding a command for interactively rendering the Mandelbrot set. The "interactive" part is not really important, but I wanted to check if the ...
0
votes
0
answers
30
views
Running a neural network backwards
I've read this paper where they basically run a network backwards.
And decided to try. Luckily, many useful functions are implemented already in pytorch.
The main idea is this:
Write a convnet
Write ...
-1
votes
0
answers
32
views
My first ReactNative code
I try to build my first serious app in ReactNativ but it's my first time with it. I build some basic components but i'm not sure if it's properly written. I used Expo and GlueStackUI + Navigation. ...
4
votes
1
answer
58
views
Improving readability of semi-nested classes for loading data of separate runs of a joint testing campaign
A bit of background:
Most often I am analysing data (mostly timeseries) of mechanical machine conditions (vibrations, temperatures...) that were acquired in different 'runs'. All runs were acquired ...
2
votes
0
answers
34
views
Reusable storage for array of objects V4
Here is a thirdfollow up on Reusable storage for array of objects, Reusable storage for array of objects V2 and Reusable storage for array of objects V3, taking into account the provided answers.
The ...
3
votes
1
answer
47
views
Remove duplication from WebVTT subtitles
I want to perform statistical analysis and index subtitles that are stored in the WebVTT (Web Video Text Tracks) format. Before I can do that I need to remove duplicated text since each cue can ...
-1
votes
0
answers
21
views
Running a spawn_local task inside LocalSet
I'm having issues with the use of tokio::task::spawn_local and tokio::task::LocalSet. Examples I see on rust docs show a single ...
4
votes
2
answers
509
views
O(nlogn) Lexicographically minimal rotation code but tle on this particular case
Based on a small suggestion here , this code tries to find lexicographically minimal rotation (question) by successively comparing two adjacent substrings in the very left , that can potentially give ...
2
votes
1
answer
62
views
Use row data from a database to find rows in dataframes that match and use data to generate a separate dataframe
I have a DataFrame (database_df) that contains the general record with the IDs that are the same team in each of the lines, containing these values I need to find ...
1
vote
0
answers
43
views
C++ registry class which manages game object, components and systems in an ECS
So this is my header file (registry.hpp):
...
1
vote
1
answer
28
views
VSCode-Portable Updater (MSYS2)
VSCode's portable mode doesn't support auto-updates, unlike its normal installer-based versions. I happen to use MSYS2's UCRT64 environment which makes the Linux tools I like play nice with the ...
1
vote
1
answer
58
views
Algorithm for Conway's Game of Life in potentially infinite grid in Python
I implemented a program for computing Conway's Game of Life iterations in Python starting from an initial grid configuration given as input. It is intended to handle arbitrarily large grids. I tried ...
2
votes
1
answer
73
views
C++ Chess Engine - Initialization of Magic Bitboard Attack Tables
I've just completed the generation of magic bitboard attack tables for bishops and rooks in my C++ chess engine.
Main Questions
The functions generateMagicNumbers()...
1
vote
1
answer
45
views
Reusable storage for array of objects V3
Here is a second follow up on Reusable storage for array of objects and Reusable storage for array of objects V2, taking into account the provided answers.
The following code should be compliant at ...
0
votes
2
answers
48
views
Idiomatic retry loop in Go
I recently started taking on the Gossip Glomers distributed systems challanges as a way for me to practice writing Go and learn something new. In order to solve one of the challenges, I had a request ...
3
votes
1
answer
48
views
Reusable storage for array of objects V2
Here is a follow up on Reusable storage for array of objects, taking into account the provided answers.
The following code should be compliant at least with gcc, <...
1
vote
2
answers
108
views
Two sum sliding window challenge
The task is a simple coding challenge I took part in. It is a spin on the two sum problem.
In the two sum problem you are given an validation sequence A and a test input I. I is valid if it's the sum ...
4
votes
3
answers
233
views
C++ custom string class implementation
I recently had an interview where I was tasked with implementing a custom C++ string class without using the STL. The interviewer provided the function signatures and variable declarations, specifying ...
11
votes
2
answers
2k
views
CAT: Cat Approved TUIs
Cat
Hello everyone! I am working on this TUI framework which aims to abstract the ncurses library. I was wondering how understandable it is, and what I can improve! Any feedback is welcome!!
My ...
1
vote
1
answer
61
views
blog RESTFUL api with posts and comments
I built RESTFUL api for a blog using java and spring boot(without a frontend).
What it does
the code manages all the http methods on a post inside the blog and comments on that post.
the post consists ...
2
votes
2
answers
107
views
Permissions system in MERN app
I am working on a MERN stack app that is a CRM with a couple of modules. Now when the user sends x request to the server to do a supposed action (such as delete something), the server first checks if ...
0
votes
1
answer
31
views
Ruby-function for reading, parsing a text-file, removing data-duplicates
Task description:
Implement a generate_unique_phone_numbers function.
The function shall parse the given text-file.
Content-example:
...
2
votes
2
answers
119
views
Mapping composition in Java
(See also the continuation of this post.)
This time, I have a mapping type:
com.github.coderodde.mapping.Mapping.java:
...