Posts by RFL • 6,205 points
308 posts
-
1
votes1
answer36
viewsA: Error creating php conditional
You can use the method exists before calling the method first() 1: $id = $this->argument('numero'); $getInfo = Parceiro::where('id', $id); if ($getInfo->exists()) { // info existe $info =…
-
0
votes1
answer43
viewsA: How to implement history of all done operations
You can use the library laravel-activitylog which was quoted in the commentary: Doc: https://spatie.be/docs/laravel-activitylog/v4/introduction Or create your own implementation using Observers:…
-
0
votes2
answers64
viewsA: How to use a customizable name for the password field in Laravel 8?
You need to overwrite the method getAuthPassword in its model of User for him to return the attribute passwordhash, see: class User extends \Illuminate\Foundation\Auth\User { protected $table =…
-
0
votes1
answer226
viewsA: on_member_join does not work, Discord.py
To send a DM for the user you need to first create a private chat with the user and then send a message to that channel. @client.event async def on_member_join(member): await member.create_dm() #…
-
0
votes3
answers325
viewsA: Occurrence of a digit on an integer using Python
Now that you’ve managed to settle according to the maniero’s response, take a look at the solution below, maybe it serves to complement your studies. How the user input will be in texto, it would be…
-
0
votes2
answers25
viewsA: Same download form for different pages, how to save to which page was downloaded?
You can put a input of the kind hidden in your form that holds the value of URL current page, see: <input type="hidden" name="origin" value="<?= $_SERVER['REQUEST_URI']; ?>" /> This way…
-
3
votes2
answers93
viewsA: How to remove a certain key and value in a dictionary with composite data (Keys and Values) in Python?
You need to iterate over all the elements using for and within the loop use the del to delete a certain key, see: for nome in alquimistas: del alquimistas[nome]['Patente'] See working:…
-
1
votes4
answers839
viewsA: Retrieve data from the logged-in user to use as the sender of the email in Laravel
You can use this package https://github.com/ImLiam/laravel-env-set-command and then use the Facade Artisan to execute a command that changes the value of the environment variable. Artisan::call('php…
-
5
votes2
answers1102
viewsA: Change part color of a string
in the template engine you can use any function available on PHP, knowing this we can use the function preg_replace replacing a text according to a regular expression, see: $texto = "este é o…
-
2
votes1
answer36
viewsA: Error: Form Elements must not be named "Submit"
The problem is that you set a field with name="submit" in this part: <?php echo form_submit(array( 'name'=>'submit', 'id'=>'submit', 'value'=>$this->lang->line('common_submit'),…
-
2
votes1
answer147
viewsA: How to maintain the sender email signature when using the Mail::send() function in the Standard?
From what I understand you’re hoping Mailer identify the configured signature on your server and include it in each submission because you are using the same SMTP/POP as well? The Mailer does not…
-
1
votes2
answers168
viewsA: Remove array item when unchecking checkbox
first of all you need to validate if the item is already in your array value_included = valores.include(event.target.value); is_checked = event.target.checked; // o valor já esta no array porem o…
-
3
votes1
answer197
viewsQ: How to select 2 objects from an array
How can I select only 2 items from a array from inside my Center? example: { "name": "xpto", "age": 11, "lista": [{"s": 1}, {"s": 2}, {"s": 3}] } I need to get the items you own s with 2 and 3 where…
-
1
votes1
answer418
viewsA: The file name Laravel
on the line $filenametostore = $filename.'_'.time().'.'.$extension; is where the number is inserted, remove the '_'.time().'.' and this number will not appear (it should look like this:…
-
0
votes1
answer380
viewsA: How to run this Curl in PHP?
You can use the functions curl_exec and curl_setopt that are native to the PHP, see; $ch = curl_init(); ; curl_setopt($ch, CURLOPT_URL,…
-
0
votes2
answers45
viewsA: Using variable values
just change the keyword const for var, this way you will be able to exchange the values contained in the variables, see in more detail in official documentation…
-
0
votes1
answer32
viewsA: What are colors and routers in various PHP frameworks
Core is where all the logic and "heart" of the framework is, in this folder are all the necessary settings for the framework to work. Never touch this briefcase unless you know what you’re doing.…
-
0
votes1
answer50
viewsQ: sort list of dictionaries by key that contains None key
How can I sort a list of dictionaries by a certain key when within those dictionaries there is one with the key None? Example: mylist = [{'category': 'director'}, {'category': 'manager'},…
-
2
votes3
answers53
viewsA: Code Duplication in Laravel ORM
if you notice you will see that there are some lines that always repeat themselves in all conditions as: Produto::orderBy('credito', 'DESC') ->where('id_subcategoria', $subcategoria)…
-
-2
votes3
answers1141
viewsA: Laravel - How to Page and Give Order By
before using the orderBy you need to search the records in the bank: ModeloVideo::all()->orderBy('created_at', 'desc')->paginate(10); ->all(): search all bank records ->orderBy: orders…
-
0
votes0
answers424
viewsQ: execute python script in google cloud VM
I created a vm in google cloud to run a script (bot) but every time I close my terminal the script is stopped for no apparent reason. the code itself has only one while True with a conditional in…
-
4
votes1
answer593
viewsQ: capture Pattern groups with regex
How do I capture group-separated information with regex? I have a string with the following format: /+1-541-754-3010 156 Alphand_St. <J Steeve> 133, Green, Rd. <E Kustur> NY-56423…
-
1
votes2
answers1208
viewsQ: select month and year of a datetime field
I own a field of the kind datetime and I need to make a consultation based only on the month and year. While researching, I noticed that there is the function extract, but it separates only one…
-
1
votes1
answer55
viewsQ: Pass sql.DB pointer as method parameter
I have a struct that has a method save receiving as parameter a pointer for access to the seat; func (c Call) Save(db *sql.DB) error { stmt, err := db.Prepare(` INSERT INTO calls values($1, $2, $3,…
-
0
votes1
answer24
viewsQ: Enable CORS in GO application in App engine
My API does not respond to requests from third-party websites and for that I need to enable CORS, I tried to add the Access-Control-Allow-Origin: "*" in the app.yaml but I get the following error.…
google-app-engineasked RFL 6,205 -
2
votes1
answer235
viewsQ: Accuracy of float64
Why Go when performing the calculation: (1 * 0.09) + 0.36 returns a float64 in the following format 0.44999999999999996? I’m trying to make comparisons with tests and the calculation should be 0.45…
-
0
votes1
answer53
viewsQ: Full value in hours with Golang
I’m trying to compare 2 dates that have only 1 minute difference between them and apply a price rule based on that time where; Each minute must have the value of R$0.10 st := time.Date(2019, 9, 21,…
-
0
votes1
answer101
viewsQ: How to capture multiple HTML values with Django Forms
So that the html send a field of the type select with several values selected it is necessary to put the notation [] in the name attribute of html: <select name="categories[]" multiple="multiple"…
-
1
votes1
answer110
viewsA: Capture Timeout on GET request
The error occurred because another error was checked before the error of timeout response, err := client.Do(request) if err != nil { fmt.Println(err.Error()) return nil, Error{Message: err.Error(),…
-
1
votes1
answer110
viewsQ: Capture Timeout on GET request
In my code I have an "attempt" to capture the timeout of the method Get package http but for some reason the mistake is not captured and a panic is displayed saying: Get…
-
2
votes2
answers396
viewsQ: Convert date string to ISO 8601 format (with "T" and "Z")
With a string date in the format 01/01/2018 13:00:40, how I could convert it to ISO 8601 format using the "T" and "Z"? Example: 2018-01-01T13:00:40Z I got it this way: datetime.strftime(…
-
0
votes0
answers38
viewsQ: Clone HTML element without clone event
I possess in my HTML a form I use for "mock" I mean, he’s just meant to be clonado to other places. After the first cloning I change some inputs so that they use a plugin datetimepicker but after…
-
3
votes3
answers253
viewsA: Comparison between PHP and mysql variables
First you need to separate the comma values so only after that you can compare one by one, see; $ids = explode(',', $rows['block']); // a saída sera um array: ['aaa', 'bbb', 'ccc', 'ddd'] with the…
-
0
votes1
answer38
viewsQ: Import packages inside tests with python
I have a project with the following structure: __init__.py setup.py - convert_keys/ - __init__.py - convert.py - tests/ - test_convert_keys.py Inside my file of tests I tried to import the following…
-
1
votes1
answer202
viewsQ: How to update column for each SELECT in a given table?
I tried to create a trigger for a table using for it to be activated after each select, but researching a little I discovered that it is not possible to create triggers for selections, only for…
-
0
votes1
answer169
viewsA: How to use make:request Laravel to clear the controller
the method authorize in your class TesteValidaRequest must return true so that you can use this class as a validator. public function authorize() { return true; }…
-
1
votes0
answers39
viewsQ: How to export package documentation with css using godoc?
After writing my package I know it is possible to generate an html page with all the documentation provided through comments in my code; godoc -html github.com/user/package > index.html But the…
-
1
votes1
answer146
viewsQ: How to accesar map coming from a JSON without creating structs?
After taking some data from an endpoint I get passes to a variable of type interface{}; var example interface{} err := json.Unmarshal(payload, &example) If I run a fmt.Println(example) have the…
-
0
votes1
answer483
viewsQ: Cross-Origin Golang with Gorilla/Mux
In my application I am using the package gorilla/mux next to the gorilla/handlers to enable/configure the CORS of my application, I currently have an GO and a frontend application in vue, in my…
-
1
votes1
answer123
viewsA: How to display two different tables in the same view?
You need to include in the view all values you want to use, see; return view('nossacasa.nossacassa', [ 'nossacasatitulo' => $nossacasatitulo, 'nossacassa' => $nossacasa ])…
-
6
votes3
answers9117
viewsA: convert a string list into a list of integer numbers
First you need to convert all the strings whole-wheat; First Solution (conventional) x = ['123', '456', '789'] valores = [] for val in x: valores.append(int(val)) Second Solution (comprehensilist…
-
1
votes1
answer233
viewsQ: Use same package function with Golang
Within my project I have 2 files, main.go and price.go; in my file main.go within the function main() i tried calling a file function price which is exportable (starts with uppercase letter), and…
-
4
votes2
answers149
viewsA: transformar Y-m-d H-i-s em d-m-Y H-i-s
You can use the class DateTime of PHP, see; $date = new DateTime("2018-04-24 16:07:17"); print_r($date->format("d-m-Y H:i:s")); // saída: 24-04-2018 16:07:17 You can use dynamically if you…
-
0
votes2
answers16086
viewsA: unboundlocalerror problem: local variable 'num' referenced before assignment
In your code you only start the variable num if the semente is different from None, if semente for equal to None the variable num will never be started, so there is no value in the variable to be…
-
0
votes1
answer60
viewsA: Parser error in Laravel 5.5
I found the problem; it was generated by a syntax error that came from another imported component within the html in question. As the Standard compiled everything into a single file it seemed that…
-
2
votes1
answer217
viewsQ: Do not stop setTimeOut when changing browser tabs
I’m building an accountant with vueJS and I noticed that the count stops when I change the focus of the tab; at first I’m using the function setTimeoutjavscript: setTimeout(() => { this.time++…
-
0
votes1
answer55
viewsQ: Load full XML with simplexml_load_string
I have an XML that has a parent node Produtos and 2500 knots children produto, Every child us has a key id that starts at 1 and goes up to 2500. When I try to load the XML using the function…
-
0
votes2
answers38
viewsA: Error in customizing the default user registration Laravel Auth
The function attach is returning null for the variable user. In his job login the expected parameter shall implement the interface Authenticable which is common in the class User, to solve this…
-
1
votes1
answer213
viewsA: Laravel 5.5 link with Ancora
an anchor with # will follow an element that has the attribute ID with the same value, see: <a href="#service">Serviços</a> <div id="service"></div>…
-
4
votes2
answers198
viewsA: Jquery removes all the least selected Divs and the ones from the other menu
You can use the function not() of jQuery to deny a condition, for example: "Delete all buttons other than the one you clicked" Example: $('.item').on('click', function () { var allExceptClicked =…