Posts by Homer Simpson • 3,001 points
47 posts
-
10
votes3
answers2440
viewsQ: Would the HTTP 418 "I’m a Teapot" response be valid?
A certain API is returning me a status 418 I'm a teapot, I saw that it is part of the protocol HTCPCP. ;,' _o_ ;:;' ,-.'---`.__ ; ((j`=====',-' `-\ / `-=-' The use of this status can be considered…
http-statusasked Homer Simpson 3,001 -
16
votes3
answers419
viewsQ: What are evolutionary algorithms?
Researching on Evolutionary Programming, I came across the question What are genetic algorithms? In an excerpt from the answer: ... Genetic algorithms are a particular class of algorithms evolutive…
-
7
votes2
answers115
viewsA: How to read comments of a class, function or method?
Class Using the ReflectionClass to access the class, and thus get the value of the comment using the method getDocComment: $reflection = new ReflectionClass('Usuariosontroller'); echo…
-
0
votes2
answers1604
viewsA: Server Did not recognize the value of HTTP Header Soapaction
The problem is because you are giving a wrong value on Header SOAPAction. The correct value to be informed is contained in WSDL who is consuming, to know a little more about WSDL, see that. You’re…
-
12
votes2
answers214
viewsQ: What is the difference of var between Kotlin and Java?
With the release of Java 10, the possibility of using the var: var list = new ArrayList<String>(); I’ve seen the difference between val and varin Kotlin, but I would like to know more about…
-
3
votes1
answer43
viewsA: Get name resolution time on HTTP request
You can use the InetAddress to make the name resolution before making the connection. InetAddress inetAddress = InetAddress.getByName("pt.stackoverflow.com"); From this, you can connect to the…
-
0
votes3
answers526
viewsA: UTF-8 sending by POST does not work
How are you not passing the kind of Character Set, will be the API that will define which charset to use, usually is ISO-8859-1, can check with more details on RFC 8187. To specify the use of a…
-
8
votes2
answers1662
viewsA: Insert multiple values into a table
SQL Server, Postgresql, Mariadb, DB2 and Mysql: INSERT INTO TESTE VALUES (1,'ABACAXI'), (2,'BATATA'); Examples: SQL Server in the SQL Fiddle. MySQL in the SQL Fiddle. PostgreSQL in the SQL Fiddle.…
sqlanswered Homer Simpson 3,001 -
6
votes1
answer6216
viewsA: Join columns in one SQL column
You can use the CONCAT: SELECT CONCAT( IsNull(Crescimento,0),'-', IsNull(AutonomiaFinanceira,0),'-', IsNull(RacioLiquidez,0) ) from Estado; See an example working on SQL Fiddle. Note: The syntax of…
-
1
votes2
answers90
viewsA: How to relate several tables?
The procedure is the same as with two tables, only add one join to the other tables: SELECT X.ID_INF_MUS, A.NOME_BANDA, B.NOME_GRAVA, C.QUANT_CD FROM INF_MUSICAS X INNER JOIN BANDA A ON X.ID_BANDA =…
-
1
votes2
answers87
viewsA: Replace the second repeated character
Can do with the SUBSTR, removing the last character: SELECT SUBSTR(VALOR, 0, LENGTH(VALOR)-1) FROM (SELECT '3.0.' VALOR FROM DUAL); See working on SQL Fiddle.…
-
6
votes2
answers1159
viewsA: How to make a "LIKE" in a DJANGO ORM query?
There are some ways to execute this query: Case sensitive Using the contains: usuarios = Usuarios.objects.filter(nome__contains='Jonh') SQL: SELECT * FROM usuarios WHERE nome LIKE '%Jonh%'; Using…
-
2
votes2
answers874
viewsA: Apache: prevent SSL forwarding of a specific URL
Take this example: <VirtualHost *:80> ServerAdmin webmaster@localhost ErrorLog /var/log/apache2/error.log DocumentRoot /var/www/html RewriteEngine On RewriteCond %{REQUEST_URI}…
-
3
votes1
answer130
viewsA: Asynctask task execution timeout
Add a timeout for connection with your webservice: protected String doInBackground(Void...params) { StringBuilder content = new StringBuilder(); try { URL url = new URL("endereco.com/dados.php");…
-
1
votes1
answer232
viewsA: Customize SQL query output
You can use the TO_CHAR(number) passing the correct values to the parameter: fmt. Syntax: TO_CHAR(n [, fmt [, 'nlsparam' ] ]) Example, with decimal: SELECT TO_CHAR(23000,'L99G999D99') FROM DUAL;…
-
4
votes3
answers1617
viewsA: Set value 0 when the number is negative
Complementing the other answers, if you cannot change the structure of your table to use the unsigned as mentioned in the other answers, an alternative is to use the function GREATEST. Example…
mysqlanswered Homer Simpson 3,001 -
1
votes2
answers5974
viewsA: How to use ALIASES in Oracle correctly?
Complemented by a few points: The use of AS when used to name columns is optional, example: SELECT MAX(salary) "Maximo Salário" , MIN(salary) "Minimo Salário", SUM(salary) "Soma de Todos Salários",…
-
0
votes1
answer86
viewsA: How to display html content in a datatable
The pattern of JSF is to escape tags from HTML and XML, what you need to do is disable it. To the tag outputText just set the attribute escape for false: <h:outputText escape="false"…
-
2
votes1
answer57
viewsQ: onSpinWait Java 9
I am porting a Java 8 application to 9, I have some processes that use the concept of Watchdog, who use something similar to: public synchronized void run() { until = System.currentTimeMillis() +…
-
8
votes2
answers248
viewsQ: Alternative to Observable and Observer in Java 9
For testing purposes, I am porting an application from version 7 to version 9 of Java. This application has some features that use Observer and Observable. I realized that both became obsolete:…
-
16
votes2
answers11683
viewsQ: What is the difference between Arrays.asList and List.of?
Studying Java 9, I saw a new method that works with collections: List.of, example: List<String> frutas = List.of("maça", "laranja"); I’ve used it before Arrays.asList, example:…
-
10
votes1
answer181
viewsQ: What is the use of underline in numerical literals?
What is the use of underline (_) in the situations below: float pi = 3.14159_26535_89793_23846; long bytes = 00101001_00100110_01100001; int n = 1____________________1;…
-
4
votes1
answer482
viewsA: How to insert icons in JSF?
You may be using the commandLink together with the graphicImage, example: <h:commandLink action="#{clienteController.editar}"> <h:graphicImage value="img/imagem.png" />…
-
0
votes2
answers453
viewsA: Capture, as string, xml-specific tag
You can get this information using: Node signature = document.getElementsByTagNameNS(XMLSignature.XMLNS, "Signature").item(0); The object document is the same as the parameter in your method…
-
11
votes1
answer219
viewsA: Convert day of week number to Day string
You can use the DayOfWeek for this, example: import java.time.DayOfWeek; public class Main { public static void main (String[] args) { System.out.println("1 = " + DayOfWeek.of(1));…
javaanswered Homer Simpson 3,001 -
16
votes1
answer994
viewsA: What are Raw Types?
What exactly are Raw Types? According to the language specification, in free translation: More precisely, a crude type is defined as being one of the following: The type of reference that is formed…
-
2
votes1
answer115
viewsQ: Relationship between Hotspot and JVM, JDK/Openjdk?
What is Java Hotspot and what is its relationship with JVM and JDK/Openjdk?
-
4
votes2
answers326
viewsA: Regular Expression R
You can use the parameter ignore.case of function grepas set out in documentation. For your case: txt <- c("1º ano", "1º ano", "1º ano", "1º ano", "2º ano", "2º ano", "2º ano", "2º ano", "3º…
-
2
votes1
answer2564
viewsA: Error in Maven POM.XML file
The dependencies informed in your POM must be contained within the tag <dependencies>. As shown in the documentation: <project xmlns="http://maven.apache.org/POM/4.0.0"…
-
0
votes1
answer192
viewsA: List data in a datatable
The reported error is the exception ConcurrentModificationException, which according to the documentation, in free translation: This exception can be made by methods that detected the modification…
-
8
votes1
answer151
viewsQ: What would MOJO be on Maven?
I use the Maven some time together with other tools, and always see something related to Mojo, what would really be a Mojo?…
mavenasked Homer Simpson 3,001 -
1
votes1
answer194
viewsA: Null in Primefaces Component Uploadfile
I see two points that need attention: The use of ajax="true" in the component commandButton when used in conjunction with the component FileUpload, where it is configured to use the simple mode…
-
35
votes3
answers25651
viewsA: What is the equivalent of the grep command in Windows?
You can use two options in Windows: Using the Command Prompt: Findstr Examples: Find files containing the expression: log: dir /B | findstr /R /C:"[log]": where: dir /B: Lists files/directories from…
-
1
votes2
answers2348
viewsA: How to make a user in SQL Server 2008 view only a VIEW?
You need to give this user you created (cliente_view) the privilege you wish, in your case, to give access only for permission to SELECT, use the GRANT: GRANT SELECT ON view_consulta_vendas TO…
-
4
votes2
answers681
viewsQ: SOA x Microservices
I’m used to working with the concept of Service Oriented Architecture - SOA, I have been reading about the subject and came across the concept of Microservices Oriented Architecture, what would be…
-
2
votes3
answers747
viewsA: How to test my site on a slow internet?
Complementing, there is the possibility of doing this test using the Jmeter. I will not go into details of how to use the same, only how to configure it to simulate different internet speeds.…
-
4
votes3
answers2636
viewsA: "Find and replace" with regular expressions in MS Word 2016
You can use the following expression in Word: ([0-9]{3}.[0-9]{8}\/[0-9]{1};) Where: [0-9]{3}.: selects 3 numbers before the point + the point. [0-9]{8}\/: selects 8 numbers before the bar + the bar.…
-
2
votes2
answers402
viewsA: For command not working with Findstr usage
For the form you want to execute, simply change the form you are using the variable, instead of using %%e utilize %e: for /f %e in ('findstr "<cd_comiss>P</cd_comiss>" *.*') do del %e…
-
2
votes1
answer644
viewsA: HTTP Error 403.7 Forbidden - SEFAZ RS
To consume Sefaz web services (homologation/production), such as Nfe or Cte you will need a valid e-CNPJ certificate. In the case of the certificate that is available together with the Subscriber,…
-
1
votes1
answer271
viewsA: JSF problem in Logoff method
There are some points that should be considered: actionListener, use in cases where you need to run a view-related logic, where there is no need to exchange page. The page that is returning in the…
-
1
votes1
answer1114
viewsA: Replace all & parameters of a query in Sqldeveloper
Using the syntax &variavel, the value assigned to it is temporary, ie will only be used in the current SQL clause. If you use syntax &&variavel, the value assigned is permanent, that is,…
sqldeveloperanswered Homer Simpson 3,001 -
8
votes1
answer195
viewsA: Edge Console? Is there?
There is yes, the hotkey would be the F12. See the documentation on the functioning.…
-
1
votes2
answers280
viewsA: How to block directory files recursively?
Configure on your Virtualhost the following Directives: <Files ~ "\.*$"> Deny from all </Files> <FilesMatch ".*\.(jpg|jpeg|png|gif|css|js)$"> Order Allow,Deny Allow from all…
-
0
votes3
answers2679
viewsA: Convert number to date
string date ( string $format [, int $timestamp ] ) The optional timestamp parameter is a Unix timestamp integer whose default is the local time if timestamp is not reported. In other words, the…
-
2
votes1
answer2112
viewsA: Apache how to redirect port?
Using the ProxyPass module mod_proxy. In the example below, everything arriving at port 80 will be redirected to the application available at http://localhost:8080/app: <VirtualHost *:80>…
apacheanswered Homer Simpson 3,001 -
3
votes1
answer2004
viewsA: How to Update a BD Record using ADVPL
See if that helps you: Contrary to what you reported, the example below does not use an explicit sql clause: I report an index: dbSetOrder(1) Pass the information to the index: dbSeek(xFilial("SA1")…
advplanswered Homer Simpson 3,001 -
3
votes2
answers159
viewsA: What’s the point of continuing flow control?
How the continue works? Simply ignore the current iteration. In which situations its use is useful? Much depends on the business rule. You can check out more here. Because the output did not print…
c#answered Homer Simpson 3,001