Posts by Miguel Angelo • 28,526 points
429 posts
-
2
votes1
answer484
viewsA: How much to charge on a website?
A simple formula: precomMaximo = search your customer, and try to determine the maximum he would pay (tip: search the market, and what your customer has access to from that market) precoMinimo =…
c#answered Miguel Angelo 28,526 -
16
votes1
answer2218
viewsA: What I need to sell a C#system
Depends on the type of application and the components used to make the application. .Net framework The. Net can be installed on any supported system for free, so I think it will only depend on the…
c#answered Miguel Angelo 28,526 -
9
votes3
answers18905
viewsA: Algorithm for betting creation on Lotofácil
Given an algorithm capable of catching the n-th combination, you just need to use random integer numbers to get the games. Class to obtain the nth combination I made a class able to get the nth…
-
4
votes3
answers4590
viewsA: SQL use variable in column name
You will not be able to change the column name by SqlCommand, because the parameters only serve to add values. You need to do this before creating the command by changing the original SQL: var…
-
11
votes2
answers148
viewsA: Why does the Chrome console return 8 when I type 010?
When Chrome interprets a number starting with the character 0 he makes it as being an octal. The octal representation of the number 8 (decimal) is 010, and the octal representation of number 64…
-
4
votes2
answers741
viewsA: Definition and utility of partial class
Partial classes are usually used with code generated by some tool, in order to allow the programmer to input code within that generated class, without having to change the generated code file. Apart…
c#answered Miguel Angelo 28,526 -
9
votes3
answers1414
viewsA: Is it possible to obtain timestamps with millisecond fractions accuracy?
Performance timer It is possible to obtain timestamps with millisecond fractions accuracy. Modern browsers allow you to use performance timers: window.performance.now() By measuring the initial and…
javascriptanswered Miguel Angelo 28,526 -
1
votes2
answers180
viewsA: In the Firebug Javascript debug, how to display the current line of code?
Go to the Stack tab and click on the first item:
javascriptanswered Miguel Angelo 28,526 -
3
votes2
answers3697
viewsA: How to recover values of fields loaded with jQuery
EDIT: the div #staus is within the element #direita which is the target of the method load, and will therefore be replaced by form that is coming from the server. Therefore, when clicking the…
-
0
votes5
answers2197
viewsA: How to create a switch.. case with value ranges?
You must use several if's and not a switch. The switch serves to compare point values, not being able to compare intervals as you indicated in the question. if (30 <= tempo && tempo <…
-
3
votes5
answers363
viewsA: What does ? and : within an expression?
Ternary conditional operator There is in javascript an operator that looks like an if/Else, which serves to return a value given a condition. This operator is a ternary conditional operator (meaning…
-
0
votes4
answers1320
viewsA: Long processes in C#
Setup You will need to make some settings before allowing the user to make a large upload to your system: upload limit size maximum request time Configuration example: <system.web>…
-
2
votes2
answers11327
viewsA: Iframe view of PDF
You can use the viewer Google Docs to view online documents on your page by placing an Iframe of the viewer. EDIT You could generate the PDF, allow it to be accessible through the internet: Example:…
-
0
votes1
answer480
viewsA: Load part of the page in AJAX
In fact the answer via ajax is faster, because you will have less data moving through the network/ internet. For example, when deleting something, you can make an AJAX for a specific URL, and then…
-
1
votes1
answer131
viewsA: What are the SQL formatting standards? Do you have a tool that does this?
There is an online tool that I use to format SQL that is very confusing: http://www.dpriver.com/pp/sqlformat.htm This tool allows you to format SQL’s of various SGDB’s, so that they are more "cute".…
-
2
votes4
answers182
viewsA: Error javascript if
If you assign true a variable, so the expected minimum would be that compared to the same original value, the condition would pass... but you used something different in the comparison: 'true'. In…
-
2
votes2
answers191
viewsA: Disable part of the form by Jquery
I recommend the use of checkbox to say whether it is anonymous or not: Javascript: $(function() { var $check = $("#checkAnonimo"); $check.on("change", function () { var anonimo =…
-
4
votes3
answers18253
viewsA: Stylization of Option via CSS
Options are really one of the worst elements of styling. The support given by browsers varies a lot. I wouldn’t recommend trying to style these elements if you want consistency of look across…
-
0
votes1
answer101
viewsA: Error logging in to server hosted on local IIS
The problem may be that you are using a local database during development, but this database does not exist on the target machine, ie the machine where you are hosting your application. Possible…
-
2
votes2
answers134
viewsA: subtraction of two double properties[]
An alternative solution would be to create a type specialized in storing positions: public struct Point { private double x, y; public Point(double x, double y) { this.x = x; this.y = y; } public…
-
2
votes2
answers134
viewsA: subtraction of two double properties[]
A property with a getter to do this does not solve? public double[] DifXY { get { return new[] { this.PosicaoInicialXY[0] - this.PosicaoFinallXY[0], this.PosicaoInicialXY[1] -…
-
3
votes2
answers3026
viewsA: Bootstrap styles do not load
You must be using a relative address for your CSS file: <link rel="stylesheet" type="text/css" href="arquivo.css"> When you do this, the browser will search the file at different addresses,…
-
5
votes1
answer862
viewsA: Capture buttons pressed on video game control reliably
Instead of implementing this in a timer, why not use another thread, and continuously check the state of the controller by triggering an event in the form when a button is pressed and when it is…
-
3
votes4
answers3125
viewsA: Dealing with collisions in Dictionary C#
Techniques for handling collisions The class Dictionary<TKey, TValue> do. Net does not allow null or duplicate keys. You will have to deal with these occurrences in the most appropriate way…
-
4
votes4
answers459
viewsA: What happens when I convert int to char?
It will take the start byte, which in human representation, are the least significant digits, ie the final digits. I say this because in memory, the first byte actually represents the least…
-
1
votes1
answer1832
viewsA: Hide parameters in the URL with routes and mvc 5
To send data to the server without the URL, the only way I know is via POST. Now the problem is how to make a POST from a link... the way I know is you create a form on the page and submit it using…
asp.net-mvc-5answered Miguel Angelo 28,526 -
2
votes7
answers6999
viewsA: Split() integer with Javascript
Just convert you to string before using the split. There are several ways to convert a number to string, for example: var n = 10.01; var s = n.toString(); var a = s.split('.'); By the way, you use…
-
8
votes2
answers5079
viewsA: How to count records (SELECT COUNT) in Linq
Although the commands are on separate lines in C#, only a query will be made in the database at the time you call the method Count(). That code does only one query: var result = from tbl in tabela…
-
2
votes1
answer328
viewsA: Something wrong with references using two layers in Entity
This error means that the resource (refers to EDMX) not found. This EDMX file stores the metadata used to map your class model to the database model. Check your EDMX file designer, the property…
-
5
votes5
answers844
viewsA: What is the shortest and most performative way to write Fibonnaci in Javascript?
A very short way of calculating This is the shortest form I’ve found that doesn’t use recursion. function fib(n){ var a=1,b=1; while(--n)a=b+(b=a); return b; } If put in a line: function fib(n){var…
-
9
votes2
answers1564
viewsA: CSS/jQuery selector for a table column
If none of the Tds own a colspan then it is possible to do this using the pseudo-class :nth-child: Example to select all third party Tds: table td:nth-child(3) { /* estilo */ } Reference in the MDN…
-
4
votes1
answer898
viewsA: How to pass checkbox list to Actionresult
Make your checkboxes look like this: <input type="checkbox" name="photoToDeleteIds" value="@imagePath.IdPhoto" /> And change your controller’s action by adding a parameter photoToDeleteIds:…
-
16
votes2
answers1842
viewsA: What is the Unicode (BOM) signature?
The BOM marker is an order indication of bytes in a text file, for each pair of 2 bytes, in the case of Unicode-16 and for the group of 4 bytes in Unicode-32. This marker comes exclusively at the…
-
20
votes5
answers22471
viewsA: How do anonymous functions work?
You can implement using recursion yes, just use the variable itself to which you assigned the function and call it: var fibonacci = function(num) { if(num==1 || num==2) return 1; else return…
-
1
votes3
answers24782
viewsA: How to sort an array by values?
A solution would be like this: Data = [3,5,1,7,3,9,10]; Data.sort(function(a,b) { return a - b; }); var str = ""; for (var it = 0; it < Data.length; it++) { str += Data[it] + ","; } alert(str);…
javascriptanswered Miguel Angelo 28,526 -
0
votes3
answers388
viewsA: Date reassembly with javascript
I am seeing that you already have the data inputs dismembered, you could create an action, that instead of receiving a date, also receive the parts dismembered: public ActionResult MinhaAction(int…
-
14
votes2
answers7145
viewsA: Is it good practice to use <Summary> for documentation?
Summary is used by Visual Studio That’s the way pattern to create documentation for the C code#. That’s where Visual Studio gets the explanation of what the method does to show when you point the…
-
3
votes2
answers1318
viewsA: How to write HTML inside Ajax Success
You will have to build HTML within the method success using strings, or some template library, and then making a append in some HTML element that is already on the page. In addition your controller…
-
0
votes2
answers351
viewsA: Always need to do clean and rebuild in visual studio
I’ve had problems for a long time, with a mixture of reference types within the same project. If this is your case, make all references within the same project references instead of referring…
visual-studioanswered Miguel Angelo 28,526 -
6
votes2
answers9591
viewsA: How to avoid SQL Injection in my PHP application?
You must encode all parameters passed to your application before concatenating to your SQL. All databases support in some way saving data in the database, even if it is an SQL, and for that the…
-
0
votes1
answer106
viewsQ: Is it bad practice to return Viewmodel from a Webservice?
It is a bad practice to use the same class that is used as Viewmodel, that a Action passes to the View, to return data from a Webservice? (like those methods marked with [WebMethod]) I imagine not,…
-
2
votes1
answer50
viewsA: Change csproj value through Teamcity
An alternative is to create a Pre-buildevent that triggers a program that will open the file "csproj" and then replace the desired line. This application (can be done in C# itself, Console…
-
0
votes3
answers1456
viewsA: Encapsulate values returned by JSON within a single object
Do so to return the json that will come out the way you want: return this.Json(new { licencas }, JsonRequestBehavior.AllowGet);
-
2
votes1
answer174
viewsA: Sorting data from one column to another
Solution using stored Procedure I found in SOEN, a solution based on stored Procedure, which does not require changing the structure of the bank: https://stackoverflow.com/a/11035966/195417 Solution…
-
1
votes1
answer593
viewsA: Problem redirecting page by route
You can use the UrlHelper to help you create urls in your view: Url.Action("Passo_06", "Passo") Exemplifying the use: <button id="btnGravarPassageiros"…
asp.net-mvc-5answered Miguel Angelo 28,526 -
1
votes2
answers538
viewsA: How to update ASP.NET Repeater in real time?
You’ll have to do it using javascript on the client side, rather than using a. I recommend you use jQuery, to be able to do this, in addition to a very good templates plugin:…
-
3
votes2
answers1506
viewsA: Compare date time with a timespan
A time-span is a time interval, and therefore to be transformed into an absolute date needs a base calculation. It is possible to use the current date as a basis of calculation thus: TimeSpan ts =…
-
3
votes3
answers691
viewsA: How to leave Facebook comment plugin with 100% width?
According to this response from the SOEN, it is possible yes: Use the CSS: .fb-comments, .fb-comments iframe[style] {width: 100% !important;} EDIT: By the way this is a bug from facebook, recently…
-
10
votes1
answer1856
viewsA: ASP.NET MVC - Attribute you write in a View
Idea 1: One way to do it would be to add the attribute [UIHint("Cep")] in your model, and then create an editor-template with the name "Cep.cshtml" that renders exactly what you want. Idea 2:…
-
7
votes1
answer492
viewsA: How to get the generic type entity type from the top interface?
It is possible to know which is the type using reflection of type. var tipos = foo.GetType() .GetInterfaces() .Where(x => x.IsGenericType && x.GetGenericTypeDefinition() ==…