All Questions

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

RXjava call an API and insert data into DB

I want to call an API and if it was success insert data to DB and then if it was success ...
0
votes
0answers
19 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 ...
2
votes
1answer
24 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 ...
4
votes
0answers
19 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 ...
0
votes
0answers
20 views

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

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 ...
3
votes
0answers
17 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... ...
1
vote
0answers
18 views

I tried to built a Valid Sudoku Generator without Backtracking in JavaScript

I have 120 days worth of experience after discovering GitHub. In other word, I am new to programming. Earlier, I tried to write a valid sudoku solver with backtracking, the performance is ...
0
votes
0answers
37 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 ...
6
votes
0answers
17 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 ...
2
votes
2answers
21 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 ...
2
votes
0answers
15 views

Optimizing the topological sorting

I have implemented the topological sort. Is there any suggestion for optimizing the solution? Thanks. ...
1
vote
0answers
25 views

I'm creating a workout tracker for fun and wanted to know if this db design is to complicated [closed]

First time here, hopefully this kind of question is accepted. I'm trying to make my first workout tracker application for fun. For the workout database I did come up with these design and wanted to ...
2
votes
1answer
46 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
10 views

Generic memoize function in Swift

I need to perform some expensive calculation, such as determining a Fibonacci number: ...
1
vote
1answer
25 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
20 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 ...
6
votes
2answers
182 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
18 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
30 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
18 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
37 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
15 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. ...
0
votes
2answers
9 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 ...
5
votes
1answer
45 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 ...
1
vote
1answer
14 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
48 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: ...
1
vote
1answer
30 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. ...
6
votes
1answer
52 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
60 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
0answers
23 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
184 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
27 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
58 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
21 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
22 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
32 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
99 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 ...
1
vote
0answers
19 views

How can I make the quickview open in mobile? [closed]

The current code works well in browsers and smoothly opens product quick view, but I want an option for opening the quick-view trigger on mobile screens. Currently, it shows no option for user to open ...
6
votes
1answer
42 views

Blocking Queue in C++ using semaphores

This is mostly an exercise for me to try to understand the differences between semaphores and locks. It's a long and rambling because it took me quite a few tries to understand the concepts. Please ...
8
votes
0answers
48 views

Dungeon Ball, a Pygame

I just completed the first release for my first game on Python, called Dungeon Ball. I'm looking for people to test out the app and give me some feedback and constructive criticism. I'd like to use ...
5
votes
0answers
46 views

Determine the complexity of sorting a binary array

The challenge is to sort an integer array containing only ones and zeros with the lowest complexity possible. As always, I am interested in any improvements suggested but in this question I am most ...
-3
votes
0answers
24 views

ALL websites in my WHM redirect to same domain if i hit non ssl version of url [closed]

I have a WHM cpanel with over 10 + domain say site 1 to site 10 i install ssl in site no. 8 , 9 , 10 now if i i call non ssl version like http://www... for site no 8,9,10 , it call the first site ...
1
vote
0answers
22 views

Protocol with generic array-like property [closed]

I'm creating a protocol to abstract different models (hand-crafted, decodable, and thrift-generated) like so: ...
3
votes
1answer
69 views

Setting instance data attributes to None in __init__ [closed]

In Python 3.7, I frequently find myself writing something like this in __init__: self.foo: Optional[Foo] = None For example:...
0
votes
0answers
51 views

Count the number of neighbors

I have a numpy array called contour of \$N\$ coordinates (x,y) of dimension (N, 2). For each ...
3
votes
0answers
26 views

SEDE query calculating user reputation averages

I've created the following SEDE query which calculates the reputation averages of users on a particular site. It also optionally excludes "new" users (users with rep of 1 or 101 so note 100% ...

15 30 50 per page
1
2 3 4 5
1354