30,476
questions
-4
votes
1
answer
37
views
printing prime number using function till a number n [closed]
I created a function primeInRanges to print the range of prime numbers. I created a helper function isprime ot find whether a number is prime or not. I call the isprime function in primeInrange ...
-8
votes
0
answers
44
views
Can someone help me with my random encounter generator? [closed]
I'm trying to make an random encounter generator that checks for encounters and displays the results of a week worth of checks. The two specific problems I'm having #1 I'm trying to get my calendar ...
-1
votes
0
answers
26
views
Unable to send Promise result to renderer from preload file in Electron
I'm trying to display the path of a user's Downloads folder in my Electron app using the app.getPath() method. But for some reason, getPath returns a promise and the path inside the promise result is ...
-1
votes
0
answers
42
views
Invalid characters in HTTP method name - how to decode what is being passed [closed]
Sometimes after my service works for a while, a day approximately, I see in the logs the following exceptions:
java.lang.IllegalArgumentException: Invalid character found in method name [...
0
votes
0
answers
36
views
Why does emptyArray.every() return true in Javascript? [duplicate]
Why emptyArray.every() returns true? It doesn´t make sense to me because there is no element which you can apply the callBackFunction on?
Example:
let x=[];
x.every(n=>n>10);
I would expect an ...
0
votes
0
answers
21
views
How generic should method names in a service layer be? [closed]
I have a Java project managing APIs, that have a service called UserService. I want it to retrieve a user entity, but I'm debating the method name for fetching this user entity. I initially considered ...
-1
votes
2
answers
52
views
c# split number in text [closed]
I have a problem and I can't solve this program. I want to identify numbers above three digits in a text and separate them from left to right so that they can be read. Just please keep in mind that I ...
0
votes
2
answers
84
views
VBA To Parse Userform Name In Method
I am trying to write less code by learning how to use OOP method. Its been a bit rough for me and have stuck. I would like to know how i will be able to parse the string name of my Userform. I have ...
-2
votes
2
answers
101
views
Doggy C# random method function errors
I'm learning c#. I came up with the idea of making 'echo' functions for practice. I decided to make a program about dogs and having the console say things about the dog's actions and attributes. The ...
-1
votes
0
answers
23
views
Error : Inconsistent accessibility: return type is less accessible than method ' maui c# [duplicate]
namespace BooksStore.Services
{
public class BookServices
{
private string baseurl {get; set;}
public BookServices()
{
this.baseurl = DeviceInfo....
0
votes
2
answers
61
views
Passing original public variables as parameters of method to be continually checked
I'm almost certain this question has been asked before, but probably not in the way I'm going to ask it.
I'm trying to make a simple method called DAwaiter that waits until a specific public bool ...
-2
votes
1
answer
61
views
Converting functions to methods in Python 3.12
I have a Python program that has 1,000s of functions (def), and none of them are using classes.
Is there an automated way to convert these functions into class methods? I would group related functions ...
-4
votes
0
answers
26
views
I don't understand why the console is returning the length of the array as 4 when in my mind it should be 3 [duplicate]
Can someone explain?
I initialised the push variable with the push method.
I would expect a return value of 3 since indexing works like this : [0,1,2,3].
I got a console log of 4 though. I am confused
...
0
votes
0
answers
39
views
Vue component: method property not rendering correctly on an app
I'm a beginner that is reading and practicing a book called 'Full Stack Vue.js' by Hassan Djirdeh and I'm having trouble rendering the showTitleOfActiveDay computed property in my Vue component ...
0
votes
1
answer
63
views
Weird behaviour when passing array to method in C [duplicate]
I wrote a method that takes as parameters two stations and an array of railway trails.
typedef enum { MA1, MA2, MA3, MA4, MA5, MA6, MA7,
MA8, MA9, MA10, MA11, MA12, MA13, MA14, MA15, MA16} ...
-3
votes
0
answers
70
views
why is it saying that arr[] is an undeclared variable? [duplicate]
i tried putting the array in Sort() but that didnt work and i also declared it as a static variable but then it showed a nullpointer exception error i have no idea what to do. This code is for my ....
-3
votes
0
answers
38
views
How to write a method to deal a certain number of cards from the deck? [duplicate]
I am new to Java. I am trying to write a method where I could deal specified number of cards from the deck. I wrote my method in FullDeck class, but when I apply it in the main method, I get an error. ...
1
vote
2
answers
78
views
"add" method for linked list on python
I'm trying to write an add method for linked list on python, but it's not behaving as expected.
class linkedlist:
def __init__(self):
self.item=None
self.next=None
def add(self,...
0
votes
1
answer
37
views
Passing a socket to a function and modifying it, or creating a socket inside the function and returning it
I am creating a simple python ASGI server and I have doubts about my implementation of the function that creates the server's socket.
Should I create the server's socket inside the function and return ...
1
vote
3
answers
42
views
Constructing a "bound method" using "unbound method" and object in Python
In the following trivial example, what is the "Pythonic" way to create a "bound" method using some_method and some_obj? (Let us assume that we cannot just use some_obj.test_method)
...
0
votes
0
answers
12
views
How to Make New Class Method Work Python 3.11.4?
I have created a subclass called list that inherits list. I have managed to create .push() as it is in Javascript, however when I made push it did not show up as a method.
I tried this:
class list(...
0
votes
0
answers
21
views
In action method am not getting the values after ajax post call
var obj = {
RdEmail: useremailid,
RduserName: username,
RduserPassword: userpassword,
RdGender: gender
};
-----------1----------------------
$.ajax({
url: "Registration/...
-1
votes
0
answers
86
views
Change activity doesn't override methods
I'm developing an app that establishes a Bluetooth connection between two devices so that they can communicate to each other to change their own views.
Everything worked perfectly, but I needed to ...
0
votes
1
answer
55
views
Update object method, with optional parameters
I have a class named car, with properties color, and year.
I'm trying to create an update method, so that it updates only the parameters provided, which can be color, year or both, but if no ...
0
votes
1
answer
29
views
Enemy script stops enemy from chasing after player
I have a script for a enemy where it can chase after the player and if close enough, close in and attack the player. If I jump over the enemy and if I time it right, the enemy will "closeIn" ...
-1
votes
0
answers
36
views
what is the point of using the @classmethod decorator in functions within classes, as opposed to using no decorator [duplicate]
I'm confused as to what the purpose of @classmethod is.
I see the difference between it and the @staticmethod, in that @staticmethod cannot access class attributes, or self attributes.
However I do ...
-5
votes
0
answers
44
views
'.' specifier in .contains() in java not found [duplicate]
I'm getting this error for a code
MainStocks.java:66: error: cannot find symbol
boolean tf = stockName.contains(stName);
^
symbol: method ...
0
votes
1
answer
43
views
Variable and Memory Allocation?
Do both of these programs consume the same memory and time?
def conv(txt):
a=int(txt) #Does the variable "a" consumes extra memory?
return a
print(conv("4"))
def conv(...
-1
votes
0
answers
27
views
I keep getting a weird attribute error despite following a pygame tutorial I need help trying to fix this error [duplicate]
def handle_vertical_collision(player, objects, dy):
collided_objects = []
for obj in objects:
if pygame.sprite.collide_mask(player, obj):
if dy > 0:
...
1
vote
0
answers
29
views
How do I fix TypeError: player.update is not a function error?
Image of Error
I'm trying to use a player method from my player.js file which is defined as follows:
// src/player.js
class Player {
constructor(name, x, y, radius, color) {
this.name = ...
2
votes
1
answer
41
views
405 method not allowed error for POST request by flask app
I have a simple web app to message (using Twilio API) selected respondents with the following code:
app.py
client = Client(account_sid, auth_token)
@app.route('/')
def index():
return ...
1
vote
1
answer
33
views
How to get method's *ssa.Function
hello i am new to static analysis and try to use golang's SSA package to analyze function code. i want to get a function's or a method's *ssa.Function in the package, get a function's *ssa.Function ...
0
votes
0
answers
15
views
Is there any way to implement the haar wavelet method on 1d unsteady state heat equation having constant initial and boundary conditions? Give example
Is there any way to implement the haar wavelet method on 1d unsteady state heat equation having constant initial and boundary conditions? Give example.
when i am implementing haar wavelet method on ...
0
votes
1
answer
51
views
A Method which runs every second? in Android Studio
Is there a way to create a method in java which will run every second?
I want to check if my ToggleButton is checked every second and if checked then vibrate the device.
In the below code, tb is ...
1
vote
2
answers
102
views
Restricting Method Accessibility in Swift Protocols and Structs (Learning Purposes)
I have this code, and I am trying to make some methods unavailable under certain conditions. In Swift, I have seen methods appear grayed out with a red exclamation mark, indicating that they cannot be ...
-1
votes
1
answer
43
views
Passing a variable from a class in one file to a class in another file
I am trying to pass variables from a class in one variable to a class in another. The variable I am trying to access is in the class called LoginOrReg in a file called LoginOrReg. I am trying to use ...
0
votes
1
answer
34
views
Reuse overloaded method in python class with most parameters
I have LCD class which is run by micropython on raspberry pi pico which i initialise like this:
class Lcd:
def __init__(self, width, height, channel, sdaPin, sclPin, contrast):
from time ...
0
votes
1
answer
23
views
Python - Better way to run external methods with similar, but different, names?
Currently in my project, I have some code like this in a method, where param1 and param2 are guaranteed to be the same for every function call:
def run_funct(self):
if self.my_type == "a&...
0
votes
1
answer
37
views
The GET method is not supported for route registrar-articulo. Supported methods: POST - axios post
I am working on a project with laravel 9.
I have a problem with a request in axios, I get the following error:
405 Method Not Allowed
I have already applied the following commands in my project:
php ...
0
votes
0
answers
28
views
How to modify a "Name+2nd name+Surname without touch 2nd name? Phyton
I want to change 2 characters in a variable in phyton but when I fix one the other change again.
I have this variable.
name= " rIana Danyela RodrYguez "
I don't want to touch the name &...
0
votes
0
answers
122
views
How to open "send this server message to my contacts" menu in telegram mini app
Good afternoon, i now working on telegram mini app project, and cant find way to open send message menu in that telegram app. User press button, then he see his contats, choose one and send to that ...
-5
votes
1
answer
45
views
Calculating the volume of a square
package Pyramid;
import java.util.Scanner;
public class SquareVolume {
public static void main(String[] args) {
double length = 0;
double width = 0;
double height = 0;
...
0
votes
0
answers
45
views
How do I use import for built-in modules for node.js
I am making a webapp to send emails using node.js. In accordance to the ECMAScript 2015 standards, I have not been using require(), but import/export.
import url from "url";
import path from ...
1
vote
1
answer
51
views
Inherit override-equivalent as different methods
Several methods from interface, super class or new method are override equivalent. I need to make different realization for each. Example:
public interface A {
int f();
}
public interface B {
...
-1
votes
1
answer
82
views
Write a method that takes 3 integer as parameters, return true if they are equal, return false otherwise without using if statement [closed]
I am trying to write a method that compares three integers without using the if statement. I tried the switch statement, but it wouldn't work. Eclipse shows case expressions must be constants.
Here is ...
1
vote
2
answers
44
views
C# reflection: Get static method with multiple generic overloads [duplicate]
How we can get a method such as Tuple.Create that has multiple generic overloads through reflection and use it with our custom generic type arguments?
usecase: the generic type arguments are known ...
1
vote
1
answer
48
views
Unable to update the currentIndex to the one where the selected modal is opened
I have a class where I can open the gallery. The problem is that this line of code doesn't reflect to the currentIndex. As a result, whenever you click a gallery img, it opens the gallery and its ...
0
votes
0
answers
32
views
Calling methods from array of method pointers not executing [duplicate]
This doesn't execute any suggestions:
void (CClient::*pMethod[CNetwork::ClientEvent::E_CE_MAX_EVENTS])();
pMethod[CNetwork::ClientEvent::E_CE_ACCEPTED] = &CClient::Accepted;
pMethod[CNetwork::...
0
votes
0
answers
12
views
After being appointed as the owner of the group, messages stopped leaving
Good afternoon. Until recently, the script worked well:
from telethon.sync import TelegramClient
api_id = '***'
api_hash = '***'
session_name = 'my_session'
client = TelegramClient(session_name, ...
3
votes
0
answers
70
views
TypeError: Privileges.show_privileges() missing 1 required positional argument: 'self' [closed]
I'm a beginner in python and I'm using python crash course 2019 as my reference. I'm having difficulty figuring out what is wrong with my code gaining the type error as said in the title. here is my ...