All Questions

Filter by
Sorted by
Tagged with
-2
votes
0answers
34 views

2 player dice game, assistance needed [closed]

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
48 views

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

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
10 views

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

I refereed to your answer on : "Always stay connected" mechanism for socket connection ...
-1
votes
3answers
37 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 ...
7
votes
4answers
4k 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: ...
5
votes
3answers
197 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
30 views

Size out of limits in array made with malloc [closed]

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 ...
3
votes
2answers
75 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
45 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
38 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? [closed]

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
42 views

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

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 ...
8
votes
1answer
354 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
14 views

Wrapper for object to avoid ambigous boolean in method [closed]

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 : ...
4
votes
1answer
32 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
42 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
26 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
22 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
17 views

java.lang.NoClassDefFoundError JEE with Maven [closed]

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
61 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 ...
8
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
70 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
47 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
32 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
44 views

TicTacToe Game Python design questions, marked with? [closed]

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 [closed]

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
58 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
32 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
26 views

Seekable HTTP response stream wrapper

I created this wrapper to use together with HttpClient streams and ZipArchive. ZipArchive ...
2
votes
1answer
39 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 ...
6
votes
2answers
110 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
118 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 ...
2
votes
1answer
276 views
+50

Computational verification of Collatz conjecture using OpenCL

This code review request follows my previous request Computational verification of Collatz conjecture. Unlike the previous program (which was designed for the CPU), this code should run on modern GPUs....
1
vote
2answers
64 views

Flat file column based parser

I implemented a Column-based FLAT parser and generator, where the information is loaded from a base class, which contains the attributes that tell the column size and type. For each line of the flat ...
-1
votes
1answer
33 views

Prime coins- Segment Tree [closed]

So this question came up to one of the company interview. I felt it as a straight segment tree question with sieve, and I was able to pass the given sample test cases, but unfortunately not a single ...
4
votes
2answers
69 views

Target Sum leetcode

I am trying to solve this problem You are given a list of non-negative integers, a1, a2, ..., an, and a target, S. Now you have 2 symbols + and -. For each integer, you should choose one from + ...
1
vote
1answer
45 views

Categorize & sub categorize from contents of one row and more execute even more queries in results

I have a table called sales and it has below columns: 'id' 'product_type' 'soldDate' 'text' ...
3
votes
1answer
36 views

User defined function call on a stack based interpreter for concatenative language

I would like to receive some advice on how to improve a small concatenative stack-based interpreter, executing a joy-like programming language. It is really minimal, and is in fact a subset of a ...
1
vote
1answer
43 views

Group items by types: replace nested for loops with reduce

I have a working code that groups items by their type values. The types can be one or multiple, however they are always returned as an array. To illustrate: if an item has types with values ...
4
votes
1answer
93 views

Random password generator that ensures diversity of character types and absence of confusing characters

I wrote the following password generator, to generate a password in which each character group appears at least at once. ...
2
votes
1answer
66 views

Verifying Mathematical Expressions

This is a part of my calculator program. I have to check if the input entered by the user is a valid mathematical expression. The first check is performed by another program, where the program checks ...
6
votes
1answer
55 views

Light weight C++ Signals/Slots or Event System

This assumes there is no need to aggregate results from the listeners of a broadcast signal. Technically I guess the slots are whatever your std::function holds, ...
7
votes
2answers
121 views

Iterate only once using LINQ

Funny thing, the following test works: ...
3
votes
1answer
29 views

Sessions class With assoc-array - practicing

I try to dealing with sessions.. including arrays before moving to "database". Sessions class.file ...
3
votes
3answers
48 views

Find a String in an Array

This program is used to get names and numbers of N person, print out the numbers of a person. Please help me improve this code. Additional Question: To avoid a very long name that exceeds char's ...
2
votes
2answers
57 views

A function that returns all letters in the Alphabet except the ones in a pre-defined list

This function should return a string that is comprised from all the letters in the Alphabet except the letters in a pre-defined list in alphabetical order. Assuming all letters in the pre-defined ...
4
votes
1answer
52 views

Paginate IEnumerable<T> sequence

I used the following to split sequence into batches: ...
4
votes
2answers
65 views

JavaRPN (Updated)

I have previously worked on this program in this question, and have gotten some very good answers and help! Now, I have done some more work on the program, and would love if you could give me honest ...
4
votes
1answer
65 views

Getting Windows User Info From The Active Directory

I took some boilerplate code that I have been using for determining an active windows user's info to either send emails with their details, or to pass to a error logging class, and encapsulated it in ...

15 30 50 per page