Posts by Caffé • 17,429 points
254 posts
-
2
votes1
answer42
viewsA: Sqlserver 2012 - Column '' in table '' is of a type that is invalid for use as a key column in an index
This index would not be useful for this type of query you described. We should not create indexes for columns whose information varies very little between records. For example, it makes no sense to…
-
10
votes6
answers56799
viewsA: What is Nullpointerexception and what are its main causes?
What is Nullpointerexception? Nullpointerexception is an exception thrown when trying to access members of a non-existent object. That is, the code assumes that a given variable references an…
-
18
votes8
answers2700
viewsA: Is it good practice to mix Php and Html?
Is a pattern. Is not recommended. It’s not a good practice. In many cases it doesn’t matter. There is a principle in software design called Separation of Concerns, that determines that each part of…
-
5
votes2
answers1066
viewsA: Listview or Gridview in Windows Forms
I see the grid as a tabulated list of data that doesn’t talk all about itself - it usually requires a header (a form with the parent data of these records) and a summary. Already the listview I see…
-
31
votes3
answers23304
viewsA: What is the difference between "passing by value" and "passing by reference"?
Introducing: GUYS by value/reference versus PASSAGEWAY by value/reference Much of the programmers' resistance in accepting an explanation about passageway by value/reference comes from the confusion…
-
9
votes2
answers2638
viewsA: Search words cannot find the word
An object-oriented approach This problem can be solved also with a bit of good old object orientation, decreasing the repetition of code and the amount of loops and ifs in order to facilitate…
-
5
votes4
answers16866
viewsA: How to know which DATETIME format is used in a given column of SQL Server?
As already said, the date in the database has no format. So what you want to know is what date format the database accepts for data entry or query. This in Microsoft SQL Server depends on some…
-
3
votes3
answers1500
viewsA: Copy bank record
To copy a record by generating a new id for it (column identity), solution 2 of the @Tobymosque response (clarify the columns leaving out the column id) is the right one: insert into pessoa (nome,…
-
87
votes3
answers21628
viewsQ: Definition of the "Big O" notation
In discussions about algorithmic performance, the use of notation is very common Big O: O(1), O(n), O(n2) It is easy to find the scientific definition of this notation and it is easy to find some…
-
3
votes1
answer1107
viewsA: Unit test of implementations of a Generic class
How best to test each Crudservice implementation? Creating an explicit test for each implementation. You can test the virtual methods of the abstract class by creating in the test code an…
-
4
votes1
answer1776
viewsA: Unit test/ Mock of a JPA query
To test whether the method findAll fulfills its role of returning all entities of a given type, the best option is to fire this query against a real database. I explain: you are testing a very close…
-
2
votes2
answers2828
viewsA: CURSOR vs table variable type
As many people have said here many times: you should only try to solve known performance problems. And potential performance issues (those not yet known but suspected to appear) may well be…
-
2
votes1
answer4660
viewsA: Foreign keys in java
The DAO of City can of course obtain the id of State reading the property city.getEstado(). getId(). You can set in the state the id which was generated for it at the time it was inserted by its…
-
0
votes2
answers259
viewsA: Create two jar with the same pom by eclipse
Maven has a plugin specialized in generating files jar with the project sources (source code for production or testing), the Maven Source Plugin. To generate a jar with the project production source…
-
15
votes5
answers12967
viewsA: Why is the use of GOTO considered bad?
Why the use of GOTO is considered bad? The drop has unique capabilities to render a code unreadable. What would be the reasons to avoid GOTO and what problems caused by its use? I will list below…
-
1
votes1
answer1667
viewsA: String Cast for int Hibernate
Hibernate SQL (HQL) supports CAST similar to native SQL, with the difference that the types are those of Java and not those of the database. Therefore: u.totalamount = CAST(:searchString as Integer)…
-
3
votes1
answer157
viewsA: How to get the necessary knowledge about a domain?
Your question is more related to the survey and analysis of requirements than to the DDD itself. The DDD does not provide any technique for lifting requirements. It makes clear that knowledge about…
-
2
votes1
answer1176
viewsA: The Primeface confirmation screen does not work
You are trying to manually program the call to confirm. That’s not the idea. The idea is that the confirm override the standard Javascript confirmation, then you program the button normally to do…
-
7
votes2
answers2347
viewsA: Why does my Try/catch only accept "Exception and" (Generic)?
In fact your Try-catch accepts yes other types of exception, more specific, but you will not escape from having to also treat the more generic type Exception or having to add it to the method…
-
1
votes1
answer107
viewsA: Modification of variables passed by parameters
You may not be observing the expected result simply by trying to access windows from a secondary thread, and this is illegal. You shouldn’t try to change the appearance of a button from another…
-
1
votes1
answer100
viewsA: Logic for Directory System
A copied directory is a new directory, so you need a new Id. This goes for children too - a new directory will also be created for each child, so each child needs a new Id. Original table content…
-
11
votes4
answers14217
viewsA: How to create/maintain "global variable" in java? To log in
The easiest way you ever know, which is your first option: "Create a Static and public attribute in Jlogin or Login to save the user and access it outside Jlogin." Although you’ve seen "it’s a bad…
-
2
votes2
answers160
viewsA: Best high availability path for my need
The question talks about high availability and centralization of remote data, and you already say that you can not count on high availability connection. If stores do not have high availability…
-
13
votes3
answers2082
viewsA: Documentation at the beginning of a project working alone
As this seems to be the focus of the question, I will only talk about the documentation of engineering software and not documentation of use of the software. Your observation that the documentation…
-
2
votes2
answers2092
viewsA: Fill all fields of an Object iteratively
You need to implement something in your object that determines the order of the properties so as to establish a convention for the order of the parameters in the array. One option is to create a…
-
9
votes7
answers1682
viewsA: Make the class builder private?
We have a lot of good answers here but since I grumbled at something in each of them, I think it’s only fair that I expose my own. As already said, the reason for the error is that you are trying to…
-
8
votes3
answers1556
viewsA: SQL in the code or in the database?
Completion: Prefer writing queries on the application side instead of writing in stored procedures. Why: The following are some factors that lean towards writing queries on the application side…
-
5
votes8
answers5853
viewsA: Recognize word repeats in String
Algorithm: In this solution I broke all the text in tokens. Each token or is a word or is anything else between words (spaces, scores and other symbols). Then I go through the tokens to see if each…
-
4
votes1
answer168
viewsA: Construction of DDD object knowledge
It is impossible to start an application and know that for it to do what it has to do it will take so many objects. The identification of these objects comes directly from the ubiquitous language…
-
5
votes1
answer1163
viewsA: A delimited context only has domain model code?
When delimiting a context, we take into account the domain and not the infrastructure that will serve it. Thus, the Sfraestruture is not part of a delimited context. See, a system can meet very…
-
2
votes1
answer66
viewsA: Make an IF to set WHERE
Include the condition of if in WHERE itself, thus: WHERE ( (@Id_ProductClass IS NOT NULL AND CLIENTPROD.Id_ProductClass = @Id_ProductClass) OR (@Id_ProductClass IS NULL AND…
-
16
votes8
answers5853
viewsA: Recognize word repeats in String
Solution: Using regular expressions can be solved with a very expressive code, small and few ifs - in fact only 1 if and only 1 loop: public String assinalaRepetidas(String texto, String…
-
3
votes3
answers461
viewsA: Make a cascaded Else inside a for
So you didn’t like the code you had to use to solve the problem. Here is a step-by-step for you to like your code and from there manage to implement a better logic: Do not use names that are not…
-
6
votes2
answers1381
viewsA: What are subdomains and how do you identify subdomains in Ddds?
What are subdomains in DDD When you separates the domain between what is the motivation for the application and what is, so to speak, auxiliary, you have the core Domain and the Generic subdomains;…
-
17
votes2
answers4565
viewsA: What are DDD aggregates and how to identify them?
So basically the idea of DDD aggregation is equivalent to the idea of object-oriented composition? Not. It’s very common to try to understand the DDD’s Patterns design by confusing them with…
-
15
votes2
answers8126
viewsA: What is the service layer in DDD?
In DDD, business logic should not be completely contained in domain types? Yes. And, in Ddds, Services are in fact domain objects. In DDD, Services are not a layer but a kind of business object.…
-
15
votes4
answers551
viewsA: When are branches useful in Git?
Git offers the resources but its issue has more to do with team engineering decisions than with Git itself. Each team can choose to work in a different way. Continuous Integration (Continuous…
-
1
votes4
answers1209
viewsA: Button with pause function
Do not pause the process, but stop it completely The ideal in a long process is to be able to pick up where you left off if you interrupt. Otherwise, if it is unintentionally interrupted, you will…
-
1
votes1
answer164
viewsA: Manipulating two lists of a Drag and Drop component in different Managedbeans
So your difficulty is to access in a Bean the objects that were instantiated in another Bean To meet user requests in resources so interconnected on the same page, there is no problem in using the…
-
1
votes1
answer294
viewsA: How to set a Spinner value to an object
You can have a method that receives parameters in your bean instead of using property as you are doing. Then the method would look for the number according to the dysline passed by parameter. The…
-
1
votes1
answer505
viewsA: Inheritance with Relationship of 0:N using Nhibernate
What I present below is a non-heritage modeling solution. The changes I promoted in their original modeling were: Address ceases to inherit from person and becomes inheriting nothing. I removed the…
-
5
votes1
answer1320
viewsA: Composite primary key or primary key plus single index?
Tables for records that have identity will always have a natural primary key. Are you trying to decide whether to use this natural primary key as the table’s physical primary key or to use a…
sql-serveranswered Caffé 17,429 -
10
votes2
answers898
viewsA: Are business rules always related to validation?
Validations are, yes, business rules. But there are other. Consider, for example, other bank business rules that go beyond checking the balance on the account before allowing a withdrawal: A bank…
-
3
votes3
answers633
viewsA: How to return the last query ID
Whereas the last test is the highest ID, the MAX function goes in a subquery to return this higher ID. The subquery, in turn, is filtered by the student returned by the main query. SELECT IDTESTE,…
-
20
votes4
answers2538
viewsA: Should exceptions be used for flow control?
Making exceptions is legal! Cool approach 1 - avoid exceptions because they represent evil: public Resultado baixaEstoque(Produto produto, int quantidade) { Resultado resultado = new Resultado(); if…
-
4
votes1
answer6363
views -
7
votes1
answer1837
viewsA: What are the differences between a Datatable and a Datareader for Mysql queries in C#?
Approaches in the use Datareader and Dataadapter (which is what you should be using to popular your Datatable) are the following: Datareader: A connection to the database is obtained Sends the SQL…
-
2
votes2
answers694
viewsA: How to round a float value in Firemonkey Mobile Delphi XE6?
The Round accepts two parameters. The second is the number of decimal places you want in the result. For example, if you do: Round(11.568, 2); Will get 11.57 (or 11.57 when on display in Brazilian…
-
0
votes1
answer476
viewsA: Select Format yyyyyy-MM-dd HH:mm:ss in MYSQL table column
If the column in the database admits time, minutes and seconds, the date recorded there may actually contain these values, and you are looking for a date without these values. So the bank could be…
-
1
votes2
answers537
viewsA: When should I save my application data to the system registry?
Using the Windows registry is more complicated than using text file or embedded database. Answers: Should I use the S.O. registry to store information of this type? For "of this type," consider…