All Questions

3
votes
1answer
40 views

Hash table with dynamic sized array in C

To gain a broader insight in things many (high-level language) programmers nowadays take for granted, I decided to study some of the more basic ways of storing data in memory. I wrote a program which ...
0
votes
0answers
32 views

Python: Max function on dictionaries [closed]

This time, write a procedure, called biggest, which returns the key corresponding to the entry with the largest number of values associated with it. If there is more than one such entry, return any ...
6
votes
3answers
2k views

Extract all GPU name, model and GPU ram

I currently use this code to extract the required GPU data. Can you review this method for efficiency or best coding practices? Code ...
1
vote
0answers
33 views

Running an UPDATE SQL QUERY within VBA using DAO

I have a macro in Excel that updates a recordset using WHERE a primary key in MS Access matches a primary key in a UserForm label value. The macro is called from a ...
0
votes
0answers
29 views

I've got enums on top of enums, and then some more traits for those enums… it's getting unwieldy [closed]

So I have an enum wrapping an enum, but I have another enum talking about what that enum is. Which makes for a confusing English sentence, so here's an example. I got one enum: ...
-1
votes
3answers
71 views

How to flatten a list of lists? [closed]

How to flatten a list of lists in more pythonic way? This is the code I tried. ...
4
votes
1answer
47 views

Bar graph of Easter date distribution

Computing Easter for a given year is a classic computational problem. It is also one of the few cases when code seems to just have to live with magic numbers. Alternative to magic numbers: Decoding ...
1
vote
1answer
75 views

2-Player Tank Battle Game [on hold]

I've created a 2-player tank battle game. The code however seems like it could be greatly simplified and there are a few issues. One of which is the hitboxes of the tank seem a bit unreliable. ...
-2
votes
1answer
35 views

Search customer by ID not printing [closed]

I dont know why my code is not working at all. In my Eclipse there's no errors shown at all. I want to use the id to print the name of my customers, and that's my goal ...
-2
votes
0answers
17 views

Set background-color of image in css [closed]

Smart invert for the ipad inverts the colors of everything except images. This increases battery life. It works great except for latex math equations at wikipedia which wikipedia converts to png ...
0
votes
0answers
30 views

Simple Linked List N Insertion [closed]

Hey guys here is a pretty simple linked list insertion in C++ and I understand most of it, but I had a question. Why does changing markerPointer at the last line effect head which is returned by the ...
-3
votes
0answers
25 views

Trying to output a game [closed]

I need help with the area I think I highlighted with arrows (static void updateTeam & processUpdate) Suppose to output a game where you type in a team and it will out put win, loss, and ties. ...
-3
votes
0answers
19 views

Tictactoe minmax recursion causing confusion [closed]

I read a number of tic tac toe examples using the minmax algorithm but haven't found a good one that really explains what's going on. I've written one that works but need help understanding a small ...
3
votes
0answers
69 views

Java game: select numbered tiles to form a goal sum

This is a homework project (Soft. Eng.) which I have completed. My teacher gave me a 91, but I am unhappy with this grade because my code is quite messy. (Please excuse incomplete Javadoc, the code is ...
1
vote
0answers
18 views
-3
votes
0answers
41 views

Remove Code Duplication [closed]

I have a card class, my show image function has a lot of duplicated code, what would be the best way to simplify the example code below. each case statemen though return a unique value. ...
0
votes
1answer
37 views

Making Anagram Problem Implementation

Problem Statement Alice is taking a cryptography class and finding anagrams to be very useful. We consider two strings to be anagrams of each other if the first string's letters can be rearranged ...
2
votes
1answer
45 views

VBA - If value in sheet1 found in sheet2, then delete data from sheet2

I have 2 sheets setup: Exclusions and Issues Issues has a list of CASE ID's and Columns that list the "Issue" Exclusions will be populated with CASE ID's that are to be excluded (and removed) from ...
2
votes
2answers
200 views

Is there a way in Ruby to make just any one out of many keyword arguments required? [closed]

I am trying to write a method, that works with three types of arguments, but requires only one of them. def convert(arg_a: 1, arg_b: 2, arg_c: 'foo') end Please ...
2
votes
1answer
27 views

Edit button toggles modal and load data from PHP using AJAX and JQUERY

I've been working on an edit/update button that will toggle a modal that looks like this: Is there a better code for this JavaScript code that I made? ...
1
vote
1answer
50 views

MinMax Problem Implementation

Problem Statement: You will be given a list of integers, arr, and a single integer k. You must create an array of length k from elements of arr such that its unfairness is minimized. Call ...
0
votes
1answer
30 views

Haskell: How to split the main:: IO() to a main::IO() and a function [on hold]

This code is to recreate the game 'Earthworms'. The part I need help with is the main :: IO() part. I want to split this part ... ...
1
vote
0answers
43 views

Simple Asynchronous Dispatch Queue

I'm practicing C++11/14/17 and am teaching myself the STL multithreading library by writing an asynchronous dispatch queue for my simple use case. It seems to "work ok" but I want to know if it's ...
2
votes
0answers
39 views

A C++17 `std::allocator` implementation

This is an implementation of C++17 std::allocator under the name my_std::allocator, with deprecated stuff omitted for simplicity....
3
votes
1answer
166 views

Tic tac toe game in a web browser

I have this tic tac toe game which is very old project of mine, though I made some changes on this to improve the script to perform better. This game is functional, Any logic improvements or other ...
1
vote
0answers
32 views

Java local service with sockets

My goal was to create a Java service on Windows that runs locally and communicates with local programs using JSON. The service should be reliable and robust. The service runs a ServerSocket and ...
0
votes
1answer
40 views

Find indices of two numbers such that they add up to a target

The task ...is taken from leetcode Given an array of integers, return indices of the two numbers such that they add up to a specific target. You may assume that each input would have ...
-3
votes
0answers
23 views

Python- HTML comparing two HTML files and ignoring elements [closed]

I am using python to compare two HTML files and it spits out the difference, but i need it to ignore certain elements like ""... the value part as it will always change and be different. Please could ...
0
votes
0answers
19 views

Authentication and auto renewal of an API Token

Following is an https call to retrieve the token, once it's retrieved, it's cached. Callers call the addTokenObserver method that sets a timer based on the token ...
8
votes
0answers
168 views
+50

Windows keylogger in C++

Windows keylogger in C++ Known issues: Not implementing rule of five Having to use hack to use member variables, out_, in static method Pressing caps-lock won't ...
1
vote
0answers
26 views

Line segment intersection from the Berg et all, computational geometry

I've implemented the following algorithm (From "Computational Geometry : Algorithms and Applications"). The code is below: (All the code actually is here: https://github.com/lukkio88/...
16
votes
6answers
5k views

Check which numbers satisfy the condition [A*B*C = A! + B! + C!]

#include <iostream> #include <cmath> using namespace std; int s = 1; //Serial No. Should I use recursion for the factorials function? ...
0
votes
2answers
83 views

User interface HTML string generated using PHP

Goal This is very basic beginner script, only for prototyping, probably never to reach alpha/beta prototyping/production, is being designed/tested for performance. Its performance quality might be ...
3
votes
1answer
59 views

Given a list of coordinates, find the rectangle with minimal area

A problem on leetcode asks the coder to write an algorithm to take a bunch of coordinates in the xy-plane and return the minimum area of a rectangle made from four of these coordinates (or return <...
0
votes
0answers
24 views

Java Minimax Tic-Tac-Toe [closed]

I've been researching the minimax algorithm and how it's implemented in Tic-Tac-Toe. But for whatever reason, it loses, on average, 15% of the games against a random bot. Could someone help me figure ...
-1
votes
0answers
18 views

Pascal's Formula Recusrion (not triangle) [closed]

So i am trying to recurse through Pascal's formula which is (n-1, k-1) + (n-1, k) but i am having trouble going through both the sides. i am thinking about it as a box trace ..here is what i have so ...
7
votes
1answer
46 views

ArXiV Technical Paper API Github Repo

My name is Ethan and I am trying to build an API for scaping technical papers to use for developers. Right now it only works for ArXiV but I would greatly appreciate some mentoring or a code review of ...
-1
votes
0answers
12 views

Need help creating a continueGame method that will work with my NumberGame.java file [closed]

I'm trying to finish this program I have been working on for a bit but I am very confused on how to create the continueGame method when the return value should be boolean but its using an input as the ...
2
votes
0answers
39 views

Code Chef's Cleaning Tables: find the minimum number of tables to clean

Description: Haku has been newly hired by Chef to clean tables at his restaurant. So whenever a customer wants a table, Haku must clean it. But Haku happens to be a lazy boy. So in the ...
1
vote
0answers
15 views

Calculate mean of vector primitive numerical values generically

I'm trying to write a generic mean function for all values within an Vector of generic numerical primitive type. Could the following implementation be possible ...
0
votes
1answer
60 views

Combinational string search using Java

I wrote a program that receives 2 strings (Input and Search) in the Search string. The sign '+' indicates that if the substring before the '+' exists in the Input string. (The search string cannot ...
5
votes
1answer
76 views

A cartesian product of tuples in C++17

I would like to write a function that computes a cartesian product of two tuples in C++17 (the tuples can be of type std::tuple or ...
1
vote
0answers
40 views

Find all pairs of unique indices in a list such that the concatenation of the two words is a palindrome

The task Given a list of words, find all pairs of unique indices such that the concatenation of the two words is a palindrome. For example, given the list ["code", "edoc", "da", "d"], return ...
1
vote
0answers
9 views

A matrix-vector multiply parallelized using boost::MPI

This program performs a matrix-vector multiply using MPI to split the computation up. It is not extremely robust (for example, it doesn't handle the case where the number of MPI processes does not ...
1
vote
0answers
21 views

Puzzling SBCL Compiler Note

I’m having trouble understanding an SBCL compiler note about unreachable code in the following function. The referenced code is attempting to push a value into an Lparallel queue: ...
3
votes
1answer
68 views

Matrix class with space-optimized triangular (lower and upper) variants

I've written a class for square numerical matrices (of doubles, in this case), in C++11. Since I intend to use this class later ...
0
votes
0answers
21 views

How can I find gcd of two polynomials in c++ using long division [closed]

I am finding the remainder and the quotient of the two polynomials using the long division. I don't understand how should I calculate the gcd of those two. ...
0
votes
0answers
19 views

Single chars mapped to enums in Rust

I'm writing a simple program to parse lines read from a file. As I'm new to Rust, I wonder if I'm creating too much boilerplate. A sample line in the file looks like this: ...
1
vote
0answers
21 views

Salary-structure report using a web-presentation

I had to create a report which presents the salary structure of a firm. The data needed was provided by the client as CSV-files. I used PHP for the reading and preprocessing of the data. The actual ...
0
votes
0answers
53 views

Codility Ladder (Fibonacci) lesson [closed]

I am trying to solve the "Ladder" problem from Codility. I got only 37% score (75% for correctness and 0% for performance). Can anyone help to identify the problem in my code. I found an optimal ...

15 30 50 per page