Posts by Thiago • 895 points
23 posts
-
0
votes1
answer48
viewsQ: Variable defined with Let/const is not "identified" by this
When I perform a direct function of the global scope that references any property through the this using var the variable is displayed correctly, but when I declare the variable with let/const the…
javascriptasked Thiago 895 -
6
votes1
answer83
viewsQ: Display conditional text snippet with regex
I am trying to create a dynamic text "generator" that will replace patterns with data from an array using regex, the structure is as follows: Hello, [user], your registration was made in…
-
3
votes1
answer46
viewsQ: Use of generators with while results in infinite loop
I made a small example of using generators to better understand how it works in php. the method getValues is an example of values that would come from a database or any other data source that…
-
2
votes2
answers49
viewsQ: Query to return minimum amount of "different" values
I have a table called clientes and this table has a column status which may have +/- 3 types (novo, cancelado, pendente...) need to display a quantity of information separated by status, and instead…
-
1
votes1
answer717
viewsQ: Service, Model and Repository: where should logic, validations and possible external communication be?
I’m doing a small project for learning purposes using Laravel, this system revolves around two "models", Conta and Transacao. one Conta has name and balance, a Transacao has count_source,…
-
10
votes2
answers573
viewsQ: Global variable returns Undefined when using this in Node.js
I’m studying about the special variable this and I came across the following situation: When executing the function below in Node.js (version 12.18.3) the result is undefined and only returns 2 if I…
-
2
votes1
answer425
viewsQ: remove an improper commit from history but keep current changes in files
I cloned a remote repository and soon after that I had to pull some files from a specific branch and it looks like it was merged (unintentionally) into the master itself, then created a new branch…
-
0
votes1
answer51
viewsA: Laravel query returns "wrong" result
After running all over the internet looking for this, it turned out the mistake was that I was sending the values of preco_fipe as string and so it generated this "strange" result, when I converted…
-
1
votes1
answer51
viewsQ: Laravel query returns "wrong" result
I have a table called "tabela_precos", with the following structure: categoria_veiculo_id | valor | preco_min | preco_max | tipo_veiculo 22 77,70 0 2500 carros 22 30,35 15000 20000 carros When I run…
-
2
votes1
answer104
viewsQ: Configuration file and/or Constants, when to use?
Currently I use constants to store configuration data in my application, but searching saw that it is a "bad practice" by coupling that can generate, I found some questions right here in…
-
3
votes2
answers1874
viewsQ: Take custom attribute value "data-attribute" within a loop
I want to select all custom attributes and do a validation with them, but I don’t know how I can get the "attr" value inside a loop, since they are the ones being iterated. HTML example: <input…
-
2
votes1
answer385
viewsQ: How to pass PDO to other objects in MVC OOP application
I’m developing a small framework for learning purposes, and one of the ways I found to pass the PDO object to be used in controllers/models was using the following approach: The constructor method…
-
2
votes1
answer164
viewsQ: Good practices for class that grows a lot
Supplementing a question I posted here some time ago, about a system for user registration using concepts of the SOLID standard, one of the problems I faced was the question of the User class being…
-
5
votes1
answer150
viewsQ: Case of use of the SRP concept in a real application
I’m studying some concepts of OOP and I see a lot about the issue of SRP, "separating actions into classes etc". at the level of testing, I decided to create a small system for registering users in…
-
0
votes2
answers3358
viewsQ: Javascript code does not work on Chrome
I’m starting with javascript and I made the following code below, only it’s not working on google Chrome, why? HTML <!DOCTYPE html> <html> <head> <meta charset="utf-8">…
javascriptasked Thiago 895 -
-2
votes1
answer1897
viewsQ: How to align all the elements of a form in the center?
I’m trying to align the elements of a form in the center and leave the tag label in the left part of the fields, this way: HTML: <form> <label for="info">Seu Texto</label>…
-
2
votes1
answer364
viewsQ: Align form elements to the center?
How can I center input/textareas (but I want the label to stay on the left)? form { width: 700px; color: red; } form textarea,input { display: block; margin: 0 0 30px 0; } <form> <input…
-
1
votes2
answers8633
views -
3
votes1
answer13146
viewsQ: How to put 2 inputs side by side?
How can I put 2 input aligned side by side? <li> <input type="text" /><input type="checkbox" /> </li>…
-
1
votes1
answer110
viewsQ: Is using functions like parameters for other functions slower?
I’m taking information from a site that generates content in format JSON and a question arose about using functions as parameters of other functions, this slows down the application? and if so, how…
-
16
votes2
answers450
viewsQ: Getters and Setters can only "walk" together?
I am studying object orientation and am having some doubts in the encapsulation part. For example: Class Url { private $url; public function setUrl($url) { if (filter_var($url, FILTER_VALIDATE_URL))…
-
7
votes4
answers8045
viewsQ: Create button with icon next to
I’m trying to create a button with icon on the side, I’m using icons of the bootstrap framework, I’m breaking my head to do it, I know the bootstrap has a component that does it, but it’s in another…
-
2
votes2
answers1432
viewsQ: Distribute <li> list in 3 columns
I’m trying to create a list with 5 blocks, 4 230X140px and 1 250X280px , but they don’t align side-by-side correctly, they’re like this: I wish they’d stay that way: codes: HTML <ul> <li…