Posts by Felipe Avelar • 9,507 points
190 posts
-
3
votes1
answer1911
viewsA: How to switch between Java 8 and 11 on Ubuntu?
Just update the version of java you want to use. To list all installed versions use the command update-java-alternatives --list To update just type the following: sudo update-java-alternatives --set…
-
5
votes1
answer1058
viewsA: There is a difference between private void, public void, public bool, public string, etc. Can someone explain this to me?
We have to understand what each particle of a method declaration means: encapsulamento tipo_de_retorno nome_do_metodo(parâmetros) Explaining each field: Encapsulation: You say where this method can…
c#answered Felipe Avelar 9,507 -
0
votes2
answers688
viewsA: How to load a Selectonemenu based on Select Previous using JSF?
You must create a function onChange in the state select and within it change the list cidades, updating with the cities of the state. For example: public void onChangeEstado() { this.cidades =…
-
1
votes1
answer40
viewsA: How to handle specific customizations with git
From the information you pass on the question, what you seem to need is submodules of a parent project. In case your main project will be a superproject will have several sub-modules and each client…
-
1
votes2
answers1023
viewsA: Reading on the same line
Just do it this way: scanf("%d/%d/%d", &nasc.dia, &nasc.mes, &nasc.ano); Remembering that the user will need to write the date using the bars. Functional example in ideone…
-
1
votes1
answer52
viewsA: Add values from jquery or javascript fields
Try something like: SE6+: let arrTipos = ['Adulto', 'Criancas6Anos', 'Criancas6a12Anos', 'Adolescentes']; let total = 0; for (var tipo of arrTipos) { if($('[name=Qtd'+ tipo +']').val() &&…
-
4
votes1
answer661
viewsQ: How to map json entities?
I wanted to know if there is any way to map json objects in React-Native. For example, let’s say I get the following json: { "data": { "lastUpdate": { "name": "Lala" } "dob": "01/01/2001" } } and I…
-
0
votes3
answers82
viewsQ: Receive result from an ajax as return
Within the following scenario: funcao1 = function() { $.ajax({ success: function(data) { return data; } }); } funcao2 = function() { var dados = funcao1(); } It is possible that I receive, even if…
-
4
votes1
answer582
viewsQ: How to find the class that called a method another class?
I wanted to know if there is any way to get the class that called a method within that method. For example: public class A { public void metodoA() { B.metodoB(); } } public static B { public void…
javaasked Felipe Avelar 9,507 -
1
votes1
answer35
viewsQ: Convert Tripledescryptoserviceprovider to javax.crypto.Cipher
I’m needing to convert a VB encryption method to Kotlin, however, the results are giving different. In Vb is implemented as follows: Public Shared Function MD5Hash(ByVal value As String) As Byte()…
-
0
votes1
answer60
viewsQ: Reset sequence every year
I am creating an identifier that has the following formatting sequence/ano, for this reason I need my Quence count to 1, again, whenever there is a turn of the year. Is there any way to do this…
-
1
votes4
answers4522
viewsA: Count number of records in a Mysql table with PHP?
$query = mysql_query("SELECT count(*) as total from tabela"); $resultado = mysql_fetch_assoc($query); echo $resultado['total'];
-
1
votes1
answer42
viewsA: Prog in C stating if x is divisible
There are two problems with this algorithm. The first problem is related to the first se: se (soma = 0) entao When the sum is zero, it means that it is divisible by all and not that it is not…
portugolanswered Felipe Avelar 9,507 -
0
votes1
answer22
viewsA: How to change decimal delimiter on primfaces chart?
To make the modification it is necessary to create a method in javascript that makes the decimal changes: function formatChart() { $.jqplot.sprintf.thousandsSeparator = '.';…
-
0
votes1
answer22
viewsQ: How to change decimal delimiter on primfaces chart?
I’m having a problem that my decimal delimiter on graph component of the primefaces is set to be ., how do I change to ,?…
-
0
votes1
answer106
viewsA: How to separate values from a json answer and add their results?
Wouldn’t it be better to create an object with each month’s keys? Something like this: let json = [{"valor":"100","dt_month":"11"}, {"valor":"150","dt_month":"11"},…
-
1
votes2
answers269
viewsA: Length of jQuery does not update with the append, how to resolve?
What happens is that the append does not update the amount of elements within the set of the element you are accessing, but rather the number of children of that element. To solve this problem,…
-
1
votes1
answer911
viewsA: Receiving data from an observable
The problem is that you are using the reserved word this to access the operations variable within the subscribe. This happens, because in javascript, the scope of this changes when you enter the…
-
1
votes1
answer104
viewsA: Why does the server send 2 public keys on TLS Handshake?
As @Inkeliz has already mentioned, the point is that the certificate sent by the server is actually not a certificate, but a chain of certificates. The certificate itself is not signed directly by…
-
0
votes1
answer49
viewsA: How to install pull request package?
To solve this problem, just take the following steps: Go to the Fork repository, in my case it was that Click to download and the button Download ZIP, right click and copy the link; In the…
-
0
votes1
answer49
viewsQ: How to install pull request package?
I’m looking to install an npm package ng2-table, but with a pull request that is not yet merged into master. Is there any way I can add this pull request to my package.json, so that it installs this…
-
4
votes1
answer660
viewsQ: How to convert an object vector to another object?
I wanted to know if there is any simple way to convert a vector of objects A to a vector of objects of type B, which follow the second structure: Object A { aId: number; aNome: string; aDesc:…
typescriptasked Felipe Avelar 9,507 -
0
votes0
answers29
viewsQ: Create a package from another
I installed an npm package, but it offered almost everything I needed, but I still had to do some customizations. The problem is that, as a team working and we have the whole issue of versioning and…
-
3
votes2
answers654
viewsA: Syntax error in if Else
The problem is that Else is tabulated, the correct would be: frase1 = str(input("Digite uma frase: ").strip()) frase2 = str(input("Digite uma frase: ").strip()) print("O tamanho da frase1 é "…
pythonanswered Felipe Avelar 9,507 -
3
votes4
answers1882
viewsA: Count substrings within a string
You can use the method Posex, which returns the position of the index (based on 1, not 0) which substring starts, if no valid substring is found it returns zero. Hence, the implementation would be…
delphianswered Felipe Avelar 9,507 -
4
votes2
answers1405
viewsA: Perfect numbers
It is probably taking a long time to execute, as it will perform summation of 1 -> n. That is, for a case where N = 10000, it performs 50005000 times that your cycle. So he hangs, exactly,…
-
1
votes1
answer592
viewsA: Select component disabled and selected angular value
Just use the directive ng-disabled. What your code would look like: <div class="form-group col-md-4"> <label>Entidade:</label> <select ng-disabled="true"…
-
8
votes3
answers663
viewsA: Class generic property
Based on this response from Soen, you need to have a common base type to be able to "extend" these objects into collections. In the case of stringand int, the common base type will be, precisely,…
-
1
votes2
answers66
viewsQ: How to create a text file template?
How do I use an extension file template txt, in such a way that my program can read this template, replace specific points of it and generate an output, for example, in another file txt. For…
c#asked Felipe Avelar 9,507 -
0
votes1
answer685
viewsQ: How to read tables from a pdf?
I am trying to read tables from a certain pdf file, using the iTextSharp, I found many answers that indicate using the LocationTextExtractionStrategy, only that my table may vary position along PDF…
-
2
votes2
answers34
viewsQ: If I return something within a using, will the resources be released?
I know that the using is used to release (give a dispose) resources. My doubt is in the following case: public void FuncNaoFazNada() { using(var acd = new AlgumaClasseIDisposable()) { return; } } In…
c#asked Felipe Avelar 9,507 -
0
votes1
answer63
viewsQ: How to upload file via ajax with Rails 4?
I want to transfer a pdf file to process on my controller and then return it while it is being processed on backend, I would like a slider or click circle to appear. However, I am having trouble…
-
10
votes2
answers16188
viewsA: How to compare two lists in Python?
I imagine that solves your problem: lista_final = list(set(lista_arquivo_2) - set(lista_arquivo_1)) whereas lista_arquivo_1 and lista_arquivo_2 are valid Python lists. As @Brunorb mentioned, this…
-
0
votes1
answer130
viewsA: Error installing goslate API for python on Windows
As you can see on that occasion Futures repository, Futures is a module made for programs of version 2.x to be compatible with Features of version 3.x, so it doesn’t make much sense to install the…
-
0
votes1
answer121
viewsA: How to receive multiple parameters in the Onnavigatedto windowsPhone 8.1 event
I imagine, from what you described in the comments, that you are returning the parameters correctly in the return of the page, to treat, what you should do is the following: if…
-
1
votes1
answer1631
viewsA: Loop to fill an input with multiple data - Selenium Webdriver
I don’t know if I understand 100% what you want, but what I think you want is the following: List<String> testes = new List<String>(); testes.add("teste1"); testes.add("teste2");…
-
1
votes1
answer62
viewsQ: Emulate navigation
I was wondering if there’s any way I can emulate browsing through a page, just like they do mechanize or the Httpurlconection, in which I can request other pages through them. Is there any way I can…
javascriptasked Felipe Avelar 9,507 -
1
votes2
answers135
viewsA: Javascript - Populate a field with paragraph
You said you tested /n, when it should actually be \n or \n\r.
-
1
votes3
answers6933
viewsA: Rotate matrix by 90º
In addition to the @Daviaragao response, you might want to save the matrix to it and rotate more than once, well follow the pattern to rotate an array with an auxiliary variable: Each element of the…
-
14
votes3
answers39504
viewsA: How does the git rebase command work?
That’s exactly what happens. The main advantage of rebase in relation to the merge is that you will have a much cleaner history (and how it really is) than a project with merges, since it will first…
gitanswered Felipe Avelar 9,507 -
6
votes2
answers5604
viewsA: How do I repeat a string in Python?
Just multiply the desired string. a = 'StackOverflow' print (a * 5) the return will be: 'StackOverflowStackOverflowStackOverflowStackOverflowStackOverflow'…
-
1
votes1
answer42
viewsQ: How to execute code before starting to change orientation?
I’m wondering if there’s any event or way to run a piece of code before it happens to change directions on Windows Phone. My problem is I need to close one MenuFlyout before changing orientation,…
-
2
votes1
answer931
viewsA: Git Commit Error
What seems to be the error is that you have set up user.mail and not user.email. So what you should do to configure the email is the following command line: git config --global user.email…
gitanswered Felipe Avelar 9,507 -
15
votes3
answers1869
viewsA: Why (1 == true) is "true" and (2 == true) is "false"?
What happens is this, when the true is replaced by a numerical value, it assumes the value of 1, so when you do: 1 == true In fact you’re doing: 1 == 1 What will return true, in the second case,…
-
8
votes1
answer124
viewsQ: How can I allow another application to start mine?
I’ve searched a lot, but I don’t know how to be in the list of applications that can open a certain type of file, for example, a photo. What I want is as if Whatsapp (or any other application) put…
-
1
votes1
answer81
viewsA: Form only works the second time
The problem is not redirecting the user when he can log in to that if: if(!$this->model->isUserLoggedIn()) And as the user is already logged in the second time on the page, it is successfully…
-
1
votes3
answers476
viewsA: How do I convert snake_case to camelCase (and vice versa) in Python?
One way to do it is to work with list comprehensions and join, as in the example below: import itertools def flatten(lista): return list(itertools.chain(*lista)) def…
-
0
votes1
answer35
viewsA: How to allow an event to reach other UI elements?
After searching a lot, the solution found was to use the VisualTreeHelper.FindElementsInHostCoordinates. Hence what was done was the following: First we left active the rectangle that is on the…
-
1
votes1
answer35
viewsQ: How to allow an event to reach other UI elements?
I own a xaml that I apply a rectangle over several images, in order to be able to manipulate them after a holding on them. The problem is that if I put the IsHitTestVisible in a state false in the…
-
3
votes2
answers355
viewsA: How to find, check and change file?
You will have to read line by line and then rewrite the file: arquivo = open("teste.txt","r") linhas = arquivo.readlines() arquivo.close() linhas_a_escrever = '' for linha in linhas: if "energia" in…