Posts by Leonardo • 9,130 points
332 posts
-
0
votes1
answer94
viewsA: Queue is created but never executed
I do not know why the negative vote on a valid and well documented question. Anyway, I managed to solve, for Mongo we need to use some more settings: The connection in Queue.php should be:…
-
-1
votes1
answer94
viewsQ: Queue is created but never executed
I’m trying to create queues to fire push notifications and emails from an API with Lumen. I got the Warninguser class that makes the shots like this: <?php namespace App\Utils; use…
-
2
votes0
answers16
viewsQ: How to ignore test files with glob?
My project is structured more or less like this: dist - * node_modules - * source - *.js - *.spec.js - *.test.js - *.vue - __tests__ tests - *.js - *.spec.js - *.test.js I’m trying to create a glob…
-
0
votes0
answers18
viewsQ: Deleting variables at the end of the method decreases spent memory?
In php we have the method unset to erase variables from memory, I have a doubt about that. After a method is executed, are its local variables automatically deleted from memory? Or is it good…
-
2
votes1
answer78
viewsQ: Pick up commits with keywords
I’m trying to mine some Git data, I need to know how many commits the X file is in and if in those commits I have a keyword for a list. I’m using the following command: git log --all --grep fix…
-
1
votes0
answers81
viewsQ: Force table header to follow width of other columns dynamically
I’m using flexbox to do everything on the site, including the table, first tried using the basic structure of a table (thead, tbody and tfoot), but I couldn’t, so I tried to do it with simple rows…
-
0
votes0
answers23
viewsQ: Catch current directory on either PHAR runs
Many PHP managers are available in PHAR files, which are installed globally via Composer or in operating system environment variables. This is the case of Composer himself, and also of Phpunit. In…
-
0
votes0
answers22
viewsQ: How should the tests that manipulate the database behave?
In everyday life we come across scenarios in which we have snippets of code that are executed once during the entire life of the system. As an example: Registration screen of the first…
-
0
votes2
answers538
viewsA: How do you test a number and tell if it’s prime or not?
It was enough to equal the div to zero whenever the while in addition to the second paragraph while I changed the condition to x < 0 since zero would be the number for the program to close.…
-
2
votes3
answers119
viewsA: Create Page Loop 3 times
With a repeating structure you won’t be able to do that, the right thing would be: php. <?php if(!isset($_SESSION['cadastro_cont']) $_SESSION['cadastro_cont'] = 1; // restante da ação da página…
-
0
votes2
answers44
viewsA: Invoke a page click and commit
Researching and finding more terms for research, I found libraries that do this, as is the case with Goutte, in addition to the Simpletest has a similar tool, etc., is usually geared towards…
-
8
votes3
answers4139
viewsQ: In practice, what is a system test and what should it cover?
Among the best known tests then the unit tests which test each class of the system individually, the integration tests which test two distinct parts of the system, such as a DAO and the database.…
-
2
votes2
answers44
viewsQ: Invoke a page click and commit
I’m not gonna post code on the question because I don’t know the beginning. I have a page in HTML and with want to know if it is possible, with PHP invoke click action, etc, in selectors for example…
-
2
votes1
answer515
viewsQ: Exception Handler having return in JSON
I’m building a Restapi using Laravel/Lumen, in tests can occur the return be totally in HTML, this occurs when it appears that already famous screen: Whoops looks like Something Went Wrong This gets…
-
1
votes1
answer515
views -
9
votes1
answer1438
viewsQ: Reuse/reuse of reactive Vue component
I’m trying to repurpose components in Vuejs, one of my attempts is to reuse form fields, example: I have in several forms of my site the fields login and password, so I created a component called…
-
3
votes3
answers326
viewsA: Script to change player (old Jquery game)
Follow the code with correction: $(document).ready(function() { var player = 1; $(".botao").click(function() { if(player == 1) { $(this).text("X"); player = 2; } else { $(this).text("O"); player =…
-
0
votes1
answer768
viewsQ: Hide/change console error message
I try to take for example a file that does not exist on my site, as: try { $.getScript('app/controllers/arquivo-errado.js', function(){}); } catch (e) { // caso de erro } The error is returned in…
-
1
votes1
answer32
viewsA: Can I use Laravel 5.3 in 5.2 projects?
You will have some problems, because some things have changed, but the Laravel code has a guide on how to perform this update, see: https://laravel.com/docs/5.3/upgrade#upgrade-5.3.0…
-
2
votes2
answers247
viewsQ: Send parameter from one route to another
I want to send a variable from one route to another, to display this variable in the view, use example: public function create(ExamRequest $request) { Exam::create( $request->all() ); $message =…
-
0
votes2
answers4705
views -
4
votes1
answer1002
viewsQ: Save Relationship 1:1 on Laravel 5.3
In my scenario, I have tables of users and teachers, where a teacher has a user, so I have a relationship 1:1. Migrations: create_users_table Schema::create('users', function (Blueprint $table) {…
-
1
votes1
answer55
viewsA: Problem in the pagination
Try it like this: session_start(); require '../conectaBanco.php'; $itens_pagina = 5; if (isset($_GET['pagina'])) $pagina = $_GET['pagina'] * $itens_pagina ; // mudei aqui else $pagina = 0; $sql_code…
-
2
votes3
answers17051
viewsA: Change a select based on the selection of another select (from data in BD)
I suggest you use AJAX, where it would look like this: In the front-end: <form> <input name='fabricante' type='number'> <select name='produto'> </select>…
-
2
votes1
answer159
views -
1
votes2
answers116
viewsA: Take values from a post form and forward to an html table
So it must be: <?php //if(!isset($_POST["json_dados"])) die("Post não enviado."); //$array_dados = json_decode($_POST["json_dados"]); $array_dados = [ ['nome' => "notebook", 'preco' =>…
-
4
votes4
answers402
viewsA: How to remove parentheses of values in an array?
You can try like this: foreach($array as $key => $value): $array[$key] = str_replace('(', '', $value); $array[$key] = str_replace(')', '', $array[$key]); endforeach; I basically went through all…
-
5
votes1
answer44
viewsA: Delete file on client host
There is no such possibility, PHP runs on the server, so you have access to server files and server locations, you will never have access to client locations, for that you would need desktop…
-
2
votes2
answers457
viewsA: How to work with PHP authorization levels?
Well, I tried to do something different than what I do, I did all the authorization based on token: <?php class ACL // classe para controle de acesso { // retorna um token baseado no tipo do…
-
1
votes1
answer229
viewsA: Extract json information in php
That would work: <?php $key = '***************************'; $forcast_days='5'; $city = '-30.1087957,-51.3169879'; $url…
-
3
votes6
answers1348
viewsA: Is there an alternative to system('cls') in PHP Console?
You can try it like this: <?php echo "Mensagem antes de limpar\n"; echo "\033[2J\033[1;1H"; echo "Mensagem depois de limpar\n"; ?> Where the ANSI \033[2J really cleans the screen, but its…
-
2
votes4
answers1313
viewsA: Capture user-typed input with PHP Shell
The question is not very clear if it is using PHP together with Shell Script (another language), or if it is using the PHP CLI (per command line), so I will cite the two cases. Using the language…
-
3
votes1
answer667
viewsA: Paypal Api Automated Payments
In the API of Paypal there are several options, which you seek is called checkout transparent, but last time I saw (and now I sought to answer the question) that service Paypal not available in…
-
3
votes1
answer215
viewsQ: Validating routes in Lumen
In the Laravel have for example: Route::get( '/produtos/mostra/{id}', 'ProdutoController@mostra' )->where('id', '[0-9]+'); How this kind of validation would be done in the Lumen? Given that a…
-
5
votes2
answers5470
viewsQ: How is good documentation done using SCRUM?
I am developing documentation using the agile method SCRUM, I do not know if I am on the right track, and many people have difficulty in this, so I decided to realize such a question, currently put…
-
7
votes2
answers4162
viewsQ: Identify and retrieve PUT and DELETE variables
I’m developing a solution for API, I can currently identify the method by: $_SERVER['REQUEST_METHOD'] How can I get the variables PUT and DELETE? As in the GET and POST i use: $_POST; $_GET; When…
-
1
votes1
answer26
viewsQ: Security on a web system by checking other open content
I’ve seen some websites that have evidence online with monitoring, capturing which screens the user opened on the computer, be it browser tab or other software, this question can be closed because…
-
2
votes2
answers136
viewsA: "Robo-Human" Intelligent
See if it suits you: <form acton="#" method="post"> <input name="speak" /> <button>Go!</button> </form> <?php function clearId($id){ $special =…
-
0
votes1
answer195
viewsA: Determine web server root folder in Vagrant
I found out that the box scotch, edit the shared folder name by adding a /public on the way, soon would be: D:/Projetos/PHP/public/public, so I altered ../public/ for ../ and it worked.…
-
0
votes1
answer195
viewsQ: Determine web server root folder in Vagrant
Follows my Vagrantfile: # -*- mode: ruby -*- # vi: set ft=ruby : Vagrant.configure("2") do |config| config.vm.box = "scotch" config.vm.network "private_network", ip: "192.168.33.107"…
-
8
votes1
answer67
views -
0
votes1
answer117
viewsQ: Responsive mouse events with canvas?
I have the following code: var block = false; var context; var drawing; var rect; $(function() { context = $('#canvas')[0].getContext('2d'); drawing = false; rect =…
-
0
votes2
answers21
views -
0
votes1
answer80
viewsQ: When a 'cloned' struct is changed it changes all the others
I have the following statements: #define SCALE 4 #define PADDING 1.1 #define CUBES 27 #define CUBE_VERTICES 8 #define CUBE_FACES 6 #define FACE_VERTICES 4 typedef struct { float angle; float x;…
-
1
votes2
answers21
views -
3
votes1
answer601
viewsQ: Return local function variables
I have two methods: // Apenas define um vetor de 4 posições e retorna ele int *verticesFromFace(int v1, int v2, int v3, int v4) { int vertices[4] = {v1, v2, v3, v4}; return &(vertices); } //…
-
6
votes1
answer282
viewsQ: Is there any way to assign values to a vector faster?
For example, I have the statement of the following vector: float vet[3] = {1, 1, 1}; It would be possible to change all values of the same at once, without having to change one by one element or…
-
1
votes1
answer191
viewsA: Summarize dynamic text in PHP with jquery
Whenever I have to do it, I do it that way, which I find simpler: $(function(){ // escondo todos os textos completos $('.more').hide(); // quando clicar em ver mais $('.see').click(function(){ //…
-
0
votes1
answer33
viewsQ: Know when a file row starts with a given string
I have a file like this: # Blender v2.69 (sub 0) OBJ File: 'CUBO.blend' # www.blender.org mtllib cube.mtl o Cube.022_Cube.030 v 0.450000 -1.450000 0.550000 v 0.450000 -1.450000 1.450000 v -0.450000…
-
0
votes1
answer877
viewsQ: Read text file picking float numbers and playing in matrix
I have a text file for example with: v 1.000000 -1.000000 -1.000000 v 1.000000 -1.000000 1.000000 v -1.000000 -1.000000 1.000000 v -1.000000 -1.000000 -1.000000 v 1.000000 1.000000 -0.999999 v…