Posts by Tobias Mesquita • 22,900 points
750 posts
-
5
votes1
answer280
viewsQ: What’s the difference between this, Event.target and Event.currentTarget in the scope of an event?
What’s the difference between this, Event.target and Event.currentTarget in the scope of an event? var elem = document.getElementById("meuId"); elem.addEventListener("click", function (event) {…
-
1
votes1
answer479
viewsA: How to open the Razorpdf report in a separate tab
The problem in question has nothing to do with geração-de-pdf, asp.net-mvc or with the RazorPDF. what you need is to open a link in another tab, for such you can set the targetof his tag <a />…
-
1
votes1
answer1742
viewsA: Automatic image upload without refresh
first step, to send a file via ajax, you need to disable the default behavior of jQuery (application/x-www-form-urlencoded) and use the web standard (multipart/form-data). $.ajax({ url: form.action,…
-
2
votes2
answers347
viewsA: Local Storage - Always replaces last data
Wagner, I know your case is much simpler, but if you need to, you can use the Storage.js, it serves as an abstraction for various storage technologies, such as the IndexedDB, WebSQL and Storage…
-
2
votes3
answers1525
viewsA: How to create HTML elements with Javascript?
Wagner, create elements following some template, I advise you to use the tag . in the example below I will clone a div.bloco and update its contents. var tmplBloco =…
-
5
votes2
answers1002
viewsA: Return Enum C#
you will have to take the attribute XmlEnumAttribute of your enumerator, then read the property Name. using System; using System.Linq; using System.Xml.Serialization; public enum…
-
4
votes1
answer2826
viewsA: How to update a DIV with Ajax/JS?
Rodrigo, to update a page by AJAX, you will first need a URL that serves you the partial content that will feed your div. for the purpose of this example, I will use the tag <template> and the…
-
1
votes1
answer661
viewsA: Change variable value js by clicking button and clicking again return to initial value
honestly, I don’t see much logic in your code, but you can reach your goal using a ternary operator. $size = 50; <label for="post-1" class="read-more-trigger" onclick="$size = $size == 50 ? 500 :…
-
1
votes1
answer58
viewsA: Is it possible to create a Chord Diagram chart using the D3 library?
I took as an example the Uber Rides by Neighborhood which is available on the d3.js. the first step, would convert your source to the format used in the example.: var data = {"links": [ { "id":…
-
1
votes3
answers121
viewsA: Associate input values to the nearest plan with jquery
You need to find the value within the array that approaches the one entered in the slider, you can do this by using the reduce. var planos = [50000, 70000, 100000, 120000, 150000, 200000, 220000,…
-
1
votes4
answers175
viewsA: Comment element ID attribute
Follow an implementation with some controls to ensure the integrity of properties. var AttrManager = function (element) { this.attr = {}; this.element = element; } AttrManager.prototype.toggle =…
-
6
votes2
answers1648
viewsA: Javascript - How to input back to normal state after validation
Follow a somewhat more generic implementation, including you can include other validation rules such as minimum, maximum, etc. var InputValidation = function (input) { var that = this; this.input =…
javascriptanswered Tobias Mesquita 22,900 -
3
votes2
answers530
viewsA: How to take the src attribute from a list of images and create an array using javascript only?
you can use a querySelectorAll to select all images, then a map to mount the array. //selecionar todos os elementos <img /> dentro de uma <div /> com à classe ".slider" var elements =…
-
2
votes3
answers205
viewsA: Doubt exercise paper stone and scissors
Acetyl, you can use computerChoice > 0.33 && computerChoice <= 0.67 var userChoice = prompt("Você escolhe pedra, papel ou tesoura?"); var computerChoice = Math.random(); console.log…
javascriptanswered Tobias Mesquita 22,900 -
7
votes4
answers23354
viewsA: Display text to mouse positioning over word or image
as you did not specify Java in your question, so I believe you need a solution with CSS only. Here is a possibility. To test pass the mouse over the bold snippet. [data-tooltip] { position:…
-
0
votes2
answers303
viewsA: Update elements inside a for using jquery
Ciro, I see that you have a table with inputs for unitary value, quantity and total value. The first problem I see is the repetition of ids in the elements. as the ids should be unique, consider…
-
1
votes1
answer2205
viewsA: Select using Join with Distinct
Initially I thought to answer this question using a Subquery, but seeing that Firebird supports Common Table Expressions (Mysql... I’m looking for you) WITH CTE_Movimento AS ( SELECT dt_producao,…
-
11
votes5
answers14934
viewsA: Sort Datatable Datetime Field
First of all, I’d like to give you a piece of advice so that you have a better chance of getting an answer, assemble a small one Code Snippet which reproduces the error. In your case, you are…
-
2
votes1
answer920
viewsA: SUM and GROUP BY doubling values
Although I’m not familiar with the structure of your bank, I can offer you a quick solution to your case. I see that in your first consultation, you have the following group by.: GROUP BY…
-
1
votes2
answers45
viewsA: Save user values to C#files
although by default there are some classes on the namespace System.Configuration, these classes are not within the System.Configuration, but of System. To use the ConfigurationManager you need to…
-
0
votes1
answer699
viewsA: Expand listing by clicking
you can put all elements with a class in common, add a class with display: none is all elements, and every click of the button load you remove this class of 10 elements. var quantidade = 10; var…
-
3
votes2
answers314
viewsA: generating an array of [month/year] p/ send to an ajax
Leandro, to go through a json, just do so.: var data = { CURSO: "", SITUACAO: "", TOTAL_FINANCIAMENTO: "", SEMESTRES_FINANCIADOS: "", VALOR_FINANCIADO_SEM: "", DATA_REPASSE: "", '01/2010': 0.00,…
-
0
votes1
answer376
viewsA: Convert JSON to GSON object
when you have a json with the following structure: `{ "Opa": {} }` you are reporting that you own a objeto who owns a propriedade calling for Opa, and this propriedade stores another objeto. so its…
-
1
votes2
answers925
viewsA: How do I make a countdown chronometer to a date?
You can use some blibioteca of Countdown, below follows an implementation used the blibioteca developed by Hugo Giraudel Countdown.js new Countdown({ selector: '#countdown', msgAfter: "O Evento…
javascriptanswered Tobias Mesquita 22,900 -
1
votes1
answer90
viewsA: Annotation to create Index Unique that accepts null with EF Code First
Ricardo, unfortunately I do not think it is possible, but through Migrations it is possible to create an outline solution. after using the commands -EnableMigration and add-migration %Migration…
entity-framework-6answered Tobias Mesquita 22,900 -
1
votes1
answer315
viewsA: Selected html filter single fields
Understand that the following script only treats the symptom, the problem will still continue, ideally perform the filter in your query populating select. var values = []; var select =…
-
3
votes2
answers3336
viewsA: How to drag an element freely on the page with pure javascript?
follows a response based on a response from Sergio (but without the use of Libraries and Frameworks (a.k.a jQuery). var Draggable = function (elemento) { var that = this; this.elemento = elemento;…
javascriptanswered Tobias Mesquita 22,900 -
3
votes2
answers1390
viewsA: Automatic name generator
Pekita, first point .OrderBy(i => Guid.NewGuid()) is an interrelative technique when we want to make a Randomize in the array, as in the extension below.: public static IEnumerable<T>…
c#answered Tobias Mesquita 22,900 -
1
votes1
answer2646
viewsA: Consume REST windows Forms
Follow an example using the System.Net.Http.Httpclient: static void Main(string[] args) { ServicePointManager.ServerCertificateValidationCallback += (sender, cert, chain, sslPolicyErrors) =>…
-
5
votes4
answers31463
viewsA: Onclick calling two functions at the same time Javascript
so inline or setting the onclick no, but it is possible to add a EventListener at the DOM. var clickMe = document.getElementById("clickMe"); var funcaoA = function functionA(event) {…
-
2
votes2
answers1694
viewsA: Place an icone with css in a div
If the question is just the arrow, I made some changes to its positioning, as well as the edge. $(document).ready(function () { $('.masterTooltip').hover(function () { var title =…
cssanswered Tobias Mesquita 22,900 -
2
votes3
answers2621
viewsA: How can I display any Javascript object as a string?
To print an Object, you can serialize it first using the JSON.strigify, but this can become a headache if you have some circular reference in your object. And since there is no normalization of how…
-
1
votes1
answer1592
viewsA: e-mail sending with bootstrap
Unless we’re talking about a Backend written in NodeJS, cannot send a E-mail using only JavaScript. If you don’t have a Backend for your page, perhaps the simplest solution is to use some API…
-
3
votes1
answer1470
viewsA: How to get value from a variable in the controller with ajax(jquery)
First of all, I advise that the only script inline in the file .cshtml is the declaration of variables from Controller, as the way the caminho virtual, Nome do Usuario, etc.. <script…
-
0
votes3
answers129
viewsA: Javascript start code from a certain line
you can use a substring to remove the initial text, after this just do a parse in the document. var data = document.querySelector("template").innerHTML; var blob = new Blob([data], { type:…
-
1
votes2
answers471
viewsA: How to create a mobile menu button with this effect? (preferably without js)
follows an off-canvas implementation using as little Javascript as possible. var wrapper = document.querySelector(".outer-wrapper"); var icon = document.querySelector(".icon");…
-
0
votes4
answers5322
viewsA: Send Javascript array via Ajax with jQuery for PHP file
I believe that for this type of scenario a POST be more appropriate, in this case try to do the following.: var data = { nome_receita: nome_receita, ingredientes: ingredientes }; var httpRequest =…
javascriptanswered Tobias Mesquita 22,900 -
1
votes2
answers565
viewsA: Doubt with using jquery.maskMoney with Asp.net mvc
your selector is wrong: $("#VALORAPOSTA1").maskMoney();
-
0
votes1
answer31
viewsA: Javascript does not recognize Dropdownlist
unfortunately this onchange calls the method in server-side, if you want to do the bind of the event change in the JavaScript, will need to do this in the Code-Behind or directly on JavaScript.…
javascriptanswered Tobias Mesquita 22,900 -
7
votes3
answers1842
viewsA: same div with different colors
for the chess effect, you should do as follows.: .container { width: 560px; } .container div { float: left; width: 50%; height: 40px; } .container div:nth-child(4n - 3), .container div:nth-child(4n)…
-
8
votes1
answer4187
viewsA: How to implement Automapper 5.0.2
Renan, at this point little thing has changed, but now you need to store your Mapper in a static variable. public class AutoMapperConfig { public static IMapper Mapper { get; private set; } public…
-
5
votes2
answers1370
viewsA: Remove onclick attribute by Javascript
rhundler, first I advise you to read the following article.: Why Inline CSS And JavaScript Code Is Such A Bad Thing now let’s go to an example without jQuery to complement Miguel’s response. var…
-
0
votes1
answer61
viewsA: TFS Cloud Visual Studio 2015 Community
Get Latest Version (Recursive) It will update all your project files to the latest version. Check Out for Edit This will inform TFS that you are working on this file, this can generate a "Lock" in…
-
7
votes2
answers358
viewsA: Keep variable in memory until system reboot
Marcus, as Maniero pointed out, you can’t keep a variable in memory, but you can save a flag stating that the system needs to be restarted, perhaps the easiest solution is to change the app.config.…
-
5
votes2
answers842
viewsA: Using Array.Foreach to modify the collection
Daniel complementing Maniero’s response, the Eric Lippert in 2009 he wrote a good article in his blog, in it it explains the evils of using the List<T>.ForEach in place of foreach. You can…
-
6
votes1
answer224
viewsA: JOIN by LINQ in C#
you can do it this way.: OUTER JOIN var set1 = new HashSet<Entity1>(); var set2 = new HashSet<Entity2>(); var query = from entity1 in set1 join entity2 in set2 on entity1.Codigo equals…
-
1
votes1
answer192
viewsA: Parallel Processing Routine C#
You can make an asynchronous call on Eventhandler.: Transceiver.ReceiveLine += new Transceiver.ReceiveLineEventHandler(ProcessReceived); public string address = ""; async void ProcessReceived(string…
-
8
votes2
answers4795
viewsA: How to subtract hours from a javascript date?
make a combination of setHours with getHours. Date.prototype.addHours = function (value) { this.setHours(this.getHours() + value); } var data = new Date(); console.log(data); data.addHours(-30);…
javascriptanswered Tobias Mesquita 22,900 -
1
votes1
answer244
viewsA: Generate Form by Clicking the Button
I see you are trying to create a component type for your page, so I will try to give you some tips that might help you achieve your goal. 1 - Use the template tag Put all the markup initial…
-
1
votes1
answer114
viewsA: Position div across the screen
if you define a height: 100% to the html and body, you can define a height: 100% for your div.home-entrada without having to define a position: absolute. html, body { position: relative; width:…
cssanswered Tobias Mesquita 22,900