All Questions

Filter by
Sorted by
Tagged with
6 votes
1 answer
564 views

Abstract class with different derived signatures in Python

I don't feel too comfortable with the use of object oriented programming and the related advanced topics. That's why I went through this exercise of using Python's abstract class to implement an ...
user avatar
  • 225
2 votes
2 answers
118 views

Find all pairs of natural numbers whose sum is 12

I have been given the following task to complete. I am not sure if my solution is the most efficient. Are you able to take a look and suggest any changes? task: An application that finds all pairs of ...
user avatar
  • 21
4 votes
1 answer
85 views

Case-insensitive sort in C

I wrote a sorting program so that if the optional argument -i is present then the sorting should be done without taking into account lowercase / uppercase letters. ...
user avatar
  • 101
0 votes
0 answers
23 views

I am building a container of differently typed variables with names for easy parsing and usage in Rust

I am new to Rust and trying to learn more about it. I want to have some kind of container that can store parameters (variables, values, constants) of varying types together with a name. This container ...
user avatar
  • 101
-3 votes
0 answers
45 views

Python: How to design a game of monopoly [closed]

So I am trying to come up with a new game of monopoly. I am not sure how to start this. Any ideas? Import Tensorflow Import math Import sys
user avatar
4 votes
1 answer
422 views

Table Printer Project - Automate the Boring Stuff Chapter 6

The project outline: Write a function named printTable() that takes a list of lists of strings and displays it in a well-organized table with each column right-justified. Assume that all the inner ...
user avatar
  • 97
3 votes
1 answer
138 views

Automate the Boring Stuff CH 10 - filling in the gaps

This exercise comes from Automate the Boring Stuff CH 10 - second edition. The exercise is called "filling in the gaps," and the instructions are as follows: Write a program that finds all ...
user avatar
  • 117
0 votes
0 answers
34 views

MTD-F Implementation in Othello

I currently am using the MTD-f algorithm, along with a hybrid negamax/negascout with memory function, in an Othello implementation: ...
user avatar
  • 101
0 votes
0 answers
10 views

Functional Fibonacci in OCaml

I'm very new to OCaml, and as an exercise I decided to implement the nth Fibonacci algorithm (return a specific Fibonacci number, given an index) in different ways, using what I've learned so far. I ...
user avatar
  • 729
-3 votes
0 answers
24 views

Should I create a class inside a namespace api? [closed]

I'm implemententing an api for a very simple file system parser for fat 16. I created a namespace with some of the struct definitions ...
user avatar
  • 107
-4 votes
0 answers
27 views

Program about Printing out a Spiral [closed]

I am trying to work on a program that prints out a spiral matrix. I have a firm idea about how to code in the algorithm however it keeps printing out an IndexOutOfBounds Exception. I am not sure how ...
user avatar
4 votes
2 answers
240 views

Porting PHP's array_push to Python

I am new to Python but not new to PHP. I've started porting PHP APIs to Python hoping to learn the Python language along the way, currently trying to grasp List, Dict, Set, Tuple. I tried writing PHP'...
user avatar
3 votes
1 answer
51 views

Call-flow graph from Python abstract syntax tree

Below is my code for building a call-flow graph from a Python abstract syntax tree. I'm not satisfied with it because the algorithm is very complicated. Perhaps much more complicated than it needs to ...
user avatar
0 votes
0 answers
131 views

Count the number of magical stones [closed]

There is a magical stone of mass 2N lying at the origin of the number line. For the next N seconds, the following event happens: Let us define the decomposition of a magical stone as follows: If there ...
user avatar
0 votes
0 answers
62 views

Vanilla JavaScript Email Obfuscation Defenses Against Bots [closed]

I have been using Cloudflare's Email Obfuscation for a while now but the JavaScript file loaded was causing a pretty substantial increases in Total Blocking Time and Time to Interactive. Then after ...
user avatar
  • 235
1 vote
1 answer
61 views

Add and delete books into this bookshelf vanilla javascript project

In this project I was supposed to add and delete books by author and title by pressing the submit and delete button. There is a video that illustrates how my project works. I did it using two ...
user avatar
0 votes
0 answers
8 views

Flutter: Updating the more recent value while the user in viewing the page with streams

Am I thinking about this the right way? I created a function that takes in a value from firebase, value in seconds, and convert it into hours:minutes:seconds, this works fine. I've used Streams for my ...
user avatar
9 votes
3 answers
1k views

A Simple Tic-Tac-Toe Game

I wrote a simple tic-tac-toe game in Python. I'm pretty much a novice, but I do have some experience with coding other things in Python. I just wanted to see if I was capable of writing a simple tic-...
user avatar
  • 143
5 votes
0 answers
61 views

A POSIX getdelim() and getline() implementation for MSVC

Tired of always having problems in reading arbitrary length lines from file under Windows, I tried to write a POSIX getdelim() and ...
user avatar
2 votes
1 answer
55 views

Reading a list of names, counting them and ordering them

I would like to know does this code follow common best practices in C++ using STL. Goal of the code: There are 10 players that were playing a game 1000 times. Each time someone has won they have put ...
user avatar
2 votes
2 answers
90 views

Create new columns based on existing columns

The code: ...
user avatar
1 vote
0 answers
29 views

Managing TimeMachinesCorp POE clock via UDP

I've got a working implementation of a go program to talk UDP to TimeMachinesCorp POE clocks. This code is also in a github repo which notes things I know aren't implemented yet. I feel like there's ...
user avatar
  • 2,646
1 vote
1 answer
54 views

Register/Login for Rock/Paper/Scissors

Recently I have been learning Python after years of putting it off, and I am having a really fun time with it. However after I spent a few hours making something that I thought was pretty cool, I ...
user avatar
  • 11
0 votes
1 answer
27 views

What is the best way to retrieve all pages of a REST API route with Python aiohttp when the number of pages is unknown?

I've encountered a paginated API route where there is no way to know the number of available pages. The only way to retrieve every pages is to check on each page if a next page exists. To do so, the ...
user avatar
0 votes
0 answers
19 views

Sensibly using fastq crate to modify fastq files

I'm learning Rust, and I have a simple program that I hope to use as a learning exercise. My goal here is to get a better idea of the proper way of doing things. I'm trying to use the fastq crate to ...
user avatar
  • 1
3 votes
1 answer
31 views

List to Dictionary Function Project - Automate the Boring Stuff Chapter 5

This is the List to Dictionary Function for Fantasy Game Inventory project in Chapter 5. The project is as follows: Write a function named addToInventory(inventory, addedItems), where the inventory ...
user avatar
  • 97
0 votes
0 answers
18 views

Create a network using Svelte [closed]

it's the first time I use Svelte and I'm a bit confused. I created a network using d3 and it works but I'm asking myself if this is the right way to implement it using Svelte. Here my code: Svelte ...
user avatar
0 votes
0 answers
10 views

How to numerically implement 2D advection equation with second order upwind scheme in MATLAB? [closed]

I am trying to numerically discretize a 2D advection equation to model the transport of rocks with thickness (h_debris) on top of glacier ice with velocity components (velx_mod and vely_mod). The ...
user avatar
1 vote
0 answers
48 views

To do application using python's tkinter and sqlite3

I program python as a hobby and wanted to learn how to apply databases in a functional program, while at the same time make something useful. so I made a to do application with some basic ...
user avatar
0 votes
3 answers
77 views

Destructuring an object in JS

The solution I have written is working as expected, but here is my function: ...
user avatar
  • 1
1 vote
0 answers
14 views

TCP socket management using multiprocessing

I wrote a Python code for a device that generates an hotspot and communicates with an app using a TCP socket. The communication is managed by a process that opens a socket and uses two threads to send ...
user avatar
  • 111
1 vote
1 answer
40 views

Typescript simple observable state and web component

I've been experimenting with wiring up a vanilla web component in a reactive manner to a state box. The goal is that when something changes on the state object, the web component reacts. I realize ...
user avatar
  • 113
0 votes
1 answer
28 views

range slider show/hides and reset (vanilla js)

I have a HTML5 range slider. i.e. ...
user avatar
0 votes
1 answer
28 views

OAuth implementation for Puredata

I am managing an OAuth implementation for Puredata (Pd), which is written in C. OAuth can accept RSA keys, but Pd cannot send messages with newlines, so placing private keys will come as a list of ...
user avatar
  • 155
3 votes
1 answer
53 views

Topological Sort C++

Comments on optimizing the code or improving the code are requested. The input parameters to the class constructor are a one dimensional array of job ID's and the second argument is a list of vectors ...
user avatar
-2 votes
1 answer
47 views

Insert row into database using static or non-static method [closed]

I would like to know if there are any benefits of one of the following 2 methods which insert an object into a database The first function calls the Model method statically, creating a new instance of ...
user avatar
3 votes
2 answers
64 views

Alphabet Rangoli

I have written alphabet rangoli code in python and would like to get it reviewed. The goal is to print concentric diamond shapes made of letters, with "a" at the center, "b" ...
user avatar
-1 votes
0 answers
39 views

Re-designing the response type of a method. Instead of throwing exceptions, put these exceptions in an Error property

I'm trying to improve SendAsync because of how ugly it looks, for ex. look at EnsureAuthenticated. I don't like the fact that it throws exceptions when it fails to ...
user avatar
  • 401
-1 votes
1 answer
61 views

Script becomes too big

I'm trying to increase the number of elements in the #source div from two to three and so on. But in order to increase it each time, I will need to create a lot of new lines of code with pretty much ...
user avatar
  • 7
1 vote
1 answer
31 views

Trouble with rendering speed of the animation of a simulation?

The following code is a conversion from some old java I wrote to python. It shows the beginnings of a simulation of an ant colony. I am finding the animation speed very slow - and I'm wondering if I ...
user avatar
  • 155
0 votes
0 answers
32 views

Filing system post editor

I'm on holiday this week and wanted to have a look at my filing system. It is a WinForms application in VB.NET (.NET Framework 4.8). The idea is that, like in a classic internet forum, you have ...
user avatar
  • 175
3 votes
2 answers
59 views

Pascal's triangle solution in Python code

I have solved the pascal's triangle problem. I am not good at writing efficient programs, hence any suggestions/ comments shall be welcomed. ...
user avatar
0 votes
0 answers
26 views

Lexer for english words in C

I implemented a simple lexer for English. What it's supposed to do is scan English text (not large text, just about one or two sentences at a time), split words at spaces, line breaks, mark each word ...
user avatar
  • 269
-3 votes
0 answers
47 views

how to make the code more beautiful and correct? [closed]

Hi everyone i trying myself with php+ base oop sintax. So can you tell me what I need to change in this code to make it more beautiful and correct index.php ...
user avatar
  • 1
0 votes
1 answer
28 views

Asynchronous recursive function for generating a unique Id

The code below is my first purpose built asynchronous recursive function. It took me a while to figure out how to write the thing, and I would like a second opinion. It's part of a project for The ...
user avatar
1 vote
2 answers
63 views

Generating random integers in one of three ranges

I have a function returns a random integer number. This function only accepts these three numbers 1,2 and 3(there's another function in my code which is make sure of this otherwise that function will ...
user avatar
  • 13
0 votes
0 answers
39 views

Web-scraping favorites from a website and saving them to an Excel sheet

...
user avatar
1 vote
0 answers
30 views

Web scraper for pokemon prices using Selenium

I made this scraper to pull the prices of pokemon cards off tcgcollector, using a csv file from the same site. Because for some reason they don't export price. I'm looking for any kind of noobie ...
user avatar
1 vote
1 answer
65 views

Storing different types with common base using atomic-based typeid

I'm trying to develop some kind of in-memory store for my entities. These entities are representations of the devices available on the system. There may be eg. 3 leds, 1 temp sensor, 2 engines etc. ...
user avatar
  • 241
3 votes
3 answers
97 views

Json Array to ND Json converter

Problem We have a tool which produces output as json array We have another tool which anticipates input as ndjson (newline delimited json) I need to write a converter to transform json array to ...
user avatar
  • 5,410

15 30 50 per page