Posts by mari • 1,280 points
38 posts
-
3
votes1
answer75
viewsA: setInterval does not stop after restarted
What happens is that when you use the remove() in the li it is no longer the same element and loses the application of events mouseover and mouseout. Even it is not only after the first time of a…
-
2
votes1
answer185
viewsA: Display array of "children" according to array of "parents" (JS)
Assemble each Tab with the corresponding Cards into a single React array of components. const dados = [ { "id": 1, "nome": "Pai1", "filhos": [ { "id": 1, "nome": "Filho1" }, { "id": 2, "nome":…
-
6
votes3
answers127
viewsA: How to get dates with X days interval?
Check if the difference between dates is a multiple of 7: select * from tabela where MOD(DATEDIFF(CURDATE(), data), 7) = 0; This select will even bring a record with data = CURDATE(), so if you…
-
0
votes2
answers119
viewsA: LIMIT IN A QUERY IN A FIELD
It is possible to consult with a Union, excluding students who are already in the private quota to enter also the neighborhood quota. with tb_particular as (select nome, media, 'cota escola…
-
2
votes2
answers2305
viewsA: React.js creating several components with arrays
Place an array of data in the state: const dado = {compra: response.data[0].rows, venda: response.data[1]....}; const { dados } = this.state; dados.push(dado); this.setState(state => ({state,…
-
1
votes1
answer77
viewsA: How to sort a vector (A) according to another vertor (B) (containing repeated numbers) in javascript?
One solution is to maintain an array with the last found index for an id, and using the function indexOf() search from that last index instead of always from the beginning of the array: function…
-
0
votes1
answer236
viewsA: Sort via javascript function
You transform the Htmlcollection of the <tr>s into an array, ignoring the first tr that is of the haeders, and use the Sort of the Array object with a function compare() comparing strings from…
-
0
votes2
answers91
viewsA: JS not formatting the thousand value correctly for Input and not receiving correctly in PHP / Database
You are replacing the comma by a dot, but you are not removing the dot that in en-br is the thousand separator. Thus the conversion to decimal stops at the first point (that of thousand that was not…
-
1
votes1
answer496
viewsA: Using Stack, how can I check if one string is the inverse of another?
First, this is not palindrome. Palindrome is a string that reading from beginning to end is equal to the end to start. Example (ignoring accents and spaces): Help me get on the bus in Morocco That…
-
0
votes2
answers131
viewsA: Add time to date and time with PHP
You must use strtotime() with the date and time string followed by the range you want to add. That is, to add time, minute and second would have to follow the date and time with '+X hours +Y minutes…
-
1
votes1
answer902
viewsA: How to compare a string position to a? C character
As the answer was eventually given comments, I will put it here for future references. Also decreasing the number of loops: #include <stdio.h> #include <stdlib.h> #include…
-
1
votes1
answer1821
viewsA: The data property does not exist in type 'Intrinsicattributes & Intrinsicclassattributes & Readonly & Readonly<{ Children?: Reactnode; }>'. ts(2322)
The state must be initialized within the constructor of the class: import React, {Component} from 'react'; import Graph from './components/Graph'; interface Props{} export default class App extends…
-
2
votes2
answers74
viewsA: Scanf does not close the read
scanf with %s will read the whole line, so it would be enough l loops. Also, unless you will need matriz_aux for something else it is superfluous and one can decrease the amount of loops: #include…
-
1
votes1
answer265
viewsA: How to check if an XML type field is null or empty in SQL SERVER
You don’t have to make a if for the xml type; just check if the field is null. For this you must have @isNullable = 1 and will enter this section that makes the check: /*vérifie si est nullable et…
-
1
votes2
answers915
viewsA: Selecting an Item from a List<T> with index equal to the iteration value of for
It’s kind of hard to know what you want to do (and then think about how). What’s the expected result? It would be a String with 10 object codes from the list between Qtd*10 and Qtd*10+10? In this…
-
0
votes2
answers2480
viewsA: React JS + PHP help
The console.log(this.state.carros); shortly after the setState will not work because setState is asynchronous. Place the console.log inside the render(): should appear s output a couple times on the…
-
1
votes1
answer35
viewsA: Concatenate values of a Database into SQL
In postgresql is easy to do using with. Given the table: |nome |divergencia |motivo | |---------------|---------------|---------------| |caio |3 |10 | |caio |4 |4 | |caio |4 |8 | |maria |3 |5 |…
-
1
votes2
answers154
views -
6
votes1
answer899
viewsA: React Native - Schedule Local Notifications
Creates a notification for each day: // toda terca a partir de hoje, essa hora d = new Date(); d.setDate(d.getDate() + (2 + 7 - d.getDay()) % 7); PushNotification.localNotificationSchedule({ //...…
-
1
votes2
answers982
viewsA: Selectonemenu is not loaded when selecting object for editing
Call populaCities in edit(): public void editar(){ funcionario = funcionarioBO.find(funcionario.getCodigoFuncionario()); populaCidades(null); disable = false; btnNew = true; btnSave = false;…
-
0
votes1
answer27
viewsA: Typing error when receiving foreign key from the database
There is no type Cidade and Doenca in the database, and yes in Java code. What the error is saying is that you are picking up a string, which is the result of rs.getString("cidade_nomecidade") and…
-
4
votes1
answer582
viewsA: React.js problem
The message below indicates that you are importing as default a class that has not exported as default, or otherwise imported as default and exported as default: You likely forgot to export your…
-
1
votes1
answer198
viewsA: Which string library can I use?
How are you using this in the call to ToStringBuilder.reflectionToString(this, ToStringStyle.MULTI_LINE_STYLE);, I suppose this is precisely the implementation of the toString() method of the Person…
-
0
votes2
answers1539
viewsA: c3p0 error - bad pool size config start 3 min 5. using 5 as start
It’s just a warning (Warning) that the initial value of the pool size (start) is smaller than the minimum pool size (start 3 < min 10), and so 10 will be used as the starting value (using 10 as…
-
8
votes1
answer771
viewsA: Hibernate with Java 9
In the exception we have: Caused by: java.lang.NoClassDefFoundError: javax/xml/bind/JAXBException That is, did not find Jaxbexception (at runtime, only). JAXB Apis are considered to be JAVA EE Apis,…
-
1
votes1
answer700
viewsA: java.lang.Arrayindexoutofboundsexception: length=0; index=0
You took the test if(response.equals(null)){ and actually Sponse is not null, but is returning an empty vector. This is Sponse has zero size, hence the length=0; index=0. When trying to access array…
-
2
votes2
answers460
viewsA: Recursive or loop method to popular or list an n-dimensional array
Since I don’t know the purpose of the code, here’s a very basic way to create the matrix points, using recursion: private static int numLinha; public static void main (String[] args) throws…
-
1
votes1
answer154
viewsA: How to leave values in report with iReport(or TIBCO) only with 2 decimal places
Set the Pattern attribute to the textField tag: <textField pattern="###0.00"> <reportElement x="437" y="462" width="100" height="20"/> <textElement/> <textFieldExpression…
-
3
votes2
answers622
viewsA: How to rotate an arrow inside a circle using Java2d?
To apply the formula A={x+L×cos(θ),y+L×sin(θ)} in your case, A is the end point of the straight. So: angle += 0.2; endX = (int) (x+length*Math.cos(angle)); endY = (int) (y+length*Math.sin(angle));…
-
12
votes3
answers1178
viewsA: What is the difference in use between the Matcher() and find() methods?
matches() will tell if the whole string matches the regex of the Pattern; find() will tell if you have regex in String, and if called again, if regex occurs again, and so on. See the output of this…
-
1
votes1
answer463
views -
0
votes1
answer151
viewsA: Chained list sorted with errors in add
Assuming the code of the Node class, probably getValue() of Node returns a T-type object and not always a Double. Regardless of whether you are ordering an ordered Linkedlistordered<Double>…
-
1
votes2
answers195
viewsA: How to list the latest message from all conversations
As Jefferson Quesado suggested, the query becomes simpler using a case: SELECT mensagens.* FROM mensagens JOIN ( SELECT (case when id_user=7 then contact_user when contact_user=7 then id_user end)…
-
3
votes1
answer65
viewsA: Remove subArray from a Main Array
To remove an item from the list, in the middle of the iteration of the list, Iterator should be used. Iterator<List> it = listaInformacoesNota.iterator(); while (it.hasNext()) { List…
-
1
votes3
answers91
viewsA: Registration error "Does not recognize the property"
Where you have adminLivrosBean.Book, switch to adminLivrosBean.Book with 'l' minimum. Servlet when viewing adminLivrosBean.book will search in the Adminlivrosbean class (class with @Managedbean…
-
2
votes1
answer134
views -
3
votes4
answers2358
viewsA: Return day of week from date in dd/mm/yyy format
Your mask is wrong, as Articuno replied. You can also shorten your code to: public static String getWeek(String date){ //ex 07/03/2017 String dayWeek = "---"; GregorianCalendar gc = new…
-
2
votes4
answers482
viewsA: Comparing Strings using Arraylist
1 - The index i goes from 0 to size-1: data[0]=="Given 1"... data[4]="Given 3" (the last Given 3). Therefore the for condition has to be 'i < size'. 2 - The 'x<data.size()' condition is after…