function Questions

7

Solved

How do I find out the filename of the script that called my function? For example, function sthing() { echo __FILE__; // echoes myself echo __CALLER_FILE__; // echoes the file that called me }
Askew asked 20/12, 2009 at 13:46

7

Solved

Here is the full context of the situation: I recently got a new Mac, I'm a php developer so I downloaded MAMP and started developing. First I noticed that my includes were not being included, but...
Sneak asked 23/4, 2011 at 3:47

7

Solved

I have this in my .bashrc: LIGHTGREEN="\[\033[1;32m\]" LIGHTRED="\[\033[1;31m\]" WHITE="\[\033[0;37m\]" RESET="\[\033[0;00m\]" function error_test { if [[ $? = "0" ]]; then echo -e "$LIGHTGREEN...
Langland asked 6/7, 2011 at 5:48

3

Solved

I've long used the find command for finding files and directories in the current directory and all subdirectories that match a pattern: find . -name "*.txt" -print find . -name "Bill*" -print Bu...
Occiput asked 14/10, 2013 at 2:50

4

Solved

Take this simple dataset and function (representative of more complex problems): x <- data.frame(a = 1:3, b = 2:4) mult <- function(a,b,n) (a + b) * n Using base R's Map I could do this to...
Breadthways asked 23/8, 2018 at 4:0

3

Solved

Is there possible in bash to call some command when function exits. I mean something like: function foo { # something like this maybe? trap "echo \"exit function foo\"" EXIT # do something } ...
Eimile asked 24/8, 2017 at 12:46

5

I was previously able to deploy an Azure function written in Python using the command func azure functionapp publish <FunctionAppName> from my project directory, building it remotely. It work...
Deoxidize asked 19/2, 2020 at 8:34

6

Solved

The little knowledge I have about first-class functions is that it supports passing functions as arguments and we can also return them as the values in another function ... I am very new in Swift p...
V asked 7/10, 2014 at 12:40

4

Solved

For example, when I have: def function(text): print(text) mylist = [function('yes'),function('no')] mylist[0] It just prints yes and no and doesn't do anything with mylist[0]. I want it to b...
Audwin asked 6/12, 2019 at 23:14

5

Solved

def funcA(i): if i%3==0: print "Oh! No!", print i break for i in range(100): funcA(i) print "Pass", print i I know script above won't work. So, how can I write if I need put a function wi...
Embroidery asked 21/12, 2012 at 8:48

8

I was asked a very interesting question during a C interview: How can you implement a function f() in such a way that it can only be called from a particular g() function. If a function other than ...
Handiwork asked 9/9, 2009 at 20:3

5

Solved

Do anyone know how I can remove the number of current available stock that is shown on my Woocommerce product page next the the title of the product? I guess this has changed since the recent Wooco...
Bremble asked 7/7, 2016 at 10:36

4

Solved

I'm wondered if it's possible in google sheet to convert Gregorian calendar to jalali using a function. In fact, I have some date such as : February 20, 2021 4:30 AM I need to display this date in...
Straightforward asked 22/2, 2021 at 12:41

3

Solved

How can I declare a variable in a table valued function?

3

Is there a way in js to list all the builtin functions and some info on their parameterlists? I couldn't really find anything about reflection to do this sort of thing edit: The functions such as ...
Barton asked 1/1, 2012 at 15:54

19

I have an array of numbers that I am trying to reverse. I believe the function in my code is correct, but I cannot get the proper output. The output reads: 10 9 8 7 6. Why can't I get the other ha...
Butene asked 31/10, 2013 at 17:21

5

I would like to call C functions (e.g. form the stdlib, math ...) dynamically. This means that my C program only knows the pointer to a random function (e.g. printf) and its signature (coded as a c...
Rivulet asked 12/3, 2013 at 22:24

6

Solved

I have been trying to create a decorator that can be used with both functions and methods in python. This on it's own is not that hard, but when creating a decorator that takes arguments, it seems ...
Mano asked 17/8, 2009 at 15:8

9

Solved

I know this is really simple but it just isn't coming to me for some reason and google isn't helping me today. I want to output the pages content, how do I do that? I thought it was this: <?p...
Martines asked 28/3, 2011 at 22:24

1

Solved

#include <iostream> #include <thread> template<int Num> class MyClass { public: MyClass(int val) : val_(val) {} // Copy constructor MyClass(const MyClass& other) : val_(o...
Hittel asked 26/4, 2024 at 6:54

6

Solved

I'm passing to Django's template a function, which returns some records. I want to call this function and iterate over its result. {% for item in my_func(10) %} That doesn't work. I've tried...
Jeanelle asked 18/3, 2010 at 9:53

13

Solved

How can I jump to a function definition using Vim? For example with Visual Assist, I can type Alt+g under a function and it opens a context menu listing the files with definitions. How can I do som...
Reconstruction asked 11/3, 2009 at 18:27

2

Solved

I get undefined variable/argument when trying to define my own random generator function. Code: function result = myrand(n, t, p, d) a = 200 * t + p big_rand = a * n result = big_rand / 10**d ...
Difficult asked 7/10, 2016 at 10:27

13

Solved

You can apply a function to every item in a vector by saying, for example, v + 1, or you can use the function arrayfun. How can I do it for every row/column of a matrix without using a for loop?
Volscian asked 21/2, 2010 at 19:58

4

Solved

I am trying to create a simple PostgreSQL function, where by using INT parameter I like to get array back. The example below will not work, but shall give idea of what I try to get back from a func...
Gavrielle asked 12/2, 2016 at 23:42

© 2022 - 2025 — McMap. All rights reserved.