Posts by Miguel Angelo • 28,526 points
429 posts
-
1
votes3
answers3702
viewsA: How to get the dynamically created Textbox value?
In Webforms, for dynamically created control values to be retrieved, you must ensure that all controls are created and added to the page hierarchy prior to the Processpostdata event. After this…
-
2
votes4
answers47574
viewsA: Capture screen size at time of request
You can use the following to define the src of the image as soon as the tag img is rendered: <img src="" onerror="this.src = 'http://myserver/myimage?w=' + screen.width + '&h=' +…
javascriptanswered Miguel Angelo 28,526 -
5
votes4
answers552
viewsA: How to distribute words in a fixed size area?
Based on your fiddle, I decided to try to get the words to move from their original points, randomly at any angle, at a fixed distance of 25px, and the result until it was good: jsfiddle Code: CSS:…
-
2
votes1
answer737
viewsA: Loop asynchronous calls and process data at the end of all runs
Do so: var tasks = servers.Select(server => ws.GetDataAsync(server)).ToArray(); Task.WaitAll(tasks); var results = tasks.SelectMany(t => t.Result).ToList(); foreach (var res in results)…
-
2
votes3
answers629
viewsA: How to capture innerHTML from a documentFragment via Javascript?
Use only: frag.querySelector('*').innerHTML The asterisk selects any first DOM object found within the fragment, which in this case is the root, and then with the root DOM object in the hands it is…
-
2
votes6
answers2374
viewsA: How to select all "empty" elements
For what you posted to work, the values must be explicitly defined as value="", and then it will be possible to select the elements input, select and textarea you want with the following expression:…
-
1
votes2
answers4221
viewsA: How to use HTML Agility pack?
I don’t know the website you’re trying to parse, but I see some errors in your code design: First, it is not necessary to use the class WebBrowser... this class represents a graphical control to be…
-
3
votes4
answers224
viewsQ: Given a group of options, at least one should be selected, using jQuery
I have a group of check-boxes that allow you to select flags on a search screen. It turns out that if I allow the user to uncheck all of them, it is certain that there will be no result. That said,…
-
3
votes4
answers224
viewsA: Given a group of options, at least one should be selected, using jQuery
I ended up doing as it is below and works for me, but I’m not sure if it is the most correct way, or if there are other better. var checkGroup = $(".check-group"); checkGroup.on("click", function…
-
0
votes2
answers1081
viewsA: Dynamic checkbox validation with jquery-Validator
You could make the field always exist, leaving the same invisible? display: none; If you can, then that would solve your problem.
-
1
votes2
answers1772
viewsA: Is it possible to have dynamic rules with jquery validation?
It is possible to add and remove validation rules dynamically, as indicated by this response in SOEN: https://stackoverflow.com/a/4878858/195417 I am currently limited to internet, please check if…
-
4
votes3
answers4291
viewsA: What is the best way to select an option by the text and not by the value in jQuery?
You can use the selector contains jQuery... is not exactly the request but solves the problem in case the search domain has only distinct texts: $("#meses…
-
5
votes6
answers11946
viewsA: Converting a string to int?
You can use the following function to make the conversion effectively and without many lines: public static int? StringToNullableInt(string strNum) { int outInt; return int.TryParse(strNum, out…
-
7
votes8
answers5526
viewsA: How to make a DIV fill all available width
Do so: .menu{ width: 250px; float: left; background-color: blue; } .resto{ background-color: red; overflow: hidden;} To keep it that way: Note that if the content has multiple lines, it will not…
-
6
votes3
answers5660
viewsA: How to keep the element scroll always at the bottom
$(function() { $("#add").click(function() { $("#wrap ul").append('<li class="new">Teste</li>'); $("li.new").slideDown('slow', 'easeOutBounce'); $("#wrap").animate({scrollTop:…
-
4
votes2
answers1950
viewsA: Close connection to database c#
I can see some problems with your code. You should use blocks using for the objects that are IDisposable: Mysqlconnection Mysqlcommand Thus: using (var bdConn = new MySqlConnection(conexao)) using…
-
0
votes3
answers1139
viewsA: Route to static pages in MVC
The way to do this is by using the method virtual HandleUnknownAction class Controller from which all controlers derive. The following example renders any page whose cshtml exists in the view folder…
-
8
votes2
answers130
viewsA: Doubt about @media
I think IE8 doesn’t support media queries: http://caniuse.com/css-mediaqueries So it would have to be a javascript solution that listens to the event window.onresize, and for example, change the…
-
0
votes4
answers3223
viewsA: Generate xml through a class, even without value in the property
You must set the property to be saved as an empty string "", instead of null. So the value containing the empty string will appear in xml. EDIT Try to create the following methods in your class…
-
3
votes5
answers16269
viewsA: How to enable a button only when all inputs are completed?
I implemented a solution that works with input, textarea and select. I will iterate the elements just once on page-load, and assign events that might change the value of an input, textarea or…
-
2
votes2
answers2126
viewsA: Error making Ajax request
From what I’ve researched, this could be caused by something that’s intercepting your request, and sending an empty request. Possibly a ad blocker (like Adblock), as indicated in this SOEN response:…
-
8
votes6
answers293
viewsA: How to visually indicate which fields are fillable?
Perhaps, one way to convey this impression is to stylize the non-enterable data as ordinary text, without the text box. You can do this in such a way that the texts are spaced equally, so that they…
-
2
votes2
answers5577
viewsA: How to see if a "file" input file has been selected?
You can use the input change event to know when some file is selected: <script type="text/javascript"> $(function() { $("input:file").change(function (){ var fileName = $(this).val(); if…
-
2
votes8
answers45427
viewsA: How to disable the scroll of a web page?
Puts the style overflow: hidden in its element body... so there will be no scroll, nor through the keyboard will be possible. EDIT I discovered in the English OS the following CSS: html {…
-
5
votes1
answer413
viewsA: How to install newtonsoft in visual studio without nuget
An alternative is to check out the repository, compile it yourself, and add the reference to your project... so it’s all very manual. https://github.com/JamesNK/Newtonsoft.Json You can even include…
visual-studioanswered Miguel Angelo 28,526 -
2
votes1
answer6036
viewsQ: How to place a border on a <tr> that appears above the edge of the <td>?
I was developing a screen, which contained a table with a style tr:hover for when the user hovers over the lines of it, they look different. Everything was going well until the moment I decided I…
-
3
votes1
answer6036
viewsA: How to place a border on a <tr> that appears above the edge of the <td>?
Explanation based on experiments: It turns out that when the edges of the table are with the attribute collapsed, the <tr>'s and <td>'s share the same edges. Therefore, there is no way…
-
8
votes5
answers10769
viewsA: How to mark and unmark a row from a table by clicking on it?
A componentized solution (i.e., it can be encapsulated), is possible using jQuery and css classes: $("#mytable > tbody > tr").on("click", function (e) {…
-
3
votes4
answers1531
viewsA: List all Roles in Checkbox and mark the roles that the User has
Firstly, your logic is not very good, because you are using two foreach nested, printing things on the page... that would be the logic of a table, but not of a list. The correct logic for a list is…
-
2
votes1
answer82
viewsA: Does ASMX Web Service contain an event to end the request?
You can implement an Ihttpmodule, or use Httpapplication events to do so. Ihttpmodule public class MeuModuloHttp : IHttpModule { public String ModuleName { get { return "MeuModuloHttp"; } } public…
-
5
votes2
answers328
viewsA: Which framework should I use for Functional Testing on . net?
My options You can use the MSTest together with a Mock framework such as Moq, and some control inversion framework, such as SimpleInjector... this way your system can be tested easily. There are…
-
2
votes2
answers144
viewsA: Compare Dayofweek in an ASP MVC query
You cannot use the property DayOfWeek in a LINQ to Entities. You’ll have to use the special function: SqlFunctions.DatePart("weekday", data): var diaDaSemanaDesejado = 1; // segunda var r =…
-
2
votes3
answers19154
viewsA: How to take the path of the open executable in C#
If you want the program execution path: System.Environment.CurrentDirectory
-
3
votes5
answers1583
viewsA: How to get the number of weeks in a date range in C#?
There are several ways depending on what you are considering as being a week. Whole weeks of the calendar Considering only whole weeks of the calendar, that is, only calendar weeks are counted that…
-
5
votes1
answer5980
viewsA: How to pass parameter in an Action Link values that are in HTML elements?
You will need to use javascript to be able to put the parameters of your inputs text and hidden as parameters in link. The value of Hidden may be placed directly on the link on the server side if…
-
0
votes2
answers237
viewsA: How to add link in a Kendo UI tabstrip?
According to the telerik forum, you can change the title of the tab via javascript as follows: $($("#tabstrip").data("kendoTabStrip").items()[tab_index_variable]) .children()[0].innerText = "New Tab…
-
0
votes3
answers671
viewsA: A C program can tell which OS it is compiling?
You could create a build file for each system by calling make with a parameter, and define a build directive through a compiler parameter that you use, or else check the compiler documentation and…
-
7
votes2
answers2496
viewsA: How to know when the user opened an application?
Filtering by window titles If you don’t know what the name of the application is, and want to use the method Contains in the name of the main window, could list all running processes, and verify…
-
1
votes2
answers1994
viewsA: Get Post Data in ASP.Net MVC
You need to create fields input type="hidden" with the values you want them to be passed via POST, and create a parameter with the same name in the action name of this input:…
-
12
votes2
answers4913
viewsA: How to check if a file is in use without launching C#exception
There is no point in checking whether a file is in use in a competitive environment. Usually what is done is to try to perform the desired operation, and put a Try/catch around the operation with…
-
38
votes1
answer1300
viewsQ: What does the && in between strings mean?
I found in a minified bootstrap file, the following: e=e&&e.replace(/.*(?=#[^\s]*$)/,"") The operator && seems to be being applied between two strings. What does that mean?…
javascriptasked Miguel Angelo 28,526 -
32
votes1
answer1300
viewsA: What does the && in between strings mean?
Meaning of the && operator in Javascript The operator && javascript is not a simple logical operator, as usual deduce by observing the use of the same operator in other languages. In…
javascriptanswered Miguel Angelo 28,526 -
2
votes3
answers232
viewsA: Why CSS properties change in browsers
This is because these are properties used during the improvement of the browser code, so that once everything is perfect, the names recommended by the standards are used. This means that at a given…
cssanswered Miguel Angelo 28,526 -
2
votes4
answers3127
viewsA: How to prevent the input-text focus from being lost by clicking on another element?
I ended up solving the problem, but this is one of those who should trim the browser tips by browser, because each one has a different thing... so, that being said, here is a solution that I was…
-
1
votes4
answers3127
viewsQ: How to prevent the input-text focus from being lost by clicking on another element?
I have a input of the kind text, in which I can type a search, which is executed via ajax, while the user type. Below this I have a list of items that were found in a table. By clicking on this…
-
0
votes3
answers221
viewsA: Equivalent to jQuery’s . filter() method or Zepto in pure javascript
var cls = 'middle'; var tag = 'P'; var lista = document.getElementsByTagName(tag); for (var i = 0; i < lista.length; i++) { if ((' ' + lista[i].className + '…
javascriptanswered Miguel Angelo 28,526 -
3
votes3
answers3055
viewsA: Web service in javascript
I found this, maybe it helps you with the WSDL: http://www.ibm.com/developerworks/webservices/library/ws-wsajax/ Use the method ajax jquery. $.ajax({ url: "url-do-webservice"}); And use one of the…
-
10
votes4
answers40379
viewsQ: How to replace column text in SQL Server (tsql)?
I have a text column in SQL Server 2008 R2, which is filled with wrong typed text, in thousands of records. I would like to make a UPDATE replacing the wrong text with the correct one.…
-
15
votes4
answers40379
viewsA: How to replace column text in SQL Server (tsql)?
It is possible to use the function REPLACE tsql, as follows in an UPDATE command: UPDATE nomeTabela SET colunaTexto = REPLACE ( colunaTexto , 'tetxo-erraddo' , 'texto-correto' ) Also, if you want to…
-
25
votes2
answers883
viewsQ: Is there a null coalescence operator in javascript? Just like the C#? operator
In C# there is an operator ?? which serves to make null coalescence, used following the syntax: var valor = valorAnulável ?? valorPadrão; Where: valueApproachable is any value including null default…
javascriptasked Miguel Angelo 28,526