Posts by Piovezan • 15,850 points
395 posts
-
1
votes1
answer92
viewsA: Magnetometer sensor works only on a few devices
Magnetometer is the sensor that gives the cell phone compass properties (Compass, in English). Not all phones have, and those that do not have an equivalent sensor. For more information about…
-
2
votes0
answers55
viewsQ: What are the benefits of object orientation?
Encapsulation allows isolating changes in the implementation code without affecting the interface offered by the class. It does not allow the internal state to commit to the client of the class…
-
4
votes0
answers53
viewsQ: Criterion for modular decomposition
Drawn from: http://wiki.c2.com/? Encapsulationisnotinformationhiding (my emphasis): As the article Linked to at the top of the page mentions, "information Hiding" was introduced by Davidparnas in…
-
1
votes0
answers75
viewsQ: How to divide a program into functions?
How to divide the code into functions in the imperative paradigm? Depends on the type (procedural, modular, OOP)? Is it broad to ask this, even if only for one of these subparadigmas? Is there any…
-
1
votes1
answer52
viewsA: Java.Util.Set does not add new elements
Overwrite the methods equals() and hashcode() class Loja. Preferably let your IDE create them for you. When it asks you for which criteria to specify the methods add the store id as criteria. Read…
-
2
votes2
answers76
viewsA: clone, copy, changeable object on getter for security
In OO there is the concern not to violate the encapsulation of classes, or rather, the concealment of information. We can say that it is a design principle. This violation occurs for example when…
-
2
votes1
answer56
viewsA: How to take only one value of a Random variable and turn it into a constant?
Use the keyword final: final int cartaUnoPersonagem = new Random().nextInt(personagem.length);
-
7
votes1
answer327
viewsQ: What does the "MZ" listed at the beginning of executable code mean?
In the good times of MS-DOS I executed the command type <nome-do-arquivo> in archives .EXE and a lot of ASCII (binary code code code code) characters started by the acronym MZ. I always…
-
0
votes2
answers63
viewsA: Why don’t my labels show up in the swing?
It’s a more-or-less answer because I don’t have the upper hand in order to better explain what’s going on, but it should work if I do: f.getContentPane().add(c); You also need to remove the…
-
0
votes1
answer340
viewsA: Histogram in Java
Reading the class documentation Bufferedimage, it seems to me that you can read the RGB value of each pixel at position (x, y), this value which is returned as a int. The name of the method is…
-
1
votes1
answer44
viewsQ: How to set fields on pages
Please inform if I need to improve the explanation. I am trying to create a report in Jaspersoft Studio composed of three sections: customer information (a Javabean containing name, email, date of…
-
1
votes0
answers92
viewsQ: Two-page report (sub-report) does not generate second page
The problem is this. I have two reports from one page each and I want the second to be the sub-report of the first. The second is in the band Summary of the first as a subreport, but when the first…
-
1
votes0
answers29
viewsQ: Jasperreports - Is it possible to work with datasource with dynamic (non-static) method?
I am trying to generate a report powered by a web service. The idea is that when the user calls the report generation command he (the command) calls a method that will bring back Java Beans from a…
-
0
votes1
answer82
viewsA: Relational database without referential integrity
Depends. If the programmers of the software abused the lack of referential integrity, aware of it or not, then it is bad, because you will have inconsistent data in your database that you may not…
-
2
votes1
answer123
viewsA: Socket with threads in Java
I think it’s a lack of giving flush after sending. For example: saida.writeUTF(clientedigitou); saida.flush(); It is necessary in this case for the message to be effectively sent.…
-
1
votes1
answer236
viewsA: How to rename a file with lib.io’s File class?
In Java you do not work directly with files, but with abstractions that represent these files, which is the case of the object File. The new serves just to instantiate the abstraction, but will not…
-
1
votes1
answer148
viewsA: How to add CR or LF to the end of the. pdf file generated by Stella.Boleto?
These are the characters from Carriage Return and Line Feed. One is the ASCII code 10 and the other ASCII 13, I do not remember now which is which (also do not remember if it is in hexadecimal too,…
-
1
votes1
answer42
viewsA: Using variables within the onPostExecute method
You are not required to pass as Return, the two forms are valid. If you had more than one variable to pass (unusual situation, but it happens) you would have to use the form without Return, which is…
-
1
votes1
answer57
viewsA: Send gps location to a server
It is not recommended to request within the method onLocationChanged() because it is called by the main thread, which controls the user interface. So doing it there will cause crashes (the…
-
3
votes2
answers121
viewsA: Arithmetic operations in PHP or Mysql?
As a rule, it’s best to keep it in the database. If you do on the application server (PHP) you have the overhead of transferring an amount of data that can be large for only after doing the…
-
1
votes4
answers153
viewsA: Public Static Void Does Not Work Properly - NETBEANS
The main method should be called main and have the following signature (i.e., obey the following standard): public static void main(String[] args) { ... }…
-
1
votes1
answer75
viewsA: How to prevent an object from being instantiated with a certain property?
Try this. The exception if launched will prevent the object from being instantiated. import java.util.Scanner; public class Fotocopiadora{ private String modelo; // essa string não deve ser nula…
-
5
votes1
answer56
viewsQ: Is it possible to reuse domain classes between different applications?
Some materials including recent cite the possibility of reusing domain classes for different applications. Example This reuse is viable? How he does in practice?…
-
0
votes1
answer101
viewsQ: What is the relationship between the application layer and the controller class?
The book Using UML and Standards presents briefly the layered architecture, one of which is the application, also called the application controller. It also features the GRASP standard called…
-
1
votes0
answers23
viewsQ: What is the application/application layer on a layered architecture? What is the difference to the domain layer (business rules)?
On a layered or layered architecture, which is the application layer or application layer? What’s the difference with the domain layer and business rules?
-
1
votes1
answer1645
viewsQ: Paper cutting (trigger guillotine) on Bematech MP-4200 TH printer
How to make the Bematech MP-4200 TH (non-fiscal) printer cut paper at the end of printing in a Java application?
-
5
votes1
answer1645
viewsA: Paper cutting (trigger guillotine) on Bematech MP-4200 TH printer
Documenting the solution I found. Caveats: 1.: Avoid mixing printing via DLL with via Spooler, can cause communication failures and generate spurious characters in printing. 2.: the DLL (or my…
-
7
votes1
answer475
viewsQ: What are application and domain services in Onion Architecture?
In Onion Architecture there is the core (application that includes domain objects, Domain Services and Application Services): I am in doubt about what the last two are (Domain services and…
-
5
votes2
answers11728
viewsQ: What characterizes a "basic CRUD" project?
Round and a half comes up a question talking about application "basic CRUD". I understand that the application contains basically the so-called "sign up screens", from which manipulate tables in…
-
2
votes1
answer186
viewsQ: What is the benefit of a classification algorithm being stable?
A classification algorithm (Sorting) is said to be stable if it maintains the relative order of the elements with equal keys. I think my question is, what is the benefit of maintaining this relative…
-
5
votes1
answer3676
viewsQ: What are software components?
"Component" is a word used in various contexts and I imagine that it is difficult to define generically. By definition it is a part that makes up a whole. For example, a subsystem. It is also said…
-
1
votes1
answer185
viewsQ: Code review: field validations, how to abstract correctly?
In a Java Swing application I have four JTextFields: Weather minimum of handover of an order in minutes Weather maximum of handover of an order in minutes Weather minimum of withdrawal of an order…
-
1
votes3
answers227
viewsQ: What is the pattern represented by this class called?
I wonder what kind of class this is DaoDeAutenticacao, whose skeleton I wrote down. Despite the name I don’t think it’s a DAO (Data Access Object), however it is defined, and yes something else (a…
-
0
votes1
answer76
viewsA: How to change the structure of a static method at runtime?
If I understand what you want, you don’t. You want a ternary that calls distinct methods according to one condition, right? Java can’t stand it, at least I’ve never seen it. This string of methods…
-
7
votes2
answers339
viewsQ: Why does String hashcode() in Java use 31 as a multiplier?
In Java, the code hash for an object String is computed as s[0]*31^(n-1) + s[1]*31^(n-2) + ... + s[n-1] using integer arithmetic, where s[i] is the i-nth character of the string, n is the string…
-
5
votes1
answer254
viewsQ: Two marbles and a 100-story building
Classic question of job interviews... You receive two marbles (marbles), you are told that they will break when they fall from a certain height (and presumably do not suffer damage if they fall…
-
2
votes1
answer114
viewsQ: Is there a canonical definition for database schema (schema)?
Each bank seems to define scheme (schema) in a different way. See for example the Mysql, the MS SQL Server, the Postgresql... Is there a relevant canonical definition or does only the individual…
-
1
votes1
answer56
viewsA: Is it possible to access a shared variable with another thread without a competition problem?
You did not specify the competition problem that is happening, but I imagine it is the simultaneous access by two threads to the variable myList. Try initializing the variable like this and see if…
-
7
votes0
answers166
viewsQ: How to learn object orientation correctly?
A lot of the "OO" code you see around is procedural. I have already committed and continue to commit several "sins" per day by programming OO. The paradigm is not easy to learn and it takes time,…
-
1
votes1
answer227
viewsQ: How to reduce the spacing between items in Boxlayout?
In my example, the class Teste is a JPanel with BorderLayout. Within the central region of this layout there is a JScrollPane containing another JPanel with BoxLayout vertically. The intention is…
-
1
votes1
answer140
viewsQ: Distribution of components in Grouplayout
The example below has a GroupLayout which contains two elements, a custom search and filter bar (JPanelSearchAndFilter) and a JScrollPane. When it runs and then the window is maximized you can…
-
1
votes0
answers22
viewsQ: Jscrollpane producing glitches on the screen
I have little experience with Java Swing and am getting beat up with one simple thing. The code below produces glitches (artifacts/dirt) on the screen when the scroll bar is dragged repeatedly and I…
-
16
votes4
answers276
viewsQ: Why is object orientation not suitable for most scenarios?
Citation maniero: It’s the biggest problem we have in our area, and it’s getting worse: something very good is created and it serves 1% of the problems, maybe 10%, but people want to use it for 100%…
-
1
votes1
answer80
viewsA: null Object Reference
You have to instantiate the inflater. Try to fit this line at the beginning of the method getView(): inflater = activity.getLayoutInflater(); You will need to find a replacement for the variable…
-
13
votes3
answers818
viewsQ: SOLID is all that they say?
Related: What are the SOLID principles? I ordered my "Agile Principles, Standards and Practices in C#" by Robert C. Martin and one of the reasons is SOLID. But I’m reluctant about SOLID. I don’t…
-
4
votes1
answer159
viewsQ: How do IDE and compiler integrate?
Taken from here: What is a programming language, IDE and compiler? In general the compiler is a console program, but there are cases that they are libraries that can be used in conjunction with…
-
0
votes2
answers171
viewsA: Error #1064 in CREATE PROCEDURE - Phpmyadmin SQL
See if it solves (I took from here): Error 1064 occurs due to Mysql version incompatibility. Different versions have different reserved words, which, if are used by a previous version, cause the…
-
0
votes1
answer25
viewsA: Error in BD/list
Method name spelled wrong. Shouldn’t getItemIdAtPosition() and yesgetItemAtPosition(). getItemIdAtPosition() returns a long, which is the item ID. getItemAtPosition() returns the item, which can be…
-
0
votes1
answer31
viewsA: Different result in order by with limit
I think it has to do with that: When using LIMIT, it is Important to use an ORDER BY clause that constrains the result Rows into a Unique order. Otherwise you will get an unpredictable subset of the…
postgresqlanswered Piovezan 15,850 -
2
votes2
answers128
viewsA: Passing parameter in Mysql LIMIT
The SQL language does not allow it. What it allows is to do UNION ALL: (SELECT * FROM sistema LIMIT 1, 300) UNION ALL (SELECT * FROM sistema LIMIT 20, 300) ORDER BY alguma_coisa; The UNION ALL…