Posts by Fábio Jânio • 3,407 points
226 posts
-
2
votes2
answers70
viewsA: can use variable php within the functions
To answer your question you must first understand what is scope of variables. The scope of a variable is the context in which it was defined. In PHP most variables have local scope only. Scope types…
phpanswered Fábio Jânio 3,407 -
1
votes1
answer32
viewsA: Save column array or multiple records?
In the first approach you are creating multi-valued columns: Cliente | Bairros 1005 | 1,2,3,4,5,6,7,8,9,10,11,12 (ColunaArray) What’s the problem with this approach? Roughly speaking, every time you…
-
6
votes2
answers2720
viewsQ: Differences in the use of $this, self, Static and Parent
I have a question about the "proper" use of $this, self, Static and Parent in some specific scenarios. I know the meaning and theoretical use of each: $this: basically references the object…
phpasked Fábio Jânio 3,407 -
2
votes1
answer2057
viewsA: Call php file without leaving the page with HTML
In this case you can use requests Ajax, I believe that would be the only option for your case. To facilitate the work use the library jQuery. Assuming you’ve already included the library on your…
-
0
votes2
answers540
viewsA: PHP POO error Polymorphism
How we model our classes depends on the behavior (rules) defined for the application. In the model below I considered that in its application, a person cannot simply be a Person (direct instance of…
-
1
votes1
answer33
viewsA: Enter data in db by php
It would be interesting to have access to your file connects.php to be able to provide a more appropriate assistance, however, I believe that your problem can be solved by using:…
-
3
votes1
answer36
viewsA: Object-Oriented Programming Simple Doubt with Implements
Well, in this case this signature is obliging the value passed to implement the interface Textelementinterface. The example below is very simple, but I believe it is suitable for the question:…
-
1
votes1
answer513
viewsA: Does changing the Docker-Compose reflect in the current container?
The idea of a container at Docker is just that it’s ephemeral, which means it could die at any moment. Following this idea, in my view, it would not be appropriate to change the port of a container…
-
3
votes1
answer2127
viewsA: Why can’t the web server find my route?
Currently your Rewriterule is like this: RewriteRule ^(.*)/$ /$1 [L,R=301] Since the index.php file mapped by the server as default file for search and upload is inside the directory public,…
-
3
votes1
answer670
viewsA: How does the imagecreatetruecolor function work? PHP
Briefly we could say that: The functions below are part of the GD library, which in turn was developed for the processing of images. It is a library open source for dynamic image creation by…
phpanswered Fábio Jânio 3,407 -
1
votes1
answer1338
viewsA: How to prevent automatic container start-up when starting Docker
According to the official documentation when setting the parameter --Restart= Always I will be setting up an automatic re-start in case of a stop, whether forced or not. This means that if I turn…
dockeranswered Fábio Jânio 3,407 -
-1
votes1
answer1338
viewsQ: How to prevent automatic container start-up when starting Docker
I have Docker installed on a Macos, when starting the Docker application my containers are being started automatically. How do I stop this auto start behavior?
dockerasked Fábio Jânio 3,407 -
0
votes0
answers99
viewsQ: How to backup a custom image?
When backing up a custom image, which is based on another. Docker handles this dependency, i.e., exports both?
dockerasked Fábio Jânio 3,407 -
4
votes2
answers2564
viewsQ: Doubt about marking "volumes" inside the Docker-Compose.yml
The Docker-Compose.yml below has been taken from the Docker documentation itself. My question is: why inside the db container we have the reference of volumes and at the end of the file the same…
-
0
votes0
answers44
viewsQ: Container Apache + Nodejs, how to create?
I climbed a container with Apache + PHP, however, I need to use the Laravel-mix, soon need the npm and nodejs. Everything works ok, however, at a certain point I saw that the container restarted,…
-
0
votes1
answer1182
viewsQ: Doubts about communication between containers
I have a question about the communication between containers, in my Docker-Compose I am creating a link between the container web and mysql. This link would be an internal network? If not, it would…
-
3
votes1
answer1815
viewsQ: What is the real usefulness of Docker-php-ext-configure and Docker-php-ext-install?
I’m taking the first steps with Docker, soon came the question, what is the Docker-php-ext-configure and Docker-php-ext-install? Example: RUN apt-get install -y libpq-dev libsqlite3-dev RUN…
dockerasked Fábio Jânio 3,407 -
1
votes2
answers1060
viewsQ: Doubts about the Docker-Compose and Dockerfile configuration
I went up a small development environment. There are 2 containers: mysql (mysql:5.7) web (php:7.1-apache) My question is in a configuration parameter of Docker-Compose.yml and Dockerfile…
-
2
votes1
answer55
viewsQ: Problem with Dockerfile
I’m trying to generate an image, but I’m getting the error: E: Command line option 'O' [from -O] is not understood in combination My Dockerfile: FROM debian:stretch MAINTAINER Fabio J L Ferreira…
dockerasked Fábio Jânio 3,407 -
2
votes1
answer435
viewsQ: With Docker, should I use Composer in the container or host?
I have some questions about the development environment. I have a project in Laravel and I’m using Docker. When using Composer or Artisan from Laravel, what is the right place to do this? On my host…
-
0
votes0
answers167
viewsQ: Difficulty organizing/controller structure in Laravel
I’m having trouble structuring my controller Arquivocontroller. Main points of difficulty: Select that repeats in different methods I am restricting the search for the logged-in user ID, it would be…
-
6
votes1
answer1821
viewsA: How to send an email after user registration has been done? Laravel 5.4
For this purpose you can use Laravel’s own triggers, I’m referring to Observers. One of the advantages is that you are already using something ready, which is part of the core of Laravel. Not to…
-
1
votes0
answers35
viewsQ: Problem with css and html file caching
I am having difficulties in my development environment, I am changing my css and html files and these are not reproducing the changes in the browser. "How can I configure in Virtualhosts of apache2…
apacheasked Fábio Jânio 3,407 -
1
votes1
answer211
viewsQ: Set sender name via Resetpasswordnotification
I am using Notification in Laravel to send password reset emails. My toMail method is like this: public function toMail($notifiable) { return (new MailMessage) ->subject('Link para redefinição de…
laravelasked Fábio Jânio 3,407 -
0
votes1
answer38
viewsQ: How to identify the data type returned from a controller?
I noticed that when creating a controller in Laravel it informs that some methods will return an object \Illuminate\Http\Response. I used a dd() at the end of the method and saw the following…
-
1
votes1
answer167
viewsQ: How to generate directory list and perform actions for each list item?
I am trying to build a Shell Script that stores directories exists at the root of /Volumes and perform an iteration on these, ignoring only the directory: "Preboot" and "Macintosh H"
bashasked Fábio Jânio 3,407 -
-2
votes3
answers461
viewsQ: Is there a significant difference in performance when using Netbeans IDE with JDK 9 instead of JDK 8?
There is some significant difference in performance that justifies using Netbeans with JDK 9 instead of JDK 8? Briefly, I’d like to know if Netbeans performs better (lower memory consumption,…
-
3
votes2
answers219
viewsQ: Container LAMP with Debian Stretch
I performed some searches on the internet and found no instructions for mounting a LAMP container using the official Debian Stretch image (https://hub.docker.com/_/debian/). The idea would be to…
-
0
votes1
answer186
viewsQ: How to activate all virtual hosts in a Docker container
Considering the files below, how can I build enable all virtual hosts (present in the volume: . /Apache/)? Docker-Compose.yaml: version: "3.3" services: mysql: container_name: mysql image: mysql:5.7…
-
0
votes1
answer206
viewsQ: Open interactive terminal
I have the following Docker-Compose: version: "3.3" services: mysql: image: mysql:5.7 environment: MYSQL_ROOT_PASSWORD: root MYSQL_DATABASE: mydb MYSQL_USER: root MYSQL_PASSWORD: root restart:…
-
2
votes2
answers1212
viewsQ: How to pass parameters to the Resource controller directly from the View with Helper url()
I have the following route on my Laravel app (v5.5): Route::resource('tags', 'Painel\TagsController'); In accordance with documentation official, this gives me a route with action Edit, verb GET and…
-
1
votes1
answer390
viewsQ: How to work with billets in the Pay PHP API.me
My difficulty is in making the Parsing of data returned in the boleto generation. My goal is to take this data and make some transformations, such as formatting the date/time and some other changes…
phpasked Fábio Jânio 3,407 -
1
votes1
answer133
viewsQ: Installing web environment with shell script
The shell script below performs some simple tasks for me, however, I would like to leave the code a little but elegant: #!/bin/bash echo "#######################" echo "Preparando servidor web" echo…
-
1
votes1
answer56
viewsQ: Preparing Linux Development Server
I am using the Debian 9 distro on my server, while searching through PHP packages I noticed that php-fpm seems to be an alias for php7.0-fpm. If I am correct, I can install my packages like this:…
-
1
votes1
answer318
viewsQ: How to free access to Mysql in-app on Azure?
I have a web application on the Azure platform, this application has a "built-in" Mysql, that is, including within the application itself. I wonder if I can free up external connection to this bank…
windows-azureasked Fábio Jânio 3,407 -
1
votes2
answers485
viewsQ: Network interfaces on Docker
In Virtualbox we have the network interfaces, for example, bridge, Nat, with host, etc... My question is, can Docker expose a host-only port? Something that in Virtualbox would be equivalent to the…
dockerasked Fábio Jânio 3,407 -
24
votes1
answer6515
viewsQ: Docker vs Vagrant, what are the main differences?
I recently had an outbreak of interest in the tool Docker. I am aware that Docker and Vagrant are virtualization solutions, however, with different approaches. In my study there were some doubts…
-
2
votes2
answers7324
viewsA: What is a lock and what are its causes?
In a database, when we perform some DML (update, Insert, delete) operation we are locking, that is, we are blocking certain object. This prevents another operation from making a change to the table…
-
1
votes1
answer28
viewsQ: What is the best strategy to create a record and associate with another by means of a pivot table?
The section below takes the user’s session data, uses the method posts present in the model User to create a new post in the bank. Later I recover the id of the created record and associate this…
laravelasked Fábio Jânio 3,407 -
4
votes1
answer309
viewsQ: How to recover categories linked to a post?
I climbed on Github (https://github.com/fabiojaniolima/larablog-beta) a small project in Laravel, something very initial. I intend as soon as possible to arrange the routes, structure the methods,…
-
1
votes0
answers39
viewsQ: How to auto fill a fk in Laravel using session data?
I have two tables, posts and users. The posts table has a relationship with the users table through the column user_id. The question is this: in the controller I am using a merge to fill the user_id…
laravelasked Fábio Jânio 3,407 -
1
votes0
answers19
viewsQ: Doubt about memory address and pointer
The return of the printf function in the code below represents the memory address occupied by to? #include <stdio.h> main() { int a = 123; int *b = &a; printf("%d", &a); printf("%d",…
casked Fábio Jânio 3,407 -
0
votes0
answers53
viewsQ: Doubt when using variables
#include <stdio.h> main() { float valor; printf("..."); scanf("%f", &valor); printf("%0.2f", valor); } In scanf I must refer to the pointer (memory space), already in printf this reference…
casked Fábio Jânio 3,407 -
2
votes2
answers50
viewsQ: Where should a globally used method be located?
I have a method called parser, in short your code is: public function parser($local) { $file = storage_path($local); $csv = Reader::createFromPath($file); // remove cabeçalho (ignora a primeira…
-
5
votes1
answer423
viewsQ: What is the hash generation algorithm that Laravel uses?
By default Laravel already comes with a pre-ready authentication system, however, someone would know tell me what the algorithm is default that this framework use for generation of hash and what…
-
9
votes2
answers4636
viewsQ: What is the csrf_token present in the Laravel layout file for?
I am aware that to submit a form in Laravel, you must add a csrf_field, or declare that the route must ignore this protection. However, in the layout file there are the following occurrences:…
-
0
votes1
answer335
viewsQ: How to work with Resource on Laravel?
My question is basically the actions/actions Store, Update and Destroy. I want to create a new record in the database, I must use the verb POST to call the action store? I want to update an existing…
laravelasked Fábio Jânio 3,407 -
6
votes4
answers1662
viewsQ: Comparing and updating data from an HTML table with data returned via JSON?
Problem: I have a table that is populated by data coming from multiple JSON files, so far no problem. The point is, I need to update the data if the values contained in JSON are different than in…
angularjsasked Fábio Jânio 3,407 -
2
votes1
answer201
viewsQ: How to find values and apply attributes using Angularjs?
I need to scroll through two specific columns of a table, locate the subtraction (-) and sum (+) symbol to apply one of the following rules: For the subtraction symbol (-) color the text red; For…
angularjsasked Fábio Jânio 3,407 -
3
votes1
answer83
viewsQ: How to identify in the constructor the method that was called?
How do I stop at builder of my controller identify which method was called? I’m using the Laravel 5.3 and my controller follows the pattern resource (index, show, edit...).…