Posts by Sorack • 27,430 points
864 posts
-
2
votes2
answers231
views -
1
votes2
answers184
viewsA: Error: Typeerror: $http.get(...). Success is not a Function
The function success of $http.get is only functional until version 1.4.3 of AngularJS. For subsequent versions, use the method then to capture the outcome of the promise. Replacing in your code:…
-
0
votes2
answers97
viewsA: Search for lower values of one field according to values of another
You can use internal variables to organize the data the way you want: SET @row_number = 0; SET @idativo = 0; SET @minimo = 0; SELECT x.idforn, x.idativo, x.minimo FROM ( SELECT @row_number := CASE…
-
0
votes2
answers2470
viewsA: Error: push is not a Function
You are using the variable listClient as an object and not as a array. Objects do not have the function push. Change the variable initialization to: $scope.listClient = [];…
-
2
votes1
answer62
viewsA: Align queries and pass your results as alias for SOMA
You can use a CASE (as suggested by Motta) and use the result of this to make the calculations you want: SELECT x.month, x.total AS 'total (100%)', (x.preventiva * 100) / x.total AS…
-
1
votes2
answers250
views -
1
votes2
answers697
viewsA: Problem renaming column in Sql Server table
Just remove the keys from your first call: USE meu_db GO EXEC sp_rename 'minhaTabela.minhaColunaAntiga', 'minhaColunaNova', 'COLUMN'; GO SP_RENAME Changes the name of a user created object in the…
-
2
votes2
answers1011
viewsA: Msg 8114 error in SQL Server while performing query
The problem is that you are trying to concatenate some field that is a numeric so the DBMS tries to convert the rest of the text to numeric when trying add up and not concatenate. In order for this…
-
1
votes2
answers133
viewsQ: COMMIT inside a CURSOR
I have a very large database that I have to copy information from. To decrease the use of memory I thought of inserting the information in parts, using a CURSOR and paging the data, thus carrying…
-
2
votes1
answer260
viewsA: How to access attributes of an object coming from a request with Node
You can access the property body.response.docs that will be a array. So you can go through this array: const { docs } = body.response; for (const doc in docs) { console.log(doc); } for...in The…
-
1
votes1
answer36
viewsA: Javascript - function Math.log() does not load
You had placed a variable with the same name of the function and also had not created the elements yet. Fixing we will have: function calcular(x, y) { return Math.log(y) / Math.log(x); } function…
javascriptanswered Sorack 27,430 -
4
votes1
answer1695
viewsA: SQL how to select in 2 different columns
To attach instructions in clause WHERE you must use the word AND: SELECT * FROM jogos WHERE name LIKE "%acao%" AND tags LIKE "%acao%" If you want to test the search in any of the columns, regardless…
-
3
votes1
answer237
viewsA: I cannot connect the Mysql Nodejs database
You are not checking for possible errors at any time. I suggest the following changes, so the errors will be shown and it will be easier to find the problem: const mysql = require('mysql'); const {…
-
3
votes1
answer48
viewsA: Return least repeating records
Your example does not match the description of the problem, but I deduce that the result you want can be achieved by creating an auxiliary table of numbers, which will have the possible values:…
-
0
votes1
answer62
viewsA: Stored Procedures parameters
You must check the NULL with the IS instead of = (The reason you can check in the answer to the question "Why NULL values are not selected?". After that you should use the function DATEADD to return…
-
2
votes1
answer334
viewsA: How to group ng-repeat in Angularjs
You can use the Angular-filter as a complement to your project and accomplish what you want with two ng-repeat: angular .module('ModuloTabelas', ['angular.filter']) .controller('ControllerTabelas',…
-
8
votes1
answer66
views -
4
votes1
answer237
viewsA: Java: Error while recovering data from Resultset, even though query is correct
How can you check in the documentation to obtain values of ResultSet you should call the method next() before obtaining the data: while(resultSet.next()){ conta.setAgencia(…
-
4
votes1
answer618
viewsA: Picking Gaps in an SQL sequence
You can use the clause WITH to generate the sequence of number and compare it with the table in question: WITH sequencias AS (SELECT 1 AS sequencia UNION ALL SELECT s.sequencia + 1 AS sequencia FROM…
-
6
votes3
answers971
viewsA: Line with NULL value is disregarded by the SUM function?
In the Mysql grouped function documentation: ... group functions ignore NULL values. OR IN FREE TRANSLATION: ... grouped functions ignore NULL values. In the SQL Server the NULL of grouped columns…
-
1
votes3
answers61
viewsA: Order newly added entries dynamically
If you want to do it for queryyou can use the clause ORDER BY: ORDER BY coluna DESC Or you can order in the JavaScript for sort: const rows = results.rows.sort((a,b) => return b.coluna -…
-
2
votes4
answers1051
viewsA: Is it possible to change Placeholder in Focus with CSS?
You can use the pseudo-element before of a div with contentEditable true to achieve an approximation of the desired result with CSS: div[type=tel][contentEditable=true] { -moz-appearance: textfield;…
-
1
votes1
answer121
viewsA: Validate path nodejs
Whereas the path is one string you can use the function indexOf to identify whether the index is 0, i.e., whether the string in question starts with the text that was provided. It would look…
-
0
votes1
answer2383
viewsA: Error connecting Firebird database to Nodejs
Try without all this configuration information to see if it is not an information conflict problem: const firebird = require('node-firebird'); const configuracoes = { database:…
-
0
votes2
answers537
viewsA: Procedure of Insert in three tables
You can use the clause OUTPUT as follows: ALTER PROCEDURE adicionarNovoLivro( @nome_livro varchar(255), @nome_autor varchar(255), @ano_livro int, @nome_editora varchar(100), @preco_livro float ) AS…
-
1
votes2
answers57
viewsA: Changing fields separator for a Macaddress
First use toLowerCase in his string: toLowerCase The toLowerCase() method returns the string called converted to lowercase. Then use replace: replace str.replace(regexp|substr, newSubStr|function)…
-
0
votes2
answers542
viewsA: Insert multiple records into Mysql using NODEJS
Considering that the names of your fields in the table are equal to those reported in the question, your code would be as follows: const values = products.map((product) => { return […
-
1
votes1
answer271
viewsA: How to create a unique Drawer?
I solved this problem by creating a Scaffold standard for the application: import 'package:flutter/material.dart'; import 'transmission_list_page.dart'; class MeuAppScaffold extends StatelessWidget…
-
0
votes1
answer35
viewsA: INNER JOIN for more than one field in the same table
You do not need the parenthesis to specify. Do it this way: ON categorias.codigo = empresas.categoria OR categorias.codigo = empresas.categoria_2 Or ON categorias.codigo IN (empresas.categoria,…
inner-joinanswered Sorack 27,430 -
0
votes2
answers114
viewsA: error in reading JSON
But your JSON is wrong anyway. In array people you are setting properties when it should be a list. You can check that the Javascript cannot interpret your data with the syntax that was defined…
-
2
votes1
answer382
viewsA: Calculating Larger and Smaller Than Average Returns SQL SERVER Error
The mistake is very clear: Cannot perform an Aggregate Function on an Expression containing an Aggregate or a subquery. Or in free translation: Cannot execute an aggregated function in an expression…
-
0
votes1
answer271
viewsQ: How to create a unique Drawer?
I would like to create a Drawer unique to my entire application and get a consistency on it. How can I do this without having to rewrite it on all my pages? For example, I have the following Drawer…
-
0
votes1
answer320
viewsA: Does not run server.js
The command npm run is an alias for the command npm run-script <comando> which indicates which property script scripts of package.json will be executed. In your case you are running with the…
-
2
votes3
answers3112
viewsA: How to change the border color of a Textformfield?
To solve this problem I created a new theme for the TextFormField in question: final password = new Theme( data: new ThemeData( hintColor: Colors.white, ), child: TextFormField( autofocus: false,…
-
3
votes3
answers3112
viewsQ: How to change the border color of a Textformfield?
I would like to change the color of the Textformfield border on the login screen to white, because the background is gradient and it would be easier to view the text. Today I’m using the pattern I…
-
2
votes3
answers475
views -
1
votes2
answers184
viewsA: Bring sql record even if you don’t have the necessary accent
You can use a collation different at runtime to remove accents: ... WHERE nome like '%vidracaria%' collate utf8_general_ci Or in case of pointed error: ... WHERE nome like '%vidracaria%' collate…
-
6
votes2
answers582
viewsA: Document.getElementById( ).value is not working with window.open( )
You are changing windows before you take the value of the element. Just take the value before you give the window.open: function myFunction() { var salario_bruto =…
-
0
votes1
answer428
viewsA: Delete all records from a database except a user
You can use the script of this OS response to generate key changes to include ON DELETE CASCADE which will automatically delete the line with the foreign key set when the primary key of the table…
-
0
votes2
answers190
viewsA: How to use a border image (or character) via CSS?
As you say this response from the OS you can draw the keys without using any pseudo element in pure CSS. Footsteps: Create an element like <div or span and use inline-block so that the size is…
-
0
votes1
answer1210
viewsA: Select with subquery to catch previous record
You can use the function ROW_NUMBER() signed by usuarioid to achieve the order of the readings and perform the calculation: WITH ordenado AS ( SELECT l.leituraid, l.usuarioid, l.referencia,…
-
3
votes3
answers914
viewsA: Expand or Minimize code snippet in eclipse
If the editor is in English, the option is: Windows -> Preferences -> Java -> Editor -> Folding To minimize all code snippets: Ctrl + Shift+ / To expand all code snippets: Ctrl + Shift+…
-
0
votes3
answers660
viewsA: Search JSON values for multiple keys
You can simply access the attribute from the first key and then use the function Object.values() to check if the value is contained within the object const buscar = (dados, chave, conteudo) => {…
-
4
votes0
answers172
viewsQ: How to optimize the generation of combinations?
I have the following code: const montar = (volante, todos, posicao, restantes) => { if (restantes === 0) { return [volante]; } const tamanho = todos.length - (restantes - 1); let novos = []; for…
javascriptasked Sorack 27,430 -
2
votes1
answer48
viewsA: Sorting multiple columns
You can use the clause GREATEST: SELECT * FROM vendas ORDER BY GREATEST(data_venda, data_agendamento, data_cancelamento, data_ligacao); GREATEST() With two or more Arguments, Returns the largest…
-
16
votes2
answers11240
viewsQ: Difference between splice() and Slice()
What is the difference between the functions splice() and slice() of the object Array of JavaScript and when each shall be used?
-
0
votes2
answers262
viewsA: I need help with that ES6 code
Disregarding that you did not inform the data input and output form, I took into account that you need 3 actions: Create a line with each person’s data; Capitalize the first letter of each name;…
-
1
votes1
answer675
viewsA: read data from a url and download
To download a file using Node.js you can use a request module http and use the stream response to generate a file. In my example I will use the module request. To install it use the command: npm i…
-
7
votes2
answers3839
viewsA: How to remove a Key from a JSON
From the ES6 you can use the function Array.prototype.map() using "Assignment via structuring (destructuring assignment)" together with the "Scattering Syntax (Spread syntax)" to delete the…
-
0
votes3
answers125
viewsA: Async Function javascript
To use the await you need to make the function asynchronous. For this you can use the async: const getProduto = async (id, produto) => { ... console.log(`getproduto --> ${produto.nome}`); };…