All Questions

Filter by
Sorted by
Tagged with
6
votes
2answers
58 views

Function to prompt user for input

The following program calls a function, which prompts the user for input. The function then returns one of three enum constants; INPUT_SUCCESSFUL, ...
-2
votes
0answers
35 views

jLabel painting performance

I'm using jLabels to show messages with icons. But labels are delaying to load or paint. So I want to increase the performance. ...
5
votes
1answer
67 views

Python/Flask Password Manager

As a project to better my skills in Python, I wrote a password manager. It's a website that has user login/logout functionality, the ability to add websites and passwords, and displays the websites/...
3
votes
1answer
64 views

Aggregation on list forEach and maps improvals

I am using a function in a SpringBoot @RestController, with Lombok This function is an intermediate result that permit me to do an aggregation between two classes. This 2 classes are: ...
3
votes
1answer
47 views

Chain of CompletableFutures in Java

I am new to this CompletableFuture function in Java. I have the following code below that works fine but looks quite messy IMHO. ...
0
votes
0answers
26 views

Store tweets to a local MongoDB server

I use NodeJS along with the MongoDB NodeJS Driver to store tweets into my local MongoDB server. In the following setup, mongos insertOne method gets invoked quite ...
6
votes
2answers
235 views

Action queue manager to perform action in a FIFO fashion

Recently, I needed a class that could execute code in a FIFO fashion in order to update parts of a WinForms or WPF UI which did not block the UI Thread and left the UI responsive to any interaction ...
1
vote
0answers
21 views

TypeTrainer OOP Tkinter program [closed]

I've been developing my first real python gui-program for a while now. Having watched some tutorials to tkinter and OOP I've gotten quite far, but now I just can't get my code to do what I want it to. ...
9
votes
3answers
1k views

Insert str into larger str in the most pythonic way

I want to insert a small str into a larger one in the most pythonic way. Maybe I missed a useful str method or function ? The function that insert the small str into the larger one is ...
2
votes
1answer
92 views

kryptein cryptography package for Node.js

I have written a cryptography NPM package called kruptein. The code is also hosted on GitHub. Having used multiple "best practices" with regards to key management, algorithm selection, key size, iv ...
6
votes
2answers
68 views

perl6: html color gradient generator

Inspired in this color gradient generator, this is a gradient generator in perl6. I wonder if the code could be simplified or improved. It converts the hex colour to base10, calculates the gradient ...
6
votes
1answer
101 views

Simple input class change with vanilla JS

I am just testing how I solved simple stuff. Goal: The aim is to expand the width of an input and collapse it. When mouseover ...
3
votes
0answers
68 views

Product Filters wordpress plugin: implement single responsibility principle for elements classes

Plugin is a small editor that allows to create a filter such as a price slider, checkboxes of "brands", a drop-down of "seasons". An example of how plugin work can be seen on page: http://demo-...
2
votes
1answer
38 views

Changes all floats in a pandas DataFrame to string

Below I created a function to format all the floats in a pandas DataFrame to a specific precision (6 d.p) and convert to string for output to a GUI (hence why I didn't just change the pandas display ...
3
votes
1answer
66 views

BindableBase with a throttle

I have project where I'm using BindableBase for my INotifyPropertyChanged implementation. Some of my objects however are ...
2
votes
0answers
23 views

Typesetting bidirectional breadth first search with Algotype.js

So I have this: And the typesetting code is here: ...
0
votes
0answers
26 views

Just a simple Rspec test comparing parent class/model account_id prop [closed]

I need to refactor this code to use ****rspec subject, let and it methods**. So i need subject of testing, and declaring vars with rspec let method.** I also need to create new instances of Classes/...
4
votes
1answer
51 views

Go function to generate permutations of a given integer array

I'm writing a function to generate a permutation of given []int: ...
6
votes
0answers
83 views

Nested cross-origin iframes for secure user-configurable javascript tools

Context I'm trying to build a system in which a tool (the Client) will generate a header to be used as part of an HTTP request from the user's browser. The user should be able to choose their own ...
0
votes
0answers
17 views

Kotlin HTML timetable visualisation generator

A Kotlin class that I wrote fairly early on while learning Kotlin which is used by another program to build and generate HTML visualisations of timetables. I'd be grateful for any feedback, especially ...
0
votes
1answer
52 views

Personal quiz with input validation

The object of the code is to prompt the user with a quiz and collect the g's, y's, 0's, and 1's and if there is more than one then the user passes (else, they fail). I am a beginner and would like to ...
2
votes
1answer
40 views

Dynamically combine ActiveRecord Relation results [closed]

This isn't the actual use-case I have but for simplicity, let's say I have an ActiveRecord Animal model in a Rails app. The Animals have a name (string) and ...
3
votes
1answer
44 views

Making a grid for collision detection in a game that wraps

I'm making a 2D game which wraps (when you move off the right edge, you appear on the left, etc). The game area is square, all objects are circles (with AABB smaller than the game area, and in most ...
7
votes
2answers
125 views

Webpage with a preload animation using JavaScript setTimeout

I am working on a website with an animation that runs at the beginning before the content of the homepage becomes visible. I've looked at some examples of preloaders and now use that code with some ...
2
votes
1answer
41 views

Django turn ChoiceField into a submit button

I have made a ChoiceField into a select and submit button and wondered if this is the correct approach. forms.py ...
15
votes
2answers
203 views

YAVI (Yet another vector implementation)

I am a C# game developer currently learning C++. I am trying to implement some simplified STL containers. Here is my implementation of vector, which does not have the allocator (because ...
6
votes
1answer
51 views

Extract strings from nested array in Perl

Extract the strings from nested arrays in Perl. It prints: a, b, c, d, E ...
2
votes
1answer
80 views

Simple UDP server (java)

I write kind of UDP server. It should serves about 50 messages per second. I would like a review about the general code 'quality' and logic. The server uses the same socket for sending and receiving ...
5
votes
1answer
31 views

CandidateArchive for model-assisted multi-fidelity global search algorithm

For my research I'm working on global search methods where a candidate solution can have it's fitness (=score) evaluated in multiple fidelities (=accuracy levels). The goal of the ...
8
votes
4answers
402 views

DDD Architecture for an e-commerce website (uploading images)

Problem Description I am working on an e-commerce website, when a user wants to sell a product, he would open the product page and he can upload up to 12 photos: Image Upload Process This is the ...
4
votes
1answer
58 views

Incremental Sieve of Eratosthenes Generator

So I was fiddling around with the Euler challenges. One of the things they mentioned in their discussions of the solutions is the Sieve of Eratosthenes and that you can only use it when you know an ...
1
vote
0answers
21 views

State machine to handle sequential and async events

I created this state machine to handle events. I'm unsure about my implementation firstly because I don't use a transition table or anything like that, instead, I ...
3
votes
1answer
59 views

Python List of Dictionaries to XLS

How may I optimize the following function to write a xls file from a list of dictionaries using the openpyxl library in Python? The current logic behind feels very very wrong The dict list: ...
1
vote
2answers
100 views

Merge k sorted lists in Java

I hava a question similiar with mege in Python but I am trying to write Java code. Here is my code: The input is: The first line - a number of arrays (k); Each next line - the first number is the ...
7
votes
2answers
80 views

c++17 compatible std::bind_front alternative

One of the things that has been really exciting me in c++20 is std::bind_front. Using placeholders with std::bind and ...
6
votes
1answer
686 views

Rust Torrent Parser

I wrote a simple Torrent file parser. The following program accepts a file and builds a Torrent structure based on the contents on the file. If the file is invalid, the app crashes (as intended). It'...
4
votes
2answers
55 views

Random line remover from file

This asks the user for the file name and the number of lines they want to remove. It then stores each line into a vector. A dynamic array is used to hold the random line numbers (generated by random ...
5
votes
1answer
77 views

Convert a hex string to base64

I wrote a program that converts a hex-encoded string to base64. It's my solution to the first of the Cryptopals challenges. My main concerns are: Portability. I don't want to rely on implementation-...
2
votes
0answers
20 views

Jenkins Declarative pipeline for multi-branch pipleline

I am working on setting up automated build and deploy jobs in jenkins for a php based project. I would like some feedback on my Jenkinsfile. Specifically regarding the parallelization, the (in my ...
2
votes
1answer
63 views

LeetCode - Merging piles of stones

This is a LeetCode Problem You have a pile of stones presented as an array. On each turn you must merge k consecutive piles of stones, starting from any pile you wish. You must continue merging ...
-1
votes
1answer
31 views

Python ANN Implementation [closed]

I recently learned about backpropagation online and tried to implement it. I am not sure I have it correct yet. I am confused and would love a second pair of eyes on this code. Please help me ...
4
votes
1answer
83 views

LeetCode: Merge k sorted lists C#

https://leetcode.com/problems/merge-k-sorted-lists/ Merge k sorted linked lists and return it as one sorted list. Analyze and describe its complexity. ...
2
votes
2answers
89 views

Get the Nth Term in the Fibonacci Sequence

I'm trying out a new editor (CLion) and I decided to try an old well known programming problem. I also decided to try out C99 rather than C89. This program calculates the nth term of the Fibonacci ...
1
vote
1answer
43 views

Browser quiz game

I have made a little game in JS. Are there any remarks? The game asks a question through the console and accepts the answer through prompt. If the answer is correct you'll get points. To stop the game ...
1
vote
0answers
45 views

eCommerce Mockup App in Vanilla Javascript [closed]

I have completed this mockup eCommerce app using pure Vanilla Javascript. This version can add product into shopping cart and automatically calculate the order summary in the shopping cart. It can ...
5
votes
2answers
113 views

PHP classes with functions used for building a web application

The following class is set of functions I use for web development(examples below) and I was wondering how to structure it. Examples: ...
0
votes
1answer
72 views

c++ python like range function to use in for loops

It's a simple range function that works like python range and it is only a syntactic sugar for the usual for loop if we want to operate on numbers in the range from 1 to 10 (1 ... 9) we use this code ...
6
votes
1answer
100 views

WPF MVVM ColorLister with navigation

By hashing together various online tutorials I've constructed my first MVVM application that lets users navigate between "tabs" and a "tab" (ColorList_Tab) that performs basic list functions such as ...
14
votes
1answer
600 views

Maze generator & animator in Python

This is a follow up to this code and I still did not get the feedback on the drawing functions Maze generator in Python- Gif animator-Custom colors/sizes The code generates custom color and size ...
12
votes
5answers
3k views

Stack class in Java 8

I have a exercise where I have to write a Stack class with the push and pop methods. The code compiles and works as it should. Are there better practices to use in my code? Is there something I should ...

15 30 50 per page