Skip to content

Instantly share code, notes, and snippets.

View Vladimir-Novick's full-sized avatar

Vladimir Novick Vladimir-Novick

View GitHub Profile
@Vladimir-Novick
Vladimir-Novick / Startup.cs
Last active October 16, 2017 06:36
Add Json Options to AspNetCore2 Application, Configuration.
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using Microsoft.AspNetCore.Http;
using System;
using Microsoft.AspNetCore.ResponseCompression;
using System.IO.Compression;
@Vladimir-Novick
Vladimir-Novick / AspNetCore2APP.csproj
Created October 16, 2017 06:29
AspNetCore2 Server Garbage Collection setting
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>netcoreapp2.0</TargetFramework>
<AssemblyName>AspNetCore2APP</AssemblyName>
<ServerGarbageCollection>true</ServerGarbageCollection>
<ConcurrentGarbageCollection>true</ConcurrentGarbageCollection>
<OutputType>Exe</OutputType>
</PropertyGroup>
<ItemGroup>
@Vladimir-Novick
Vladimir-Novick / Publish NET CORE 2 Application to Ubuntu 16.04 and Windows_Server
Last active June 4, 2018 09:51
Publish NET CORE 2 App to Ubuntu 16.04, and Windows_Server without install NET CORE 2 FRAMEWORK
ubuntu.16.04-x64
--------------------
dotnet publish -c Release -r ubuntu.16.04-x64
Release_Windows_Server_2008_R2
---------------------------------------------
dotnet publish -c Release -r win7-x64
Release_Windows_Server_2012_R2
-------------------------------------------
@Vladimir-Novick
Vladimir-Novick / Kestrel_Multithreading
Created October 17, 2017 08:41
Kestrel Server multithreading configuration to AspNetCore2 web application
var host = new WebHostBuilder()
.UseKestrel()
.UseLibuv(options =>
{
options.ThreadCount = 10;
})
.UseUrls(url)
.UseContentRoot(Directory.GetCurrentDirectory())
.UseStartup<Startup>()
.Build();
@Vladimir-Novick
Vladimir-Novick / AmazonS3FileReader
Last active September 20, 2020 07:24
Amazon S3 File Downloader ( C# Class )
public class AmazonS3FileReader
{
private AmazonS3Client GetAmazonS3Client()
{
AmazonS3Client _client = new AmazonS3Client(
HttpFileReaderConfig.GetConfigData.AmazonS3AccessKey,
HttpFileReaderConfig.GetConfigData.AmazonS3SecretKey,
new AmazonS3Config { ServiceURL = HttpFileReaderConfig.GetConfigData.ServiceURL }
);
return _client;
Currently almost all of our components implement componentWillMount
to trigger some operation in reaction to select page:
Example:
componentWillMount() {
// This method runs when the component is first added to the page
let startDateIndex = parseInt(this.props.match.params.startDateIndex) || 0;
this.props.requestTaskItems(startDateIndex);
}
The full solution for the issue of the page reloading will be:
private renderButtons() {
return <div className="buttonDiv">
<button type="button" className="btn btn-default" onClick={this.dataRefrech}>Refresh</button>
<button type="button" className="btn btn-default btn-right" onClick={this.handleClick}>Remove From Queue</button>
</div>;
}
handleClick() {
var array = [];
var elements = document.getElementsByClassName('checkTask');
for (var i = 0; i < elements.length; i++) {
var p = elements[i].getAttribute('checked');
if (p === 'checked') {
let fetchQue = fetch(RunQueRequest)
.then((response) => response.json())
.then((responseJson) => {
responseJson.map((QueItem: any) => {
var Key = "row_chk" + QueItem.Key;
var rowElement = document.getElementById(Key);
if (rowElement !== null) {
let parent = rowElement.parentNode;
var p = parent as HTMLElement;
p.removeChild(rowElement);
public class Converter
{
public static String EncodingBase64(String str)
{
byte[] bytes = Encoding.UTF8.GetBytes(str);
string base64 = Convert.ToBase64String(bytes);
return base64;
}
public static String DecodeFromBase64(String str)