All Questions

Filter by
Sorted by
Tagged with
0
votes
0answers
10 views

Project Euler # Triangular, pentagonal and hexagonal in Python

Triangle, pentagonal, and hexagonal numbers are generated by the following formulae: Triangle: \$T_n=\frac{n(n+1)}{2}\$ 1, 3, 6, 10, 15, … Pentagonal: \$...
2
votes
0answers
18 views

Filename sequencer with outdated C++

My path to learning C++ has been a rough one. Currently, I'm writing a project and my knowledge is very outdated. While I can write code that accomplishes the tasks required, I'd like to improve and ...
-2
votes
0answers
21 views

Is it wrong to dynamicly fill my DI system? [on hold]

I am using C# ASP.Net and with the IServiceCollection I am using this DI container system. Now my application grow and my amount of classes is about 150+. So instead making a very long list of ...
4
votes
0answers
22 views

Evaluating a math expression given in string format

I am currently working on building a calculator using Java and JavaFX to practice my coding skills. I wrote the following methods to evaluate a given expression. What can I improve? Is there ...
0
votes
0answers
17 views

Project Euler # 44 Pentagon numbers in Python

Pentagonal numbers are generated by the formula, Pn=n(3n−1)/2. The first ten pentagonal numbers are: 1, 5, 12, 22, 35, 51, 70, 92, 117, 145, ... It can be seen that P4 + P7 = 22 + 70 = 92 = P8. ...
-3
votes
0answers
13 views

how do i write a header file for a program that is supposed to preform a binary search? [on hold]

// this program is for a binary search i need help specifically for building a header file //ive been struggling with this program for a few days. // any suggestion? thank you ...
0
votes
0answers
6 views

Console app to get XML from API and save to database

I am making a small console app to get XML from an API and then save the data to a database. While this project was not created via test-driven-development, I have tried to make it such that tests can ...
0
votes
0answers
18 views

Project Euler # 43 Sub-string divisibility in Python

The number, 1406357289, is a 0 to 9 pandigital number because it is made up of each of the digits 0 to 9 in some order, but it also has a rather interesting sub-string divisibility property. Let d1 ...
-2
votes
0answers
10 views

Class design supporting many payment methods

Suppose originally a Person class supporting a single CreditCard for purchases a user can do. ...
1
vote
0answers
16 views

Project Euler # 42 Coded triangle number in Python

The nth term of the sequence of triangle numbers is given by, tn = ½n(n+1); so the first ten triangle numbers are: 1, 3, 6, 10, 15, 21, 28, 36, 45, 55, ... By converting each letter in a word to a ...
1
vote
0answers
7 views

jQuery AJAX JSON response

I was looking good explanation of jQuery AJAX for JSON response in Rails app and I found this page - https://www.alfajango.com/blog/rails-3-remote-links-and-forms-data-type-with-jquery/ where I have ...
1
vote
0answers
14 views

.htaccess file syntax check? security check?

This is one of my main .htaccess files and I'm wondering if anyone can review it and tell me if I have the syntax correct, I'm still not 100% sure what should and shouldn't be inside a module, I know ...
-2
votes
0answers
5 views

What is the right way to import a constant according to Google's python style guide?

According to the doc here https://github.com/google/styleguide/blob/gh-pages/pyguide.md#22-imports ...
1
vote
0answers
14 views

Filling up a numpy array using data from a list

I am looking to optimize the nested for-loops shown in the code below. I have a list, mixtures, that contains points that represent 1 Gaussian Mixture (GM) on ...
0
votes
0answers
16 views

Login to a school system and get account type

I'm new to MySQL database design. My question is this database is correctly built or not. We used the users table to login and get account type and here the code to login ...
1
vote
0answers
22 views

Project Euler # 38 Pandigital multiples in Python

Take the number 192 and multiply it by each of 1, 2, and 3: 192 × 1 = 192 192 × 2 = 384 192 × 3 = 576 By concatenating each product we get the 1 to 9 pandigital, 192384576. We will call 192384576 the ...
4
votes
0answers
27 views

Await data coming from an event

This is a USB related question, but the problem is not USB specific. When reading data from a USB endpoint, there are two patterns I am concerned with. Request/Response like HTTP (done over the Bulk ...
1
vote
0answers
10 views

Reading image files asynchronously and displaying them on the page

I am trying to display images from a folder in my project using the "fs" module with NodeJS. I need to read all images in a directory and run them in a loop for them to be displayed. I was able to do ...
0
votes
0answers
5 views

extracting a particular MODIS image from an image collection in Google earth Engine

I am working with MODIS imageries in GEE and I am new to its interface. So I have been able to access the land cover product of MODIS (MCD12Q1). I have added imageries from 2003 uptil 2016. How can i ...
3
votes
1answer
26 views

First Python program: pick and display alien characteristics

This is my first Python program and all it does is print out a description of the specific "Alien Class" that the user inputs. Looking for tips and pointers and what I can do better and what I am ...
-1
votes
1answer
21 views

Project Euler # 37 Truncatable primes in Python

The number 3797 has an interesting property. Being prime itself, it is possible to continuously remove digits from left to right, and remain prime at each stage: 3797, 797, 97, and 7. Similarly we can ...
0
votes
0answers
23 views

finding solutions to tiled puzzle

This is an abstraction of a simple jigsaw puzzle. each tile has for sides. the matching pairs have the same letter, save for a asterik to show the nose and the gap. e.g. b* and b fit together, b and b ...
2
votes
1answer
37 views

Fast “index of minimum” for distances to points on single thread

The problem in simple words: I have three arrays of double values (x-, y- and z-coordinates) and need to find the index of the point which has minimum distance to a reference points. I do not need the ...
-3
votes
0answers
14 views

Which iso-charset file is this in C as header-file? [on hold]

Is there a header-file like this in C which can be used for #include ? This header-file should have all international charset-iso-codes of the keyboard ? Or would this be only possible in groups ...
5
votes
0answers
40 views

Unbalanced search tree for comparing multiple string arrays

I have a system that stores resources. A resource contains a string that represents a user role, for example "3". With this user role "3", you can retrieve a list of permissions for the user role, ...
0
votes
1answer
24 views

Provide functional-programming style solution for 2D Array - DS challenge

Problem Statement: Given a 6×6 2D Array, arr: 1 1 1 0 0 0 0 1 0 0 0 0 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 We define an hourglass in A to be ...
4
votes
1answer
36 views

A view for Python list slices

As you probably know, Python slices like arr[1:3] etc. do NOT provide a view onto list and instead creates a copy of the list, what can be not optimal performance ...
1
vote
1answer
18 views

Statistical function which computes the average work time in different months

It's a task from a Ruby-course, in which I'm currently enrolled: Ruby Course - Page Precisely it's one of the assignments for the first week. Following idea: Your are given a list in which finished ...
1
vote
1answer
47 views

Project Euler # 36 Double-base palindromes in Python

The decimal number, 585 = 10010010012 (binary), is palindromic in both bases. Find the sum of all numbers, less than one million, which are palindromic in base 10 and base 2. (Please note that the ...
2
votes
0answers
17 views

Implementing a TCP client in Golang

I am very new to concurrent programming in general and want to know if my implementation is thread-safe. I'm currently working on implementing a TCP client in golang. The service listens on a port ...
11
votes
2answers
886 views

Making an example from 'Clean Code' more functional

I'm a C++ dev, and I've recently started working my way through Clean Code*. Whenever I encounter an example I think I could improve, I try to re-implement it in C++. On pp. 28-29 there is an example ...
1
vote
0answers
45 views

Project Euler # 35 Circular primes in Python

The number, 197, is called a circular prime because all rotations of the digits: 197, 971, and 719, are themselves prime. There are thirteen such primes below 100: 2, 3, 5, 7, 11, 13, 17, 31, 37, 71, ...
1
vote
2answers
47 views

Project Euler 34 # Digit Factorials in Python

145 is a curious number, as 1! + 4! + 5! = 1 + 24 + 120 = 145. Find the sum of all numbers which are equal to the sum of the factorial of their digits. Note: as 1! = 1 and 2! = 2 are not sums they ...
2
votes
0answers
17 views

Extensible tree header context menu

I have a Qt tree view which has a custom tree header. The tree has a so called mode, by default there are two. During each of the modes a different tree is shown. The mode switcher is presented as a ...
0
votes
1answer
30 views

Project Euler # 30 Digits fifth power in Python

Surprisingly there are only three numbers that can be written as the sum of fourth powers of their digits: 1634 = 1⁴ + 6⁴ + 3⁴ + 4⁴ 8208 = 8⁴ + 2⁴ + 0⁴ + 8⁴ 9474 = 9⁴ + 4⁴ + 7⁴ + 4⁴ As 1 = 1⁴ is not ...
0
votes
1answer
23 views

Imperative and functional-programming solutions for Jumping on the Cloud challenge

Problem Statement Emma is playing a new mobile game that starts with consecutively numbered clouds. Some of the clouds are thunderheads and others are cumulus. She can jump on any cumulus cloud ...
0
votes
0answers
14 views
0
votes
1answer
13 views

Project Euler # 29: Distinct powers in Python

Consider all integer combinations of ab for 2 ≤ a ≤ 5 and 2 ≤ b ≤ 5: 2 ** 2 = 4, 2 ** 3 = 8, 2 ** 4 = 16, 2 ** 5 = 32 3 ** 2 = 9, 3 ** 3 = 27, 3 ** 4 = 81, 3 * 5 = 243 4 ** 2 = 16, 4 ** 3 = ...
1
vote
0answers
12 views

Project Euler # 28: Number spiral diagonals in Python

Starting with the number 1 and moving to the right in a clockwise direction a 5 by 5 spiral is formed as follows: ...
0
votes
1answer
17 views

Ruby if block refactor from new synthax needed

I have this, I guess, new Ruby syntax in my method but Rubocop are warning me that the second last line is too long. Could you please help me to refactor this method? ...
-4
votes
0answers
19 views

How does the following code calculate a cubic spline? [on hold]

I am currently exploring cubic spline interpolation methods and I have come across the following code which interpolates in 3 dimensions, however I am unsure exactly how it works. I've researched ...
4
votes
1answer
32 views

Count all X-shaped bits from 8 integers

I am given 8 positive 32-bit integer numbers. The task is to write program to count all X-bits. X-bits are groups of 9 bits (3 rows x 3 columns) forming the letter "X". task is to count all X-bits ...
2
votes
1answer
31 views

Implementation of Generic Binary Tree Code

I'm in the process of independently learning Generics as a way to build on a college assignment for Binary Search Tree. I've completed this program without Generics first and now I've converted over ...
-1
votes
1answer
39 views

Optimal BST challenge

I was coding the problem here. I think I have solved it, but I ran into time limit exceeded issues. I am new in Competitive Programming, so I was looking for a better, time efficient logic for solving ...
7
votes
3answers
411 views

Counting multiples of 3 up to a given number

I'm attempting a practice problem in Codeforces that requires you to find the number of multiples of 3 less than or equal to a given number. I have written the following code but it gives a TLE once ...
2
votes
0answers
50 views

Page-by model of data output and search results with values for UI

This is my first experience of designing classes with inheritance. I would like to get feedback on the interaction between the presented classes. It is unlikely that this code will seem complicated. ...
2
votes
0answers
14 views

Google Play billing + Firebase functions: Creating a one-time product, server-side

My Android app must request my Cloud Functions server to create in-app products at runtime ; then, the server responds with the created one-time product. I've written the server Cloud Function that ...
7
votes
0answers
30 views

Loading a file from a FAT32 filesystem in 16 bit real mode on x86 (Intel syntax assembly)

I am writing a bootloader that needs to load a file from a FAT32 filesytem. Since I need to load both the root directory first to find the start of the file, and then the actual file, I wrote a ...
7
votes
1answer
62 views

Tiles Game Best Practices

Coming from a software engineering background I don't have so much experience developing games. Below is a simple 2d tile connect game. What would people improve about it? What are some good practices ...
3
votes
0answers
39 views

OOP Python Blackjack game with player accounts in PostgreSQL

This is an OOP version of Lastest version of my Blackjack game. Also, it now uses PostgreSQL as database. ...

15 30 50 per page