Skip to main content
Filter by
Sorted by
Tagged with
-7 votes
4 answers
117 views

I am trying to make a temperature converter that automatically changes value when the user changes the input and clicks elsewhere (using the onChange in my html file) in javascript, but when i type in ...
Agwaraonye vivian's user avatar
2 votes
1 answer
72 views

Summary: I want to be able to recreate my SQL code via Python such that I dont have to manually type out each join for situations when the combinations get too large to handle I have one table import ...
qwerty12's user avatar
Advice
0 votes
3 replies
41 views

I have a trigger in Postgresql 13 like this to prevent duplicate entry on one of the coloumn : This trigger is used in Arcgis Field Map apps. CREATE OR REPLACE FUNCTION xxx_check_unique() ...
padjee's user avatar
  • 265
7609 votes
86 answers
1.6m views

How would you explain JavaScript closures to someone with a knowledge of the concepts they consist of (for example functions, variables and the like), but does not understand closures themselves? I ...
0 votes
1 answer
116 views

I'm writing a simple maths sketch. At this point I want to check if 2 random numbers, when divided, leave a remainder. If not then pass them onto the next part of the program. If the remainder is not ...
joe lennox's user avatar
7671 votes
42 answers
1.2m views

I've recently started maintaining someone else's JavaScript code. I'm fixing bugs, adding features and also trying to tidy up the code and make it more consistent. The previous developer used two ways ...
Richard Garside's user avatar
Advice
2 votes
7 replies
126 views

I know that it's possible to take the address of an inline function, just like with ordinary functions. But if each translation unit has its own inline definition, and I take the address of the ...
Morel's user avatar
  • 1
0 votes
1 answer
64 views

I am looking to remove <script data-no-optimize="1">var litespeed_docref=sessionStorage.getItem("litespeed_docref");litespeed_docref&&(Object.defineProperty(document,&...
user31225's user avatar
Advice
0 votes
2 replies
52 views

How do I make these all apply to one function, so that one plays, but stops the one before it? Code def rex_audio(self): RexAud = SoundLoader.load('Rex.wav') RexAud.play() ...
Michael James's user avatar
1 vote
0 answers
60 views

I am working with a custom logistic function: logistic.fcn <- function (x, y0, y100B, dy100.F, a, x0B, dx0.F, isF_num) { y0 + ((y100B + isF_num*dy100.F)-y0)/(1 + exp (-a * (x - (x0B + isF_num*...
olowman's user avatar
  • 11
3505 votes
25 answers
836k views

What is the difference between using Function.prototype.apply() and Function.prototype.call() to invoke a function? const func = function() { alert("Hello world!"); }; func.apply() vs. ...
John Duff's user avatar
  • 38.6k
2690 votes
30 answers
1.5m views

I would like a JavaScript function to have optional arguments which I set a default on, which get used if the value isn't defined (and ignored if the value is passed). In Ruby you can do it like this: ...
Tilendor's user avatar
  • 49k
2475 votes
31 answers
2.7m views

Which method of checking if a variable has been initialized is better/correct? (Assuming the variable could hold anything (string, int, object, function, etc.)) if (elem) { // or !elem or if (typeof ...
samliew's user avatar
  • 79.5k
0 votes
3 answers
219 views

I have just encountered a case in this C program: void row_del(int**& a, int& row, int col, int k) { for (int j = 0; j < col; j++) { for (int i = k; i < row - 1; i++) { ...
hacklo's user avatar
  • 17
3199 votes
22 answers
690k views

How do I make two decorators in Python that would do the following? @make_bold @make_italic def say(): return "Hello" Calling say() should return: "<b><i>Hello</i>&...
Imran's user avatar
  • 91.7k
0 votes
0 answers
43 views

After trying Lavi Kumar's example it seems the package import pdbext.debug in ~/.pdbrc goes out of scope when another source file is called. ~/.pdbrc: !import pdbext.debug alias pl !pdbext.debug....
CharlieB's user avatar
Advice
0 votes
4 replies
76 views

I want to calculate resistance and resilience of the soil microbial community in my experiment. I have an experimental design with 4 treatments: ambient (control), drought, warmed, and warmed & ...
Moriah's user avatar
  • 27
0 votes
1 answer
139 views

I want to setup an environment in a Jupyter notebook where parameters are stored in a dictionary parValue and where you can change values of one or several parameters with a function par(), while ...
janpeter's user avatar
  • 1,166
0 votes
1 answer
65 views

In Google Sheets, I have a database on which I want to apply a filter depending on 10 criteria from 10 columns, using values from 10 specific cells. I can do this, but I would like that the filter ...
Fabien GALOPIN's user avatar
1 vote
0 answers
81 views

unknown is so annoying to work with when using strict Typescript. I understand not being allowed to assign a type unknown to a known type, but you are able to assign known types to unknown. So why ...
Dao Seeker's user avatar
0 votes
3 answers
149 views

I am currently learning the new array functions in Excel. I've been learning them for a bit, but still learning. I am trying to create a dynamic YTD type report off some dummy data however I can't ...
Nathan_Sav's user avatar
  • 8,576
3 votes
2 answers
64 views

Description I'm having an issue with a collapsible requiring 2 clicks of a button to open, then another 2 clicks to close. The Show/Hide text inside the button gets mixed up as well. I think it might ...
strawberrymilkrats's user avatar
2220 votes
27 answers
579k views

What is the scope of variables in javascript? Do they have the same scope inside as opposed to outside a function? Or does it even matter? Also, where are the variables stored if they are defined ...
lYriCAlsSH's user avatar
  • 58.2k
2 votes
1 answer
211 views

I'm trying to print elements of matrix (example will be below). Here is the following code written in Dev-C++: #include <iostream> using namespace std; class Matrix { private: int **...
Michael's user avatar
  • 11
1023 votes
24 answers
608k views

I already know that apply and call are similar functions which set this (context of a function). The difference is with the way we send the arguments (manual vs array) Question: But when should I use ...
Royi Namir's user avatar
  • 149k
0 votes
1 answer
67 views

Motivation : I would like to have the app.R file as svelt as possible so I use function to do the larger part of computations that doesn't need to be made in a reactive environnement. Still, I need ...
osc07's user avatar
  • 1
3 votes
2 answers
89 views

The PostgreSQL documentation for argtype in function and procedure definitions states: The type of a column is referenced by writing table_name.column_name%TYPE. This works fine for IN mode ...
qrpnxz's user avatar
  • 45
574 votes
31 answers
557k views

<?php $name = $_POST['name']; $email = $_POST['email']; $message = $_POST['message']; $from = 'From: yoursite.com'; $to = '[email protected]'; $subject = 'Customer ...
user3818620's user avatar
  • 5,783
-1 votes
1 answer
77 views

i'm trying to automate a few basic tasks for a helpdesk team and I cannot seem to understand why I cannot get the desired result from this code: I did try to explicityl define $Tile as a [string] but ...
user3023421's user avatar
793 votes
28 answers
538k views

Is there a way to determine a function's name from within the function? def foo(): print("my name is", __myname__) # <== how do I calculate this at runtime? In the example above, ...
Rob's user avatar
  • 8,160
769 votes
24 answers
623k views

I have a problem with the transfer of the variable insurance_mode by the decorator. I would do it by the following decorator statement: @execute_complete_reservation(True) def test_booking_gta_object(...
falek.marcin's user avatar
  • 10.9k
2 votes
2 answers
180 views

How to check whether a name is a locally accessible function and only locally accessible? For example, with function out = top_level_function(name) % ??? function helper2 end end function ...
Argyll's user avatar
  • 10.1k
878 votes
16 answers
1.1m views

How do I pass a function as a parameter without the function executing in the "parent" function or using eval()? (Since I've read that it's insecure.) I have this: addContact(entityId, ...
imperium2335's user avatar
  • 24.2k
681 votes
30 answers
793k views

The function foo below returns a string 'foo'. How can I get the value 'foo' which is returned from the thread's target? from threading import Thread def foo(bar): print('hello {}'.format(bar)) ...
wim's user avatar
  • 368k
1576 votes
8 answers
2.0m views

I am trying to search how to pass parameters in a Bash function, but what comes up is always how to pass parameter from the command line. I would like to pass parameters within my script. I tried: ...
stivlo's user avatar
  • 85.9k
844 votes
19 answers
2.1m views

file.py contains a function named function. How do I import it? from file.py import function(a,b) The above gives an error: ImportError: No module named 'file.py'; file is not a package
user2977230's user avatar
  • 9,667
2 votes
1 answer
98 views

I followed the Panda3D tutorial and got everything working so tried adding my own custom arguments using argparse. The first one I made was --no-rotate where it would stop the camera rotating which ...
Sam's user avatar
  • 23
490 votes
48 answers
403k views

What is the simplest/cleanest way to implement the singleton pattern in JavaScript?
Jakub Arnold's user avatar
  • 87.5k
2 votes
4 answers
205 views

There is a declaration of a function in C language. int foo(int, int) { // код функции. } How do I access a parameter inside a function, only the parameter type is specified (no name). A program ...
Volkov Sergey's user avatar
986 votes
26 answers
597k views

I'm trying to figure out Python lambdas. Is lambda one of those "interesting" language items that in real life should be forgotten? I'm sure there are some edge cases where it might be ...
meade's user avatar
  • 23.4k
2 votes
3 answers
130 views

I am trying to save some date to a PSCustomObject in one function and pass that object to another function so I can access the objects properties and values. I am doing something incorrect as I can ...
RookieMistake's user avatar
843 votes
23 answers
593k views

What is the use of bind() in JavaScript?
Sandy's user avatar
  • 14.2k
769 votes
16 answers
1.2m views

Suppose I have a function and a dataframe defined as below: def get_sublist(sta, end): return mylist[sta:end+1] df = pd.DataFrame({'ID':['1','2','3'], 'col_1': [0,2,3], 'col_2':[1,4,5]}) mylist = ...
bigbug's user avatar
  • 59.9k
1 vote
1 answer
166 views

I have two configuration classes with functional beans: @Configuration public class PositionReporter { @Bean public Supplier<Aircraft> reportPositions() { return () -> new ...
tibotka's user avatar
  • 214
1470 votes
8 answers
244k views

I found this code: !function () {}(); What is the purpose of the exclamation mark here?
Sebastian Otto's user avatar
1003 votes
18 answers
195k views

Could someone explain? I understand the basic concepts behind them but I often see them used interchangeably and I get confused. And now that we're here, how do they differ from a regular function?
sker's user avatar
  • 18.5k
644 votes
14 answers
905k views

I am working with a bash script and I want to execute a function to print a return value: function fun1(){ return 34 } function fun2(){ local res=$(fun1) echo $res } When I execute fun2, it ...
mindia's user avatar
  • 7,949
-2 votes
2 answers
81 views

I'm trying to understand how functions work, I defined my function with length and area parameters. Here is the problem: I want to write if area is less than a # then print a string of text. def ...
mt.297's user avatar
  • 9
2 votes
1 answer
129 views

I have this code in which I'm trying to use scipy.optimize.curve_fit() to take a cos^2(x) function and approximate it as a sum of gaussian peaks. However, it is generating a very poor fit and I can't ...
Cody Payne's user avatar
-2 votes
1 answer
84 views

I'm making a quiz-type thing with Google Sheets- one as the user-end (where the quiztaker would input answers) and one as the answersheet. What I want to do is have a function in conditional ...
bunnie's user avatar
  • 3

1
2 3 4 5
2229