All Questions

Filter by
Sorted by
Tagged with
4
votes
3answers
389 views

Program to print the multiple occurrence of numbers in a list

I wrote this program to print how many times each number occurs in a list: ...
0
votes
0answers
24 views

Test A Swizzling Swift method

I've a method that swizzles out the the localization bundle for another put in the project build. It works great: ...
1
vote
2answers
82 views

Listing last 3 items (or all if less than 3) in an ArrayList

Writing a code to return the last 3 items in a list, if the list has 3 or more elements, otherwise return all list items. But the code looks really bad. What is a better way to write the same code? <...
6
votes
1answer
130 views

Web scraper that extracts urls from Amazon and eBay

Description: This is a simple script for scraping Amazon and eBay category, sub-category and product URLs and saving contents to files. In case of previously saved files, the files will be read and no ...
-2
votes
0answers
18 views

For The Ambulance Class, this.sirens displays as 'undefined'. I cannot find why [closed]

When I run the code, I get this.sirens result show as 'undefined'. ...
3
votes
1answer
34 views

Finding similar items in two arrays with multithreading in C++

I'm exploring multithreading for some code that I want to speed up in C++. I wrote a simple program to facilitate my understanding. The program takes in two arrays of equal length, the value of the ...
4
votes
0answers
118 views

The anime downloader [duplicate]

NOTE: Here's the latest version of this program, since this question idled out. This is a recreational script made to update my home server w/ the latest anime from HorribleSubs. I'd like to know if ...
-4
votes
0answers
41 views

new to python, longest collatz sequence [closed]

i am new to python and struggling with an assignment. "Consider the following operation applied to positive integer values: if the number is even, then halve it, but if the number is odd, then ...
2
votes
3answers
109 views

Split array into chunks (JavaScript, Python, PHP)

Problem Given a list and an integer chunk size, divide the list into sublists, where each sublist is of chunk size. Codes Just for practicing, I've coded to solve the problem using JavaScript and ...
1
vote
0answers
17 views

Searching for Duplicates in SQL Table with Confidence Score

Sometimes I'm not sure if my questions should be here or StackOverflow, so I appologize if this is the wrong place. I have a SQL (MS SQL 2016) stored procedure that is evaluating data looking for ...
-3
votes
0answers
16 views

Potential errors and selecting backend [closed]

https://codesandbox.io/s/github/lukaszbrk/Umowy2/tree/post-4p Helo, The app is used to search for clauses by their name and the keywords they contain. When a clause is selected, the columns with the ...
-2
votes
0answers
20 views

ReentrantLock.signal() not working as expected but ReentrantLock.signalAll() works. Why? [closed]

In my simple code below, if I replace condition1.signal()/condition2.signal() with ...
2
votes
0answers
24 views

Upgrade script for MediaWiki website with one external addon

I have a MediaWiki 1.33.0 website with only one external addon installed (external extension), which is ContactPage. I wrote the following script, that, if there is an upgrade to either MediaWiki ...
2
votes
1answer
69 views

LeetCode: Greatest Common Divisor of Strings C#

https://leetcode.com/problems/greatest-common-divisor-of-strings/ For strings S and T, we say "T divides S" if and only if S = T + ... + T (T concatenated with itself 1 or more times) ...
1
vote
1answer
27 views

Small service for hashing and validating passwords, using PBKDF2

As part of a larger authentication/authorization system, I've developed a small .NET Core 3.0 service for hashing passwords using PBKDF2 (with a salt) and validating passwords against a stored hash/...
0
votes
1answer
42 views

Solution to knapsack problem exceeds time and RAM limits

My goal is to code the knapsack problem algorithm. The problem is that a knapsack has a given weight limit, W. I have a collection of items which have a given ...
2
votes
2answers
48 views

Creating a stack class in C++

Create a class called Stack for storing integers. The data members are an integer array for storing the integers and an integer for storing the top of stack (<...
0
votes
0answers
10 views

Using CMake and googletest: Structuring file systems

This is my first time moving out of Microsoft and into Linux. As such I now no longer work in Visual Studio and have had to learn the ropes of building projects myself. I use Sublime Text as an editor ...
-3
votes
0answers
49 views

Is this sudoku answer correct? [closed]

I have been trying to submit my answer to https://www.urionlinejudge.com.br/judge/en/questions/index/1383 My outputs are correct according to the problem. (Code with inputs here:) http://ideone.com/...
0
votes
0answers
7 views

Dependency Injection approach pass just one IServiceProvider or one parameter for each interface? [closed]

I am not sure of what is the best approach between pass a IServiceProvider or to pass directly the interfaces I will need. ...
12
votes
3answers
741 views

Python algorithm that converts array-like data into MathJax

I frequently use MathJax, and often I need to write matrices. Since writing matrices using MathJax is very tiresome task, I decided to automate it. Code: ...
-1
votes
3answers
78 views

IF statement with multiple AND/OR conditions [closed]

I have if statement with many checks. There must be a better way to implement this. Does someone have an idea on how to improve this method? I have many similar methods in production. I would like to ...
1
vote
0answers
30 views

Find parallel-base left-truncatable primes

Factorial base - representation of numbers not as sums of base_number^digit_number, but as sums of digit_number! (factorial). So 7 (decimal) is represented as 101_! in factorial base, because 7 = 6+1 =...
5
votes
2answers
64 views

Display hexadecimal value stored at a register

I read a book about OS development and faced with a simple exercise: write a function that prints a hexadecimal value stored at a register. The program runs as a boot sector. I would really ...
0
votes
0answers
41 views

Simple password generator with 6 letters, 3 numbers and 4 symbols in C [closed]

I have to make a password generator with 13 caracters, 6 of them are letters (3 cap), 3 numbers and 4 symbols. I tried make this way: ...
2
votes
3answers
91 views

Unit tests code for a Java class that that checks whether an array is sorted

I'm trying to write unit tests code for a java class. The class tests an array for sorted (either way) or not. Here is the Unit Tests code: ...
6
votes
1answer
48 views

simple and extendable shop

My task is to write a simple shop. The requirements are : It can have multiple items Each item its own price and quantity Each customer basic identifier such as full name Each customer receives ...
1
vote
1answer
35 views

Sudoku validation

Problem explanation I've written a function to validate sudoku. Given a two-dimensional 9×9 array of numbers: Each row should have each of the numbers 1–9 exactly once. Each column should have each ...
0
votes
3answers
61 views

Basic Palindrome check comparing chars

I've seen variations of this assignment where you reverse a string to match it to the original to find out if it is a palindrome, but this version I made only iterates through half of the string ...
3
votes
0answers
43 views

Simple vanilla JavaScript Carousel with tabs and pause button

I currently got into coding and I am completely self taught. Since I know that my code is far from being perfect, I am asking for advice and tips on how to improve. Feel free to drop in any comments ...
2
votes
1answer
40 views

K_nearest_neighbors from scratch [on hold]

I wanted to create a script that will perform the k_nearest_neighbors algorithm on the well-known iris dataset. This was mainly for me to better understand the algorithm and process. I think it works, ...
5
votes
3answers
176 views

C++ logging class

I've created a simple C++ logging class. It outputs various loglevels, and adjusts output color accordingly. I'm interested in any tips to improve my coding style. I am especially concerned with my ...
-1
votes
0answers
31 views

SQL Injection Username and Account number to change password [closed]

I want the user to enter their account number and username in order to confirm their identity and change the password. The code works when i only put the username to be confirmed but i can't seem to ...
2
votes
1answer
61 views

Rock Paper Scissors Beginner Python Game [closed]

I recently made this game for rock, paper, scissors in Python 3. Everything works as intended, but I am sure this is not an optimal way of accomplishing this task. Wondering if there is any beginner ...
6
votes
1answer
65 views

program options from command line initialize [v2 - after CR]

After getting a CR from @pacmaninbw and @ALX23z here, I want to share my new code, and to ask for better ways (which always exist) to improve the code, even with new libraries. The only thing that ...
1
vote
1answer
27 views

Updating NamedTuple members based on a function and previous value

I'm using a NamedTuple to represent the state of my game while it's running. The user can alter these settings using key presses, so in my PyGame key handler, I'm ...
3
votes
2answers
144 views

LeetCode: Diameter of Binary Tree

https://leetcode.com/problems/diameter-of-binary-tree/ Given a binary tree, you need to compute the length of the diameter of the tree. The diameter of a binary tree is the length of the longest ...
1
vote
0answers
31 views

leetcode 230: kth smallest element in a Binary Search Tree

Here is my implementation: the goal of the algorithm is to find the kth smallest element in a BST. ...
-6
votes
0answers
36 views

Can't replicate code with the same logic [closed]

The code that gets the right value (Utility percentage) ...
-4
votes
0answers
28 views

Need help converting my program to M-V-C [closed]

I'm currently doing a course in Object Oriented programming in Java, and we need to create a game using JavaFX and the Model-View-Controller approach for our last lab so my lab partner and me chose to ...
7
votes
3answers
492 views

Checking an array is sorted in either order efficiently

Here is my code, it works fine, just wondering if there any anything to make it even better. ...
-3
votes
0answers
34 views

code works but shows wrong values [closed]

Hi I am new to programming while trying to execute this script the input file has this form (in this case they are called nohd*.txt files) ...
3
votes
1answer
275 views
+50

Monitoring Traces for Satisfaction of Temporal Logic Properties

I am trying to implement a monitor for a certain temporal logic. What this means is the following: There is some external source, from which a trace of items are coming. An item looks like a ...
4
votes
2answers
697 views

Palindrome and Reverse a String Problems (JavaScript, Python)

Problem 1 Given a string, the task is to reverse the string and return a reversed string. Problem 2 Given a string, return true if the string is a palindrome or false if it is not. Code Just for ...
1
vote
0answers
31 views

Message handling: Should a test/spec do it?

I am currently implementing an app that uses an architecture based on features & usecases and message sending. Features are created with message handler passed in. To test the feature, a handler ...
5
votes
1answer
46 views

Creating procfs entry on linux in Kernel Module

My Linux kernel version is Linux version 5.0.0-29-generic I'm currently learning how to write kernel modules for Linux and implemented this simple module which ...
2
votes
1answer
57 views

PHP code for blacklisting and rewriting/redirecting URLs

We faced an issue where URLs had a wrong "subfolder" in its URL, so e.g. example.com/match1/randomgenerated should have been ...
1
vote
0answers
9 views

Changing opacity of KML file (with icon linked) fetched in the Leaflet Map

I have a solution for making the .kml file transparent in the Leaflet Map. The working code looks like this: ...
1
vote
2answers
78 views

Breadth-first search(BFS) Implementation in Python 3 [closed]

I have implemented a BFS. Does this look like a proper implementation of BFS in Python 3? And if you think something needs to be improved, say it. ...
5
votes
1answer
37 views

“Bigint” decimal to two's complement binary list of bytes in Python

I'm toying with the idea of writing a "bigint" library in 6502 assembler that would handle variable-length integers up to 255 bytes long. Since this would be unit tested using pytest, and to help wrap ...

15 30 50 per page