All Questions

Filter by
Sorted by
Tagged with
2
votes
0answers
5 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
11 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 ...
1
vote
0answers
5 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
9 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. ...
-4
votes
0answers
27 views

Can't replicate code with the same logic [on hold]

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

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

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 ...
2
votes
0answers
43 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. ...
-2
votes
0answers
24 views

code works but shows wrong values [on hold]

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) ...
1
vote
0answers
11 views

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 ...
1
vote
2answers
52 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
21 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 ...
4
votes
1answer
30 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 ...
1
vote
1answer
30 views

Is this PHP code for blacklisting and rewriting/redirecting URLs good?

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
4 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
46 views

Breadth-first search(BFS) Implementation in Python 3

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
33 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 ...
-2
votes
0answers
28 views

2 player dice game, assistance needed [on hold]

The players roll two 6-sided dice each and get points depending on what they roll. There are 5 rounds in a game. In each round, each player rolls the two dice. The rules are: The points rolled on ...
0
votes
1answer
45 views

Python - 'if name in dict:' OR 'try:/except:' [on hold]

I'm writing some OO Python and I would like to know which of these methods is more pythonic, or which is generally better, or faster. This is an accessor for an attribute which is a dictionary. ...
-2
votes
0answers
9 views

TCP reassembly not happening with windows APIs in WINDOWS APPLICATION .NET [on hold]

I refereed to your answer on : "Always stay connected" mechanism for socket connection ...
-2
votes
2answers
15 views

Implement state eraser for NIST DRBG and other crypto primitives using macro

As a spare-time personal project, I'm implementing a set of symmetric-key cryptographic primitives. One thing I've left vacant for a long time, is the key/state eraser, which I decide to add right ...
6
votes
4answers
2k views

Find the closest enemy

I'm currently creating a 2d game in python. I have to calculate the closest enemy so the player knows which one to target. I have the following function to accomplish this task: ...
3
votes
3answers
96 views

C# Bowling Game interview test

I recently interviewed for a software engineering job that requires at least one year of C# and experience with the Microsoft stack. Even though I made it clear at the outset that I had zero ...
1
vote
0answers
25 views

Size out of limits in array made with malloc [on hold]

I'm applying what I learned in statistics class to a program to calculate everything automatically, but encountered an unexpected 'mistake' in my code. I say unexpected, because it's not the first ...
2
votes
2answers
48 views

program options from command line initialize

I'd like to receive a CR for the following command-line program options' initializing using boost::program_options. I'd like to know if there is a better way of ...
5
votes
1answer
35 views

Log Text Messages In Google Sheets

This script sends and receives text messages and logs responses in a google sheet. Demo Gif here: https://github.com/RyGuy96/HealthTracker. I'm a self-taught beginner coder just starting my formal ...
5
votes
1answer
33 views

Simplified Blackjack in Python

I just started learning python a couple of weeks back from and like many others here, I too seek feedback on my simplified Blackjack game. I would like to know if the code could have been more elegant/...
-4
votes
0answers
17 views

having errors with makin g a palindrome program with methods? [on hold]

So I'm trying to make a palindrome program that uses the methods reverse(int number) and isPalindrone(int number) and the program rather prints out palindrome or not palindrome, but I'm getting the ...
-4
votes
0answers
22 views

How to find the Area of an Irregularly Shaped Room [on hold]

I'm having trouble figuring out how to solve this. Remember the formula for finding the area of a rectangle is length * width and the area of a right triangle is 0.5 * the base * height. Sample run ...
7
votes
1answer
296 views

Truth table generator for an arbitrary function

Summary: This function generates a truth table for a boolean function of variable number of arguments. The name of the function passed and its arguments are deduced outside of the computable function ...
-1
votes
0answers
12 views

Wrapper for object to avoid ambigous boolean in method [on hold]

I recently thought if wrapping an object in a method that returns that object only when a method inside it is called is a good idea. I have a User object with fields like username, email, avatar etc. ...
8
votes
2answers
2k views

Implementation of A* algorithm in C++

I have implemented the A-Star path finding algorithm for a 2D grid. The function returns a list of positions of an acceptable path. main.cpp : ...
3
votes
0answers
12 views

Passing around context.Context in Golang

I am currently "gracefully" handling HTTP server net/http shutdown which works perfectly fine (I am not asking you to review server shutdown). As seen in the code ...
3
votes
1answer
33 views

Swift protocol with lazy property requirement

First question here on CodeReview. I was directed here from a question I asked on SO: Swift protocol with lazy property - Cannot use mutating getter on immutable value: '$0' is immutable. Goal: ...
4
votes
1answer
19 views

Bash script to reconfigure the screen orientation when entering or exiting tablet mode

I'm writing a bash script for my tablet laptop to flip the screen depending on a file in Manjaro Linux. My current script is the following: ...
2
votes
0answers
19 views

File and folder filter for a “last-updated explorer”

Sometimes I save a file somewhere but can't find it after or I install something and want to see what files were added. For this reason, I created a winforms app which only displayes files created/...
-3
votes
0answers
14 views

java.lang.NoClassDefFoundError JEE with Maven [on hold]

I have create two project as maven project in eclipse(Jee Version: 2019-09 R (4.13.0)): frontoffice and core . I want to add a dependency between the two project so i did like follow : core : pom.xml ...
5
votes
1answer
56 views

State space search for sliding tile puzzle

I am working on state space search (8 Puzzle) in Python and when I run my program with python3 -m profile, I find out that most of time program performs a few ...
7
votes
4answers
1k views

Replacing each letter with the letter that is in the corresponding position from the end of the English alphabet

I wrote a small program for hyperskill/jetbrains academy to encrypt the message "we found a treasure!" and print only the ciphertext (in lower case) by replacing each letter with the letter that is in ...
4
votes
2answers
55 views

C# Cryptography Interface

C# lacks a common off-the-shelf encryption and decryption interface for dependency injection. Nearly every codebase I've ever opened has a couple of extension methods for hashing strings and so on. ...
1
vote
1answer
42 views

Add a value to each of the array element between two given indices successively

I am trying to solve the HackerRank: Array Manipulation problem using Java. The problem that I am facing is that the program is running for half of the test cases, while for the other half it is ...
-7
votes
0answers
26 views

Please explain the code means for the TicTacToe Game [duplicate]

I would like to get an explanation in English, what this section of the code below means: ...
-5
votes
0answers
37 views

TicTacToe Game Python design questions, marked with? [on hold]

Please explain the code lines I marked with triple question marks (???) for the TicTacToe Game So far I understand all lines, except for the lines marked with ???. I numbered the question mark (e.g. ?...
-3
votes
0answers
18 views

Plot Histogram and QQ plots [on hold]

I am new to Python and have written a code for plotting the histogram of a dataframe as well as its QQ plot in order to check normality. However, I would like to know how to further optimize the code ...
4
votes
1answer
56 views

Creating an inverted index from text documents

I am working on an information retrieval project, where I have to process a ~1.5 GB text data and create a Dictionary (words, document frequency) and posting list (document id, term frequency). ...
3
votes
0answers
28 views

Application uniqueness and unilateral IPC on Unix

This program Detects application uniqueness, if the application is a unique/primary instance, it launches a server, otherwise a client over a Unix domain socket. Client will send a message that will ...
2
votes
0answers
22 views

Seekable HTTP response stream wrapper

I created this wrapper to use together with HttpClient streams and ZipArchive. ZipArchive ...
-4
votes
0answers
34 views

Which of these code blocks should I use for max efficiency? [on hold]

I am aware that isalnum() really just returns isalpha(character)||isdigit(character) to see if it is alphanumeric. Is alpha does ...
2
votes
1answer
34 views

OpenFile function in C++

I am in the process of learning basic C++ and one of the practice questions I came across was to write a function to open a file in C++. I did understand how to use the streams but I think I went ...
2
votes
0answers
14 views

Implementing a REST API in Go using gorilla/mux and Gorm

While learning Go I decided to implement a simple REST API to get to know the language and since I am inexperienced in Go I would appreciate any feedback on the code. Please post any thoughts you ...
2
votes
2answers
106 views

Brute-force ID reversal search

EDIT The random number generator in this code is a blackbox for a similar algorithm that isn't publishable for privacy concern. The algorithm works in similar way, in that it takes in a seed value ...

15 30 50 per page