Posts by Anthony Accioly • 20,516 points
346 posts
-
9
votes2
answers3452
viewsA: Instantiating interface - What’s the point?
The annotation @Autowired is not instantiating an interface. There is no way to instantiate an interface since the interface is just a "contract" (in Java 8 there are methods default with concrete…
-
2
votes3
answers386
viewsA: Use of the split method
Workaround using Java 8 streams: final Pattern p = Pattern.compile(","); alertas.stream() .filter(a -> p.splitAsStream(a.getUsers_receive()).anyMatch("vinicius.candido"::equals))…
-
7
votes2
answers6368
viewsA: HEAD is Detached in Repository
That means you’re no longer in a branch local (that is, back to a previous commit or exploiting a remote commit). To get back to normal (considering that there are no new changes to be committed),…
-
2
votes1
answer134
viewsA: Bulk Substitution in XML
Use regular expressions to do Parsing and transformation of XML it’s not a good idea. Your problem demands both things. The tool to be used must first find tags comment within the original document…
-
4
votes1
answer3781
viewsA: IDE for Python that has GUI modeling
It depends on what you want. The IDE Anjuta has a good integration with the Glade which is one of the most popular tools to make uis design with GTK+. But in the Python world you don’t necessarily…
-
1
votes2
answers179
viewsA: Error generating pdf report (Jasper)
java.io.FileNotFoundException: C:\Users\brenno.mello\Documents\Projeto%20SPED\coffeepot-br-sped-fiscal\target\classes\relatorio\RelatorioNcmInexistente.jasper Your compiled report (archive .jasper)…
-
1
votes2
answers1011
viewsA: Problem running project - Special characters
First check if your files are really backed up in ISO-8859-1, if yes, it may be that your console is set to UTF-8 or some other type of coding. You can change the console encoding by adding the flag…
-
5
votes1
answer70
viewsA: Date - 4 digit Character conversion
That’s a weird rule of century inference in the year mask y. In the documentation we have the following information on the conversion of double-digit dates: %y Year without century (00-99). At the…
ranswered Anthony Accioly 20,516 -
4
votes3
answers1104
viewsA: Change of vector size in a structure
In the c you usually solve this with a pointer of the type char and malloc to reserve space dynamically: struct Implicantes { int posicao; char *binario; bool dontcare; bool tick; struct Implicantes…
-
3
votes2
answers5400
viewsA: Mysql not connecting connects by socket error
In accordance with that reply from Soen, a common problem that causes the ERROR 2002 is to install the mysql-client instead of mysql-server. In Ubuntu you can install the package mysql-server with:…
-
3
votes4
answers1605
viewsA: Turn Messagedigest MD5 into a string
Try to use the DataTypeConverter, i would also pass an encoding to keep the hash portable (getBytes assumes the encoding platform standard): md.update(str.getBytes("UTF-8")); byte[] bytes =…
-
2
votes2
answers660
viewsA: Classformaterror: Incompatible Magic value 0 in class file
Incompatible Magic value happens when a class has been corrupted in some way (e.g., downloading some .class failed or the compiler / bytecode generator did something it shouldn’t). I’ve seen this…
javaanswered Anthony Accioly 20,516 -
2
votes1
answer2206
viewsA: How to Identify and Fix 00302 Error in Oracle?
A mistake PLS-00302 in Oracle PL/SQL means that some component used in the code of statement was not declared. The most common reasons for this are: Forget to declare variables Declare variables…
-
2
votes2
answers178
viewsA: How to define a method that receives a lamppost expression?
OP found a solution using function pointers. He chose to pass the pointer through the constructor and store it in the class. Another possibility is to pass the function pointer directly to the…
-
8
votes3
answers200
viewsQ: Speed difference between Plink and Openssh
I have a setup with some Mercurial repositories. For security and standardization reasons, https access to Mercurial repositories was recently disabled, which forced all developers to use ssh. In…
-
22
votes2
answers6768
viewsA: What is, and how it works, a Etag
Succinctly, Etag is an HTTP mechanism for conditional cache validation. The idea is to serve content to be curled with an identifier (usually a hash or version number). The client then uses this…
-
8
votes1
answer51
viewsA: What does this piece of sql statement mean?
It is a Enum. With an Enum you can restrict the values of a column to the options specified, e.g., in your case 'S' or 'M'. Enum is a very efficient and compact type. Internally the bank uses…
-
3
votes1
answer157
viewsA: Javadb generating sequence of ids with 3 digits
From JPA 2.1 (Java EE 7) the annotation Column won an attribute columnDefinition which can be used to change the definition of a field. Example: @Id @GeneratedValue @Column(name="ID",…
javaanswered Anthony Accioly 20,516 -
3
votes3
answers331
viewsA: Return setInterval Value
The function setInterval returns an id of the range (used to later cancel this range), so you should not use return. You can use scopes but according to Pedro Luzio’s answer. Additionally you can…
javascriptanswered Anthony Accioly 20,516 -
1
votes1
answer63
viewsA: Blogger migration to domain does not load
Opening your page On the Chrome console I received the following errors: Refused to execute script from 'https://sites.google.com/site/3f2x4a/1/jquery.js' because its MIME type ('text/html') is not…
-
3
votes3
answers534
viewsA: Reduce jar size in Maven Design
In addition to following the advice of colleagues and reviewing dependencies and transitive dependencies, there are tools that can help you. A first way to reduce jar size is to compact using…
-
4
votes2
answers2045
viewsA: Postgresql Hibernate Id Generation Strategy
Alternatively it is also possible to use a column of the type SERIAL combined with a generation strategy IDENTITY from the Hibernate side. @Id @Column(name = "meu_id", columnDefinition = "serial")…
-
4
votes1
answer830
viewsA: How do I stop tracking changes to a file after the commit?
You’re on the right track. The problem is that just removing the file won’t stop git from tracking modifications. Entire process: git rm --cached Add the file in question to .gitignore git commit…
gitanswered Anthony Accioly 20,516 -
5
votes4
answers8025
viewsA: Searching dates through BETWEEN AND
The problem seems to be that you’re treating guys DATETIME as DATE. Try: SELECT * FROM sales.logger where data BETWEEN "2016-04-12 00:00:00" AND "2016-04-14 23:59:59" ORDER BY data;…
mysqlanswered Anthony Accioly 20,516 -
5
votes1
answer1532
viewsA: How do I get the mouse position (x and y) on the console? C++
I assume your code is windows specific (windows.h). In Windows environments you can use the function GetCursorPos to get the cursor position relative to the screen. To translate the coordinates so…
-
1
votes1
answer603
viewsA: Problems implementing an email sending method
You are asking the email client to use SSL: email.setSSLOnConnect(true); This requires your application to trust and validate the public certificate used by the smtp server. You can find a guide on…
-
4
votes1
answer893
viewsA: I cannot ignore fields when trying to return them as Json causing "Infinite recursion"
You have here an infinite recursion case due to bi-directional relationship. Let’s say John is a Admin: The object of type Usuário John, therefore had a reference to the Perfil Admin. The object…
-
6
votes1
answer477
viewsA: Time difference between stdio. h and iostream
cin and cout "spend" a good amount of time synchronizing with the buffers of stdio. It is not difficult to see programs with operations 3 to 4 times slower compared to scanf and printf (see this…
-
3
votes1
answer110
viewsA: Criteria of the grails
In accordance with the tutorial from which the code in question was copied, this example combines projections and aggregate functions. Projections modify the return of the select clause, so that it…
-
2
votes1
answer75
viewsA: Early return of a fold
The best workaround that I found was to wrap the fold with a IIFE (javascript style). This way I can use return sum with no one label. val firstEvenSum = fun(): Int { array.fold(0, {acc, n -> val…
kotlinanswered Anthony Accioly 20,516 -
6
votes1
answer75
viewsQ: Early return of a fold
Kotlin allows returns for previously declared tags, including implicit labels. Example of documentation: fun foo() { ints.forEach { if (it == 0) return@forEach print(it) } } In that spirit, I would…
kotlinasked Anthony Accioly 20,516 -
4
votes2
answers84
viewsA: Doubt interpretation function
Turning my comments into a response. The code in question is some kind of Dispatcher Pattern. The idea is to send the message by typing it in ObjectOutputStream of a particular customer (according…
javaanswered Anthony Accioly 20,516 -
10
votes1
answer187
viewsQ: Persist "pieces" of a tree (large) in parallel
I find myself with the following problem at hand: Goal: Parallelize an ETL process that: Reads from an external interface a tree with an undetermined number of elements. Transforms the…
-
2
votes1
answer685
viewsA: Clear a Bean variable from the JSF page
Summary of the conversation with the OP in chat Original problem: Clear data OP was storing all query data and various projections in a Managed Bean @SessionScoped. Memory consumption was beating at…
-
4
votes2
answers1679
viewsA: How do I generate random numbers and without repeating them in a time interval?
One way to do this is to use a array, std:set or std::unordered_set (C++11 or higher) to store intermediate values. The sets are especially interesting since they do not allow repetitions:…
-
1
votes1
answer181
viewsA: Delay of the swing timer.
One of the ways to solve the problem is to assign a delay different initial for each animation, e.g: public void piscaImagen(ImageIcon img1, ImageIcon img1b, JLabel lbl, int initialDelay) { Timer…
-
1
votes1
answer580
viewsA: Spring @Scheduled with internal transaction triggering Propagation error
The problem is that the implementation of @Transactional by default uses a proxy. When you write down the same method with an annotation like @Scheduled she doesn’t pass any proxy and so Spring has…
-
3
votes2
answers309
viewsA: Mysql does not use Input in query (Inner Join)
Assuming protocolo be the PK of rel_financeiro as pointed out in reply of fbiazi, the problem seems to be the position of the Join: SELECT r.protocolo, r.aceito, r.valor_previsto FROM emails e INNER…
mysqlanswered Anthony Accioly 20,516 -
5
votes1
answer83
viewsA: Java input problem
This happens because methods like nextInt, and next do not consume the input line break. When you call nextLine the method finds the line break and assumes that the input is empty. One way to fix…
-
4
votes1
answer90
viewsQ: Is there any way to get back to the last branch in git?
The title says it all. Around and a half we use the git as follows: git checkout branch_x git checkout branch_y git checkout branch_x x can be master, or some Feature branch whichever. I wonder if…
gitasked Anthony Accioly 20,516 -
2
votes1
answer224
viewsA: Store some elements of a struct array in another struct array
A first problem with your code is that you are not feeding the seed of the pseudo-random number generator correctly, thus the result of rand will be predictable. To change the seed value, use the…
canswered Anthony Accioly 20,516 -
13
votes4
answers41801
viewsA: What is the purpose of the void in C?
Pointers void* precedes C++ and templates as a mechanism to deal with "generic" types in C. To be more specific void represents the absence of type, which can be understood as the presence of any…
-
9
votes1
answer199
viewsA: "[-4:]" What is this syntax?
That’s a Slice (slice). The code in question returns the last four characters of the string. A Slice follows the pattern [começo:fim]. começo and fim are indexes starting from zero. The character of…
-
6
votes2
answers3059
viewsA: To group and remove lines with "null" values from this query in Mysql
If I understand your question right you’re trying to make that query here: SELECT cli_resp.idCliente, MAX(IF(cli_resp.idPergunta = 16, resp.resposta, NULL)) AS `Qual o seu telefone?`,…
-
2
votes1
answer155
viewsA: How to log in with slf4j from inside a jboss module?
For future reference, my problem had nothing to do with logging. The above recipe works as expected. In fact, I suffered due to a false information: mine module.xml original was never really used. I…
-
2
votes1
answer155
viewsQ: How to log in with slf4j from inside a jboss module?
How can I log into the console / server.log from within a jboss module? Let’s say I have a class: public class MyClass { private static final Logger logger = LoggerFactory.getLogger(MyClass.class);…
-
1
votes1
answer1585
viewsA: Generate Runnable Jar from a Maven project
According to your own tutorial, Jar generated by Maven will not include dependencies. The solution proposed by the tutorial is to use the plugin One-Jar to generate a Uber Jar including your project…
-
6
votes1
answer397
viewsA: Primefaces p:datatable without the "No Records found" message?
This message is controlled by attribute emptyMessage of dataTable. For default the attribute value is "No Records Found", but nothing prevents you from changing that message: <p:dataTable…
-
4
votes1
answer1562
viewsA: How to find conflicting files in GIT?
According to that answer in Soen just use: git diff --name-only --diff-filter=U
gitanswered Anthony Accioly 20,516 -
5
votes1
answer211
viewsA: What justifications/implications for the removal of Permanent Generation?
The removal of Metaspace began with the JEP 122. But what was the motivation of this and where it was relocated? Whoever worked with Java must have taken some java.lang.OutOfMemoryError: PermGen…