30,333 questions
0
votes
0
answers
28
views
Entity Framework unable to translate IComparable cast of DateTime in OrderBy
In an effort to simplify some of my code, I tried using a switch expression to create a selector for sorting on an EF Core 10 query:
Expression<Func<Foo, IComparable>> selector = sortField ...
5
votes
1
answer
129
views
MSVC accepts lambda with deleted parameterized ctor while GCC and Clang rejects
I wrote the following program that is accepted by MSVC, but is rejected by both GCC and CLANG. What is the standard compliant behavior?
Live Demo
struct C
{
C(int) = delete;
C(){};
};
decltype([b ...
5
votes
1
answer
144
views
Lambda with deducing this parameter of unrelated type [duplicate]
A colleague of mine showed me a program with explicit object parameter in a lambda function. The program is accepted by two compilers, but produces a strange result:
struct A {
int a = 2;
...
1
vote
1
answer
125
views
Is there a difference between 'eval' and sourcing a temporary file?
These two examples accomplish the same thing:
# using eval
var=hello
eval "some_func() { echo $var; }"
some_func # "hello"
# using source
var=hello
source <(echo "...
3
votes
1
answer
94
views
Accessing a lambda's parameter leads to "Assignment type mismatch: actual type is 'Unit', but 'String' was expected"
I'm trying to pass a click handler to a child function that sends a string back to the parent and updates a mutable value based on the string. I'm getting an error on the function:
Assignment type ...
0
votes
1
answer
72
views
Array FILTER/TRANSFORM lambda using index
Snowflake supports higher order functions like FILTER or TRANSFORM.
A lambda expression that defines the filter condition on each array element.
The lambda expression must have only one argument ...
4
votes
3
answers
348
views
Passing a local reference to a closure
Consider the code below:
for (T &t : some_vector_) {
futures.push_back(thread_pool.submit([&t] { t.do_something(); }));
}
On some iteration i, t is initialized to a reference to a vector ...
Advice
0
votes
2
replies
85
views
Method-body equivalent of lambda expression
Following is a part of the execution sequence when a middleware gets configured in ASP.NET Core -
// my code
app.Use(some middleware);
// class UseExtensions / namespace Microsoft.AspNetCore.Builder
...
2
votes
3
answers
144
views
How to modify mulitple columns applying if else to multiple pandas dataframe columns
I have a dataFrame with columns Age, Salary and others, if I used:
df['Age'] = df['Age'].apply(lambda x : x+100 if x>30 else 0)
Then I can modify the Age column with the if else condition. Also, if ...
0
votes
0
answers
89
views
Datadog APM traces not appearing for AWS Lambda with Node.js despite metrics working
Problem
I'm trying to set up Datadog APM tracing for my AWS Lambda functions (Node.js/TypeScript), but traces are not appearing in the Datadog APM UI. Custom metrics are being collected successfully, ...
1
vote
3
answers
152
views
Pass QString in Lambda Function
I want to pass a QString into a lambda slot-function to modify it further. Unfortunately the QString goes out of scope before reaching the slot, so I cannot append text. How can I ensure that the ...
1
vote
1
answer
151
views
Why can't I return type byte in lambda expression in Arrays.setAll
I'm trying to implement a lambda function (for educational purposes) to initiate an array to append to the front of potentially encrypted data to save information like salt and initiation vector, ...
-1
votes
1
answer
54
views
Why are all versions of Lambda@Edge function being modified when I deploy the latest code?
I have a Lambda@Edge function which has 2 versions. Version 1 has non-functional code and version 2 has the latest operational code. What that function does is it fetches an object from an S3 bucket ...
0
votes
1
answer
59
views
Localstack returning error when trying to provision a dotnet8 lambda
I'm trying to provision a lambda on a free localstack instance. As such, I cannot build the lambda as an image and push it into localstack's ECR because ECR is a paid resource. So I'm taking the ...
1
vote
1
answer
58
views
Unexpected behavior when replacing arrow-kt partiallyN function with kotlin lambda
I'm working on updating some Kotlin code that depends on arrow-kt. As part of the migration process from arrow 1.2 to 2.x, I need to get rid of arrow partiallyN() functions and replace them with ...