1,533 questions
0
votes
1
answer
30
views
Is it a good practice to reassign self properties to a local variable
I wonder if it is a good practice to reassign the status_report to a local variable like this:
def report_remote(remote,error):
def report_error(err):
if err ...
-1
votes
1
answer
32
views
No implicit conversion Error while extracting nested parameter in Rails self method
I am trying to implement search functionality based on parameters by passing into rails model self method. While checking passed parameter conditionally on query I am getting no implicit conversion of ...
1
vote
1
answer
144
views
std::forward_like error with clang and deducing this
I'm experimenting with deducing this in order to simplify a code base. I'm getting an issue with a straightforward test:
#include <iostream>
#include <type_traits>
#include <utility>
...
6
votes
0
answers
453
views
How can I determine the type of a tuple's elements directly from its type name in Swift?
I have been exploring different abstractions in Swift, and I found myself stumped on how to determine the type of a tuple's element from its own type. I know the compiler and Xcode are quick to ...
0
votes
2
answers
59
views
Python decorators with class methods
I want a decorator that I can use as both @decorator and decorator() with class methods, like this :
def decorator_with_args(name):
print(f'Hello {name} !')
def decorator(func):
def ...
-1
votes
1
answer
108
views
Python Tkinter structured in a Class: Can methods be in an independent file?
I'm setting up a Tkinter GUI in what's becoming a rather long Python class with attributes toward the top and methods toward the bottom. To avoid the need for so much scrolling up and down, it would ...
0
votes
1
answer
57
views
List > numpy.ndarray using np.array(list) not working in class __init__ . Problem with numpy?
I'm currently building a class called 'system' that takes in 4 arguments: A, B, C, D which are matrices of a state-space system.
The intent is that the user can input these using nested built-in <...
0
votes
0
answers
128
views
making a Vec<Child> containing reference to Parent struct? [duplicate]
Im new to Rust, and i'm having this problem where I need to keep a Vec of Child in the Parent struct, and each child needs to be able to use the Parent functions, so with some research I ended up with ...
1
vote
2
answers
192
views
how to clone an Rc from a method that takes in &self
I have a struct Region which contains [Option<Rc<RefCell<Region>>>; 2] as its subregions and Option<Weak<RefCell<Region>>> as its container. I am writing a method ...
0
votes
1
answer
569
views
Prisma Schema and query for comments and comment thats a replay to a comment in single table
I have a basic chat system with user comments, and I am now adding a reply method but not able to create in a self relationship I think is possible.
model shoutMessage {
id String ...
1
vote
1
answer
73
views
Correct way to call helper function in a class
Is there a 'correct' way to call a helper function when using an instance method in a class? Both functions calc_age and calc_age_v2 work, is there a preferred method? This is a toy example, the real ...
0
votes
0
answers
89
views
I've recently begun experimenting with classes in Python and I'm facing a challenge with string slicing. Here's a snippet of my code
I've recently begun experimenting with classes in Python and I'm facing a challenge with string slicing. Here's a snippet of my code
def future(self):
self.futures = ['you will die soon','you will ...
0
votes
0
answers
41
views
WCF Self Hosted no parallelism at first
I have a self hosted WCF service with two methods:
public async Task<string> MethodA()
{
return await Task.Run(() => samplesMain.MethodA());
}
public async Task&...
1
vote
1
answer
103
views
Unable to uninstall the Nucleon EDR Agent [closed]
I have installed Nucleon EDR to protect my endpoint. After completing my testing, I want to temporarily uninstall the EDR Nucleon Agent. However, I am unable to do so, and I also cannot access the ...
0
votes
0
answers
33
views
I don't understand 'self' in Python class [duplicate]
So, what I know about python class is that if I want to assign values to instance attributes, I have to use self, something like this:
class Myclass:
def __init__(self, num1, num2):
self....