Posts by Tobias Mesquita • 22,900 points
750 posts
-
5
votes2
answers403
viewsA: How to filter in LINQ for every X months?
Only with LINQ it is not possible, you can even do with T-SQL, either using LEAD/LAG, or using a CTE Recursive. But only with C#, you can create a Dictionary, then consult if in a given period of…
-
3
votes3
answers1139
viewsA: Organize alphabetically with indicative header, json
Although the above answers solve the problem well, I see a scenario that can bring problems... accents.: In this case, we could use the Intl.Collator to compare the strings, but we would still have…
-
5
votes2
answers1498
viewsA: Using Object or Iframe to import other sites to my site
unfortunately you will not be able to modify the style of the contents of an iframe that points to another domain, since you will not have access to document of the same. if the destination page…
-
7
votes1
answer86
viewsA: In what situations use each prototype type in HTML elements?
Samir, Element represents whatever element in the Document, be it text, html, svg, xml, etc. Htmlelement represents only HTML elements, for example a <div>, <input>, elements such as…
-
7
votes3
answers11523
viewsA: Putting two Yes and No buttons on a Javascript message
Unfortunately you cannot modify the options of a confirm, in this case you will need to use some script, such as jQUeryUI Dialog, Bootstrap Modal or Foundation Reveal. var msgExcluir =…
-
5
votes2
answers287
viewsA: Create product classes and photos and initialize
you need to start the collection before you can use it, so modify the constructor Produto. public class Produto { public Produto() { this.Fotos = new HashSet<Foto>(); } public int ProdutoId {…
-
1
votes3
answers221
viewsA: I wanted to know how to make each page refresh to . class be moved
There are some techniques to shuffle an array, my favorite makes use of Array.protorype.sort with Math.random(). Array.prototype.shuffle = function () { return this.sort(function () { return 0.5 -…
-
2
votes1
answer515
viewsA: Click Link Inside Clickable DIV
In this case the ideal is to add an event click to the img.add-cart, on it you call the event.stopPropagation(), thus the event click of div.item will not be executed. var tmplItem =…
-
1
votes2
answers263
viewsA: How to prevent my site from being rendered in an iframe
add the following header to your page: X-Frame-Options: DENY you can also use the SAMEORIGIN instead of DENY…
iframeanswered Tobias Mesquita 22,900 -
1
votes2
answers368
viewsA: Fill in inputs from an iframe
Fernanda, unfortunately you will fall under the security policy of browsers, this will not allow you to modify a document in a different domain or access it using AJAX. For you to get around it,…
-
2
votes1
answer56
viewsA: Jquery if element (':Visible')
missed the last ) in the if if($('.classe1').is(':visible')... $(document).ready(function($) { if($('.classe1').is(':visible')) { $('.classe2').hide(); } });…
-
2
votes1
answer880
viewsA: Database for the Poll
Alberto, although two questions have exactly the same text and from the point of view of the user they are the same, at the level of database they do not need to be the same question. Follow the…
-
1
votes2
answers5893
viewsA: Image Transition with css3 - Keyframes
in case, you need to work with animation and not with transition... another point is that you need to use the prefix in the animation-delay. In his keyframes, you have to distribute the time between…
-
2
votes1
answer309
viewsA: jquery ui dialog does not expect confirmation
Marconcilio, you need to cancel the default click behavior, either with a return false or a event.preventDefault, this way postBack will not be executed. Then in the Sim of dialog you can do…
-
2
votes2
answers1914
viewsA: Enable and disable function in jquery
you can use the addEventListener to activate the event and the removeEventListener to remove the event. follows an example with the event mousemove. var x = document.getElementById("x"); var y =…
-
5
votes1
answer110
viewsA: Deserialize Json List
in this case, you will need a class with the same structure as your JSON, for example: public class Discografia { public Artist[] data { get; set; } public int total { get; set; } public string next…
-
1
votes4
answers82
viewsA: Doubt with height in a DIV
I’ll use position: absolute for such; html, body, main, header, footer, section, div { box-sizing: border-box; } html, body, main { position: relative; width: 100%; height: 100%; padding: 0px;…
-
2
votes1
answer478
viewsA: Session issues in MVC application using Actionfilters
Rodrigo, I believe the problem lies in the way your hosting service balances the requests, possibly you are being taken to different servers at each request. How you must be wearing one In-process…
-
6
votes3
answers1293
viewsA: Problem to remove element added with jQuery
you are adding the event click to input.apagar before creating the same. then put the evento to all the input.apagar pertaining to #content using the method $.on. Another detail, the $.parents will…
jqueryanswered Tobias Mesquita 22,900 -
1
votes2
answers417
viewsA: Click elements below a div?
Your div.noturno has virtually the same CSS as the fade div modal of jQueryUI, and its intention is precisely to prevent the interaction of the user with the other elements of the page. In this…
-
3
votes1
answer68
viewsA: Complex type can have Entity Type property?
Renan, now I understand your problem. Unfortunately it is not possible to reference a Entidades in Tipos Complexos. So to maintain this structure, you have to transform Endereco in a Entidade,…
-
3
votes3
answers49197
viewsA: How to use the output of a select to mount another?
Although Ricardo’s response works, this approach can make consultation confusing. for example, let’s imagine the following hypothetical query: SELECT c.id c.descricao d.descricao as alt, FROM…
-
1
votes4
answers144
viewsA: Problems initializing a type within a LINQ query
I see that your Entity and your DTO have the same properties with compatible types and the same name. In this case, you can try using the Automapper to do the mapping for you. below follows an…
-
1
votes4
answers1102
viewsA: Catch Divs with certain class
I really don’t understand your problem, whether he’s manipulating a div so that it behaves like a checkbox, or identifying the state of the div/checkbox. As for customizing the div, I advise you to…
-
0
votes2
answers246
viewsA: How to add cloned events, right after cloning
Matthew, I know the code below won’t solve your problem, but it might help you organize the code. In this case, I have a class that closes the Line, so I can access its properties directly, as well…
javascriptanswered Tobias Mesquita 22,900 -
1
votes1
answer382
viewsA: Create popup DOM
akm, if you really need to open a new window, I believe it is best to create a document in memory with the desired HTML: var tmplPopUp = document.getElementById("tmplPopUp"); var abrirPopUp =…
javascriptanswered Tobias Mesquita 22,900 -
1
votes4
answers1917
viewsA: Home Time in SQL (Years, months and days)
Paul, this function may have problems with leap years, try to do the following: DECLARE @DTINI DATE, @DTFIM DATE, @ANO INT, @MES INT, @DIA INT SET @DTINI = '2015-01-01' SET @DTFIM = '2016-12-31' SET…
-
7
votes3
answers38959
viewsA: How to position text within an image
First you must put both elements detritus from a div or figure with position: relative and display: inline-block;, then you can put a position: absolute; in the label or figcaption and position it…
-
0
votes1
answer628
viewsA: How to check a login form without giving refresh?
Daniel, as wide as your question is, you can perform an AJAX request: var logon = document.getElementById("logon"); var email = document.getElementById("email"); var password =…
-
2
votes3
answers4496
viewsA: onchange Select does not work - jQuery
your script cidadesEstados.js is setting the event .onchange() in the following passage: this.estado.onchange=function(){this.dgCidadesEstados.run()}; with this what you defined in HTML is…
jqueryanswered Tobias Mesquita 22,900 -
1
votes5
answers150
viewsA: Doubt with image positioning
if you want an object to stay always in the center of the screen, regardless of other elements, then you must use position: fixed, anchor it at the ends of the screen, use a fixed size and margem:…
-
1
votes1
answer337
viewsQ: wkHtmlToPdf - Header and footer on all pages
I’m trying to generate a "report" using Rotary, but I’m having difficulty to repeat the header and footer on all pages: This is the outline of what I’ve done: Controller using System; using…
-
3
votes3
answers17714
viewsA: Disable Submit button to make no multiple calls to the server
The HTML page will not send the form if the the input[type="submit"] is disabled. Like the event click of input[type="submit"] occurs before the submit of form, then you are to indirectly abort the…
-
3
votes4
answers877
viewsA: How to search for an element with the same class depending on the number of children?
you can search for the li belonging to .teste who is only daughter, then access the relationship of the same. var itens = document.querySelectorAll(".teste li:only-child"); var listas…
-
5
votes1
answer219
viewsA: JS - Write a function that returns the largest STRING
You don’t need to write a function that already exists, use Array.prototype.reduce() var strings = ["StackOverflow", "Sem resposta", "Tags"]; var retorno = strings.reduce(function (atual, proximo) {…
javascriptanswered Tobias Mesquita 22,900 -
4
votes1
answer57
viewsA: Javascript button error on IE9
Mariane, the API for accessing files on a input[type='file'] is not implemented in IE9. Below is the list of browsers that support: Chrome 13 Firefox 7 Internet Explorer 10 Opera 16 Safari (Webkit)…
-
2
votes2
answers206
viewsA: Change attribute "src" with fadein effect
Diego, I do not believe it is possible to make a transition effect to the property 'src', the most that is possible is using a background-image. var imagens =…
jqueryanswered Tobias Mesquita 22,900 -
0
votes3
answers804
viewsA: How to reload or refresh the CSS of the page with Javascript
after popular your layers, try calling the .trigger('create') about the same. var tmplCamada = document.getElementById("tmplCamada").content; var numeroCamadas =…
-
0
votes3
answers804
viewsA: How to reload or refresh the CSS of the page with Javascript
after popular your layers, try calling the .trigger('create') about the same. var tmplCamada = document.getElementById("tmplCamada").content; var numeroCamadas =…
-
4
votes3
answers1311
viewsA: How to place a upload image within a Javascript function?
I use the following implementation: var block = document.querySelector(".block"); var fazerRequisicao = document.getElementById("fazerRequisicao"); fazerRequisicao.addEventListener("click", function…
-
4
votes5
answers6773
viewsA: Separate ddd from phone with SQL statement
You can remove all spaces and words NULL, if you don’t have a 0 left, add one, then format the string: DECLARE @Telefones AS TABLE ( [DDD Telefone] VARCHAR(50) ) INSERT INTO @Telefones VALUES ('47…
-
1
votes3
answers756
viewsA: How to group results in a row?
In this case you will need a Pivot, if you only have these three exams, you can do it as follows: SELECT FICHA, CASE WHEN [Colesterol] IS NULL THEN 'N' ELSE 'S' END AS [POSSUI COLESTEROL?], CASE…
-
3
votes1
answer233
viewsA: Checkbox summation system not working
Like you said, your code is working but something on your other page is making it break into it. In this case, what I can advise you is to define a scope for your script, including when searching…
-
2
votes3
answers229
viewsA: How to add new jquery inputs through a number of a text box, but add only those that are missing
Follows an implementation that makes no use of string manipulation and maintains index integrity. var txtQuantidade = document.getElementById("txtQuantidade"); var btnAdicionar =…
jqueryanswered Tobias Mesquita 22,900 -
0
votes4
answers4957
viewsA: Javascript code does not work
Giannini, there is an implementation in Ecmascript 2015 (ES6) to check if the object of type Number is an Integer: Number.isInteger. Although it is not available in most modern browsers, you can use…
javascriptanswered Tobias Mesquita 22,900 -
7
votes5
answers8511
viewsA: Reverse array order
Pedro, despite the Array.prototype.reverse work in your example, it will mutate the original array, so if you make a console.log(meuArray) you will notice that the same will be reversed. var output…
javascriptanswered Tobias Mesquita 22,900 -
1
votes1
answer940
viewsA: Return function Angularjs / Javascript
you will not be able to return a value synchronously that is available in an asynchronous method. in this case your best option is to pass a callback function. So instead of having something like:…
-
9
votes5
answers31061
viewsA: Format Float value as currency using Jquery
I know you asked in Jquery, but Javascript already has an internal function for this. Number.prototype.toLocaleString var valor = 16.00; var texto = valor.toLocaleString("pt-BR", { style: "currency"…
jqueryanswered Tobias Mesquita 22,900 -
5
votes1
answer157
viewsA: Linq groups and fetch max id
Marconcilio, you can first make a subquery to return the latest version of each cost center... then you make a Join with this subquery. var centrosCusto = from formulario in qrFormularios group…
-
0
votes5
answers1346
viewsA: How to get all HREF and SRC values from a code
Follow a solution using Javascript only: var rawHTML = document.getElementById("rawHTML"); var btGetLinks = document.getElementById("btGetLinks"); var listLinks =…