Posts by Ricardo Pontual • 21,129 points
751 posts
-
7
votes1
answer196
viewsA: VB6 always executes the 2nd function even though the 1st is False
This evaluation of logical expressions is known as "short-circuit evaluation" (Short-Circuit Evaluation): Short-Circuit Evaluation Unlike C# for example, in VB this validation is not performed, that…
-
1
votes1
answer257
viewsA: Problems when giving Post on a Viewmodel to the Controller - Asp.Net Core 2 MVC
When you put the Model, only what has been associated with the elements in the View with names corresponding to the properties of your Model. In the code below: <select asp-for="PessoaNatureza"…
-
1
votes1
answer721
viewsA: Conditional in Mysql
You can use CASE WHEN for that reason: SELECT *, CASE descritor WHEN 'PT' THEN 'Português' WHEN 'MT' THEN 'Matemática' END AS Disciplina FROM Tabela…
mysqlanswered Ricardo Pontual 21,129 -
0
votes2
answers1361
viewsA: Insert content from an HTML file into a DIV - jQuery/Ajax
An alternative is to use Ajax itself to do this. The secret is to set the dataType as "html", so: $('.carrega_pagina').click(function () { var href = $(this).attr('href'); $.ajax({ url: href,…
-
4
votes3
answers139
viewsA: Difference between attr=val, attr="val" and attr='val' in Javascript?
From the selector’s point of view, there is no difference, but there are some considerations: Single or double quotes depend on how the command started not to conflict. Example:…
-
1
votes2
answers145
viewsA: Jquery autocomplete 1.9.1
The plugin autocomplete, according to API jQuery, was included in the version 1.8 It is part of the jQuery UI, if you loaded js jquery-ui.js it has to work, if you don’t have it in your project, you…
-
5
votes3
answers1947
viewsA: Add time column in SQL SERVER
You can use a combination of DATEADD and DATEDIFF to calculate the difference in interval in hours, and CAST at the end to convert to format TIME thus: select CAST(DATEADD(ms, SUM(DATEDIFF(ms,…
-
0
votes3
answers262
viewsA: Browse array to find a particular index
You can use the filter of Javascript, which is a function where you make the comparison of what you are looking for so that it returns a boolean, and can replace the for var users = [ {nome:…
-
2
votes1
answer180
viewsA: What would be the format of the data transmitted by a SOAP web service?
A web service SOAP traffic XML More info here: https://www.w3schools.com/xml/xml_soap.asp A SOAP message MUST be encoded using XML That is, the messages SOAP always traffic in XML A SOAP message is…
-
1
votes2
answers998
viewsA: URL redirection via web.config
Failed to add the $V, which is the path of the url with page before the $Q which is the querystring, the exactDestination="true", that informs that it will be an absolute and not relative path:…
-
1
votes2
answers37
viewsA: How do I send an email form and change the DIV to another one with a message?
It’s simple, the div has the following id: id='msgsucess' and your code is like this: $('#mgssucess').show(); just change to: $('#msgsucess').show();…
-
0
votes3
answers538
viewsA: How to take the value of each TD inside each TR dynamically using jQuery?
You can do this: create an array and add the elements to it and then serialize: var obj = { esportes: [] }; $("#tableEsportes > tbody > tr").each(function() { var linha = { esporte:…
jqueryanswered Ricardo Pontual 21,129 -
2
votes3
answers479
viewsA: Complex SQL with Mysql
Let me give you an example of how to build this using a select of multiple selects, but you could also put the results in a temporary table if you wanted to: select descricao, valor from ( select…
mysqlanswered Ricardo Pontual 21,129 -
1
votes2
answers231
viewsA: How to make a SELECT keeping the first column until the records are finished
What you want to do is what you usually want to avoid in a query with more than one table, a Cartesian. You want to combine all the data from Person with Stadium Just make a select with the fields,…
-
2
votes4
answers549
viewsA: Footer with one line
You can put each group of things from the footer (image, text and icons) into separate Ivs and use display: inline-block on the Ivs. Easy, without having to float and more organized: .footer{…
-
0
votes1
answer227
viewsA: How to change one HTML file for another?
Let’s suppose for your example the following structure: start.html h1.html (iframe menu) function alterarInput()... h2.html (iframe resto) <input id="input1" /> In any of iframes, you can…
-
2
votes2
answers260
viewsA: How to make @media print ignore @media max-width
Yes, you make them act only on the screen or printing using @media only for example @media only screen and (max-width: 1024px) { // somente tela } and then @media print { // impressão } More…
-
1
votes5
answers3081
viewsA: How to decide between using for or foreach?
Generally speaking, there is benchmarks around showing that the difference between them is not so great in most scenarios, but there are some specific ones that have a difference. Look at this one…
-
0
votes1
answer54
viewsA: Update data via cursor in another table
The problem in your script is that each time it runs from FETCH, the value of the variable @@FETCH_STATUS is updated, and this makes it impossible to use nested cursors. The solution is to assign…
databaseanswered Ricardo Pontual 21,129 -
0
votes2
answers264
viewsA: Migrate EXTRACT(YEAR_MONTH,data) from Mysql to SQL Server
You want the period '201705' between the dates of trainings.data_home_training and trainings.data_fim_training There are some ways to do this, you need to test to see the performance, but could do:…
-
0
votes4
answers2107
viewsA: Search string on page with Javascript
As you didn’t specify, you must be using Javascript pure, so you can use search: var div= document.getElementById("Id_do_div"); var existe = div.innerHTML.search("texto") >= 0; Reference:…
-
2
votes2
answers1049
viewsA: Add values of different selects
You can add directly into the bank using a third query, that would be so: select sum(janvalor) as Soma from ( select sum(janvalor) janvalor from Vendas2017 union select sum(janvalor) janvalor from…
-
0
votes2
answers35
viewsA: Query returning divergent result
You cannot enter more than one table in the clause from without relating them in any way (using join for example). That way, you need separate results. You can use a union for example: select…
-
1
votes3
answers227
viewsA: Remove class when Scroll Up with Jquery
If you want to remove the class when just scroll up, I think the animate It’s not gonna be the best option. Use scroll it is possible, see this example: var lastScrollTop = 0; $(window).on('scroll',…
jqueryanswered Ricardo Pontual 21,129 -
1
votes2
answers80
viewsA: View or hide an element with javascript codes using the.display style
If you’re using jQuery, why use the getElementById? You can use the show and hide of jQuery also, so: if ($('#DadosComplementares').val()=="SIM") { $('#Painel4').show(); } else {…
javascriptanswered Ricardo Pontual 21,129 -
1
votes1
answer670
viewsA: Why was hgrup discontinued? Any replacements on site?
This subject has already been discussed on another issue: /questions/27077/tag-hgroup-est%C3%a1-unused On how to replace, there is no other tag defined for the same semantic function of hgroup, but…
html5answered Ricardo Pontual 21,129 -
3
votes2
answers2261
viewsA: I need to do a SUM inside Group BY in Lambda
You can use LINQ to do the group by thus: var resultado = from x in suaLista group x by NumCarroId into g select new { NumeroCarroId = g.NumCarroId, LitroTotal = g.Sum(a => a.Litro),…
-
1
votes2
answers581
viewsA: How to change the default bootbox OK button name?
There are good examples in the documentation: http://bootboxjs.com/documentation.html For your case, just set buttons: bootbox.alert({ message: "Não foi possível processar a sua requisição. abra o…
-
2
votes2
answers1617
viewsA: Grab a css property with jquery
Yes, you can use css to read the computed properties of an object, example: $('#id').css('background-color'); Reference: http://api.jquery.com/css/ console.log($('#div1').css('display'));…
-
1
votes1
answer2095
viewsA: How to verify that "DLL" files was successfully registered
You can inspect the Windows registry to see if the DLL or OCX is registered. The number CLSID has registered keys: HKEY_CLASSES_ROOT\CLSID\{xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx} But for that you…
-
1
votes1
answer588
viewsA: Add address to favorites via Javascript
I use the code I found on this link: https://www.thewebflash.com/how-to-add-a-cross-browser-add-to-favorites-bookmark-button-to-your-website/ The example uses jQuery. I tested again now that I’m…
-
5
votes1
answer154
viewsA: I have a Javascript function in Chrome but not in Firefox
I’ve had this problem with Firefox, after searching the solution I found was to use it: var key = event.keyCode || event.which; In the case of Firefox, if the keyCode does not work, uses the which,…
-
10
votes2
answers684
viewsA: Use of interfaces in domain classes?
That’s a good point for discussion.. I’ll open the discussion with this answer. The purpose of an interface is to define a contract through which two components (classes, projects, services, etc.)…
-
2
votes1
answer3969
viewsA: Storage of credit card data in the database
A while ago, before the Mercadopago and of Paying were popular, I worked in a company and they wanted to process payments directly with the operator. At the time the operator said that they could…
-
3
votes2
answers3268
viewsA: Vector ascending order c#
Another change is to use the Linq which is very compact: int[] numeros = { 10, 5, 20, 60, 1, 5, 8, 30, 11, 20, 25, 30, 50 }; int[] numerosImparesOrdenados = numeros.Where(x => x % 2 !=…
c#answered Ricardo Pontual 21,129 -
0
votes1
answer226
viewsA: How to make a Join of 2 tables and where 2 fields of table A refer to the same field of table B?
You want to do the join for the same table from different fks, then you can use the inner join in place of where, and properly turn on the keys, so: SELECT GAT_requisicao.id_GATrequisicao as 'ID…
-
0
votes1
answer163
viewsA: Refresh in data attr to show in bootstrap Popover
Apparently the bootstrap always take what’s in data-content when it generates Popover, and then no longer updates. One solution is to say that content Popover will be dynamic, changing the property…
-
25
votes5
answers60507
viewsA: DISTINCT and GROUP BY, what is the difference between the two statements?
They are very different proposals. While DISTINCT aims to bring unique information by removing duplicates, the GROUP BY groups the values, and is using them in conjunction with the aggregation…
-
7
votes3
answers956
viewsA: How to make the background of a div be dotted?
You can use a combination of background-image with gradient to achieve this: div { width: 200px; height: 200px; background-image: -moz-linear-gradient(45deg, #666 25%, transparent 25%),…
css3answered Ricardo Pontual 21,129 -
4
votes2
answers410
viewsA: What is competition control?
In a very simple way, competition control aims to manage access to shared resources. The goal is to control how multiple accesses can use a resource without conflicts, because concurrent access is…
-
2
votes2
answers1832
viewsA: How to concatenate or use & commercial with date and text?
You can format the date in a variable and then assign the value in the cell: Dim data As String data = Format(Date, "dd/mm") data = texto1 & "/" & data & "/" & texto2…
-
1
votes1
answer225
viewsA: Modalpopupextender how to close when clicking outside the modal
Following @Marconi’s link, the English OS link solution: https://stackoverflow.com/questions/14650345/want-to-be-able-to-close-a-modal-popup-when-clicked-outside-of-it The proposed solution is to…
-
1
votes1
answer225
viewsQ: Modalpopupextender how to close when clicking outside the modal
Working on a cool project, I’m using the ModalPopupExtender of AjaxToolKit. I’ve identified if I can use the attributes OkControlID and CancelControlID to define which control, a Button for example,…
-
1
votes1
answer54
viewsA: Find ip inside the network
Has a class called InetAddress that can help you: InetAddress endereco = InetAddress.getByName("hostname"); String ip = endereco.getHostAddress(); Reference:…
-
2
votes3
answers92
viewsA: VB.NET to C#
This construction of VB really won’t work with C#, you’ll really need to use if if you want to test using Contains this way. You can adapt the code using an expression to evaluate the Contains…
-
2
votes1
answer49
viewsA: Reverse checkbox c#
Yes it is possible, but not using foreach. In this case, use the command for: for (int x = listView.Items.Count-1; x >= 0; x--) { UltraListViewItem item = listView.Items[x]; // aqui continua o…
-
1
votes1
answer704
viewsA: Perform calculation Quantity x Value between inputs in shopping cart
Yes, the ID must be unique. You can use the attribute name to identify the fields. For example like: <div class="qty"> <input type="text" name="quantidade" maxlength="3" />` </div>…
-
0
votes1
answer81
viewsA: How to perform a function optionally if the page is loaded within an iframe?
The @Andersoncarloswoss suggestion may give security error. Have a comment (in English) here: https://html.spec.whatwg.org/multipage/browsers.html#dom-frameelement One solution I found, was in this…
-
1
votes1
answer999
viewsA: If exists update Else Insert in table with foreign key postgres
You can use the IF EXISTS, checking if the value exists in the table with FK: IF NOT EXISTS (SELECT 1 FROM TabelaFK WHERE campo = valor) THEN -- insere os dados na tabela "FK" END IF; Reference (in…
-
3
votes2
answers4867
viewsA: Loop in pl/sql oracle
I understand you want to wear one cursor. In PL/SQL you can do using FOR. Suppose you have a table with the Code and Name fields, an example would look like this: FOR i IN (SELECT Codigo, Nome FROM…