Posts by NoobSaibot • 9,554 points
354 posts
-
17
votes1
answer407
viewsQ: Is it possible to use the autocomplete attribute in "textarea/select"?
I know the attribute can be used in the element input <input type="text" name="email" autocomplete="on" /> According to the MDN Web Docs, the element textarea includes the global attributes to…
html5asked NoobSaibot 9,554 -
4
votes1
answer402
viewsA: Python - print list elements that have 5 letters
You can use the function len() lista_nomes =['Manuel', 'Laura', 'Antonio', 'Jasmim', 'Maria', 'Silvia', 'Lu', 'Pancrácio', 'Diogo', 'Ricardo', 'Miguel', 'Andre',] nomes = [nome for nome in…
-
1
votes1
answer327
viewsA: WEBPACK commands do not work
Error may have been caused due to argument order -g in command, which according to the documentation is: npm install -g webpack-cli other than the Yarn that is: yarn add webpack-cli -g Reference How…
-
2
votes1
answer522
viewsA: Split array with multiple INSERT array_push in SQL
You can go through each array, see: I created a variable of type array. $resultado = []; Follow the steps: Traverse the parent array. for($i = 0; $i < count($dados); $i++) Set a variable with…
-
11
votes1
answer496
viewsA: Array in PHP using () or []?
According to the documentation, Short syntax array was added in the version 5.4.0 of PHP: $array = ['a', 'b', 'c']; When executing the above code in a lower version than 5.4, will get the error…
-
0
votes5
answers505
viewsA: Is it possible to listen to multiple buttons with a single addeventlistener() ? If it is possible How to do it with pure javascript?
You can also use onclick var botoes = document.querySelectorAll('.quina'); for (let i = 0; i < botoes.length; i++) { botoes[i].onclick = function(e) { document.querySelector('#resultado').value…
-
0
votes1
answer808
viewsA: Date Today Moments.js
Correct is to use the method format() instead of calendar(). Another point to note is that the method add() is receiving format parameters that has been discontinued, instead of add('months', $i)…
-
2
votes1
answer101
viewsA: Command to Check if a software is installed on Ubuntu
Use the command command informing the argument -v echo $(command -v git) in the above example, if git was found will have a similar return to the below: >> /usr/bin/git otherwise it will…
shell-scriptanswered NoobSaibot 9,554 -
1
votes1
answer32
viewsA: Multiple Prototypes
Use Object.defineProperty() to set a new property directly on an object, or modify an existing property on an object. To avoid code repetitions and facilitate maintenance, create a new module, here…
-
1
votes1
answer75
viewsA: First element array of a multidimensional array as key for others
Yes, just you retrieve the first element: $chaves = $retorno[0]; then go through the array starting from the first index and add to the new array: $novo = []; for($i=1; $i < count($retorno);…
phpanswered NoobSaibot 9,554 -
2
votes1
answer83
viewsA: To some form of progressive count to the limit set by Hour, sound alert
You can create a method that returns the current date and time: function DataHora() { var date = new Date(), hora = date.getHours(), minuto = date.getMinutes(), dia = date.getDate(), mes =…
javascriptanswered NoobSaibot 9,554 -
2
votes2
answers3405
viewsA: Python, value percentage (result)
This answer is based on this reply given by Anderson Carlos Woss. You can use a dictionary to store all options: opcoes = { 1: 0, 2: 0, 3: 0, 4: 0, 5: 0, 6: 0 } thus avoiding a large number of if…
pythonanswered NoobSaibot 9,554 -
2
votes1
answer34
viewsA: The change() is not acting as expected, why?
You must hide the div within the div procedures. $('#procedimentos > div').hide(); Behold working in jsbin.com…
jqueryanswered NoobSaibot 9,554 -
1
votes1
answer117
viewsA: What way can I validate current time
Within your method, create variables to store the current time and minute. var hora = new Date().getHours(); var minuto = new Date().getMinutes(); Then change your condition to check if hrs is less…
-
2
votes2
answers793
viewsA: Chatbot in Python with NLTK
You can create a CSV file, use the dot and comma as the delimiter to separate the fields, the first field will be the regular expression, and the second field the answer. Note that I removed the…
-
0
votes2
answers90
viewsA: Validando fechamento de factura para tipo de compra e venda Javascript e submeter para uma api
Do the following. Retrieve the current date in a variable: let DATE = new Date(); // Data atual Recover the current month: let MONTH = DATE.getMonth() + 1; // Mês atual It is worth remembering that…
-
3
votes1
answer112
viewsA: jQuery cutting words with space
Turns out you’re not passing the value inside quotes, example: <input type="text" value=Stack Overflow Português /> <input type="text" value="Stack Overflow Português" /> Change to:…
-
2
votes1
answer96
viewsA: How to select an image link text (html) and delete everything else with Regex?
Use the expression: src\="https:\/\/exemplo\.files\.wordpress\.com(.*?)" in the replace field put $1 which is equivalent to group 1: (.*?) You can test the expression on regex101.com…
-
0
votes1
answer75
viewsA: View categories of each post via JSON JS
It is only displaying one category, because within the first loop for you declare the variable postLabels being an array, soon after in the second loop for, you define it again and define its value…
-
1
votes1
answer28
viewsA: Mousemove reset counter jquery
It’s simple, first you must set the variable interVal out of method CountDown, then just set in the document the events you want, clear the range of interVal and recall the method CountDown: var…
jqueryanswered NoobSaibot 9,554 -
1
votes2
answers214
viewsA: Count trading amounts performed with python replace
You can also use Regular Expressions, as I mentioned in reply given in your question Search for sub-strings Python 3.xx. To count, do what you’re already doing, only instead of incrementing, you…
pythonanswered NoobSaibot 9,554 -
2
votes1
answer305
viewsA: Search for sub-strings Python 3.xx
Using regular expressions: import re str = input('digite palavra:') for m in re.finditer(r"\b(\w+)+\1\b", str): str = str.replace(m.group(1) * str.count(m.group(1)), m.group(1), 1) print(str) With…
pythonanswered NoobSaibot 9,554 -
1
votes1
answer48
viewsA: Update of an installment form query
If what you want to do is ride a query dynamically with only the columns informed in the object, do the following: Set a variable to store the amount of parameters, and the object to store the query…
-
1
votes3
answers4107
viewsA: How to implement Bootstrap 4 in Angular CLI
You need to add the Bootstrap in your project: npm install bootstrap@4 --save then edit the file .angular-cli.json: "styles": [ "styles.css", "../node_modules/bootstrap/dist/css/bootstrap.min.css"…
-
3
votes1
answer34
viewsA: Show date and time to current user
You must concatenate: $tabela1 .= '<td> <input type="date" name= "Data[]" id= "Data" value="'. date("Y-m-d") .'"> <input type="time" required="" id="Hora" name="Hora[]" value="' .…
phpanswered NoobSaibot 9,554 -
2
votes3
answers281
viewsA: Pick up reply email content
Following the same example from @Diegomarques /^(Em\s)?\d{1,2} de \w+ de \d{4}/gm The above expression will separate if you find the following sequences: 5 de April de 2018 and or On April 10, 2018…
-
1
votes2
answers888
viewsA: How to get the row and column indexes of a list List<List<int>>?
You can browse the list using ForEach to discover the column: int a = new int(), b = new int(), busca = 1; a = matriz.FindIndex(x => x.Contains(busca)); matriz.ForEach(x => {…
-
1
votes1
answer31
viewsA: *ngFor client side
There’s been a mix-up, ngFor and ngModel are present in version 2+ of Angular. Already in the Angular 1 the correct is ng-repeat and ng-model: var app = angular.module("crudlist", []);…
-
1
votes1
answer979
viewsA: Masks in the Angularjs
To use in your browser, you must execute the command: npm run build will create a directory on the project root with the name releases which will contain a file probably with the name…
-
3
votes2
answers829
viewsA: How to pick only numbers between parentheses in Python with regular expression
You can do it like this: \((\d+) g\) The first and last counter-bar is to escape the parentheses, (\d+) will capture only the digits within the parentheses. The complete code: import re Texto = "54…
-
1
votes1
answer374
viewsA: VIACEP did not find the cep variable to return to the result in PHP
Actually your code is working, note what the documentation says about searching by address: The result will be ordered by the proximity of the street name and has a maximum limit of 50 (fifty) Zip…
-
2
votes1
answer724
viewsA: How do I get a single div with the same class in jquery?
Simple use the method find: $(document).ready(function() { $('.lista').click(function() { $(this).find(".item").toggleClass('green'); }); }); .lista { border-bottom: 1px solid #ccc; cursor: pointer;…
-
1
votes2
answers64
viewsQ: Is it possible in PHP to recover part of a string using the same notation as Python?
I have the following variable for example: $teste = 'Uma frase qualquer!'; In Python, for me to get the word back frase, I would use the notation variavel[inicio:fim]: teste = 'Uma frase qualquer!'…
-
1
votes1
answer966
viewsA: Delete from localStorage
Add to object objeto within the method cadastrar() the property id var objeto = { id: 'tarefa' + cont, tarefa : document.querySelector("input[id = 'nomeTarefa']").value, prioridade :…
-
1
votes2
answers1287
viewsA: Recover value of a props in child component
You can set a state in the Map component: this.state = { cep: '' }; and in the method render before the return check whether the status value cep of the component is different informed by props if…
reactanswered NoobSaibot 9,554 -
0
votes1
answer50
viewsA: Remove information from within an angled array
Using the filter limitTo it is not possible, when limitTo is used for strings, it returns a string containing only the specified number of characters. You can use the method substring:…
-
0
votes1
answer71
viewsA: Improved javascript from Dat.GUI
For this you must create an object: var dry = []; and instead of creating a variable for each item, add them to the object: dry.push( cssVars.addColor(block, 'mainColor'), cssVars.add(block,…
-
2
votes1
answer1204
viewsA: How to set time in bootstrap timepicker
By default, the option defaultTime has its value as current which is the current time, just remove the option defaultTime: '' the field will be filled automatically. If you want to set a standard…
-
2
votes1
answer473
viewsA: Increment Ionic data 3, Angular, Typescript
I recommend using the library Moment js., in his method parcelas() create a variable: let data = moment(this.due_date.value); In the for leave it so: parcelasCobranca.push({ value:…
-
0
votes1
answer71
viewsA: Treat CNPJ’s list with regular expression
I honestly see no reason to use Regular Expressions in something simple. In PHP utilize explode and join $str = '32132132132 32132132132 321321321323 32132132132132'; $exp = explode(' ', $str); echo…
regexanswered NoobSaibot 9,554 -
0
votes2
answers131
viewsA: Delete element from array
You can do it like this: var selecionados = []; function selecione(item) { // Verifique se o item já existe no objeto "selecionados" let test = selecionados.filter(x => x === item); // Faça uma…
-
3
votes2
answers70
viewsA: Extract portion of characters using PHP
A simple way to do it is by using the methods preg_match_all and array_combine. function extrair($str) { # Extrai o número de dentro da tag a…
-
1
votes2
answers55
viewsQ: Generate dynamic borders
I have the following form: <input type="number" min="0" value="0" /> <input type="number" min="0" value="0" /> <input type="number" min="0" value="0" /> <input type="number"…
-
1
votes2
answers46
viewsA: I have questions that when you click on it, the onclick event is called a div that is on display - None appear
How you are making use of the library jQuery does not need to create a function. If it is more than one question, I recommend to div within the tag a: <a href="#" class="pergunta">…
-
2
votes1
answer2549
viewsA: How can I change the state of an array item in React Native
You have to use TouchableHighlight so that items respond appropriately to touches. Set a method to update the property value. handleUsuarioViu = (index) => { let dados = this.state.dados;…
-
5
votes3
answers86
viewsA: Javascript comparison
You can do it like this: const teste = function(a) { a ? console.log(`O valor que vc passou é ${a}`) : console.log('Nenhum valor informado') }; teste('Teste'); teste(''); teste(null);…
-
1
votes3
answers1440
viewsA: Javascript - How to pass parameters to a function of an Event Attribute
You can use the method bind() var button = document.querySelector('button'); function minhaFuncao(num1, num2) { alert(num1 + num2); } button.onclick = minhaFuncao.bind(null, 2, 2);…
javascriptanswered NoobSaibot 9,554 -
1
votes1
answer90
viewsA: Increment Array with filter
Check if the item already exists in result let test = this.result.filter(item => item === this.orders[i].nome_service); Make a condition that checks whether the number of returned elements is…
-
7
votes1
answer39540
viewsA: Error. Unhandledpromiserejectionwarning
The event unhandledRejection is issued whenever a Promise is rejected and no error handler is attached to the promise. To solve, just treat the rejection: return Promise.reject('Oops!').catch(err…
node.jsanswered NoobSaibot 9,554 -
1
votes1
answer315
viewsA: Calculate and Decrease Array Values
Since the intention is to add up the value of price_service of all items containing the property qtd equal to 1, there is no need to create a new object. Just filter the object orders using the…