Posts by Sorack • 27,430 points
864 posts
-
1
votes2
answers349
viewsA: Checkbox - how to check if at least 1 cbx has been selected
If you want to try one-on-one: boolean algumSelecionado = jcbx1.isSelected() || jcbx2.isSelected() || jcbx3.isSelected() || jcbx4.isSelected() || jcbx5.isSelected() || jcbx6.isSelected() ||…
-
0
votes2
answers145
viewsA: Is it possible in Mysql to update column information in several duplicated rows, leaving only one row with the original value?
You just change the query that you had quoted to UPDATE: UPDATE a SET apresentado = 0 FROM sis_produto_xml a LEFT JOIN (SELECT MIN(ID) id, sku, nome FROM sis_produto_xml GROUP BY nome) b ON a.id =…
-
3
votes2
answers87
viewsA: Scroll down when restarting with JS
Try to use the onload within your javascript: window.onload = toBottom; function toBottom() { setTimeout(function() { window.scrollTo(0,document.body.scrollHeight); }, 0); }…
javascriptanswered Sorack 27,430 -
2
votes2
answers1010
viewsA: Recursive search in all directories and Ubdirectories of a given folder
Using Java 8 you can use the method walk class Files: List<Path> lista = new ArrayList<>(); Files.walk(Paths.get("C:/D/Desktop/Workshop")) .filter(arquivo -> this.filtrar(arquivo))…
-
1
votes2
answers82
viewsA: Join bringing wrong value
You are misusing the INNER JOIN, making the bond for what should be their condition OR: SELECT SUM(h.vl_honorario) as vl_honorario, h.id_usuario FROM empresa as h INNER JOIN honorario as p ON…
-
2
votes1
answer213
viewsA: Get elements from one dependent column of another
You can use a subquery to obtain the quantity of each species per tank. However, to show only one record per tank you will need to use the NOT EXISTS comparing the quantity using HAVING. The result…
-
2
votes1
answer173
viewsA: Why can’t I access the elements inside an Arraylist with a for?
Let’s assume you have an item class: public class Item { String descricao; public String getDescricao() { return descricao; } public void setDescricao(String descricao) { this.descricao = descricao;…
-
1
votes2
answers1404
viewsA: Split string into substrings and search for them in another
Based on a function to separate words by space: if object_id('fc_split', 'TF') is null begin exec('create function fc_split() returns @resultado table(item varchar(max)) as begin return end'); end…
sql-serveranswered Sorack 27,430 -
1
votes1
answer42
viewsA: Enter a column if it exists in ALL elements of another SQL
You can use the clause NOT EXISTS in the WHERE to look for an unconnected aquarium: SELECT cat.nome FROM cat_taxonomica cat -- Que não tenha um aquário sem vínculo WHERE NOT EXISTS(SELECT 1 FROM…
-
3
votes1
answer78
viewsA: Get the largest elements of an SQL column
You can use the clause EXISTS in the WHERE to test if there is any aquarium with higher suitability and only show the result if there is no: SELECT e.nome_cientifico as especie, a.nome as aquario…
-
3
votes1
answer93
viewsA: Group SQL queries
Basically you just have to do LEFT JOIN with herself: SELECT base.codigo_processo, base.nome_produto_processo, base.aprovado_uso, boletim.caminho_arquivo AS 'Boletim Tecnico', fispq.caminho_arquivo…
-
1
votes2
answers489
viewsA: Sqlserver Trigger after update
The ideal way for the structure to work in the best way was that its table email had a id single, so it would be possible to do with a trigger instead of that would do the treatment even before the…
-
4
votes2
answers2545
viewsA: Move file list between folders
Just out of curiosity in versions prior to 7. Renaming: import java.io.File; public class Movendo { public static void main(String[] args) { try { File arquivo = new File("C:/pasta1/arquivo.txt");…
-
3
votes1
answer53
viewsA: Why should I create a static method and not one that could instantiate the class and use this method?
A static method should be created if it makes sense to have it without an instance of the Object. Simple example: in a class Geladeira you may have a static method double…
-
3
votes1
answer4117
viewsA: Convert ISO-8859-1 string to UTF-8 in java
The problem is that the System.out.println shows only in a encoding, then to show with encodings different you could use the PrintStream: PrintStream outISO = new PrintStream(System.out, true,…
-
3
votes1
answer64
viewsA: Doubt - Angular Controllers
You can have a Controller for view, but the important thing is to recognize that the concept of Controller serves to separate the application scopes. The Controller decouples the format of the…
-
1
votes1
answer215
viewsA: Like query returns nothing when you have more than one word in PHP
Since the word without accentuation works correctly in the search the problem is probably the encoding used that for sqlsrv_queryis ISO-8859-1. So before you run your query do the decode: $SQL =…
-
12
votes6
answers17915
viewsA: How to make a phonetic algorithm for Brazilian Portuguese?
Considering only the implementation of the algorithm I have a function adapted to Mysql in which the phonemes have been analyzed and improved as time goes by to reflect the searches performed in…
-
4
votes1
answer73
viewsA: What error in while loop? moon turn on
You missed zeroing the variable cont within the while: while n<=29 do k=1 cont = 0 ...
-
3
votes2
answers1290
viewsA: Error: android.database.sqlite.Sqliteexception: no such column:
Your CREATE is with if not exists. If you do not delete the old table it will never create the new column. Or you delete the old one: DROP TABLE users; Or you use the following command to add the…
-
4
votes1
answer838
viewsA: Interface defining the signature in a generic way of the methods to be implemented
You can use a generic type on interface as follows: import java.util.ArrayList; public interface ICRUD<T> { void adicionar(T objeto); void remover(T objeto); boolean alterar(T objeto); T…
-
1
votes2
answers718
views -
11
votes1
answer8640
viewsA: Limit and Offset for Web Paging in SQL Server
As of SQL 2012 SELECT coluna1, ... FROM tabela WHERE ... ORDER BY coluna1, ... OFFSET @Offset ROWS FETCH NEXT @Limit ROWS ONLY; In your case you can change the variable @Limit for @QtdPorPagina and…
-
3
votes1
answer289
viewsA: Tag Google Adwords Conversion Actions
You can add a trigger to his tag. One trigger manages when a tag is activated. It consists of an event and one or more filters. Each filter consists of Variable, Operator and Valor. Variable: Choice…
-
2
votes3
answers1314
viewsA: How to read a . json file in the Angular module.config()?
You must put this file .json inside a folder in the public and access it using $http: $http.get("./conf/configuracao.json").success(function(dados, status, headers, config) { ...…
-
3
votes1
answer839
viewsA: What is this? private List<Map<String, Object>> expenses;
Yes, it is a list of maps. It allows you to insert a set of keys and values forming a structure like your example: [ {"data": "04/02/2012"}, {"descricao": "Diária Hotel"}, {"valor": "R$ 260,00"},…
-
5
votes1
answer1828
viewsQ: How to present the correct accent on the return of cmd?
Considering a method to list files from a folder using ProcessBuilder I have the incorrect return of the accented words. Code import java.io.BufferedReader; import java.io.IOException; import…
-
2
votes2
answers1688
views -
1
votes1
answer260
viewsA: How to turn v-on:click="Sync" into an automatic trigger when opening html
You can take the creation of the function vm and right after calling the function: var vm = new Vue({...}); vm.setNoticias();
-
1
votes2
answers188
viewsA: Receive 2 parameters when entering a key parameter
One way is to use the class Multimap library Guava google. The use would be as follows: ListMultimap<Integer, String> cidades = ArrayListMultimap.create(); cidades.put(1253, "São Paulo");…
-
1
votes1
answer3648
viewsA: Sort HTML tables
You can use the method sort of array: Sort: The method sort() organizes the items of a array. Sort by the name of the disciplines: array.sort(function(a, b){ if(a.disciplinas < b.disciplinas) {…
-
2
votes4
answers1038
viewsA: How to create a regex to filter and delete files with a particular chunk in the name
You can use the following regular expression: Pattern.compile("Copia - Copia\\.[a-zA-Z]{3,4}$"); Where: Copia - Copia is the text you are looking for; \\. is the literal character .. Normal would…
-
1
votes2
answers3172
viewsA: How to add Card Mask?
The code below: Allows only digits; Put a dot every 4 characters; Remove the point if left over; Limits the size; function mcc(v){ v = v.replace(/\D/g,""); // Permite apenas dígitos v =…
-
0
votes2
answers686
viewsA: Help in Deletion and Angular Editing
Follow an example of CRUD with all operations. Although it seems like a tutorial I believe it is what you need to remedy your doubts. var app = angular.module("Aplicacao", []);…
-
3
votes2
answers194
viewsA: Hello Word javascript
Because his Javascript is in the head, that is, is being executed before the h1 is in the DOM. Option 1 - Load at the end of the body: Change to the following: HTML <!DOCTYPE html> <html…
-
5
votes1
answer102
viewsA: Treat a word with dots
I took the liberty of making some corrections on points that were not pointed out in the question: You are using id in the element span, which is incorrect if you have one more element to apply the…
-
2
votes2
answers1035
viewsA: Listing files from a folder
Using Java 8 If you want to return the objects File: private ArrayList<File> listar(String caminho, String extensao) { File pasta = new File(caminho); return this.listar(pasta, extensao); }…
-
4
votes1
answer91
viewsA: List records without reference in another table
You can use the clause EXISTS as follows: SELECT c.* FROM clientes c ON WHERE NOT EXISTS(SELECT p.codcliente FROM planos p INNER JOIN servicos se ON p.codser = se.codser WHERE p.codcliente =…
-
2
votes2
answers129
viewsA: Search frequency in Mysql tables
Without seeing the tables is kind of difficult to give you a solution, but the query would look something like this: SELECT u.* FROM usuarios u WHERE EXISTS(SELECT x.* FROM (SELECT * FROM tabela1 AS…
-
1
votes3
answers3421
viewsA: Write to files without erasing its contents
One of the options is to create a method where you will pass the file path and the text that will be applied: private void escrever(String caminho, String conteudo) throws IOException { Path…
-
6
votes5
answers3614
viewsA: Split array into smaller groups
I’d do it this way: It would go through the items of array; Use a variable to control the group the item will be placed in; It would increment the variable if the rest of its division was 0. (In…
-
1
votes2
answers936
viewsA: Read file and save lines
If using Java 8: List<String> linhas = new ArrayList<>(); String caminho = "C:/Users/lucas/Desktop/teste.txt"; try (Stream<String> stream = Files.lines(Paths.get(caminho))) {…
-
1
votes1
answer304
viewsA: Sort html with grid Angularjs
I made an example here using the ui-grid. You just need to include your data in the property data of the attribute ui-grid in your HTML. The result is as follows: (function() { 'use strict'; angular…
-
1
votes1
answer881
viewsA: Javascript search
The ideal would be for you to filter your search on the server to not consume resource. But if you want to limit the number of records on AngularJS you can use the filter limitTo: limited Creates a…
-
1
votes2
answers99
viewsA: Procedure for storing in backup tables?
You can do it this way: if object_id('realizar_backup', 'P') is null begin exec('create procedure realizar_backup as'); end; go alter procedure realizar_backup @data_inicio datetime, @data_fim…
-
2
votes1
answer110
viewsA: SQL query using several times the same function
You can create a new column to mirror the information you want: ALTER TABLE repositorio ADD numeric_tag NUMBER(12); And fill it through a trigger when inserting or updating: CREATE OR REPLACE…
-
1
votes1
answer1274
viewsA: Search function in an Angularjs list
From what I understood from your question your data are not being filtered correctly by paging. So I made an example where I monitor the variable q to filter a array and apply paging. Note that not…
-
3
votes2
answers760
viewsA: Help with mysql Kurdate()-1
The function that subtracts an interval from a date is a SUBTIME. SELECT SUBTIME(CURRDATE(), '1 0:0:0.0') As above 1 day is subtracted from date. According to the Tech On The Net - SUBTIME: Mysql’s…
-
6
votes2
answers160
viewsA: Error adding BD information
The only thing that could be wrong is that its variable Cliente empty or void. But there has to be seen in the business rule where it should be filled. syntax error at the end of the input It’s an…
-
1
votes2
answers209
viewsA: Organize multidimensional array in javascript, preventing the next item from having the same type as the previous one
Taking the solution only from the logical side I would do the following: It would separate the array main organizing by the types in other arrays underage; Check which had the highest number of…