Posts by NoobSaibot • 9,554 points
354 posts
-
6
votes2
answers2605
viewsA: How to insert an HTML file with [innerHtml] and maintain Angular attributes
Update 2 If you do not want to make use of library, you can use the class Compiler ( Note: Not to be confused with $compile of Angularjs ) Filing cabinet app.componentts. import { Compiler,…
-
10
votes1
answer96
viewsA: How to extract String from a larger string separated by "/"
It would not be easier to use the method split? String link = "lojas/RJ/Macaé/Loja Modelo/pedidos_ativos/03-03-2018-8773"; String[] partes = link.split("/"); System.out.println(partes[0]); // lojas…
-
4
votes4
answers103
viewsA: How to avoid value repeats in this code?
You can do it this way too: function remAcentos(p){ var acc = { 'áâàãâ': 'a', 'éê': 'e', 'í': 'i', 'óôõ': 'o', 'ú': 'u' } return p.replace(/[áàãâéêíóõôú]/g, letra => { let re;…
-
0
votes1
answer51
viewsA: How to count the columns of a <td> showing the tatal at the end
Your code is a little complicated to understand, but I think it will help. Create a method to return the amount of presences and absences of each student, traverse the object alunos using the method…
-
1
votes1
answer94
viewsA: Vuejs Event with Mixins
You are registering a Mixin Global, just reference the method in the event click without the need to create a new method. <button v-on:click="Alerta">test</button> But the documentation…
vue.jsanswered NoobSaibot 9,554 -
0
votes2
answers379
viewsA: Using the filter method an object array
Using only the method filter const musicData = [ { artist: 'Adele', name: '25', sales: 1731000 }, { artist: 'Drake', name: 'Views', sales: 1608000 }, { artist: 'Beyonce', name: 'Lemonade', sales:…
-
0
votes2
answers647
viewsA: Catch only days of the month by removing Saturday and Sunday with JAVASCRIPT/TYPESCRIPT
Recently I had to recover all the Sundays, as Farms and the Saturdays of the current month to generate a scale. I found the plugin Moment-weekdaysin to the library Moment js.. You must perform the…
-
0
votes1
answer106
viewsQ: Generate scale of two people for certain days
I have a document to do every month, in this document is presented a three-day schedule ( Domingo, Fifth and Saturday ) every week, two different people will be scales on each day of this week: let…
javascriptasked NoobSaibot 9,554 -
4
votes2
answers419
viewsQ: What is the "module" value for in the type property of the HTML <script> element
I recently saw a code that includes a file Javascript was set the attribute type with the value module as in the example below: <script type="module" src="arquivo.js"></script> I would…
-
0
votes2
answers1964
viewsA: How to delete an element by Key in React?
To remove an item when the component is rendered using the method componentDidMount class App extends React.Component { constructor() { super(); this.state = { lista: [ { to:"/pag0",…
-
2
votes2
answers784
viewsA: Recursive Function in Typescript Returning Array with Dynamic Objects
A very simple way just using the method filter const arr = [ { id: 1, idPai: null }, { id: 2, idPai: null }, { id: 11, idPai: 1 }, { id: 12, idPai: 1 }, { id: 21, idPai: 2 }, { id: 22, idPai: 2 }, {…
-
3
votes4
answers244
viewsA: Set a range in the execution of each for loop
You can create a method and use setInterval, see: let li = document.querySelectorAll('li'); let x = 0; let intervalo = null; const loop = () => { if (x < li.length) {…
-
1
votes1
answer716
viewsA: Error message : Cannot read Property 'thisCompilation' of Undefined
This error happens due to a bug in the version 4.0.0, there are several bug reports on Github To fix just remove and install previous version as the following example: npm remove webpack npm install…
-
1
votes3
answers2526
viewsA: How to add HTML with onClick event in React
You must use state, it shall contain data specific to the component which may change during the use of the component. State must be a simple Javascript object. For better understanding, we will…
-
2
votes1
answer76
viewsA: Escape symbols in Nodejs
Basically just replace the character of + for %2B and the character & for %26. But you can use the library urlencode to help in this process, to install just run the command: npm install…
-
6
votes1
answer143
viewsA: Error in Vue.js filterBy
The filter in the v-for was removed from the version 2.0 of Vue. You can use Dados Computados and perform a filter: computed: { searchBook() { return this.mySearch ? this.books.filter(book => {…
vue.jsanswered NoobSaibot 9,554 -
1
votes1
answer318
viewsA: How to make a each inside an append?
Well, first we have to correct some errors. The variables declared right at the beginning have no effect, so I took the liberty of removing them. The events click moved into the plugin. Within the…
-
1
votes1
answer168
viewsA: Icon inside HTML data-text attribute
Yes it is possible, just do the following: Sets the source property: font-family: 'FontAwesome'; In the attribute put in front of the text the Unicode code referring to the icon.…
-
2
votes6
answers1028
viewsA: How to subtract an array
You can use the method differenceWith library Lodash. let arr1 = [ {nome: 'Fulano', idade: 19}, {nome: 'Fulano', idade: 39}, {nome: 'Ciclano',idade: 20}, {nome: 'João', idade: 20}, {nome: 'Maria',…
-
1
votes2
answers1203
viewsA: Regex to make full-name first letter uppercase, whether or not with a special character
Your question is the answer here: Convert every first letter of every word into uppercase. But I adapted to format names, I won’t go into detail. const formataNome = str => { return…
-
2
votes2
answers1925
viewsA: Concatenate string with Vue in href
You can do it like this: <h3 class="item-title"><a :href="'http://localhost:62828/colecoes/channel.aspx?channelId=' + colecao.Id +…
-
1
votes1
answer178
viewsA: Convert JSON to Object with different structure
I think the easiest way is to use the method Object.assign(). Case the property client has an object: let json = { "cliente": [ { "cliente_cpf": "43900404640", "cliente_nome": "Luiza",…
-
2
votes1
answer232
viewsA: Configure log in crontab
According to the documentation, to attach to the log file without replacing the previous one must use the parameter -a, it does the same as the parameter -o only instead of replacing the file log…
-
1
votes1
answer689
viewsA: How to work with Json on Vuejs?
The problem occurs due to the use of this, remember that in the context of global execution ( Window and or Document ), this refers to the global object and when you create an instance of Vue, an…
vue.jsanswered NoobSaibot 9,554 -
0
votes1
answer42
viewsA: Angular4 method edit
Basically what you need is to inform the directive ngModel in the field and or ngFor if the variable contains an array. <input type="text" [ngModel]="regioes"> <input type="text"…
-
1
votes3
answers327
viewsA: :first-Child no . active Owl-Carousel does not work
You can use Callbacks to personalize an event. To avoid repeating lines of code, we create a function: function changeActive(e) { // Remove o seletor classe de todos item $('.owl-stage…
-
3
votes1
answer6347
viewsA: How to modify an element within a Python list?
In fact you are trying to modify a tuple, tuples are like lists, only immutable that is, once created cannot be modified. When trying to modify a tuple element: numeros = (1,2,3,4,5,6,7,8)…
-
1
votes2
answers703
viewsA: How to style elements within the <textarea> tag?
One way to get the result is by doing the following: Create a textarea I’ll set the attribute id as editor_back. <textarea id="editor_back"></textarea> Apply the CSS #editor_back {…
-
0
votes2
answers76
viewsA: Data processing
We will understand the problem. According to the documentation, JSON contains methods for Parsing JSON that are those: JSON.parse() JSON.stringify() For this reason when trying to execute the code…
javascriptanswered NoobSaibot 9,554 -
7
votes3
answers1543
viewsA: Why "html, body" and not just "body" to delete the page margins?
The reason for this is because browsers use different standard style sheets. Example, the Chrome may use a margins for the document HTML: /* É apenas um exemplo */ html { margin: 10px; padding:…
-
2
votes1
answer36
viewsA: Is there an alternative to PRIORITY_MAX that is obsolete?
The method setPriority has become obsolete since the API 26 and in the documentation it is recommended to use setImportance You can use IMPORTANCE_HIGH in place of PRIORITY_MAX. Below the values…
-
3
votes1
answer620
viewsA: Create button effect pressed
Define within the constructor method a variable, example: this.interval = null; She’ll save the timer setInterval, now create a method to clean the timer: clear() { clearInterval(this.interval);…
-
7
votes2
answers1215
viewsA: Darken screen by clicking on the search bar
There are several ways to get the result, I give you one: // Quando o campo receber focus. $('.busca').on('focus', function() { // Altera a propriedade z-index $(this).css({ 'z-index': 99 }); //…
-
1
votes2
answers399
viewsA: How to Make a Mask for Field Validation
You can use the library jQuery-Mask-Plugin, and use Regular Expressions to check the field value. See the example: $(document).ready(function() { var campo = $('.campo'); var alert = $('.erro'); var…
-
0
votes2
answers1600
viewsA: Vector size in C
I’m not the best person to answer, but I’m learning from it. Below is a step by step example I was testing on repl it. First we created the struct here the identifier is s_products struct s_produtos…
-
1
votes1
answer764
viewsA: Add Scroll Bar to a Box
These are some of the causes of returning this error: The element has not been rendered The informed reference is not the same as the element, example: <div ref="box"> When redeeming the…
-
1
votes5
answers8190
viewsA: Onclick event in image
To work the way you are trying, simply remove the attribute href tag a, it is logical that the function of existing otherwise will not work! var clicks = 1; function ocultaForm() { alert('VOCÊ…
-
1
votes4
answers117
viewsA: Copy one line at a time from the source file to the target files
Using for gets like this: #!/bin/sh NUM=0 MAX=10 # Caso tenha Nome e Sobrenome por exemplo: Ana Paula IFS=$'\n' for LINHA in $(cat lista-casais.txt) do if [ $NUM -lt $MAX ]; then M=$(echo $LINHA |…
-
0
votes1
answer35
viewsA: Javascript variable scope - DOM attribute value is not passed by assignment
window.onscroll performs a function every time the scroll rolled. So in order for it to work, the variables must be within the function! var backToTop = document.getElementById("back-to-top");…
javascriptanswered NoobSaibot 9,554 -
1
votes2
answers436
viewsA: Bootstrap message, apply Location.Reload upon termination message
Add the code below: $("#alert_div").remove(); // Redireciona window.location.href = "http://answall.com"; There are several ways to redirect, see more in this question: How to redirect the user to…
-
1
votes2
answers40
viewsQ: How to prevent a property from being removed or modified?
I have an object and would like to prevent certain properties from being modified or removed. The code below is to illustrate: var pessoa = { nome: 'Fulano de Tal', doc: '999.999.999-99' };…
javascriptasked NoobSaibot 9,554 -
1
votes1
answer127
viewsA: Hide element only if visible or vice versa
You can use attributeNotEqual or the method :not() attributeNotEqual $('select[name="template"]').on('change', function() { var id = $(this).val(); // Oculta as DIV's menos a selecionada…
-
1
votes2
answers302
viewsA: Using variable in chdir function (module OS)
To recover the user directory you can utilize the library os.path.expanduser, example: from os.path import expanduser user_dir = expanduser("~") print(user_dir) The exit in Windows will be similar:…
-
1
votes1
answer230
viewsA: How to use return values using . map() in Javascript
The way the code is, just call the method passing as parameter numeros[i] see that i is the index of each element. var numeros = [1, 2, 3, 4, 5, 6, 7, 8, 10]; var i = 4; // Índice // Saida => 5…
-
3
votes1
answer233
viewsA: How to create, access and manipulate associative arrays?
The correct is declare -A chaves, the variable "keys" will be treated as a matrix. #!/bin/bash declare -A chaves NEXT_IDX=1 while read line; do if [ "x${chaves[$line]}" = "x" ]; then # então chave…
bashanswered NoobSaibot 9,554 -
1
votes2
answers107
viewsA: Array search by name
She’d be like this: var lista = ["Orange", "Melancia", "Abobora"]; const buscar = str => (lista.indexOf(str) > -1) ? console.log('Encontrada') : console.log("Não encontrada");…
javascriptanswered NoobSaibot 9,554 -
1
votes2
answers152
viewsQ: What is the "customElements" property for?
Navigating here on Sopt found the following question: How to add customElements support for Opera 12?, and I would like to know the usefulness of this property. Note that making a simple research…
javascriptasked NoobSaibot 9,554 -
24
votes1
answer612
viewsQ: Is it always possible that (a == 1 && a == 2 && a == 3) can be evaluated as true in Javascript?
It is possible that (a == 1 && a == 2 && a == 3) can be evaluated as true? This is an interview question asked by a major technology company. I’m trying to find the answer. I know we…
javascriptasked NoobSaibot 9,554 -
3
votes2
answers73
viewsA: How to Filter an array using the For structure?
Just make a condition, it can also be done so: numeros.forEach((n) => { if (n < 10) { filterTwo.push(n); } }); const numeros = [1,2,3,4,5,55,190,355,747,1000,125]; const filterOne = x => x…
-
3
votes1
answer419
viewsQ: How to list containers in Docker?
I recently started testing on Docker, created a virtual machine and installed Debian 9 without a graphical interface. I know the command: docker ps Shows the running containers, there are other…