Posts by NoobSaibot • 9,554 points
354 posts
-
1
votes1
answer326
viewsA: Site Vue.js in production does not load complementary files
You are running the project via protocol file://, Vue CLI assumes that your application will be deployed to the root of a domain, e.g.: https://dominio.com.br/ According to the documentation of the…
-
0
votes0
answers51
viewsQ: Qmediaplayer stops or skips next when removing media from playlist
As the title itself says, the problem lies in removing a media from the playlist, but precisely in removing a media that the content is lower than that of the media playing at the time. I’m already…
-
1
votes1
answer125
viewsA: Error in Python code
Note: Complete later, no time at the moment. I can’t find the error in this code When you are defining the arguments, you are trying to define a default value if the argument is omitted, but you are…
python-3.xanswered NoobSaibot 9,554 -
5
votes1
answer56
viewsA: Which CSS rule has priority in this case?
The CSS is interpreted from top to bottom, in this case the paragraph will be blue. p { color: red; } p { color: blue; } <p>Teste</p> if the declaration is used !important, the paragraph…
cssanswered NoobSaibot 9,554 -
5
votes1
answer175
viewsA: Error while running project in Android Studio
Please install the Android Support Repository from the Android SDK Manager. As the message itself says, you must install the Support Library, follow the steps: Initiate the Android SDK Manager At…
androidanswered NoobSaibot 9,554 -
1
votes1
answer825
viewsA: Copy part of Dataframe where column is Null or Nan
You can use one of the three options: op_a = df[df['B'].isnull()] # mesmo resultado com: isna() # ou op_b = df.loc[df['B'].isnull()] # mesmo resultado com: isna() # ou op_c = df.query('B != B') both…
-
7
votes1
answer891
viewsQ: Is it possible to unstructure an array in PHP equal to or similar to the Python list?
In Python we can unstructure a list like this: lista = [ "Maça", "Pera" ] maca, pera = lista print(maca, pera) the exit will be: Maça Pera I know that in PHP it is possible to get the result using…
-
1
votes1
answer270
viewsA: How to make calculations with elements of a Ruby array?
Important points: Remove the operator splat before the parameter name *numeros You’re redeclareting the variable numeros when instances the class C then you can use the method inject or reduce…
-
0
votes1
answer559
viewsA: Vue-router: hide components in page change
You can create a plugin to store some settings: ./Components/config/index.js import Vue from 'vue' const globalConfig = new Vue({ data: { menu: { show: true, hide_from_pages: [ 'Contact' ] } },…
-
1
votes1
answer208
viewsA: How to add a class to a label tag of an input dynamically selected by Vue.js?
You can do it like this: v-bind:class="{ active: seltags.includes(keyoption) }" The code above: Add the code to label <label class="btn bg-grey"> Checks whether the object seltags contains…
-
5
votes2
answers3831
viewsA: Dataframe Pandas - Calculate column based on other
You can use the function where the package Numpy, just inform a condition and the values to be used if true or false. df['Classe Prevista'] = np.where(df.COMEDY > df.CRIME, 'COMEDY', 'CRIME') # |…
-
4
votes2
answers97
viewsA: Slidetoggle in jQuery does not work as it should!
You are using two methods to hide and display the elements. You hide the elements li: $('li').hide(); Then use the method toggle() which will display the elements again, and then uses the method…
jqueryanswered NoobSaibot 9,554 -
1
votes1
answer18
viewsA: Why doesn’t my Sass compile this code?
There are three errors in your code: The variable $button-font-color was not declared. Undefined variable. stdin 3:12 root stylesheet on line 3 at column 12 The variable $button-font-size was not…
sassanswered NoobSaibot 9,554 -
0
votes1
answer50
viewsA: PHP captures date text
It will not be possible using the function preg_replace because it takes value of the string or array type with strings in the parameter replacement To get the result, use the function…
phpanswered NoobSaibot 9,554 -
1
votes2
answers754
viewsA: How to insert multiple records with 1 Insert?
I leave an alternative. You can use the function array_map to iterate the array and apply a function to each element. The function you see will perform its role: array_map(function($id) { return…
-
3
votes2
answers6913
viewsA: Counting Nan and null values in a pandas dataframe
What is wrong? The function count() does non-zero data counting (for each column or row), the correct use of it is: Non-zero data count for all columns print(po.count()) the exit will be: col1 5…
-
1
votes1
answer33
viewsA: How not to present in html the keys of a vector in VUE.js application
Only use the method join to transform the array into a string, separating the elements by comma ( or any other separator you want ). <p> Resposta: {{ frames.join(', ') }} </p> See…
-
1
votes1
answer7298
viewsA: How to save in CSV or Excel a table generated from another table with pandas or pivot table?
You can use the module Xlsxwriter to export as Excel file, to install just run one of the commands: # Utilizando pip pip install XlsxWriter # Utilizando easy_install easy_install XlsxWriter…
-
4
votes1
answer6739
viewsA: Date column of the Dataframe
First you must turn the column Data e Hora for datetime df['Data e Hora'] = pd.to_datetime(df['Data e Hora']) to create the columns using the method dt.strftime convert the column value Data e Hora…
-
1
votes1
answer780
viewsA: How to list files in a directory and use in an Angular2 + Webpack project
I asked a similar question a while ago, and based on what I found, you can use the Chokidar informing the directory, the wildcard character followed by the extension. let watcher =…
-
2
votes2
answers29
viewsA: Insert Event date into a table if page width is less than a given value
To work as desired, you must put the document to listen to the event resize, create a function: function screen_width() { var width = window.innerWidth || document.documentElement.clientWidth ||…
-
2
votes2
answers50
viewsA: Organizing the response array
Use the function array_map to traverse the array and apply a function to each traversed element: $Resposta = array_map(function($Valor) { // Faz alguma coisa com "$Valor" }, $Resposta); use the…
-
2
votes2
answers189
viewsA: What is the best way to get the content inside a div for a variable?
The correct way to retrieve "rendered" content is by using the property innerText Example var p = document.querySelector('p').innerText; console.log(p); <p>Stackoverflow Português</p>…
-
2
votes2
answers326
viewsA: Data analysis with python list
You need the module pandas. To install run the command: pip install pandas then import: import pandas as pd to read the file, use the function read_csv: df = pd.read_csv('lista.txt', delimiter=";",…
python-3.xanswered NoobSaibot 9,554 -
1
votes1
answer63
viewsA: I cannot print an array with foreach
Is returning the error: Warning: Invalid argument supplied for foreach() because you are trying to iterate an element that is not array: $use[$i]['outrachave'] = 'some valor'; To solve, you can make…
-
2
votes2
answers487
viewsA: Filter array by first letter
Create a function and filter into it: $scope.filtrar = function(letter) { return $scope.brands.filter(b => b.brand[0] === letter); } then call her in the loop ng-repeat="x in filtrar(letter)",…
-
0
votes1
answer35
viewsA: I do not know what is the error of this code, update button is not updating the table field
Not updating because you have set id as field value name="id" instead of $row['id'] in the archive php.. Alter: echo "<td> <form method='POST' action='aprovar.php'> <input…
phpanswered NoobSaibot 9,554 -
3
votes1
answer318
viewsA: Remove indexes from the array
The function array_values returns all values of an array: $Array = ["Torrada" => 4,"Cachorro quente" => 1]; $Valores = array_values($Array); print_r($Valores); Exit: Array ( [0] => 4 [1]…
-
2
votes1
answer361
viewsA: Allocate day period to hours
The message that function where takes a maximum of 3 arguments, and you are giving 8! You can use the function apply and inform as parameters, a function which will be executed for each item and the…
-
7
votes2
answers910
viewsA: Catch DDD nos (11) with regex
You can use the expression ^\((\d{2})\) Explaining: ^ - Corresponds to the beginning of a string without consuming any character. \( and \) - Escape is necessary to be treated as text and not as a…
-
7
votes2
answers2983
viewsA: How to exclude a certain group from the regular expression
If the expression is used in the editor Notepad++, do as the Marconi said. Access the shortcut CTRL+H and in the field Find what? put the expression \|\d+$ and click on Replace Everything. To use…
regexanswered NoobSaibot 9,554 -
2
votes1
answer240
viewsA: Connectionrefusederror: [Errno 111] XML-RPC python
You are getting the error: Connectionrefusederror: [Errno 111] Connection refused because it is trying to access a Loopback interface, the loopback interface is a virtual network interface used…
pythonanswered NoobSaibot 9,554 -
1
votes1
answer312
viewsA: Working with datepicker on ng-bootstrap
To set a maximum date, create a new property in your class NgbdDatepickerRange: maxDate: NgbDateStruct; to avoid code repetition, create a function to add a month to the start date: addMonth() { let…
-
0
votes1
answer339
viewsA: Skip line in XML with PHP
First remove the parameter $nomeArquivo and the condition that is within the function, because if the file exists or will not execute the same code, then why repeat ? function…
-
3
votes1
answer469
viewsQ: What is the purpose of the "Asp-area" attribute in Web ASP.NET Core MVC?
Creating a project Web ASP.NET Core MVC in the Visual Studio 2017, I found that in the file _Layout.cshtml all elements a has an attribute called asp-area but it has no value: <li><a…
asp.net-coreasked NoobSaibot 9,554 -
0
votes1
answer747
viewsA: How to add limit value along with jquery Mask?
You can the event onKeyPress, replace the comma with the point and check that it is greater than 100.0: $('.decimal').mask('000,0', { reverse: true, onKeyPress: function(val, e, field, options) { if…
-
0
votes1
answer216
viewsA: Single lists with at least 2 difference elements
Update 1 Another way to get to the result is by removing the elements already added in the lists: import random def gera_lista(qnt): listas = [] numeros = random.sample(range(1, 100), 25) # Sorteia…
-
0
votes4
answers2543
viewsA: Insert paragraphs from a JSON file into a DIV
Using the methods split and join also comes to the result: >>> "Primeiro parágrafo.\nSegundo parágrafo.".split('\n').join('<br/>'); "Primeiro parágrafo.<br/>Segundo parágrafo."…
-
1
votes1
answer39
viewsA: Use element attributes in function of controller scope
Pass the expression as a parameter in the method $event <form ng-submit="submit($event)" action="http://example.com" method="POST"> then just access the property srcElement of expression…
-
3
votes3
answers2286
viewsA: How to remove duplicate values from a multidimensional array in javascript?
You can use the method filter and make the check. var dados = [ ['maria', 'telefone', '324-5678', true], ['maria', 'telefone', '91234-5555', true], ['maria', 'telefone', '324-5678', false],…
javascriptanswered NoobSaibot 9,554 -
1
votes2
answers675
viewsA: How to multiply the number of lists by an integer?
A way Pythonico n = int( input() ) colecao = [ list( map(int, input().split(',')) ) for _ in range(n) ] print(colecao) See working on repl.it, Github Gist for future reference Reference What is…
-
1
votes1
answer470
viewsA: Iterating web pages using Requests and Python
When you are on a page, is set the value active in the tag attribute li of pagination: <ul class="list-unstyled list-inline header-paginator pull-right"> <li class="active…
-
0
votes2
answers157
viewsA: How to create a property on an existing object of an http request?
The return of the API is an array, to add a new element, using the method push. Working example: let result = JSON.parse('[{"prop1":"prop1","prop2":"prop2"},{"prop1":"prop1","prop2":"prop2"}]');…
-
0
votes1
answer436
viewsA: Search for part of string in php?
There’s no secret, let’s assume we have these records: { "_id" : ObjectId("5afae5b338597ce11fc99dc0"), "nome" : "Maria da Silva" } { "_id" : ObjectId("5afae5bd38597ce11fc99dc1"), "nome" : "Anderson…
-
4
votes2
answers533
viewsA: How to create a script to automate link exchange in HTML?
Updating: If you do not want to open file by file, you can create a PHP script to scan a directory for HTML file or other case you want. See: This script will be executed through Terminal /…
-
0
votes1
answer2071
viewsA: How can I filter objects in an Array with Typescript?
The function filter came to facilitate life, if it was not created, you would have to traverse the object using for / for...in and or forEach, making the condition and adding the element that passed…
-
2
votes2
answers2122
viewsA: Access-Control-Allow-Origin jQuery Ajax
I don’t know if it’s impossible, but you can access the Mail API next to the server. If you are using PHP create a file, example: php. /* Recupere os dados enviados via POST * Documentação:…
-
1
votes3
answers883
viewsA: Add columns Vue.js
Complementing the response of guastallaigor, your code has a problem, when editing the fields the values are converted to string, what ends up making your code stop working. So recommend converting…
-
0
votes1
answer41
viewsA: Error checking Apache Cordova version
You must change the owner of the directory files: # Se estiver usando distribuições Linux /home/NOME_DO_USUARIO/.config/configstore/ # Se estiver utilizando Mac…
-
1
votes1
answer306
viewsA: function is not defined
This shows the error because you are setting the function as the setTimeout. Behold: setTimeout(function montaAlua(){ console.log('Funcionou!'); }, 1000); montaAlua(); The correct thing is to define…