Posts by Ricardo Pontual • 21,129 points
751 posts
-
4
votes1
answer6778
viewsA: The INSERT statement conflicted with the FOREIGN KEY C#
Well, the mistake says you’re violating the constraint of the foreign key by entering a value that does not exist in the reference table. In other words, the value that is passing to the column Code…
-
0
votes2
answers306
viewsA: Organize a json and write the results
You turn json into an object and can use for to read each object. Something more or less like this (assuming everything, COD, DESCRIPTION, STOCK and QUANT_UNID have the same number of elements):…
phpanswered Ricardo Pontual 21,129 -
0
votes1
answer667
viewsA: Assign a cursor value to a table column
Only fetch variable loaded with value in insert and do the fetch again inside the loop while: while @@fetch_status = 0 begin -- aqui, verificar se o insert está correto usando @id_exm_rea insert…
-
5
votes5
answers2915
viewsA: What is actually the array?
Interesting thing about it. First, let’s think about array in its essence. We know that a variable is a name, a tag that points to a memory location that stores a value. Studying the language C,…
-
0
votes4
answers196
viewsA: Similar function to indexof() in Javascript
Can also be done using array.some (more information here: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/some) The method some will go through all the items…
javascriptanswered Ricardo Pontual 21,129 -
1
votes1
answer9363
viewsA: Run function that returns multiple values and based on these make the main SELECT - SQL Server
Here, an example using Table-Value return. CREATE FUNCTION dbo.FiltraNomeColunas(@FiltroColuna VARCHAR(200)) RETURNS @nomes TABLE ( Nome VARCHAR(200) ) AS BEGIN INSERT INTO @nomes SELECT c.name as…
-
1
votes2
answers8816
viewsA: Leaving the input in focus after javascript valid?
I’ve had this problem in some specific sailing, and another one worked. I decided to add one timeout, and then set the focus in the field, so: window.setTimeout(function () {…
-
1
votes1
answer302
viewsA: Close element when clicking any other part of page
This could be done easily with Tooltip jQuery, but how are you doing in Javascript pure, you will have to capture the event document click. Then check if you clicked on any element outside your…
-
1
votes1
answer73
viewsA: Error while receiving variable JSON
By answering your question, by parsing you can have an array of objects: var jsonTitles = jQuery.parseJSON(latGas); To sort, just use the method sort of the object array: // Ordem crescente…
-
4
votes2
answers1333
viewsA: Set default value SQL Server column
You can create a constraint to validate the field domain: ALTER TABLE [dbo].[XPTO] WITH CHECK ADD CONSTRAINT [CK_ATIVO] CHECK (( [ATIVO]='S' OR [ATIVO]='N')) GO ALTER TABLE [dbo].[XPTO] CHECK…
-
4
votes8
answers44013
viewsA: How to remove auto complete input from google Chrome?
Another solution I found was to disable the field, which makes the autocomplete not work in any browser (I tested it in Chrome, FF and IE). Then just enable the field when the form is loaded,…
-
0
votes1
answer194
viewsA: Jquery run a shortcut
That code does it: var press = jQuery.Event("keypress"); press.which = 78; // tecla n press.shiftKey = true; // shift pressionado press.altKey = true; // alt pressionado…
jqueryanswered Ricardo Pontual 21,129 -
6
votes2
answers2918
viewsA: Entity Framework WITH (NOLOCK)
You can’t exactly use the WITH (NOLOCK) in a query generated in Entity Framework, but you can change the ISOLATION LEVEL, which in practice offers the same result. The difference is that NOLOCK is…
-
2
votes3
answers796
viewsA: Error calling 2 javascript functions at the same time
You can add more than one Function to the same event, and it will run once in the case of onload, but will perform all functions in the order you add using addEventListener. Documentation here:…
javascriptanswered Ricardo Pontual 21,129 -
1
votes3
answers419
viewsA: Hide mandatory and non-compulsory field
If you are using client validation in javascript, you can add the attribute data-val-required and remove it when you don’t want the field to be mandatory, something like that: // Obrigatório…
-
1
votes2
answers394
viewsA: Compare a null bit column
I had already seen some things about this, there is even a very interesting post in the English OS: https://stackoverflow.com/questions/3118213/isnull-vs-is-null But in the link example, you are…
sql-serveranswered Ricardo Pontual 21,129 -
3
votes1
answer494
viewsA: Pass value of equal properties, different classes
You can’t match objects of different types directly like this, unless they implement the same interface. One suggestion is to do by Reflexion, or still use a mapper, such as Automapper:…
-
5
votes1
answer1657
viewsA: Entity Framework - What is the difference between With Entitystate.Modified and Without Entitystate.Modified?
The State informs the Entity Framework the state of its object. In its first example, it is not necessary to set the State: Entity Framework itself will do it for you. But in case you are…
-
2
votes2
answers643
viewsA: Disable button during javascript processing c#
Remove client event from button (OnClientClick) And use this line when loading the page: window.onbeforeunload = btnOk_OnClick;
-
1
votes1
answer58
viewsA: What is the difference between Httprequestcontext and Httprequest? And how to convert Httprequestcontext to Httprequest?
As far as I know, HttpRequestContext is an object that is "inside" the HttpRequest. The HttpRequest (System.Web.HttpRequest) returns the current request, where we can read the QueryString for…
asp.netanswered Ricardo Pontual 21,129 -
5
votes2
answers959
viewsA: Instantiate an object through the interface and access methods not present in it
An interface is a contract, where both parties, the class it implements and the class it uses, know the "rules" of the contract. What is the point of creating a "rule" that is not in the contract,…
-
1
votes2
answers297
viewsA: How to list array values (Angularjs) using PHP?
If you want to pass an array, you should use the model items and not user: $http({ method : 'POST', url : 'clone.php', data : $scope.items }) Then just read the array in PHP: $post =…
-
2
votes2
answers4550
viewsA: Conversion from VARCHAR to SMALLDATETIME
Your problem must be in date format, which is probably different from the database. The command CONVERT(varchar(10), GETDATE(), 103) returns the date in dd/mm/yyyy format, because of the "103"…
sql-serveranswered Ricardo Pontual 21,129 -
1
votes1
answer94
viewsA: apply css property directly by javascript and a good practice?
Apply properties such as background-color not a good practice, it gets bad to track and understand the styles you are using, now if you apply classes, then it is much better. This is also well…
-
6
votes5
answers5742
viewsA: Is it possible to develop websites with C/C++?
As @Maniero commented, possible is, but almost nobody does. This is simple to understand: C/C++ does not have this focus of being a language for Web. It would be like trying to develop a website…
-
1
votes1
answer47
viewsA: Cordova com Angularjs
Your question doesn’t explain exactly what you want to do when opening the native email client, but if it is to compose a message, just use the mailto on the link: <a…
-
4
votes1
answer3888
viewsA: How to send Images via AJAX to php
You need to create an object FormData with input the image you want to upload: var fd = new FormData(); fd.append('file', $('#inputFile")); Then make the call ajax "POST" by passing the FormData as…
-
2
votes2
answers81
viewsA: Is it possible to make Postgresql database data visible or not, without erasing it?
Would have some possible solutions: Create a column to define whether the data is visible or not, then filter through that column. Create a table with the ids of the records that should or should…
-
4
votes4
answers94
viewsA: What’s wrong with this Javascript code?
If menuTabs is an array, you can access it without an index, as you are doing on that line: menuTabs.classList.add('tab-active'); The right thing would be: menuTabs[i].classList.add('tab-active');…
javascriptanswered Ricardo Pontual 21,129 -
0
votes3
answers222
viewsA: Check if there are equal fields in a form
It has a much simpler shape: $("select").change(function() { var id = $(this).attr('id'); var valor = $(this).val(); var selects = $('select').not('#' + id).find('option[value="' + valor +…
-
1
votes1
answer176
viewsA: Use a Focus for several fields.
Some remarks about your code: Using Document.ready in incorrect location: this will not run within your code block: if (erro.length > 0) { $(this).val(''); alert(erro); $(document).ready(function…
-
7
votes1
answer63
viewsA: Recover Value Array
What’s wrong is the split: var location = cord[i].split(","); split is a function, parentheses are used.
javascriptanswered Ricardo Pontual 21,129 -
2
votes1
answer772
viewsA: place table elements in a list
You can do it like this: TABLE: <table id="dataTable"> <tr> <th>Codigo</th> <th>Descricao</th> </tr> <tr> <td>1</td>…
-
1
votes1
answer496
viewsA: Sending form to Pagseguro
Only include external url in Html.BeginForm: @Html.BeginForm(null, null, FormMethod.Post, new {@action="https://sandbox.pagseguro.uol.com.br/checkout/checkout.jhtml"} ) { ... aqui vão os inputs e…
-
2
votes3
answers3450
viewsA: Preloader while the site loads
You need to put the heavy content of your page into a container, a div for example, and the image loading into another one, like this: <div id="carregando"></div> <div…
-
2
votes2
answers502
viewsA: Iframe from external site
You can access the iframe by id (best) or use $('iframe')[0]contents(), [0] is an index. If there is more than one iframe, you will need to set another value. To access an input per value do so:…
-
10
votes3
answers981
viewsA: What do the two dots in a row (.) mean in a file path?
Imagine you’re in a structure like this: / css estilo.css Images Logo.png Scripts ... That is, at the root of the project have the css folders, Images, Scripts, etc. If you want the.css style file…
-
1
votes1
answer1069
viewsA: Difference between "Extension Relationship" and "Extension Point"
The difference is what extent point defines a particular state, condition or prerequisite for the extension to happen. While the extension happens when a use case is completed, the extension point…
-
3
votes1
answer342
viewsA: bring html code from the bank
If the code coming from the bank is the same as the one you posted in the first image, you need to do Code and use Html.Raw of Razor, thus: <i> @Html.Raw(HttpUtility.HtmlDecode(Model.Botao));…
asp.net-mvcanswered Ricardo Pontual 21,129 -
1
votes1
answer652
viewsA: How to copy a value within a span
You can use the following to get the value of the slider: <!-- adicionei um id para simplificar o exemplo --> <div class="slider" id="slider" ...... >…
-
1
votes1
answer280
viewsA: What’s the difference between this, Event.target and Event.currentTarget in the scope of an event?
this is the very element that has the event associating, in your case, the element with "meuId". event.target is the element that triggered the event. Imagine that inside the element "meuId" there…
-
2
votes1
answer920
viewsA: Difference between hours without taking into account the date
A very simple way is like this: select CAST((C1.MAXBATIDA-C2.MINBATIDA) as time(0)) Horas Take this example: declare @d1 datetime, @d2 datetime set @d1='20161024 21:18:41.330' set @d2='20161024…
-
0
votes2
answers113
viewsA: How to create a class from another class? (Hierarchy)
Yes, you must declare so: function EstudanteMonitor() { } // Aqui vai a herança, você diz que o prototype de EstudanteMonitor é Estudante EstudanteMonitor.prototype = new Estudante(); var e= new…
javascriptanswered Ricardo Pontual 21,129 -
1
votes1
answer1244
viewsA: What are the advantages and disadvantages of publishing a web service on a server or as a Windows service?
An answer to that question may be quite long, but I will try to summarize a few points: Management "Web": If you create a Web service, be a Webservice, WCF, or an application that answers calls…
-
1
votes1
answer79
viewsA: Query with datiff returning 0 in sql server result
This must occur because DATEDIFF altarpiece INT, and may be making some rounding. Try to return in seconds and it will work, see the example: declare @d1 datetime, @d2 datetime set @d1='2016-10-19…
-
1
votes1
answer800
viewsA: Delete values from the html list of options
As you didn’t mention if you’re using jQuery or another library, I’ll put an example in pure javascript: First, apply the onchange event to all select: <select name="a1" id="a1"…
-
1
votes1
answer93
viewsA: Vary Script within Div
You can create the script tag dynamically and add to an element, a div for example: <div id="scriptQuiz"></div> Javascript: var link = "<a…
-
2
votes1
answer190
viewsA: Pick up Variable from one Config directly on in another Config
You can’t do that. The values in the configuration files are static, so that if you have a web application and edit Web.config, the application undergoes a Restart to "pick up" the new values,…
-
2
votes3
answers3159
viewsA: Add SOAP Header to SOAP C#
This implementation seems a little complicated. I have several services here that use values in Header, I’ll show you two solutions that can suit you: Assign values in Header directly in the…
-
1
votes1
answer121
viewsA: How to pass variables from C# MVC 4 to SASS SCSS?
You can even use Val to process javascript expressions, but you can’t create dynamic values like this in SASS. What you can do is create multiple style files and load them dynamically (or use…