Posts by Wallace Maxters • 102,340 points
1,984 posts
-
2
votes3
answers881
viewsQ: How to calculate difference of dates that are a previous row with MYSQL?
I have a table where I record the time when a particular request had its status_id changed. This table I call historico_status_solicitacoes. In this table, I have the following fields: id,…
-
0
votes1
answer679
viewsA: Is there any way to send an attachment along with the BOT message from Telegram?
As indicated in the comments by @fernandosavio and also in the documentation of Telegram, it is possible to use the method sendDocument. A few points should be observed: The field caption may have…
-
5
votes2
answers240
viewsQ: How to make a sequence of boxes with the triangular border on the right, on top of the other, box with CSS?
I didn’t know a better title to describe my need, but in fact, I would like to be able to make a sequence of boxes whose right edge was in a triangular shape, superimposed on the subsequent box.…
-
1
votes1
answer117
viewsA: Socket PHP keeps falling
There’s a process control system I use called Supervisord. It allows you to start a process. The same, if the process falls, tries to start it again, according to what you set up. You can install it…
-
3
votes1
answer672
viewsA: How to convert date time to ISO 8601 format in PHP?
Just start the constructor of DateTime passing your string as parameter: $date = new DateTime('2018-10-23T12:05:18.18UTC0TUE') And use the method DateTime::format to format in ISO8601…
-
4
votes1
answer124
viewsQ: Is it possible to make Polyfill for Arrow Function and Template String?
The functionality of Template String and Arrow Function are excellent to facilitate some Javascript operations. However, it seems that not all browsers still support the same. In many cases of lack…
javascriptasked Wallace Maxters 102,340 -
13
votes2
answers215
viewsQ: What is the Javascript Cache class for?
I saw that Javascript has a class called Cache. From what little I could understand, it seems to have something to do with requisitions. I wanted to know a little more about this class: Does it…
javascriptasked Wallace Maxters 102,340 -
2
votes1
answer156
viewsQ: How to add a custom font to TCPDF?
I’m using TCPDF to generate (obvious) Pdfs and need to add a custom source. I took a look at documentation and there it says that has a method called addTTFfont . The problem is, when I try to call,…
-
1
votes2
answers710
viewsA: Do I need to use a middleware auth on the controller if I use Gates from Laravel?
It doesn’t make sense what you want to do. One thing is the middleware auth, another is Gate. One checks authentication, another checks permission. The middleware auth is intended to allow user…
-
1
votes1
answer540
viewsA: Laravel and Github
The question is, is this the right way to get a project into git? Ignoring . env and in case I need to work on the project again, create a file . env based on .env.example and filling the keys? Yes,…
-
1
votes1
answer296
viewsA: move_uploaded_file returns only FALSE
Have you checked what’s worth error the variable $_FILES['img'] ? The value 'error' returns 0 when there is no error in the upload. PHP provides the constant called UPLOAD_ERR_OK to check if the…
-
4
votes1
answer59
viewsQ: Is there a technique for reporting Javascript errors?
The following is as follows: I use the Laravel Framework and, in it, configure the application so that when any server error occurs, it sends me an email, writes in a log file and/or sends me a…
-
2
votes1
answer129
viewsQ: Filters in Vue only work with interpolation, they don’t work with v-text. Why?
I know to use a filter on Vue, you can make the call as follows: Vue.filter('hello', function (input) { return "hello, " + input; }) new Vue({ el: "#app", data: { name: "Wallace", } }) <script…
-
4
votes1
answer76
viewsA: Javascript converts string to int when passed as function parameter
It is because its concatenation makes the value passed as an integer in the expression. That is, assuming the value of dados[i].cnpj be a string "1046", when mounting the expression…
-
5
votes1
answer867
viewsA: How to filter time in a datime field in eloquent?
Whereas you want to disregard the date but consider only the time, you need to use the function TIME Mysql to format column with format datetime for time format. Therefore, it is necessary to use…
-
10
votes1
answer423
viewsA: VUE v-for value filter
You can use the computed to solve the problem. Thus: new Vue({ el: '#app', data: { meus_valores: [/** **/] }, computed: { meus_valores_filtrados: function () { return meus_valores.filter(function…
-
0
votes1
answer87
viewsA: How to get the html of the page after loading javascript, using Guzzlehttp
When you use the Guzzle, the value returned by getBody is an object. That object is the GuzzleHttp\Stream\Stream. By default the class json_encode usually brings confusing results when you try to…
-
2
votes2
answers811
viewsA: "Illegal string offset" error when calling usort in database data
The first step of everything is to try to translate the error to know what it is. Illegal string offset is returned when you try to get a offset of a string, passing a string per parameter. Behold:…
-
2
votes2
answers1138
viewsA: Jquery - Make ENTER trigger a button
Generally, you can use the event.keyCode === 13 to check if ENTER has been pressed. You need to use Event keydown, keyup or keypress for that reason. Example: $('#input').on('keydown', function (e)…
-
2
votes1
answer519
viewsA: How to save click id on a PHP session?
You’re mixing PHP with Javascript. First you need to understand two things: PHP is a server-side language - it runs on the server side. Javascript is a client-side language - it runs on the client…
-
1
votes1
answer27
viewsA: Take advantage of
Because I’m using Laravel, I can see there’s a lot wrong with your code. But what could be done, by responding objectively, would be to use the $this to assign the value to it. Thus: class…
-
1
votes2
answers89
viewsA: Closure and Magical Methods
Which of the two methods is best considered when it comes to good programming practices? It depends on how many times you will use the function. I would say Closures should be used only when you…
phpanswered Wallace Maxters 102,340 -
1
votes2
answers388
viewsA: Directory listing appears with dots, how to remove?
In PHP we also have the SPL class called FileSystemIterator, that uses an iterator to list the directories of a file. By default, the FileSystemiterator comes with a second parameter called…
phpanswered Wallace Maxters 102,340 -
12
votes1
answer193
viewsQ: What is the purpose of Object.is?
I realized that Javascript now has the Object.is and, according to the documentation: Object.is determines whether two values correspond to the same value. Some doubts have arisen about this: Why…
-
9
votes3
answers4332
viewsA: Passing HTML Parameters to Javascript
Your code has too much structural error. First, on this line: var pessoa1 = new pessoa(document.getElementById('nome')); You are assigning the element returned by getElementById to the property…
-
2
votes2
answers102
viewsQ: How to convert the If-Modified-Since header to a date (and vice versa)?
The header If-Modified-Since displays the following return format: Wed, 21 Oct 2015 07:28:00 GMT I need to compare this date that comes in this header item with the creation date of a file on my…
-
4
votes1
answer252
viewsA: Problem of Laravel routes
The way I see it, it looks like you’re wearing Route::resource before setting the route atualizacoes.listar. You need to remember that when you use Route::resource, it will create a route that has…
-
17
votes2
answers3144
viewsQ: Is there a REST specification for uploading files?
I’ve been having second thoughts about it for almost a month. In certain to my application, the user can upload to a file library. This upload needs to be recorded in a table called midias, where,…
-
4
votes2
answers160
viewsA: Decrease Field Size Edit
First question: why are you wearing table to align the elements? This is conceptually wrong. Use table for tabular data only. Bootstrap provides the row, which allows the alignment of elements by…
-
2
votes2
answers402
viewsA: How to make a mockery (consult only after you finish typing in the input) in VUEJS?
I decided to publish a reply to register the way I solved the problem. I used a mocking technique for Javascript, based on a setTimeout. Behold: new Vue({ el: '#app', methods: {…
-
0
votes2
answers402
viewsQ: How to make a mockery (consult only after you finish typing in the input) in VUEJS?
I come from Angularjs and, at certain times, when I need to make a query according to what the user is searching, I use ng-change, but I agree with him ng-model-options="{debounce: 500}". This makes…
-
0
votes1
answer485
viewsQ: How to disable modal closure via the ESC key in the modal of the UI-Bootstrap?
In the ui-bootstrap, i can disable the modal closure by clicking on the black background through the option {backdrop: 'static'}. But now I also need to turn off the key ESC, because when you press…
-
2
votes1
answer2585
viewsA: Protect php files from direct access without locking to the system
I’m going to be simple and straightforward. The solution I would give for this would be to structurally divide in the application what is public of what is not. Like? Creating a folder that contains…
-
1
votes1
answer281
viewsA: How do I place a function inside ng-bind-html?
The problem I believe that in your case the approach is wrong. It seems you are trying to define the content of a button created dynamically within a div. The problem of doing this with ng-bind-html…
-
3
votes2
answers1988
viewsQ: How to get the last day of a month with Momentjs?
I’m using MomentJS and I need to pick up the first and last day of the current month. Currently, to catch the first day of the month I’m doing so: var data_inicial = moment().format('01/MM/YYYY') So…
-
2
votes2
answers1988
viewsA: How to get the last day of a month with Momentjs?
You can use the method endOf and add the parameter 'month'. Example: moment().endOf('month').format('DD/MM/YYYY')…
-
5
votes1
answer9432
viewsA: How to discover the chat ID via the Telegram API?
To find out the chat ID in question, you need to access the method getUpdates of the Telegram API. Using Guzzle himself would look like this: $cli = new \GuzzleHttp\Client([ 'base_uri' =>…
-
4
votes1
answer9432
viewsQ: How to discover the chat ID via the Telegram API?
I am configuring the Telegram BOT API via Guzzle. I am trying to understand what the parameter would be chat_id described in the method documentation sendMessage. I have the following code: $cli =…
-
36
votes5
answers4828
viewsA: With CSS is it possible to put 2 colors in 1 letter? Or half the text with a different color?
The closest I could get was using background-clip: textand text-fill-color: transparent. Behold: .two-colors{ font-size: 160px; background: linear-gradient(to right, blue 50%, red 0);…
-
0
votes1
answer679
viewsQ: Is there any way to send an attachment along with the BOT message from Telegram?
I am using the Telegram API to send error logs from my applications. I display some key information but would also like to display the trace exception. The problem is that Telegram returns an error…
-
3
votes2
answers54
viewsA: Which event should I associate with select?
You need to use the event change in the select, and not in the option. Thus: $(document).ready(function() { $("#btn1").click(function(){ $("p").hide(); $('#categoria').val("other"); });…
jqueryanswered Wallace Maxters 102,340 -
5
votes1
answer55
viewsA: Is it possible to assign a native function to a variable?
In javascript, object methods in Javascript have a context. When you use some native object and try to assign a method like this to a variable, to call it later, you will receive a Illegal…
javascriptanswered Wallace Maxters 102,340 -
8
votes2
answers1283
viewsA: How to access the elements of a set (set)?
The set has as its purpose define a single list of elements. One was able to do that would be convert to list and get the value through the index. Thus: a = set([1, 2, 3, 4]) print(list(a)[0])…
-
6
votes2
answers505
viewsA: How to limit the interval between two dates in the <input type="Month">?
It is possible to limit the "range" between two dates in the <input type="month">? You can use the attributes min and max. Thus: <input id="aniversario" type="month" name="aniversario"…
-
2
votes1
answer86
viewsA: Helper problems in Laravel 5.6
Probably the problem is you’re using App\FunAuxiliar.php, instead of app\FunAuxiliar.php. To my knowledge, in Laravel, the default application folder is app and not App. On operating systems like…
laravel-5answered Wallace Maxters 102,340 -
2
votes1
answer318
viewsQ: Is there any way to generate Migrations based on an existing database in Laravel?
When I used Python’s Django, I was surprised by the command inspectdb, that is able to generate models based on an existing database. At Laravel, we have Migrations to work with the database, and I…
-
5
votes3
answers738
viewsQ: What is the $() [dollar sign followed by parentheses] for in BASH?
I’ve seen some examples of code in the BASH where it’s used $() to be able to execute a command. For example: sudo chown -R $(whoami) . What this means followed by the enclosed command in…
bashasked Wallace Maxters 102,340 -
0
votes1
answer415
viewsA: How to insert a query value into a variable in the Shell Script?
I ran a test and I believe you can solve it using the command encompassed by $() Thus: aux=$($ns | jq -r ".p | .nome[$i]") The test I did here was using the command $ls, thus: ls='ls' result=$($ls…
-
7
votes1
answer384
viewsA: Send GET parameters to a php using the exec command
From what I see, you are trying to pass an argument to the PHP script that runs on the command line. On command line, not used $_GET to access arguments from a script. You must use the variable…
-
8
votes1
answer132
viewsA: How to prevent pseudo-element (:before or ::after) within a <a> tag from being clickable?
You can use the pointer-events: none; Behold: .link { visibility: hidden; position: relative; } .link:after { visibility: visible; content: 'Texto visível'; position: absolute; left: 0; top: 0;…