Questions tagged [classes]
Core to Object-Oriented Programming (OOP), a class is a template for creating new objects that describes the common state(s) and behavior(s).
413
questions
0
votes
1
answer
62
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 :)
...
5
votes
3
answers
667
views
Library: Point class
Recently I made a point dataclass and a point_calc class which performs various commonly used algorithms on a point.
...
2
votes
1
answer
113
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 ...
2
votes
1
answer
82
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 ...
3
votes
2
answers
487
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?
...
2
votes
1
answer
75
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 ...
-4
votes
1
answer
58
views
any bits unsigned integer [closed]
This is a class that acts as an unsigned integer with a variable amount of bits.
...
1
vote
0
answers
27
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 ...
2
votes
1
answer
95
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:
...
1
vote
2
answers
123
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 ...
2
votes
1
answer
77
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 ...
0
votes
1
answer
68
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 ...
2
votes
3
answers
119
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 ...
4
votes
1
answer
159
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 ...
1
vote
0
answers
45
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 (...
0
votes
0
answers
376
views
football team results in python
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 ...
0
votes
0
answers
57
views
Java pathfinding in general trees - Part 1/4: model classes
Java pathfinding in general trees - Part 1/4: model classes (this post)
Java pathfinding in general trees - Part 2/4: algorithms
Java pathfinding in general trees - Part 3/4: demonstration
Java ...
1
vote
0
answers
57
views
Powershell Outlook Email Security custom classes
This provides custom classes to work with Outlook 2016's email security settings in trust center. Included are some top level functions to list outlook profiles, retrieve the data from a given profile,...
0
votes
1
answer
128
views
Fetch data from two exchange (Python)
I'm trying to fetch the latest price from two exchange and do further action base on the prices.
exchanges.py:
...
0
votes
0
answers
68
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 ...
1
vote
1
answer
38
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 ...
2
votes
1
answer
145
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 ...
1
vote
1
answer
115
views
A greedy approach to the Knapsack problem with C++ templates
The assignment is to be implemented on the following instructions:
You are to write a Knapsack class and the main() to support and
demonstrate the functionality required here.
A function generate(int)...
3
votes
1
answer
240
views
Movie app using fetch API
The code will create a new Movie class and then with the response of the API call, will render html using the data.
Although the code works, I imagine it will get quite convoluted, now that everything ...
2
votes
2
answers
55
views
Object Oriented Hangman in Python (version 1.0)
As always, I am looking for as much criticism as possible. Forums and exchanges like this are where I have received my most solid feedback.
Enjoy!
Github hangman repository
The code that I import is ...
2
votes
2
answers
175
views
Python: Sorting Marbles with switch and rotate - Need help in optimizing a working solution
I have made a couple modifications to the switch/rotate routine for the classic Marbles game. The modifications are
Using a random_select method that can help pick either switch or rotate
Create a ...
0
votes
1
answer
223
views
What can I do better in my C++ serialization implementation?
I want to serialize a class Mango recursively.
...
4
votes
1
answer
133
views
Alpha finance trader singleton
I used to write singleton in Python, which actually Alpha only need to initialize once and the trading bot will run forever. For example in main.py:
...
0
votes
0
answers
164
views
Function block diagram code in CPP to program Arduino
I have created a processing program (Java) with which a programmer can use a GUI to make a program for an Arduino using logic function blocks. It looks like this:
Ofcourse it still needs some work. I ...
4
votes
2
answers
92
views
A simple and fast library/code to store & manage variable data
I've been searching through the different ways to store data and found some helpful and actually great libs like:
JSON
XML
And some neh:
text file basic write and read
some binary type data storing?...
2
votes
1
answer
172
views
Generating random number of randomly sized Squares/Rectangles using numpy arrays
I made classes to use in generating square/rectangular shapes on a texture.
...
2
votes
2
answers
72
views
Template Complex class
I have created a class Complex which represents a complex number of any arbitrary arithmetic type. Overloads are given for the 4 common functions, addition, ...
8
votes
5
answers
2k
views
ReversibleList: a list that is "reversed" in O(1) time
UPDATE: Thanks everyone for the suggestions! I made a follow up version here which fixes the bugs, incorporates the feedback, and has more tests.
A ReversibleList ...
2
votes
1
answer
261
views
Object-oriented Snake game in HTML without using canvas
I wanted to try out classes in Javascript and implemented a snake game. You can control the snake by using the arrow keys.
I would be interested to know if the source code can be improved in terms of ...
0
votes
1
answer
119
views
Equation calculator
Function
Calculates values for user defined equations. Just a concept right now. I plan to add many more equations.
Equations in code
Density:
$$ p = \frac{m}{v} $$
Speed:
$$ s = u + a \cdot t $$
<...
3
votes
2
answers
286
views
MP3 Playlist Class in Python
Background Info
I am an intermediate level Python programmer. This is my implementation of a MP3 Playlist class challenge that was hosted on 101 Computing.Net. The ...
0
votes
1
answer
178
views
Common interface for fixed-length and variable-length lists in C#
I am working on library project in which I am reading and writing binary files that have own file format structure. In that structure there are variable-length and fixed-length elements. My approach ...
1
vote
1
answer
168
views
Monster Maker application in Tkinter
I have a program that works okay (not fully completed) however, I would like to simplify things and create some classes and different .py files for my tkinter app as I feel that would help organize ...
3
votes
1
answer
147
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 ...
2
votes
1
answer
357
views
Sudoku Tkinter generator
I made OOP sudoku generator - at this moment it generates only valid table. You can clear it and then generate over.
The case is I struggled with calling "fill_board" and "clear_board&...
1
vote
3
answers
714
views
Saving Multiple Lists to Database - C# Forms
I am trying to store multiple lists to a database but I'm struggling on finding a better way of doing it, as the way I am doing it now, seems to be incorrect.
On my form, I have 6 different legs. Each ...
2
votes
1
answer
90
views
UpdateCustomer - implementation in C++
I am trying to write a program that does the following:
The application will read the customer and book orders data from a
data file “BookOrders.txt” and load them in a customer linked list,
each ...
1
vote
1
answer
155
views
ASCII game in console [closed]
Overall, I want to make a game in console, something Pokemon-like but with typical rpg scenery - swords, magic and all that. I want to make player able to move around the map, find dungeons, fight ...
2
votes
2
answers
1k
views
Input validation that verifies a boolean assignment using a Boolean object
Taking online college course and I'm new to Java. We just learned about input validation. I've used input validation pretty comfortably for strings, ints, and whatnot. But I had to validate a boolean ...
1
vote
1
answer
64
views
Tiny Validity class
Here is a part of my new code replacing the old and deprecated old-school one.
Let's get to business right away:
I document everything with Documentation comments, which are proving very useful so ...
1
vote
1
answer
124
views
Python password generator with Tkinter
I program in Python as a hobby and this week I decided to write a program that generates 16 character long passwords. I wrote this program as a class, which i rarely do. Because of this I think I ...
0
votes
1
answer
44
views
Comparing custom Geometry classes (Lines and Planes): How to increase the accuracy of the __eq__ method
I'm creating custom classes to represent Planes and Lines on a 3d graph. To help improve the performance of my process I've started implementing __eq__ so that I ...
0
votes
1
answer
28
views
JavaScript Class with a Fixed Set of Instances
I am looking to write a JavaScript class BasicType with five fixed instances INT, FLOAT, <...
1
vote
0
answers
493
views
deprecated strftime in PHP 8.1
I saw that strftime is deprecated in PHP 8.1.
I saw I can use a class include in intl but I'm not sure to understand how to use It.
On my site I use this function with the array $datesToConvert{020222,...
-1
votes
1
answer
385
views
Vending Machine give changes after they select the menu [closed]
The program offers items, has the user pay for items, 'gives' the items. It seems to work more or less. I have 2 questions:
I don't know how to deduct the cash from cash it is deposited and when they ...