Thread pools on the JVM should usually be divided into the following three categories:
- CPU-bound
- Blocking IO
- Non-blocking IO polling
Each of these categories has a different optimal configuration and usage pattern.
using System; | |
using System.Linq.Expressions; | |
using System.Reflection; | |
using ServiceStack.Model; | |
using ServiceStack.OrmLite; | |
using ServiceStack.OrmLite.Support; | |
namespace YourNamespace | |
{ | |
public static class LeftOuterJoinExtensions |
static Task<TResponse> Execute<TRequest, TResponse>(this Channel channel, TRequest request, string serviceName, string methodName, | |
CallOptions options = default, string? host = null) | |
where TRequest : class | |
where TResponse : class | |
=> Execute<TRequest, TResponse>(new DefaultCallInvoker(channel), request, serviceName, methodName, options, host); | |
static async Task<TResponse> Execute<TRequest, TResponse>(this CallInvoker invoker, TRequest request, string serviceName, string methodName, | |
CallOptions options = default, string? host = null) | |
where TRequest : class | |
where TResponse : class | |
{ |
Create React App does not provide watching build mode oficially (#1070).
This script provides watching build mode for an external tool such as Chrome Extensions or Firebase app.
Create a React app.
Put the script into scripts/watch.js
.
public class ThrottlePlugin : IPlugin | |
{ | |
/// <param name="redisHost">host name</param> | |
/// <param name="redisPort">port</param> | |
/// <param name="redisPassword">password</param> | |
public ThrottlePlugin(string redisHost, int redisPort, string redisPassword = null) | |
{ | |
_redisClient = new RedisClient(redisHost, redisPort, redisPassword); | |
} |
this.GlobalRequestFilters.Add((httpReq, httpResp, requestDto) => | |
{ | |
var header = httpReq.Headers["Authorization"]; | |
if( header.IsNullOrEmpty() ) { | |
httpResp.StatusCode = (int)HttpStatusCode.Unauthorized; | |
httpResp.EndRequest(); | |
} | |
try |
exec { & $tools_dir\ildasm.exe /NOBAR /OUT="$dist_dir\net40\AutoMapper.il" "$dist_dir\net40-un\AutoMapper.dll" } | |
exec { & $framework_dir\ilasm.exe /QUIET /KEY="$source_dir\AutoMapper.snk" /DLL="$dist_dir\net40\AutoMapper.dll" /RESOURCE="$dist_dir\net40\AutoMapper.res" "$dist_dir\net40\AutoMapper.il" } |
public static void BulkInsertNpgsql<T>(this IDbConnection dbConn, IEnumerable<T> list, IEnumerable<string> insertFields = null) | |
{ | |
if (list == null) return; | |
if (list.Count() < 1) return; | |
var objWithAttributes = list.FirstOrDefault(); | |
var modelDef = OrmLiteConfig.GetModelDefinition(objWithAttributes.GetType()); | |
if (insertFields == null) insertFields = new List<string>(); |
HEY: I've turned this into a blog post, which is a little more in depth.
🚨 https://eev.ee/blog/2016/06/04/converting-a-git-repo-from-tabs-to-spaces/ 🚨
#1 JavaScript | |
#2 Ruby | |
#3 Java | |
#4 Shell | |
#5 Python | |
#6 PHP | |
#7 C | |
#8 C++ | |
#9 Perl | |
#10 CoffeeScript |