Posts by Tiago Oliveira de Freitas • 1,798 points
46 posts
-
1
votes2
answers508
viewsQ: Phyton wait pause
I want to automate a task, as the software has no api that allows this, I will control the mouse of the OS and click using Phyton. I intend to create validations with images to ensure that I am on…
pythonasked Tiago Oliveira de Freitas 1,798 -
1
votes1
answer224
viewsQ: Postgres: Error converting date in Postgres 10
When I perform a date conversion on postgres 9.6 that I have on my machine, it fixes the date if it is invalid, the same is not happening on postgres 10 that is on another machine: Postgres 9.6…
-
0
votes1
answer56
viewsA: Postgres user with access only in the replica
The solution we found was to limit the access by ip in pg_hba.conf.
-
0
votes1
answer56
viewsQ: Postgres user with access only in the replica
The database in question has replication of data, the same database, however on another server, has to ensure the access of a user ( user_bi ) only in the replica ? REVOKE ALL ON ALL TABLES IN…
-
2
votes0
answers142
viewsQ: Postgresql - autovacuum in small table
What would be a suitable configuration for autovacuum act in this table ? We have a "sequence" table, does what the sequence postgres should do, but perhaps by using other banks the development…
-
0
votes2
answers40
viewsA: Returning the total with the date in a query with the SUM
I think I understand what you want: SELECT sum(m.value), MIN(t.sale_date) from t_transaction t left join t_movement m on m.transaction_id = t.id where t.paybox_id = 26 That’s right ?…
-
1
votes1
answer1067
viewsA: Difference between hours and minutes days in Sql Server?
I don’t know if I understand this right, but I think this is what you want select CAST( '2018-01-01 17:00:01' AS DATETIME ) AS data_um, CAST( '2018-01-02 10:01:02' AS DATETIME ) AS data_dois,…
-
-1
votes1
answer149
viewsA: Testing UPDATE in Postgres
I got some results using Datastudio, I have no interest in another tool, use more of a type bank and datastudio allows me to access all of them. WITH alterados AS ( UPDATE syo_evento SET…
-
1
votes1
answer149
viewsQ: Testing UPDATE in Postgres
The idea is to do a search with the BEFORE result, run UPDATE with the appropriate changes and run a new search with DEPOIS, then undo all the changes, a test for UPDATE. SELECT id_evento,…
-
3
votes2
answers1257
viewsQ: Sql Server Error 8623: The query Processor Ran out of Internal Resources and could not Produce a query plan
Sql Server Database 2012 and 2008. They log the following error (sql server 2012): error_reported 2017-12-27 09:14:16.2053050 8623 16 1 False The query processor ran out of internal resources and…
-
3
votes1
answer7859
viewsQ: Sql Server - View the View structure
I executed the following commands in the Sql Server database: comando 1: SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'vendas' resultado 1: TABLE_CATALOG TABLE_SCHEMA TABLE_NAME…
-
0
votes1
answer3263
viewsQ: How to assign the query cost to a variable in Postgres
To take the cost esteemed of the query use the EXPLAIN SELECT coluna FROM tabela;, to take the cost current of the query use the EXPLAIN ANALYSE SELECT coluna FROM tabela;, my doubt is how to search…
-
0
votes1
answer162
viewsQ: Java command to ignore Encoding
I have the following situation, work with the software A of vehicle sales, in it has the opportunity to sell and this has a media (as the customer learned the opportunity), in addition to the store…
-
2
votes1
answer404
viewsA: How to merge lines?
EDIT: With SQL I think the only way is to check the information that is different between the lines and use the FOR XML PATH in that column, in the following example I used in the column…
-
1
votes1
answer222
viewsQ: Ulitization IS DISTINCT FROM - Postgres
What is the best use of this function in Postgres IS DISTINCT FROM, doing tests obtained the same result using COALESCE but in less time, follows the test: SELECT COUNT(P.id) FROM produto P INNER…
-
2
votes1
answer729
viewsA: SQL - Category & Subcategory
If I understand correctly, all main categories have id_category = 0, then: SELECT * FROM ( SELECT c1.id, c1.categoria as categoria_principal, null as sub_categoria FROM categoria AS c1 WHERE…
-
5
votes4
answers32475
viewsA: Query to catch word after given character
You did not specify which word you want to compare or which column to search for, adapt and test: with t as (SELECT 'Inicio bla bla bla Meio bla Fim bla ww Fim 123 bla dihfidfh' as teste) select…
-
5
votes2
answers81
viewsA: Simple SQL query
Tries: SELECT * FROM tabela WHERE (id = @varid OR @varid IS NULL)
-
0
votes1
answer415
viewsA: How to see the disk space that the index occupies in the database?
I found something: SELECT c2.relname, c2.relpages FROM pg_class c, pg_class c2, pg_index i WHERE c.relname = 'manutencao' AND c.oid = i.indrelid AND c2.oid = i.indexrelid AND c2.relname =…
-
1
votes1
answer415
viewsQ: How to see the disk space that the index occupies in the database?
I have the table maintenance with the column id_product (varchar(MAX)), however the same is not the primary key, the table has 900 thousand records so I decided to create indices to optimize…
-
1
votes2
answers313
viewsA: Error running Java program - Mapping Servlet Web.xml
The @Fulvius answer is correct, I include this to record in this question that it is possible to map a Servlet 3.0 in their own class with an annotation @WebServlet, as it was in the file…
-
2
votes1
answer1395
viewsQ: How to pick up Form value - Java - Swing
I created a form on Java interfacing Swing, in this has a field textfield Text and a button Send, in the code of the button need to assign the value informado in the textfield to a variable of the…
-
0
votes1
answer599
viewsQ: Query Performance - Postgresql
I have the following situation, I need to bring data from a vehicle table of the system in which I work and another with integrated data of a partner system, for being integration the data are not…
-
2
votes2
answers1487
viewsA: How to round age with Postgresql?
I like to use the to_char, brings many possibilities, follows example of various functions: select *, date_part('year', age(data_nascimento))||' Anos' AS idade, date_trunc('year',…
-
0
votes2
answers313
viewsQ: Error running Java program - Mapping Servlet Web.xml
I have the following software, it should allow me to pass a file, will send a message on the console to just positive access to a class and list the result on the page, I’m starting and do not know…
-
1
votes1
answer330
viewsA: Error: You have an error in your SQL syntax
Man, I think the mistake is in Classe PessoaDAO, in this passage: sqlUpdate.setInt(10, pessoa.getCodigo()); ----> sqlUpdate.executeUpdate(SQLUPDATE); <----- retorno = true; You have loaded the…
-
1
votes2
answers336
viewsA: Instantiate an external Java directory class in JSP
Now yes, everything is working. First installed in Eclipse the software Eclipse Java EE Developer Tools Eclipse Java Web Developer Tools Eclipse Web Developer Tools Eclipse XML Editors and Tools As…
-
14
votes3
answers20505
viewsQ: How to resolve the error - The superclass "javax.servlet.http.Httpservlet" was not found on the Java Build Path
I’m using Eclipse Mars.1 for web development, I received this error when including a file JSP, The superclass "javax.servlet.http.HttpServlet" was not found on the Java Build Path. I also have…
-
18
votes3
answers20505
viewsA: How to resolve the error - The superclass "javax.servlet.http.Httpservlet" was not found on the Java Build Path
As with the database, the Eclipse does not recognise the service of Apache Tomcat just because it is present in the system, a plugin is required for the Eclipse. In Eclipse go to Window >…
-
1
votes2
answers8546
viewsA: How to set and pick objects saved in Javascript session
If you can create a JSON for the Person array: {"Status":"OK!","Pessoa": [{"IdPessoa":01,"Nome":"JOAO"}, {"IdPessoa":02,"Nome":"MARIA"} ]} Then pass JSON in String form: var parsedResult =…
javascriptanswered Tiago Oliveira de Freitas 1,798 -
1
votes2
answers336
viewsQ: Instantiate an external Java directory class in JSP
I created my app Java with Eclipse in the directory Meus Documentos/workspace/TesteJAVA/ Now I want to call a class with JSP, want to know how to configure to grab the application from this…
-
5
votes2
answers179
viewsA: Doubt about using the Inner Join
Try this query: SELECT cad.IP, por.numero_porta, swi.modelo FROM cadastro cad INNER JOIN Porta_has_Cadastro phc ON cad.idCadastro = phc.idCadastro INNER JOIN Porta por ON phc.id_porta = por.id_porta…
-
3
votes2
answers757
viewsA: NULL value in database x performance
In SQL queries, NULL behaves differently when using certain functions, e.g.: A table with: | ID | Cliente | Valor Gasto | | 01 | JOAO | 100 | | 02 | PEDRO | NULL | | 03 | MARIA | 50 | When executing…
-
3
votes4
answers34297
viewsA: Take the highest value per category by also loading the ID
You have equal id and category, so it is a composite primary key, can bring what you look for with a subquery in HAVING, so it will work: SELECT id, categoria, quantidade FROM categoria cat GROUP BY…
-
3
votes2
answers586
viewsA: Application does not save data and only saves code
You did not set values in the person object, at least I did not find the sets methods in the code: public VideoPessoa() { initComponents(); new Conexao(); pessoaController = new PessoaController();…
-
-1
votes2
answers909
viewsA: Generate HTML elements via Javascript
Try this: <script> function sua_funcao(parametroA) { if (window.XMLHttpRequest) { // code for IE7+, Firefox, Chrome, Opera, Safari xmlhttp = new XMLHttpRequest(); } else { // code for IE6, IE5…
-
35
votes2
answers48974
viewsQ: What does public Static void main(String[] args) mean?
I want to understand what each item of public static void main(String[] args) in Java and when to use.
javaasked Tiago Oliveira de Freitas 1,798 -
18
votes2
answers48974
viewsA: What does public Static void main(String[] args) mean?
public: is the visibility, which may be public, private, protected or default. Static: is optional, means that the method can be called without the class being instantiated into an object, is very…
javaanswered Tiago Oliveira de Freitas 1,798 -
0
votes1
answer27536
viewsQ: How to include or remove enter, line break, new line from a string - Postgresql
How to remove or include "line break", "enter", "new line" from a string result in postgres. The result is: comentário Texto do comentário Mais texto And I want to: comentário Texto do comentário -…
-
1
votes1
answer27536
viewsA: How to include or remove enter, line break, new line from a string - Postgresql
To remove, we can use: select regexp_replace(sua_coluna, E'[\\n\\r]+', ' - ', 'g' ) OR select regexp_replace(sua_coluna, '[\n\r]+', ' - ', 'g' ) To includes a new use line: select E'Primeira…
-
1
votes1
answer123
viewsA: Stored Procedure loop
I don’t know this syntax, which SQL language is this ? If you run the following select: select 8 + null You will see that the value will be equal to null, you are sure that no null is coming in…
-
0
votes1
answer62
viewsA: Determining value within a pivot
This query would bring something like: F.CHAPAFUNC | F.NOMECOMPLETOFUNC | F.DTADMFUNC | DIAMES | OCORRENCIA | OCORRENCIA1 | VALOR_PREMIACAO | | | | | | FUNC | JOAO | 10/11/2014 | 10 | 25 | 25 | 100%…
-
1
votes2
answers153
viewsA: Is it possible to use between to filter searches with a Character field?
It is possible, however string and number are read in different ways, the number is read respecting the values of each position, (units, tens, hundreds etc.), the string from left to right,…
-
4
votes5
answers15132
viewsA: Change NULL value in SQL SERVER
Failed to quote the COALESCE SELECT COALESCE(coluna, 'NONE') ... This function is standard in the SQL language and applies to other databases (which implement it logically). It is also possible to…
-
11
votes2
answers48433
viewsA: Using WITH AS command in Sql Server
This syntax would not work, the correct is: With ClientesAtivos AS ( SELECT Id from Client WHERE IsActive = 1 ), ClientesInativos AS -- apenas um WITH, os demais são separados por vírgula) ( SELECT…
sql-serveranswered Tiago Oliveira de Freitas 1,798 -
1
votes2
answers319
viewsA: how to take an element from a table
Usa subquerys, SELECT nomeProduto, codigoProd, (subquery que busca o cliente que mais comprou) AS cliente, (subquery que busca a quantidade vendida) AS qtdComprada; FROM PRODUTO ... The subquery is…