Posts by Wallace Maxters • 102,340 points
1,984 posts
-
1
votes1
answer637
viewsA: Validation of the update in the Standard
This error is caused when you use the function find and it does not find any corresponding result in the database for the ID of Model researched. In such cases, I usually use findOrFail to avoid…
-
2
votes1
answer813
viewsA: Reference Sleep PHP function
sleep, as the documentation itself says, its purpose is to delay the execution time of the script, from the point that it is invoked. Generally, the function is used sleep in infinite loops, usually…
phpanswered Wallace Maxters 102,340 -
1
votes3
answers146
viewsA: Laravel 5.5: same field in multiple rows on Seeds
By default in Laravel created_at is inserted automatically, unless you are using a Model, of course. If using the method insert, the insertion needs to be manual. If you want to insert the…
-
1
votes1
answer590
viewsQ: file_get_contents is generating the error: "Too Many open files"
I have a script running on my server through Supervisord. This script queries the database for pending request processing, and when it does, sends the data of each request to an endpoint of a…
-
1
votes1
answer594
viewsQ: Is there any way to put Scroll on TBODY?
I have a table where the amount of items listed on TBODY is quite large and I would like to add a scroll, setting the maximum size of the TBODY at 500px. I tried to do this, but it didn’t work (I’m…
-
2
votes5
answers1186
viewsA: How to use the reduce (reduce) operation on objects?
I’ll give you my toothpick too. Just use the Object.keys to list object keys. var valores = [{valor: 1}, {valor: 2}, {valor: 3}, {valor: 4}, {valor: 5}, {valor: 1000}]; var resultado =…
-
4
votes5
answers1186
viewsQ: How to use the reduce (reduce) operation on objects?
In Javascript, when I need to do a reduction operation, I use the method Array.reduce. Thus: var valores = [1, 2, 3, 4, 5, 1000]; var resultado = valores.reduce(function (soma, atual) { return soma…
-
2
votes1
answer487
viewsA: Ajax + Php Pass Variable
If you need to check from time to time, consider using Long Polling to do so. First of all, you’d have to change his code for him to use setTimeout with recursion, instead of using setInterval, on…
-
15
votes1
answer5948
viewsQ: What is Long Polling?
Whenever I search for "periodic updates" and "real-time notifications" for web applications, I come across the term long Polling. From what I understand, it seems to refer to periodic updates made…
-
2
votes1
answer176
viewsA: Div moving in changing screen
Use the latest and modern display: flex to solve your problems! #container{ background-color: steelblue; height: 400px; display: flex; align-items: center; justify-content: center; } #center{ width:…
-
20
votes2
answers14582
viewsQ: What is Basic Auth?
What is and how Basic Auth works? In which scenarios it should be used? It is safe to use it currently, since we already have Oauth and Oauth2, among other more modern forms of authentication?…
-
2
votes1
answer98
viewsA: Doubt, API Restfull x Angular x CSRF
It is necessary to protect against CSRF? I understand that any system where you use a protection against the Cross-site Request Forgery is to avoid requests coming from source or forms not expected…
-
1
votes3
answers394
viewsA: Is it possible to remove the option all files in the file explorer?
The option used only leaves the desired type marked as default. It is not possible to remove this option (at least until today). I think the best thing to do in case you don’t want files of certain…
htmlanswered Wallace Maxters 102,340 -
0
votes2
answers291
viewsA: How to post date and time using datatime type in sql
The object DateTime there’s no cast for string. It is therefore necessary to use the method format to display the date on desired output. The format used in MYSQL to enter dates is Y-m-d H:i:s. $sql…
-
3
votes1
answer510
viewsQ: How to run a callback at the end of a $http file, whether it works or not?
At Angular, I’m running a call HTTP through the $http.get and, when this request ends, I change the value of a variable through the callback in the then: $scope.carregando = true;…
-
7
votes4
answers2632
viewsQ: What is the equivalent of CSS media queries in Javascript?
When I want to apply certain style according to screen size, I usually use CSS media queries. Example: @media only screen and (max-width : 768px) { .container { width:960px; } } I wonder if in…
-
9
votes1
answer983
viewsQ: Is there any way to record the webcam through HTML5?
I know there’s a way (I’ve even used it on at least 5 systems I’ve developed) to open the webcam by HTML5 and capture a photo (I do it using the canvas). Example Camera Capture with Html5 But I had…
-
3
votes4
answers190
viewsQ: What is the default value of the "cursor" attribute?
What is the default value of the "cursor attribute"? I changed the value to pointer, but in a certain case I prefer to return to the default arrow, but I don’t know what is the value.…
cssasked Wallace Maxters 102,340 -
2
votes2
answers103
viewsA: Manipulating array values in PHP
The mistake Invalid argument supplied for foreach() It happens when you pass the foreach a non-transferable value. Therefore, you should have a check if really the value $_SESSION['item'] can be…
-
1
votes1
answer309
viewsA: Multiple Nvironment Portable
According to the documentation, you can create manual checks of which environment is through the method App::envinroment(). For example: if (App::environment('local')) { // Ambiente local } if…
-
2
votes2
answers460
viewsA: Use 2 different frameworks in the same CSS?
In fact, if you will use Gulp to "compile" a custom CSS, you can use a SCSS file and import the values from the desired framework... Example 1) install the desired frameworks npm install --save…
-
7
votes2
answers1311
viewsQ: What is the "Pointer-Events" property for?
I was researching a way to style the little arrow <select /> and came across a solution that used a <label> with the value pointer-events: none. I wonder what that’s for pointer-events…
css3asked Wallace Maxters 102,340 -
13
votes1
answer1552
viewsQ: How do the Angularjs Watchers work?
In Angularjs, there is the two-way data Binding, which causes the values to be displayed immediately on views even when this value is updated in controller. In addition there is also the function…
-
13
votes3
answers291
viewsA: Is it correct to write CSS with Javascript?
Vuejs' idea (I think it’s the same as Angularjs) to use CSS attribute definition directly in the TAG dynamically aims to make small manipulations in the DOM. I wouldn’t particularly use it the way…
-
3
votes3
answers306
viewsQ: How to remove internal dashes from a <SELECT> in Firefox
Once again I just realized that Firefox is putting "additional stylings" in my inputs. This time, in the <select>, when I click on it to select an option, there is always an internal dashed:…
-
2
votes2
answers412
viewsQ: How can I style the <select> arrow in Firefox?
I have this little problem. I have a layout that needs to be exactly as they passed me, within them the definitions of the type text and select. In Google Chrome, everything worked beautifully,…
-
1
votes1
answer176
viewsA: bug ng-change with checkbox cheked
I think in your case it would be better to use the $watch than the ng-change to "track" the changes in the variable. I do not know what is the need for you to use two variables with different names,…
angularjsanswered Wallace Maxters 102,340 -
2
votes1
answer314
viewsA: My Laravel project does not see my Javascript file
Browser will not be able to read the Assets in the folder resources, and yes the files in the folder public. You should understand that the assests of the folder resources are used so that you can…
-
3
votes2
answers1179
viewsA: .htaccess change extensions . php and . html automatically?
I would do so: RewriteEngine On #Sua definições aqui RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f RewriteRule (.*)$ $1.php That regular expression of RewriteRule says…
-
3
votes5
answers1023
viewsA: What is the difference between starting an empty variable and starting directly with the value?
If you set the variable with the value of array, it is important to define the definition, even though you can define directly as array, if you define as another type of value can generate errors.…
-
0
votes1
answer522
viewsA: Does anyone have any idea how to create a pagination with RESTFULL API in Laravel?
I think the answer is simple: Use the method paginate of Laravel. I always use this in my applications to make a "paging" (actually what I do is a load on demand, using Laravel’s paging logic). What…
-
14
votes1
answer3877
viewsQ: What is the history.pushState function for?
I realized that the object history has some relationship with browser history handling. There are methods like go and back which are more understandable, but do not understand very well what makes…
-
9
votes4
answers11575
viewsA: Use . env file in PHP project?
As a curiosity, I inform you that the Library used to read this file .env is called vLucas/phpdotenv and can be installed via Composer. Therefore, you can implement it in any project, as long as you…
-
3
votes1
answer195
viewsQ: What is WAMP (Web Application Messaging Protocol)?
I’ve been studying a little bit about Websockets and while researching how to do channel structure or push, I came across the term WAMP. It seems to me, WAMP is a protocol or subprotocolo of a…
-
5
votes5
answers4681
viewsQ: How to make a Rigger for a SEM jQuery event?
In jQuery, when I want to make a Rigger for an existing event, I do so: $(function (){ $('#button').on('click', function () { console.log('olá mundo'); }); $('#button').trigger('click'); })…
-
4
votes1
answer527
viewsA: Blade OR syntax within Laravel Collective input value
In Collective, you will have to do with PHP syntax, since this syntax of OR of Blade is compiled for a ternary expression with isset. For you to understand better, when you do Blade’s "echo" like…
-
28
votes4
answers1037
viewsQ: What is reverse proxy?
When I was setting up the PHP FPM (PHP module that allows the use of Fastcgi), I stumbled on the term Reverse Proxy when I was researching some tutorials on how to set it up in Apache 2. Example…
terminologyasked Wallace Maxters 102,340 -
1
votes1
answer357
viewsQ: How to use the "php_admin_value" flag in virtualhost via PHP-FPM on a specific Virtual Host?
I decided to replace Apache2handler with PHP-FPM on my server. After this change, I tried running sudo apache2ctl configtest and I got the following mistake: AH00526: Syntax error on line 53 of…
-
0
votes1
answer378
viewsQ: I can’t install PHP-FPM on Ubuntu
When I try to turn the remote sudo apt install php5.6-fpm, I’m getting the following message: Some packages could not be installed. This may mean that you requested an impossible situation or, if…
-
9
votes2
answers1514
viewsA: How to continue executing a script even after sending the data to the browser?
How to do this in PHP with common settings? I took a test in the Laravel framework and got the expected result. I did it this way: Route::get('/', function () { $response = Response::json([…
-
10
votes2
answers1514
viewsQ: How to continue executing a script even after sending the data to the browser?
When I asked the question What is the solution for asynchronous PHP processes?, basically what I had in mind was this question: "There is some way to complete a request from a client, but leave a…
-
8
votes3
answers643
viewsQ: How do I remove a "listener" that I added via addeventlistener?
I always use the function addEventListener to "listen" to some events, such as click, Websocket connection and the like. For example: var ws = new WebSocket('ws://echo.websocket.org/');…
javascriptasked Wallace Maxters 102,340 -
0
votes1
answer28
viewsA: Basic error in Javascript
Missed closing the stretch where you do the $.get('database3.php', function (data, status) {. Just add the ) before the stretch that has var dados. Also missing close with the ) the last line, that…
javascriptanswered Wallace Maxters 102,340 -
1
votes2
answers49
viewsA: How to perform a query of a query stored in a string through the DB class?
You can use the method DB::select directly. It allows you to execute a query from a string. Behold: $query = 'SELECT FIND_IN_SET(KillCount, (SELECT GROUP_CONCAT(KillCount ORDER BY KillCount DESC)…
-
10
votes1
answer969
viewsQ: What is the difference between Service Worker and Web Worker?
I was reading on MDN and I realized that in addition to the Webworkers, there are also the Service Workers. It even has this example code: if ('serviceWorker' in navigator) {…
-
4
votes1
answer443
viewsQ: How does each value that can be used in the CSS "Transition" (Transition-timing-Function) attribute work?
Usually when I want to make one transition to animate a CSS element, I usually use the value linear right after I set the time I want in an animation. Example: .boing-boing{ height: 100px; width:…
-
7
votes1
answer9223
viewsA: What does window.location.Reload do?
According to documentation from MDN, this parameter is called forceReload. Syntax: window.location.reload(forcedReload); forcedReload: It is a Boolean flag, which when true, makes the page always be…
javascriptanswered Wallace Maxters 102,340 -
3
votes1
answer3754
viewsA: How do I select all occurrences of a selection in Visual Studio Code the same way I do in Sublime Text?
In Visual Studio Code, the shortcut equivalent to ALT+F3 of the Sublime Text would be the CTRL+F2. You select the desired text and then press CTRL+F2.…
visual-studio-codeanswered Wallace Maxters 102,340 -
3
votes1
answer43
viewsQ: Visual Studio has shortcut to navigate to a similar file in Sublime Text, when we press CTRL+P?
In sublime Text, we can use the shortcut CTRL+P to type the name of a file and select it directly, without having to look for it in the folder structure. For example: Already in Visual Studio, there…
visual-studioasked Wallace Maxters 102,340 -
3
votes1
answer3754
viewsQ: How do I select all occurrences of a selection in Visual Studio Code the same way I do in Sublime Text?
In sublime Text, you can select all the occurrences of a selection and edit them at the same time. To do this just press ALT+F3 after making the selection, as in the example below: In the example,…
visual-studio-codeasked Wallace Maxters 102,340