All Questions

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

Self Running iterable state machine with Enums in Java

During development I needed to design a state machine with decision which runs to completion and performs state transition without the need to wait for events. So i come up with the following ...
0
votes
0answers
6 views

Correct way to delete posts and unlink images using NODE JS

I have the following tables in MySQL: ...
1
vote
1answer
29 views

Is performing IO in constructor good idea?

I have Java (or C#, Python, Kotlin, or other similar language) class that will be used to communicate with client over network. Protocol used by this application allows many different ways to create ...
0
votes
0answers
6 views

Advent of Code 2019: Day 6 (with Trees)

I've been going through some 2019 AoC challenges and decided to solve Day 6 in Haskell with the help of Data.Tree. In summary, the puzzle provides a list of orbits (...
1
vote
0answers
8 views

PowerShell Script to Harvest System Inventory

I've written a 'fast & dirty' PowerShell script to harvest a system inventory of Windows client and\or server operating systems to streamline case note documentation. ...
1
vote
0answers
9 views

Angular: HttpInterceptor for caching HTTP request

I would like to get your opinion on this service, which is used to cache HTTP requests. See the working demo, this is the full code: ng-http-caching.module.ts ...
2
votes
0answers
16 views

Concerned about thread safety

I'm writing start/stop module for my application. I have a class that manages application life cycle and I called it Work. Work ...
3
votes
2answers
53 views

This python code converts integers to strings and strings to ints without the inbuilt functions “int()” and “str()”

It is my solution from a challange from edabit.com named "Drunken Python". Thats the task: You need to create two functions to substitute str() and int(). A function called int_to_str() that ...
3
votes
2answers
40 views

Shortening list of arguments to some kind of a variadic function

If you look at ImportAndPreload method, it looks bad because: MovingAverageConvergenceDivergence, StochasticRSI, RelativeStrengthIndex and ExponentialMovingAverage. ...
-3
votes
0answers
20 views

How to create a folders and subfolders in python in a tree like structure [closed]

I want to create folders and subfolders in the order: Test , Train ,valid. Each of these folders will contain 1 to n subjects and each subject will have three different folders. Ex: ...
-5
votes
0answers
16 views

8 Puzzle problem using BFS in python [closed]

i want to apply 8 puzzle problem in python using BFS algorithm in simplest way. please somebody help me. i just write the main class but i cant go further. ...
1
vote
0answers
40 views

Building a string with only two repeating characters (different code)

Context I would like to receive feedback on my code for the question which can be seen here. Problem This is another C# implementation for the a function for given parameters ...
5
votes
2answers
670 views

Too many class what the alternatives?

Working on a program that using RIOT API league of legends that collects the data of a player and calculate how skill a player is by using a grade system( AS of right now it just the average of the ...
5
votes
0answers
33 views

Mutual recursion - Naming the opponent serve - pingpong

Problem statement Ping-pong The ping-pong sequence counts up starting from 1 and is always either counting up or counting down. At element k, the direction switches if k is a multiple of 7 or ...
-2
votes
0answers
31 views

I’m a beginner building a terminal hangman app in which you can decide what the guessword for you opponent is [closed]

The following program directs you to a menu once you start it where you can either enter a new guessword or start the hangman game. By looking at it I think the code should work but once I press 2 to ...
4
votes
0answers
28 views

JavaScript string to Unicode (Hex)

This set of questions are related to a project I've published for converting characters, or strings, to Hex based Unicode; eg... ...
3
votes
0answers
46 views

A valid Sudoku Generator without backtracking in JavaScript

I am new to programming. I tried to write a valid Sudoku solver with backtracking, the performance is disappointing. So, I tried to generate a valid Sudoku generator without backtracking. The white ...
2
votes
0answers
45 views

Using >= even though it's impossible for > to be true [closed]

I can't find an answer to this question either because it doesn't exist or because I am incapable of searching for it correctly. Consider this code which prints out the numbers from 1 to 12 ad ...
7
votes
1answer
34 views

Accounting for floating point error when rounding

I have to implement some business logic that will round a number (typically a double) upwards. Given that this number comes from a third-party and I don't know how they come to calculate it I'm ...
3
votes
2answers
26 views

Merge Sort Implementation and Optimization

This is Merge Sort that i implemented, i feel i can make it better esp the combination function. So i split the code into functions because i don't like seeing a bunch of spaghetti code in a single ...
3
votes
0answers
23 views

Optimizing the topological sorting

I have implemented the topological sort. Is there any suggestion for optimizing the solution? Thanks. ...
4
votes
1answer
64 views

Doubly-linked list with iterators

Writing a double-linked list seemed like a good practice for understanding it. I tried to fix all the errors that were pointed out to me in the last question, as well as add new functionality. In ...
1
vote
0answers
14 views

Generic memoize function in Swift

I need to perform some expensive calculation, such as determining a Fibonacci number: ...
2
votes
1answer
35 views

Optimize insertion from ArrayList to HashMap

I'm trying to insert data from ArrayList to HashMap<String, Language> optimally. Many items may have the same languge_name (code below), so I need to group items having the same language in ...
1
vote
0answers
21 views

Connect 4 in TypeScript

This is my first TypeScript program, so I'm curious as to what conventions and optimisations I may have missed. Concerns: I'm not sure whether to check for 4 in a row in the entire board or to just ...
7
votes
1answer
457 views

Building a string with only two repeating characters

The below is the C# implementation for the a function for given parameters int a, int b - both represent characters 'A' and 'B' ...
3
votes
0answers
19 views

Text only turn based battle simulator

This is my first proper-ish project I've made. This was my first time using classes as well. I know that I made really stupid decisions, this is extremely far from being anywhere close to optimal, and ...
-1
votes
0answers
31 views

A star in C++ path tracing issue [closed]

I am implementing the A* algorithm on a 2D grid of nodes (squares). I am unable to trace back the path from the end node once the path is solved. I think that I am not linking the nodes correctly. If ...
2
votes
0answers
19 views

Linkedlist & hashmap _duplicates removal

I have implemented a LinkedList removal fo duplicates class by using HashMap. Looking forward to your reviews. Thanks. ...
0
votes
0answers
41 views

C++ god object refactor [closed]

In my program I have singleton god object class Core. I want to refactor it. Code: ...
3
votes
0answers
17 views

Securely upload multiple image files with PHP

I am working on script to a upload image files Securely. can anyone please review my code and suggest improvements on security. ...
2
votes
2answers
24 views

Better way to code this code snippet (copy paste)

I am trying to improve upon a VBA code created through recording a macro. Can the code below be optimized (I was informed to avoid .Select as much as possible)? The code itself works fine for me ...
7
votes
1answer
53 views

Text Parsing in C on a microcontroller

Microcontroller receive data on uart and call parser_i2c function when user presses enter e.g. parser_i2c(I2C scan) I want to parse following input from user communicated through uart I2C scan I2C ...
0
votes
0answers
32 views

C++ modifying const pointer reference value [migrated]

I've encountered similar code piece today and it got me wondering. I did a little experiment myself as shown below. Why does the first stuff function with shared ...
2
votes
1answer
20 views

Display toast after action

I have a React functional component where users can add a movie from a list to their dashboard. I'm displaying a toast (Material UI Snackbar) to show the result. The result can be good: movie has been ...
3
votes
1answer
51 views

Any ideas how do I prettify this SQL query?

This question is abut coding style. I'd like to see how would you improve this code look considering readability as well. Feel free to upvote others solutions you find good. #1 Initial version: ...
2
votes
1answer
34 views

Fast API path parameters from Enum Class

from enum import Enum from fastapi import FastAPI app = FastAPI() Hi Defined a route and a Enum Class for the same but the Enum Class looks ugly. ...
7
votes
1answer
81 views

Compare and analyze sent and received vectors

I have a set of connections and protocols for which I am writing unit tests. Their purpose is to assess 2 vectors for validity and consistency; that is there must be not any elements that have been ...
2
votes
0answers
63 views

Request mixed with JSON strings and array fields, in custom function for reduction need Simplify/Refactory

Client From a POST request I get a mixed structure of an array and JSON. To handle multiple type of elements I am using var_dump to get the passes. For ...
5
votes
1answer
28 views

Extract the data from Dicom files in an time efficient way

I am trying to extract and save images from a Dicom dataset. It is taking approximate 4-5 hours to process 1000 files. (Also, I am reading and saving files in an external hard drive so there is a time ...
6
votes
1answer
187 views

Handling errors in potentially incomplete responses

I am using the library geoip2 to get Geolocation of many IP adderesses ...
-5
votes
0answers
23 views

Generating a recursive list [closed]

Given a list of numbers p[i] for i=0,...,n what is the best way to generate a list N[i] in python where each element of N[i] is such that ...
-4
votes
0answers
24 views

Dict vs. tuple of tuples vs. ordered tuple [closed]

A function in a package I'm developing should take a list of IDs as input, make async calls to a server for each of the provided IDs and return server responses for each ID. I'm trying to choose ...
5
votes
0answers
28 views

after initial r*view here is a rewrite of my c++ timerqueue ported to rust

Purpose. Provides a background task queue so that code can ask for a function to be run at a specified point in the future. They indicate what to run (a closure) and when to run it (also a name just ...
6
votes
0answers
65 views

c++ std::function implementation

When I first tried to implement std::function I thought it would as easy as creating a class that holds a function pointer. Consequently, I quickly figured out that ...
2
votes
0answers
22 views

Ranking Tennis No.1s

Previously, I built a scraper to get ranking data for ATP # 1 over the years. See Webscraping tennis data, and follow ups. Now, I use the data to rank the players on the basis of how many weeks they'...
2
votes
0answers
24 views

Collect messages from a job to send in body of one email

I have a Spring service that calls a few methods to ...
3
votes
0answers
33 views

Nodejs async with express server

I use the following code which works as expected. the code uses open ID connect to login user, as I'm pretty new to node and express, it will be great if I can get ...
2
votes
0answers
15 views

Birthday messages at start of new day with time zone support

My goal is to let users specify their DOB and time zone, I want to send them a birthday message when the day just started in their time zone (00:00) regardless of where my server is hosted, I am using ...
6
votes
1answer
104 views

Faster and cleaner SHA-1 leading zero histogram with Python

I've written a python code for finding the distribution of the leading zeros of SHA-1. Using random inputs and hashing than counting. Normally it is expected to fit the ...

15 30 50 per page
1
2 3 4 5
1354