Posts by Ricardo Pontual • 21,129 points
751 posts
-
1
votes2
answers438
viewsA: Return the previous page after logging in
You can use a very simple logic: save the current user location, with window.location.pathname by exmeplo, and in the Promise redirects to that page: // se o caminho for a raiz "/", definir como…
-
1
votes1
answer471
viewsA: req.body nãp works on Express
The problem is you’re sending an object JSON with Plain text, need to change this option on Postman: That will solve…
-
1
votes3
answers89
viewsA: problem with select case
You can also make a subquery to calculate each status per driver, thus: select (select count(cor.uid) from corridas cor where cor.idMotorista = mot.idMotorista and cor.status = 35) as finalizadas,…
-
0
votes1
answer50
viewsA: Calculate items from a table
You added the "change" event with this line: $('.pacientes-table-plugin').on('change', function(){ It turns out that this class is being used in the table, and a table has no event change, the…
-
3
votes3
answers7823
viewsA: What is the semantic difference between Section and article?
Both serve to mark code blocks, to simply separate things, or to use a differentiated formatting. Before the HTML5, there was only the tag div with this more generic purpose of separating things, so…
-
4
votes3
answers3006
viewsA: Search directory name of a file. bat
You can use %cd%, this will return the current path where the batch is running. Can test with echo %cd%
-
0
votes2
answers55
viewsA: Input appear with two numbers after the comma
Do it like this: ValorTotalPedido = float.Parse(pedidoFornecedor.ValorTotalPedido.ToString("0.00##")) Here a fiddle running: https://dotnetfiddle.net/RoVORC…
asp.net-mvcanswered Ricardo Pontual 21,129 -
4
votes3
answers3810
viewsA: What is the difference between a View and a Stored Procedure in SQL?
One view is treated "as if it were" a table by the database. Basically is a select save to bank. Used to save a view (select) at the bank. Already stored procedure as the name says, it is a sequence…
-
3
votes2
answers64
viewsA: How to access a jquery without id?
It may be so: $('*[data-uid="_b03bc8304532"]'); Selects all elements with this data-uid. I switched to a span to demonstrate: $('*[data-uid="_b03bc8304532"]').html('texto alterado'); <script…
-
1
votes1
answer213
viewsA: Multiple calls to modal bootstrap
You need to identify the events associated with the button that are triggering the event that opens the modal. There are several ways to do this, the simplest is by using your browser’s developer…
-
2
votes3
answers2944
viewsA: While use within the if
First, to read infinite notes, you have to read the average value inside the while. Second, test the value if it is greater than 10 and give a message. Take advantage and think about how to validate…
-
1
votes2
answers184
viewsA: How to automatically name a manually created CONSTRAINT in Sqlserver 2016
Not if you want to use the command create index, the name is mandatory: Docs.microsoft.com What happens as you already know is that when you use create table or alter table and create constraints or…
-
14
votes3
answers5657
viewsA: What is the LOCK TABLES command for?
How does LOCK TABLES work? I would like some examples. Simply explicitly lock the table, locking only for the session that executed the command. Mysql documentation:…
mysqlanswered Ricardo Pontual 21,129 -
5
votes1
answer365
viewsA: Read Streamreader First Line or skip how to fix?
A solution for this line, and perhaps for others who may have invalid content, and check the conversion, for example using TryParse If the return is true because it managed to convert, otherwise you…
c#answered Ricardo Pontual 21,129 -
1
votes2
answers676
viewsA: Delete last entered digit
You can use the function slice: var str=document.getElementById("campo-com-o-valor").value; str = str.slice(0, -1);
-
1
votes1
answer146
viewsA: Edit the text of a div and her children by clicking
You can add to the div contentEditable="true"to make the widget editable: Developer.mozilla.org Since you only want this from the double click, you can do this using an event:…
-
3
votes1
answer507
viewsA: How to create a View with filter?
One view does not accept parameters as a function or stored procedure, then you can’t change the where dynamically. You can filter the result of a view from a select if this is no problem (many…
sql-serveranswered Ricardo Pontual 21,129 -
3
votes2
answers64
viewsA: Is expression-bodied recommended? Is there a performance difference?
How the goal is to replace the classic structures ({ .. } for example) and make the code more readable and concise, there is no reason not to use. Your specific example will compile in the same way…
-
0
votes3
answers529
viewsA: Difference between dates in months with decimal return
To have the difference in decimals, you need to calculate in hours, and convert later: multiply by 24 to know in days and by 30 later to know in months: select…
-
1
votes1
answer22
viewsA: Where based on the value of a variable
With the conditional function IIF() you can test a value and compare the field with the variable or itself, which in practice ignores the condition: DECLARE @var AS INT = 10; SELECT * FROM TB_SQL…
sql-serveranswered Ricardo Pontual 21,129 -
1
votes1
answer924
viewsA: Password Encryption Question - SQL Server
Encrypting the password in the bank is perfect, but note that you are using direct encryption on INSERT, This means that you should use the same when doing SELECT to compare the password. The ideal…
-
6
votes1
answer214
viewsA: How do I make the onclick event work on a button where Parent already has an onlick?
Add Event.stopPropagation the code to prevent other events from happening and prevent the flow of events: <div onclick="alert('div pai')"> <p>div pai</p> <button…
-
3
votes4
answers1185
viewsA: Change only the day of registration
You can use the function DATEFROMPARTS, to change only the day: UPDATE tabela SET datainclusao = datefromparts(year(datainclusao), month(datainclusao), 1) Here, I took the same year and month of the…
-
1
votes2
answers43
viewsA: getVersionNumber() returns me Undefined on Ionic
Are you trying to show a value that has not yet returned on promise, need to put the alert in the right place: this.appVersion.getVersionNumber().then(version => { versaoApp = version;…
-
5
votes3
answers48
viewsA: Object for a javascript array
To use the forEach, your object needs to be an array [], as it is an object of objects, you can use the Object.() for that reason: let sel = { "1": { "id_turma": 485, "codigo_turma": "1112A - 41",…
javascriptanswered Ricardo Pontual 21,129 -
1
votes2
answers152
viewsA: Hide div when you click it
If you have entered your complete code, you are missing close the click assignment, missing one ); in the end. I believe that’s because I put your code in a fiddle and it worked, and here in the…
-
17
votes1
answer222
viewsA: Can displaying many elements in the DOM impair performance?
Having many elements in the DOM could harm performance? Yes, and let’s look at two aspects: memory - the more elements the DOM has, obviously more memory will consume, below I put two images to…
-
3
votes1
answer110
viewsA: Is it possible to make a Picker color with canvas?
There are several even, some interesting: codepen.io seesparkbox.com github What I found downloaded was to generate the color palette (code piece of the codepen link): // esse elemento é um canvas…
-
0
votes3
answers51
viewsA: I can’t get average
If you want the total sum, divided by count partial (grouped), you can use a subquery (see if performace looks good): select top 10 cod_pessoa as CodPessoa, dat_compra as DataCompra, vlr_compra as…
-
3
votes2
answers222
viewsA: Bold "<b>" does not apply in a range
"Why does this happen?" Because an element TD must be followed by an element TR, there is no room for elements between them. "The only way would be to manually place in each cell, or by CSS?" Yes,…
htmlanswered Ricardo Pontual 21,129 -
1
votes2
answers860
viewsA: Open select open value with javascript
Unfortunately there is no solution javascript "correct" to do this. The reason is that there is no definition of an event that provides this for the element select defined in W3.org:…
-
1
votes1
answer147
viewsA: Dynamic mounted Angular 5 track
I already had this problem in a project and we solved using a ! before the bar on routes, for example: <a href="#!/cliente/novo"> The ! tells the Angular which is a client-side route, a link…
-
5
votes2
answers1861
viewsA: How to consult birthday and month in SQL on Oracle?
In the Oracle you can use the EXTRACT: SELECT nome FROM aluno WHERE extract(month from datanascimento) = extract(month from sysdate) Here a working example: sqlfiddle.com…
-
1
votes3
answers169
viewsA: How to know if Modal has active scrolling?
You should inspect the element with the "modal-body class". To know if you have scroll, check if scroll property is larger than the client, for width or height, like this: var scrollHorizontal =…
-
0
votes4
answers1737
viewsA: How to use "wildcard" in "CLASS" selectors with jQuery.expr?
As already replied, the jQuery uses the selectors you mentioned: ^= Starts with (start with); $= ends with (end with); *= contains (contains); Natively these are, but there are extensions that allow…
jqueryanswered Ricardo Pontual 21,129 -
5
votes3
answers1082
viewsA: How to style "broken image" (when image does not load)
Solution-based bitsofcode: https://bitsofco.de/styling-broken-images/ img { font-family: 'Helvetica'; font-weight: 300; line-height: 2; text-align: center; width: 100%; height: auto; display: block;…
-
2
votes1
answer1153
viewsA: Oracle SQL Query - Subtract Hours
You can use interval to do this, be it so: select R.RUNSTARTTIMESTAMP - numtodsinterval(3,'hour') from DSODB.JobRun R or so: select R.RUNSTARTTIMESTAMP - interval '3' hour from DSODB.JobRun R See…
-
0
votes2
answers165
viewsA: Search full month ORACLE
In that case you could use in the WHERE to: 1. Compare current month - 1 to date month 2. Compare the current year with the year of the date This is easy using the function EXTRACT: The problem is…
-
0
votes3
answers2026
viewsA: How to change the color of the form button with javascript?
Can only use css for this, with the pseudo-class :disabled: button:disabled { background-color: cyan } <p> <button> Sou um botão sem disabled </button> </p> <p>…
javascriptanswered Ricardo Pontual 21,129 -
3
votes1
answer1842
viewsA: Insert quote text in mysql database
The command should look like this (using single folded quotes): insert into medicacaohistorico (data, unidadeori, unidadedes, itemdetalhe, qtd, solicitante, despachante) values ('18-08-08', '5',…
-
1
votes1
answer67
viewsA: Jquery - use "focusIn" as trigger to add a class
Selects the div by another criterion, an ID for example, and removes one class adds it to another, avoiding conflict, because if you remove the "Hide" class, how does it work if your event is in the…
-
8
votes3
answers4418
viewsA: Error in a simple SELECT with Group By - SQL Server
SQL is saying that the column Stockphotos.Pack.Name should: Being computed with an aggregation function, for example SUM or COUNT, or It must be part of the grouping, that is, it must be in the…
-
1
votes3
answers49
viewsA: Resume counting if you exceed options
If you don’t want the colors exactly in that order, you can generate a random value between 1 and 8: $(function(){ $("#adicionar").on("click",function(e){ var num = Math.floor((Math.random() * 8) +…
-
2
votes1
answer215
viewsA: (Localdb) Error after Update-Database command -> "Cannot attach the file ...."
The problem is in your connection string. This part: attachdbfilename=|DataDirectory|\TesteDB.mdf tell the bank that he must Set the file "Testedb.mdf" that is in "Datadirectory". If the bank…
-
2
votes3
answers1365
viewsA: Creating html elements in javascript looping
There are improvements that can be made to your code, but to answer your questions about the loop and how to do the counter, I will keep the code as is and add comments to explain:…
-
2
votes3
answers2323
viewsA: How to do with CSS a checkered checkerboard background for Body?
Taking your idea and adapting with some tips from the internet, I arrived at this result: body { background-image: -moz-linear-gradient(45deg, #000 25%, transparent 25%,transparent 75%, #000 75%,…
-
1
votes2
answers37
viewsA: hasFocus() verification in <a> tag
hasFocus() is an object method document: Developer.mozilla.org/Document/hasFocus To check in javascript if an element has Focus, compare with the element in document.activeElement, which returns the…
-
0
votes2
answers23
viewsA: Changing the Button Source
It turns out that inside the button, the Html.ActionLink is rendered with a link tag <a>, then you need to style this tag. See below for an example: .button { background-color: #294a73;…
-
3
votes2
answers543
viewsA: HTML Drag and Drop on mobile (touchscreen screens)
I already had this problem and ended up using this solution: http://bernardo-castilho.github.io/DragDropTouch/ Bernardo Castilho’s script overwrites the events and makes them compatible with touch,…
htmlanswered Ricardo Pontual 21,129 -
3
votes4
answers271
viewsA: Javascript equivalent of "Date.now()" in C#?
If you want a value similar to javascript can calculate the difference between the current date/time and 01/01/1970: var d = Math.Floor((DateTime.Now.ToUniversalTime()- new…