All Questions

Filter by
Sorted by
Tagged with
1
vote
0answers
6 views

Is there any way to simplify this code? & would it be better to insert a bool like the example code I show?

This is my code, which chooses a random number from 0 to 10 for the user to guess. ...
1
vote
1answer
10 views

How can I apply the DRY principle to this exercise, while sticking to the progression of the assignments?

I solved this exercise on jshero.com but I know the solution can be written more cleanly, I just don't know how. Here are the directions: Write a function addWithSurcharge that adds two amounts with ...
2
votes
1answer
17 views

Guess the Number In C++

Mind that this is my first actual program in C++ and I tried to prepare for any possible input. Also the reason I included static_cast<void>(generator(range))...
2
votes
1answer
15 views

Implementations and analysis of my python login system (~80 lines)

I wrote this login system in the evening and i would like to know what should I fix / change, if should I use classes and, about readability, if this code is OK. I'm a begginer in coding so made this ...
-1
votes
0answers
12 views

Method name if class already contains a part of it

I have a class called ComputerGameService. In this class I've methods with following names: ...
3
votes
0answers
25 views

Can I shorten this assembly code to test if a number is even?

Here is MIPS code to return 1 if a number is even, 0 otherwise: isEven: andi $t0, $a0, 1 li $t1, 1 sub $v0, $t1, $t0 jr $ra My question is whether ...
1
vote
0answers
10 views

Deploy folder to desired path - PowerShell function

I am still learning PowerShell and I would like your opinion on my folder deployment PowerShell function. It basically check if a defined folder exists and creates it if it does not and writes it ...
3
votes
1answer
42 views

Banking system using polymorphism

I am asking this, because after studying I am confused that it is necessary to declare base class object, then declare derived class object and then store reference of derived class object in base ...
0
votes
0answers
17 views

Integrating web scraping code into loop

Background:I have systematically written code segments that scape a recipe website for certain recipe stats of information including - Ingredients list Method / Instructions Prep time Cook time Yield ...
3
votes
4answers
107 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. The problem is: in a large list of large integers, I must find the one ...
-1
votes
0answers
11 views

How do I volleyrequest to see if data does not exist in mysql table? I want to set an x drawable in an imageview if an entry does not exist

I am making an app that has users complete a survey. They are given a grade that is time based. This means if you complete the survey (called the monthly check in) within 5 days you get an A, 8 days ...
3
votes
0answers
10 views

Parse data from Input file and print results

I have written a script which does parsing to the input file and take out some values from them with respect to the node and print the data accordingly. Below is my script, and it works as expected: <...
1
vote
0answers
18 views

Team scrambler VueJs

I wanted to do a very little project of a team scrambler. There are two teams of 5 players. Each player has a unique color (in his team) from a limited pool. You can use 2 actions : Scramble the ...
3
votes
2answers
195 views

Simple console calculator in python

I am new to python, I made a calculator but I need to make it calculating unlimited numbers and to shorten the code more, how can I improve it? Any help is appreciated. ...
3
votes
2answers
73 views

Simple async task scheduler

I've written a .NET Core console application to monitor the operation of a sensor network and I'd like a review of the task scheduling performed by the main program loop. There are three tasks that ...
-4
votes
0answers
16 views

I can't figure out why MongoDB connects but does not retrieve data. I'm using Python with pymongo [closed]

i'm brand new to Python and MongoDB and currently trying to figure out how to retrieve data from a database. When running the code I get the Mongo is connected ...
-2
votes
0answers
15 views

How to manage multiple bookings in same order in SQL?

I am working with system that user can book services. I am developing using PHP and MySQL. Now Currently all things are working fine. But I need to manage Multiple Bookings in Same OrderId What Issue ...
2
votes
0answers
51 views

This recursive function encrypts a string

Is there a way to rewrite these last 2 recursive functions with fewer arguments (preferably 2) while keeping them recursive? The entire code can be seen here: https://github.com/GirkovArpa/hutton-...
3
votes
0answers
13 views

Arduino-based darkroom timer

Description I have created a darkroom timer, which is used for enlarging and developing film. It has four separate timers, and can toggle mains via a relay to turn on the enlarger for a specified ...
5
votes
1answer
53 views

LeetCode: my calender 2 C#

https://leetcode.com/problems/my-calendar-ii/ Implement a MyCalendarTwo class to store your events. A new event can be added if adding the event will not cause a triple booking. Your class will have ...
4
votes
2answers
89 views

C++ Practice on STL templates and algorithms

I have implemented the following program below for an assignment for practice on STL templates and algorithms. All I'm doing is implementing the code for the printing of empty files, un-empty files, ...
-6
votes
0answers
30 views

how can i make a beter code in python? [closed]

it is my code for problems five of euler project where is my wrong and how can i make a beter code please make my code true ...
3
votes
0answers
30 views

Yet another implementation of Conway's Game of life in Haskell

(Sorry for my bad English) Hi, I'm interested in getting feedback of my own implementation of Conway's Game of Life. Some details: Uses gloss for animation Uses rio for shorter dependency list My ...
1
vote
1answer
26 views

Tips on my LILO 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 ...
1
vote
1answer
15 views

Load multiple worksheets from Excel file to multiple DataFrames

The spreadsheet can be found just above the references section at this link. https://www.sciencedirect.com/science/article/pii/S1872497316301429 It's a publication for STR DNA locus frequencies to ...
2
votes
1answer
30 views

Python Simple Range and Bearing Calculator using Complex Numbers

I have just written this code that takes an initial coordinate and returns a new vector depending on a user-supplied range and bearing. The calculation of the new position is done using Complex ...
1
vote
0answers
13 views

Random Word Chain Finder in Ruby

Wrote this program out of curiosity after initially solving the Word Chains puzzle. Explanation of puzzle in link below. http://rubyquiz.com/quiz44.html NWordChains#find_word_chains will take in a ...
3
votes
0answers
19 views

App to seed DB, generate CSVs, and export individually or in complex zip files Rails 5

I have an app whose sole purpose is to seed data files and add the data to different CSVs which are zipped and exported by the user. My application controller is filled with lines that all look like ...
2
votes
1answer
46 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'...
-4
votes
0answers
28 views

How to pass a class as parametr [closed]

I am trying to improve my coding skills and i run an issue when parsing json objects to another method. I have created a class and later i am adding to this class values (when i debug they are there) ...
-1
votes
1answer
46 views

Move generation n c++ for Knight [closed]

So I have been working on this Chess project and for that I need a move generator. I wish to know if I can improve my code for the move generation for the Knight. Here is my current code; Let me tell ...
3
votes
0answers
35 views

Largest Prime factor (Project Euler in Rust)

I've been working on my Rust a bit and want to know how idiomatic my rust code is for the following Project Euler problem: ...
6
votes
1answer
539 views

Convert Decimal to Fraction

This code below converts number from decimal to fraction. I don't know if there's a better way or better methods to do this job so any advice would be appreciated. ...
3
votes
1answer
42 views

Most elegant way to copy type alias class to original collection

Looking for a most elegant way to copy dictionary type alias to original collection. ...
3
votes
1answer
56 views

Huffman encoding

The Huffman-Algorithm The Huffman-Algorithm, named after David A. Huffman who first published this algorithm in 1952, is a algorithm for lossless data compression. As most encoding-methods, the words ...
3
votes
2answers
55 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
15 views

Scrapinng the Instagram follower list - no data received [closed]

I'm making a node.js app that scrap the follower list on Instagram. I use, for scraping, a service of scraperapi sdk When I go on the app the reuslt is the egde[] is empty, but if I execute the same ...
4
votes
1answer
120 views

Snake game in C++ with SFML

I started learning programming about a year ago, starting with Python. Half a year ago, I moved onto C++ and this is my first large project with that language. Have I understood the basics of the ...
2
votes
0answers
42 views

Smashing two heaviest stones until at most one stone is left - counting number of stone comparisions

Based on this question: Heaviest Stone algorithm time complexity Problem: We have a collection of stones, each stone has a positive integer weight. Each turn, we choose the two heaviest stones and ...
5
votes
2answers
228 views

Object oriented approach for snake game in C++

I started to code in c++ recently and my goal is to develop games using c++. After learning basics I tried to implement my own version of snake console based game in c++ with the help of some online ...
1
vote
1answer
44 views

nth Factorial of n 1s in a row

In what way can I improve this? Be that performance, readability, etc. I'm thinking implementing NumPy would improve performance. Usage: Calculate* the nth factorial of n 1s in a row. *No need for a ...
3
votes
1answer
28 views

Dictionary implementation in Rust

This is an implementation of a dictionary (hash map) in Rust. It is loosely based on Python's dictionary implementation, using the same "random" probing and capacity/size management. Does it ...
1
vote
0answers
17 views

Custom include? method for a substring

Task: Write a function which returns true if a given substring is found within a given string. If the substring isn't found, then return false. My implementation: ...
2
votes
0answers
24 views

Async linked list to and from async iterable

I'm working on some stuff that works better with (immutable async) linked lists such as this: ...
2
votes
0answers
20 views

Ubuntu GTK+ 3 desktop app, made with Python library PyGObject

I just created my first GTK+ 3 app with Python using PyGObject. It is very nice to be able to make GTK applications using Python, as I love that language. I'm not completely sure if the way I designed ...
-4
votes
0answers
32 views

HackerRank Apples(Python) [closed]

There are M Women sitting on the chair in a row. Every woman has a number assigned to it. Person A is distributing the apples to those women with following conditions. Each woman has at least one ...
6
votes
1answer
227 views

Optimizing Efficiency in a Stack

I'm solving a problem on HackerRank where I'm required to implement a simple stack. It's passing all the tests except for the last 4 where it fails due to surpassing the time constraint of 10s. ...
3
votes
0answers
24 views

Rearranging data from one table to another in spreadsheets using apps script

I need some help with making my code run faster. It currently works by going through all cells in a 201x151 table. If the value in a cell is not equal to zero, then it will return the row number, the ...
2
votes
0answers
14 views

Simple Effects in Angular 2+ application using Firebase, NGRX and RXJS

Made an Angular app using Firebase, RXJS and NGRX. ...
3
votes
0answers
64 views

Providing a connection pool

I need some opinions about method naming and single responsibility principle. First of all, let's talk about method naming. The class below was created to provide a connection pool and whenever a pool ...

15 30 50 per page
1
2 3 4 5
1355