Posts by Laerte • 22,243 points
249 posts
-
7
votes4
answers6237
viewsA: How does the "#include" directive work?
The directive #include, when executed, causes a copy of the file whose name is given between < and > to be included in the source code. For example, suppose we define the following macros and…
-
10
votes3
answers57329
viewsA: Format double with mile and decimal
Just use, the number 2 is the number of decimals. txtSomatorio.Text = somatorio.ToString("n2"); Upshot: 43.239,11
-
5
votes2
answers939
viewsA: Match jQuery function, how to get the cards
The method Match is not Jquery, is native to the Javascript language, I modified its regular expression to pick up the contents inside the brackets. var regex = /\S*(.*)\S*->\S*(.*)\[(.*?)\]/i;…
-
2
votes3
answers667
viewsA: What are these attributes in the properties?
[Obsolete("Não utilizar esse método.")] public void Metodo(); [Serializable] public class Classe(); [WebMethod] public static void Listar(); These names between keys above each method name or class…
-
4
votes2
answers4042
viewsA: Get property values of a class
You are passing only the type of the Object and not the Object, I would do as follows: public string[] ObterValoresPropriedades(Object Objeto) { var lista = new List<string>(); var p =…
-
2
votes1
answer188
viewsA: Format Textbox with date
You can use the function Substring: TxtDataForm.Text = table.Rows(0)("GraduateDate").ToString().Substring(0, IIf(table.Rows(0)("GraduateDate").ToString().Length > 10, 10,…
-
10
votes2
answers1398
viewsA: Returning a list using select new with LINQ
In the select new pass the type of the object you want to return in the list. var filial = (from f in base.EntityContext.vw_filial select new vw_filial { COD_FILIAL = f.COD_FILIAL, CGCCPF =…
-
3
votes1
answer988
viewsA: How do I remove the character limit of a URL by GET or POST
You can change this limit on the Web.Config by changing the values of the maxQueryString and maxUrl which is the "size" of the URL string, I get an example on the Web.Config: <configuration>…
-
1
votes3
answers108
viewsA: Vertical-align does not align <li>’s
Change the display of .headercontainer li for table-Cell. .headercontainer li{ display:table-cell; height:inherit; vertical-align:middle; } Example: http://jsfiddle.net/rhbogwx7/3/…
-
5
votes2
answers79
viewsA: Add CSS to the Grid Record
In the event Rowdatabound from your grid, you can use: if (e.Row.RowType == DataControlRowType.DataRow) { string decodedText = HttpUtility.HtmlDecode(e.Row.Cells[0].Text); e.Row.Cells[0].Text =…
-
15
votes4
answers7358
viewsA: How to jump to the next field using jQuery?
Explanation Using the method on jquery, passing the selector #table, I added a Handler, for when the event keyup is triggered by an input it performs my anonymous function. if(event.which == 13)…
-
13
votes4
answers7358
viewsQ: How to jump to the next field using jQuery?
How to move focus to the next field of a table using jQuery? I have a table with the fields Id, Name and Price, the price column is a text input. How to implement a feature for when the user presses…
-
5
votes2
answers69
viewsA: Problem with the font property
There is an order to be followed: font-style, font-Variant, font-Weight, font-size, line-height, and font-family., for property font is nothing more than a shortcut to set these properties in a…
-
4
votes4
answers3412
viewsA: How to take the value with getElement and assign to a variable?
This error is probably occurring because some input containing the "sum" class is valueless. You can do a check before, so it doesn’t occur anymore. function somaPesos() { var soma = 0; var itens =…
javascriptanswered Laerte 22,243 -
3
votes1
answer3295
viewsA: Selecting directory/directory in an input
There is an attribute called webkitdirectory, on the G+ page of Addy Osmani he explains better how it works, here a demo. <input type="file" multiple webkitdirectory id="pasta"/> I tested it…
-
1
votes2
answers57
viewsA: Using [Foreignkey(")] - MVC
The correct using is the: System.ComponentModel.DataAnnotations.Schema;
asp.net-mvcanswered Laerte 22,243 -
35
votes2
answers9074
viewsQ: What is the difference between mock & stub?
In what situations should be used? What’s the difference between them?
-
6
votes2
answers5369
viewsA: Communication with Pagseguro
Felipe, You can use the Pagseguro Testserver for testing purposes. To know when the user made the payment there is the return URL (callback) that you configure that will be the address that he must…
asp.net-mvcanswered Laerte 22,243 -
2
votes4
answers1684
viewsA: Dynamically check which attributes of a Model have been changed?
Since I didn’t find anything ready on the internet, with the help of a friend, we created a class and a generic method to do this: public class AlteracaoLog { public string ObjName { get; set; }…
-
5
votes4
answers1684
viewsQ: Dynamically check which attributes of a Model have been changed?
I am developing an ASP.NET MVC 4 application and need to save the log of each change made in a Model object. Is there any native method or implementation already known to do this? Example: public…
-
22
votes3
answers10939
viewsQ: How does the C#lock work?
I was just looking at an article by MSDN, but it was not clear why to use this. class Account { decimal balance; private Object thisLock = new Object(); public void Withdraw(decimal amount) { lock…
-
8
votes1
answer9490
viewsQ: What is the difference between TRUNCATE and DELETE + CHECKIDENT?
Both perform the same action (delete + reset the PK value), but in performance what is the difference between them? Example: When you have more records it is recommended to use which form? TRUNCATE:…
-
3
votes1
answer720
viewsA: Insert selected records into another table
A solution would be to use INSERT with SELECT. Example: INSERT INTO banco.tabela-destino (campo1, campo2, campo3...) SELECT campo1,campo2,campo3... FROM banco.tabela-origem; Note that the fields are…
-
1
votes3
answers1701
viewsA: Return of SQL SELECT
Douglas, try this: SELECT 1 FROM USUARIOS WHERE LOGIN = '$LOGIN' SELECT 1 it 1 if there is a record instead of the table fields, it is often used in your case, that you need to verify the existence…
-
16
votes2
answers958
viewsQ: What is the difference between: Urlencode, Escapeuristring and Escapedatastring
And which of the three is equivalent to encodeURIComponent javascript? String: 'apostrophe' "double quotes" Stackoverflow! string teste = "'apóstrofo' \"aspas duplas\" StackOverflow!";…
-
1
votes2
answers1799
viewsA: jQuery Mask Plugin does not format the number properly
I found the solution! I added Stringformat, in the Textboxfor: <div class="campo"> @Html.LabelFor(model => model.ValorPadrao) <br /> @Html.TextBoxFor(model => model.ValorPadrao,…
-
0
votes2
answers1799
viewsQ: jQuery Mask Plugin does not format the number properly
I am working on a MVC4 project, the mask works correctly when saved, but when returning the database data the plugin shows incorrect data if the value ends in 0. Data example: 99.000,00, when I go…
-
7
votes1
answer204
viewsQ: What does the "OR" operator do in an Enum?
What the logical operator | (or) does so in that Enum? public enum Status { Running = 1, Inactive = 2, Error = Inactive | Running }
-
14
votes2
answers3311
viewsQ: What is the difference between multi-layer and multi-tier applications?
What is the difference between multi-layer and multi-tier applications? One depends on the other?
software-architectureasked Laerte 22,243 -
27
votes4
answers5927
viewsQ: Why split layers? What are the benefits of a multi-layered architecture?
There are n types of architectures that use layer separation, an example: Model-view-controller (MVC). How creating multiple layers can help my application? What are the advantages of doing this?…
-
7
votes2
answers2661
viewsQ: What are the advantages and disadvantages of using transaction explicitly
Beyond security what is the advantage of using explicit transaction? In which situations is recommended?
-
5
votes2
answers765
viewsA: Tips for turning procedural code into object-oriented?
I participated in a project recently where I had to port a desktop system programmed in VB6 to ASP.NET C# OO (3 layers). My analysis was as follows: Understand how the system (and each page of it)…
-
1
votes2
answers2131
viewsA: Embed Instagram profile
Officially, it is only possible to embed images and videos, not from the entire profile as you want.
-
4
votes2
answers3360
viewsQ: Best practices for creating and reviewing procedures
What is the best way to create, change and evaluate procedures? Where work we do of the following flow: We check if the trial exists if we delete it and then create again. To Verse I use a header…
-
17
votes2
answers28085
viewsQ: What are schemas? What are the advantages of using it?
In which situations your use is recommended?
-
1
votes1
answer2605
viewsA: Change button text "Previous" and "Next" in Datatables - Tabletools
From what I read in documentation: $('#example').dataTable( { "language": { "paginate": { "previous": "Anterior", "next": "Próximo" } } } ); Sources here and here…
answered Laerte 22,243 -
44
votes2
answers21131
viewsQ: What does branch, tag and trunk mean?
What they mean and what best practices to use them?
-
35
votes5
answers27254
viewsA: Clear browser caching with Javascript
It’s not possible, and if it were, it would be a massive security breach, you thought you could clear the cache of anyone who accessed your page? What you can do is indicate to the browser do not…
-
3
votes3
answers3487
viewsQ: What are the ways to measure a programmer’s knowledge?
Just as there are techniques to measure productivity, there are techniques or ways to measure a programmer’s knowledge (both in a specific technology and in general)? If yes, which ones? In…
methodologyasked Laerte 22,243 -
21
votes7
answers18353
viewsQ: Why is COBOL still the preferred language in the business world?
As you all know COBOL is widely used by financial institutions, where only the interface is done using current languages like Java. The cost to maintain mainframes is large, but the migration to a…
-
7
votes1
answer4965
viewsQ: Transactionscope does not transact
I’m trying to use the TransactionScope in C#, I am performing the tests with local bank, but every time I try to execute some method it returns me this Exception: Partner transaction manager…
-
59
votes6
answers10591
views -
8
votes6
answers7191
viewsA: How to put default (default) arguments in a Javascript function?
Thus: function Retorno(x){ if(x == 0) return x; x = x || 10; // Valor de x caso existir ou 10 que é o padrão return x; } I recommend reading of that answer of Miguel Angelo which better explains the…
-
2
votes2
answers502
viewsA: How to make a Textbox field only receive integer values on VB6?
At the event Change of Textbox, check if the entered value is number, if it is not then assign the old value. Dim textval As String Dim numval As String Private Sub TextBox1_Change() textval =…
visual-basic-6answered Laerte 22,243 -
8
votes2
answers129
viewsQ: Get user-created methods
I have a method that lists the methods that a given object has, I want to take only the methods created by the user, in this case: Add and Subtract. What this method returns to me: Generic Class…
-
6
votes1
answer5290
viewsQ: Method that returns a class
I am trying to create a method that takes a string and returns an instance of the class with the name passed, example: "Calculator", will return me an instance of the class "Calculator" (If it…
-
6
votes3
answers9393
viewsA: Set CSS according to browser
Yes it is possible, this "technique" has a name: CSS Hack, basically it abuses the rendering errors of the browsers, because they are properties written in a wrong way just to not work but the…
-
9
votes1
answer8430
viewsA: Make git go through proxy
Exchange the @ of your password by Percent-encoding his: %40, example: git config --global http.proxy http://username:senh%40nov%[email protected]:3128…
-
35
votes7
answers30495
viewsA: How to differentiate phone types
The Numbering Plan is the way in which the numbers of telecommunications services for public use are organised. The table below has the relationship between the numeric ranges of landline and mobile…
-
11
votes2
answers1282
viewsA: What does <<< EOH in PHP do?
This is a method called HEREDOC is an alternative to not having to use double quotes to write in multiple lines. See more here is equivalent to @"Texto" of C# Article of Wikipedia about: "is a file…