Category "class"

python workaround gpiozero when_motion with multiple sensors

i'm trying to listen on 3 motion sensors, each one triggering its own sound i'm using when_motion because it's creating a thread, so i can do other thing while

How do I make this function more efficient?

I'm trying to create a tiny database that contains a list of people, their names, ID, and their income as time passed on. Using this database I'd like to find t

Pythonic way to control an attribute over another attribute

There is a pythonic way to control attributes? I wan't that the init method is clear, trying to avoid to use a function like: self.a = check_a_greater_than_b(a)

VBA UserForm Frame ScrollTop function not working from class function

This should be a simple task and I've been coding in VBA for 10+ years but I cannot seem to get this to work. I have a UserForm with a MultiPage (with 2 pages)

Still can't use a function defined in a separate .cpp file

I've been searching through questions on this for hours, and it just isn't working for some reason, so sorry if there's already an answer and I just didn't unde

Friend classes and header files

I am writing a C++ program where I wish to use a friend class in order to access protected members of another class. Here is the header for the class I wish to

Flutter and audioplayer: cannot stop playing audio between 2 classes

**Hello, I am new to Flutter, I hope you will be able to understand my problem. I am using “AudioPlayers” and would like to play audio from a define

how to handle garbage value while making my own vector in c++?

Good evening guys I am trying to make my own vector class. But I have few problems. Firstable, I dont know why There is garbage value I've tried to check constr

How to generate aware time object in Faker?

I have the following (simplified) model and factory: models.py class Event(): duration = FloatField() start_time = TimeField() finish_time = DateTim

How can I repair this error that occurs occasionally when my code is running?

Sometimes the code runs till the end without any errors while other times it stops in the middle and gives me this error Thread 1: EXC_BAD_ACCESS (code=EXC_I386

Is there a simple way to compare two class objects for all items that are not none?

I am looking to compare two instances of the same class, but only the items for which both are not None. for instance, I will have a Bolt class, and one instanc

Exception Handling using a Constructor (JAVA)

I'm currently working on a project in which I am to ask the user to input 2 numbers, divide them, and then throw an exception if the denominator is 0. I feel li

How to call tostring method on all objects

I have a school project where I have to make every tostring method appear on every object. Does anyone know how to do it? enter image description here enter ima

Calling a method from one class to another to get its value

package Multiplemethods; import java.util.stream.DoubleStream; public class TimeOffice { public static void main(String args[]){ //instance variables dou

How to create objects from a dict where the keys are the name objects and the values are the attributes? Using a loop

class Cars(object): def __init__(self,brand=None,color=None,cost=None): self.brand = brand self.color = color self.cost = cost ima

jQuery doesn't want add class without point

jQuery doesn't want add class without point. Here's the html markup: <div class="form-group" id="plis"> <select class="form-control-input notEmpty"

How to access private members in friend function in header class

I have created header file for definition of Class Name.h class Name { private: char* Fname; char* Lname; public: Name(char* ='\0', char* ='\0'

How to construct a class from a pack in C++?

I am trying to initialize a class with a pack passed as an argument to my function. Here is what I got so far: struct Vec3 { float x, y, z; }; template<

Dart: Object is giving output only once even when called multiple times

Hi I am trying to print value of 'a' property of x object but I only get output once. void main() { var x = Test("Boy"); x; x; x; x; x; x; } clas

How Do You Make an Object From an Inheritance Class in Java?

EDITED: Looks a little cleaner now, reflects where I currently am and what I'm trying to accomplish, and shows the new issue I'm working on (which has a comment