Skip to main content

All Questions

Tagged with or
Filter by
Sorted by
Tagged with
5 votes
4 answers
284 views

Creates class and makes animals, then print bios

...
LMays's user avatar
  • 133
8 votes
0 answers
117 views

Faster VB6 / VBA class deallocation

VB6 / VBA is slow to deallocate class instances VB* class instance deallocation becomes exponentially slower the more instances of that particular class there are. Quick test. You will need: Guido's ...
Cristian Buse's user avatar
1 vote
1 answer
88 views

set Member Function Implementation for Image in C++

This is a follow-up question for draw_if_possible Template Function Implementation for Image in C++. In G. Sliepen's answer, set member function has been mentioned. ...
JimmyHu's user avatar
  • 5,510
4 votes
1 answer
66 views

Implementing Intersections data structure that is able to hold a container of multiple types that maintains order in C++

I am trying to implement a way to store intersections of rays with arbitrary objects. So far I thought I could make the object derived from an interface and put that as the type in the Intersection ...
Zcahfuz's user avatar
  • 41
5 votes
1 answer
83 views

Backend-snippet of a full-stack web application for creating, viewing, and registering for events

The backstory (you can skip this if you want to) This code stems from a project that I had to do for a presentation for a university class around November 2023. The task was the following: Create a ...
JupperTV's user avatar
6 votes
3 answers
1k views

Simple Container Class

I'm learning C++ and trying to create my own container class just for practice (I know about vector, list, map, set). I plan to improve this class and add new methods as I learn new material. Please ...
vansergh's user avatar
  • 161
5 votes
2 answers
696 views

What is the best way to set a class value to a variable in Python if it exists in a dictionary?

I have this code which sets values in a location class from values from JSON data. ...
Asher Ross's user avatar
10 votes
2 answers
1k views

A simple Python class designed to facilitate investment portfolio analysis

Background In an attempt to learn a bit more about investing and economics, I've begun writing a simple historical portfolio analysis tool in Python. The ...
IntegerEuler's user avatar
3 votes
1 answer
176 views

Snail matrix in Java - version III (generalizing)

Once again, in the previous version, Alexander Ivanchenko helped me with his awesome answer. Now, I have improved the toString() and, also, generalized the class ...
coderodde's user avatar
  • 29.8k
4 votes
1 answer
331 views

Snail matrix in Java - version II

(This post is the continuation of Snail matrix in Java. Also, this post has an continuation.) As previously, a snail matrix is any square matrix \$M_n = \mathbb{N}^{n \times n}\$ with cell elements ...
coderodde's user avatar
  • 29.8k
6 votes
2 answers
895 views

Snail matrix in Java

(This post has an continuation: Snail matrix in Java - version II.) Inspired by this post, I decided to solve that problem in Java. The idea is to decide on an \$n \in \mathbb{N}\$, create a square ...
coderodde's user avatar
  • 29.8k
4 votes
1 answer
87 views

Terminal based game: Part 3 (Using templated game)

Working from previous posts In this post: Terminal based game: Part 2 I introduced the concept of a Game object. To build a game like Terminal Base Snake you could ...
Loki Astari's user avatar
  • 96.6k
2 votes
1 answer
74 views

Dynamically mapping an API's setting IDs to instance methods using Descriptors

I'm working with an API, where the url can be constructed with setting_ids. To more clearly indicate the functionality of the setting ids I am mapping them to a WriterClass' methods, with relevant ...
Floriancitt's user avatar
0 votes
1 answer
68 views

Should the SqlConnection Be a Class Field or Should I Pass It In and Out Of Functions As Needed?

I am writing a C# Database connection class and I am trying to adhere to best practices and produce clean code. In the CreateAndOpenDatabaseConnection function ...
BeeFriedman's user avatar
0 votes
1 answer
49 views

Updating class method to use data from new weather API endpoint while keeping same return value object structure as with old endpoint

I needed to update a class in Node.js that parses the response from a new weather API endpoint but still preserves the same object structure and key values from having been using the old weather API ...
Aaron Goldsmith's user avatar
5 votes
5 answers
374 views

Using MergeSort to sort data structured in Person class based on object attributes (DRY)

I am working on a program that sorts data using mergesort. I implemented functions to 'Person' class to make it comparable, sortable, subscriptable, iterable, and castable (to float, int, and string). ...
Pitre's user avatar
  • 51
1 vote
2 answers
134 views

Mapping an API's setting IDs to setting names with class methods, enabling clearer utilization

I'm trying to access an API using the requests library in as clean a manner as possible. The API is accessing various settings of various devices. I'd like to keep my code as readable and ...
Floriancitt's user avatar
1 vote
1 answer
114 views

An Updated Multi-dimensional Image Data Structure with Variadic Template Functions in C++

This is a follow-up question for Multi-dimensional Image Data Structure with Variadic Template Functions in C++. Considering the suggestion from G. Sliepen: Make everything work for more than 5 ...
JimmyHu's user avatar
  • 5,510
2 votes
2 answers
128 views

Alternate **kwargs for class __init__ function [closed]

I want to set up a Python class so that it can be constructed with one set of parameters or another. I'm trying to mimic C++ function templates. I tried alternate constructors. In the actual code I'm ...
JDT's user avatar
  • 81
5 votes
1 answer
294 views

Multi-dimensional Image Data Structure with Variadic Template Functions in C++

This is a follow-up question for Three dimensional data structure in C++. I am trying to implement multi-dimensional image data structure with variadic template functions. For example, ...
JimmyHu's user avatar
  • 5,510
3 votes
1 answer
95 views

Random generation of points for the graphs of 3 stock share parameters

I currently studying OOP and related design patterns, and tried to implement random data generation for some stock charts using OOP as an exercise. This code randomly generates data points for 3 ...
Jin22's user avatar
  • 33
5 votes
2 answers
840 views

Three dimensional data structure in C++

This is a follow-up question for Three dimensional gaussian image generator in C++. Considering the suggestion from G. Sliepen: Structure of a 3D image Your 2D ...
JimmyHu's user avatar
  • 5,510
0 votes
3 answers
160 views

Declaring type definition once for all variables

To avoid the use of magic numbers, I created a static class to store some integer values that are represented inside a database. I avoided using enums because I need to cast them every time I use them....
Abcd's user avatar
  • 103
1 vote
1 answer
73 views

Python3 tokenizer abstract baseclass ( Without the permission to be instantiated directly )

I'm a newbie python developer, and fortunately I have been introduced to the principle of abstract base classes and they seemed pretty interesting to tackle while going forward in my Python journey. I'...
KhodeNima's user avatar
  • 399
1 vote
1 answer
208 views

Python3 currency abstract class (without the permission to be instantiated directly)

I'm a newbie python developer who accidentally studied the concept of Abstract classes and I found it pretty much helpful to implement due to the SOLID principles. At the very moment of testing and ...
KhodeNima's user avatar
  • 399
3 votes
2 answers
126 views

Defining hardware components structure

I'm writing firmware for my Arduino project, and I'm struggling with a clean, scalable hardware mapping structure. Initially, I had the following namespace: ...
Dead1nside's user avatar
4 votes
1 answer
63 views

Improving readability of semi-nested classes for loading data of separate runs of a joint testing campaign

A bit of background: Most often I am analysing data (mostly timeseries) of mechanical machine conditions (vibrations, temperatures...) that were acquired in different 'runs'. All runs were acquired ...
Jorre Goossens's user avatar
4 votes
1 answer
196 views

Blog site generator in python

Summary: This project is a simple static blog site generator written in python, utilizing pandoc to convert posts written in Markdown to HTML. It is essentially a follow up to my previous post: blog ...
766F6964's user avatar
  • 901
7 votes
3 answers
209 views

C++ String Class Reimplementation

I started learning C++ about a week ago and I was hoping somebody can critique my code. I decided to implement my own basic String class just for the sake of applying all that I've learned about ...
Janriz Libres's user avatar
0 votes
1 answer
103 views

PHP Class to render HTML div styled tables v2 [reviewed by me]

After my previous question I made several changes and came up with this. Remember: I wrote this for PHP 7.0.33. I'm aware I should upgrade, save the advice :) ...
julio's user avatar
  • 199
5 votes
3 answers
845 views

Library: Point class

Recently I made a point dataclass and a point_calc class which performs various commonly used algorithms on a point. ...
TheHappyBee's user avatar
2 votes
1 answer
518 views

PHP Class to render HTML div styled tables v1

This class aims to render an HTML compliant div styled table. I added a help() method that provides usage and styling in a more user-friendly way. Besides the ...
julio's user avatar
  • 199
2 votes
1 answer
105 views

HTML form Class

After my previous question I revised the code to the code below. I am using PHP 7.0.33 and tried to accomplish PSR-12 as much as I could. In "condensed usage" in the docblock you can find a ...
julio's user avatar
  • 199
3 votes
2 answers
695 views

PHP HTML form Class - so far so good?

I am writing this class to render HTML forms. It is working as expected, so far. There are many things to be done yet (including testing). Is it ok to keep this way? ...
julio's user avatar
  • 199
2 votes
1 answer
102 views

PHP Pagination class (Clase para paginar resultados)

This is my first question in Code Review. I apologize in advance for using Spanish (my native language). I thought there was a spanish version of Code Review. This class is meant for pagination. It ...
julio's user avatar
  • 199
-4 votes
1 answer
86 views

any bits unsigned integer [closed]

This is a class that acts as an unsigned integer with a variable amount of bits. ...
RhinoRunner's user avatar
1 vote
0 answers
107 views

Storing multiple PyTorch tensors of different shapes with names that are not known by advance

I need to create a container for instances of torch.Tensor of different shapes, where I can call them by their name. It is a use case for a dict except that: I don't want to rely on the heavy syntax ...
Xiiryo's user avatar
  • 111
2 votes
1 answer
106 views

Making a game using python and pygame

I am making a game using python and pygame and as my game started to grow, in some of my classes the number of instance variables started to get big. Like in the settings class is like this: ...
Alex's user avatar
  • 123
1 vote
2 answers
151 views

A simple String class and its special member functions

I am learning the behavior of C++'s special member function, using a naive String class as example. (The code is modified from this tutorial) Here is the ...
Lion Lai's user avatar
  • 297
2 votes
1 answer
161 views

Java program for complex math utilities

I've got 2 Java programs, with the aim of solving some matrix math that involves complex numbers (an EE problem). Both programs have main functions, the one with all the complex math operations has a ...
Aloy's user avatar
  • 21
0 votes
1 answer
78 views

GPG class for AJAX calls

I want to know if this GPG class in PHP is up to snuff as a professional-level class. I did my best to include everything and make it easy to use. I'm calling the object by invoke(). If anyone can ...
Anthony Pulse's user avatar
2 votes
3 answers
136 views

Rock Paper Scissors with file save/load

Took me a couple days and I had to make 2 versions. Version 1.2 is better looking and more readable, with better functionality. No where near optimized though, as I know nothing about that. Save and ...
Beginner's user avatar
  • 199
1 vote
1 answer
146 views

Interconnect Recipe and Notes

I'm currently working through a tutorial. The project is a recipe website. One of the lessons to "save some lines of code" and use bidirectional setters for bidirectional relations of ...
Benjamin Basmaci's user avatar
4 votes
1 answer
215 views

Simple console menu backend with calculator implementation in Python

I've written a simple calculator in Python. I want to show not much effect of the action but the logic behind it, by that I mean console menu implementation in the ...
whiteman808's user avatar
3 votes
0 answers
72 views

A Haskell-style "maybe" type in Python, version 2

I have decided on a preferred solution to my question A maybe type in Python. Which implementation is best?, and have expanded it to be more ergonomic. I have implemented a host of utility functions (...
schuelermine's user avatar
3 votes
2 answers
1k views

Football team match result summary table

The program is taken on the standard input a list of football team games with the result of the match and displays on the standard output a summary table of the results of all matches. A team is ...
Sefora Abigail's user avatar
2 votes
1 answer
223 views

Fetch data from two exchanges

I'm trying to fetch the latest price from two exchanges and to do further actions based on the prices. exchanges.py: ...
tung's user avatar
  • 107
1 vote
1 answer
95 views

Investment capital calculator(Python)

The program is simulate a situation where my goal is to lose money in Corresponding exchange, however I will win max_lose times ...
tung's user avatar
  • 107
1 vote
1 answer
51 views

Sparse String Matrix Storage Class C++

Introduction I implemented a class to store a matrix with entries at positions (i,j) that are strings. The matrices I would like to efficiently store in this class have strings as entries and it ...
jan0155's user avatar
  • 113
2 votes
1 answer
179 views

Create a string "Build" number for procedures and module

The class assigns various strings to the build number. So the build might look like 3.4.5.1 which would be of the format ...
DanM's user avatar
  • 121

1
2 3 4 5
9