Skip to main content
Filter by
Sorted by
Tagged with
-6 votes
1 answer
98 views

I have this method in my program, it is meant to register the gender of the user for later on in the program (with Male and Female as the only valid options): public static void Main(string[] args) { ...
Matto's user avatar
  • 1
-6 votes
1 answer
84 views

In a class that has a bunch of functions, should I be making a separate private method specifically for formatting or should I just be formatting in every function that requires a string to be ...
Fatko's user avatar
  • 1
3 votes
1 answer
66 views

I'm using typescript in a project which uses BackboneJS and in a certain case, a method overload gets lost. I narrowed it down to this case: class Model { set<A extends string>(key: A, value: ...
Sjaak Voz's user avatar
0 votes
1 answer
63 views

I would like that method redefenition would result in failure and script execution stop. Like any other common error. In the following example I want to see that method print cannot be redefined. oo::...
Sterling7135's user avatar
3 votes
1 answer
201 views

In Java we have toArray() method which will return Object[]. If I want to return another data type I need to pass it to parameters like this SomeClass.SomeList.toArray(new AnotherClass[0]); What does ...
JustDreaming's user avatar
0 votes
0 answers
152 views

Suppose I am working on a library with a decent number of classes, most of them having a bunch of methods, in addition to the basic ctors and dtor. For reasons, the method implementations are spread ...
einpoklum's user avatar
  • 137k
1 vote
1 answer
75 views

I have class example: export class Test{ private func: (...args: any[]) => void; constructor(func: (...args: any[]) => void) { this.func = func; } method(...args: any[]) {...
Алексей Смирнов's user avatar
0 votes
1 answer
95 views

I come from PHP where I usually never have global constants. For instance, if I have the class Users and the method add(int $status, string $username) then the status of the user is a constant only ...
Tintenfisch's user avatar
0 votes
3 answers
124 views

I am working on an ASP.NET project that uses Vue.js and jQuery. I have a JavaScript file (fields.js) that defines several classes (e.g., Users, Fields) and initializes a Vue instance. When I use the ...
kev's user avatar
  • 139
0 votes
0 answers
42 views

I'm trying to understand how the reduce() function works in this example: const fruits = ['apple', 'banana', 'apple', 'orange', 'banana', 'apple']; const count = fruits.reduce((tally, fruit) => { ...
heizzz's user avatar
  • 1
-9 votes
1 answer
146 views

I was trying to get the last word of the sentence using the .find() method in a loop. My code: sentence = "please write a program which keeps asking the user for words" index = 0 substring = ...
krish mundra's user avatar
0 votes
2 answers
113 views

I have a few methods that require a certain condition to be applied to function properly. To avoid code repetition I've created a decorator to check if this condition is applied and only then execute ...
good user's user avatar
2 votes
1 answer
69 views

Passing a class, or a totally different object, as the first argument to method is easy: class Foo: def method(self): ... Foo.method(object()) # pass anything to self I wonder, is this possible ...
Daraan's user avatar
  • 5,166
1 vote
1 answer
66 views

I have this Dir type alias that is a set of 8 cardinal directions, used as an enum: type Dir = "N" | "NE" | "E" | "SE" | "S" | "SW" | "...
bigyihsuan's user avatar
0 votes
1 answer
115 views

// StopOrderBase.hpp template <typename TriggerOrderType> struct StopOrderBase { template <typename OrderBook> bool execute(OrderBook& orderbook) const noexcept; }; // ...
Osama Ahmad's user avatar
  • 2,368
0 votes
1 answer
57 views

I want to know how two separate struct methods can modify a field in third struct. What I'm getting now is {[20]} {[30]} Like the two methods on B and C should modify the list field of A and the ...
Adeyinka Azeez's user avatar
1 vote
2 answers
102 views

Here is a basic Java Code which I wrote. I want to know how I can calculate 0! as it can calculate every other number. import java.util.*; public class main { public static int calcFactorial(int n) ...
Sanskar Kumar's user avatar
1 vote
0 answers
79 views

I have created a module with a custom class that generates specific [Node] objects. The module has another class with an method that gets a single specific Node and also a method that gets a ...
iRon's user avatar
  • 24.4k
0 votes
0 answers
27 views

/* * ForecastFragment */ public class ForecastFragment extends Fragment { //------------------------------ //---- DATA MEMBERS ---- //--------------------...
Terence Boakye's user avatar
1 vote
1 answer
116 views

I'm doing homework for a Data Structures class and making a 2-3 tree in NetBeans, but there's a glitch that keeps happening where a method is called twice, but the second time, it's being called by a ...
TheRealNoofle's user avatar
0 votes
3 answers
141 views

I would like to make a constructor with an optional parameter, to avoid giving in Strings all the time, because I need to use the constructor like a thousand times, so I would like to call methods ...
Agnes Nycs's user avatar
-2 votes
2 answers
93 views

I have five classes. My Main class, a form class, two subclasses that extend the form class and a createForm class I am forced to use to create new instances of the subclass. public class FormenFabrik ...
Wannabree's user avatar
0 votes
1 answer
176 views

I have a very deeply nested class structure spanning multiple files and multiple levels of definitions. You can imagine this as a class describing some hardware system where each hardware component is ...
Knyq's user avatar
  • 45
-3 votes
4 answers
122 views

Current Outputs: Is [1, 2, 3] found in [1, 2, 1, 2, 3] ? >>> false Is [1, 1, 3] found in [1, 2, 1, 2, 3] ? >>> false Needed Outputs: Is [1, 2, 3] found in [1, 2, 1, 2, 3]? >>&...
NotInferno_'s user avatar
1 vote
2 answers
57 views

im new to laravel and im getting an error Undefined variable $columnCounts passed to view. i have a index() method that call 2 other method of the same NumberController, columnCount() and rowCount() ...
BIKAPPA2's user avatar
-1 votes
1 answer
80 views

The program technically works, but I keep getting the error: "Cannot invoke "javax.swing.JButton.addActionListener(java.awt.event.ActionListener)" because "this.check" is null&...
Eryk Smaga's user avatar
0 votes
0 answers
51 views

It is need to solve the problem using the Jacobi method: d^T/dx^2 + d^2T/dy^2 = 0 with conditions at the boundaries of the square: T(0, y) = 1, T(x, 1) = 1, dT/dx(1, y) = 1 - y, dT/dy(x, 0) = x. ...
ulyannaaa's user avatar
1 vote
1 answer
108 views

So I have a method with simple lambda functions I use to update my weights and I want to try different functions but I also want to have default parameter for the decay: void ema_update(int i, const ...
AnArrayOfFunctions's user avatar
-4 votes
1 answer
163 views

I have been trying to understand two code blocks. The first code block: string status = "Healthy"; Console.WriteLine($"Start: {status}"); SetHealth(status, false); Console....
bibashmanjusubedi's user avatar
0 votes
0 answers
39 views

My goal is to collect and graph CPU usage for the host. I have a simple Vite project and am using vite-plugin-node-polyfills to try to use the os JS method. However, it just returns an empty object. I ...
Andrew Hollingworth's user avatar
-2 votes
1 answer
78 views

If I have a class hierarchy in Python (we can assume there's no multiple inheritance), how can I find the class in which a method is defined? For example: class C: def f(): pass class D(C): ...
user200783's user avatar
  • 14.5k
-4 votes
1 answer
78 views

I seem to have a problem to sort my list (cities and temperatures) from coldest to warmest. Here is the code for the method. static void bubblesort(List<Stad> städer, int n) { n = städer....
Aron Åkesäter's user avatar
1 vote
2 answers
79 views

Ive been trying to set the values of matrices with the help of methods that take pointers, But I am unable to do this. The setMatrixValue method stops working when the loop reaches the second row. The ...
carbonatedWaterr's user avatar
0 votes
1 answer
117 views

I'm beginner in C# programming, What I want to do is use a method out side of the class but method is unreachable, I cant do it without static keyword and I dont want to use static keyword because I'm ...
user avatar
1 vote
1 answer
108 views

I'm trying to use SwiftUI with onDelete() method to capture the TodoItem.id of the row that was swiped. I've set up an array called arrayOfTodosToDelete which will be the IDs of the deleted rows ie [&...
Clay_F's user avatar
  • 599
0 votes
0 answers
29 views

The MWE below shows that vectorize returns zeros instead of the actual values. Compare the printout from within the function to the arrays returned in the second test. It is curious that the first ...
Tom Kuiper's user avatar
1 vote
1 answer
67 views

So I'm an economics undergrad trying to learn some pandas for data manipulation. # Making YEAR as the index inflation_forecasts.index = pd.DatetimeIndex(inflation_forecasts['YEAR'].astype(int).astype(...
Foodle Jang's user avatar
3 votes
3 answers
218 views

I have multiple classes C1, C2, etc, each has different members variables, ex: C1M1, C1M2, C2N1, C2N2. And I have a pointer to data that could be an object of C1, C2 based on initial bytes. Is there a ...
pasha's user avatar
  • 2,115
2 votes
1 answer
107 views

I'm working on a recursive method clean that extracts the substring inside the outermost parentheses of a string, without the parentheses themselves. The method works as expected, but omits the ...
Kaizen985's user avatar
1 vote
0 answers
27 views

I am trying to make an audio visualizer on Java, and I am attempting to use the .getLevel() function of the Clip clip; thing. Yet it is only returning -1.0, nothing else. Here is my code: import java....
VQ350GeTsome's user avatar
0 votes
2 answers
146 views

I created an age conditional "Hello World!". You type in your name, then I ask your age and if you're under 8, I ask you to leave the computer because you should just go play outside. Here's ...
lynou-cats's user avatar
-4 votes
2 answers
103 views

I've been assigned a temperature conversion assignment that requires values to be printed next to each other, using two static methods and a single System.out.print statement. For reference, I've ...
TheNomad's user avatar
-1 votes
1 answer
188 views

I'm trying to make a plugin HPOS compatible. Below is the new code that I edited and then the old one. This is my code attempt (new replaced code): /** * Save payment info * * @param type $order_id ...
Der Fred's user avatar
1 vote
0 answers
79 views

When I call the android settings menu to enable my input method, I would like the menu to flash to highlight the correct item in the list for my keyboard. I saw this happen when installing another ...
Matt Stoodley's user avatar
0 votes
1 answer
59 views

Having any Python function as: def function1(param1, param2): #... return 0 How would be possible to get a param string name (variable name) used in the function call? ideally getting this ...
codev's user avatar
  • 43
0 votes
1 answer
55 views

That's my code to explain my idea better (I'm a non english speaker): The ".includes()" method doesn't work in this case const sentence = "hello world hello boy"; let words = ...
Edilson Nogueira's user avatar
1 vote
0 answers
49 views

I use Django 5.1.2 In order to clarify what my users need to do when my app serves them a form, I've added a dict to my forms called 'contents'. It contains a bunch of instructions for the template ...
vanderlove's user avatar
0 votes
1 answer
70 views

Is it possible for the same method have different return types based on what is passed in, so that for example GetScripts(new Camera()) returns a Camera and GetScripts(new Cube()) returns a Cube? I ...
Waarnov's user avatar
  • 25
0 votes
1 answer
74 views

So I have this code: Require Import Unicode.Utf8. Require Import String. Inductive AExp := | avar : string → AExp | anum : nat → AExp | aplus : AExp → AExp → AExp | amul : AExp → AExp → AExp. ...
Vlad's user avatar
  • 3
0 votes
0 answers
47 views

I'm currently working on an Angular project to develop a dashboard of sorts. public donutChartData: any = { labels: [], datasets: [ { data: [1, 1, 1], backgroundColor: [ ...
Pablo's user avatar
  • 1

1
2 3 4 5
610