Posts by Vinícius Lima • 5,059 points
106 posts
-
1
votes1
answer30
viewsQ: How does the Dbcontext startup work in the Entity Framework Core?
How to initialize an object DbContext works? The ways I always see is by injection of dependency or using the using. What would happen if I initialized it as a normal object? (Follow an example…
-
10
votes2
answers289
viewsQ: When to use record or class on C#?
One of the novelties of C# 9 are the record types, I saw that one of the biggest differences between them and the classes are the methods .ToString() and .Equals() who has a different behavior. But…
-
4
votes1
answer63
viewsQ: Can the use of many variables in the CSS affect page performance?
The use of many variables in CSS can end up greatly degrading the page’s performance? It is possible to say more or less the use of how many would be necessary to begin to bring a negative impact?…
-
0
votes2
answers1870
viewsA: How to pass input value via post on Asp.net core Razor
When sending a POST, GET, etc. request, you should name the input with the parameter or property name. For example: <form method="post"> <input name="id" /> <input name="example"…
-
4
votes1
answer823
viewsQ: What is the purpose of Concurrencystamp and Securitystamp in ASP.NET Identity?
The summary of both properties in the entity IdentityUser are in English: Concurrencystamp: A Random value that must change Whenever a user is persisted to the store. Translating would be something…
-
3
votes1
answer320
viewsA: What is this and when and how to use it?
The this is a keyword that references the object/instance of the current class. public class Example { private string str; public void Stack(int a, string b) { this.str = b; // Neste exemplo, você…
c#answered Vinícius Lima 5,059 -
5
votes2
answers57
viewsA: Initializing Array from a new class
Apparently your problem is that you did not initialize the "Array", to solve you could initialize it before assigning some value: bClass cVar = new bClass(); cVar.bfield = new bfield[] { new aClass…
-
2
votes1
answer96
viewsA: Force a page title rewrite
You can do this using Javascript or jQuery, but it would be better if you chose to edit directly on ./includes/header.php. Javascript: document.title = 'Novo título'; jQuery: $('title').text('Novo…
-
0
votes2
answers40
viewsA: Error handling hours in mysql
You can do it this way: // (23 horas e 30 minutos + 90 minutos) / (24 horas) TIME((ADDTIME(TIME('23:30:00'), SEC_TO_TIME(90 * 60))) % (TIME('24:00:00'))); Being in your case, as you reported in the…
-
8
votes2
answers695
viewsQ: What is ASP.NET Core Blazor?
Looking at the list of novelties found in Visual Studio, I came across something talking about ASP.NET Core Blazor, and apparently there’s almost nothing talking about, I found very little material,…
-
5
votes3
answers1618
viewsA: Encoding string conversion
You can do this in a very simple way: Encoding.UTF8.GetString(Encoding.Default.GetBytes("Cinto De Segurança")); Use the namespace: System.Text. using System.Text; According to this answer in Soen,…
-
3
votes1
answer790
viewsQ: How to do Semantic Versioning (Semver) with GIT?
One question that I’ve always had and gives me a lot of headache is about how I should do Semantic Versioning with GIT. I should take into consideration the commit, one "release" of the project, or…
-
14
votes1
answer497
viewsQ: Should I use the ushort, uint and ulong types whenever the number is equal to or greater than 0?
Is it good practice or is there something from Microsoft recommending the use of ushort, uint and ulong whenever I am sure that the value will be equal to or greater than 0? I can gain some…
-
1
votes2
answers205
viewsA: How to return hexadecimal color randomly
Complementing the reply by @Bacco with the doubt of your comment. You can get again the red, green and blue as follows: $hex: #FAFEF0; red($hex); // 250 green($hex); // 254 blue($hex); // 240 The…
-
4
votes3
answers3627
viewsA: Format a string for phone format
You can do it this way: long.Parse("49988070405").ToString(@"(00) 00000-0000"); // (49) 98807-0405 Another example, using extensions: using System; public static class Program { public static void…
c#answered Vinícius Lima 5,059 -
1
votes1
answer301
viewsA: How to display a message in a clean <div></div!
If what you want is to display the PHP variable message $msg, you can do it two very simple ways: Short: <div class="mensagem"><?= $msg ?></div> Traditional: <div…
-
1
votes1
answer357
viewsQ: What is "Asp-fallback" for in ASP.NET MVC, Razor Pages?
I see some files like lines similar to this: <script src="https://ajax.aspnetcdn.com/ajax/jquery/jquery-2.2.0.min.js" asp-fallback-src="~/lib/jquery/dist/jquery.min.js"…
-
12
votes5
answers3081
viewsQ: How to decide between using for or foreach?
When should I choose between using the for or foreach? They both do pretty much the same thing, and I always wonder if I’m using the "correct"... My doubt increases when people say to use the for…
-
13
votes5
answers453
viewsQ: How to separate "words" in Camelcase in C#?
How can I separate "words" into Camelcase using hyphen for example? String: string example = "CamelCase"; // CamelCase para: // Camel-Case and enumerator: enum Example { CamelCase }…
-
2
votes1
answer104
viewsQ: Why does adding a variable, property, method, etc. to a string work?
When I add a variable, property, method, enumerator, etc. into a string, it works, even though I’m not calling the method ToString() for example. Example with type and integer: var example =…
-
11
votes3
answers3647
viewsQ: What are the differences between a source editor, text editor and an IDE?
What’s the difference between a source editor, a text editor and an IDE? People claim that Visual Studio Code is a code and not an IDE. I really see that the difference between VS Code and VS is…
-
0
votes1
answer37
viewsA: How do I make an event happen on my PHP site only on Thursdays?
You can do this in many ways. The simplest way I know would be: // Hora de abertura do site. $openHours = new DateTime("09:00:00"); // Hora de fechamento do site. $closeHours = new…
phpanswered Vinícius Lima 5,059 -
6
votes2
answers3207
viewsQ: What are the differences between ASP.NET MVC and ASP.NET Razor Pages?
What are the differences and limitations between ASP.NET MVC and ASP.NET Razor Pages? I was very curious, because apparently the Razor Pages use the MVC standard, but without the need to use a…
-
1
votes1
answer274
viewsQ: How to use NPM and Yarn in ASP.Net Core?
I’m having trouble using Yarn/NPM in ASP.Net Core. I am installing packages as follows: (Example installing Jquery) Yarn: yarn add jquery NPM: npm install jquery Everything normally occurs, the…
-
2
votes2
answers1059
viewsQ: How important is the branch in versioning?
Because creating branches is important in software versioning, rather than just using "master" (in large, medium, small or even personal applications)? What advantages do I have in using them? A…
-
-1
votes1
answer72
viewsQ: HTML vs markup auxiliaries
Apparently HTML and markup helpers can perform the same functions, like this example I found in microsoft documentation: HTML auxiliaries @using (Html.BeginForm("Register", "Account",…
-
1
votes1
answer301
viewsQ: Is coding a URL important?
Most languages have methods to encode and decode a URL, as in the case of C# System.Net.WebUtility.UrlEncode(string value) and System.Net.WebUtility.UrlDecode(string encodedValue). I realized that…
-
6
votes1
answer473
viewsA: Doubt about DOCTYPE and HTML tags
You must change it, the tag <!DOCTYPE html> indicates to the browser that the HTML document should be read as a HTML5, just as it is documented in W3C. @Maniero answered a question about "HTML…
-
2
votes1
answer124
viewsQ: Dictionary<string, string> or Namevaluecollection?
What’s the difference in using Dictionary<string, string> and NameValueCollection? I researched, but only found in English in the same Sopt, I used the translator, but the translation became…
-
1
votes1
answer279
viewsQ: How to pass and traverse an anonymous object in a method
How can I pass an anonymous object to a method, and then traverse it? What I’m trying to do is this: public static string QueryStringToUrl(string url, Dictionary<string, string> query) { var…
-
2
votes2
answers545
viewsQ: Comments on JSON in Visual Studio
JSON does not support comments, but in Visual Studio (2017 to be more specific, my version) I add comments and do not present any error, but when I open the file in Visual Studio Code, the following…
-
0
votes1
answer296
viewsA: Quotation marks exiting in incorrect JSON format!
I found the answer in an English OS question: https://stackoverflow.com/questions/9331195/json-net-serialize-c-sharp-object-to-json-issue Using @Html.Raw() I can get the exit right without problems.…
-
0
votes1
answer296
viewsQ: Quotation marks exiting in incorrect JSON format!
I’m creating a dictionary for JSON on Razor Pages, but the quotation marks ("), are coming out as " _Layout.cshtml (UTF-8) ... <body> ... <script type="application/ld+json">…
-
1
votes1
answer439
viewsQ: What is the purpose of "ASP.Net" folders?
In the Visual Studio it offers me the option of "Add ASP.NET Folder". What would their purposes be? If possible I would like you to talk at least a little about each one.…
-
0
votes2
answers615
viewsQ: How to play something similar to CSS in Windows Form?
I would like to make a program with the same appearance/style as the site, but in Windows Form CSS does not work because it is a Web technology. So how could I do something like that?
-
3
votes1
answer96
viewsQ: How to create variables in C# in the same way as in PHP?
You can use variable variables or something similar in C# as in PHP for example? $example = "etc.."; $var = "example"; // variáveis variáveis echo $$var; // etc... echo ${$var}; // etc... If not…
-
0
votes2
answers59
viewsQ: How do I share information on my website with others?
I have 2 sites, the first that has the information and the second that wants to take this information, which in case would be a kind of articles. Articles contain title, image, description, tags,…
-
3
votes1
answer253
viewsQ: How to calculate days, ignoring the hours?
How can I calculate if spent 1 day ignoring the hours. Explaining, it would be more or less like this: I have a date 2017-09-09 11:45:20, normally it would have been a day when the 11:45 the other…
-
0
votes1
answer57
viewsQ: Can creating multiple sessions affect user performance?
My site creates named sessions for each page to be used in requests and stores unique tokens generated each time the page is accessed and other data. Example: $_SESSION['RSD']['page_username_id'] =…
-
0
votes2
answers398
views -
3
votes2
answers1065
viewsQ: How to confirm that the request was made through the website securely
Good would like to know if there is any way for me to confirm that the request really came from the site and not from outside, and is also being made by the page with the user action. I tried to…
-
0
votes2
answers398
views -
2
votes1
answer93
viewsQ: How to position Ivs in Tumblr style
How can I position the Divs this way? Remembering that it does not position in vertical line, always in horizontal it goes kind of fitting.…
-
6
votes2
answers875
viewsQ: How to load Facebook content?
How does Facebook do this with loading your page? It uploads content gradually and not all at once like most websites, Stackoverflow is an example that loads once and for all. What do you call this…
-
2
votes1
answer44
viewsQ: Instance declared in variable that then receives a new value
I have the following code: $config = new \Skreth\System\Config(dirname(__DIR__) . '/config/config.ini'); $config = $config->getProperties(); I create a declared instance in the variable $config…
-
12
votes1
answer717
viewsQ: What are the main differences and advantages between PHP and Hack languages?
I see that the syntax of both are quite similar, but surely they have their differences, after all they are not one. What are your differences? I’ll put some items I think are important for the…
-
1
votes1
answer822
viewsQ: Which is more performatic - foreach or array_map?
Which of both are more performative, foreach? foreach ($example as $val) $ex[] = str_replace(...); or $ex = array_map(function ($val) { return str_replace(...); }, $example); I believe it is the…
-
2
votes1
answer57
viewsQ: How to document parameters received by the "func_get_args" function?
How can I be documenting parameters that are received through the function func_get_args? The reason is that you can pass several parameters to the function with the same purpose! /** * Gets a smart…
-
1
votes3
answers97
viewsQ: Check the existence of the values of one array in the Keys of another
I have two arrays: $Keys Array ( [0] => Array ( [0] => {3} [1] => {1} [2] => {2} [3] => {0} [4] => {4} [5] => {5} ) ); $properties Array ( [0] => Array ( [0] =>…
-
2
votes1
answer620
viewsQ: How to get the line number in PHP?
How can I be getting the line number on which the method was executed for example? class.php Class Example { function methodExample() { echo __LINE__; } } index php. include "class.php";…