Posts by Sorack • 27,430 points
864 posts
-
10
votes1
answer1546
viewsA: How to round up time?
Using the function DATEDIFF You get an integer representing the difference between two dates. As the rounding you want is in the minute box, you only need to calculate the difference between the…
-
6
votes2
answers1943
views -
2
votes4
answers2773
viewsA: How to mount buttons with Angular?
Using Boostrap and Button Group: angular .module('app', []); angular .module('app') .controller('ClassesController', ClassesController); ClassesController.$inject = []; function ClassesController()…
-
3
votes1
answer471
viewsA: Transfer data from SQL Server to Sqlite with Android
If you use the SQL Studio just right click on the database you want to copy the data if you select Tasks > Generate Scripts.... Fill in the information until the screen Set Scripting Options and…
-
2
votes2
answers1020
viewsA: Delete record being duplicated in query with Inner Join
From what you’ve described, you only use the product to make a filter, so there’s no need to show the features. So the ideal is that you do not use any kind of JOIN and yes the clause EXISTS in his…
-
1
votes4
answers5888
viewsA: Select with multiple Left Joins Sql Server
You can use the clause UNION which will "concatenate" the results of querys that have the same definitions of resulting columns. So you can assemble a return of people with their proper types. UNION…
-
7
votes2
answers941
views -
1
votes1
answer72
viewsA: Doubt with select in mysql
You only need to make one INNER JOIN in the same table passing the field you want to link, in this case the id_cliente: SELECT dev.id FROM pedidos ped INNER JOIN pedidos ped2 ON ped2.id_cliente =…
-
8
votes2
answers1510
views -
0
votes2
answers345
viewsA: Nodejs error and MSSQL module
Change your method getCampanhas to work with promises and add the method connect before executing the query: CampanhaDAO.prototype.getCampanhas = function(){ var sql = "SELECT * FROM…
-
1
votes3
answers793
viewsA: Check in Javascript if String has string x numbers
You can use a function that mounts the sequence and use .indexOf to check it: function verificarSequencia(texto, quantidade) { var regex = new RegExp('\\d{' + quantidade + '}', 'g'); return…
-
1
votes3
answers243
viewsA: List error with null reference in Java
You can set a default value if it is null, for example: if (listaParcelasExtraUm == null) { listaParcelasExtraUm = new ArrayList<>(); } Or simplifying using ternary operator:…
-
1
votes1
answer268
viewsA: Convert Jsoup doc to string, apply Regex and return a value in String
whereas the content to be extracted is http://arquivosdofulano.com/pessoas we can create regular expression as follows: Begins with http or https - (http|https) - The character | determines the…
-
2
votes1
answer38
viewsA: List tables to make recommendations to the customer?
You can add 1 to a column if you find the record in another table and use the sum of the 3 to sort the results: SELECT l.id_livro, IFNULL((SELECT 1 FROM curtidos c WHERE c.id_livro = l.id_livro…
-
0
votes1
answer95
viewsA: Jsoup not returning any value
Important remark: When accessing any page or service using a Web Crawler it is important to check beforehand if the provider allows you to read the content in this way. In some cases it is allowed,…
-
4
votes2
answers558
viewsA: Sort by the number of repetitions in a column?
Just put a COUNT of the records and a ORDER BY in the end: SELECT id_livro, COUNT(id_livro) AS quantidade FROM comentarios GROUP BY id_livro ORDER BY quantidade DESC…
-
2
votes1
answer61
viewsA: Returning Nullpointer in controller
You are not initiating your lists, so at the moment the method add is called for the variable listaNomeProjeto, an exception is triggered since it is null. One way to correct by disregarding your…
-
5
votes1
answer116
viewsA: Error setting Executesql method
You are importing the class Statement wrong. Change the import class Statement to the following: import java.sql.Statement; Or just remove the line below, after all you are already doing the import…
-
2
votes1
answer595
viewsA: How to display a menu according to the type of user logged in with Ionic / Angularjs?
Switch to a function as follows: ng-show="checarPermissoes('cliente')" or ng-show="checkPermissions('client')" And the function: $scope.verificarPermissoes(tipo) { var permitido; if (tipo ===…
-
4
votes4
answers1225
viewsA: How do I write a store that uses current and previous line values?
To carry out the process you want, one can use a cursor to go through the lines and select the previous value, thus updating the new value: create procedure atualizar as begin declare @id int,…
-
2
votes2
answers83
viewsA: Database connection problem
Using the microsoft documentation to make a connection with their JDBC, we have the following method conectar. I also put an example of the use for your case: public static void main(String[] args)…
-
1
votes1
answer229
viewsA: Sequential execution in Javascript or Angularjs
How you use a request to the server, automatically your calls from console.log will be mixed. But this is not necessarily wrong, since the Javascript is asynchronous in nature. Your error is in…
-
2
votes2
answers125
viewsA: How to remove rows from a table A that has no relationship to table B?
Using NOT EXISTS DELETE t_a FROM a t_a WHERE NOT EXISTS(SELECT 1 FROM b t_b WHERE t_b.fk_id = t_a.fk_id) Using JOIN DELETE t_a FROM a t_a LEFT JOIN b t_b ON t_b.fk_id = t_a.fk_id WHERE b.fk_id IS…
-
1
votes1
answer674
viewsA: Import Sql Server Backup and Differential
To answer your question, I will use the definition of 3 backup types available in SQL Server, the complete backup, differential and transaction log. The full backup, as the name already says, makes…
-
1
votes1
answer47
viewsA: How do I list what appears on the console in View?
Change your code from controller for: var tipos = window.localStorage.getItem("tipos_pagamentos"); $scope.tipos= tipos .split(';'); And change your HTML to the following: <div class="list…
-
1
votes1
answer697
viewsA: How to make a list of categories with a completed and unfulfilled task counter?
You can use a service to pass the data of a controller to the other. angular .module('todoApp') .factory('todoService', todoService); todoService.$inject = []; function todoService(){ var service =…
-
1
votes1
answer228
viewsA: Display datepicker as selected
Use the directive ng-if in the form below: (function() { 'use strict'; angular .module('appExemplo', []); angular .module('appExemplo') .controller('ExemploController', ExemploController);…
-
2
votes1
answer316
viewsA: How do I call a method that is in another class on onclick
Your question is half vague, but to execute methods of another class you have two options: Option 1 Use a method that is declared as static, as an example: public static double somar(double a,…
-
0
votes1
answer1929
viewsA: Implementation of a Linkedlist
Your method that returns the Iterator is not implemented. It is so in the code you presented: @Override public Iterator<T> iterator() { // TODO Auto-generated method stub return null; } So it…
-
2
votes2
answers87
viewsA: SQL + Left Join
In reality the best way would be with NOT EXISTS since the clause exists exactly for this purpose: SELECT p.idProduto, p.descricao AS 'Produto', 2015 AS 'Ano' FROM Produto p WHERE NOT EXISTS(SELECT…
-
1
votes1
answer63
views -
2
votes1
answer1069
viewsA: How to access variables from another class of objects per array?
Considering that this total you want to calculate is the total of all attributes, the calculation (since it is not clear in the question) would look like this: public String…
-
10
votes3
answers112
viewsA: DOM search for positive name and value
You have to separate the searches within different brackets: $('input[name="FLG_SEXOX_CLIEN"][value="{{ $cliente->FLG_SEXOX_CLIEN }}"]').attr('ckecked').trigger("chosen:updated"); Selector -…
-
8
votes2
answers4792
viewsA: Check if it already exists in the table before entering record
You can do the INSERT straight from a query. INSERT INTO relacao(user_1, user_2) SELECT x.user_1, x.user_2 FROM (SELECT 'Pedro' user_1, 'Laura' user_2) x WHERE NOT EXISTS(SELECT 1 FROM relacao r…
-
1
votes2
answers56
viewsA: Is there a way to transform a string as a path?
To access an attribute with the key as a string you must use brackets []: sql.datatypes.integer[type].mysql
-
1
votes1
answer357
viewsA: Pass a subquery of the FROM clause to the WHERE clause
Although it is not the best way, following what was required in the question the result would be more or less this. It is not recommended to use the same query so many times in this way and it is…
-
3
votes2
answers1032
viewsA: Bring all records if parameter is different
Use the clause OR for conditional search. SELECT c.* FROM contrato c WHERE :parametro NOT IN (0, 1) OR c.concluido = :parametro; If the parameter can be null, use one more clause OR: SELECT c.* FROM…
-
2
votes1
answer98
viewsA: SQL: MAX(data) with wrong results
The correct thing would be for you to do the validation with a NOT EXISTS bringing only with the record with the highest date as follows: SELECT a.n_func, a.id_sk, a.data, a.obs FROM chklist a WHERE…
-
2
votes2
answers82
viewsA: To obtain number of elements depending on the maximum number of elements per groups
You can use the following query if there are no "holes" in the field id_especime: SELECT x.nome FROM (SELECT max(e.id_especime) as maximo_id_especime, a.nome FROM aquario a INNER JOIN especime e ON…
-
3
votes1
answer5997
viewsA: Currency format
You can use the function FORMAT as follows: SELECT t.*, CONCAT('de ', FORMAT(t.valor, 2, 'de_DE'), ' por ', FORMAT(t.desconto, 2, 'de_DE')) AS promocao FROM (SELECT c.Valor as valor, c.valor -…
-
5
votes1
answer77
viewsA: Double Binding is not working with Angularjs
You need to initialize the variable size in his controller since it will only manipulate items within it: $scope.size = []; var app = angular.module('app', []); app.controller('TestController',…
-
3
votes1
answer874
viewsA: Ascending and descending order Angularjs
The first thing is that you are forcing the ordination on HTML. When you have a dynamic ordering it becomes easier to do and cleaner to do it on controller. Secondly you have a ng-if and this limits…
-
6
votes2
answers2784
viewsA: What is the argument limit of the IN operator in SQL Server?
Using a subquery in the IN I reached the memory limit used by the bank, but not within the clause. I used the following script for that reason: declare @numeros table(numero int); declare @proximo…
-
2
votes1
answer2775
viewsA: JSON Parse error:
The error refers to the format of your JSON. The function JSON#parse requires the parameter to be a JSON validated. Check the contents of your variable this.responseText and validates whether it is…
-
10
votes2
answers1267
viewsA: What is the difference between String[] args and String args[]?
The execution works both ways without any real difference. The recommendation is to use the syntax String[] args which is more consistent with the Java typing declaration. The first also allows the…
-
3
votes1
answer89
viewsA: Help with MYSQL TRIGGER
You don’t need a trigger. It is only necessary that you create a foreign key column and determine that it is not possible to delete if there is a child: ALTER TABLE ocorrencias ADD CONSTRAINT…
-
2
votes1
answer38
viewsA: Create a query by checking two columns
The following query will return the total for you, where the variable @id_usuario should be replaced by the user code you are looking for: SELECT COUNT(1) AS total FROM TBL_MISSAO WHERE…
-
4
votes1
answer98
viewsA: Pick specific snippet from a string
You can use the parse_str and parse_url: <?php $url = "https://www.youtube.com/watch?v=k4qVkWh1EAo"; parse_str( parse_url( $url, PHP_URL_QUERY ), $vars); echo $vars['v']; // Saída: k4qVkWh1EAo…
-
2
votes2
answers309
views -
3
votes1
answer219
views