All Questions

0
votes
0answers
2 views

Enhance code for collapsing left-side tree

I was wondering if there is a better way to write the following code? The code is working, I am looking for better technique to achieve the functionality, if any exists. Never mind the classes that ...
0
votes
0answers
2 views

Python 3 minesweeper tkinter game

I have just finished my minesweeper game using tkinter and would like to know how I could improve my program. ...
-3
votes
0answers
10 views

Python: cycles and indices [on hold]

Write a function which receives an "L1" list of integers and returns a list "L2", of the same length as "L1", whose generic element L2[i] is equal to the first major element of L1[i] present in "L1". ...
0
votes
0answers
6 views

Web server using syscalls in Go

I'm new to Go and wanted to implement a web server using system calls to get a better feel for how everything works. I'm looking for feedback on idiomatic go especially error handling and using ...
1
vote
1answer
20 views

De-bouncing a (Gray) Rotary Encoder Switch in C

I would like feedback on the correctness and performance of this code. My priorities are also are readability, simplicity and self-documenting code - but I'm happy with those as they are. I still ...
1
vote
1answer
12 views

Print out numbers of increasing distance from center value in Python

I am trying to print out numbers by increasing positive and negative values around a center number, and I don't think I've found the best way. For example, say I want to find what number in a list my ...
0
votes
0answers
15 views

Esoteric programming language in Ruby

I have recently created an esoteric programming language called 01 and I will be grateful for a code review and any opinions or suggestions about the future of this language. GitHub ...
0
votes
0answers
9 views

Self-referenced generic parameter [on hold]

For example I have the following classes: ...
0
votes
0answers
28 views

Graph puzzle resolver

I've solved test task for job vacancy. Need your feedback about my solution. Task The image below shows the puzzle in the solved state. The puzzle consists of 10 cells. Among the cells one is empty, ...
5
votes
1answer
14 views

Forcing the user to choose from a set of options (in Python)

First Code Review request =) I wrote this after making several projects that required a user to pick an option. I wanted to have a set way of forcing that choice in all of my projects. The module also ...
0
votes
0answers
12 views

React table with JSON

I'm pretty new to React and I was working on some JSON data. Now I just to understand basic concepts, so I wrote this little component, but in my eyes it's not efficient. ...
3
votes
0answers
30 views

Object-Oriented Breadth-First Search Implementation

My goal is to write a GUI application where a user can create a maze and select an algorithm. The passage of the algorithm from a selected start and end point should be visualized. The following ...
1
vote
2answers
26 views

Work out largest prime factor of a number

I am trying to get better at problem solving, so I am going through challenges on Project Euler. Problem: The prime factors of 13195 are 5, 7, 13 and 29. What is the largest prime factor of ...
4
votes
3answers
183 views

LRU implementation in C++ using a LinkedList

Explanation : I am adding new elements in the list until the window runs out. Head will have the earliest element and tail will have the most recent element. Once the window is over, every addition ...
0
votes
1answer
16 views

Django functions to sanitize URL, return welcome message, redirect, compute HMAC, and manage profile picture

I wrote this code to to perform the following: I will remove the "spaces" within the url. Return welcome message. Redirect the user to different url. Compute HMAC for the request. Return and revoke ...
0
votes
0answers
6 views

Dynamic “compilation” of SQL stored procedures

I have a stored procedure which is called to create ( "compile" ) temporary stored procedures, code below, based on whether a flag in a database record is set - the various sub-procedures such as ...
2
votes
1answer
23 views

Hamming Distance in Python

I was solving this Leetcode challenge about Hamming Distance. Would love feedback on my syntax and code style. Here's the challenge description: The Hamming distance between two integers is the ...
0
votes
1answer
27 views

Predicting credit card default

I have this code for predicting credit card default and it works perfectly, but I am checking here to see if anybody could make it more efficient or compact. It is pretty long though, but please bear ...
2
votes
0answers
21 views

Codewars: N smallest elements in original order

I am consistently timing out on the mentioned kata: Task You will be given an array of random integers and a number n. You have to extract n smallest integers out of it preserving the original ...
3
votes
0answers
33 views

Chess move validator

I have written code for making a Chess Validator, which will validate the moves of a chess game. There is a Main class which is taking the input from the user, about the move. Problem The board is ...
-3
votes
0answers
8 views

How to store a range of generated numbers using IntStream to a text file [on hold]

I wrote a program to generate a range of numbers using IntStream (java 8) but can seems to figure out a way to store the generated numbers into a text file. I know how to store Strings to a file but ...
0
votes
1answer
14 views

Incrementing time in a discrete-event simulation of a supermarket queue

A method has been written that increments time in minutes that simulates how much time it takes to process item in a supermarket queue and if there is an empty queue, skip it and loops around to find ...
1
vote
1answer
80 views

Calculating array size in C++

This code shows two ways to calculate size of array of any type. I would like to know, which should be preferred? Is there any advantage/disadvantage? ...
1
vote
3answers
30 views

SPOJ Adding reversed number in Java

I just started to practice for competitive programming and just started to solve the most solved problems on SPOJ. This is what I made for ADDREV: Adding reversed numbers in Java (https://www.spoj....
-4
votes
1answer
33 views

JavaScript Code - Your Opinion [on hold]

I wrote the following javascript code and I need someone to review it and give me his opinion about my stracture, flow, mistakes (if exits) and things I have to avoid. The code contains the following ...
1
vote
2answers
11 views

Bash script to find included files in C code

I've got the following shell script (let say get_includes.sh): ...
-1
votes
0answers
30 views

Hackerrank Anansi's Ponzi scheme [on hold]

Problem Description Anansi wants to never work in his life again! So, being the trickster that he is, he decides to invest n dollars to start a Ponzi Scheme club. In this club, there are ...
0
votes
0answers
6 views

Mysql: Should I use AFTER INSERT trigger to populate reference/link tables? [on hold]

Might the use of MySQL triggers present difficulties when developing the code later on, should I stick with doing the following relations in the code instead of the DB? I have the following tables: <...
3
votes
0answers
41 views

get; set; in C++

I wrote a class that replaces the get and set functions: ...
0
votes
1answer
21 views

Battleship Game in Java

I wanted to make a very simply Battleship game in Java, any feedback is welcome. Nevermind the getters / setters. Just assume they are there. ...
0
votes
0answers
14 views

Tracking when a column was last modified using a trigger (in SQL Server)

How can I improve the following code to track when an Azure SQL Database column value was last modified? ...
0
votes
0answers
24 views

Find all starting indices in a string which are anagrams of a word

The task: Given a word W and a string S, find all starting indices in S which are anagrams of W. For example, given that W is "ab", and S is "abxaba", return 0, 3, and 4. My solution: <...
1
vote
2answers
43 views

Python program to find the topic with the most meeting time dedicated to it

I must create a program for information regarding schedules and topics of meetings at work. The data relating to the meetings are stored in an "M" matrix with 5 columns, in which the generic row [g, m,...
-3
votes
1answer
12 views

ID Confirming system, glitches [on hold]

Hey I'm doing ID confirm system, which is equal to login system. And one bug, that I have discovered, is that this system is based on TXT file, so when the code is checking the user id, which he typed,...
-4
votes
0answers
12 views

Creating 45 variables and properties for CRUD program [on hold]

I'm new in OOP world, I've been using functional paradigm in vb past 5 years and I have a task to link a vb form to a table which has got 45 fields. It's a Form with Textbox, comboxbox, richtextbox......
0
votes
1answer
25 views

Insertion sort algorithm in Java

I have tested this code and it yields the expected outputs, but I want to verify if I have applied insertion sort algorithm correctly or not. ...
3
votes
2answers
104 views

Determine whether a vector intersects the up or down unit vector

I wrote an if statement that checks if an iteratively altered vector "crosses" the up vector (0,1,0) or the down vector (0,-1,0). ...
1
vote
1answer
27 views

Generating all subarrays from an array of Integer

I want to generate all the subarrays from an array of integer as below: ...
0
votes
0answers
9 views

Mini HttpClient json post by Action parameter

This is an implementation of HttpClient Json Post by Action parameter. Logic: It is mainly convenient to pass the url and object (automatically converted to json by Json.Net), and can use ...
-4
votes
0answers
17 views

How to export Mysql request on PHP to CSV file on UTF-8 without BOM character [on hold]

I would like to extract my request SQL from php to a CSV file. When I write my csv file, I've an file encoding on UTF-8 with BOM. But When I open this file on excel, I modify the data and save. Excel ...
1
vote
0answers
37 views

C# Async/Await networking server

I made a simple async networking server and I'd like to get some input on the code, whether things can be done better and whether the code is stable (able to hold more than 1000 connections without ...
-1
votes
0answers
36 views

Dynamic programming with 3D arrays

I am trying to solve a question given on Codeforces involving dynamic programming with 3D arrays. F. Trucks and Cities There are \$n\$ cities along the road, which can be represented as a ...
3
votes
1answer
31 views

Bash script to backup a LAMP server

I wrote a bash script for backing up my LAMP server. To be honest that's my first experience in bash so I want to ask you for help in its improvement. ...
1
vote
0answers
23 views

R code for inequalities row by row

I would like to efficiently calculate which coordinates (x, y) fall between (x1, y1) and ...
1
vote
0answers
16 views

Simple generic macro-generated containers

In order to learn macros in C I decided to make a generic data structures generator for other projects that I have in C. The main macros are the following: ...
4
votes
2answers
39 views

PHP password-resetting page

I am producing a PHP code and I want to implement it in my server to do its function. My question is, are there any vulnerabilities that I should correct? I tried to establish the session first then ...
-2
votes
0answers
14 views

readbinary in datagrid view [on hold]

Need to do the reading in the datagridview The model did, but I can not figure out how to make it appear in datagridview Model: ...
3
votes
1answer
31 views

Noughts and Crosses Version 2

Made the game much more user-friendly than previous version - has an example grid to demonstrate input, Xs and Os are now used. Game can now detect draw. Changed the algorithm to detect winner, it'...
-4
votes
0answers
15 views
1
vote
2answers
36 views

Find maximum length of array where every entries are the same

Is the complexity of this code \$O(n^3)$? How can I improve the efficiency and reduce the complexity? ...

15 30 50 per page