Posts by Anthony Accioly • 20,516 points
346 posts
-
14
votes4
answers1851
viewsA: Infer class type from a generic
One possible trick is to change an instance of your class: Foo<Integer> x = new Foo<Integer>(new ArrayList<Integer>()); By a subclass of her (in this case an anonymous class):…
-
3
votes4
answers12261
viewsA: How to know which version in use of a particular package is installed via Pip?
Only one alternative, for Pip 1.3 or higher you can use the command show: pip show pelican Source Soen - Find which version of package is installed with Pip…
-
3
votes1
answer802
viewsA: Transfer files by FTP to Java Hosting
Yes, it is possible. You must configure the ftp service on a server. Next to your Desktop client you should upload the file to the ftp server using one of the many libraries for this (e. g.,…
-
3
votes2
answers358
viewsA: Doubt about compilation in C/C++
TL/DR: Your compiler / linkeditor is finding the dependencies you included (e. g., stdlib.h) in some library in the default path. According to compile/ linkedit options, the library is being…
-
2
votes1
answer203
viewsA: SWT using DATETIME problem in saving compatible SQL format
I’d convert to a middleman like Calendar (Java <= 7) or LocalDate (in Java 8): Calendar: Calendar calendar = Calendar.getInstance(); calendar.set(Calendar.DAY_OF_MONTH, dateTime.getDay());…
-
4
votes2
answers191
viewsA: Serve libraries with CDN or Own Server?
Every strategy has its pros and cons... CDN: The great advantage is that most users who fall on your site will have a version of the library cached. This reduces the time for downloading resources…
-
1
votes0
answers61
viewsQ: Loggerfields for Syslog (write priority and stack trace)
Log4j can send logs to Papertrail using a syslog appender (documentation): log4j.appender.syslog=org.apache.log4j.net.SyslogAppender log4j.appender.syslog.Facility=LOCAL7…
-
2
votes3
answers3334
viewsA: Close Windows popup in Java (Selenium Webdriver)
Try the following: driver.switchTo().window("[handle da sua janela]"); driver.close(); // Ou um click no caminho do botão ok. The method switchTo goes to the popup window. The method close closes…
-
3
votes1
answer1718
viewsA: How to create schema and use it in table creation
I believe you’re looking for the command CREATE SCHEMA USE MeuDatabase; GO CREATE SCHEMA Cadastro AUTHORIZATION MeuUsuario; GO You may also want to give permissions to other users who intend to use…
sql-serveranswered Anthony Accioly 20,516 -
4
votes1
answer986
viewsQ: Stream -> findFirst vs findAny
The class Stream has two very similar methods, findFirstand findAny. Both return a Optional<T> with an item (or emptycase to Stream be empty). The findFirst returns the first item found. In…
java-8asked Anthony Accioly 20,516 -
3
votes1
answer695
viewsA: Cannot get a text value from a Numeric Cell "Poi"
You are getting an instance of the type Cell in sheet.getRow(i).getCell(0). That is to say: Cell cell = sheet.getRow(linhaDaCelula).getCell(colunaDaCelula); Cells may be of the type CELL_TYPE_BLANK,…
-
12
votes6
answers15200
viewsA: What is and how does Bootstrap work?
Well, let’s go in pieces. It’s just a meeting of CSS and Javascript templates? Yes and no. As described by the site, Bootstrap is designed to provide the foundation for applications with responsive…
-
11
votes2
answers1347
viewsA: Find out how many days passed from one date to another
To Date-Time API Java 8 greatly facilitated this type of operation. For your specific problem we can avail ourselves of the units ChronoUnit. The method between does exactly what you’re wanting.…
javaanswered Anthony Accioly 20,516 -
2
votes1
answer370
viewsA: PDO Selection in mysql database parameter BLOB
Behold PDO - Large Objects (Lobs) . Basically missed the constant PDO::PARAM_LOBwhen it’s time to make Binding... $stmt->bindValue(":img", $imagem->getImagem(), PDO::PARAM_LOB); Of course I’m…
-
4
votes2
answers2492
viewsA: What’s the difference between SOME, IN and ANY?
In accordance with official Mysql documentation ANY "returns TRUE if the comparison is true for whichever of the values in the column that the subquery returns." For example: SELECT s1 FROM t1 WHERE…
mysqlanswered Anthony Accioly 20,516 -
3
votes0
answers32
viewsQ: GAE: Managed Vms - Java 8 Support
[Rant mode on] It’s been a while since the community has been asking Java 8 support in GAE. This month Oracle’s official public support for Java 7 ends. It seems there will be no side changes in GAE…
-
3
votes1
answer1304
viewsA: How to persist abstract class with JPA
If you are looking for a mapping strategy with a single table (i.e., where there is a single table for Carro also containing the columns defined in Veiculo) all you have to do is write down Veiculo…
-
7
votes4
answers5471
viewsA: Count occurrences in a list according to prefixes
One-Liner functional abominable with sum and map: sum(map(lambda x: 1 if x.startswith(tuple(pref)) else 0, words)) Abominable one-Liner with reduce: reduce(lambda x, y: x + 1 if…
-
4
votes1
answer275
viewsA: General namespace for mapped class
At first glance it seems that you are searching for the note @Xmlschema. With this annotation you can map namespaces, prefixes, etc, including at the packet level (coarser granularity). To make use…
-
2
votes2
answers219
viewsA: Tool to debug a stored Procedure on linux
I know it’s not quite what you’re looking for, but you can always make a: SELECT CONCAT('O valor de x é', x); In the middle of your stored file. This "prints" the value of a variable on the screen.…
-
2
votes3
answers4417
viewsA: Java 8 (Stream) - Grouped sum
I present a solution by map and reduce. Map Given the raw input List<Object[]> lista, you are only interested in the columns whose contents are in int... valores. You also want to separate the…
-
5
votes3
answers5444
viewsA: How to calculate mathematical expressions in a string?
Pragmatic response (do not re-invent the wheel). Use one of many libraries to evaluate expressions in Java. Links: Jep (owner) expr Jeval Matheval exp4j Evalex Expression-Evaluator-demo There are so…
javaanswered Anthony Accioly 20,516 -
5
votes1
answer7480
viewsA: ORA-00980: synonym Translation is no longer Valid
Free translation of official documentation ORA-00980: The translation of the synonym is no longer valid Cause: A synonym has not been translated into a legal target object. This may occur for one of…
oracleanswered Anthony Accioly 20,516 -
3
votes1
answer651
viewsA: Glassfish does not take root context from the application
In Glassfish the synonym for root is /. You can set this context in several ways: For configuration files like glassfish-web.xml: <glassfish-web-app> <context-root>/</context-root>…
-
3
votes1
answer77
viewsA: Integration by the Simpson method into the R
Try the function sintegral package Bolstad2. Example of manual: ## integrate the normal density from -3 to 3 x<-seq(-3,3,length=100) fx<-dnorm(x) estimate<-sintegral(x,fx)$int…
-
2
votes1
answer892
viewsA: How to correctly declare Server Runtime or provided Wildfly dependency on Gradle
While both solutions appear to be acceptable, the second includes an external (implicit) dependency on the IDE. Thus, the first solution seems to me the most appropriate. On the Apis versions used…
-
1
votes1
answer385
viewsA: JSF accessing serial port
If you need low-level access (i.e., do more than enable the browser print window with Javascript) you will need something in the client yes, but I wouldn’t recommend an Applet. After so many years…
-
2
votes1
answer1383
viewsA: Load values from an already saved Selectitem into a database on the screen
Missing include the property value in the selectOneMenu. For example, if your Managed bean owns the property tecnicoResponsavel indicating the previously selected technician you can do something…
-
3
votes1
answer410
viewsA: Write only one line in Bufferedwriter
You need a Randomaccessfile. File file = new File("resources/Save/Room1.txt"); RandomAccessFile raf = new RandomAccessFile(file, "rw"); raf.seek(0l); raf.writeChars("1"); // Não se esqueça de tratar…
javaanswered Anthony Accioly 20,516 -
0
votes1
answer422
viewsA: Using FQL in facebbok api php 4
You can get birthday friends with the following consultation: $request = new FacebookRequest( $session, 'GET', '/me/friends?fields=friends{id,name,birthday}' ); $response = $request->execute();…
-
2
votes2
answers1093
viewsA: How to assemble logic to read 2 files, compare them and extract values not found
On request follows a minimum sketch of the solution in memory with Set. Read a file to a Set: public Set<String> leMunicipios(Path path, int linhasParaPular, Charset charset) throws…
-
2
votes1
answer1560
viewsA: Fetch of children with JPA+Hibernate not working
Summarizing the comments in a reply. You’ve fallen into a common problem with two-way relationships. Follows a grafting of Wikibooks Object corruption, one side of the Relationship is not updated…
-
3
votes2
answers93
viewsA: Does R have a similar command to SAS IN?
You can also use the operator %in% variavel1 <- 5 if (variavel1 %in% c(4, 5, 6, 7)) { variavel2 <- 1 } Functional example…
-
2
votes1
answer410
viewsA: Phonetic Research for Telephone Directory
From what I understand you don’t really want a phonetic research, you just want an alternative to LIKE (that is not performatic, especially when we seek a word in the middle of the text). This…
-
8
votes4
answers2296
viewsA: How to order three Ivs according to an attribute of hers?
You can extract an array from the Divs with jQuery and sort it with the method Array.sort. var divList = $(".produtos"); divList.sort(function(a, b) { // para ordem decrescente; use a - b para…
-
11
votes1
answer1769
viewsA: How to clone/download a repository with just the last commit?
Use the switch --depth: Example: git clone --depth=1 <url_do_meu_repositório> Note however that this practice of Shallow copy (SVN style) is not usually the best solution in the Git world for…
-
2
votes1
answer104
viewsA: Client side deleted object instance and sends to the server
The problem The Binding among the inputs and the List in the Spring model is done through an index in the name of the input. For example: <form:input path="products[${i.index}].quantidade"…
-
3
votes1
answer765
viewsA: Share article on Facebook - Popup / Blank window
Problem solved (what a pity that the reward went to limbo). It all happened because of this favicon staying at Microsoft One Drive. The URL was blocked without warning. I even remembered to check…
-
7
votes1
answer545
viewsA: Genericdao - Is that correct?
There is nothing wrong with your code. Many frameworks use that approach with parameters of the type Class<T> to circumvent the limitations of the Java generic implementation (in short the…
-
5
votes1
answer688
viewsA: Mysql Backup with Event Scheduler
To backup all tables recommend the command mysqldump. Example: mysqldump --defaults-file=/home/bk/arquivo.cnf schema > /home/bk/backup_mysql.sql Where arquivo.cnf contains the access information:…
-
2
votes1
answer2639
viewsA: Call PL/SQL precedent with object collection
Posting the solution to other users who eventually encounter the same problem. The commenting of Marcus helped me kill the riddle. Actually what we need to build is a ARRAY of STRUCTS. Each of these…
-
5
votes2
answers314
viewsA: Jasper Reports 5 to 6 Obsolete methods
According to the class Javadoc Jrxlsexporter: setParameter -> Replaced by setExporterInput(ExporterInput), setConfiguration(ExporterConfiguration), setConfiguration(ReportExportConfiguration) and…
-
4
votes1
answer765
viewsQ: Share article on Facebook - Popup / Blank window
From last week to now, when trying to share any content on my blog to Facebook, I get a popup or blank page within the Facebook domain. Examples: Share Article 1 (that article) Share Article 2 (that…
-
1
votes1
answer119
viewsA: Return names of selected items from a checkboxTree
The node has a method getUserObject that returns the object referring to the current node (e.g., if you fed the tree with the string "red" just convert the Object for a String): String color =…
-
6
votes1
answer2639
viewsQ: Call PL/SQL precedent with object collection
Consider the following types: CREATE TYPE meu_tipo AS OBJECT ( meu_id NUMBER(6), meu_nome VARCHAR2(200) ); CREATE TYPE meu_tipo_tabela AS TABLE OF meu_tipo; And the following package: create or…
-
1
votes1
answer692
viewsA: I cannot delete input from a Jformattedtextfield
Take a look in that article. The author implements a AllowBlankMaskFormatter made for this type of situation. AllowBlankMaskFormatter abmf = new AllowBlankMaskFormatter("##:##");…
-
0
votes2
answers1283
viewsA: Generating dates , from a date entered and month quantity informed
OP found a solution on his own. Even so, by reference, follow how I would do it in Java 8 with the Date and Time API: import java.time.LocalDate; import java.time.format.DateTimeFormatter; // ...…
javaanswered Anthony Accioly 20,516 -
1
votes1
answer571
viewsA: Sort table by name
TL;DR You need to rethink your implementation. It is not possible to "reorder" data already sent to the server-side client. Get informed about Ajax and customer side solutions. This is a very common…
-
1
votes2
answers1035
viewsA: Conflict between Spring MVC and Primefaces
I suggest you start your project from a Maven archetype (as one of the two that enable JSF + Spring from that repository). If you want something even more agile you can also try JSF support from…
-
4
votes1
answer982
viewsA: How to change page after inserting object in database?
I suggest you take a look at official tutorial on JSF of Java EE, in particular in the chapter on Navigation Model from JSF. This is a fairly complex issue. To give you a pragmatic response, your…