Posts by talles • 11,434 points
64 posts
-
9
votes3
answers7413
viewsA: How to customize error pages on an ASP.NET MVC system?
There is a special view for these cases, the Shared/Error.cshtml (has to be this name). Just turn on the customErrors of its application in Web.config: <system.web> <customErrors mode="On"…
-
33
votes11
answers8299
viewsA: Should I write my program in English or Portuguese?
Describing certain actions in English is much easier, ex: setName(string name) Already in Portuguese: setNome, mixture English with Portuguese. setarNome, neologism in the word set. atribuirNome, a…
-
5
votes4
answers512
viewsA: Debug applications in Nodejs
Besides Node’s Debugger recently launched the Node.js Tools for Visual Studio. the add-on looks promising and, in my opinion, Visual Studio is one of the best IDE for thresh that there are...…
-
11
votes2
answers4446
viewsA: How to package a Node.js project into an executable?
Currently there doesn’t seem to be many options for distributing a binary standalone of a Node.js application. One of them, and practically unique, option is the Nexe. Does just what you want, but…
-
39
votes3
answers2867
viewsA: Capitalizing on C#names
One way is by using method Totitlecase to capitalize on words in C#. CultureInfo.CurrentCulture.TextInfo.ToTitleCase("JOSÉ DA SILVA".ToLower()); // retorna "José Da Silva" The call ToLower the…
-
12
votes2
answers821
viewsA: In Python, how to get the default temporary directory?
tempfile.gettempdir() returns the directory used as a temporary directory. import tempfile print tempfile.gettempdir()…
-
17
votes6
answers34688
viewsA: How to send emails only with HTML5 basics
Sending is not possible with HTML5 and Javascript only. To send an email you need an SMTP server. This task is normally delegated to the web server (server-side), but as you explained you did not…
-
10
votes4
answers2543
viewsA: Insert paragraphs from a JSON file into a DIV
What is the most correct method to use? More correct in what sense? Performance? Assertiveness? Readability? Finally, one usually uses a traditional replace of Javascript (as seen here, here and…
-
3
votes4
answers10238
viewsA: Problem using paragraphs in JSON file
Just one \n simple in the final json string. >>> var pessoa = { nome: 'James Bond', apresentacao: 'Meu nome é Bond...\n\nJames Bond.' }; >>> console.log(pessoa.apresentacao); Menu…
-
3
votes4
answers66720
viewsA: What is the correct way to make a regular Javascript substitution for all occurrences found?
The most correct (and recommended) way is how @Lias responded, via regex. As a curiosity, the Firefox engine (Spidermonkey) implements an extra parameter in the method replace called flags who…
-
16
votes3
answers5937
viewsA: How do I see which commits change a certain file?
git log <arquivo> To make git understand and follow the file even when renamed: git log --follow <arquivo>…
-
36
votes4
answers28968
viewsA: What is the most appropriate way to concatenate strings?
First of all, what is literal constant? Literal constant is the representation of a value of a string in the source code, example: "isto é uma constante literal" Another example: var str = "foo"; In…
-
9
votes3
answers2138
viewsA: How to perform unit tests on nodejs
Assert One of the Node modules is the assert. It is not a complete tool for unit testing but it is possible to use it without any additional to perform its tests. Methods fail: Compares two values…
-
21
votes8
answers48170
viewsA: How to calculate a person’s age in SQL Server?
The fairest way I know is: SELECT FLOOR(DATEDIFF(DAY, DataNascimento, GETDATE()) / 365.25) This way is more accurate than using one-year hours (as @rodrigorgs suggested) because the time of day the…