Posts by Miguel Angelo • 28,526 points
429 posts
-
3
votes3
answers3841
viewsA: Why use relics in C#?
This is just a way to organize the code, and is usually used by generated code. In codes not generated I recommend a certain care when using Codes, because when used to separate codes according to…
c#answered Miguel Angelo 28,526 -
17
votes3
answers10218
viewsA: How to create a real-time notification system similar to Stack Overflow?
I just answered a similar question, only I was talking about a chat. The options you have are as follows:: To implement the chat: the option that will give you the widest range in terms of browsers,…
-
13
votes4
answers5293
viewsA: How to check if the user is online?
You can use a set of techniques to get this information. On the client’s side: Listen to the closing event of the browser window, and when the user closes, send a signal to the server, indicating…
-
8
votes2
answers1259
viewsA: Difference in performance and use situation of numerical types
No. Net (as in many other languages), there is a separation between integer types and rational types, so I will separate my explanation of these types into these two categories. Whole Types There…
-
1
votes3
answers3981
viewsA: Declare variable within my cshtml
That’s not exactly how web systems work. The text box is something that will appear for the client to fill and then submit to the server... then yes you will have the opportunity to collect the…
-
4
votes2
answers330
viewsA: Display layout only when view is not loaded via ajax
Indicating the master view in the controller One way to do this is not set the layout in the view, but in the controller: In the view delete that line: Layout = "_Layout.cshtml"; // elimine In your…
-
6
votes2
answers222
viewsA: What difference xmldocument vs xmlwriter?
Xmldocument represents an entire XML loaded into memory, while Xmlwriter is an object that assists in writing XML into a stream. Xmldocument If you want to manipulate an XML, for example, load it…
-
0
votes3
answers5368
viewsA: How to add an onBlur event without overwriting the original?
This is an old javascript problem in browsers, easily reachable by the use of libraries, such as the jQuery. Using jQuery your example would look like this: <input id="txt" type="text" value=""…
javascriptanswered Miguel Angelo 28,526 -
0
votes4
answers3446
viewsA: Javascript function for zeros on the left with MVC 5
If the rule is to have only 2 digits, you can do so: var sufixo = i < 10 ? "0" + i : i; and then concatenate with variable names: nm = "txtNome" + sufixo; dia = "txtDia" + sufixo; mes = "txtMes"…
-
3
votes2
answers8248
viewsA: Fill fields with json function return with jquery
On your controller, remove the Httppost attribute from the action, if the intention is to call via GET. By returning it, allowing Json to be returned via GET I suppose that is the intention. The…
-
0
votes2
answers234
viewsA: How to perform an action before 'mousedown' in javascript/jquery?
From what I know, changing the values passed in the variable that identifies the event has no real effect, so it makes no sense to change these values hoping that the browser has a different…
-
3
votes3
answers2246
viewsA: What is the percentage difference between the number of possible addresses with Ipv4 and Ipv6?
IPV4 has 32 bits, IPV6 has 128 bits. It is such an absurdly large value that it is possible to say that IPV4 = 0% of IPV6
-
0
votes1
answer54
viewsQ: Why is triggerHandler only affecting the first on the list?
I’m trying to call Handler an event via jquery, by using the method triggerHandler is only affecting one of the selected elements, and the selector definitely represents several elements. jsfiddle…
jqueryasked Miguel Angelo 28,526 -
12
votes2
answers3377
viewsA: How to count lines of code in a . NET Solution?
Right click on the solution then click on Calculate Code Metrics. This window will appear: Another way is to use the screen to search all documents Ctrl+shift+F with the following regex:…
-
11
votes1
answer2651
viewsQ: What does the CSS selector :first-Child and :last-Child mean?
I have a code using jQuery that was based on CSS selectors :first-child and :last-child (and that worked for a long time), to get the first input and the last input within a group containing input +…
-
18
votes1
answer2651
viewsA: What does the CSS selector :first-Child and :last-Child mean?
Pseudo-classes do not work like this It is common to make this confusion about the meaning of the selectors :first-child and :last-child, also called pseudo-classes, in addition to other…
-
2
votes2
answers706
viewsA: Print highlighted matrix specific values
To know if a number is for or odd, use the following: Par: $numero % 2 == 0 Odd: $numero % 2 == 1 So it becomes clearer what you mean, in my opinion. Besides, I wouldn’t use <b> and yes…
-
5
votes6
answers11304
viewsA: How to get distance given the coordinates using SQL?
I wouldn’t calculate the distance in the database. Instead, I would take all the points you’re inside of a square, which makes the query easier, and can still make it much faster because it only…
-
2
votes2
answers60
viewsA: Can I override already existing anottation on . net?
Resharper can break down the attribute code (as well as anything else) so you could see the attribute code. You can also see the code of the same online.…
-
0
votes4
answers3455
viewsA: Is it possible to communicate Client-Server in real time via HTTP?
Another option to Signalr, which has some drawbacks, such as not using WebSockets if the server is not using IIS-8, it is xsockets... which creates server-side connections independently of IIS.…
-
26
votes2
answers1436
viewsA: What it means '~' in front of the constructor of a C#class
This is not a builder, but a destroyer. The destructor is called when the CLR checks that there are no more references to the object, and then will eliminate it from memory. If there is a destructor…
-
3
votes4
answers10727
viewsA: What is the Mysql CREATE VIEW command for?
A View is a SELECT query that is saved in the database to be used later. When you need the View data in any context, just use the View name, which will be as a sub-SELECT at the point where the View…
mysqlanswered Miguel Angelo 28,526 -
7
votes6
answers3343
viewsA: Methods to test websites in different browsers?
First of all I wouldn’t test all browsers, and I wouldn’t worry about testing as many browsers as possible, but on the browsers that are most important to the target audience. To get an idea of how…
-
7
votes2
answers3379
viewsA: How to avoid sending PHP requests in a row?
You can use Javascript to disable the button as soon as it is clicked once, so the user cannot make multiple requests if you have Javascript enabled, what is the case with the majority, but ai…
-
2
votes2
answers182
viewsA: Animation namespaces in jQuery
I found something in SOEN that may be a solution to this question: Stopping specific jQuery animations According to the answer it is possible to call the method animate passing the parameter queue:…
-
12
votes2
answers5714
viewsA: How does it work and use the Stack in C#?
Stack is nothing more than a stack, in which the incoming objects end up blocking those that are already in the stack, so that only the one that has no other blocking can be removed from the stack.…
-
1
votes4
answers1101
viewsA: How to check with javascript/jquery which object(s) is(is) triggering a scroll bar on the page?
I implemented a script to do this using jQuery: $(function () { var $w = $(window), wb = $w.height(), wr = $w.width(), arr = []; $('*').each(function () { var $this = $(this), ofs = $this.offset(),…
-
2
votes3
answers1220
viewsA: Remove key pressed in an input text
You could simply prevent the action of the key by returning false: jsfiddle Code: $("#foo").on("keydown", function (e) { if (e.keyCode >= 32) return false; });…
-
5
votes3
answers3204
viewsA: Button next to text bar with Bootstrap
You are using bootstrap 3, which is quite different from bootstrap 2. Some elements are missing from your HTML structure. See fiddle: jsfiddle HTML: <form role="form"> <div…
-
0
votes6
answers5531
viewsA: Why use Javascript if there are so many other technologies to generate dynamic content?
Reasons that I consider the main ones as a result of javascript being able to run in the client: Fast response time for GUI operations Save bandwidth from both user and server Reasons to use…
-
2
votes2
answers1465
viewsA: ASP.NET MVC - Route does not pass values to the Controller
The option View in browser... from Visual Studio, it’s kind of incompatible with ASP.NET MVC, because it tries to navigate to the page with a URL using the folder structure as a template, rather…
asp.net-mvc-5answered Miguel Angelo 28,526 -
9
votes3
answers5558
viewsA: Master-detail in MVC C# with Razor
Since it’s to save everything at once, I’d use one client approach, no postback until such time as everything has to be saved. You could argue about the possible loss of data in complex…
-
4
votes2
answers4861
viewsA: How to order a JSON in descending order?
You can write a comparison function and pass as parameter of the array’s Sort method. Example: function comparer(a, b) { if (a.cont < b.cont) return -1; if (a.cont > b.cont) return 1; return…
-
11
votes3
answers7891
viewsA: How to create a click event that is only called when clicking outside a div?
You can associate the event in a more external element, for example the body, and inside the event check which is the target of the event. If the target is the DIV you want to delete from the click…
-
2
votes2
answers251
viewsA: Generating thumbnails through Filereader
The problem is the use of for (... in ...), which also reads the file array properties, such as length. That is, you are adding an image when the length property is iterated! EDIT A help to generate…
-
1
votes2
answers3447
viewsA: PDF view in browser
You can use the Google Docs viewer, which allows you to reference online documents (e.g. PDF, DOC, etc.), and then use one of the options given by Viewer: URL: url of the view page Link <a…
-
15
votes4
answers3989
viewsA: How the relationship between the same table works
It is perfectly possible for a table to have relationships with itself. There are several data models that require such an approach: Tree: each node refers to the parent node, and the root node…
-
1
votes2
answers507
viewsA: Webclient request returns empty
You have to set the request headers before making the request: WebClient wc = new WebClient(); wc.Headers["Accept"] = "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8";…
-
2
votes2
answers1762
viewsA: Visual Studio Test Explorer does not find the tests
As I recall, Visual Studio does not recognize third-party testing (i.e., not Mstest) automatically, requiring the installation of additional packages at the same time. Take a look at this for the…
-
2
votes2
answers2219
viewsA: How to upload multiple images with just 1 click?
You can use jQuery File Upload plugin created by blueimp: http://blueimp.github.io/jQuery-File-Upload/ You can install the plugin by nuget. Just go to Package Manager, and search for blueimp. The…
-
6
votes2
answers2520
viewsA: How to create an autorun?
Answering a little more than asked, I will point out some options you have when using the file autorun.inf: Main attributes action=texto optional: auto-run item text, both in the context menu, and…
windowsanswered Miguel Angelo 28,526 -
1
votes3
answers1552
viewsA: How to download an image from the internet with C#?
If you’re talking about Windows Forms, then you can use the method Load of Pictirebox passing a URL: pictureBox1.Load("http://www.simepar.br/site/fragmentos/radar/simepar_24.gif");…
-
4
votes6
answers18641
viewsA: What is the difference between declaring an array with "array()" and "[]" in Javascript?
The difference should be minimal (i.e. only in the code as far as I can see). I had the idea to test with the prototype of the Array, before instantiating either using the literal form, or using the…
-
1
votes2
answers1930
viewsA: C# - Path to execution
The name of this is not "fixed path" but yes "relative path"... but I think I understand what you mean, actually the string is that it’s fixed, representing a relative path. =) I see no problem in…
-
25
votes3
answers2308
viewsQ: What HTTP status should I use for when a POST parameter is missing?
I have a form that will be submitted to the server via ajax, using a plugin for this. When the form is not filled in correctly (in case when a mandatory parameter is missing), I want to return a…
-
4
votes3
answers853
viewsA: How to replace hexadecimal value in a binary file?
You will need to process the bytes manually in the case of a binary file: byte[] findBytes = { 0x62, 0x61, 0x72 }; byte[] replaceBytes = { 0x66, 0x6F, 0x6F }; List<byte> result; using (var…
-
9
votes2
answers1921
viewsA: Async operations on ASP.NET
A utility I see for bound CPU operations, would be running multiple processing on separate processors, with a await in the code like this: var tasks = PegarMultiplasTarefas(); await…
-
5
votes3
answers2226
viewsA: Performance: string "concatenated" or all in the same line?
In case of replacing multiple calls from StringBuilder.Append for only one, the gain will be minimal. On one occasion, working with the class StringBuilder I noticed a great improvement in…
-
4
votes6
answers14419
viewsA: Which database should I use in a small desktop application?
As it seems to me that the company is looking for a solution that is cheap, and that does not waste a lot of resources, maybe one option is to use a Shared-hosting aimed for. Net, and create a web…
-
0
votes2
answers336
viewsA: Why does the script not only accept the letter F?
Your regular expression shouldn’t be like this: ^(([F]{0,1})|((([1]{1}[0]{1})\.([0]{1}))|((([0]{1})(\d){1}))\.(\d{1})))?$ I think you’ve made a little typo. Switched {0,1} for {0-1}.…