All Questions

1
vote
1answer
34 views

Token generator for Valve Data Format parser in Java

I'm looking to parse a reduced subset of the Valve Data Format (VDF). It is similar to JSON, allowing representation of key-value collections (maps) with arbitrary recursion. As a small example: <...
-1
votes
0answers
16 views

How to reduce a given series expression to an algebraic expression? [on hold]

I need to reduce the given series expression to an algebraic expression, without summation. Then I have to express the performance of the algebraic expression in Big O Notation. I am mainly confused ...
-1
votes
0answers
20 views

PHP database constructor [on hold]

Im getting started with PHP and trying to write a constructor for a DB using this piece of sample code ...
4
votes
1answer
41 views

Python Pygame treasure hunt game

This is a python game that I am working on. It is a grid based treasure hunt game in which you collect coins from specific tiles (some tiles ask you questions in which you need to answer correctly in ...
0
votes
1answer
58 views

Return a sorted ordering of courses such that we can finish all courses

The task: We're given a hashmap associating each courseId key with a list of courseIds values, which represents that the prerequisites of courseId are courseIds. Return a sorted ordering of ...
1
vote
1answer
20 views

Multiple database connections class

This is my database connection class in order to handle multiple connections with the use of context managers. Brief explanation: The __init__ method reads ...
1
vote
0answers
41 views

Simple Mastermind in c++

i created this console application ( it's actually a Mastermind) and i would like to know what can i improve as a beginner. Thanks ! ...
-1
votes
2answers
46 views

Refactor multiple if statements while creating object [on hold]

I've got a class with few fields: ...
2
votes
1answer
24 views

RESTful API echo server using Python bottles

I just wrote an echo server that responds to curl requests with the method used and the data sent. Sticking to GET and POST for now, but I would like to know if there's something I can do to improve ...
1
vote
1answer
35 views

Leetcode 3Sum problem using hashmap in Python

For practice, I solved Leetcode 15. 3Sum question: Given an array nums of n integers, are there elements a, b, c in nums such that a + b + c = 0? Find all unique triplets in the array which gives ...
5
votes
3answers
93 views

Student grade calculator using classes/ structs in C++

I am trying to teach myself C++ and using Problem Solving in C++ by Walter Savitch. This is a program project from the book that I used to practice using classes/ structs and would like some feedback, ...
-1
votes
0answers
20 views

Null Pointer Exception based on HashMap [on hold]

I am getting a Null pointer exception despite instantiating a general HashMap with constant values. I intend to track inventory of various car types in a car rental service; with car type serving as ...
2
votes
1answer
53 views

Simple Console Snake game C++

I recently started learning C++ and have made a very simple Console-based Snake Game, I would like to have some feedback on improvements. You might notice the obvious delay in clearing and printing ...
-1
votes
0answers
29 views

How to predict stock returns with a multivariate regression in R [on hold]

I’m replicating a study which was published in the journal of finance. My findings are the opposite of the paper and since I’m very new to R, I’m not sure if, I’m running the regression correctly. ...
0
votes
0answers
10 views

how to get char ascii value in python without using builtin functions [on hold]

how to get char ASCII value in ' python without using built-in functions ord("char") byearray("some char") byearray("some char")
-1
votes
0answers
15 views

When scraping webpage XPATH variable returns Unfinished Literal [on hold]

I am trying to scrape Amazon for ASIN Best Seller Rank and when I run the script in python it returns an unfinished literal error Everything works except for the Best Sellers Rank. I would really ...
0
votes
1answer
30 views

Calling token API

I'm calling an API to request token, and making sure i'm not leaving any corners for errors and handle the result appropriately. It's a web service POST call in general, The code gets credentials, ...
-2
votes
0answers
21 views

Calling Salesforce Live Agent API in Java [on hold]

I haven't used the objects in the java.net.* library before. This is all taking place in the run() method of a subclass of ...
6
votes
2answers
378 views

Python Making Brute Froce Crack Faster

I made an Brute Force Cracker with python, but its extremely slow. How can i make it faster? ...
0
votes
0answers
21 views

WPF Async Filter [on hold]

I'm using a SearchWaterMArkTextBox and a Gridview, where I've bind this line to my gridview. ...
3
votes
0answers
27 views

Analyzing spoke overlaps during rotation: Round 2

Round 1: Analyzing spoke overlaps during rotation I previously posted this question, but I've changed a lot of the code since then. There was a mention of the previous being a bit mixed up, and ...
0
votes
0answers
10 views

Codable Failure Response Handler

Suppose You have two kind of response like one for success and one for failure Success response model will looks like ...
5
votes
3answers
74 views

K&R C book, Exercise 1-21: Replace tabs with spaces

I'm new to C, just started reading K&R C book, and am working through exercises. This is my solution to 1-21, and as far as I tested it works. Anything that I'm doing wrong, or that it's not ...
1
vote
1answer
54 views

Find out whether string A can be shifted to get string B

The task: Given two strings A and B, return whether or not A can be shifted some number of times to get B. For example, if A is abcde and B is cdeab, return true. If A is abc and B is acb, ...
4
votes
1answer
90 views

Word Chain Implementation

The idea originaes from the CodeKata19, find a word chain for two words of a wordlist example 1 turning lead into gold: ...
2
votes
2answers
51 views

Chained Sort Python Implementation

So I've run into a few occasions where I'd want to sort a list according to a criteria, then for all loosely sorted sublists (a sequence of equal elements), I'd want to sort those sublists according ...
1
vote
1answer
29 views

A simple Java class for implementing code stop watches - follow-up

I have received a nice answer for this post. Now, it is my attempt for some improvement: ...
1
vote
0answers
26 views

Java: Note for monitoring buy/sell item list

I'm making note where you can add items that you buy or sell, any suggestions? ...
5
votes
2answers
409 views

Python update SQLite DB Values

At the moment I try to get used to SQLite and Python. I started with insert, select and so on. But now i want to get a bit further. Now I have a DB with 200 rows for testing and in want to update two ...
-5
votes
0answers
16 views

Losing the penny on the output [closed]

I'm writing a Python script that will prompt the user for monetary value (such as 11.26). Then, calculate the number of dollars, quarters, dimes, nickels, and pennies. It should use the maximum ...
11
votes
2answers
2k views

BinaryTree<T> written in C#

I've written a binary-tree using .NET Core 3.0. What can I do to improve my coding style? ...
0
votes
2answers
40 views

JavaScript DOM Implementation

I'm supposed to create a website that adds multiple forms to the page, is responsive and checks if the inputs are valid (validation is not important, just needs to show some attempt at regex). Below ...
1
vote
0answers
20 views

Stack layered lookup

This is code I wrote to check a product structure from 1 table in a database. It's based on a type which can have area(s) and area(s) can have group(s). I have: ...
-2
votes
0answers
18 views

Shopping List Creation [closed]

For my coding class I have to build a shopping list by having the user enter the number of items they need and then each item (one at a time). I then have to output the final shopping list in a multi-...
2
votes
2answers
66 views

Reach to the last index starting at index 0

The task: Given an integer list where each number represents the number of hops you can make, determine whether you can reach to the last index starting at index 0. For example, ...
3
votes
1answer
61 views

Design of a Tic Tac Toe program in Python

Here is a program I wrote to reproduce the known win proportions for random Tic Tac Toe games (X always moving first). It takes about a minute to play the one million random games that will be played ...
1
vote
2answers
85 views

Calculating the minimum and maximum of a byte array [on hold]

I've been working with binary files with this last assignment and part of it was to determine the maximum and minimum byte. Initially this was 2 functions but a bonus portion was to make them into 1 ...
2
votes
1answer
75 views

C++ ASCII To Base64 String Encoding

My Base64 encoder class converts a string with ascii characters to a base64 encoded string with padding if required. Note that I'm not using istream as the input ...
2
votes
1answer
29 views

Using boost::mpi to take the Euclidean norm of a vector

I am learning MPI (via boost::mpi) and wrote this program that takes the euclidean norm of a 1-D vector (represented as an array here.) I want to make sure that I ...
2
votes
0answers
22 views

Quiz for random boolean expressions

Inspired by the various quiz programs on this site, as well as Simon Tatham's puzzle collection, I thought I'd write a quiz that constructs its questions automatically and randomly. A typical session ...
1
vote
1answer
31 views

Find closest greater and smaller number from a sorted array

I have a sorted array. It can be empty. I have to find its closest greater and smaller number. If the given number is present in the array, it will be considered as greater number. I implemented it ...
-2
votes
0answers
13 views

Mongoose populate operator not working [closed]

i know this question has been asked a lot but none of the solutions of those questions solved my problem . i am trying to join two collections and use the populate method but the populate method seems ...
12
votes
1answer
78 views

Brainfuck to NASM compiler in Haskell

After reading this article on writing a Brainfuck interpreter in Haskell and achieving awful performance with it (for example, mandelbrot generating 37.5 minutes on an old Intel Atom powered laptop) I'...
-2
votes
0answers
28 views

Order Integers From Ascending as Well As Descending Order [closed]

I am working through a worksheet of for loops in c# and have come across this problem, "Write a program to request an integer n from 1 to 9 and print a line of output consisting of ascending digits ...
6
votes
1answer
45 views

Analyzing spoke overlaps during rotation

For a personal project that I've recently started I have to analyze the rotation of two shapes with sets of spokes, where the spokes are evenly-spaced, and split into a given number. That is, if I ...
-3
votes
0answers
12 views

Trouble reading and printing content of my text file in Java Main Method [closed]

I have a text file shown below with different input types on a line that I am trying to read accordingly as shown below. I put the text file "Vehicle.txt" shown below directly in the src folder of my ...
2
votes
1answer
22 views

Refactoring coordinates for Minecraft Pi buildings written in Python

I'm fairly new to coding and I wrote this script in Python for a house with a roof in Minecraft Pi. I've found different ways to write the coordinates to make the code base shorter, but I'm wondering ...
4
votes
0answers
27 views

dynwg: A DynDNS watchdog for WireGuard via systemd-networkd

Preface I'm using WireGuard as a VPN solution to connect a remote client permanently to my home server. Unfortunately due to Consumer DSL-related IP address changes, the client loses the connection ...
0
votes
0answers
70 views

Algebraic data types in C++ [on hold]

After some exposure to Haskell I came to love ADTs to describe 'is one of' and tree-like structures. But now that I work with C++ a lot more I want to use them in C++ too. As far as I know I have two ...
1
vote
1answer
55 views

A simple Java class for implementing code stop watches

(The next iteration: A simple Java class for implementing code stop watches - follow-up) Here is my attempt at more convenient benchmarking (yes, this time I am aware of JVM warmup, etc.), and it ...

15 30 50 per page