what difference between make(chan int, 1) and make(chan int) in golang? 【代码】what difference between make(chan int, 1) and make(chan int) in golang?
in golang, how many usages are there for pointer? and can you provide example for each of them? ``go*ptr = 42value := 0``````go// fields``````gocount intc.count++``````gonum := 42```
ACID的解释 I有read uncommitted, read committed, repeatable read (开启事物后,锁住第一次查询的数据行,不许读写更新操作。但是管不住插入行), serialization(加了范围锁,阻止整个范围其他事物再读写更新)
Java的private, default, protected public的变量访问范围 对于这四个变量,private和public都很好记住。对于default和protected,总结如下:可以看到下面红色的字段是不能访问的。所以网上的我加了红色的部分
CSV file转成各个字段都加双引号 $path = "C:\tmp\112.csv"$data = Import-Csv -Path $Path$ColNames = ($data[0].psobject.Properties).name$header = ""foreach($column in $ColNames){ if(![string]::IsNullOrEmpty($header)){ $header = $header + "," $header = $header + $column
快速排序C#代码 using System;namespace ConsoleApp12{ class Program { static void Main(string[] args) { Console.WriteLine("Hello World!"); int[] aa = new int[] {3,12,8,7,4,3,89,1 }; QuickSort(aa, 0, aa.Length .
leetcode :https://leetcode.com/problems/container-with-most-water/ public static int MaxArea(int[] b) { if (b.Length <= 1) { return 0; } int max = 0; int l = 0; int r = b.Length-1; while (l < r) .
求字符串中最长的回文字符串 using System;namespace ConsoleApp11{ class Program { static void Main(string[] args) { Console.WriteLine("Hello World!"); GetHuiWen2("cbbd"); } public static int GetHuiwen(string s, int l.
Add two numbers for leetcode Loading...no more words, see codes:using System;namespace ConsoleApp10{ class Program { public class Node { public int data; public Node next; } //approach1: recursive public
Redis: requirepass and masterauth version 6.2.1when I only set requirepass in redis.conf, and create redis cluster, the following error is raised in log:Unexpected reply to PSYNC from master: -NOAUTH Authentication required.so I add requirepass and masterauth in redis.conf. no erro.
在构造函数还没有被执行的情况下,它的其他函数被执行了。 public class Class2 : IClass1 { public string cc = null; public Class2() : base("redis") { sssss = "1111"; cc = "cc"; } public override void SetConfig() { test();...
ReaderWriterLockSlim vs ReaderWriterLock 看MS official doc, we can know the performance Slim is better than ReadWriteLock.但是ReaderWriterLockSlim的使用场景也有限制比如这个TryEnterUpgradableReadMode, 这个Upgradable mode, 只能一个线程 in this mode,有点鸡肋(当然也有他的使用场景,比如只有一个线程可能写,其他线程只有读,可能好用)。...
ReaderWriterLock当获取Writelock时,是等到其他的ReaderLock都释放了,才能拿到WriteLock. 看代码:using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Threading.Tasks;using System.IO;using System.Reflection;using System.Threading;namespace ConsoleApplication23{ class Program { p
Kubernet ConfigMap读书笔记 1. 使用configmap的限制条件 a. ConfigMap必须在pod之前创建 b. ConfigMap也可以定义为属于某个Namespace.只有处于相同namespace中的Pod可以饮用它 c. ConfigMap中的配置管理还未能实现 d. kubelet...
泛型和多态的比较 比如T test<T>(T info){return T;}public class interface IInfo{}IInfo test(IInfo info) {return info;}对于这两个方法,下面接口的运行效率更高,因为泛型其实是会多生成若干份相似的代码。
aysnc await deadlock for UI applicaiton and asp.net application. https://blog.stephencleary.com/2012/07/dont-block-on-async-code.html