This file has been truncated, but you can view the full file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"runtime": "Net50", | |
"defaultVariables": "", | |
"documentGenerator": { | |
"fromDocument": { | |
"json": "{\r\n \"x-generator\": \"NSwag v13.11.3.0 (NJsonSchema v10.4.4.0 (Newtonsoft.Json v12.0.0.0))\",\r\n \"openapi\": \"3.0.0\",\r\n \"info\": {\r\n \"title\": \"Resource Demand Main Web API\",\r\n \"description\": \"Resource Demand Main Web API\",\r\n \"version\": \"v1\"\r\n },\r\n \"servers\": [\r\n {\r\n \"url\": \"https://localhost:5001\"\r\n }\r\n ],\r\n \"paths\": {\r\n \"/Projects/DetailExport\": {\r\n \"get\": {\r\n \"tags\": [\r\n \"Projects\"\r\n ],\r\n \"operationId\": \"Projects_DetailExport\",\r\n \"parameters\": [\r\n {\r\n \"name\": \"Id\",\r\n \"in\": \"query\",\r\n \"schema\": {\r\n \"type\": \"string\",\r\n \"format\": \"guid\",\r\n \"nullable\": true\r\n },\r\n \"x-position\": 1\r\n },\r\n {\r\n |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[FromQuery] attribute handles query parameters, i.e. key-value pairs coming after "?" in URI. [FromRoute] attribute handles | |
route parameters coming before "?" in URI, i.e. path parameters. | |
For example, if you configured route "orders/{id}", then "id" is your route parameter, and if some actual request is like | |
"orders/123?showHistory=true", then "showHistory" is your query parameter. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
IEnumerable describes behavior, while List is an implementation of that behavior. When you use IEnumerable, you give the compiler a chance | |
to defer work until later, possibly optimizing along the way. If you use ToList() you force the compiler to reify the results right away. | |
Whenever I'm "stacking" LINQ expressions, I use IEnumerable, because by only specifying the behavior I give LINQ a chance to defer evaluation and possibly optimize the program. Remember how LINQ doesn't generate the SQL to query the database until you enumerate it. | |
i.e deffered execution | |
- Non-Generic collections - These are the collections that can hold elements of different data types. It holds all elements as object type. | |
So it includes overhead of type conversions. | |
- Generic collections - These are the collections that can hold data of same type and we can decide what type of data that collections can hold. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<add key="aspnet:MaxJsonDeserializerMembers" value="2147483647" /> | |
Response.Write(new ScriptingJsonSerializationSection().MaxJsonLength); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int y = Nullable.Compare<DateTime>(DateTime.UtcNow, x); | |
if y=-1 means x is greater | |
if y=1 means x is lesser | |
if y=0 means equal |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
select f.*, | |
count(*) over ( | |
partition by title, uk_release_date | |
) ct | |
from films f; | |
select * | |
from ( | |
select f.*, | |
count(*) over ( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Pivot C# Array or DataTable: Convert a Column To a Row with LINQ | |
var data = new[] { | |
new { Product = "Product 1", Year = 2009, Sales = 1212 }, | |
new { Product = "Product 2", Year = 2009, Sales = 522 }, | |
new { Product = "Product 1", Year = 2010, Sales = 1337 }, | |
new { Product = "Product 2", Year = 2011, Sales = 711 }, | |
new { Product = "Product 2", Year = 2012, Sales = 2245 }, | |
new { Product = "Product 3", Year = 2012, Sales = 1000 } | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1.Create a cookie before writing the stream to Response. | |
2.Use JavaScript timer to check whether the value of cookie is set to true | |
3.If downloaded cookie is true, display a message that file download is successful and erase cookie | |
<script> | |
var timer; | |
function getCookie(name) { | |
var re = new RegExp(name + "=([^;]+)"); | |
var value = re.exec(document.cookie); | |
return (value != null) ? unescape(value[1]) : null; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"scripts": { | |
"ng": "ng", | |
"start": "ng serve --open", | |
"start-hmr": "ng serve --configuration hmr --source-map=false --hmr-warning=false", | |
"start-hmr-sourcemaps": "ng serve --configuration hmr --source-map=true --hmr-warning=false", | |
"build": "node --max_old_space_size=6144 ./node_modules/@angular/cli/bin/ng build --aot --deploy-url=dist/ --output-hashing all --watch", | |
"build-watch": "node --max_old_space_size=6144 ./node_modules/@angular/cli/bin/ng build --deploy-url=dist/ --output-hashing all --watch", | |
"build-stats": "node --max_old_space_size=6144 ./node_modules/@angular/cli/bin/ng build --dev --stats-json", | |
"build-prod": "node --max_old_space_size=6144 ./node_modules/@angular/cli/bin/ng build --prod --aot --deploy-url=dist/", | |
"build-ci": "ng build --prod --aot --output-path=prod/dist --deploy-url=dist/", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.IO; | |
using System.Linq; | |
using System.Security.Cryptography; | |
public class PasswordCryptoServiceProvider : IDisposable | |
{ | |
protected const string Base58Chars = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"; | |
private readonly SymmetricAlgorithm algorithm; |