Related
User 979490: If I have a function that returns something, that's the best, the one below is the best way. Does it follow a better format, does it have better performance? private int myfunc()
{
int value=0;
for(int i=0;i<5;i++)
{
if (i==2
User 979490: If I have a function that returns something, that's the best, the one below is the best way. Does it follow a better format, does it have better performance? private int myfunc()
{
int value=0;
for(int i=0;i<5;i++)
{
if (i==2
Joseph Katzman Am I looking for the best way to return the computation time of a method? For example, I have a multiplty method and the result of the expansion is an integer value, but what if my user wants to get both (result and time) or just the int result?
sk I set up a function in a shell script that checks if the folder exists, if it doesn't, try to create it and if the folder can't be created (for example if the user doesn't have the correct permissions) return 1 Then, I check this "return value", but I don't
Lezak Suppose I have this method that calls an API and returns some results: public async Task<List<ClientModel>> GetClients()
{
var result = new List<ClientModel>();
try
{
results = await myHttpCLient.GetFromJsonAs
sk I set up a function in a shell script that checks if the folder exists, if it doesn't, try to create it and if the folder can't be created (for example if the user doesn't have the correct permissions) return 1 Then, I check this "return value", but I don't
asl.har: I don't know which would be the best return type for my controller if I return an empty ResponseEntity. For example, if I want to return a 204 - don't use content ResponseEntity.noContent().build()should my fonction be returned ResponseEntity<?>, Resp
Secretary: I have a function that needs to do something with a string. I need the function to return a boolean indicating whether the operation was successful or not, and also need to return the modified string. In C#, I would use out parameters for strings, b
developed: When I return Integer or other wrapper from Spring Controller like this: @GetMapping(path = "test1")
public Integer test1() {
return 1;
}
The response to the user has the following body: 1
This is not valid JSON. Is there any practice how thes
help I have one that List<MyModel>I return from the controller toview Should I create a new class to hold it Listand return an object of the new class or I can return it Listitself.. Which is better programming practice? Abimanuel Guy It depends on what your e
the rest I have a WCF method that searches the database for a record and returns Some(object) if the record exists and None if it doesn't. As I can see, I cannot call the method returned Type optionvia WCF (I get the exception). What's the best way to design a
Graham: This is a small problem because I can easily take a pair of classes to do the job. I don't really want to do this, I feel like there should be some simple, built-in, Java-like way to return two values. What is the best and easiest way for you guys? arr
Secretary: I have a function that needs to do something with a string. I need the function to return a boolean indicating whether the operation was successful or not, and also need to return the modified string. In C#, I would use out parameters for strings, b
Dkisiale I have a function that reads a csv that gives me a list. Then I find the max of that list and return that list and max from the function. I would like to know the best way to do this to make my code more efficient and readable. I'm still a bit new to
developed: When I return Integer or other wrapper from Spring Controller like this: @GetMapping(path = "test1")
public Integer test1() {
return 1;
}
The response to the user has the following body: 1
This is not valid JSON. Is there any practice how thes
Aaron Austin I'm building a simple custom headless CMS with React to persist data in Fauna via API Gateway and Lambda. In order to list my posts in the admin, I want to get data from my collection sorted by date value. When I create a new index to do this, I w
yavg In an ASP.NET Core Web API project, I do this to build the json style: {
"ok": true,
"error": {
"message": "el valor Terror ya existe"
}
}
Use this code: message = $"el valor {message} ya existe";
var new_jso
Matt What is a thread-safe and memory-leak-free way to return a string from C++ to the SWIG python interface? SWIG will automatically copy the contents of the char *return value into the python string. This SWIG guide provides examples: char *__str__() {
s
Bowes I did realize that when a non-promise is returned in a .then() handler, it is immediately passed to the next handler, and if it is a returning promise, execution is suspended to resolve the promise before it is passed under a handler. I also know that a
Aaron Austin I'm building a simple custom headless CMS with React to persist data in Fauna via API Gateway and Lambda. In order to list my posts in the admin, I want to get data from my collection sorted by date value. When I create a new index to do this, I w
Dkisiale I have a function that reads a csv that gives me a list. Then I find the max of that list and return that list and max from the function. I would like to know the best way to do this to make my code more efficient and readable. I'm still a bit new to
yavg In an ASP.NET Core Web API project, I do this to build the json style: {
"ok": true,
"error": {
"message": "el valor Terror ya existe"
}
}
Use this code: message = $"el valor {message} ya existe";
var new_jso
June 11 I'm having trouble choosing between the two options. If you want to have a function that returns a class member by reference, how should the class member be defined? MemberClass m_member? MemberClass* m_member? Suppose m_member is a member of type Memb
mango I have a function that returns an array like this: vector<string> GetString()
{
vector<string> s;
s.push_back("one");
s.push_back("two");
s.push_back("three");
return s;
}
I call it like this: vector<string> mystrings=GetStrings();
I
mango I have a function that returns an array like this: vector<string> GetString()
{
vector<string> s;
s.push_back("one");
s.push_back("two");
s.push_back("three");
return s;
}
I call it like this: vector<string> mystrings=GetStrings();
I
Phil I'm trying to conform my JavaScript to best practices for returning values from functions. Currently, I declare a variable, handle the variable in the function, and return it. I think it's good practice to explicitly state the state, but I'm wondering if
Bastian Van Damme I wrote this code var query = from u in context.Users
join ui in context.UserIdentifiers on u.id equals ui.user_fk
where ui.identifier_value == identifier
sel
Jefferson I want to write a function that parses a file and returns an array of "matched" lines. I don't care if it's a function or a subroutine, but I'm not sure how to do it. Let's be specific with an example: Suppose we want to return an array of all lines
Matt What is a thread-safe and memory-leak-free way to return a string from C++ to the SWIG python interface? SWIG will automatically copy the contents of the char *return value into the python string. This SWIG guide provides examples: char *__str__() {
s