Merge pull request #2 from LCTT/master

lctt update
This commit is contained in:
dianbanjiu
2019-02-15 18:48:09 +08:00
committed by GitHub
70 changed files with 7816 additions and 2817 deletions

View File

@@ -1,26 +1,27 @@
[#]: collector: (lujun9972)
[#]: translator: (qhwdw)
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: reviewer: (wxy)
[#]: publisher: (wxy)
[#]: url: (https://linux.cn/article-10526-1.html)
[#]: subject: (Computer Laboratory Raspberry Pi: Lesson 4 OK04)
[#]: via: (https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/ok04.html)
[#]: author: (Robert Mullins http://www.cl.cam.ac.uk/~rdm34)
计算机实验室 树莓派:课程 4 OK04
计算机实验室树莓派:课程 4 OK04
======
OK04 课程在 OK03 的基础上进行构建,它教你如何使用定时器让 `OK``ACT` LED 灯按精确的时间间隔来闪烁。假设你已经有了 [课程 3OK03][1] 的操作系统,我们将以它为基础来构建。
OK04 课程在 OK03 的基础上进行构建,它教你如何使用定时器让 OK 或 ACT LED 灯按精确的时间间隔来闪烁。假设你已经有了 [课程 3OK03][1] 的操作系统,我们将以它为基础来构建。
### 1、一个新设备
定时器是树莓派保持时间的唯一方法。大多数计算机都有一个电池供电的时钟,这样当计算机关机后仍然能保持时间。
> 定时器是树莓派保持时间的唯一方法。大多数计算机都有一个电池供电的时钟,这样当计算机关机后仍然能保持时间。
到目前为止,我们仅看了树莓派硬件的一小部分,即 GPIO 控制器。我只是简单地告诉你做什么,然后它会发生什么事情。现在,我们继续看定时器,并继续带你去了解它的工作原理。
和 GPIO 控制器一样,定时器也有地址。在本案例中,定时器的基地址在 20003000~16~。阅读手册我们可以找到下面的表:
和 GPIO 控制器一样,定时器也有地址。在本案例中,定时器的基地址在 20003000<sub>16</sub>。阅读手册我们可以找到下面的表:
表 1.1 GPIO 控制器寄存器
| 地址 | 大小 / 字节 | 名字 | 描述 | 读或写 |
| -------- | ------------ | ---------------- | ---------------------------------------------------------- | ---------------- |
| 20003000 | 4 | Control / Status | 用于控制和清除定时器通道比较器匹配的寄存器 | RW |
@@ -34,40 +35,33 @@ OK04 课程在 OK03 的基础上进行构建,它教你如何使用定时器让
这个表只告诉我们一部分内容,在手册中描述了更多的字段。手册上解释说,定时器本质上是按每微秒将计数器递增 1 的方式来运行。每次它是这样做的,它将计数器的低 32 位4 字节)与 4 个比较器寄存器进行比较,如果匹配它们中的任何一个,它更新 `Control/Status` 以反映出其中有一个是匹配的。
关于<ruby>位<rt>bit</rt></ruby>、字节、<ruby>位字段<rt>bit field</rt></ruby>、以及数据大小的更多内容如下:
关于<ruby>位<rt>bit</rt></ruby>、<ruby>字节<rt>byte</rt></ruby>、<ruby>位字段<rt>bit field</rt></ruby>、以及数据大小的更多内容如下:
>
> 一个位是一个单个的二进制数的名称。你可能还记得,一个单个的二进制数可能是一个 1也可能是一个 0。
> 一个位是一个单个的二进制数的名称。你可能还记得,一个单个的二进制数可能是一个 1也可能是一个 0。
>
> 一个字节是一个 8 位集合的名称。由于每个位可能是 1 或 0 这两个值的其中之一,因此,一个字节有 2^8^ = 256 个不同的可能值。我们一般解释一个字节为一个介于 0 到 255之间的二进制数。
> 一个字节是一个 8 位集合的名称。由于每个位可能是 1 或 0 这两个值的其中之一,因此,一个字节有 2^8 = 256 个不同的可能值。我们一般解释一个字节为一个介于 0 到 255之间的二进制数。
>
> ![Diagram of GPIO function select controller register 0.][3]
>
> 一个位字段是解释二进制的另一种方式。二进制可以解释为许多不同的东西,而不仅仅是一个数字。一个位字段可以将二进制看做为一系列的 1 或 0的开关。对于每个小开关我们都有一个意义我们可以使用它们去控制一些东西。我们已经遇到了 GPIO 控制器使用的位字段,使用它设置一个针脚的开或关。位为 1 时 GPIO 针脚将准确地打开或关闭。有时我们需要更多的选项,而不仅仅是开或关,因此我们将几个开关组合到一起,比如 GPIO 控制器的函数设置(如上图),每 3 位为一组控制一个 GPIO 针脚的函数。
>
我们的目标是实现一个函数,这个函数能够以一个时间数量为输入来调用它,这个输入的时间数量将作为等待的时间,然后返回。想一想如何去做,想想我们都拥有什么。
我认为这将有两个选择:
1. 从计数器中读取一个值,然后保持分支返回到相同的代码,直到计数器的等待时间数量大于它。
2. 从计数器中读取一个值,加时间数量去等待,保存到比较器寄存器,然后保持分支返回到相同的代码处,直到 `Control / Status` 寄存器更新。
```
像这样存在被称为"并发问题"的问题,并且几乎无法解决。
```
2. 从计数器中读取一个值,加上要等待的时间数量,将它保存到比较器寄存器,然后保持分支返回到相同的代码处,直到 `Control / Status` 寄存器更新。
这两种策略都工作的很好,但在本教程中,我们将只实现第一个。原因是比较器寄存器更容易出错,因为在增加等待时间并保存它到比较器的寄存器期间,计数器可能已经增加了,并因此可能会不匹配。如果请求的是 1 微秒(或更糟糕的情况是 0 微秒)的等待,这样可能导致非常长的意外延迟。
> 像这样存在被称为“并发问题”的问题,并且几乎无法解决。
### 2、实现
```
大型的操作系统通常使用等待函数来抓住机会在后台执行任务。
```
我将把这个创建完美的等待方法的挑战基本留给你。我建议你将所有与定时器相关的代码都放在一个名为 `systemTimer.s` 的文件中(理由很明显)。关于这个方法的复杂部分是,计数器是一个 8 字节值,而每个寄存器仅能保存 4 字节。所以,计数器值将分到 2 个寄存器中。
我将把这个创建完美的等待方法的挑战留给你。我建议你将所有与定时器相关的代码都放在一个名为 `systemTimer.s` 的文件中(理由很明显)。关于这个方法的复杂部分是,计数器是一个 8 字节值,而每个寄存器仅能保存 4 字节。所以,计数器值将分到 2 个寄存器中
> 大型的操作系统通常使用等待函数来抓住机会在后台执行任务
下列的代码块是一个示例。
@@ -75,13 +69,11 @@ OK04 课程在 OK03 的基础上进行构建,它教你如何使用定时器让
ldrd r0,r1,[r2,#4]
```
```assembly
ldrd regLow,regHigh,[src,#val] 从 src 加上 val 数的地址上加载 8 字节到寄存器 regLow 和 regHigh 中。
```
> `ldrd regLow,regHigh,[src,#val]``src` 中的数加上 `val` 之和的地址加载 8 字节到寄存器 `regLow``regHigh` 中。
上面的代码中你可以发现一个很有用的指令是 `ldrd`。它从两个寄存器中加载 8 字节的内存。在本案例中,这 8 字节内存从寄存器 `r2` 中的地址开始,将被复制进寄存器 `r0``r1`。这种安排的稍微复杂之处在于 `r1` 实际上只持有了高位 4 字节。换句话说就是,如果如果计数器的值是 999,999,999,999~10~ = 1110100011010100101001010000111111111111~2~ ,那么寄存器 `r1` 中只有 11101000~2~,而寄存器 `r0` 中则是 11010100101001010000111111111111~2~
上面的代码中你可以发现一个很有用的指令是 `ldrd`。它加载 8 字节的内存到两个寄存器中。在本案例中,这 8 字节内存从寄存器 `r2` 中的地址 + 4 开始,将被复制进寄存器 `r0``r1`。这种安排的稍微复杂之处在于 `r1` 实际上只持有了高位 4 字节。换句话说就是,如果如果计数器的值是 999,999,999,999<sub>10</sub> = 1110100011010100101001010000111111111111<sub>2</sub> ,那么寄存器 `r1` 中只有 11101000<sub>2</sub>,而寄存器 `r0` 中则是 11010100101001010000111111111111<sub>2</sub>
实现它的更明智的方式应该是,去计算当前计数器值与来自方法启动后的那一个值的差,然后将它与要求的等待时间数量进行比较。除非恰好你希望的等待时间是支持 8 字节的,否则上面示例中寄存器 `r1` 中的值将会丢,而计数器仅需要使用低位 4 字节。
实现它的更明智的方式应该是,去计算当前计数器值与来自方法启动后的那一个值的差,然后将它与要求的等待时间数量进行比较。除非恰好你希望的等待时间是占用 8 字节的,否则上面示例中寄存器 `r1` 中的值将会丢,而计数器仅需要使用低位 4 字节。
当等待开始时,你应该总是确保使用大于比较,而不是使用等于比较,因为如果你尝试去等待一个时间,而这个时间正好等于方法开始的时间与结束的时间之差,那么你就错过这个值而永远等待下去。
@@ -97,7 +89,7 @@ ldrd regLow,regHigh,[src,#val] 从 src 加上 val 数的地址上加载 8 字节
> mov pc,lr
> ```
>
> 另一个被证明非常有用的函数是在寄存器 `r0``r1`返回当前计数器值:
> 另一个被证明非常有用的函数是返回在寄存器 `r0``r1`当前计数器值:
>
> ```assembly
> .globl GetTimeStamp
@@ -110,7 +102,7 @@ ldrd regLow,regHigh,[src,#val] 从 src 加上 val 数的地址上加载 8 字节
>
> 这个函数简单地使用了 `GetSystemTimerBase` 函数,并像我们前面学过的那样,使用 `ldrd` 去加载当前计数器值。
>
> 现在,我们可以去写我们的等待方法的代码了。首先,在方法启动后,我们需要知道计数器值,当前计数器值我们现在已经可以使用 `GetTimeStamp` 来取得
> 现在,我们可以去写我们的等待方法的代码了。首先,在方法启动后,我们需要知道计数器值,我们可以使用 `GetTimeStamp` 来取得。
>
> ```assembly
> delay .req r2
@@ -121,9 +113,9 @@ ldrd regLow,regHigh,[src,#val] 从 src 加上 val 数的地址上加载 8 字节
> mov start,r0
> ```
>
> 这个代码复制我们的方法的输入,将延迟时间的数量放到寄存器 `r2` 中,然后调用 `GetTimeStamp`,这个函数将会寄存器 `r0``r1`返回当前计数器值。接着复制计数器值的低位 4 字节到寄存器 `r3` 中。
> 这个代码复制我们的方法的输入,将延迟时间的数量放到寄存器 `r2` 中,然后调用 `GetTimeStamp`,这个函数将会返回寄存器 `r0``r1`当前计数器值。接着复制计数器值的低位 4 字节到寄存器 `r3` 中。
>
> 接下来,我们需要计算当前计数器值与读入的值的差,然后持续这样做,直到它们的差至少是延迟大小为止。
> 接下来,我们需要计算当前计数器值与读入的值的差,然后持续这样做,直到它们的差至少是 `delay`大小为止。
>
> ```assembly
> loop$:
@@ -136,7 +128,7 @@ ldrd regLow,regHigh,[src,#val] 从 src 加上 val 数的地址上加载 8 字节
> bls loop$
> ```
>
> 这个代码将一直等待,一直到等待到传递给它的时间数量为止。它从计数器中读取数值,减去最初从计数器中读取的值,然后与要求的延迟时间进行比较。如果过去的时间数量小于要求的延迟,它切换 `loop$`
> 这个代码将一直等待,一直到等待到传递给它的时间数量为止。它从计数器中读取数值,减去最初从计数器中读取的值,然后与要求的延迟时间进行比较。如果过去的时间数量小于要求的延迟,它切换 `loop$`
>
> ```assembly
> .unreq delay
@@ -161,13 +153,13 @@ via: https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/ok04.html
作者:[Robert Mullins][a]
选题:[lujun9972][b]
译者:[qhwdw](https://github.com/qhwdw)
校对:[校对者ID](https://github.com/校对者ID)
校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: http://www.cl.cam.ac.uk/~rdm34
[b]: https://github.com/lujun9972
[1]: https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/ok03.html
[1]: https://linux.cn/article-10519-1.html
[2]: https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/images/systemTimer.png
[3]: https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/images/gpioControllerFunctionSelect.png
[4]: https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/ok05.html

View File

@@ -0,0 +1,100 @@
[#]: collector: (lujun9972)
[#]: translator: (oska874)
[#]: reviewer: (wxy)
[#]: publisher: (wxy)
[#]: url: (https://linux.cn/article-10530-1.html)
[#]: subject: (Computer Laboratory Raspberry Pi: Lesson 5 OK05)
[#]: via: (https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/ok05.html)
[#]: author: (Robert Mullins http://www.cl.cam.ac.uk/~rdm34)
计算机实验室之树莓派:课程 5 OK05
======
OK05 课程构建于课程 OK04 的基础,使用它来闪烁摩尔斯电码的 SOS 序列(`...---...`)。这里假设你已经有了 [课程 4OK04][1] 操作系统的代码作为基础。
### 1、数据
到目前为止,我们与操作系统有关的所有内容提供的都是指令。然而有时候,指令只是完成了一半的工作。我们的操作系统可能还需要数据。
> 一些早期的操作系统确实只允许特定文件中的特定类型的数据,但是这通常被认为限制太多了。现代方法确实可以使程序变得复杂的多。
通常,数据就是些很重要的值。你可能接受过培训,认为数据就是某种类型的,比如,文本文件包含文本,图像文件包含图片,等等。说实话,这只是你的想法而已。计算机上的全部数据都是二进制数字,重要的是我们选择用什么来解释这些数据。在这个例子中,我们会用一个闪灯序列作为数据保存下来。
`main.s` 结束处复制下面的代码:
```
.section .data %定义 .data 段
.align 2 %对齐
pattern: %定义整形变量
.int 0b11111111101010100010001000101010
```
> `.align num` 确保下一行代码的地址是 2^num 的整数倍。
> `.int val` 输出数值 `val`。
要区分数据和代码,我们将数据都放在 `.data` 区域。我已经将该区域包含在操作系统的内存布局图。我选择将数据放到代码后面。将我们的指令和数据分开保存的原因是,如果最后我们在自己的操作系统上实现一些安全措施,我们就需要知道代码的那些部分是可以执行的,而那些部分是不行的。
我在这里使用了两个新命令 `.align``.int``.align` 保证接下来的数据是按照 2 的乘方对齐的。在这个里,我使用 `.align 2` ,意味着数据最终存放的地址是 2^2=4 的整数倍。这个操作是很重要的,因为我们用来读取内存的指令 `ldr` 要求内存地址是 4 的倍数。
命令 `.int` 直接复制它后面的常量到输出。这意味着 11111111101010100010001000101010<sub>2</sub> 将会被存放到输出,所以该标签模式实际是将这段数据标识为模式。
> 关于数据的一个挑战是寻找一个高效和有用的展示形式。这种保存一个开、关的时间单元的序列的方式,运行起来很容易,但是将很难编辑,因为摩尔斯电码的 `-` 或 `.` 样式丢失了。
如我提到的,数据可以代表你想要的所有东西。在这里我编码了摩尔斯电码的 SOS 序列,对于不熟悉的人,就是 `...---...`。我使用 0 表示一个时间单元的 LED 灭灯,而 1 表示一个时间单元的 LED 亮。这样,我们可以像这样编写一些代码在数据中显示一个序列,然后要显示不同序列,我们所有需要做的就是修改这段数据。下面是一个非常简单的例子,操作系统必须一直执行这段程序,解释和展示数据。
复制下面几行到 `main.s` 中的标记 `loop$` 之前。
```
ptrn .req r4 %重命名 r4 为 ptrn
ldr ptrn,=pattern %加载 pattern 的地址到 ptrn
ldr ptrn,[ptrn] %加载地址 ptrn 所在内存的值
seq .req r5 %重命名 r5 为 seq
mov seq,#0 %seq 赋值为 0
```
这段代码加载 `pattrern` 到寄存器 `r4`,并加载 0 到寄存器 `r5``r5` 将是我们的序列位置,所以我们可以追踪我们已经展示了多少个 `pattern`
如果 `pattern` 的当前位置是 1 且仅有一个 1下面的代码将非零值放入 `r1`
```
mov r1,#1 %加载1到 r1
lsl r1,seq %对r1 的值逻辑左移 seq 次
and r1,ptrn %按位与
```
这段代码对你调用 `SetGpio` 很有用,它必须有一个非零值来关掉 LED而一个 0 值会打开 LED。
现在修改 `main.s` 中你的全部代码,这样代码中每次循环会根据当前的序列数设置 LED等待 250000 毫秒(或者其他合适的延时),然后增加序列数。当这个序列数到达 32 就需要返回 0。看看你是否能实现这个功能作为额外的挑战也可以试着只使用一条指令。
### 2、当你玩得开心时时间过得很快
你现在准备好在树莓派上实验。应该闪烁一串包含 3 个短脉冲3 个长脉冲,然后 3 个短脉冲的序列。在一次延时之后,这种模式应该重复。如果这不工作,请查看我们的问题页。
一旦它工作,祝贺你已经抵达 OK 系列教程的结束点。
在这个系列我们学习了汇编代码GPIO 控制器和系统定时器。我们已经学习了函数和 ABI以及几个基础的操作系统原理已经关于数据的知识。
你现在已经可以准备学习下面几个更高级的课程的某一个。
* [Screen][2] 系列是接下来的,会教你如何通过汇编代码使用屏幕。
* [Input][3] 系列教授你如何使用键盘和鼠标。
到现在,你已经有了足够的信息来制作操作系统,用其它方法和 GPIO 交互。如果你有任何机器人工具,你可能会想尝试编写一个通过 GPIO 管脚控制的机器人操作系统。
--------------------------------------------------------------------------------
via: https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/ok05.html
作者:[Robert Mullins][a]
选题:[lujun9972][b]
译者:[ezio](https://github.com/oska874)
校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: http://www.cl.cam.ac.uk/~rdm34
[b]: https://github.com/lujun9972
[1]: https://linux.cn/article-10526-1.html
[2]: https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/screen01.html
[3]: https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/input01.html

View File

@@ -1,112 +1,100 @@
Linux 上最好的五款音乐播放器
======
> Jack Wallen 盘点他最爱的五款 Linux 音乐播放器。
![](https://www.linux.com/sites/lcom/files/styles/rendered_file/public/live-music.jpg?itok=Ejbo4rf7_)
>Jack Wallen 盘点他最爱的五款 Linux 音乐播放器。图片来源 Creative Commons Zero
>Pixabay
不管你做什么,你都有时会来一点背景音乐。不管你是码农,运维或是一个典型的电脑用户,享受美妙的音乐都可能是你在电脑上最想做的事情之一。同时随着即将到来的假期,你可能收到一些能让你买几首新歌的礼物卡。如果你所选的音乐是数字形式(我的恰好是唱片形式)而且你的平台是 Linux 的话,你会想要一个好的图形用户界面播放器来享受音乐。
不管你做什么,你都有时会来一点背景音乐。不管你是开发、运维或是一个典型的电脑用户,享受美妙的音乐都可能是你在电脑上最想做的事情之一。同时随着即将到来的假期,你可能收到一些能让你买几首新歌的礼物卡。如果你所选的音乐是数字形式(我的恰好是唱片形式)而且你的平台是 Linux 的话,你会想要一个好的图形用户界面播放器来享受音乐。
幸运的是Linux 不缺好的数字音乐播放器。事实上Linux 上有不少播放器,大部分是开源并且可以免费获得的。让我们看看其中的几款,看哪个能满足你的需要。
### Clementine
我想从当了我许多年默认选项的播放器开始。[Clementine][1] 可能在播放器中提供了最好的易用性与灵活性间的平衡。Clementine是新的停运的 [Amarok][2] 音乐播放器的复刻,但它不仅限于 Linux Clementine 在 Mac OS 和 Windows 平台上也可以获得。它的一系列特性十分惊艳,包括:
我想从我用来许多年默认选项的播放器开始。[Clementine][1] 可能是最好的平衡了易用性与灵活性的播放器。Clementine 是新停摆的 [Amarok][2] 音乐播放器的复刻,但它不仅限于 Linux Clementine 在 Mac OS 和 Windows 平台上也可以获得。它的一系列特性十分惊艳,包括:
* 內建的均衡器
* 可定制的界面(将现在的专辑封面显示成背景——图一)
* 播放本地音乐或者从 Spotify Last.fm 等播放音乐
* 便于库导的侧边栏
* 內建的音频转码(转成 MP3OGGFlac等
* 可定制的界面(将现在的专辑封面显示成背景,见图一)
* 播放本地音乐或者从 SpotifyLast.fm 等播放音乐
* 便于库导的侧边栏
* 內建的音频转码(转成 MP3OGGFlac 等)
* 通过 [安卓应用][3] 远程控制
* 便利的搜索功能
* 分页的播放列表
* 简单的规律性和智能化的播放列表创建
* 支持音乐追踪表单
* 选项卡式播放列表
* 简单创建常规和智能化的播放列表
* 支持 CUE 文件
* 支持标签
![Clementine][5]
图一Clementine 界面可能有一点老派,但是它不可思议得灵活好用。
[受许可使用][6]
*图一Clementine 界面可能有一点老派,但是它不可思议得灵活好用。*
在所有我用过的音乐播放器中Clementine 是目前为止功能最多也是最容易使用的。它同时也包含了你能在 Linux 音乐播放器中找到的最好的均衡器(有十个频带可以调)。尽管它的界面不够时髦,但它创建、操控播放列表的能力是无与伦比的。如果你的音乐集很大,同时你想完全控你的音乐集的话,这就是你想要的播放器。
在所有我用过的音乐播放器中Clementine 是目前为止功能最多也是最容易使用的。它同时也包含了你能在 Linux 音乐播放器中找到的最好的均衡器(有十个频带可以调)。尽管它的界面不够时髦,但它创建、操控播放列表的能力是无与伦比的。如果你的音乐集很大,同时你想完全控你的音乐集的话,这就是你想要的播放器。
Clementine 可以在标准仓库中找到。它可以从你的发行版的软件中心或通过命令行来安装。
### Rhythmbox
[Rhythmbox][7] 是 GNOME 桌面的默认播放器但是它在其它桌面工作得也很好。Rhythmbox 的界面比 Clementine 的界面稍微时尚一点,它的设计遵循极简的理念。这并不意味着它缺乏特性,相反 Rhythmbox 提供无间隔回放Soundcloud 支持,专辑封面显示从 Last.fm 和 Libre.fm 导入音频Jamendo 支持,播客订阅 (从 [Apple iTunes][8]从网页远程控制等特性。
[Rhythmbox][7] 是 GNOME 桌面的默认播放器但是它在其它桌面工作得也很好。Rhythmbox 的界面比 Clementine 的界面稍微时尚一点,它的设计遵循极简的理念。这并不意味着它缺乏特性,相反 Rhythmbox 提供无间隔回放、支持 Soundcloud专辑封面显示从 Last.fm 和 Libre.fm 导入音频、支持 Jamendo播客订阅(从 [Apple iTunes][8]从网页远程控制等特性。
在 Rhythmbox 中发现的一个很好的特性是插件支持,这使得你可以使用像 DAAP 音乐分享FM 电台封面艺术查找通知ReplayGain歌词等特性。
在 Rhythmbox 中发现的一个很好的特性是支持插件,这使得你可以使用像 DAAP 音乐分享FM 电台封面查找通知ReplayGain歌词等特性。
Rhythmbox 播放列表特性不像 Clementine 的那么强大,但是将你的音乐整理进任何形式的快速播放列表还是很简单的。尽管 Rhythmbox 的界面(图二)比 Clementine 要时髦一点,但是它不像 Clementine 那样灵活。
Rhythmbox 播放列表特性不像 Clementine 的那么强大,但是将你的音乐整理进任何形式的快速播放列表还是很简单的。尽管 Rhythmbox 的界面(图二)比 Clementine 要时髦一点,但是它不像 Clementine 那样灵活。
![Rhythmbox][10]
图二: Rhythmbox 界面简单直接。
[受许可使用][6]
*图二Rhythmbox 界面简单直接。*
### VLC Media Player
对于部分人来说,[VLC][11] 在视频播放方面是无懈可击的。然而 VLC 不仅限于视频播放。事实上VLC在播放音频文件方面做得也很好。对于 [KDE Neon][12] 用户来说VLC 既是音乐也是视频的默认播放器。 尽管 VLC 是 Linux 市场最好的视频播放器的之一(它是我的默认播放器),它在音频方面确实略有瑕疵——缺少播放列表以及不能够连接到你网络中的远程仓库。但如果你是在寻找一种播放本地文件或者网络 mms/rtsp 的简单可靠的方式VLC是上佳之选。VLC 确实包括一个均衡器(图三)一个压缩器以及一个空间音响。它同样也能够从捕捉到的设备录音。
对于部分人来说,[VLC][11] 在视频播放方面是无懈可击的。然而 VLC 不仅限于视频播放。事实上VLC在播放音频文件方面做得也很好。对于 [KDE Neon][12] 用户来说VLC 既是音乐也是视频的默认播放器。尽管 VLC 是 Linux 市场最好的视频播放器的之一(它是我的默认播放器),它在音频方面确实略有瑕疵 —— 缺少播放列表以及不能够连接到你网络中的远程仓库。但如果你是在寻找一种播放本地文件或者网络 mms/rtsp 的简单可靠的方式VLC 是上佳之选。VLC 包括一个均衡器(图三)一个压缩器以及一个空间音响。它同样也能够从捕捉到的设备录音。
![VLC][14]
图三: 运转中的 VLC 均衡器。
[受许可使用][6]
*图三:运转中的 VLC 均衡器。*
### Audacious
如果你在寻找一个轻量级的音乐播放器Audacious 完美地满足要求。这个音乐播放器相当的专一,但是它确实包括了一个均衡器和一小部分能够改善许多音频的声效(比如回声,消除默音,调节速度和音调,去除人声等——图四)。
如果你在寻找一个轻量级的音乐播放器Audacious 完美地满足要求。这个音乐播放器相当的专一,但是它包括了一个均衡器和一小部分能够改善许多音频的声效(比如回声、消除默音、调节速度和音调、去除人声等,见图四)。
![Audacious][16]
图四: Audacious 均衡器和插件。
[受许可使用][6]
*图四Audacious 均衡器和插件。*
Audacious 也包括了一个十分简便的闹铃功能。它允许你设置一个能在用户选定的时间点和持续的时间段内播放选定乐段的闹铃。
### Spotify
我必须承认,我每天都用 Spotify。我是一个 Spotify 的订阅者并用它去发现、购买新的音乐——这意味着我在不停地探索发现。运的是Spotify 有一个我能按照 [Spotify官方 Linux 平台安装指导][17] 轻松安装的桌面客户端。在桌面客户端与 [安卓应用][18] 间无缝转换对我来说也大有帮助,这样我就永远不会错过我喜欢的音乐了。
我必须承认,我每天都用 Spotify。我是一个 Spotify 的订阅者并用它去发现、购买新的音乐 —— 这意味着我在不停地探索发现。运的是Spotify 有一个我能按照 [Spotify官方 Linux 平台安装指导][17] 轻松安装的桌面客户端。在桌面客户端与 [安卓应用][18] 间无缝转换对我来说也大有帮助,这样我就永远不会错过我喜欢的音乐了。
![Spotify][16]
*图五Linux 上的 Spotify 官方客户端。*
图五: Linux 上的 Spotify 官方客户端
[受许可使用][6]
Spotify 界面十分易于使用,事实上它完胜网页端的播放器。不要在 Linux 上装 [Spotify 网页播放器][21] 因为桌面客户端在创建管理你的播放列表方面简便得多。如果你是 Spotify 重度用户,甚至没必要用其他桌面应用的內建流传输客户端支持——一旦你用过 Spotify 桌面客户端,其它应用就根本没可比性。
Spotify 界面十分易于使用,事实上它完胜网页端的播放器。不要在 Linux 上装 [Spotify 网页播放器][21] 因为桌面客户端在创建管理你的播放列表方面简便得多。如果你是 Spotify 重度用户,甚至没必要用其他桌面应用的內建流传输客户端支持 —— 一旦你用过 Spotify 桌面客户端,其它应用就根本没可比性
### 选择在你
其它选择也是有的查看你的桌面软件中心但这五款客户端在我看来是最好的了。对我来说Clementine 和 Spotify 的组合拳就已经让我美好得唱赞歌了。尝试它们看看哪个能更好地满足你的需要。
### 额外奖品
虽然这篇文章翻译于国外作者,但作为给中国的 Linux 用户看的文章,如果在一篇分享音乐播放器的文章中**不提及**网易云音乐,那一定会被猛烈吐槽(事实上,我们曾经被吐槽过好多次了,哈哈)。
网易云音乐是我见过的最好的音乐播放器之一,不只是在 Linux 上,它甚至还支持包括 Windows、Mac、 iOS、安卓等在内的 8 个操作系统平台。当前的 Linux 版本是 1.1.0 版,支持 64 位的深度 Linux 15 和 Ubuntu 16.04 及之后的版本。下载地址和截图就不在这里安利了,大家想必自己能找到的。
通过 edX 和 Linux Foundation 上免费的 ["Introduction to Linux" ][22] 课程学习更多有关 Linux 的知识。
--------------------------------------------------------------------------------
via: https://www.linux.com/learn/intro-to-linux/2017/12/top-5-linux-music-players
作者:[][a]
作者:[JACK WALLEN][a]
译者:[tomjlw](https://github.com/tomjlw)
校对:[校对者ID](https://github.com/校对者ID)
校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]:https://www.linux.com
[a]:https://www.linux.com/users/jlwallen
[1]:https://www.clementine-player.org/
[2]:https://en.wikipedia.org/wiki/Amarok_(software)
[3]:https://play.google.com/store/apps/details?id=de.qspool.clementineremote

View File

@@ -0,0 +1,54 @@
[#]: collector: (lujun9972)
[#]: translator: (geekpi)
[#]: reviewer: (wxy)
[#]: publisher: (wxy)
[#]: url: (https://linux.cn/article-10537-1.html)
[#]: subject: (Go on an adventure in your Linux terminal)
[#]: via: (https://opensource.com/article/18/12/linux-toy-adventure)
[#]: author: (Jason Baker https://opensource.com/users/jason-baker)
在 Linux 终端上进行冒险
======
> 我们的 Linux 命令行玩具日历的最后一天以一场盛大冒险结束。
![](https://opensource.com/sites/default/files/styles/image-full-size/public/uploads/linux-toy-advent.png?itok=OImUJJI5)
今天是我们为期 24 天的 Linux 命令行玩具日历的最后一天。希望你一直有在看,但如果没有,请[从头开始][1],继续努力。你会发现 Linux 终端有很多游戏、消遣和奇怪之处。
虽然你之前可能已经看过我们日历中的一些玩具,但我们希望对每个人而言至少有一件新东西。
今天的玩具是由 Opensource.com 管理员 [Joshua Allen Holm][2] 提出的:
> “如果你的冒险日历的最后一天不是 ESREric S. Raymond的[开源版的 Adventure 游戏][3] —— 它仍然使用经典的 `advent` 命令(在 BSD 游戏包中的 `adventure` ,我会非常非常非常失望 ;-)“
这是结束我们这个系列的完美方式。
<ruby>巨洞冒险<rt>Colossal Cave Adventure</rt></ruby>(通常简称 Adventure是一款来自 20 世纪 70 年代的基于文本的游戏它引领产生了冒险游戏这个类型的游戏。尽管它很古老但是当探索幻想世界时Adventure 仍然是一种轻松消耗时间的方式,就像龙与地下城那样,地下城主可能会引导你穿过一个充满想象的地方。
与其带你了解 Adventure 的历史,我鼓励你去阅读 Joshua 的[该游戏的历史][4]这篇文章,以及为什么它几年前会重新复活,并且被重新移植。接着,[克隆它的源码][5]并按照[安装说明][6]在你的系统上使用 `advent` 启动游戏。或者,像 Joshua 提到的那样,可以从 bsd-games 包中获取该游戏的另一个版本,该软件包可能存在于你的发行版中的默认仓库。
你有喜欢的命令行玩具认为我们应该介绍么?今天我们的系列结束了,但我们仍然乐于在新的一年中介绍一些很酷的命令行玩具。请在下面的评论中告诉我,我会查看一下。让我知道你对今天玩具的看法。
一定要看看昨天的玩具,[能从远程获得乐趣的 Linux 命令][7],明年再见!
--------------------------------------------------------------------------------
via: https://opensource.com/article/18/12/linux-toy-adventure
作者:[Jason Baker][a]
选题:[lujun9972][b]
译者:[geekpi](https://github.com/geekpi)
校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://opensource.com/users/jason-baker
[b]: https://github.com/lujun9972
[1]: https://opensource.com/article/18/12/linux-toy-boxes
[2]: https://opensource.com/users/holmja
[3]: https://gitlab.com/esr/open-adventure (https://gitlab.com/esr/open-adventure)
[4]: https://opensource.com/article/17/6/revisit-colossal-cave-adventure-open-adventure
[5]: https://gitlab.com/esr/open-adventure
[6]: https://gitlab.com/esr/open-adventure/blob/master/INSTALL.adoc
[7]: https://opensource.com/article/18/12/linux-toy-remote

View File

@@ -0,0 +1,184 @@
[#]: collector: (lujun9972)
[#]: translator: (wxy)
[#]: reviewer: (wxy)
[#]: publisher: (wxy)
[#]: url: (https://linux.cn/article-10538-1.html)
[#]: subject: (How To Display Thumbnail Images In Terminal)
[#]: via: (https://www.ostechnix.com/how-to-display-thumbnail-images-in-terminal/)
[#]: author: (SK https://www.ostechnix.com/author/sk/)
如何在终端显示图像缩略图
======
![](https://www.ostechnix.com/wp-content/uploads/2019/01/lsix-720x340.png)
不久前,我们讨论了 [Fim][1],这是一个轻量级的命令行图像查看器应用程序,用于从命令行显示各种类型的图像,如 bmp、gif、jpeg 和 png 等。今天,我偶然发现了一个名为 `lsix` 的类似工具。它类似于类 Unix 系统中的 `ls` 命令,但仅适用于图像。`lsix` 是一个简单的命令行实用程序,旨在使用 Sixel 图形格式在终端中显示缩略图。对于那些想知道的人来说Sixel 是<ruby>六像素<rt>six pixels</rt></ruby>的缩写,是一种位图图形格式。它使用 ImageMagick因此几乎所有 imagemagick 支持的文件格式都可以正常工作。
### 功能
关于 `lsix` 的功能,我们可以列出如下:
* 自动检测你的终端是否支持 Sixel 图形格式。如果你的终端不支持 Sixel它会通知你启用它。
* 自动检测终端背景颜色。它使用终端转义序列来试图找出终端应用程序的前景色和背景色,并清楚地显示缩略图。
* 如果目录中有更多图像(通常大于 21 个),`lsix` 将一次显示这些图像因此你无需等待创建整个蒙太奇图像LCTT 译注:拼贴图)。
* 可以通过 SSH 工作,因此你可以轻松操作存储在远程 Web 服务器上的图像。
* 它支持非位图图形,例如 .svg、.eps、.pdf、.xcf 等。
* 用 Bash 编写,适用于几乎所有 Linux 发行版。
### 安装 lsix
由于 `lsix` 使用 ImageMagick请确保已安装它。它在大多数 Linux 发行版的默认软件库中都可用。 例如,在 Arch Linux 及其变体如 Antergos、Manjaro Linux 上可以使用以下命令安装ImageMagick
```
$ sudo pacman -S imagemagick
```
在 Debian、Ubuntu、Linux Mint
```
$ sudo apt-get install imagemagick
```
`lsix` 并不需要安装,因为它只是一个 Bash 脚本。只需要下载它并移动到你的 `$PATH` 中。就这么简单。
从该项目的 GitHub 主页下载最新的 `lsix` 版本。我使用如下命令下载 `lsix` 归档包:
```
$ wget https://github.com/hackerb9/lsix/archive/master.zip
```
提取下载的 zip 文件:
```
$ unzip master.zip
```
此命令将所有内容提取到名为 `lsix-master` 的文件夹中。将 `lsix` 二进制文件从此目录复制到 `$PATH` 中,例如 `/usr/local/bin/`
```
$ sudo cp lsix-master/lsix /usr/local/bin/
```
最后,使 `lsix` 二进制文件可执行:
```
$ sudo chmod +x /usr/local/bin/lsix
```
如此,现在是在终端本身显示缩略图的时候了。
在开始使用 `lsix` 之前,请确保你的终端支持 Sixel 图形格式。
开发人员在 vt340 仿真模式下的 Xterm 上开发了 `lsix`。 然而,他声称 `lsix` 应该适用于任何Sixel 兼容终端。
Xterm 支持 Sixel 图形格式,但默认情况下不启用。
你可以从另外一个终端使用命令来启动一个启用了 Sixel 模式的 Xterm
```
$ xterm -ti vt340
```
或者,你可以使 vt340 成为 Xterm 的默认终端类型,如下所述。
编辑 `.Xresources` 文件(如果它不可用,只需创建它):
```
$ vi .Xresources
```
添加如下行:
```
xterm*decTerminalID : vt340
```
按下 `ESC` 并键入 `:wq` 以保存并关闭该文件。
最后,运行如下命令来应用改变:
```
$ xrdb -merge .Xresources
```
现在,每次启动 Xterm 就会默认启用 Sixel 图形支持。
### 在终端中显示缩略图
启动 Xterm不要忘记以 vt340 模式启动它)。以下是 Xterm 在我的系统中的样子。
![](https://www.ostechnix.com/wp-content/uploads/2019/01/xterm-1.png)
就像我已经说过的那样,`lsix` 非常简单实用。它没有任何命令行选项或配置文件。你所要做的就是将文件的路径作为参数传递,如下所示。
```
$ lsix ostechnix/logo.png
```
![](https://www.ostechnix.com/wp-content/uploads/2019/01/lsix-4.png)
如果在没有路径的情况下运行它,它将显示在当前工作目录中的缩略图图像。我在名为 `ostechnix` 的目录中有几个文件。
要显示此目录中的缩略图,只需运行:
```
$ lsix
```
![](https://www.ostechnix.com/wp-content/uploads/2019/01/lsix-1.png)
看到了吗?所有文件的缩略图都显示在终端里。
如果使用 `ls` 命令,则只能看到文件名,而不是缩略图。
![][3]
你还可以使用通配符显示特定类型的指定图像或一组图像。
例如,要显示单个图像,只需提及图像的完整路径,如下所示。
```
$ lsix girl.jpg
```
![](https://www.ostechnix.com/wp-content/uploads/2019/01/lsix-2.png)
要显示特定类型的所有图像,例如 PNG请使用如下所示的通配符。
```
$ lsix *.png
```
![][4]
对于 JEPG 类型,命令如下:
```
$ lsix *jpg
```
缩略图的显示质量非常好。我以为 `lsix` 会显示模糊的缩略图。但我错了,缩略图清晰可见,就像在图形图像查看器上一样。
而且,这一切都是唾手可得。如你所见,`lsix``ls` 命令非常相似,但它仅用于显示缩略图。如果你在工作中处理很多图像,`lsix` 可能会非常方便。试一试,请在下面的评论部分告诉我们你对此实用程序的看法。如果你知道任何类似的工具,也请提出建议。我将检查并更新本指南。
更多好东西即将到来。敬请关注!
干杯!
--------------------------------------------------------------------------------
via: https://www.ostechnix.com/how-to-display-thumbnail-images-in-terminal/
作者:[SK][a]
选题:[lujun9972][b]
译者:[wxy](https://github.com/wxy)
校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://www.ostechnix.com/author/sk/
[b]: https://github.com/lujun9972
[1]: https://www.ostechnix.com/how-to-display-images-in-the-terminal/
[2]: data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7
[3]: http://www.ostechnix.com/wp-content/uploads/2019/01/ls-command-1.png
[4]: http://www.ostechnix.com/wp-content/uploads/2019/01/lsix-3.png

View File

@@ -1,14 +1,15 @@
[#]: collector: (lujun9972)
[#]: translator: (HankChow)
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: reviewer: (wxy)
[#]: publisher: (wxy)
[#]: url: (https://linux.cn/article-10527-1.html)
[#]: subject: (Hacking math education with Python)
[#]: via: (https://opensource.com/article/19/1/hacking-math)
[#]: author: (Don Watkins https://opensource.com/users/don-watkins)
将 Python 结合到数学教育中
======
> 身兼教师、开发者、作家数职的 Peter Farrell 来讲述为什么使用 Python 来讲数学课会比传统方法更加好。
![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/getting_started_with_python.png?itok=MFEKm3gl)
@@ -19,11 +20,11 @@
Peter 的灵感来源于 Logo 语言之父 [Seymour Papert][2],他的 Logo 语言现在还存在于 Python 的 [Turtle 模块][3]中。Logo 语言中的海龟形象让 Peter 喜欢上了 Python并且进一步将 Python 应用到数学教学中。
Peter 在他的新书《[<ruby>Python 数学奇遇记<rt>Math Adventures with Python</rt></ruby>][5]》中分享了他的方法:“图文并茂地指导如何用代码探索数学”。因此我最近对他进行了一次采访,向他了解更多这方面的情况。
Peter 在他的新书《<ruby>[Python 数学奇遇记][5]<rt>Math Adventures with Python</rt></ruby>》中分享了他的方法:“图文并茂地指导如何用代码探索数学”。因此我最近对他进行了一次采访,向他了解更多这方面的情况。
**Don Watkins注:本文作者):** 你的教学背景是什么?
**Don WatkinsLCTT 译注:本文作者):** 你的教学背景是什么?
**Peter Farrell** 我曾经当过八年的数学老师,之后又了十年的数学。我还在当老师的时候,就阅读过 Papert 的 《[<ruby>头脑风暴<rt>Mindstorms</rt></ruby>][6]》并从中受到了启发,将 Logo 语言和海龟引入到了我所有的数学课上。
**Peter Farrell** 我曾经当过八年的数学老师,之后又了十年的数学私教。我还在当老师的时候,就阅读过 Papert 的 《<ruby>[头脑风暴][6]<rt>Mindstorms</rt></ruby>》并从中受到了启发,将 Logo 语言和海龟引入到了我所有的数学课上。
**DW** 你为什么开始使用 Python 呢?
@@ -68,7 +69,7 @@ via: https://opensource.com/article/19/1/hacking-math
作者:[Don Watkins][a]
选题:[lujun9972][b]
译者:[HankChow](https://github.com/HankChow)
校对:[校对者ID](https://github.com/校对者ID)
校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出

View File

@@ -0,0 +1,60 @@
[#]: collector: (lujun9972)
[#]: translator: (geekpi)
[#]: reviewer: (wxy)
[#]: publisher: (wxy)
[#]: url: (https://linux.cn/article-10535-1.html)
[#]: subject: (Getting started with Sandstorm, an open source web app platform)
[#]: via: (https://opensource.com/article/19/1/productivity-tool-sandstorm)
[#]: author: (Kevin Sonney https://opensource.com/users/ksonney (Kevin Sonney))
开始使用 Sandstorm 吧,一个开源 Web 应用平台
======
> 了解 Sandstorm这是我们在开源工具系列中的第三篇它将在 2019 年提高你的工作效率。
![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/sand_dunes_desert_hills_landscape_nature.jpg?itok=wUByylBb)
每年年初似乎都有疯狂的冲动想提高工作效率。新年的决心,渴望开启新的一年,当然,“抛弃旧的,拥抱新的”的态度促成了这一切。通常这时的建议严重偏向闭源和专有软件,但事实上并不用这样。
这是我挑选出的 19 个新的(或者对你而言新的)开源工具中的第三个工具来帮助你在 2019 年更有效率。
### Sandstorm
保持高效不仅仅需要待办事项以及让事情有组织。通常它需要一组工具以使工作流程顺利进行。
![](https://opensource.com/sites/default/files/uploads/sandstorm_1.png)
[Sandstorm][1] 是打包的开源应用集合,它们都可从一个 Web 界面访问,也可在中央控制台进行管理。你可以自己托管或使用 [Sandstorm Oasis][2] 服务。它按用户收费。
![](https://opensource.com/sites/default/files/uploads/sandstorm_2.png)
Sandstorm 有一个市场,在这里可以轻松安装应用。应用包括效率类、财务、笔记、任务跟踪、聊天、游戏等等。你还可以按照[开发人员文档][3]中的应用打包指南打包自己的应用并上传它们。
![](https://opensource.com/sites/default/files/uploads/sandstorm_3.png)
安装后,用户可以创建 [grain][4] - 容器化后的应用数据实例。默认情况下grain 是私有的,它可以与其他 Sandstorm 用户共享。这意味着它们默认是安全的,用户可以选择与他人共享的内容。
![](https://opensource.com/sites/default/files/uploads/sandstorm_4.png)
Sandstorm 可以从几个不同的外部源进行身份验证,也可以使用无需密码的基于电子邮件的身份验证。使用外部服务意味着如果你已使用其中一种受支持的服务,那么就无需管理另一组凭据。
最后Sandstorm 使安装和使用支持的协作应用变得快速,简单和安全。
--------------------------------------------------------------------------------
via: https://opensource.com/article/19/1/productivity-tool-sandstorm
作者:[Kevin Sonney][a]
选题:[lujun9972][b]
译者:[geekpi](https://github.com/geekpi)
校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://opensource.com/users/ksonney (Kevin Sonney)
[b]: https://github.com/lujun9972
[1]: https://sandstorm.io/
[2]: https://oasis.sandstorm.io
[3]: https://docs.sandstorm.io/en/latest/developing/
[4]: https://sandstorm.io/how-it-works

View File

@@ -0,0 +1,59 @@
[#]: collector: (lujun9972)
[#]: translator: (geekpi)
[#]: reviewer: (wxy)
[#]: publisher: (wxy)
[#]: url: (https://linux.cn/article-10539-1.html)
[#]: subject: (Get started with TaskBoard, a lightweight kanban board)
[#]: via: (https://opensource.com/article/19/1/productivity-tool-taskboard)
[#]: author: (Kevin Sonney https://opensource.com/users/ksonney (Kevin Sonney))
开始使用 TaskBoard 吧,一款轻量级看板
======
> 了解我们在开源工具系列中的第九个工具,它将帮助你在 2019 年提高工作效率。
![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/checklist_hands_team_collaboration.png?itok=u82QepPk)
每年年初似乎都有疯狂的冲动想提高工作效率。新年的决心,渴望开启新的一年,当然,“抛弃旧的,拥抱新的”的态度促成了这一切。通常这时的建议严重偏向闭源和专有软件,但事实上并不用这样。
这是我挑选出的 19 个新的(或者对你而言新的)开源工具中的第九个工具来帮助你在 2019 年更有效率。
### TaskBoard
正如我在本系列的[第二篇文章][1]中所写的那样,[看板][2]现在非常受欢迎。但并非所有的看板都是相同的。[TaskBoard][3] 是一个易于在现有 Web 服务器上部署的 PHP 应用,它有一些易于使用和管理的功能。
![](https://opensource.com/sites/default/files/uploads/taskboard-1.png)
[安装][4]它只需要解压 Web 服务器上的文件,运行一两个脚本,并确保目录可正常访问。第一次启动时,你会看到一个登录页面,然后可以就可以添加用户和制作看板了。看板创建选项包括添加要使用的列以及设置卡片的默认颜色。你还可以将用户分配给指定看板,这样每个人都只能看到他们需要查看的看板。
用户管理是轻量级的,所有帐户都是服务器的本地帐户。你可以为服务器上的每个用户设置默认看板,用户也可以设置自己的默认看板。当有人在多个看板上工作时,这个选项非常有用。
![](https://opensource.com/sites/default/files/uploads/taskboard-2.png)
TaskBoard 还允许你创建自动操作,包括更改用户分配、列或卡片类别这些操作。虽然 TaskBoard 不如其他一些看板应用那么强大,但你可以设置自动操作,使看板用户更容易看到卡片、清除截止日期,并根据需要自动为人们分配新卡片。例如,在下面的截图中,如果将卡片分配给 “admin” 用户,那么它的颜色将更改为红色,并且当将卡片分配给我的用户时,其颜色将更改为蓝绿色。如果项目已添加到“待办事项”列,我还添加了一个操作来清除项目的截止日期,并在发生这种情况时自动将卡片分配给我的用户。
![](https://opensource.com/sites/default/files/uploads/taskboard-3.png)
卡片非常简单。虽然它们没有开始日期,但它们确实有结束日期和点数字段。点数可用于估计所需的时间、所需的工作量或仅是一般优先级。使用点数是可选的,但如果你使用 TaskBoard 进行 scrum 规划或其他敏捷技术,那么这是一个非常方便的功能。你还可以按用户和类别过滤视图。这对于正在进行多个工作流的团队非常有用,因为它允许团队负责人或经理了解进度状态或人员工作量。
![](https://opensource.com/sites/default/files/uploads/taskboard-4.png)
如果你需要一个相当轻便的看板,请看下 TaskBoard。它安装快速有一些很好的功能且非常、非常容易使用。它还足够的灵活性可用于开发团队个人任务跟踪等等。
--------------------------------------------------------------------------------
via: https://opensource.com/article/19/1/productivity-tool-taskboard
作者:[Kevin Sonney][a]
选题:[lujun9972][b]
译者:[geekpi](https://github.com/geekpi)
校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://opensource.com/users/ksonney (Kevin Sonney)
[b]: https://github.com/lujun9972
[1]: https://linux.cn/article-10454-1.html
[2]: https://en.wikipedia.org/wiki/Kanban
[3]: https://taskboard.matthewross.me/
[4]: https://taskboard.matthewross.me/docs/

View File

@@ -1,26 +1,26 @@
[#]: collector: (lujun9972)
[#]: translator: (bestony)
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: reviewer: (wxy)
[#]: publisher: (wxy)
[#]: url: (https://linux.cn/article-10532-1.html)
[#]: subject: (PyGame Zero: Games without boilerplate)
[#]: via: (https://opensource.com/article/19/1/pygame-zero)
[#]: author: (Moshe Zadka https://opensource.com/users/moshez)
PyGame Zero: 从 0 开始的游戏
PyGame Zero: 无需模板的游戏开发
======
在你的游戏开发过程中有了 PyGame Zero和枯燥的模板说再见吧。
> 在你的游戏开发过程中有了 PyGame Zero和枯燥的模板说再见吧。
![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/python3-game.png?itok=jG9UdwC3)
Python 一个很好的入门编程语言。并且,游戏是一个很好的入门项目:它们是可视化的,自驱动的,并且可以很愉快的与朋友和家人分享。虽然,绝大多数的 Python 写就的库,比如 [PyGame][1] ,会让初学者因为忘记微小的细节很容易导致什么都没渲染而感到困扰
Python 一个很好的入门编程语言。并且,游戏是一个很好的入门项目:它们是可视化的,自驱动的,并且可以很愉快的与朋友和家人分享。虽然,绝大多数的 Python 写就的库,比如 [PyGame][1] ,会让初学者因为忘记微小的细节很容易导致什么都没渲染而感到困扰
人们理解所有部分的原因前,他们将其中的许多部分都视为“无意识的板文件”——需要复制和粘贴到程序中才能使其工作的神奇段落。
在理解所有部分的作用之前,他们将其中的许多部分都视为“无意识的板文件”——需要复制和粘贴到程序中才能使其工作的神奇段落。
[PyGame Zero][2] 试图通过在 PyGame 上放置一个抽象层来弥合这一差距,因此它实际上并不需要模板。
[PyGame Zero][2] 试图通过在 PyGame 上放置一个抽象层来弥合这一差距,因此它字面上并不需要模板。
我们在字面上说的,就是我们的意思
我们在说的“字面”,就是在指字面。
这是一个合格的 PyGame Zero 文件:
@@ -28,17 +28,17 @@ Python 说一个很好的入门编程语言。并且,游戏是一个很好的
# This comment is here for clarity reasons
```
我们可以将它放在一个 **game.py** 文件里,并运行:
我们可以将它放在一个 `game.py` 文件里,并运行:
```
$ pgzrun game.py
```
这将会展示一个可以通过关闭窗口或按下**CTRL-C**中断的窗口,并在后台运行一个游戏循环
这将会展示一个窗口,并运行一个可以通过关闭窗口或按下 `CTRL-C` 中断的游戏循环
遗憾的是,这将是一场无聊的游戏。什么都没发生。
为了让更有趣一点,我们可以画一个不同的背景:
为了让更有趣一点,我们可以画一个不同的背景:
```
def draw():
@@ -59,10 +59,9 @@ def update():
这将会让窗口从黑色开始,逐渐变亮,直到变为亮红色,再返回黑色,一遍一遍循环。
**update** 函数更新了 **draw** 渲染这个游戏所需的这些参数的值
`update` 函数更新了参数的值,而 `draw` 基于这些参数渲染这个游戏
即使是这样,这里也没有任何方式给玩家与这个游戏的交互的方式。
让我们试试其他一些事情:
即使是这样,这里也没有任何方式给玩家与这个游戏的交互的方式。让我们试试其他一些事情:
```
colors = [0, 0, 0]
@@ -77,7 +76,7 @@ def on_key_down(key, mod, unicode):
    colors[1] = (colors[1] + 1) % 256
```
现在,按下按来提升亮度。
现在,按下按来提升亮度。
这些包括游戏循环的三个重要部分:响应用户输入,更新参数和重新渲染屏幕。
@@ -92,7 +91,7 @@ via: https://opensource.com/article/19/1/pygame-zero
作者:[Moshe Zadka][a]
选题:[lujun9972][b]
译者:[bestony](https://github.com/bestony)
校对:[校对者ID](https://github.com/校对者ID)
校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出

View File

@@ -0,0 +1,138 @@
[#]: collector: (lujun9972)
[#]: translator: (wxy)
[#]: reviewer: (wxy)
[#]: publisher: (wxy)
[#]: url: (https://linux.cn/article-10534-1.html)
[#]: subject: (Top 5 Linux Distributions for Development in 2019)
[#]: via: (https://www.linux.com/blog/2019/1/top-5-linux-distributions-development-2019)
[#]: author: (Jack Wallen https://www.linux.com/users/jlwallen)
5 个用于开发工作的 Linux 发行版
======
> 这五个发行版用于开发工作将不会让你失望。
![](https://www.linux.com/sites/lcom/files/styles/rendered_file/public/dev-main.jpg?itok=DEe9pYtb)
Linux 上最受欢迎的任务之一肯定是开发。理由很充分:业务依赖于 Linux。没有 Linux技术根本无法满足当今不断发展的世界的需求。因此开发人员不断努力改善他们的工作环境。而进行此类改善的一种方法就是拥有合适的平台。值得庆幸的是这就是 Linux所以你总是有很多选择。
但有时候,太多的选择本身就是一个问题。哪种发行版适合你的开发需求?当然,这取决于你正在开发的工作,但某些发行版更适合作为你的工作任务的基础。我将重点介绍我认为 2019 年最适合开发人员的五个发行版。
### Ubuntu
无需赘言。虽然 Linux Mint 的忠实用户无疑是一个非常忠诚的群体(这是有充分的理由的,他们选择的发行版很棒),但 Ubuntu Linux 在这里更被认可。为什么?因为有像 [AWS][1] 这样的云服务商存在Ubuntu 成了部署最多的服务器操作系统之一。这意味着在 Ubuntu 桌面发行版上进行开发可以更轻松地转换为 Ubuntu Server。而且因为 Ubuntu 使得开发、使用和部署容器非常容易,所以你想要使用这个平台是完全合理的。而 Ubuntu 与其包含的 Snap 软件包相结合,使得这个 CanonicalUbuntu 发行版背后的公司)的操作系统如虎添翼。
但这不仅是你可以用 Ubuntu 做什么而是你可以轻松做到。几乎对于所有的任务Ubuntu 都是一个非常易用的发行版。而且因为 Ubuntu 如此受欢迎,所以你可以从 Ubuntu “软件” 应用的图形界面里轻松安装你想要使用的每个工具和 IDE图 1
![Ubuntu][3]
*图 1可以在 Ubuntu “软件”工具里面找到开发者工具。*
如果你正在寻求易用、易于迁移,以及大量的工具,那么将 Ubuntu 作为开发平台就不会有错。
### openSUSE
我将 openSUSE 添加到此列表中有一个非常具体的原因。它不仅是一个出色的桌面发行版,它还是市场上最好的滚动发行版之一。因此,如果你希望用最新的软件开发、发布最新的软件,[openSUSE Tumbleweed][5] 应该是你的首选之一。如果你想使用最喜欢的 IDE 的最新版本,如果你总是希望确保使用最新的库和工具包进行开发,那么 Tumbleweed 就是你的平台。
但 openSUSE 不仅提供滚动发布版本。如果你更愿意使用标准发行版,那么 [openSUSE Leap][6] 就是你想要的。
当然它不仅有标准版或滚动版openSUSE 平台还有一个名为 [Kubic][7] 的 Kubernetes 特定版本,该版本基于 openSUSE MicroOS 上的 Kubernetes。但即使你没有为 Kubernetes 进行开发,你也会发现许多软件和工具可供使用。
openSUSE 还提供了选择桌面环境的能力,或者你也可以选择通用桌面或服务器(图 2
![openSUSE][9]
*图 2 正在安装 openSUSE Tumbleweed。*
### Fedora
使用 Fedora 作为开发平台才有意义。为什么这个发行版本身似乎是面向开发人员的。通过定期的六个月发布周期开发人员可以确保他们不会一直使用过时的软件。当你需要最新的工具和库时这很重要。如果你正在开发企业级业务Fedora 是一个理想的平台,因为它是红帽企业 LinuxRHEL的上游。这意味着向 RHEL 的过渡应该是无痛的。这一点很重要,特别是如果你希望将你的项目带到一个更大的市场(一个比以桌面为中心的目标更深的领域)。
Fedora 还提供了你将体验到的最佳 GNOME 体验之一(图 3。换言之这是非常稳定和快速的桌面。
![GNOME][11]
*图 3Fedora 上的 GNOME 桌面。*
但是如果 GNOME 不是你的菜,你还可以选择安装一个 [Fedora 花样版][12](包括 KDE、XFCE、LXQT、Mate-Compiz、Cinnamon、LXDE 和 SOAS 等桌面环境)。
### Pop!_OS
如果这个列表中我没有包括 [System76][13] 平台专门为他们的硬件定制的操作系统(虽然它也在其他硬件上运行良好),那我算是失职了。为什么我要包含这样的发行版,尤其是它还并未远离其所基于的 Ubuntu 平台?主要是因为如果你计划从 System76 购买台式机或笔记本电脑,那它就是你想要的发行版。但是你为什么要这样做呢(特别是考虑到 Linux 几乎适用于所有现成的硬件)?因为 System76 销售的出色硬件。随着他们的 Thelio 桌面的发布,这是你可以使用的市场上最强大的台式计算机之一。如果你正在努力开发大型应用程序(特别是那些非常依赖于非常大的数据库或需要大量处理能力进行编译的应用程序),为什么不用最好的计算机呢?而且由于 Pop!_OS 完全适用于 System76 硬件,因此这是一个明智的选择。
由于 Pop!_OS 基于 Ubuntu因此你可以轻松获得其所基于的 Ubuntu 可用的所有工具(图 4
![Pop!_OS][15]
*图 4运行在 Pop!_OS 上的 Anjunta IDE*
Pop!_OS 也会默认加密驱动器,因此你可以放心你的工作可以避免窥探(如果你的硬件落入坏人之手)。
### Manjaro
对于那些喜欢在 Arch Linux 上开发,但不想经历安装和使用 Arch Linux 的所有环节的人来说,那选择就是 Manjaro。Manjaro 可以轻松地启动和运行一个基于 Arch Linux 的发行版(就像安装和使用 Ubuntu 一样简单)。
但是 Manjaro 对开发人员友好的原因(除了享受 Arch 式好处)是你可以下载好多种不同口味的桌面。从[Manjaro 下载页面][16] 中,你可以获得以下口味:
* GNOME
* XFCE
* KDE
* OpenBox
* Cinnamon
* I3
* Awesome
* Budgie
* Mate
* Xfce 开发者预览版
* KDE 开发者预览版
* GNOME 开发者预览版
* Architect
* Deepin
值得注意的是它的开发者版本面向测试人员和开发人员Architect 版本(适用于想要从头开始构建 Manjaro 的用户)和 Awesome 版本(图 5适用于开发人员处理日常工作的版本。使用 Manjaro 的一个警告是,与任何滚动版本一样,你今天开发的代码可能明天无法运行。因此,你需要具备一定程度的敏捷性。当然,如果你没有为 Manjaro或 Arch做开发并且你正在进行工作更多是通用的或 Web开发那么只有当你使用的工具被更新了且不再适合你时才会影响你。然而这种情况发生的可能性很小。和大多数 Linux 发行版一样,你会发现 Manjaro 有大量的开发工具。
![Manjaro][18]
*图 5Manjaro Awesome 版对于开发者来说很棒。*
Manjaro 还支持 AURArch User Repository —— Arch 用户的社区驱动软件库),其中包括最先进的软件和库,以及 [Unity Editor][19] 或 yEd 等专有应用程序。但是,有个关于 AUR 的警告AUR 包含的软件中被怀疑发现了恶意软件。因此,如果你选择使用 AUR请谨慎操作风险自负。
### 其实任何 Linux 都可以
说实话,如果你是开发人员,几乎任何 Linux 发行版都可以工作。如果从命令行执行大部分开发,则尤其如此。但是如果你喜欢在可靠的桌面上运行一个好的图形界面程序,试试这些发行版中的一个,它们不会令人失望。
通过 Linux 基金会和 edX 的免费[“Linux 简介”][20]课程了解有关 Linux 的更多信息。
--------------------------------------------------------------------------------
via: https://www.linux.com/blog/2019/1/top-5-linux-distributions-development-2019
作者:[Jack Wallen][a]
选题:[lujun9972][b]
译者:[wxy](https://github.com/wxy)
校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://www.linux.com/users/jlwallen
[b]: https://github.com/lujun9972
[1]: https://aws.amazon.com/
[2]: https://www.linux.com/files/images/dev1jpg
[3]: https://www.linux.com/sites/lcom/files/styles/rendered_file/public/dev_1.jpg?itok=7QJQWBKi (Ubuntu)
[4]: https://www.linux.com/licenses/category/used-permission
[5]: https://en.opensuse.org/Portal:Tumbleweed
[6]: https://en.opensuse.org/Portal:Leap
[7]: https://software.opensuse.org/distributions/tumbleweed
[8]: /files/images/dev2jpg
[9]: https://www.linux.com/sites/lcom/files/styles/rendered_file/public/dev_2.jpg?itok=1GJmpr1t (openSUSE)
[10]: /files/images/dev3jpg
[11]: https://www.linux.com/sites/lcom/files/styles/rendered_file/public/dev_3.jpg?itok=_6Ki4EOo (GNOME)
[12]: https://spins.fedoraproject.org/
[13]: https://system76.com/
[14]: /files/images/dev4jpg
[15]: https://www.linux.com/sites/lcom/files/styles/rendered_file/public/dev_4.jpg?itok=nNG2Ax24 (Pop!_OS)
[16]: https://manjaro.org/download/
[17]: /files/images/dev5jpg
[18]: https://www.linux.com/sites/lcom/files/styles/rendered_file/public/dev_5.jpg?itok=RGfF2UEi (Manjaro)
[19]: https://unity3d.com/unity/editor
[20]: https://training.linuxfoundation.org/linux-courses/system-administration-training/introduction-to-linux

View File

@@ -1,15 +1,17 @@
[#]: collector: (lujun9972)
[#]: translator: (geekpi)
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: reviewer: (wxy)
[#]: publisher: (wxy)
[#]: url: (https://linux.cn/article-10525-1.html)
[#]: subject: (Get started with eDEX-UI, a Tron-influenced terminal program for tablets and desktops)
[#]: via: (https://opensource.com/article/19/1/productivity-tool-edex-ui)
[#]: author: (Kevin Sonney https://opensource.com/users/ksonney (Kevin Sonney))
开始使用 eDEX-UI一款受《创:战纪》影响的平板电脑和台式机终端程序
开始使用 eDEX-UI,一款受《电子世界争霸战》影响的终端程序
======
使用 eDEX-UI 让你的工作更有趣,这是我们开源工具系列中的第 15 个工具,它将使你在 2019 年更高效。
> 使用 eDEX-UI 让你的工作更有趣,这是我们开源工具系列中的第 15 个工具,它将使你在 2019 年更高效。
![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/button_push_open_keyboard_file_organize.png?itok=KlAsk1gx)
每年年初似乎都有疯狂的冲动想提高工作效率。新年的决心,渴望开启新的一年,当然,“抛弃旧的,拥抱新的”的态度促成了这一切。通常这时的建议严重偏向闭源和专有软件,但事实上并不用这样。
@@ -18,25 +20,25 @@
### eDEX-UI
当[《创:战纪》][1]上映时我才 11岁。我不能否认,尽管这部电影充满幻想,但它对我后来的职业选择产生了影响。
当[《电子世界争霸战》][1]上映时我才 11 岁。我不能否认,尽管这部电影充满幻想,但它对我后来的职业选择产生了影响。
![](https://opensource.com/sites/default/files/uploads/edex-ui-1.png)
[eDEX-UI][2] 是一款专为平板电脑和台式机设计的跨平台终端程序,它受到《创:战纪》用户界面的启发。它在选项卡式界面中有五个终端,因此可以轻松地在任务之间切换,以及显示有用的系统信息。
[eDEX-UI][2] 是一款专为平板电脑和台式机设计的跨平台终端程序,它的用户界面受到《电子世界争霸战》的启发。它在选项卡式界面中有五个终端,因此可以轻松地在任务之间切换,以及显示有用的系统信息。
在启动时eDEX-UI 会启动一系列的东西,其中包含它所基于的 ElectronJS 系统的信息。启动后eDEX-UI 会显示系统信息、文件浏览器、键盘(用于平板电脑)和主终端选项卡。其他四个选项卡(被标记为 EMPTY没有加载任何内容并且当你单击它时将启动一个 shell。eDEX-UI 中的默认 shell 是 Bash如果在 Windows 上,则可能需要将其更改为 PowerShell 或 cmd.exe
![](https://opensource.com/sites/default/files/uploads/edex-ui-2.png)
更改文件浏览器中的目录将更改活动终端中的目录,反之亦然。文件浏览器可以执行你期望的所有操作,包括在单击文件时打开关联的应用。唯一的例外是 eDEX-UI 的 settings.json 文件(默认.config/eDEX-UI它会打开配置编辑器。这允许你为终端设置 shell 命令、更改主题以及修改用户界面的其他几个设置。主题也保存在配置目录中,因为它们也是 JSON 文件,所以创建自定义主题非常简单。
更改文件浏览器中的目录将更改活动终端中的目录,反之亦然。文件浏览器可以执行你期望的所有操作,包括在单击文件时打开关联的应用。唯一的例外是 eDEX-UI 的 `settings.json` 文件(默认`.config/eDEX-UI`),它会打开配置编辑器。这允许你为终端设置 shell 命令、更改主题以及修改用户界面的其他几个设置。主题也保存在配置目录中,因为它们也是 JSON 文件,所以创建自定义主题非常简单。
![](https://opensource.com/sites/default/files/uploads/edex-ui-3.png)
eDEX-UI 允许你使用完全仿真运行五个终端。默认终端类型是 xterm-color这意味着它支持全色彩。需要注意的一点是输入时键会亮起,因此如果你在平板电脑上使用 eDEX-UI键盘可能会在人们看见屏幕的环境中带来安全风险。因此最好在这些设备上使用没有键盘的主题尽管在打字时看起来确实很酷。
eDEX-UI 允许你使用完全仿真运行五个终端。默认终端类型是 xterm-color这意味着它支持全色彩。需要注意的一点是输入时键会亮起因此如果你在平板电脑上使用 eDEX-UI键盘可能会在人们看见屏幕的环境中带来安全风险。因此最好在这些设备上使用没有键盘的主题尽管在打字时看起来确实很酷。
![](https://opensource.com/sites/default/files/uploads/edex-ui-4.png)
虽然 eDEX-UI 仅支持五个终端窗口但这对我来说已经足够了。在平板电脑上eDEX-UI 给了我网络空间的感觉而不会影响我的效率。在桌面上eDEX-UI 支持所有功能,并让我在我的同事面前显得很酷。
虽然 eDEX-UI 仅支持五个终端窗口但这对我来说已经足够了。在平板电脑上eDEX-UI 给了我网络空间而不会影响我的效率。在桌面上eDEX-UI 支持所有功能,并让我在我的同事面前显得很酷。
--------------------------------------------------------------------------------
@@ -45,7 +47,7 @@ via: https://opensource.com/article/19/1/productivity-tool-edex-ui
作者:[Kevin Sonney][a]
选题:[lujun9972][b]
译者:[geekpi](https://github.com/geekpi)
校对:[校对者ID](https://github.com/校对者ID)
校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出

View File

@@ -0,0 +1,73 @@
[#]: collector: (lujun9972)
[#]: translator: (geekpi)
[#]: reviewer: (wxy)
[#]: publisher: (wxy)
[#]: url: (https://linux.cn/article-10536-1.html)
[#]: subject: (3 simple and useful GNOME Shell extensions)
[#]: via: (https://fedoramagazine.org/3-simple-and-useful-gnome-shell-extensions/)
[#]: author: (Ryan Lerch https://fedoramagazine.org/introducing-flatpak/)
3 个简单实用的 GNOME Shell 扩展
======
![](https://fedoramagazine.org/wp-content/uploads/2019/01/3simple-816x345.png)
Fedora 工作站的默认桌面 GNOME Shell因其极简、整洁的用户界面而闻名并深受许多用户的喜爱。它还以可使用扩展添加到 stock 界面的能力而闻名。在本文中,我们将介绍 GNOME Shell 的 3 个简单且有用的扩展。这三个扩展为你的桌面提供了更多的行为,可以完成你可能每天都会做的简单任务。
### 安装扩展程序
安装 GNOME Shell 扩展的最快捷、最简单的方法是使用“软件”应用。有关详细信息,请查看 Magazine [以前的文章](https://fedoramagazine.org/install-extensions-via-software-application/)
![](https://fedoramagazine.org/wp-content/uploads/2018/11/installing-extensions-768x325.jpg)
### 可移动驱动器菜单
![][1]
*Fedora 29 中的 Removable Drive Menu 扩展*
首先是 [Removable Drive Menu][2] 扩展。如果你的计算机中有可移动驱动器,它是一个可在系统托盘中添加一个 widget 的简单工具。它可以使你轻松打开可移动驱动器中的文件,或者快速方便地弹出驱动器以安全移除设备。
![][3]
*软件应用中的 Removable Drive Menu*
### 扩展之扩展
![][4]
如果你一直在安装和尝试新扩展,那么 [Extensions][5] 扩展非常有用。它提供了所有已安装扩展的列表,允许你启用或禁用它们。此外,如果该扩展有设置,那么可以快速打开每个扩展的设置对话框。
![][6]
*软件中的 Extensions 扩展*
### 无用的时钟移动
![][7]
最后的是列表中最简单的扩展。[Frippery Move Clock][8],只是将时钟位置从顶部栏的中心向右移动,位于状态区旁边。
![][9]
--------------------------------------------------------------------------------
via: https://fedoramagazine.org/3-simple-and-useful-gnome-shell-extensions/
作者:[Ryan Lerch][a]
选题:[lujun9972][b]
译者:[geekpi](https://github.com/geekpi)
校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://fedoramagazine.org/introducing-flatpak/
[b]: https://github.com/lujun9972
[1]: https://fedoramagazine.org/wp-content/uploads/2019/01/removable-disk-1024x459.jpg
[2]: https://extensions.gnome.org/extension/7/removable-drive-menu/
[3]: https://fedoramagazine.org/wp-content/uploads/2019/01/removable-software-1024x723.png
[4]: https://fedoramagazine.org/wp-content/uploads/2019/01/extensions-extension-1024x459.jpg
[5]: https://extensions.gnome.org/extension/1036/extensions/
[6]: https://fedoramagazine.org/wp-content/uploads/2019/01/extensions-software-1024x723.png
[7]: https://fedoramagazine.org/wp-content/uploads/2019/01/move_clock-1024x189.jpg
[8]: https://extensions.gnome.org/extension/2/move-clock/
[9]: https://fedoramagazine.org/wp-content/uploads/2019/01/Screenshot-from-2019-01-28-21-53-18-1024x723.png

View File

@@ -1,23 +1,24 @@
[#]: collector: (lujun9972)
[#]: translator: ( dianbanjiu )
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: translator: (dianbanjiu)
[#]: reviewer: (wxy)
[#]: publisher: (wxy)
[#]: url: (https://linux.cn/article-10531-1.html)
[#]: subject: (Using more to view text files at the Linux command line)
[#]: via: (https://opensource.com/article/19/1/more-text-files-linux)
[#]: author: (Scott Nesbitt https://opensource.com/users/scottnesbitt)
在 Linux 命令行使用 more 查看文本文件
======
文本文件和 Linux 一直是携手并进的。或者说看起来如此。那你又是依靠哪些让你使用起来很舒服的工具来查看这些文本文件的呢?
> 文本文件和 Linux 一直是携手并进的。或者说看起来如此。那你又是依靠哪些让你使用起来很舒服的工具来查看这些文本文件的呢?
![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/terminal_command_linux_desktop_code.jpg?itok=p5sQ6ODE)
Linux 下有很多实用工具可以让你在终端界面查看文本文件。其中一个就是 [**more**][1]。
Linux 下有很多实用工具可以让你在终端界面查看文本文件。其中一个就是 [more][1]。
**more** 跟我之前另一篇文章里写到的工具 —— **[less][2]** 很相似。它们之间的主要不同点在于 **more** 只允许你向前查看文件。
`more` 跟我之前另一篇文章里写到的工具 —— [less][2] 很相似。它们之间的主要不同点在于 `more` 只允许你向前查看文件。
尽管它能提供的功能看起来很有限,不过它依旧有很多有用的特性值得你去了解。下面让我们来快速浏览一下 **more** 可以做什么,以及如何使用它吧。
尽管它能提供的功能看起来很有限,不过它依旧有很多有用的特性值得你去了解。下面让我们来快速浏览一下 `more` 可以做什么,以及如何使用它吧。
### 基础使用
@@ -35,9 +36,9 @@ $ more jekyll-article.md
![](https://opensource.com/sites/default/files/uploads/more-viewing-file.png)
使用空格键可以向下翻页,输入 **q** 可以退出。
使用空格键可以向下翻页,输入 `q` 可以退出。
如果你想在这个文件中搜索一些文本,输入 **/** 字符并在其后加上你想要查找的文字。例如你要查看的字段是 terminal只需输入
如果你想在这个文件中搜索一些文本,输入 `/` 字符并在其后加上你想要查找的文字。例如你要查看的字段是 terminal,只需输入:
```
/terminal
@@ -45,12 +46,13 @@ $ more jekyll-article.md
![](https://opensource.com/sites/default/files/uploads/more-searching.png)
搜索的内容是区分大小写的,所以输入 /terminal 跟 /Terminal 会出现不同的结果。
搜索的内容是区分大小写的,所以输入 `/terminal``/Terminal` 会出现不同的结果。
### 和其他实用工具组合使用
你可以通过管道将其他命令行工具得到的文本传输到 **more**。你问为什么这样做?因为有时这些工具获取的文本会超过终端一页可以显示的限度。
想要做到这个,先输入你想要使用的完整命令,后面跟上管道符(**|**),管道符后跟 **more**。假设现在有一个有很多文件的目录。你就可以组合 **more****ls** 命令完整查看这个目录当中的内容
你可以通过管道将其他命令行工具得到的文本传输到 `more`。你问为什么这样做?因为有时这些工具获取的文本会超过终端一页可以显示的限度
想要做到这个,先输入你想要使用的完整命令,后面跟上管道符(`|`),管道符后跟 `more`。假设现在有一个有很多文件的目录。你就可以组合 `more``ls` 命令完整查看这个目录当中的内容。
```shell
$ ls | more
@@ -58,7 +60,7 @@ $ ls | more
![](https://opensource.com/sites/default/files/uploads/more-with_ls_cmd.png)
你可以组合 **more****grep** 命令,从而实现在多个文件中找到指定的文本。下面是我在多篇文章的源文件中查找 productivity 的例子。
你可以组合 `more``grep` 命令,从而实现在多个文件中找到指定的文本。下面是我在多篇文章的源文件中查找 productivity 的例子。
```shell
$ grep productivity core.md Dict.md lctt2014.md lctt2016.md lctt2018.md README.md | more
@@ -66,17 +68,17 @@ $ grep productivity core.md Dict.md lctt2014.md lctt2016.md lctt2018.md RE
![](https://opensource.com/sites/default/files/uploads/more-with_grep_cmd.png)
另外一个可以和 **more** 组合的实用工具是 **ps**(列出你系统上正在运行的进程)。当你的系统上运行了很多的进程,你现在想要查看他们的时候,这个组合将会派上用场。例如你想找到一个你需要杀死的进程,只需输入下面的命令:
另外一个可以和 `more` 组合的实用工具是 `ps`(列出你系统上正在运行的进程)。当你的系统上运行了很多的进程,你现在想要查看他们的时候,这个组合将会派上用场。例如你想找到一个你需要杀死的进程,只需输入下面的命令:
```shell
$ ps -u scott | more
```
注意用你的用户名替换掉 scott。
注意用你的用户名替换掉 scott
![](https://opensource.com/sites/default/files/uploads/more-with_ps_cmd.png)
就像我文章开篇提到的, **more** 很容易使用。尽管不如它的双胞胎兄弟 **less** 那般灵活,但是仍然值得了解一下。
就像我文章开篇提到的, `more` 很容易使用。尽管不如它的双胞胎兄弟 `less` 那般灵活,但是仍然值得了解一下。
--------------------------------------------------------------------------------
@@ -85,7 +87,7 @@ via: https://opensource.com/article/19/1/more-text-files-linux
作者:[Scott Nesbitt][a]
选题:[lujun9972][b]
译者:[dianbanjiu](https://github.com/dianbanjiu)
校对:[校对者ID](https://github.com/校对者ID)
校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出

View File

@@ -1,14 +1,15 @@
[#]: collector: (lujun9972)
[#]: translator: (HankChow)
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: reviewer: (wxy)
[#]: publisher: (wxy)
[#]: url: (https://linux.cn/article-10529-1.html)
[#]: subject: (More About Angle Brackets in Bash)
[#]: via: (https://www.linux.com/blog/learn/2019/1/more-about-angle-brackets-bash)
[#]: author: (Paul Brown https://www.linux.com/users/bro66)
Bash 中尖括号的更多用法
======
> 在这篇文章,我们继续来深入探讨尖括号的更多其它用法。
![](https://www.linux.com/sites/lcom/files/styles/rendered_file/public/bash-angles.png?itok=mVFnxPzF)
@@ -22,19 +23,20 @@ Bash 中尖括号的更多用法
diff <(ls /original/dir/) <(ls /backup/dir/)
```
[`diff`][2] 命令是一个逐行比较两个文件之间差异的工具。在上面的例子中,就使用了 `<``diff` 认为两个 `ls` 命令输出的结果都是文件,从而能够比较它们之间的差异。
[diff][2] 命令是一个逐行比较两个文件之间差异的工具。在上面的例子中,就使用了 `<``diff` 认为两个 `ls` 命令输出的结果都是文件,从而能够比较它们之间的差异。
要注意,在 `<``(...)` 之间是没有空格的。
我尝试在我的图片目录和它的备份目录执行上面的命令,输出的是以下结果:
```
diff <(ls /My/Pictures/) <(ls /My/backup/Pictures/) 5d4 < Dv7bIIeUUAAD1Fc.jpg:large.jpg
diff <(ls /My/Pictures/) <(ls /My/backup/Pictures/)
5d4 < Dv7bIIeUUAAD1Fc.jpg:large.jpg
```
输出结果中的 `<` 表示 `Dv7bIIeUUAAD1Fc.jpg:large.jpg` 这个文件存在于左边的目录(`/My/Pictures`)但不存在于右边的目录(`/My/backup/Pictures`)中。也就是说,在备份过程中可能发生了问题,导致这个文件没有被成功备份。如果 `diff` 没有显示出任何输出结果,就表明两个目录中的文件是一致的。
看到这里你可能会想到,既然可以通过 `<` 将一些命令行的输出内容作为一个文件提供给一个需要接受文件格式的命令,那么在上一篇文章的“最喜欢的演员排序”例子中,就可以省去中间的一些步骤,直接对输出内容执行 `sort` 操作了。
看到这里你可能会想到,既然可以通过 `<` 将一些命令行的输出内容作为一个文件提供给一个需要接受文件格式的命令,那么在上一篇文章的“最喜欢的演员排序”例子中,就可以省去中间的一些步骤,直接对输出内容执行 `sort` 操作了。
确实如此,这个例子可以简化成这样:
@@ -42,7 +44,7 @@ diff <(ls /My/Pictures/) <(ls /My/backup/Pictures/) 5d4 < Dv7bIIeUUAAD1Fc.jpg:la
sort -r <(while read -r name surname films;do echo $films $name $surname ; done < CBactors)
```
### Here string
### Here 字符串
除此以外,尖括号的重定向功能还有另一种使用方式。
@@ -52,9 +54,9 @@ sort -r <(while read -r name surname films;do echo $films $name $surname ; done
myvar="Hello World" echo $myvar | tr '[:lower:]' '[:upper:]' HELLO WORLD
```
[`tr`][3] 命令可以将一个字符串转换为某种格式。在上面的例子中,就使用了 `tr` 将字符串中的所有小写字母都转换为大写字母。
[tr][3] 命令可以将一个字符串转换为某种格式。在上面的例子中,就使用了 `tr` 将字符串中的所有小写字母都转换为大写字母。
要理解的是,这个传递过程的重点不是变量,而是变量的值,也就是字符串 `Hello World`。这样的字符串叫做 here string,含义是“这就是我们要处理的字符串”。但对于上面的例子,还可以用更直观的方式的处理,就像下面这样:
要理解的是,这个传递过程的重点不是变量,而是变量的值,也就是字符串 `Hello World`。这样的字符串叫做 HERE 字符串,含义是“这就是我们要处理的字符串”。但对于上面的例子,还可以用更直观的方式的处理,就像下面这样:
```
tr '[:lower:]' '[:upper:]' <<< $myvar
@@ -75,13 +77,13 @@ via: https://www.linux.com/blog/learn/2019/1/more-about-angle-brackets-bash
作者:[Paul Brown][a]
选题:[lujun9972][b]
译者:[HankChow](https://github.com/HankChow)
校对:[校对者ID](https://github.com/校对者ID)
校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://www.linux.com/users/bro66
[b]: https://github.com/lujun9972
[1]: https://www.linux.com/blog/learn/2019/1/understanding-angle-brackets-bash
[1]: https://linux.cn/article-10502-1.html
[2]: https://linux.die.net/man/1/diff
[3]: https://linux.die.net/man/1/tr

View File

@@ -0,0 +1,136 @@
[#]: collector: (lujun9972)
[#]: translator: (wxy)
[#]: reviewer: (wxy)
[#]: publisher: (wxy)
[#]: url: (https://linux.cn/article-10533-1.html)
[#]: subject: (DNS and Root Certificates)
[#]: via: (https://lushka.al/dns-and-certificates/)
[#]: author: (Anxhelo Lushka https://lushka.al/)
DNS 和根证书
======
> 关于 DNS 和根证书你需要了解的内容。
由于最近发生的一些事件我们Privacy Today 组织)感到有必要写一篇关于此事的短文。它适用于所有读者,因此它将保持简单 —— 技术细节可能会在稍后的文章发布。
### 什么是 DNS为什么它与你有关
DNS 的意思是<ruby>域名系统<rt>Domain Name System</rt></ruby>,你每天都会接触到它。每当你的 Web 浏览器或任何其他应用程序连接到互联网时,它就很可能会使用域名。简单来说,域名就是你键入的地址:例如 [duckduckgo.com][1]。你的计算机需要知道它所导向的地方,会向 DNS 解析器寻求帮助。而它将返回类似 [176.34.155.23][2] 这样的 IP —— 这就是连接时所需要知道的公开网络地址。 此过程称为 DNS 查找。
这对你的隐私、安全以及你的自由都有一定的影响:
#### 隐私
由于你要求解析器获取域名的 IP因此它会确切地知道你正在访问哪些站点并且由于“物联网”通常缩写为 IoT甚至它还知道你在家中使用的是哪个设备。
#### 安全
你可以相信解析器返回的 IP 是正确的。有一些检查措施可以确保如此,在正常情况下这一般不是问题。但这些可能措施会被破坏,这就是写作本文的原因。如果返回的 IP 不正确,你可能会被欺骗引向了恶意的第三方 —— 甚至你都不会注意到任何差异。在这种情况下,你的隐私会受到更大的危害,因为不仅会被跟踪你访问了什么网站,甚至你访问的内容也会被跟踪。第三方可以准确地看到你正在查看的内容,收集你输入的个人信息(例如密码)等等。你的整个身份可以轻松接管。
#### 自由
审查通常是通过 DNS 实施的。这不是最有效的方法,但它非常普遍。即使在西方国家,它也经常被公司和政府使用。他们使用与潜在攻击者相同的方法;当你查询 IP 地址时,他们不会返回正确的 IP。他们可以表现得就好像某个域名不存在或完全将访问指向别处。
### DNS 查询的方式
#### 由你的 ISP 提供的第三方 DNS 解析器
大多数人都在使用由其互联网接入提供商ISP提供的第三方解析器。当你连接调制解调器时LCTT 译注:或宽带路由器),这些 DNS 解析器就会被自动取出,而你可能从来没注意过它。
#### 你自己选择的第三方 DNS 解析器
如果你已经知道 DNS 意味着什么,那么你可能会决定使用你选择的另一个 DNS 解析器。这可能会改善这种情况,因为它使你的 ISP 更难以跟踪你,并且你可以避免某些形式的审查。尽管追踪和审查仍然是可能的,但这种方法并没有被广泛使用。
#### 你自己(本地)的 DNS 解析器
你可以自己动手,避免使用别人的 DNS 解析器的一些危险。如果你对此感兴趣,请告诉我们。
### 根证书
#### 什么是根证书?
每当你访问以 https 开头的网站时,你都会使用它发送的证书与之通信。它使你的浏览器能够加密通信并确保没有人可以窥探。这就是为什么每个人都被告知在登录网站时要注意 https而不是 http。证书本身仅用于验证是否为某个域所生成。以及
这就是根证书的来源。可以其视为一个更高的级别,用来确保其下的级别是正确的。它验证发送给你的证书是否已由证书颁发机构授权。此权限确保创建证书的人实际上是真正的运营者。
这也被称为信任链。默认情况下,你的操作系统包含一组这些根证书,以确保该信任链的存在。
#### 滥用
我们现在知道:
* DNS 解析器在你发送域名时向你发送 IP 地址
* 证书允许加密你的通信,并验证它们是否为你访问的域生成
* 根证书验证该证书是否合法,并且是由真实站点运营者创建的
**怎么会被滥用呢?**
* 如前所述,恶意 DNS 解析器可能会向你发送错误的 IP 以进行审查。它们还可以将你导向完全不同的网站。
* 这个网站可以向你发送假的证书。
* 恶意的根证书可以“验证”此假证书。
对你来说,这个网站看起来绝对没问题;它在网址中有 https如果你点击它它会说已经通过验证。就像你了解到的一样对吗**不对!**
它现在可以接收你要发送给原站点的所有通信。这会绕过想要避免被滥用而创建的检查。你不会收到错误消息,你的浏览器也不会发觉。
**而你所有的数据都会受到损害!**
### 结论
#### 风险
* 使用恶意 DNS 解析器总是会损害你的隐私,但只要你注意 https你的安全性就不会受到损害。
* 使用恶意 DNS 解析程序和恶意根证书,你的隐私和安全性将完全受到损害。
#### 可以采取的动作
**不要安装第三方根证书!**只有非常少的例外情况才需要这样做,并且它们都不适用于一般最终用户。
**不要被那些“广告拦截”、“军事级安全”或类似的东西营销噱头所吸引**。有一些方法可以自行使用 DNS 解析器来增强你的隐私,但安装第三方根证书永远不会有意义。你正在将自己置身于陷阱之中。
### 实际看看
**警告**
有位友好的系统管理员提供了一个现场演示,你可以实时看到自己。这是真事。
**千万不要输入私人数据!之后务必删除证书和该 DNS**
如果你不知道如何操作,那就不要安装它。虽然我们相信我们的朋友,但你不要随便安装随机和未知的第三方根证书。
#### 实际演示
链接在这里:<http://https-interception.info.tm/>
* 设置所提供的 DNS 解析器
* 安装所提供的根证书
* 访问 <https://paypal.com> 并输入随机登录数据
* 你的数据将显示在该网站上
### 延伸信息
如果你对更多技术细节感兴趣,请告诉我们。如果有足够多感兴趣的人,我们可能会写一篇文章,但是目前最重要的部分是分享基础知识,这样你就可以做出明智的决定,而不会因为营销和欺诈而陷入陷阱。请随时提出对你很关注的其他主题。
这篇文章来自 [Privacy Today 频道][3]。[Privacy Today][4] 是一个关于隐私、开源、自由哲学等所有事物的组织!
所有内容均根据 CC BY-NC-SA 4.0 获得许可。([署名 - 非商业性使用 - 共享 4.0 国际][5])。
--------------------------------------------------------------------------------
via: https://lushka.al/dns-and-certificates/
作者:[Anxhelo Lushka][a]
选题:[lujun9972][b]
译者:[wxy](https://github.com/wxy)
校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://lushka.al/
[b]: https://github.com/lujun9972
[1]: https://duckduckgo.com
[2]: http://176.34.155.23
[3]: https://t.me/privacytoday
[4]: https://t.me/joinchat/Awg5A0UW-tzOLX7zMoTDog
[5]: https://creativecommons.org/licenses/by-nc-sa/4.0/

View File

@@ -1,64 +0,0 @@
[#]: collector: (lujun9972)
[#]: translator: ( )
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (Toyota Motors and its Linux Journey)
[#]: via: (https://itsfoss.com/toyota-motors-linux-journey)
[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/)
Toyota Motors and its Linux Journey
======
**This is a community submission from Its FOSS reader Malcolm Dean.**
I spoke with Brian R Lyons of TMNA Toyota Motor Corp North America about the implementation of Linux in Toyota and Lexus infotainment systems. I came to find out there is an Automotive Grade Linux (AGL) being used by several autmobile manufacturers.
I put together a short article comprising of my discussion with Brian about Toyota and its tryst with Linux. I hope that Linux enthusiasts will like this quick little chat.
All [Toyota vehicles and Lexus vehicles are going to use Automotive Grade Linux][1] (AGL) majorly for the infotainment system. This is instrumental in Toyota Motor Corp because as per Mr. Lyons “As a technology leader, Toyota realized that adopting open source development methodology is the best way to keep up with the rapid pace of new technologies”.
Toyota among other automotive companies thought, going with a Linux based operating system might be cheaper and quicker when it comes to updates, and upgrades compared to using proprietary software.
Wow! Finally Linux in a vehicle. I use Linux every day on my desktop; what a great way to expand the use of this awesome software to a completely different industry.
I was curious when Toyota decided to use the [Automotive Grade Linux][2] (AGL). According to Mr. Lyons, it goes back to 2011.
> “Toyota has been an active member and contributor to AGL since its launch more than five years ago, collaborating with other OEMs, Tier 1s and suppliers to develop a robust, Linux-based platform with increased security and capabilities”
![Toyota Infotainment][3]
In 2011, [Toyota joined the Linux Foundation][4] and started discussions about IVI (In-Vehicle Infotainment) software with other car OEMs and software companies. As a result, in 2012, Automotive Grade Linux working group was formed in the Linux Foundation.
What Toyota did at first in AGL group was to take “code first” approach as normal as in the open source domains, and then start the conversation about the initial direction by specifying requirement specifications which had been discussed among car OEMs, IVI Tier-1 companies, software companies, and so on.
Toyota had already realized that sharing the software code among Tier1 companies was going to essential at the time when it joined the Linux Foundation. This was because the cost of maintaining such a huge software was very costly and was no longer differentiation by Tier1 companies. Toyota and its Tier1 supplier companies wanted to spend more resources n new functions and new user experiences rather than maintaining conventional code all by themselves.
This is a huge thing as automotive companies have gone in together to further their cooperation. Many companies have adopted this after finding proprietary software to be expensive.
Today, AGL is used for all Toyota and Lexus vehicles and is used in all markets where vehicles are sold.
As someone who has sold cars for Lexus, I think this is a huge step forward. I and other sales associates had many customers who would come back to speak with a technology specialist to learn about the full capabilities of their infotainment system.
I see this as a huge step forward for the Linux community, and users. The operating system we use on a daily basis is being put to use right in front of us albeit in a modified form but is there none-the-less.
Where does this lead? Hopefully a better user-friendly and less glitchy experience for consumers.
--------------------------------------------------------------------------------
via: https://itsfoss.com/toyota-motors-linux-journey
作者:[Abhishek Prakash][a]
选题:[lujun9972][b]
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://itsfoss.com/author/abhishek/
[b]: https://github.com/lujun9972
[1]: https://www.linuxfoundation.org/press-release/2018/01/automotive-grade-linux-hits-road-globally-toyota-amazon-alexa-joins-agl-support-voice-recognition/
[2]: https://www.automotivelinux.org/
[3]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/01/toyota-interiors.jpg?resize=800%2C450&ssl=1
[4]: https://www.linuxfoundation.org/press-release/2011/07/toyota-joins-linux-foundation/

View File

@@ -0,0 +1,59 @@
[#]: collector: (lujun9972)
[#]: translator: ( )
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (4 confusing open source license scenarios and how to navigate them)
[#]: via: (https://opensource.com/article/19/1/open-source-license-scenarios)
[#]: author: (P.Kevin Nelson https://opensource.com/users/pkn4645)
4 confusing open source license scenarios and how to navigate them
======
Before you begin using a piece of software, make sure you fully understand the terms of its license.
![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/LAW_openisopen.png?itok=FjmDxIaL)
As an attorney running an open source program office for a Fortune 500 corporation, I am often asked to look into a product or component where there seems to be confusion as to the licensing model. Under what terms can the code be used, and what obligations run with such use? This often happens when the code or the associated project community does not clearly indicate availability under a [commonly accepted open source license][1]. The confusion is understandable as copyright owners often evolve their products and services in different directions in response to market demands. Here are some of the scenarios I commonly discover and how you can approach each situation.
### Multiple licenses
The product is truly open source with an [Open Source Initiative][2] (OSI) open source-approved license, but has changed licensing models at least once if not multiple times throughout its lifespan. This scenario is fairly easy to address; the user simply has to decide if the latest version with its attendant features and bug fixes is worth the conditions to be compliant with the current license. If so, great. If not, then the user can move back in time to a version released under a more palatable license and start from that fork, understanding that there may not be an active community for support and continued development.
### Old open source
This is a variation on the multiple licenses model with the twist that current licensing is proprietary only. You have to use an older version to take advantage of open source terms and conditions. Most often, the product was released under a valid open source license up to a certain point in its development, but then the copyright holder chose to evolve the code in a proprietary fashion and offer new releases only under proprietary commercial licensing terms. So, if you want the newest capabilities, you have to purchase a proprietary license, and you most likely will not get a copy of the underlying source code. Most often the open source community that grew up around the original code line falls away once the members understand there will be no further commitment from the copyright holder to the open source branch. While this scenario is understandable from the copyright holder's perspective, it can be seen as "burning a bridge" to the open source community. It would be very difficult to again leverage the benefits of the open source contribution models once a project owner follows this path.
### Open core
By far the most common discovery is that a product has both an open source-licensed "community edition" and a proprietary-licensed commercial offering, commonly referred to as open core. This is often encouraging to potential consumers, as it gives them a "try before you buy" option or even a chance to influence both versions of the product by becoming an active member of the community. I usually encourage clients to begin with the community version, get involved, and see what they can achieve. Then, if the product becomes a crucial part of their business plan, they have the option to upgrade to the proprietary level at any time.
### Freemium
The component is not open source at all, but instead it is released under some version of the "freemium" model. A version with restricted or time-limited functionality can be downloaded with no immediate purchase required. However, since the source code is usually not provided and its accompanying license does not allow perpetual use, the creation of derivative works, nor further distribution, it is definitely not open source. In this scenario, it is usually best to pass unless you are prepared to purchase a proprietary license and accept all attendant terms and conditions of use. Users are often the most disappointed in this outcome as it has somewhat of a deceptive feel.
### OSI compliant
Of course, the happy path I haven't mentioned is to discover the project has a single, clear, OSI-compliant license. In those situations, open source software is as easy as downloading and going forward within appropriate use.
Each of the more complex scenarios described above can present problems to potential development projects, but consultation with skilled procurement or intellectual property professionals with regard to licensing lineage can reveal excellent opportunities.
An earlier version of this article was published on [OSS Law][3] and is republished with the author's permission.
--------------------------------------------------------------------------------
via: https://opensource.com/article/19/1/open-source-license-scenarios
作者:[P.Kevin Nelson][a]
选题:[lujun9972][b]
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://opensource.com/users/pkn4645
[b]: https://github.com/lujun9972
[1]: https://opensource.org/licenses
[2]: https://opensource.org/licenses/category
[3]: http://www.pknlaw.com/2017/06/i-thought-that-was-open-source.html

View File

@@ -0,0 +1,203 @@
[#]: collector: (lujun9972)
[#]: translator: ( )
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (OOP Before OOP with Simula)
[#]: via: (https://twobithistory.org/2019/01/31/simula.html)
[#]: author: (Sinclair Target https://twobithistory.org)
OOP Before OOP with Simula
======
Imagine that you are sitting on the grassy bank of a river. Ahead of you, the water flows past swiftly. The afternoon sun has put you in an idle, philosophical mood, and you begin to wonder whether the river in front of you really exists at all. Sure, large volumes of water are going by only a few feet away. But what is this thing that you are calling a “river”? After all, the water you see is here and then gone, to be replaced only by more and different water. It doesnt seem like the word “river” refers to any fixed thing in front of you at all.
In 2009, Rich Hickey, the creator of Clojure, gave [an excellent talk][1] about why this philosophical quandary poses a problem for the object-oriented programming paradigm. He argues that we think of an object in a computer program the same way we think of a river—we imagine that the object has a fixed identity, even though many or all of the objects properties will change over time. Doing this is a mistake, because we have no way of distinguishing between an object instance in one state and the same object instance in another state. We have no explicit notion of time in our programs. We just breezily use the same name everywhere and hope that the object is in the state we expect it to be in when we reference it. Inevitably, we write bugs.
The solution, Hickey concludes, is that we ought to model the world not as a collection of mutable objects but a collection of processes acting on immutable data. We should think of each object as a “river” of causally related states. In sum, you should use a functional language like Clojure.
![][2]
The author, on a hike, pondering the ontological commitments
of object-oriented programming.
Since Hickey gave his talk in 2009, interest in functional programming languages has grown, and functional programming idioms have found their way into the most popular object-oriented languages. Even so, most programmers continue to instantiate objects and mutate them in place every day. And they have been doing it for so long that it is hard to imagine that programming could ever look different.
I wanted to write an article about Simula and imagined that it would mostly be about when and how object-oriented constructs we are familiar with today were added to the language. But I think the more interesting story is about how Simula was originally so unlike modern object-oriented programming languages. This shouldnt be a surprise, because the object-oriented paradigm we know now did not spring into existence fully formed. There were two major versions of Simula: Simula I and Simula 67. Simula 67 brought the world classes, class hierarchies, and virtual methods. But Simula I was a first draft that experimented with other ideas about how data and procedures could be bundled together. The Simula I model is not a functional model like the one Hickey proposes, but it does focus on processes that unfold over time rather than objects with hidden state that interact with each other. Had Simula 67 stuck with more of Simula Is ideas, the object-oriented paradigm we know today might have looked very different indeed—and that contingency should teach us to be wary of assuming that the current paradigm will dominate forever.
### Simula 0 Through 67
Simula was created by two Norwegians, Kristen Nygaard and Ole-Johan Dahl.
In the late 1950s, Nygaard was employed by the Norwegian Defense Research Establishment (NDRE), a research institute affiliated with the Norwegian military. While there, he developed Monte Carlo simulations used for nuclear reactor design and operations research. These simulations were at first done by hand and then eventually programmed and run on a Ferranti Mercury. Nygaard soon found that he wanted a higher-level way to describe these simulations to a computer.
The kind of simulation that Nygaard commonly developed is known as a “discrete event model.” The simulation captures how a sequence of events change the state of a system over time—but the important property here is that the simulation can jump from one event to the next, since the events are discrete and nothing changes in the system between events. This kind of modeling, according to a paper that Nygaard and Dahl presented about Simula in 1966, was increasingly being used to analyze “nerve networks, communication systems, traffic flow, production systems, administrative systems, social systems, etc.” So Nygaard thought that other people might want a higher-level way to describe these simulations too. He began looking for someone that could help him implement what he called his “Simulation Language” or “Monte Carlo Compiler.”
Dahl, who had also been employed by NDRE, where he had worked on language design, came aboard at this point to play Wozniak to Nygaards Jobs. Over the next year or so, Nygaard and Dahl worked to develop what has been called “Simula 0.” This early version of the language was going to be merely a modest extension to ALGOL 60, and the plan was to implement it as a preprocessor. The language was then much less abstract than what came later. The primary language constructs were “stations” and “customers.” These could be used to model certain discrete event networks; Nygaard and Dahl give an example simulating airport departures. But Nygaard and Dahl eventually came up with a more general language construct that could represent both “stations” and “customers” and also model a wider range of simulations. This was the first of two major generalizations that took Simula from being an application-specific ALGOL package to a general-purpose programming language.
In Simula I, there were no “stations” or “customers,” but these could be recreated using “processes.” A process was a bundle of data attributes associated with a single action known as the process operating rule. You might think of a process as an object with only a single method, called something like `run()`. This analogy is imperfect though, because each process operating rule could be suspended or resumed at any time—the operating rules were a kind of coroutine. A Simula I program would model a system as a set of processes that conceptually all ran in parallel. Only one process could actually be “current” at any time, but once a process suspended itself the next queued process would automatically take over. As the simulation ran, behind the scenes, Simula would keep a timeline of “event notices” that tracked when each process should be resumed. In order to resume a suspended process, Simula needed to keep track of multiple call stacks. This meant that Simula could no longer be an ALGOL preprocessor, because ALGOL had only once call stack. Nygaard and Dahl were committed to writing their own compiler.
In their paper introducing this system, Nygaard and Dahl illustrate its use by implementing a simulation of a factory with a limited number of machines that can serve orders. The process here is the order, which starts by looking for an available machine, suspends itself to wait for one if none are available, and then runs to completion once a free machine is found. There is a definition of the order process that is then used to instantiate several different order instances, but no methods are ever called on these instances. The main part of the program just creates the processes and sets them running.
The first Simula I compiler was finished in 1965. The language grew popular at the Norwegian Computer Center, where Nygaard and Dahl had gone to work after leaving NDRE. Implementations of Simula I were made available to UNIVAC users and to Burroughs B5500 users. Nygaard and Dahl did a consulting deal with a Swedish company called ASEA that involved using Simula to run job shop simulations. But Nygaard and Dahl soon realized that Simula could be used to write programs that had nothing to do with simulation at all.
Stein Krogdahl, a professor at the University of Oslo that has written about the history of Simula, claims that “the spark that really made the development of a new general-purpose language take off” was [a paper called “Record Handling”][3] by the British computer scientist C.A.R. Hoare. If you read Hoares paper now, this is easy to believe. Im surprised that you dont hear Hoares name more often when people talk about the history of object-oriented languages. Consider this excerpt from his paper:
> The proposal envisages the existence inside the computer during the execution of the program, of an arbitrary number of records, each of which represents some object which is of past, present or future interest to the programmer. The program keeps dynamic control of the number of records in existence, and can create new records or destroy existing ones in accordance with the requirements of the task in hand.
> Each record in the computer must belong to one of a limited number of disjoint record classes; the programmer may declare as many record classes as he requires, and he associates with each class an identifier to name it. A record class name may be thought of as a common generic term like “cow,” “table,” or “house” and the records which belong to these classes represent the individual cows, tables, and houses.
Hoare does not mention subclasses in this particular paper, but Dahl credits him with introducing Nygaard and himself to the concept. Nygaard and Dahl had noticed that processes in Simula I often had common elements. Using a superclass to implement those common elements would be convenient. This also raised the possibility that the “process” idea itself could be implemented as a superclass, meaning that not every class had to be a process with a single operating rule. This then was the second great generalization that would make Simula 67 a truly general-purpose programming language. It was such a shift of focus that Nygaard and Dahl briefly considered changing the name of the language so that people would know it was not just for simulations. But “Simula” was too much of an established name for them to risk it.
In 1967, Nygaard and Dahl signed a contract with Control Data to implement this new version of Simula, to be known as Simula 67. A conference was held in June, where people from Control Data, the University of Oslo, and the Norwegian Computing Center met with Nygaard and Dahl to establish a specification for this new language. This conference eventually led to a document called the [“Simula 67 Common Base Language,”][4] which defined the language going forward.
Several different vendors would make Simula 67 compilers. The Association of Simula Users (ASU) was founded and began holding annual conferences. Simula 67 soon had users in more than 23 different countries.
### 21st Century Simula
Simula is remembered now because of its influence on the languages that have supplanted it. You would be hard-pressed to find anyone still using Simula to write application programs. But that doesnt mean that Simula is an entirely dead language. You can still compile and run Simula programs on your computer today, thanks to [GNU cim][5].
The cim compiler implements the Simula standard as it was after a revision in 1986. But this is mostly the Simula 67 version of the language. You can write classes, subclass, and virtual methods just as you would have with Simula 67. So you could create a small object-oriented program that looks a lot like something you could easily write in Python or Ruby:
```
! dogs.sim ;
Begin
Class Dog;
! The cim compiler requires virtual procedures to be fully specified ;
Virtual: Procedure bark Is Procedure bark;;
Begin
Procedure bark;
Begin
OutText("Woof!");
OutImage; ! Outputs a newline ;
End;
End;
Dog Class Chihuahua; ! Chihuahua is "prefixed" by Dog ;
Begin
Procedure bark;
Begin
OutText("Yap yap yap yap yap yap");
OutImage;
End;
End;
Ref (Dog) d;
d :- new Chihuahua; ! :- is the reference assignment operator ;
d.bark;
End;
```
You would compile and run it as follows:
```
$ cim dogs.sim
Compiling dogs.sim:
gcc -g -O2 -c dogs.c
gcc -g -O2 -o dogs dogs.o -L/usr/local/lib -lcim
$ ./dogs
Yap yap yap yap yap yap
```
(You might notice that cim compiles Simula to C, then hands off to a C compiler.)
This was what object-oriented programming looked like in 1967, and I hope you agree that aside from syntactic differences this is also what object-oriented programming looks like in 2019. So you can see why Simula is considered a historically important language.
But Im more interested in showing you the process model that was central to Simula I. That process model is still available in Simula 67, but only when you use the `Process` class and a special `Simulation` block.
In order to show you how processes work, Ive decided to simulate the following scenario. Imagine that there is a village full of villagers next to a river. The river has lots of fish, but between them the villagers only have one fishing rod. The villagers, who have voracious appetites, get hungry every 60 minutes or so. When they get hungry, they have to use the fishing rod to catch a fish. If a villager cannot use the fishing rod because another villager is waiting for it, then the villager queues up to use the fishing rod. If a villager has to wait more than five minutes to catch a fish, then the villager loses health. If a villager loses too much health, then that villager has starved to death.
This is a somewhat strange example and Im not sure why this is what first came to mind. But there you go. We will represent our villagers as Simula processes and see what happens over a days worth of simulated time in a village with four villagers.
The full program is [available here as a Gist][6].
The last lines of my output look like the following. Here we are seeing what happens in the last few hours of the day:
```
1299.45: John is hungry and requests the fishing rod.
1299.45: John is now fishing.
1311.39: John has caught a fish.
1328.96: Betty is hungry and requests the fishing rod.
1328.96: Betty is now fishing.
1331.25: Jane is hungry and requests the fishing rod.
1340.44: Betty has caught a fish.
1340.44: Jane went hungry waiting for the rod.
1340.44: Jane starved to death waiting for the rod.
1369.21: John is hungry and requests the fishing rod.
1369.21: John is now fishing.
1379.33: John has caught a fish.
1409.59: Betty is hungry and requests the fishing rod.
1409.59: Betty is now fishing.
1419.98: Betty has caught a fish.
1427.53: John is hungry and requests the fishing rod.
1427.53: John is now fishing.
1437.52: John has caught a fish.
```
Poor Jane starved to death. But she lasted longer than Sam, who didnt even make it to 7am. Betty and John sure have it good now that only two of them need the fishing rod.
What I want you to see here is that the main, top-level part of the program does nothing but create the four villager processes and get them going. The processes manipulate the fishing rod object in the same way that we would manipulate an object today. But the main part of the program does not call any methods or modify and properties on the processes. The processes have internal state, but this internal state only gets modified by the process itself.
There are still fields that get mutated in place here, so this style of programming does not directly address the problems that pure functional programming would solve. But as Krogdahl observes, “this mechanism invites the programmer of a simulation to model the underlying system as a set of processes, each describing some natural sequence of events in that system.” Rather than thinking primarily in terms of nouns or actors—objects that do things to other objects—here we are thinking of ongoing processes. The benefit is that we can hand overall control of our program off to Simulas event notice system, which Krogdahl calls a “time manager.” So even though we are still mutating processes in place, no process makes any assumptions about the state of another process. Each process interacts with other processes only indirectly.
Its not obvious how this pattern could be used to build, say, a compiler or an HTTP server. (On the other hand, if youve ever programmed games in the Unity game engine, this should look familiar.) I also admit that even though we have a “time manager” now, this may not have been exactly what Hickey meant when he said that we need an explicit notion of time in our programs. (I think hed want something like the superscript notation [that Ada Lovelace used][7] to distinguish between the different values a variable assumes through time.) All the same, I think its really interesting that right there at the beginning of object-oriented programming we can find a style of programming that is not all like the object-oriented programming we are used to. We might take it for granted that object-oriented programming simply works one way—that a program is just a long list of the things that certain objects do to other objects in the exact order that they do them. Simula Is process system shows that there are other approaches. Functional languages are probably a better thought-out alternative, but Simula I reminds us that the very notion of alternatives to modern object-oriented programming should come as no surprise.
If you enjoyed this post, more like it come out every four weeks! Follow [@TwoBitHistory][8] on Twitter or subscribe to the [RSS feed][9] to make sure you know when a new post is out.
Previously on TwoBitHistory…
> Hey everyone! I sadly haven't had time to do any new writing but I've just put up an updated version of my history of RSS. This version incorporates interviews I've since done with some of the key people behind RSS like Ramanathan Guha and Dan Libby.<https://t.co/WYPhvpTGqB>
>
> — TwoBitHistory (@TwoBitHistory) [December 18, 2018][10]
--------------------------------------------------------------------------------
1. Jan Rune Holmevik, “The History of Simula,” accessed January 31, 2019, http://campus.hesge.ch/daehne/2004-2005/langages/simula.htm. ↩
2. Ole-Johan Dahl and Kristen Nygaard, “SIMULA—An ALGOL-Based Simulation Langauge,” Communications of the ACM 9, no. 9 (September 1966): 671, accessed January 31, 2019, http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.95.384&rep=rep1&type=pdf. ↩
3. Stein Krogdahl, “The Birth of Simula,” 2, accessed January 31, 2019, http://heim.ifi.uio.no/~steinkr/papers/HiNC1-webversion-simula.pdf. ↩
4. ibid. ↩
5. Ole-Johan Dahl and Kristen Nygaard, “The Development of the Simula Languages,” ACM SIGPLAN Notices 13, no. 8 (August 1978): 248, accessed January 31, 2019, https://hannemyr.com/cache/knojd_acm78.pdf. ↩
6. Dahl and Nygaard (1966), 676. ↩
7. Dahl and Nygaard (1978), 257. ↩
8. Krogdahl, 3. ↩
9. Ole-Johan Dahl, “The Birth of Object-Orientation: The Simula Languages,” 3, accessed January 31, 2019, http://www.olejohandahl.info/old/birth-of-oo.pdf. ↩
10. Dahl and Nygaard (1978), 265. ↩
11. Holmevik. ↩
12. Krogdahl, 4. ↩
--------------------------------------------------------------------------------
via: https://twobithistory.org/2019/01/31/simula.html
作者:[Sinclair Target][a]
选题:[lujun9972][b]
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://twobithistory.org
[b]: https://github.com/lujun9972
[1]: https://www.infoq.com/presentations/Are-We-There-Yet-Rich-Hickey
[2]: /images/river.jpg
[3]: https://archive.computerhistory.org/resources/text/algol/ACM_Algol_bulletin/1061032/p39-hoare.pdf
[4]: http://web.eah-jena.de/~kleine/history/languages/Simula-CommonBaseLanguage.pdf
[5]: https://www.gnu.org/software/cim/
[6]: https://gist.github.com/sinclairtarget/6364cd521010d28ee24dd41ab3d61a96
[7]: https://twobithistory.org/2018/08/18/ada-lovelace-note-g.html
[8]: https://twitter.com/TwoBitHistory
[9]: https://twobithistory.org/feed.xml
[10]: https://twitter.com/TwoBitHistory/status/1075075139543449600?ref_src=twsrc%5Etfw

View File

@@ -0,0 +1,118 @@
[#]: collector: (lujun9972)
[#]: translator: ( )
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (Config management is dead: Long live Config Management Camp)
[#]: via: (https://opensource.com/article/19/2/configuration-management-camp)
[#]: author: (Matthew Broberg https://opensource.com/users/mbbroberg)
Config management is dead: Long live Config Management Camp
======
CfgMgmtCamp '19 co-organizers share their take on ops, DevOps, observability, and the rise of YoloOps and YAML engineers.
![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/cicd_continuous_delivery_deployment_gears.png?itok=kVlhiEkc)
Everyone goes to [FOSDEM][1] in Brussels to learn from its massive collection of talk tracks, colloquially known as developer rooms, that run the gauntlet of curiosities, covering programming languages like Rust, Go, and Python, to special topics ranging from community, to legal, to privacy. After two days of nonstop activity, many FOSDEM attendees move on to Ghent, Belgium, to join hundreds for Configuration Management Camp ([CfgMgmtCamp][2]).
Kris Buytaert and Toshaan Bharvani run the popular post-FOSDEM show centered around infrastructure management, featuring hackerspaces, training, workshops, and keynotes. It's a deeply technical exploration of the who, what, and how of building resilient infrastructure. It started in 2013 as a PuppetCamp but expanded to include more communities and tools in 2014.
I spoke with Kris and Toshaan, who both have a healthy sense of humor, about CfgMgmtCamp's past, present, and future. Our interview has been edited for length and clarity.
**Matthew: Your opening[keynote][3] is called "CfgMgmtCamp is dead." Is config management dead? Will it live on, or will something take its place?**
**Kris:** We've noticed people are jumping on the hype of containers, trying to solve the same problems in a different way. But they are still managing config, only in different ways and with other tools. Over the past couple of years, we've evolved from a conference with a focus on infrastructure-as-code tooling, such as Puppet, Chef, CFEngine, Ansible, Juju, and Salt, to a more open source infrastructure automation conference in general. So, config management is definitely not dead. Infrastructure-as-code is also not dead, but it all is evolving.
**Toshaan:** We see people changing tools, jumping on hype, and communities changing; however, the basic ideas and concepts remain the same.
**Matthew: It's great to see[observability as the topic][4] of one of your keynotes. Why should those who care about configuration management also care about monitoring and observability?**
**Kris:** While the name of the conference hasn't changed, the tools have evolved and we have expanded our horizon. Ten years ago, [Devopsdays][5] was just #devopsdays, but it evolved to focus on culture—the C of [CAMS][6] in the DevOps' core principles of Culture, Automation, Measurement, and Sharing.
![](https://opensource.com/sites/default/files/uploads/cams.png)
[Monitorama][7] filled the gap on monitoring and metrics (tackling the M in CAMS). Config Management Camp is about open source Automation, the A. Since they are all open source conferences, they fulfill the Sharing part, completing the CAMS concept.
Observability sits on the line between Automation and Measurement. To go one step further, in some of my talks about open source monitoring, I describe the evolution of monitoring tools from #monitoringsucks to #monitoringlove; for lots of people (including me), the love for monitoring returned because we tied it to automation. We started to provision a service and automatically adapted the monitoring of that service to its state. Gone were the days where the monitoring tool was out of sync with reality.
Looking at it from the other side, when you have an infrastructure or application so complex that you need observability in it, you'd better not be deploying manually; you will need some form of automation at that level of complexity. So, observability and infrastructure automation are tied together.
**Toshaan:** Yes, while in the past we focused on configuration management, we will be looking to expand that into all types of infrastructure management. Last year, we played with this idea, and we were able to have a lot of cross-tool presentations. This year, we've taken this a step further by having more differentiated content.
**Matthew: Some of my virtualization and Linux admin friends push back, saying observability is a developer's responsibility. How would you respond without just saying "DevOps?"**
**Kris:** What you describe is what I call "Ooops Devs." This is a trend where the people who run the platform don't really care what they run; as long as port 80 is listening and the node pings, they are happy. It's equally bad as "Dev Ooops." "Ooops Devs" is where the devs rant about the ops folks because they are slow, not agile, and not responsive. But, to me, your job as an ops person or as a Linux admin is to keep a service running, and the only way to do that is to take on that task is as a team—with your colleagues who have different roles and insights, people who write code, people who design, etc. It is a shared responsibility. And hiding behind "that is someone else's responsibility," doesn't smell like collaboration going on.
**Toshaan:** Even in the dark ages of silos, I believe a true sysadmin should have cared about observability, monitoring, and automation. I believe that the DevOps movement has made this much more widespread, and that it has become easier to get this information and expose it. On the other hand, I believe that pure operators or sysadmins have learned to be team players (or, they may have died out). I like the analogy of an army unit composed of different specialty soldiers who work together to complete a mission; we have engineers who work to deliver products or services.
**Matthew: In a[Devopsdays Zurich talk][8], Kris offered an opinion that Americans build software for acquisition and Europeans build for resilience. In that light, what are the best skills for someone who wants to build meaningful infrastructure?**
**Toshaan:** I believe still some people don't understand the complexity of code sprawl, and they believe that some new hype will solve this magically.
**Kris:** This year, we invited [Steve Traugott][9], co-author of the 1998 USENIX paper "[Bootstrapping an Infrastructure][10]" that helped kickstart our community. So many people never read [Infrastructures.org][11], never experienced the pain of building images and image sprawl, and don't understand the evolution we went through that led us to build things the way we build them from source code.
People should study topics such as idempotence, resilience, reproducibility, and surviving the tenth floor test. (As explained in "Bootstrapping an Infrastructure": "The test we used when designing infrastructures was 'Can I grab a random machine and throw it out the tenth-floor window without adversely impacting users for more than 10 minutes?' If the answer to this was 'yes,' then we knew we were doing things right.") But only after they understand the service they are building—the service is the absolute priority—can they begin working on things like: how can we run this, how can we make sure it keeps running, how can it fail and how can we prevent that, and if it disappears, how can we spin it up again fast, unnoticed by the end user.
**Toshaan:** 100% uptime.
**Kris:** The challenge we have is that lots of people don't have that experience yet. We've seen the rise of [YoloOps][12]—just spin it up once, fire, and forget—which results in security problems, stability problems, data loss, etc., and they often grasp onto the solutions in YoloOps, the easy way to do something quickly and move on. But understanding how things will eventually fail takes time, it's called experience.
**Toshaan:** Well, when I was a student and manned the CentOS stand at FOSDEM, I remember a guy coming up to the stand and complaining that he couldn't do consulting because of the "fire once and forgot" policy of CentOS, and that it just worked too well. I like to call this ZombieOps, but YoloOps works also.
**Matthew: I see you're leading the second year of YamlCamp as well. Why does a markup language need its own camp?**
**Kris:** [YamlCamp][13] is a parody, it's a joke. Last year, Bob Walker ([@rjw1][14]) gave a talk titled "Are we all YAML engineers now?" that led to more jokes. We've had a discussion for years about rebranding CfgMgmtCamp; the problem is that people know our name, we have a large enough audience to keep going, and changing the name would mean effort spent on logos, website, DNS, etc. We won't change the name, but we joked that we could rebrand to YamlCamp, because for some weird reason, a lot of the talks are about YAML. :)
**Matthew: Do you think systems engineers should list YAML as a skill or a language on their CV? Should companies be hiring YAML engineers, or do you have "Long live all YAML engineers" on the website in jest?**
**Toshaan:** Well, the real question is whether people are willing to call themselves YAML engineers proudly, because we already have enough DevOps engineers.
**Matthew: What FOSS software helps you manage the event?**
**Toshaan:** I re-did the website in Hugo CMS because we were spending too much time maintaining the website manually. I chose Hugo, because I was learning Golang, and because it has been successfully used for other conferences and my own website. I also wanted a static website and iCalendar output, so we could use calendar tooling such as Giggity to have a good scheduling tool.
The website now builds quite nicely, and while I still have some ideas on improvements, maintenance is now much easier.
For the call for proposals (CFP), we now use [OpenCFP][15]. We want to optimize the submission, voting, selection, and extraction to be as automated as possible, while being easy and comfortable for potential speakers, reviewers, and ourselves to use. OpenCFP seems to be the tool that works; while we still have some feature requirements, I believe that, once we have some time to contribute back to OpenCFP, we'll have a fully functional and easy tool to run CFPs with.
Last, we switched from EventBrite to Pretix because I wanted to be GDPR compliant and have the ability to run our questions, vouchers, and extra features. Pretix allows us to control registration of attendees, speakers, sponsors, and organizers and have a single overview of all the people coming to the event.
### Wrapping up
The beauty of Configuration Management Camp to me is that it continues to evolve with its audience. Configuration management is certainly at the heart of the work, but it's in service to resilient infrastructure. Keep your eyes open for the talk recordings to learn from the [line up of incredible speakers][16], and thank you to the team for running this (free) show!
You can follow Kris [@KrisBuytaert][17] and Toshaan [@toshywoshy][18]. You can also see Kris' past articles [on his blog][19].
--------------------------------------------------------------------------------
via: https://opensource.com/article/19/2/configuration-management-camp
作者:[Matthew Broberg][a]
选题:[lujun9972][b]
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://opensource.com/users/mbbroberg
[b]: https://github.com/lujun9972
[1]: https://fosdem.org/2019/
[2]: https://cfgmgmtcamp.eu/
[3]: https://cfgmgmtcamp.eu/schedule/monday/intro00/
[4]: https://cfgmgmtcamp.eu/schedule/monday/keynote0/
[5]: https://www.devopsdays.org/
[6]: http://devopsdictionary.com/wiki/CAMS
[7]: http://monitorama.com/
[8]: https://vimeo.com/272519813
[9]: https://cfgmgmtcamp.eu/schedule/tuesday/keynote1/
[10]: http://www.infrastructures.org/papers/bootstrap/bootstrap.html
[11]: http://www.infrastructures.org/
[12]: https://gist.githubusercontent.com/mariozig/5025613/raw/yolo
[13]: https://twitter.com/yamlcamp
[14]: https://twitter.com/rjw1
[15]: https://github.com/opencfp/opencfp
[16]: https://cfgmgmtcamp.eu/speaker/
[17]: https://twitter.com/KrisBuytaert
[18]: https://twitter.com/toshywoshy
[19]: https://krisbuytaert.be/index.shtml

View File

@@ -0,0 +1,91 @@
[#]: collector: (lujun9972)
[#]: translator: ( )
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (7 predictions for artificial intelligence in 2019)
[#]: via: (https://opensource.com/article/19/2/predictions-artificial-intelligence)
[#]: author: (Salil Sethi https://opensource.com/users/salilsethi)
7 predictions for artificial intelligence in 2019
======
While 2018 was a big year for AI, the stage is set for it to make an even deeper impact in 2019.
![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/robot_arm_artificial_ai.png?itok=8CUU3U_7)
Without question, 2018 was a big year for artificial intelligence (AI) as it pushed even further into the mainstream, successfully automating more functionality than ever before. Companies are increasingly exploring applications for AI, and the general public has grown accustomed to interacting with the technology on a daily basis.
The stage is set for AI to continue transforming the world as we know it. In 2019, not only will the technology continue growing in global prevalence, but it will also spawn deeper conversations around important topics, fuel innovative business models, and impact society in new ways, including the following seven.
### 1\. Machine learning as a service (MLaaS) will be deployed more broadly
In 2018, we witnessed major strides in MLaaS with technology powerhouses like Google, Microsoft, and Amazon leading the way. Prebuilt machine learning solutions and capabilities are becoming more attractive in the market, especially to smaller companies that don't have the necessary in-house resources or talent. For those that have the technical know-how and experience, there is a significant opportunity to sell and deploy packaged solutions that can be easily implemented by others.
Today, MLaaS is sold primarily on a subscription or usage basis by cloud-computing providers. For example, Microsoft Azure's ML Studio provides developers with a drag-and-drop environment to develop powerful machine learning models. Google Cloud's Machine Learning Engine also helps developers build large, sophisticated algorithms for a variety of applications. In 2017, Amazon jumped into the realm of AI and launched Amazon SageMaker, another platform that developers can use to build, train, and deploy custom machine learning models.
In 2019 and beyond, be prepared to see MLaaS offered on a much broader scale. Transparency Market Research predicts it will grow to US$20 billion at an alarming 40% CAGR by 2025.
### 2\. More explainable or "transparent" AI will be developed
Although there are already many examples of how AI is impacting our world, explaining the outputs and rationale of complex machine learning models remains a challenge.
Unfortunately, AI continues to carry the "black box" burden, posing a significant limitation in situations where humans want to understand the rationale behind AI-supported decision making.
AI democratization has been led by a plethora of open source tools and libraries, such as Scikit Learn, TensorFlow, PyTorch, and more. The open source community will lead the charge to build explainable, or "transparent," AI that can clearly document its logic, expose biases in data sets, and provide answers to follow-up questions.
Before AI is widely adopted, humans need to know that the technology can perform effectively and explain its reasoning under any circumstance.
### 3\. AI will impact the global political landscape
In 2019, AI will play a bigger role on the global stage, impacting relationships between international superpowers that are investing in the technology. Early adopters of AI, such as the US and [China][1], will struggle to balance self-interest with collaborative R&D. Countries that have AI talent and machine learning capabilities will experience tremendous growth in areas like predictive analytics, creating a wider global technology gap.
Additionally, more conversations will take place around the ethical use of AI. Naturally, different countries will approach this topic differently, which will affect political relationships. Overall, AI's impact will be small relative to other international issues, but more noticeable than before.
### 4\. AI will create more jobs than it eliminates
Over the long term, many jobs will be eliminated as a result of AI-enabled automation. Roles characterized by repetitive, manual tasks are being outsourced to AI more and more every day. However, in 2019, AI will create more jobs than it replaces.
Rather than eliminating the need for humans entirely, AI is augmenting existing systems and processes. As a result, a new type of role is emerging. Humans are needed to support AI implementation and oversee its application. Next year, more manual labor will transition to management-type jobs that work alongside AI, a trend that will continue to 2020. Gartner predicts that in two years, [AI will create 2.3 million jobs while only eliminating 1.8 million.][2]
### 5\. AI assistants will become more pervasive and useful
AI assistants are nothing new to the modern world. Apple's Siri and Amazon's Alexa have been supporting humans on the road and in their homes for years. In 2019, we will see AI assistants continue to grow in their sophistication and capabilities. As they collect more behavioral data, AI assistants will become better at responding to requests and completing tasks. With advances in natural language processing and speech recognition, humans will have smoother and more useful interactions with AI assistants.
In 2018, we saw companies launch promising new AI assistants. Recently, Google began rolling out its voice-enabled reservation booking service, Duplex, which can call and book appointments on behalf of users. Technology company X.ai has built two AI personal assistants, Amy and Andrew, who can interact with humans and schedule meetings for their employers. Amazon also recently announced Echo Auto, a device that enables drivers to integrate Alexa into their vehicles. However, humans will continue to place expectations ahead of reality and be disappointed at the technology's limitations.
### 6\. AI/ML governance will gain importance
With so many companies investing in AI, much more energy will be put towards developing effective AI governance structures. Frameworks are needed to guide data collection and management, appropriate AI use, and ethical applications. Successful and appropriate AI use involves many different stakeholders, highlighting the need for reliable and consistent governing bodies.
In 2019, more organizations will create governance structures and more clearly define how AI progress and implementation are managed. Given the current gap in explainability, these structures will be tremendously important as humans continue to turn to AI to support decision-making.
### 7\. AI will help companies solve AI talent shortages
A [shortage of AI and machine learning talent][3] is creating an innovation bottleneck. A [survey][4] released last year from O'Reilly revealed that the biggest challenge companies are facing related to using AI is a lack of available talent. And as technological advancement continues to accelerate, it is becoming harder for companies to develop talent that can lead large-scale enterprise AI efforts.
To combat this, organizations will—ironically—use AI and machine learning to help address the talent gap in 2019. For example, Google Cloud's AutoML includes machine learning products that help developers train machine learning models without having any prior AI coding experience. Amazon Personalize is another machine learning service that helps developers build sophisticated personalization systems that can be implemented in many ways by different kinds of companies. In addition, companies will use AI to find talent and fill job vacancies and propel innovation forward.
### AI In 2019: bigger and better with a tighter leash
Over the next year, AI will grow more prevalent and powerful than ever. Expect to see new applications and challenges and be ready for an increased emphasis on checks and balances.
What do you think? How might AI impact the world in 2019? Please share your thoughts in the comments below!
--------------------------------------------------------------------------------
via: https://opensource.com/article/19/2/predictions-artificial-intelligence
作者:[Salil Sethi][a]
选题:[lujun9972][b]
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://opensource.com/users/salilsethi
[b]: https://github.com/lujun9972
[1]: https://www.turingtribe.com/story/china-is-achieving-ai-dominance-by-relying-on-young-blue-collar-workers-rLMsmWqLG4fGFwisQ
[2]: https://www.gartner.com/en/newsroom/press-releases/2017-12-13-gartner-says-by-2020-artificial-intelligence-will-create-more-jobs-than-it-eliminates
[3]: https://www.turingtribe.com/story/tencent-says-there-are-only-bTpNm9HKaADd4DrEi
[4]: https://www.forbes.com/sites/bernardmarr/2018/06/25/the-ai-skills-crisis-and-how-to-close-the-gap/#19bafcf631f3

View File

@@ -0,0 +1,82 @@
[#]: collector: (lujun9972)
[#]: translator: ( )
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (4 steps to becoming an awesome agile developer)
[#]: via: (https://opensource.com/article/19/2/steps-agile-developer)
[#]: author: (Daniel Oh https://opensource.com/users/daniel-oh)
4 steps to becoming an awesome agile developer
======
There's no magical way to do it, but these practices will put you well on your way to embracing agile in application development, testing, and debugging.
![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/metrics_lead-steps-measure.png?itok=DG7rFZPk)
Enterprises are rushing into their DevOps journey through [agile][1] software development with cloud-native technologies such as [Linux containers][2], [Kubernetes][3], and [serverless][4]. Continuous integration helps enterprise developers reduce bugs, unexpected errors, and improve the quality of their code deployed in production.
However, this doesn't mean all developers in DevOps automatically embrace agile for their daily work in application development, testing, and debugging. There is no magical way to do it, but the following four practical steps and best practices will put you well on your way to becoming an awesome agile developer.
### Start with design thinking agile practices
There are many opportunities to learn about using agile software development practices in your DevOps initiatives. Agile practices inspire people with new ideas and experiences for improving their daily work in application development with team collaboration. More importantly, those practices will help you discover the answers to questions such as: Why am I doing this? What kind of problems am I trying to solve? How do I measure the outcomes?
A [domain-driven design][5] approach will help you start discovery sooner and easier. For example, the [Start At The End][6] practice helps you redesign your application and explore potential business outcomes—such as, what would happen if your application fails in production? You might also be interested in [Event Storming][7] for interactive and rapid discovery or [Impact Mapping][8] for graphical and strategic design as part of domain-driven design practices.
### Use a predictive approach first
In agile software development projects, enterprise developers are mainly focused on adapting to rapidly changing app development environments such as reactive runtimes, cloud-native frameworks, Linux container packaging, and the Kubernetes platform. They believe this is the best way to become an agile developer in their organization. However, this type of adaptive approach typically makes it harder for developers to understand and report what they will do in the next sprint. Developers might know the ultimate goal and, at best, the app features for a release about four months from the current sprint.
In contrast, the predictive approach places more emphasis on analyzing known risks and planning future sprints in detail. For example, predictive developers can accurately report the functions and tasks planned for the entire development process. But it's not a magical way to make your agile projects succeed all the time because the predictive team depends totally on effective early-stage analysis. If the analysis does not work very well, it may be difficult for the project to change direction once it gets started.
To mitigate this risk, I recommend that senior agile developers increase the predictive capabilities with a plan-driven method, and junior agile developers start with the adaptive methods for value-driven development.
### Continuously improve code quality
Don't hesitate to engage in [continuous integration][9] (CI) practices for improving your application before deploying code into production. To adopt modern application frameworks, such as cloud-native architecture, Linux container packaging, and hybrid cloud workloads, you have to learn about automated tools to address complex CI procedures.
[Jenkins][10] is the standard CI tool for many organizations; it allows developers to build and test applications in many projects in an automated fashion. Its most important function is detecting unexpected errors during CI to prevent them from happening in production. This should increase business outcomes through better customer satisfaction.
Automated CI enables agile developers to not only improve the quality of their code but their also application development agility through learning and using open source tools and patterns such as [behavior-driven development][11], [test-driven development][12], [automated unit testing][13], [pair programming][14], [code review][15], and [design pattern][16].
### Never stop exploring communities
Never settle, even if you already have a great reputation as an agile developer. You have to continuously take on bigger challenges to make great software in an agile way.
By participating in the very active and growing open source community, you will not only improve your skills as an agile developer, but your actions can also inspire other developers who want to learn agile practices.
How do you get involved in specific communities? It depends on your interests and what you want to learn. It might mean presenting specific topics at conferences or local meetups, writing technical blog posts, publishing practical guidebooks, committing code, or creating pull requests to open source projects' Git repositories. It's worth exploring open source communities for agile software development, as I've found it is a great way to share your expertise, knowledge, and practices with other brilliant developers and, along the way, help each other.
### Get started
These practical steps can give you a shorter path to becoming an awesome agile developer. Then you can lead junior developers in your team and organization to become more flexible, valuable, and predictive using agile principles.
--------------------------------------------------------------------------------
via: https://opensource.com/article/19/2/steps-agile-developer
作者:[Daniel Oh][a]
选题:[lujun9972][b]
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://opensource.com/users/daniel-oh
[b]: https://github.com/lujun9972
[1]: https://opensource.com/article/18/10/what-agile
[2]: https://opensource.com/resources/what-are-linux-containers
[3]: https://opensource.com/resources/what-is-kubernetes
[4]: https://opensource.com/article/18/11/open-source-serverless-platforms
[5]: https://en.wikipedia.org/wiki/Domain-driven_design
[6]: https://openpracticelibrary.com/practice/start-at-the-end/
[7]: https://openpracticelibrary.com/practice/event-storming/
[8]: https://openpracticelibrary.com/practice/impact-mapping/
[9]: https://en.wikipedia.org/wiki/Continuous_integration
[10]: https://jenkins.io/
[11]: https://en.wikipedia.org/wiki/Behavior-driven_development
[12]: https://en.wikipedia.org/wiki/Test-driven_development
[13]: https://en.wikipedia.org/wiki/Unit_testing
[14]: https://en.wikipedia.org/wiki/Pair_programming
[15]: https://en.wikipedia.org/wiki/Code_review
[16]: https://en.wikipedia.org/wiki/Design_pattern

View File

@@ -0,0 +1,64 @@
[#]: collector: (lujun9972)
[#]: translator: ( )
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (What blockchain and open source communities have in common)
[#]: via: (https://opensource.com/article/19/2/blockchain-open-source-communities)
[#]: author: (Gordon Haff https://opensource.com/users/ghaff)
What blockchain and open source communities have in common
======
Blockchain initiatives can look to open source governance for lessons on establishing trust.
![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/diversity_flowers_chain.jpg?itok=ns01UPOp)
One of the characteristics of blockchains that gets a lot of attention is how they enable distributed trust. The topic of trust is a surprisingly complicated one. In fact, there's now an [entire book][1] devoted to the topic by Kevin Werbach.
But here's what it means in a nutshell. Organizations that wish to work together, but do not fully trust one another, can establish a permissioned blockchain and invite business partners to record their transactions on a shared distributed ledger. Permissioned blockchains can trace assets when transactions are added to the blockchain. A permissioned blockchain implies a degree of trust (again, trust is complicated) among members of a consortium, but no single entity controls the storage and validation of transactions.
The basic model is that a group of financial institutions or participants in a logistics system can jointly set up a permissioned blockchain that will validate and immutably record transactions. There's no dependence on a single entity, whether it's one of the direct participants or a third-party intermediary who set up the blockchain, to safeguard the integrity of the system. The blockchain itself does so through a variety of cryptographic mechanisms.
Here's the rub though. It requires that competitors work together cooperatively—a relationship often called [coopetition][2]. The term dates back to the early 20th century, but it grew into widespread use when former Novell CEO Ray Noorda started using the term to describe the company's business strategy in the 1990s. Novell was then planning to get into the internet portal business, which required it to seek partnerships with some of the search engine providers and other companies it would also be competing against. In 1996, coopetition became the subject of a bestselling [book][3].
Coopetition can be especially difficult when a blockchain network initiative appears to be driven by a dominant company. And it's hard for the dominant company not to exert outsize influence over the initiative, just as a natural consequence of how big it is. For example, the IBM-Maersk joint venture has [struggled to sign up rival shipping companies][4], in part because Maersk is the world's largest carrier by capacity, a position that makes rivals wary.
We see this same dynamic in open source communities. The original creators of a project need to not only let go; they need to put governance structures in place that give competing companies confidence that there's a level playing field.
For example, Sarah Novotny, now head of open source strategy at Google Cloud Platform, [told me in a 2017 interview][5] about the [Kubernetes][6] project that it isn't always easy to give up control, even when people buy into doing what is best for a project.
> Google turned Kubernetes over to the Cloud Native Computing Foundation (CNCF), which sits under the Linux Foundation umbrella. As [CNCF executive director Dan Kohn puts it][7]: "One of the things they realized very early on is that a project with a neutral home is always going to achieve a higher level of collaboration. They really wanted to find a home for it where a number of different companies could participate."
>
> Defaulting to public may not be either natural or comfortable. "Early on, my first six, eight, or 12 weeks at Google, I think half my electrons in email were spent on: 'Why is this discussion not happening on a public mailing list? Is there a reason that this is specific to GKE [Google Container Engine]? No, there's not a reason,'" said Novotny.
To be sure, some grumble that open source foundations have become too common and that many are too dominated by paying corporate members. Simon Phipps, currently the president of the Open Source Initiative, gave a talk at OSCON way back in 2015 titled ["Enough Foundations Already!"][8] in which he argued that "before we start another open source foundation, let's agree that what we need protected is software freedom and not corporate politics."
Nonetheless, while not appropriate for every project, foundations with business, legal, and technical governance are increasingly the model for open source projects that require extensive cooperation among competing companies. A [2017 analysis of GitHub data by the Linux Foundation][9] found a number of different governance models in use by the highest-velocity open source projects. Unsurprisingly, quite a few remained under the control of the company that created or acquired them. However, about a third were under the auspices of a foundation.
Is there a lesson here for blockchain? Quite possibly. Open source projects can be sponsored by a company while still putting systems and governance in place that are welcoming to outside contributors. However, there's a great deal of history to suggest that doing so is hard because it's hard not to exert control and leverage when you can. Furthermore, even if you make a successful case for being truly open to equal participation to outsiders today, it will be hard to allay suspicions that you might not be as welcoming tomorrow.
To the degree that we can equate blockchain consortiums with open source communities, this suggests that business blockchain initiatives should look to open source governance for lessons. Dominant players in the ecosystem need to forgo control, and they need to have conversations with partners and potential partners about what types of structures would make participating easier.
Many blockchain infrastructure software projects are already under foundations such as Hyperledger. But perhaps some specific production deployments of blockchain aimed at specific industries and ecosystems will benefit from formal governance structures as well.
--------------------------------------------------------------------------------
via: https://opensource.com/article/19/2/blockchain-open-source-communities
作者:[Gordon Haff][a]
选题:[lujun9972][b]
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://opensource.com/users/ghaff
[b]: https://github.com/lujun9972
[1]: https://mitpress.mit.edu/books/blockchain-and-new-architecture-trust
[2]: https://en.wikipedia.org/wiki/Coopetition
[3]: https://en.wikipedia.org/wiki/Co-opetition_(book)
[4]: https://www.theregister.co.uk/2018/10/30/ibm_struggles_to_sign_up_shipping_carriers_to_blockchain_supply_chain_platform_reports/
[5]: https://opensource.com/article/17/4/podcast-kubernetes-sarah-novotny
[6]: https://kubernetes.io/
[7]: http://bitmason.blogspot.com/2017/02/podcast-cloud-native-computing.html
[8]: https://www.oreilly.com/ideas/enough-foundations-already
[9]: https://www.linuxfoundation.org/blog/2017/08/successful-open-source-projects-common/

View File

@@ -0,0 +1,46 @@
[#]: collector: (lujun9972)
[#]: translator: ( )
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (Which programming languages should you learn?)
[#]: via: (https://opensource.com/article/19/2/which-programming-languages-should-you-learn)
[#]: author: (Marty Kalin https://opensource.com/users/mkalindepauledu)
Which programming languages should you learn?
======
Learning a new programming language is a great way to get ahead in your career. But which one?
![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/search_find_code_issue_bug_programming.png?itok=XPrh7fa0)
If you want to get started or get ahead in your programming career, learning a new language is a smart idea. But the huge number of languages in active use invites the question: Which programming language is the best one to know? To answer that, let's start with a simplifying question: What sort of programming do you want to do?
If you want to do web programming on the client side, then the specialized languages HTML, CSS, and JavaScript—in one of its seemingly infinite dialects—are de rigueur.
If you want to do web programming on the server side, the options include all of the familiar general-purpose languages: C++, Golang, Java, C#, Node.js, Perl, Python, Ruby, and so on. As a matter of course, server-side programs interact with datastores, such as relational and other databases, which means query languages such as SQL may come into play.
If you're writing native apps for mobile devices, knowing the target platform is important. For Apple devices, Swift has supplanted Objective C as the language of choice. For Android devices, Java (with dedicated libraries and toolsets) remains the dominant language. There are special languages such as Xamarin, used with C#, that can generate platform-specific code for Apple, Android, and Windows devices.
What about general-purpose languages? There are various choices within the usual pigeonholes. Among the dynamic or scripting languages (e.g., Perl, Python, and Ruby), there are newer offerings such as Node.js. Java and C#, which are more alike than their fans like to admit, remain the dominant statically compiled languages targeted at a virtual machine (the JVM and CLR, respectively). Among languages that compile into native executables, C++ is still in the mix, along with later arrivals such as Golang and Rust. General-purpose functional languages abound (e.g., Clojure, Haskell, Erlang, F#, Lisp, and Scala), often with passionately devoted communities. It's worth noting that object-oriented languages such as Java and C# have added functional constructs (in particular, lambdas), and the dynamic languages have had functional constructs from the start.
Let me end with a pitch for C, which is a small, elegant, and extensible language not to be confused with C++. Modern operating systems are written mostly in C, with the rest in assembly language. The standard libraries on any platform are likewise mostly in C. For example, any program that issues the Hello, world! greeting does so through a call to the C library function named **write**.
C serves as a portable assembly language, exposing details about the underlying system that other high-level languages deliberately hide. To understand C is thus to gain a better grasp of how programs contend for the shared system resources (processors, memory, and I/O devices) required for execution. C is at once high-level and close-to-the-metal, so unrivaled in performance—except, of course, for assembly language. Finally, C is the lingua franca among programming languages, and almost every general-purpose language supports C calls in one form or another.
For a modern introduction to C, consider my book [C Programming: Introducing Portable Assembler][1]. No matter how you go about it, learn C and you'll learn a lot more than just another programming language.
What programming languages do you think are important to know? Do you agree or disagree with these recommendations? Let us know in the comments!
--------------------------------------------------------------------------------
via: https://opensource.com/article/19/2/which-programming-languages-should-you-learn
作者:[Marty Kalin][a]
选题:[lujun9972][b]
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://opensource.com/users/mkalindepauledu
[b]: https://github.com/lujun9972
[1]: https://www.amazon.com/dp/1977056954?ref_=pe_870760_150889320

View File

@@ -0,0 +1,69 @@
[#]: collector: (lujun9972)
[#]: translator: ( )
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (Introducing kids to computational thinking with Python)
[#]: via: (https://opensource.com/article/19/2/break-down-stereotypes-python)
[#]: author: (Don Watkins https://opensource.com/users/don-watkins)
Introducing kids to computational thinking with Python
======
Coding program gives low-income students the skills, confidence, and knowledge to break free from economic and societal disadvantages.
![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/idea_innovation_kid_education.png?itok=3lRp6gFa)
When the [Parkman Branch][1] of the Detroit Public Library was flooded with bored children taking up all the computers during summer break, the library saw it not as a problem, rather an opportunity. They started a coding club, the [Parkman Coders][2], led by [Qumisha Goss][3], a librarian who is leveraging the power of Python to introduce disadvantaged children to computational thinking.
When she started the Parkman Coders program about four years ago, "Q" (as she is known) didn't know much about coding. Since then, she's become a specialist in library instruction and technology and a certified Raspberry Pi instructor.
The program began by using [Scratch][4], but the students got bored with the block coding interface, which they regarded as "baby stuff." She says, "I knew we need to make a change to something that was still beginner friendly, but that would be more challenging for them to continue to hold their attention." At this point, she started teaching them Python.
Q first saw Python while playing a game with dungeons and skeleton monsters on [Code.org][5]. She began to learn Python by reading books like [Python Programming: An Introduction to Computer Science][6] and [Python for Kids][7]. She also recommends [Automate the Boring Stuff with Python][8] and [Lauren Ipsum: A Story about Computer Science and Other Improbable Things][9].
### Setting up a Raspberry Pi makerspace
Q decided to use [Raspberry Pi][10] computers to avoid the possibility that the students might be able to hack into the library system's computers, which weren't arranged in a way conducive to a makerspace anyway. The Pi's affordability, plus its flexibility and the included free software, lent more credibility to her decision.
While the coder program was the library's effort keep the peace and create a learning space that would engage the children, it quickly grew so popular that it ran out of space, computers, and adequate electrical outlets in a building built in 1921. They started with 10 Raspberry Pi computers shared among 20 children, but the library obtained funding from individuals, companies including Microsoft, the 4H, and the Detroit Public Library Foundation to get more equipment and expand the program.
Currently, about 40 children participate in each session and they have enough Raspberry Pi's for one device per child and some to give away. Many of the Parkman Coders come from low socio-economic backgrounds and don't have a computer at home, so the library provides them with donated Chromebooks.
Q says, "when kids demonstrate that they have a good understanding of how to use a Raspberry Pi or a [Microbit][11] and have been coming to programs regularly, we give them equipment to take home with them. This process is very challenging, however, because [they may not] have internet access at home [or] all the peripheral things they need like monitors, keyboards, and mice."
### Learning life skills and breaking stereotypes with Python
Q says, "I believe that the mainstays of learning computer science are learning critical thinking and problem-solving skills. My hope is that these lessons will stay with the kids as they grow and pursue futures in whatever field they choose. In addition, I'm hoping to inspire some pride in creatorship. It's a very powerful feeling to know 'I made this thing,' and once they've had these successes early, I hope they will approach new challenges with zeal."
She also says, "in learning to program, you have to learn to be hyper-vigilant about spelling and capitalization, and for some of our kids, reading is an issue. To make sure that the program is inclusive, we spell aloud during our lessons, and we encourage kids to speak up if they don't know a word or can't spell it correctly."
Q also tries to give extra attention to children who need it. She says, "if I recognize that someone has a more severe problem, we try to get them paired with a tutor at our library outside of program time, but still allow them to come to the program. We want to help them without discouraging them from participating."
Most importantly, the Parkman Coders program seeks to help every child realize that each has a unique skill set and abilities. Most of the children are African-American and half are girls. Q says, "we live in a world where we grow up with societal stigmas that frequently limit our own belief of what we can accomplish." She believes that children need a nonjudgmental space where "they can try new things, mess up, and discover."
The environment Q and the Parkman Coders program creates helps the participants break away from economic and societal disadvantages. She says that the secret sauce is to "make sure you have a welcoming space so anyone can come and that your space is forgiving and understanding. Let people come as they are, and be prepared to teach and to learn; when people feel comfortable and engaged, they want to stay."
--------------------------------------------------------------------------------
via: https://opensource.com/article/19/2/break-down-stereotypes-python
作者:[Don Watkins][a]
选题:[lujun9972][b]
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://opensource.com/users/don-watkins
[b]: https://github.com/lujun9972
[1]: https://detroitpubliclibrary.org/locations/parkman
[2]: https://www.dplfound.org/single-post/2016/05/15/Parkman-Branch-Coders
[3]: https://www.linkedin.com/in/qumisha-goss-b3bb5470
[4]: https://scratch.mit.edu/
[5]: http://Code.org
[6]: https://www.amazon.com/Python-Programming-Introduction-Computer-Science/dp/1887902996
[7]: https://nostarch.com/pythonforkids
[8]: https://automatetheboringstuff.com/
[9]: https://nostarch.com/laurenipsum
[10]: https://www.raspberrypi.org/
[11]: https://microbit.org/guide/

View File

@@ -1,911 +0,0 @@
[#]: collector: (lujun9972)
[#]: translator: ( )
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (Computer Laboratory Raspberry Pi: Lesson 11 Input02)
[#]: via: (https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/input02.html)
[#]: author: (Alex Chadwick https://www.cl.cam.ac.uk)
Computer Laboratory Raspberry Pi: Lesson 11 Input02
======
The Input02 lesson builds on Input01, by building a simple command line interface where the user can type commands and the computer interprets and displays them. It is assumed you have the code for the [Lesson 11: Input01][1] operating system as a basis.
### 1 Terminal 1
```
In the early days of computing, there would usually be one large computer in a building, and many 'terminals' which sent commands to it. The computer would take it in turns to execute different incoming commands.
```
Almost every operating system starts life out as a text terminal. This is typically a black screen with white writing, where you type commands for the computer to execute on the keyboard, and it explains how you've mistyped them, or very occasionally, does what you want. This approach has two main advantages: it provides a simple, robust control mechanism for the computer using only a keyboard and monitor, and it is done by almost every operating system, so is widely understood by system administrators.
Let's analyse what we want to do precisely:
1. Computer turns on, displays some sort of welcome message
2. Computer indicates its ready for input
3. User types a command, with parameters, on the keyboard
4. User presses return or enter to commit the command
5. Computer interprets command and performs actions if command is acceptable
6. Computer displays messages to indicate if command was successful, and also what happened
7. Loop back to 2
One defining feature of such terminals is that they are unified for both input and output. The same screen is used to enter inputs as is used to print outputs. This means it is useful to build an abstraction of a character based display. In a character based display, the smallest unit is a character, not a pixel. The screen is divided into a fixed number of characters which have varying colours. We can build this on top of our existing screen code, by storing the characters and their colours, and then using the DrawCharacter method to push them to the screen. Once we have a character based display, drawing text becomes a matter of drawing a line of characters.
In a new file called terminal.s copy the following code:
```
.section .data
.align 4
terminalStart:
.int terminalBuffer
terminalStop:
.int terminalBuffer
terminalView:
.int terminalBuffer
terminalColour:
.byte 0xf
.align 8
terminalBuffer:
.rept 128*128
.byte 0x7f
.byte 0x0
.endr
terminalScreen:
.rept 1024/8 core.md Dict.md lctt2014.md lctt2016.md lctt2018.md LICENSE published README.md scripts sources translated 768/16
.byte 0x7f
.byte 0x0
.endr
```
This sets up the data we need for the text terminal. We have two main storages: terminalBuffer and terminalScreen. terminalBuffer is storage for all of the text we have displayed. It stores up to 128 lines of text (each containing 128 characters). Each character consists of an ASCII character code and a colour, all of which are initially set to 0x7f (ASCII delete) and 0 (black on a black background). terminalScreen stores the characters that are currently displayed on the screen. It is 128 by 48 characters, similarly initialised. You may think that we only need this terminalScreen, not the terminalBuffer, but storing the buffer has 2 main advantages:
1. We can easily see which characters are different, so we only have to draw those.
2. We can 'scroll' back through the terminal's history because it is stored (to a limit).
You should always try to design systems that do the minimum amount of work, as they run much faster for things which don't often change.
The differing trick is really common on low power Operating Systems. Drawing the screen is a slow operation, and so we only want to draw thing that we absolutely have to. In this system, we can freely alter the terminalBuffer, and then call a method which copies the bits that change to the screen. This means we don't have to draw each character as we go along, which may save time in the long run on very long sections of text that span many lines.
The other values in the .data section are as follows:
* terminalStart
The first character which has been written in terminalBuffer.
* terminalStop
The last character which has been written in terminalBuffer.
* terminalView
The first character on the screen at present. We can use this to scroll the screen.
* temrinalColour
The colour to draw new characters with.
```
Circular buffers are an example of an **data structure**. These are just ideas we have for organising data, that we sometimes implement in software.
```
![Diagram showing hellow world being inserted into a circular buffer of size 5.][2]
The reason why terminalStart needs to be stored is because termainlBuffer should be a circular buffer. This means that when the buffer is completely full, the end 'wraps' round to the start, and so the character after the very last one is the first one. Thus, we need to advance terminalStart so we know that we've done this. When wokring with the buffer this can easily be implemented by checking if the index goes beyond the end of the buffer, and setting it back to the beginning if it does. Circular buffers are a common and clever way of storing a lot of data, where only the most recent data is important. It allows us to keep writing indefinitely, while always being sure there is a certain amount of recent data available. They're often used in signal processing or compression algorithms. In this case, it allows us to store a 128 line history of the terminal, without any penalties for writing over 128 lines. If we didn't have this, we would have to copy 127 lines back a line very time we went beyond the 128th line, wasting valuable time.
I've mentioned the terminalColour here a few times. You can implement this however you, wish, however there is something of a standard on text terminals to have only 16 colours for foreground, and 16 colours for background (meaning there are 162 = 256 combinations). The colours on a CGA terminal are defined as follows:
Table 1.1 - CGA Colour Codes
| Number | Colour (R, G, B) |
| ------ | ------------------------|
| 0 | Black (0, 0, 0) |
| 1 | Blue (0, 0, ⅔) |
| 2 | Green (0, ⅔, 0) |
| 3 | Cyan (0, ⅔, ⅔) |
| 4 | Red (⅔, 0, 0) |
| 5 | Magenta (⅔, 0, ⅔) |
| 6 | Brown (⅔, ⅓, 0) |
| 7 | Light Grey (⅔, ⅔, ⅔) |
| 8 | Grey (⅓, ⅓, ⅓) |
| 9 | Light Blue (⅓, ⅓, 1) |
| 10 | Light Green (⅓, 1, ⅓) |
| 11 | Light Cyan (⅓, 1, 1) |
| 12 | Light Red (1, ⅓, ⅓) |
| 13 | Light Magenta (1, ⅓, 1) |
| 14 | Yellow (1, 1, ⅓) |
| 15 | White (1, 1, 1) |
```
Brown was used as the alternative (dark yellow) was unappealing and not useful.
```
We store the colour of each character by storing the fore colour in the low nibble of the colour byte, and the background colour in the high nibble. Apart from brown, all of these colours follow a pattern such that in binary, the top bit represents adding ⅓ to each component, and the other bits represent adding ⅔ to individual components. This makes it easy to convert to RGB colour values.
We need a method, TerminalColour, to read these 4 bit colour codes, and then call SetForeColour with the 16 bit equivalent. Try to implement this on your own. If you get stuck, or have not completed the Screen series, my implementation is given below:
```
.section .text
TerminalColour:
teq r0,#6
ldreq r0,=0x02B5
beq SetForeColour
tst r0,#0b1000
ldrne r1,=0x52AA
moveq r1,#0
tst r0,#0b0100
addne r1,#0x15
tst r0,#0b0010
addne r1,#0x540
tst r0,#0b0001
addne r1,#0xA800
mov r0,r1
b SetForeColour
```
### 2 Showing the Text
The first method we really need for our terminal is TerminalDisplay, one that copies the current data from terminalBuffer to terminalScreen and the actual screen. As mentioned, this method should do a minimal amount of work, because we need to be able to call it often. It should compare the text in terminalBuffer with that in terminalDisplay, and copy it across if they're different. Remember, terminalBuffer is a circular buffer running, in this case, from terminalView to terminalStop or 128*48 characters, whichever comes sooner. If we hit terminalStop, we'll assume all characters after that point are 7f16 (ASCII delete), and have colour 0 (black on a black background).
Let's look at what we have to do:
1. Load in terminalView, terminalStop and the address of terminalDisplay.
2. For each row:
1. For each column:
1. If view is not equal to stop, load the current character and colour from view
2. Otherwise load the character as 0x7f and the colour as 0
3. Load the current character from terminalDisplay
4. If the character and colour are equal, go to 10
5. Store the character and colour to terminalDisplay
6. Call TerminalColour with the background colour in r0
7. Call DrawCharacter with r0 = 0x7f (ASCII delete, a block), r1 = x, r2 = y
8. Call TerminalColour with the foreground colour in r0
9. Call DrawCharacter with r0 = character, r1 = x, r2 = y
10. Increment the position in terminalDisplay by 2
11. If view and stop are not equal, increment the view position by 2
12. If the view position is at the end of textBuffer, set it to the start
13. Increment the x co-ordinate by 8
2. Increment the y co-ordinate by 16
Try to implement this yourself. If you get stuck, my solution is given below:
1.
```
.globl TerminalDisplay
TerminalDisplay:
push {r4,r5,r6,r7,r8,r9,r10,r11,lr}
x .req r4
y .req r5
char .req r6
col .req r7
screen .req r8
taddr .req r9
view .req r10
stop .req r11
ldr taddr,=terminalStart
ldr view,[taddr,#terminalView - terminalStart]
ldr stop,[taddr,#terminalStop - terminalStart]
add taddr,#terminalBuffer - terminalStart
add taddr,#128*128*2
mov screen,taddr
```
I go a little wild with variables here. I'm using taddr to store the location of the end of the textBuffer for ease.
2.
```
mov y,#0
yLoop$:
```
Start off the y loop.
1.
```
mov x,#0
xLoop$:
```
Start off the x loop.
1.
```
teq view,stop
ldrneh char,[view]
```
I load both the character and the colour into char simultaneously for ease.
2.
```
moveq char,#0x7f
```
This line complements the one above by acting as though a black delete character was read.
3.
```
ldrh col,[screen]
```
For simplicity I load both the character and colour into col simultaneously.
4.
```
teq col,char
beq xLoopContinue$
```
Now we can check if anything has changed with a teq.
5.
```
strh char,[screen]
```
We can also easily save the current value.
6.
```
lsr col,char,#8
and char,#0x7f
lsr r0,col,#4
bl TerminalColour
```
I split up char into the colour in col and the character in char with a bitshift and an and, then use a bitshift to get the background colour to call TerminalColour.
7.
```
mov r0,#0x7f
mov r1,x
mov r2,y
bl DrawCharacter
```
Write out a delete character which is a coloured block.
8.
```
and r0,col,#0xf
bl TerminalColour
```
Use an and to get the low nibble of col then call TerminalColour.
9.
```
mov r0,char
mov r1,x
mov r2,y
bl DrawCharacter
```
Write out the character we're supposed to write.
10.
```
xLoopContinue$:
add screen,#2
```
Increment the screen pointer.
11.
```
teq view,stop
addne view,#2
```
Increment the view pointer if necessary.
12.
```
teq view,taddr
subeq view,#128*128*2
```
It's easy to check for view going past the end of the buffer because the end of the buffer's address is stored in taddr.
13.
```
add x,#8
teq x,#1024
bne xLoop$
```
We increment x and then loop back if there are more characters to go.
2.
```
add y,#16
teq y,#768
bne yLoop$
```
We increment y and then loop back if there are more characters to go.
```
pop {r4,r5,r6,r7,r8,r9,r10,r11,pc}
.unreq x
.unreq y
.unreq char
.unreq col
.unreq screen
.unreq taddr
.unreq view
.unreq stop
```
Don't forget to clean up at the end!
### 3 Printing Lines
Now we have our TerminalDisplay method, which will automatically display the contents of terminalBuffer to terminalScreen, so theoretically we can draw text. However, we don't actually have any drawing routines that work on a character based display. A quick method that will come in handy first of all is TerminalClear, which completely clears the terminal. This can actually very easily be achieved with no loops. Try to deduce why the following method suffices:
```
.globl TerminalClear
TerminalClear:
ldr r0,=terminalStart
add r1,r0,#terminalBuffer-terminalStart
str r1,[r0]
str r1,[r0,#terminalStop-terminalStart]
str r1,[r0,#terminalView-terminalStart]
mov pc,lr
```
Now we need to make a basic method for character based displays; the Print function. This takes in a string address in r0, and a length in r1, and simply writes it to the current location at the screen. There are a few special characters to be wary of, as well as special behaviour to ensure that terminalView is kept up to date. Let's analyse what it has to do:
1. Check if string length is 0, if so return
2. Load in terminalStop and terminalView
3. Deduce the x-coordinate of terminalStop
4. For each character:
1. Check if the character is a new line
2. If so, increment bufferStop to the end of the line storing a black on black delete character.
3. Otherwise, copy the character in the current terminalColour
4. Check if we're at the end of a line
5. If so, check if the number of characters between terminalView and terminalStop is more than one screen
6. If so, increment terminalView by one line
7. Check if terminalView is at the end of the buffer, replace it with the start if so
8. Check if terminalStop is at the end of the buffer, replace it with the start if so
9. Check if terminalStop equals terminalStart, increment terminalStart by one line if so
10. Check if terminalStart is at the end of the buffer, replace it with the start if so
5. Store back terminalStop and terminalView.
See if you can implement this yourself. My solution is provided below:
1.
```
.globl Print
Print:
teq r1,#0
moveq pc,lr
```
This quick check at the beginning makes a call to Print with a string of length 0 almost instant.
2.
```
push {r4,r5,r6,r7,r8,r9,r10,r11,lr}
bufferStart .req r4
taddr .req r5
x .req r6
string .req r7
length .req r8
char .req r9
bufferStop .req r10
view .req r11
mov string,r0
mov length,r1
ldr taddr,=terminalStart
ldr bufferStop,[taddr,#terminalStop-terminalStart]
ldr view,[taddr,#terminalView-terminalStart]
ldr bufferStart,[taddr]
add taddr,#terminalBuffer-terminalStart
add taddr,#128*128*2
```
I do a lot of setup here. bufferStart contains terminalStart, bufferStop contains terminalStop, view contains terminalView, taddr is the address of the end of terminalBuffer.
3.
```
and x,bufferStop,#0xfe
lsr x,#1
```
As per usual, a sneaky alignment trick makes everything easier. Because of the aligment of terminalBuffer, the x-coordinate of any character address is simply the last 8 bits divided by 2.
4.
1.
```
charLoop$:
ldrb char,[string]
and char,#0x7f
teq char,#'\n'
bne charNormal$
```
We need to check for new lines.
2.
```
mov r0,#0x7f
clearLine$:
strh r0,[bufferStop]
add bufferStop,#2
add x,#1
teq x,#128 blt clearLine$
b charLoopContinue$
```
Loop until the end of the line, writing out 0x7f; a delete character in black on a black background.
3.
```
charNormal$:
strb char,[bufferStop]
ldr r0,=terminalColour
ldrb r0,[r0]
strb r0,[bufferStop,#1]
add bufferStop,#2
add x,#1
```
Store the current character in the string and the terminalColour to the end of the terminalBuffer and then increment it and x.
4.
```
charLoopContinue$:
cmp x,#128
blt noScroll$
```
Check if x is at the end of a line; 128.
5.
```
mov x,#0
subs r0,bufferStop,view
addlt r0,#128*128*2
cmp r0,#128*(768/16)*2
```
Set x back to 0 and check if we're currently showing more than one screen. Remember, we're using a circular buffer, so if the difference between bufferStop and view is negative, we're actually wrapping around the buffer.
6.
```
addge view,#128*2
```
Add one lines worth of bytes to the view address.
7.
```
teq view,taddr
subeq view,taddr,#128*128*2
```
If the view address is at the end of the buffer we subtract the buffer length from it to move it back to the start. I set taddr to the address of the end of the buffer at the beginning.
8.
```
noScroll$:
teq bufferStop,taddr
subeq bufferStop,taddr,#128*128*2
```
If the stop address is at the end of the buffer we subtract the buffer length from it to move it back to the start. I set taddr to the address of the end of the buffer at the beginning.
9.
```
teq bufferStop,bufferStart
addeq bufferStart,#128*2
```
Check if bufferStop equals bufferStart. If so, add one line to bufferStart.
10.
```
teq bufferStart,taddr
subeq bufferStart,taddr,#128*128*2
```
If the start address is at the end of the buffer we subtract the buffer length from it to move it back to the start. I set taddr to the address of the end of the buffer at the beginning.
```
subs length,#1
add string,#1
bgt charLoop$
```
Loop until the string is done.
5.
```
charLoopBreak$:
sub taddr,#128*128*2
sub taddr,#terminalBuffer-terminalStart
str bufferStop,[taddr,#terminalStop-terminalStart]
str view,[taddr,#terminalView-terminalStart]
str bufferStart,[taddr]
pop {r4,r5,r6,r7,r8,r9,r10,r11,pc}
.unreq bufferStart
.unreq taddr
.unreq x
.unreq string
.unreq length
.unreq char
.unreq bufferStop
.unreq view
```
Store back the variables and return.
This method allows us to print arbitrary text to the screen. Throughout, I've been using the colour variable, but no where have we actually set it. Normally, terminals use special combinations of characters to change the colour. For example ASCII Escape (1b16) followed by a number 0 to f in hexadecimal could set the foreground colour to that CGA colour number. You can try implementing this yourself; my version is in the further examples section on the download page.
### 4 Standard Input
```
By convention, in many programming languages, every program has access to stdin and stdout, which are an input and and output stream linked to the terminal. This is still true on graphical programs, though many don't use it.
```
Now we have an output terminal that in theory can print out text and display it. That is only half the story however, we want input. We want to implement a method, ReadLine, which stores the next line of text a user types to a location given in r0, up to a maximum length given in r1, and returns the length of the string read in r0. The tricky thing is, the user annoyingly wants to see what they're typing as they type it, they want to use backspace to delete mistakes and they want to use return to submit commands. They probably even want a flashing underscore character to indicate the computer would like input! These perfectly reasonable requests make this method a real challenge. One way to achieve all of this is to store the text they type in memory somewhere along with its length, and then after every character, move the terminalStop address back to where it started when ReadLine was called and calling Print. This means we only have to be able to manipulate a string in memory, and then make use of our Print function.
Lets have a look at what ReadLine will do:
1. If the maximum length is 0, return 0
2. Retrieve the current values of terminalStop and terminalView
3. If the maximum length is bigger than half the buffer size, set it to half the buffer size
4. Subtract one from maximum length to ensure it can store our flashing underscore or a null terminator
5. Write an underscore to the string
6. Write the stored terminalView and terminalStop addresses back to the memory
7. Call Print on the current string
8. Call TerminalDisplay
9. Call KeyboardUpdate
10. Call KeyboardGetChar
11. If it is a new line character go to 16
12. If it is a backspace character, subtract 1 from the length of the string (if it is > 0)
13. If it is an ordinary character, write it to the string (if the length < maximum length)
14. If the string ends in an underscore, write a space, otherwise write an underscore
15. Go to 6
16. Write a new line character to the end of the string
17. Call Print and TerminalDisplay
18. Replace the new line with a null terminator
19. Return the length of the string
Convince yourself that this will work, and then try to implement it yourself. My implementation is given below:
1.
```
.globl ReadLine
ReadLine:
teq r1,#0
moveq r0,#0
moveq pc,lr
```
Quick special handling for the zero case, which is otherwise difficult.
2.
```
string .req r4
maxLength .req r5
input .req r6
taddr .req r7
length .req r8
view .req r9
push {r4,r5,r6,r7,r8,r9,lr}
mov string,r0
mov maxLength,r1
ldr taddr,=terminalStart
ldr input,[taddr,#terminalStop-terminalStart]
ldr view,[taddr,#terminalView-terminalStart]
mov length,#0
```
As per the general theme, I do a lot of initialisations early. input contains the value of terminalStop and view contains terminalView. Length starts at 0.
3.
```
cmp maxLength,#128*64
movhi maxLength,#128*64
```
We have to check for unusually large reads, as we can't process them beyond the size of the terminalBuffer (I suppose we CAN, but it would be very buggy, as terminalStart could move past the stored terminalStop).
4.
```
sub maxLength,#1
```
Since the user wants a flashing cursor, and we ideally want to put a null terminator on this string, we need 1 spare character.
5.
```
mov r0,#'_'
strb r0,[string,length]
```
Write out the underscore to let the user know they can input.
6.
```
readLoop$:
str input,[taddr,#terminalStop-terminalStart]
str view,[taddr,#terminalView-terminalStart]
```
Save the stored terminalStop and terminalView. This is important to reset the terminal after each call to Print, which changes these variables. Strictly speaking it can change terminalStart too, but this is irreversible.
7.
```
mov r0,string
mov r1,length
add r1,#1
bl Print
```
Write the current input. We add 1 to the length for the underscore.
8.
```
bl TerminalDisplay
```
Copy the new text to the screen.
9.
```
bl KeyboardUpdate
```
Fetch the latest keyboard input.
10.
```
bl KeyboardGetChar
```
Retrieve the key pressed.
11.
```
teq r0,#'\n'
beq readLoopBreak$
teq r0,#0
beq cursor$
teq r0,#'\b'
bne standard$
```
Break out of the loop if we have an enter key. Also skip these conditions if we have a null terminator and process a backspace if we have one.
12.
```
delete$:
cmp length,#0
subgt length,#1
b cursor$
```
Remove one from the length to delete a character.
13.
```
standard$:
cmp length,maxLength
bge cursor$
strb r0,[string,length]
add length,#1
```
Write out an ordinary character where possible.
14.
```
cursor$:
ldrb r0,[string,length]
teq r0,#'_'
moveq r0,#' '
movne r0,#'_'
strb r0,[string,length]
```
Load in the last character, and change it to an underscore if it isn't one, and a space if it is.
15.
```
b readLoop$
readLoopBreak$:
```
Loop until the user presses enter.
16.
```
mov r0,#'\n'
strb r0,[string,length]
```
Store a new line at the end of the string.
17.
```
str input,[taddr,#terminalStop-terminalStart]
str view,[taddr,#terminalView-terminalStart]
mov r0,string
mov r1,length
add r1,#1
bl Print
bl TerminalDisplay
```
Reset the terminalView and terminalStop and then Print and TerminalDisplay the final input.
18.
```
mov r0,#0
strb r0,[string,length]
```
Write out the null terminator.
19.
```
mov r0,length
pop {r4,r5,r6,r7,r8,r9,pc}
.unreq string
.unreq maxLength
.unreq input
.unreq taddr
.unreq length
.unreq view
```
Return the length.
### 5 The Terminal: Rise of the Machine
So, now we can theoretically interact with the user on the terminal. The most obvious thing to do is to put this to the test! In 'main.s' delete everything after bl UsbInitialise and copy in the following code:
```
reset$:
mov sp,#0x8000
bl TerminalClear
ldr r0,=welcome
mov r1,#welcomeEnd-welcome
bl Print
loop$:
ldr r0,=prompt
mov r1,#promptEnd-prompt
bl Print
ldr r0,=command
mov r1,#commandEnd-command
bl ReadLine
teq r0,#0
beq loopContinue$
mov r4,r0
ldr r5,=command
ldr r6,=commandTable
ldr r7,[r6,#0]
ldr r9,[r6,#4]
commandLoop$:
ldr r8,[r6,#8]
sub r1,r8,r7
cmp r1,r4
bgt commandLoopContinue$
mov r0,#0
commandName$:
ldrb r2,[r5,r0]
ldrb r3,[r7,r0]
teq r2,r3
bne commandLoopContinue$
add r0,#1
teq r0,r1
bne commandName$
ldrb r2,[r5,r0]
teq r2,#0
teqne r2,#' '
bne commandLoopContinue$
mov r0,r5
mov r1,r4
mov lr,pc
mov pc,r9
b loopContinue$
commandLoopContinue$:
add r6,#8
mov r7,r8
ldr r9,[r6,#4]
teq r9,#0
bne commandLoop$
ldr r0,=commandUnknown
mov r1,#commandUnknownEnd-commandUnknown
ldr r2,=formatBuffer
ldr r3,=command
bl FormatString
mov r1,r0
ldr r0,=formatBuffer
bl Print
loopContinue$:
bl TerminalDisplay
b loop$
echo:
cmp r1,#5
movle pc,lr
add r0,#5
sub r1,#5
b Print
ok:
teq r1,#5
beq okOn$
teq r1,#6
beq okOff$
mov pc,lr
okOn$:
ldrb r2,[r0,#3]
teq r2,#'o'
ldreqb r2,[r0,#4]
teqeq r2,#'n'
movne pc,lr
mov r1,#0
b okAct$
okOff$:
ldrb r2,[r0,#3]
teq r2,#'o'
ldreqb r2,[r0,#4]
teqeq r2,#'f'
ldreqb r2,[r0,#5]
teqeq r2,#'f'
movne pc,lr
mov r1,#1
okAct$:
mov r0,#16
b SetGpio
.section .data
.align 2
welcome: .ascii "Welcome to Alex's OS - Everyone's favourite OS"
welcomeEnd:
.align 2
prompt: .ascii "\n> "
promptEnd:
.align 2
command:
.rept 128
.byte 0
.endr
commandEnd:
.byte 0
.align 2
commandUnknown: .ascii "Command `%s' was not recognised.\n"
commandUnknownEnd:
.align 2
formatBuffer:
.rept 256
.byte 0
.endr
formatEnd:
.align 2
commandStringEcho: .ascii "echo"
commandStringReset: .ascii "reset"
commandStringOk: .ascii "ok"
commandStringCls: .ascii "cls"
commandStringEnd:
.align 2
commandTable:
.int commandStringEcho, echo
.int commandStringReset, reset$
.int commandStringOk, ok
.int commandStringCls, TerminalClear
.int commandStringEnd, 0
```
This code brings everything together into a simple command line operating system. The commands available are echo, reset, ok and cls. echo copies any text after it back to the terminal, reset resets the operating system if things go wrong, ok has two functions: ok on turns the OK LED on, and ok off turns the OK LED off, and cls clears the terminal using TerminalClear.
Have a go with this code on the Raspberry Pi. If it doesn't work, please see our troubleshooting page.
When it works, congratulations you've completed a basic terminal Operating System, and have completed the input series. Unfortunately, this is as far as these tutorials go at the moment, but I hope to make more in the future. Please send feedback to awc32@cam.ac.uk.
You're now in position to start building some simple terminal Operating Systems. My code above builds up a table of available commands in commandTable. Each entry in the table is an int for the address of the string, and an int for the address of the code to run. The last entry has to be commandStringEnd, 0. Try implementing some of your own commands, using our existing functions, or making new ones. The parameters for the functions to run are r0 is the address of the command the user typed, and r1 is the length. You can use this to pass inputs to your commands. Maybe you could make a calculator program, perhaps a drawing program or a chess program. Whatever ideas you've got, give them a go!
--------------------------------------------------------------------------------
via: https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/input02.html
作者:[Alex Chadwick][a]
选题:[lujun9972][b]
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://www.cl.cam.ac.uk
[b]: https://github.com/lujun9972
[1]: https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/input01.html
[2]: https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/images/circular_buffer.png

View File

@@ -1,540 +0,0 @@
[#]: collector: (lujun9972)
[#]: translator: (qhwdw)
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (Computer Laboratory Raspberry Pi: Lesson 9 Screen04)
[#]: via: (https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/screen04.html)
[#]: author: (Alex Chadwick https://www.cl.cam.ac.uk)
Computer Laboratory Raspberry Pi: Lesson 9 Screen04
======
The Screen04 lesson builds on Screen03, by teaching how to manipulate text. It is assumed you have the code for the [Lesson 8: Screen03][1] operating system as a basis.
### 1 String Manipulation
```
Variadic functions look much less intuitive in assembly code. Nevertheless, they are useful and powerful concepts.
```
Being able to draw text is lovely, but unfortunately at the moment you can only draw strings which are already prepared. This is fine for displaying something like the command line, but ideally we would like to be able to display and text we so desire. As per usual, if we put the effort in and make an excellent function that does all the string manipulation we could ever want, we get much easier code later on in return. Once such complicated function in C programming is sprintf. This function generates a string based on a description given as another string and additional arguments. What is interesting about this function is that it is variadic. This means that it takes a variable number of parameters. The number of parameters depends on the exact format string, and so cannot be determined in advance.
The full function has many options, and I list a few here. I've highlighted the ones which we will implement in this tutorial, though you can try to implement more.
The function works by reading the format string, and then interpreting it using the table below. Once an argument is used, it is not considered again. The return value of the function is the number of characters written. If the method fails, a negative number is returned.
Table 1.1 sprintf formatting rules
| Sequence | Meaning |
| ---------------------- | ---------------------- |
| Any character except % | Copies the character to the output. |
| %% | Writes a % character to the output. |
| %c | Writes the next argument as a character. |
| %d or %i | Writes the next argument as a base 10 signed integer. |
| %e | Writes the next argument in scientific notation using eN to mean ×10N. |
| %E | Writes the next argument in scientific notation using EN to mean ×10N. |
| %f | Writes the next argument as a decimal IEEE 754 floating point number. |
| %g | Same as the shorter of %e and %f. |
| %G | Same as the shorter of %E and %f. |
| %o | Writes the next argument as a base 8 unsigned integer. |
| %s | Writes the next argument as if it were a pointer to a null terminated string. |
| %u | Writes the next argument as a base 10 unsigned integer. |
| %x | Writes the next argument as a base 16 unsigned integer, with lowercase a,b,c,d,e and f. |
| %X | Writes the next argument as a base 16 unsigned integer, with uppercase A,B,C,D,E and F. |
| %p | Writes the next argument as a pointer address. |
| %n | Writes nothing. Copies instead the number of characters written so far to the location addressed by the next argument. |
Further to the above, many additional tweaks exist to the sequences, such as specifying minimum length, signs, etc. More information can be found at [sprintf - C++ Reference][2].
Here are a few examples of calls to the method and their results to illustrate its use.
Table 1.2 sprintf example calls
| Format String | Arguments | Result |
| "%d" | 13 | "13" |
| "+%d degrees" | 12 | "+12 degrees" |
| "+%x degrees" | 24 | "+1c degrees" |
| "'%c' = 0%o" | 65, 65 | "'A' = 0101" |
| "%d * %d%% = %d" | 200, 40, 80 | "200 * 40% = 80" |
| "+%d degrees" | -5 | "+-5 degrees" |
| "+%u degrees" | -5 | "+4294967291 degrees" |
Hopefully you can already begin to see the usefulness of the function. It does take a fair amount of work to program, but our reward is a very general function we can use for all sorts of purposes.
### 2 Division
```
Division is the slowest and most complicated of the basic mathematical operators. It is not implemented directly in ARM assembly code because it takes so long to deduce the answer, and so isn't a 'simple' operation.
```
While this function does look very powerful, it also looks very complicated. The easiest way to deal with its many cases is probably to write functions to deal with some common tasks it has. What would be useful would be a function to generate the string for a signed and an unsigned number in any base. So, how can we go about doing that? Try to devise an algorithm quickly before reading on.
The easiest way is probably the exact way I mentioned in [Lesson 1: OK01][3], which is the division remainder method. The idea is the following:
1. Divide the current value by the base you're working in.
2. Store the remainder.
3. If the new value is not 0, go to 1.
4. Reverse the order of the remainders. This is the answer.
For example:
Table 2.1 Example base 2
conversion
| Value | New Value | Remainder |
| ----- | --------- | --------- |
| 137 | 68 | 1 |
| 68 | 34 | 0 |
| 34 | 17 | 0 |
| 17 | 8 | 1 |
| 8 | 4 | 0 |
| 4 | 2 | 0 |
| 2 | 1 | 0 |
| 1 | 0 | 1 |
So the answer is 100010012
The unfortunate part about this procedure is that it unavoidably uses division. Therefore, we must first contemplate division in binary.
For a refresher on long division expand the box below.
```
Let's suppose we wish to divide 4135 by 17.
0243 r 4
17)4135
0 0 × 17 = 0000
4135 4135 - 0 = 4135
34 200 × 17 = 3400
735 4135 - 3400 = 735
68 40 × 17 = 680
55 735 - 680 = 55
51 3 × 17 = 51
4 55 - 51 = 4
Answer: 243 remainder 4
First of all we would look at the top digit of the dividend. We see that the smallest multiple of the divisor which is less or equal to it is 0. We output a 0 to the result.
Next we look at the second to top digit of the dividend and all higher digits. We see the smallest multiple of the divisor which is less than or equal is 34. We output a 2 and subtract 3400.
Next we look at the third digit of the dividend and all higher digits. The smallest multiple of the divisor that is less than or equal to this is 68. We output 4 and subtract 680.
Finally we look at all remaining digits. We see that the lowest multiple of the divisor that is less than the remaining digits is 51. We output a 3, subtract 51. The result of the subtraction is our remainder.
```
To implement division in assembly code, we will implement binary long division. We do this because the numbers are stored in binary, which gives us easy access to the all important bit shift operations, and because division in binary is simpler than in any higher base due to the much lower number of cases.
```
1011 r 1
1010)1101111
1010
11111
1010
1011
1010
1
This example shows how binary long division works. You simply shift the divisor as far right as possible without exceeding the dividend, output a 1 according to the poisition and subtract the number. Whatever remains is the remainder. In this case we show 11011112 ÷ 10102 = 10112 remainder 12. In decimal, 111 ÷ 10 = 11 remainder 1.
```
Try to implement long division yourself now. You should write a function, DivideU32 which divides r0 by r1, returning the result in r0, and the remainder in r1. Below, we will go through a very efficient implementation.
```
function DivideU32(r0 is dividend, r1 is divisor)
set shift to 31
set result to 0
while shift ≥ 0
if dividend ≥ (divisor << shift) then
set dividend to dividend - (divisor <&lt shift)
set result to result + 1
end if
set result to result << 1
set shift to shift - 1
loop
return (result, dividend)
end function
```
This code does achieve what we need, but would not work as assembly code. Our problem comes from the fact that our registers only hold 32 bits, and so the result of divisor << shift may not fit in a register (we call this overflow). This is a real problem. Did your solution have overflow?
Fortunately, an instruction exists called clz or count leading zeros, which counts the number of zeros in the binary representation of a number starting at the top bit. Conveniently, this is exactly the number of times we can shift the register left before overflow occurs. Another optimisation you may spot is that we compute divisor << shift twice each loop. We could improve upon this by shifting the divisor at the beginning, then shifting it down at the end of each loop to avoid any need to shift it elsewhere.
Let's have a look at the assembly code to make further improvements.
```
.globl DivideU32
DivideU32:
result .req r0
remainder .req r1
shift .req r2
current .req r3
clz shift,r1
lsl current,r1,shift
mov remainder,r0
mov result,#0
divideU32Loop$:
cmp shift,#0
blt divideU32Return$
cmp remainder,current
addge result,result,#1
subge remainder,current
sub shift,#1
lsr current,#1
lsl result,#1
b divideU32Loop$
divideU32Return$:
.unreq current
mov pc,lr
.unreq result
.unreq remainder
.unreq shift
```
```
clz dest,src stores the number of zeros from the top to the first one of register dest to register src
```
You may, quite rightly, think that this looks quite efficient. It is pretty good, but division is a very expensive operation, and one we may wish to do quite often, so it would be good if we could improve the speed in any way. When looking to optimise code with a loop in it, it is always important to consider how many times the loop must run. In this case, the loop will run a maximum of 31 times for an input of 1. Without making special cases, this could often be improved easily. For example when dividing 1 by 1, no shift is required, yet we shift the divisor to each of the positions above it. This could be improved by simply using the new clz command on the dividend and subtracting this from the shift. In the case of 1 ÷ 1, this means shift would be set to 0, rightly indicating no shift is required. If this causes the shift to be negative, the divisor is bigger than the dividend and so we know the result is 0 remainder the dividend. Another quick check we could make is if the current value is ever 0, then we have a perfect division and can stop looping.
```
.globl DivideU32
DivideU32:
result .req r0
remainder .req r1
shift .req r2
current .req r3
clz shift,r1
clz r3,r0
subs shift,r3
lsl current,r1,shift
mov remainder,r0
mov result,#0
blt divideU32Return$
divideU32Loop$:
cmp remainder,current
blt divideU32LoopContinue$
add result,result,#1
subs remainder,current
lsleq result,shift
beq divideU32Return$
divideU32LoopContinue$:
subs shift,#1
lsrge current,#1
lslge result,#1
bge divideU32Loop$
divideU32Return$:
.unreq current
mov pc,lr
.unreq result
.unreq remainder
.unreq shift
```
Copy the code above to a file called 'maths.s'.
### 3 Number Strings
Now that we can do division, let's have another look at implementing number to string conversion. The following is pseudo code to convert numbers from registers into strings in up to base 36. By convention, a % b means the remainder of dividing a by b.
```
function SignedString(r0 is value, r1 is dest, r2 is base)
if value ≥ 0
then return UnsignedString(value, dest, base)
otherwise
if dest > 0 then
setByte(dest, '-')
set dest to dest + 1
end if
return UnsignedString(-value, dest, base) + 1
end if
end function
function UnsignedString(r0 is value, r1 is dest, r2 is base)
set length to 0
do
set (value, rem) to DivideU32(value, base)
if rem &gt 10
then set rem to rem + '0'
otherwise set rem to rem - 10 + 'a'
if dest > 0
then setByte(dest + length, rem)
set length to length + 1
while value > 0
if dest > 0
then ReverseString(dest, length)
return length
end function
function ReverseString(r0 is string, r1 is length)
set end to string + length - 1
while end > start
set temp1 to readByte(start)
set temp2 to readByte(end)
setByte(start, temp2)
setByte(end, temp1)
set start to start + 1
set end to end - 1
end while
end function
```
In a file called 'text.s' implement the above. Remember that if you get stuck, a full solution can be found on the downloads page.
### 4 Format Strings
Let's get back to our string formatting method. Since we're programming our own operating system, we can add or change formatting rules as we please. We may find it useful to add a %b operation that outputs a number in binary, and if you're not using null terminated strings, you may wish to alter the behaviour of %s to take the length of the string from another argument, or from a length prefix if you wish. I will use a null terminator in the example below.
One of the main obstacles to implementing this function is that the number of arguments varies. According to the ABI, additional arguments are pushed onto the stack before calling the method in reverse order. So, for example, if we wish to call our method with 8 parameters; 1,2,3,4,5,6,7 and 8, we would do the following:
1. Set r0 = 5, r1 = 6, r2 = 7, r3 = 8
2. Push {r0,r1,r2,r3}
3. Set r0 = 1, r1 = 2, r2 = 3, r3 = 4
4. Call the function
5. Add sp,#4*4
Now we must decide what arguments our function actually needs. In my case, I used the format string address in r0, the length of the format string in r1, the destination string address in r2, followed by the list of arguments required, starting in r3 and continuing on the stack as above. If you wish to use a null terminated format string, the parameter in r1 can be removed. If you wish to have a maximum buffer length, you could store this in r3. As an additional modification, I think it is useful to alter the function so that if the destination string address is 0, no string is outputted, but an accurate length is still returned, so that the length of a formatted string can be accurately determined.
If you wish to attempt the implementation on your own, try it now. If not, I will first construct the pseudo code for the method, then give the assembly code implementation.
```
function StringFormat(r0 is format, r1 is formatLength, r2 is dest, ...)
set index to 0
set length to 0
while index < formatLength
if readByte(format + index) = '%' then
set index to index + 1
if readByte(format + index) = '%' then
if dest > 0
then setByte(dest + length, '%')
set length to length + 1
otherwise if readByte(format + index) = 'c' then
if dest > 0
then setByte(dest + length, nextArg)
set length to length + 1
otherwise if readByte(format + index) = 'd' or 'i' then
set length to length + SignedString(nextArg, dest, 10)
otherwise if readByte(format + index) = 'o' then
set length to length + UnsignedString(nextArg, dest, 8)
otherwise if readByte(format + index) = 'u' then
set length to length + UnsignedString(nextArg, dest, 10)
otherwise if readByte(format + index) = 'b' then
set length to length + UnsignedString(nextArg, dest, 2)
otherwise if readByte(format + index) = 'x' then
set length to length + UnsignedString(nextArg, dest, 16)
otherwise if readByte(format + index) = 's' then
set str to nextArg
while getByte(str) != '\0'
if dest > 0
then setByte(dest + length, getByte(str))
set length to length + 1
set str to str + 1
loop
otherwise if readByte(format + index) = 'n' then
setWord(nextArg, length)
end if
otherwise
if dest > 0
then setByte(dest + length, readByte(format + index))
set length to length + 1
end if
set index to index + 1
loop
return length
end function
```
Although this function is massive, it is quite straightforward. Most of the code goes into checking all the various conditions, the code for each one is simple. Further, all the various unsigned integer cases are the same but for the base, and so can be summarised in assembly. This is given below.
```
.globl FormatString
FormatString:
format .req r4
formatLength .req r5
dest .req r6
nextArg .req r7
argList .req r8
length .req r9
push {r4,r5,r6,r7,r8,r9,lr}
mov format,r0
mov formatLength,r1
mov dest,r2
mov nextArg,r3
add argList,sp,#7*4
mov length,#0
formatLoop$:
subs formatLength,#1
movlt r0,length
poplt {r4,r5,r6,r7,r8,r9,pc}
ldrb r0,[format]
add format,#1
teq r0,#'%'
beq formatArg$
formatChar$:
teq dest,#0
strneb r0,[dest]
addne dest,#1
add length,#1
b formatLoop$
formatArg$:
subs formatLength,#1
movlt r0,length
poplt {r4,r5,r6,r7,r8,r9,pc}
ldrb r0,[format]
add format,#1
teq r0,#'%'
beq formatChar$
teq r0,#'c'
moveq r0,nextArg
ldreq nextArg,[argList]
addeq argList,#4
beq formatChar$
teq r0,#'s'
beq formatString$
teq r0,#'d'
beq formatSigned$
teq r0,#'u'
teqne r0,#'x'
teqne r0,#'b'
teqne r0,#'o'
beq formatUnsigned$
b formatLoop$
formatString$:
ldrb r0,[nextArg]
teq r0,#0x0
ldreq nextArg,[argList]
addeq argList,#4
beq formatLoop$
add length,#1
teq dest,#0
strneb r0,[dest]
addne dest,#1
add nextArg,#1
b formatString$
formatSigned$:
mov r0,nextArg
ldr nextArg,[argList]
add argList,#4
mov r1,dest
mov r2,#10
bl SignedString
teq dest,#0
addne dest,r0
add length,r0
b formatLoop$
formatUnsigned$:
teq r0,#'u'
moveq r2,#10
teq r0,#'x'
moveq r2,#16
teq r0,#'b'
moveq r2,#2
teq r0,#'o'
moveq r2,#8
mov r0,nextArg
ldr nextArg,[argList]
add argList,#4
mov r1,dest
bl UnsignedString
teq dest,#0
addne dest,r0
add length,r0
b formatLoop$
```
### 5 Convert OS
Feel free to try using this method however you wish. As an example, here is the code to generate a conversion chart from base 10 to binary to hexadecimal to octal and to ASCII.
Delete all code after bl SetGraphicsAddress in 'main.s' and replace it with the following:
```
mov r4,#0
loop$:
ldr r0,=format
mov r1,#formatEnd-format
ldr r2,=formatEnd
lsr r3,r4,#4
push {r3}
push {r3}
push {r3}
push {r3}
bl FormatString
add sp,#16
mov r1,r0
ldr r0,=formatEnd
mov r2,#0
mov r3,r4
cmp r3,#768-16
subhi r3,#768
addhi r2,#256
cmp r3,#768-16
subhi r3,#768
addhi r2,#256
cmp r3,#768-16
subhi r3,#768
addhi r2,#256
bl DrawString
add r4,#16
b loop$
.section .data
format:
.ascii "%d=0b%b=0x%x=0%o='%c'"
formatEnd:
```
Can you work out what will happen before testing? Particularly what happens for r3 ≥ 128? Try it on the Raspberry Pi to see if you're right. If it doesn't work, please see our troubleshooting page.
When it does work, congratulations, you've completed the Screen04 tutorial, and reached the end of the screen series! We've learned about pixels and frame buffers, and how these apply to the Raspberry Pi. We've learned how to draw simple lines, and also how to draw characters, as well as the invaluable skill of formatting numbers into text. We now have all that you would need to make graphical output on an Operating System. Can you make some more drawing methods? What about 3D graphics? Can you implement a 24bit frame buffer? What about reading the size of the framebuffer in from the command line?
The next series is the [Input][4] series, which teaches how to use the keyboard and mouse to really get towards a traditional console computer.
--------------------------------------------------------------------------------
via: https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/screen04.html
作者:[Alex Chadwick][a]
选题:[lujun9972][b]
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://www.cl.cam.ac.uk
[b]: https://github.com/lujun9972
[1]: https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/screen03.html
[2]: http://www.cplusplus.com/reference/clibrary/cstdio/sprintf/
[3]: https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/ok01.html
[4]: https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/input01.html

View File

@@ -1,95 +0,0 @@
beamrolling is translating.
Introduction to the Pony programming language
======
![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/programming_keys.jpg?itok=O4qaYCHK)
At [Wallaroo Labs][1], where I'm the VP of engineering, we're are building a [high-performance, distributed stream processor][2] written in the [Pony][3] programming language. Most people haven't heard of Pony, but it has been an excellent choice for Wallaroo, and it might be an excellent choice for your next project, too.
> "A programming language is just another tool. It's not about syntax. It's not about expressiveness. It's not about paradigms or models. It's about managing hard problems." —Sylvan Clebsch, creator of Pony
I'm a contributor to the Pony project, but here I'll touch on why Pony is a good choice for applications like Wallaroo and share ways I've used Pony. If you are interested in a more in-depth look at why we use Pony to write Wallaroo, we have a [blog post][4] about that.
### What is Pony?
You can think of Pony as something like "Rust meets Erlang." Pony sports buzzworthy features. It is:
* Type-safe
* Memory-safe
* Exception-safe
* Data-race-free
* Deadlock-free
Additionally, it's compiled to efficient native code, and it's developed in the open and available under a two-clause BSD license.
That's a lot of features, but here I'll focus on the few that were key to my company adopting Pony.
### Why Pony?
Writing fast, safe, efficient, highly concurrent programs is not easy with most of our existing tools. "Fast, efficient, and highly concurrent" is an achievable goal, but throw in "safe," and things get a lot harder. With Wallaroo, we wanted to accomplish all four, and Pony has made it easy to achieve.
#### Highly concurrent
Pony makes concurrency easy. Part of the way it does that is by providing an opinionated concurrency story. In Pony, all concurrency happens via the [actor model][5].
The actor model is most famous via the implementations in Erlang and Akka. The actor model has been around since the 1970s, and details vary widely from implementation to implementation. What doesn't vary is that all computation is executed by actors that communicate via asynchronous messaging.
Think of the actor model this way: objects in object-oriented programming are state + synchronous methods and actors are state + asynchronous methods.
When an actor receives a message, it executes a corresponding method. That method might operate on a state that is accessible by only that actor. The actor model allows us to use a mutable state in a concurrency-safe manner. Every actor is single-threaded. Two methods within an actor are never run concurrently. This means that, within a given actor, data updates cannot cause data races or other problems commonly associated with threads and mutable states.
#### Fast and efficient
Pony actors are scheduled with an efficient work-stealing scheduler. There's a single Pony scheduler per available CPU. The thread-per-core concurrency model is part of Pony's attempt to work in concert with the CPU to operate as efficiently as possible. The Pony runtime attempts to be as CPU-cache friendly as possible. The less your code thrashes the cache, the better it will run. Pony aims to help your code play nice with CPU caches.
The Pony runtime also features per-actor heaps so that, during garbage collection, there's no "stop the world" garbage collection step. This means your program is always doing at least some work. As a result, Pony programs end up with very consistent performance and predictable latencies.
#### Safe
The Pony type system introduces a novel concept: reference capabilities, which make data safety part of the type system. The type of every variable in Pony includes information about how the data can be shared between actors. The Pony compiler uses the information to verify, at compile time, that your code is data-race- and deadlock-free.
If this sounds a bit like Rust, it's because it is. Pony's reference capabilities and Rust's borrow checker both provide data safety; they just approach it in different ways and have different tradeoffs.
### Is Pony right for you?
Deciding whether to use a new programming language for a non-hobby project is hard. You must weigh the appropriateness of the tool against its immaturity compared to other solutions. So, what about Pony and you?
Pony might be the right solution if you have a hard concurrency problem to solve. Concurrent applications are Pony's raison d'être. If you can accomplish what you want in a single-threaded Python script, you probably don't need Pony. If you have a hard concurrency problem, you should consider Pony and its powerful data-race-free, concurrency-aware type system.
You'll get a compiler that will prevent you from introducing many concurrency-related bugs and a runtime that will give you excellent performance characteristics.
### Getting started with Pony
If you're ready to get started with Pony, your first visit should be the [Learn section][6] of the Pony website. There you will find directions for installing the Pony compiler and resources for learning the language.
If you like to contribute to the language you are using, we have some [beginner-friendly issues][7] waiting for you on GitHub.
Also, I can't wait to start talking with you on [our IRC channel][8] and the [Pony mailing list][9].
To learn more about Pony, attend Sean Allen's talk, [Pony: How I learned to stop worrying and embrace an unproven technology][10], at the [20th OSCON][11], July 16-19, 2018, in Portland, Ore.
--------------------------------------------------------------------------------
via: https://opensource.com/article/18/5/pony
作者:[Sean T Allen][a]
选题:[lujun9972](https://github.com/lujun9972)
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]:https://opensource.com/users/seantallen
[1]:http://www.wallaroolabs.com/
[2]:https://github.com/wallaroolabs/wallaroo
[3]:https://www.ponylang.org/
[4]:https://blog.wallaroolabs.com/2017/10/why-we-used-pony-to-write-wallaroo/
[5]:https://en.wikipedia.org/wiki/Actor_model
[6]:https://www.ponylang.org/learn/
[7]:https://github.com/ponylang/ponyc/issues?q=is%3Aissue+is%3Aopen+label%3A%22complexity%3A+beginner+friendly%22
[8]:https://webchat.freenode.net/?channels=%23ponylang
[9]:https://pony.groups.io/g/user
[10]:https://conferences.oreilly.com/oscon/oscon-or/public/schedule/speaker/213590
[11]:https://conferences.oreilly.com/oscon/oscon-or

View File

@@ -1,3 +1,4 @@
translated by lixinyuxx
7 open source tools to make literature reviews easy
======

View File

@@ -1,137 +0,0 @@
tomjlw is translating
How to connect to a remote desktop from Linux
======
![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/rh_003499_01_cloud21x_cc.png?itok=5UwC92dO)
A [remote desktop][1], according to Wikipedia, is "a software or operating system feature that allows a personal computer's desktop environment to be run remotely on one system (usually a PC, but the concept applies equally to a server), while being displayed on a separate client device."
In other words, a remote desktop is used to access an environment running on another computer. For example, the [ManageIQ/Integration tests][2] repository's pull request (PR) testing system exposes a Virtual Network Computing (VNC) connection port so I can remotely view my PRs being tested in real time. Remote desktops are also used to help customers solve computer problems: with the customer's permission, you can establish a VNC or Remote Desktop Protocol (RDP) connection to see or interactively access the computer to troubleshoot or repair the problem.
These connections are made using remote desktop connection software, and there are many options available. I use [Remmina][3] because I like its minimal, easy-to-use user interface (UI). It's written in GTK+ and is open source under the GNU GPL license.
In this article, I'll explain how to use the Remmina client to connect remotely from a Linux computer to a Windows 10 system and a Red Hat Enterprise Linux 7 system.
### Install Remmina on Linux
First, you need to install Remmina on the computer you'll use to access the other computer(s) remotely. If you're using Fedora, you can run the following command to install Remmina:
```
sudo dnf install -y remmina
```
If you want to install Remmina on a different Linux platform, follow these [installation instructions][4]. You should then find Remmina with your other apps (Remmina is selected in this image).
![](https://opensource.com/sites/default/files/uploads/remmina1-on-desktop.png)
Launch Remmina by clicking on the icon. You should see a screen that resembles this:
![](https://opensource.com/sites/default/files/uploads/remmina2_launched.png)
Remmina offers several types of connections, including RDP, which is used to connect to Windows-based computers, and VNC, which is used to connect to Linux machines. As you can see in the top-left corner above, Remmina's default setting is RDP.
### Connecting to Windows 10
Before you can connect to a Windows 10 computer through RDP, you must change some permissions to allow remote desktop sharing and connections through your firewall.
[Note: Windows 10 Home has no RDP feature listed. ][5]
To enable remote desktop sharing, in **File Explorer** right-click on **My Computer → Properties → Remote Settings** and, in the pop-up that opens, check **Allow remote connections to this computer** , then select **Apply**.
![](https://opensource.com/sites/default/files/uploads/remmina3_connect_win10.png)
Next, enable remote desktop connections through your firewall. First, search for **firewall settings** in the **Start** menu and select **Allow an app through Windows Firewall**.
![](https://opensource.com/sites/default/files/uploads/remmina4_firewall.png)
In the window that opens, look for **Remote Desktop** under **Allowed apps and features**. Check the box(es) in the **Private **and/or **Public** columns, depending on the type of network(s) you will use to access this desktop. Click **OK**.
![](https://opensource.com/sites/default/files/uploads/remmina5_firewall_2.png)
Go to the Linux computer you use to remotely access the Windows PC and launch Remmina. Enter the IP address of your Windows computer and hit the Enter key. (How do I locate my IP address [in Linux][6] and [Windows 10][7]?) When prompted, enter your username and password and click OK.
![](https://opensource.com/sites/default/files/uploads/remmina6_login.png)
If you're asked to accept the certificate, select OK.
![](https://opensource.com/sites/default/files/uploads/remmina7_certificate.png)
You should be able to see your Windows 10 computer's desktop.
![](https://opensource.com/sites/default/files/uploads/remmina8_remote_desktop.png)
### Connecting to Red Hat Enterprise Linux 7
To set permissions to enable remote access on your RHEL7 computer, open **All Settings** on the Linux desktop.
![](https://opensource.com/sites/default/files/uploads/remmina9_settings.png)
Click on the Sharing icon, and this window will open:
![](https://opensource.com/sites/default/files/uploads/remmina10_sharing.png)
If **Screen Sharing** is off, click on it. A window will open, where you can slide it into the **On** position. If you want to allow remote connections to control the desktop, set **Allow Remote Control** to **On**. You can also select between two access options: one that prompts the computer's primary user to accept or deny the connection request, and another that allows connection authentication with a password. At the bottom of the window, select the network interface where connections are allowed, then close the window.
Next, open **Firewall Settings** from **Applications Menu → Sundry → Firewall**.
![](https://opensource.com/sites/default/files/uploads/remmina11_firewall_settings.png)
Check the box next to vnc-server (as shown above) and close the window. Then, head to Remmina on your remote computer, enter the IP address of the Linux desktop you want to connect with, select **VNC** as the protocol, and hit the **Enter** key.
![](https://opensource.com/sites/default/files/uploads/remmina12_vncprotocol.png)
If you previously chose the authentication option **New connections must ask for access** , the RHEL system's user will see a prompt like this:
![](https://opensource.com/sites/default/files/uploads/remmina13_permission.png)
Select **Accept** for the remote connection to succeed.
If you chose the option to authenticate the connection with a password, Remmina will prompt you for the password.
![](https://opensource.com/sites/default/files/uploads/remmina14_password-auth.png)
Enter the password and hit **OK** , and you should be connected to the remote computer.
![](https://opensource.com/sites/default/files/uploads/remmina15_connected.png)
### Using Remmina
Remmina offers a tabbed UI, as shown in above picture, much like a web browser. In the top-left corner, as shown in the screenshot above, you can see two tabs: one for the previously established Windows 10 connection and a new one for the RHEL connection.
On the left-hand side of the window, there is a toolbar with options such as **Resize Window** , **Full-Screen Mode** , **Preferences** , **Screenshot** , **Disconnect** , and more. Explore them and see which ones work best for you.
You can also create saved connections in Remmina by clicking on the **+** (plus) sign in the top-left corner. Fill in the form with details specific to your connection and click **Save**. Here is an example Windows 10 RDP connection:
![](https://opensource.com/sites/default/files/uploads/remmina16_saved-connection.png)
The next time you open Remmina, the connection will be available.
![](https://opensource.com/sites/default/files/uploads/remmina17_connection-available.png)
Just click on it, and your connection will be established without re-entering the details.
### Additional info
When you use remote desktop software, all the operations you perform take place on the remote desktop and use its resources—Remmina (or similar software) is just a way to interact with that desktop. You can also access a computer remotely through SSH, but it usually limits you to a text-only terminal to that computer.
You should also note that enabling remote connections with your computer could cause serious damage if an attacker uses this method to gain access to your computer. Therefore, it is wise to disallow remote desktop connections and block related services in your firewall when you are not actively using Remote Desktop.
--------------------------------------------------------------------------------
via: https://opensource.com/article/18/6/linux-remote-desktop
作者:[Kedar Vijay Kulkarni][a]
选题:[lujun9972](https://github.com/lujun9972)
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]:https://opensource.com/users/kkulkarn
[1]:https://en.wikipedia.org/wiki/Remote_desktop_software
[2]:https://github.com/ManageIQ/integration_tests
[3]:https://www.remmina.org/wp/
[4]:https://www.tecmint.com/remmina-remote-desktop-sharing-and-ssh-client/
[5]:https://superuser.com/questions/1019203/remote-desktop-settings-missing#1019212
[6]:https://opensource.com/article/18/5/how-find-ip-address-linux
[7]:https://www.groovypost.com/howto/find-windows-10-device-ip-address/

View File

@@ -1,169 +0,0 @@
[#]: collector: (lujun9972)
[#]: translator: ( )
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (4 Unique Terminal Emulators for Linux)
[#]: via: (https://www.linux.com/blog/learn/2018/12/4-unique-terminals-linux)
[#]: author: (Jack Wallen https://www.linux.com/users/jlwallen)
4 Unique Terminal Emulators for Linux
======
![](https://www.linux.com/sites/lcom/files/styles/rendered_file/public/terminals_main.jpg?itok=e6av-5VO)
Lets face it, if youre a Linux administrator, youre going to work with the command line. To do that, youll be using a terminal emulator. Most likely, your distribution of choice came pre-installed with a default terminal emulator that gets the job done. But this is Linux, so you have a wealth of choices to pick from, and that ideology holds true for terminal emulators as well. In fact, if you open up your distributions GUI package manager (or search from the command line), youll find a trove of possible options. Of those, many are pretty straightforward tools; however, some are truly unique.
In this article, Ill highlight four such terminal emulators, that will not only get the job done, but do so while making the job a bit more interesting or fun. So, lets take a look at these terminals.
### Tilda
[Tilda][1] is designed for Gtk and is a member of the cool drop-down family of terminals. That means the terminal is always running in the background, ready to drop down from the top of your monitor (such as Guake and Yakuake). What makes Tilda rise above many of the others is the number of configuration options available for the terminal (Figure 1).
![](https://www.linux.com/sites/lcom/files/styles/rendered_file/public/terminals_1.jpg?itok=bra6qb6X)
Tilda can be installed from the standard repositories. On a Ubuntu- (or Debian-) based distribution, the installation is as simple as:
```
sudo apt-get install tilda -y
```
Once installed, open Tilda from your desktop menu, which will also open the configuration window. Configure the app to suit your taste and then close the configuration window. You can then open and close Tilda by hitting the F1 hotkey. One caveat to using Tilda is that, after the first run, you wont find any indication as to how to reach the configuration wizard. No worries. If you run the command tilda -C it will open the configuration window, while still retaining the options youve previously set.
Available options include:
* Terminal size and location
* Font and color configurations
* Auto Hide
* Title
* Custom commands
* URL Handling
* Transparency
* Animation
* Scrolling
* And more
What I like about these types of terminals is that they easily get out of the way when you dont need them and are just a button click away when you do. For those that hop in and out of the terminal, a tool like Tilda is ideal.
### Aterm
Aterm holds a special place in my heart, as it was one of the first terminals I used that made me realize how flexible Linux was. This was back when AfterStep was my window manager of choice (which dates me a bit) and I was new to the command line. What Aterm offered was a terminal emulator that was highly customizable, while helping me learn the ins and outs of using the terminal (how to add options and switches to a command). “How?” you ask. Because Aterm never had a GUI for customization. To run Aterm with any special options, it had to run as a command. For example, say you want to open Aterm with transparency enabled, green text, white highlights, and no scroll bar. To do this, issue the command:
```
aterm -tr -fg green -bg white +xb
```
The end result (with the top command running for illustration) would look like that shown in Figure 2.
![Aterm][3]
Figure 2: Aterm with a few custom options.
[Used with permission][4]
Of course, you must first install Aterm. Fortunately, the application is still found in the standard repositories, so installing on the likes of Ubuntu is as simple as:
```
sudo apt-get install aterm -y
```
If you want to always open Aterm with those options, your best bet is to create an alias in your ~/.bashrc file like so:
```
alias=”aterm -tr -fg green -bg white +sb”
```
Save that file and, when you issue the command aterm, it will always open with those options. For more about creating aliases, check out [this tutorial][5].
### Eterm
Eterm is the second terminal that really showed me how much fun the Linux command line could be. Eterm is the default terminal emulator for the Enlightenment desktop. When I eventually migrated from AfterStep to Enlightenment (back in the early 2000s), I was afraid Id lose out on all those cool aesthetic options. That turned out to not be the case. In fact, Eterm offered plenty of unique options, while making the task easier with a terminal toolbar. With Eterm, you can easily select from a large number of background images (should you want one - Figure 3) by selecting from the Background > Pixmap menu entry.
![Eterm][7]
Figure 3: Selecting from one of the many background images for Eterm.
[Used with permission][4]
There are a number of other options to configure (such as font size, map alerts, toggle scrollbar, brightness, contrast, and gamma of background images, and more). The one thing you want to make sure is, after youve configured Eterm to suit your tastes, to click Eterm > Save User Settings (otherwise, all settings will be lost when you close the app).
Eterm can be installed from the standard repositories, with a command such as:
```
sudo apt-get install eterm
```
### Extraterm
[Extraterm][8] should probably win a few awards for coolest feature set of any terminal window project available today. The most unique feature of Extraterm is the ability to wrap commands in color-coded frames (blue for successful commands and red for failed commands - Figure 4).
![Extraterm][10]
Figure 4: Extraterm showing two failed command frames.
[Used with permission][4]
When you run a command, Extraterm will wrap the command in an isolated frame. If the command succeeds, the frame will be outlined in blue. Should the command fail, the frame will be outlined in red.
Extraterm cannot be installed via the standard repositories. In fact, the only way to run Extraterm on Linux (at the moment) is to [download the precompiled binary][11] from the projects GitHub page, extract the file, change into the newly created directory, and issue the command ./extraterm.
Once the app is running, to enable frames you must first enable bash integration. To do that, open Extraterm and then right-click anywhere in the window to reveal the popup menu. Scroll until you see the entry for Inject Bash shell Integration (Figure 5). Select that entry and you can then begin using the frames option.
![Extraterm][13]
Figure 5: Injecting Bash integration for Extraterm.
[Used with permission][4]
If you run a command, and dont see a frame appear, you probably have to create a new frame for the command (as Extraterm only ships with a few default frames). To do that, click on the Extraterm menu button (three horizontal lines in the top right corner of the window), select Settings, and then click the Frames tab. In this window, scroll down and click the New Rule button. You can then add a command you want to work with the frames option (Figure 6).
![frames][15]
Figure 6: Adding a new rule for frames.
[Used with permission][4]
If, after this, you still dont see frames appearing, download the extraterm-commands file from the [Download page][11], extract the file, change into the newly created directory, and issue the command sh setup_extraterm_bash.sh. That should enable frames for Extraterm.
Theres plenty more options available for Extraterm. Im convinced, once you start playing around with this new take on the terminal window, you wont want to go back to the standard terminal. Hopefully the developer will make this app available to the standard repositories soon (as it could easily become one of the most popular terminal windows in use).
### And Many More
As you probably expected, there are quite a lot of terminals available for Linux. These four represent (at least for me) four unique takes on the task, each of which do a great job of helping you run the commands every Linux admin needs to run. If you arent satisfied with one of these, give your package manager a look to see whats available. You are sure to find something that works perfectly for you.
--------------------------------------------------------------------------------
via: https://www.linux.com/blog/learn/2018/12/4-unique-terminals-linux
作者:[Jack Wallen][a]
选题:[lujun9972][b]
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://www.linux.com/users/jlwallen
[b]: https://github.com/lujun9972
[1]: http://tilda.sourceforge.net/tildadoc.php
[2]: https://www.linux.com/files/images/terminals2jpg
[3]: https://www.linux.com/sites/lcom/files/styles/rendered_file/public/terminals_2.jpg?itok=gBkRLwDI (Aterm)
[4]: https://www.linux.com/licenses/category/used-permission
[5]: https://www.linux.com/blog/learn/2018/12/aliases-diy-shell-commands
[6]: https://www.linux.com/files/images/terminals3jpg
[7]: https://www.linux.com/sites/lcom/files/styles/rendered_file/public/terminals_3.jpg?itok=RVPTJAtK (Eterm)
[8]: http://extraterm.org
[9]: https://www.linux.com/files/images/terminals4jpg
[10]: https://www.linux.com/sites/lcom/files/styles/rendered_file/public/terminals_4.jpg?itok=2n01qdwO (Extraterm)
[11]: https://github.com/sedwards2009/extraterm/releases
[12]: https://www.linux.com/files/images/terminals5jpg
[13]: https://www.linux.com/sites/lcom/files/styles/rendered_file/public/terminals_5.jpg?itok=FdaE1Mpf (Extraterm)
[14]: https://www.linux.com/files/images/terminals6jpg
[15]: https://www.linux.com/sites/lcom/files/styles/rendered_file/public/terminals_6.jpg?itok=lQ1Zv5wq (frames)

View File

@@ -1,54 +0,0 @@
[#]: collector: (lujun9972)
[#]: translator: ( )
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (Go on an adventure in your Linux terminal)
[#]: via: (https://opensource.com/article/18/12/linux-toy-adventure)
[#]: author: (Jason Baker https://opensource.com/users/jason-baker)
Go on an adventure in your Linux terminal
======
Our final day of the Linux command-line toys advent calendar ends with the beginning of a grand adventure.
![](https://opensource.com/sites/default/files/styles/image-full-size/public/uploads/linux-toy-advent.png?itok=OImUJJI5)
Today is the final day of our 24-day-long Linux command-line toys advent calendar. Hopefully, you've been following along, but if not, start back at [the beginning][1] and work your way through. You'll find plenty of games, diversions, and oddities for your Linux terminal.
And while you may have seen some toys from our calendar before, we hope theres at least one new thing for everyone.
Today's toy was suggested by Opensource.com moderator [Joshua Allen Holm][2]:
"If the last day of your advent calendar is not ESR's [Eric S. Raymond's] [open source release of Adventure][3], which retains use of the classic 'advent' command (Adventure in the BSD Games package uses 'adventure), I will be very, very, very disappointed. ;-)"
What a perfect way to end our series.
Colossal Cave Adventure (often just called Adventure), is a text-based game from the 1970s that gave rise to the entire adventure game genre. Despite its age, Adventure is still an easy way to lose hours as you explore a fantasy world, much like a Dungeons and Dragons dungeon master might lead you through an imaginary place.
Rather than take you through the history of Adventure here, I encourage you to go read Joshua's [history of the game][4] itself and why it was resurrected and re-ported a few years ago. Then, go [clone the source][5] and follow the [installation instructions][6] to launch the game with **advent** **** on your system. Or, as Joshua mentions, another version of the game can be obtained from the **bsd-games** package, which is probably available from your default repositories in your distribution of choice.
Do you have a favorite command-line toy that you we should have included? Our series concludes today, but we'd still love to feature some cool command-line toys in the new year. Let me know in the comments below, and I'll check it out. And let me know what you thought of today's amusement.
Be sure to check out yesterday's toy, [The Linux command line can fetch fun from afar][7], and I'll see you next year!
--------------------------------------------------------------------------------
via: https://opensource.com/article/18/12/linux-toy-adventure
作者:[Jason Baker][a]
选题:[lujun9972][b]
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://opensource.com/users/jason-baker
[b]: https://github.com/lujun9972
[1]: https://opensource.com/article/18/12/linux-toy-boxes
[2]: https://opensource.com/users/holmja
[3]: https://gitlab.com/esr/open-adventure (https://gitlab.com/esr/open-adventure)
[4]: https://opensource.com/article/17/6/revisit-colossal-cave-adventure-open-adventure
[5]: https://gitlab.com/esr/open-adventure
[6]: https://gitlab.com/esr/open-adventure/blob/master/INSTALL.adoc
[7]: https://opensource.com/article/18/12/linux-toy-remote

View File

@@ -1,186 +0,0 @@
[#]: collector: (lujun9972)
[#]: translator: ( WangYueScream)
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (How To Display Thumbnail Images In Terminal)
[#]: via: (https://www.ostechnix.com/how-to-display-thumbnail-images-in-terminal/)
[#]: author: (SK https://www.ostechnix.com/author/sk/)
How To Display Thumbnail Images In Terminal
======
![](https://www.ostechnix.com/wp-content/uploads/2019/01/lsix-720x340.png)
A while ago, we discussed about [**Fim**][1], a lightweight, CLI image viewer application used to display various type of images, such as bmp, gif, jpeg, and png etc., from command line. Today, I stumbled upon a similar utility named **lsix**. It is like ls command in Unix-like systems, but for images only. The lsix is a simple CLI utility designed to display thumbnail images in Terminal using **Sixel** graphics. For those wondering, Sixel, short for six pixels, is a type of bitmap graphics format. It uses **ImageMagick** , so almost all file formats supported by imagemagick will work fine.
### Features
Concerning the features of lsix, we can list the following:
* Automatically detects if your Terminal supports Sixel graphics or not. If your Terminal doesnt support Sixel, it will notify you to enable it.
* Automatically detects the terminal background color. It uses terminal escape sequences to try to figure out the foreground and background colors of your Terminal application and will display the thumbnails clearly.
* If there are more images in the directory, usually >21, lsix will display those images one row a a time, so you need not to wait for the entire montage to be created.
* Works well over SSH, so you can manipulate images stored on your remote web server without much hassle.
* It supports Non-bitmap graphics, such as.svg, .eps, .pdf, .xcf etc.
* Written in BASH, so works on almost all Linux distros.
### Installing lsix
Since lsix uses ImageMagick, make sure you have installed it. It is available in the default repositories of most Linux distributions. For example, on Arch Linux and its variants like Antergos, Manjaro Linux, ImageMagick can be installed using command:
```
$ sudo pacman -S imagemagick
```
On Debian, Ubuntu, Linux Mint:
```
$ sudo apt-get install imagemagick
```
lsix doesnt require any installation as it is just a BASH script. Just download it and move it to your $PATH. Its that simple.
Download the latest lsix version from projects github page. I am going to download the lsix archive file using command:
```
$ wget https://github.com/hackerb9/lsix/archive/master.zip
```
Extract the downloaded zip file:
```
$ unzip master.zip
```
This command will extract all contents into a folder named lsix-master. Copy the lsix binary from this directory to your $PATH, for example /usr/local/bin/.
```
$ sudo cp lsix-master/lsix /usr/local/bin/
```
Finally, make the lsbix binary executable:
```
$ sudo chmod +x /usr/local/bin/lsix
```
Thats it. Now is the time to display thumbnails in the terminal itself.
Before start using lsix, **make sure your Terminal supports Sixel graphics**.
The developer has developed lsix on an Xterm in **vt340 emulation mode**. However, the he claims that lsix should work on any Sixel compatible Terminal.
Xterm supports Sixel graphics, but it isnt enabled by default.
You can launch Xterm with Sixel mode enabled using command (from another Terminal):
```
$ xterm -ti vt340
```
Alternatively, you can make vt340 the default terminal type for Xterm as described below.
Edit **.Xresources** file (If it not available, just create it):
```
$ vi .Xresources
```
Add the following line:
```
xterm*decTerminalID : vt340
```
Press **ESC** and type **:wq** to save and close the file.
Finally, run the following command to apply the changes:
```
$ xrdb -merge .Xresources
```
Now Xterm will start with Sixel mode enabled at every launch by default.
### Display Thumbnail Images In Terminal
Launch Xterm (Dont forget to start it with vt340 mode). Here is how Xterm looks like in my system.
![](https://www.ostechnix.com/wp-content/uploads/2019/01/xterm-1.png)
Like I already stated, lsix is very simple utility. It doesnt have any command line flags or configuration files. All you have to do is just pass the path of your file as an argument like below.
```
$ lsix ostechnix/logo.png
```
![](https://www.ostechnix.com/wp-content/uploads/2019/01/lsix-4.png)
If you run it without path, it will display the thumbnail images in your current working directory. I have few files in a directory named **ostechnix**.
To display the thumbnails in this directory, just run:
```
$ lsix
```
![](https://www.ostechnix.com/wp-content/uploads/2019/01/lsix-1.png)
See? The thumbnails of all files are displayed in the terminal itself.
If you use ls command, you would just see the filenames only, not thumbnails.
![][3]
You can also display a specific image or group of images of a specific type using wildcards.
For example, to display a single image, just mention the full path of the image like below.
```
$ lsix girl.jpg
```
![](https://www.ostechnix.com/wp-content/uploads/2019/01/lsix-2.png)
To display all images of a specific type, say PNG, use the wildcard character like below.
```
$ lsix *.png
```
![][4]
For JPEG type images, the command would be:
```
$ lsix *jpg
```
The thumbnail image quality is surprisingly good. I thought lsix would just display blurry thumbnails. I was wrong. The thumbnails are clearly visible just like on the graphical image viewers.
And, thats all for now. As you can see, lsix is very similar to ls command, but it only for displaying thumbnails. If you deal with a lot of images at work, lsix might be quite handy. Give it a try and let us know your thoughts on this utility in the comment section below. If you know any similar tools, please suggest them as well. I will check and update this guide.
More good stuffs to come. Stay tuned!
Cheers!
--------------------------------------------------------------------------------
via: https://www.ostechnix.com/how-to-display-thumbnail-images-in-terminal/
作者:[SK][a]
选题:[lujun9972][b]
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://www.ostechnix.com/author/sk/
[b]: https://github.com/lujun9972
[1]: https://www.ostechnix.com/how-to-display-images-in-the-terminal/
[2]: data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7
[3]: http://www.ostechnix.com/wp-content/uploads/2019/01/ls-command-1.png
[4]: http://www.ostechnix.com/wp-content/uploads/2019/01/lsix-3.png

View File

@@ -1,58 +0,0 @@
[#]: collector: (lujun9972)
[#]: translator: (geekpi)
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (Getting started with Sandstorm, an open source web app platform)
[#]: via: (https://opensource.com/article/19/1/productivity-tool-sandstorm)
[#]: author: (Kevin Sonney https://opensource.com/users/ksonney (Kevin Sonney))
Getting started with Sandstorm, an open source web app platform
======
Learn about Sandstorm, the third in our series on open source tools that will make you more productive in 2019.
![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/sand_dunes_desert_hills_landscape_nature.jpg?itok=wUByylBb)
There seems to be a mad rush at the beginning of every year to find ways to be more productive. New Year's resolutions, the itch to start the year off right, and of course, an "out with the old, in with the new" attitude all contribute to this. And the usual round of recommendations is heavily biased towards closed source and proprietary software. It doesn't have to be that way.
Here's the third of my picks for 19 new (or new-to-you) open source tools to help you be more productive in 2019.
### Sandstorm
Being productive isn't just about to-do lists and keeping things organized. Often it requires a suite of tools linked to make a workflow go smoothly.
![](https://opensource.com/sites/default/files/uploads/sandstorm_1.png)
[Sandstorm][1] is an open source collection of packaged apps, all accessible from a single web interface and managed from a central console. You can host it yourself or use the [Sandstorm Oasis][2] service—for a per-user fee.
![](https://opensource.com/sites/default/files/uploads/sandstorm_2.png)
Sandstorm has a marketplace that makes it simple to install the apps that are available. It includes apps for productivity, finance, note taking, task tracking, chat, games, and a whole lot more. You can also package your own apps and upload them by following the application-packaging guidelines in the [developer documentation][3].
![](https://opensource.com/sites/default/files/uploads/sandstorm_3.png)
Once installed, a user can create [grains][4]—basically containerized instances of app data. Grains are private by default and can be shared with other Sandstorm users. This means they are secure by default, and users can chose what to share with others.
![](https://opensource.com/sites/default/files/uploads/sandstorm_4.png)
Sandstorm can authenticate from several different external sources as well as use a "passwordless" email-based authentication. Using an external service means you don't have to manage yet another set of credentials if you already use one of the supported services.
In the end, Sandstorm makes installing and using supported collaborative apps quick, easy, and secure.
--------------------------------------------------------------------------------
via: https://opensource.com/article/19/1/productivity-tool-sandstorm
作者:[Kevin Sonney][a]
选题:[lujun9972][b]
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://opensource.com/users/ksonney (Kevin Sonney)
[b]: https://github.com/lujun9972
[1]: https://sandstorm.io/
[2]: https://oasis.sandstorm.io
[3]: https://docs.sandstorm.io/en/latest/developing/
[4]: https://sandstorm.io/how-it-works

View File

@@ -1,5 +1,5 @@
[#]: collector: (lujun9972)
[#]: translator: ( )
[#]: translator: (hopefully2333)
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )

View File

@@ -1,59 +0,0 @@
[#]: collector: (lujun9972)
[#]: translator: (geekpi)
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (Get started with TaskBoard, a lightweight kanban board)
[#]: via: (https://opensource.com/article/19/1/productivity-tool-taskboard)
[#]: author: (Kevin Sonney https://opensource.com/users/ksonney (Kevin Sonney))
Get started with TaskBoard, a lightweight kanban board
======
Check out the ninth tool in our series on open source tools that will make you more productive in 2019.
![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/checklist_hands_team_collaboration.png?itok=u82QepPk)
There seems to be a mad rush at the beginning of every year to find ways to be more productive. New Year's resolutions, the itch to start the year off right, and of course, an "out with the old, in with the new" attitude all contribute to this. And the usual round of recommendations is heavily biased towards closed source and proprietary software. It doesn't have to be that way.
Here's the ninth of my picks for 19 new (or new-to-you) open source tools to help you be more productive in 2019.
### TaskBoard
As I wrote in the [second article][1] in this series, [kanban boards][2] are pretty popular these days. And not all kanban boards are created equal. [TaskBoard][3] is a PHP application that is easy to set up on an existing web server and has a set of functions that make it easy to use and manage.
![](https://opensource.com/sites/default/files/uploads/taskboard-1.png)
[Installation][4] is as simple as unzipping the files on your web server, running a script or two, and making sure the correct directories are accessible. The first time you start it up, you're presented with a login form, and then it's time to start adding users and making boards. Board creation options include adding the columns you want to use and setting the default color of the cards. You can also assign users to boards so everyone sees only the boards they need to see.
User management is lightweight, and all accounts are local to the server. You can set a default board for everyone on the server, and users can set their own default boards, too. These options can be useful when someone works on one board more than others.
![](https://opensource.com/sites/default/files/uploads/taskboard-2.png)
TaskBoard also allows you to create automatic actions, which are actions taken upon changes to user assignment, columns, or card categories. Although TaskBoard is not as powerful as some other kanban apps, you can set up automatic actions to make cards more visible for board users, clear due dates, and auto-assign new cards to people as needed. For example, in the screenshot below, if a card is assigned to the "admin" user, its color is changed to red, and when a card is assigned to my user, its color is changed to teal. I've also added an action to clear an item's due date if it's added to the "To-Do" column and to auto-assign cards to my user when that happens.
![](https://opensource.com/sites/default/files/uploads/taskboard-3.png)
The cards are very straightforward. While they don't have a start date, they do have end dates and a points field. Points can be used for estimating the time needed, effort required, or just general priority. Using points is optional, but if you are using TaskBoard for scrum planning or other agile techniques, it is a really handy feature. You can also filter the view by users and categories. This can be helpful on a team with multiple work streams going on, as it allows a team lead or manager to get status information about progress or a person's workload.
![](https://opensource.com/sites/default/files/uploads/taskboard-4.png)
If you need a reasonably lightweight kanban board, check out TaskBoard. It installs quickly, has some nice features, and is very, very easy to use. It's also flexible enough to be used for development teams, personal task tracking, and a whole lot more.
--------------------------------------------------------------------------------
via: https://opensource.com/article/19/1/productivity-tool-taskboard
作者:[Kevin Sonney][a]
选题:[lujun9972][b]
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://opensource.com/users/ksonney (Kevin Sonney)
[b]: https://github.com/lujun9972
[1]: https://opensource.com/article/19/1/productivity-tool-wekan
[2]: https://en.wikipedia.org/wiki/Kanban
[3]: https://taskboard.matthewross.me/
[4]: https://taskboard.matthewross.me/docs/

View File

@@ -1,5 +1,5 @@
[#]: collector: (lujun9972)
[#]: translator: ( )
[#]: translator: (geekpi)
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )

View File

@@ -1,5 +1,5 @@
[#]: collector: (lujun9972)
[#]: translator: ( )
[#]: translator: (geekpi)
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )

View File

@@ -1,161 +0,0 @@
[#]: collector: (lujun9972)
[#]: translator: ( )
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (Top 5 Linux Distributions for Development in 2019)
[#]: via: (https://www.linux.com/blog/2019/1/top-5-linux-distributions-development-2019)
[#]: author: (Jack Wallen https://www.linux.com/users/jlwallen)
Top 5 Linux Distributions for Development in 2019
======
![](https://www.linux.com/sites/lcom/files/styles/rendered_file/public/dev-main.jpg?itok=DEe9pYtb)
One of the most popular tasks undertaken on Linux is development. With good reason: Businesses rely on Linux. Without Linux, technology simply wouldnt meet the demands of todays ever-evolving world. Because of that, developers are constantly working to improve the environments with which they work. One way to manage such improvements is to have the right platform to start with. Thankfully, this is Linux, so you always have a plethora of choices.
But sometimes, too many choices can be a problem in and of itself. Which distribution is right for your development needs? That, of course, depends on what youre developing, but certain distributions that just make sense to use as a foundation for your task. Ill highlight five distributions I consider the best for developers in 2019.
### Ubuntu
Lets not mince words here. Although the Linux Mint faithful are an incredibly loyal group (with good reason, their distro of choice is fantastic), Ubuntu Linux gets the nod here. Why? Because, thanks to the likes of [AWS][1], Ubuntu is one of the most deployed server operating systems. That means developing on a Ubuntu desktop distribution makes for a much easier translation to Ubuntu Server. And because Ubuntu makes it incredibly easy to develop for, work with, and deploy containers, it makes perfect sense that youd want to work with this platform. Couple that with Ubuntus inclusion of Snap Packages, and Canonical's operating system gets yet another boost in popularity.
But its not just about what you can do with Ubuntu, its how easily you can do it. For nearly every task, Ubuntu is an incredibly easy distribution to use. And because Ubuntu is so popular, chances are every tool and IDE you want to work with can be easily installed from the Ubuntu Software GUI (Figure 1).
![Ubuntu][3]
Figure 1: Developer tools found in the Ubuntu Software tool.
[Used with permission][4]
If youre looking for ease of use, simplicity of migration, and plenty of available tools, you cannot go wrong with Ubuntu as a development platform.
### openSUSE
Theres a very specific reason why I add openSUSE to this list. Not only is it an outstanding desktop distribution, its also one of the best rolling releases youll find on the market. So if youre wanting to develop with and release for the most recent software available, [openSUSE Tumbleweed][5] should be one of your top choices. If you want to leverage the latest releases of your favorite IDEs, if you always want to make sure youre developing with the most recent libraries and toolkits, Tumbleweed is your platform.
But openSUSE doesnt just offer a rolling release distribution. If youd rather make use of a standard release platform, [openSUSE Leap][6] is what you want.
Of course, its not just about standard or rolling releases. The openSUSE platform also has a Kubernetes-specific release, called [Kubic][7], which is based on Kubernetes atop openSUSE MicroOS. But even if you arent developing for Kubernetes, youll find plenty of software and tools to work with.
And openSUSE also offers the ability to select your desktop environment, or (should you chose) a generic desktop or server (Figure 2).
![openSUSE][9]
Figure 2: The openSUSE Tumbleweed installation in action.
[Used with permission][4]
### Fedora
Using Fedora as a development platform just makes sense. Why? The distribution itself seems geared toward developers. With a regular, six month release cycle, developers can be sure they wont be working with out of date software for long. This can be important, when you need the most recent tools and libraries. And if youre developing for enterprise-level businesses, Fedora makes for an ideal platform, as it is the upstream for Red Hat Enterprise Linux. What that means is the transition to RHEL should be painless. Thats important, especially if you hope to bring your project to a much larger market (one with deeper pockets than a desktop-centric target).
Fedora also offers one of the best GNOME experiences youll come across (Figure 3). This translates to a very stable and fast desktops.
![GNOME][11]
Figure 3: The GNOME desktop on Fedora.
[Used with permission][4]
But if GNOME isnt your jam, you can opt to install one of the [Fedora spins][12] (which includes KDE, XFCE, LXQT, Mate-Compiz, Cinnamon, LXDE, and SOAS).
### Pop!_OS
Id be remiss if I didnt include [System76][13]s platform, customized specifically for their hardware (although it does work fine on other hardware). Why would I include such a distribution, especially one that doesnt really venture far away from the Ubuntu platform for which is is based? Primarily because this is the distribution you want if you plan on purchasing a desktop or laptop from System76. But why would you do that (especially given that Linux works on nearly all off-the-shelf hardware)? Because System76 sells outstanding hardware. With the release of their Thelio desktop, you have available one of the most powerful desktop computers on the market. If youre developing seriously large applications (especially ones that lean heavily on very large databases or require a lot of processing power for compilation), why not go for the best? And since Pop!_OS is perfectly tuned for System76 hardware, this is a no-brainer.
Since Pop!_OS is based on Ubuntu, youll have all the tools available to the base platform at your fingertips (Figure 4).
![Pop!_OS][15]
Figure 4: The Anjunta IDE running on Pop!_OS.
[Used with permission][4]
Pop!_OS also defaults to encrypted drives, so you can trust your work will be safe from prying eyes (should your hardware fall into the wrong hands).
### Manjaro
For anyone that likes the idea of developing on Arch Linux, but doesnt want to have to jump through all the hoops of installing and working with Arch Linux, theres Manjaro. Manjaro makes it easy to have an Arch Linux-based distribution up and running (as easily as installing and using, say, Ubuntu).
But what makes Manjaro developer-friendly (besides enjoying that Arch-y goodness at the base) is how many different flavors youll find available for download. From the [Manjaro download page][16], you can grab the following flavors:
* GNOME
* XFCE
* KDE
* OpenBox
* Cinnamon
* I3
* Awesome
* Budgie
* Mate
* Xfce Developer Preview
* KDE Developer Preview
* GNOME Developer Preview
* Architect
* Deepin
Of note are the developer editions (which are geared toward testers and developers), the Architect edition (which is for users who want to build Manjaro from the ground up), and the Awesome edition (Figure 5 - which is for developers dealing with everyday tasks). The one caveat to using Manjaro is that, like any rolling release, the code you develop today may not work tomorrow. Because of this, you need to think with a certain level of agility. Of course, if youre not developing for Manjaro (or Arch), and youre doing more generic (or web) development, that will only affect you if the tools you use are updated and no longer work for you. Chances of that happening, however, are slim. And like with most Linux distributions, youll find a ton of developer tools available for Manjaro.
![Manjaro][18]
Figure 5: The Manjaro Awesome Edition is great for developers.
[Used with permission][4]
Manjaro also supports the Arch User Repository (a community-driven repository for Arch users), which includes cutting edge software and libraries, as well as proprietary applications like [Unity Editor][19] or yEd. A word of warning, however, about the Arch User Repository: It was discovered that the AUR contained software considered to be malicious. So, if you opt to work with that repository, do so carefully and at your own risk.
### Any Linux Will Do
Truth be told, if youre a developer, just about any Linux distribution will work. This is especially true if you do most of your development from the command line. But if you prefer a good GUI running on top of a reliable desktop, give one of these distributions a try, they will not disappoint.
Learn more about Linux through the free ["Introduction to Linux" ][20]course from The Linux Foundation and edX.
--------------------------------------------------------------------------------
via: https://www.linux.com/blog/2019/1/top-5-linux-distributions-development-2019
作者:[Jack Wallen][a]
选题:[lujun9972][b]
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://www.linux.com/users/jlwallen
[b]: https://github.com/lujun9972
[1]: https://aws.amazon.com/
[2]: https://www.linux.com/files/images/dev1jpg
[3]: https://www.linux.com/sites/lcom/files/styles/rendered_file/public/dev_1.jpg?itok=7QJQWBKi (Ubuntu)
[4]: https://www.linux.com/licenses/category/used-permission
[5]: https://en.opensuse.org/Portal:Tumbleweed
[6]: https://en.opensuse.org/Portal:Leap
[7]: https://software.opensuse.org/distributions/tumbleweed
[8]: /files/images/dev2jpg
[9]: https://www.linux.com/sites/lcom/files/styles/rendered_file/public/dev_2.jpg?itok=1GJmpr1t (openSUSE)
[10]: /files/images/dev3jpg
[11]: https://www.linux.com/sites/lcom/files/styles/rendered_file/public/dev_3.jpg?itok=_6Ki4EOo (GNOME)
[12]: https://spins.fedoraproject.org/
[13]: https://system76.com/
[14]: /files/images/dev4jpg
[15]: https://www.linux.com/sites/lcom/files/styles/rendered_file/public/dev_4.jpg?itok=nNG2Ax24 (Pop!_OS)
[16]: https://manjaro.org/download/
[17]: /files/images/dev5jpg
[18]: https://www.linux.com/sites/lcom/files/styles/rendered_file/public/dev_5.jpg?itok=RGfF2UEi (Manjaro)
[19]: https://unity3d.com/unity/editor
[20]: https://training.linuxfoundation.org/linux-courses/system-administration-training/introduction-to-linux

View File

@@ -1,73 +0,0 @@
[#]: collector: (lujun9972)
[#]: translator: (geekpi)
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (3 simple and useful GNOME Shell extensions)
[#]: via: (https://fedoramagazine.org/3-simple-and-useful-gnome-shell-extensions/)
[#]: author: (Ryan Lerch https://fedoramagazine.org/introducing-flatpak/)
3 simple and useful GNOME Shell extensions
======
![](https://fedoramagazine.org/wp-content/uploads/2019/01/3simple-816x345.png)
The default desktop of Fedora Workstation — GNOME Shell — is known and loved by many users for its minimal, clutter-free user interface. It is also known for the ability to add to the stock interface using extensions. In this article, we cover 3 simple, and useful extensions for GNOME Shell. These three extensions provide a simple extra behaviour to your desktop; simple tasks that you might do every day.
### Installing Extensions
The quickest and easiest way to install GNOME Shell extensions is with the Software Application. Check out the previous post here on the Magazine for more details:
![](https://fedoramagazine.org/wp-content/uploads/2018/11/installing-extensions-768x325.jpg)
### Removable Drive Menu
![][1]
Removable Drive Menu extension on Fedora 29
First up is the [Removable Drive Menu][2] extension. It is a simple tool that adds a small widget in the system tray if you have a removable drive inserted into your computer. This allows you easy access to open Files for your removable drive, or quickly and easily eject the drive for safe removal of the device.
![][3]
Removable Drive Menu in the Software application
### Extensions Extension.
![][4]
The [Extensions][5] extension is super useful if you are always installing and trying out new extensions. It provides a list of all the installed extensions, allowing you to enable or disable them. Additionally, if an extension has settings, it allows quick access to the settings dialog for each one.
![][6]
the Extensions extension in the Software application
### Frippery Move Clock
![][7]
Finally, there is the simplest extension in the list. [Frippery Move Clock][8], simply moves the position of the clock from the center of the top bar to the right, next to the status area.
![][9]
--------------------------------------------------------------------------------
via: https://fedoramagazine.org/3-simple-and-useful-gnome-shell-extensions/
作者:[Ryan Lerch][a]
选题:[lujun9972][b]
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://fedoramagazine.org/introducing-flatpak/
[b]: https://github.com/lujun9972
[1]: https://fedoramagazine.org/wp-content/uploads/2019/01/removable-disk-1024x459.jpg
[2]: https://extensions.gnome.org/extension/7/removable-drive-menu/
[3]: https://fedoramagazine.org/wp-content/uploads/2019/01/removable-software-1024x723.png
[4]: https://fedoramagazine.org/wp-content/uploads/2019/01/extensions-extension-1024x459.jpg
[5]: https://extensions.gnome.org/extension/1036/extensions/
[6]: https://fedoramagazine.org/wp-content/uploads/2019/01/extensions-software-1024x723.png
[7]: https://fedoramagazine.org/wp-content/uploads/2019/01/move_clock-1024x189.jpg
[8]: https://extensions.gnome.org/extension/2/move-clock/
[9]: https://fedoramagazine.org/wp-content/uploads/2019/01/Screenshot-from-2019-01-28-21-53-18-1024x723.png

View File

@@ -0,0 +1,552 @@
[#]: collector: (lujun9972)
[#]: translator: ( )
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (A small notebook for a system administrator)
[#]: via: (https://habr.com/en/post/437912/)
[#]: author: (sukhe https://habr.com/en/users/sukhe/)
A small notebook for a system administrator
======
I am a system administrator, and I need a small, lightweight notebook for every day carrying. Of course, not just to carry it, but for use it to work.
I already have a ThinkPad x200, but its heavier than I would like. And among the lightweight notebooks, I did not find anything suitable. All of them imitate the MacBook Air: thin, shiny, glamorous, and they all critically lack ports. Such notebook is suitable for posting photos on Instagram, but not for work. At least not for mine.
After not finding anything suitable, I thought about how a notebook would turn out if it were developed not with design, but the needs of real users in mind. System administrators, for example. Or people serving telecommunications equipment in hard-to-reach places — on roofs, masts, in the woods, literally in the middle of nowhere.
The results of my thoughts are presented in this article.
[![Figure to attract attention][1]][2]
Of course, your understanding of the admin notebook does not have to coincide with mine. But I hope you will find a couple of interesting thoughts here.
Just keep in mind that «system administrator» is just the name of my position. And in fact, I have to work as a network engineer, and installer, and perform a significant part of other work related to hardware. Our company is tiny, we are far from large settlements, so all of us have to be universal specialist.
In order not to constantly clarify «this notebook», later in the article I will call it the “adminbook”. Although it can be useful not only to administrators, but also to all who need a small, lightweight notebook with a lot of connectors. In fact, even large laptops dont have as many connectors.
So let's get started…
### 1\. Dimensions and weight
Of course, you want it smaller and more lightweight, but the keyboard with the screen should not be too small. And there has to be space for connectors, too.
In my opinion, a suitable option is a notebook half the size of an x200. That is, approximately the size of a sheet of A5 paper (210x148mm). In addition, the side pockets of many bags and backpacks are designed for this size. This means that the adminbook doesnt even have to be carried in the main compartment.
Though I couldnt fit everything I wanted into 210mm. To make a comfortable keyboard, the width had to be increased to 230mm.
In the illustrations the adminbook may seem too thick. But thats only an optical illusion. In fact, its thickness is 25mm (28mm taking the rubber feet into account).
Its size is close to the usual hardcover book, 300-350 pages thick.
Its lightweight, too — about 800 grams (half the weight of the ThinkPad).
The case of the adminbook is made of mithril aluminum. Its a lightweight, durable metal with good thermal conductivity.
### 2\. Keyboard and trackpoint
A quality keyboard is very important for me. “Quality” there means the fastest possible typing and hotkey speed. It needs to be so “matter-of-fact” I dont have to think about it at all, as if it types seemingly by force of thought.
This is possible if the keys are normal size and in their typical positions. But the adminbook is too small for that. In width, it is even smaller than the main block of keys of a desktop keyboard. So, you have to work around that somehow.
After a long search and numerous tests, I came up with what you see in the picture:
![](https://habrastorage.org/webt/2-/mh/ag/2-mhagvoofl7vgqiadv3rcnclb0.jpeg)
Fig.2.1 — Adminbook keyboard
This keyboard has the same vertical key distance as on a regular keyboard. A horizontal distance decreased just only 2mm (17 instead of 19).
You can even type blindly on this keyboard! To do this, some keys have small bumps for tactile orientation.
However, if you do not sit at a table, the main input method will be to press the keys “at a glance”. And here the muscle memory does not help — you have to look at the keys with your eyes.
To hit the buttons faster, different key colors are used.
For example, the numeric row is specifically colored gray to visually separate it from the QWERTY row, and NumLock is mapped to the “6” key, colored black to stand out.
To the right of NumLock, gray indicates the area of the numeric keypad. These (and neighboring) buttons work like a numeric keypad in NumLock mode or when you press Fn. I must say, this is a useful feature for the admin computer — some users come up with passwords on the numpad in the form of a “cross”, “snake”, “spiral”, etc. I want to be able to type them that way too.
As for the function keys. I dont know about you, but it annoys me when, in a 15-inch laptop, this row is half-height and only accessible through pressing Fn. Given that theres a lot free space around the keyboard!
The adminbook doesnt have free space at all. But the function keys can be pressed without Fn. These are separate keys that are even divided into groups of 4 using color coding and location.
By the way, have you seen which key is to the right of AltGr on modern ThinkPads? I dont know what they were thinking, but now they have PrintScreen there!
Where? Where, I ask, is the context menu key that I use every day? Its not there.
So the adminbook has it. Two, even! You can put it up by pressing Fn + Alt. Sorry, I couldnt map it to a separate key due to lack of space. Just in case, I added the “Right Win” key as Fn + CtrlR. Maybe some people use it for something.
However, the adminbook allows you to customize the keyboard to your liking. The keyboard is fully reprogrammable. You can assign the scan codes you need to the keys. Setting the keyboard parameters is done via the “KEY” button (Fn + F3).
Of course, the adminbook has a keyboard backlight. It is turned on with Fn + B (below the trackpoint, you can even find it in the dark). The backlight here is similar to the ThinkPad ThinkLight. That is, its an LED above the display, illuminating the keyboard from the top. In this case, it is better than a backlight from below, because it allows you to distinguish the color of the keys. In addition, keys have several characters printed on them, while only English letters are usually made translucent to the backlight.
Since were on the topic of characters… Red letters are Ukrainian and Russian. I specifically drew them to show that keys have space for several alphabets: after all, English is not a native language for most of humanity.
Since there isnt enough space for a full touchpad, the trackpoint is used as the positioning device. If you have no experience working with it — dont worry, its actually quite handy. The mouse cursor moves with slight inclines of the trackpoint, like an analog joystick, and its three buttons (under the spacebar) work the same as on the mouse.
To the left of the trackpoint keys is a fingerprint scanner. That makes it possible to login by fingerprint. Its very convenient in most cases.
The space bar has an NFC antenna location mark. You can simply read data from devices equipped with NFC, and you can make it to lock the system while not in use. For example, if you wear an NFC-equipped ring, it looks like this: when you remove hands from the keyboard, the computer locks after a certain time, and unlocks when you put hands on the keyboard again.
And now the unexpected part. The keyboard and the trackpoint can work as a USB keyboard and mouse for an external computer! For this, there are USB Type C and MicroUSB connectors on the back, labeled «OTG». You can connect to an external computer using a standard USB cable from a phone (which is usually always with you).
![](https://habrastorage.org/webt/e2/wa/m5/e2wam5d1bbckfdxpvqwl-i6aqle.jpeg)
Fig.2.2 — On the right: the power connector 5.5x2.5mm, the main LAN connector, POE indicator, USB 3.0 Type A, USB Type C (with alternate HDMI mode), microSD card reader and two «magic» buttons
Switching to the external keyboard mode is done with the «K» button on the right side of the adminbook. And there are actually three modes, since the keyboard+trackpoint combo can also work as a Bluetooth keyboard/mouse!
Moreover: to save energy, the keyboard and trackpoint can work autonomously from the rest of the adminbook. When the adminbook is turned off, pressing «K» can turn on only the keyboard and trackpoint to use them by connecting to another computer.
Of course, the keyboard is water-resistant. Excess water is drained down through the drainage holes.
### 3\. Video subsystem
There are some devices that normally do not need a monitor and keyboard. For example, industrial computers, servers or DVRs. And since the monitor is «not needed», it is, in most cases, absent.
And when there is a need to configure such a device from the console, it can be a big surprise that the entire office is working on laptops and there is not a single stationary monitor within reach. Therefore, in some cases you have to take a monitor with you.
But you dont need to worry about this if you have the adminbook.
The fact is that the video outputs of the adminbook can switch «in the opposite direction» and work as video inputs by displaying the incoming image on the built-in screen. So, the adminbook can also replace the monitor (in addition to replace the mouse and keyboard).
![](https://habrastorage.org/webt/4a/qr/f-/4aqrf-1sgstwwffhx-n4wr0p7ws.jpeg)
Fig.3.1 — On the left side of the adminbook, there are Mini DisplayPort, USB Type C (with alternate DisplayPort mode), SD card reader, USB 3.0 Type A connectors, HDMI, four audio connectors, VGA and power button
Switching modes between input and output is done by pressing the «M» button on the right side of the adminbook.
The video subsystem, as well as the keyboard, can work autonomously — that is, when used as a monitor, the other parts of the adminbook remain disabled. To turn on to this mode also uses the «M» button.
Detailed screen adjustment (contrast, geometry, video input selection, etc.) is performed using the menu, brought up with the «SCR» button (Fn + F4).
The adminbook has HDMI, MiniDP, VGA and USB Type C connectors (with DisplayPort and HDMI alternate mode) for video input / output. The integrated GPU can display the image simultaneously in three directions (including the integrated display).
The adminbook display is FullHD (1920x1080), 9.5, matte screen. The brightness is sufficient for working outside during the day. And to do it better, the set includes folding blinds for protection from sunlight.
![](https://habrastorage.org/webt/k-/nc/rh/k-ncrhphspvcoimfds1wurnzk3i.jpeg)
Fig.3.2 — Blinds to protect from sunlight
In addition to video output via these connectors, the adminbook can use wireless transmission via WiDi or Miracast protocols.
### 4\. Emulation of external drives
One of the options for installing the operating system is to install it from a CD / DVD, but now very few computers have optical drives. USB connectors are everywhere, though. Therefore, the adminbook can pretend to be an external optical drive connected via USB.
That allows connecting it to any computer to install an operating system on it, while also running boot discs with test programs or antiviruses.
To connect, it uses the same USB cable thats used for connecting it to a desktop as an external keyboard/mouse.
The “CD” button (Fn + F2) controls the drive emulation — select a disc image (in an .iso file) and mount / unmount it.
If you need to copy data from a computer or to it, the adminbook can emulate an external hard drive connected via the same USB cable. HDD emulation is also enabled by the “CD” button.
This button also turns on the emulation of bootable USB flash drives. They are now used to install operating systems almost more often than CDs. Therefore, the adminbook can pretend to be a bootable flash drive.
The .iso files are located on a separate partition of the hard disk. This allows you to use them regardless of the operating system. Moreover, in the emulation menu you can connect a virtual drive to one of the USB interfaces of the adminbook. This makes it possible to install an operating system on the adminbook using itself as an installation disc drive.
By the way, the adminbook is designed to work under Windows 10 and Debian / Kali / Ubuntu. The menu system called via function buttons with Fn works autonomously on a separate microcontroller.
### 5\. Rear connectors
First, a classic DB-9 connector for RS-232. Any admin notebook simply has to have it. We have it here, too, and galvanically isolated from the rest of the notebook.
In addition to RS-232, RS-485 widely used in industrial automation is supported. It has a two-wire and four-wire version, with a terminating resistor and without, with the ability to enable a protective offset. It can also work in RS-422 and UART modes.
All these protocols are configured in the on-screen menu, called by the «COM» button (Fn + F8).
Since there are multiple protocols, it is possible to accidentally connect the equipment to a wrong connector and break it.
To prevent this from happening, when you turn off the computer (or go into sleep mode, or close the display lid), the COM port switches to the default mode. This may be a “port disabled” state, or enabling one of the protocols.
![](https://habrastorage.org/webt/uz/ii/ig/uziiig_yr86yzdcnivkbapkbbgi.jpeg)
Fig.5.1 — The rear connectors: DB-9, SATA + SATA Power, HD Mini SAS, the second wired LAN connector, two USB 3.0 Type A connectors, two USB 2.0 MicroB connectors, three USB Type C connectors, a USIM card tray, a PBD-12 pin connector (jack)
The adminbook has one more serial port. But if the first one uses the hardware UART chipset, the second one is connected to the USB 2.0 line through the FT232H converter.
Thanks to this, via COM2, you can exchange data via I2C, SMBus, SPI, JTAG, UART protocols or use it as 8 outputs for Bit-bang / GPIO. These protocols are used when working with microcontrollers, flashing firmware on routers and debugging any other electronics. For this purpose, pin connectors are usually used with a 2.54mm pitch. Therefore, COM2 is made to look like one of these connectors.
![](https://habrastorage.org/webt/qd/rc/ln/qdrclnoljgnlohthok4hgjb0be4.jpeg)
Fig.5.2 — USB to UART adapter replaced by COM2 port
There is also a secondary LAN interface at the back. Like the main one, it is gigabit-capable, with support for VLAN. Both interfaces are able to test the integrity of the cable (for pair length and short circuits), the presence of connected devices, available communication speeds, the presence of POE voltage. With the using a wiremap adapter on the other side (see chapter 17) it is possible to determine how the cable is connected to crimps.
The network interface menu is called with the “LAN” button (Fn + F6).
The adminbook has a combined SATA + SATA Power connector, connected directly to the chipset. That makes it possible to perform low-level tests of hard drives that do not work through USB-SATA adapters. Previously, you had to do it through ExpressCards-type adapters, but the adminbook can do without them because it has a true SATA output.
![](https://habrastorage.org/webt/dr/si/in/drsiinbafiyz8ztzwrowtvi0lk8.jpeg)
Fig.5.3 — USB to SATA/IDE and ExpressCard to SATA adapters
The adminbook also has a connector that no other laptops have — HD Mini SAS (SFF-8643). PCIe x4 is routed outside through this connector. Thus, it's possible to connect an external U.2 (directly) or M.2 type (through an adapter) drives. Or even a typical desktop PCIe expansion card (like a graphics card).
![](https://habrastorage.org/webt/ud/ph/86/udph860bshazyd6lvuzvwgymwnk.jpeg)
Fig.5.4 — HD Mini SAS (SFF-8643) to U.2 cable
![](https://habrastorage.org/webt/kx/dd/99/kxdd99krcllm5ooz67l_egcttym.jpeg)
Fig.5.5 — U.2 drive
![](https://habrastorage.org/webt/xn/de/gx/xndegxy5i1g7h2lwefs2jt1scpq.jpeg)
Fig.5.6 — U.2 to M.2 adapter
![](https://habrastorage.org/webt/z2/dd/hd/z2ddhdoioezdwov_nv9e3b0egsa.jpeg)
Fig.5.7 — Combined adapter from U.2 to M.2 and PCIe (sample M.2 22110 drive is installed)
Unfortunately, the limitations of the chipset dont allow arbitrary use of PCIe lanes. In addition, the processor uses the same data lanes for PCIe and SATA. Therefore, the rear connectors can only work in two ways:
— all four PCIe lanes go to the Mini SAS connector (the second network interface and SATA dont work)
— two PCIe lanes go to the Mini SAS, and two lanes to the second network interface and SATA connector
On the back there are also two USB connectors (usual and Type C), which are constantly powered. That allows you to charge other devices from your notebook, even when the notebook is turned off.
### 6\. Power Supply
The adminbook is designed to work in difficult and unpredictable conditions, therefore, it is able to receive power in various ways.
**Method number one** is Power Delivery. The power supply cable can be connected to any USB Type C connector (except the one marked “OTG”).
**The second option** is from a normal 5V phone charger with a microUSB or USB Type C connector. At the same time, if you connect to the ports labeled QC 3.0, the QuickCharge fast charging standard will be supported.
**The third option** — from any source of 12-60V DC power. To connect, use a coaxial ( also known as “barrel”) 5.5x2.5mm power connector, often found in laptop power supplies.
For greater safety, the 12-60V power supply is galvanically isolated from the rest of the notebook. In addition, theres reverse polarity protection. In fact, the adminbook can receive energy even if positive and negative ends are mismatched.
![](https://habrastorage.org/webt/ju/xo/c3/juxoc3lxi7urqwgegyd6ida5h_8.jpeg)
Fig.6.1 — The cable, connecting the power supply to the adminbook (terminated with 5.5x2.5mm connectors)
Adapters for a car cigarette lighter and crocodile clips are included in the box.
![](https://habrastorage.org/webt/l6/-v/gv/l6-vgvqjrssirnvyi14czhi0mrc.jpeg)
Fig.6.2 — Adapter from 5.5x2.5mm coaxial connector to crocodile clips
![](https://habrastorage.org/webt/zw/an/gs/zwangsvfdvoievatpbfxqvxrszg.png)
Fig.6.3 — Adapter to a car cigarette lighter
**The fourth option** — Power Over Ethernet (POE) through the main network adapter. Supported options are 802.3af, 802.3at and Passive POE. Input voltage from 12 to 60V. This method is convenient if you have to work on the roof or on the tower, setting up Wi-Fi antennas. Power to them comes through Ethernet cables, and there is no other electricity on the tower.
POE electricity can be used in three ways:
* power the notebook only
* forward to a second network adapter and power the notebook from batteries
* power the notebook and the antenna at the same time
To prevent equipment damage, if one of the Ethernet cables is disconnected, the power to the second network interface is terminated. The power can only be turned on manually through the corresponding menu item.
When using the 802.3af / at protocols, you can set the power class that the adminbook will request from the power supply device. This and other POE properties are configured from the menu called with the “LAN” button (Fn + F6).
By the way, you can remotely reset Ubiquity access points (which is done by closing certain wires in the cable) with the second network interface.
The indicator next to the main network interface shows the presence and type of POE: green — 802.3af / at, red — Passive POE.
**The last, fifth** power supply is the battery. Here its a LiPol, 42W/hour battery.
In case the external power supply does not provide sufficient power, the missing power can be drawn from the battery. Thus, it can draw power from the battery and external sources at the same time.
### 7\. Display unit
The display can tilt 180 degrees, and its locked with latches while closed (opens with a button on the front side). When the display is closed, adminbook doesnt react to pressing any external buttons.
In addition to the screen, the notebook lid contains:
* front and rear cameras with lights, microphones, activity LEDs and mechanical curtains
* LED of the upper backlight of the keyboard (similar to ThinkLight)
* LED indicators for Wi-Fi, Bluetooth, HDD and others
* wireless protocol antennas (in the blue plastic insert)
* photo sensors and LEDs for the infrared remote
* gyroscope, accelerometer, magnetometer
The plastic insert for the antennas does not reach the corners of the display lid. This is done because in the «traveling» notebooks the corners are most affected by impacts, and it's desirable that they be made of metal.
### 8\. Webcams
The notebook has 2 webcams. The front-facing one is 8MP (4K / UltraHD), while the “selfie” one is 2MP (FullHD). Both cameras have a backlight controlled by separate buttons (Fn + G and Fn + H). Each camera has a mechanical curtain and an activity LED. The shifted mechanical curtain also turns off the microphones of the corresponding side (configurable).
The external camera has two quick launch buttons — Fn + 1 takes an instant photo, Fn + 2 turns on video recording. The internal camera has a combination of Fn + Q and Fn + W.
You can configure cameras and microphones from the menu called up by the “CAM” button (Fn + F10).
### 9\. Indicator row
It has the following indicators: Microphone, NumLock, ScrollLock, hard drive access, battery charge, external power connection, sleep mode, mobile connection, WiFi, Bluetooth.
Three indicators are made to shine through the back side of the display lid, so that they can be seen while the lid is closed: external power connection, battery charge, sleep mode.
Indicators are color-coded.
Microphone — lights up red when all microphones are muted
Battery charge: more than 60% is green, 30-60% is yellow, less than 30% is red, less than 10% is blinking red.
External power: green — power is supplied, the battery is charged; yellow — power is supplied, the battery is charging; red — there is not enough external power to operate, the battery is drained
Mobile: 4G (LTE) — green, 3G — yellow, EDGE / GPRS — red, blinking red — on, but no connection
Wi-Fi: green — connected to 5 GHz, yellow — to 2.4 GHz, red — on, but not connected
You can configure the indication with the “IND” button (Fn + F9)
### 10\. Infrared remote control
Near the indicators (on the front and back of the display lid) there are infrared photo sensors and LEDs to recording and playback commands from IR remotes. You can set it up, as well as emulate a remote control by pressing the “IR” button (Fn + F5).
### 11\. Wireless interfaces
WiFi — dual-band, 802.11a/b/g/n/ac with support for Wireless Direct, Intel WI-Di / Miracast, Wake On Wireless LAN.
You ask, why is Miracast here? Because is already embedded in many WiFi chips, so its presence does not lead to additional costs. But you can transfer the image wirelessly to TVs, projectors and TV set-top boxes, that already have Miracast built in.
Regarding Bluetooth, theres nothing special. Its version 4.2 or newest. By the way, the keyboard and trackpoint have a separate Bluetooth module. This is much easier than connect them to the system-wide module.
Of course, the adminbook has a built-in cellular modem for 4G (LTE) / 3G / EDGE / GPRS, as well as a GPS / GLONASS / Galileo / Beidou receiver. This receiver also doesnt cost much, because its already built into the 4G modem.
There is also an NFC communication module, with the antenna under the spacebar. Antennas of all other wireless interfaces are in a plastic insert above the display.
You can configure wireless interfaces with the «WRLS» button (Fn + F7).
### 12\. USB connectors
In total, four USB 3.0 Type A connectors and four USB 3.1 Type C connectors are built into the adminbook. Peripherals are connected to the adminbook through these.
One more Type C and MicroUSB are allocated only for keyboard / mouse / drive emulation (denoted as “OTG”).
«QC 3.0» labeled MicroUSB connector can not only be used for power, but it can switch to normal USB 2.0 port mode, except using MicroB instead of normal Type A. Why is it necessary? Because to flash some electronics you sometimes need non-standard USB A to USB A cables.
In order to not make adapters outselves, you can use a regular phone charging cable by plugging it into this Micro B connector. Or use an USB A to USB Type C cable (if you have one).
![](https://habrastorage.org/webt/0p/90/7e/0p907ezbunekqwobeogjgs5fgsa.jpeg)
Fig.12.1 — Homemade USB A to USB A cable
Since USB Type C supports alternate modes, it makes sense to use it. Alternate modes are when the connector works as HDMI or DisplayPort video outputs. Though youll need adapters to connect it to a TV or monitor. Or appropriate cables that have Type C on one end and HDMI / DP on the other. However, USB Type C to USB Type C cables might soon become the most common video transfer cable.
The Type C connector on the left side of the adminbook supports an alternate Display Port mode, and on the right side, HDMI. Like the other video outputs of the adminbook, they can work as both input and output.
The one thing left to say is that Type C is bidirectional in regard to power delivery — it can both take in power as well as output it.
### 13\. Other
On the left side there are four audio connectors: Line In, Line Out, Microphone and the combo headset jack (headphones + microphone). Supports simple stereo, quad and 5.1 mode output.
Audio outputs are specially placed next to the video connectors, so that when connected to any equipment, the wires are on one side.
Built-in speakers are on the sides. Outside, they are covered with grills and acoustic fabric with water-repellent impregnation.
There are also two slots for memory cards — full-size SD and MicroSD. If you think that the first slot is needed only for copying photos from the camera — you are mistaken. Now, both single-board computers like Raspberry Pi and even rack-mount servers are loaded from SD cards. MicroSD cards are also commonly found outside of phones. In general, you need both card slots.
Sensors more familiar to phones — a gyroscope, an accelerometer and a magnetometer — are built into the lid of the notebook. Thanks to this, one can determine where the notebook cameras are directed and use this for augmented reality, as well as navigation. Sensors are controlled via the menu using the “SNSR” button (Fn + F11).
Among the function buttons with Fn, F1 (“MAN”) and F12 (“ETC”) I havent described yet. The first is a built-in guide on connectors, modes and how to use the adminbook. The second is the settings of non-standard subsystems that have not separate buttons.
### 14\. What's inside
The adminbook is based on the Core i5-7Y57 CPU (Kaby Lake architecture). Although its less of a CPU, but more of a real SOC (System On a Chip). That is, almost the entire computer (without peripherals) fits in one chip the size of a thumb nail (2x1.6 cm).
It emits from 3.5W to 7W of heat (depends on the frequency). So, a passive cooling system is adequate in this case.
8GB of RAM are installed by default, expandable up to 16GB.
A 256GB M.2 2280 SSD, connected with two PCIe lanes, is used as the hard drive.
Wi-Fi + Bluetooth and WWAN + GNSS adapters are also designed as M.2 modules.
RAM, the hard drive and wireless adapters are located on the top of the motherboard and can be replaced by the user — just unscrew and lift the keyboard.
The battery is assembled from four LP545590 cells and can also be replaced.
SOC and other irreplaceable hardware are located on the bottom of the motherboard. The heating components for cooling are pressed directly against the case.
External connectors are located on daughter boards connected to the motherboard via ribbon cables. That allows to release different versions of the adminbook based on the same motherboard.
For example, one of the possible version:
![](https://habrastorage.org/webt/j9/sw/vq/j9swvqfi1-ituc4u9nr6-ijv3nq.jpeg)
Fig.14.1 — Adminbook A4 (front view)
![](https://habrastorage.org/webt/pw/fq/ag/pwfqagvrluf1dbnmcd0rt-0eyc0.jpeg)
Fig.14.2 — Adminbook A4 (back view)
![](https://habrastorage.org/webt/mn/ir/8i/mnir8in1pssve0m2tymevz2sue4.jpeg)
Fig.14.3 — Adminbook A4 (keyboard)
This is an adminbook with a 12.5” display, its overall dimensions are 210x297mm (A4 paper format). The keyboard is full-size, with a standard key size (only the top row is a bit narrower). All the standard keys are there, except for the numpad and the Right Win, available with Fn keys. And trackpad added.
### 15\. The underside of the adminbook
Not expecting anything interesting from the bottom? But there is!
First I will say a few words about the rubber feet. On my ThinkPad, they sometimes fall away and lost. I don't know if it's a bad glue, or a backpack is not suitable for a notebook, but it happens.
Therefore, in the adminbook, the rubber feet are screwed in (the screws are slightly buried in rubber, so as not to scratch the tables). The feet are sufficiently streamlined so that they cling less to other objects.
On the bottom there are visible drainage holes marked with a water drop.
And the four threaded holes for connecting the adminbook with fasteners.
![](https://habrastorage.org/webt/3d/q9/ku/3dq9kus6t7ql3rh5mbpfo3_xqng.jpeg)
Fig.15.1 — The underside of the adminbook
Large hole in the center has a tripod thread.
![](https://habrastorage.org/webt/t5/e5/ps/t5e5ps3iasu2j-22uc2rgl_5x_y.jpeg)
Fig.15.2 — Camera clamp mount
Why is it necessary? Because sometimes you have to hang on high, holding the mast with one hand, holding the notebook with the second, and typing something on the third… Unfortunately, I am not Shiva, so these tricks are not easy for me. And you can just screw the adminbook by a camera mount to any protruding part of the structure and free your hands!
No protruding parts? No problem. A plate with neodymium magnets is screwed to three other holes and the adminbook is magnetised to any steel surface — even vertical! As you see, opening the display by 180° is pretty useful.
![](https://habrastorage.org/webt/ua/28/ub/ua28ubhpyrmountubiqjegiibem.jpeg)
Fig.15.3 — Fastening with magnets and shaped holes for nails / screws
And if there is no metal? For example, working on the roof, and next to only a wooden wall. Then you can screw 1-2 screws in the wall and hang the adminbook on them. To do this, there are special slots in the mount, plus an eyelet on the handle.
For especially difficult cases, theres an arm mount. This is not very convenient, but better than nothing. Besides, it allows you to navigate even with a working notebook.
![](https://habrastorage.org/webt/tp/fo/0y/tpfo0y_8gku4bmlbeqwfux1j4me.jpeg)
Fig.15.4 — Arm mount
In general, these three holes use a regular metric thread, specifically so that you can make some DIY fastening and fasten it with ordinary screws.
Except fasteners, an additional radiator can be screwed to these holes, so that you can work for a long time under high load or at high ambient temperature.
![](https://habrastorage.org/webt/k4/jo/eq/k4joeqhmaxgvzhnxno6z3alg5go.jpeg)
Fig.15.5 — Adminbook with additional radiator
### 16\. Accessories
The adminbook has some unique features, and some of them are implemented using equipment designed specifically for the adminbook. Therefore, these accessories are immediately included. However, non-unique accessories are also available immediately.
Here is a complete list of both:
* fasteners with magnets
* arm mount
* heatsink
* screen blinds covering it from sunlight
* HD Mini SAS to U.2 cable
* combined adapter from U.2 to M.2 and PCIe
* power cable, terminated by coaxial 5.5x2.5mm connectors
* adapter from power cable to cigarette lighter
* adapter from power cable to crocodile clips
* different adapters from the power cable to coaxial connectors
* universal power supply and power cord from it into the outlet
### 17\. Power supply
Since this is a power supply for a system administrator's notebook, it would be nice to make it universal, capable of powering various electronic devices. Fortunately, the vast majority of devices are connected via coaxial connectors or USB. I mean devices with external power supplies: routers, switches, notebooks, nettops, single-board computers, DVRs, IPTV set top boxes, satellite tuners and more.
![](https://habrastorage.org/webt/jv/zs/ve/jvzsveqavvi2ihuoajjnsr1xlp0.jpeg)
Fig.17.1 — Adapters from 5.5x2.5mm coaxial connector to other types of connectors
There arent many connector types, which allows to get by with an adjustable-voltage PSU and adapters for the necessary connectors. It also needs to support various power delivery standards.
In our case, the power supply supports the following modes:
* Power Delivery — displayed as **[pd]**
* Quick Charge **[qc]**
* 802.3af/at **[at]**
* voltage from 5 to 54 volts in 0.5V increments (displayed voltage)
![](https://habrastorage.org/webt/fj/jm/qv/fjjmqvdhezywuyh9ew3umy9wgmg.jpeg)
Fig.17.2 — Mode display on the 7-segment indicator (1.9. = 19.5V)
![](https://habrastorage.org/webt/h9/zg/u0/h9zgu0ngl01rvhgivlw7fb49gpq.jpeg)
Fig.17.3 — Front and top sides of power supply
USB outputs on the power supply (5V 2A) are always on. On the other outputs the voltage is applied by pressing the ON/OFF button.
The desired mode is selected with the MODE button and this selection is remembered even when the power is turned off. The modes are listed like this: pd, qc, at, then a series of voltages.
Voltage increases by pressing and holding the MODE button, decreases by short pressing. Step to the right — 1 Volt, step to the left — 0.5 Volt. Half a volt is needed because some equipment requires, for example, 19.5 volts. These half volts are displayed on the display with decimal points (19V -> **[19]** , 19.5V -> **[1.9.]** ).
When power is on, the green LED is on. When a short-circuit or overcurrent protection is triggered, **[SH]** is displayed, and the LED lights up red.
In the Power Delivery and Quick Charge modes, voltage is applied to the USB outputs (Type A and Type C). Only one of them can be used at one time.
In 802.3af/at modes, the power supply acts as an injector, combining the supply voltage with data from the LAN connector and supplying it to the POE connector. Power is supplied only if a device with 802.3af or 802.3at support is plugged into the POE connector.
But in the simple voltage supply mode, electricity throu the POE connector is issued immediately, without any checks. This is the so-called Passive POE — positive charge goes to conductors 4 and 5, and negative charge to conductors 7 and 8. At the same time, the voltage is applied to the coaxial connector. Adapters for various types of connectors are used in this mode.
The power supply unit has a built-in button to remotely reset Ubiquity access points. This is a very useful feature that allows you to reset the antenna to factory settings without having to climb on the mast. I dont know — is any other manufacturers support a feature like this?
The power supply also has the passive wiremap adapter, which allows you to determine the correct Ethernet cable crimping. The active part is located in the Ethernet ports of the adminbook.
![](https://habrastorage.org/webt/pp/bm/ws/ppbmws4g1o5j05eyqqulnwuuwge.jpeg)
Fig.17.4 — Back side and wiremap adapter
Of course, the network cable tester built into the adminbook will not replace a professional OTDR, but for most tasks it will be enough.
To prevent overheating, part of the PSUs body acts as an aluminum heatsink. Power supply power — 65 watts, size 10x5x4cm.
### 18\. Afterword
“It wont fit into such a small case!” — the sceptics will probably say. To be frank, I also sometimes think that way when re-reading what I wrote above.
And then I open the 3D model and see, that all parts fits. Of course, I am not an electronic engineer, and for sure I miss some important things. But, I hope that if there are mistakes, they are “overcorrections”. That is, real engineers would fit all of that into a case even smaller.
By and large, the adminbook can be divided into 5 functional parts:
* the usual part, as in all notebooks — processor, memory, hard drive, etc.
* keyboard and trackpoint that can work separately
* autonomous video subsystem
* subsystem for managing non-standard features (enable / disable POE, infrared remote control, PCIe mode switching, LAN testing, etc.)
* power subsystem
If we consider them separately, then everything looks quite feasible.
The **SOC Kaby Lake** contains a CPU, a graphics accelerator, a memory controller, PCIe, SATA controller, USB controller for 6 USB3 and 10 USB2 outputs, Gigabit Ethernet controller, 4 lanes to connect webcams, integrated audio and etc.
All that remains is to trace the lanes to connectors and supply power to it.
**Keyboard and trackpoint** is a separate module that connects via USB to the adminbook or to an external connector. Nothing complicated here: USB and Bluetooth keyboards are very widespread. In our case, in addition, needs to make a rewritable table of scan codes and transfer non-standard keys over a separate interface other than USB.
**The video subsystem** receives the video signal from the adminbook or from external connectors. In fact, this is a regular monitor with a video switchboard plus a couple of VGA converters.
**Non-standard features** are managed independently of the operating system. The easiest way to do it with via a separate microcontroller which receives codes for pressing non-standard keys (those that are pressed with Fn) and performs the corresponding actions.
Since you have to display a menu to change the settings, the microcontroller has a video output, connected to the adminbook for the duration of the setup.
**The internal PSU** is galvanically isolated from the rest of the system. Why not? On habr.com there was an article about making a 100W, 9.6mm thickness planar transformer! And it only costs $0.5.
So the electronic part of the adminbook is quite feasible. There is the programming part, and I dont know which part will harder.
This concludes my fairly long article. It long, even though I simplified, shortened and threw out minor details.
The ideal end of the article was a link to an online store where you can buy an adminbook. But it's not yet designed and released. Since this requires money.
Unfortunately, I have no experience with Kickstarter or Indigogo. Maybe you have this experience? Let's do it together!
### Update
Many people asked for a simplified version. Ok. Done. Sorry — just a 3d model, without render.
Deleted: second LAN adapter, micro SD card reader, one USB port Type C, second camera, camera lights and camera curtines, display latch, unnecessary audio connectors.
Also in this version there will be no infrared remote control, a reprogrammable keyboard, QC 3.0 charging standard, and getting power by POE.
![](https://habrastorage.org/webt/3l/lg/vm/3llgvmv4pebiruzgldqckab0uyc.jpeg)
![](https://habrastorage.org/webt/sp/x6/rv/spx6rvmn6zlumbwg46xwfmjnako.jpeg)
![](https://habrastorage.org/webt/sm/g0/xz/smg0xzdspfm3vr3gep__6bcqae8.jpeg)
--------------------------------------------------------------------------------
via: https://habr.com/en/post/437912/
作者:[sukhe][a]
选题:[lujun9972][b]
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://habr.com/en/users/sukhe/
[b]: https://github.com/lujun9972
[1]: https://habrastorage.org/webt/_1/mp/vl/_1mpvlyujldpnad0cvvzvbci50y.jpeg
[2]: https://habrastorage.org/webt/mr/m6/d3/mrm6d3szvghhpghfchsl_-lzgb4.jpeg

View File

@@ -1,60 +0,0 @@
[#]: collector: (lujun9972)
[#]: translator: ( )
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (Get started with Budgie Desktop, a Linux environment)
[#]: via: (https://opensource.com/article/19/1/productivity-tool-budgie-desktop)
[#]: author: (Kevin Sonney https://opensource.com/users/ksonney (Kevin Sonney))
Get started with Budgie Desktop, a Linux environment
======
Configure your desktop as you want with Budgie, the 18th in our series on open source tools that will make you more productive in 2019.
![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/data_metrics_analytics_desktop_laptop.png?itok=9QXd7AUr)
There seems to be a mad rush at the beginning of every year to find ways to be more productive. New Year's resolutions, the itch to start the year off right, and of course, an "out with the old, in with the new" attitude all contribute to this. And the usual round of recommendations is heavily biased towards closed source and proprietary software. It doesn't have to be that way.
Here's the 18th of my picks for 19 new (or new-to-you) open source tools to help you be more productive in 2019.
### Budgie Desktop
There are many, many desktop environments for Linux. From the easy to use and graphically stunning [GNOME desktop][1] (default on most major Linux distributions) and [KDE][2], to the minimalist [Openbox][3], to the highly configurable tiling [i3][4], there are a lot of options. What I look for in a good desktop environment is speed, unobtrusiveness, and a clean user experience. It is hard to be productive when a desktop works against you, not with or for you.
![](https://opensource.com/sites/default/files/uploads/budgie-1.png)
[Budgie Desktop][5] is the default desktop on the [Solus][6] Linux distribution and is available as an add-on package for most of the major Linux distributions. It is based on GNOME and uses many of the same tools and libraries you likely already have on your computer.
The default desktop is exceptionally minimalistic, with just the panel and a blank desktop. Budgie includes an integrated sidebar (called Raven) that gives quick access to the calendar, audio controls, and settings menu. Raven also contains an integrated notification area with a unified display of system messages similar to MacOS's.
![](https://opensource.com/sites/default/files/uploads/budgie-2.png)
Clicking on the gear icon in Raven brings up Budgie's control panel with its configuration settings. Since Budgie is still in development, it is a little bare-bones compared to GNOME or KDE, and I hope it gets more options over time. The Top Panel option, which allows the user to configure the ordering, positioning, and contents of the top panel, is nice.
![](https://opensource.com/sites/default/files/uploads/budgie-3.png)
The Budgie Welcome application (presented at first login) contains options to install additional software, panel applets, snaps, and Flatpack packages. There are applets to handle networking, screenshots, additional clocks and timers, and much, much more.
![](https://opensource.com/sites/default/files/uploads/budgie-4.png)
Budgie provides a desktop that is clean and stable. It responds quickly and has many options that allow you to customize it as you see fit.
--------------------------------------------------------------------------------
via: https://opensource.com/article/19/1/productivity-tool-budgie-desktop
作者:[Kevin Sonney][a]
选题:[lujun9972][b]
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://opensource.com/users/ksonney (Kevin Sonney)
[b]: https://github.com/lujun9972
[1]: https://www.gnome.org/
[2]: https://www.kde.org/
[3]: http://openbox.org/wiki/Main_Page
[4]: https://i3wm.org/
[5]: https://getsol.us/solus/experiences/
[6]: https://getsol.us/home/

View File

@@ -0,0 +1,102 @@
[#]: collector: (lujun9972)
[#]: translator: ( )
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (Olive is a new Open Source Video Editor Aiming to Take On Biggies Like Final Cut Pro)
[#]: via: (https://itsfoss.com/olive-video-editor)
[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/)
Olive is a new Open Source Video Editor Aiming to Take On Biggies Like Final Cut Pro
======
[Olive][1] is a new open source video editor under development. This non-linear video editor aims to provide a free alternative to high-end professional video editing software. Too high an aim? I think so.
If you have read our [list of best video editors for Linux][2], you might have noticed that most of the professional-grade video editors such as [Lightworks][3] or DaVinciResolve are neither free nor open source.
[Kdenlive][4] and Shotcut are there but they dont often meet the standards of professional video editing (thats what many Linux users have expressed).
This gap between the hobbyist and professional video editors prompted the developer(s) of Olive to start this project.
![Olive Video Editor][5]Olive Video Editor Interface
There is a detailed [review of Olive on Libre Graphics World][6]. Actually, this is where I came to know about Olive first. You should read the article if you are interested in knowing more about it.
### Installing Olive Video Editor in Linux
Let me remind you. Olive is in the early stages of development. Youll find plenty of bugs and missing/incomplete features. You should not treat it as your main video editor just yet.
If you want to test Olive, there are several ways to install it on Linux.
#### Install Olive in Ubuntu-based distributions via PPA
You can install Olive via its official PPA in Ubuntu, Mint and other Ubuntu-based distributions.
```
sudo add-apt-repository ppa:olive-editor/olive-editor
sudo apt-get update
sudo apt-get install olive-editor
```
#### Install Olive via Snap
If your Linux distribution supports Snap, you can use the command below to install it.
```
sudo snap install --edge olive-editor
```
#### Install Olive via Flatpak
If your [Linux distribution supports Flatpak][7], you can install Olive video editor via Flatpak.
#### Use Olive via AppImage
Dont want to install it? Download the [AppImage][8] file, set it as executable and run it.
Both 32-bit and 64-bit AppImage files are available. You should download the appropriate file.
Olive is also available for Windows and macOS. You can get it from their [download page][9].
### Want to support the development of Olive video editor?
If you like what Olive is trying to achieve and want to support it, here are a few ways you can do that.
If you are testing Olive and find some bugs, please report it on their GitHub repository.
If you are a programmer, go and check out the source code of Olive and see if you could help the project with your coding skills.
Contributing to projects financially is another way you can help the development of open source software. You can support Olive monetarily by becoming a patron.
If you dont have either the money or coding skills to support Olive, you could still help it. Share this article or Olives website on social media or in Linux/software related forums and groups you frequent. A little word of mouth should help it indirectly.
### What do you think of Olive?
Its too early to judge Olive. I hope that the development continues rapidly and we have a stable release of Olive by the end of the year (if I am not being overly optimistic).
What do you think of Olive? Do you agree with the developers aim of targeting the pro-users? What features would you like Olive to have?
--------------------------------------------------------------------------------
via: https://itsfoss.com/olive-video-editor
作者:[Abhishek Prakash][a]
选题:[lujun9972][b]
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://itsfoss.com/author/abhishek/
[b]: https://github.com/lujun9972
[1]: https://www.olivevideoeditor.org/
[2]: https://itsfoss.com/best-video-editing-software-linux/
[3]: https://www.lwks.com/
[4]: https://kdenlive.org/en/
[5]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/01/olive-video-editor-interface.jpg?resize=800%2C450&ssl=1
[6]: http://libregraphicsworld.org/blog/entry/introducing-olive-new-non-linear-video-editor
[7]: https://itsfoss.com/flatpak-guide/
[8]: https://itsfoss.com/use-appimage-linux/
[9]: https://www.olivevideoeditor.org/download.php
[10]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/01/olive-video-editor-interface.jpg?fit=800%2C450&ssl=1

View File

@@ -0,0 +1,106 @@
[#]: collector: (lujun9972)
[#]: translator: (HankChow)
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (Will quantum computing break security?)
[#]: via: (https://opensource.com/article/19/1/will-quantum-computing-break-security)
[#]: author: (Mike Bursell https://opensource.com/users/mikecamel)
Will quantum computing break security?
======
Do you want J. Random Hacker to be able to pretend they're your bank?
![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/security_privacy_lock.png?itok=ZWjrpFzx)
Over the past few years, a new type of computer has arrived on the block: the quantum computer. It's arguably the sixth type of computer:
1. **Humans:** Before there were artificial computers, people used, well, people. And people with this job were called "computers."
2. **Mechanical analogue:** These are devices such as the [Antikythera mechanism][1], astrolabes, or slide rules.
3. **Mechanical digital:** In this category, I'd count anything that allowed discrete mathematics but didn't use electronics for the actual calculation: the abacus, Babbage's Difference Engine, etc.
4. **Electronic analogue:** Many of these were invented for military uses such as bomb sights, gun aiming, etc.
5. **Electronic digital:** I'm going to go out on a limb here and characterise Colossus as the first electronic digital computer1: these are basically what we use today for anything from mobile phones to supercomputers.
6. **Quantum computers:** These are coming and are fundamentally different from all of the previous generations.
### What is quantum computing?
Quantum computing uses concepts from quantum mechanics to allow very different types of calculations from what we're used to in "classical computing." I'm not even going to try to explain, because I know I'd do a terrible job, so I suggest you try something like [Wikipedia's definition][2] as a starting point. What's important for our purposes is to understand that quantum computers use qubits to do calculations, and for quite a few types of mathematical algorithms—and therefore computing operationsthey can solve problems much faster than classical computers.
What's "much faster"? Much, much faster: orders of magnitude faster. A calculation that might take years or decades with a classical computer could, in certain circumstances, take seconds. Impressive, yes? And scary. Because one of the types of problems that quantum computers should be good at solving is decrypting encrypted messages, even without the keys.
This means that someone with a sufficiently powerful quantum computer should be able to read all of your current and past messages, decrypt any stored data, and maybe fake digital signatures. Is this a big thing? Yes. Do you want J. Random Hacker to be able to pretend they're your bank?2 Do you want that transaction on the blockchain where you were sold a 10 bedroom mansion in Mayfair to be "corrected" to be a bedsit in Weston-super-Mare?3
### Some good news
This is all scary stuff, but there's good news of various types.
The first is that, in order to make any of this work at all, you need a quantum computer with a good number of qubits operating, and this is turning out to be hard.4 The general consensus is that we've got a few years before anybody has a "big" enough quantum computer to do serious damage to classical encryption algorithms.
The second is that, even with a sufficient number of qubits to attacks our existing algorithms, you still need even more to allow for error correction.
The third is that, although there are theoretical models to show how to attack some of our existing algorithms, actually making them work is significantly harder than you or I5 might expect. In fact, some of the attacks may turn out to be infeasible or just take more years to perfect than we worry about.
The fourth is that there are clever people out there who are designing quantum-computation-resistant algorithms (sometimes referred to as "post-quantum algorithms") that we can use, at least for new encryption, once they've been tested and become widely available.
All in all, in fact, there's a strong body of expert opinion that says we shouldn't be overly worried about quantum computing breaking our encryption in the next five or even 10 years.
### And some bad news
It's not all rosy, however. Two issues stick out to me as areas of concern.
1. People are still designing and rolling out systems that don't consider the issue. If you're coming up with a system that is likely to be in use for 10 or more years or will be encrypting or signing data that must remain confidential or attributable over those sorts of periods, then you should be considering the possible impact of quantum computing on your system.
2. Some of the new, quantum-computing-resistant algorithms are proprietary. This means that when you and I want to start implementing systems that are designed to be quantum-computing resistant, we'll have to pay to do so. I'm a big proponent of open source, and particularly of [open source cryptography][3], and my big worry is that we just won't be able to open source these things, and worse, that when new protocol standards are createdeither de-facto or through standards bodiesthey will choose proprietary algorithms that exclude the use of open source, whether on purpose, through ignorance, or because few good alternatives are available.
### What to do?
Luckily, there are things you can do to address both of the issues above. The first is to think and plan when designing a system about what the impact of quantum computing might be on it. Often—very often—you won't need to implement anything explicit now (and it could be hard to, given the current state of the art), but you should at least embrace [the concept of crypto-agility][4]: designing protocols and systems so you can swap out algorithms if required.7
The second is a call to arms: Get involved in the open source movement and encourage everybody you know who has anything to do with cryptography to rally for open standards and for research into non-proprietary, quantum-computing-resistant algorithms. This is something that's very much on my to-do list, and an area where pressure and lobbying is just as important as the research itself.
1\. I think it's fair to call it the first electronic, programmable computer. I know there were earlier non-programmable ones, and that some claim ENIAC, but I don't have the space or the energy to argue the case here.
2\. No.
3\. See 2. Don't get me wrong, by the way—I grew up near Weston-super-Mare, and it's got things going for it, but it's not Mayfair.
4\. And if a quantum physicist says something's hard, then to my mind, it's hard.
5\. And I'm assuming that neither of us is a quantum physicist or mathematician.6
6\. I'm definitely not.
7\. And not just for quantum-computing reasons: There's a good chance that some of our existing classical algorithms may just fall to other, non-quantum attacks such as new mathematical approaches.
This article was originally published on [Alice, Eve, and Bob][5] and is reprinted with the author's permission.
--------------------------------------------------------------------------------
via: https://opensource.com/article/19/1/will-quantum-computing-break-security
作者:[Mike Bursell][a]
选题:[lujun9972][b]
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://opensource.com/users/mikecamel
[b]: https://github.com/lujun9972
[1]: https://en.wikipedia.org/wiki/Antikythera_mechanism
[2]: https://en.wikipedia.org/wiki/Quantum_computing
[3]: https://opensource.com/article/17/10/many-eyes
[4]: https://aliceevebob.com/2017/04/04/disbelieving-the-many-eyes-hypothesis/
[5]: https://aliceevebob.com/2019/01/08/will-quantum-computing-break-security/

View File

@@ -0,0 +1,121 @@
[#]: collector: (lujun9972)
[#]: translator: ( )
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (Top 5 Linux Distributions for New Users)
[#]: via: (https://www.linux.com/blog/learn/2019/2/top-5-linux-distributions-new-users)
[#]: author: (Jack Wallen https://www.linux.com/users/jlwallen)
Top 5 Linux Distributions for New Users
======
![](https://www.linux.com/sites/lcom/files/styles/rendered_file/public/deepin-main.jpg?itok=ASgr0mOP)
Linux has come a long way from its original offering. But, no matter how often you hear how easy Linux is now, there are still skeptics. To back up this claim, the desktop must be simple enough for those unfamiliar with Linux to be able to make use of it. And, the truth is that plenty of desktop distributions make this a reality.
### No Linux knowledge required
It might be simple to misconstrue this as yet another “best user-friendly Linux distributions” list. That is not what were looking at here. Whats the difference? For my purposes, the defining line is whether or not Linux actually plays into the usage. In other words, could you set a user in front of a desktop operating system and have them be instantly at home with its usage? No Linux knowledge required.
Believe it or not, some distributions do just that. I have five Id like to present to you here. Youve probably heard of all of them. They might not be your distribution of choice, but you can guarantee that they slide Linux out of the spotlight and place the user front and center.
Lets take a look at the chosen few.
### Elementary OS
The very philosophy of Elementary OS is centered around how people actually use their desktops. The developers and designers have gone out of their way to create a desktop that is as simple as possible. In the process, theyve de-Linuxd Linux. That is not to say theyve removed Linux from the equation. No. Instead, what theyve done is create an operating system that is about as neutral as youll find. Elementary OS is streamlined in such a way as to make sure everything is perfectly logical. From the single Dock to the clear-to-anyone Applications menu, this is a desktop that doesnt say to the user, “Youre using Linux!” In fact, the layout itself is reminiscent of Mac, but with the addition of a simple app menu (Figure 1).
![Elementary OS Juno][2]
Figure 1: The Elementary OS Juno Application menu in action.
[Used with permission][3]
Another important aspect of Elementary OS that places it on this list is that its not nearly as flexible as some other desktop distributions. Sure, some users would balk at that, but having a desktop that doesnt throw every bell and whistle at the user makes for a very familiar environment -- one that neither requires or allows a lot of tinkering. That aspect of the OS goes a long way to make the platform familiar to new users.
And like any modern Linux desktop distribution, Elementary OS includes and App Store, called AppCenter, where users can install all the applications they need, without ever having to touch the command line.
### Deepin
Deepin not only gets my nod for one of the most beautiful desktops on the market, its also just as easy to adopt as any desktop operating system available. With a very simplistic take on the desktop interface, theres very little in the way of users with zero Linux experience getting up to speed on its usage. In fact, youd be hard-pressed to find a user who couldnt instantly start using the Deepin desktop. The only possible hitch in that works might be the sidebar control center (Figure 2).
![][5]
Figure 2: The Deepin sidebar control panel.
[Used with permission][3]
But even that sidebar control panel is as intuitive as any other configuration tool on the market. And anyone that has used a mobile device will be instantly at home with the layout. As for opening applications, Deepin takes a macOS Launchpad approach with the Launcher. This button is in the usual far right position on the desktop dock, so users will immediately gravitate to that, understanding that it is probably akin to the standard “Start” menu.
In similar fashion as Elementary OS (and most every Linux distribution on the market), Deepin includes an app store (simply called “Store”), where plenty of apps can be installed with ease.
### Ubuntu
You knew it was coming. Ubuntu is most often ranked at the top of most user-friendly Linux lists. Why? Because its one of the chosen few where a knowledge of Linux simply isnt necessary to get by on the desktop. Prior to the adoption of GNOME (and the ousting of Unity), that wouldnt have been the case. Why? Because Unity often needed a bit of tweaking to get it to the point where a tiny bit of Linux knowledge wasnt necessary (Figure 3). Now that Ubuntu has adopted GNOME, and tweaked it to the point where an understanding of GNOME isnt even necessary, this desktop makes Linux take a back seat to simplicity and usability.
![Ubuntu 18.04][7]
Figure 3: The Ubuntu 18.04 desktop is instantly familiar.
[Used with permission][3]
Unlike Elementary OS, Ubuntu doesnt hold the user back. So anyone who wants more from their desktop, can have it. However, the out of the box experience is enough for just about any user type. Anyone looking for a desktop that makes the user unaware as to just how much power they have at their fingertips, could certainly do worse than Ubuntu.
### Linux Mint
I will preface this by saying Ive never been the biggest fan of Linux Mint. Its not that I dont respect what the developers are doing, its more an aesthetic. I prefer modern-looking desktop environments. But that old school desktop metaphor (found in the default Cinnamon desktop) is perfectly familiar to nearly anyone who uses it. With a taskbar, start button, system tray, and desktop icons (Figure 4), Linux Mint offers an interface that requires zero learning curve. In fact, some users might be initially fooled into thinking they are working with a Windows 7 clone. Even the updates warning icon will look instantly familiar to users.
![Linux Mint ][9]
Figure 4: The Linux Mint Cinnamon desktop is very Windows 7-ish.
[Used with permission][3]
Because Linux Mint benefits from being based on Ubuntu, itll not only enjoy an immediate familiarity, but a high usability. No matter if you have even the slightest understanding of the underlying platform, users will feel instantly at home on Linux Mint.
### Ubuntu Budgie
Our list concludes with a distribution that also does a fantastic job of making the user forget they are using Linux, and makes working with the usual tools a simple, beautiful thing. Melding the Budgie Desktop with Ubuntu makes for an impressively easy to use distribution. And although the layout of the desktop (Figure 5) might not be the standard fare, there is no doubt the acclimation takes no time. In fact, outside of the Dock defaulting to the left side of the desktop, Ubuntu Budgie has a decidedly Elementary OS look to it.
![Budgie][11]
Figure 5: The Budgie desktop is as beautiful as it is simple.
[Used with permission][3]
The System Tray/Notification area in Ubuntu Budgie offers a few more features than the usual fare: Features such as quick access to Caffeine (a tool to keep your desktop awake), a Quick Notes tool (for taking simple notes), Night Lite switch, a Places drop-down menu (for quick access to folders), and of course the Raven applet/notification sidebar (which is similar to, but not quite as elegant as, the Control Center sidebar in Deepin). Budgie also includes an application menu (top left corner), which gives users access to all of their installed applications. Open an app and the icon will appear in the Dock. Right-click that app icon and select Keep in Dock for even quicker access.
Everything about Ubuntu Budgie is intuitive, so theres practically zero learning curve involved. It doesnt hurt that this distribution is as elegant as it is easy to use.
### Give One A Chance
And there you have it, five Linux distributions that, each in their own way, offer a desktop experience that any user would be instantly familiar with. Although none of these might be your choice for top distribution, its hard to argue their value when it comes to users who have no familiarity with Linux.
Learn more about Linux through the free ["Introduction to Linux" ][12]course from The Linux Foundation and edX.
--------------------------------------------------------------------------------
via: https://www.linux.com/blog/learn/2019/2/top-5-linux-distributions-new-users
作者:[Jack Wallen][a]
选题:[lujun9972][b]
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://www.linux.com/users/jlwallen
[b]: https://github.com/lujun9972
[1]: https://www.linux.com/files/images/elementaryosjpg-2
[2]: https://www.linux.com/sites/lcom/files/styles/rendered_file/public/elementaryos_0.jpg?itok=KxgNUvMW (Elementary OS Juno)
[3]: https://www.linux.com/licenses/category/used-permission
[4]: https://www.linux.com/files/images/deepinjpg
[5]: https://www.linux.com/sites/lcom/files/styles/rendered_file/public/deepin.jpg?itok=VV381a9f
[6]: https://www.linux.com/files/images/ubuntujpg-1
[7]: https://www.linux.com/sites/lcom/files/styles/rendered_file/public/ubuntu_1.jpg?itok=bax-_Tsg (Ubuntu 18.04)
[8]: https://www.linux.com/files/images/linuxmintjpg
[9]: https://www.linux.com/sites/lcom/files/styles/rendered_file/public/linuxmint.jpg?itok=8sPon0Cq (Linux Mint )
[10]: https://www.linux.com/files/images/budgiejpg-0
[11]: https://www.linux.com/sites/lcom/files/styles/rendered_file/public/budgie_0.jpg?itok=zcf-AHmj (Budgie)
[12]: https://training.linuxfoundation.org/linux-courses/system-administration-training/introduction-to-linux

View File

@@ -0,0 +1,77 @@
[#]: collector: (lujun9972)
[#]: translator: ( )
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (7 Best VPN Services For 2019)
[#]: via: (https://www.ostechnix.com/7-best-opensource-vpn-services-for-2019/)
[#]: author: (Editor https://www.ostechnix.com/author/editor/)
7 Best VPN Services For 2019
======
At least 67 percent of global businesses in the past three years have faced data breaching. The breaching has been reported to expose hundreds of millions of customers. Studies show that an estimated 93 percent of these breaches would have been avoided had data security fundamentals been considered beforehand.
Understand that poor data security can be extremely costly, especially to a business and could quickly lead to widespread disruption and possible harm to your brand reputation. Although some businesses can pick up the pieces the hard way, there are still those that fail to recover. Today however, you are fortunate to have access to data and network security software.
![](https://www.ostechnix.com/wp-content/uploads/2019/02/vpn-1.jpeg)
As you start 2019, keep off cyber-attacks by investing in a **V** irtual **P** rivate **N** etwork commonly known as **VPN**. When it comes to online privacy and security, there are many uncertainties. There are hundreds of different VPN providers, and picking the right one means striking just the right balance between pricing, services, and ease of use.
If you are looking for a solid 100 percent tested and secure VPN, you might want to do your due diligence and identify the best match. Here are the top 7 Best tried and tested VPN services For 2019.
### 1. Vpnunlimitedapp
With VPN Unlimited, you have total security. This VPN allows you to use any WIFI without worrying that your personal data can be leaked. With AES-256, your data is encrypted and protected against prying third-parties and hackers. This VPN ensures you stay anonymous and untracked on all websites no matter the location. It offers a 7-day trial and a variety of protocol options: OpenVPN, IKEv2, and KeepSolid Wise. Demanding users are entitled to special extras such as a personal server, lifetime VPN subscription, and personal IP options.
### 2. VPN Lite
VPN Lite is an easy-to-use and **free VPN service** that allows you to browse the internet at no charges. You remain anonymous and your privacy is protected. It obscures your IP and encrypts your data meaning third parties are not able to track your activities on all online platforms. You also get to access all online content. With VPN Lite, you get to access blocked sites in your state. You can also gain access to public WIFI without the worry of having sensitive information tracked and hacked by spyware and hackers.
### 3. HotSpot Shield
Launched in 2005, this is a popular VPN embraced by the majority of users. The VPN protocol here is integrated by at least 70 percent of the largest security companies globally. It is also known to have thousands of servers across the globe. It comes with two free options. One is completely free but supported by online advertisements, and the second one is a 7-day trial which is the flagship product. It contains military grade data encryption and protects against malware. HotSpot Shield guaranteed secure browsing and offers lightning-fast speeds.
### 4. TunnelBear
This is the best way to start if you are new to VPNs. It comes to you with a user-friendly interface complete with animated bears. With the help of TunnelBear, users are able to connect to servers in at least 22 countries at great speeds. It uses **AES 256-bit encryption** guaranteeing no data logging meaning your data stays protected. You also get unlimited data for up to five devices.
### 5. ProtonVPN
This VPN offers you a strong premium service. You may suffer from reduced connection speeds, but you also get to enjoy its unlimited data. It features an intuitive interface easy to use, and comes with a multi-platform compatibility. Protons servers are said to be specifically optimized for torrenting and thus cannot give access to Netflix. You get strong security features such as protocols and encryptions meaning your browsing activities remain secure.
### 6. ExpressVPN
This is known as the best offshore VPN for unblocking and privacy. It has gained recognition for being the top VPN service globally resulting from solid customer support and fast speeds. It offers routers that come with browser extensions and custom firmware. ExpressVPN also has an admirable scope of quality apps, plenty of servers, and can only support up to three devices.
Its not entirely free, and happens to be one of the most expensive VPNs on the market today because it is fully packed with the most advanced features. With it comes a 30-day money-back guarantee, meaning you can freely test this VPN for a month. Good thing is; it is completely risk-free. If you need a VPN for a short duration to bypass online censorship for instance, this could, be your go-to solution. You dont want to give trials to a spammy, slow, free program.
It is also one of the best ways to enjoy online streaming as well as outdoor security. Should you need to continue using it, you only have to renew or cancel your free trial if need be. Express VPN has over 2000 servers across 90 countries, unblocks Netflix, gives lightning fast connections, and gives users total privacy.
### 7. PureVPN
While this VPN may not be completely free, it falls under the most budget-friendly services on this list. Users can sign up for a free seven days trial and later choose one of its paid plans. With this VPN, you get to access 750-plus servers in at least 140 countries. There is also access to easy installation on almost all devices. All its paid features can still be accessed within the free trial window. That includes unlimited data transfers, IP leakage protection, and ISP invisibility. The supproted operating systems are iOS, Android, Windows, Linux, and macOS.
### Summary
With the large variety of available freemium VPN services today, why not take that opportunity to protect yourself and your customers? Understand that there are some great VPN services. Even the most secure free service however, cannot be touted as risk free. You might want to upgrade to a premium one for increased protection. Premium VPN allows you to test freely offering risk-free money-back guarantee. Whether you plan to sign up for a paid VPN or commit to a free one, it is highly advisable to have a VPN.
**About the author:**
**Renetta K. Molina** is a tech enthusiast and fitness enthusiast. She writes about technology, apps, WordPress and a variety of other topics. In her free time, she likes to play golf and read books. She loves to learn and try new things.
--------------------------------------------------------------------------------
via: https://www.ostechnix.com/7-best-opensource-vpn-services-for-2019/
作者:[Editor][a]
选题:[lujun9972][b]
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://www.ostechnix.com/author/editor/
[b]: https://github.com/lujun9972

View File

@@ -0,0 +1,125 @@
[#]: collector: (lujun9972)
[#]: translator: ( )
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (Top 5 open source network monitoring tools)
[#]: via: (https://opensource.com/article/19/2/network-monitoring-tools)
[#]: author: (Paul Bischoff https://opensource.com/users/paulbischoff)
Top 5 open source network monitoring tools
======
Keep an eye on your network to avoid downtime with these monitoring tools.
![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/mesh_networking_dots_connected.png?itok=ovINTRR3)
Maintaining a live network is one of a system administrator's most essential tasks, and keeping a watchful eye over connected systems is essential to keeping a network functioning at its best.
There are many different ways to keep tabs on a modern network. Network monitoring tools are designed for the specific purpose of monitoring network traffic and response times, while application performance management solutions use agents to pull performance data from the application stack. If you have a live network, you need network monitoring to make sure you aren't vulnerable to an attacker. Likewise, if you rely on lots of different applications to run your daily operations, you will need an [application performance management][1] solution as well.
This article will focus on open source network monitoring tools. These tools help monitor individual nodes and applications for signs of poor performance. Through one window, you can view the performance of an entire network and even get alerts to keep you in the loop if you're away from your desk.
Before we get into the top five network monitoring tools, let's look more closely at the reasons you need to use one.
### Why do I need a network monitoring tool?
Network monitoring tools are vital to maintaining networks because they allow you to keep an eye on devices connected to the network from a central location. These tools help flag devices with subpar performance so you can step in and run troubleshooting to get to the root of the problem.
Running in-depth troubleshooting can minimize performance problems and prevent security breaches. In practical terms, this keeps the network online and eliminates the risk of falling victim to unnecessary downtime. Regular network maintenance can also help prevent outages that could take thousands of users offline.
A network monitoring tool enables you to:
* Autodiscover devices connected to your network
* View live and historic performance data for a range of devices and applications
* Configure alerts to notify you of unusual activity
* Generate graphs and reports to analyze network activity in greater depth
### The top 5 open source network monitoring tools
Now, that you know why you need a network monitoring tool, take a look at the top 5 open source tools to see which might best meet your needs.
#### Cacti
![](https://opensource.com/sites/default/files/uploads/cacti_network-monitoring-tools.png)
If you know anything about open source network monitoring tools, you've probably heard of [Cacti][2]. It's a graphing solution that acts as an addition to [RRDTool][3] and is used by many network administrators to collect performance data in LANs. Cacti comes with Simple Network Management Protocol (SNMP) support on Windows and Linux to create graphs of traffic data.
Cacti typically works by using data sourced from user-created scripts that ping hosts on a network. The values returned by the scripts are stored in a MySQL database, and this data is used to generate graphs.
This sounds complicated, but Cacti has templates to help speed the process along. You can also create a graph or data source template that can be used for future monitoring activity. If you'd like to try it out, [download Cacti][4] for free on Linux and Windows.
#### Nagios Core
![](https://opensource.com/sites/default/files/uploads/nagioscore_network-monitoring-tools.png)
[Nagios Core][5] is one of the most well-known open source monitoring tools. It provides a network monitoring experience that combines open source extensibility with a top-of-the-line user interface. With Nagios Core, you can auto-discover devices, monitor connected systems, and generate sophisticated performance graphs.
Support for customization is one of the main reasons Nagios Core has become so popular. For example, [Nagios V-Shell][6] was added as a PHP web interface built in AngularJS, searchable tables and a RESTful API designed with CodeIgniter.
If you need more versatility, you can check the Nagios Exchange, which features a range of add-ons that can incorporate additional features into your network monitoring. These range from the strictly cosmetic to monitoring enhancements like [nagiosgraph][7]. You can try it out by [downloading Nagios Core][8] for free.
#### Icinga 2
![](https://opensource.com/sites/default/files/uploads/icinga2_network-monitoring-tools.png)
[Icinga 2][9] is another widely used open source network monitoring tool. It builds on the groundwork laid by Nagios Core. It has a flexible RESTful API that allows you to enter your own configurations and view live performance data through the dashboard. Dashboards are customizable, so you can choose exactly what information you want to monitor in your network.
Visualization is an area where Icinga 2 performs particularly well. It has native support for Graphite and InfluxDB, which can turn performance data into full-featured graphs for deeper performance analysis.
Icinga2 also allows you to monitor both live and historical performance data. It offers excellent alerts capabilities for live monitoring, and you can configure it to send notifications of performance problems by email or text. You can [download Icinga 2][10] for free for Windows, Debian, DHEL, SLES, Ubuntu, Fedora, and OpenSUSE.
#### Zabbix
![](https://opensource.com/sites/default/files/uploads/zabbix_network-monitoring-tools.png)
[Zabbix][11] is another industry-leading open source network monitoring tool, used by companies from Dell to Salesforce on account of its malleable network monitoring experience. Zabbix does network, server, cloud, application, and services monitoring very well.
You can track network information such as network bandwidth usage, network health, and configuration changes, and weed out problems that need to be addressed. Performance data in Zabbix is connected through SNMP, Intelligent Platform Management Interface (IPMI), and IPv6.
Zabbix offers a high level of convenience compared to other open source monitoring tools. For instance, you can automatically detect devices connected to your network before using an out-of-the-box template to begin monitoring your network. You can [download Zabbix][12] for free for CentOS, Debian, Oracle Linux, Red Hat Enterprise Linux, Ubuntu, and Raspbian.
#### Prometheus
![](https://opensource.com/sites/default/files/uploads/promethius_network-monitoring-tools.png)
[Prometheus][13] is an open source network monitoring tool with a large community following. It was built specifically for monitoring time-series data. You can identify time-series data by metric name or key-value pairs. Time-series data is stored on local disks so that it's easy to access in an emergency.
Prometheus' [Alertmanager][14] allows you to view notifications every time it raises an event. Alertmanager can send notifications via email, PagerDuty, or OpsGenie, and you can silence alerts if necessary.
Prometheus' visual elements are excellent and allow you to switch from the browser to the template language and Grafana integration. You can also integrate various third-party data sources into Prometheus from Docker, StatsD, and JMX to customize your Prometheus experience.
As a network monitoring tool, Prometheus is suitable for organizations of all sizes. The onboard integrations and the easy-to-use Alertmanager make it capable of handling any workload, regardless of its size. You can [download Prometheus][15] for free.
### Which are best?
No matter what industry you're working in, if you rely on a network to do business, you need to implement some form of network monitoring. Network monitoring tools are an invaluable resource that help provide you with the visibility to keep your systems online. Monitoring your systems will give you the best chance to keep your equipment in working order.
As the tools on this list show, you don't need to spend an exorbitant amount of money to reap the rewards of network monitoring. Of the five, I believe Icinga 2 and Zabbix are the best options for providing you with everything you need to start monitoring your network to keep it online. Staying vigilant will help to minimize the change of being caught off-guard by performance issues.
--------------------------------------------------------------------------------
via: https://opensource.com/article/19/2/network-monitoring-tools
作者:[Paul Bischoff][a]
选题:[lujun9972][b]
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://opensource.com/users/paulbischoff
[b]: https://github.com/lujun9972
[1]: https://www.comparitech.com/net-admin/application-performance-management/
[2]: https://www.cacti.net/index.php
[3]: https://en.wikipedia.org/wiki/RRDtool
[4]: https://www.cacti.net/download_cacti.php
[5]: https://www.nagios.org/projects/nagios-core/
[6]: https://exchange.nagios.org/directory/Addons/Frontends-%28GUIs-and-CLIs%29/Web-Interfaces/Nagios-V-2DShell/details
[7]: https://exchange.nagios.org/directory/Addons/Graphing-and-Trending/nagiosgraph/details#_ga=2.79847774.890594951.1545045715-2010747642.1545045715
[8]: https://www.nagios.org/downloads/nagios-core/
[9]: https://icinga.com/products/icinga-2/
[10]: https://icinga.com/download/
[11]: https://www.zabbix.com/
[12]: https://www.zabbix.com/download
[13]: https://prometheus.io/
[14]: https://prometheus.io/docs/alerting/alertmanager/
[15]: https://prometheus.io/download/

View File

@@ -0,0 +1,435 @@
[#]: collector: (lujun9972)
[#]: translator: ( )
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (12 Methods To Check The Hard Disk And Hard Drive Partition On Linux)
[#]: via: (https://www.2daygeek.com/linux-command-check-hard-disks-partitions/)
[#]: author: (Vinoth Kumar https://www.2daygeek.com/author/vinoth/)
12 Methods To Check The Hard Disk And Hard Drive Partition On Linux
======
Usually Linux admins check the available hard disk and its partitions whenever they want to add a new disks or additional partition in the system.
We used to check the partition table of our hard disk to view the disk partitions.
This will help you to view how many partitions were already created on the disk. Also, it allow us to verify whether we have any free space or not.
In general hard disks can be divided into one or more logical disks called partitions.
Each partitions can be used as a separate disk with its own file system and partition information is stored in a partition table.
Its a 64-byte data structure. The partition table is part of the master boot record (MBR), which is a small program that is executed when a computer boots.
The partition information are saved in the 0 the sector of the disk. Make a note, all the partitions must be formatted with an appropriate file system before files can be written to it.
This can be verified using the following 12 methods.
* **`fdisk:`** manipulate disk partition table
* **`sfdisk:`** display or manipulate a disk partition table
* **`cfdisk:`** display or manipulate a disk partition table
* **`parted:`** a partition manipulation program
* **`lsblk:`** lsblk lists information about all available or the specified block devices.
* **`blkid:`** locate/print block device attributes.
* **`hwinfo:`** hwinfo stands for hardware information tool is another great utility that used to probe for the hardware present in the system.
* **`lshw:`** lshw is a small tool to extract detailed information on the hardware configuration of the machine.
* **`inxi:`** inxi is a command line system information script built for for console and IRC.
* **`lsscsi:`** list SCSI devices (or hosts) and their attributes
* **`cat /proc/partitions:`**
* **`ls -lh /dev/disk/:`** The directory contains Disk manufacturer name, serial number, partition ID and real block device files, Those were symlink with real block device files.
### How To Check Hard Disk And Hard Drive Partition In Linux Using fdisk Command?
**[fdisk][1]** stands for fixed disk or format disk is a cli utility that allow users to perform following actions on disks. It allows us to view, create, resize, delete, move and copy the partitions.
```
# fdisk -l
Disk /dev/sda: 30 GiB, 32212254720 bytes, 62914560 sectors
Units: sectors of 1 core.md Dict.md lctt2014.md lctt2016.md lctt2018.md LICENSE published README.md scripts sources translated 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0xeab59449
Device Boot Start End Sectors Size Id Type
/dev/sda1 core.md Dict.md lctt2014.md lctt2016.md lctt2018.md LICENSE published README.md scripts sources translated 20973568 62914559 41940992 20G 83 Linux
Disk /dev/sdb: 10 GiB, 10737418240 bytes, 20971520 sectors
Units: sectors of 1 core.md Dict.md lctt2014.md lctt2016.md lctt2018.md LICENSE published README.md scripts sources translated 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk /dev/sdc: 10 GiB, 10737418240 bytes, 20971520 sectors
Units: sectors of 1 core.md Dict.md lctt2014.md lctt2016.md lctt2018.md LICENSE published README.md scripts sources translated 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x8cc8f9e5
Device Boot Start End Sectors Size Id Type
/dev/sdc1 2048 2099199 2097152 1G 83 Linux
/dev/sdc3 4196352 6293503 2097152 1G 83 Linux
/dev/sdc4 6293504 20971519 14678016 7G 5 Extended
/dev/sdc5 6295552 8392703 2097152 1G 83 Linux
Disk /dev/sdd: 10 GiB, 10737418240 bytes, 20971520 sectors
Units: sectors of 1 core.md Dict.md lctt2014.md lctt2016.md lctt2018.md LICENSE published README.md scripts sources translated 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk /dev/sde: 10 GiB, 10737418240 bytes, 20971520 sectors
Units: sectors of 1 core.md Dict.md lctt2014.md lctt2016.md lctt2018.md LICENSE published README.md scripts sources translated 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
```
### How To Check Hard Disk And Hard Drive Partition In Linux Using sfdisk Command?
sfdisk is a script-oriented tool for partitioning any block device. sfdisk supports MBR (DOS), GPT, SUN and SGI disk labels, but no longer provides any functionality for CHS (Cylinder-Head-Sector) addressing.
```
# sfdisk -l
Disk /dev/sda: 30 GiB, 32212254720 bytes, 62914560 sectors
Units: sectors of 1 core.md Dict.md lctt2014.md lctt2016.md lctt2018.md LICENSE published README.md scripts sources translated 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0xeab59449
Device Boot Start End Sectors Size Id Type
/dev/sda1 core.md Dict.md lctt2014.md lctt2016.md lctt2018.md LICENSE published README.md scripts sources translated 20973568 62914559 41940992 20G 83 Linux
Disk /dev/sdb: 10 GiB, 10737418240 bytes, 20971520 sectors
Units: sectors of 1 core.md Dict.md lctt2014.md lctt2016.md lctt2018.md LICENSE published README.md scripts sources translated 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk /dev/sdc: 10 GiB, 10737418240 bytes, 20971520 sectors
Units: sectors of 1 core.md Dict.md lctt2014.md lctt2016.md lctt2018.md LICENSE published README.md scripts sources translated 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x8cc8f9e5
Device Boot Start End Sectors Size Id Type
/dev/sdc1 2048 2099199 2097152 1G 83 Linux
/dev/sdc3 4196352 6293503 2097152 1G 83 Linux
/dev/sdc4 6293504 20971519 14678016 7G 5 Extended
/dev/sdc5 6295552 8392703 2097152 1G 83 Linux
Disk /dev/sdd: 10 GiB, 10737418240 bytes, 20971520 sectors
Units: sectors of 1 core.md Dict.md lctt2014.md lctt2016.md lctt2018.md LICENSE published README.md scripts sources translated 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk /dev/sde: 10 GiB, 10737418240 bytes, 20971520 sectors
Units: sectors of 1 core.md Dict.md lctt2014.md lctt2016.md lctt2018.md LICENSE published README.md scripts sources translated 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
```
### How To Check Hard Disk And Hard Drive Partition In Linux Using cfdisk Command?
cfdisk is a curses-based program for partitioning any block device. The default device is /dev/sda. It provides basic partitioning functionality with a user-friendly interface.
```
# cfdisk /dev/sdc
Disk: /dev/sdc
Size: 10 GiB, 10737418240 bytes, 20971520 sectors
Label: dos, identifier: 0x8cc8f9e5
Device Boot Start End Sectors Size Id Type
>> /dev/sdc1 2048 2099199 2097152 1G 83 Linux
Free space 2099200 4196351 2097152 1G
/dev/sdc3 4196352 6293503 2097152 1G 83 Linux
/dev/sdc4 6293504 20971519 14678016 7G 5 Extended
├─/dev/sdc5 6295552 8392703 2097152 1G 83 Linux
└─Free space 8394752 20971519 12576768 6G
┌───────────────────────────────────────────────────────────────────────────────┐
│ Partition type: Linux (83) │
│Filesystem UUID: d17e3c31-e2c9-4f11-809c-94a549bc43b7 │
│ Filesystem: ext2 │
│ Mountpoint: /part1 (mounted) │
└───────────────────────────────────────────────────────────────────────────────┘
[Bootable] [ Delete ] [ Quit ] [ Type ] [ Help ] [ Write ]
[ Dump ]
Quit program without writing changes
```
### How To Check Hard Disk And Hard Drive Partition In Linux Using parted Command?
**[parted][2]** is a program to manipulate disk partitions. It supports multiple partition table formats, including MS-DOS and GPT. It is useful for creating space for new operating systems, reorganising disk usage, and copying data to new hard disks.
```
# parted -l
Model: ATA VBOX HARDDISK (scsi)
Disk /dev/sda: 32.2GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags:
Number Start End Size Type File system Flags
1 10.7GB 32.2GB 21.5GB primary ext4 boot
Model: ATA VBOX HARDDISK (scsi)
Disk /dev/sdb: 10.7GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags:
Model: ATA VBOX HARDDISK (scsi)
Disk /dev/sdc: 10.7GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags:
Number Start End Size Type File system Flags
1 1049kB 1075MB 1074MB primary ext2
3 2149MB 3222MB 1074MB primary ext4
4 3222MB 10.7GB 7515MB extended
5 3223MB 4297MB 1074MB logical
Model: ATA VBOX HARDDISK (scsi)
Disk /dev/sdd: 10.7GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags:
Model: ATA VBOX HARDDISK (scsi)
Disk /dev/sde: 10.7GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags:
```
### How To Check Hard Disk And Hard Drive Partition In Linux Using lsblk Command?
lsblk lists information about all available or the specified block devices. The lsblk command reads the sysfs filesystem and udev db to gather information.
If the udev db is not available or lsblk is compiled without udev support than it tries to read LABELs, UUIDs and filesystem types from the block device. In this case root permissions are necessary. The command prints all block devices (except RAM disks) in a tree-like format by default.
```
# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 30G 0 disk
└─sda1 8:1 0 20G 0 part /
sdb 8:16 0 10G 0 disk
sdc 8:32 0 10G 0 disk
├─sdc1 8:33 0 1G 0 part /part1
├─sdc3 8:35 0 1G 0 part /part2
├─sdc4 8:36 0 1K 0 part
└─sdc5 8:37 0 1G 0 part
sdd 8:48 0 10G 0 disk
sde 8:64 0 10G 0 disk
sr0 11:0 1 1024M 0 rom
```
### How To Check Hard Disk And Hard Drive Partition In Linux Using blkid Command?
blkid is a command-line utility to locate/print block device attributes. It uses libblkid library to get disk partition UUID in Linux system.
```
# blkid
/dev/sda1: UUID="d92fa769-e00f-4fd7-b6ed-ecf7224af7fa" TYPE="ext4" PARTUUID="eab59449-01"
/dev/sdc1: UUID="d17e3c31-e2c9-4f11-809c-94a549bc43b7" TYPE="ext2" PARTUUID="8cc8f9e5-01"
/dev/sdc3: UUID="ca307aa4-0866-49b1-8184-004025789e63" TYPE="ext4" PARTUUID="8cc8f9e5-03"
/dev/sdc5: PARTUUID="8cc8f9e5-05"
```
### How To Check Hard Disk And Hard Drive Partition In Linux Using hwinfo Command?
**[hwinfo][3]** stands for hardware information tool is another great utility that used to probe for the hardware present in the system and display detailed information about varies hardware components in human readable format.
```
# hwinfo --block --short
disk:
/dev/sdd VBOX HARDDISK
/dev/sdb VBOX HARDDISK
/dev/sde VBOX HARDDISK
/dev/sdc VBOX HARDDISK
/dev/sda VBOX HARDDISK
partition:
/dev/sdc1 Partition
/dev/sdc3 Partition
/dev/sdc4 Partition
/dev/sdc5 Partition
/dev/sda1 Partition
cdrom:
/dev/sr0 VBOX CD-ROM
```
### How To Check Hard Disk And Hard Drive Partition In Linux Using lshw Command?
**[lshw][4]** (stands for Hardware Lister) is a small nifty tool that generates detailed reports about various hardware components on the machine such as memory configuration, firmware version, mainboard configuration, CPU version and speed, cache configuration, usb, network card, graphics cards, multimedia, printers, bus speed, etc.
```
# lshw -short -class disk -class volume
H/W path Device Class Description
===================================================
/0/3/0.0.0 /dev/cdrom disk CD-ROM
/0/4/0.0.0 /dev/sda disk 32GB VBOX HARDDISK
/0/4/0.0.0/1 /dev/sda1 volume 19GiB EXT4 volume
/0/5/0.0.0 /dev/sdb disk 10GB VBOX HARDDISK
/0/6/0.0.0 /dev/sdc disk 10GB VBOX HARDDISK
/0/6/0.0.0/1 /dev/sdc1 volume 1GiB Linux filesystem partition
/0/6/0.0.0/3 /dev/sdc3 volume 1GiB EXT4 volume
/0/6/0.0.0/4 /dev/sdc4 volume 7167MiB Extended partition
/0/6/0.0.0/4/5 /dev/sdc5 volume 1GiB Linux filesystem partition
/0/7/0.0.0 /dev/sdd disk 10GB VBOX HARDDISK
/0/8/0.0.0 /dev/sde disk 10GB VBOX HARDDISK
```
### How To Check Hard Disk And Hard Drive Partition In Linux Using inxi Command?
**[inxi][5]** is a nifty tool to check hardware information on Linux and offers wide range of option to get all the hardware information on Linux system that i never found in any other utility which are available in Linux. It was forked from the ancient and mindbendingly perverse yet ingenius infobash, by locsmif.
```
# inxi -Dp
Drives: HDD Total Size: 75.2GB (22.3% used)
ID-1: /dev/sda model: VBOX_HARDDISK size: 32.2GB
ID-2: /dev/sdb model: VBOX_HARDDISK size: 10.7GB
ID-3: /dev/sdc model: VBOX_HARDDISK size: 10.7GB
ID-4: /dev/sdd model: VBOX_HARDDISK size: 10.7GB
ID-5: /dev/sde model: VBOX_HARDDISK size: 10.7GB
Partition: ID-1: / size: 20G used: 16G (85%) fs: ext4 dev: /dev/sda1
ID-3: /part1 size: 1008M used: 1.3M (1%) fs: ext2 dev: /dev/sdc1
ID-4: /part2 size: 976M used: 2.6M (1%) fs: ext4 dev: /dev/sdc3
```
### How To Check Hard Disk And Hard Drive Partition In Linux Using lsscsi Command?
Uses information in sysfs (Linux kernel series 2.6 and later) to list SCSI devices (or hosts) currently attached to the system. Options can be used to control the amount and form of information provided for each device.
By default in this utility device node names (e.g. “/dev/sda” or “/dev/root_disk”) are obtained by noting the major and minor numbers for the listed device obtained from sysfs
```
# lsscsi
[0:0:0:0] cd/dvd VBOX CD-ROM 1.0 /dev/sr0
[2:0:0:0] disk ATA VBOX HARDDISK 1.0 /dev/sda
[3:0:0:0] disk ATA VBOX HARDDISK 1.0 /dev/sdb
[4:0:0:0] disk ATA VBOX HARDDISK 1.0 /dev/sdc
[5:0:0:0] disk ATA VBOX HARDDISK 1.0 /dev/sdd
[6:0:0:0] disk ATA VBOX HARDDISK 1.0 /dev/sde
```
### How To Check Hard Disk And Hard Drive Partition In Linux Using ProcFS?
The proc filesystem (procfs) is a special filesystem in Unix-like operating systems that presents information about processes and other system information.
Its sometimes referred to as a process information pseudo-file system. It doesnt contain real files but runtime system information (e.g. system memory, devices mounted, hardware configuration, etc).
```
# cat /proc/partitions
major minor #blocks name
11 0 1048575 sr0
8 0 31457280 sda
8 1 20970496 sda1
8 16 10485760 sdb
8 32 10485760 sdc
8 33 1048576 sdc1
8 35 1048576 sdc3
8 36 1 sdc4
8 37 1048576 sdc5
8 48 10485760 sdd
8 64 10485760 sde
```
### How To Check Hard Disk And Hard Drive Partition In Linux Using /dev/disk Path?
This directory contains four directories, its by-id, by-uuid, by-path and by-partuuid. Each directory contains some useful information and its symlinked with real block device files.
```
# ls -lh /dev/disk/by-id
total 0
lrwxrwxrwx 1 root root 9 Feb 2 23:08 ata-VBOX_CD-ROM_VB0-01f003f6 -> ../../sr0
lrwxrwxrwx 1 root root 9 Feb 3 00:14 ata-VBOX_HARDDISK_VB26e827b5-668ab9f4 -> ../../sda
lrwxrwxrwx 1 root root 10 Feb 3 00:14 ata-VBOX_HARDDISK_VB26e827b5-668ab9f4-part1 -> ../../sda1
lrwxrwxrwx 1 root root 9 Feb 2 23:39 ata-VBOX_HARDDISK_VB3774c742-fb2b3e4e -> ../../sdd
lrwxrwxrwx 1 root root 9 Feb 2 23:39 ata-VBOX_HARDDISK_VBe72672e5-029a918e -> ../../sdc
lrwxrwxrwx 1 root root 10 Feb 2 23:39 ata-VBOX_HARDDISK_VBe72672e5-029a918e-part1 -> ../../sdc1
lrwxrwxrwx 1 root root 10 Feb 2 23:39 ata-VBOX_HARDDISK_VBe72672e5-029a918e-part3 -> ../../sdc3
lrwxrwxrwx 1 root root 10 Feb 2 23:39 ata-VBOX_HARDDISK_VBe72672e5-029a918e-part4 -> ../../sdc4
lrwxrwxrwx 1 root root 10 Feb 2 23:39 ata-VBOX_HARDDISK_VBe72672e5-029a918e-part5 -> ../../sdc5
lrwxrwxrwx 1 root root 9 Feb 2 23:39 ata-VBOX_HARDDISK_VBed1cf451-9f51c5f6 -> ../../sdb
lrwxrwxrwx 1 root root 9 Feb 2 23:39 ata-VBOX_HARDDISK_VBf242dbdd-49a982eb -> ../../sde
```
Output of by-uuid
```
# ls -lh /dev/disk/by-uuid
total 0
lrwxrwxrwx 1 root root 10 Feb 2 23:39 ca307aa4-0866-49b1-8184-004025789e63 -> ../../sdc3
lrwxrwxrwx 1 root root 10 Feb 2 23:39 d17e3c31-e2c9-4f11-809c-94a549bc43b7 -> ../../sdc1
lrwxrwxrwx 1 root root 10 Feb 3 00:14 d92fa769-e00f-4fd7-b6ed-ecf7224af7fa -> ../../sda1
```
Output of by-path
```
# ls -lh /dev/disk/by-path
total 0
lrwxrwxrwx 1 root root 9 Feb 2 23:08 pci-0000:00:01.1-ata-1 -> ../../sr0
lrwxrwxrwx 1 root root 9 Feb 3 00:14 pci-0000:00:0d.0-ata-1 -> ../../sda
lrwxrwxrwx 1 root root 10 Feb 3 00:14 pci-0000:00:0d.0-ata-1-part1 -> ../../sda1
lrwxrwxrwx 1 root root 9 Feb 2 23:39 pci-0000:00:0d.0-ata-2 -> ../../sdb
lrwxrwxrwx 1 root root 9 Feb 2 23:39 pci-0000:00:0d.0-ata-3 -> ../../sdc
lrwxrwxrwx 1 root root 10 Feb 2 23:39 pci-0000:00:0d.0-ata-3-part1 -> ../../sdc1
lrwxrwxrwx 1 root root 10 Feb 2 23:39 pci-0000:00:0d.0-ata-3-part3 -> ../../sdc3
lrwxrwxrwx 1 root root 10 Feb 2 23:39 pci-0000:00:0d.0-ata-3-part4 -> ../../sdc4
lrwxrwxrwx 1 root root 10 Feb 2 23:39 pci-0000:00:0d.0-ata-3-part5 -> ../../sdc5
lrwxrwxrwx 1 root root 9 Feb 2 23:39 pci-0000:00:0d.0-ata-4 -> ../../sdd
lrwxrwxrwx 1 root root 9 Feb 2 23:39 pci-0000:00:0d.0-ata-5 -> ../../sde
```
Output of by-partuuid
```
# ls -lh /dev/disk/by-partuuid
total 0
lrwxrwxrwx 1 root root 10 Feb 2 23:39 8cc8f9e5-01 -> ../../sdc1
lrwxrwxrwx 1 root root 10 Feb 2 23:39 8cc8f9e5-03 -> ../../sdc3
lrwxrwxrwx 1 root root 10 Feb 2 23:39 8cc8f9e5-04 -> ../../sdc4
lrwxrwxrwx 1 root root 10 Feb 2 23:39 8cc8f9e5-05 -> ../../sdc5
lrwxrwxrwx 1 root root 10 Feb 3 00:14 eab59449-01 -> ../../sda1
```
--------------------------------------------------------------------------------
via: https://www.2daygeek.com/linux-command-check-hard-disks-partitions/
作者:[Vinoth Kumar][a]
选题:[lujun9972][b]
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://www.2daygeek.com/author/vinoth/
[b]: https://github.com/lujun9972
[1]: https://www.2daygeek.com/linux-fdisk-command-to-manage-disk-partitions/
[2]: https://www.2daygeek.com/how-to-manage-disk-partitions-using-parted-command/
[3]: https://www.2daygeek.com/hwinfo-check-display-detect-system-hardware-information-linux/
[4]: https://www.2daygeek.com/lshw-find-check-system-hardware-information-details-linux/
[5]: https://www.2daygeek.com/inxi-system-hardware-information-on-linux/

View File

@@ -0,0 +1,172 @@
[#]: collector: (lujun9972)
[#]: translator: ( )
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (5 Streaming Audio Players for Linux)
[#]: via: (https://www.linux.com/blog/2019/2/5-streaming-audio-players-linux)
[#]: author: (Jack Wallen https://www.linux.com/users/jlwallen)
5 Streaming Audio Players for Linux
======
![](https://www.linux.com/sites/lcom/files/styles/rendered_file/public/music-main.png?itok=bTxfvadR)
As I work, throughout the day, music is always playing in the background. Most often, that music is in the form of vinyl spinning on a turntable. But when Im not in purist mode, Ill opt to listen to audio by way of a streaming app. Naturally, Im on the Linux platform, so the only tools I have at my disposal are those that play well on my operating system of choice. Fortunately, plenty of options exist for those who want to stream audio to their Linux desktops.
In fact, Linux offers a number of solid offerings for music streaming, and Ill highlight five of my favorite tools for this task. A word of warning, not all of these players are open source. But if youre okay running a proprietary app on your open source desktop, you have some really powerful options. Lets take a look at whats available.
### Spotify
Spotify for Linux isnt some dumb-downed, half-baked app that crashes every other time you open it, and doesnt offer the full-range of features found on the macOS and Windows equivalent. In fact, the Linux version of Spotify is exactly the same as youll find on other platforms. With the Spotify streaming client you can listen to music and podcasts, create playlists, discover new artists, and so much more. And the Spotify interface (Figure 1) is quite easy to navigate and use.
![Spotify][2]
Figure 1: The Spotify interface makes it easy to find new music and old favorites.
[Used with permission][3]
You can install Spotify either using snap (with the command sudo snap install spotify), or from the official repository, with the following commands:
* sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 931FF8E79F0876134EDDBDCCA87FF9DF48BF1C90
* sudo echo deb <http://repository.spotify.com> stable non-free | sudo tee /etc/apt/sources.list.d/spotify.list
* sudo apt-get update
* sudo apt-get install spotify-client
Once installed, youll want to log into your Spotify account, so you can start streaming all of the great music to help motivate you to get your work done. If you have Spotify installed on other devices (and logged into the same account), you can dictate to which device the music should stream (by clicking the Devices Available icon near the bottom right corner of the Spotify window).
### Clementine
Clementine one of the best music players available to the Linux platform. Clementine not only allows user to play locally stored music, but to connect to numerous streaming audio services, such as:
* Amazon Cloud Drive
* Box
* Dropbox
* Icecast
* Jamendo
* Magnatune
* RockRadio.com
* Radiotunes.com
* SomaFM
* SoundCloud
* Spotify
* Subsonic
* Vk.com
* Or internet radio streams
There are two caveats to using Clementine. The first is you must be using the most recent version (as the build available in some repositories is out of date and wont install the necessary streaming plugins). Second, even with the most recent build, some streaming services wont function as expected. For example, with Spotify, youll only have available to you the Top Tracks (and not your playlist … or the ability to search for songs).
With Clementine Internet radio streaming, youll find musicians and bands youve never heard of (Figure 2), and plenty of them to tune into.
![Clementine][5]
Figure 2: Clementine Internet radio is a great way to find new music.
[Used with permission][3]
### Odio
Odio is a cross-platform, proprietary app (available for Linux, MacOS, and Windows) that allows you to stream internet music stations of all genres. Radio stations are curated from [www.radio-browser.info][6] and the app itself does an incredible job of presenting the streams for you (Figure 3).
![Odio][8]
Figure 3: The Odio interface is one of the best youll find.
[Used with permission][3]
Odio makes it very easy to find unique Internet radio stations and even add those you find and enjoy to your library. Currently, the only way to install Odio on Linux is via Snap. If your distribution supports snap packages, install this streaming app with the command:
sudo snap install odio
Once installed, you can open the app and start using it. There is no need to log into (or create) an account. Odio is very limited in its settings. In fact, it only offers the choice between a dark or light theme in the settings window. However, as limited as it might be, Odio is one of your best bets for playing Internet radio on Linux.
Streamtuner2 is an outstanding Internet radio station GUI tool. With it you can stream music from the likes of:
* Internet radio stations
* Jameno
* MyOggRadio
* Shoutcast.com
* SurfMusic
* TuneIn
* Xiph.org
* YouTube
### StreamTuner2
Streamtuner2 offers a nice (if not slightly outdated) interface, that makes it quite easy to find and stream your favorite music. The one caveat with StreamTuner2 is that its really just a GUI for finding the streams you want to hear. When you find a station, double-click on it to open the app associated with the stream. That means you must have the necessary apps installed, in order for the streams to play. If you dont have the proper apps, you cant play the streams. Because of this, youll spend a good amount of time figuring out what apps to install for certain streams (Figure 4).
![Streamtuner2][10]
Figure 4: Configuring Streamtuner2 isnt for the faint of heart.
[Used with permission][3]
### VLC
VLC has been, for a very long time, dubbed the best media playback tool for Linux. Thats with good reason, as it can play just about anything you throw at it. Included in that list is streaming radio stations. Although you wont find VLC connecting to the likes of Spotify, you can head over to Internet-Radio, click on a playlist and have VLC open it without a problem. And considering how many internet radio stations are available at the moment, you wont have any problem finding music to suit your tastes. VLC also includes tools like visualizers, equalizers (Figure 5), and more.
![VLC ][12]
Figure 5: The VLC visualizer and equalizer features in action.
[Used with permission][3]
The only caveat to VLC is that you do have to have a URL for the Internet Radio you wish you hear, as the tool itself doesnt curate. But with those links in hand, you wont find a better media player than VLC.
### Always More Where That Came From
If one of these five tools doesnt fit your needs, I suggest you open your distributions app store and search for one that will. There are plenty of tools to make streaming music, podcasts, and more not only possible on Linux, but easy.
Learn more about Linux through the free ["Introduction to Linux" ][13] course from The Linux Foundation and edX.
--------------------------------------------------------------------------------
via: https://www.linux.com/blog/2019/2/5-streaming-audio-players-linux
作者:[Jack Wallen][a]
选题:[lujun9972][b]
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://www.linux.com/users/jlwallen
[b]: https://github.com/lujun9972
[2]: https://www.linux.com/sites/lcom/files/styles/rendered_file/public/spotify_0.jpg?itok=8-Ym-R61 (Spotify)
[3]: https://www.linux.com/licenses/category/used-permission
[5]: https://www.linux.com/sites/lcom/files/styles/rendered_file/public/clementine_0.jpg?itok=5oODJO3b (Clementine)
[6]: http://www.radio-browser.info
[8]: https://www.linux.com/sites/lcom/files/styles/rendered_file/public/odio.jpg?itok=sNPTSS3c (Odio)
[10]: https://www.linux.com/sites/lcom/files/styles/rendered_file/public/streamtuner2.jpg?itok=1MSbafWj (Streamtuner2)
[12]: https://www.linux.com/sites/lcom/files/styles/rendered_file/public/vlc_0.jpg?itok=QEOsq7Ii (VLC )
[13]: https://training.linuxfoundation.org/linux-courses/system-administration-training/introduction-to-linux

View File

@@ -0,0 +1,122 @@
[#]: collector: (lujun9972)
[#]: translator: ( )
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (CFS: Completely fair process scheduling in Linux)
[#]: via: (https://opensource.com/article/19/2/fair-scheduling-linux)
[#]: author: (Marty kalin https://opensource.com/users/mkalindepauledu)
CFS: Completely fair process scheduling in Linux
======
CFS gives every task a fair share of processor resources in a low-fuss but highly efficient way.
![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/fail_progress_cycle_momentum_arrow.png?itok=q-ZFa_Eh)
Linux takes a modular approach to processor scheduling in that different algorithms can be used to schedule different process types. A scheduling class specifies which scheduling policy applies to which type of process. Completely fair scheduling (CFS), which became part of the Linux 2.6.23 kernel in 2007, is the scheduling class for normal (as opposed to real-time) processes and therefore is named **SCHED_NORMAL**.
CFS is geared for the interactive applications typical in a desktop environment, but it can be configured as **SCHED_BATCH** to favor the batch workloads common, for example, on a high-volume web server. In any case, CFS breaks dramatically with what might be called "classic preemptive scheduling." Also, the "completely fair" claim has to be seen with a technical eye; otherwise, the claim might seem like an empty boast.
Let's dig into the details of what sets CFS apart from—indeed, above—other process schedulers. Let's start with a quick review of some core technical terms.
### Some core concepts
Linux inherits the Unix view of a process as a program in execution. As such, a process must contend with other processes for shared system resources: memory to hold instructions and data, at least one processor to execute instructions, and I/O devices to interact with the external world. Process scheduling is how the operating system (OS) assigns tasks (e.g., crunching some numbers, copying a file) to processors—a running process then performs the task. A process has one or more threads of execution, which are sequences of machine-level instructions. To schedule a process is to schedule one of its threads on a processor.
In a simplifying move, Linux turns process scheduling into thread scheduling by treating a scheduled process as if it were single-threaded. If a process is multi-threaded with N threads, then N scheduling actions would be required to cover the threads. Threads within a multi-threaded process remain related in that they share resources such as memory address space. Linux threads are sometimes described as lightweight processes, with the lightweight underscoring the sharing of resources among the threads within a process.
Although a process can be in various states, two are of particular interest in scheduling. A blocked process is awaiting the completion of some event such as an I/O event. The process can resume execution only after the event completes. A runnable process is one that is not currently blocked.
A process is processor-bound (aka compute-bound) if it consumes mostly processor as opposed to I/O resources, and I/O-bound in the opposite case; hence, a processor-bound process is mostly runnable, whereas an I/O-bound process is mostly blocked. As examples, crunching numbers is processor-bound, and accessing files is I/O-bound. Although an entire process might be characterized as either processor-bound or I/O-bound, a given process may be one or the other during different stages of its execution. Interactive desktop applications, such as browsers, tend to be I/O-bound.
A good process scheduler has to balance the needs of processor-bound and I/O-bound tasks, especially in an operating system such as Linux that thrives on so many hardware platforms: desktop machines, embedded devices, mobile devices, server clusters, supercomputers, and more.
### Classic preemptive scheduling versus CFS
Unix popularized classic preemptive scheduling, which other operating systems including VAX/VMS, Windows NT, and Linux later adopted. At the center of this scheduling model is a fixed timeslice, the amount of time (e.g., 50ms) that a task is allowed to hold a processor until preempted in favor of some other task. If a preempted process has not finished its work, the process must be rescheduled. This model is powerful in that it supports multitasking (concurrency) through processor time-sharing, even on the single-CPU machines of yesteryear.
The classic model typically includes multiple scheduling queues, one per process priority: Every process in a higher-priority queue gets scheduled before any process in a lower-priority queue. As an example, VAX/VMS uses 32 priority queues for scheduling.
CFS dispenses with fixed timeslices and explicit priorities. The amount of time for a given task on a processor is computed dynamically as the scheduling context changes over the system's lifetime. Here is a sketch of the motivating ideas and technical details:
* Imagine a processor, P, which is idealized in that it can execute multiple tasks simultaneously. For example, tasks T1 and T2 can execute on P at the same time, with each receiving 50% of P's magical processing power. This idealization describes perfect multitasking, which CFS strives to achieve on actual as opposed to idealized processors. CFS is designed to approximate perfect multitasking.
* The CFS scheduler has a target latency, which is the minimum amount of time—idealized to an infinitely small duration—required for every runnable task to get at least one turn on the processor. If such a duration could be infinitely small, then each runnable task would have had a turn on the processor during any given timespan, however small (e.g., 10ms, 5ns, etc.). Of course, an idealized infinitely small duration must be approximated in the real world, and the default approximation is 20ms. Each runnable task then gets a 1/N slice of the target latency, where N is the number of tasks. For example, if the target latency is 20ms and there are four contending tasks, then each task gets a timeslice of 5ms. By the way, if there is only a single task during a scheduling event, this lucky task gets the entire target latency as its slice. The fair in CFS comes to the fore in the 1/N slice given to each task contending for a processor.
* The 1/N slice is, indeed, a timeslice—but not a fixed one because such a slice depends on N, the number of tasks currently contending for the processor. The system changes over time. Some processes terminate and new ones are spawned; runnable processes block and blocked processes become runnable. The value of N is dynamic and so, therefore, is the 1/N timeslice computed for each runnable task contending for a processor. The traditional **nice** value is used to weight the 1/N slice: a low-priority **nice** value means that only some fraction of the 1/N slice is given to a task, whereas a high-priority **nice** value means that a proportionately greater fraction of the 1/N slice is given to a task. In summary, **nice** values do not determine the slice, but only modify the 1/N slice that represents fairness among the contending tasks.
* The operating system incurs overhead whenever a context switch occurs; that is, when one process is preempted in favor of another. To keep this overhead from becoming unduly large, there is a minimum amount of time (with a typical setting of 1ms to 4ms) that any scheduled process must run before being preempted. This minimum is known as the minimum granularity. If many tasks (e.g., 20) are contending for the processor, then the minimum granularity (assume 4ms) might be more than the 1/N slice (in this case, 1ms). If the minimum granularity turns out to be larger than the 1/N slice, the system is overloaded because there are too many tasks contending for the processor—and fairness goes out the window.
* When does preemption occur? CFS tries to minimize context switches, given their overhead: time spent on a context switch is time unavailable for other tasks. Accordingly, once a task gets the processor, it runs for its entire weighted 1/N slice before being preempted in favor of some other task. Suppose task T1 has run for its weighted 1/N slice, and runnable task T2 currently has the lowest virtual runtime (vruntime) among the tasks contending for the processor. The vruntime records, in nanoseconds, how long a task has run on the processor. In this case, T1 would be preempted in favor of T2.
* The scheduler tracks the vruntime for all tasks, runnable and blocked. The lower a task's vruntime, the more deserving the task is for time on the processor. CFS accordingly moves low-vruntime tasks towards the front of the scheduling line. Details are forthcoming because the line is implemented as a tree, not a list.
* How often should the CFS scheduler reschedule? There is a simple way to determine the scheduling period. Suppose that the target latency (TL) is 20ms and the minimum granularity (MG) is 4ms:
`TL / MG = (20 / 4) = 5 ## five or fewer tasks are ok`
In this case, five or fewer tasks would allow each task a turn on the processor during the target latency. For example, if the task number is five, each runnable task has a 1/N slice of 4ms, which happens to equal the minimum granularity; if the task number is three, each task gets a 1/N slice of almost 7ms. In either case, the scheduler would reschedule in 20ms, the duration of the target latency.
Trouble occurs if the number of tasks (e.g., 10) exceeds TL / MG because now each task must get the minimum time of 4ms instead of the computed 1/N slice, which is 2ms. In this case, the scheduler would reschedule in 40ms:
`(number of tasks) core.md Dict.md lctt2014.md lctt2016.md lctt2018.md LICENSE published README.md scripts sources translated MG = (10 core.md Dict.md lctt2014.md lctt2016.md lctt2018.md LICENSE published README.md scripts sources translated 4) = 40ms ## period = 40ms`
Linux schedulers that predate CFS use heuristics to promote the fair treatment of interactive tasks with respect to scheduling. CFS takes a quite different approach by letting the vruntime facts speak mostly for themselves, which happens to support sleeper fairness. An interactive task, by its very nature, tends to sleep a lot in the sense that it awaits user inputs and so becomes I/O-bound; hence, such a task tends to have a relatively low vruntime, which tends to move the task towards the front of the scheduling line.
### Special features
CFS supports symmetrical multiprocessing (SMP) in which any process (whether kernel or user) can execute on any processor. Yet configurable scheduling domains can be used to group processors for load balancing or even segregation. If several processors share the same scheduling policy, then load balancing among them is an option; if a particular processor has a scheduling policy different from the others, then this processor would be segregated from the others with respect to scheduling.
Configurable scheduling groups are another CFS feature. As an example, consider the Nginx web server that's running on my desktop machine. At startup, this server has a master process and four worker processes, which act as HTTP request handlers. For any HTTP request, the particular worker that handles the request is irrelevant; it matters only that the request is handled in a timely manner, and so the four workers together provide a pool from which to draw a task-handler as requests come in. It thus seems fair to treat the four Nginx workers as a group rather than as individuals for scheduling purposes, and a scheduling group can be used to do just that. The four Nginx workers could be configured to have a single vruntime among them rather than individual vruntimes. Configuration is done in the traditional Linux way, through files. For vruntime-sharing, a file named **cpu.shares** , with the details given through familiar shell commands, would be created.
As noted earlier, Linux supports scheduling classes so that different scheduling policies, together with their implementing algorithms, can coexist on the same platform. A scheduling class is implemented as a code module in C. CFS, the scheduling class described so far, is **SCHED_NORMAL**. There are also scheduling classes specifically for real-time tasks, **SCHED_FIFO** (first in, first out) and **SCHED_RR** (round robin). Under **SCHED_FIFO** , tasks run to completion; under **SCHED_RR** , tasks run until they exhaust a fixed timeslice and are preempted.
### CFS implementation
CFS requires efficient data structures to track task information and high-performance code to generate the schedules. Let's begin with a central term in scheduling, the runqueue. This is a data structure that represents a timeline for scheduled tasks. Despite the name, the runqueue need not be implemented in the traditional way, as a FIFO list. CFS breaks with tradition by using a time-ordered red-black tree as a runqueue. The data structure is well-suited for the job because it is a self-balancing binary search tree, with efficient **insert** and **remove** operations that execute in **O(log N)** time, where N is the number of nodes in the tree. Also, a tree is an excellent data structure for organizing entities into a hierarchy based on a particular property, in this case a vruntime.
In CFS, the tree's internal nodes represent tasks to be scheduled, and the tree as a whole, like any runqueue, represents a timeline for task execution. Red-black trees are in wide use beyond scheduling; for example, Java uses this data structure to implement its **TreeMap**.
Under CFS, every processor has a specific runqueue of tasks, and no task occurs at the same time in more than one runqueue. Each runqueue is a red-black tree. The tree's internal nodes represent tasks or task groups, and these nodes are indexed by their vruntime values so that (in the tree as a whole or in any subtree) the internal nodes to the left have lower vruntime values than the ones to the right:
```
    25     ## 25 is a task vruntime
    /\
  17  29   ## 17 roots the left subtree, 29 the right one
  /\  ...
 5  19     ## and so on
...  \
     nil   ## leaf nodes are nil
```
In summary, tasks with the lowest vruntime—and, therefore, the greatest need for a processor—reside somewhere in the left subtree; tasks with relatively high vruntimes congregate in the right subtree. A preempted task would go into the right subtree, thus giving other tasks a chance to move leftwards in the tree. A task with the smallest vruntime winds up in the tree's leftmost (internal) node, which is thus the front of the runqueue.
The CFS scheduler has an instance, the C **task_struct** , to track detailed information about each task to be scheduled. This structure embeds a **sched_entity** structure, which in turn has scheduling-specific information, in particular, the vruntime per task or task group:
```
struct task_struct {       /bin /boot /dev /etc /home /lib /lib64 /lost+found /media /mnt /opt /proc /root /run /sbin /srv /sys /tmp /usr /var info on a task **/
  ...
  struct sched_entity se;  /** vruntime, etc. **/
  ...
};
```
The red-black tree is implemented in familiar C fashion, with a premium on pointers for efficiency. A **cfs_rq** structure instance embeds a **rb_root** field named **tasks_timeline** , which points to the root of a red-black tree. Each of the tree's internal nodes has pointers to the parent and the two child nodes; the leaf nodes have nil as their value.
CFS illustrates how a straightforward idea—give every task a fair share of processor resources—can be implemented in a low-fuss but highly efficient way. It's worth repeating that CFS achieves fair and efficient scheduling without traditional artifacts such as fixed timeslices and explicit task priorities. The pursuit of even better schedulers goes on, of course; for the moment, however, CFS is as good as it gets for general-purpose processor scheduling.
--------------------------------------------------------------------------------
via: https://opensource.com/article/19/2/fair-scheduling-linux
作者:[Marty kalin][a]
选题:[lujun9972][b]
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://opensource.com/users/mkalindepauledu
[b]: https://github.com/lujun9972

View File

@@ -0,0 +1,443 @@
[#]: collector: (lujun9972)
[#]: translator: ( )
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (Install Apache, MySQL, PHP (LAMP) Stack On Ubuntu 18.04 LTS)
[#]: via: (https://www.ostechnix.com/install-apache-mysql-php-lamp-stack-on-ubuntu-18-04-lts/)
[#]: author: (SK https://www.ostechnix.com/author/sk/)
Install Apache, MySQL, PHP (LAMP) Stack On Ubuntu 18.04 LTS
======
![](https://www.ostechnix.com/wp-content/uploads/2019/02/lamp-720x340.jpg)
**LAMP** stack is a popular, open source web development platform that can be used to run and deploy dynamic websites and web-based applications. Typically, LAMP stack consists of Apache webserver, MariaDB/MySQL databases, PHP/Python/Perl programming languages. LAMP is the acronym of **L** inux, **M** ariaDB/ **M** YSQL, **P** HP/ **P** ython/ **P** erl. This tutorial describes how to install Apache, MySQL, PHP (LAMP stack) in Ubuntu 18.04 LTS server.
### Install Apache, MySQL, PHP (LAMP) Stack On Ubuntu 18.04 LTS
For the purpose of this tutorial, we will be using the following Ubuntu testbox.
* **Operating System** : Ubuntu 18.04.1 LTS Server Edition
* **IP address** : 192.168.225.22/24
#### 1. Install Apache web server
First of all, update Ubuntu server using commands:
```
$ sudo apt update
$ sudo apt upgrade
```
Next, install Apache web server:
```
$ sudo apt install apache2
```
Check if Apache web server is running or not:
```
$ sudo systemctl status apache2
```
Sample output would be:
```
● apache2.service - The Apache HTTP Server
Loaded: loaded (/lib/systemd/system/apache2.service; enabled; vendor preset: en
Drop-In: /lib/systemd/system/apache2.service.d
└─apache2-systemd.conf
Active: active (running) since Tue 2019-02-05 10:48:03 UTC; 1min 5s ago
Main PID: 2025 (apache2)
Tasks: 55 (limit: 2320)
CGroup: /system.slice/apache2.service
├─2025 /usr/sbin/apache2 -k start
├─2027 /usr/sbin/apache2 -k start
└─2028 /usr/sbin/apache2 -k start
Feb 05 10:48:02 ubuntuserver systemd[1]: Starting The Apache HTTP Server...
Feb 05 10:48:03 ubuntuserver apachectl[2003]: AH00558: apache2: Could not reliably
Feb 05 10:48:03 ubuntuserver systemd[1]: Started The Apache HTTP Server.
```
Congratulations! Apache service is up and running!!
##### 1.1 Adjust firewall to allow Apache web server
By default, the apache web browser cant be accessed from remote systems if you have enabled the UFW firewall in Ubuntu 18.04 LTS. You must allow the http and https ports by following the below steps.
First, list out the application profiles available on your Ubuntu system using command:
```
$ sudo ufw app list
```
Sample output:
```
Available applications:
Apache
Apache Full
Apache Secure
OpenSSH
```
As you can see, Apache and OpenSSH applications have installed UFW profiles. You can list out information about each profile and its included rules using “ **ufw app info “Profile Name”** command.
Let us look into the **“Apache Full”** profile. To do so, run:
```
$ sudo ufw app info "Apache Full"
```
Sample output:
```
Profile: Apache Full
Title: Web Server (HTTP,HTTPS)
Description: Apache v2 is the next generation of the omnipresent Apache web
server.
Ports:
80,443/tcp
```
As you see, “Apache Full” profile has included the rules to enable traffic to the ports **80** and **443** :
Now, run the following command to allow incoming HTTP and HTTPS traffic for this profile:
```
$ sudo ufw allow in "Apache Full"
Rules updated
Rules updated (v6)
```
If you dont want to allow https traffic, but only http (80) traffic, run:
```
$ sudo ufw app info "Apache"
```
##### 1.2 Test Apache Web server
Now, open your web browser and access Apache test page by navigating to **<http://localhost/>** or **<http://IP-Address/>**.
![](https://www.ostechnix.com/wp-content/uploads/2016/06/apache-2.png)
If you are see a screen something like above, you are good to go. Apache server is working!
#### 2. Install MySQL
To install MySQL On Ubuntu, run:
```
$ sudo apt install mysql-server
```
Verify if MySQL service is running or not using command:
```
$ sudo systemctl status mysql
```
**Sample output:**
```
● mysql.service - MySQL Community Server
Loaded: loaded (/lib/systemd/system/mysql.service; enabled; vendor preset: enab
Active: active (running) since Tue 2019-02-05 11:07:50 UTC; 17s ago
Main PID: 3423 (mysqld)
Tasks: 27 (limit: 2320)
CGroup: /system.slice/mysql.service
└─3423 /usr/sbin/mysqld --daemonize --pid-file=/run/mysqld/mysqld.pid
Feb 05 11:07:49 ubuntuserver systemd[1]: Starting MySQL Community Server...
Feb 05 11:07:50 ubuntuserver systemd[1]: Started MySQL Community Server.
```
Mysql is running!
##### 2.1 Setup database administrative user (root) password
By default, MySQL **root** user password is blank. You need to secure your MySQL server by running the following script:
```
$ sudo mysql_secure_installation
```
You will be asked whether you want to setup **VALIDATE PASSWORD plugin** or not. This plugin allows the users to configure strong password for database credentials. If enabled, It will automatically check the strength of the password and enforces the users to set only those passwords which are secure enough. **It is safe to leave this plugin disabled**. However, you must use a strong and unique password for database credentials. If dont want to enable this plugin, just press any key to skip the password validation part and continue the rest of the steps.
If your answer is **Yes** , you will be asked to choose the level of password validation.
```
Securing the MySQL server deployment.
Connecting to MySQL using a blank password.
VALIDATE PASSWORD PLUGIN can be used to test passwords
and improve security. It checks the strength of password
and allows the users to set only those passwords which are
secure enough. Would you like to setup VALIDATE PASSWORD plugin?
Press y|Y for Yes, any other key for No y
```
The available password validations are **low** , **medium** and **strong**. Just enter the appropriate number (0 for low, 1 for medium and 2 for strong password) and hit ENTER key.
```
There are three levels of password validation policy:
LOW Length >= 8
MEDIUM Length >= 8, numeric, mixed case, and special characters
STRONG Length >= 8, numeric, mixed case, special characters and dictionary file
Please enter 0 = LOW, 1 = MEDIUM and 2 = STRONG:
```
Now, enter the password for MySQL root user. Please be mindful that you must use password for mysql root user depending upon the password policy you choose in the previous step. If you didnt enable the plugin, just use any strong and unique password of your choice.
```
Please set the password for root here.
New password:
Re-enter new password:
Estimated strength of the password: 50
Do you wish to continue with the password provided?(Press y|Y for Yes, any other key for No) : y
```
Once you entered the password twice, you will see the password strength (In our case it is **50** ). If it is OK for you, press Y to continue with the provided password. If not satisfied with password length, press any other key and set a strong password. I am OK with my current password, so I chose **y**.
For the rest of questions, just type **y** and hit ENTER. This will remove anonymous user, disallow root user login remotely and remove test database.
```
Remove anonymous users? (Press y|Y for Yes, any other key for No) : y
Success.
Normally, root should only be allowed to connect from
'localhost'. This ensures that someone cannot guess at
the root password from the network.
Disallow root login remotely? (Press y|Y for Yes, any other key for No) : y
Success.
By default, MySQL comes with a database named 'test' that
anyone can access. This is also intended only for testing,
and should be removed before moving into a production
environment.
Remove test database and access to it? (Press y|Y for Yes, any other key for No) : y
- Dropping test database...
Success.
- Removing privileges on test database...
Success.
Reloading the privilege tables will ensure that all changes
made so far will take effect immediately.
Reload privilege tables now? (Press y|Y for Yes, any other key for No) : y
Success.
All done!
```
Thats it. Password for MySQL root user has been set.
##### 2.2 Change authentication method for MySQL root user
By default, MySQL root user is set to authenticate using the **auth_socket** plugin in MySQL 5.7 and newer versions on Ubuntu. Even though it enhances the security, it will also complicate things when you access your database server using any external programs, for example phpMyAdmin. To fix this issue, you need to change authentication method from **auth_socket** to **mysql_native_password**. To do so, login to your MySQL prompt using command:
```
$ sudo mysql
```
Run the following command at the mysql prompt to find the current authentication method for all mysql user accounts:
```
SELECT user,authentication_string,plugin,host FROM mysql.user;
```
**Sample output:**
```
+------------------|-------------------------------------------|-----------------------|-----------+
| user | authentication_string | plugin | host |
+------------------|-------------------------------------------|-----------------------|-----------+
| root | | auth_socket | localhost |
| mysql.session | *THISISNOTAVALIDPASSWORDTHATCANBEUSEDHERE | mysql_native_password | localhost |
| mysql.sys | *THISISNOTAVALIDPASSWORDTHATCANBEUSEDHERE | mysql_native_password | localhost |
| debian-sys-maint | *F126737722832701DD3979741508F05FA71E5BA0 | mysql_native_password | localhost |
+------------------|-------------------------------------------|-----------------------|-----------+
4 rows in set (0.00 sec)
```
![][2]
As you see, mysql root user uses `auth_socket` plugin for authentication.
To change this authentication to **mysql_native_password** method, run the following command at mysql prompt. Dont forget to replace **“password”** with a strong and unique password of your choice. If you have enabled VALIDATION plugin, make sure you have used a strong password based on the current policy requirements.
```
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'password';
```
Update the changes using command:
```
FLUSH PRIVILEGES;
```
Now check again if the authentication method is changed or not using command:
```
SELECT user,authentication_string,plugin,host FROM mysql.user;
```
Sample output:
![][3]
Good! Now the myql root user can authenticate using password to access mysql shell.
Exit from the mysql prompt:
```
exit
```
#### 3\. Install PHP
To install PHP, run:
```
$ sudo apt install php libapache2-mod-php php-mysql
```
After installing PHP, create **info.php** file in the Apache root document folder. Usually, the apache root document folder will be **/var/www/html/** or **/var/www/** in most Debian based Linux distributions. In Ubuntu 18.04 LTS, it is **/var/www/html/**.
Let us create **info.php** file in the apache root folder:
```
$ sudo vi /var/www/html/info.php
```
Add the following lines:
```
<?php
phpinfo();
?>
```
Press ESC key and type **:wq** to save and quit the file. Restart apache service to take effect the changes.
```
$ sudo systemctl restart apache2
```
##### 3.1 Test PHP
Open up your web browser and navigate to **<http://IP-address/info.php>** URL.
You will see the php test page now.
![](https://www.ostechnix.com/wp-content/uploads/2019/02/php-test-page.png)
Usually, when a user requests a directory from the web server, Apache will first look for a file named **index.html**. If you want to change Apache to serve php files rather than others, move **index.php** to first position in the **dir.conf** file as shown below
```
$ sudo vi /etc/apache2/mods-enabled/dir.conf
```
Here is the contents of the above file.
```
<IfModule mod_dir.c>
DirectoryIndex index.html index.cgi index.pl index.php index.xhtml index.htm
</IfModule>
# vim: syntax=apache ts=4 sw=4 sts=4 sr noet
```
Move the “index.php” file to first. Once you made the changes, your **dir.conf** file will look like below.
```
<IfModule mod_dir.c>
DirectoryIndex index.php index.html index.cgi index.pl index.xhtml index.htm
</IfModule>
# vim: syntax=apache ts=4 sw=4 sts=4 sr noet
```
Press **ESC** key and type **:wq** to save and close the file. Restart Apache service to take effect the changes.
```
$ sudo systemctl restart apache2
```
##### 3.2 Install PHP modules
To improve the functionality of PHP, you can install some additional PHP modules.
To list the available PHP modules, run:
```
$ sudo apt-cache search php- | less
```
**Sample output:**
![][4]
Use the arrow keys to go through the result. To exit, type **q** and hit ENTER key.
To find the details of any particular php module, for example **php-gd** , run:
```
$ sudo apt-cache show php-gd
```
To install a php module run:
```
$ sudo apt install php-gd
```
To install all modules (not necessary though), run:
```
$ sudo apt-get install php*
```
Do not forget to restart Apache service after installing any php module. To check if the module is loaded or not, open info.php file in your browser and check if it is present.
Next, you might want to install any database management tools to easily manage databases via a web browser. If so, install phpMyAdmin as described in the following link.
Congratulations! We have successfully setup LAMP stack in Ubuntu 18.04 LTS server.
--------------------------------------------------------------------------------
via: https://www.ostechnix.com/install-apache-mysql-php-lamp-stack-on-ubuntu-18-04-lts/
作者:[SK][a]
选题:[lujun9972][b]
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://www.ostechnix.com/author/sk/
[b]: https://github.com/lujun9972
[1]: data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7
[2]: http://www.ostechnix.com/wp-content/uploads/2019/02/mysql-1.png
[3]: http://www.ostechnix.com/wp-content/uploads/2019/02/mysql-2.png
[4]: http://www.ostechnix.com/wp-content/uploads/2016/06/php-modules.png

View File

@@ -0,0 +1,133 @@
[#]: collector: (lujun9972)
[#]: translator: ( )
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (Installing Kali Linux on VirtualBox: Quickest & Safest Way)
[#]: via: (https://itsfoss.com/install-kali-linux-virtualbox)
[#]: author: (Ankush Das https://itsfoss.com/author/ankush/)
Installing Kali Linux on VirtualBox: Quickest & Safest Way
======
**This tutorial shows you how to install Kali Linux on Virtual Box in Windows and Linux in the quickest way possible.**
[Kali Linux][1] is one of the [best Linux distributions for hacking][2] and security enthusiasts.
Since it deals with a sensitive topic like hacking, its like a double-edged sword. We have discussed it in the detailed Kali Linux review in the past so I am not going to bore you with the same stuff again.
While you can install Kali Linux by replacing the existing operating system, using it via a virtual machine would be a better and safer option.
With Virtual Box, you can use Kali Linux as a regular application in your Windows/Linux system. Its almost the same as running VLC or a game in your system.
Using Kali Linux in a virtual machine is also safe. Whatever you do inside Kali Linux will NOT impact your host system (i.e. your original Windows or Linux operating system). Your actual operating system will be untouched and your data in the host system will be safe.
![Kali Linux on Virtual Box][3]
### How to install Kali Linux on VirtualBox
Ill be using [VirtualBox][4] here. It is a wonderful open source virtualization solution for just about anyone (professional or personal use). Its available free of cost.
In this tutorial, we will talk about Kali Linux in particular but you can install almost any other OS whose ISO file exists or a pre-built virtual machine save file is available.
**Note:** The same steps apply for Windows/Linux running VirtualBox.
As I already mentioned, you can have either Windows or Linux installed as your host. But, in this case, I have Windows 10 installed (dont hate me!) where I try to install Kali Linux in VirtualBox step by step.
And, the best part is even if you happen to use a Linux distro as your primary OS, the same steps will be applicable!
Wondering, how? Lets see…
### Step by Step Guide to install Kali Linux on VirtualBox
We are going to use a custom Kali Linux image made for VirtualBox specifically. You can also download the ISO file for Kali Linux and create a new virtual machine but why do that when you have an easy alternative?
#### 1\. Download and install VirtualBox
The first thing you need to do is to download and install VirtualBox from Oracles official website.
[Download VirtualBox](https://www.virtualbox.org/wiki/Downloads)
Once you download the installer, just double click on it to install VirtualBox. Its the same for installing VirtualBox on Ubuntu/Fedora Linux as well.
#### 2\. Download ready-to-use virtual image of Kali Linux
After installing it successfully, head to [Offensive Securitys download page][5] to download the VM image for VirtualBox. If you change your mind to utilize [VMware][6], that is available too.
![Kali Linux Virtual Box Image][7]
As you can see the file size is well over 3 GB, you should either use the torrent option or download it using a [download manager][8].
#### 3\. Install Kali Linux on Virtual Box
Once you have installed VirtualBox and downloaded the Kali Linux image, you just need to import it to VirtualBox in order to make it work.
Heres how to import the VirtualBox image for Kali Linux:
**Step 1** : Launch VirtualBox. You will notice an **Import** button click on it
![virtualbox import][9] Click on Import button
**Step 2:** Next, browse the file you just downloaded and choose it to be imported (as you can see in the image below). The file name should start with kali linux and end with . **ova** extension.
![virtualbox import file][10] Importing Kali Linux image
**S** Once selected, proceed by clicking on **Next**.
**Step 3** : Now, you will be shown the settings for the virtual machine you are about to import. So, you can customize them or not that is your choice. It is okay if you go with the default settings.
You need to select a path where you have sufficient storage available. I would never recommend the **C:** drive on Windows.
![virtualbox kali linux settings][11] Import hard drives as VDI
Here, the hard drives as VDI refer to virtually mount the hard drives by allocating the storage space set.
After you are done with the settings, hit **Import** and wait for a while.
**Step 4:** You will now see it listed. So, just hit **Start** to launch it.
You might get an error at first for USB port 2.0 controller support, you can disable it to resolve it or just follow the on-screen instruction of installing an additional package to fix it. And, you are done!
![kali linux on windows virtual box][12]Kali Linux running in VirtualBox
I hope this guide helps you easily install Kali Linux on Virtual Box. Of course, Kali Linux has a lot of useful tools in it for penetration testing good luck with that!
**Tip** : Both Kali Linux and Ubuntu are Debian-based. If you face any issues or error with Kali Linux, you may follow the tutorials intended for Ubuntu or Debian on the internet.
### Bonus: Free Kali Linux Guide Book
If you are just starting with Kali Linux, it will be a good idea to know how to use Kali Linux.
Offensive Security, the company behind Kali Linux, has created a guide book that explains the basics of Linux, basics of Kali Linux, configuration, setups. It also has a few chapters on penetration testing and security tools.
Basically, it has everything you need to get started with Kali Linux. And the best thing is that the book is available to download for free.
Let us know in the comments below if you face an issue or simply share your experience with Kali Linux on VirtualBox.
--------------------------------------------------------------------------------
via: https://itsfoss.com/install-kali-linux-virtualbox
作者:[Ankush Das][a]
选题:[lujun9972][b]
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://itsfoss.com/author/ankush/
[b]: https://github.com/lujun9972
[1]: https://www.kali.org/
[2]: https://itsfoss.com/linux-hacking-penetration-testing/
[3]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/02/kali-linux-virtual-box.png?resize=800%2C450&ssl=1
[4]: https://www.virtualbox.org/
[5]: https://www.offensive-security.com/kali-linux-vm-vmware-virtualbox-image-download/
[6]: https://itsfoss.com/install-vmware-player-ubuntu-1310/
[7]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/02/kali-linux-virtual-box-image.jpg?resize=800%2C347&ssl=1
[8]: https://itsfoss.com/4-best-download-managers-for-linux/
[9]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/02/vmbox-import-kali-linux.jpg?ssl=1
[10]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/02/vmbox-linux-next.jpg?ssl=1
[11]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/02/vmbox-kali-linux-settings.jpg?ssl=1
[12]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/02/kali-linux-on-windows-virtualbox.jpg?resize=800%2C429&ssl=1
[13]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/02/kali-linux-virtual-box.png?fit=800%2C450&ssl=1

View File

@@ -0,0 +1,95 @@
[#]: collector: (lujun9972)
[#]: translator: (geekpi)
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (4 cool new projects to try in COPR for February 2019)
[#]: via: (https://fedoramagazine.org/4-cool-new-projects-to-try-in-copr-for-february-2019/)
[#]: author: (Dominik Turecek https://fedoramagazine.org)
4 cool new projects to try in COPR for February 2019
======
![](https://fedoramagazine.org/wp-content/uploads/2017/08/4-copr-945x400.jpg)
COPR is a [collection][1] of personal repositories for software that isnt carried in Fedora. Some software doesnt conform to standards that allow easy packaging. Or it may not meet other Fedora standards, despite being free and open source. COPR can offer these projects outside the Fedora set of packages. Software in COPR isnt supported by Fedora infrastructure or signed by the project. However, it can be a neat way to try new or experimental software.
Heres a set of new and interesting projects in COPR.
### CryFS
[CryFS][2] is a cryptographic filesystem. It is designed for use with cloud storage, mainly Dropbox, although it works with other storage providers as well. CryFS encrypts not only the files in the filesystem, but also metadata, file sizes and directory structure.
#### Installation instructions
The repo currently provides CryFS for Fedora 28 and 29, and for EPEL 7. To install CryFS, use these commands:
```
sudo dnf copr enable fcsm/cryfs
sudo dnf install cryfs
```
### Cheat
[Cheat][3] is a utility for viewing various cheatsheets in command-line, aiming to help remind usage of programs that are used only occasionally. For many Linux utilities, cheat provides cheatsheets containing condensed information from man pages, focusing mainly on the most used examples. In addition to the built-in cheatsheets, cheat allows you to edit the existing ones or creating new ones from scratch.
![][4]
#### Installation instructions
The repo currently provides cheat for Fedora 28, 29 and Rawhide, and for EPEL 7. To install cheat, use these commands:
```
sudo dnf copr enable tkorbar/cheat
sudo dnf install cheat
```
### Setconf
[Setconf][5] is a simple program for making changes in configuration files, serving as an alternative for sed. The only thing setconf does is that it finds the key in the specified file and changes its value. Setconf provides only a few options to change its behavior — for example, uncommenting the line that is being changed.
#### Installation instructions
The repo currently provides setconf for Fedora 27, 28 and 29. To install setconf, use these commands:
```
sudo dnf copr enable jamacku/setconf
sudo dnf install setconf
```
### Reddit Terminal Viewer
[Reddit Terminal Viewer][6], or rtv, is an interface for browsing Reddit from terminal. It provides the basic functionality of Reddit, so you can log in to your account, view subreddits, comment, upvote and discover new topics. Rtv currently doesnt, however, support Reddit tags.
![][7]
#### Installation instructions
The repo currently provides Reddit Terminal Viewer for Fedora 29 and Rawhide. To install Reddit Terminal Viewer, use these commands:
```
sudo dnf copr enable tc01/rtv
sudo dnf install rtv
```
--------------------------------------------------------------------------------
via: https://fedoramagazine.org/4-cool-new-projects-to-try-in-copr-for-february-2019/
作者:[Dominik Turecek][a]
选题:[lujun9972][b]
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://fedoramagazine.org
[b]: https://github.com/lujun9972
[1]: https://copr.fedorainfracloud.org/
[2]: https://www.cryfs.org/
[3]: https://github.com/chrisallenlane/cheat
[4]: https://fedoramagazine.org/wp-content/uploads/2019/01/cheat.png
[5]: https://setconf.roboticoverlords.org/
[6]: https://github.com/michael-lazar/rtv
[7]: https://fedoramagazine.org/wp-content/uploads/2019/01/rtv.png

View File

@@ -0,0 +1,211 @@
[#]: collector: (lujun9972)
[#]: translator: ( )
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (And, Ampersand, and & in Linux)
[#]: via: (https://www.linux.com/blog/learn/2019/2/and-ampersand-and-linux)
[#]: author: (Paul Brown https://www.linux.com/users/bro66)
And, Ampersand, and & in Linux
======
![](https://www.linux.com/sites/lcom/files/styles/rendered_file/public/ampersand.png?itok=7GdFO36Y)
Take a look at the tools covered in the [three][1] [previous][2] [articles][3], and you will see that understanding the glue that joins them together is as important as recognizing the tools themselves. Indeed, tools tend to be simple, and understanding what _mkdir_ , _touch_ , and _find_ do (make a new directory, update a file, and find a file in the directory tree, respectively) in isolation is easy.
But understanding what
```
mkdir test_dir 2>/dev/null || touch images.txt && find . -iname "*jpg" > backup/dir/images.txt &
```
does, and why we would write a command line like that is a whole different story.
It pays to look more closely at the sign and symbols that live between the commands. It will not only help you better understand how things work, but will also make you more proficient in chaining commands together to create compound instructions that will help you work more efficiently.
In this article and the next, we'll be looking at the the ampersand (`&`) and its close friend, the pipe (`|`), and see how they can mean different things in different contexts.
### Behind the Scenes
Let's start simple and see how you can use `&` as a way of pushing a command to the background. The instruction:
```
cp -R original/dir/ backup/dir/
```
Copies all the files and subdirectories in _original/dir/_ into _backup/dir/_. So far so simple. But if that turns out to be a lot of data, it could tie up your terminal for hours.
However, using:
```
cp -R original/dir/ backup/dir/ &
```
pushes the process to the background courtesy of the final `&`. This frees you to continue working on the same terminal or even to close the terminal and still let the process finish up. Do note, however, that if the process is asked to print stuff out to the standard output (like in the case of `echo` or `ls`), it will continue to do so, even though it is being executed in the background.
When you push a process into the background, Bash will print out a number. This number is the PID or the _Process' ID_. Every process running on your Linux system has a unique process ID and you can use this ID to pause, resume, and terminate the process it refers to. This will become useful later.
In the meantime, there are a few tools you can use to manage your processes as long as you remain in the terminal from which you launched them:
* `jobs` shows you the processes running in your current terminal, whether be it in the background or foreground. It also shows you a number associated with each job (different from the PID) that you can use to refer to each process:
```
$ jobs
[1]- Running cp -i -R original/dir/* backup/dir/ &
[2]+ Running find . -iname "*jpg" > backup/dir/images.txt &
```
* `fg` brings a job from the background to the foreground so you can interact with it. You tell `fg` which process you want to bring to the foreground with a percentage symbol (`%`) followed by the number associated with the job that `jobs` gave you:
```
$ fg %1 # brings the cp job to the foreground
cp -i -R original/dir/* backup/dir/
```
If the job was stopped (see below), `fg` will start it again.
* You can stop a job in the foreground by holding down [Ctrl] and pressing [Z]. This doesn't abort the action, it pauses it. When you start it again with (`fg` or `bg`) it will continue from where it left off...
...Except for [`sleep`][4]: the time a `sleep` job is paused still counts once `sleep` is resumed. This is because `sleep` takes note of the clock time when it was started, not how long it was running. This means that if you run `sleep 30` and pause it for more than 30 seconds, once you resume, `sleep` will exit immediately.
* The `bg` command pushes a job to the background and resumes it again if it was paused:
```
$ bg %1
[1]+ cp -i -R original/dir/* backup/dir/ &
```
As mentioned above, you won't be able to use any of these commands if you close the terminal from which you launched the process or if you change to another terminal, even though the process will still continue working.
To manage background processes from another terminal you need another set of tools. For example, you can tell a process to stop from a a different terminal with the [`kill`][5] command:
```
kill -s STOP <PID>
```
And you know the PID because that is the number Bash gave you when you started the process with `&`, remember? Oh! You didn't write it down? No problem. You can get the PID of any running process with the `ps` (short for _processes_ ) command. So, using
```
ps | grep cp
```
will show you all the processes containing the string " _cp_ ", including the copying job we are using for our example. It will also show you the PID:
```
$ ps | grep cp
14444 pts/3 00:00:13 cp
```
In this case, the PID is _14444_. and it means you can stop the background copying with:
```
kill -s STOP 14444
```
Note that `STOP` here does the same thing as [Ctrl] + [Z] above, that is, it pauses the execution of the process.
To start the paused process again, you can use the `CONT` signal:
```
kill -s CONT 14444
```
There is a good list of many of [the main signals you can send a process here][6]. According to that, if you wanted to terminate the process, not just pause it, you could do this:
```
kill -s TERM 14444
```
If the process refuses to exit, you can force it with:
```
kill -s KILL 14444
```
This is a bit dangerous, but very useful if a process has gone crazy and is eating up all your resources.
In any case, if you are not sure you have the correct PID, add the `x` option to `ps`:
```
$ ps x| grep cp
14444 pts/3 D 0:14 cp -i -R original/dir/Hols_2014.mp4
  original/dir/Hols_2015.mp4 original/dir/Hols_2016.mp4
  original/dir/Hols_2017.mp4 original/dir/Hols_2018.mp4 backup/dir/
```
And you should be able to see what process you need.
Finally, there is nifty tool that combines `ps` and `grep` all into one:
```
$ pgrep cp
8
18
19
26
33
40
47
54
61
72
88
96
136
339
6680
13735
14444
```
Lists all the PIDs of processes that contain the string " _cp_ ".
In this case, it isn't very helpful, but this...
```
$ pgrep -lx cp
14444 cp
```
... is much better.
In this case, `-l` tells `pgrep` to show you the name of the process and `-x` tells `pgrep` you want an exact match for the name of the command. If you want even more details, try `pgrep -ax command`.
### Next time
Putting an `&` at the end of commands has helped us explain the rather useful concept of processes working in the background and foreground and how to manage them.
One last thing before we leave: processes running in the background are what are known as _daemons_ in UNIX/Linux parlance. So, if you had heard the term before and wondered what they were, there you go.
As usual, there are more ways to use the ampersand within a command line, many of which have nothing to do with pushing processes into the background. To see what those uses are, we'll be back next week with more on the matter.
Read more:
[Linux Tools: The Meaning of Dot][1]
[Understanding Angle Brackets in Bash][2]
[More About Angle Brackets in Bash][3]
--------------------------------------------------------------------------------
via: https://www.linux.com/blog/learn/2019/2/and-ampersand-and-linux
作者:[Paul Brown][a]
选题:[lujun9972][b]
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://www.linux.com/users/bro66
[b]: https://github.com/lujun9972
[1]: https://www.linux.com/blog/learn/2019/1/linux-tools-meaning-dot
[2]: https://www.linux.com/blog/learn/2019/1/understanding-angle-brackets-bash
[3]: https://www.linux.com/blog/learn/2019/1/more-about-angle-brackets-bash
[4]: https://ss64.com/bash/sleep.html
[5]: https://bash.cyberciti.biz/guide/Sending_signal_to_Processes
[6]: https://www.computerhope.com/unix/signals.htm

View File

@@ -0,0 +1,126 @@
[#]: collector: (lujun9972)
[#]: translator: ( )
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (Getting started with Vim visual mode)
[#]: via: (https://opensource.com/article/19/2/getting-started-vim-visual-mode)
[#]: author: (Susan Lauber https://opensource.com/users/susanlauber)
Getting started with Vim visual mode
======
Visual mode makes it easier to highlight and manipulate text in Vim.
![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/programming_code_keyboard_orange_hands.png?itok=G6tJ_64Y)
Ansible playbook files are text files in a YAML format. People who work regularly with them have their favorite editors and plugin extensions to make the formatting easier.
When I teach Ansible with the default editor available in most Linux distributions, I use Vim's visual mode a lot. It allows me to highlight my actions on the screen—what I am about to edit and the text manipulation task I'm doing—to make it easier for my students to learn.
### Vim's visual mode
When editing text with Vim, visual mode can be extremely useful for identifying chunks of text to be manipulated.
Vim's visual mode has three versions: character, line, and block. The keystrokes to enter each mode are:
* Character mode: **v** (lower-case)
* Line mode: **V** (upper-case)
* Block mode: **Ctrl+v**
Here are some ways to use each mode to simplify your work.
### Character mode
Character mode can highlight a sentence in a paragraph or a phrase in a sentence. Then the visually identified text can be deleted, copied, changed, or modified with any other Vim editing command.
#### Move a sentence
To move a sentence from one place to another, start by opening the file and moving the cursor to the first character in the sentence you want to move.
![](https://opensource.com/sites/default/files/uploads/vim-visual-char1.png)
* Press the **v** key to enter visual character mode. The word **VISUAL** will appear at the bottom of the screen.
* Use the Arrow keys to highlight the desired text. You can use other navigation commands, such as **w** to highlight to the beginning of the next word or **$** to include the rest of the line.
* Once the text is highlighted, press the **d** key to delete the text.
* If you deleted too much or not enough, press **u** to undo and start again.
* Move your cursor to the new location and press **p** to paste the text.
#### Change a phrase
You can also highlight a chunk of text that you want to replace.
![](https://opensource.com/sites/default/files/uploads/vim-visual-char2.png)
* Place the cursor at the first character you want to change.
* Press **v** to enter visual character mode.
* Use navigation commands, such as the Arrow keys, to highlight the phrase.
* Press **c** to change the highlighted text.
* The highlighted text will disappear, and you will be in Insert mode where you can add new text.
* After you finish typing the new text, press **Esc** to return to command mode and save your work.
![](https://opensource.com/sites/default/files/uploads/vim-visual-char3.png)
### Line mode
When working with Ansible playbooks, the order of tasks can matter. Use visual line mode to move a task to a different location in the playbook.
#### Manipulate multiple lines of text
![](https://opensource.com/sites/default/files/uploads/vim-visual-line1.png)
* Place your cursor anywhere on the first or last line of the text you want to manipulate.
* Press **Shift+V** to enter line mode. The words **VISUAL LINE** will appear at the bottom of the screen.
* Use navigation commands, such as the Arrow keys, to highlight multiple lines of text.
* Once the desired text is highlighted, use commands to manipulate it. Press **d** to delete, then move the cursor to the new location, and press **p** to paste the text.
* **y** (yank) can be used instead of **d** (delete) if you want to copy the task.
#### Indent a set of lines
When working with Ansible playbooks or YAML files, indentation matters. A highlighted block can be shifted right or left with the **>** and **<** keys.
![]9https://opensource.com/sites/default/files/uploads/vim-visual-line2.png
* Press **>** to increase the indentation of all the lines.
* Press **<** to decrease the indentation of all the lines.
Try other Vim commands to apply them to the highlighted text.
### Block mode
The visual block mode is useful for manipulation of specific tabular data files, but it can also be extremely helpful as a tool to verify indentation of an Ansible playbook.
Tasks are a list of items and in YAML each list item starts with a dash followed by a space. The dashes must line up in the same column to be at the same indentation level. This can be difficult to see with just the human eye. Indentation of other lines within the task is also important.
#### Verify tasks lists are indented the same
![](https://opensource.com/sites/default/files/uploads/vim-visual-block1.png)
* Place your cursor on the first character of the list item.
* Press **Ctrl+v** to enter visual block mode. The words **VISUAL BLOCK** will appear at the bottom of the screen.
* Use the Arrow keys to highlight the single character column. You can verify that each task is indented the same amount.
* Use the Arrow keys to expand the block right or left to check whether the other indentation is correct.
![](https://opensource.com/sites/default/files/uploads/vim-visual-block2.png)
Even though I am comfortable with other Vim editing shortcuts, I still like to use visual mode to sort out what text I want to manipulate. When I demo other concepts during a presentation, my students see a tool to highlight text and hit delete in this "new to them" text only editor.
--------------------------------------------------------------------------------
via: https://opensource.com/article/19/2/getting-started-vim-visual-mode
作者:[Susan Lauber][a]
选题:[lujun9972][b]
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://opensource.com/users/susanlauber
[b]: https://github.com/lujun9972

View File

@@ -0,0 +1,325 @@
[#]: collector: (lujun9972)
[#]: translator: ( )
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (10 Methods To Create A File In Linux)
[#]: via: (https://www.2daygeek.com/linux-command-to-create-a-file/)
[#]: author: (Vinoth Kumar https://www.2daygeek.com/author/vinoth/)
10 Methods To Create A File In Linux
======
As we already know that everything is a file in Linux, that includes device as well.
Linux admin should be performing the file creation activity multiple times (It may 20 times or 50 times or more than that, its depends upon their environment) in a day.
Navigate to the following URL, if you would like to **[create a file in a specific size in Linux][1]**.
Its very important. how efficiently are we creating a file. Why im saying efficient? there is a lot of benefit if you know the efficient way to perform an activity.
It will save you a lot of time. You can spend those valuable time on other important or major tasks, where you want to spend some more time instead of doing that in hurry.
Here im including multiple ways to create a file in Linux. I advise you to choose few which is easy and efficient for you to perform your activity.
You no need to install any of the following commands because all these commands has been installed as part of Linux core utilities except nano command.
It can be done using the following 6 methods.
* **`Redirect Symbol (>):`** Standard redirect symbol allow us to create a 0KB empty file in Linux.
* **`touch:`** touch command can create a 0KB empty file if does not exist.
* **`echo:`** echo command is used to display line of text that are passed as an argument.
* **`printf:`** printf command is used to display the given text on the terminal window.
* **`cat:`** It concatenate files and print on the standard output.
* **`vi/vim:`** Vim is a text editor that is upwards compatible to Vi. It can be used to edit all kinds of plain text.
* **`nano:`** nano is a small and friendly editor. It copies the look and feel of Pico, but is free software.
* **`head:`** head is used to print the first part of files..
* **`tail:`** tail is used to print the last part of files..
* **`truncate:`** truncate is used to shrink or extend the size of a file to the specified size.
### How To Create A File In Linux Using Redirect Symbol (>)?
Standard redirect symbol allow us to create a 0KB empty file in Linux. Basically it used to redirect the output of a command to a new file. When you use redirect symbol without a command then its create a file.
But it wont allow you to input any text while creating a file. However, its very simple and will be useful for lazy admins. To do so, simple enter the redirect symbol followed by the filename which you want.
```
$ > daygeek.txt
```
Use the ls command to check the created file.
```
$ ls -lh daygeek.txt
-rw-rw-r-- 1 daygeek daygeek 0 Feb 4 02:00 daygeek.txt
```
### How To Create A File In Linux Using touch Command?
touch command is used to update the access and modification times of each FILE to the current time.
Its create a new file if does not exist. Also, touch command doesnt allow us to enter any text while creating a file. By default it creates a 0KB empty file.
```
$ touch daygeek1.txt
```
Use the ls command to check the created file.
```
$ ls -lh daygeek1.txt
-rw-rw-r-- 1 daygeek daygeek 0 Feb 4 02:02 daygeek1.txt
```
### How To Create A File In Linux Using echo Command?
echo is a built-in command found in most operating systems. It is frequently used in scripts, batch files, and as part of individual commands to insert a text.
This is nice command that allow users to input a text while creating a file. Also, it allow us to append the text in the next time.
```
$ echo "2daygeek.com is a best Linux blog to learn Linux" > daygeek2.txt
```
Use the ls command to check the created file.
```
$ ls -lh daygeek2.txt
-rw-rw-r-- 1 daygeek daygeek 49 Feb 4 02:04 daygeek2.txt
```
To view the content from the file, use the cat command.
```
$ cat daygeek2.txt
2daygeek.com is a best Linux blog to learn Linux
```
If you would like to append the content in the same file, use the double redirect Symbol (>>).
```
$ echo "It's FIVE years old blog" >> daygeek2.txt
```
You can view the appended content from the file using cat command.
```
$ cat daygeek2.txt
2daygeek.com is a best Linux blog to learn Linux
It's FIVE years old blog
```
### How To Create A File In Linux Using printf Command?
printf command also works in the same way like how echo command works.
printf command in Linux is used to display the given string on the terminal window. printf can have format specifiers, escape sequences or ordinary characters.
```
$ printf "2daygeek.com is a best Linux blog to learn Linux\n" > daygeek3.txt
```
Use the ls command to check the created file.
```
$ ls -lh daygeek3.txt
-rw-rw-r-- 1 daygeek daygeek 48 Feb 4 02:12 daygeek3.txt
```
To view the content from the file, use the cat command.
```
$ cat daygeek3.txt
2daygeek.com is a best Linux blog to learn Linux
```
If you would like to append the content in the same file, use the double redirect Symbol (>>).
```
$ printf "It's FIVE years old blog\n" >> daygeek3.txt
```
You can view the appended content from the file using cat command.
```
$ cat daygeek3.txt
2daygeek.com is a best Linux blog to learn Linux
It's FIVE years old blog
```
### How To Create A File In Linux Using cat Command?
cat stands for concatenate. It is very frequently used in Linux to reads data from a file.
cat is one of the most frequently used commands on Unix-like operating systems. Its offer three functions which is related to text file such as display content of a file, combine multiple files into the single output and create a new file.
```
$ cat > daygeek4.txt
2daygeek.com is a best Linux blog to learn Linux
It's FIVE years old blog
```
Use the ls command to check the created file.
```
$ ls -lh daygeek4.txt
-rw-rw-r-- 1 daygeek daygeek 74 Feb 4 02:18 daygeek4.txt
```
To view the content from the file, use the cat command.
```
$ cat daygeek4.txt
2daygeek.com is a best Linux blog to learn Linux
It's FIVE years old blog
```
If you would like to append the content in the same file, use the double redirect Symbol (>>).
```
$ cat >> daygeek4.txt
This website is maintained by Magesh M, It's licensed under CC BY-NC 4.0.
```
You can view the appended content from the file using cat command.
```
$ cat daygeek4.txt
2daygeek.com is a best Linux blog to learn Linux
It's FIVE years old blog
This website is maintained by Magesh M, It's licensed under CC BY-NC 4.0.
```
### How To Create A File In Linux Using vi/vim Command?
Vim is a text editor that is upwards compatible to Vi. It can be used to edit all kinds of plain text. It is especially useful for editing programs.
There are a lot of features are available in vim to edit a single file with the command.
```
$ vi daygeek5.txt
2daygeek.com is a best Linux blog to learn Linux
It's FIVE years old blog
```
Use the ls command to check the created file.
```
$ ls -lh daygeek5.txt
-rw-rw-r-- 1 daygeek daygeek 75 Feb 4 02:23 daygeek5.txt
```
To view the content from the file, use the cat command.
```
$ cat daygeek5.txt
2daygeek.com is a best Linux blog to learn Linux
It's FIVE years old blog
```
### How To Create A File In Linux Using nano Command?
Nanos is a another editor, an enhanced free Pico clone. nano is a small and friendly editor. It copies the look and feel of Pico, but is free software, and implements several features that Pico lacks, such as: opening multiple files, scrolling per line, undo/redo, syntax coloring, line numbering, and soft-wrapping overlong lines.
```
$ nano daygeek6.txt
2daygeek.com is a best Linux blog to learn Linux
It's FIVE years old blog
This website is maintained by Magesh M, It's licensed under CC BY-NC 4.0.
```
Use the ls command to check the created file.
```
$ ls -lh daygeek6.txt
-rw-rw-r-- 1 daygeek daygeek 148 Feb 4 02:26 daygeek6.txt
```
To view the content from the file, use the cat command.
```
$ cat daygeek6.txt
2daygeek.com is a best Linux blog to learn Linux
It's FIVE years old blog
This website is maintained by Magesh M, It's licensed under CC BY-NC 4.0.
```
### How To Create A File In Linux Using head Command?
head command is used to output the first part of files. By default it prints the first 10 lines of each FILE to standard output. With more than one FILE, precede each with a header giving the file name.
```
$ head -c 0K /dev/zero > daygeek7.txt
```
Use the ls command to check the created file.
```
$ ls -lh daygeek7.txt
-rw-rw-r-- 1 daygeek daygeek 0 Feb 4 02:30 daygeek7.txt
```
### How To Create A File In Linux Using tail Command?
tail command is used to output the last part of files. By default it prints the first 10 lines of each FILE to standard output. With more than one FILE, precede each with a header giving the file name.
```
$ tail -c 0K /dev/zero > daygeek8.txt
```
Use the ls command to check the created file.
```
$ ls -lh daygeek8.txt
-rw-rw-r-- 1 daygeek daygeek 0 Feb 4 02:31 daygeek8.txt
```
### How To Create A File In Linux Using truncate Command?
truncate command is used to shrink or extend the size of a file to the specified size.
```
$ truncate -s 0K daygeek9.txt
```
Use the ls command to check the created file.
```
$ ls -lh daygeek9.txt
-rw-rw-r-- 1 daygeek daygeek 0 Feb 4 02:37 daygeek9.txt
```
I have performed totally 10 commands in this article to test this. All together in the single output.
```
$ ls -lh daygeek*
-rw-rw-r-- 1 daygeek daygeek 0 Feb 4 02:02 daygeek1.txt
-rw-rw-r-- 1 daygeek daygeek 74 Feb 4 02:07 daygeek2.txt
-rw-rw-r-- 1 daygeek daygeek 74 Feb 4 02:15 daygeek3.txt
-rw-rw-r-- 1 daygeek daygeek 148 Feb 4 02:20 daygeek4.txt
-rw-rw-r-- 1 daygeek daygeek 75 Feb 4 02:23 daygeek5.txt
-rw-rw-r-- 1 daygeek daygeek 148 Feb 4 02:26 daygeek6.txt
-rw-rw-r-- 1 daygeek daygeek 148 Feb 4 02:32 daygeek7.txt
-rw-rw-r-- 1 daygeek daygeek 148 Feb 4 02:32 daygeek8.txt
-rw-rw-r-- 1 daygeek daygeek 148 Feb 4 02:38 daygeek9.txt
-rw-rw-r-- 1 daygeek daygeek 0 Feb 4 02:00 daygeek.txt
```
--------------------------------------------------------------------------------
via: https://www.2daygeek.com/linux-command-to-create-a-file/
作者:[Vinoth Kumar][a]
选题:[lujun9972][b]
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://www.2daygeek.com/author/vinoth/
[b]: https://github.com/lujun9972
[1]: https://www.2daygeek.com/create-a-file-in-specific-certain-size-linux/

View File

@@ -0,0 +1,227 @@
[#]: collector: (lujun9972)
[#]: translator: ( )
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (How to determine how much memory is installed, used on Linux systems)
[#]: via: (https://www.networkworld.com/article/3336174/linux/how-much-memory-is-installed-and-being-used-on-your-linux-systems.html)
[#]: author: (Sandra Henry-Stocker https://www.networkworld.com/author/Sandra-Henry_Stocker/)
How to determine how much memory is installed, used on Linux systems
======
![](https://images.idgesg.net/images/article/2019/02/memory-100787327-large.jpg)
There are numerous ways to get information on the memory installed on Linux systems and view how much of that memory is being used. Some commands provide an overwhelming amount of detail, while others provide succinct, though not necessarily easy-to-digest, answers. In this post, we'll look at some of the more useful tools for checking on memory and its usage.
Before we get into the details, however, let's review a few details. Physical memory and virtual memory are not the same. The latter includes disk space that configured to be used as swap. Swap may include partitions set aside for this usage or files that are created to add to the available swap space when creating a new partition may not be practical. Some Linux commands provide information on both.
Swap expands memory by providing disk space that can be used to house inactive pages in memory that are moved to disk when physical memory fills up.
One file that plays a role in memory management is **/proc/kcore**. This file looks like a normal (though extremely large) file, but it does not occupy disk space at all. Instead, it is a virtual file like all of the files in /proc.
```
$ ls -l /proc/kcore
-r--------. 1 root root 140737477881856 Jan 28 12:59 /proc/kcore
```
Interestingly, the two systems queried below do _not_ have the same amount of memory installed, yet the size of /proc/kcore is the same on both. The first of these two systems has 4 GB of memory installed; the second has 6 GB.
```
system1$ ls -l /proc/kcore
-r--------. 1 root root 140737477881856 Jan 28 12:59 /proc/kcore
system2$ ls -l /proc/kcore
-r-------- 1 root root 140737477881856 Feb 5 13:00 /proc/kcore
```
Explanations that claim the size of this file represents the amount of available virtual memory (maybe plus 4K) don't hold much weight. This number would suggest that the virtual memory on these systems is 128 terrabytes! That number seems to represent instead how much memory a 64-bit systems might be capable of addressing — not how much is available on the system. Calculations of what 128 terrabytes and that number, plus 4K would look like are fairly easy to make on the command line:
```
$ expr 1024 \* 1024 \* 1024 \* 1024 \* 128
140737488355328
$ expr 1024 \* 1024 \* 1024 \* 1024 \* 128 + 4096
140737488359424
```
Another and more human-friendly command for examining memory is the **free** command. It gives you an easy-to-understand report on memory.
```
$ free
total used free shared buff/cache available
Mem: 6102476 812244 4090752 13112 1199480 4984140
Swap: 2097148 0 2097148
```
With the **-g** option, free reports the values in gigabytes.
```
$ free -g
total used free shared buff/cache available
Mem: 5 0 3 0 1 4
Swap: 1 0 1
```
With the **-t** option, free shows the same values as it does with no options (don't confuse -t with terrabytes!) but by adding a total line at the bottom of its output.
```
$ free -t
total used free shared buff/cache available
Mem: 6102476 812408 4090612 13112 1199456 4983984
Swap: 2097148 0 2097148
Total: 8199624 812408 6187760
```
And, of course, you can choose to use both options.
```
$ free -tg
total used free shared buff/cache available
Mem: 5 0 3 0 1 4
Swap: 1 0 1
Total: 7 0 5
```
You might be disappointed in this report if you're trying to answer the question "How much RAM is installed on this system?" This is the same system shown in the example above that was described as having 6GB of RAM. That doesn't mean this report is wrong, but that it's the system's view of the memory it has at its disposal.
The free command also provides an option to update the display every X seconds (10 in the example below).
```
$ free -s 10
total used free shared buff/cache available
Mem: 6102476 812280 4090704 13112 1199492 4984108
Swap: 2097148 0 2097148
total used free shared buff/cache available
Mem: 6102476 812260 4090712 13112 1199504 4984120
Swap: 2097148 0 2097148
```
With **-l** , the free command provides high and low memory usage.
```
$ free -l
total used free shared buff/cache available
Mem: 6102476 812376 4090588 13112 1199512 4984000
Low: 6102476 2011888 4090588
High: 0 0 0
Swap: 2097148 0 2097148
```
Another option for looking at memory is the **/proc/meminfo** file. Like /proc/kcore, this is a virtual file and one that gives a useful report showing how much memory is installed, free and available. Clearly, free and available do not represent the same thing. MemFree seems to represent unused RAM. MemAvailable is an estimate of how much memory is available for starting new applications.
```
$ head -3 /proc/meminfo
MemTotal: 6102476 kB
MemFree: 4090596 kB
MemAvailable: 4984040 kB
```
If you only want to see total memory, you can use one of these commands:
```
$ awk '/MemTotal/ {print $2}' /proc/meminfo
6102476
$ grep MemTotal /proc/meminfo
MemTotal: 6102476 kB
```
The **DirectMap** entries break information on memory into categories.
```
$ grep DirectMap /proc/meminfo
DirectMap4k: 213568 kB
DirectMap2M: 6076416 kB
```
DirectMap4k represents the amount of memory being mapped to standard 4k pages, while DirectMap2M shows the amount of memory being mapped to 2MB pages.
The **getconf** command is one that will provide quite a bit more information than most of us want to contemplate.
```
$ getconf -a | more
LINK_MAX 65000
_POSIX_LINK_MAX 65000
MAX_CANON 255
_POSIX_MAX_CANON 255
MAX_INPUT 255
_POSIX_MAX_INPUT 255
NAME_MAX 255
_POSIX_NAME_MAX 255
PATH_MAX 4096
_POSIX_PATH_MAX 4096
PIPE_BUF 4096
_POSIX_PIPE_BUF 4096
SOCK_MAXBUF
_POSIX_ASYNC_IO
_POSIX_CHOWN_RESTRICTED 1
_POSIX_NO_TRUNC 1
_POSIX_PRIO_IO
_POSIX_SYNC_IO
_POSIX_VDISABLE 0
ARG_MAX 2097152
ATEXIT_MAX 2147483647
CHAR_BIT 8
CHAR_MAX 127
--More--
```
Pare that output down to something specific with a command like the one shown below, and you'll get the same kind of information provided by some of the commands above.
```
$ getconf -a | grep PAGES | awk 'BEGIN {total = 1} {if (NR == 1 || NR == 3) total *=$NF} END {print total / 1024" kB"}'
6102476 kB
```
That command calculates memory by multiplying the values in the first and last lines of output like this:
```
PAGESIZE 4096 <==
_AVPHYS_PAGES 1022511
_PHYS_PAGES 1525619 <==
```
Calculating that independently, we can see how that value is derived.
```
$ expr 4096 \* 1525619 / 1024
6102476
```
Clearly that's one of those commands that deserves to be turned into an alias!
Another command with very digestible output is **top**. In the first five lines of top's output, you'll see some numbers that show how memory is being used.
```
$ top
top - 15:36:38 up 8 days, 2:37, 2 users, load average: 0.00, 0.00, 0.00
Tasks: 266 total, 1 running, 265 sleeping, 0 stopped, 0 zombie
%Cpu(s): 0.2 us, 0.4 sy, 0.0 ni, 99.4 id, 0.0 wa, 0.0 hi, 0.0 si, 0.0 st
MiB Mem : 3244.8 total, 377.9 free, 1826.2 used, 1040.7 buff/cache
MiB Swap: 3536.0 total, 3535.7 free, 0.3 used. 1126.1 avail Mem
```
And finally a command that will answer the question "So, how much RAM is installed on this system?" in a succinct fashion:
```
$ sudo dmidecode -t 17 | grep "Size.*MB" | awk '{s+=$2} END {print s / 1024 "GB"}'
6GB
```
Depending on how much detail you want to see, Linux systems provide a lot of options for seeing how much memory is installed on your systems and how much is used and available.
Join the Network World communities on [Facebook][1] and [LinkedIn][2] to comment on topics that are top of mind.
--------------------------------------------------------------------------------
via: https://www.networkworld.com/article/3336174/linux/how-much-memory-is-installed-and-being-used-on-your-linux-systems.html
作者:[Sandra Henry-Stocker][a]
选题:[lujun9972][b]
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://www.networkworld.com/author/Sandra-Henry_Stocker/
[b]: https://github.com/lujun9972
[1]: https://www.facebook.com/NetworkWorld/
[2]: https://www.linkedin.com/company/network-world

View File

@@ -0,0 +1,185 @@
[#]: collector: (lujun9972)
[#]: translator: ( )
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (3 Ways to Install Deb Files on Ubuntu Linux)
[#]: via: (https://itsfoss.com/install-deb-files-ubuntu)
[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/)
3 Ways to Install Deb Files on Ubuntu Linux
======
**This beginner article explains how to install deb packages in Ubuntu. It also shows you how to remove those deb packages afterwards.**
This is another article in the Ubuntu beginner series. If you are absolutely new to Ubuntu, you might wonder about [how to install applications][1].
The easiest way is to use the Ubuntu Software Center. Search for an application by its name and install it from there.
Life would be too simple if you could find all the applications in the Software Center. But that does not happen, unfortunately.
Some software are available via DEB packages. These are archived files that end with .deb extension.
You can think of .deb files as the .exe files in Windows. You double click on the .exe file and it starts the installation procedure in Windows. DEB packages are pretty much the same.
You can find these DEB packages from the download section of the software providers website. For example, if you want to [install Google Chrome on Ubuntu][2], you can download the DEB package of Chrome from its website.
Now the question arises, how do you install deb files? There are multiple ways of installing DEB packages in Ubuntu. Ill show them to you one by one in this tutorial.
![Install deb files in Ubuntu][3]
### Installing .deb files in Ubuntu and Debian-based Linux Distributions
You can choose a GUI tool or a command line tool for installing a deb package. The choice is yours.
Lets go on and see how to install deb files.
#### Method 1: Use the default Software Center
The simplest method is to use the default software center in Ubuntu. You have to do nothing special here. Simply go to the folder where you have downloaded the .deb file (it should be the Downloads folder) and double click on this file.
![Google Chrome deb file on Ubuntu][4]Double click on the downloaded .deb file to start installation
It will open the software center and you should see the option to install the software. All you have to do is to hit the install button and enter your login password.
![Install Google Chrome in Ubuntu Software Center][5]The installation of deb file will be carried out via Software Center
See, its even simple than installing from a .exe files on Windows, isnt it?
#### Method 2: Use Gdebi application for installing deb packages with dependencies
Again, life would be a lot simpler if things always go smooth. But thats not life as we know it.
Now that you know that .deb files can be easily installed via Software Center, let me tell you about the dependency error that you may encounter with some packages.
What happens is that a program may be dependent on another piece of software (libraries). When the developer is preparing the DEB package for you, he/she may assume that your system already has that piece of software on your system.
But if thats not the case and your system doesnt have those required pieces of software, youll encounter the infamous dependency error.
The Software Center cannot handle such errors on its own so you have to use another tool called [gdebi][6].
gdebi is a lightweight GUI application that has the sole purpose of installing deb packages.
It identifies the dependencies and tries to install these dependencies along with installing the .deb files.
![gdebi handling dependency while installing deb package][7]Image Credit: [Xmodulo][8]
Personally, I prefer gdebi over software center for installing deb files. It is a lightweight application so the installation seems quicker. You can read in detail about [using gDebi and making it the default for installing DEB packages][6].
You can install gdebi from the software center or using the command below:
```
sudo apt install gdebi
```
#### Method 3: Install .deb files in command line using dpkg
If you want to install deb packages in command lime, you can use either apt command or dpkg command. Apt command actually uses [dpkg command][9] underneath it but apt is more popular and easy to use.
If you want to use the apt command for deb files, use it like this:
```
sudo apt install path_to_deb_file
```
If you want to use dpkg command for installing deb packages, heres how to do it:
```
sudo dpkg -i path_to_deb_file
```
In both commands, you should replace the path_to_deb_file with the path and name of the deb file you have downloaded.
![Install deb files using dpkg command in Ubuntu][10]Installing deb files using dpkg command in Ubuntu
If you get a dependency error while installing the deb packages, you may use the following command to fix the dependency issues:
```
sudo apt install -f
```
### How to remove deb packages
Removing a deb package is not a big deal as well. And no, you dont need the original deb file that you had used for installing the program.
#### Method 1: Remove deb packages using apt commands
All you need is the name of the program that you have installed and then you can use apt or dpkg to remove that program.
```
sudo apt remove program_name
```
Now the question comes, how do you find the exact program name that you need to use in the remove command? The apt command has a solution for that as well.
You can find the list of all installed files with apt command but manually going through this will be a pain. So you can use the grep command to search for your package.
For example, I installed AppGrid application in the previous section but if I want to know the exact program name, I can use something like this:
```
sudo apt list --installed | grep grid
```
This will give me all the packages that have grid in their name and from there, I can get the exact program name.
```
apt list --installed | grep grid
WARNING: apt does not have a stable CLI interface. Use with caution in scripts.
appgrid/now 0.298 all [installed,local]
```
As you can see, a program called appgrid has been installed. Now you can use this program name with the apt remove command.
#### Method 2: Remove deb packages using dpkg commands
You can use dpkg to find the installed programs name:
```
dpkg -l | grep grid
```
The output will give all the packages installed that has grid in its name.
```
dpkg -l | grep grid
ii appgrid 0.298 all Discover and install apps for Ubuntu
```
ii in the above command output means package has been correctly installed.
Now that you have the program name, you can use dpkg command to remove it:
```
dpkg -r program_name
```
**Tip: Updating deb packages**
Some deb packages (like Chrome) provide updates through system updates but for most other programs, youll have to remove the existing program and install the newer version.
I hope this beginner guide helped you to install deb packages on Ubuntu. I added the remove part so that youll have better control over the programs you installed.
--------------------------------------------------------------------------------
via: https://itsfoss.com/install-deb-files-ubuntu
作者:[Abhishek Prakash][a]
选题:[lujun9972][b]
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://itsfoss.com/author/abhishek/
[b]: https://github.com/lujun9972
[1]: https://itsfoss.com/remove-install-software-ubuntu/
[2]: https://itsfoss.com/install-chrome-ubuntu/
[3]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/02/deb-packages-ubuntu.png?resize=800%2C450&ssl=1
[4]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/01/install-google-chrome-ubuntu-4.jpeg?resize=800%2C347&ssl=1
[5]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/01/install-google-chrome-ubuntu-5.jpeg?resize=800%2C516&ssl=1
[6]: https://itsfoss.com/gdebi-default-ubuntu-software-center/
[7]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/01/gdebi-handling-dependency.jpg?ssl=1
[8]: http://xmodulo.com
[9]: https://help.ubuntu.com/lts/serverguide/dpkg.html.en
[10]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/02/install-deb-file-with-dpkg.png?ssl=1
[11]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/02/deb-packages-ubuntu.png?fit=800%2C450&ssl=1

View File

@@ -0,0 +1,114 @@
[#]: collector: (lujun9972)
[#]: translator: (LazyWolfLin)
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (7 steps for hunting down Python code bugs)
[#]: via: (https://opensource.com/article/19/2/steps-hunting-code-python-bugs)
[#]: author: (Maria Mckinley https://opensource.com/users/parody)
7 steps for hunting down Python code bugs
======
Learn some tricks to minimize the time you spend tracking down the reasons your code fails.
![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/bug-insect-butterfly-diversity-inclusion-2.png?itok=TcC9eews)
It is 3 pm on a Friday afternoon. Why? Because it is always 3 pm on a Friday when things go down. You get a notification that a customer has found a bug in your software. After you get over your initial disbelief, you contact DevOps to find out what is happening with the logs for your app, because you remember receiving a notification that they were being moved.
Turns out they are somewhere you can't get to, but they are in the process of being moved to a web application—so you will have this nifty application for searching and reading them, but of course, it is not finished yet. It should be up in a couple of days. I know, totally unrealistic situation, right? Unfortunately not; it seems logs or log messages often come up missing at just the wrong time. Before we track down the bug, a public service announcement: Check your logs to make sure they are where you think they are and logging what you think they should log, regularly. Amazing how these things just change when you aren't looking.
OK, so you found the logs or tried the call, and indeed, the customer has found a bug. Maybe you even think you know where the bug is.
You immediately open the file you think might be the problem and start poking around.
### 1. Don't touch your code yet
Go ahead and look at it, maybe even come up with a hypothesis. But before you start mucking about in the code, take that call that creates the bug and turn it into a test. This will be an integration test because although you may have suspicions, you do not yet know exactly where the problem is.
Make sure this test fails. This is important because sometimes the test you make doesn't mimic the broken call; this is especially true if you are using a web or other framework that can obfuscate the tests. Many things may be stored in variables, and it is unfortunately not always obvious, just by looking at the test, what call you are making in the test. I'm not going to say that I have created a test that passed when I was trying to imitate a broken call, but, well, I have, and I don't think that is particularly unusual. Learn from my mistakes.
### 2. Write a failing test
Now that you have a failing test or maybe a test with an error, it is time to troubleshoot. But before you do that, let's do a review of the stack, as this makes troubleshooting easier.
The stack consists of all of the tasks you have started but not finished. So, if you are baking a cake and adding the flour to the batter, then your stack would be:
* Make cake
* Make batter
* Add flour
You have started making your cake, you have started making the batter, and you are adding the flour. Greasing the pan is not on the list since you already finished that, and making the frosting is not on the list because you have not started that.
If you are fuzzy on the stack, I highly recommend playing around on [Python Tutor][1], where you can watch the stack as you execute lines of code.
Now, if something goes wrong with your Python program, the interpreter helpfully prints out the stack for you. This means that whatever the program was doing at the moment it became apparent that something went wrong is on the bottom.
### 3. Always check the bottom of the stack first
Not only is the bottom of the stack where you can see which error occurred, but often the last line of the stack is where you can find the issue. If the bottom doesn't help, and your code has not been linted in a while, it is amazing how helpful it can be to run. I recommend pylint or flake8. More often than not, it points right to where there is an error that I have been overlooking.
If the error is something that seems obscure, your next move might just be to Google it. You will have better luck if you don't include information that is relevant only to your code, like the name of variables, files, etc. If you are using Python 3 (which you should be), it's helpful to include the 3 in the search; otherwise, Python 2 solutions tend to dominate the top.
Once upon a time, developers had to troubleshoot without the benefit of a search engine. This was a dark time. Take advantage of all the tools available to you.
Unfortunately, sometimes the problem occurred earlier and only became apparent during the line executed on the bottom of the stack. Think about how forgetting to add the baking powder becomes obvious when the cake doesn't rise.
It is time to look up the stack. Chances are quite good that the problem is in your code, and not Python core or even third-party packages, so scan the stack looking for lines in your code first. Plus it is usually much easier to put a breakpoint in your own code. Stick the breakpoint in your code a little further up the stack and look around to see if things look like they should.
"But Maria," I hear you say, "this is all helpful if I have a stack trace, but I just have a failing test. Where do I start?"
Pdb, the Python Debugger.
Find a place in your code where you know this call should hit. You should be able to find at least one place. Stick a pdb break in there.
#### A digression
Why not a print statement? I used to depend on print statements. They still come in handy sometimes. But once I started working with complicated code bases, and especially ones making network calls, print just became too slow. I ended up with print statements all over the place, I lost track of where they were and why, and it just got complicated. But there is a more important reason to mostly use pdb. Let's say you put a print statement in and discover that something is wrong—and must have gone wrong earlier. But looking at the function where you put the print statement, you have no idea how you got there. Looking at code is a great way to see where you are going, but it is terrible for learning where you've been. And yes, I have done a grep of my code base looking for where a function is called, but this can get tedious and doesn't narrow it down much with a popular function. Pdb can be very helpful.
You follow my advice, and put in a pdb break and run your test. And it whooshes on by and fails again, with no break at all. Leave your breakpoint in, and run a test already in your test suite that does something very similar to the broken test. If you have a decent test suite, you should be able to find a test that is hitting the same code you think your failed test should hit. Run that test, and when it gets to your breakpoint, do a `w` and look at the stack. If you have no idea by looking at the stack how/where the other call may have gone haywire, then go about halfway up the stack, find some code that belongs to you, and put a breakpoint in that file, one line above the one in the stack trace. Try again with the new test. Keep going back and forth, moving up the stack to figure out where your call went off the rails. If you get all the way up to the top of the trace without hitting a breakpoint, then congratulations, you have found the issue: Your app was spelled wrong. No experience here, nope, none at all.
### 4. Change things
If you still feel lost, try making a new test where you vary something slightly. Can you get the new test to work? What is different? What is the same? Try changing something else. Once you have your test, and maybe additional tests in place, it is safe to start changing things in the code to see if you can narrow down the problem. Remember to start troubleshooting with a fresh commit so you can easily back out changes that do not help. (This is a reference to version control, if you aren't using version control, it will change your life. Well, maybe it will just make coding easier. See "[A Visual Guide to Version Control][2]" for a nice introduction.)
### 5. Take a break
In all seriousness, when it stops feeling like a fun challenge or game and starts becoming really frustrating, your best course of action is to walk away from the problem. Take a break. I highly recommend going for a walk and trying to think about something else.
### 6. Write everything down
When you come back, if you aren't suddenly inspired to try something, write down any information you have about the problem. This should include:
* Exactly the call that is causing the problem
* Exactly what happened, including any error messages or related log messages
* Exactly what you were expecting to happen
* What you have done so far to find the problem and any clues that you have discovered while troubleshooting
Sometimes this is a lot of information, but trust me, it is really annoying trying to pry information out of someone piecemeal. Try to be concise, but complete.
### 7. Ask for help
I often find that just writing down all the information triggers a thought about something I have not tried yet. Sometimes, of course, I realize what the problem is immediately after hitting the submit button. At any rate, if you still have not thought of anything after writing everything down, try sending an email to someone. First, try colleagues or other people involved in your project, then move on to project email lists. Don't be afraid to ask for help. Most people are kind and helpful, and I have found that to be especially true in the Python community.
Maria McKinley will present [Hunting the Bugs][3] at [PyCascades 2019][4], February 23-24 in Seattle.
--------------------------------------------------------------------------------
via: https://opensource.com/article/19/2/steps-hunting-code-python-bugs
作者:[Maria Mckinley][a]
选题:[lujun9972][b]
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://opensource.com/users/parody
[b]: https://github.com/lujun9972
[1]: http://www.pythontutor.com/
[2]: https://betterexplained.com/articles/a-visual-guide-to-version-control/
[3]: https://2019.pycascades.com/talks/hunting-the-bugs
[4]: https://2019.pycascades.com/

View File

@@ -0,0 +1,153 @@
[#]: collector: (lujun9972)
[#]: translator: ( )
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (How To Install And Use PuTTY On Linux)
[#]: via: (https://www.ostechnix.com/how-to-install-and-use-putty-on-linux/)
[#]: author: (SK https://www.ostechnix.com/author/sk/)
How To Install And Use PuTTY On Linux
======
![](https://www.ostechnix.com/wp-content/uploads/2019/02/putty-720x340.png)
**PuTTY** is a free and open source GUI client that supports wide range of protocols including SSH, Telnet, Rlogin and serial for Windows and Unix-like operating systems. Generally, Windows admins use PuTTY as a SSH and telnet client to access the remote Linux servers from their local Windows systems. However, PuTTY is not limited to Windows. It is also popular among Linux users as well. This guide explains how to install PuTTY on Linux and how to access and manage the remote Linux servers using PuTTY.
### Install PuTTY on Linux
PuTTY is available in the official repositories of most Linux distributions. For instance, you can install PuTTY on Arch Linux and its variants using the following command:
```
$ sudo pacman -S putty
```
On Debian, Ubuntu, Linux Mint:
```
$ sudo apt install putty
```
### How to use PuTTY to access remote Linux systems
Once PuTTY is installed, launch it from the menu or from your application launcher. Alternatively, you can launch it from the Terminal by running the following command:
```
$ putty
```
This is how PuTTY default interface looks like.
![](https://www.ostechnix.com/wp-content/uploads/2019/02/putty-default-interface.png)
As you can see, most of the options are self-explanatory. On the left pane of the PuTTY interface, you can do/edit/modify various configurations such as,
1. PuTTY session logging,
2. Options for controlling the terminal emulation, control and change effects of keys,
3. Control terminal bell sounds,
4. Enable/disable Terminal advanced features,
5. Set the size of PuTTY window,
6. Control the scrollback in PuTTY window (Default is 2000 lines),
7. Change appearance of PuTTY window and cursor,
8. Adjust windows border,
9. Change fonts for texts in PuTTY window,
10. Save login details,
11. Set proxy details,
12. Options to control various protocols such as SSH, Telnet, Rlogin, Serial etc.
13. And more.
All options are categorized under a distinct name for ease of understanding.
### Access a remote Linux server using PuTTY
Click on the **Session** tab on the left pane. Enter the hostname (or IP address) of your remote system you want to connect to. Next choose the connection type, for example Telnet, Rlogin, SSH etc. The default port number will be automatically selected depending upon the connection type you choose. For example if you choose SSH, port number 22 will be selected. For Telnet, port number 23 will be selected and so on. If you have changed the default port number, dont forget to mention it in the **Port** section. I am going to access my remote via SSH, hence I choose SSH connection type. After entering the Hostname or IP address of the system, click **Open**.
![](http://www.ostechnix.com/wp-content/uploads/2019/02/putty-1.png)
If this is the first time you have connected to this remote system, PuTTY will display a security alert dialog box that asks whether you trust the host you are connecting to. Click **Accept** to add the remote systems host key to the PuTTYs cache:
![][2]
Next enter your remote systems user name and password. Congratulations! Youve successfully connected to your remote system via SSH using PuTTY.
![](https://www.ostechnix.com/wp-content/uploads/2019/02/putty-3.png)
**Access remote systems configured with key-based authentication**
Some Linux administrators might have configured their remote servers with key-based authentication. For example, when accessing AMS instances from PuTTY, you need to specify the key files location. PuTTY supports public key authentication and uses its own key format ( **.ppk** files).
Enter the hostname or IP address in the Session section. Next, In the **Category** pane, expand **Connection** , expand **SSH** , and then choose **Auth**. Browse the location of the **.ppk** key file and click **Open**.
![][3]
Click Accept to add the host key if it is the first time you are connecting to the remote system. Finally, enter the remote systems passphrase (if the key is protected with a passphrase while generating it) to connect.
**Save PuTTY sessions**
Sometimes, you want to connect to the remote system multiple times. If so, you can save the session and load it whenever you want without having to type the hostname or ip address, port number every time.
Enter the hostname (or IP address) and provide a session name and click **Save**. If you have key file, make sure you have already given the location before hitting the Save button.
![][4]
Now, choose session name under the **Saved sessions** tab and click **Load** and click **Open** to launch it.
**Transferring files to remote systems using the PuTTY Secure Copy Client (pscp)
**
Usually, the Linux users and admins use **scp** command line tool to transfer files from local Linux system to the remote Linux servers. PuTTY does have a dedicated client named **PuTTY Secure Copy Clinet** ( **PSCP** in short) to do this job. If youre using windows os in your local system, you may need this tool to transfer files from local system to remote systems. PSCP can be used in both Linux and Windows systems.
The following command will copy **file.txt** to my remote Ubuntu system from Arch Linux.
```
pscp -i test.ppk file.txt sk@192.168.225.22:/home/sk/
```
Here,
* **-i test.ppk** : Key file to access remote system,
* **file.txt** : file to be copied to remote system,
* **sk@192.168.225.22** : username and ip address of remote system,
* **/home/sk/** : Destination path.
To copy a directory. use **-r** (recursive) option like below:
```
pscp -i test.ppk -r dir/ sk@192.168.225.22:/home/sk/
```
To transfer files from Windows to remote Linux server using pscp, run the following command from command prompt:
```
pscp -i test.ppk c:\documents\file.txt.txt sk@192.168.225.22:/home/sk/
```
You know now what is PuTTY, how to install and use it to access remote systems. Also, you have learned how to transfer files to the remote systems from the local system using pscp program.
And, thats all for now. Hope this was useful. More good stuffs to come. Stay tuned!
Cheers!
--------------------------------------------------------------------------------
via: https://www.ostechnix.com/how-to-install-and-use-putty-on-linux/
作者:[SK][a]
选题:[lujun9972][b]
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://www.ostechnix.com/author/sk/
[b]: https://github.com/lujun9972
[1]: data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7
[2]: http://www.ostechnix.com/wp-content/uploads/2019/02/putty-2.png
[3]: http://www.ostechnix.com/wp-content/uploads/2019/02/putty-4.png
[4]: http://www.ostechnix.com/wp-content/uploads/2019/02/putty-5.png

View File

@@ -0,0 +1,192 @@
[#]: collector: (lujun9972)
[#]: translator: ( )
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (How To Remove/Delete The Empty Lines In A File In Linux)
[#]: via: (https://www.2daygeek.com/remove-delete-empty-lines-in-a-file-in-linux/)
[#]: author: (Magesh Maruthamuthu https://www.2daygeek.com/author/magesh/)
How To Remove/Delete The Empty Lines In A File In Linux
======
Some times you may wants to remove or delete the empty lines in a file in Linux.
If so, you can use the one of the below method to achieve it.
It can be done in many ways but i have listed simple methods in the article.
You may aware of that grep, awk and sed commands are specialized for textual data manipulation.
Navigate to the following URL, if you would like to read more about these kind of topics. For **[creating a file in specific size in Linux][1]** multiple ways, for **[creating a file in Linux][2]** multiple ways and for **[removing a matching string from a file in Linux][3]**.
These are fall in advanced commands category because these are used in most of the shell script to do required things.
It can be done using the following 5 methods.
* **`sed Command:`** Stream editor for filtering and transforming text.
* **`grep Command:`** Print lines that match patterns.
* **`cat Command:`** It concatenate files and print on the standard output.
* **`tr Command:`** Translate or delete characters.
* **`awk Command:`** The awk utility shall execute programs written in the awk programming language, which is specialized for textual data manipulation.
* **`perl Command:`** Perl is a programming language specially designed for text editing.
To test this, i had already created the file called `2daygeek.txt` with some texts and empty lines. The details are below.
```
$ cat 2daygeek.txt
2daygeek.com is a best Linux blog to learn Linux.
It's FIVE years old blog.
This website is maintained by Magesh M, it's licensed under CC BY-NC 4.0.
He got two GIRL babys.
Her names are Tanisha & Renusha.
```
Now everything is ready and im going to test this in multiple ways.
### How To Remove/Delete The Empty Lines In A File In Linux Using sed Command?
Sed is a stream editor. A stream editor is used to perform basic text transformations on an input stream (a file or input from a pipeline).
```
$ sed '/^$/d' 2daygeek.txt
2daygeek.com is a best Linux blog to learn Linux.
It's FIVE years old blog.
This website is maintained by Magesh M, it's licensed under CC BY-NC 4.0.
He got two GIRL babes.
Her names are Tanisha & Renusha.
```
Details are follow:
* **`sed:`** Its a command
* **`//:`** It holds the searching string.
* **`^:`** Matches start of string.
* **`$:`** Matches end of string.
* **`d:`** Delete the matched string.
* **`2daygeek.txt:`** Source file name.
### How To Remove/Delete The Empty Lines In A File In Linux Using grep Command?
grep searches for PATTERNS in each FILE. PATTERNS is one or patterns separated by newline characters, and grep prints each line that matches a pattern.
```
$ grep . 2daygeek.txt
or
$ grep -Ev "^$" 2daygeek.txt
or
$ grep -v -e '^$' 2daygeek.txt
2daygeek.com is a best Linux blog to learn Linux.
It's FIVE years old blog.
This website is maintained by Magesh M, it's licensed under CC BY-NC 4.0.
He got two GIRL babes.
Her names are Tanisha & Renusha.
```
Details are follow:
* **`grep:`** Its a command
* **`.:`** Replaces any character.
* **`^:`** matches start of string.
* **`$:`** matches end of string.
* **`E:`** For extended regular expressions pattern matching.
* **`e:`** For regular expressions pattern matching.
* **`v:`** To select non-matching lines from the file.
* **`2daygeek.txt:`** Source file name.
### How To Remove/Delete The Empty Lines In A File In Linux Using awk Command?
The awk utility shall execute programs written in the awk programming language, which is specialized for textual data manipulation. An awk program is a sequence of patterns and corresponding actions.
```
$ awk NF 2daygeek.txt
or
$ awk '!/^$/' 2daygeek.txt
or
$ awk '/./' 2daygeek.txt
2daygeek.com is a best Linux blog to learn Linux.
It's FIVE years old blog.
This website is maintained by Magesh M, it's licensed under CC BY-NC 4.0.
He got two GIRL babes.
Her names are Tanisha & Renusha.
```
Details are follow:
* **`awk:`** Its a command
* **`//:`** It holds the searching string.
* **`^:`** matches start of string.
* **`$:`** matches end of string.
* **`.:`** Replaces any character.
* **`!:`** Delete the matched string.
* **`2daygeek.txt:`** Source file name.
### How To Delete The Empty Lines In A File In Linux using Combination of cat And tr Command?
cat stands for concatenate. It is very frequently used in Linux to reads data from a file.
cat is one of the most frequently used commands on Unix-like operating systems. Its offer three functions which is related to text file such as display content of a file, combine multiple files into the single output and create a new file.
Translate, squeeze, and/or delete characters from standard input, writing to standard output.
```
$ cat 2daygeek.txt | tr -s '\n'
2daygeek.com is a best Linux blog to learn Linux.
It's FIVE years old blog.
This website is maintained by Magesh M, it's licensed under CC BY-NC 4.0.
He got two GIRL babes.
Her names are Tanisha & Renusha.
```
Details are follow:
* **`cat:`** Its a command
* **`tr:`** Its a command
* **`|:`** Pipe symbol. It pass first command output as a input to another command.
* **`s:`** Replace each sequence of a repeated character that is listed in the last specified SET.
* **`\n:`** To add a new line.
* **`2daygeek.txt:`** Source file name.
### How To Remove/Delete The Empty Lines In A File In Linux Using perl Command?
Perl stands in for “Practical Extraction and Reporting Language”. Perl is a programming language specially designed for text editing. It is now widely used for a variety of purposes including Linux system administration, network programming, web development, etc.
```
$ perl -ne 'print if /\S/' 2daygeek.txt
2daygeek.com is a best Linux blog to learn Linux.
It's FIVE years old blog.
This website is maintained by Magesh M, it's licensed under CC BY-NC 4.0.
He got two GIRL babes.
Her names are Tanisha & Renusha.
```
--------------------------------------------------------------------------------
via: https://www.2daygeek.com/remove-delete-empty-lines-in-a-file-in-linux/
作者:[Magesh Maruthamuthu][a]
选题:[lujun9972][b]
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://www.2daygeek.com/author/magesh/
[b]: https://github.com/lujun9972
[1]: https://www.2daygeek.com/create-a-file-in-specific-certain-size-linux/
[2]: https://www.2daygeek.com/linux-command-to-create-a-file/
[3]: https://www.2daygeek.com/empty-a-file-delete-contents-lines-from-a-file-remove-matching-string-from-a-file-remove-empty-blank-lines-from-a-file/

View File

@@ -0,0 +1,107 @@
[#]: collector: (lujun9972)
[#]: translator: ( )
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (How does rootless Podman work?)
[#]: via: (https://opensource.com/article/19/2/how-does-rootless-podman-work)
[#]: author: (Daniel J Walsh https://opensource.com/users/rhatdan)
How does rootless Podman work?
======
Learn how Podman takes advantage of user namespaces to run in rootless mode.
![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/code_computer_development_programming.png?itok=4OM29-82)
In my [previous article][1] on user namespace and [Podman][2], I discussed how you can use Podman commands to launch different containers with different user namespaces giving you better separation between containers. Podman also takes advantage of user namespaces to be able to run in rootless mode. Basically, when a non-privileged user runs Podman, the tool sets up and joins a user namespace. After Podman becomes root inside of the user namespace, Podman is allowed to mount certain filesystems and set up the container. Note there is no privilege escalation here other then additional UIDs available to the user, explained below.
### How does Podman create the user namespace?
#### shadow-utils
Most current Linux distributions include a version of shadow-utils that uses the **/etc/subuid** and **/etc/subgid** files to determine what UIDs and GIDs are available for a user in a user namespace.
```
$ cat /etc/subuid
dwalsh:100000:65536
test:165536:65536
$ cat /etc/subgid
dwalsh:100000:65536
test:165536:65536
```
The useradd program automatically allocates 65536 UIDs for each user added to the system. If you have existing users on a system, you would need to allocate the UIDs yourself. The format of these files is **username:STARTUID:TOTALUIDS**. Meaning in my case, dwalsh is allocated UIDs 100000 through 165535 along with my default UID, which happens to be 3265 defined in /etc/passwd. You need to be careful when allocating these UID ranges that they don't overlap with any **real** UID on the system. If you had a user listed as UID 100001, now I (dwalsh) would be able to become this UID and potentially read/write/execute files owned by the UID.
Shadow-utils also adds two setuid programs (or setfilecap). On Fedora I have:
```
$ getcap /usr/bin/newuidmap
/usr/bin/newuidmap = cap_setuid+ep
$ getcap /usr/bin/newgidmap
/usr/bin/newgidmap = cap_setgid+ep
```
Podman executes these files to set up the user namespace. You can see the mappings by examining /proc/self/uid_map and /proc/self/gid_map from inside of the rootless container.
```
$ podman run alpine cat /proc/self/uid_map /proc/self/gid_map
        0       3267            1
        1       100000          65536
        0       3267            1
        1       100000          65536
```
As seen above, Podman defaults to mapping root in the container to your current UID (3267) and then maps ranges of allocated UIDs/GIDs in /etc/subuid and /etc/subgid starting at 1. Meaning in my example, UID=1 in the container is UID 100000, UID=2 is UID 100001, all the way up to 65536, which is 165535.
Any item from outside of the user namespace that is owned by a UID or GID that is not mapped into the user namespace appears to belong to the user configured in the **kernel.overflowuid** sysctl, which by default is 35534, which my /etc/passwd file says has the name **nobody**. Since your process can't run as an ID that isn't mapped, the owner and group permissions don't apply, so you can only access these files based on their "other" permissions. This includes all files owned by **real** root on the system running the container, since root is not mapped into the user namespace.
The [Buildah][3] command has a cool feature, [**buildah unshare**][4]. This puts you in the same user namespace that Podman runs in, but without entering the container's filesystem, so you can list the contents of your home directory.
```
$ ls -ild /home/dwalsh
8193 drwx--x--x. 290 dwalsh dwalsh 20480 Jan 29 07:58 /home/dwalsh
$ buildah unshare ls -ld /home/dwalsh
drwx--x--x. 290 root root 20480 Jan 29 07:58 /home/dwalsh
```
Notice that when listing the home dir attributes outside the user namespace, the kernel reports the ownership as dwalsh, while inside the user namespace it reports the directory as owned by root. This is because the home directory is owned by 3267, and inside the user namespace we are treating that UID as root.
### What happens next in Podman after the user namespace is set up?
Podman uses [containers/storage][5] to pull the container image, and containers/storage is smart enough to map all files owned by root in the image to the root of the user namespace, and any other files owned by different UIDs to their user namespace UIDs. By default, this content gets written to ~/.local/share/containers/storage. Container storage works in rootless mode with either the vfs mode or with Overlay. Note: Overlay is supported only if the [fuse-overlayfs][6] executable is installed.
The kernel only allows user namespace root to mount certain types of filesystems; at this time it allows mounting of procfs, sysfs, tmpfs, fusefs, and bind mounts (as long as the source and destination are owned by the user running Podman. OverlayFS is not supported yet, although the kernel teams are working on allowing it).
Podman then mounts the container's storage if it is using fuse-overlayfs; if the storage driver is using vfs, then no mounting is required. Podman on vfs requires a lot of space though, since each container copies the entire underlying filesystem.
Podman then mounts /proc and /sys along with a few tmpfs and creates the devices in the container.
In order to use networking other than the host networking, Podman uses the [slirp4netns][7] program to set up **User mode networking for unprivileged network namespace**. Slirp4netns allows Podman to expose ports within the container to the host. Note that the kernel still will not allow a non-privileged process to bind to ports less than 1024. Podman-1.1 or later is required for binding to ports.
Rootless Podman can use user namespace for container separation, but you only have access to the UIDs defined in the /etc/subuid file.
### Conclusion
The Podman tool is enabling people to build and use containers without sacrificing the security of the system; you can give your developers the access they need without giving them root.
And when you put your containers into production, you can take advantage of the extra security provided by the user namespace to keep the workloads isolated from each other.
--------------------------------------------------------------------------------
via: https://opensource.com/article/19/2/how-does-rootless-podman-work
作者:[Daniel J Walsh][a]
选题:[lujun9972][b]
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://opensource.com/users/rhatdan
[b]: https://github.com/lujun9972
[1]: https://opensource.com/article/18/12/podman-and-user-namespaces
[2]: https://podman.io/
[3]: https://buildah.io/
[4]: https://github.com/containers/buildah/blob/master/docs/buildah-unshare.md
[5]: https://github.com/containers/storage
[6]: https://github.com/containers/fuse-overlayfs
[7]: https://github.com/rootless-containers/slirp4netns

View File

@@ -0,0 +1,68 @@
[#]: collector: (lujun9972)
[#]: translator: ( )
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (What's the right amount of swap space for a modern Linux system?)
[#]: via: (https://opensource.com/article/19/2/swap-space-poll)
[#]: author: (David Both https://opensource.com/users/dboth)
What's the right amount of swap space for a modern Linux system?
======
Complete our survey and voice your opinion on how much swap space to allocate.
![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/find-file-linux-code_magnifying_glass_zero.png?itok=E2HoPDg0)
Swap space is one of those things that everyone seems to have an idea about, and I am no exception. All my sysadmin friends have their opinions, and most distributions make recommendations too.
Many years ago, the rule of thumb for the amount of swap space that should be allocated was 2X the amount of RAM installed in the computer. Of course that was when a typical computer's RAM was measured in KB or MB. So if a computer had 64KB of RAM, a swap partition of 128KB would be an optimum size.
This took into account the fact that RAM memory sizes were typically quite small, and allocating more than 2X RAM for swap space did not improve performance. With more than twice RAM for swap, most systems spent more time thrashing than performing useful work.
RAM memory has become quite inexpensive and many computers now have RAM in the tens of gigabytes. Most of my newer computers have at least 4GB or 8GB of RAM, two have 32GB, and my main workstation has 64GB. When dealing with computers with huge amounts of RAM, the limiting performance factor for swap space is far lower than the 2X multiplier. As a consequence, recommended swap space is considered a function of system memory workload, not system memory.
Table 1 provides the Fedora Project's recommended size for a swap partition, depending on the amount of RAM in your system and whether you want enough memory for your system to hibernate. To allow for hibernation, you need to edit the swap space in the custom partitioning stage. The "recommended" swap partition size is established automatically during a default installation, but I usually find it's either too large or too small for my needs.
The [Fedora 28 Installation Guide][1] defines current thinking about swap space allocation. Note that other versions of Fedora and other Linux distributions may differ slightly, but this is the same table Red Hat Enterprise Linux uses for its recommendations. These recommendations have not changed since Fedora 19.
| Amount of RAM installed in system | Recommended swap space | Recommended swap space with hibernation |
| --------------------------------- | ---------------------- | --------------------------------------- |
| ≤ 2GB | 2X RAM | 3X RAM |
| 2GB 8GB | = RAM | 2X RAM |
| 8GB 64GB | 4G to 0.5X RAM | 1.5X RAM |
| >64GB | Minimum 4GB | Hibernation not recommended |
Table 1: Recommended system swap space in Fedora 28's documentation.
Table 2 contains my recommendations based on my experiences in multiple environments over the years.
| Amount of RAM installed in system | Recommended swap space |
| --------------------------------- | ---------------------- |
| ≤ 2GB | 2X RAM |
| 2GB 8GB | = RAM |
| > 8GB | 8GB |
Table 2: My recommended system swap space.
It's possible that neither of these tables will work for your environment, but they will give you a place to start. The main consideration is that as the amount of RAM increases, adding more swap space simply leads to thrashing well before the swap space comes close to being filled. If you have too little virtual memory, you should add more RAM, if possible, rather than more swap space.
In order to test the Fedora (and RHEL) swap space recommendations, I used its recommendation of **0.5*RAM** on my two largest systems (the ones with 32GB and 64GB of RAM). Even when running four or five VMs, multiple documents in LibreOffice, Thunderbird, the Chrome web browser, several terminal emulator sessions, the Xfe file manager, and a number of other background applications, the only time I see any use of swap is during backups I have scheduled for every morning at about 2am. Even then, swap usage is no more than 16MB—yes megabytes. These results are for my system with my loads and do not necessarily apply to your real-world environment.
I recently had a conversation about swap space with some of the other Community Moderators here at [Opensource.com][2], and Chris Short, one of my friends in that illustrious and talented group, pointed me to an old [article][3] where he recommended using 1GB for swap space. This article was written in 2003, and he told me later that he now recommends zero swap space.
So, we wondered, what you think? What do you recommend or use on your systems for swap space?
--------------------------------------------------------------------------------
via: https://opensource.com/article/19/2/swap-space-poll
作者:[David Both][a]
选题:[lujun9972][b]
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://opensource.com/users/dboth
[b]: https://github.com/lujun9972
[1]: https://docs.fedoraproject.org/en-US/fedora/f28/install-guide/
[2]: http://Opensource.com
[3]: https://chrisshort.net/moving-to-linux-partitioning/

View File

@@ -0,0 +1,63 @@
[#]: collector: (lujun9972)
[#]: translator: (jdh8383)
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (Toyota Motors and its Linux Journey)
[#]: via: (https://itsfoss.com/toyota-motors-linux-journey)
[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/)
丰田汽车的Linux之旅
======
**这篇文章来自 It's FOSS 的读者 Malcolm Dean的投递。**
我之前跟丰田汽车北美分公司的 Brian.R.Lyons丰田发言人聊了聊话题是关于Linux在丰田和雷克萨斯汽车的信息娱乐系统上的实施方案。我了解到一些汽车制造商使用了 Automotive Grade Linux (AGL)。
然后我写了一篇短文,记录了我和 Brian 的讨论内容,就是丰田和 Linux 的一些渊源。希望 Linux 的狂热粉丝们能够喜欢这次对话。
全部[丰田和雷克萨斯汽车都将会使用 Automotive Grade Linux][1] (AGL),主要是用于车载信息娱乐系统。这项措施对于丰田集团来说是至关重要的,因为据 Lyons 先生所说:“作为技术的引领者之一,丰田认识到,赶上科技快速进步最好的方法就是拥抱开源理念”。
丰田和众多汽车制造公司都认为,与使用非自由软件相比,采用基于 Linux 的操作系统在更新和升级方面会更加廉价和快捷。
这简直太棒了! Linux 终于跟汽车结合起来了。我每天都在电脑上使用 Linux能看到这个优秀的软件在一个完全不同的产业领域里大展拳脚真是太好了。
我很好奇丰田是什么时候开始使用 [Automotive Grade Linux][2] (AGL) 的。按照 Lyons 先生的说法,这要追溯到 2011 年。
>“自 AGL 项目在五年前启动之始,作为活跃的会员和贡献者,丰田与其他顶级制造商和供应商展开合作,着手开发一个基于 Linux 的强大平台,并不断地增强其功能和安全性。”
![丰田信息娱乐系统][3]
[丰田于2011年加入了 Linux 基金会][4],与其他汽车制造商和软件公司就 IVI车内信息娱乐系统展开讨论最终在 2012 年Linux 基金会内部成立了 Automotive Grade Linux 工作组。
丰田在 AGL 工作组里首先提出了“代码优先”的策略这在开源领域是很常见的做法。然后丰田和其他汽车制造商、IVI 一线厂家,软件公司等各方展开对话,根据各方的技术需求详细制定了初始方向。
在加入 Linux 基金会的时候,丰田就已经意识到,在一线公司之间共享软件代码将会是至关重要的。因为要维护如此复杂的软件系统,对于任何一家顶级厂商都是一笔不小的开销。丰田和它的一级供货商想把更多的资源用在开发新功能和新的用户体验上,而不是用在维护各自的代码上。
各个汽车公司联合起来深入合作是一件大事。许多公司都达成了这样的共识,因为他们都发现开发维护私有软件其实更费钱。
今天,在全球市场上,丰田和雷克萨斯的全部车型都使用了 AGL。
身为雷克萨斯的销售人员,我认为这是一大进步。我和其他销售顾问都曾接待过很多回来找技术专员的客户,他们想更多的了解自己车上的信息娱乐系统到底都能做些什么。
这件事本身对于 Linux 社区和用户是个重大利好。虽然那个我们每天都在使用的操作系统变了模样,被推到了更广阔的舞台上,但它仍然是那个 Linux简单、包容而强大。
未来将会如何发展呢?我希望它能少出差错,为消费者带来更佳的用户体验。
--------------------------------------------------------------------------------
via: https://itsfoss.com/toyota-motors-linux-journey
作者:[Abhishek Prakash][a]
选题:[lujun9972][b]
译者:[jdh8383](https://github.com/jdh8383)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://itsfoss.com/author/abhishek/
[b]: https://github.com/lujun9972
[1]: https://www.linuxfoundation.org/press-release/2018/01/automotive-grade-linux-hits-road-globally-toyota-amazon-alexa-joins-agl-support-voice-recognition/
[2]: https://www.automotivelinux.org/
[3]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/01/toyota-interiors.jpg?resize=800%2C450&ssl=1
[4]: https://www.linuxfoundation.org/press-release/2011/07/toyota-joins-linux-foundation/

View File

@@ -1,103 +0,0 @@
[#]: collector: (lujun9972)
[#]: translator: (oska874)
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (Computer Laboratory Raspberry Pi: Lesson 5 OK05)
[#]: via: (https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/ok05.html)
[#]: author: (Robert Mullins http://www.cl.cam.ac.uk/~rdm34)
translating by ezio
树莓派计算机实验室 课程 5 OK05
======
OK05 课程构建于课程 OK04 的基础,使用更多代码方式烧、保存写莫尔斯码的 SOS 序列(`...---...`)。这里假设你已经有了 [课程 4: OK04][1] 操作系统的代码基础。
### 1 数据
到目前为止,我们与操作系统有关的所有内容都提供了遵循的说明。然而有时候,说明只是一半。我们的操作系统可能需要数据
> 一些早期的操作系统确实只允许特定文件中的特定类型的数据,但是这通常被认为太严格了。现代方法确实使程序变得复杂的多。
通常,只是数据的值很重要。你可能经过训练,认为数据是指定类型,比如,一个文本文件包含文章,一个图像文件包含一幅图片,等等。说实话,这只是一个理想罢了。计算机上的全部数据都是二进制数字,重要的是我们选择用什么来解释这些数据。在这个例子中,我们会将一个闪灯序列作为数据保存下来。
`main.s` 结束处复制下面的代码:
```
.section .data %定义 .data 段
.align 2 %对齐
pattern: %定义整形变量
.int 0b11111111101010100010001000101010
```
>`.align num` 保证下一行代码的地址是 `2^num` 的整数倍。
>`.int val` 输出数值 `val`
要区分数据和代码,我们将数据都放在 `.data` 区域。我已经将该区域包含在操作系统的内存布局图。我已经选择将数据放到代码后面。将我们的指令和数据分开保存的原因是,如果最后我们在自己的操作系统上实现一些安全措施,我们就需要知道代码的那些部分是可以执行的,而那些部分是不行的。
我在这里使用了两个新命令 `.align``.int``.align` 保证下来的数据是按照 2 的乘方对齐的。在这个里,我使用 `.align 2` ,意味着数据最终存放的地址是 `2^2=4` 的整数倍。这个操作是很重要的,因为我们用来读取内寸的指令 `ldr` 要求内存地址是 4 的倍数。
The .int command copies the constant after it into the output directly. That means that 111111111010101000100010001010102 will be placed into the output, and so the label pattern actually labels this piece of data as pattern.
命令 `.int` 直接复制它后面的常量到输出。这意味着 `11111111101010100010001000101010`(二进制数) 将会被存放到输出,所以标签模式实际将标记这段数据作为模式。
> 关于数据的一个挑战是寻找一个高效和有用的展示形式。这种保存一个开、关的时间单元的序列的方式,运行起来很容易,但是将很难编辑,因为摩尔斯的原理 `-` 或 `.` 丢失了。
如我提到的,数据可以意味这你想要的所有东西。在这里我编码了摩尔斯代码 SOS 序列,对于不熟悉的人,就是 `...---...`。我使用 0 表示一个时间单元的 LED 灭灯,而 1 表示一个时间单元的 LED 亮。这样,我们可以像这样编写一些代码在数据中显示一个序列,然后要显示不同序列,我们所有需要做的就是修改这段数据。下面是一个非常简单的例子,操作系统必须一直执行这段程序,解释和展示数据。
复制下面几行到 `main.s` 中的标记 `loop$` 之前。
```
ptrn .req r4 %重命名 r4 为 ptrn
ldr ptrn,=pattern %加载 pattern 的地址到 ptrn
ldr ptrn,[ptrn] %加载地址 ptrn 所在内存的值
seq .req r5 %重命名 r5 为 seq
mov seq,#0 %seq 赋值为 0
```
这段代码加载 `pattrern` 到寄存器 `r4`,并加载 0 到寄存器 `r5``r5` 将是我们的序列位置,所以我们可以追踪有多少 `pattern` 我们已经展示了。
下面的代码将非零值放入 `r1` ,如果仅仅是如果,这里有个 1 在当前位置的 `pattern`
```
mov r1,#1 %加载1到 r1
lsl r1,seq %对r1 的值逻辑左移 seq 次
and r1,ptrn %按位与
```
这段代码对你调用 `SetGpio` 很有用,它必须有一个非零值来关掉 LED而一个0值会打开 LED。
现在修改 `main.s` 中全部你的代码,这样代码中每次循环会根据当前的序列数设置 LED等待 250000 毫秒(或者其他合适的延时),然后增加序列数。当这个序列数到达 32 就需要返回 0.看看你是否能实现这个功能,作为额外的挑战,也可以试着只使用一条指令。
### 2 Time Flies When You're Having Fun... 当你玩得开心时,过得很快
你现在准备好在树莓派上实验。应该闪烁一串包含 3 个短脉冲3 个长脉冲,然后 3 个更短脉冲的序列。在一次延时之后,这种模式应该重复。如果这部工作,请查看我们的问题页。
一旦它工作,祝贺你已经达到 OK 系列教程的结束。
在这个谢列我们学习了汇编代码GPIO 控制器和系统定时器。我们已经学习了函数和 ABI以及几个基础的操作系统原理和关于数据的知识。
你现在已经准备好下面几个更高级的课程的某一个。
* [Screen][2] 系列是接下来的,会教你如何通过汇编代码使用屏幕。
* [Input][3] 系列教授你如何使用键盘和鼠标。
到现在,你已经有了足够的信息来制作操作系统,用其它方法和 GPIO 交互。如果你有任何机器人工具,你可能会想尝试编写一个通过 GPIO 管教控制的机器人操作系统。
--------------------------------------------------------------------------------
via: https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/ok05.html
作者:[Robert Mullins][a]
选题:[lujun9972][b]
译者:[ezio](https://github.com/oska874)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: http://www.cl.cam.ac.uk/~rdm34
[b]: https://github.com/lujun9972
[1]: https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/ok04.html
[2]: https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/screen01.html
[3]: https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/input01.html

View File

@@ -0,0 +1,911 @@
[#]: collector: (lujun9972)
[#]: translator: (guevaraya )
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (Computer Laboratory Raspberry Pi: Lesson 11 Input02)
[#]: via: (https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/input02.html)
[#]: author: (Alex Chadwick https://www.cl.cam.ac.uk)
计算机实验室 树莓派开发: 课程11 输入02
======
课程输入02是以课程输入01基础讲解的通过一个简单的命令行实现用户的命令输入和计算机的处理和显示。本文假设你已经具备 [课程11输入01][1] 的操作系统代码基础。
### 1 终端
```
早期的计算一般是在一栋楼里的一个巨型计算机系统,他有很多可以输命令的'终端'。计算机依次执行不同来源的命令。
```
几乎所有的操作系统都是以字符终端显示启动的。经典的黑底白字,通过键盘输入计算机要执行的命令,然后会提示你拼写错误,或者恰好得到你想要的执行结果。这种方法有两个主要优点:键盘和显示器可以提供简易,健壮的计算机交互机制,几乎所有的计算机系统都采用这个机制,这个也广泛被系统管理员应用。
让我们分析下真正想要哪些信息:
1. 计算机打开后,显示欢迎信息
2. 计算机启动后可以接受输入标志
3. 用户从键盘输入带参数的命令
4. 用户输入回车键或提交按钮
5. 计算机解析命令后执行可用的命令
6. 计算机显示命令的执行结果,过程信息
7. 循环跳转到步骤2
这样的终端被定义为标准的输入输出设备。用于输入的屏幕和输出打印的屏幕是同一个。也就是说终端是对字符显示的一个抽象。字符显示中,单个字符是最小的单元,而不是像素。屏幕被划分成固定数量不同颜色的字符。我们可以在现有的屏幕代码基础上,先存储字符和对应的颜色,然后再用方法 DrawCharacter 把其推送到屏幕上。一旦我们需要字符显示,就只需要在屏幕上画出一行字符串。
新建文件名为 terminal.s 如下:
```
.section .data
.align 4
terminalStart:
.int terminalBuffer
terminalStop:
.int terminalBuffer
terminalView:
.int terminalBuffer
terminalColour:
.byte 0xf
.align 8
terminalBuffer:
.rept 128*128
.byte 0x7f
.byte 0x0
.endr
terminalScreen:
.rept 1024/8 core.md Dict.md lctt2014.md lctt2016.md lctt2018.md LICENSE published README.md scripts sources translated 768/16
.byte 0x7f
.byte 0x0
.endr
```
这是文件终端的配置数据文件。我们有两个主要的存储变量terminalBuffer 和 terminalScreen。terminalBuffer保存所有显示过的字符。它保存128行字符文本1行包含128个字符。每个字符有一个 ASCII 字符和颜色单元组成初始值为0x7fASCII的删除键和 0前景色和背景色为黑。terminalScreen 保存当前屏幕显示的字符。它保存128x48的字符与 terminalBuffer 初始化值一样。你可能会想我仅需要terminalScreen就够了为什么还要terminalBuffer其实有两个好处
1. 我们可以很容易看到字符串的变化,只需画出有变化的字符。
2. 我们可以回滚终端显示的历史字符,也就是缓冲的字符(有限制)
你总是需要尝试去设计一个高效的系统,如果很少变化的条件这个系统会运行的更快。
独特的技巧在低功耗系统里很常见。画屏是很耗时的操作因此我们仅在不得已的时候才去执行这个操作。在这个系统里我们可以任意改变terminalBuffer然后调用一个仅拷贝屏幕上字节变化的方法。也就是说我们不需要持续画出每个字符这样可以节省一大段跨行文本的操作时间。
其他在 .data 段的值得含义如下:
* terminalStart
写入到 terminalBuffer 的第一个字符
* terminalStop
写入到 terminalBuffer 的最后一个字符
* terminalView
表示当前屏幕的第一个字符,这样我们可以控制滚动屏幕
* temrinalColour
即将被描画的字符颜色
```
循环缓冲区是**数据结构**一个例子。这是一个组织数据的思路,有时我们通过软件实现这种思路。
```
![显示 Hellow world 插入到大小为5的循环缓冲区的示意图。][2]
terminalStart 需要保存起来的原因是 termainlBuffer 是一个循环缓冲区。意思是当缓冲区变满时,末尾地方会回滚覆盖开始位置,这样最后一个字符变成了第一个字符。因此我们需要将 terminalStart 往前推进这样我们知道我们已经占满它了。如何实现缓冲区检测如果索引越界到缓冲区的末尾就将索引指向缓冲区的开始位置。循环缓冲区是一个比较常见的高明的存储大量数据的方法往往这些数据的最近部分比较重要。它允许无限制的写入只保证最近一些特定数据有效。这个常常用于信号处理和数据压缩算法。这样的情况可以允许我们存储128行终端记录超过128行也不会有问题。如果不是这样当超过第128行时我们需要把127行分别向前拷贝一次这样很浪费时间。
之前已经提到过 terminalColour 几次了。你可以根据你的想法实现终端颜色但这个文本终端有16个前景色和16个背景色这里相当于有16²=256种组合。[CGA][3]终端的颜色定义如下:
表格 1.1 - CGA 颜色编码
| 序号 | 颜色 (R, G, B) |
| ------ | ------------------------|
| 0 | 黑 (0, 0, 0) |
| 1 | 蓝 (0, 0, ⅔) |
| 2 | 绿 (0, ⅔, 0) |
| 3 | 青色 (0, ⅔, ⅔) |
| 4 | 红色 (⅔, 0, 0) |
| 5 | 品红 (⅔, 0, ⅔) |
| 6 | 棕色 (⅔, ⅓, 0) |
| 7 | 浅灰色 (⅔, ⅔, ⅔) |
| 8 | 灰色 (⅓, ⅓, ⅓) |
| 9 | 淡蓝色 (⅓, ⅓, 1) |
| 10 | 淡绿色 (⅓, 1, ⅓) |
| 11 | 淡青色 (⅓, 1, 1) |
| 12 | 淡红色 (1, ⅓, ⅓) |
| 13 | 浅品红 (1, ⅓, 1) |
| 14 | 黄色 (1, 1, ⅓) |
| 15 | 白色 (1, 1, 1) |
```
棕色作为替代色(黑黄色)既不吸引人也没有什么用处。
```
我们将前景色保存到颜色的低字节,背景色保存到颜色高字节。除过棕色,其他这些颜色遵循一种模式如二进制的高位比特代表增加 ⅓ 到每个组件其他比特代表增加⅔到各自组件。这样很容易进行RGB颜色转换。
我们需要一个方法从TerminalColour读取颜色编码的四个比特然后用16比特等效参数调用 SetForeColour。尝试实现你自己实现。如果你感觉麻烦或者还没有完成屏幕系列课程我们的实现如下
```
.section .text
TerminalColour:
teq r0,#6
ldreq r0,=0x02B5
beq SetForeColour
tst r0,#0b1000
ldrne r1,=0x52AA
moveq r1,#0
tst r0,#0b0100
addne r1,#0x15
tst r0,#0b0010
addne r1,#0x540
tst r0,#0b0001
addne r1,#0xA800
mov r0,r1
b SetForeColour
```
### 2 文本显示
我们的终端第一个真正需要的方法是 TerminalDisplay它用来把当前的数据从 terminalBuffe r拷贝到 terminalScreen 和实际的屏幕。如上所述,这个方法必须是最小开销的操作,因为我们需要频繁调用它。它主要比较 terminalBuffer 与 terminalDisplay的文本然后只拷贝有差异的字节。请记住 terminalBuffer 是循环缓冲区运行的,这种情况,从 terminalView 到 terminalStop 或者 128*48 字符集,哪个来的最快。如果我们遇到 terminalStop我们将会假定在这之后的所有字符是7f16 (ASCII delete)背景色为0黑色前景色和背景色
让我们看看必须要做的事情:
1. 加载 terminalView terminalStop 和 terminalDisplay 的地址。
2. 执行每一行:
1. 执行每一列:
1. 如果 terminalView 不等于 terminalStop根据 terminalView 加载当前字符和颜色
2. 否则加载 0x7f 和颜色 0
3. 从 terminalDisplay 加载当前的字符
4. 如果字符和颜色相同直接跳转到10
5. 存储字符和颜色到 terminalDisplay
6. 用 r0 作为背景色参数调用 TerminalColour
7. 用 r0 = 0x7f (ASCII 删除键, 一大块), r1 = x, r2 = y 调用 DrawCharacter
8. 用 r0 作为前景色参数调用 TerminalColour
9. 用 r0 = 字符, r1 = x, r2 = y 调用 DrawCharacter
10. 对位置参数 terminalDisplay 累加2
11. 如果 terminalView 不等于 terminalStop不能相等 terminalView 位置参数累加2
12. 如果 terminalView 位置已经是文件缓冲器的末尾,将他设置为缓冲区的开始位置
13. x 坐标增加8
2. y 坐标增加16
Try to implement this yourself. If you get stuck, my solution is given below:
尝试去自己实现吧。如果你遇到问题,我们的方案下面给出来了:
1.
```
.globl TerminalDisplay
TerminalDisplay:
push {r4,r5,r6,r7,r8,r9,r10,r11,lr}
x .req r4
y .req r5
char .req r6
col .req r7
screen .req r8
taddr .req r9
view .req r10
stop .req r11
ldr taddr,=terminalStart
ldr view,[taddr,#terminalView - terminalStart]
ldr stop,[taddr,#terminalStop - terminalStart]
add taddr,#terminalBuffer - terminalStart
add taddr,#128*128*2
mov screen,taddr
```
我这里的变量有点乱。为了方便起见,我用 taddr 存储 textBuffer 的末尾位置。
2.
```
mov y,#0
yLoop$:
```
从yLoop开始运行。
1.
```
mov x,#0
xLoop$:
```
从yLoop开始运行。
1.
```
teq view,stop
ldrneh char,[view]
```
为了方便起见,我把字符和颜色同时加载到 char 变量了
2.
```
moveq char,#0x7f
```
这行是对上面一行的补充说明读取黑色的Delete键
3.
```
ldrh col,[screen]
```
为了简便我把字符和颜色同时加载到 col 里。
4.
```
teq col,char
beq xLoopContinue$
```
现在我用teq指令检查是否有数据变化
5.
```
strh char,[screen]
```
我可以容易的保存当前值
6.
```
lsr col,char,#8
and char,#0x7f
lsr r0,col,#4
bl TerminalColour
```
我用 bitshift比特偏移 指令和 and 指令从 char 变量中分离出颜色到 col 变量和字符到 char变量然后再用bitshift比特偏移指令后调用TerminalColour 获取背景色。
7.
```
mov r0,#0x7f
mov r1,x
mov r2,y
bl DrawCharacter
```
写入一个彩色的删除字符块
8.
```
and r0,col,#0xf
bl TerminalColour
```
用 and 指令获取 col 变量的最低字节然后调用TerminalColour
9.
```
mov r0,char
mov r1,x
mov r2,y
bl DrawCharacter
```
写入我们需要的字符
10.
```
xLoopContinue$:
add screen,#2
```
自增屏幕指针
11.
```
teq view,stop
addne view,#2
```
如果可能自增view指针
12.
```
teq view,taddr
subeq view,#128*128*2
```
很容易检测 view指针是否越界到缓冲区的末尾因为缓冲区的地址保存在 taddr 变量里
13.
```
add x,#8
teq x,#1024
bne xLoop$
```
如果还有字符需要显示,我们就需要自增 x 变量然后循环到 xLoop 执行
2.
```
add y,#16
teq y,#768
bne yLoop$
```
如果还有更多的字符显示我们就需要自增 y 变量,然后循环到 yLoop 执行
```
pop {r4,r5,r6,r7,r8,r9,r10,r11,pc}
.unreq x
.unreq y
.unreq char
.unreq col
.unreq screen
.unreq taddr
.unreq view
.unreq stop
```
不要忘记最后清除变量
### 3 行打印
现在我有了自己 TerminalDisplay方法它可以自动显示 terminalBuffer 到 terminalScreen因此理论上我们可以画出文本。但是实际上我们没有任何基于字符显示的实例。 首先快速容易上手的方法便是 TerminalClear 它可以彻底清除终端。这个方法没有循环很容易实现。可以尝试分析下面的方法应该不难:
```
.globl TerminalClear
TerminalClear:
ldr r0,=terminalStart
add r1,r0,#terminalBuffer-terminalStart
str r1,[r0]
str r1,[r0,#terminalStop-terminalStart]
str r1,[r0,#terminalView-terminalStart]
mov pc,lr
```
现在我们需要构造一个字符显示的基础方法:打印函数。它将保存在 r0 的字符串和 保存在 r1 字符串长度简易的写到屏幕上。有一些特定字符需要特别的注意,这些特定的操作是确保 terminalView 是最新的。我们来分析一下需要做啥:
1. 检查字符串的长度是否为0如果是就直接返回
2. 加载 terminalStop 和 terminalView
3. 计算出 terminalStop 的 x 坐标
4. 对每一个字符的操作:
1. 检查字符是否为新起一行
2. 如果是的话,自增 bufferStop 到行末,同时写入黑色删除键
3. 否则拷贝当前 terminalColour 的字符
4. 加成是在行末
5. 如果是,检查从 terminalView 到 terminalStop 之间的字符数是否大于一屏
6. 如果是terminalView 自增一行
7. 检查 terminalView 是否为缓冲区的末尾,如果是的话将其替换为缓冲区的起始位置
8. 检查 terminalStop 是否为缓冲区的末尾,如果是的话将其替换为缓冲区的起始位置
9. 检查 terminalStop 是否等于 terminalStart 如果是的话 terminalStart 自增一行。
10. 检查 terminalStart 是否为缓冲区的末尾,如果是的话将其替换为缓冲区的起始位置
5. 存取 terminalStop 和 terminalView
试一下自己去实现。我们的方案提供如下:
1.
```
.globl Print
Print:
teq r1,#0
moveq pc,lr
```
这个是打印函数开始快速检查字符串为0的代码
2.
```
push {r4,r5,r6,r7,r8,r9,r10,r11,lr}
bufferStart .req r4
taddr .req r5
x .req r6
string .req r7
length .req r8
char .req r9
bufferStop .req r10
view .req r11
mov string,r0
mov length,r1
ldr taddr,=terminalStart
ldr bufferStop,[taddr,#terminalStop-terminalStart]
ldr view,[taddr,#terminalView-terminalStart]
ldr bufferStart,[taddr]
add taddr,#terminalBuffer-terminalStart
add taddr,#128*128*2
```
这里我做了很多配置。 bufferStart 代表 terminalStart bufferStop代表terminalStop view 代表 terminalViewtaddr 代表 terminalBuffer 的末尾地址。
3.
```
and x,bufferStop,#0xfe
lsr x,#1
```
和通常一样,巧妙的对齐技巧让许多事情更容易。由于需要对齐 terminalBuffer每个字符的 x 坐标需要8位要除以2。
4.
1.
```
charLoop$:
ldrb char,[string]
and char,#0x7f
teq char,#'\n'
bne charNormal$
```
我们需要检查新行
2.
```
mov r0,#0x7f
clearLine$:
strh r0,[bufferStop]
add bufferStop,#2
add x,#1
teq x,#128 blt clearLine$
b charLoopContinue$
```
循环执行值到行末写入 0x7f黑色删除键
3.
```
charNormal$:
strb char,[bufferStop]
ldr r0,=terminalColour
ldrb r0,[r0]
strb r0,[bufferStop,#1]
add bufferStop,#2
add x,#1
```
存储字符串的当前字符和 terminalBuffer 末尾的 terminalColour然后将它和 x 变量自增
4.
```
charLoopContinue$:
cmp x,#128
blt noScroll$
```
检查 x 是否为行末128
5.
```
mov x,#0
subs r0,bufferStop,view
addlt r0,#128*128*2
cmp r0,#128*(768/16)*2
```
这是 x 为 0 然后检查我们是否已经显示超过1屏。请记住我们是用的循环缓冲区因此如果 bufferStop 和 view 之前差是负值,我们实际使用是环绕缓冲区。
6.
```
addge view,#128*2
```
增加一行字节到 view 的地址
7.
```
teq view,taddr
subeq view,taddr,#128*128*2
```
如果 view 地址是缓冲区的末尾,我们就从它上面减去缓冲区的长度,让其指向开始位置。我会在开始的时候设置 taddr 为缓冲区的末尾地址。
8.
```
noScroll$:
teq bufferStop,taddr
subeq bufferStop,taddr,#128*128*2
```
如果 stop 的地址在缓冲区末尾,我们就从它上面减去缓冲区的长度,让其指向开始位置。我会在开始的时候设置 taddr 为缓冲区的末尾地址。
9.
```
teq bufferStop,bufferStart
addeq bufferStart,#128*2
```
检查 bufferStop 是否等于 bufferStart。 如果等于增加一行到 bufferStart。
10.
```
teq bufferStart,taddr
subeq bufferStart,taddr,#128*128*2
```
如果 start 的地址在缓冲区的末尾,我们就从它上面减去缓冲区的长度,让其指向开始位置。我会在开始的时候设置 taddr 为缓冲区的末尾地址。
```
subs length,#1
add string,#1
bgt charLoop$
```
循环执行知道字符串结束
5.
```
charLoopBreak$:
sub taddr,#128*128*2
sub taddr,#terminalBuffer-terminalStart
str bufferStop,[taddr,#terminalStop-terminalStart]
str view,[taddr,#terminalView-terminalStart]
str bufferStart,[taddr]
pop {r4,r5,r6,r7,r8,r9,r10,r11,pc}
.unreq bufferStart
.unreq taddr
.unreq x
.unreq string
.unreq length
.unreq char
.unreq bufferStop
.unreq view
```
保存变量然后返回
这个方法允许我们打印任意字符到屏幕。然而我们用了颜色变量但实际上没有设置它。一般终端用特性的组合字符去行修改颜色。如ASCII转移1b16后面跟着一个0-f的16进制的书就可以设置前景色为 CGA颜色。如果你自己想尝试实现在下载页面有一个我的详细的例子。
### 4 标志输入
```
按照惯例,许多编程语言中,任意程序可以访问 stdin 和 stdin他们可以连接到终端的输入和输出流。在图形程序其实也可以进行同样操作但实际几乎不用。
```
现在我们有一个可以打印和显示文本的输出终端。这仅仅是说了一半我们需要输入。我们想实现一个方法Readline可以保存文件的一行文本文本位置有 r0 给出,最大的长度由 r1 给出,返回 r0 里面的字符串长度。棘手的是用户输出字符的时候要回显功能,同时想要退格键的删除功能和命令回车执行功能。他们还想需要一个闪烁的下划线代表计算机需要输入。这些完全合理的要求让构造这个方法更具有挑战性。有一个方法完成这些需求就是存储用户输入的文本和文件大小到内存的某个地方。然后当调用 ReadLine 的时候,移动 terminalStop 的地址到它开始的地方然后调用 Print。也就是说我们只需要确保在内存维护一个字符串然后构造一个我们自己的打印函数。
让我们看看 ReadLine做了哪些事情
1. 如果字符串可保存的最大长度为0直接返回
2. 检索 terminalStop 和 terminalStop 的当前值
3. 如果字符串的最大长度大约缓冲区的一半,就设置大小为缓冲区的一半
4. 从最大长度里面减去1来确保输入的闪烁字符或结束符
5. 向字符串写入一个下划线
6. 写入一个 terminalView 和 terminalStop 的地址到内存
7. 调用 Print 大约当前字符串
8. 调用 TerminalDisplay
9. 调用 KeyboardUpdate
10. 调用 KeyboardGetChar
11. 如果为一个新行直接跳转到16
12. 如果是一个退格键将字符串长度减一如果其大约0
13. 如果是一个普通字符,将他写入字符串(字符串大小确保小于最大值)
14. 如果字符串是以下划线结束,写入一个空格,否则写入下划线
15. 跳转到6
16. 字符串的末尾写入一个新行
17. 调用 Print 和 TerminalDisplay
18. 用结束符替换新行
19. 返回字符串的长度
为了方便读者理解,然后然后自己去实现,我们的实现提供如下:
1.
```
.globl ReadLine
ReadLine:
teq r1,#0
moveq r0,#0
moveq pc,lr
```
快速处理长度为0的情况
2.
```
string .req r4
maxLength .req r5
input .req r6
taddr .req r7
length .req r8
view .req r9
push {r4,r5,r6,r7,r8,r9,lr}
mov string,r0
mov maxLength,r1
ldr taddr,=terminalStart
ldr input,[taddr,#terminalStop-terminalStart]
ldr view,[taddr,#terminalView-terminalStart]
mov length,#0
```
考虑到常见的场景我们初期做了很多初始化动作。input 代表 terminalStop 的值view 代表 terminalView。Length 默认为 0.
3.
```
cmp maxLength,#128*64
movhi maxLength,#128*64
```
我们必须检查异常大的读操作,我们不能处理超过 terminalBuffer 大小的输入(理论上可行但是terminalStart 移动越过存储的terminalStop会有很多问题)。
4.
```
sub maxLength,#1
```
由于用户需要一个闪烁的光标,我们需要一个备用字符在理想状况在这个字符串后面放一个结束符。
5.
```
mov r0,#'_'
strb r0,[string,length]
```
写入一个下划线让用户知道我们可以输入了。
6.
```
readLoop$:
str input,[taddr,#terminalStop-terminalStart]
str view,[taddr,#terminalView-terminalStart]
```
保存 terminalStop 和 terminalView。这个对重置一个终端很重要它会修改这些变量。严格讲也可以修改 terminalStart但是不可逆。
7.
```
mov r0,string
mov r1,length
add r1,#1
bl Print
```
写入当前的输入。由于下划线因此字符串长度加1
8.
```
bl TerminalDisplay
```
拷贝下一个文本到屏幕
9.
```
bl KeyboardUpdate
```
获取最近一次键盘输入
10.
```
bl KeyboardGetChar
```
检索键盘输入键值
11.
```
teq r0,#'\n'
beq readLoopBreak$
teq r0,#0
beq cursor$
teq r0,#'\b'
bne standard$
```
如果我们有一个回车键,循环中断。如果有结束符和一个退格键也会同样跳出选好。
12.
```
delete$:
cmp length,#0
subgt length,#1
b cursor$
```
从 length 里面删除一个字符
13.
```
standard$:
cmp length,maxLength
bge cursor$
strb r0,[string,length]
add length,#1
```
写回一个普通字符
14.
```
cursor$:
ldrb r0,[string,length]
teq r0,#'_'
moveq r0,#' '
movne r0,#'_'
strb r0,[string,length]
```
加载最近的一个字符,如果不是下换线则修改为下换线,如果是空格则修改为下划线
15.
```
b readLoop$
readLoopBreak$:
```
循环执行值到用户输入按下
16.
```
mov r0,#'\n'
strb r0,[string,length]
```
在字符串的结尾处存入一新行
17.
```
str input,[taddr,#terminalStop-terminalStart]
str view,[taddr,#terminalView-terminalStart]
mov r0,string
mov r1,length
add r1,#1
bl Print
bl TerminalDisplay
```
重置 terminalView 和 terminalStop 然后调用 Print 和 TerminalDisplay 输入回显
18.
```
mov r0,#0
strb r0,[string,length]
```
写入一个结束符
19.
```
mov r0,length
pop {r4,r5,r6,r7,r8,r9,pc}
.unreq string
.unreq maxLength
.unreq input
.unreq taddr
.unreq length
.unreq view
```
返回长度
### 5 终端: 机器进化
现在我们理论用终端和用户可以交互了。最显而易见的事情就是拿去测试了!在 'main.s' 里UsbInitialise后面的删除代码如下
```
reset$:
mov sp,#0x8000
bl TerminalClear
ldr r0,=welcome
mov r1,#welcomeEnd-welcome
bl Print
loop$:
ldr r0,=prompt
mov r1,#promptEnd-prompt
bl Print
ldr r0,=command
mov r1,#commandEnd-command
bl ReadLine
teq r0,#0
beq loopContinue$
mov r4,r0
ldr r5,=command
ldr r6,=commandTable
ldr r7,[r6,#0]
ldr r9,[r6,#4]
commandLoop$:
ldr r8,[r6,#8]
sub r1,r8,r7
cmp r1,r4
bgt commandLoopContinue$
mov r0,#0
commandName$:
ldrb r2,[r5,r0]
ldrb r3,[r7,r0]
teq r2,r3
bne commandLoopContinue$
add r0,#1
teq r0,r1
bne commandName$
ldrb r2,[r5,r0]
teq r2,#0
teqne r2,#' '
bne commandLoopContinue$
mov r0,r5
mov r1,r4
mov lr,pc
mov pc,r9
b loopContinue$
commandLoopContinue$:
add r6,#8
mov r7,r8
ldr r9,[r6,#4]
teq r9,#0
bne commandLoop$
ldr r0,=commandUnknown
mov r1,#commandUnknownEnd-commandUnknown
ldr r2,=formatBuffer
ldr r3,=command
bl FormatString
mov r1,r0
ldr r0,=formatBuffer
bl Print
loopContinue$:
bl TerminalDisplay
b loop$
echo:
cmp r1,#5
movle pc,lr
add r0,#5
sub r1,#5
b Print
ok:
teq r1,#5
beq okOn$
teq r1,#6
beq okOff$
mov pc,lr
okOn$:
ldrb r2,[r0,#3]
teq r2,#'o'
ldreqb r2,[r0,#4]
teqeq r2,#'n'
movne pc,lr
mov r1,#0
b okAct$
okOff$:
ldrb r2,[r0,#3]
teq r2,#'o'
ldreqb r2,[r0,#4]
teqeq r2,#'f'
ldreqb r2,[r0,#5]
teqeq r2,#'f'
movne pc,lr
mov r1,#1
okAct$:
mov r0,#16
b SetGpio
.section .data
.align 2
welcome: .ascii "Welcome to Alex's OS - Everyone's favourite OS"
welcomeEnd:
.align 2
prompt: .ascii "\n> "
promptEnd:
.align 2
command:
.rept 128
.byte 0
.endr
commandEnd:
.byte 0
.align 2
commandUnknown: .ascii "Command `%s' was not recognised.\n"
commandUnknownEnd:
.align 2
formatBuffer:
.rept 256
.byte 0
.endr
formatEnd:
.align 2
commandStringEcho: .ascii "echo"
commandStringReset: .ascii "reset"
commandStringOk: .ascii "ok"
commandStringCls: .ascii "cls"
commandStringEnd:
.align 2
commandTable:
.int commandStringEcho, echo
.int commandStringReset, reset$
.int commandStringOk, ok
.int commandStringCls, TerminalClear
.int commandStringEnd, 0
```
这块代码集成了一个简易的命令行操作系统。支持命令echoresetok 和 cls。echo 拷贝任意文本到终端reset命令会在系统出现问题的是复位操作系统ok 有两个功能:设置 OK 灯亮灭,最后 cls 调用 TerminalClear 清空终端。
试试树莓派的代码吧。如果遇到问题,请参照问题集锦页面吧。
如果运行正常祝贺你完成了一个操作系统基本终端和输入系列的课程。很遗憾这个教程先讲到这里但是我希望将来能制作更多教程。有问题请反馈至awc32@cam.ac.uk。
你已经在建立了一个简易的终端操作系统。我们的代码在 commandTable 构造了一个可用的命令表格。每个表格的入口是一个整型数字,用来表示字符串的地址,和一个整型数字表格代码的执行入口。 最后一个入口是 为 0 的commandStringEnd。尝试实现你自己的命令可以参照已有的函数建立一个新的。函数的参数 r0 是用户输入的命令地址r1是其长度。你可以用这个传递你输入值到你的命令。也许你有一个计算器程序或许是一个绘图程序或国际象棋。不管你的什么电子让它跑起来
--------------------------------------------------------------------------------
via: https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/input02.html
作者:[Alex Chadwick][a]
选题:[lujun9972][b]
译者:[译者ID](https://github.com/guevaraya)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://www.cl.cam.ac.uk
[b]: https://github.com/lujun9972
[1]: https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/input01.html
[2]: https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/images/circular_buffer.png
[3]: https://en.wikipedia.org/wiki/Color_Graphics_Adapter

View File

@@ -0,0 +1,538 @@
[#]: collector: (lujun9972)
[#]: translator: (qhwdw)
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (Computer Laboratory Raspberry Pi: Lesson 9 Screen04)
[#]: via: (https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/screen04.html)
[#]: author: (Alex Chadwick https://www.cl.cam.ac.uk)
计算机实验室 树莓派:课程 9 屏幕04
======
屏幕04 课程基于屏幕03 课程来构建,它教你如何操作文本。假设你已经有了[课程 8屏幕03][1] 的操作系统代码,我们将以它为基础。
### 1、操作字符串
```
变长函数在汇编代码中看起来似乎不好理解,然而 ,它却是非常有用和很强大的概念。
```
能够绘制文本是极好的,但不幸的是,现在你只能绘制预先准备好的字符串。如果能够像命令行那样显示任何东西才是完美的,而理想情况下应该是,我们能够显示任何我们期望的东西。一如既往地,如果我们付出努力而写出一个非常好的函数,它能够操作我们所希望的所有字符串,而作为回报,这将使我们以后写代码更容易。曾经如此复杂的函数,在 C 语言编程中只不过是一个 `sprintf` 而已。这个函数基于给定的另一个字符串和作为描述的额外的一个参数而生成一个字符串。我们对这个函数感兴趣的地方是,这个函数是个变长函数。这意味着它可以带可变数量的参数。参数的数量取决于具体的格式字符串,因此它的参数的数量不能预先确定。
完整的函数有许多选项,而我们在这里只列出了几个。在本教程中将要实现的选项我做了高亮处理,当然,你可以尝试去实现更多的选项。
函数通过读取格式字符串来工作,然后使用下表的意思去解释它。一旦一个参数已经使用了,就不会再次考虑它了。函数 的返回值是写入的字符数。如果方法失败,将返回一个负数。
表 1.1 sprintf 格式化规则
| 选项 | 含义 |
| -------------------------- | ------------------------------------------------------------ |
| ==Any character except %== | 复制字符到输出。 |
| ==%%== | 写一个 % 字符到输出。 |
| ==%c== | 将下一个参数写成字符格式。 |
| ==%d or %i== | 将下一个参数写成十进制的有符号整数。 |
| %e | 将下一个参数写成科学记数法,使用 eN 意思是 ×10N。 |
| %E | 将下一个参数写成科学记数法,使用 EN 意思是 ×10N。 |
| %f | 将下一个参数写成十进制的 IEEE 754 浮点数。 |
| %g | 与 %e 和 %f 的指数表示形式相同。 |
| %G | 与 %E 和 %f 的指数表示形式相同。 |
| ==%o== | 将下一个参数写成八进制的无符号整数。 |
| ==%s== | 下一个参数如果是一个指针,将它写成空终止符字符串。 |
| ==%u== | 将下一个参数写成十进制无符号整数。 |
| ==%x== | 将下一个参数写成十六进制无符号整数(使用小写的 a、b、c、d、e 和 f。 |
| %X | 将下一个参数写成十六进制的无符号整数(使用大写的 A、B、C、D、E 和 F。 |
| %p | 将下一个参数写成指针地址。 |
| ==%n== | 什么也不输出。而是复制到目前为止被下一个参数在本地处理的字符个数。 |
除此之外,对序列还有许多额外的处理,比如指定最小长度,符号等等。更多信息可以在 [sprintf - C++ 参考][2] 上找到。
下面是调用方法和返回的结果的示例。
表 1.2 sprintf 调用示例
| 格式化字符串 | 参数 | 结果 |
| "%d" | 13 | "13" |
| "+%d degrees" | 12 | "+12 degrees" |
| "+%x degrees" | 24 | "+1c degrees" |
| "'%c' = 0%o" | 65, 65 | "'A' = 0101" |
| "%d * %d%% = %d" | 200, 40, 80 | "200 * 40% = 80" |
| "+%d degrees" | -5 | "+-5 degrees" |
| "+%u degrees" | -5 | "+4294967291 degrees" |
希望你已经看到了这个函数是多么有用。实现它需要大量的编程工作,但给我们的回报却是一个非常有用的函数,可以用于各种用途。
### 2、除法
```
除法是非常慢的,也是非常复杂的基础数学运算。它在 ARM 汇编代码中不能直接实现,因为如果直接实现的话,它得出答案需要花费很长的时间,因此它不是个“简单的”运算。
```
虽然这个函数看起来很强大、也很复杂。但是,处理它的许多情况的最容易的方式可能是,编写一个函数去处理一些非常常见的任务。它是个非常有用的函数,可以为任何底的一个有符号或无符号的数字生成一个字符串。那么,我们如何去实现呢?在继续阅读之前,尝试快速地设计一个算法。
最简单的方法或许就是我在 [课程 1OK01][3] 中提到的“除法余数法”。它的思路如下:
1. 用当前值除以你使用的底。
2. 保存余数。
3. 如果得到的新值不为 0转到第 1 步。
4. 将余数反序连起来就是答案。
例如:
表 2.1 以 2 为底的例子
转换
| 值 | 新值 | 余数 |
| ---- | ---- | ---- |
| 137 | 68 | 1 |
| 68 | 34 | 0 |
| 34 | 17 | 0 |
| 17 | 8 | 1 |
| 8 | 4 | 0 |
| 4 | 2 | 0 |
| 2 | 1 | 0 |
| 1 | 0 | 1 |
因此答案是 10001001<sub>2</sub>
这个过程的不幸之外在于使用了除法。所以,我们必须首先要考虑二进制中的除法。
我们复习一下长除法
> 假如我们想把 4135 除以 17。
>
> 0243 r 4
> 17)4135
> 0 0 × 17 = 0000
> 4135 4135 - 0 = 4135
> 34 200 × 17 = 3400
> 735 4135 - 3400 = 735
> 68 40 × 17 = 680
> 55 735 - 680 = 55
> 51 3 × 17 = 51
> 4 55 - 51 = 4
> 答案243 余 4
>
> 首先我们来看被除数的最高位。 我们看到它是小于或等于除数的最小倍数,因此它是 0。我们在结果中写一个 0。
>
> 接下来我们看被除数倒数第二位和所有的高位。我们看到小于或等于那个数的除数的最小倍数是 34。我们在结果中写一个 2和减去 3400。
>
> 接下来我们看被除数的第三位和所有高位。我们看到小于或等于那个数的除数的最小倍数是 68。我们在结果中写一个 4和减去 680。
>
> 最后,我们看一下所有的余位。我们看到小于余数的除数的最小倍数是 51。我们在结果中写一个 3减去 51。减法的结果就是我们的余数。
>
在汇编代码中做除法,我们将实现二进制的长除法。我们之所以实现它是因为,数字都是以二进制方式保存的,这让我们很容易地访问所有重要位的移位操作,并且因为在二进制中做除法比在其它高进制中做除法都要简单,因为它的数更少。
> 1011 r 1
>1010)1101111
> 1010
> 11111
> 1010
> 1011
> 1010
> 1
这个示例展示了如何做二进制的长除法。简单来说就是,在不超出被除数的情况下,尽可能将除数右移,根据位置输出一个 1和减去这个数。剩下的就是余数。在这个例子中我们展示了 1101111<sub>2</sub> ÷ 1010<sub>2</sub> = 1011<sub>2</sub> 余数为 1<sub>2</sub>。用十进制表示就是111 ÷ 10 = 11 余 1。
你自己尝试去实现这个长除法。你应该去写一个函数 `DivideU32` ,其中 `r0` 是被除数,而 `r1` 是除数,在 `r0` 中返回结果,在 `r1` 中返回余数。下面,我们将完成一个有效的实现。
```c
function DivideU32(r0 is dividend, r1 is divisor)
set shift to 31
set result to 0
while shift 0
if dividend (divisor << shift) then
set dividend to dividend - (divisor <&lt shift)
set result to result + 1
end if
set result to result << 1
set shift to shift - 1
loop
return (result, dividend)
end function
```
这段代码实现了我们的目标,但却不能用于汇编代码。我们出现的问题是,我们的寄存器只能保存 32 位,而 `divisor << shift` 的结果可能在一个寄存器中装不下(我们称之为溢出)。这确实是个问题。你的解决方案是否有溢出的问题呢?
幸运的是,有一个称为 `clz``计数前导零count leading zeros` 的指令,它能计算一个二进制表示的数字的前导零的个数。这样我们就可以在溢出发生之前,可以将寄存器中的值进行相应位数的左移。你可以找出的另一个优化就是,每个循环我们计算 `divisor << shift` 了两遍。我们可以通过将除数移到开始位置来改进它,然后在每个循环结束的时候将它移下去,这样可以避免将它移到别处。
我们来看一下进一步优化之后的汇编代码。
```assembly
.globl DivideU32
DivideU32:
result .req r0
remainder .req r1
shift .req r2
current .req r3
clz shift,r1
lsl current,r1,shift
mov remainder,r0
mov result,#0
divideU32Loop$:
cmp shift,#0
blt divideU32Return$
cmp remainder,current
addge result,result,#1
subge remainder,current
sub shift,#1
lsr current,#1
lsl result,#1
b divideU32Loop$
divideU32Return$:
.unreq current
mov pc,lr
.unreq result
.unreq remainder
.unreq shift
```
```assembly
clz dest,src 将第一个寄存器 dest 中二进制表示的值的前导零的数量,保存到第二个寄存器 src 中。
```
你可能毫无疑问的认为这是个非常高效的作法。它是很好,但是除法是个代价非常高的操作,并且我们的其中一个愿望就是不要经常做除法,因为如果能以任何方式提升速度就是件非常好的事情。当我们查看有循环的优化代码时,我们总是重点考虑一个问题,这个循环会运行多少次。在本案例中,在输入为 1 的情况下,这个循环最多运行 31 次。在不考虑特殊情况的时候,这很容易改进。例如,当 1 除以 1 时,不需要移位,我们将把除数移到它上面的每个位置。这可以通过简单地在被除数上使用新的 clz 命令并从中减去它来改进。在 `1 ÷ 1` 的案例中,这意味着移位将设置为 0明确地表示它不需要移位。如果它设置移位为负数表示除数大于被除数因此我们就可以知道结果是 0而余数是被除数。我们可以做的另一个快速检查就是如果当前值为 0那么它是一个整除的除法我们就可以停止循环了。
```assembly
.globl DivideU32
DivideU32:
result .req r0
remainder .req r1
shift .req r2
current .req r3
clz shift,r1
clz r3,r0
subs shift,r3
lsl current,r1,shift
mov remainder,r0
mov result,#0
blt divideU32Return$
divideU32Loop$:
cmp remainder,current
blt divideU32LoopContinue$
add result,result,#1
subs remainder,current
lsleq result,shift
beq divideU32Return$
divideU32LoopContinue$:
subs shift,#1
lsrge current,#1
lslge result,#1
bge divideU32Loop$
divideU32Return$:
.unreq current
mov pc,lr
.unreq result
.unreq remainder
.unreq shift
```
复制上面的代码到一个名为 `maths.s` 的文件中。
### 3、数字字符串
现在,我们已经可以做除法了,我们来看一下另外的一个将数字转换为字符串的实现。下列的伪代码将寄存器中的一个数字转换成以 36 为底的字符串。根据惯例a % b 表示 a 被 b 相除之后的余数。
```c
function SignedString(r0 is value, r1 is dest, r2 is base)
if value 0
then return UnsignedString(value, dest, base)
otherwise
if dest > 0 then
setByte(dest, '-')
set dest to dest + 1
end if
return UnsignedString(-value, dest, base) + 1
end if
end function
function UnsignedString(r0 is value, r1 is dest, r2 is base)
set length to 0
do
set (value, rem) to DivideU32(value, base)
if rem &gt 10
then set rem to rem + '0'
otherwise set rem to rem - 10 + 'a'
if dest > 0
then setByte(dest + length, rem)
set length to length + 1
while value > 0
if dest > 0
then ReverseString(dest, length)
return length
end function
function ReverseString(r0 is string, r1 is length)
set end to string + length - 1
while end > start
set temp1 to readByte(start)
set temp2 to readByte(end)
setByte(start, temp2)
setByte(end, temp1)
set start to start + 1
set end to end - 1
end while
end function
```
上述代码实现在一个名为 `text.s` 的汇编文件中。记住,如果你遇到了困难,可以在下载页面找到完整的解决方案。
### 4、格式化字符串
我们继续回到我们的字符串格式化方法。因为我们正在编写我们自己的操作系统,我们根据我们自己的意愿来添加或修改格式化规则。我们可以发现,添加一个 `a %b` 操作去输出一个二进制的数字比较有用,而如果你不使用空终止符字符串,那么你应该去修改 `%s` 的行为,让它从另一个参数中得到字符串的长度,或者如果你愿意,可以从长度前缀中获取。我在下面的示例中使用了一个空终止符。
实现这个函数的一个主要的障碍是它的参数个数是可变的。根据 ABI 规定,额外的参数在调用方法之前以相反的顺序先推送到栈上。比如,我们使用 8 个参数 1、2、3、4、5、6、7 和 8 来调用我们的方法,我们将按下面的顺序来处理:
1. Set r0 = 5、r1 = 6、r2 = 7、r3 = 8
2. Push {r0,r1,r2,r3}
3. Set r0 = 1、r1 = 2、r2 = 3、r3 = 4
4. 调用函数
5. Add sp,#4*4
现在,我们必须确定我们的函数确切需要的参数。在我的案例中,我将寄存器 `r0` 用来保存格式化字符串地址,格式化字符串长度则放在寄存器 `r1` 中,目标字符串地址放在寄存器 `r2` 中,紧接着是要求的参数列表,从寄存器 `r3` 开始和像上面描述的那样在栈上继续。如果你想去使用一个空终止符格式化字符串,在寄存器 r1 中的参数将被移除。如果你想有一个最大缓冲区长度,你可以将它保存在寄存器 `r3` 中。由于有额外的修改,我认为这样修改函数是很有用的,如果目标字符串地址为 0意味着没有字符串被输出但如果仍然返回一个精确的长度意味着能够精确的判断格式化字符串的长度。
如果你希望尝试实现你自己的函数,现在就可以去做了。如果不去实现你自己的,下面我将首先构建方法的伪代码,然后给出实现的汇编代码。
```c
function StringFormat(r0 is format, r1 is formatLength, r2 is dest, ...)
set index to 0
set length to 0
while index < formatLength
if readByte(format + index) = '%' then
set index to index + 1
if readByte(format + index) = '%' then
if dest > 0
then setByte(dest + length, '%')
set length to length + 1
otherwise if readByte(format + index) = 'c' then
if dest > 0
then setByte(dest + length, nextArg)
set length to length + 1
otherwise if readByte(format + index) = 'd' or 'i' then
set length to length + SignedString(nextArg, dest, 10)
otherwise if readByte(format + index) = 'o' then
set length to length + UnsignedString(nextArg, dest, 8)
otherwise if readByte(format + index) = 'u' then
set length to length + UnsignedString(nextArg, dest, 10)
otherwise if readByte(format + index) = 'b' then
set length to length + UnsignedString(nextArg, dest, 2)
otherwise if readByte(format + index) = 'x' then
set length to length + UnsignedString(nextArg, dest, 16)
otherwise if readByte(format + index) = 's' then
set str to nextArg
while getByte(str) != '\0'
if dest > 0
then setByte(dest + length, getByte(str))
set length to length + 1
set str to str + 1
loop
otherwise if readByte(format + index) = 'n' then
setWord(nextArg, length)
end if
otherwise
if dest > 0
then setByte(dest + length, readByte(format + index))
set length to length + 1
end if
set index to index + 1
loop
return length
end function
```
虽然这个函数很大,但它还是很简单的。大多数的代码都是在检查所有各种条件,每个代码都是很简单的。此外,所有的无符号整数的大小写都是相同的(除了底以外)。因此在汇编中可以将它们汇总。下面是它的汇编代码。
```assembly
.globl FormatString
FormatString:
format .req r4
formatLength .req r5
dest .req r6
nextArg .req r7
argList .req r8
length .req r9
push {r4,r5,r6,r7,r8,r9,lr}
mov format,r0
mov formatLength,r1
mov dest,r2
mov nextArg,r3
add argList,sp,#7*4
mov length,#0
formatLoop$:
subs formatLength,#1
movlt r0,length
poplt {r4,r5,r6,r7,r8,r9,pc}
ldrb r0,[format]
add format,#1
teq r0,#'%'
beq formatArg$
formatChar$:
teq dest,#0
strneb r0,[dest]
addne dest,#1
add length,#1
b formatLoop$
formatArg$:
subs formatLength,#1
movlt r0,length
poplt {r4,r5,r6,r7,r8,r9,pc}
ldrb r0,[format]
add format,#1
teq r0,#'%'
beq formatChar$
teq r0,#'c'
moveq r0,nextArg
ldreq nextArg,[argList]
addeq argList,#4
beq formatChar$
teq r0,#'s'
beq formatString$
teq r0,#'d'
beq formatSigned$
teq r0,#'u'
teqne r0,#'x'
teqne r0,#'b'
teqne r0,#'o'
beq formatUnsigned$
b formatLoop$
formatString$:
ldrb r0,[nextArg]
teq r0,#0x0
ldreq nextArg,[argList]
addeq argList,#4
beq formatLoop$
add length,#1
teq dest,#0
strneb r0,[dest]
addne dest,#1
add nextArg,#1
b formatString$
formatSigned$:
mov r0,nextArg
ldr nextArg,[argList]
add argList,#4
mov r1,dest
mov r2,#10
bl SignedString
teq dest,#0
addne dest,r0
add length,r0
b formatLoop$
formatUnsigned$:
teq r0,#'u'
moveq r2,#10
teq r0,#'x'
moveq r2,#16
teq r0,#'b'
moveq r2,#2
teq r0,#'o'
moveq r2,#8
mov r0,nextArg
ldr nextArg,[argList]
add argList,#4
mov r1,dest
bl UnsignedString
teq dest,#0
addne dest,r0
add length,r0
b formatLoop$
```
### 5、一个转换操作系统
你可以使用这个方法随意转换你希望的任何东西。比如,下面的代码将生成一个换算表,可以做从十进制到二进制到十六进制到八进制以及到 ASCII 的换算操作。
删除 `main.s` 文件中 `bl SetGraphicsAddress` 之后的所有代码,然后粘贴以下的代码进去。
```assembly
mov r4,#0
loop$:
ldr r0,=format
mov r1,#formatEnd-format
ldr r2,=formatEnd
lsr r3,r4,#4
push {r3}
push {r3}
push {r3}
push {r3}
bl FormatString
add sp,#16
mov r1,r0
ldr r0,=formatEnd
mov r2,#0
mov r3,r4
cmp r3,#768-16
subhi r3,#768
addhi r2,#256
cmp r3,#768-16
subhi r3,#768
addhi r2,#256
cmp r3,#768-16
subhi r3,#768
addhi r2,#256
bl DrawString
add r4,#16
b loop$
.section .data
format:
.ascii "%d=0b%b=0x%x=0%o='%c'"
formatEnd:
```
你能在测试之前推算出将发生什么吗?特别是对于 `r3 ≥ 128` 会发生什么?尝试在树莓派上运行它,看看你是否猜对了。如果不能正常运行,请查看我们的排错页面。
如果一切顺利恭喜你你已经完成了屏幕04 教程,屏幕系列的课程结束了!我们学习了像素和帧缓冲的知识,以及如何将它们应用到树莓派上。我们学习了如何绘制简单的线条,也学习如何绘制字符,以及将数字格式化为文本的宝贵技能。我们现在已经拥有了在一个操作系统上进行图形输出的全部知识。你可以写出更多的绘制方法吗?三维绘图是什么?你能实现一个 24 位帧缓冲吗?能够从命令行上读取帧缓冲的大小吗?
接下来的课程是[输入][4]系列课程,它将教我们如何使用键盘和鼠标去实现一个传统的计算机控制台。
--------------------------------------------------------------------------------
via: https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/screen04.html
作者:[Alex Chadwick][a]
选题:[lujun9972][b]
译者:[qhwdw](https://github.com/qhwdw)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://www.cl.cam.ac.uk
[b]: https://github.com/lujun9972
[1]: https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/screen03.html
[2]: http://www.cplusplus.com/reference/clibrary/cstdio/sprintf/
[3]: https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/ok01.html
[4]: https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/input01.html

View File

@@ -0,0 +1,96 @@
Pony 编程语言简介
======
Pony一种“Rust 遇上 Erlang”的语言让开发快捷安全高效以及高并发程序更简单。
![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/programming_keys.jpg?itok=O4qaYCHK)
在 [Wallaroo Labs][1],我是副总工程师,我们正在构建一个用 [Pony][3] 编程语言编写的 [高性能分布式流处理器][2]。大多数人没有听说过 Pony但它一直是 Wallaroo 的最佳选择,它也可能成为你的下一个项目的最佳选择。
> "一门编程语言只是另一种工具。与语法无关。与表达性无关。与范式或模型无关。仅与管理难题有关" —Sylvan ClebschPony 的创建者
我是 Pony 项目的贡献者,但在这里我要谈谈为什么 Pony 对于像 Wallaroo 这样的应用是个好选择,并分享我使用 Pony 的方式。如果你对我们为什么使用 Pony 来编写 Wallaroo 甚感兴趣,我们有一篇关于它的 [博文][4]。
### Pony 是什么?
你可以把 Pony 想象成某种“Rust 遇上 Erlang”的东西。Pony 有着最引人注目的特性,它们是:
* 类型安全
* 存储安全
* 异常安全
* 无数据竞争
* 无死锁
此外,它被编译为高效的本地代码,它是在开放的情况下开发的,在 2-clause BSD 许可下可用。
以上说的功能不少,但在这里我将重点关注那些对我们公司来说采用 Pony 至关重要的功能。
### 为什么使用 Pony
使用大多数我们现有的工具编写快速,安全,高效,高并发的程序并非易事。“快速,高效,高度并发”是可实现的目标,但加入“安全”之后,就困难了许多。通过 Wallaroo我们希望同时实现四个目标而 Pony 让实现它们更加简单。
#### 高并发
Pony 让并发变得简单。一部分是因为通过提供一个自用的并发主张。在 Pony 语言中,所有的并发都是通过 [Actor 模型][5] 进行的。
Actor 模型在 Erlang 和 Akka 中的实现最为著名。Actor 模型从 1970 年出现,细节因实施而异。不变的是,所有计算都由异步消息进行通信的 actor 来执行。
你可以用这种方式来看待 Actor 模型:面向对象中的对象是状态+同步方法,而 actor 是状态+异步方法。
当一个 actor 收到一个消息时,它执行相应的方法。该方法可以在只有该 actor 可访问的状态下运行。Actor 模型允许我们以并发安全的方式使用可变状态。每个 actor 都是单线程的。actor 中的两个方法不会并发运行。这意味着,在给定的 actor 中,数据更新不会引起数据竞争或通常与线程和可变状态相关的其他问题。
#### 快速高效
Pony actor 安排了一个高效的工作窃取调度程序。每个可用的 CPU 都有一个 Pony 调度程序。这种每个核心一个线程的并发模型是 Pony 尝试与 CPU 协同工作以尽可能高效运行的一部分。Pony 运行时尝试尽可能保持 CPU 缓存。代码越少缓存越高运行得越好。Pony 意在帮你的代码与 CPU 缓存友好相处。
Pony 运行时还会有每个 actor 的堆因此在垃圾收集期间没有“stop the world”的垃圾收集步骤。这意味着你的程序总是至少能做一点工作。因此 Pony 程序最终具有非常一致的性能和可预测的延迟。
#### 安全
Pony 型别系统引入了一个新概念参考能力使得数据安全成为型别系统的一部分。Pony 语言中每种变量的类型都包含了有关如何在 actor 之间分享数据的信息。Pony 编译器用这些信息来确认,在编译时,你的代码是数据竞争和无死锁的。
如果这听起来有点像 Rust那是因为本来就是这样的。Pony 的参考功能和 Rust 的借用检查器都提供数据安全性;它们只是以不同的方式来接近它,并有不同的权衡。
### Pony 适合你吗?
决定是否要在一个非业余爱好的项目上使用一门新的编程语言是困难的。与其他方法想比你必须权衡工具的适当性和不成熟度。那么Pony 和你搭不搭呢?
如果你有一个困难的并发问题需要解决,那么 Pony 可能是一个好选择。解决并发应用问题是 Pony 存在的理由。如果你能用一个单线程的 Python 脚本就完成所需操作,那你大概不需要它。如果你有一个困难的并发问题,你应该考虑 Pony 及其强大的无数据竞争,并发感知型别系统。
你将获得一个编译器,它将阻止你引入许多与并发相关的错误,并在运行时为你提供出色的性能特征。
### 开始使用 Pony
如果你准备好开始使用 Pony你需要先在 Pony 的网站上访问 [学习部分][6]。在这里你会找到安装 Pony 编译器的步骤和学习这门语言的资源。
如果你愿意为你正在使用的语言做出贡献,我们会在 GitHub 上为你提供一些 [初学者友好的问题][7]。
同时,我迫不及待地想在 [我们的 IRC 频道][8] 和 [Pony 邮件列表][9] 上与你交谈。
要了解更多有关 Pony 的消息,请参阅 Sean Allen 2018 年 7 月 16 日至 19 日在俄勒冈州波特兰举行的 [第 20 届 OSCON 会议][11] 上的演讲: [Pony我如何学会停止担心并拥抱未经证实的技术][10]。
--------------------------------------------------------------------------------
via: https://opensource.com/article/18/5/pony
作者:[Sean T Allen][a]
选题:[lujun9972](https://github.com/lujun9972)
译者:[beamrolling](https://github.com/beamrolling)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]:https://opensource.com/users/seantallen
[1]:http://www.wallaroolabs.com/
[2]:https://github.com/wallaroolabs/wallaroo
[3]:https://www.ponylang.org/
[4]:https://blog.wallaroolabs.com/2017/10/why-we-used-pony-to-write-wallaroo/
[5]:https://en.wikipedia.org/wiki/Actor_model
[6]:https://www.ponylang.org/learn/
[7]:https://github.com/ponylang/ponyc/issues?q=is%3Aissue+is%3Aopen+label%3A%22complexity%3A+beginner+friendly%22
[8]:https://webchat.freenode.net/?channels=%23ponylang
[9]:https://pony.groups.io/g/user
[10]:https://conferences.oreilly.com/oscon/oscon-or/public/schedule/speaker/213590
[11]:https://conferences.oreilly.com/oscon/oscon-or

View File

@@ -0,0 +1,135 @@
如何从 Linux 上连接到远程桌面
======
![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/rh_003499_01_cloud21x_cc.png?itok=5UwC92dO)
根据维基百科,[远程桌面][1] 是一种“可以让个人电脑上的桌面环境在一个系统(通常是电脑,但是也可以是服务器)上远程运行并在另一个分开的客户端设备显示的软件或者操作系统特性”。
换句话说,远程桌面是用来访问在另一台电脑上运行的环境的。比如说 [ManageIQ/Integration tests][2] 仓库的拉取请求 (PR) 测试系统暴露了一个虚拟网络计算 (VNC) 连接端口,使得我能够远程浏览正被实时测试的拉取请求。远程桌面也被用于帮助客户解决电脑问题:在客户的许可下,你可以远程建立 VNC 或者远程桌面协议RDP连接来看或者交互式地访问电脑以寻找并解决问题。
运用远程桌面连接软件可以建立这些连接。可供选择的软件有很多,我用 [Remmina][3] 因为我喜欢它极简、好用的用户界面 (UI)。它是用 GTK+ 编写的,在 GNU GPL 证书下它是开源的。
在这篇文章里,我会解释如何使用 Remmina 客户端从一台 Linux 电脑上远程连接到 Windows 10 系统 和 Red Hat 企业版 Linux 7 系统。
### 在 Linux 上安装 Remmina
首先,你需要在你用来远程访问其它电脑的的主机上安装 Remmina。如果你用的是 Fedora你可以运行如下的命令来安装 Remmina
```
sudo dnf install -y remmina
```
如果你想在一个不同的 Linux 平台上安装 Remmina跟着 [安装教程][4] 走。然后你会发现 Remmina 正和你其它软件待在一起Remmina 在这张图片里被选中)。
![](https://opensource.com/sites/default/files/uploads/remmina1-on-desktop.png)
点击图标运行 Remmina你应该能看到像这样的屏幕
![](https://opensource.com/sites/default/files/uploads/remmina2_launched.png)
Remmina 提供不同种类的连接,其中包括用来连接到 Windows 系统的 RDP 和 用来连接到 Linux 系统的 VNC。如你在上图左上角所见的Remmina 的默认设置是 RDP。
### 连接到 Windows 10
在你通过 RDP 连接到一台 Windows 10 电脑之前,你必须修改权限以允许分享远程桌面并通过防火墙建立连接。
[注意: Windows 10 家庭版没有列出 RDP 特性][5]
要许可远程桌面分享,在**文件管理器**界面右击**我的电脑 → 属性 → 远程设置**,接着在跳出的窗口中,勾选**在这台电脑上允许远程连接**,再点击**应用**。
![](https://opensource.com/sites/default/files/uploads/remmina3_connect_win10.png)
然后,允许远程连接通过你的防火墙。首先在**开始菜单中**查找**防火墙设置**,选择**允许应用通过防火墙**。
![](https://opensource.com/sites/default/files/uploads/remmina4_firewall.png)
在打开的窗口中,在**允许的应用和特性**下找到**远程桌面**。根据你用来访问这个桌面的网络酌情勾选**隐私**和/或**公开**列的选框。点击**确定**。
![](https://opensource.com/sites/default/files/uploads/remmina5_firewall_2.png)
回到你用来远程访问 Windows 主机的 Linux 电脑,打开 Remmina。输入你的 Windows 主机的 IP 地址,敲击回车键。(我怎么在 [Linux][6] 和 [Windws][7] 中定位我的 IP 地址?)看到提示后,输入你的用户名和密码,点击确定。
![](https://opensource.com/sites/default/files/uploads/remmina6_login.png)
如果你被询问是否接受证书,点击确定。
![](https://opensource.com/sites/default/files/uploads/remmina7_certificate.png)
你此时应能看到你的 Windows 10 主机桌面。
![](https://opensource.com/sites/default/files/uploads/remmina8_remote_desktop.png)
### 连接到 Red Hat 企业版 Linux 7
要在你的 RHEL7 电脑上允许远程访问,在 Linux 桌面上打开**所有设置**。
![](https://opensource.com/sites/default/files/uploads/remmina9_settings.png)
点击分享图标会打开如下的窗口:
![](https://opensource.com/sites/default/files/uploads/remmina10_sharing.png)
如果**屏幕分享**处于关闭状态,点击一下。一个窗口会弹出,你可以滑动到**打开**的位置。如果你想允许远程控制桌面,将**允许远程控制**调到**打开**。你同样也可以在两种访问选项间选择:一个能够让电脑的主要用户接受或者否绝连接要求,另一个能用密码验证连接。在窗口底部,选择被允许连接的网络界面,最后关闭窗口。
接着,从**应用菜单 → 其它 → 防火墙**打开**防火墙设置**。
![](https://opensource.com/sites/default/files/uploads/remmina11_firewall_settings.png)
勾选 vnc-服务器旁边的选框(如下图所示)关闭窗口。接着直接到你远程电脑上的 Remmina输入 你想连接到的 Linux 桌面的 IP 地址,选择 **VNC** 作为协议,点击**回车**键。
![](https://opensource.com/sites/default/files/uploads/remmina12_vncprotocol.png)
如果你之前选择的验证选项是**新连接必须询问访问许可**RHEL 系统用户会看到这样的一个弹窗
![](https://opensource.com/sites/default/files/uploads/remmina13_permission.png)
点击**接受**以成功进行远程连接。
如果你选择用密码验证连接Remmina 会向你询问密码。
![](https://opensource.com/sites/default/files/uploads/remmina14_password-auth.png)
输入密码然后**确认**,你应该能连接到远程电脑。
![](https://opensource.com/sites/default/files/uploads/remmina15_connected.png)
### 使用 Remmina
Remmina 提供如上图所示的标签化的 UI就好像一个浏览器一样。在上图所示的左上角你可以看到两个标签一个是之前建立的 WIndows 10 连接,另一个新的是 RHEL 连接。
在窗口的左侧,有一个有着**缩放窗口****全屏模式****偏好****截屏****断开连接**等选项的工具栏。你可以自己探索看那种适合你。
你也可以通过点击左上角的**+**号创建保存过的连接。根据你的连接情况填好表单点击**保存**。以下是一个 Windows 10 RDP 连接的示例:
![](https://opensource.com/sites/default/files/uploads/remmina16_saved-connection.png)
下次你打开 Remmina 时连接就在那了。
![](https://opensource.com/sites/default/files/uploads/remmina17_connection-available.png)
点击一下它你不用补充细节就可以建立连接了。
### 补充说明
当你使用远程桌面软件时,你所有的操作都在远程桌面上消耗资源—— Remmina或者其它类似软件仅仅是一种与远程桌面交互的方式。你也可以通过 SSH 远程访问一台电脑,但那将会让你在那台电脑上局限于仅能使用文字的终端。
你也应当注意到当你允许你的电脑远程连接时,如果一名攻击者用这种方法获得你电脑的访问权同样会给你带来严重损失。因此当你不频繁使用远程桌面时,禁止远程桌面连接以及其在防火墙中相关的服务是很明智的做法。
--------------------------------------------------------------------------------
via: https://opensource.com/article/18/6/linux-remote-desktop
作者:[Kedar Vijay Kulkarni][a]
选题:[lujun9972](https://github.com/lujun9972)
译者:[tomjlw](https://github.com/tomjlw)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]:https://opensource.com/users/kkulkarn
[1]:https://en.wikipedia.org/wiki/Remote_desktop_software
[2]:https://github.com/ManageIQ/integration_tests
[3]:https://www.remmina.org/wp/
[4]:https://www.tecmint.com/remmina-remote-desktop-sharing-and-ssh-client/
[5]:https://superuser.com/questions/1019203/remote-desktop-settings-missing#1019212
[6]:https://opensource.com/article/18/5/how-find-ip-address-linux
[7]:https://www.groovypost.com/howto/find-windows-10-device-ip-address/

View File

@@ -0,0 +1,152 @@
[#]: collector: (lujun9972)
[#]: translator: (wxy)
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (4 Unique Terminal Emulators for Linux)
[#]: via: (https://www.linux.com/blog/learn/2018/12/4-unique-terminals-linux)
[#]: author: (Jack Wallen https://www.linux.com/users/jlwallen)
4 个独特的 Linux 终端模拟器
======
> 这四个不同的终端模拟器 —— 不仅可以完成工作,还可以增加一些乐趣。
![](https://www.linux.com/sites/lcom/files/styles/rendered_file/public/terminals_main.jpg?itok=e6av-5VO)
让我们面对现实,如果你是 Linux 管理员那么你要用命令行来工作。为此你将使用终端模拟器LCTT 译注:常简称为“终端”,与终端本身的原意不同)。最有可能的是,你的选择发行版预先安装了一个可以完成工作的默认终端模拟器。但这是有很多选择可供选择的 Linux所以这种思想自然也适用于终端模拟器。实际上如果你打开发行版的图形界面的包管理器或从命令行搜索你将找到大量可能的选择。其中许多是非常简单的工具然而有些是真正独特的。
在本文中,我将重点介绍四个这样的终端模拟器,它们不仅可以完成工作,而且可以使工作变得更有趣或更有趣。 那么,让我们来看看这些终端。
### Tilda
[Tilda][1] 是为Gtk设计的是一种酷炫的下拉终端。这意味着该终端始终在后台运行随时准备从显示器顶部拉下来例如 Guake 和 Yakuake。让 Tilda 超越许多其他产品的原因是该终端可用的配置选项数量(图 1
![](https://www.linux.com/sites/lcom/files/styles/rendered_file/public/terminals_1.jpg?itok=bra6qb6X)
可以从标准的软件库安装 Tilda。在基于 Ubuntu或 Debian的发行版上安装非常简单
```
sudo apt-get install tilda -y
```
安装完成后,从桌面菜单中打开 Tilda这也将打开其配置窗口。根据你的喜好配置应用程序然后关闭配置窗口。然后你可以通过点击 `F1` 热键来打开和关闭 Tilda。对使用 Tilda 的一个警告是,在第一次运行后,你将找不到有关如何找到配置向导的任何提示。别担心。只要运行命令 `tilda -C`,它将打开配置窗口,同时仍保留你之前设置的选项。
可用选项包括:
* 终端大小和位置
* 字体和颜色配置
* 自动隐藏
* 标题
* 自定义命令
* URL 处理
* 透明度
* 动画
* 滚动
* 和更多
我喜欢这些类型的终端是因为当你不需要它们时它们很容易就会消失,只需按一下按钮即可。对于那些不断进出终端的人来说,像 Tilda 这样的工具是理想的选择。
### Aterm
Aterm 在我心中占有特殊的位置,因为它是我第一次使用的终端之一,它让我意识到 Linux 的灵活性。 这要回到当 AfterStep 成为我选择的窗口管理器时用了不太久而且那时我是命令行新手。Aterm 提供的是一个高度可定制的终端仿真器,同时帮助我了解使用终端的细节(如何添加选项和切换到命令)。“你觉得怎么样?”。因为 Aterm 从未有过用于定制的图形界面。要使用任何特殊选项运行 Aterm它必须以命令选项的方式运行。例如假设你要启用透明度、绿色文本、白色高亮和无滚动条。为此请运行以下命令
```
aterm -tr -fg green -bg white +xb
```
最终结果(`top` 命令运行用于说明)看起来如图 2 所示。
![Aterm][3]
*图 2使用了一些定制选项的 Aterm*
当然,你必须先安装 Aterm。幸运的是这个应用程序仍然可以在标准软件库中找到因此在 Ubuntu 上安装就像下面这样简单:
```
sudo apt-get install aterm -y
```
如果你想总是用这些选项打开 Aterm你最好的办法是在 `~/.bashrc` 文件中创建一个别名,如下所示:
```
alias=”aterm -tr -fg green -bg white +sb”
```
保存该文件,当你运行命令 `aterm` 时,它将始终打开这些选项。有关创建别名的更多信息,请查看[这个教程][5]。
### Eterm
Eterm 是第二个真正告诉我 Linux 命令行可以带来多少乐趣的终端。Eterm 是 Enlightenment 桌面的默认终端模拟器。当我最终从 AfterStep 迁移到 Enlightenment 时(那时早在 20 世纪初),我担心我会失去所有那些很酷的美学选择。结果并非如此。 实际上Eterm 提供了许多独特的选项,同时使用终端工具栏使任务更容易。使用 Eterm你可以通过从 “Background > Pixmap”菜单条目中轻松地从大量背景图像中选择一个背景如果你需要一个的话图 3
![Eterm][7]
*图 3从大量的背景图中为 Eterm 选择一个。*
还有许多其他配置选项(例如字体大小、映射警报、切换滚动条、亮度、对比度和背景图像的透明度等)。 你要确定的一件事是,在你配置 Eterm 以满足你的口味后,需要单击 “Eterm > Save User Settings”否则关闭应用程序时所有设置都将丢失
可以从标准软件库安装 Eterm其命令如下
```
sudo apt-get install eterm
```
### Extraterm
[Extraterm][8] 应该可以赢得今天任何终端窗口项目最酷功能集的一些奖项。Extraterm 最独特的功能是能够以彩色框来包装命令(蓝色表示成功命令,红色表示失败命令。图 4
![Extraterm][10]
*图 4Extraterm 显示有两个失败的命令框。*
在运行命令时Extraterm 会将命令包装在一个单独的颜色框中。如果该命令成功,则该颜色框将以蓝色轮廓显示。如果命令失败,框将以红色标出。
无法通过标准软件库安装 Extraterm。事实上在 Linux 上运行 Extraterm目前的唯一方法是从项目的 GitHub 页面[下载预编译的二进制文件][11],解压缩文件,切换到新创建的目录,然后运行命令 `./extraterm`
当该应用程序运行后,要启用颜色框,你必须首先启用 bash 集成。为此,请打开 Extraterm然后右键单击窗口中的任意位置以显示弹出菜单。滚动直到看到 “Inject Bash shell Integration”的条目图 5。选择该条目然后你可以开始使用这个颜色框选项。
![Extraterm][13]
*图 5为 Extraterm 插入 Bash 集成。。*
如果你运行了一个命令,并且看不到颜色框,则可能必须为该命令创建一个新的颜色框(因为 Extraterm 仅附带一些默认颜色框)。为此,请单击 “Extraterm” 菜单按钮窗口右上角的三条水平线选择“Settings”然后单击“Frames”选项卡。在此窗口中向下滚动并单击“New Rule”按钮。 然后,你可以添加要使用颜色框的命令(图 6
![frames][15]
*图 6为颜色框添加新规则。*
如果在此之后仍然没有看到框架出现,请从[下载页面][11]下载 `extraterm-commands` 文件,解压缩该文件,切换到新创建的目录,然后运行命令 `sh setup_extraterm_bash.sh`。这应该可以为 Extraterm 启用颜色框。
还有更多可用于 Extraterm 的选项。我相信,一旦你开始在终端窗口上玩这个新花头,你就不会想回到标准终端。希望开发人员尽快将这个应用程序提供给标准软件库(因为它很容易就可以成为最常用的终端窗口之一)。
### 更多
正如你可能预期的那样Linux 有很多可用的终端。这四个代表(至少对我来说)四个独特的终端,每个都可以帮助你运行每个 Linux 管理员需要运行的命令。如果你对其中一个不满意,请让你的包管理员查看可用的软件包。你一定会找到适合你的东西。
--------------------------------------------------------------------------------
via: https://www.linux.com/blog/learn/2018/12/4-unique-terminals-linux
作者:[Jack Wallen][a]
选题:[lujun9972][b]
译者:[wxy](https://github.com/wxy)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://www.linux.com/users/jlwallen
[b]: https://github.com/lujun9972
[1]: http://tilda.sourceforge.net/tildadoc.php
[2]: https://www.linux.com/files/images/terminals2jpg
[3]: https://www.linux.com/sites/lcom/files/styles/rendered_file/public/terminals_2.jpg?itok=gBkRLwDI (Aterm)
[4]: https://www.linux.com/licenses/category/used-permission
[5]: https://www.linux.com/blog/learn/2018/12/aliases-diy-shell-commands
[6]: https://www.linux.com/files/images/terminals3jpg
[7]: https://www.linux.com/sites/lcom/files/styles/rendered_file/public/terminals_3.jpg?itok=RVPTJAtK (Eterm)
[8]: http://extraterm.org
[9]: https://www.linux.com/files/images/terminals4jpg
[10]: https://www.linux.com/sites/lcom/files/styles/rendered_file/public/terminals_4.jpg?itok=2n01qdwO (Extraterm)
[11]: https://github.com/sedwards2009/extraterm/releases
[12]: https://www.linux.com/files/images/terminals5jpg
[13]: https://www.linux.com/sites/lcom/files/styles/rendered_file/public/terminals_5.jpg?itok=FdaE1Mpf (Extraterm)
[14]: https://www.linux.com/files/images/terminals6jpg
[15]: https://www.linux.com/sites/lcom/files/styles/rendered_file/public/terminals_6.jpg?itok=lQ1Zv5wq (frames)

View File

@@ -0,0 +1,60 @@
[#]: collector: (lujun9972)
[#]: translator: (geekpi)
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (Get started with Budgie Desktop, a Linux environment)
[#]: via: (https://opensource.com/article/19/1/productivity-tool-budgie-desktop)
[#]: author: (Kevin Sonney https://opensource.com/users/ksonney (Kevin Sonney))
开始使用 Linux 桌面环境 Budgie
======
使用 Budgie 按需配置你的桌面,这是我们开源工具系列中的第 18 个工具,它将在 2019 年提高你的工作效率。
![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/data_metrics_analytics_desktop_laptop.png?itok=9QXd7AUr)
每年年初似乎都有疯狂的冲动,想方设法提高工作效率。新年的决议,开始一年的权利,当然,“与旧的,与新的”的态度都有助于实现这一目标。通常的一轮建议严重偏向封闭源和专有软件。它不一定是这样。
这是我挑选出的 19 个新的(或者对你而言新的)开源工具中的第 18 个工具来帮助你在 2019 年更有效率。
### Budgie 桌面
Linux 种有许多桌面环境。从易于使用以及有令人惊叹图形界面的 [GNOME 桌面][1](在大多数主要 Linux 发行版上是默认桌面)和 [KDE][2],到极简主义的 [Openbox][3],到高度可配置的平铺化 [i3][4],有很多选择。我要找的桌面环境需要速度、不引人注目和干净的用户体验。当桌面不适合你时,很难会有高效率。
![](https://opensource.com/sites/default/files/uploads/budgie-1.png)
[Budgie 桌面][5]是 [Solus][6] Linux 发行版的默认桌面,它在大多数主要 Linux 发行版的附加软件包中提供。它基于 GNOME并使用了许多你可能已经在计算机上使用的相同工具和库。
默认桌面非常简约只有面板和空白桌面。Budgie 包含一个集成的侧边栏(称为 Raven通过它可以快速访问日历、音频控件和设置菜单。Raven 还包含一个集成的通知区域,其中包含与 MacOS 类似的统一系统消息显示。
![](https://opensource.com/sites/default/files/uploads/budgie-2.png)
点击 Raven 中的齿轮图标会显示 Budgie 的控制面板及其配置。由于 Budgie 仍处于开发阶段,与 GNOME 或 KDE相 比,它有点勉强,我希望随着时间的推移它会有更多的选项。顶部面板选项允许用户配置顶部面板的排序、位置和内容,这很不错。
![](https://opensource.com/sites/default/files/uploads/budgie-3.png)
Budgie Welcome 应用(首次登录时展示)包含安装其他软件、面板小程序、截图和 Flatpack 软件包的选项。这些小程序有处理网络、截图、额外的时钟和计时器等等。
![](https://opensource.com/sites/default/files/uploads/budgie-4.png)
Budgie 提供干净稳定的桌面。它响应迅速,有许多选项,允许你根据需要自定义它。
--------------------------------------------------------------------------------
via: https://opensource.com/article/19/1/productivity-tool-budgie-desktop
作者:[Kevin Sonney][a]
选题:[lujun9972][b]
译者:[geekpi](https://github.com/geekpi)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://opensource.com/users/ksonney (Kevin Sonney)
[b]: https://github.com/lujun9972
[1]: https://www.gnome.org/
[2]: https://www.kde.org/
[3]: http://openbox.org/wiki/Main_Page
[4]: https://i3wm.org/
[5]: https://getsol.us/solus/experiences/
[6]: https://getsol.us/home/