All Questions

Filter by
Sorted by
Tagged with
2
votes
1answer
34 views

Snake game using graphics.py

I am a self taught python beginner for about 3 months and recently I finished my own snake game project. As seen from the code, it is not very efficient nor tidy to look at so I want to know if there ...
-2
votes
0answers
8 views

I need to modify this code to produce the desire output

I need to modify the function to return a new array of names of the people who are 16 or older. function getNamesOfLegalDrivers(people) { return people ...
5
votes
2answers
56 views

Project Euler # 62 Cubic permutations in Python

The cube, 41063625 (\$345^3\$), can be permuted to produce two other cubes: 56623104 (\$384^3\$) and 66430125 (\$405^3\$). In fact, 41063625 is the smallest cube which has exactly three permutations ...
1
vote
1answer
32 views

Extension to BindingList<T> that allows for cancelable notifications of changing and deleting

This is an extension of the System.ComponentModel.BindingList<T> class that allows for notifications of item changing and deleting. These notifications ...
-1
votes
0answers
13 views

Solving Kruskal algorithm using Python

This is the problem from uva online judge. Visit https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=975 In an episode of the Dick Van Dyke ...
2
votes
1answer
28 views

Compute the square root of a positive integer using binary search

The requirement is to find the square root of a positive integer using binary search and the math property that square root of a number n is between ...
3
votes
3answers
26 views

Rotate List by K places

I am trying to solve the question at :https://leetcode.com/problems/rotate-list/ Question: Given a linked list, rotate the list to the right by k places, where k is non-negative. Example 1:...
1
vote
0answers
10 views

Compare two Excel sheets by Cell Content

This code is a result of a lot of help from this community. What does it do? It compares two excel sheets cell by cell and copies the differences into another excel file. I’m trying to modify the ...
2
votes
2answers
31 views

C++ Least cost swapping 2

I've made a solution for a problem which involves changing order of objects having some mass, so it costs a mass of an object A and a mass of an object B to make a swap. The full description of the ...
0
votes
1answer
16 views

C++ For Euler Problem 3

Here's my solution for Euler Problem 3: The prime factors of 13195 are 5, 7, 13 and 29. What is the largest prime factor of the number 600851475143 ? I'm using the Euler problems to learn ...
5
votes
1answer
110 views

STL-like vector implemention in C++

I attempt to write a STL-like vector, mostly to figure out how it works. I wonder which parts look weird or what I made stupid. Any kind of comment is appreciated: alloc.hpp ...
3
votes
2answers
60 views

Find the first missing positive integer in an array of integers

The problem is the one explained in Given an unsorted integer array, find the first missing positive integer Given an unsorted integer array, find the first missing positive integer. For ...
5
votes
2answers
88 views

Custom serialiser with object factory

A couple of years ago I wrote a serialisation library for my project. By the time it worked well, but recently I thought it could be modernised. Back then I needed something that looks similar to ...
9
votes
5answers
213 views

Reducing contention in thread-safe LruCache

I was looking for a in-memory cache class, but couldn't find any in the .Net Core framework; luckily I found one already implemented here. I made some minor modifications to it and tried to make it ...
1
vote
0answers
61 views

Creating a date adder

We are thinking about hiring more developers so I was asked to compose a test. I have been looking online for ideas. I found this question: How to add n days to a Date in java without importing Date/...
1
vote
0answers
5 views

Asp.net web API Nlog implementation with UnhandledExceptionHandler

I have an asp.net web api. I would like to log errors into a file. So I decided to use NLog. I already have UnhandledExceptionHandler so I added NLog as follows. I removed all the try/catch in order ...
12
votes
3answers
1k views

Binary Converting Code

I made a program that converts a decimal number given from the user, and converts it to a binary number. For example, if I entered 2, it would return 10. It then, counts the amount of ones and zeros ...
2
votes
2answers
3k views

HackerRank - Birthday Cake Candles and the counting loop

I was having fun on solving one of the HackerRank simple challenges - Birthday Cake Candles. Description Colleen is turning n years old! Therefore, she has n candles of various heights on her ...
2
votes
2answers
28 views

Radix2 Fast Fourier Transform implemented in C++

Note: If you don't know much about Fourier transform algorithms, a simple review of whether I am doing anything inefficient with C++ in general would be appreciated. I've been working on implementing ...
1
vote
1answer
66 views

Bowling Kata in Java

I am sharing my Bowling Game Score Kata made in Java, it is available for whoever wants to code review it. I appreciate any comments. ...
2
votes
1answer
28 views

HackerRank leaderboard challenge Time out

https://www.hackerrank.com/challenges/climbing-the-leaderboard/problem I tried to solve this challenge and optimize the solution but I still have timeout. This my code below The code simply starts ...
3
votes
0answers
22 views

React - pomodoro clock

I'm looking for some feedback on a pomodoro clock that I recently wrote with React. I'm pretty new to React and coding in general. I followed a couple of online courses, but I'm mostly self-taught. ...
1
vote
1answer
34 views

Remapping property IDs when inserting CSV data to a database table

My code is functioning the way I'm expecting, with the if. However, it is not pythonic to me, and that bugs me. The multiple if in the code below are supposed to ...
0
votes
0answers
10 views

Web application with user privileges and role feature

I'm building a web application with CodeIgniter which manage the following roles: Super Administrator Administrator Operator Customer Each role have a default list of privileges, eg: ...
5
votes
4answers
180 views

Java methods to add and authenticate users in MySQL

I'm going through some code and trying to figure out how to get rid of duplicates from the following two methods. Both methods execute a simple login/register query to a local MySQL DB. I couldnt ...
2
votes
1answer
28 views

Fast Food Order Simulator

I have been trying learn OOP lately, and have made a simple program that simulates some sort of drive thru experience using a 9 digit keypad to add, delete, and pay for items ordered from the menu. ...
8
votes
4answers
334 views

Parse a simple key=value config file in C

Write a program that should read a file formatted strictly like this below: $ cat sample bingo=2 bingo2=939 bingo3=text The left and right side of ...
2
votes
1answer
141 views

Trick circumvents [position: sticky] restriction to parent

Check out the live example: https://verifuse.github.io position: sticky; elements are sticky within the bounding box of their direct parent containers. I wanted to ...
2
votes
2answers
2k views

Java API token expiration handler

I want to implement a utility class which manages tokens generated by any API. The idea is simple: It should store the current token value. The token should be initialized just before first use ...
3
votes
1answer
24 views

LeetCode #37: Sudoku as Exact Cover Problem solved using Dancing Links

Introduction I provide a regular 9x9 Sudoku solver, reducing the puzzle to an Exact Cover Problem. The algorithm used is Knuth'...
-3
votes
0answers
22 views

C# to C++ (dependency injection, passing parameters) [on hold]

I'm relatively new to c++ and trying to understand some conversion from c# to c++. I am struggling to understand when to pass a parameter as reference/pointer/smart pointer or what to return. I read ...
2
votes
2answers
28 views

Google homepage beginner project

I was hoping to get some feedback on my basic recreation of the google homepage. Im doing the Odin Project learning course and this was the first project trying to use the basics of HTML/CSS HTML ...
-2
votes
0answers
6 views

JavaScript Function that Pops Up “Open File” Dialog [on hold]

So, I have a text file to download. Right now these files are getting downloaded as text and displayed in a browser window, which is awkward and very inconvenient. Because you have to manually copy ...
7
votes
3answers
79 views

String routines

These are a few string routines (just the mem* ones). I've tried to optimize them the best I can without having them be too big, but I'm unsure if I've done a good ...
5
votes
3answers
98 views

php one-time prepared statement execution function

I use prepared statements often even when I only need to execute the statement once (for security), so I implemented a function to abstract away all the function calls on the mysqli_stmt object, as ...
1
vote
2answers
1k views

Protect against XSS with .htaccess file

My .htaccess redirects everything to my index.php, but I wonder if it's vulnerable to XSS attacks. Am I safe? .htaccess file ...
1
vote
0answers
30 views

Tab 2 spaces convertor (for markdown)

This below program simply converts given glob files' tab to spaces. There is a special case to ignore content inside triple back ticks. Example usage is ...
2
votes
0answers
29 views

Python - How to efficiently bin multiple dependent variables to a common independent variable?

Setup: I have ~30 parameters (dependent variables) measured simultaneously along a common time axis with ~1Hz resolution (independent variable). I need to calculate bin averages for all parameters, ...
3
votes
1answer
31 views

Throttle implementation using pure JavaScript adding and removing event listener

I am trying to implement throttle function in vanilla JavaScript. I have seen other implementations on the web, but the way I have implemented it is more understandable for myself. I was wondering if ...
5
votes
1answer
58 views

C++ bare getter setter with dispatch

I am trying to achieve a getter/setter behaviour that will reduce code in C++. The interface I would like to achieve is for example: ...
3
votes
1answer
100 views

Calculate the heat flow (for radiators)

I´m a programing rookie with minor javascript skills. So I ask you for a code review since I'm not sure whether my code is ok. Short explanation of my program: I work for the heating industry. ...
0
votes
1answer
51 views

Extract HTML tags and its content from a string [on hold]

Goal I want to extract HTML tags and its content from a string. The content (input) is queried from WordPress database. Sample data (input) I extract this dummy data from my WordPress database: ...
3
votes
3answers
96 views

Brute force looping & formatting Or Create Union range & Format? Which is efficient and when?

May be my question is not up to the standard for Code Review, but of upmost importance for reassessing methods used in my VBA coding . While preparing/testing answer for a SO post (thought to simplest ...
5
votes
4answers
172 views

C-based hash matching cracker

How can I improve this hash matching program using either abstraction or search/sort algorithms? We briefly were introduced to searching methods such as bubble sort and merge sort, but I'm not sure ...
3
votes
1answer
39 views

How to optimize the code snippet which has several calls to find method that is to read files and load them into the map?

I wrote a functionality to read files and load them into the map m_fileParams. Then I am searching the specific keys in the map container using ...
1
vote
2answers
55 views

Project Euler Problem #50 Consecutive Prime Sums

Problem: Which prime, below one-million, can be written as the sum of the most consecutive primes? At the moment my code runs for over 200 seconds and was wondering how I can find a way to bring that ...
4
votes
2answers
543 views

Huge Fibonacci modulo m optimization in Python 3

I'm doing some an Algorithm Design online course as a way of learning algorithms and Python as well. One of these challenges requires that I write code for finding a "Huge Fibonacci Number Modulo m". ...
7
votes
3answers
10k views

Area Calculator in Java

This is a simple Area Calculator coded in Java. What this does is that it prompts the user to select a shape, and asks for the details needed to calculate the area of that specific shape. Main.java: ...
2
votes
1answer
68 views

Summing same index values in 2D arrays in javascript

After solving a problem, I came to this conclusion. ...
3
votes
1answer
52 views

Pomodoro countdown timer synced to the clock

This countdown timer is supposed to: be synced to the user's clock at every hour and half hour, will start a 25 minute countdown followed by a 5 minute break The code works but I question its ...

15 30 50 per page