All Questions

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

Refactoring a class that counts xml dom nodes and caches the result

I saw this entertaining talk by: Bob Martin on clean code and started refactoring a relatively simple class today. I am, by no means, an expert on coding and still learning a lot every day, so I want ...
9
votes
1answer
297 views

OOP Snake Game C++

This is my version of the Snake Game. The project is not done yet, I still want to try to implement some other game mechanics like two player mode, high score leaderboard, etc. Also I would like to ...
6
votes
4answers
2k views

Kadane's Algorithm for 2D array with known boundaries

I asked this question first on StackOverflow but I didn't get an answer and was advised to try here too. So here we go. I have implemented Kadane's algorithm for a 2D array in Python 2 with known ...
2
votes
1answer
32 views

Looking cleaner code of Python Combining Image with PIL

Please review and help me write better codes. Combining Pictures We can use a conditional to copy just the non-white pixels from one picture to another picture. We can take this tiny image of the ...
4
votes
1answer
154 views
+50

Nodejs async with express server

I use the following code which works as expected. The code uses open ID connect to login user. Because I'm pretty new to node and express, it will be great if I can ...
4
votes
2answers
68 views

Optimizing performance of randomly generated pygame maze game

I made a random maze generator that is also playable. The performance is crap and I'd like to improve it. I'll be working on this for a few more days to make it run better myself, but just thought I'd ...
-4
votes
0answers
13 views

Breakout clone - collision detection bug [closed]

First of all, I am a beginner in javascript programming, even in computer programming. This is my first project. I have used javascript p5js library to draw in the canvas. But my collision detection ...
2
votes
1answer
66 views

Car Pooling algorithm time complexity

I created a solution for the car pooling algorithm. Problem: You are driving a vehicle that has capacity empty seats initially available for passengers. The vehicle only drives east (ie. it cannot ...
0
votes
0answers
8 views

Is my Angular Material MessageBox component well build?

My angular knowledge is limited, so I don't know much yet about it's garbage collection etc to make sure my component can be used without any strange side effects or memory leaks. I've created a ...
3
votes
1answer
28 views

Creating a values only copy of an excel workbook without opening it

I have created a working VBA script that allows the user to select a workbook and make a values only copy of it without opening it. This is useful for getting data from a workbook that is very slow to ...
-3
votes
0answers
22 views

Algorithm trading Problem EMA(Trading Bot) [closed]

I'm make Trading Bot that makes automate for trading on the Binance site, however, it's work fine but I have a file called "strategies.py" it has a function called "maCrossoverStrategy&...
16
votes
1answer
160 views

Sorting algorithm visualizer in C++ and SDL2

I finished a sorting algorithm visualizer (for now only uses bubble sort) and this is the code. I'd like some suggestions to improve the memory usage or time elapsed. Built with Cmake and Ninja on ...
3
votes
0answers
34 views

Linear probing 16 hashmap elements in parallel using SIMD instrinsics

For my hashmap implementation, I'm caching hashes for each map element in an array of length NBUCKETS, where each element corresponds to an element in the hashmap. ...
9
votes
3answers
1k views

IP address detection code

I am using PHP for detecting a user's IP address and displaying their details and I use OOP (i.e. object-oriented programming). Are there any problems in it or is it well-written? index.php: ...
2
votes
0answers
30 views

Test Driven Development in JS and Sinon Stub

I am going through some TDD and BDD tutorials which guide one through implementing a simple beverage-ordering system. While I think I understand the material, I am still wondering about some ...
3
votes
0answers
23 views

Dynamic-sized Hash table with Linked List

Below is an implementation heavily based on climberig's implementation on Leetcode for LeetCode 706. Design HashMap. Just to preface, I am doing this in preparation for an exam. The one below is ...
1
vote
0answers
16 views

Calculating text similarity, filtering the results, and reshaping matrix into a list-of-tuples generates MemoryError

I have a constantly growing corpus of currently ~36,000 documents (growing daily) and I want calculate the similarity between each pair of documents. After calculating the similarity scores, I want ...
3
votes
1answer
60 views

Copy-Paste-Find-Replace (weekly update)

Heres a code that update weekly datas from production reports Known flaws : Im copy pasting the old line and replacing the week number in it to fit it to the one we want to update. The problem is ...
1
vote
0answers
12 views

Analog Clock for WebAssembly in AEC

I've ported the Analog Clock program written in AEC from Linux to WebAssembly. You can see the live version. ...
2
votes
2answers
250 views

Tic-Tac-Toe game in Python 3

I have written a code for a tic-tac-toe game and it works well. But, I don't know whether it is an efficient one. Any help on how to optimize it? ...
7
votes
1answer
309 views

Javascript FizzBuzz and Behavior-Driven Development Using Mocha and Chai

I am currently getting closely acquainted with Behavior-Driven Development. Could someone tell me how I am doing with the Fizzbuzz program below? I am interested in both improving the JavaScript code ...
4
votes
0answers
16 views

React Typescript Boilerplate

I'm trying to build a React Boilerplate Using multiple tools. They are all: React, TypeScript, ESLint, Webpack, Babel, Prettier, VSCode and with Airbnb's code style guide. Actually, this is my first ...
4
votes
1answer
51 views

LeetCode: Find And Replace in String C#

It took me a while to solve this question and there are corner cases i missed hence the 4 unit tests. please review for performance. and if you can treat this as a review for a 45 mins programming ...
4
votes
1answer
88 views

C++ generator function for a Chess game

Here is my code for a move generator function for a chess engine. It's currently working perfectly and returning fully legal moves. How can i improve it. I am looking to improve this generator ...
4
votes
0answers
34 views
3
votes
2answers
38 views

Generic loan score

I created a Python class called Score. I intend to use it to assign scores depending on two parameters. the type of score, ...
14
votes
5answers
3k views

Finding an element without pair in a list O(n**2)

I'm practicing algorithms, and I just can not come up with a faster solution to this problem, but I'm not hitting the benchmark. Problem: In a large list of large integers, I must find the one element,...
2
votes
0answers
42 views

Get the value of the precedent day in a pivot table

I have a pivot table of approximately 2 millions lines coming from a dataframe with the same structure as below: ...
6
votes
0answers
31 views

A* using a Priority Queue

I've implemented an A* with a priority queue. I am not getting any performance issues in this little game that I am making but it would be interesting to know how to improve this. I am doing a few o(n)...
2
votes
1answer
21 views

Bash script wallpaper randomizer

I thought it would be fun to write a simple and small bash script which randomly chooses a wallpaper from a given directory of a set of wallpaper images. The code is as follows. ...
7
votes
2answers
124 views

Dijkstra's implementation in rust

I would like to get any feedback about my implementation of Dijkstra algorithm in Rust following this youtube video. Please be aware that this my first code in Rust as well as my first Dijkstra ...
1
vote
1answer
30 views

Iterating an Array Object & Assigning the Attributes Values to those that Match the Condition

Is there any approaches to reduce the below coding snippet in Angular 2+ with few lines of code by making use of ECMA Script or by some other ways ...
0
votes
0answers
8 views

Emitting multiple States for Single Input using ViewModelType architecture

Below I have enum representing State of a UITableView. The states are divided into 3 categories as below. For all the 3 states I have different UITableViewCells which will be shown for respected cases....
1
vote
0answers
40 views

Check whether '.' and '/' are escaped properly

I'm currently using a function to check if a URL has correctly escaped two different characters: . and /. To escape a character ...
2
votes
1answer
39 views

Is my unity component validation overkill?

Unity scripts need access to components they will be using, my solution here guarantees that a script will have a valid reference to a component it needs, but is this solution overkill, or hard to ...
4
votes
1answer
4k views

Accessing Adapter data from ViewHolder

In my Android app, I need to disable a button in Layout if the api return status as 0. I get this status in the Adapter and based on it, I have disabled the button in ViewHolder which is inflating the ...
1
vote
0answers
42 views

8 puzzle solver in C

The code works fine for inputs that have a solution. The goal board is 1 2 3 4 5 6 7 8 I have tried to implement using the A* search algorithm. The code runs for 2 seconds or slightly more time which ...
2
votes
1answer
49 views
2
votes
2answers
103 views
0
votes
0answers
27 views

Code refactor - eliminate generic interface and object methods

I'm building a method that tries to detect whether given information about an object's property to retrieve, a constraint operator and some data to compare it against, whether the result is true or ...
3
votes
2answers
74 views

Returning interfaces in Java without significant casting

I am writing some code that takes and returns interfaces following the patterns in Effective Java Third Edition. I understand the principle - we want to take in interfaces because in many cases we don'...
2
votes
1answer
60 views

PyGame image editor

I recently build a simple image editor in Python. There is nothing specific that I am dissatisfied about regarding this code. I am just asking for general criticism to help me improve. ...
1
vote
1answer
60 views

Kotlin Stack using an ArrayList to compare and remove elements

Is this a performant strategy to implement a stack in Kotlin to compare and delete values? Expect Create a stack in order to compare an array of asteroids (ASTs) and handle collisions (deletions), ...
4
votes
2answers
41 views

Right-trimming text files

below vbscript code took me 3hours just to complete trimming whitespaces of a 24MB file any tips to speed up the process below? ...
3
votes
2answers
58 views

Tips on my LIFO java code

I've been trying to learn java recently and I finally finish my first code. Any suggestions on where I can improve? Also, is it possible to send an argument to a class using something like an init ...
2
votes
1answer
115 views

Excel VBA speed up code to hide rows/delete color

I am using following code to delete color and hide rows that include several criteria before exporting sheets to pdf's. Is there any way to speed up this process as it is taking quite a lot of time to ...
0
votes
0answers
7 views

Plugin architecture to extend/customize behavior of white label swift based application

I have a white label swift based application in which I need to change behavior depending on the customers. I would like to add that behavior in a dedicated framework in classes/struct that would be ...
-4
votes
0answers
14 views

Lua - Basic Calculator using 3 operator [closed]

We had given below task Create three function using Lua which can perform addition, subtraction and multiplication/ The program should be Accept any number. Check the operator + - *. If not the print &...
14
votes
4answers
16k views

ROT13 JavaScript

I wrote a ROT13 cipher script rotating uppercase letters only. Can this function be improved? ROT13 Wikipedia article ...

15 30 50 per page
1
2 3 4 5
1356