Posts by Leonardo Getulio • 1,143 points
52 posts
-
1
votes2
answers43
viewsA: Take a label by Parent() or id and replace
I simulated a small example based on your model, see if it helps you: $(document).ready(function(){ const listaParaReplace = $('.identificador-replace'); for (i = 0; i < listaParaReplace.length;…
-
1
votes1
answer70
viewsA: How to catch the return of the post on my Scope Angularjs?
The angular returns the data in response.data and not in response. Tip: debug the output of responseto see what is coming out, if it is a different object than expected, it is very common to notice…
-
0
votes1
answer78
viewsA: In the Object.assign() method, and result visually is the same, regardless of whether [{}] is assigned or not
In the clone you passed [{}] as source, the interpreter will understand as an empty array object and fill in with the new object. In the clone2 you have done nothing but create a reference to the…
javascriptanswered Leonardo Getulio 1,143 -
0
votes2
answers48
viewsA: Javascript, Function that groups strings according to parameter value
Better codes will appear, here comes my humble little suggestion: function test(line_size){ return function(text){ if (!text) { return []; } let remainingText = text; const result = []; while…
javascriptanswered Leonardo Getulio 1,143 -
2
votes1
answer1057
viewsA: How to recover user IP using Node
Utilizes req.connection.remoteAddress in processing the request. Example with several possibilities: const ipCliente = req.connection.remoteAddress || req.socket.remoteAddress ||…
-
1
votes1
answer69
viewsA: How to check if one variable is INT and the other is a String?
Check the variable type using the command typeof, store the value in a variable and check if the value is what you want. Follow a short example: valor1 = 1; valor2 = '1'; tipoValor1 = typeof valor1;…
javascriptanswered Leonardo Getulio 1,143 -
1
votes1
answer75
viewsA: How to know the route before redirecting at Angular 4
I suggest creating an event to listen to the route change in its main component relative to the <router-outlet> and publish the modifications on a service by capturing them on your 404 page.…
-
1
votes1
answer393
viewsA: Compare two object arrays and remove the difference in javascript
Small example of a filter: const categorias = [{ id: 1, nome: 'Categoria 1' }, { id: 2, nome: 'Categoria 2' }, { id: 3, nome: 'Categoria 3' }]; const produtos = [{ nome: 'Produto 1', category_id: 1…
javascriptanswered Leonardo Getulio 1,143 -
1
votes1
answer125
viewsA: VS Code is not commenting. Has anyone ever come across this problem?
HTML comments are made by opening the tag <!-- and closing in -->. Example: <!-- comentario.. --> <!-- comentario 2 segunda linha --> // and /* */ are for javascript (and other…
visual-studio-codeanswered Leonardo Getulio 1,143 -
1
votes2
answers580
viewsA: Angular ignores *ngFor in select option
I noticed a detail in your code, maybe it’s the cause. You declared the form variable itemForm: FormGroup with the name itemForm and initialized as bankAccountForm. I don’t know if it’s two…
-
1
votes3
answers326
viewsA: Convert date string without punctuation in Date Javascript format
You will need to manually format because javascript does not accept custom formatting of inputs/date entries. As long as you always work in the same format, you can use the function below: sdata =…
-
2
votes1
answer23
viewsA: Problem with select using ng-repeat
Your code is missing in the ng-model of <select>, you are modeling the variable usuarios which is the same variable that contains array of users used in <option ng-repeat="user in…
-
0
votes1
answer86
viewsA: Javascript algorithm to count down a specific time
I suggest turning everything into seconds and then manipulating the result by time division. Here is a short example: const horaAtual = new Date(); var nAcordarHora = new Date();…
javascriptanswered Leonardo Getulio 1,143 -
4
votes2
answers269
viewsA: What is the maximum size of a variable of type int in Javascript?
The largest size of an integer is 9007199254740991, you can check using Number.MAX_SAFE_INTEGER
javascriptanswered Leonardo Getulio 1,143 -
1
votes1
answer274
viewsA: How to find out which program running in the foreground in windows, preference in python
This code shows who is running, it is a loop but serves as an example: import win32gui import time import psutil import win32process i = 0 while i <= 1: time.sleep(1) w = win32gui w.GetWindowText…
pythonanswered Leonardo Getulio 1,143 -
1
votes2
answers104
viewsA: Translate date return and manipulate days
Hello, to do this I suggest you two ways. The first would be to set the locale at Angular so it translates to the desired language automatically. The second would be to create an array with months…
-
0
votes3
answers623
viewsA: Wait Thread Finish to continue code - Delphi
Follow below mutex codes and traffic lights. The Mutex creates a single lock in memory that can be validated even by other non-Delphi applications. Some advantages are simple implementation and…
-
1
votes1
answer433
viewsA: Problems to pick up input value in modal Angularjs
This is the code working right below. First I’ll explain 2 extracts of the modal component. You should listen to the end of the modal with .then() and manipulate the result. I did this by setting a…
-
1
votes5
answers431
viewsA: Go to certain link depending on the page
The correction of your code should look +/- like this: var url = window.location.href; if(url === 'tela03.html'){ window.location.href = 'tela04.html' }else if(url === 'tela05.html'){…
-
9
votes2
answers245
viewsA: What’s the benefit of signing a commit with a GPG key?
GPG is an end-to-end encryption system using pairs, in this system data is encrypted on sending and decrypted on receiving. It is also used in digital signatures "so that the integrity and sender of…
gitanswered Leonardo Getulio 1,143 -
2
votes2
answers256
viewsA: Close Load when opening modal
bootstrap launches an event where you set up a callback to run after the modal is displayed. Example: $('#addClientem').on('shown.bs.modal', function () { //seu código aqui para pós abertura }) If…
-
3
votes1
answer49
viewsA: Creating Run Time Components in Windows Service
A Delphi service cannot create a Tmemo because it is a graphic component and needs a "Parent" designed to draw inside it. The most correct solution in your case to manipulate these texts would be to…
-
2
votes2
answers239
viewsA: Checklist using checkbox, javascript and Localstorage
function checkItem(item) { var check1status = document.getElementById(item).checked; document.getElementById(item).checked = check1status ; …
-
0
votes1
answer355
viewsA: How to place a spinner on the button according to the service. Angular 2+
I do it this way and I’ll share an example, maybe it’ll work for you. I suggest creating a variable to control when the spinner will appear and control this variable in the request. Example using…
-
2
votes2
answers525
viewsA: Check if the Base64 character set is an image
Daria yes, you will have to decode and validate the header. In the case of your example Base64, it decodes into something close to GIF89a=D,3uXg3̿ϟ [...], then you can validate if there is GIF at…
-
1
votes1
answer195
viewsA: Sort method of my flatList
To sort by the time use this code similar to the one I sent you before by date: let listaRecebida = [ {"period": "2019-10-19T19:00:00.000-03:00"}, {"period": "2019-10-11T11:00:00.000-03:00"},…
-
1
votes2
answers285
viewsA: How to use 'filter' in a flatlist (json API)
Follow this example adapting your received object that will give right: let listaRecebida = [ {"period": "2019-10-19T00:00:00.000-03:00"}, {"period": "2019-10-11T00:00:00.000-03:00"}, {"period":…
-
0
votes1
answer46
viewsA: How do I return the date?
To do straight in rendering you can use so: <Text style={{color: 'black'}}>{new Date(item.period).getDate()}h</Text> It will return you the day of the month as you wish, in case the…
-
0
votes1
answer66
viewsA: URL replicating path each time I hit F5
Changes the auth/loginfor /auth/login, and the login for /login.
-
1
votes1
answer100
viewsA: get name and properties fonts installed in windows on Delphi
I stopped Delphi a long time ago, I’m a little outdated, but I got this sample code on the Internet and it works. You have to run the application with permissions at the administrator level:…
delphianswered Leonardo Getulio 1,143 -
1
votes1
answer26
viewsA: Input capture of an angled form
I’d do +/- like this: var myApp = angular.module('myApp', []); myApp.controller('myController', function myController($scope) { $scope.valorSelecionado = ''; $scope.checkboxObj = [ {nome:…
-
1
votes2
answers173
viewsA: Click event to tag tr of a table
$(document).ready(function(){ $("#modelTable > tbody > tr").on('click', function() { console.log("clique"); …
-
1
votes1
answer381
viewsA: Pass PHP variable value inside while loop for javascript
By following your model you can do something like this: <?php $i = 1; while ($i < 10) { $codigo = $i; $i++; ?> <button type='button' title='Sem Contato' data-toggle='popover<?php…
-
0
votes2
answers1783
viewsA: How to add item to an array list at angular
Deborah, I couldn’t understand your code because it has a routine this.cenario.push() and an object cenario in ngModel. I imagine that the first would be an array of scenarios and the second an…
-
0
votes1
answer115
viewsA: How to make an auto complete in the Standard
I changed some things in your code and typeahead here made the requests, basically I reversed the parameters query and proccess, and added the call process.process(data) on the return. I am using…
-
0
votes2
answers41
viewsA: Write to a file from another PHP site
There are "n" ways to do this, let me give you an example of 2. You redirect your form to send to the second site, the fields should have the same ID’s to the site that will receive interpret them…
phpanswered Leonardo Getulio 1,143 -
1
votes2
answers86
viewsA: Nan in javascript tabulated algorithm
This line is incorrect brother: item.text =`${n} x ${c} = ${num*c}` Change to: item.text =`${n} x ${c} = ${n*c}`
-
0
votes1
answer51
viewsA: How do I leave my objects in static JS?
You can persist the data in Storage, when starting the application you load the saved data. This is for browser memory, type a cookie. If you want to persist definitive you must save the changes in…
-
1
votes2
answers404
viewsA: Consuming Webapi by Angularjs
Bruno, good morning. So, in the test of ports I use often shows that there is no port 80 (http) open in your IP. Use this site to check, you need to go through this procedure or it will not work. If…
-
2
votes1
answer48
viewsA: How to view a JSON file with dynamic key/value?
Example: response = { "carros" : [ {"fabricante":"fiat","teto_solar":"sim"}, {"fabricante":"volkswagen","teto_solar":"sim"}, {"fabricante":"gm","teto_solar":"sim"},…
-
-2
votes4
answers75
viewsA: Find item in array
Code tested and working: <?php function get_page($url){ $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 20); curl_setopt($ch,…
phpanswered Leonardo Getulio 1,143 -
3
votes3
answers651
viewsA: Treat Json return array with CURL
Solution: echo '<pre>'; //print_r( $result ); foreach ($result as $item) { echo $item['Codigo']; echo '<br>'; } echo '</pre>'; What it takes is that when you call "for" with index…
-
1
votes1
answer29
viewsA: Autocomplete in bringing result in other input
Change the callback onSelect to: onSelect: function (suggestion) { $('#'+ this.id).parent().parent().find('input[name="cod"]').val( suggestion.id ); $('#'+…
-
2
votes1
answer39
viewsA: Help with Javascript = ( =
the problem is as the friend above said even: //var entrada = require('readline-sync') var entrada = "2.0 4.0 7.5 8.0 6.4" var linha = entrada.split(' ') //var segundoValor = entrada.question() var…
javascriptanswered Leonardo Getulio 1,143 -
1
votes2
answers48
viewsA: Insert WHERE into query giving error
You must add in the clause select the field "participantes_atividades.participante_id" in order to group by it. SELECT participantes.name, participantes_atividades.participante_id,…
-
1
votes1
answer1504
viewsA: Help to perform javascript start date and end date filter
You can use this code that works: let objetos = [ {nome: 'teste01', data: '03/09/2019'}, {nome: 'teste02', data: '03/10/2019'}, {nome: 'teste03', data: '03/11/2019'}, {nome: 'teste04', data:…
-
1
votes2
answers388
viewsA: Asynchronous return of some Apis
Failed to treat the receipt: async function getUserGithub() { await fetch(`https://api.github.com/users/decarvalholucas`).then(function(response) { response.json().then(function(data){…
-
0
votes1
answer26
viewsA: How to make the Morris Chart pick up information from an Asp.Net Core api
Starts a variable for Morris.Bar type: var morrisChart = Morris.Bar({ element: 'graph', data: day_data, xkey: 'period', ykeys: ['motorista', 'totalDeChegadas'], labels: ['Motorista', 'Total'],…
-
0
votes1
answer54
viewsA: Swap css for parameter
change to: cssEstilos = { 'background-color': 'red', };
angularanswered Leonardo Getulio 1,143 -
0
votes1
answer189
viewsA: How to change the value of an Array inside a $
if (isset($_POST["add_to_cart"])) { if (isset($_SESSION["shopping_cart"])) { $item_array_id = array_column($_SESSION["shopping_cart"], "item_id"); if (!in_array($_GET["id"],…