All Questions
76,157
questions
0
votes
0
answers
27
views
Unit test for a registration form using C# and Selenium
I would like to know if the below code written in C# Selenium to do Unit Test is efficient and readable. Is there any particular way to do Unit Test. Else suggest me where I can learn to do better ...
4
votes
2
answers
518
views
JavaScript front end for Odin Project book library database
I am currently working on The Odin Project and have reached the JavaScript Part. There is a project, to create a Website that serves a a library. You can add a book and it appears on the site as a ...
0
votes
1
answer
30
views
javascript calculation of person ages and heights
I need to take sum of all the person's ages and heights.
Input Array:
...
1
vote
1
answer
62
views
Need someone to evaluate my Encryption Decryption Algorithm
I have been trying for so long to code an encryption/decryption algorithm using the modulus operator. Basically my code does a basic mathematical operation on given text and key then do a modulus 255 ...
1
vote
0
answers
30
views
Update a gamer and its child objects using Entity framework 6.0 [closed]
The below logic is working fine. But is there any way to optimize this logic ?
Gamer is the root level object, it will have Characters. Character will have set of Skills & a weapon
I want to ...
0
votes
0
answers
47
views
Creating a 3rd party League of Legends application to mimic chat and preemptively filter for profanity to prevent misconduct
My small project I'm working on is meant to be a League of Legends 3rd party application ran along side it to preemptively warn the user before they go about making the incorrect decision to trash ...
1
vote
2
answers
61
views
USACO Training - Section 1.5 - Arithmetic Progressions [closed]
I am working on the USACO problem Arithmetic Progression. Here is their problem statement:
An arithmetic progression is a sequence of the form a, a+b, a+2b, ..., a+...
0
votes
1
answer
67
views
Count the number of objects created statically and dynamically in C++
I have written below program to count the number of static and dynamically created object of the class.
...
1
vote
0
answers
57
views
Node.js batch processing
Batch processing steps:
When a job is posted, push it to the queue.
Get the required number of items from the queue and put it in the ...
0
votes
0
answers
21
views
Shortest path in dags: Part 3/3 - the demo benchmark
Part 1/3
Part 2/3
In this post, I will present the benchmark code from this project.
com.github.coderodde.graph.benchmark.DemoDagProvider.java:
...
2
votes
1
answer
69
views
Price calculator for a dispensary
I'm making an out the door calculator for my dispensary. As it stands now the program works 100%, im planning on adding a GUI and such in the future but right now im focused on not have a god class ...
0
votes
1
answer
27
views
Nametag fiddle: matching data with its rules for display
The problem statement is as follows:
I have a database of name tag data. I want to display these name tags to the screen. Each item of information on a nametag has certain rules for its display.
Here ...
2
votes
0
answers
41
views
Virtual memory manager, physical memory manager and buddy allocator
I'm writing memory manager for my toy operating system and I would like to get some feedback. There is physical memory manager, which uses bitmap, virtual memory manager which uses buddy algorithm for ...
1
vote
1
answer
55
views
Haskell function that executes each action until a predicate returns True
The following function executes each action from the list until a predicate returns True. I have a feeling that this function can be rewritten using ...
1
vote
1
answer
69
views
game interface setup
I've learned that magic numbers are bad in code. However, should the coordinates, and rotation angles of all the sprites be stored in variables? Is the convention in game development to leave those ...
7
votes
3
answers
123
views
Program that calculates the first n powers of x
I am a beginner. I wrote a C program that calculates the first n powers of x and I don't even know if this is legit C code or ...
1
vote
1
answer
56
views
Shortest path in dags: Part 2/3 - the preprocessing and shortest path algorithms
Part 1/3
Part 3/3
I have this library for performing shortest path queries on dags (directed acyclic graphs). This post presents the shortest path algorithms and the topological sorters. Two ...
1
vote
1
answer
45
views
Shortest path in dags: Part 1/3 - the graph data structure
Part 2/3
Part 3/3
I have this library for performing shortest path queries on dags (directed acyclic graphs). This post presents the graph data structure:
...
1
vote
1
answer
107
views
Iterate and assign weights based on two columns (python)
FI_name
ISN
Sector
Industry
REC
INE02
PS
FS
HDB
INE03
PR
FS
ABC
INE04
PR
FS
RHC
INE05
PR
CO
ZHE
INE06
PR
FS
HSE
INE07
PR
FS
ZAK
INE08
PS
MT
HGB
INE09
PR
FS
YUJ
INE10
PR
MT
WSD
INE11
PS
FS
...
1
vote
2
answers
60
views
Calculates the multiplicative persistence of a given number // Returns the smallest number with a given level of MP (Numberphile Challenge)
I was watching this Numberphile video: https://youtu.be/Wim9WJeDTHQ on multiplicative persistence (multiplying digits of a number over and over until one digit remains). I decided to take up the ...
1
vote
1
answer
42
views
Pulling images from a MongoDb database
I have a method that on click produces an excel file with information in it. I have been asked to pull images from the data base and add them within the excel file as well. This is how I am pulling ...
1
vote
0
answers
39
views
Simple rust ECS with no dynamic dispatch
I'm trying to write a minimal, high performance uncomplicated ECS for a simple game in which I have a good idea of all of the Entity and Component types from the get-go.
I want to take advantage of ...
0
votes
0
answers
13
views
best way to check if every part of a stepper is valid and emit an event then
I want to check if each part of my multipart form is valid inside my stepper component, if it's the case I intend to emit an event that can be handled by the parent component.
To do this, I have made ...
1
vote
2
answers
44
views
JS page loading without refresh
As an exercise, I found a basic way of updating pages without refreshing, partially mimicking the behaviour of SPAs and routing libraries such as React Router. I was not looking for something as ...
-3
votes
1
answer
57
views
How can I optimize my code and reduce execution time? [closed]
I would like to see if it is possible to optimize the following code. Indeed before I was in php and the execution was much faster. but I had to switch to java and unfortunately the execution of the ...
2
votes
1
answer
36
views
Bash script to take user input to set AWS envrionment variable the first time and automatically in subsequent calls
Background
Our team has a utility called envmgr to set aws iam roles. The credentials are only good for 4 hours or so. As such, I have a number of scripts that call the command ...
1
vote
1
answer
55
views
Tic Tac Toe - Python
I made a program that allows a player to play Tic Tac Toe against a computer. Of course, I didn't make it analyse the slightly harder algorithms, as I am just a beginner at programming. Are there any ...
1
vote
0
answers
18
views
Converting future.get() to CompletionStage.whenComplete()?
I currently have some code in Java which looks something like this, but I want to refactor this.
...
4
votes
3
answers
795
views
Filter an array, but remove the filtered elements
I needed a PHP function that would filter values from one array into a new one, while also removing those values from the original array. After looking through the docs, I didn't see any such function,...
1
vote
1
answer
57
views
Output last occurrence of match in file
Hi this is my problem statement
File 1 contains lines like this :
aaaa 1
aaaa 2
bbbb 1
bbbb 2
bbbb 3
cccc 1
cccc 2
dddd 1
dddd 2
File 2 contains ...
2
votes
1
answer
67
views
Slot machine game using python
I made a 3 reel slot machine using the pygame library in Python. This is what I have so far.
I want to improve it to make it work for a 3x5 slot machine with multiple paylines, right now it is a 1x3 ...
1
vote
0
answers
30
views
DOM scrolling implementation [closed]
Which code is considered better to write to implement smooth scrolling for the page?
1st, with optional chaining:
...
3
votes
1
answer
295
views
C++ disk-file memory resource
After writing a C++ simulator for malloc() and free(), (C++ imitation of glibc malloc(), free()),
I thought: "My simulator ...
3
votes
1
answer
57
views
Tic-Tac-Toe - JS + HTML
Coming from a python background, I recently started learning django, currently at the javascript section. This tic-tac-toe code is to familiarize myself with javascript basic concepts. No application ...
0
votes
0
answers
28
views
`nat -> nat` uncountability proved in Coq
I am learning vanilla Coq (not ssreflect). That's my way to prove that { nat -> nat } is uncoutable:
...
2
votes
1
answer
38
views
Function to find the first pair where the sum zero. using 2-pointers approach
Here is the function called sumZero, where it should return the sum of any two numbers in the array to sum upto zero. where the array is a sorted array.
My approach:
Using 2 pointers approach, calling ...
4
votes
0
answers
83
views
Determine when a file is no longer being changed by hashing
I have a requirement to essentially scan a filesystem on any kind of filesystem and move a resource whenever it is ready. To do this I have the following code
...
3
votes
2
answers
814
views
Password Validation Class
I created a class designed to validate passwords based on user defined criteria. Each PasswordValidator object objects a minimum and maximum password length, a character blacklist, as well as ...
-2
votes
0
answers
21
views
how can I code script that use the hashlib python script to retrieve multiple files md5 within selected directory [duplicate]
I am not sure what I am doing wrong as this code I am trying to make function which collects the md5 of all files within the selected folder and then prints it
...
1
vote
0
answers
23
views
JavaScript webworker sandbox
I am trying to make a JavaScript sandbox thru webworkers. This sandbox is only used for very basic JavaScript, so I want to strip all of the global API's and built in functions, such as ...
2
votes
0
answers
24
views
All pairs/Cartesian multiplication of iterators in rust
crustaceans!
This is my attempt at creating an all_pairs operation for rust iterators. The code has to generate a new iterator which, when iterated, produces all ...
10
votes
1
answer
159
views
C++ imitation of glibc malloc(), free()
I wrote a C++ simulator that performs algorithms for glibc malloc() and free().
The core logic is basically the same, with the ...
3
votes
2
answers
91
views
Card game using OOP
I already know that I shouldn't really use the global function and that how I judge who wins is also really inefficient so I would appreciate improvements for that. I watched a tutorial about Object ...
5
votes
2
answers
208
views
A matrix class using const members
I've long used a simple matrix class with a vector and rows/cols for the shape. But I've always disliked getters even when necessary to prevent exposing invariants. Then came c++20 which provided the ...
1
vote
1
answer
57
views
Testing string membership using (in) keyword in python is very slow
I have the following text dataset:
4 million paragraphs of length between (10-60 words each).
...
3
votes
0
answers
37
views
My first rust program: transposing a CSV
Here's the result:
...
2
votes
1
answer
47
views
Project Euler 11 Haskell - Largest product in a grid
Intro
I have been learning haskell and functional programming using random Project Euler problems. Currently, I have solved Problem 11.
What is the greatest product of four adjacent numbers in the ...
0
votes
1
answer
38
views
better localStorage api
I wasn't quite happy with the way localStorage handles non-string values, for example ...
3
votes
2
answers
71
views
Bash script using SSH to sum disk usage on NetApp
I have tried to come with below bash script which is at least working for me, i know its not perfect and that why i want some review and suggestion to make it more aligned with bash practices. I'm ...
1
vote
0
answers
29
views
A Type.FromText function in M for PowerQuery using Expression.Evaluate
The Solution
I recently came across this solution here, for a Type.FromText() function in M for Power Query*. This solution allows a user to extract the actual <...