Posts by André Nascimento • 1,258 points
107 posts
-
1
votes2
answers634
viewsQ: Sort objects according to name attribute using Collections.Sort() or Reverse()
How to sort objects through the name attribute? I am implementing the Comparator interface. I made a small example. Let’s go to the codes: file: Person.java import java.util.ArrayList; import…
javaasked André Nascimento 1,258 -
0
votes1
answer97
viewsQ: redirect to the view
How can I redirect to cakephp based on the following code: <noscript> //redirecionamento aqui </noscript> I’m using: <noscript> <meta http-equiv="refresh" content="1;…
cakephpasked André Nascimento 1,258 -
0
votes3
answers1411
viewsA: Compare an integer typed with each Enum value
I corrected it. Where is: if (opcaoEscolhida == OPCAO) { Placed: if (opcaoEscolhida == opcao.OPCAO) { The code presented in doubt, now corrected, was: package; public Enum Enummenuinicial {…
-
1
votes3
answers1411
viewsQ: Compare an integer typed with each Enum value
Hello. I want to check if the option that the user typed corresponds to an option in the menu. I’m using Enum to show the options and the user type a corresponding number. But I can’t. Let’s see the…
-
0
votes2
answers6093
viewsQ: how to test with sql Injection
I want to do some tests of sql Injection. For this, I created a db called person and a table called users. I am passing some sql statements to test the ingestion of sql. Gives error, but does not…
-
1
votes1
answer768
viewsQ: Test main class input method with Systemin drive in test class
As I test the System.out.println() a method? The method I want to test displays the phrase: Enter the name > How do I test whether or not this phrase has been changed in the Test? main class:…
-
1
votes1
answer523
viewsQ: String reading error - picking n from buffer
I’m using a variable of the type String to get the answer whether or not to enter a new account. When I start the program, in do while I ask for the name of the holder. The program does not display…
javaasked André Nascimento 1,258 -
0
votes1
answer208
viewsQ: Synchronize local app times via internet
Hello. I have an application that I’m building in cakephp. The application keeps showing the date and time on the page, but it’s computer time. How do I get the time of some server or internet link?…
-
0
votes3
answers269
viewsA: Solve logic error
I did it in a simpler way: Isuário enters with a number, the program must print the largest prime number between 1 and the number typed int main() { int i, num; printf("digite um nume:\n");…
canswered André Nascimento 1,258 -
0
votes1
answer41
viewsQ: Form via post and pass in beforeSave
I’m not able to send the data via post, is via put. You’re not going through callback beforeSave and when I debug the request in the controller, you’re put. Maybe that’s why you don’t pass callback…
-
0
votes0
answers43
viewsQ: Count function brings different amount according to date parameters passed
I need to take the month and the year twice: to consult the expenses and calculate the amount of expenses found. In the function consultarDespesas, step for the two global variables to subsequently…
cakephpasked André Nascimento 1,258 -
1
votes2
answers63
viewsQ: Date formatting is changing its parameters
I’m using callback beforeSave to format the date of d/m/Y for Y-m-d. The date is being saved as Y-d-m instead of Y-m-d. Syntactically the code is right. The date is in the table as date. function…
-
1
votes2
answers52
viewsQ: Query brings data ignoring $conditions
I’m making a query and the cake is bringing all the data ignoring $conditions. I want to search by date, but when I put a date that does not exist in any record, it still brings all the data. public…
cakephpasked André Nascimento 1,258 -
0
votes2
answers68
viewsA: callback afterFind
Already solved. The problem is that I was using the same methods to format date and monetary value of beforeSave. beforeSave replaces "/" with "-" and puts it in y, m, d. E replaces "," with "." in…
cakephpanswered André Nascimento 1,258 -
1
votes1
answer196
viewsQ: Error while uploading files to remote server
Hello. I created a remote repository in bitbucket and did all the normal operations via command line: clone, add, commit, push and pull. I saved a copy on the drive and had to format the machine.…
bitbucketasked André Nascimento 1,258 -
1
votes2
answers68
viewsQ: callback afterFind
Hello, I still can’t use the afterFind, even following some posts on the net. Help me with the controller and model, please. I use beforeSave, but I can’t use afterFind. I’ve already put Return…
cakephpasked André Nascimento 1,258 -
0
votes1
answer50
viewsQ: Rule in model using str_replace() to replace "," with "."
The rule is not working. I take a real value with "," and want to replace it with "." to save the decimal values in the bank. For example, the value 35.39 reais would be 35.39 in the bank. The rule…
cakephpasked André Nascimento 1,258 -
1
votes1
answer3085
viewsQ: Send local repository to remote repository
Hello. I want to send my project called sfp to bitbucket. I didn’t create this project or repository there at the bit, but I want to know if it is possible to already send and create the Repo at the…
bitbucketasked André Nascimento 1,258 -
2
votes1
answer2028
viewsQ: Display message for form validation instead of alert
I am making a form that if the user leaves the name field blank, display the message in the field instead of an alert. The document.write does not work with function through an event. I am using…
javascriptasked André Nascimento 1,258 -
0
votes5
answers1500
viewsA: Keep displaying the date and time in the javascript browser
function DataHora() { var data = new Date(); tempo.innerHTML = data; var dataBr = tempo.toLocaleString(); setTimeout("DataHora()", 1000); } <body…
javascriptanswered André Nascimento 1,258 -
3
votes2
answers369
viewsQ: Field allowing only an exact amount of data
How to put a field in mysql that only allows 4 characters. No more and no less? I’m doing like this: alter table cartoes add os_4_ultimos_digitos int (4); < But it takes a Constraint and I can’t…
mysqlasked André Nascimento 1,258 -
1
votes1
answer491
viewsQ: Rule in model to format date
I have two rules in two camps. In the data_expense field, I want to take the format d/m/a and move on to a-m-d. Turns out when you save it on the bench, it’s like 0000-00-00. I don’t know how to…
cakephpasked André Nascimento 1,258 -
0
votes1
answer66
viewsQ: Output command or pass output in php
Hello. I want to return the success message if a name is inserted into the array. And I want to display the names in that array. I don’t want to use Alert(). Document.write doesn’t work well in…
javascriptasked André Nascimento 1,258 -
0
votes1
answer352
viewsQ: Fix Where Clause with like null operator that finds data with null parameters
I have a query that is picking up the fields null with the like operator. Let’s see an example in the query below: $palavraChave = null; $consulta = "select * from receitas where receita like…
sqlasked André Nascimento 1,258 -
-1
votes1
answer40
viewsQ: isEmpty() method giving error in a while block
Hello. I am developing a board game and in the method below I want to check if in the matrix of integers x any position has been set or is vasia. Error in line: while. public void…
javaasked André Nascimento 1,258 -
0
votes0
answers80
viewsQ: A query to add the values and select all fields according to the clause "Where" and "or" with the like operator
In cakephp, I want to do a query that takes all the values according to the parameter passed to the expense field or to the data_expense field, as well as summing the values of the expense…
cakephpasked André Nascimento 1,258 -
1
votes1
answer294
viewsQ: Search query in cakephp
I want to do a query that finds the date, but the query below is finding even when I do not pass value or when it is a value that has nothing to do with date: $busca =…
cakephpasked André Nascimento 1,258 -
2
votes2
answers100
viewsQ: What is the error in this regular expression?
What is the error of this regular expression. I have tried it with another function and the mask works. But this one for pennies, it doesn’t work. What’s the mistake? <html> <body>…
javascriptasked André Nascimento 1,258 -
7
votes4
answers29938
viewsQ: Regular expression to accept only numbers and a ","
How can I make an expression or function to pick only numbers and comma, which the user informs. I want to pick up a product pricing form. If the user types a letter or something other than the…
javascriptasked André Nascimento 1,258 -
1
votes2
answers306
viewsQ: How to set flash in CAKEPHP view?
In the method in my controller I select the flash, according to the condition. if ($this->Auth->user()) { //redireciona apos o login; echo $this->Session->setFlash("Bem-vindo"); } How…
cakephpasked André Nascimento 1,258 -
0
votes2
answers166
viewsA: Several errors in code C - How to fix?
#include <stdio.h> void receber_matriz(l, c) { int M[l][c]; for (l = 0; l < 4 ; l++) { for (c = 0; c < 4; c++) { printf("\nInsira o valor do numero da linha: %d e da coluna: %d", l, c);…
canswered André Nascimento 1,258 -
3
votes1
answer321
viewsQ: Error analysis and correction in DB connection test using Hibernate
Class to test bank connection with Hibernate. package br.drogaria.main; public class HibernatUtilTeste { public static void main(String[] args) { //abre sessão…
-
3
votes2
answers2241
viewsQ: Exit loop when string is empty or when typing a specific word
I am making an algorithm that displays the total price of purchases. I enter the product, unit price and quantity. Again I have the possibility to enter with the product and so on. When you want to…
javaasked André Nascimento 1,258 -
0
votes1
answer53
viewsA: view of eclipse problems
For the eclipse to focus only on project views, select the other projects, in the project menu click close. You will not access views from other projects, making it easier to view issues and alerts…
eclipseanswered André Nascimento 1,258 -
0
votes1
answer53
viewsQ: view of eclipse problems
Hello. When I copy a program and go into the problem view, the eclipse shows problems and alerts from other projects already copied before. How can I not close the eclipse and just focus on the…
eclipseasked André Nascimento 1,258 -
3
votes2
answers17491
viewsA: What does software scalability mean?
An example of scalability: You have a company and want to prevent changes in laws, increased consumption and data generation. Then you architect your system to meet these changes with the least…
-
0
votes1
answer79
viewsQ: Connection to database and mapping
@Techies I re-asked the question with an appropriate title, based on the initial doubt in: What to do after mapping? Hello. Following the guidelines of another post, I have some questions, starting…
javaasked André Nascimento 1,258 -
0
votes1
answer74
viewsQ: What to do after mapping?
I want to make a system to place and search data in a database. It is an agenda that the user inserts the location, the commitment and the priority. So far, that’s it. I’ve already started mapping.…
-
0
votes3
answers373
viewsQ: Reset button on the form
I want to reset all fields of a form using Cakephp framework. What happens is the following, the sign up button is only enabled if the user marks the checkbox to accept. If he clicks the clear…
cakephpasked André Nascimento 1,258 -
6
votes2
answers2368
viewsQ: How to use "Biginteger" type to solve this problem?
I’m solving a story-based solution involving the chessboard. See a piece of history: "Then Sessa asked for his payment in grain of wheat as follows: One grain of wheat for the first box, two for the…
javaasked André Nascimento 1,258 -
2
votes3
answers1222
viewsA: Filters with PHP - Search Form
From what I understand, you want to show the data searched. Let’s go to a possible answer: $busca=mysql_query("select * from Atividades"); $row = mysql_num_rows($query); if ($row==0) { echo "Não há…
-
0
votes1
answer56
viewsA: Field search
Do you want to take the product in the user table? You have to model the database correctly to better implement the querys. You did the right thing in the query structure to display the product and…
phpanswered André Nascimento 1,258 -
1
votes1
answer183
viewsQ: Understanding the same method in Pository and in service
Why in the service and controller, do objects point to the same function? I’ll detail: Repository: @RepositoryRestResource(exported = false) public interface AtividadeRepository extends…
jpaasked André Nascimento 1,258 -
0
votes1
answer73
viewsQ: Details with @Autowired and Down object
There’s been a conflict of concepts with me. I have here a service called: AtividadeService There are some lines that catch my eye: import com.dendetech.entity.Atividade; Why import Entity? If it…
-
0
votes2
answers102
viewsA: trying to connect with mysqli
You need to pass the data via post: And the button: <input type="submit" value="Enviar"/> I recommend doing it step by step. For example: check if you connected to the database server. Then…
-
0
votes1
answer1023
viewsQ: JPA annotation @Autowired
@Autowired is the same as extends? Let’s take a small example: package com.dendetech.services; import com.dendetech.Entity.Participant; import com.dendetech.repositories.Participanterepository;…
jpaasked André Nascimento 1,258 -
9
votes1
answer1492
viewsQ: Libraries, interface, classes and methods
What’s the difference between libraries and interfaces? For example, on the line: import java.util.Scanner; The util would be the interface and Scanner the class? Or the util would be the library…
-
2
votes1
answer5896
viewsQ: Service difference, repositories and controller
What’s the difference between services, repositories and controller in JPA. I know the repositories work with data abstraction. Who takes the database data? Mapped classes (@Entity), controller and…
jpaasked André Nascimento 1,258 -
0
votes0
answers282
viewsQ: Compile java and generate . jar
I have a Maven project already well structured. I want to create the . jar to run the application. Inside the project, at the prompt, I did: mvn clean install package Returns the error: C:…
javaasked André Nascimento 1,258 -
6
votes1
answer593
viewsQ: Using constructor and using set() for same attributes
I’m studying JPA following the example of uaiContacts. His project is on Github. I took the file example modelContact.java: The class Contact is mapped: public class Contact { @Id @GeneratedValue…
javaasked André Nascimento 1,258