Posts by Wallace Maxters • 102,340 points
1,984 posts
-
3
votes2
answers234
viewsQ: How to globally set the default date output in Laravel 5?
I remember well when I used the Laravel 4 that it was possible to convert globally the formats of created_at and updated_at, for display in JSON replies or even in direct call {{…
-
37
votes3
answers9049
viewsQ: What is a Transpilation?
I started reading one article on Ecmascript 6 and I came across the term Transpilation, which in Portuguese would be Transpilation. In addition to this, I noticed that other articles use this term.…
-
0
votes2
answers177
viewsA: Join 2 if’s Php
There’s no reason to have two If, like you did. You could have used the operator && to join conditional expressions Thus If ($condicao_1 == true && $condicao_2 == true) That is,…
phpanswered Wallace Maxters 102,340 -
7
votes2
answers2370
viewsQ: What is the difference between directives (Directive) and components (Component)?
It seems that in more recent versions, in addition to the method directive, Angular 1 also has a method called component. I would like to understand the main differences between one and the other.…
angularjsasked Wallace Maxters 102,340 -
11
votes1
answer1183
viewsQ: What is a collation?
I never knew exactly what it meant. I know it has to do with the coding of the data that will be entered in the table, but in addition, there is some more specific reason to select a collation? I…
-
5
votes2
answers4183
viewsQ: How to discover a collation of a table or database using an SQL query?
I can visualize the collation of certain table or bank perfectly by Phpmyadmin. But if I did not dispose of this aforementioned tool, as I could do to discover the collation by manually doing an SQL…
-
3
votes2
answers1008
viewsA: How to transform this text into an array with name and description?
You can do it this way: First open the contents of the text and save to a variable: $string = file_get_contents('arquivo.txt'); Next we will create an array with each line of the file. $array =…
phpanswered Wallace Maxters 102,340 -
6
votes1
answer2145
viewsQ: What is the difference between JWT and JWS?
I asked a question a little while ago on the site regarding the JWT, which is used to create access tokens through JSON. I tried to implement JWT between two applications that use different versions…
-
1
votes1
answer106
viewsQ: How to redirect all HTTP requests to HTTPS in Silex?
In Silex, there is some possibility of making a filter that redirects a url to https when it does not have https? I know how to do it in the Laravel, but I’d like to do the same operation with…
-
7
votes1
answer154
viewsQ: How is the process of installing the letsencrypt.org certificate on Linux on Apache servers?
I really liked the idea of using the certificate from letsencrypt.org. I found several tutorials on the internet, including that in Digital Ocean. All the steps worked correctly, but since I don’t…
-
7
votes1
answer1285
viewsA: How to list files in PHP with a specific name?
I think you did it in the most complicated way possible. It was simpler to use the function glob containing the desired expression: $expr = '/caminho/para/pasta/Carros*.txt'; foreach (glob($expr) as…
phpanswered Wallace Maxters 102,340 -
45
votes4
answers26195
viewsQ: What is a payload?
I’ve always seen in some frameworks that work with REST or with sending data in JSON format in a request using the expression payload. What does that name mean in HTTP requests? What is specifically…
-
5
votes3
answers134
viewsQ: Why do libraries use "! function_exists('function')" always when there is a statement of a function?
I’ve used several PHP libraries and realized that they always use the same statement, whenever there is a declaration of a new function. if (! function_exists('funcao')) { function funcao($arg) { }…
-
2
votes2
answers50
viewsA: Where should a globally used method be located?
In which part of the structure of Laravel should I allocate the file that will have this code? You can create your own file to load your own functions. Create a file resources/funcoes.php Alter your…
-
7
votes1
answer494
viewsQ: What is ABI? Does it have anything to do with API?
I am reading that answer because I am currently studying C++. I was trying to understand the difference C and C++. In the quoted answer, I came across the term ABI. Until then I knew about API, but…
-
0
votes3
answers235
viewsA: How to check by javascript if you have entered a new li tag through setInterval?
Maybe it’s easier for you to use one setTimeout inside, to process scroll change after html is changed: function openWidChat(de,para,nome) { var url_s = $("#url_s").val(); $.ajax({ url: url_s…
-
3
votes3
answers292
viewsA: Remove only numeric elements from an array
If in your case, the numbers that are present on array always are int or float (and not a number within a string), you can make it simpler yet: $sem_numeros = array_filter($arr, 'is_string');…
phpanswered Wallace Maxters 102,340 -
4
votes1
answer94
viewsA: How to empty php buffer while running?
According to my tests, that way it works: @ini_set("output_buffering", 0); // off @ini_set("zlib.output_compression", 0); // off @ini_set("implicit_flush", 1); // on header('Content-Type:…
-
4
votes0
answers58
viewsQ: Isn’t the value of an unassigned int variable in C++ 0 (zero)?
I’m having my first serious contact with C++. I wanted to see what would happen if I added up a value int of a variable assigned with another without assigning, and see what happened: #include…
-
4
votes1
answer1424
viewsA: Practical application of isset() and unset() in PHP
isset isset is intended to verify if a variable exists or if it is not null. Being so, isset makes perfect sense in developing a PHP application. Imagine the following scenario: You need to know if…
phpanswered Wallace Maxters 102,340 -
5
votes1
answer1084
viewsA: Update in the database via javascript
Javascript is a client-side working language (browser). Therefore, it has no direct connection to a Mysql server. Also, if you had, it would be a problem, since you would need to specify a password…
-
3
votes1
answer335
viewsA: How to work with Resource on Laravel?
The Resource in Laravel create methods for performing CRUD. Methods are used to list, update, show, create and delete records. For example, if you create a Resource for Userscontroller, you should…
laravelanswered Wallace Maxters 102,340 -
10
votes4
answers1233
viewsA: What is the correct order to use the PHP header and ob_start functions?
The answer is: It makes no difference, depending on where you call the ob_start. What I answered is controversial, but you need to understand how buffer capture works and how it works to send wiring…
-
1
votes1
answer2252
viewsA: Route system in php
What you are wanting, in my view, could be solved quietly with the use of a include dynamic. You can do something like this: <?php include 'topo.php'; ?> <?php $pagina =…
phpanswered Wallace Maxters 102,340 -
8
votes1
answer1138
viewsQ: What are the existing layers in an HTTP/HTTPS request?
I gave a special attention this morning to read some questions and answers here on the site that speak specifically about https/ssl. Like for example these: Data received from HTTPS comes encrypted?…
-
4
votes2
answers2487
viewsA: What is a recursive function?
A recursive function is a function that calls itself. They can be used to process a given operation and there are usually internal conditions for recursivities to be applied (since without…
-
2
votes3
answers2181
viewsQ: Error "class Domdocument not found" when trying to run Phpunit
When trying to turn the command phpunit on the command line, I received the following error: Class 'Domdocument' not found This wasn’t happening before. I remember having removed and installed PHP…
-
4
votes2
answers576
viewsQ: What is Initialization Vector?
When I used a PHP function, called openssl_encrypt, that encrypts data, I came across the term iv, that is Initialization Vector. I’d like to understand a little bit about that; I saw it in a…
-
3
votes0
answers100
viewsQ: What does this error mean after calling the openssl_encrypt function?
When calling the function openssl_encrypt, always returned false. When checking the function openssl_error_string, I get the following error: error:0906D06C:PEM routines:Pem_read_bio:no start line…
-
1
votes2
answers148
viewsA: How to protect yourself from malicious entry through a select dropdown?
One of the possible ways to validate would be using the function in_array PHP to make this check. if (! in_array($_POST['valor'], ['opt1', 'opt2', 'opt3']) { // inválido } Because someone could…
-
4
votes1
answer312
viewsQ: How to avoid multiple function calls in the view?
Using Angular, in my controller I have a function that calculates the amount of filtered items. Thus: $scope.totalConferenciasRestantes = function () { return…
-
0
votes1
answer143
viewsQ: Access denied for printing iframe in Firefox
I have a system where I need to print a PDF by clicking the button. The url is built according to the shipment ID, so dynamically, I use an iframe that will load the data and, when loaded, I call a…
-
12
votes3
answers1408
viewsA: What are the differences between the forms of dependency injection?
Form 2 and 3 consider the position of the argument, not the name. In Javascript minification, for example, once variable names are changed, it could cause errors in your Angular application.…
angularjsanswered Wallace Maxters 102,340 -
4
votes1
answer1193
viewsQ: How to use a font-awesome icon with Angular Material button?
In the Documentation of Material Angular there are examples of using icons on buttons, through an SVG icon. Example: <md-button class="md-icon-button md-primary" aria-label="Settings">…
-
3
votes1
answer1193
viewsA: How to use a font-awesome icon with Angular Material button?
I don’t remember seeing anything about this in the documentation, but to use a font as an icon, you need to use the directive md-icon with the property md-font-icon containing the class referring to…
-
7
votes2
answers366
viewsQ: Does using "Document.open" and "Document.close" make a difference?
I saw in a certain answer from SOEN a question about printing iframe content. I ended up encountering an excerpt of code where I had the following: var newWin = window.frames["printf"];…
-
13
votes3
answers614
viewsQ: What happens to three-digit hexadecimal colors?
I’ve always been curious to know what happens in a 3-digit hexadecimal expression of a CSS color. For example, you have 000 and 000000, which is the black color. And fff or ffffff which is white.…
-
45
votes3
answers3408
viewsQ: How to find out if a hexadecimal color is dark or light?
I have a status listing that is displayed and each status has an assigned color. These colors are saved in my database in hexadecimal format. Example: #add555 I have a small problem: If the color is…
-
4
votes1
answer291
viewsQ: Why do some angular services use dollar ("$") at the beginning?
I used some libraries written for Angularjs where Services were always written with a $ at first. For example, in Angular Material we have the service $mdDialog, and in Angular Bootstrap we have the…
angularjsasked Wallace Maxters 102,340 -
1
votes2
answers1016
viewsQ: What’s Options Multiviews for?
I saw a code .htaccess in the Laravel Framework, whose code snippet had this: <IfModule mod_negotiation.c> Options -MultiViews </IfModule> What would that be -MultiViews? What does he…
htaccessasked Wallace Maxters 102,340 -
1
votes1
answer962
viewsQ: How to define a subfolder as the root of an HTACCESS application?
I have a certain PHP application written with the Silex framework. I set up the structure in a way where only the folder public would be the folder where I would point the Apache to read it. My…
-
8
votes1
answer17973
viewsQ: What is the difference TEXT and LONGTEXT?
I am developing a system where I will import the data from an Excel. As this data will be temporary, I intend to save the information of this imported column in format JSON at the bank. Therefore, I…
mysqlasked Wallace Maxters 102,340 -
0
votes1
answer123
viewsQ: How to define providers that only work in a local environment with Laravel 4?
On Laravel 4, we have a file called app/config/app.php, that we use to be able to define configuration information that will be used in the application. When I am in development environment, I…
-
1
votes1
answer1256
viewsA: Confirm exclusion in Laravel 5.4
Use the confirm of Javascript putting it in onsubmit from your form for this. Behold: <form class="form-inline" method="POST" action="/servidores/{{ $serve->id }}" onsubmit="confirm('Tem…
-
5
votes2
answers728
viewsQ: How to separate numbers from three to three, backwards, in Javascript, without regular expression?
I already know how separate the numbers from three to three, backwards, with regular expression in Javascript. But I wonder if in Javascript there is a simpler solution, and without the use of…
-
19
votes4
answers1173
viewsQ: What does the regular expression "/(?=(?:...)*$)/" do in detail?
I just needed a solution to put points to separate numbers from three to three, backwards. For example: 1000 => 1.000 100000 => 100.000 10000000 => 1.000.000 In a reply I found in English…
-
0
votes1
answer67
viewsA: restrict htaccess access
One of the options is to rewrite everything to v1/index.php RewriteRule ^ v1/index.php [L] And the other is to ban access: RewriteRule ^(helper|uteis)/ - [F,L]…
-
3
votes1
answer1682
viewsA: Can you "hide" the password that goes in mysqli_connect?
No need for that. The people who must access the connection configuration file with the bank (or any other application within the application that uses password or security tokens) must be the ones…
-
5
votes1
answer8639
viewsA: Pass parameter from one route to another
Would it be correct to pass a variable $id to capture the route parameter? Route::get('doacao/{id}', function(Request $request, $id){ return Redirect::route('escolha/doacao')->with('id',$id); });…
-
2
votes4
answers994
viewsA: Why does Input Type Email validation accept pointless domains?
In addition: Is there a case where it would be valid to use a domain without the value after the point (.com, . net, etc) ? Yes. We should remember that on local hosts (like localhost for example)…