Questions tagged [function]

33851 questions
1

votes
1

answer
249

Views

Functions with Armadillo optional parameters

I need to build a function with optional arguments. It seems that I should give a default values to the parameters. This approach works very well when the optional parameter type is double or integer for example. I can set the default value to 0 or NULL. But assume that the optional parameter is an...
Ari.stat
1

votes
1

answer
462

Views

ERROR schema does not exist

CREATE OR REPLACE FUNCTION analyzeTables() RETURNS INT AS $$ DECLARE v_rec information_schema.tables%ROWTYPE; BEGIN FOR v_rec IN SELECT * FROM information_schema.tables mytable WHERE mytable.TABLE_SCHEMA = 'public' AND mytable.table_type = 'BASE TABLE' ORDER BY mytable.table_name LOOP ANALYZE v_rec....
Bernard Craddock
1

votes
1

answer
28

Views

Wordpress: I need every blog posts to appear under the Blog Page, AND the latest post to appear in a Category (code not working thus far)

I have been trying to have one specific page display all the posts, while having a Category display only the latest post. Both my Page and Category appear as part of the main menu. This piece of code in the functions.php will display a single post for both my Page and my Category. However, I need th...
user3298911
0

votes
2

answer
39

Views

How can I use this pointer with pointer to member function

I have typedef for a function pointer: typedef bool(WlanApiWrapper::* (connect_func) )(WLAN_AVAILABLE_NETWORK, const char *, const char *); and have a method that returns a pointer to function: const auto connect_method = map_algorithm_to_method(*network) So I want to call that like that: (*this.*co...
Andriy
1

votes
1

answer
52

Views

HOC/Render-Call Back or Library function?

I'm working on a project where a prospect needs to be sent an email about a property they are interested in. There is a top level component that fetches the property information and prospect's contact info from the database and passes to its children. There are two components that share the same pro...
Shane Unger
1

votes
1

answer
32

Views

my button id when call in javascript works but onserverclick event not works that store and update data on sql

this is button coding here id use in javascript and onserverclick to trigger event in C# to add or update data Update this is javascript code to show popup modal when user change password and it shows error in this window with validation var update = document.getElementById('update'); update.onclick...
Optima Payroll
1

votes
0

answer
137

Views

Passing a local variable into an anonymous function in Javascript (D3 filtering)

I'm trying to pass a local variable (a dictionary) into a D3 filter function, but am having little success in doing so. d3appendedElement.on('click', function(d){ var county_list = state_retriever[d.id]; //county_list is a dictionary: //county_list = {'56001': true, '56003': true, '56005': tru...
asuprem
1

votes
1

answer
64

Views

R Programming Newbie! - Median Loop Function Broken

So the function below is using a really big dataframe. Two columns of this DF are the year houses were built and the other is the cost. I want to input the column name, in this case ds$Built as the function argument YearCount
Mitsugi
1

votes
1

answer
260

Views

Report Viewer DLL loading issue in Azure function

I have added following DLL and set local copy true Microsoft.ReportViewer.Common.dll 10.0.0.0 Microsoft.ReportViewer.WebForms.dll 10.0.0.0 Microsoft.ReportViewer.ProcessingObjectModel.dll 10.0.0.0 When I browse application folder throws Azure Kudu, I can see above DLL in the bin folder. I am always...
user1328004
1

votes
0

answer
167

Views

ERROR TypeError: db.list(…).subscribe is not a function

import { Component } from '@angular/core'; import {AngularFireDatabase} from 'angularfire2/database'; import 'rxjs/add/operator/take'; @Component({ selector: 'app-root', templateUrl: './app.component.html', styleUrls: ['./app.component.css'] }) export class AppComponent { firesto: any[]; constructor...
user8547607
1

votes
0

answer
350

Views

Context.Done Azure function Javascript multiple async calls

I have made an Azure function with 3 calls to db. But as they work async only the first item gets added. My code below. So to be exact Context.Done but first, the calls have to be finished before going to the next call hope someone can help me. It seems it has to do with the Azure function context a...
KbWorks
1

votes
4

answer
99

Views

Loop notification to every user

I'm trying to send a notification to every users thats assigned to a project. I can get all user id by doing this $ids = array_column($users, 'id'); $userid = implode(', ', $ids); echo $userid; But when I trying to put it insida my function nothing happened. It just blank. I have also tried to move...
Fredrik J
1

votes
1

answer
250

Views

Using functions as arguments - how to call?

I have the following code, where I call a function from a subroutine, all of them in the same module: module mymodule implicit none contains subroutine mycode real :: y0(3), a = 0.0, b = 1.0 integer :: i, N = 10 real, allocatable :: y(:,:) y0(:) = [1.0, 1.0, 1.0] y = AB2(od, a, b, N, y0) do i = 1,...
Hans
1

votes
2

answer
60

Views

PHP function pass by reference not working out of function scope

Why does this code print 1 and not anything else? The function passes by reference, but the reference seems not to work out of the function scope. Why?
thay
1

votes
1

answer
65

Views

Matlab: Error using gammaln… while plotting psychometric functions

I'm using the toolbox psignifit to plot psychometric functions from a dataset. My code looks essentially like the following: load data.mat options = struct; options.sigmoidname = 'logistic'; result = psignifit(data,options); % this is where the error occurs result.Fit result.conf_Intervals plotPsy...
greenapplegobbler
1

votes
1

answer
205

Views

call after function several times tkinter

I have a question about the after function and also about how it works in the mainloop. I have made the code below which works and I noticed that I could call the after function several times. This makes the ball move quicker each time it's called. I'd like to reproduce that without pressing the but...
eric paris
1

votes
0

answer
362

Views

Siamese networks Accuracy?

I'm using the contrastive loss layer from this paper: I've set the margin to a certain value. But I am not quite sure how I would calculate the accuracy for a classification task. As far as I know, I would calculate the euclidean distance from the features and check for a certain threshold. Would th...
Luke
1

votes
1

answer
55

Views

Swift iOS : Serial Function Execution

I wish to create a function that runs 3 internal functions 1 after the 1 and repeat that process 3 times. The problem I am finding is that all 3 functions execute simultaneously. Currently when I test the app it turns green and that is it. Where I would like it to turn red for 30 seconds, then gree...
Darryl Mitchell
1

votes
1

answer
29

Views

How to implement elements comparsion in tensor by Tensorflow?

In my custom loss function, I want to implement this specific computation: Input: tensor A: placeholder([None, 1]) tensor B: placeholder([None, 1]) And A, B has the same shape. Output: tensor res: placeholder([None, 1]). For example: tensor A: [0, 0, 1, 2, 2, 2, 3,...] tensor B: [4, 9, 2, 3, 5...
yuukilp
1

votes
2

answer
422

Views

Calling component in input placeholder

I'm currently trying to call a React component in the position of a text placeholder, but It returns [Object object]. Below is the input render(){ const myText = this.movingText(); } then this is the function I'm calling with the component typist tag. movingText() { return ( Hello this is the text...
LoseYou21
1

votes
2

answer
25

Views

how to bring the list I created in class as a parameter in new function

I'd like to say my English is second language and sorry for any inconvenience to read or understand my post. I will explain what kind of code I produced first, So I created my class function using the code below class Histogram: def __init__(self, range , max_mark): self.__range = range self.__max_...
G.Lee159
1

votes
0

answer
41

Views

How can I hide a functions signature(arguments) ) in doxygen?

I need to hide all functions signatures in doxygen. any idea how i can do this ? Thanks.
Avi Nehori
1

votes
2

answer
164

Views

MATLAB - lsim() function not giving proper attenuation for my RC transfer function

I am trying to model a RC filter's transfer function in order to know how an input signal is deformed when it reaches my sample. I first build the RC filter's transfer function to fit my experimental data but when I give an input signal to the lsim() function, it doesn't give me proper results, eve...
Exeko
1

votes
0

answer
93

Views

What happens if I overwrite __qualname__ of a function

For debugging purposes I wanted some lambda functions to be named, i.e. see a __repr__ string. Possible to change a function's repr in python? provides some good answers to how this can be properly done, but I do wonder about the following, 'quick and dirty' version (which I won't keep in productio...
Elias Mi
1

votes
2

answer
57

Views

Java Generics: using parameterized interface in method calls

I want to store a function to be applied to any instance of a class. As I want to do this for different classes, I am using an interface in my storing and applying code. But I have some problems with my type variables: I've got an interface public interface SomeInterface And an implementing class p...
Agast
1

votes
0

answer
34

Views

How can I best check to see if ANY string in a vector either is or is contained within a specific column of a matrix for EVERY matrix in a list?

I'm writing a little script in R to check if an email address has a valid domain extension. I've read in and vectorized a file of the current valid extensions, e.g. com, uk, biz, etc. Let's say for example: valid_domain_extensions
Joshilyn Hoisington
1

votes
1

answer
242

Views

QPSK function operation/MATLAB

QPSK Modulation its supposed to use 2 bits for each symbol, but wheter I use pskmod or comm.QPSKModulator, I'm still getting the same amount of symbols as bits. Am i doing something wrong? Is something wrong with the function? Thanks in advance. M=4; n=64; m=log2(M); x=round(rand(n*m,1)); mod = comm...
Bryan Carrión
1

votes
0

answer
45

Views

Address different for external function

I want to determine the position of the LoadLibraryA function relative to its container dll(kernel32). This is what I have tried (code used for debugging): int main(){ unsigned char *kernel=(unsigned char *)LoadLibraryA('kernel32'); cout
sergiu reznicencu
1

votes
0

answer
99

Views

An efficient function for generating random numbers in python based on PDF?

I am trying to make a random number generator that I could change the distribution based on its PDF, I know they are different random number generator in libraries available but I want to write a function that is customized, in the following, I tried to make this function for normal distribution. (a...
Nikki
1

votes
0

answer
26

Views

bbPress how to sort users by most created Topics?

I am using Wordpress and bbPress as a Forum. I want to list 5 Users by most created Topics. Is that Possible? I have searched for it but doesnt found such an Plugin anywhere.
Crookie Susoku
1

votes
6

answer
50

Views

Return array of strings and numbers from parsed object

Trying to create a function to remove duplicates from an array of strings, numbers, and booleans by adding array values to an object as the keys and then pushing the keys to a result array. I know I can write it much more quickly and cleanly with a callback and '.filer' / '.indexOf' but I'm trying t...
slimdoja
1

votes
2

answer
57

Views

R Which repetition of loop produces a value larger than the critical value

I have this function gillespieLO = function (N, n, ...) { tt = 0 x = N$M S = t(N$Post - N$Pre) u = nrow(S) v = ncol(S) tcrit = 2 tvec = vector('numeric', n) xmat = matrix(ncol = u, nrow = n + 1) xmat[1, ] = x for (i in 1:n) { h = N$h(x, tt, ...) tt = tt + rexp(1, sum(h)) j = sample(v, 1, prob = h)...
Gragbow
1

votes
0

answer
103

Views

How to create a tensor from a float value?

I'm using keras to build NN. I need to make custom evaluation function (which I did but not completely). Here is part of the code: from keras import backend as K ... def customized_loss(y_true, y_pred): loss = K.square(y_true - y_pred) return K.sum(loss) ... model.compile(loss=customized_loss, opt...
veich
1

votes
2

answer
56

Views

How to bring member function in scope?

So I am calling a function which takes input as limit i, and array of objects h. #include #include using namespace std; class hotel { private: string name,add; char grade; int charge,no; public: void getdata(); void putdata(); void grade_print(int,hotel[]); void room_charge(); void top2(); }; void h...
Arohan Ajit
1

votes
1

answer
37

Views

How to use tensorflow to build a deep neural network with the local loss for each layer?

I'm a novice on tensorflow (TF). Recently, I feel confused when I try to use TF to construct my deep model, in which each layer has its own (local) loss function. It seems like many deep models (e.g., CNN) implemented by TF has only one (global) loss function, so one can first comput the hidden rep...
Zengjie Song
1

votes
0

answer
68

Views

Overload functional parameter for in-place modification or not

I am working on a binary search tree, where the order matters. If a node/ nodes get modified, the tree need update to keep the order right. What I want to do is overload the visiting methods, such as preOrderTraversal; so that it can distinguish whether the function will modify the nodes or not. vo...
user9245717
1

votes
3

answer
321

Views

Create and return variable with included argument name

i have a function that returns averaged timeseries (using package hydroTSM). However, i want not only to output the averages but also to create a variable with specified name ('d2m'+argument name), so i can access those values later. This is what I've come up so far. d2m = function(var) { d2m = dail...
Petr Dušek
1

votes
0

answer
59

Views

Microchip dsPIC33 C30 function pointer size?

The C30 user manual manual states that pointers near and far are 16bits wide. How then does this address the full code memory space which is 24bits wide? I am so confused as I have an assembler function (called from C) returning the program counter (from the stack) where a trap error occurred. I am...
berntd
1

votes
2

answer
41

Views

Summing lists using *args and a specified list index

I previously posted a question on Stack Overflow asking how to combine lists made of integer values, while also summing the values at the respective indexes (Summing lists of different lengths in Python beginning at a specified index using a function). I got a good answer from @pault, but now I am w...
W. Churchill
1

votes
1

answer
63

Views

JavaScript Function Constructor Parse Security

When using the Function constructor in JavaScript, a function object is dynamically created from the given code: const input = 'return 2 + 3;'; // (1) const fun = new Function(input); // (2) const ret = fun(); // (3) Assuming the input string (1) is arbitrary user input, is it insecu...
Steven

View additional questions