All Questions

Filter by
Sorted by
Tagged with
9
votes
3answers
921 views

Convert Roman Numerals to integers

I am a beginner, and so I have decided to program a Roman Numeral to Arabic integer converter. I came up with all of the code on my own. There are differing opinions about what constitutes 'proper' ...
4
votes
0answers
31 views

Feedback on Pygame Minesweeper Clone

I'm still a relative beginner to coding and I would like some feedback on my Minesweeper clone written in Python using Pygame for the graphics. I'm wondering if it would be beneficial to use classes ...
3
votes
2answers
90 views

Protein Chemical Shift Prediction processing

I have 2 scripts, one is a tkinter GUI script where the user gives specific inputs, the 2nd script takes those inputs, does some modification, and then sends it back to the GUI script to be written/...
-3
votes
1answer
51 views

Printing the next element if the previous element is in a list [closed]

I would like to reduce the following Python code. I have one list and a few if statements. a=[one, two, three, four] ...
6
votes
2answers
97 views

Follow up to “C simple hashcons data structure”

This is a follow-up question to my previous question I have modified the code according to the feedback I got from here and my Professor. However, my Professor is still not happy with the final code. ...
2
votes
2answers
68 views

Get the character and its count which has highest occurrence

I have this C# method which get the character and its count which has highest occurrence ...
1
vote
0answers
12 views

QTableView implementation

I've put together my first table using Qt's QTableView and a custom data model. Currently, some data is populated on initialisation, and the user has the option of adding and deleting entries. ...
2
votes
0answers
36 views

Genetic sequence analyzer that reads FASTA and GenBank file formats and outputs all possible gene products

I have updated my my gene sequencing program from my previous post. That post explains what each functions accomplish. If you need clarifications feel free to ask. Any tips to make the code more ...
2
votes
2answers
51 views

Is this code is safe or not (img upload) ? [PHP]

I'd like to know if this code is usable, because I'm not sure, thank you. The code is used to upload images to a predefined folder for users. ...
3
votes
0answers
40 views

Traversing a binary tree using a Node interface and an abstract Traverser class using a strategy pattern for order

I have written this code for depth first tree traversals. It feels like a lot of boilerplate, and I want to refactor it to remove this boilerplate. However I haven't done a lot of refactoring before, ...
1
vote
3answers
121 views

amino acid data prediction

I want to preface this by saying I didn't quite know where to put this because this isn't quite a stack overflow question. So if this is the wrong place to post, please let me know, and please let me ...
2
votes
1answer
59 views

Updating a dictionary of trajectories after a step has been made

I am using a dictionary to save possible trajectories in a game. A trajectory is defined as a list of numbers separated by _. For example ...
2
votes
1answer
59 views

Library for parsing CSV data

Please review my C++ CSV parsing class. I have some specific questions: Should get_next_record be a static function? CsvParser ...
6
votes
4answers
332 views

Finding the first pair of prime numbers that have some specified difference

I tried printing the first pair of prime number in between a list of numbers with a particular difference. But my run time is still too high (for large range of numbers). I want to reduce the run time ...
-3
votes
0answers
34 views

Printing how many pair that exist in an array in java [closed]

Guys please am new to java, still using terminal to code. Here is my code ...
4
votes
2answers
311 views

Removing points from slow riders

I have a CSV like the following. ...
4
votes
1answer
56 views

Calculator console app in Java

Here is my source code for my very first app in Java. I am completely new to the language; any help and criticism is welcomed! ...
2
votes
2answers
84 views

Double LinkedList Deep Copy in Kotlin

Goal Return a deep copy of a double LinkedList. Each node also contains an additional random pointer, potentially to any node or null. Code to start ...
3
votes
3answers
101 views

Algorithm to determine if binary tree is a Binary Search Tree (BST)

Continuing with algorithms I've implemented a binary search tree validator. I don't like the two boolean variables within NodeFollowsBSTContract as it feels too ...
8
votes
2answers
345 views

C++, sort integers using knowledge of entire vector

I am solving the "Sort" problem on Kattis. Mirko is a great code breaker. He knows any cipher in the world can be broken by frequency analysis. He has completely the wrong idea what ...
6
votes
0answers
52 views

Using get_dummies to create a Simple Recommender System - Cold Start

Question: was using get_dummies a good choice for converting categorical strings? I used get_dummies to convert categorical ...
4
votes
0answers
60 views

3D Direct Convolution Implementation in C

For my project, I've written a naive C implementation of Direct3D convolution with periodic padding on the input. Unfortunately, since I'm new to C, the performance isn't so good. By convention, all ...
5
votes
3answers
93 views

CAN Bus testing

I am creating a Python 3.8 script that executes a series of tests that reads and writes information to and from a CAN bus network. I'm using the python-can and the cantools packages. I've managed to ...
2
votes
1answer
52 views

LeetCode 753: Cracking the Safe

I'm posting my code for a LeetCode problem copied here. If you have time and would like to review, please do so. Thank you! Problem There is a box protected by a password. The password is a sequence ...
3
votes
0answers
39 views

Small Automatic Differentiation Library

Introduction As a programming exercise I recently wrote this automatic differentiation library based on forward accumulation. It should offer a simple way to create mathematical functions whose ...
1
vote
1answer
57 views

C - Division from scratch

I wrote this code where division can be done without using C's builtin operator: ...
-1
votes
1answer
52 views

Recursively displaying json data on website [closed]

I am displaying the data from a json file onto a website, with recursive and iterative tables side by side. i have the iterative code working, but I have no idea on how to make it recursive. Here is ...
1
vote
0answers
20 views

A Firebase Uploader CLI

I built this code as part of a test project that was given to me by a company. They had given me a .csv file that contained over 9000 records and wanted me to build a program that would upload it to ...
2
votes
2answers
66 views

Make django, weasyprint code object oriented

Please ignore the comments in the code for the purpose of reviewing. I just require tips on using SOLID principles and how classes can be used in this code.Comments in the code are for mapping the ...
5
votes
2answers
33 views

Iter 2: Reusable, robust c++ std::hash<mpz_class> for GMP's big integer type

This is the 2nd iteration of a code review. The 1st iteration (completed) is at Iter 1: Reusable, robust c++ std::hash<mpz_class> for GMP's big integer type 1. Goal My intention is to ...
-1
votes
0answers
23 views

How to use 'while' loop and list slicing effectively in this algorithm of Guess The Number Game where lies allowed? [closed]

I am making an Algorithm, which can solve the guess the number game with high, low hints where wrong hints are allowed but not in two consecutive guesses (for the game you can see my first posted ...
0
votes
0answers
25 views

Reset password implementation using JWT for easier code invalidation/expiration?

This is the first time I had to implement forget password meant for real-use so I had to cover code expiration. My questions are: Is using jwt here bad in any way other than it's not the best? If the ...
2
votes
0answers
37 views

SQL database implementation - statement execution

This is another class from my implementation of SQL in C#. It handles the execution of SQL statements, with the core method looking like this: ...
8
votes
2answers
518 views

An attempt at a toy Vm

I usually use c++ so it may not be best practice for c. This is a stack based toy vm and as a result it is very primitive, and it has no bitwise instructions 64k might be a bit overkill for a toy vm. ...
-2
votes
0answers
27 views

Have I used the repository correctly? My command file seems incorrect [closed]

I am using C# to create functions that connect my API to a web repository. I get the user to input information 'payment reference' and 'payment amount limit' and that info gets sent to the API. I have ...
2
votes
0answers
35 views

Chain operations on raster data

I am developing a workflow to perform a variety of operations on raster dataset using rasterio. My previous workflow involved lots of I/O when performing such operations on raster files. I would like ...
-4
votes
0answers
23 views

2 Issues with chess piece in Java [closed]

I have an issue : I can't select a black piece The source (Because it will take me too long for copy paste all the code here ) The main class : ...
2
votes
1answer
41 views

Finding the lowest perfect square that can be added to a number to make another perfect square

The code below returns the smallest perfect square that can be added to a number n to result in a perfect square. It works perfectly fine but I need it to run ...
4
votes
1answer
46 views

React custom hooks using refs as index counters

My custom hook useTyper.js ended up as a bit of a mess and hard to read. It's mimicking a nested for-loop but using React.useRef...
5
votes
1answer
125 views

Working with images in multiple formats

I've been doing some research around how to best make use of the WebP images (with fallback) in React. Most solutions point to something similar to what I've written below. That means if I have a lot ...
-1
votes
0answers
36 views

The script works very poorly and very slowly [closed]

I am not good at programming, but I heard that the if function is in Python. In terms of performance, the script works very poorly and very slowly. I found a script ...
5
votes
1answer
45 views

Using Boost.Spirit to transform expression to AST

Is there a better way to transform some expression to AST using Boost.Spirit? I have built it, but I think it's messy and can be simplified a lot. Code is also available on Godbolt. ...
3
votes
0answers
73 views

Product inventory database with attributes and variants

I have design a model for product apps. This is the first time I am trying to create a product's database schema and then model it in Django. My code handles the following: A product type can have ...
0
votes
0answers
38 views

Retrieving and filtering DB entries

I have a class which I created it contains static factory methods for, retrieving and filtering DB entities. Could you give me some tips on how this can be converted to a singleton class? So that it ...
3
votes
2answers
61 views

Set default value for remaining size of list by use of Java 8 and Stream

I have written a method which will return the size 16 List every time. If the input List has size less than 16, the remaining list object will be filled with default values.  Is there any way to ...
2
votes
1answer
56 views

C# Reflection-based CSV Parser

I've been trying to make a C# version of my Java CSV Parser using C# specific idioms. Here is the full code: ...
3
votes
2answers
1k views

Malloc and free

I'm looking for help speeding up some code I'm tinkering with. The rest of the code, as well as my 'benchmark', can be found here. ...
1
vote
0answers
49 views

Hairy collision code

I have a lot of nested for loops is there a better way to organize this code? Also the way I add and remove enemies and lazers seems like a bad implementation. I set the index of the table to nil ...

15 30 50 per page