Posts by suriyel • 297 points
7 posts
-
2
votes1
answer49
viewsA: Is it possible to filter an SQL base based on a list of values?
The operator IN tests multiple values in a list of elements in parentheses. Your example would be: SELECT * FROM 'dataset.table1' WHERE mpg IN (15, 17, 22) It is also possible to use the result of a…
-
4
votes4
answers184
viewsA: How to set a GET request header in Golang
resp, err := http.Get(API) No way to change the header with Get, he makes the request immediately and uses the values default package http. What you need to create is a custom request, using the…
-
1
votes1
answer67
viewsA: How to store the result in a variable to use later? - PHP
Use the function sprintf, which returns the string instead of printing. <?php $data1 = '2021-02-23 00:00:00'; $data2 = date('Y-m-d H:i:s', strtotime("-3 hours", strtotime("now"))); $unix_data1 =…
-
1
votes2
answers93
viewsA: How to make a function accept a Slice parameter of any kind?
You can use some functions of package reflect to make this code generic, the main one is this. func Swapper(slice interface{}) func(i, j int) Swapper Returns a Function that swaps the Elements in…
-
1
votes1
answer97
viewsA: Error when calculating tree height Trie in C
The problem is you’re trying to use the type no** as an index of array, what is not possible. You have to change these lines no** i = r->filho; no** fim = i + (sizeof(r->filho) / sizeof(no…
-
6
votes2
answers140
viewsA: I cannot use the value passed in argv in the program call
The parameter argv is a array of arrays of chars. When you use argv[1], what you’re actually accessing is a pointer to the start of array of chars which represents the second argument passed to the…
-
1
votes1
answer179
viewsQ: How to search for a substring from an offset in Rust?
How to find the index of the beginning of a substring starting from a given index of string? In C++, for example, the method std::string::find accepts a offset or index where the search should…