Posts by Sorack • 27,430 points
864 posts
-
2
votes1
answer313
viewsA: Select with Angularjs
Just add an empty option to your arrayof options: $scope.typeOptions.unshift({name: '', value: ''}); Or, in the case of your example: $scope.typeOptions = [ {name: '', value: ''}, {name: 'Feature',…
-
8
votes2
answers1340
views -
1
votes3
answers421
viewsA: Query with conditions in SQL SERVER
Thinking of a forward-looking approach, I thought you might want to work with a framework that allows you to have "grandchildren" from your posts. For that I did the following script insertion:…
-
4
votes2
answers142
viewsA: how to query data in a table that is not related to the other table?
To return the available vehicles you use the query: SELECT v.* FROM veiculo v WHERE NOT EXISTS(SELECT l.id FROM locacao l WHERE l.veiculo_id = v.veiculo_id AND '2016-11-22' BETWEEN l.dt_inicio AND…
-
2
votes4
answers1255
viewsA: Index returning -1 in Java Arraylist
indexof(Object o): Returns the index of the first occurrence of a specific element in the list, or -1 if the list does not contain the element. Like int is different from Conta you will never find…
-
1
votes3
answers3228
viewsA: How to change the CSS style sheet dynamically with Angularjs?
SUGGESTION 1: You can use a controller directly into your HTML and change only the href of your link. Here’s a Plunker exemplifying. The code would look like below: index.html: <!doctype html>…
-
2
votes1
answer71
viewsA: Inconvergence of consolidated results x by interval
You should always make the consultation considering the maximum of the previous period, that is, discounting 1 second from the end: ...WHERE datetime_entry_queue BETWEEN '2016-11-03 00:00:00' AND…
-
2
votes1
answer74
viewsA: function result is given as Undefined in javascript
You are not returning the result. To do this you need a return: function calculaDiasDeVida(idade) { return idade * 365; }; function calculaBatimentos(dias){ return dias * 24 * 60 * 80; }; His…
-
2
votes1
answer61
viewsA: How to be notified when there are grid changes - Angulasjs ui-grid
According to the documentation there is an event within ui.grid.core.api called rowsRendered: It is invoked after the cache of the visible lines is changed. The call goes like this:…
-
2
votes1
answer49
views -
3
votes2
answers255
viewsA: Error while running the application on another computer
I noticed the property LoadParamsOnConnect is true in your code. Remove the line that assigns the value to property and change the component to false: SQLConnection.LoadParamsOnConnect := false;…
-
1
votes2
answers51
viewsA: $Md dialog when loading the page
You can use the $timeout: $timeout($scope.showAdvanced, 0); Don’t forget to inject the dependency $timeout to make it work properly.
-
4
votes2
answers1969
viewsA: How to get the Primary key Identity of an inserted record?
SCOPE_IDENTITY() You only need the following line to assign the code you entered: SET @codJogo = SCOPE_IDENTITY(); SCOPE_IDENTITY Returns the last identity value inserted in an identity column in…
-
1
votes1
answer432
viewsA: How to increase text font with Ngsatinize?
From what I understand of your question you must be having difficulty inserting style inline on the tag inside the ng-bind. For it to work properly you must use the provider $sce and function…
-
5
votes1
answer67
viewsA: Convert weight into money
When you use a int in a division the result will be rounded. So to solve your problem, change the result calculation to: double Result = ((5.0 / 1000.0) * pesagem); Tip: Do not use variables…
-
1
votes1
answer69
viewsA: Block Prints
The real problem is that your ordering does not consider all possibilities. For example, you do not have a if checking whether the n1 is the largest number. I would advise you to separate that part…
-
3
votes1
answer1040
viewsA: how to take data from one mysql table and insert it into another :?
Assuming that the id be it autoincrement: INSERT INTO vencimento(data) SELECT v.data FROM validacao v WHERE v.pincode = 'xxxxxxx' and v.status = 0;…
-
2
votes1
answer506
viewsA: Bootstrap - Jquery error
Add the script of jquerybefore the bootstrap: <script src="https://code.jquery.com/jquery-3.1.1.js" integrity="sha256-6cdPddA6VdVInumRGo6IbivbERE8p7CQR3HzTBuELA="…
-
2
votes2
answers619
viewsA: What is the correct way to use an npm-installed package?
I particularly like to use NPM only for server dependencies and the Bower for customer dependencies. To install Bower just use the command: npm i bower -g After doing this you can create a file…
-
4
votes1
answer368
viewsA: Format date in INSERT and UPDATE Mysql PHP
If you are using 19.11.2016 the format shall be %d.%m.%Y getting: DATA = STR_TO_DATE('$name_01', '%d.%m.%Y') The %drefers to the day, the %m refers to the month and the %Y refers to the year, where…
-
2
votes1
answer103
viewsA: Delete select value by comparing to another table
Perform a check NOT EXISTS with respect to table agendamento, checking whether the column horarios_livres is not between the horainicia and the horafim subtracting 1 second. SELECT d.* FROM…
-
2
votes1
answer320
viewsA: angular - Update radiobutton values with textarea
You’re doing almost everything the right way, but it’s best to consider that the options will be just a text and use the split at the time of assembling the checkbox, as below: (function() { 'use…
-
2
votes2
answers1513
viewsA: how to change the type of graph using Chart.js?
You can use the directive ng-if of the angular, thus the div in question will only be part of the DOM once the condition is satisfied. As you requested suggestion also used the Angular 1 Style Guide…
-
16
votes1
answer8164
viewsA: NPM --save doubt
The --save saves the package in the archive package.json, that serves as a reference for your project. Just when you use the command npm install all modules that have been installed with the --save…
-
3
votes1
answer93
viewsA: Using SELECT to list information
From what I understand of your question, you want to use only the side of client, then if you can use Javascript, as an alternative, I advise you to use Angularjs that would simply solve your…
-
1
votes1
answer1606
viewsA: How to read from a file and save to variables in Java
You can create a simple method for converting String for double: private double converter(String texto) { return Double.parseDouble(texto); } And change your method ler for: @Override public void…
-
4
votes2
answers7656
viewsA: Go through all keys of a json
You can scroll through the object with the for...in and check what type of property: var objeto = { "logistics_provider": "{{lp_name}}", "shipper": "{{co_common_name}}", "invoice_key":…
-
3
votes2
answers1052
viewsA: How to set a timeout for a request?
You just put the setting timeout: $http.get(url, {timeout: 10000})... If you want to do it with promise: var cancelar = $q.defer(); $http.get(url, {timeout: cancelar.promise})...…
-
3
votes1
answer83
viewsA: SUB-CONSULTATIONS IN SQL?
Would look like this using INNER JOIN to find the person, but will only return the name and date: SELECT pes.nome as pessoa, emp.data_do_aluguel FROM emprestimo emp INNER JOIN pessoa pes ON pes.id =…
-
4
votes1
answer368
viewsA: GET function in ng-click
Is missing the $scope before the declaration of your method so that it is visible to the view: $scope.carregarContratosPaginados = function (pageNumber)...…
-
1
votes1
answer919
viewsA: SELECT with REGEXP
Actually if you don’t want to use regular expression you can only use one replace: SELECT * FROM pessoas WHERE replace(replace(cpf, '.', ''), '-', '') = '00000000000'; Where the first parameter is…
-
1
votes2
answers76
viewsA: I have a mistake I can’t identify in the println
You didn’t set the property data before line 16 of its main class: lucas.data = new Data(); lucas.data.setDatadia(13); Other than that I have at least 2 tips to give you: 1) Use the constructor to…
-
4
votes1
answer415
views -
21
votes5
answers7016
views -
7
votes4
answers640
viewsA: Java abstract class exercise doubt
If using Java 8 you can iterate as follows: public void imprimir(Set<? extends FuncionarioAbstract> funcionarios) { funcionarios.forEach(this::imprimir); } And implement the method that prints…
-
4
votes1
answer407
viewsA: How to get the date of a server instead of a local server?
Considering that your database will be on a server that is out of the user’s control, one of the ways to resolve it is directly on query as follows: SELECT CASE WHEN STR_TO_DATE(data, '%d%m%Y') >…
-
2
votes1
answer34
viewsA: Error trying to access certain bank information
The Connect of IdHTTP only works if you already have the address. Remove this line and add only if you put the address of the URL to connect to.
-
3
votes2
answers878
viewsA: Limit record occurrences for each type
You can use the ROW_NUMBER grouped as follows: SELECT x.* FROM(SELECT ROW_NUMBER() OVER(PARTITION BY m.TIPO ORDER BY m.ID) as sequencia, m.* FROM TB_MATERIAIS m) x WHERE x.sequencia <= 10;…
-
3
votes2
answers1007
viewsA: How do I display what’s on the list?
Your class Item need to overwrite the method toString. By default the method shows a hashing unique generated by JDK. Then it would be something like: @Override public String toString() { return…
-
3
votes2
answers2957
viewsA: I need a new Random number for each line in an sql(server) query
You can use the function row_number assigning a line number based on aggregation or ordering, and using the function newid as sort, which generates a unique value for each line each time the query…
-
2
votes1
answer102
viewsA: How to take more than one database value and save in a Combobox more than one returned value?
Your problem is that you return in the first increment of ResultSet. Then I suggest you return one List of String: public List<String> tipoMedico(String tipo) { List<String> medicos =…
-
3
votes2
answers1004
viewsA: Group table data with two columns
If you want to obtain as separate data: SELECT COUNT(tipo) as quantidade, identificador, GROUP_CONCAT(de ORDER BY de SEPARATOR ', ') AS dados FROM tabela GROUP BY tipo, identificador Or if you want…
-
2
votes2
answers886
viewsA: compare and remove repeated element
If you want to use a structure that does not allow duplicated objects maybe you should take a look at Set. If you want to use the array, but also take advantage of this Set, implement the method…
-
1
votes1
answer452
viewsA: SQL, subquery if null
The ifnull has to stay out of the parenthesis of subquery: ifnull((select ...), 0) as aumento
-
2
votes1
answer60
viewsA: Find and replace string
Replacement can be done with regular expression / *- *[0-9]+ *CM/g where * that is to say zero ou mais spaces and [0-9]+ that is to say 1 ou mais digits. So we can transform JSON into a string to do…
-
4
votes1
answer813
viewsA: cannot be cast to java.util.Map
The variable r is an instance of Criteria and cannot be converted to a List. Actually to return the result list you should use the method list() as follows: return (List<NotaFiscalProduto>)…
-
1
votes2
answers402
viewsA: SQL/Java query
Whereas you are using the Ormlite and that you want a result similar to: SELECT classe FROM tabela WHERE 32 BETWEEN minimo AND maximo We will need to create a query using the queryBuilder of Dao.…
-
2
votes2
answers119
viewsA: Helps decrease the size of php mysql scripts
Analyzing their querys I identified that there are seven of them that have the same goal, which is to bring the amount of answers per area. So I suggest you return them all at once, so you can…
-
2
votes1
answer795
viewsA: Select to check where a primary key is referenced
Making INNER JOIN only the records that satisfy the junction will appear, so you can check the method to select them as follows: SELECT pes.nome, 'C' as tipo FROM pessoa pes INNER JOIN cliente cli…
postgresqlanswered Sorack 27,430 -
2
votes1
answer1673
viewsA: Scanner.nextLine does not pick up information after Scanner.nextInt
According to the scanner class documentation the method nextLine returns the remainder of the last line that was read, which in this case is only a enter, so the reading is ignored. Then following…