111,284 questions
3
votes
2
answers
93
views
Remove WordPress Shortcode From Excerpt
My current WordPress theme has a list post style that uses the excerpts function to show 35 words
<?php echo wp_trim_words( get_the_content(), 35, '...' ); ?>
In one of my posts, has a shordcode ...
Best practices
0
votes
6
replies
179
views
How does the C compiler detect which function to start first?
How does the C compiler(GCC) detect which function to start first?
Example :
#include <stdio.h>
#define MSG_1 "Hello, World!"
#define MSG_2 "Gougagougagouga!"
void ...
-2
votes
0
answers
80
views
Call By Ref in Free Pascal
I expected that the simple freepascal code
program callByRef;
var z: integer;
function alpha(var z: integer): integer;
begin
z:= 7;
alpha:= 5;
end;
begin
z:= 0;
z:= z + alpha(z);
...
Best practices
1
vote
1
replies
78
views
Type Unstable Functions in Julia
I am writing some numerical simulations in Julia.
I have some functions which compute many parameters iteratively. When I am debugging, I like to have a debugging option, where a function additionally ...
1
vote
1
answer
95
views
Functions in scripts not recognized
I can't seem to define functions inside a script (I usually put them at the bottom).
Content of Nothing.m:
My_F();
function x = My_F()
x= 43;
endfunction
Output:
error: 'My_F' undefined near line 1,...
0
votes
1
answer
222
views
Can a function be executed within the variable scope of another function?
Is it possible in JavaScript to pass a function to a function and execute it within the variable scope of the receiving function? Something like Tool Command Language's uplevel?
In this example, can ...
Advice
1
vote
9
replies
229
views
Cumulative return value in C?
Currently following CS50 and learning recursion in C.
This program returns the number of steps taken to get from n to 1, using the Collatz conjecture. I understand most of what's going on here, except ...
4
votes
2
answers
108
views
What is the significance of making a nested function global in Lua?
This is the Lua version of Knuth's "Man/Boy Test". I found that, to reproduce the result shown in the Wikipedia article, I had to declare the nested function "B" "local"....
Advice
0
votes
2
replies
165
views
Designing a Python API: list of coordinate tuples vs separate parameters?
I created a Python toolkit called `cartons` that wraps RoutingPy and OSRM.
Currently, my API looks like this:
cartons.route(lon1, lat1, lon2, lat2)
For version 1.2.0, I want to support multiple ...
2
votes
3
answers
138
views
Bash function to output variable's name and value
Instead of writing:
echo "variable: $variable"
when debugging, I would like to do it all with a function, say:
print "$variable"
So far I have got this working:
t=https://www....
Best practices
0
votes
2
replies
93
views
how to calculate result of calculator in dart , button equal?
I am trying to build function for calculator
this is my code :
ExpressionParser p = GrammarParser();
Expression exp = p.parse(input);
var evaluator = ...
1
vote
1
answer
131
views
In VB.Net, why √(x) is refused as function's name but not π(x)?
The following code is refused with error BC30037: invalid character for the √ character:
Public Function √(x As BigDecimal) As BigDecimal
return BigDecimal.SquareRoot(x, BigDecimal.Precision)
End ...
Best practices
0
votes
4
replies
107
views
What are the should-have implementations/functions for a new struct for a new library in rust?
I've got Display and FromStr, but what else?
I'm working on releasing my first general-use library in rust that creates a struct and implementation for general use to assist with integrating with some ...
2
votes
2
answers
48
views
Skip computation of output leaves of `jax` pytree function when input leaves are set to `None`
I have a function fun that takes as argument a jax pytree and returns a jax pytree with the same structure. Sometimes, I don't want to calculate the function for a specific leaf of the pytree. In that ...
0
votes
1
answer
100
views
PostgreSQL function returns date format differently from table
In PostgreSQL (using DBeaver as a client), when I return the same query from a function as from a table for a timestamptz field, the time element appears differently (and is then handled by downstream ...