# All Questions

67,744 questions
Filter by
Sorted by
Tagged with
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. ...
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 ...
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))...
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 ...
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: ...
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 ...
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 ...
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 ...
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 ...
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 ...
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 ...
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: <...
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 ...
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. ...
73 views

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 ...
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 ...
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 ...
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-...
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 ...
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 ...
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, ...
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 ...
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 ...
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 ...
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 ...
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 ...
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 ...
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 ...
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'...
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) ...
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 ...
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: ...
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. ...
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. ...
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 ...
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 ...
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 ...
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 ...
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 ...
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 ...
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 ...
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 ...
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: ...
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: ...
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 ...
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 ...
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. ...
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 ...