diff options
-rw-r--r-- | c++.html.markdown | 4 | ||||
-rw-r--r-- | ca-es/go-ca.html.markdown | 2 | ||||
-rw-r--r-- | cs-cz/go.html.markdown | 2 | ||||
-rw-r--r-- | fi-fi/go-fi.html.markdown | 2 | ||||
-rw-r--r-- | go.html.markdown | 2 | ||||
-rw-r--r-- | zfs.html.markdown | 18 | ||||
-rw-r--r-- | zh-cn/bc-cn.html.markdown | 96 |
7 files changed, 111 insertions, 15 deletions
diff --git a/c++.html.markdown b/c++.html.markdown index 6d039c33..663fa45e 100644 --- a/c++.html.markdown +++ b/c++.html.markdown @@ -263,10 +263,10 @@ std::string& fooRef = foo; // This creates a reference to foo. fooRef += ". Hi!"; // Modifies foo through the reference std::cout << fooRef; // Prints "I am foo. Hi!" +std::cout << &fooRef << '\n'; // Prints the address of foo // Doesn't reassign "fooRef". This is the same as "foo = bar", and // foo == "I am bar" // after this line. -std::cout << &fooRef << '\n'; // Prints the address of foo fooRef = bar; std::cout << &fooRef << '\n'; // Still prints the address of foo std::cout << fooRef << '\n'; // Prints "I am bar" @@ -840,7 +840,7 @@ void doSomethingWithAFile(const std::string& filename) // manage the lifetime of the object being pointed to without ever needing to explicitly delete // the object. The term itself simply describes a set of pointers with the // mentioned abstraction. -// Smart pointers should preferred over raw pointers, to prevent +// Smart pointers should be preferred over raw pointers, to prevent // risky memory leaks, which happen if you forget to delete an object. // Usage of a raw pointer: diff --git a/ca-es/go-ca.html.markdown b/ca-es/go-ca.html.markdown index dc6a6748..bdfd498f 100644 --- a/ca-es/go-ca.html.markdown +++ b/ca-es/go-ca.html.markdown @@ -460,5 +460,5 @@ Un altre gran recurs per aprendre Go és Go Mobile afegeix suport per plataformes mòbils (Android i iOS). Es poden escriure aplicacions mòbils o escriure llibreries de paquets de Go, que es poden cridar des de Java (android) i Objective-C (iOS). -Comproveu la [Go Mobile page](https://github.com/golang/go/wiki/Mobile) per +Comproveu la [Go Mobile page](https://go.dev/wiki/Mobile) per més informació. diff --git a/cs-cz/go.html.markdown b/cs-cz/go.html.markdown index 18880a3b..b2fec30f 100644 --- a/cs-cz/go.html.markdown +++ b/cs-cz/go.html.markdown @@ -427,5 +427,5 @@ tak se podíváte na dokumentaci. Dalším dobrým zdrojem informací je [Go v ukázkách](https://gobyexample.com/). Go mobile přidává podporu pro Android a iOS. Můžete s ním psát nativní mobilní aplikace nebo knihovny, které půjdou -spustit přes Javu (pro Android), nebo Objective-C (pro iOS). Navštivte [web Go Mobile](https://github.com/golang/go/wiki/Mobile) +spustit přes Javu (pro Android), nebo Objective-C (pro iOS). Navštivte [web Go Mobile](https://go.dev/wiki/Mobile) pro více informací. diff --git a/fi-fi/go-fi.html.markdown b/fi-fi/go-fi.html.markdown index c0b92d2f..6a966e46 100644 --- a/fi-fi/go-fi.html.markdown +++ b/fi-fi/go-fi.html.markdown @@ -438,4 +438,4 @@ lähdekoodi tulee esille! Toinen loistava paikka oppia on [Go by example](https://gobyexample.com/). Go Mobile lisää tuen mobiilialustoille (Android ja iOS). Voit kirjoittaa pelkällä Go:lla natiiveja applikaatioita tai tehdä kirjaston joka sisältää sidoksia -Go-paketista, jotka puolestaan voidaan kutsua Javasta (Android) ja Objective-C:stä (iOS). Katso [lisätietoja](https://github.com/golang/go/wiki/Mobile). +Go-paketista, jotka puolestaan voidaan kutsua Javasta (Android) ja Objective-C:stä (iOS). Katso [lisätietoja](https://go.dev/wiki/Mobile). diff --git a/go.html.markdown b/go.html.markdown index 81d45b98..d3f2572e 100644 --- a/go.html.markdown +++ b/go.html.markdown @@ -492,4 +492,4 @@ There are many excellent conference talks and video tutorials on Go available on Go Mobile adds support for mobile platforms (Android and iOS). You can write all-Go native mobile apps or write a library that contains bindings from a Go package, -which can be invoked via Java (Android) and Objective-C (iOS). Check out the [Go Mobile page](https://github.com/golang/go/wiki/Mobile) for more information. +which can be invoked via Java (Android) and Objective-C (iOS). Check out the [Go Mobile page](https://go.dev/wiki/Mobile) for more information. diff --git a/zfs.html.markdown b/zfs.html.markdown index 92d7aaa2..8058211d 100644 --- a/zfs.html.markdown +++ b/zfs.html.markdown @@ -18,7 +18,7 @@ usability for systems administrators. ### Virtual Devices -A VDEV (Virtual Device) in ZFS is analogous to a RAID device and simmilaly offers different +A VDEV (Virtual Device) in ZFS is analogous to a RAID device and similarly offers different benefits in terms of redundancy and performance. In general VDEV's offer better reliability and safety than a RAID card. It is discouraged to use a RAID setup with ZFS, as ZFS expects to directly manage the underlying disks. @@ -256,14 +256,14 @@ zroot/var none none ### Write Log Pool -The ZFS Intent Log (ZIL) is a write log designed to speed up syncronus writes. This is +The ZFS Intent Log (ZIL) is a write log designed to speed up synchronous writes. This is typically a faster drive or drive partition than the larger storage pools. ```bash # Add a log pool $ zpool add mypool/lamb log /dev/sdX -# Check the configureation +# Check the configuration $ zpool status mypool/lamb ``` @@ -277,13 +277,13 @@ storage pools. # Add a cache pool $ zpool add mypool/lamb cache /dev/sdY -# Check the configureation +# Check the configuration $ zpool status mypool/lamb ``` ### Data Compression -Data compression reduces the amount of space data occupies on disk in excange for some extra +Data compression reduces the amount of space data occupies on disk in exchange for some extra CPU usage. When enabled, it can enhance performance by reducing the amount of disk I/O. It especially beneficial on systems with more CPU resources than disk bandwidth. @@ -297,14 +297,14 @@ compression NO YES on | off | lzjb | gzip | gzip-[1-9] | zle | lz4 | # Set compression $ zfs set compression=on mypool/lamb -# Check the configureation +# Check the configuration $ zpool get compression mypool/lamb ``` ### Encryption at Rest Encryption allows data to be encrypted on the device at the cost of extra CPU cycles. This -propery can only be set when a dataset is being created. +property can only be set when a dataset is being created. ```bash # Enable encryption on the pool @@ -313,7 +313,7 @@ $ zpool set feature@encryption=enabled black_hole # Create an encrypted dataset with a prompt $ zfs create -o encryption=on -o keyformat=passphrase black_hole/enc -# Check the configureation +# Check the configuration $ zfs get encryption black_hole/enc ``` @@ -422,7 +422,7 @@ $ zfs promote zroot/home/sarlalian_new ### Putting it all together This following a script utilizing FreeBSD, jails and ZFS to automate -provisioning a clean copy of a mysql staging database from a live replication +provisioning a clean copy of a MySQL staging database from a live replication slave. ```bash diff --git a/zh-cn/bc-cn.html.markdown b/zh-cn/bc-cn.html.markdown new file mode 100644 index 00000000..e2cc3680 --- /dev/null +++ b/zh-cn/bc-cn.html.markdown @@ -0,0 +1,96 @@ +--- +language: bc +contributors: + - ["Btup"] +translators: + - ["CloneWith", "https://github.com/CloneWith"] +filename: learnbc.bc +lang: zh-cn +--- +```bc +/*这是一条 +多行注释。*/ +# 这(在 GNU bc 中)也是一条(单行)注释! + + /*1. 变量与指令结构*/ +num = 45 /*所有变量都只以双精度浮点数形式存储, + 并且 bc 不支持直接存储字符串常量。*/ +num = 45; /*每个语句后可以添加 + 一个英文分号,也可以不加。*/ +/*语句块使用 {} 运算符表示(与 C 语言相似):*/ +while(num < 50) { + num += 1 /*等价于 num=num+1。 + a = a op b 等价于 a op= b。*/ +} +/*也有 ++(自加)与 --(自减)运算符。*/ +/*有三个特殊变量: +scale: 定义双精度浮点数字的比例。 +ibase: 定义输入数值的基数。 +obase: 定义输出数值的基数。*/ +/*If 语句:*/ +hour = read() /*输入一个数字*/ + +if(hour < 12) { /*运算符的用法与 C 语言类似。*/ + print "Good morning\n" /*“print”输出字符串或变量,用英文逗号分隔。*/ +} else if(hour == 12) { + print "Hello\n" + /*字符串中的转义序列以反斜杠 \ 开头。 + 为了讲述清楚,以下为 bc 中常用转义序列表: + \b: 退格 + \c: 硬回车 + \n: 换行符 + \t: 制表符 + \\: 反斜杠*/ +} else { + print "Good afternoon\n" +} + +/*像 C 语言一样,只有 0 定义为假(false)。*/ +num = 0 +if(!num) {print "false\n"} + +/*与 C 语言不同,bc 没有 ?: 运算符。例如, + 这个代码块会导致出错: +a = (num) ? 1 : 0 +但是你可以模拟一个:*/ +a = (num) && (1) || (0) /*&& 代表“与”,|| 代表“或”*/ + +/*循环语句*/ +num = 0 +for(i = 1; i <= 100; i++) {/*与 C 语言中的循环类似。*/ + num += i +} + + /*2.函数与数组*/ +define fac(n) { /*使用“define”定义函数。*/ + if(n == 1 || n == 0) { + return 1 /*返回一个数值*/ + } + return n * fac(n - 1) /*可以使用递归*/ +} + +/*不可使用闭包与匿名函数。*/ + +num = fac(4) /*24*/ + +/*这是局部变量的示例:*/ +define x(n) { + auto x + x = 1 + return n + x +} +x(3) /*4*/ +print x /*看起来无法在函数外访问 x。*/ +/*数组与 C 语言中的等同。*/ +for(i = 0; i <= 3; i++) { + a[i] = 1 +} +/*这样访问它:*/ +print a[0], " ", a[1], " ", a[2], " ", a[3], "\n" +quit /*添加这行代码,确保程序退出。 +这行代码可写可不写。*/ +``` + +请享用这个简单的计算器吧!(或者确切地讲,这个编程语言。) + +本程序全部使用 GNU bc 语言编写。要运行程序,请使用 ```bc learnbc.bc```。 |