mirror of
https://github.com/LCTT/TranslateProject.git
synced 2025-03-03 01:10:13 +08:00
commit
c5bcec872a
@ -1,35 +1,39 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: (gxlct008)
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
[#]: reviewer: (wxy)
|
||||
[#]: publisher: (wxy)
|
||||
[#]: url: (https://linux.cn/article-12782-1.html)
|
||||
[#]: subject: (Go on very small hardware Part 3)
|
||||
[#]: via: (https://ziutek.github.io/2018/05/03/go_on_very_small_hardware3.html)
|
||||
[#]: author: (Michał Derkacz )
|
||||
|
||||
Go 语言在极小硬件上的运用(三)
|
||||
======
|
||||
[![STM32F030F4P6][1]][2]
|
||||
|
||||
在本系列的 [第一][3] 和 [第二][4] 部分中讨论的大多数示例都是以一种或另一种方式闪烁的 LED。起初它可能很有趣,但是一段时间后变得有些无聊。让我们做些更有趣的事情……
|
||||

|
||||
|
||||
|
||||
在本系列的 [第一][3] 和 [第二][4] 部分中讨论的大多数示例都是以某种方式闪烁的 LED。起初它可能很有趣,但是一段时间后变得有些无聊。让我们做些更有趣的事情……
|
||||
|
||||
…让我们点亮更多的 LED!
|
||||
|
||||
### WS281x LEDs
|
||||
![STM32F030F4P6][1]
|
||||
|
||||
[WS281x][5] RGB LED(及其克隆)非常受欢迎。您可以作为单个元素购买、链成长条或组装成矩阵、环或其他形状因子。
|
||||
### WS281x LED
|
||||
|
||||
[WS281x][5] RGB LED(及其克隆品)非常受欢迎。你可以以单个元素购买、链成长条或组装成矩阵、环或其他形状。
|
||||
|
||||
![WS2812B][6]
|
||||
|
||||
它们可以串联连接,基于这个事实,您可以只用 MCU 的单个引脚就可以控制一个很长的 LED 灯条。不幸的是,它们的内部控制器使用的物理协议不能直接适用于您在 MCU 中可以找到的任何外围设备。您必须使用 <ruby>位脉冲<rt>bit-banging</rt></ruby>或以特殊方式使用可用的外设。
|
||||
它们可以串联连接,基于这个事实,你可以只用 MCU 的单个引脚就可以控制一个很长的 LED 灯条。不幸的是,它们的内部控制器使用的物理协议不能直接适用于你在 MCU 中可以找到的任何外围设备。你必须使用 <ruby>位脉冲<rt>bit-banging</rt></ruby>或以特殊方式使用可用的外设。
|
||||
|
||||
哪种可用的解决方案最有效取决于同时控制的 LED 灯条数量。如果您必须驱动 4 到 16 个条带,那么最有效的方法是 [使用定时器和 DMA][7](请不要忽略 Martin 文章末尾的链接)。
|
||||
哪种可用的解决方案最有效取决于同时控制的 LED 灯条数量。如果你必须驱动 4 到 16 个灯条,那么最有效的方法是 [使用定时器和 DMA][7](请不要忽略这篇文章末尾的链接)。
|
||||
|
||||
如果只需要控制一个或两个条带,请使用可用的 SPI 或 UART 外设。对于 SPI,您只能在发送的一个字节中编码两个 WS281x 位。由于巧妙地使用了起始位和停止位,UART 允许更密集的编码:每发送一个字节 3 位。
|
||||
如果只需要控制一个或两个灯条,请使用可用的 SPI 或 UART 外设。对于 SPI,你只能在发送的一个字节中编码两个 WS281x 位。由于巧妙地使用了起始位和停止位,UART 允许更密集的编码:每发送一个字节 3 位。
|
||||
|
||||
我在 [此站点][8] 上找到了有关 UART 协议如何适用于 WS281x 协议的最佳解释。如果您不懂波兰语,这里是 [英文翻译][9]。
|
||||
我在 [此站点][8] 上找到了有关 UART 协议如何适用于 WS281x 协议的最佳解释。如果你不懂波兰语,这里是 [英文翻译][9]。
|
||||
|
||||
基于 WS281x 的 LED 仍然是最受欢迎的,但市场上也有 SPI 控制的 LED:[APA102][10],[SK9822][11]。关于它们的三篇有趣的文章在这里:[1][12],[2][13],[3][14]
|
||||
基于 WS281x 的 LED 仍然是最受欢迎的,但市场上也有 SPI 控制的 LED:[APA102][10]、[SK9822][11]。关于它们的三篇有趣的文章在这里:[1][12]、[2][13]、[3][14]。
|
||||
|
||||
### LED 环
|
||||
|
||||
@ -43,12 +47,11 @@ Go 语言在极小硬件上的运用(三)
|
||||
|
||||
![WS2812B][16]
|
||||
|
||||
我们的 STM32F030F4P6 MCU 和整个 STM32 F0、F3、F7、L4 系列具有 F1、F4、L1 MCU 不具备的一项重要功能:它可以反转 UART 信号,因此我们可以将环直接连接到 UART TXD 引脚。如果您不知道我们需要这种反转,那么您可能没有读过我上面提到的 [文章][9]。
|
||||
我们的 STM32F030F4P6 MCU 和整个 STM32 F0、F3、F7、L4 系列具有 F1、F4、L1 MCU 不具备的一项重要功能:它可以反转 UART 信号,因此我们可以将环直接连接到 UART TXD 引脚。如果你不知道我们需要这种反转,那么你可能没有读过我上面提到的 [文章][9]。
|
||||
|
||||
因此,您不能以这种方式使用流行的 [Blue Pill][17] 或 [STM32F4-DISCOVERY][18]。使用其 SPI 外设或外部反相器。有关使用 SPI 的 NUCLEO-F411RE,请参见 [圣诞树灯][19] 项目作为 UART + 逆变器的示例或 [WS2812示例][20]。
|
||||
因此,你不能以这种方式使用流行的 [Blue Pill][17] 或 [STM32F4-DISCOVERY][18]。使用其 SPI 外设或外部反相器。有关使用 SPI 的 NUCLEO-F411RE,请参见 [圣诞树灯][19] 项目作为 UART + 逆变器的示例或 [WS2812示例][20]。
|
||||
|
||||
|
||||
顺便说一下,大多数 DISCOVERY 板可能还有一个问题:它们在 VDD = 3V 而不是 3.3V 的情况下工作。 对于高 DI,WS281x 至少要求电源电压 * 0.7。如果是 5V 电源,则为 3.5V;如果是 4.7V 电源,则为 3.3V;可在 DISCOVERY 的 5V 引脚上找到。如您所见,即使在我们的情况下,第一个 LED 的工作电压也低于规格 0.2V。对于 DISCOVERY 板,如果供电 4.7V,它将工作在低于规格的 0.3V 下;如果供电 5V,它将工作在低于规格 0.5V 下。
|
||||
顺便说一下,大多数 DISCOVERY 板可能还有一个问题:它们在 VDD = 3V 而不是 3.3V 的情况下工作。 对于高 DI,WS281x 至少要求电源电压 * 0.7。如果是 5V 电源,则为 3.5V;如果是 4.7V 电源,则为 3.3V;可在 DISCOVERY 的 5V 引脚上找到。如你所见,即使在我们的情况下,第一个 LED 的工作电压也低于规格 0.2V。对于 DISCOVERY 板,如果供电 4.7V,它将工作在低于规格的 0.3V 下;如果供电 5V,它将工作在低于规格 0.5V 下。
|
||||
|
||||
让我们结束这段冗长的介绍并转到代码:
|
||||
|
||||
@ -134,9 +137,9 @@ var ISRs = [...]func(){
|
||||
}
|
||||
```
|
||||
|
||||
##### 导入部分
|
||||
#### 导入部分
|
||||
|
||||
与前面的示例相比,导入部分中的新内容是 `rand/math` 包和带有 `led/ws281x` 子树的 led 包。 led 包本身包含 `Color` 类型的定义。 `led/ws281x/wsuart` 定义了 `ColorOrder`、`Pixel` 和 `Strip` 类型。
|
||||
与前面的示例相比,导入部分中的新内容是 `rand/math` 包和带有 `led/ws281x` 子树的 `led` 包。 `led` 包本身包含 `Color` 类型的定义。 `led/ws281x/wsuart` 定义了 `ColorOrder`、`Pixel` 和 `Strip` 类型。
|
||||
|
||||
我想知道如何使用 `image/color` 中的 `Color` 或 `RGBA` 类型,以及如何以它将实现 `image.Image` 接口的方式定义 `Strip`。 但是由于使用了 [gamma 校正][21] 和 大开销的 `color/draw` 包,我以简单的方式结束:
|
||||
|
||||
@ -147,13 +150,13 @@ type Strip []Pixel
|
||||
|
||||
使用一些有用的方法。然而,这种情况在未来可能会改变。
|
||||
|
||||
##### init 函数
|
||||
#### init 函数
|
||||
|
||||
`init` 函数没有太多新颖之处。 UART 波特率从 115200 更改为 3000000000/1390 ≈ 2158273,相当于每个 WS2812 位 1390 纳秒。 CR2 寄存器中的 TxInv 位设置为反转 TXD 信号。
|
||||
|
||||
##### main 函数
|
||||
#### main 函数
|
||||
|
||||
`XorShift64` 伪随机数生成器用于生成随机颜色。 [XORSHIFT][22] 是目前由 `math/rand` 包实现的唯一算法。您必须使用带有非零参数的 `Seed` 方法显式初始化它。
|
||||
`XorShift64` 伪随机数生成器用于生成随机颜色。 [XORSHIFT][22] 是目前由 `math/rand` 包实现的唯一算法。你必须使用带有非零参数的 `Seed` 方法显式初始化它。
|
||||
|
||||
`rgb` 变量的类型为 `wsuart.ColorOrder`,并设置为 WS2812 使用的 GRB 颜色顺序(WS2811 使用 RGB 顺序)。然后用于将颜色转换为像素。
|
||||
|
||||
@ -166,9 +169,9 @@ strip.Clear()
|
||||
|
||||
其余代码使用随机颜色绘制类似于 “Please Wait…” 微调器的内容。
|
||||
|
||||
条带切片充当帧缓冲区。 `tts.Write(strip.Bytes()` 将帧缓冲区的内容发送到环。
|
||||
`strip` 切片充当帧缓冲区。 `tts.Write(strip.Bytes())` 将帧缓冲区的内容发送到环。
|
||||
|
||||
##### 中断
|
||||
#### 中断
|
||||
|
||||
该程序由处理中断的代码组成,与先前的 [UART 示例][23] 中的代码相同。
|
||||
|
||||
@ -182,27 +185,23 @@ $ arm-none-eabi-size cortexm0.elf
|
||||
$ openocd -d0 -f interface/stlink.cfg -f target/stm32f0x.cfg -c 'init; program cortexm0.elf; reset run; exit'
|
||||
```
|
||||
|
||||
我跳过了 openocd 输出。下面的视频显示了该程序的工作原理:
|
||||
我跳过了 `openocd` 的输出。下面的视频显示了该程序的工作原理:
|
||||
|
||||
原文中插入视频的代码:
|
||||
<video width="576" height="324" controls="" preload="auto">
|
||||
<source src="https://ziutek.github.io/videos/rgbspinner.mp4" type="video/mp4">
|
||||
Sorry, your browser doesn't support embedded videos.
|
||||
</video>
|
||||

|
||||
|
||||
### 让我们做些有用的事情...
|
||||
|
||||
在 [第一部分][3] 的开头,我曾问过:“我们能降到多低,还能做一些有用的事情?”。 我们的 MCU 实际上是一种低端设备(8 比特的人可能会不同意我的看法),但到目前为止,我们还没有做任何有用的事情。
|
||||
在 [第一部分][3] 的开头,我曾问过:“Go 能深入到多低层,而还能做一些有用的事情?”。 我们的 MCU 实际上是一种低端设备(8 比特的人可能会不同意我的看法),但到目前为止,我们还没有做任何有用的事情。
|
||||
|
||||
所以... 让我们做些有用的事情... 让我们做个时钟!
|
||||
|
||||
在互联网上有许多由 RGB LED 构成的时钟示例。让我们用小板子和 RGB 环制作自己的时钟。我们按照下面的描述更改先前的代码。
|
||||
在互联网上有许多由 RGB LED 构成的时钟示例。让我们用我们的小板子和 RGB 环制作自己的时钟。我们按照下面的描述更改先前的代码。
|
||||
|
||||
##### 导入部分
|
||||
#### 导入部分
|
||||
|
||||
删除 `math/rand` 包,然后添加 `stm32/hal/exti`。
|
||||
|
||||
##### 全局变量
|
||||
#### 全局变量
|
||||
|
||||
添加两个新的全局变量:`btn` 和 `btnev`:
|
||||
|
||||
@ -214,9 +213,9 @@ var (
|
||||
)
|
||||
```
|
||||
|
||||
它们将用来处理那些用于设置时钟的 “button”。我们的板子除了重置之外没有其他按钮,但是如果没有它,我们仍然可以通过某种方式进行管理。
|
||||
它们将用来处理那些用于设置时钟的 “按钮”。我们的板子除了重置之外没有其他按钮,但是如果没有它,我们仍然可以通过某种方式进行管理。
|
||||
|
||||
##### init 函数
|
||||
#### init 函数
|
||||
|
||||
将这段代码添加到 `init` 函数:
|
||||
|
||||
@ -237,9 +236,9 @@ rtos.IRQ(irq.EXTI4_15).Enable()
|
||||
|
||||
我们使用 EXTI 外设来跟踪 PA4 状态。它被配置为在发生任何更改时都会产生中断。
|
||||
|
||||
##### btnWait 函数
|
||||
#### btnWait 函数
|
||||
|
||||
定义一个新的辅助功能:
|
||||
定义一个新的辅助函数:
|
||||
|
||||
```
|
||||
func btnWait(state int, deadline int64) bool {
|
||||
@ -254,7 +253,7 @@ func btnWait(state int, deadline int64) bool {
|
||||
}
|
||||
```
|
||||
|
||||
它等待 “button” 引脚上的指定状态,但只等到最后期限出现。这是稍微改进的轮询代码:
|
||||
它等待 “按钮” 引脚上的指定状态,但只等到最后期限出现。这是稍微改进的轮询代码:
|
||||
|
||||
```
|
||||
for btn.Load() != state {
|
||||
@ -264,9 +263,9 @@ for btn.Load() != state {
|
||||
}
|
||||
```
|
||||
|
||||
我们的 `btnWait` 函数不是忙于等待状态或截止日期,而是使用 `rtos.EventFlag` 类型的 `btnev` 变量休眠,直到有事情发生。您当然可以使用通道而不是 `rtos.EventFlag`,但是后者便宜得多。
|
||||
我们的 `btnWait` 函数不是忙于等待 `state` 或 `deadline`,而是使用 `rtos.EventFlag` 类型的 `btnev` 变量休眠,直到有事情发生。你当然可以使用通道而不是 `rtos.EventFlag`,但是后者便宜得多。
|
||||
|
||||
##### main 函数
|
||||
#### main 函数
|
||||
|
||||
我们需要全新的 `main` 函数:
|
||||
|
||||
@ -331,11 +330,11 @@ func main() {
|
||||
}
|
||||
```
|
||||
|
||||
我们使用 `rtos.Nanosec` 函数代替 `time.Now` 来获取当前时间。这样可以节省大量的 Flash,但也使我们的时钟变成了不知道日、月、年的老式设备,最糟糕的是它无法处理夏令时的变化。
|
||||
我们使用 `rtos.Nanosec` 函数代替 `time.Now` 来获取当前时间。这样可以节省大量的闪存,但也使我们的时钟变成了不知道日、月、年的老式设备,最糟糕的是它无法处理夏令时的变化。
|
||||
|
||||
我们的环有 24 个 LED,因此秒针的显示精度可以达到 2.5 秒。为了不牺牲这种精度并获得流畅的运行效果,我们使用 1/4 秒作为基准间隔。半秒就足够了,但四分之一秒更准确,而且与 16 和 48 个 LED 配合使用也很好。
|
||||
|
||||
红色、绿色和蓝色分别用于时针、分针和秒针。这允许我们使用简单的 `逻辑或操作` 进行颜色混合。我们 `Color.Blend` 方法可以混合任意颜色,但是我们缺少 Flash,所以我们选择最简单的解决方案。
|
||||
红色、绿色和蓝色分别用于时针、分针和秒针。这允许我们使用简单的“逻辑或操作”进行颜色混合。我们 `Color.Blend` 方法可以混合任意颜色,但是我们闪存不多,所以我们选择最简单的解决方案。
|
||||
|
||||
我们只有在秒针移动时才重画时钟。
|
||||
|
||||
@ -345,9 +344,9 @@ btnWait(0, int64(qs+ds)*25e7)
|
||||
|
||||
上面的这行代码等待的正是那一刻,或者是按钮的按下。
|
||||
|
||||
每按一下按钮就会把时钟向前调一调。按住按钮一段时间会产生加速度。
|
||||
每按一下按钮就会把时钟向前调一调。按住按钮一段时间会加速调整。
|
||||
|
||||
##### 中断
|
||||
#### 中断
|
||||
|
||||
定义新的中断处理程序:
|
||||
|
||||
@ -363,12 +362,11 @@ func exti4_15ISR() {
|
||||
|
||||
并将 `irq.EXTI4_15: exti4_15ISR` 条目添加到 ISR 数组。
|
||||
|
||||
该处理程序(或中断服务程序)处理 EXTI4_15 IRQ。 Cortex-M0 CPU 支持的 IRQ 明显少于其较大的同类兄弟处理器,因此您经常可以看到一个 IRQ 被多个中断源共享。在我们的例子中,一个 IRQ 由 12 个 EXTI 线共享。
|
||||
该处理程序(或中断服务程序)处理 EXTI4_15 IRQ。 Cortex-M0 CPU 支持的 IRQ 明显少于其较大的同类兄弟处理器,因此你经常可以看到一个 IRQ 被多个中断源共享。在我们的例子中,一个 IRQ 由 12 个 EXTI 线共享。
|
||||
|
||||
exti4_15ISR 读取所有挂起的位,并从中选择 12 个更高的有效位。接下来,它清除 EXTI 中选中的位并开始处理它们。在我们的例子中,仅检查第 4 位。 `btnev.Signal(1)` 引发 `btnev.Wait(1, deadline)` 唤醒并返回 true。
|
||||
exti4_15ISR 读取所有挂起的位,并从中选择 12 个更高的有效位。接下来,它清除 EXTI 中选中的位并开始处理它们。在我们的例子中,仅检查第 4 位。 `btnev.Signal(1)` 引发 `btnev.Wait(1, deadline)` 唤醒并返回 `true`。
|
||||
|
||||
|
||||
您可以在 [Github][24] 上找到完整的代码。让我们来编译它:
|
||||
你可以在 [Github][24] 上找到完整的代码。让我们来编译它:
|
||||
|
||||
```
|
||||
$ egc
|
||||
@ -377,7 +375,7 @@ $ arm-none-eabi-size cortexm0.elf
|
||||
15960 240 216 16416 4020 cortexm0.elf
|
||||
```
|
||||
|
||||
这里所有的改进只有 184 个字节。让我们再次重新构建所有内容,但这次在 typeinfo 中不使用任何类型和字段名:
|
||||
这里所有的改进只得到 184 个字节。让我们再次重新构建所有内容,但这次在 typeinfo 中不使用任何类型和字段名:
|
||||
|
||||
```
|
||||
$ cd $HOME/emgo
|
||||
@ -389,26 +387,22 @@ $ arm-none-eabi-size cortexm0.elf
|
||||
15120 240 216 15576 3cd8 cortexm0.elf
|
||||
```
|
||||
|
||||
现在,有了千字节的空闲空间,您可以改进一些东西。让我们看看它是如何工作的:
|
||||
现在,有了千字节的空闲空间,你可以改进一些东西。让我们看看它是如何工作的:
|
||||
|
||||
原文中插入视频的代码:
|
||||
<video width="576" height="324" controls="" preload="auto">
|
||||
<source src="https://ziutek.github.io/videos/rgbclock.mp4" type="video/mp4">
|
||||
Sorry, your browser doesn't support embedded videos.
|
||||
</video>
|
||||

|
||||
|
||||
我不知道我是怎么精确打到 3:00 的!?
|
||||
|
||||
以上就是所有内容!在第 4 部分(本系列的结束)中,我们将尝试在 LCD 上显示一些内容。
|
||||
以上就是所有内容!在第 4 部分(本系列的结束)中,我们将尝试在 LCD 上显示一些内容。(LCTT 译注:然而烂尾了,第三篇写于 2018 年,整个博客当年就停更了。)
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://ziutek.github.io/2018/05/03/go_on_very_small_hardware3.html
|
||||
|
||||
作者:[-;Michał Derkacz][a]
|
||||
作者:[Michał Derkacz][a]
|
||||
选题:[lujun9972][b]
|
||||
译者:[gxlct008](https://github.com/gxlct008)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
校对:[wxy](https://github.com/wxy)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
@ -416,8 +410,8 @@ via: https://ziutek.github.io/2018/05/03/go_on_very_small_hardware3.html
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://ziutek.github.io/images/mcu/f030-demo-board/board.jpg
|
||||
[2]: https://ziutek.github.io/2018/05/03/go_on_very_small_hardware3.html
|
||||
[3]: https://ziutek.github.io/2018/03/30/go_on_very_small_hardware.html
|
||||
[4]: https://ziutek.github.io/2018/04/14/go_on_very_small_hardware2.html
|
||||
[3]: https://linux.cn/article-11383-1.html
|
||||
[4]: https://linux.cn/article-12747-1.html
|
||||
[5]: http://www.world-semi.com/solution/list-4-1.html
|
||||
[6]: https://ziutek.github.io/images/led/ws2812b.jpg
|
||||
[7]: http://www.martinhubacek.cz/arm/improved-stm32-ws2812b-library
|
@ -0,0 +1,60 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: (chenmu-kk)
|
||||
[#]: reviewer: (wxy)
|
||||
[#]: publisher: (wxy)
|
||||
[#]: url: (https://linux.cn/article-12803-1.html)
|
||||
[#]: subject: (Most enterprise networks can't handle big data loads)
|
||||
[#]: via: (https://www.networkworld.com/article/3440519/most-enterprise-networks-cant-handle-big-data-loads.html)
|
||||
[#]: author: (Andy Patrizio https://www.networkworld.com/author/Andy-Patrizio/)
|
||||
|
||||
大多数企业网络无法处理大数据负载
|
||||
======
|
||||
|
||||
> 随着网络中流动着越来越多的数据,由于领导力和技术问题,网络正在滞后于数据的发展速度。
|
||||
|
||||

|
||||
|
||||
又过了一周,另一项调查发现,IT 已经无法跟上不断膨胀的数据过载。这次的问题将主要是网络带宽和整体性能。
|
||||
|
||||
管理咨询公司埃森哲对 [300 名 IT 专业人士进行的一项调查][1] 发现,大多数人认为他们企业网络无法胜任处理大数据的任务和物联网部署的任务。只有 43% 的受访公司表示他们的网络已经准备好支持云服务、物联网和其他数字技术。
|
||||
|
||||
一个关键原因(58%)是“IT 与商业需求之间的错位”,这延缓了这些项目的进展。这是一个不同寻常的发现,因为 85% 的受访者还表示他们的网络已经完全或者大体上已经准备好支持企业的数字化计划。那么,究竟是哪一种情况呢?
|
||||
|
||||
第二和第三大时常提及的障碍是“业务需求和运营需求间固有的复杂性”以及“对带宽、性能等方面的需求超过交付能力”,各占 45%。
|
||||
|
||||
由于分析技术和其他大数据技术的推动,大量传输的数据持续涌入网络线路,网络瓶颈持续增长。调查发现,带宽需求并未得到满足,目前的网络性能依旧达不到要求。
|
||||
|
||||
其他原因还包括缺乏网络技术、设备扩展和设备老化。
|
||||
|
||||
### 网络性能问题的一个解决方案:SDN
|
||||
|
||||
埃森哲发现,大多数公司表示 [软件定义网络(SDN)][5] 是应对带宽和性能挑战的解决方案,77% 的受访企业在调查中表示正在部署 SDN 或者已完成部署。它指出,虽然 SDN 可能在组织的某部分中存在,它并不总是在整个企业范围内统一地推出。
|
||||
|
||||
如今看来,似乎从未有人有足够的预算来满足他们所有的 IT 雄心,但 31% 受访者认为为网络改善提供资金是“简单的”,而且是在网络基础设施团队的控制范围内,相较于直接下属(13%)或基础设施/网络主管和副总裁(19%),首席信息官/首席技术官更可能将融资过程报告为“轻松”(40%)。
|
||||
|
||||
报告指出,“仅靠传统网络无法支持数字时代所需的创新和性能。”报告呼吁拥抱新技术,但没有提到 SDN 的名字。同时它还呼吁首席执行官和他们直接下属间加强合作,因为很明显,双方在看待问题的方式上存在分歧。
|
||||
|
||||
报告总结说,“我们认为需要一种新的网络范式来确保网络满足当前和未来的业务需求。然而,尽管有进步的迹象,但变革的步伐缓慢。公司必须承担起重担,才能实现统一和标准化企业能力,提供必要的带宽、性能和安全,以支持当前和未来的业务需求”。
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://www.networkworld.com/article/3440519/most-enterprise-networks-cant-handle-big-data-loads.html
|
||||
|
||||
作者:[Andy Patrizio][a]
|
||||
选题:[lujun9972][b]
|
||||
译者:[chenmu-kk](https://github.com/chenmu-kk)
|
||||
校对:[wxy](https://github.com/wxy)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://www.networkworld.com/author/Andy-Patrizio/
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://www.accenture.com/_acnmedia/pdf-107/accenture-network-readiness-survey.pdf#zoom=50
|
||||
[2]: https://www.networkworld.com/article/3209131/lan-wan/what-sdn-is-and-where-its-going.html
|
||||
[3]: https://www.networkworld.com/article/3206709/lan-wan/what-s-the-difference-between-sdn-and-nfv.html
|
||||
[4]: https://www.networkworld.com/newsletters/signup.html
|
||||
[5]: https://www.networkworld.com/article/3209131/what-sdn-is-and-where-its-going.html
|
||||
[6]: https://www.networkworld.com/blog/itaas-and-the-corporate-storage-technology/
|
||||
[7]: https://www.networkworld.com/article/3405522/how-network-pros-acquire-skills-for-sdn-programmable-networks.html
|
||||
[8]: https://www.facebook.com/NetworkWorld/
|
||||
[9]: https://www.linkedin.com/company/network-world
|
@ -0,0 +1,202 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: (geekpi)
|
||||
[#]: reviewer: (wxy)
|
||||
[#]: publisher: (wxy)
|
||||
[#]: url: (https://linux.cn/article-12783-1.html)
|
||||
[#]: subject: (How to Install Ubuntu Server on a Raspberry Pi)
|
||||
[#]: via: (https://itsfoss.com/install-ubuntu-server-raspberry-pi/)
|
||||
[#]: author: (Dimitrios Savvopoulos https://itsfoss.com/author/dimitrios/)
|
||||
|
||||
如何在树莓派上安装 Ubuntu 服务器?
|
||||
======
|
||||
|
||||
![][6]
|
||||
|
||||
[树莓派][1]是最著名的[单板计算机][2]。最初,树莓派项目的范围旨在促进学校和发展中国家的计算机基础科学的教学。
|
||||
|
||||
它的低成本、便携性和极低的功耗,使得它的受欢迎程度远远超过预期。从气象站到家庭自动化,玩家们用树莓派搭建了许多[酷炫的项目][3]。
|
||||
|
||||
[第四代树莓派][4]具备了普通台式电脑的功能和处理能力。但本文并不是要介绍如何使用树莓派作为桌面。相反,我会告诉你如何在树莓派上安装 Ubuntu 服务器。
|
||||
|
||||
在本教程中,我将使用树莓派 4,以下是我将介绍的内容:
|
||||
|
||||
* 在 microSD 卡上安装 Ubuntu 服务器
|
||||
* 在树莓派上设置无线网络连接
|
||||
* 通过 SSH 访问你的树莓派
|
||||
|
||||
![][5]
|
||||
|
||||
**本教程需要以下设备**:
|
||||
|
||||
* 一张 micro SD 卡(建议使用 8GB 或更大的卡)
|
||||
* 一台带有 micro SD 卡读卡器的计算机(运行 Linux、Windows 或 macOS)
|
||||
* 树莓派 2、3 或 4
|
||||
* 良好的互联网连接
|
||||
* 用于树莓派 2 和 3 的 HDMI 线和用于树莓派 4 的 micro HDMI 线(可选)
|
||||
* 一套 USB 键盘(可选)
|
||||
|
||||
### 在树莓派上安装 Ubuntu 服务器
|
||||
|
||||
在本教程中,我使用 Ubuntu 来创建树莓派 SD 卡,但你可以在其他 Linux 发行版、macOS 和 Windows 上创建它。这是因为准备 SD 卡的步骤对 Raspberry Pi Imager 工具而言是一样的。
|
||||
|
||||
Raspberry Pi Imager 工具会自动下载你[选择的树莓派系统][7]镜像。这意味着你需要一个良好的网络连接来下载 1GB 左右的数据。
|
||||
|
||||
#### 步骤 1:用 Raspberry Pi Imager 准备 SD 卡
|
||||
|
||||
确保你已将 microSD 卡插入电脑,并在电脑上安装 Raspberry Pi Imager。
|
||||
|
||||
你可以从这些链接中下载适合你操作系统的 Imager 工具:
|
||||
|
||||
* [用于 Ubuntu/Debian 的 Raspberry Pi Imager][8]
|
||||
* [用于 Windows 的 Raspberry Pi Imager][9]
|
||||
* [用于 MacOS 的 Raspberry Pi Imager][10]
|
||||
|
||||
尽管我使用的是 Ubuntu,但我不会使用上面列出的 Debian 软件包,而是使用命令行安装 snap 包。这个方法可以适用于更广泛的 Linux 发行版。
|
||||
|
||||
```
|
||||
sudo snap install rpi-imager
|
||||
```
|
||||
|
||||
安装好 Raspberry Pi Imager 工具后,找到并打开它,点击 “CHOOSE OS” 菜单。
|
||||
|
||||
![][11]
|
||||
|
||||
滚动菜单并点击 “Ubuntu” (“核心”和“服务器”镜像)。
|
||||
|
||||
![][12]
|
||||
|
||||
从可用的镜像中,我选择了 Ubuntu 20.04 LTS 64 位。如果你有一个树莓派 2,那你只能选择 32 位镜像。
|
||||
|
||||
**重要提示:如果你使用的是最新的树莓派 4 - 8 GB 内存型号,你应该选择 64 位操作系统,否则只能使用 4 GB 内存。**
|
||||
|
||||
![][13]
|
||||
|
||||
从 “SD Card” 菜单中选择你的 microSD 卡,然后点击 “WRITE”。
|
||||
|
||||
![][14]
|
||||
|
||||
如果它显示一些错误,请尝试再次写入它。现在它将下载 Ubuntu 服务器镜像并将其写入 micro SD 卡。
|
||||
|
||||
当这个过程完成时,它将通知你。
|
||||
|
||||
![][15]
|
||||
|
||||
#### 步骤 2:在 Ubuntu 服务器上添加 WiFi 支持
|
||||
|
||||
烧录完 micro SD 卡后,你就差不多可以使用它了。在使用它之前,有一件事情你可能想做,那就是添加 Wi-Fi 支持。
|
||||
|
||||
SD 卡仍然插入读卡器中,打开文件管理器,找到卡上的 “system-boot” 分区。
|
||||
|
||||
你要找的和需要编辑的文件名为 `network-config`。
|
||||
|
||||
![][16]
|
||||
|
||||
这个过程也可以在 Windows 和 MacOS 上完成。如前所述,编辑 `network-config` 文件,添加你的 Wi-Fi 凭证。
|
||||
|
||||
首先,取消矩形框内的行的注释(删除开头的标签 `#`)。
|
||||
|
||||
之后,将 `myhomewifi` 替换为你的 Wi-Fi 网络名,比如 `"itsfoss"`,将 `"S3kr1t"` 替换为 Wi-Fi 密码,用引号括起来,比如 `"12345679"`。
|
||||
|
||||
![][17]
|
||||
|
||||
它可能看上去像这样:
|
||||
|
||||
```
|
||||
wifis:
|
||||
wlan0:
|
||||
dhcp4: true
|
||||
optional: true
|
||||
access-points:
|
||||
"your wifi name":
|
||||
password: "your_wifi_password"
|
||||
```
|
||||
|
||||
保存文件并将 micro SD 卡插入到你的树莓派中。在第一次启动时,如果你的树莓派无法连接到 Wi-Fi 网络,只需重启你的设备。
|
||||
|
||||
#### 步骤 3:在树莓派上使用 Ubuntu 服务器(如果你有专门的显示器、键盘和鼠标的话)
|
||||
|
||||
如果你有一套额外的鼠标,键盘和显示器,你可以很容易地像其他电脑一样使用树莓派(但没有 GUI)。
|
||||
|
||||
只需将 micro SD 卡插入树莓派,连接显示器、键盘和鼠标。现在[打开你的树莓派][18]。它将出现 TTY 登录屏幕(黑色终端屏幕)并询问用户名和密码。
|
||||
|
||||
* 默认用户名:`ubuntu`
|
||||
* 默认密码:`ubuntu`
|
||||
|
||||
看到提示符时,用 `ubuntu` 作为密码。登录成功后,[Ubuntu 会要求你更改默认密码][19]。
|
||||
|
||||
享受你的 Ubuntu 服务器吧!
|
||||
|
||||
#### 步骤 3:通过 SSH 远程连接到你的树莓派(如果你没有树莓派的显示器、键盘和鼠标的话)
|
||||
|
||||
如果你没有专门与树莓派一起使用的显示器也没关系。当你可以直接通过 SSH 进入它并按照你的方式使用它时,谁还需要一个带有显示器的服务器呢?
|
||||
|
||||
**在 Ubuntu 和 Mac OS**上,通常已经安装了一个 SSH 客户端。要远程连接到你的树莓派,你需要找到它的 IP 地址。检查[连接到你的网络的设备][20],看看哪个是树莓派。
|
||||
|
||||
由于我没有 Windows 机器,你可以访问[微软][21]提供的综合指南。
|
||||
|
||||
打开终端,运行以下命令:
|
||||
|
||||
```
|
||||
ssh ubuntu@raspberry_pi_ip_address
|
||||
```
|
||||
|
||||
你可能会看到以下信息确认连接:
|
||||
|
||||
```
|
||||
Are you sure you want to continue connecting (yes/no/[fingerprint])?
|
||||
```
|
||||
|
||||
输入 `yes`,然后点击回车键。
|
||||
|
||||
![][22]
|
||||
|
||||
当提示时,用前面提到的 `ubuntu` 作为密码。当然,你会被要求更改密码。
|
||||
|
||||
完成后,你将自动注销,你必须使用新密码重新连接。
|
||||
|
||||
你的 Ubuntu 服务器就可以在树莓派上运行了!
|
||||
|
||||
### 总结
|
||||
|
||||
在树莓派上安装 Ubuntu 服务器是一个简单的过程,而且它的预配置程度很高,使用起来很愉快。
|
||||
|
||||
我不得不说,在所有[我在树莓派上尝试的操作系统][7]中,Ubuntu 服务器是最容易安装的。我并没有夸大其词。请查看我的[在树莓派上安装 Arch Linux][23] 的指南,以供参考。
|
||||
|
||||
希望这篇指南也能帮助你在树莓派上安装 Ubuntu 服务器。如果你有问题或建议,请在评论区告诉我。
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://itsfoss.com/install-ubuntu-server-raspberry-pi/
|
||||
|
||||
作者:[Dimitrios Savvopoulos][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://itsfoss.com/author/dimitrios/
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://www.raspberrypi.org/
|
||||
[2]: https://itsfoss.com/raspberry-pi-alternatives/
|
||||
[3]: https://itsfoss.com/raspberry-pi-projects/
|
||||
[4]: https://itsfoss.com/raspberry-pi-4/
|
||||
[5]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/09/Ubuntu-Server-20.04.1-LTS-aarch64.png?resize=800%2C600&ssl=1
|
||||
[6]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/09/ubuntu-server-raspberry-pi.png?resize=800%2C450&ssl=1
|
||||
[7]: https://itsfoss.com/raspberry-pi-os/
|
||||
[8]: https://downloads.raspberrypi.org/imager/imager_amd64.deb
|
||||
[9]: https://downloads.raspberrypi.org/imager/imager.exe
|
||||
[10]: https://downloads.raspberrypi.org/imager/imager.dmg
|
||||
[11]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/09/raspberry-pi-imager.png?resize=800%2C600&ssl=1
|
||||
[12]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/09/raspberry-pi-imager-choose-ubuntu.png?resize=800%2C600&ssl=1
|
||||
[13]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/09/raspberry-pi-imager-ubuntu-server.png?resize=800%2C600&ssl=1
|
||||
[14]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/09/raspberry-pi-imager-sd-card.png?resize=800%2C600&ssl=1
|
||||
[15]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/09/ubuntu-server-installed-raspberry-pi.png?resize=799%2C506&ssl=1
|
||||
[16]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/09/ubuntu-server-pi-network-config.png?resize=800%2C565&ssl=1
|
||||
[17]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/09/Ubuntu-server-wifi.png?resize=800%2C600&ssl=1
|
||||
[18]: https://itsfoss.com/turn-on-raspberry-pi/
|
||||
[19]: https://itsfoss.com/change-password-ubuntu/
|
||||
[20]: https://itsfoss.com/how-to-find-what-devices-are-connected-to-network-in-ubuntu/
|
||||
[21]: https://docs.microsoft.com/en-us/windows-server/administration/openssh/openssh_install_firstuse
|
||||
[22]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/09/ubuntu-server-change-password.png?resize=800%2C600&ssl=1
|
||||
[23]: https://itsfoss.com/install-arch-raspberry-pi/
|
@ -0,0 +1,59 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: (chenmu-kk)
|
||||
[#]: reviewer: (wxy)
|
||||
[#]: publisher: (wxy)
|
||||
[#]: url: (https://linux.cn/article-12768-1.html)
|
||||
[#]: subject: (My first contribution to open source: Making a decision)
|
||||
[#]: via: (https://opensource.com/article/19/11/my-first-open-source-contribution-mistake-decisions)
|
||||
[#]: author: (Galen Corey https://opensource.com/users/galenemco)
|
||||
|
||||
我的第一次开源贡献:做出决定
|
||||
======
|
||||
|
||||
> 一位新的开源贡献者告诉你如何加入到开源项目中。
|
||||
|
||||

|
||||
|
||||
先前,我把我的第一次开源贡献的拖延归咎于[冒牌综合症][2]。但还有一个我无法忽视的因素:我做出决定太艰难了。在[成千上百万][3]的开源项目中选择时,选择一个要做贡献的项目是难以抉择的。如此重负,以至于我常常不得不关掉我的笔记本去思考:“或许我改天再做吧”。
|
||||
|
||||
错误之二是让我对做出决定的恐惧妨碍了我做出第一次贡献。在理想世界里,也许开始我的开源之旅时,心中就已经有了一个真正关心和想去做的具体项目,但我有的只是总得为开源项目做出贡献的模糊目标。对于那些处于同一处境的人来说,这儿有一些帮助我挑选出合适的项目(或者至少是一个好的项目)来做贡献的策略。
|
||||
|
||||
### 经常使用的工具
|
||||
|
||||
一开始,我不认为有必要将自己局限于已经熟悉的工具或项目。有一些项目我之前从未使用过,但由于它们的社区很活跃,或者它们解决的问题很有趣,因此看起来很有吸引力。
|
||||
|
||||
但是,考虑我投入到这个项目中的时间有限,我决定继续投入到我了解的工具上去。要了解工具需求,你需要熟悉它的工作方式。如果你想为自己不熟悉的项目做贡献,则需要完成一个额外的步骤来了解代码的功能和目标。这个额外的工作量可能是有趣且值得的,但也会使你的工作时间加倍。因为我的目标主要是贡献,投入到我了解的工具上是缩小范围的很好方式。回馈一个你认为有用的项目也是有意义的。
|
||||
|
||||
### 活跃而友好的社区
|
||||
|
||||
在选择项目的时候,我希望在那里有人会审查我写的代码才会觉得有信心。当然,我也希望审核我代码的人是个和善的人。毕竟,把你的作品放在那里接受公众监督是很可怕的。虽然我对建设性的反馈持开放态度,但开发者社区中的一些有毒角落是我希望避免的。
|
||||
|
||||
为了评估我将要加入的社区,我查看了我正在考虑加入的仓库的<ruby>议题<rt>issue</rt></ruby>部分。我要查看核心团队中是否有人定期回复。更重要的是,我试着确保没有人在评论中互相诋毁(这在议题讨论中是很常见的)。我还留意了那些有行为准则的项目,概述了什么是适当的和不适当的在线互动行为。
|
||||
|
||||
### 明确的贡献准则
|
||||
|
||||
因为这是我第一次为开源项目做出贡献,在此过程中我有很多问题。一些项目社区在流程的文档记录方面做的很好,可以用来指导挑选其中的议题并发起拉取请求。 [Gatsby][4] 是这种做法的典范,尽管那时我没有选择它们,因为在此之前我从未使用过该产品。
|
||||
|
||||
这种清晰的文档帮助我们缓解了一些不知如何去做的不安全感。它也给了我希望:项目对新的贡献者是开放的,并且会花时间来查看我的工作。除了贡献准则外,我还查看了议题部分,看看这个项目是否使用了“<ruby>第一个好议题<rt>good first issue</rt></ruby>”标志。这是该项目对初学者开放的另一个迹象(并可以帮助你学会要做什么)。
|
||||
|
||||
### 总结
|
||||
|
||||
如果你还没有计划好选择一个项目,那么选择合适的领域进行你的第一个开源贡献更加可行。列出一系列标准可以帮助自己缩减选择范围,并为自己的第一个拉取请求找到一个好的项目。
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/19/11/my-first-open-source-contribution-mistake-decisions
|
||||
|
||||
作者:[Galen Corey][a]
|
||||
选题:[lujun9972][b]
|
||||
译者:[chenmu-kk](https://github.com/chenmu-kk)
|
||||
校对:[wxy](https://github.com/wxy)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://opensource.com/users/galenemco
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/lightbulb-idea-think-yearbook-lead.png?itok=5ZpCm0Jh (Lightbulb)
|
||||
[2]: https://opensource.com/article/19/10/my-first-open-source-contribution-mistakes
|
||||
[3]: https://github.blog/2018-02-08-open-source-project-trends-for-2018/
|
||||
[4]: https://www.gatsbyjs.org/contributing/
|
@ -0,0 +1,171 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: (MjSeven)
|
||||
[#]: reviewer: (wxy)
|
||||
[#]: publisher: (wxy)
|
||||
[#]: url: (https://linux.cn/article-12772-1.html)
|
||||
[#]: subject: (Use the internet from the command line with curl)
|
||||
[#]: via: (https://opensource.com/article/20/5/curl-cheat-sheet)
|
||||
[#]: author: (Seth Kenlon https://opensource.com/users/seth)
|
||||
|
||||
使用 curl 从命令行访问互联网
|
||||
======
|
||||
|
||||
> 下载我们整理的 curl 备忘录。要在不使用图形界面的情况下从互联网上获取所需的信息,curl 是一种快速有效的方法。
|
||||
|
||||

|
||||
|
||||
`curl` 通常被视作一款非交互式 Web 浏览器,这意味着它能够从互联网上获取信息,并在你的终端中显示,或将其保存到文件中。从表面看,这是 Web 浏览器,类似 Firefox 或 Chromium 所做的工作,只是它们默认情况下会*渲染*信息,而 `curl` 会下载并显示原始信息。实际上,`curl` 命令可以做更多的事情,并且能够使用多种协议与服务器进行双向传输数据,这些协议包括 HTTP、FTP、SFTP、IMAP、POP3、LDAP、SMB、SMTP 等。对于普通终端用户来说,这是一个有用的工具;而对于系统管理员,这非常便捷;对于微服务和云开发人员来说,它是一个质量保证工具。
|
||||
|
||||
`curl` 被设计为在没有用户交互的情况下工作,因此与 Firefox 不同,你必须从头到尾考虑与在线数据的交互。例如,如果想要在 Firefox 中查看网页,你需要启动 Firefox 窗口。打开 Firefox 后,在地址栏或搜索引擎中输入要访问的网站。然后,导航到网站,然后单击要查看的页面。
|
||||
|
||||
对于 `curl` 来说也是如此,不同之处在于你需要一次执行所有操作:在启动 `curl` 的同时提供需要访问的互联网地址,并告诉它是否要将数据保存在终端或文件中。当你必须与需要身份验证的网站或 API 进行交互时,会变得有点复杂,但是一旦你学习了 `curl` 命令语法,它就会变得自然而然。为了帮助你掌握它,我们在一个方便的[备忘录][2]中收集了相关的语法信息。
|
||||
|
||||
### 使用 curl 下载文件
|
||||
|
||||
你可以通过提供指向特定 URL 的链接来使用 `curl` 命令下载文件。如果你提供的 URL 默认为 `index.html`,那么将下载此页面,并将下载的文件显示在终端屏幕上。你可以将数据通过管道传递到 `less`、`tail` 或任何其它命令:
|
||||
|
||||
```
|
||||
$ curl "http://example.com" | tail -n 4
|
||||
<h1>Example Domain</h1>
|
||||
<p>This domain is for use in illustrative examples in documents. You may use this domain in literature without prior coordination or asking for permission.</p>
|
||||
<p><a href="https://www.iana.org/domains/example">More information...</a></p>
|
||||
</div></body></html>
|
||||
```
|
||||
|
||||
由于某些 URL 包含特殊字符,shell 通常会将其解释,因此最安全的做法用引号将 URL 包起来。
|
||||
|
||||
某些文件无法很好的在终端中转换显示。你可以使用 `--remote-name` 选项使文件根据服务器上的命名进行保存:
|
||||
|
||||
```
|
||||
$ curl --remote-name "https://example.com/linux-distro.iso"
|
||||
$ ls
|
||||
linux-distro.iso
|
||||
```
|
||||
|
||||
或者,你可以使用 `--output` 选项来命名你想要下载的内容:
|
||||
|
||||
```
|
||||
curl "http://example.com/foo.html" --output bar.html
|
||||
```
|
||||
|
||||
### 使用 curl 列出带有远程目录的内容
|
||||
|
||||
因为 `curl` 不是交互式的,所以很难浏览页面上的可下载元素。如果你要连接的远程服务器允许,可以使用 `curl` 来列出目录的内容:
|
||||
|
||||
```
|
||||
$ curl --list-only "https://example.com/foo/"
|
||||
```
|
||||
|
||||
### 继续中断下载
|
||||
|
||||
如果你正在下载一个非常大的文件,你可能会发现有时候必须中断下载。`curl` 非常智能,可以确定下载从何处中断并继续下载。这意味着,下一次当你下载一个 4GB 的 Linux 发行版的 ISO 出现问题时,就不必重新开始了。`--continue-at` 的语法有点不寻常:如果你知道下载中断时的字节数,你可以提供给 `curl`;否则,你可以使用单独的一个破折号(`-`)指示 curl 自动检测:
|
||||
|
||||
```
|
||||
$ curl --remote-name --continue-at - "https://example.com/linux-distro.iso"
|
||||
```
|
||||
|
||||
### 下载文件序列
|
||||
|
||||
如果你需要下载多个文件而不是一个大文件,那么 `curl` 可以帮助你解决这个问题。假设你知道要下载的文件的位置和文件名模式,则可以使用 `curl` 的序列标记:中括号里是整数范围的起点和终点。对于输出文件名,使用 `#1` 表示第一个变量:
|
||||
|
||||
```
|
||||
$ curl "https://example.com/file_[1-4].webp" --output "file_#1.webp"
|
||||
```
|
||||
|
||||
如果你需要使用其它变量来表示另一个序列,按照每个变量在命令中出现的顺序表示它们。例如,在这个命令中,`#1` 指目录 `images_000` 到 `images_009`,而 `#2` 指目录 `file_1.webp` 至 `file_4.webp`:
|
||||
|
||||
```
|
||||
$ curl "https://example.com/images_00[0-9]/file_[1-4].webp" --output "file_#1-#2.webp"
|
||||
```
|
||||
|
||||
### 从站点下载所有 PNG 文件
|
||||
|
||||
你也可以仅使用 `curl` 和 `grep` 进行一些基本的 Web 抓取操作,以找到想要下载的内容。例如,假设你需要下载与正在归档网页关联的所有图像,首先,下载引用了图像的页面。将页面内通过管道传输到 `grep`,搜索所需的图片类型(在此示例中为 PNG)。最后,创建一个 `while` 循环来构造下载 URL,并将文件保存到你的计算机:
|
||||
|
||||
```
|
||||
$ curl https://example.com |\
|
||||
grep --only-matching 'src="[^"]*.[png]"' |\
|
||||
cut -d\" -f2 |\
|
||||
while read i; do \
|
||||
curl https://example.com/"${i}" -o "${i##*/}"; \
|
||||
done
|
||||
```
|
||||
|
||||
这只是一个示例,但它展示了 `curl` 与 Unix 管道和一些基本而巧妙的解析结合使用时是多么的灵活。
|
||||
|
||||
### 获取 HTML 头
|
||||
|
||||
用于数据交换的协议在计算机发送通信的数据包中嵌入了大量元数据。HTTP 头是数据初始部分的组件。在连接一个网站出现问题时,查看这些报文头(尤其是响应码)会有所帮助:
|
||||
|
||||
```
|
||||
curl --head "https://example.com"
|
||||
HTTP/2 200
|
||||
accept-ranges: bytes
|
||||
age: 485487
|
||||
cache-control: max-age=604800
|
||||
content-type: text/html; charset=UTF-8
|
||||
date: Sun, 26 Apr 2020 09:02:09 GMT
|
||||
etag: "3147526947"
|
||||
expires: Sun, 03 May 2020 09:02:09 GMT
|
||||
last-modified: Thu, 17 Oct 2019 07:18:26 GMT
|
||||
server: ECS (sjc/4E76)
|
||||
x-cache: HIT
|
||||
content-length: 1256
|
||||
```
|
||||
|
||||
### 快速失败
|
||||
|
||||
响应 200 通常是 HTTP 成功指示符,这是你与服务器连接时通常期望的结果。著名的 404 响应表示找不到页面,而 500 则表示服务器在处理请求时出现了错误。
|
||||
|
||||
要查看协商过程中发生了什么错误,添加 `--show-error` 选项:
|
||||
|
||||
```
|
||||
$ curl --head --show-error "http://opensource.ga"
|
||||
```
|
||||
|
||||
除非你可以访问要连接的服务器,否则这些问题将很难解决,但是 `curl` 通常会尽力连接你指定的地址。有时在网络上进行测试时,无休止的重试似乎只会浪费时间,因此你可以使用 `--fail-early` 选项来强制 `curl` 在失败时迅速退出:
|
||||
|
||||
```
|
||||
curl --fail-early "http://opensource.ga"
|
||||
```
|
||||
|
||||
### 由 3xx 响应指定的重定向查询
|
||||
|
||||
300 这个系列的响应更加灵活。具体来说,301 响应意味着一个 URL 已被永久移动到其它位置。对于网站管理员来说,重新定位内容并留下“痕迹”是一种常见的方式,这样访问旧地址的人们仍然可以找到它。默认情况下,`curl` 不会进行 301 重定向,但你可以使用 `--localtion` 选项使其继续进入 301 响应指向的目标:
|
||||
|
||||
```
|
||||
$ curl "https://iana.org" | grep title
|
||||
<title>301 Moved Permanently</title>
|
||||
$ curl --location "https://iana.org"
|
||||
<title>Internet Assigned Numbers Authority</title>
|
||||
```
|
||||
|
||||
### 展开短网址
|
||||
|
||||
如果你想要在访问短网址之前先查看它们,那么 `--location` 选项非常有用。短网址对于有字符限制的社交网络(当然,如果你使用[现代和开源的社交网络][4]的话,这可能不是问题),或者对于用户不能复制粘贴长地址的印刷媒体来说是有用处的。但是,它们也可能存在风险,因为其目的地址本质上是隐藏的。通过结合使用 `--head` 选项仅查看 HTTP 头,`--location` 选项可以查看一个 URL 的最终地址,你可以查看一个短网址而无需加载其完整的资源:
|
||||
|
||||
```
|
||||
$ curl --head --location "<https://bit.ly/2yDyS4T>"
|
||||
```
|
||||
|
||||
### 下载我们的 curl 备忘录
|
||||
|
||||
一旦你开始考虑了将探索 web 由一条命令来完成,那么 `curl` 就成为一种快速有效的方式,可以从互联网上获取所需的信息,而无需麻烦图形界面。为了帮助你适应到工作流中,我们创建了一个 [curl 备忘录][2],它包含常见的 `curl` 用法和语法,包括使用它查询 API 的概述。
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/20/5/curl-cheat-sheet
|
||||
|
||||
作者:[Seth Kenlon][a]
|
||||
选题:[lujun9972][b]
|
||||
译者:[MjSeven](https://github.com/MjSeven)
|
||||
校对:[wxy](https://github.com/wxy)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://opensource.com/users/seth
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/coverimage_cheat_sheet.png?itok=lYkNKieP (Cheat Sheet cover image)
|
||||
[2]: https://opensource.com/downloads/curl-command-cheat-sheet
|
||||
[3]: https://www.iana.org/domains/example"\>More
|
||||
[4]: https://opensource.com/article/17/4/guide-to-mastodon
|
@ -1,36 +1,35 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: (HankChow)
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
[#]: reviewer: (wxy)
|
||||
[#]: publisher: (wxy)
|
||||
[#]: url: (https://linux.cn/article-12766-1.html)
|
||||
[#]: subject: (Automate your container orchestration with Ansible modules for Kubernetes)
|
||||
[#]: via: (https://opensource.com/article/20/9/ansible-modules-kubernetes)
|
||||
[#]: author: (Seth Kenlon https://opensource.com/users/seth)
|
||||
|
||||
|
||||
使用 Ansible Kubernetes 模块实现容器编排自动化
|
||||
使用 Ansible 的 Kubernetes 模块实现容器编排自动化
|
||||
======
|
||||
> 在云上的 Kubernetes 中结合 Ansible 实现自动化的同时,还可以参照我们的速记表熟悉 Ansible 的 k8s 模块。
|
||||
|
||||
![Ship captain sailing the Kubernetes seas][1]
|
||||
> 将 Kubernetes 与 Ansible 结合实现云端自动化。此外,还可以参照我们的 Ansible 的 k8s 模块速查表。
|
||||
|
||||

|
||||
|
||||
[Ansible][2] 是实现自动化工作的优秀工具,而 [Kubernetes][3] 则是容器编排方面的利器,要是把两者结合起来,会有怎样的效果呢?正如你所猜测的,Ansible + Kubernetes 的确可以实现容器编排自动化。
|
||||
|
||||
### Ansible 模块
|
||||
|
||||
实际上,Ansible 本身只是一个用于解释 YAML 文件的框架。它真正强大之处在于它[丰富的模块][4],所谓<ruby>模块<rt>module</rt></ruby>,就是在 Ansible playbook 中让你得以通过简单配置就能调用外部应用程序的一些工具。
|
||||
实际上,Ansible 本身只是一个用于解释 YAML 文件的框架。它真正强大之处在于它[丰富的模块][4],所谓<ruby>模块<rt>module</rt></ruby>,就是在 Ansible <ruby>剧本<rt>playbook</rt></ruby> 中让你得以通过简单配置就能调用外部应用程序的一些工具。
|
||||
|
||||
Ansible 中有模块可以直接操作 Kubernetes,也有对一些相关组件(例如 [Docker][5] 和 [Podman][6])实现操作的模块。学习使用一个新模块的过程和学习新的终端命令、API 一样,可以先从文档中了解这个模块在调用的时候需要接受哪些参数,以及这些参数在外部应用程序中产生的具体作用。
|
||||
|
||||
### 访问 Kubernetes 集群
|
||||
|
||||
在使用 Ansible Kubernetes 模块之前,先要有能够访问 Kubernetes 集群的权限。在没有权限的情况下,可以尝试使用一个短期账号,但我们更推荐的是按照 Kubernetes 官网上的指引,或是参考 Braynt Son 《[入门 Kubernetes][8]》的教程安装 [Minikube][7]。Minikube 提供了一个单节点 Kubernetes 实例的安装过程,你可以像使用一个完整集群一样对其进行配置和交互。
|
||||
在使用 Ansible Kubernetes 模块之前,先要有能够访问 Kubernetes 集群的权限。在没有权限的情况下,可以尝试使用一个短期在线试用账号,但我们更推荐的是按照 Kubernetes 官网上的指引,或是参考 Braynt Son 《[入门 Kubernetes][8]》的教程安装 [Minikube][7]。Minikube 提供了一个单节点 Kubernetes 实例的安装过程,你可以像使用一个完整集群一样对其进行配置和交互。
|
||||
|
||||
**[下载 [Ansible k8s 速记表][9]]**
|
||||
- 下载 [Ansible k8s 速记表][9](需注册)
|
||||
|
||||
在安装 Minikube 之前,你需要确保你的环境支持虚拟化并安装 `libvirt`,然后对 `libvirt` 用户组授权:
|
||||
|
||||
|
||||
```
|
||||
$ sudo dnf install libvirt
|
||||
$ sudo systemctl start libvirtd
|
||||
@ -42,7 +41,6 @@ $ newgrp libvirt
|
||||
|
||||
为了能够在 Ansible 中使用 Kubernetes 相关的模块,你需要安装以下这些 Python 模块:
|
||||
|
||||
|
||||
```
|
||||
$ pip3.6 install kubernetes --user
|
||||
$ pip3.6 install openshift --user
|
||||
@ -52,9 +50,8 @@ $ pip3.6 install openshift --user
|
||||
|
||||
如果你使用的是 Minikube 而不是完整的 Kubernetes 集群,请使用 `minikube` 命令在本地创建一个最精简化的 Kubernetes 实例:
|
||||
|
||||
|
||||
```
|
||||
`$ minikube start --driver=kvm2 --kvm-network default`
|
||||
$ minikube start --driver=kvm2 --kvm-network default
|
||||
```
|
||||
|
||||
然后等待 Minikube 完成初始化,这个过程所需的时间会因实际情况而异。
|
||||
@ -63,29 +60,26 @@ $ pip3.6 install openshift --user
|
||||
|
||||
集群启动以后,通过 `cluster-info` 选项就可以获取到集群相关信息了:
|
||||
|
||||
|
||||
```
|
||||
$ kubectl cluster-info
|
||||
Kubernetes master is running at <https://192.168.39.190:8443>
|
||||
KubeDNS is running at <https://192.168.39.190:8443/api/v1/namespaces/kube-system/services/kube-dns:dns/proxy>
|
||||
Kubernetes master is running at https://192.168.39.190:8443
|
||||
KubeDNS is running at https://192.168.39.190:8443/api/v1/namespaces/kube-system/services/kube-dns:dns/proxy
|
||||
|
||||
To further debug and diagnose cluster problems, use 'kubectl cluster-info dump'.
|
||||
```
|
||||
|
||||
### 使用 `k8s` 模块
|
||||
|
||||
Ansible 使用 `k8s` 这个模块来实现对 Kubernetes 的操作,在 playbook 中使用 `k8s` 模块就可以对 Kuvernetes 对象进行管理。这个模块描述了 `kubectl` 命令的最终状态,例如对于以下这个使用 `kubectl` 创建新的[命名空间][10]的操作:
|
||||
### 使用 k8s 模块
|
||||
|
||||
Ansible 使用 `k8s` 这个模块来实现对 Kubernetes 的操作,在剧本中使用 `k8s` 模块就可以对 Kuvernetes 对象进行管理。这个模块描述了 `kubectl` 命令的最终状态,例如对于以下这个使用 `kubectl` 创建新的[命名空间][10]的操作:
|
||||
|
||||
```
|
||||
`$ kubectl create namespace my-namespace`
|
||||
$ kubectl create namespace my-namespace
|
||||
```
|
||||
|
||||
这是一个很简单的操作,而对这个操作的最终状态用 YAML 文件来描述是这样的:
|
||||
|
||||
|
||||
```
|
||||
\- hosts: localhost
|
||||
- hosts: localhost
|
||||
tasks:
|
||||
- name: create namespace
|
||||
k8s:
|
||||
@ -95,25 +89,22 @@ Ansible 使用 `k8s` 这个模块来实现对 Kubernetes 的操作,在 playboo
|
||||
state: present
|
||||
```
|
||||
|
||||
如果你使用的是 Minikube,那么主机名应该定义为 `localhost`。需要注意的是,模块中对其它可用参数也定义了对应的语法(例如 `api_version` 和 `kind` 参数)。
|
||||
|
||||
在运行这个 playbook 之前,先通过 `yamllint` 命令验证是否有错误:
|
||||
如果你使用的是 Minikube,那么主机名(`hosts`)应该定义为 `localhost`。需要注意的是,所使用的模块也定义了可用参数的语法(例如 `api_version` 和 `kind` 参数)。
|
||||
|
||||
在运行这个剧本之前,先通过 `yamllint` 命令验证是否有错误:
|
||||
|
||||
```
|
||||
`$ yamllint example.yaml`
|
||||
$ yamllint example.yaml
|
||||
```
|
||||
|
||||
确保没有错误之后,运行 playbook:
|
||||
|
||||
确保没有错误之后,运行剧本:
|
||||
|
||||
```
|
||||
`$ ansible-playbook ./example.yaml`
|
||||
$ ansible-playbook ./example.yaml
|
||||
```
|
||||
|
||||
可以验证新的命名空间是否已经被创建出来:
|
||||
|
||||
|
||||
```
|
||||
$ kubectl get namespaces
|
||||
NAME STATUS AGE
|
||||
@ -127,10 +118,9 @@ my-namespace Active 3s
|
||||
|
||||
### 使用 Podman 拉取容器镜像
|
||||
|
||||
容器是受 Kubernetes 管理的最小单位 Linux 系统,因此 [LXC 项目][11]和 Docker 对容器定义了很多规范。Podman 是一个最新的容器操作工具集,它不需要守护进程就可以运行,为此受到了很多用户的欢迎。
|
||||
|
||||
通过 Podman 可以从 Docker Hub 或者 Quay.io 拉取到容器镜像。这一操作对应的 Ansible 语法也很简单,只需要将存储库网站提供的镜像路径写在 playbook 中的相应位置就可以了:
|
||||
容器是个 Linux 系统,几乎是最小化的,可以由 Kubernetes 管理。[LXC 项目][11]和 Docker 定义了大部分的容器规范。最近加入容器工具集的是 Podman,它不需要守护进程就可以运行,为此受到了很多用户的欢迎。
|
||||
|
||||
通过 Podman 可以从 Docker Hub 或者 Quay.io 等存储库拉取容器镜像。这一操作对应的 Ansible 语法也很简单,只需要将存储库网站提供的镜像路径写在剧本中的相应位置就可以了:
|
||||
|
||||
```
|
||||
- name: pull an image
|
||||
@ -140,13 +130,11 @@ my-namespace Active 3s
|
||||
|
||||
使用 `yamllint` 验证:
|
||||
|
||||
|
||||
```
|
||||
`$ yamllint example.yaml`
|
||||
$ yamllint example.yaml
|
||||
```
|
||||
|
||||
运行 playbook:
|
||||
|
||||
运行剧本:
|
||||
|
||||
```
|
||||
$ ansible-playbook ./example.yaml
|
||||
@ -171,8 +159,7 @@ localhost: ok=3 changed=1 unreachable=0 failed=0
|
||||
|
||||
### 使用 Ansible 实现部署
|
||||
|
||||
Ansible 除了可以执行小型维护任务以外,还可以通过 playbook 实现其它由 `kubectl` 实现的功能,因为两者的 YAML 文件之间只有少量的差异。 在 Kubernetes 中使用的 YAML 文件只需要稍加改动,就可以在 Ansible playbook 中使用。例如下面这个用于使用 `kubectl` 命令部署 Web 服务器的 YAML 文件:
|
||||
|
||||
Ansible 除了可以执行小型维护任务以外,还可以通过剧本实现其它由 `kubectl` 实现的功能,因为两者的 YAML 文件之间只有少量的差异。在 Kubernetes 中使用的 YAML 文件只需要稍加改动,就可以在 Ansible 剧本中使用。例如下面这个用于使用 `kubectl` 命令部署 Web 服务器的 YAML 文件:
|
||||
|
||||
```
|
||||
apiVersion: apps/v1
|
||||
@ -196,8 +183,7 @@ spec:
|
||||
- containerPort: 80
|
||||
```
|
||||
|
||||
如果你对其中的参数比较熟悉,你只要把 YAML 文件中的大部分内容放到 playbook 中的 `definition` 部分,就可以在 Ansible 中使用了:
|
||||
|
||||
如果你对其中的参数比较熟悉,你只要把 YAML 文件中的大部分内容放到剧本中的 `definition` 部分,就可以在 Ansible 中使用了:
|
||||
|
||||
```
|
||||
- name: deploy a web server
|
||||
@ -230,7 +216,6 @@ spec:
|
||||
|
||||
执行完成后,使用 `kubectl` 命令可以看到预期中的的<ruby>部署<rt>deployment</rt></ruby>:
|
||||
|
||||
|
||||
```
|
||||
$ kubectl -n my-namespace get pods
|
||||
NAME READY STATUS
|
||||
@ -248,7 +233,7 @@ via: https://opensource.com/article/20/9/ansible-modules-kubernetes
|
||||
作者:[Seth Kenlon][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/) 荣誉推出
|
||||
|
@ -1,8 +1,8 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: (wxy)
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
[#]: reviewer: (wxy)
|
||||
[#]: publisher: (wxy)
|
||||
[#]: url: (https://linux.cn/article-12773-1.html)
|
||||
[#]: subject: (Linux Jargon Buster: What is Display Manager in Linux?)
|
||||
[#]: via: (https://itsfoss.com/display-manager/)
|
||||
[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/)
|
||||
@ -12,7 +12,7 @@ Linux 黑话解释:什么是显示管理器?
|
||||
|
||||
> 在这篇 Linux 黑话解释中,你将了解 Linux 中的显示管理器。它是桌面环境的一部分吗?它的作用是什么?
|
||||
|
||||
### 在 Linux 中什么是显示管理器?
|
||||
### 什么是 Linux 中的显示管理器?
|
||||
|
||||
简单来说,<ruby>显示管理器<rt>display manager</rt></ruby>(DM)是一个为你的 Linux 发行版提供图形登录功能的程序。它控制用户会话并管理用户认证。显示管理器会在你输入用户名和密码后,立即启动[显示服务器][1]并加载[桌面环境][2]。
|
||||
|
||||
@ -46,13 +46,13 @@ Linux 黑话解释:什么是显示管理器?
|
||||
|
||||
有这么多的桌面环境可供选择,它们都有自己的显示管理器吗?不,不是这样的。
|
||||
|
||||
正如我之前提到的,可见的登录屏幕被称为欢迎页。这个欢迎页可以被自定义来改变登录屏幕的外观。
|
||||
正如我之前提到的,可见的登录屏幕被称为欢迎页。这个欢迎页可以进行自定义来改变登录屏幕的外观。
|
||||
|
||||
事实上,许多发行版和/或桌面环境都编写了自己的欢迎页,以给用户提供一个类似于他们品牌的登录屏幕。
|
||||
事实上,许多发行版和/或桌面环境都制作了自己的欢迎页,以给用户提供一个类似于他们品牌的登录屏幕。
|
||||
|
||||
例如,Mint 的 Cinnamon 桌面使用了 LightDM,但有自己的欢迎页来给它更多的 Mint 式(或者我应该说是 Cinnamon)的外观。
|
||||
|
||||
![基于 LightDM 的 Linux Mint 登录屏幕][9]。
|
||||
![基于 LightDM 的 Linux Mint 登录屏幕][9]
|
||||
|
||||
来看看 Kali Linux 的登录界面:
|
||||
|
||||
@ -66,7 +66,7 @@ Linux 黑话解释:什么是显示管理器?
|
||||
|
||||
![][12]
|
||||
|
||||
如果当时没有做切换,那么以后可以通过手动配置来改变显示管理器。不同的发行版重新配置显示管理器的方法略有不同,不在本文讨论范围内。
|
||||
如果当时没有做切换,那么以后可以通过手动配置来改变显示管理器。不同的发行版重新配置显示管理器的方法略有不同,这不在本文讨论范围内。
|
||||
|
||||
### 结语
|
||||
|
||||
@ -81,7 +81,7 @@ via: https://itsfoss.com/display-manager/
|
||||
作者:[Abhishek Prakash][a]
|
||||
选题:[lujun9972][b]
|
||||
译者:[wxy](https://github.com/wxy)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
校对:[wxy](https://github.com/wxy)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
@ -0,0 +1,95 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: (geekpi)
|
||||
[#]: reviewer: (wxy)
|
||||
[#]: publisher: (wxy)
|
||||
[#]: url: (https://linux.cn/article-12769-1.html)
|
||||
[#]: subject: (Try Linux on any computer with this bootable USB tool)
|
||||
[#]: via: (https://opensource.com/article/20/10/fedora-media-writer)
|
||||
[#]: author: (Sumantro Mukherjee https://opensource.com/users/sumantro)
|
||||
|
||||
用这个创建可引导 USB 的工具在电脑上尝试 Linux
|
||||
======
|
||||
|
||||
> Fedora Media Writer 是创建临场版 USB 以尝试 Linux 的方便方法。
|
||||
|
||||

|
||||
|
||||
[Fedora Media Writer][2] 是一个小巧、轻量、全面的工具,它简化了 Linux 的入门体验。它可以下载 Fedora 的 Workstation 或 Server 版本并写入到一个可以在任何系统上引导的 USB 驱动器上,使你无需将其安装到硬盘上就可以试用 Fedora Linux。
|
||||
|
||||
Media Writer 工具可以用来创建一个<ruby>临场体验的<rt>Live</rt></ruby>、可引导的 USB 驱动器。在你的平台上安装 Fedora Media Writer 应用后,你可以下载并烧录最新的 Fedora Workstation 或 Server 稳定版,也可以选择烧录你下载的任何其他镜像。而且它并不局限于英特尔 64 位设备。它还可以用于 ARM 设备,如[树莓派][3],这些设备日益变得更加强大和有用。
|
||||
|
||||
![Fedora Media Writer main screen][4]
|
||||
|
||||
### 安装 Fedora Media Writer
|
||||
|
||||
[安装 Fedora Media Writer][6] 有几种方式。你可以通过 GitHub [从源码编译][7]、下载 MacOS 或 Windows 版本、使用 `dnf` 或 `yum` 安装 RPM 包,或者以 Flatpak 的形式获得。
|
||||
|
||||
在 Fedora 上:
|
||||
|
||||
```
|
||||
$ sudo dnf install mediawriter
|
||||
```
|
||||
|
||||
最新版本请参见 GitHub 仓库的[发布][8]部分。
|
||||
|
||||
### 准备好你的媒体介质
|
||||
|
||||
首先,你需要一个 USB 驱动器来安装你的 Linux 操作系统。这就是 Fedora Media Writer 要烧录的设备。这个驱动器必须是空白或可擦除的,因为 **该 USB 驱动器上的所有数据都会被删除**。如果有任何数据,哪怕只是一个文件,如果你不想丢失,那么你必须在继续之前备份它!
|
||||
|
||||
确认你的 USB 驱动器是可擦除的之后,将它插入你的电脑并启动 Fedora Media Writer。
|
||||
|
||||
### 使用 Fedora Media Writer
|
||||
|
||||
当你启动 Fedora Media Writer 时,你会看到一个页面,提示你从互联网上获取一个可引导的镜像,或者从你的硬盘上加载一个自定义镜像。第一个选择是 Fedora 的最新版本。Workstation 版本适用于台式机和笔记本电脑,Server 版本适用于虚拟化、机架服务器或任何你想作为服务器运行的情况。
|
||||
|
||||
如果你选择了 Fedora 镜像,Media Writer 会下载一个光盘镜像(通常称为 “iso”,文件扩展名为 .iso),并将其保存到你的下载文件夹中,这样你就可以重复使用它来烧录另一个驱动器。
|
||||
|
||||
![Select your image][9]
|
||||
|
||||
另外还有 Fedora Spins,这是来自 Fedora 社区的镜像,它旨在满足小众的兴趣。例如,如果你是 [MATE 桌面][10]的粉丝,那么你会很高兴地发现 Media Writer 提供了 MATE spin。它有很多,所以请滚动查看所有的选择。如果你是 Linux 的新手,不要被吓到或感到困惑:这些额外的选项是为老用户准备的,这些用户除了默认的选项外,还发展出了自己的偏好,所以对你来说,只使用 Workstation 或 Server 选项就行,这取决于你是想把 Fedora 作为一个桌面还是作为一个服务器操作系统来运行。
|
||||
|
||||
如果你需要一个与你当前使用的 CPU 不同架构的镜像,从窗口右上角的下拉菜单中选择 CPU 架构。
|
||||
|
||||
如果你已经将镜像保存在硬盘上,请选择“Custom Image”选项,并选择你要烧录到 USB 的发行版的 .iso 文件。
|
||||
|
||||
### 写入 USB 驱动器
|
||||
|
||||
当你下载或选择了一个镜像,你必须确认你要将该镜像写入驱动器。
|
||||
|
||||
驱动器选择下拉菜单只显示了外部驱动器,所以你不会意外地覆盖自己的硬盘驱动器。这是 Fedora Media Writer 的一个重要功能,它比你在网上看到的许多手动说明要安全得多。然而,如果你的计算机上连接了多个外部驱动器,除了你想覆盖的那个,你应该将它们全部移除,以增加安全性。
|
||||
|
||||
选择你要安装镜像的驱动器,然后单击“Write to Disk”按钮。
|
||||
|
||||
![Media write][11]
|
||||
|
||||
稍等一会儿,镜像就会被写入到你的驱动器,然后可以看看 Don Watkins 对[如何从 USB 驱动器启动到 Linux][12]的出色介绍。
|
||||
|
||||
### 开始使用 Linux
|
||||
|
||||
Fedora Media Writer 是一种将 Fedora Workstation 或 Server,或任何 Linux 发行版烧录到 USB 驱动器的方法,因此你可以在安装它到设备上之前试用它。试试吧,并在评论中分享你的经验和问题。
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/20/10/fedora-media-writer
|
||||
|
||||
作者:[Sumantro Mukherjee][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/sumantro
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/usb-hardware.png?itok=ROPtNZ5V (Multiple USB plugs in different colors)
|
||||
[2]: https://github.com/FedoraQt/MediaWriter
|
||||
[3]: https://fedoraproject.org/wiki/Architectures/ARM/Raspberry_Pi
|
||||
[4]: https://opensource.com/sites/default/files/uploads/fmw_mainscreen.png (Fedora Media Writer main screen)
|
||||
[5]: https://creativecommons.org/licenses/by-sa/4.0/
|
||||
[6]: https://docs.fedoraproject.org/en-US/fedora/f32/install-guide/install/Preparing_for_Installation/#_fedora_media_writer
|
||||
[7]: https://github.com/FedoraQt/MediaWriter#building
|
||||
[8]: https://github.com/FedoraQt/MediaWriter/releases
|
||||
[9]: https://opensource.com/sites/default/files/mediawriter-image.png
|
||||
[10]: https://opensource.com/article/19/12/mate-linux-desktop
|
||||
[11]: https://opensource.com/sites/default/files/mediawriter-write.png (Media write)
|
||||
[12]: https://opensource.com/article/20/4/first-linux-computer
|
@ -1,8 +1,8 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: (wxy)
|
||||
[#]: reviewer: (wxy)
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
[#]: publisher: (wxy)
|
||||
[#]: url: (https://linux.cn/article-12764-1.html)
|
||||
[#]: subject: (Fedora 33 is officially here!)
|
||||
[#]: via: (https://fedoramagazine.org/announcing-fedora-33/)
|
||||
[#]: author: (Matthew Miller https://fedoramagazine.org/author/mattdm/)
|
@ -1,71 +1,69 @@
|
||||
[#]: collector: "lujun9972"
|
||||
[#]: translator: "xiao-song-123"
|
||||
[#]: reviewer: " "
|
||||
[#]: publisher: " "
|
||||
[#]: url: " "
|
||||
[#]: reviewer: "wxy"
|
||||
[#]: publisher: "wxy"
|
||||
[#]: url: "https://linux.cn/article-12776-1.html"
|
||||
[#]: subject: "How open source underpins blockchain technology"
|
||||
[#]: via: "https://opensource.com/article/20/10/open-source-blockchain"
|
||||
[#]: author: "Matt Shealy https://opensource.com/users/mshealy"
|
||||
|
||||
开源是如何支撑区块链技术发展的
|
||||
======
|
||||
创造出区块链安全性和可靠性的原因:是开放,而非监管。
|
||||
|
||||
![cubes coming together to create a larger cube][1]
|
||||
> 创造出区块链安全性和可靠性的原因:是开放,而非监管。
|
||||
|
||||

|
||||
|
||||
当人们发现以安全性而闻名的区块链技术居然是建立在开源软件代码之上时,通常会感到非常惊讶。事实上,正是这种开放性才赋予了区块链技术的安全性和可靠性。
|
||||
|
||||
把任何事物构建成开源的,其核心价值之一就是提高效率。建立起一个有着不同观点和技能的开发人员社区,这些开发人员工作在同一个代码库的时候,可以成倍增加构建出来的应用程序数量以及复杂性。
|
||||
以开源方式构建的任何事物,其核心价值之一就是为了提高效率。建立起一个有着不同观点和技能的开发人员社区,这些开发人员工作在同一个代码库的时候,可以成倍增加构建出来的应用程序数量以及复杂性。
|
||||
|
||||
### 开源比人们想象中的要更加普遍
|
||||
|
||||
开源的 Linux,就是一种比较流行的操作系统。Linux 为服务器提供了许多服务,这些服务让我们可以轻松地共享个人信息。其中包括 Google,Facebook 和数千个主要网站。当我们使用这些服务时,就是在和这些在网络上运行着 Linux 系统的计算机进行交互。Chromebook 也使用 Linux,Android 手机使用的操作系统也是基于 Linux 的。
|
||||
开源的 Linux,就是一种比较流行的操作系统。Linux 为服务器提供了许多服务,这些服务让我们可以轻松地共享个人信息。其中包括 Google、Facebook 和数千个主要网站。当我们使用这些服务时,就是在和这些在网络上运行着 Linux 系统的计算机进行交互。Chromebook 也使用 Linux,Android 手机使用的操作系统也是基于 Linux 的。
|
||||
|
||||
Linux 不属于任何一家公司,人们可以免费使用并且可以共同协作来完善创造它。自 2005 年推出以来,已经有来自 1,700 多家公司的 20,000 多名开发人员 [为其中的代码做出了贡献][2] 。
|
||||
Linux 不属于任何一家公司,人们可以免费使用并且可以共同协作来完善创造它。自 2005 年推出以来,已经有来自 1,700 多家公司的 20,000 多名开发人员 [为其中的代码做出了贡献][2] 。
|
||||
|
||||
这就是开源软件的工作原理。大量的人为此贡献,并不断添加、修改或构建开源代码库来创建新的应用程序和平台。区块链和加密货币的大部分代码都是使用开源软件开发的。开源软件是由热情的用户构建的,这些用户对错误、故障或缺陷时刻保持警惕。当发现问题时,开源社区中的开发人员将一起努力来解决问题。
|
||||
这就是开源软件的运作方式。大量的人为此贡献,并不断添加、修改或构建开源代码库来创建新的应用程序和平台。区块链和加密货币的大部分代码都是使用开源软件开发的。开源软件是由充满热情的用户构建的,这些用户对错误、故障或缺陷时刻保持警惕。当发现问题时,开源社区中的开发人员将一起努力来解决问题。
|
||||
|
||||
### 区块链和开源
|
||||
|
||||
整个开源区块链开发者社区都在不断地添加和完善代码库。
|
||||
|
||||
以下是区块链执行的基本方式:
|
||||
以下是区块链的基本表现方式:
|
||||
|
||||
* 区块链平台具有一个交易数据库,该交易数据库允许对等方在任何时候彼此进行交易。
|
||||
* 附有用户识别标签,以方便交易。
|
||||
* 平台一定有一种安全的方式来在交易批准前对交易进行验证。
|
||||
* 无法被验证的交易不会进行。
|
||||
|
||||
开源软件允许开发者在 [去中心化应用程序(Dapp)][3]中创建这些平台,这是区块链中交易的安全、保障和可变性的关键。
|
||||
|
||||
|
||||
开源软件允许开发者在 [去中心化应用程序(Dapp)][3]中创建这些平台,这是区块链中交易的安全性、安全性和可变性的关键。
|
||||
|
||||
这种去中心化的方式意味着没有中央权威机构来调解交易,没有人能控制发生的事情。直接点对点的交易可以更快速、安全的进行。随着交易记录在分类账簿中,这条交易记录也会分发到系统各处。
|
||||
这种去中心化的方式意味着没有中央权威机构来调解交易,没有人能控制发生的事情。直接的点对点的交易可以更快速、安全的进行。由于交易被记录在分类账簿中,它们也会分发到整个生态系统中。
|
||||
|
||||
区块链使用密码学来保证安全。每一笔交易都携带着与前一笔交易相关联的信息,以验证其真实性。这可以防止威胁者篡改数据,因为一旦数据被添加到公共分类账中,其他用户就不能更改。
|
||||
|
||||
### 区块链是开源的吗?
|
||||
|
||||
虽然区块链本身在技术上可能不是开源的,但区块链系统通常是使用开源软件实现的,因为没有政府机构对其进行监管,所以这些开源软件使用的概念体现了一种开放文化。私人公司开发的用于处理金融交易的专有软件很可能受到 [政府机构 ][4] 的监管。在美国,这可能包括美国证券交易委员会 (SEC)、联邦储备委员会和联邦存款保险公司 (FDIC)。区块链技术在开放环境下使用不需要政府监管,实际上,用来验证交易的是用户社区。
|
||||
虽然区块链本身在技术上可以是不开源的,但区块链系统通常是使用开源软件实现的,因为没有政府机构对其进行监管,所以这些开源软件使用的概念体现了一种开放文化。私人公司开发的用于处理金融交易的专有软件很可能受到 [政府机构][4] 的监管。在美国,这可能包括美国证券交易委员会(SEC)、联邦储备委员会和联邦存款保险公司(FDIC)。区块链技术在开放环境下使用不需要政府监管,实际上,用来验证交易的是用户社区。
|
||||
|
||||
你可以称它为众包的一种极端形式,既用于开发构建区块链平台的开源软件,也用于验证交易。这就是区块链得到如此多关注的原因之一:它有可能颠覆整个行业,因为它可以作为处理和验证交易的权威中介。
|
||||
你可以称它为一种极端的众包形式,既用于开发构建区块链平台的开源软件,也用于验证交易。这就是区块链得到如此多关注的原因之一:它有可能颠覆整个行业,因为它可以作为处理和验证交易的权威中介。
|
||||
|
||||
### 比特币,以太坊和其他加密货币
|
||||
|
||||
截至2020年6月,超过 [5000万人拥有区块链钱包][5] 。他们大多数用于金融交易,例如交易比特币,以太坊和其他加密货币。 与交易员观察股票价格一样,[检查加密货币价格][6] 已成为许多人的主流。
|
||||
截至 2020 年 6 月,超过 [5000 万人拥有区块链钱包][5] 。他们大多数用于金融交易,例如交易比特币、以太坊和其他加密货币。对许多人来说,像交易员观察股票价格一样,[查看加密货币价格][6] 已成为主流。
|
||||
|
||||
加密货币平台也使用开源软件。[以太坊项目][7] 开发出了任何人都可以免费使用的开源软件,社区中大量的开发者都为此贡献了代码。比特币客户端的参考实现版是由 450 多个开发人员和工程师进行开发的,他们已经贡献了超过 150,000 行代码。
|
||||
加密货币平台也使用开源软件。[以太坊项目][7] 开发出了任何人都可以免费使用的开源软件,社区中大量的开发者都为此贡献了代码。比特币客户端的参考实现版是由 450 多个开发人员和工程师进行开发的,他们已经贡献了超过 150,000 个贡献。
|
||||
|
||||
加密货币区块链是一个持续增长的记录。每个被称作为块的记录按顺序链接在一起,它们互相链接形成一条链。每个块都有其自己的唯一标记,这个标记称为 [哈希][8] 。一个块包含自身的哈希值和前一个块密码的哈希值。从本质上讲,每个块都链接到前一个块,形成了无法中断的长链,每个长链都包含有关用于验证交易的其他块的信息。
|
||||
加密货币区块链是一个持续增长的记录。每个被称作为块的记录按顺序链接在一起,它们互相链接形成一条链。每个块都有其自己的唯一标记,这个标记称为 [哈希][8] 。一个块包含自身的哈希值和前一个块的加密计算出的哈希值。从本质上讲,每个块都链接到前一个块,形成了无法中断的长链,每个块都包含其它区块的信息,用于验证交易。
|
||||
|
||||
在金融或是加密货币的区块链中没有中央银行。这些分布在整个互联网中的区块,建立了一个性能强大的审计跟踪系统。任何人都能够通过区块链来验证交易,但却不能更改上面的记录。
|
||||
|
||||
### 牢不可破的区块链
|
||||
|
||||
尽管区块链不受任何政府或机构的监管,但分布式的网络保证了它们的安全。随着区块链的发展,每一笔交易都会增加伪造的难度。区块分布在世界各地的网络中,它们使用的信任标记不可被改变,这条链条变得牢不可破。
|
||||
尽管区块链不受任何政府或机构的监管,但分布式的网络保证了它们的安全。随着链的增长,每一笔交易都会增加伪造的难度。区块分布在世界各地的网络中,它们使用的信任标记不可被改变,这条链条几乎变得牢不可破。
|
||||
|
||||
这种去中心化的网络,其背后的代码是开源的,也是用户在交易中不必使用诸如银行或经纪人之类的中介就可以相互信任的原因之一。支撑加密货币平台的软件是由相互独立的开发者组建的联盟创建的,并且任何人都可以免费使用。这创造了世界上最大的制衡体系之一。
|
||||
这种去中心化的网络,其背后的代码是开源的,这也是用户在交易中不必使用诸如银行或经纪人之类的中介就可以相互信任的原因之一。支撑加密货币平台的软件是由相互独立的开发者组建的联盟创建的,并且任何人都可以免费使用。这创造了世界上最大的制衡体系之一。
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
@ -74,7 +72,7 @@ via: https://opensource.com/article/20/10/open-source-blockchain
|
||||
作者:[Matt Shealy][a]
|
||||
选题:[lujun9972][b]
|
||||
译者:[xiao-song-123](https://github.com/xiao-song-123)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
校对:[wxy](https://github.com/wxy)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
@ -1,8 +1,8 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: (robsean)
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
[#]: reviewer: (wxy)
|
||||
[#]: publisher: (wxy)
|
||||
[#]: url: (https://linux.cn/article-12779-1.html)
|
||||
[#]: subject: (How to Free Up Space in /boot Partition on Ubuntu Linux?)
|
||||
[#]: via: (https://itsfoss.com/free-boot-partition-ubuntu/)
|
||||
[#]: author: (Ankush Das https://itsfoss.com/author/ankush/)
|
||||
@ -10,13 +10,13 @@
|
||||
如何在 Ubuntu Linux 上释放 /boot 分区的空间?
|
||||
======
|
||||
|
||||
前几天,我收到一个警告,/boot 分区已经几乎满了或者已经没有剩余空间了。是的,我有一个独立的 /boot 分区,我相信现在很少有人这样做了。
|
||||
前几天,我收到一个警告,`/boot` 分区已经几乎满了,没有剩余空间了。是的,我有一个独立的 `/boot` 分区,我相信现在很少有人这样做了。(LCTT 译注:个人认为保留单独的 /boot 分区是个好的运维经验,除此以外,/tmp、/var 也单独划定分区比较好。)
|
||||
|
||||
这是我第一次看到这样一个错误,它让我很迷惑。现在,这里有一些 [方法来释放在 Ubuntu 上的分区][1] (或者基于 Ubuntu 的发行版) ,但是在这种情况下并不是所有的方法都能用。
|
||||
这是我第一次看到这样一个错误,它让我很迷惑。现在,这里有一些 [方法来释放在 Ubuntu (或基于 Ubuntu 的分区)上的分区][1] ,但是在这种情况下并不是所有的方法都能用。
|
||||
|
||||
这就是为什么我决定写这些我释放 /boot 分区空间的步骤的原因。
|
||||
这就是为什么我决定写这些我释放 `/boot` 分区空间的步骤的原因。
|
||||
|
||||
### 如何在 Ubuntu 上释放 /boot 分区的空间(如果你的 /boot 分区空间不足)
|
||||
### 如何在 Ubuntu 上释放 /boot 分区的空间
|
||||
|
||||
![][2]
|
||||
|
||||
@ -24,7 +24,7 @@
|
||||
|
||||
#### 方法 1: 使用 apt autoremove
|
||||
|
||||
你不必是一名终端专家来做这件事,它只需要一个命令,你将移除未使用的内核来释放 /boot 分区中是空间。
|
||||
你不必是一名终端专家来做这件事,它只需要一个命令,你将移除未使用的内核来释放 `/boot` 分区中是空间。
|
||||
|
||||
你所有要做的事情是,输入:
|
||||
|
||||
@ -32,7 +32,7 @@
|
||||
sudo apt autoremove
|
||||
```
|
||||
|
||||
这个命令不仅仅可以移除未使用的内核,而且也将摆脱你不需要的或工具安装后所不需要的依赖项。
|
||||
这个命令不仅仅可以移除未使用的内核,而且也将移除你不需要的或工具安装后所不需要的依赖项。
|
||||
|
||||
在你输入命令后,它将列出将被移除的东西,你只需要确认操作即可。如果你很好奇它将移除什么,你可以仔细检查一下看看它实际移除了什么。
|
||||
|
||||
@ -40,13 +40,13 @@ sudo apt autoremove
|
||||
|
||||
![][3]
|
||||
|
||||
你必需按 **Y** 按键来继续。
|
||||
你必须按 `Y` 按键来继续。
|
||||
|
||||
_**值得注意的是,这种方法只在你仅剩余一点点空间并并且得到警告的情况下才有效。但是,如果你的 /boot 分区已经满了,APT 甚至可能不会工作。**_
|
||||
**值得注意的是,这种方法只在你还剩余一点点空间,并且得到警告的情况下才有效。但是,如果你的 `/boot` 分区已经满了,APT 甚至可能不会工作。**
|
||||
|
||||
在接下来的方法中,我将重点介绍两种不同的方法,通过这些方法你可以使用 GUI 和终端来移除旧内核来释放空间。
|
||||
|
||||
#### 方法 2: 手动移除未使用的内核(如果 apt autoremove 不工作的话)
|
||||
#### 方法 2: 手动移除未使用的内核
|
||||
|
||||
在你尝试 [移除一些旧内核][4] 来释放空间前,你需要识别当前活动的内核,并且确保你不会删除它。
|
||||
|
||||
@ -56,43 +56,43 @@ _**值得注意的是,这种方法只在你仅剩余一点点空间并并且
|
||||
uname -r
|
||||
```
|
||||
|
||||
[uname 命令通常用于获取 Linux 系统信息][6] 。在这里,这个命令显示当前正在被使用的 Linux 内核。它看起来应该是这样:
|
||||
[uname 命令通常用于获取 Linux 系统信息][6]。在这里,这个命令显示当前正在被使用的 Linux 内核。它看起来应该是这样:
|
||||
|
||||
![][7]
|
||||
|
||||
现在,你已经知道你当前的 Linux 内核是什么,你必需移除一个不同于这个版本内核的内核。你应该把它记录在某些地方,以便你不会不知不觉地移除它。
|
||||
现在,你已经知道你当前的 Linux 内核是什么,你必须移除一个不同于这个版本的内核。你应该把它记录在某些地方,以便你不会不知不觉地移除它。
|
||||
|
||||
接下来,要移除它,你可以使用终端或 GUI .
|
||||
接下来,要移除它,你可以使用终端或 GUI。
|
||||
|
||||
警告!
|
||||
|
||||
在删除内核时一定要额外的小心。只识别和删除旧内核,而不是当前你正在使用的内核,否则你将会拥有一个残缺的系统。
|
||||
> 警告!
|
||||
>
|
||||
> 在删除内核时一定要额外的小心。只识别和删除旧内核,而不是当前你正在使用的内核,否则你将会拥有一个残缺的系统。
|
||||
|
||||
##### 使用一个 GUI 工具来移除旧的 Linux 内核
|
||||
|
||||
你可以使用 [Synaptic 软件包管理器][8] 或一个类似 [Stacer][9] 的工具来开始。就我个人而言,当我遇到一个满满的 /boot 分区且 apt 损坏是,我使用 [Stacer][6] 来丢弃旧内核。因此,让我向你展示一下它看起的样子。
|
||||
你可以使用 [Synaptic 软件包管理器][8] 或一个类似 [Stacer][9] 的工具来开始。就我个人而言,当我遇到一个满满的 `/boot` 分区且 APT 损坏时,我使用 [Stacer][6] 来丢弃旧内核。因此,让我向你展示一下它看起的样子。
|
||||
|
||||
首先,你需要启动 “**Stacer**” ,然后导航到软件包卸载器,如下面屏幕截图所示。
|
||||
首先,你需要启动 Stacer ,然后导航到软件包卸载器,如下面屏幕截图所示。
|
||||
|
||||
![][10]
|
||||
|
||||
在这里,搜索 “**image**” ,你将找到你所拥有的 Linux 内核。你只需要删除旧内核版本的镜像,而不是当前内核的镜像。
|
||||
在这里,搜索 “image” ,你将找到你所拥有的 Linux 内核。你只需要删除旧内核版本的镜像,而不是当前内核的镜像。
|
||||
|
||||
在上面的屏幕截图中,我已经指出了我系统上的当前内核和旧内核,因此你必需注意你系统上的内核。
|
||||
在上面的屏幕截图中,我已经指出了我系统上的当前内核和旧内核,因此你必须注意你系统上的内核。
|
||||
|
||||
你没有必要删除任何其它东西,只需要删除旧的内核版本。
|
||||
|
||||
同样的,只需要在软件包列表中搜索 “**headers**” ,并删除如下显示的旧的 “**headers**” 版本。
|
||||
同样的,只需要在软件包列表中搜索 “headers” ,并删除如下显示的旧的 “headers” 版本。
|
||||
|
||||
![][11]
|
||||
|
||||
只是提醒你,你 **不希望移除 “linux-headers-generic”** 。只是关注那些与其相关的有版本号的。
|
||||
作为提醒,你 **不会希望移除 `linux-headers-generic`** 。只关注一下那些与其相关的有版本号的就行。
|
||||
|
||||
然后,就这样,你完成了所有的工作,apt 将会再次工作,并且你将成功地释放来自 /boot 分区的一些空间。同样地,你也可以使用任意其它的软件包管理器来完成这些工作。
|
||||
然后,就这样,你完成了所有的工作,APT 将会再次工作,并且你将成功地释放来自 `/boot` 分区的一些空间。同样地,你也可以使用任意其它的软件包管理器来完成这些工作。
|
||||
|
||||
#### 使用命令行来移除旧内核
|
||||
|
||||
使用命令行来移除旧内核与使用 GUI 来移除旧内核是一样的。因此,如果你没有选择使用一款 GUI 软件 (如果它是一台远程机器/一项远程服务) 的权利,或者如果你只是对终端情有独钟,你可以仿效下面的步骤。
|
||||
使用命令行来移除旧内核与使用 GUI 来移除旧内核是一样的。因此,如果你没有选择使用 GUI 软件(如果它是一台远程机器/一项远程服务)的权利,或者如果你只是对终端情有独钟,你可以仿效下面的步骤。
|
||||
|
||||
首先,使用下面的命令列出所有已安装的内核:
|
||||
|
||||
@ -104,15 +104,15 @@ ls -l /boot
|
||||
|
||||
![][12]
|
||||
|
||||
写为 “**old**” 的内核,或者不匹配你当前内核版本,都是未使用的内核,你可以删除它们。
|
||||
标记为 “old” 的内核,或者不匹配你当前内核版本,都是未使用的内核,你可以删除它们。
|
||||
|
||||
现在,你可以使用 **rm** 命令来移除具体指定来自 /boot 分区中的内核,使用下面的命令(一个命令对应一个内核):
|
||||
现在,你可以使用 `rm` 命令来移除具体指定来自 `/boot` 分区中的内核,使用下面的命令(一个命令对应一个内核):
|
||||
|
||||
```
|
||||
sudo rm /boot/vmlinuz-5.4.0-7634-generic
|
||||
```
|
||||
|
||||
务必检查你发系统的版本 — 它可能与你的系统的版本不同。
|
||||
务必检查系统的版本 — 这里可能与你的系统的版本不同。
|
||||
|
||||
如果你有很多未使用的内核,这将需要一些时间。因此,你也可以下面的命令丢弃多个内核:
|
||||
|
||||
@ -120,7 +120,7 @@ sudo rm /boot/vmlinuz-5.4.0-7634-generic
|
||||
sudo rm /boot/*-5.4.0-{7634}-*
|
||||
```
|
||||
|
||||
为了澄清这一点,你需要用逗号分隔内核版本号的最后一部分/编码,以便同时删除它们。
|
||||
为了清晰起见,你需要用逗号分隔内核版本号的最后一部分/编码,以便同时删除它们。
|
||||
|
||||
假设,我有两个旧的内核 5.4.0-7634-generic 和 5.4.0-7624 ,那么命令将是:
|
||||
|
||||
@ -128,15 +128,15 @@ sudo rm /boot/*-5.4.0-{7634}-*
|
||||
sudo rm /boot/*-5.4.0-{7634,7624}-*
|
||||
```
|
||||
|
||||
如果你不希望在 grub 启动菜单中再看到这些旧的内核版本,你可以使用下面的命令简单地 [更新 grub][13] :
|
||||
如果你不希望在 grub 启动菜单中再看到这些旧的内核版本,你可以使用下面的命令简单地 [更新 grub][13]:
|
||||
|
||||
```
|
||||
sudo update-grub
|
||||
```
|
||||
|
||||
就这样,你完成了所有的工作。你已经释放了空间,还修复了可能潜在的破损的 APT 问题,如果它是一个在你的 /boot 分区填满后出现的重要的问题的话。
|
||||
就这样,你完成了所有的工作。你已经释放了空间,还修复了可能潜在的破损的 APT 问题,如果它是一个在你的 `/boot` 分区填满后出现的重要的问题的话。
|
||||
|
||||
在一些情况下,你需要输入这些命令来修复破损的 (正如我在论坛中注意到的):
|
||||
在一些情况下,你需要输入这些命令来修复破损的(正如我在论坛中注意到的):
|
||||
|
||||
```
|
||||
sudo dpkg --configure -a
|
||||
@ -152,7 +152,7 @@ via: https://itsfoss.com/free-boot-partition-ubuntu/
|
||||
作者:[Ankush Das][a]
|
||||
选题:[lujun9972][b]
|
||||
译者:[robsean](https://github.com/robsean)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
校对:[wxy](https://github.com/wxy)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
@ -1,40 +1,38 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: (geekpi)
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
[#]: reviewer: (wxy)
|
||||
[#]: publisher: (wxy)
|
||||
[#]: url: (https://linux.cn/article-12791-1.html)
|
||||
[#]: subject: (Start using virtual tables in Apache Cassandra 4.0)
|
||||
[#]: via: (https://opensource.com/article/20/10/virtual-tables-apache-cassandra)
|
||||
[#]: author: (Ben Bromhead https://opensource.com/users/ben-bromhead)
|
||||
|
||||
开始在 Apache Cassandra 4.0 中使用虚拟表
|
||||
如何在 Apache Cassandra 4.0 中使用虚拟表
|
||||
======
|
||||
它们是什么以及如何使用它们。
|
||||
![Computer laptop in space][1]
|
||||
|
||||
在最近的 [Apache Cassandra 4.0 测试版][3]中的[众多新增功能][2]中,虚拟表是一个值得关注的功能。
|
||||
> 虚拟表是什么以及如何使用。
|
||||
|
||||
在以前的 Cassandra 版本中,用户需要访问 Java 管理扩展 ([JMX][4]) 来检查 Cassandra 的细节,如运行中的压缩、客户端、度量和各种配置设置。虚拟表消除了这些挑战。Cassandra 4.0 测试版使用户能够从一个只读的系统表中以 Cassandra 查询语言 (CQL) 行的形式查询这些细节和数据。
|
||||

|
||||
|
||||
以下是之前 Cassandra 版本中基于 JMX 的机制是如何工作的。想象一下,一个用户想要检查集群中某个节点的压缩状态。用户首先要建立一个 JMX 连接,在节点上运行 `nodetool compactionstats`。这个要求给用户带来了一些复杂的问题。用户的客户端是否配置了 JMX 访问?Cassandra 节点和防火墙是否配置为允许 JMX 访问?是否准备好了适当的安全和审计措施,并落实到位?这些只是用户在处理 Cassandra 以前版本时不得不面对的一些问题。
|
||||
在最近的发布的 [Apache Cassandra 4.0 测试版][3]中的[众多新增功能][2]中,<ruby>虚拟表<rt>virtual table</rt></ruby>是一个值得关注的功能。
|
||||
|
||||
在以前的 Cassandra 版本中,用户需要访问 <ruby>Java 管理扩展<rt>Java Management Extensions</rt></ruby>([JMX][4]) 来查看 Cassandra 的细节,如运行中的<ruby>压实<rt>compaction</rt></ruby>、客户端、度量和各种配置设置。虚拟表消除了这些挑战。Cassandra 4.0 测试版让用户能够从一个只读的系统表中以 <ruby>Cassandra 查询语言<rt>Cassandra Query Language</rt></ruby>(CQL)行的形式查询这些细节和数据。
|
||||
|
||||
以下是之前 Cassandra 版本中基于 JMX 的机制是如何工作的。想象一下,一个用户想要检查集群中某个节点的压实状态。用户首先要建立一个 JMX 连接,在节点上运行 `nodetool compactionstats`。这个要求马上就给用户带来了一些复杂的问题。用户的客户端是否配置了 JMX 访问?Cassandra 节点和防火墙是否配置为允许 JMX 访问?是否准备好了适当的安全和审计措施,并落实到位?这些只是用户在处理 Cassandra 以前版本时必须面对的其中一些问题。
|
||||
|
||||
在 Cassandra 4.0 中,虚拟表使得用户可以利用之前配置的驱动来查询所需信息。这一变化消除了与实现和维护 JMX 访问相关的所有开销。
|
||||
|
||||
Cassandra 4.0 创建了两个新的键空间来帮助用户利用虚拟表:`system_views` 和 `system_virtual_schema`。`system_views` 键空间包含了用户查询的所有有价值的信息,有用地存储在一些表中。`system_virtual_schema` 键空间,顾名思义,存储了这些虚拟表的所有必要的模式信息。
|
||||
Cassandra 4.0 创建了两个新的<ruby>键空间<rt>keyspace</rt></ruby>来帮助用户利用虚拟表:`system_views` 和 `system_virtual_schema`。`system_views` 键空间包含了用户查询的所有有价值的信息,有用地存储在一些表中。`system_virtual_schema` 键空间,顾名思义,存储了这些虚拟表的所有必要的模式信息。
|
||||
|
||||
![system_views and system_virtual_schema keyspaces and tables][5]
|
||||
|
||||
(Ben Bromhead, [CC BY-SA 4.0][6])
|
||||
重要的是要明白,每个虚拟表的范围仅限于其节点。任何虚拟表查询都将返回的数据,只对其协调器的节点有效,而不管一致性如何。为了简化这一要求,已经在几个驱动中添加了支持,以便在这些查询中指定协调器节点 (Python、DataStax Java 和其他驱动现在提供了这种支持)。
|
||||
|
||||
重要的是要明白,每个虚拟表的范围仅限于其节点。任何虚拟表查询都将返回只对作为其协调器的节点有效的数据,而不管一致性如何。为了简化这一要求,已经在几个驱动中添加了支持,以便在这些查询中指定协调器节点 (Python、DataStax Java 和其他驱动现在提供了这种支持)。
|
||||
|
||||
为了说明这一点,请检查这个 `sstable_tasks` 虚拟表。这个虚拟表显示了对 [SSTables][7] 的所有操作,包括压缩、清理、升级等。
|
||||
为了说明这一点,请查看这个 `sstable_tasks` 虚拟表。这个虚拟表显示了对 [SSTables][7] 的所有操作,包括压实、清理、升级等。
|
||||
|
||||
![Querying the sstable_tasks virtual table][8]
|
||||
|
||||
(Ben Bromhead, [CC BY-SA 4.0][6])
|
||||
|
||||
如果用户在以前的 Cassandra 版本中运行 `nodetool compactionstats`,则会显示相同类型的信息。 在这里,查询发现该节点当前有一个活动的压缩。它还显示了它的进度以及它的键空间和表。得益于虚拟表,用户可以快速收集这些信息,并同样有效地获得正确诊断集群健康状况所需的能力。
|
||||
如果用户在以前的 Cassandra 版本中运行 `nodetool compactionstats`,则会显示相同类型的信息。 在这里,这个查询发现该节点当前有一个活动的压缩。它还显示了它的进度以及它的键空间和表。得益于虚拟表,用户可以快速收集这些信息,并同样有效地获得正确诊断集群健康状况所需的能力。
|
||||
|
||||
需要说明的是,Cassandra 4.0 并没有去除对 JMX 访问的需求。JMX 仍然是查询某些指标的唯一选择。尽管如此,用户会欢迎简单地使用 CQL 来获取关键集群指标的能力。由于虚拟表提供的便利,用户可能会将之前投入到 JMX 工具的时间和资源重新投入到 Cassandra 本身。客户端工具也应该开始利用虚拟表提供的优势。
|
||||
|
||||
@ -47,7 +45,7 @@ via: https://opensource.com/article/20/10/virtual-tables-apache-cassandra
|
||||
作者:[Ben Bromhead][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/) 荣誉推出
|
||||
|
@ -1,50 +1,52 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: (geekpi)
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
[#]: reviewer: (wxy)
|
||||
[#]: publisher: (wxy)
|
||||
[#]: url: (https://linux.cn/article-12787-1.html)
|
||||
[#]: subject: (How to Clear Apt Cache and Reclaim Precious Disk Space)
|
||||
[#]: via: (https://itsfoss.com/clear-apt-cache/)
|
||||
[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/)
|
||||
|
||||
如何清除 apt 缓存来回收宝贵的磁盘空间
|
||||
如何清除 APT 缓存来回收宝贵的磁盘空间
|
||||
======
|
||||
|
||||
如何清除 apt 缓存?你只需使用这个 [apt-get 命令][1]选项:
|
||||
![][13]
|
||||
|
||||
如何清除 APT 缓存?你只需使用这个 [apt-get 命令][1]选项:
|
||||
|
||||
```
|
||||
sudo apt-get clean
|
||||
```
|
||||
|
||||
但是,清理 apt 缓存不仅仅是运行上面的命令。
|
||||
但是,清理 APT 缓存不仅仅是运行上面的命令。
|
||||
|
||||
在本教程中,我将解释什么是 apt 缓存、为什么会使用它、为什么你要清理它,以及关于清理 apt 缓存你应该知道的其他事情。
|
||||
在本教程中,我将解释什么是 APT 缓存、为什么会使用它、为什么你要清理它,以及关于清理 APT 缓存你应该知道的其他事情。
|
||||
|
||||
我将在这里使用 Ubuntu 作为参考,但由于这是关于 apt 的,因此它也适用于 [Debian][2] 和其他基于 Debian 和 Ubuntu 的发行版,比如 Linux Mint、Deepin 等等。
|
||||
我将在这里使用 Ubuntu 作为参考,但由于这是关于 APT 的,因此它也适用于 [Debian][2] 和其他基于 Debian 和 Ubuntu 的发行版,比如 Linux Mint、Deepin 等等。
|
||||
|
||||
### 什么是 apt 缓存?为什么要使用它?
|
||||
### 什么是 APT 缓存?为什么要使用它?
|
||||
|
||||
当你使用 apt-get 或 [apt 命令][3]安装一个软件包时(或在软件中心安装 DEB 包),apt [包管理器][4]会以 .deb 格式下载软件包及其依赖关系,并将其保存在 /var/cache/apt/archives 文件夹中。
|
||||
当你使用 `apt-get` 或 [apt 命令][3]安装一个软件包时(或在软件中心安装 DEB 包),APT [包管理器][4]会以 .deb 格式下载软件包及其依赖关系,并将其保存在 `/var/cache/apt/archives` 文件夹中。
|
||||
|
||||
![][5]
|
||||
|
||||
下载时,apt 将 deb 包保存在 /var/cache/apt/archives/partial 目录下。当 deb 包完全下载完毕后,它会被移到 /var/cache/apt/archives 目录下。
|
||||
下载时,`apt` 将 deb 包保存在 `/var/cache/apt/archives/partial` 目录下。当 deb 包完全下载完毕后,它会被移到 `/var/cache/apt/archives` 目录下。
|
||||
|
||||
下载完包的 deb 文件及其依赖关系后,你的系统就会[从这些 deb 文件中安装包][6]。
|
||||
|
||||
现在你明白缓存的用途了吧?系统在安装软件包之前,需要一个地方把软件包文件存放在某个地方。如果你了解 [Linux 目录结构][7],你就会明白,/var/cache 是合适的地方。
|
||||
现在你明白缓存的用途了吧?系统在安装软件包之前,需要一个地方把软件包文件存放在某个地方。如果你了解 [Linux 目录结构][7],你就会明白,`/var/cache` 是合适的地方。
|
||||
|
||||
#### 为什么安装包后要保留缓存?
|
||||
|
||||
下载的 deb 文件在安装完成后并不会立即从目录中删除。如果你删除了一个软件包,然后重新安装,你的系统会在缓存中查找这个软件包,并从这里获取它,而不是重新下载(只要缓存中的软件包版本与远程仓库中的版本相同)。
|
||||
|
||||
这样就快多了。你可以自己尝试一下,看看一个程序第一次安装,删除后再安装需要多长时间。你可以[使用 time 命令来了解完成一个命令需要多长时间][8]:_**time sudo apt install package_name**_
|
||||
这样就快多了。你可以自己尝试一下,看看一个程序第一次安装,删除后再安装需要多长时间。你可以[使用 time 命令来了解完成一个命令需要多长时间][8]:`time sudo apt install package_name`。
|
||||
|
||||
我找不到任何关于缓存保留策略的内容,所以我无法说明 Ubuntu 会在缓存中保留下载的包多长时间。
|
||||
|
||||
#### 你应该清理 apt 缓存吗?
|
||||
#### 你应该清理 APT 缓存吗?
|
||||
|
||||
这取决于你。如果你的根目录下的磁盘空间用完了,你可以清理 apt cache 来回收磁盘空间。这是 [Ubuntu 上释放磁盘空间的几种方法][9]之一。
|
||||
这取决于你。如果你的根目录下的磁盘空间用完了,你可以清理 APT 缓存来回收磁盘空间。这是 [Ubuntu 上释放磁盘空间的几种方法][9]之一。
|
||||
|
||||
使用 [du 命令][10]检查缓存占用了多少空间:
|
||||
|
||||
@ -52,43 +54,41 @@ sudo apt-get clean
|
||||
|
||||
有的时候,这可能会占用几百兆,如果你正在运行一个服务器,这些空间可能是至关重要的。
|
||||
|
||||
#### 如何清理 apt 缓存?
|
||||
#### 如何清理 APT 缓存?
|
||||
|
||||
如果你想清除 apt 缓存,有一个专门的命令来做。所以不要去手动删除缓存目录。只要使用这个命令就可以了:
|
||||
如果你想清除 APT 缓存,有一个专门的命令来做。所以不要去手动删除缓存目录。只要使用这个命令就可以了:
|
||||
|
||||
```
|
||||
sudo apt-get clean
|
||||
```
|
||||
|
||||
这将删除 /var/cache/apt/archives 目录的内容(除了锁文件)。以下是 apt-get clean 命令模拟删除内容:
|
||||
这将删除 `/var/cache/apt/archives` 目录的内容(除了锁文件)。以下是 `apt-get clean` 命令模拟删除内容:
|
||||
|
||||
![][12]
|
||||
|
||||
还有一个命令是关于清理 apt 缓存的:
|
||||
还有一个命令是关于清理 APT 缓存的:
|
||||
|
||||
```
|
||||
sudo apt-get autoclean
|
||||
```
|
||||
|
||||
与 clean 不同的是,autoclean 只删除那些无法从仓库中下载的包。
|
||||
与 `clean` 不同的是,`autoclean` 只删除那些无法从仓库中下载的包。
|
||||
|
||||
假设你安装了包 xyz。它的 deb 文件仍然保留在缓存中。如果现在仓库中有新的 xyz 包,那么缓存中现有的这个 xyz 包就已经过时了,没有用了。autoclean 选项会删除这种不能再下载的无用包。
|
||||
假设你安装了包 xyz。它的 deb 文件仍然保留在缓存中。如果现在仓库中有新的 xyz 包,那么缓存中现有的这个 xyz 包就已经过时了,没有用了。`autoclean` 选项会删除这种不能再下载的无用包。
|
||||
|
||||
#### 删除 apt 缓存安全吗?
|
||||
|
||||
![][13]
|
||||
是的,清除 APT 创建的缓存是完全安全的。它不会对系统的性能产生负面影响。也许如果你重新安装软件包,下载时间会更长一些,但也仅此而已。
|
||||
|
||||
是的,清除 apt 创建的缓存是完全安全的。它不会对系统的性能产生负面影响。也许如果你重新安装软件包,下载时间会更长一些,但也仅此而已。
|
||||
|
||||
再说一次,使用 apt-get clean 命令。它比手动删除缓存目录更快、更简单。
|
||||
再说一次,使用 `apt-get clean` 命令。它比手动删除缓存目录更快、更简单。
|
||||
|
||||
你也可以使用像 [Stacer][14] 或 [Bleachbit][15] 这样的图形工具来实现这个目的。
|
||||
|
||||
#### 总结
|
||||
|
||||
在写这篇文章的时候,新的 apt 命令没有内置选项。不过,为了保持向后的兼容性,仍然可以运行 _**apt clean**_ (内部应该是运行 apt-get clean)。请参考这篇文章来[了解 apt 和 apt-get 的区别][16]。
|
||||
在写这篇文章的时候,新的 `apt` 命令没有这样的内置选项。不过,为了保持向后的兼容性,仍然可以运行 `apt clean` (内部应该是运行了 `apt-get clean`)。请参考这篇文章来[了解 apt 和 apt-get 的区别][16]。
|
||||
|
||||
我希望你觉得这个关于 apt 缓存的解释很有趣。虽然这不是什么必要的东西,但了解这些小东西会让你对你的 Linux 系统更加了解。
|
||||
我希望你觉得这个关于 APT 缓存的解释很有趣。虽然这不是什么必要的东西,但了解这些小东西会让你对你的 Linux 系统更加了解。
|
||||
|
||||
欢迎你在评论区提出反馈和建议。
|
||||
|
||||
@ -99,7 +99,7 @@ via: https://itsfoss.com/clear-apt-cache/
|
||||
作者:[Abhishek Prakash][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/) 荣誉推出
|
||||
|
@ -1,20 +1,20 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: (geekpi)
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
[#]: reviewer: (wxy)
|
||||
[#]: publisher: (wxy)
|
||||
[#]: url: (https://linux.cn/article-12775-1.html)
|
||||
[#]: subject: (LibreOffice Wants Apache to Drop the Ailing OpenOffice and Support LibreOffice Instead)
|
||||
[#]: via: (https://itsfoss.com/libreoffice-letter-openoffice/)
|
||||
[#]: author: (Ankush Das https://itsfoss.com/author/ankush/)
|
||||
|
||||
LibreOffice 希望 Apache 放弃陷入困境的 OpenOffice,转而支持 LibreOffice
|
||||
文档基金会希望 Apache 放弃陷入困境的 OpenOffice,转而支持 LibreOffice
|
||||
======
|
||||
|
||||
对于 Linux 用户来说,当我们想到[微软 Office 的开源替代品][1]时,Apache OpenOffice 仍然是一个相关的推荐,这是不言而喻的。然而,在过去的几年里,OpenOffice 的发展几乎是停滞的。
|
||||
|
||||
当然,考虑到 Abhishek 早在 2016年 就写过 [Apache OpenOffice 关闭的可能性][2],这并不令人震惊。
|
||||
当然,考虑到 Abhishek 早在 2016 年就写过 [Apache OpenOffice 关闭的可能性][2],这并不令人震惊。
|
||||
|
||||
现在,在[文档基金会的公开信][3]中,他们呼吁 Apache OpenOffice 推荐用户开始使用更好的替代品,比如 LibreOffice。在本文中,我将提到文档基金会的博文中的一些重点,以及它对 Apache OpenOffice 的意义。
|
||||
现在,在一封[文档基金会的公开信][3]中,他们呼吁 Apache OpenOffice 推荐用户开始使用更好的替代品,比如 LibreOffice。在本文中,我将提到文档基金会的博文中的一些重点,以及它对 Apache OpenOffice 的意义。
|
||||
|
||||
![][4]
|
||||
|
||||
@ -28,11 +28,11 @@ LibreOffice 希望 Apache 放弃陷入困境的 OpenOffice,转而支持 LibreO
|
||||
|
||||
![][5]
|
||||
|
||||
现在 OpenOffice 已经没有重大的开发了,Apache OpenOffice 的未来是什么?最大开源基金会一个有些活跃的项目没有重大发布?
|
||||
现在 OpenOffice 已经没有重大的开发了,Apache OpenOffice 的未来是什么?一个相当活跃的项目,这个最大的开源基金会会不发布重大版本?
|
||||
|
||||
这听起来并不乐观,而这正是文档基金会在他们的公开信中所强调的:
|
||||
|
||||
> OpenOffice(.org),LibreOffice 的”父项目“,是一个伟大的办公套件,它改变了世界。它有着引人入胜的历史,但**自从 2014 年以来,Apache OpenOffice (它现在的家)还没有一个重大的版本**。没错,六年多来,没有重大的新功能或重大更新到来。很少有次要的发布,而且在及时的安全更新方面也存在问题。
|
||||
> OpenOffice(.org),是 LibreOffice 的”父项目“,它是一个伟大的办公套件,它改变了世界。它有着引人入胜的历史,但**自从 2014 年以来,Apache OpenOffice (它现在的家)还没有一个重大的版本**。没错,六年多来,没有重大的新功能或重大更新到来,也很少发布次要版本,而且在及时的安全更新方面也存在问题。
|
||||
|
||||
对于一个普通用户来说,如果他们不知道 [LibreOffice][6],我肯定希望他们知道。但是,Apache 基金会是否应该建议 OpenOffice 用户尝试使用 LibreOffice 来体验更好或更高级的办公套件呢?
|
||||
|
||||
@ -48,9 +48,9 @@ LibreOffice 希望 Apache 放弃陷入困境的 OpenOffice,转而支持 LibreO
|
||||
|
||||
如果 OpenOffice 能完成工作,用户可能不需要努力寻找替代品。那么,因为他们的缓慢开发而呼唤另一个项目,建议用户采用未来工具并推荐它是一个好主意么?
|
||||
|
||||
在争论中,有人可能会说,如果你已经完成了,并且对改进 OpenOffice 没有兴趣,那么推广你的竞争对手才是公平的。而且,这并没有错,开源社区应该一直合作,以确保新用户得到最好的选择。
|
||||
在争论中,有人可能会说,如果你已经完成了你的目标,并且对改进 OpenOffice 没有兴趣,那么推广你的竞争对手才是公平的。而且,这并没有错,开源社区应该一直合作,以确保新用户得到最好的选择。
|
||||
|
||||
从另一个侧面来看,我们可以说,文档基金会对于 OpenOffice 在 2020 年即使没有任何重大改进却仍然有重要意义感到沮丧。
|
||||
从另一个侧面来看,我们可以说,文档基金会对于 OpenOffice 到了 2020 年即使没有任何重大改进却仍然有重要意义感到沮丧。
|
||||
|
||||
我不会去评判,但当我看了这封公开信时,这些矛盾的想法就浮现在我的脑海里。
|
||||
|
||||
@ -67,7 +67,7 @@ via: https://itsfoss.com/libreoffice-letter-openoffice/
|
||||
作者:[Ankush Das][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/) 荣誉推出
|
||||
|
||||
@ -77,5 +77,5 @@ via: https://itsfoss.com/libreoffice-letter-openoffice/
|
||||
[2]: https://itsfoss.com/openoffice-shutdown/
|
||||
[3]: https://blog.documentfoundation.org/blog/2020/10/12/open-letter-to-apache-openoffice/
|
||||
[4]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/10/libre-office-open-office.png?resize=800%2C450&ssl=1
|
||||
[5]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/10/libre-office-open-office-derivatives.jpg?resize=800%2C166&ssl=1
|
||||
[5]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/10/libre-office-open-office-derivatives.jpg?resize=1536%2C319&ssl=1
|
||||
[6]: https://itsfoss.com/libreoffice-tips/
|
101
published/20201021 5 open source tools I can-t live without.md
Normal file
101
published/20201021 5 open source tools I can-t live without.md
Normal file
@ -0,0 +1,101 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: (geekpi)
|
||||
[#]: reviewer: (wxy)
|
||||
[#]: publisher: (wxy)
|
||||
[#]: url: (https://linux.cn/article-12804-1.html)
|
||||
[#]: subject: (5 open source tools I can't live without)
|
||||
[#]: via: (https://opensource.com/article/20/10/open-source-tools)
|
||||
[#]: author: (Victoria Martinez de la Cruz https://opensource.com/users/vkmc)
|
||||
|
||||
5 个我不可或缺的开源工具
|
||||
======
|
||||
|
||||
> 通过将这些工具放在自己的技能包中,提高你在终端内、外的工作效率。
|
||||
|
||||

|
||||
|
||||
前段时间,我参与了一个在科技人士中广为流传的 Twitter 话题。“挑战?只挑选五个你不能没有的工具。”我开始结合我的日常生活来思考这个问题,只挑出五个工具并不容易。我使用了许多我认为必不可少的工具,比如用来与同事和朋友联系的 [IRC][2] 客户端(是的,我仍然使用 IRC),一个用来做各种事情的出色的文本编辑器,一个用来保持有条不紊的日历应用,以及当需要更直接的互动时的一个视频会议平台。
|
||||
|
||||
所以,让我给这个挑战来个变化:选出五个能提高你工作效率的开源工具。这是我的清单。请在评论中分享你的清单。
|
||||
|
||||
### tmate
|
||||
|
||||
![tmate screenshot][3]
|
||||
|
||||
哦,我喜欢这个工具。`tmate` 是著名的 [tmux][5] 终端多路复用器的一个复刻,它允许你启动一个 `tmux` 会话并通过 SSH 共享。你可以用它来进行[结对编程][6](这是我的主要使用场景),也可以用来进行远程控制。
|
||||
|
||||
如果你经常与你的团队成员合作,并且你想要一个简单的、与发行版无关的、开源的方式与他们一起编程(而且共享终端访问对你来说已经足够了),这绝对是你必须加到列表中的东西。
|
||||
|
||||
在 [tmate 的网站][7]上获取更多信息,或者在 [GitHub][8] 上查看代码。
|
||||
|
||||
### ix
|
||||
|
||||
`ix` 是一个命令行粘贴板。你不需要安装任何东西。你可以通过 `curl` 到 [ix.io][9] 站点来创建新的粘贴。例如,`echo Hello world. | curl -F 'f:1=<-' ix.io` 会给你一个到 ix.io 的链接,那里粘贴了消息 “Hello world” 的信息。当你想分享日志用于调试或在没有桌面环境的服务器上保存配置文件时,这非常方便。
|
||||
|
||||
有一个缺点是源码还没有公布,尽管它的目的是自由开源。如果你是作者,并且正在阅读这篇文章,请发布代码,这样我们就可以为打磨它的过程做出贡献。
|
||||
|
||||
### asciinema
|
||||
|
||||
是的,这是另一个终端工具,`asciinema` 可以让你记录你的终端。使用它的方法有很多,但我一般用它来制作演示。它非常容易使用,而且有很多 Linux 发行版和其他平台的软件包。
|
||||
|
||||
要想知道它是如何工作的,可以看看这个[酷炫的演示][10]。是不是很棒?
|
||||
|
||||
在 [asciinema 的网站][11]上获取更多信息,在 [GitHub][12] 上访问其源代码。
|
||||
|
||||
### GNOME Pomodoro
|
||||
|
||||
![pomodoro timer gnome][13]
|
||||
|
||||
好了,关于终端工具的介绍就到此为止。现在我想和大家分享一下这个简单的宝物,它让你的工作变得有条不紊。你听说过 [番茄工作法][14] 吗?Pomodoro 基本上是一个时间管理工具。它使用一个番茄形状的计时器,帮助你将时间分成工作时间和休息时间(默认情况下,25 分钟的工作后有 5 分钟的休息时间)。而且,每隔 4 个“番茄”之后,你就会有更长的休息时间(默认为 15 分钟)。这样做的目的是让你在工作时间内保持专注,而在休息时间内进行伸展和放松。
|
||||
|
||||
这听起来非常非常简单,你可能会对让一个番茄形状的时钟来控制你的生活感到犹豫,但它确实帮助我变得跟有条理,并且在试图同时专注于许多事情时避免感到疲惫。
|
||||
|
||||
无论你是什么角色,我都强烈推荐这种做法。而在众多实现它的不同工具中,我推荐 GNOME Pomodoro 应用。它适用于主要的 GNU/Linux 发行版,所以它需要你使用 GNOME 桌面环境(这可能是它的缺点)。
|
||||
|
||||
在 [GNOME Pomodoro 的网站][15]上查看更多信息,并访问其 [GitHub][16] 仓库来获取源码并了解如何做出贡献。
|
||||
|
||||
### Jitsi
|
||||
|
||||
最后但同样重要的是 Jitsi。当你在一个远程、遍布全球的团队中工作时,你需要一种与人们联系的方式。即时通讯是好的,但有时最好还是开个快速会议,面对面地讨论事情(嗯,看到对方的脸)。有很多[视频会议工具][17]可用,但我很喜欢 Jitsi。不仅因为它是免费和开源的,还因为它提供了一个简洁、实用的界面。你可以设置自己的 Jitsi 服务器(用于商业目的),但你也可以通过访问 [Jitsi Meet][18] 网站来试用一个公共的 Jitsi 实例。
|
||||
|
||||
设置这种会议的一个好做法是:只有在你心中有明确的议程时才使用它。而且要时刻问自己,这个会议能不能用电子邮件代替?遵循这些准则,谨慎使用 Jitsi,你的工作日将会非常高效!
|
||||
|
||||
在 [Jitsi 网站][19]上了解更多信息,并通过访问其 [GitHub][20] 仓库开始贡献。
|
||||
|
||||
* * *
|
||||
|
||||
我希望我的清单能帮助你在生产力上达到一个新的水平。你的 5 个不能离开的开源生产力工具是什么?在评论中告诉我。
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/20/10/open-source-tools
|
||||
|
||||
作者:[Victoria Martinez de la Cruz][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/vkmc
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/lenovo-thinkpad-laptop-window-focus.png?itok=g0xPm2kD (young woman working on a laptop)
|
||||
[2]: https://en.wikipedia.org/wiki/Internet_Relay_Chat
|
||||
[3]: https://opensource.com/sites/default/files/pictures/tmate-opensource.jpg (tmate screenshot)
|
||||
[4]: https://creativecommons.org/licenses/by-sa/4.0/
|
||||
[5]: https://opensource.com/article/20/7/tmux-cheat-sheet
|
||||
[6]: https://en.wikipedia.org/wiki/Pair_programming
|
||||
[7]: https://tmate.io/
|
||||
[8]: https://github.com/tmate-io/tmate
|
||||
[9]: http://ix.io/
|
||||
[10]: https://asciinema.org/a/239367
|
||||
[11]: https://asciinema.org/
|
||||
[12]: https://github.com/asciinema/asciinema
|
||||
[13]: https://opensource.com/sites/default/files/pictures/pomodoro_timer_gnome.jpg (pomodoro timer gnome)
|
||||
[14]: https://en.wikipedia.org/wiki/Pomodoro_Technique
|
||||
[15]: https://gnomepomodoro.org/
|
||||
[16]: https://github.com/codito/gnome-pomodoro
|
||||
[17]: https://opensource.com/article/20/5/open-source-video-conferencing
|
||||
[18]: https://meet.jit.si/
|
||||
[19]: https://jitsi.org/
|
||||
[20]: https://github.com/jitsi
|
117
published/20201026 ninja- a simple way to do builds.md
Normal file
117
published/20201026 ninja- a simple way to do builds.md
Normal file
@ -0,0 +1,117 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: (geekpi)
|
||||
[#]: reviewer: (wxy)
|
||||
[#]: publisher: (wxy)
|
||||
[#]: url: (https://linux.cn/article-12798-1.html)
|
||||
[#]: subject: (ninja: a simple way to do builds)
|
||||
[#]: via: (https://jvns.ca/blog/2020/10/26/ninja--a-simple-way-to-do-builds/)
|
||||
[#]: author: (Julia Evans https://jvns.ca/)
|
||||
|
||||
ninja:一个简单的构建方式
|
||||
======
|
||||
|
||||
大家好!每隔一段时间,我就会发现一款我非常喜欢的新软件,今天我想说说我最近喜欢的一款软件:[ninja][1]!
|
||||
|
||||
### 增量构建很有用
|
||||
|
||||
我做了很多小项目,在这些项目中,我想设置增量构建。例如,现在我正在写一本关于 bash 的杂志,杂志的每一页都有一个 `.svg`文件。我需要将 SVG 转换为 PDF,我的做法是这样的:
|
||||
|
||||
```
|
||||
for i in *.svg
|
||||
do
|
||||
svg2pdf $i $i.pdf # or ${i/.svg/.pdf} if you want to get really fancy
|
||||
done
|
||||
```
|
||||
|
||||
这很好用,但是我的 `svg2pdf` 脚本有点慢(它使用 Inkscape),而且当我刚刚只更新了一页的时候,必须等待 90 秒或者其他什么时间来重建所有的 PDF 文件,这很烦人。
|
||||
|
||||
### 构建系统是让人困惑的
|
||||
|
||||
在过去,我对使用 `make` 或 `bazel` 这样的构建系统来做我的小项目一直很反感,因为 `bazel` 是个大而复杂的东西,而 `make` 对我来说感觉有点神秘。我真的不想使用它们中的任何一个。
|
||||
|
||||
所以很长时间以来,我只是写了一个 bash 脚本或者其他的东西来进行构建,然后就认命了,有时候只能等一分钟。
|
||||
|
||||
### ninja 是一个极其简单的构建系统
|
||||
|
||||
但 `ninja` 并不复杂!以下是我所知道的关于 ninja 构建文件的语法:创建一个 `rule` 和一个 `build`:
|
||||
|
||||
`rule` 有一个命令(`command`)和描述(`description`)参数(描述只是给人看的,所以你可以知道它在构建你的代码时在做什么)。
|
||||
|
||||
```
|
||||
rule svg2pdf
|
||||
command = inkscape $in --export-text-to-path --export-pdf=$out
|
||||
description = svg2pdf $in $out
|
||||
```
|
||||
|
||||
`build` 的语法是 `build output_file: rule_name input_files`。下面是一个使用 `svg2pdf` 规则的例子。输出在规则中的 `$out` 里,输入在 `$in` 里。
|
||||
|
||||
```
|
||||
build pdfs/variables.pdf: svg2pdf variables.svg
|
||||
```
|
||||
|
||||
这就完成了!如果你把这两个东西放在一个叫 `build.ninja` 的文件里,然后运行 `ninja`,ninja 会运行 `inkscape variables.svg --export-text-to-path --export-pdf=pdfs/variables.pdf`。然后如果你再次运行它,它不会运行任何东西(因为它可以告诉你已经构建了 `pdfs/variables.pdf`,而且是最新的)。
|
||||
|
||||
Ninja 还有一些更多的功能(见[手册][2]),但我还没有用过。它最初是[为 Chromium][3] 构建的,所以即使只有一个小的功能集,它也能支持大型构建。
|
||||
|
||||
### ninja 文件通常是自动生成的
|
||||
|
||||
ninja 的神奇之处在于,你不必使用一些混乱的构建语言,它们很难记住,因为你不经常使用它(比如 `make`),相反,ninja 语言超级简单,如果你想做一些复杂的事情,那么你只需使用任意编程语言生成你想要的构建文件。
|
||||
|
||||
我喜欢写一个 `build.py` 文件,或者像这样的文件,创建 ninja 的构建文件,然后运行 `ninja`:
|
||||
|
||||
```
|
||||
with open('build.ninja', 'w') as ninja_file:
|
||||
# write some rules
|
||||
ninja_file.write("""
|
||||
rule svg2pdf
|
||||
command = inkscape $in --export-text-to-path --export-pdf=$out
|
||||
description = svg2pdf $in $out
|
||||
""")
|
||||
|
||||
# some for loop with every file I need to build
|
||||
for filename in things_to_convert:
|
||||
ninja_file.write(f"""
|
||||
build {filename.replace('svg', 'pdf')}: svg2pdf {filename}
|
||||
""")
|
||||
|
||||
# run ninja
|
||||
import subprocess
|
||||
subprocess.check_call(['ninja'])
|
||||
```
|
||||
|
||||
我相信有一堆 `ninja` 的最佳实践,但我不知道。对于我的小项目而言,我发现它很好用。
|
||||
|
||||
### meson 是一个生成 ninja 文件的构建系统
|
||||
|
||||
我对 [Meson][4] 还不太了解,但最近我在构建一个 C 程序 ([plocate][5],一个比 `locate` 更快的替代方案)时,我注意到它有不同的构建说明,而不是通常的 `./configure; make; make install`:
|
||||
|
||||
```
|
||||
meson builddir
|
||||
cd builddir
|
||||
ninja
|
||||
```
|
||||
|
||||
看起来 Meson 是一个可以用 ninja 作为后端的 C/C++/Java/Rust/Fortran 构建系统。
|
||||
|
||||
### 就是这些!
|
||||
|
||||
我使用 ninja 已经有几个月了。我真的很喜欢它,而且它几乎没有给我带来让人头疼的构建问题,这让我感觉非常神奇。
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://jvns.ca/blog/2020/10/26/ninja--a-simple-way-to-do-builds/
|
||||
|
||||
作者:[Julia Evans][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://jvns.ca/
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://ninja-build.org/
|
||||
[2]: https://ninja-build.org/manual.html
|
||||
[3]: http://neugierig.org/software/chromium/notes/2011/02/ninja.html
|
||||
[4]: https://mesonbuild.com/Tutorial.html
|
||||
[5]: https://blog.sesse.net/blog/tech/2020-09-28-00-37_introducing_plocate
|
@ -0,0 +1,87 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: (geekpi)
|
||||
[#]: reviewer: (wxy)
|
||||
[#]: publisher: (wxy)
|
||||
[#]: url: (https://linux.cn/article-12806-1.html)
|
||||
[#]: subject: (How to Clear Terminal Screen in Ubuntu and Other Linux Distributions [Beginner’s Tip])
|
||||
[#]: via: (https://itsfoss.com/clear-terminal-ubuntu/)
|
||||
[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/)
|
||||
|
||||
如何清除 Ubuntu 和其他 Linux 发行版的终端屏幕
|
||||
======
|
||||
|
||||
![][2]
|
||||
|
||||
在终端上工作时,通常会发现终端屏幕上显示了太多的命令及其输出。
|
||||
|
||||
你可能需要清除终端屏幕并专注于要执行的下一个任务。相信我,清除 Linux 终端屏幕会很有帮助。
|
||||
|
||||
### 使用 clear 命令清除 Linux 终端
|
||||
|
||||
那么,如何清除 Linux 中的终端?最简单,最常见的方法是使用 `clear` 命令:
|
||||
|
||||
```
|
||||
clear
|
||||
```
|
||||
|
||||
`clear` 命令无需选项。就是这么简单,但是你还需要了解其他一些内容。
|
||||
|
||||
![][1]
|
||||
|
||||
`clear` 命令和其他清除屏幕的方法可能取决于你使用的终端模拟器。终端模拟器是用于访问 Linux Shell(命令行)的终端应用。
|
||||
|
||||
如果你在带有 GNOME 终端的 Ubuntu 上使用 `clear` 命令,它将清除屏幕,并且你将无法看到之前屏幕上的内容。
|
||||
|
||||
在许多其他终端模拟器或 Putty 中,它可能只清除一页屏幕。如果使用鼠标或 `PageUp` 和 `PageDown` 键滚动,那么仍然可以看到以前的屏幕输出。
|
||||
|
||||
坦白说,这取决于你的需要。如果你突然意识到需要引用以前运行的命令的输出,那么也许可以使用该方式。
|
||||
|
||||
### 在 Linux 中清除终端屏幕的其他方法
|
||||
|
||||
`clear` 命令不是清除终端屏幕的唯一方法。
|
||||
|
||||
你可以在 Linux 中使用 `Ctrl+L` [键盘快捷键][3]来清除屏幕。它适用于大多数终端模拟器。
|
||||
|
||||
```
|
||||
Ctrl+L
|
||||
```
|
||||
|
||||
如果你在 GNOME 终端(Ubuntu 中默认)中使用 `Ctrl+L` 和 `clear` 命令,那么你会注意到它们的影响有所不同。`Ctrl+L` 将屏幕向下移动一页,给人一种干净的错觉,但是你仍然可以通过向上滚动来访问命令输出历史。
|
||||
|
||||
**某些其他终端模拟器将此键盘快捷键设置为 `Ctrl+Shift+K`**。
|
||||
|
||||
你也可以使用 `reset` 命令清除终端屏幕。实际上,此命令执行完整的终端重新初始化。但是,它可能比 `clear` 命令要花费更长的时间。
|
||||
|
||||
```
|
||||
reset
|
||||
```
|
||||
|
||||
当你想完全清除屏幕时,还有几种其他复杂的方法可以清除屏幕。但是由于命令有点复杂,所以最好将它作为 [Linux 中的别名][4]:
|
||||
|
||||
```
|
||||
alias cls='printf "\033c"'
|
||||
```
|
||||
|
||||
你可以将此别名添加到你的 bash 配置文件中,以便作为命令使用。
|
||||
|
||||
我知道这是一个非常基本的主题,大多数 Linux 用户可能已经知道了,但这对于为新 Linux 用户介绍基本主题并没有什么坏处。是不是?
|
||||
|
||||
在清除终端屏幕上有些秘密提示吗?为什么不与我们分享呢?
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://itsfoss.com/clear-terminal-ubuntu/
|
||||
|
||||
作者:[Abhishek Prakash][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://itsfoss.com/author/abhishek/
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/10/clear-command-linux.gif?resize=800%2C432&ssl=1
|
||||
[2]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/10/clear-terminal-screen-linux.png?resize=800%2C450&ssl=1
|
||||
[3]: https://linuxhandbook.com/linux-shortcuts/
|
||||
[4]: https://linuxhandbook.com/linux-alias-command/
|
75
published/20201028 What-s new in Fedora 33 Workstation.md
Normal file
75
published/20201028 What-s new in Fedora 33 Workstation.md
Normal file
@ -0,0 +1,75 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: (geekpi)
|
||||
[#]: reviewer: (wxy)
|
||||
[#]: publisher: (wxy)
|
||||
[#]: url: (https://linux.cn/article-12801-1.html)
|
||||
[#]: subject: (What’s new in Fedora 33 Workstation)
|
||||
[#]: via: (https://fedoramagazine.org/whats-new-fedora-33-workstation/)
|
||||
[#]: author: (Gregory Bartholomew https://fedoramagazine.org/author/glb/)
|
||||
|
||||
Fedora 33 Workstation 的新功能
|
||||
======
|
||||
|
||||
![][1]
|
||||
|
||||
Fedora 33 Workstation 是我们这个免费的、领先的操作系统的[最新版本][2]。你现在就可以从[官方网站][3]下载它。Fedora 33 Workstation 中有一些新的和值得注意的变化。请阅读如下更多细节。
|
||||
|
||||
### GNOME 3.38
|
||||
|
||||
Fedora 33 Workstation 为各类用户提供了最新版本的 GNOME 桌面环境。在 Fedora 33 Workstation 中的 GNOME 3.38 包含了许多更新和改进,包括:
|
||||
|
||||
#### 一个新的 GNOME Tour 应用
|
||||
|
||||
现在,新用户会看到一个“新的 Tour 应用,重点展示了桌面的主要功能,并为第一次使用 GNOME 的用户提供一个很好的欢迎页”。
|
||||
|
||||
![The new GNOME Tour application in Fedora 33][4]
|
||||
|
||||
#### 拖动重排序应用
|
||||
|
||||
GNOME 3.38 用一个单一的可定制的、一致的视图取代了之前分开的“常用”和“所有”应用视图,这允许你重新排列应用并将它们组织到自定义文件夹中。只需点击并拖动即可移动应用。
|
||||
|
||||
![GNOME 3.38 Drag to Reorder][5]
|
||||
|
||||
#### 改进屏幕录制
|
||||
|
||||
GNOME Shell 中的屏幕录制基础架构已被改进,以利用 PipeWire 和内核 API。这将有助于减少资源消耗并提高响应速度。
|
||||
|
||||
GNOME 3.38 还提供了许多额外的功能和改进。查看 [GNOME 3.38 发行说明][6]以获得更多信息。
|
||||
|
||||
#### B-tree 文件系统
|
||||
|
||||
正如[之前宣布的][7],新安装的 Fedora 33 将默认使用 [Btrfs][8]。每一个新的内核版本都会为 Btrfs 增加一些特性和增强功能。[变更日志][9]有一个完整的总结,它介绍了每个新内核版本给 Btrfs 带来的功能。
|
||||
|
||||
#### Swap on ZRAM
|
||||
|
||||
Anaconda 和 Fedora IoT 多年来一直默认使用 swap-on-zram。在 Fedora 33 中,将默认启用 swap-on-zram,而不是交换分区。查看 [Fedora wiki 页面][10]了解更多关于 swap-on-zram 的细节。
|
||||
|
||||
#### 默认使用 Nano
|
||||
|
||||
新的 Fedora 33 将把 `EDITOR` 环境变量默认设置为 [nano][11]。这个变化影响了一些命令行工具,当它们需要用户输入时,会打开一个文本编辑器。在早期的版本中,这个环境变量的默认值并没有被指定,而是由各个应用程序来选择一个默认的编辑器。通常情况下,应用程序会使用 [vi][12] 作为它们的默认编辑器,因为它是一个小应用,通常在大多数 Unix/Linux 操作系统的基础安装中都可以使用。由于 Fedora 33 的基本安装中包含了 nano,而且 nano 对于初学者来说更加直观,所以 Fedora 33 将默认使用 nano。当然,想要使用 vi 的用户可以在自己的环境中覆盖 `EDITOR` 变量的值。详见[Fedora 修改请求][11]获取更多信息。
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://fedoramagazine.org/whats-new-fedora-33-workstation/
|
||||
|
||||
作者:[Gregory Bartholomew][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/author/glb/
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://fedoramagazine.org/wp-content/uploads/2020/10/f33workstation-816x345.jpg
|
||||
[2]: https://fedoramagazine.org/announcing-fedora-33/
|
||||
[3]: https://getfedora.org/workstation
|
||||
[4]: https://fedoramagazine.org/wp-content/uploads/2020/10/fedora-33-gnome-tour-1.png
|
||||
[5]: https://fedoramagazine.org/wp-content/uploads/2020/10/drag-to-reorder-1.gif
|
||||
[6]: https://help.gnome.org/misc/release-notes/3.38/
|
||||
[7]: https://fedoramagazine.org/btrfs-coming-to-fedora-33/
|
||||
[8]: https://en.wikipedia.org/wiki/Btrfs
|
||||
[9]: https://btrfs.wiki.kernel.org/index.php/Changelog#By_feature
|
||||
[10]: https://fedoraproject.org/wiki/Changes/SwapOnZRAM
|
||||
[11]: https://fedoraproject.org/wiki/Changes/UseNanoByDefault
|
||||
[12]: https://en.wikipedia.org/wiki/Vi
|
@ -0,0 +1,79 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: (geekpi)
|
||||
[#]: reviewer: (wxy)
|
||||
[#]: publisher: (wxy)
|
||||
[#]: url: (https://linux.cn/article-12807-1.html)
|
||||
[#]: subject: (Linux Kernel 5.10 Will be the Next LTS Release and it has Some Exciting Improvements Lined Up)
|
||||
[#]: via: (https://itsfoss.com/kernel-5-10/)
|
||||
[#]: author: (Ankush Das https://itsfoss.com/author/ankush/)
|
||||
|
||||
Linux 内核 5.10 LTS 的一些令人兴奋的改进
|
||||
======
|
||||
|
||||
> Linux 内核 5.10 的开发正在进行中。已确认这是一个长期支持的版本,将带来更新的硬件支持和其他承诺的功能。
|
||||
|
||||
### Linux Kernel 5.10 将是长期支持版本
|
||||
|
||||
主要稳定内核维护者 **Greg Kroah-Hartman** 在 Linux 基金会欧洲开源峰会的 “Ask the Expert” 环节上发言,确认 Linux 5.10 将是下一个 LTS 版本。
|
||||
|
||||
尽管早期有一些关于 5.9 是 LTS 版本的猜测,但 Greg 澄清说,**一年的最后一个内核版本永远是 LTS 版本**。
|
||||
|
||||
目前来看,[Linux 内核 5.4][1] 系列恰好是最新的 LTS 版本,它增加了很多改进和硬件支持。另外,考虑到开发进度,Linux [内核 5.8][2] 是目前最大的版本,而 Linux 5.10 的第一个候选版本也很接近,所以下面有很多事情要做。
|
||||
|
||||
让我们来看看 Linux 内核 5.10 的一些功能和改进。
|
||||
|
||||
### Linux 内核 5.10 特性
|
||||
|
||||
![][4]
|
||||
|
||||
**注意:** Linux 内核 5.10 仍处于早期开发阶段。因此,我们将定期更新文章,以更新最新的补充/功能。
|
||||
|
||||
#### AMD Zen 3 处理器支持
|
||||
|
||||
新的 [Ryzen 5000][5] 产品线是 2020 年最大的看点之一。所以,随着 Linux 内核 5.10 发布候选版本的推出,针对 Zen 3 处理器的各种新增功能也在陆续推出。
|
||||
|
||||
#### Intel Rocket Lake 支持
|
||||
|
||||
我并不对 Intel 的 Rocket Lake 芯片组在明年(2021 年) Q1 出货报太大希望。但是,考虑到英特尔在不断地压榨 14 纳米制程,看到 Intel Rocket Lake 在 Linux 内核 5.10 上所做的工作,绝对是一件好事。
|
||||
|
||||
#### Radeon RX 6000 系列开源驱动
|
||||
|
||||
尽管我们是在 Big Navi 揭晓前一天才报道的,但 Radeon RX 6000 系列绝对会是一个令人印象深刻的东西,可以和 NVIDIA RTX 3000 系列竞争。
|
||||
|
||||
当然,除非它和 Vega 系列或 5000 系列遇到的同样问题。
|
||||
|
||||
很高兴在 Linux 内核 5.10 上看到下一代 Radeon GPU 的开源驱动已经完成。
|
||||
|
||||
#### 文件系统优化和存储改进
|
||||
|
||||
[Phoronix][6] 报道了 5.10 也对文件系统进行了优化和存储改进。所以,从这一点来看,我们应该会看到一些性能上的改进。
|
||||
|
||||
#### 其他改进
|
||||
|
||||
毫无疑问,你应该期待新内核带来大量的驱动更新和硬件支持。
|
||||
|
||||
目前,对 SoundBlaster AE-7 的支持、对 NVIDIA Orin(AI 处理器)的早期支持以及 Tiger Lake GPU 的改进似乎是主要亮点。
|
||||
|
||||
Linux 内核 5.10 的稳定版本应该会在 12 月中旬左右发布。它将被支持至少 2 年,但可能一直会有安全和 bug 修复更新,直到 2026 年。因此,我们将继续关注下一个 Linux 内核 5.10 LTS 版本的发展,以获得任何令人兴奋的东西。
|
||||
|
||||
你对即将发布的 Linux 内核 5.10 有什么看法?请在评论中告诉我们你的想法。
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://itsfoss.com/kernel-5-10/
|
||||
|
||||
作者:[Ankush Das][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://itsfoss.com/author/ankush/
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://itsfoss.com/linux-kernel-5-4/
|
||||
[2]: https://itsfoss.com/kernel-5-8-release/
|
||||
[3]: https://twitter.com/gregkh/status/1320745076566433793?ref_src=twsrc%5Etfw
|
||||
[4]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/10/kernel-5-10-release.png?resize=800%2C450&ssl=1
|
||||
[5]: https://www.tomsguide.com/news/amd-ryzen-5000-revealed-what-it-means-for-pc-gaming
|
||||
[6]: https://www.phoronix.com/scan.php?page=article&item=linux-510-features&num=1
|
@ -0,0 +1,169 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: (wxy)
|
||||
[#]: reviewer: (wxy)
|
||||
[#]: publisher: (wxy)
|
||||
[#]: url: (https://linux.cn/article-12786-1.html)
|
||||
[#]: subject: (How to Use apt-cache Command in Debian, Ubuntu and Other Linux Distributions)
|
||||
[#]: via: (https://itsfoss.com/apt-cache-command/)
|
||||
[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/)
|
||||
|
||||
如何在 Debian、Ubuntu 中使用 apt-cache 命令
|
||||
======
|
||||
|
||||
> 使用 apt-cache 命令,你可以在本地 APT 缓存中搜索软件包的详细信息。在本教程中学习使用 apt-cache 命令。
|
||||
|
||||
### apt-cache 命令是用来干什么的?
|
||||
|
||||
[APT][1] [包管理器][2]工作在软件包元数据的本地缓存上。元数据通常由包名、版本、描述、依赖关系、仓库和开发者等信息组成。通过 `apt-cache` 命令,你可以查询这个本地 APT 缓存并获得相关信息。
|
||||
|
||||
你可以搜索一个包的可用性、它的版本号、它的依赖关系等等。我将通过实例告诉你如何使用 `apt-cache`命令。
|
||||
|
||||
APT 缓存的位置是 `/var/lib/apt/lists/` 目录。缓存哪些仓库元数据取决于你的源列表中 `/etc/apt/sources.list` 文件中添加的仓库,以及位于 `/etc/apt/sources.list.d` 目录下的额外仓库文件。
|
||||
|
||||
令人惊讶的是,`apt-cache` 并不能清除 APT 缓存。为此,你必须[使用 apt-get clean 命令][3]。
|
||||
|
||||
不用说,APT 打包系统是在 Debian 和基于 Debian 的 Linux 发行版上使用的,比如 Ubuntu、Linux Mint、Elementary OS 等。你不能在 Arch 或 Fedora 上使用它。
|
||||
|
||||
### 使用 apt-cache 命令
|
||||
|
||||
![][4]
|
||||
|
||||
就像其他 Linux 命令一样,`apt-cache` 也有一些可用的选项,你可以随时参考它的手册页来了解这些选项。
|
||||
|
||||
然而,你可能并不需要使用所有的选项。这就是为什么我在本教程中只向你展示 `apt-cache` 命令中最常见和最有用的例子。
|
||||
|
||||
#### 始终更新
|
||||
|
||||
更新本地 APT 缓存以与远程仓库同步是一个好主意。如何做到这一点呢?你可以使用命令:
|
||||
|
||||
```
|
||||
sudo apt update
|
||||
```
|
||||
|
||||
#### 搜索软件包
|
||||
|
||||
`apt-cache` 命令最常见的用途是查找软件包。你可以使用一个正则表达式来搜索本地 APT 缓存中的包。
|
||||
|
||||
```
|
||||
apt-cache search package_name
|
||||
```
|
||||
|
||||
默认情况下,它会在软件包的名称和描述中查找搜索关键词。它按字母顺序显示匹配的软件包及其简短的描述。
|
||||
|
||||
![][5]
|
||||
|
||||
你也可以缩小搜索范围,只在软件包名称中查找搜索词。
|
||||
|
||||
```
|
||||
apt-cache search --names-only package_name
|
||||
```
|
||||
|
||||
![][6]
|
||||
|
||||
如果你想知道所有匹配软件包的完整细节,你可以使用 `--full` 标志。
|
||||
|
||||
![][7]
|
||||
|
||||
#### 获取详细的包装信息
|
||||
|
||||
如果你知道确切的软件包名称(或者你已经成功地通过搜索找到了它),你可以得到软件包的详细元数据信息。
|
||||
|
||||
```
|
||||
apt-cache show package_name
|
||||
```
|
||||
|
||||
![][8]
|
||||
|
||||
你可以看到软件包元数据中的所有细节,比如名称、版本、开发者、维护者、仓库、长短描述、软件包大小甚至是校验和。
|
||||
|
||||
还有一个选项 `showpkg` 可以显示软件包的名称、版本、正向和反向依赖关系等信息。
|
||||
|
||||
```
|
||||
apt-cache showpkg package_name
|
||||
```
|
||||
|
||||
#### apt-cache 的策略
|
||||
|
||||
这是 `apt-cache` 命令中很少使用的一个选项。`policy` 选项可以帮助你调试与 [preference 文件][9]相关的问题。
|
||||
|
||||
如果你指定了软件包的名称,它将显示该软件包是否已经安装,在哪个版本的仓库中可用,以及它的优先级。
|
||||
|
||||
![][10]
|
||||
|
||||
默认情况下,每个已安装的软件包版本的优先级为 100,未安装的软件包的优先级为 500。同一软件包可能有多个不同优先级的版本。APT 会安装优先级较高的版本,除非安装的版本较新。
|
||||
|
||||
如果不理解这个部分,也没关系。对于一个普通的 Linux 用户来说,会极少纠结于这么深的软件包管理知识。
|
||||
|
||||
#### 检查软件包的依赖关系和反向依赖关系。
|
||||
|
||||
你可以在安装之前(甚至在安装之后)[检查一个包的依赖关系][11]。它还会显示所有可能满足依赖关系的软件包。
|
||||
|
||||
```
|
||||
apt-cache depends package
|
||||
```
|
||||
|
||||
![][12]
|
||||
|
||||
你也可以通过 `apt-cahce` 检查反向依赖关系来检查哪些包是依赖于某个包的。
|
||||
|
||||
![][13]
|
||||
|
||||
坦白说,看到 Ansible 这样的 DevOps 工具对 [Cowsay 这样有趣的 Linux 命令][14]有依赖性,我也很惊讶。我想可能是因为在[安装 Ansible][15]之后,它会在节点上显示一些信息。
|
||||
|
||||
#### 检查未满足的依赖性
|
||||
|
||||
你可能会被 [Ubuntu 中未满足的依赖问题][16]所困扰,其他 Linux 也有类似问题。`apt-cache` 命令提供了一个选项来检查系统中各种可用软件包的所有未满足的依赖关系。
|
||||
|
||||
```
|
||||
apt-cache unmet
|
||||
```
|
||||
|
||||
![][17]
|
||||
|
||||
### 结论
|
||||
|
||||
你可以用 `apt-cache` 命令列出所有可用的软件包。输出结果会很庞大,所以我建议将其与 [wc 命令][18] 结合起来,得到可用软件包的总数,就像这样:
|
||||
|
||||
```
|
||||
apt-cache pkgnames | wc -l
|
||||
```
|
||||
|
||||
你是否注意到你不需要成为 [root 用户][19]就可以使用 `apt-cache` 命令?
|
||||
|
||||
较新的 [apt 命令][20]也有一些与 `apt-cache` 命令相对应的功能选项。由于 `apt` 比较新,所以在脚本中还是首选使用 `apt-get` 及其相关的 `apt-cache` 等命令。
|
||||
|
||||
希望你觉得本教程对你有帮助。如果你对上面讨论的任何一点有疑问或者有改进的建议,请在评论中告诉我。
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://itsfoss.com/apt-cache-command/
|
||||
|
||||
作者:[Abhishek Prakash][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://itsfoss.com/author/abhishek/
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://wiki.debian.org/Apt
|
||||
[2]: https://itsfoss.com/package-manager/
|
||||
[3]: https://itsfoss.com/clear-apt-cache/
|
||||
[4]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/10/apt-cache-command.png?resize=800%2C450&ssl=1
|
||||
[5]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/10/apt-cache-search.png?resize=759%2C437&ssl=1
|
||||
[6]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/10/apt-cache-search-names-only.png?resize=759%2C209&ssl=1
|
||||
[7]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/10/apt-cache-show-full.png?resize=759%2C722&ssl=1
|
||||
[8]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/10/apt-cache-show-pkgname.png?resize=800%2C795&ssl=1
|
||||
[9]: https://debian-handbook.info/browse/stable/sect.apt-get.html#sect.apt.priorities
|
||||
[10]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/10/apt-cache-policy.png?resize=795%2C456&ssl=1
|
||||
[11]: https://itsfoss.com/check-dependencies-package-ubuntu/
|
||||
[12]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/10/apt-cache-dependency-check.png?resize=768%2C304&ssl=1
|
||||
[13]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/10/apt-cache-reverse-dependency.png?resize=768%2C304&ssl=1
|
||||
[14]: https://itsfoss.com/funny-linux-commands/
|
||||
[15]: https://linuxhandbook.com/install-ansible-linux/
|
||||
[16]: https://itsfoss.com/held-broken-packages-error/
|
||||
[17]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/10/apt-cache-unmet.png?resize=759%2C399&ssl=1
|
||||
[18]: https://linuxhandbook.com/wc-command/
|
||||
[19]: https://itsfoss.com/root-user-ubuntu/
|
||||
[20]: https://itsfoss.com/apt-command-guide/
|
@ -0,0 +1,109 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: (geekpi)
|
||||
[#]: reviewer: (wxy)
|
||||
[#]: publisher: (wxy)
|
||||
[#]: url: (https://linux.cn/article-12810-1.html)
|
||||
[#]: subject: (4 cool new projects to try in COPR from October 2020)
|
||||
[#]: via: (https://fedoramagazine.org/4-cool-new-projects-to-try-in-copr-from-october-2020/)
|
||||
[#]: author: (frostyx https://fedoramagazine.org/author/frostyx/)
|
||||
|
||||
COPR 仓库中 4 个很酷的新项目(2020.10)
|
||||
======
|
||||
|
||||
![][1]
|
||||
|
||||
COPR 是个人软件仓库[集合][2],它不在 Fedora 中。这是因为某些软件不符合轻松打包的标准;或者它可能不符合其他 Fedora 标准,尽管它是自由而开源的。COPR 可以在 Fedora 套件之外提供这些项目。COPR 中的软件不受 Fedora 基础设施的支持,或者是由项目自己背书的。但是,这是一种尝试新的或实验性的软件的一种巧妙的方式。
|
||||
|
||||
本文介绍了 COPR 中一些有趣的新项目。如果你第一次使用 COPR,请参阅 [COPR 用户文档][3]。
|
||||
|
||||
### Dialect
|
||||
|
||||
[Dialect][4] 使用谷歌翻译将文本翻译成外语。它可以记住你的翻译历史,并支持自动语言检测和文本到语音等功能。用户界面简约,模仿谷歌翻译工具本身,所以它真的很容易使用。
|
||||
|
||||
![][5]
|
||||
|
||||
#### 安装说明
|
||||
|
||||
目前[仓库][6]在 Fedora 33 和 Fedora Rawhide 中提供了 Dialect。要安装它,请使用下面的命令:
|
||||
|
||||
```
|
||||
sudo dnf copr enable lyessaadi/dialect
|
||||
sudo dnf install dialect
|
||||
```
|
||||
|
||||
### GitHub CLI
|
||||
|
||||
[gh][7] 是一个官方的 GitHub 命令行客户端。它在终端提供了快速的访问,并完全控制你的项目问题、拉取请求和发布。议题(和其他东西)也可以在浏览器中轻松查看,以获得更标准的用户界面,或与他人分享。
|
||||
|
||||
![][8]
|
||||
|
||||
#### 安装说明
|
||||
|
||||
目前[仓库][9]在 Fedora 33 和 Fedora Rawhide 中提供了 `gh` 。要安装它,请使用下面的命令:
|
||||
|
||||
```
|
||||
sudo dnf copr enable jdoss/github-cli
|
||||
sudo dnf install github-cli
|
||||
```
|
||||
|
||||
### Glide
|
||||
|
||||
[Glide][10] 是一个基于 GStreamer 的极简主义媒体播放器。它可以播放任何 GStreamer 支持的多媒体格式的本地和远程文件。如果你需要一个多平台的具有简单用户界面的媒体播放器,你可能会想试试 Glide。
|
||||
|
||||
![][11]
|
||||
|
||||
#### 安装说明
|
||||
|
||||
目前[仓库][12]在 Fedora 32、33 和 Rawhide 中提供了 Glide。要安装它,请使用下面的命令:
|
||||
|
||||
```
|
||||
sudo dnf copr enable atim/glide-rs
|
||||
sudo dnf install glide-rs
|
||||
```
|
||||
|
||||
### Vim ALE
|
||||
|
||||
[ALE][13] 是 Vim 文本编辑器的一个插件,它提供了语法和语义错误检查。它还带来了诸如代码修复和许多其他类似于 IDE 的功能,如 TAB 补全、跳转到定义、查找引用、查看文档等。
|
||||
|
||||
![][14]
|
||||
|
||||
#### 安装说明
|
||||
|
||||
目前[仓库][15]在 Fedora 31、32、33 和 Rawhide 还有 EPEL8 中提供了 `vim-ale` 。要安装它,请使用下面的命令:
|
||||
|
||||
```
|
||||
sudo dnf copr enable praiskup/vim-ale
|
||||
sudo dnf install vim-ale
|
||||
```
|
||||
|
||||
编者注:可在[此处][16]查阅以前的 COPR 文章。
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://fedoramagazine.org/4-cool-new-projects-to-try-in-copr-from-october-2020/
|
||||
|
||||
作者:[frostyx][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/author/frostyx/
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://fedoramagazine.org/wp-content/uploads/2017/08/4-copr-945x400.jpg
|
||||
[2]: https://copr.fedorainfracloud.org/
|
||||
[3]: https://docs.pagure.org/copr.copr/user_documentation.html
|
||||
[4]: https://github.com/gi-lom/dialect
|
||||
[5]: https://fedoramagazine.org/wp-content/uploads/2020/10/dialect.png
|
||||
[6]: https://copr.fedorainfracloud.org/coprs/lyessaadi/dialect/
|
||||
[7]: https://github.com/cli/cli
|
||||
[8]: https://fedoramagazine.org/wp-content/uploads/2020/10/github-cli.png
|
||||
[9]: https://copr.fedorainfracloud.org/coprs/jdoss/github-cli/
|
||||
[10]: https://github.com/philn/glide
|
||||
[11]: https://fedoramagazine.org/wp-content/uploads/2020/10/glide.png
|
||||
[12]: https://copr.fedorainfracloud.org/coprs/atim/glide-rs/
|
||||
[13]: https://github.com/dense-analysis/ale
|
||||
[14]: https://fedoramagazine.org/wp-content/uploads/2020/10/vim-ale.png
|
||||
[15]: https://copr.fedorainfracloud.org/coprs/praiskup/vim-ale/
|
||||
[16]: https://fedoramagazine.org/?s=COPR
|
@ -0,0 +1,104 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: (wxy)
|
||||
[#]: reviewer: (wxy)
|
||||
[#]: publisher: (wxy)
|
||||
[#]: url: (https://linux.cn/article-12809-1.html)
|
||||
[#]: subject: (Linux Jargon Buster: What are GUI, CLI and TUI in Linux?)
|
||||
[#]: via: (https://itsfoss.com/gui-cli-tui/)
|
||||
[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/)
|
||||
|
||||
Linux 黑话解释:什么是 Linux 中的 GUI、CLI 和 TUI?
|
||||
======
|
||||
|
||||

|
||||
|
||||
当你开始使用 Linux 并关注关于 Linux 的网站和论坛时,你会经常遇到诸如 GUI、CLI 等术语,有时还会遇到 TUI。
|
||||
|
||||
这一章的 Linux 黑话解释简要解释了这些术语,以便你作为一个(新的)Linux 用户在使用这些缩写词时能够更好地理解上下文。
|
||||
|
||||
说实话,像 GUI、CLI 或 TUI 这样的术语并不是 Linux 的专属术语。这些都是通用的计算术语,你会发现在非 Linux 的讨论中也会用到它们。
|
||||
|
||||
### GUI - <ruby>图形用户界面<rt>Graphical User Interface</rt></ruby>
|
||||
|
||||
这可能是你在这里最常遇到的词汇。这是因为我们专注于桌面 Linux 用户,并试图涵盖易于使用的图形化方法和应用程序。
|
||||
|
||||
GUI 应用程序(或图形应用程序)基本上是指任何可以与你的鼠标、触摸板或触摸屏交互的东西。有了图标和其他视觉概念,你可以使用鼠标指针来访问功能。
|
||||
|
||||
![GIMP:一个用于照片编辑的GUI应用程序][1]
|
||||
|
||||
在 Linux 上,[桌面环境][2]为你提供了与系统交互的图形界面,然后,你可以使用 GUI 应用程序,如 GIMP,VLC、Firefox、LibreOffice、文件管理器等来完成各种任务。
|
||||
|
||||
GUI 使普通用户的计算机使用变得更加容易,否则它将仍然是一个极客专用区。
|
||||
|
||||
### CLI - <ruby>命令行界面<rt>Command Line Interface</rt></ruby>
|
||||
|
||||
CLI 基本上是一个接受输入来执行某种功能的命令行程序。基本上,任何可以在终端中通过命令使用的应用程序都属于这一类。
|
||||
|
||||
![apt-cache 是一个 CLI 工具,用于在基于 Debian 的系统上与 APT 缓存交互][3]
|
||||
|
||||
早期的电脑与操作系统交互没有鼠标,你必须使用命令与机器互动。
|
||||
|
||||
如果你认为这都算困难,那你应该知道,早期的计算机甚至没有一个屏幕可以看到正在输入的东西,他们用实体的纸质打印机看到他们的输入命令。我从来没有用过这样的电脑,也没有在现实生活中看到过。我用过的最接近的东西是学习期间的单片机套件。
|
||||
|
||||
![肯•汤普森和丹尼斯•里奇在 PDP11 电脑上开发 UNIX 操作系统][4]
|
||||
|
||||
现在的 CLI 还有用吗?当然有。命令总是有它的好处,特别是当你处理操作系统的核心功能和配置时,比如设置防火墙、管理网络甚至[包管理][5]。
|
||||
|
||||
你可能会有一个基于 GUI 的应用程序来完成同样的任务,但命令可以让你更精细地访问这些功能。在一些情况下,你会发现 GUI 应用程序也会用命令(在它们的代码中使用)与操作系统交互。
|
||||
|
||||
![Handbrake GUI 应用程序在底层使用 FFMPEG CLI 工具][6]
|
||||
|
||||
许多流行的 GUI 应用程序往往是基于 CLI 工具的。以[Handbrake][7] 为例。这是一个流行的开源媒体转换器,它底层使用的是 [FFMPEG 命令行][8]工具。
|
||||
|
||||
很明显,使用命令行工具没有图形工具那么简单。不要担心。除非你有特殊需要,否则你应该可以用图形化的方式使用 Linux 系统。然而,了解基本的 Linux 命令会有很大的帮助。
|
||||
|
||||
### TUI - <ruby>终端用户界面<rt>Terminal User Interface</rt></ruby>(也称为<ruby>基于文本的用户界面<rt>Text-based User Interface</rt></ruby>)
|
||||
|
||||
这是三者中最不常见的名词。TUI 基本上部分是 GUI,部分是 CLI。糊涂了吗?让我为你解释一下。
|
||||
|
||||
你已经知道,早期的计算机使用 CLI。在实际的 GUI 出现之前,基于文本的用户界面在终端中提供了一种非常基本的图形交互。你会有更多的视觉效果,也可以使用鼠标和键盘与应用程序进行交互。
|
||||
|
||||
![终端中的 nnn 文件浏览器][9]
|
||||
|
||||
TUI 是基于文本的用户界面或终端用户界面的缩写。“基于文本”这个说法主要是因为你在屏幕上有一堆文本,而“终端用户界面”的说法是因为它们只在终端中使用。
|
||||
|
||||
TUI 的应用虽然不是那么常见,但你还是有一些的。[基于终端的 Web 浏览器][10]是 TUI 程序的好例子。[基于终端的游戏][11]也属于这一类。
|
||||
|
||||
![CMUS 是基于终端的音乐播放器][12]
|
||||
|
||||
当你在 [Ubuntu 中安装多媒体编解码器][13]时,你可能会遇到 TUI,你必须接受 EULA 或做出选择。
|
||||
|
||||
TUI 应用程序不像 GUI 应用程序那样用户友好,它们经常会有学习曲线,但它们比命令行工具更容易使用一些。
|
||||
|
||||
### 最后……
|
||||
|
||||
TUI 应用程序通常也被认为是 CLI 应用程序,因为它们被限制在终端上。在我看来,你是否认为它们与 CLI 不同,这取决于你。
|
||||
|
||||
我希望你喜欢这篇 Linux 黑话解释。如果你对这个系列的主题有什么建议,请在评论中告诉我,我将在以后尽量涵盖它们。
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://itsfoss.com/gui-cli-tui/
|
||||
|
||||
作者:[Abhishek Prakash][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://itsfoss.com/author/abhishek/
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2018/04/gimp-2-10-interface.jpg?resize=800%2C450&ssl=1
|
||||
[2]: https://itsfoss.com/what-is-desktop-environment/
|
||||
[3]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/10/apt-cache-search-names-only.png?resize=759%2C209&ssl=1
|
||||
[4]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/11/Ken_Thompson_and_Dennis_Ritchie_at_PDP-11.jpg?resize=800%2C641&ssl=1
|
||||
[5]: https://itsfoss.com/package-manager/
|
||||
[6]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/11/handbrake.png?resize=800%2C537&ssl=1
|
||||
[7]: https://itsfoss.com/handbrake/
|
||||
[8]: https://itsfoss.com/ffmpeg/
|
||||
[9]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/10/nnn-file-browser.jpg?resize=800%2C597&ssl=1
|
||||
[10]: https://itsfoss.com/terminal-web-browsers/
|
||||
[11]: https://itsfoss.com/best-command-line-games-linux/
|
||||
[12]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2017/07/cmus-interface.png?resize=734%2C436&ssl=1
|
||||
[13]: https://itsfoss.com/install-media-codecs-ubuntu/
|
@ -0,0 +1,99 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: (wxy)
|
||||
[#]: reviewer: (wxy)
|
||||
[#]: publisher: (wxy)
|
||||
[#]: url: (https://linux.cn/article-12793-1.html)
|
||||
[#]: subject: (The New Raspberry Pi 400 is Basically a Tiny Computer Inside a Keyboard)
|
||||
[#]: via: (https://itsfoss.com/raspberry-pi-400/)
|
||||
[#]: author: (Ankush Das https://itsfoss.com/author/ankush/)
|
||||
|
||||
新的树莓派 400:一台藏身于键盘内微型计算机
|
||||
======
|
||||
|
||||
树莓派是什么已经无需介绍。这台起初是为 DIY 爱好者打造的低规格电脑,现在可以作为全功能桌面使用了。
|
||||
|
||||
随着树莓派 400 的发布,使得它更加适合作为家庭电脑使用。树莓派 400 基本上是一台藏身于键盘内微型计算机。
|
||||
|
||||
如果你还记得,[Commodore 64][1] 在 1982 年时也是一台键盘形式的电脑。尽管树莓派 400 并不是独一无二的,但对于树莓派这样的成功产品来说,这是一个令人心仪的产品。
|
||||
|
||||
### 树莓派 400 概观
|
||||
|
||||
![][2]
|
||||
|
||||
它是基于树莓派 4 的(带有 4GB 内存),并已调整附加了冷却器。它采用四核处理器,速度比以往更快。
|
||||
|
||||
除了易用性和便携性,它还可以为你节省很多桌面空间。而且,就像我一样,如果你打算买一台备用电脑来测试东西,我想我可能会选择树莓派 400,而不是组装另一台 PC 或[基于 Linux 的迷你 PC][3]。
|
||||
|
||||
尽管我在下面提到了它的技术规格,但你可以观看官方视频来了解它的外观,以及它所承诺的是否可以满足作为你的家用电脑的需求。
|
||||
|
||||

|
||||
|
||||
### 树莓派 400 技术规格
|
||||
|
||||
* 博通 BCM2711 四核 Cortex-A72(ARM v8)64 位 SoC @ 1.8GHz
|
||||
* 4GB LPDDR4-3200
|
||||
* 双频(2.4GHz 和 5.0GHz)IEEE 802.11b/g/n/ac 无线局域网
|
||||
* 蓝牙 5.0,BLE
|
||||
* 千兆以太网
|
||||
* 2 个 USB 3.0 和 1 个 USB 2.0 端口
|
||||
* 水平 40 针 GPIO 头
|
||||
* 2 个 micro HDMI 端口(支持最高 4Kp60)
|
||||
* H.265(4Kp60 解码);H.264(1080p60 解码,1080p30 编码);OpenGL ES 3.0 图形
|
||||
* micro SD 卡插槽,用于操作系统和数据存储
|
||||
* 78 或 79 键的小型键盘(取决于地区差异)
|
||||
* 5V DC,通过 USB 连接器
|
||||
* 工作温度:环境温度 0℃ 至 +50℃。
|
||||
* 最大尺寸 286 毫米 × 122 毫米 × 23 毫米
|
||||
|
||||
![][4]
|
||||
|
||||
### 定价与供应
|
||||
|
||||
这是你付出 **70** 美元,所能得到的最好的现代家用电脑,只需一个键盘就可以简单的携带到任何地方(你只需要一个屏幕连接)。
|
||||
|
||||
你可以花 70 美元只买树莓派 400,也可以花 100 美元买完整的套装,它还包括一个 USB 鼠标、micro HDMI 转 HDMI 线、USB-C 电源、一本初学者指南和一张预装了树莓派操作系统的 SD 卡。
|
||||
|
||||
如果你想知道,对于键盘布局的支持,新闻稿中是这样提到的:
|
||||
|
||||
> 在发布时,我们支持英语(英国和美国)、法语、意大利语、德语和西班牙语的键盘布局,并(首次)提供翻译版的新手指南。在不久的将来,我们计划支持与我们的[官方键盘][5]相同的语言集。
|
||||
|
||||
换句话说,一开始他们就支持所有主要的键盘布局。所以,对于大多数人来说,这应该不是问题。
|
||||
|
||||
除了键盘布局的细节外,下面是你如何获得树莓派 400 的方法:
|
||||
|
||||
> 英国、美国和法国的树莓派 400 [套件][6]和[电脑][7]现在就可以购买。意大利、德国和西班牙的产品正在送往树莓派授权经销商的路上,他们应该在下周就会有货。
|
||||
>
|
||||
> 我们预计,印度、澳大利亚和新西兰的授权经销商将在今年年底前拿到套件和电脑。我们也在迅速推出其他地区的合规认证,因此树莓派 400 将在 2021 年的前几个月在全球范围内上市。
|
||||
>
|
||||
> 当然,如果你在剑桥附近的任何地方,你可以前往[树莓派商店][8],今天就可以领取你的树莓派 400。
|
||||
|
||||
- [树莓派 400][9]
|
||||
|
||||
### 总结
|
||||
|
||||
在远程办公成为新常态的当下,树莓派 400 绝对是令人印象深刻的好东西,也是非常有用的。
|
||||
|
||||
你对新的树莓派 400 有什么看法?打算买一台吗?在下面的评论中告诉我你的想法。
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://itsfoss.com/raspberry-pi-400/
|
||||
|
||||
作者:[Ankush Das][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://itsfoss.com/author/ankush/
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://en.wikipedia.org/wiki/Commodore_64
|
||||
[2]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/11/raspberry-pi-400.jpg?resize=800%2C554&ssl=1
|
||||
[3]: https://itsfoss.com/linux-based-mini-pc/
|
||||
[4]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/11/raspberry-pi-400-shot.jpeg?resize=800%2C572&ssl=1
|
||||
[5]: https://www.raspberrypi.org/products/raspberry-pi-keyboard-and-hub/
|
||||
[6]: https://www.raspberrypi.org/products/raspberry-pi-400/
|
||||
[7]: https://www.raspberrypi.org/products/raspberry-pi-400-unit/
|
||||
[8]: https://www.raspberrypi.org/raspberry-pi-store/
|
||||
[9]: https://www.raspberrypi.org/products/raspberry-pi-400
|
@ -1,66 +0,0 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: ( )
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
[#]: subject: (Most enterprise networks can't handle big data loads)
|
||||
[#]: via: (https://www.networkworld.com/article/3440519/most-enterprise-networks-cant-handle-big-data-loads.html)
|
||||
[#]: author: (Andy Patrizio https://www.networkworld.com/author/Andy-Patrizio/)
|
||||
|
||||
Most enterprise networks can't handle big data loads
|
||||
======
|
||||
As more data moves through the network, efforts to keep up are lagging due to leadership and technology issues.
|
||||
Metamorworks / Getty Images
|
||||
|
||||
Another week, another survey that finds IT cannot keep up with the ever-expanding data overload. This time the problem surrounds network bandwidth and overall performance.
|
||||
|
||||
[A survey of 300 IT professionals][1] conducted by management consultant firm Accenture found the majority feel their enterprise networks are not up to the task of handling big data and internet of things (IoT) deployments. Only 43% of those companies polled said their networks are ready to support the cloud, IoT, and other digital technologies.
|
||||
|
||||
**[ Learn more about SDN: Find out [where SDN is going][2] and learn the [difference between SDN and NFV][3]. | Get regularly scheduled insights: [Sign up for Network World newsletters][4]. ]**
|
||||
|
||||
A key reason (58%) is a “misalignment between IT and business needs” that is slowing those rollouts. That is an unusual finding, since 85% of respondents also reported that their networks were completely or mostly ready to support the business’ digital initiatives. So which is it?
|
||||
|
||||
The second and third most commonly cited barriers were “inherent complexities between business requirements and operational needs” and “demands for bandwidth, performance, etc. outpacing the ability to deliver” at 45% each.
|
||||
|
||||
Network bottlenecks continue to grow as the sheer amount of data being pumped over the wires continues to increase thanks to analytics and other big data technologies. The survey found that bandwidth demands were not being met and current network performance continues to fall short.
|
||||
|
||||
Other reasons cited were lack of networking skills, device sprawl, and aging equipment.
|
||||
|
||||
### One solution to network performance woes: SDN
|
||||
|
||||
Accenture found that most firms said [software-defined networks (SDN)][5] were the solution for bandwidth and performance challenges, with 77% of those surveyed reporting they were in the process of deploying SDN or have completed the deployment. It qualified that, noting that while SDN may be in place in parts of the organization, it is not always rolled out uniformly enterprise-wide.
|
||||
|
||||
**** From HPE: [ITaaS and Corporate Storage Technology][6]: This blog explains why pay-per-use IT models, such as ITaaS, could be the next chapter in IT infrastructure. (Sponsored) ****
|
||||
|
||||
Now, while it seems no one ever has enough budget for all of their IT ambitions, 31% of those surveyed describe funding network improvements as “easy” and within the network infrastructure team’s control, with CIOs/CTOs being much more likely to report the funding process as “easy” (40%), compared to their direct reports (13%) or directors and vice presidents of infrastructure/network (19%).
|
||||
|
||||
Saying, "Legacy networks alone cannot support the innovation and performance required in the digital age," the report calls for embracing new technologies, without saying SDN by name. It also called for greater collaboration between the C suite and their direct reports because it was clear there was a disconnect between how the two sides viewed things.
|
||||
|
||||
"We believe a new network paradigm is needed to ensure networks meet current and future business needs. However, although there are signs of progress, the pace of change is slow. Companies must undertake significant work before they achieve a unified and standardized enterprise capability that will offer the bandwidth, performance and security necessary to support business needs today—and tomorrow," the report concluded.
|
||||
|
||||
**[ Now see: [How network pros acquire skills for SDN, programmable networks][7] ]**
|
||||
|
||||
Join the Network World communities on [Facebook][8] and [LinkedIn][9] to comment on topics that are top of mind.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://www.networkworld.com/article/3440519/most-enterprise-networks-cant-handle-big-data-loads.html
|
||||
|
||||
作者:[Andy Patrizio][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/Andy-Patrizio/
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://www.accenture.com/_acnmedia/pdf-107/accenture-network-readiness-survey.pdf#zoom=50
|
||||
[2]: https://www.networkworld.com/article/3209131/lan-wan/what-sdn-is-and-where-its-going.html
|
||||
[3]: https://www.networkworld.com/article/3206709/lan-wan/what-s-the-difference-between-sdn-and-nfv.html
|
||||
[4]: https://www.networkworld.com/newsletters/signup.html
|
||||
[5]: https://www.networkworld.com/article/3209131/what-sdn-is-and-where-its-going.html
|
||||
[6]: https://www.networkworld.com/blog/itaas-and-the-corporate-storage-technology/
|
||||
[7]: https://www.networkworld.com/article/3405522/how-network-pros-acquire-skills-for-sdn-programmable-networks.html
|
||||
[8]: https://www.facebook.com/NetworkWorld/
|
||||
[9]: https://www.linkedin.com/company/network-world
|
@ -0,0 +1,125 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: ( )
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
[#]: subject: (Roy Fielding's Misappropriated REST Dissertation)
|
||||
[#]: via: (https://twobithistory.org/2020/06/28/rest.html)
|
||||
[#]: author: (Two-Bit History https://twobithistory.org)
|
||||
|
||||
Roy Fielding's Misappropriated REST Dissertation
|
||||
======
|
||||
|
||||
RESTful APIs are everywhere. This is funny, because how many people really know what “RESTful” is supposed to mean?
|
||||
|
||||
I think most of us can empathize with [this Hacker News poster][1]:
|
||||
|
||||
> I’ve read several articles about REST, even a bit of the original paper. But I still have quite a vague idea about what it is. I’m beginning to think that nobody knows, that it’s simply a very poorly defined concept.
|
||||
|
||||
I had planned to write a blog post exploring how REST came to be such a dominant paradigm for communication across the internet. I started my research by reading [Roy Fielding’s 2000 dissertation][2], which introduced REST to the world. After reading Fielding’s dissertation, I realized that the much more interesting story here is how Fielding’s ideas came to be so widely misunderstood.
|
||||
|
||||
Many more people know that Fielding’s dissertation is where REST came from than have read the dissertation (fair enough), so misconceptions about what the dissertation actually contains are pervasive.
|
||||
|
||||
The biggest of these misconceptions is that the dissertation directly addresses the problem of building APIs. I had always assumed, as I imagine many people do, that REST was intended from the get-go as an architectural model for web APIs built on top of HTTP. I thought perhaps that there had been some chaotic experimental period where people were building APIs on top of HTTP all wrong, and then Fielding came along and presented REST as the sane way to do things. But the timeline doesn’t make sense here: APIs for web services, in the sense that we know them today, weren’t a thing until a few years after Fielding published his dissertation.
|
||||
|
||||
Fielding’s dissertation (titled “Architectural Styles and the Design of Network-based Software Architectures”) is not about how to build APIs on top of HTTP but rather about HTTP itself. Fielding contributed to the HTTP/1.0 specification and co-authored the HTTP/1.1 specification, which was published in 1999. He was interested in the architectural lessons that could be drawn from the design of the HTTP protocol; his dissertation presents REST as a distillation of the architectural principles that guided the standardization process for HTTP/1.1. Fielding used these principles to make decisions about which proposals to incorporate into HTTP/1.1. For example, he rejected a proposal to batch requests using new `MGET` and `MHEAD` methods because he felt the proposal violated the constraints prescribed by REST, especially the constraint that messages in a REST system should be easy to proxy and cache.[1][3] So HTTP/1.1 was instead designed around persistent connections over which multiple HTTP requests can be sent. (Fielding also felt that cookies are not RESTful because they add state to what should be a stateless system, but their usage was already entrenched.[2][4]) REST, for Fielding, was not a guide to building HTTP-based systems but a guide to extending HTTP.
|
||||
|
||||
This isn’t to say that Fielding doesn’t think REST could be used to build other systems. It’s just that he assumes these other systems will also be “distributed hypermedia systems.” This is another misconception people have about REST: that it is a general architecture you can use for any kind of networked application. But you could sum up the part of the dissertation where Fielding introduces REST as, essentially, “Listen, we just designed HTTP, so if you also find yourself designing a _distributed hypermedia system_ you should use this cool architecture we worked out called REST to make things easier.” It’s not obvious why Fielding thinks anyone would ever attempt to build such a thing given that the web already exists; perhaps in 2000 it seemed like there was room for more than one distributed hypermedia system in the world. Anyway, Fielding makes clear that REST is intended as a solution for the scalability and consistency problems that arise when trying to connect hypermedia across the internet, _not_ as an architectural model for distributed applications in general.
|
||||
|
||||
We remember Fielding’s dissertation now as the dissertation that introduced REST, but really the dissertation is about how much one-size-fits-all software architectures suck, and how you can better pick a software architecture appropriate for your needs. Only a single chapter of the dissertation is devoted to REST itself; much of the word count is spent on a taxonomy of alternative architectural styles[3][5] that one could use for networked applications. Among these is the Pipe-and-Filter (PF) style, inspired by Unix pipes, along with various refinements of the Client-Server style (CS), such as Layered-Client-Server (LCS), Client-Cache-Stateless-Server (C$SS), and Layered-Client-Cache-Stateless-Server (LC$SS). The acronyms get unwieldy but Fielding’s point is that you can mix and match constraints imposed by existing styles to derive new styles. REST gets derived this way and could instead have been called—but for obvious reasons was not—Uniform-Layered-Code-on-Demand-Client-Cache-Stateless-Server (ULCODC$SS). Fielding establishes this taxonomy to emphasize that different constraints are appropriate for different applications and that this last group of constraints were the ones he felt worked best for HTTP.
|
||||
|
||||
This is the deep, deep irony of REST’s ubiquity today. REST gets blindly used for all sorts of networked applications now, but Fielding originally offered REST as an illustration of how to derive a software architecture tailored to an individual application’s particular needs.
|
||||
|
||||
I struggle to understand how this happened, because Fielding is so explicit about the pitfalls of not letting form follow function. He warns, almost at the very beginning of the dissertation, that “design-by-buzzword is a common occurrence” brought on by a failure to properly appreciate software architecture.[4][6] He picks up this theme again several pages later:
|
||||
|
||||
> Some architectural styles are often portrayed as “silver bullet” solutions for all forms of software. However, a good designer should select a style that matches the needs of a particular problem being solved.[5][7]
|
||||
|
||||
REST itself is an especially poor “silver bullet” solution, because, as Fielding later points out, it incorporates trade-offs that may not be appropriate unless you are building a distributed hypermedia application:
|
||||
|
||||
> REST is designed to be efficient for large-grain hypermedia data transfer, optimizing for the common case of the Web, but resulting in an interface that is not optimal for other forms of architectural interaction.[6][8]
|
||||
|
||||
Fielding came up with REST because the web posed a thorny problem of “anarchic scalability,” by which Fielding means the need to connect documents in a performant way across organizational and national boundaries. The constraints that REST imposes were carefully chosen to solve this anarchic scalability problem. Web service APIs that are _public-facing_ have to deal with a similar problem, so one can see why REST is relevant there. Yet today it would not be at all surprising to find that an engineering team has built a backend using REST even though the backend only talks to clients that the engineering team has full control over. We have all become the architect in [this Monty Python sketch][9], who designs an apartment building in the style of a slaughterhouse because slaughterhouses are the only thing he has experience building. (Fielding uses a line from this sketch as an epigraph for his dissertation: “Excuse me… did you say ‘knives’?”)
|
||||
|
||||
So, given that Fielding’s dissertation was all about avoiding silver bullet software architectures, how did REST become a de facto standard for web services of every kind?
|
||||
|
||||
My theory is that, in the mid-2000s, the people who were sick of SOAP and wanted to do something else needed their own four-letter acronym.
|
||||
|
||||
I’m only half-joking here. SOAP, or the Simple Object Access Protocol, is a verbose and complicated protocol that you cannot use without first understanding a bunch of interrelated XML specifications. Early web services offered APIs based on SOAP, but, as more and more APIs started being offered in the mid-2000s, software developers burned by SOAP’s complexity migrated away en masse.
|
||||
|
||||
Among this crowd, SOAP inspired contempt. Ruby-on-Rails dropped SOAP support in 2007, leading to this emblematic comment from Rails creator David Heinemeier Hansson: “We feel that SOAP is overly complicated. It’s been taken over by the enterprise people, and when that happens, usually nothing good comes of it.”[7][10] The “enterprise people” wanted everything to be formally specified, but the get-shit-done crowd saw that as a waste of time.
|
||||
|
||||
If the get-shit-done crowd wasn’t going to use SOAP, they still needed some standard way of doing things. Since everyone was using HTTP, and since everyone would keep using HTTP at least as a transport layer because of all the proxying and caching support, the simplest possible thing to do was just rely on HTTP’s existing semantics. So that’s what they did. They could have called their approach Fuck It, Overload HTTP (FIOH), and that would have been an accurate name, as anyone who has ever tried to decide what HTTP status code to return for a business logic error can attest. But that would have seemed recklessly blasé next to all the formal specification work that went into SOAP.
|
||||
|
||||
Luckily, there was this dissertation out there, written by a co-author of the HTTP/1.1 specification, that had something vaguely to do with extending HTTP and could offer FIOH a veneer of academic respectability. So REST was appropriated to give cover for what was really just FIOH.
|
||||
|
||||
I’m not saying that this is exactly how things happened, or that there was an actual conspiracy among irreverent startup types to misappropriate REST, but this story helps me understand how REST became a model for web service APIs when Fielding’s dissertation isn’t about web service APIs at all. Adopting REST’s constraints makes some sense, especially for public-facing APIs that do cross organizational boundaries and thus benefit from REST’s “uniform interface.” That link must have been the kernel of why REST first got mentioned in connection with building APIs on the web. But imagining a separate approach called “FIOH,” that borrowed the “REST” name partly just for marketing reasons, helps me account for the many disparities between what today we know as RESTful APIs and the REST architectural style that Fielding originally described.
|
||||
|
||||
REST purists often complain, for example, that so-called REST APIs aren’t actually REST APIs because they do not use Hypermedia as The Engine of Application State (HATEOAS). Fielding himself [has made this criticism][11]. According to him, a real REST API is supposed to allow you to navigate all its endpoints from a base endpoint by following links. If you think that people are actually out there trying to build REST APIs, then this is a glaring omission—HATEOAS really is fundamental to Fielding’s original conception of REST, especially considering that the “state transfer” in “Representational State Transfer” refers to navigating a state machine using hyperlinks between resources (and not, as many people seem to believe, to transferring resource state over the wire).[8][12] But if you imagine that everyone is just building FIOH APIs and advertising them, with a nudge and a wink, as REST APIs, or slightly more honestly as “RESTful” APIs, then of course HATEOAS is unimportant.
|
||||
|
||||
Similarly, you might be surprised to know that there is nothing in Fielding’s dissertation about which HTTP verb should map to which CRUD action, even though software developers like to argue endlessly about whether using PUT or PATCH to update a resource is more RESTful. Having a standard mapping of HTTP verbs to CRUD actions is a useful thing, but this standard mapping is part of FIOH and not part of REST.
|
||||
|
||||
This is why, rather than saying that nobody understands REST, we should just think of the term “REST” as having been misappropriated. The modern notion of a REST API has historical links to Fielding’s REST architecture, but really the two things are separate. The historical link is good to keep in mind as a guide for when to build a RESTful API. Does your API cross organizational and national boundaries the same way that HTTP needs to? Then building a RESTful API with a predictable, uniform interface might be the right approach. If not, it’s good to remember that Fielding favored having form follow function. Maybe something like GraphQL or even just JSON-RPC would be a better fit for what you are trying to accomplish.
|
||||
|
||||
_If you enjoyed this post, more like it come out every four weeks! Follow [@TwoBitHistory][13] on Twitter or subscribe to the [RSS feed][14] to make sure you know when a new post is out._
|
||||
|
||||
_Previously on TwoBitHistory…_
|
||||
|
||||
> New post is up! I wrote about how to solve differential equations using an analog computer from the '30s mostly made out of gears. As a bonus there's even some stuff in here about how to aim very large artillery pieces.<https://t.co/fwswXymgZa>
|
||||
>
|
||||
> — TwoBitHistory (@TwoBitHistory) [April 6, 2020][15]
|
||||
|
||||
1. Roy Fielding. “Architectural Styles and the Design of Network-based Software Architectures,” 128. 2000. University of California, Irvine, PhD Dissertation, accessed June 28, 2020, <https://www.ics.uci.edu/~fielding/pubs/dissertation/fielding_dissertation_2up.pdf>. [↩︎][16]
|
||||
|
||||
2. Fielding, 130. [↩︎][17]
|
||||
|
||||
3. Fielding distinguishes between software architectures and software architecture “styles.” REST is an architectural style that has an instantiation in the architecture of HTTP. [↩︎][18]
|
||||
|
||||
4. Fielding, 2. [↩︎][19]
|
||||
|
||||
5. Fielding, 15. [↩︎][20]
|
||||
|
||||
6. Fielding, 82. [↩︎][21]
|
||||
|
||||
7. Paul Krill. “Ruby on Rails 2.0 released for Web Apps,” InfoWorld. Dec 7, 2007, accessed June 28, 2020, <https://www.infoworld.com/article/2648925/ruby-on-rails-2-0-released-for-web-apps.html> [↩︎][22]
|
||||
|
||||
8. Fielding, 109. [↩︎][23]
|
||||
|
||||
|
||||
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://twobithistory.org/2020/06/28/rest.html
|
||||
|
||||
作者:[Two-Bit History][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://news.ycombinator.com/item?id=7201871
|
||||
[2]: https://www.ics.uci.edu/~fielding/pubs/dissertation/fielding_dissertation_2up.pdf
|
||||
[3]: tmp.o6JUcKs91D#fn:1
|
||||
[4]: tmp.o6JUcKs91D#fn:2
|
||||
[5]: tmp.o6JUcKs91D#fn:3
|
||||
[6]: tmp.o6JUcKs91D#fn:4
|
||||
[7]: tmp.o6JUcKs91D#fn:5
|
||||
[8]: tmp.o6JUcKs91D#fn:6
|
||||
[9]: https://www.youtube.com/watch?v=vNoPJqm3DAY
|
||||
[10]: tmp.o6JUcKs91D#fn:7
|
||||
[11]: https://roy.gbiv.com/untangled/2008/rest-apis-must-be-hypertext-driven
|
||||
[12]: tmp.o6JUcKs91D#fn:8
|
||||
[13]: https://twitter.com/TwoBitHistory
|
||||
[14]: https://twobithistory.org/feed.xml
|
||||
[15]: https://twitter.com/TwoBitHistory/status/1247187881946275841?ref_src=twsrc%5Etfw
|
||||
[16]: tmp.o6JUcKs91D#fnref:1
|
||||
[17]: tmp.o6JUcKs91D#fnref:2
|
||||
[18]: tmp.o6JUcKs91D#fnref:3
|
||||
[19]: tmp.o6JUcKs91D#fnref:4
|
||||
[20]: tmp.o6JUcKs91D#fnref:5
|
||||
[21]: tmp.o6JUcKs91D#fnref:6
|
||||
[22]: tmp.o6JUcKs91D#fnref:7
|
||||
[23]: tmp.o6JUcKs91D#fnref:8
|
@ -0,0 +1,139 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: ( )
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
[#]: subject: (A few things I've learned about email marketing)
|
||||
[#]: via: (https://jvns.ca/blog/2020/10/28/a-few-things-i-ve-learned-about-email-marketing/)
|
||||
[#]: author: (Julia Evans https://jvns.ca/)
|
||||
|
||||
A few things I've learned about email marketing
|
||||
======
|
||||
|
||||
Hello! I’ve been learning a lot about business over the last few years (it’s possible to make a living by helping people learn! it’s amazing!). One of the things I’ve found hardest to get my head around was email marketing.
|
||||
|
||||
Like a lot of people, I get a lot of unwanted email, and at first I was really opposed to doing any kind of email marketing because I was worried I’d be the _source_ of that unwanted email. But I’ve learned how to do it in a way that feels good to me, and where the replies to my marketing emails are usually along the lines of “wow, I love this, thank you so much!”. ([literally: here are excerpts from the last 20 or so replies I’ve gotten][1])
|
||||
|
||||
I’m going to structure this as a series of beliefs I had about email marketing that turned out not to be universally true.
|
||||
|
||||
### myth 1: selling things is an adversarial relationship
|
||||
|
||||
I used to think that selling things was a sort of adversarial relationship: the person selling the product wants to convince the buyer (by any means necessary) to spend as much money as possible, and that people buying things are usually kind of resentful of anyone asking them to spend money.
|
||||
|
||||
I’ve learned that actually a lot of people are happy (or even actively **want**) to spend money on something that will help them solve a problem they have.
|
||||
|
||||
Here’s a silly example of something illustrating this: 2 years ago, we’d hired someone to paint our new apartment. We decided to paint a lot of the walls white, and we were stuck with the impossible problem of deciding which of the 10 billion possible shades of white to paint the walls. I found a $27 ebook called [white is complicated][2], and (long story short, this blog post is not about painting) it really helped me confidently choose a shade of white!! We spent thousands of dollars on painting, so $30 was a really good investment in making sure we’d be happy with the result.
|
||||
|
||||
So even though $27 for an ebook on how to choose a white seems silly at first, I was really happy to spend the money, and my guess is a lot of other people who bought that ebook are as well.
|
||||
|
||||
The bigger idea here is that it’s easier to run a business when you’re selling to people who are happy to buy things based on the value they’re getting from the product. In my case, I’ve found that there are lots of programmers who are happy to pay for clear, short, friendly explanations of concepts they need to understand for their jobs.
|
||||
|
||||
### a quick note on how I learned these things: 30x500
|
||||
|
||||
I originally wrote this blog post about all these things I learned, and it kind of read like I figured out all of these things naturally over the course of running a business. But that’s not how it went at all! I’ve actually found it very hard to debug business problems on my own. A lot of the attitudes I had when I started out running a business were counterproductive (like thinking of selling something as an adversarial process), and I don’t know that many people who run similar businesses who I can get advice from.
|
||||
|
||||
I learned how to think about selling things as a non-adversarial process (and everything else in this blog post, and a lot more) from [30x500][3], a business class by Amy Hoy ([her writing is here][4]) and [Alex Hillman][5] that I bought a couple of years ago. 30x500 is about running a specific kind of business (very briefly: sell to people who buy based on value, decide what to build by researching your audience, market by teaching people helpful things), which happens to be the exact kind of business that I run. It’s been a really great way to learn how to run my business better.
|
||||
|
||||
Okay, back to my misconceptions about email marketing!
|
||||
|
||||
### myth 2: sending email is inherently bad
|
||||
|
||||
The next thing I believed was that sending email from a business was somehow inherently bad and that all marketing email was unwanted.
|
||||
|
||||
I now realize this is untrue even for normal marketing emails – for example, lots of people subscribe to marketing newsletters for brands they like because they want to hear about new products when they come out & sales.
|
||||
|
||||
But marketing emails aren’t just “not inherently bad”, they can actually be really useful!
|
||||
|
||||
### marketing is about building trust
|
||||
|
||||
When I started sending out business emails, I based them on the emails I was used to receiving – I’d announce new zines I’d written, and explain why the zine was useful.
|
||||
|
||||
But what I’ve learned is that (at least for me) marketing isn’t about describing your product to the audience, **marketing is about building trust by helping people**.
|
||||
|
||||
So, instead of just periodically emailing out “hey, here’s a new zine, here’s why it’s good”, my main marketing email list is called [saturday comics][6], and it sends you 1 email a week with a programming comic.
|
||||
|
||||
What I like about this approach to marketing (“just help people learn things for free”) is that it’s literally just what I love doing anyway – I wrote this blog to help people learn things for free for years just because I think it’s fun to help people learn.
|
||||
|
||||
And people love the Saturday Comics! And it makes money – I announce new zines to that list as well, and lots of people buy them. It’s really simple and nice!
|
||||
|
||||
### myth 3: you have to trick people into signing up for your email marketing list
|
||||
|
||||
One pattern I see a lot is that I sign up for some free service, and then I start getting deluged with marketing emails trying to convince me to upgrade to the paid tier or whatever. I used to think that this was how marketing emails **had** to work – you somehow get people’s email and then send them email, and hope that for some reason (???) they decide to buy things from you.
|
||||
|
||||
But, of course, this isn’t true! If your marketing list is actually just full of genuinely helpful emails, and you can describe who it’s intended for clearly (give people a link to the archive to see if they like what they see!), then a lot of people will be happy to sign up and receive the emails!
|
||||
|
||||
If you clearly communicate who your mailing list will help, then people can easily filter themselves in, and the only people on the list will be happy to be on the list. And then you don’t have to send any unwanted email at all! Hooray!
|
||||
|
||||
Here’s one story that influenced how I think about this: once I sent an email to everyone who had bought a past zine saying “hey, I just released this other zine, maybe you want to buy it!”. And I got an angry reply from someone saying something like “why are you emailing me, I just bought that one thing from you, I don’t want you to keep emailing me about other things”. I decided that I agreed with that, and now I’m more careful about being clear about what kinds of emails people are opting into.
|
||||
|
||||
### marketing is about communicating clearly & honestly
|
||||
|
||||
One insight (from Alex Hillman) that helped me a lot recently was – when someone is dissatisfied with something they bought, it doesn’t always mean that the product is “bad”. Maybe the product is helpful to many other people!
|
||||
|
||||
But it definitely means that the person’s expectations weren’t met. A tiny example: one of the few refund requests I’ve gotten for a zine was from someone from who expected there to be more information about sed in the zine, and they were disappointed there was only 1 page about sed.
|
||||
|
||||
So if I communicate clearly & accurately what problems a product solves, who it’s for, and how it solves those problems, people are much more likely to be delighted when they buy it and be happy to buy from me again in the future!. For my zines specifically, I like to make the table of contents very easy to find so that people can see that there’s [1 page about sed][7] :)
|
||||
|
||||
### myth 4: you have to constantly produce new emails
|
||||
|
||||
I’ve tried and failed to start a lot of mailing lists. the pattern I kept getting stuck in was:
|
||||
|
||||
I have an idea for a weekly mailing list I send 2 emails I give up forever
|
||||
|
||||
This was partly because I thought that to have a weekly/biweekly mailing list, you have to write new emails every week. And some people definitely do mailing lists this way, like [Austin Kleon][8].
|
||||
|
||||
But I learned that there’s a different way to write a mailing list! Instead, you:
|
||||
|
||||
put together a list of your best articles / comics / whatever when someone subscribes to that list, send them 1 email a week (or every 2 weeks, or whatever) with one article from the List Of Your Best Articles
|
||||
|
||||
The point is most people in the world probably haven’t already read your best articles, and so if you just send them one article a week from that list, it’ll probably actually be MORE helpful to them than if you were writing a new article every week. And you don’t need to write any emails every week!
|
||||
|
||||
I think this is called a “drip marketing campaign”, but when I search for that term I don’t find the results super helpful – there’s a lot out there about tools to do this, but as with anything I think the actual content of the emails is the most important thing.
|
||||
|
||||
### myth 5: unsubscribes are the end of the world
|
||||
|
||||
Another email marketing thing I used to get stressed out about was unsubscribes. It always feels a little sad to send an email about something I’m excited about and see 20 people unsubscribe immediately, even if it’s only 0.3% of people on the mailing list.
|
||||
|
||||
But I know that I subscribe to mailing lists very liberally, even on topics that I’m not that interested in, and 70% of the time I decide that I’m not that interested in the topic and unsubscribe eventually. A small percentage of people unsubscribing really just isn’t that big of a deal.
|
||||
|
||||
### myth 6: you need to optimize your open rates
|
||||
|
||||
There are all kinds of analytics you can do with email marketing, like open rates. I love numbers and analyzing things, but so far I really haven’t found trying to A/B test or optimize my numbers to be that productive or healthy. I’d rather spend my energy on just writing more helpful things for people to read.
|
||||
|
||||
The most important thing I’ve learned about website analytics is that it’s unproductive to look at random statistics like “the open rate on this email is 43% but the last one was 47%” and wonder what they mean. What _has_ been helpful has been coming up with a few specific questions that are important to me (“are people visiting this page from links on other sites, or only from my links?”) and keeping very rough track of the answers over time.
|
||||
|
||||
So far I’ve really never used any of the tracking features of my email marketing software. The only thing I’ve done that I’ve found helpful is: sometimes when I release a new zine I’ll send out a discount code to people on the list, and I can tell if people bought the thing from the mailing list because they used the discount code.
|
||||
|
||||
### it’s important to remember there are people on the other side
|
||||
|
||||
The last thing that’s helped me is to remember that even though emailing thousands of people sometimes feels like a weird anonymous thing, there are a lot of very delightful people on the other side! So when I write emails, I usually try to imagine that I’m writing to some very nice person I met at a conference one time who told me that they like my blog. We’re not best friends, but they know my work to some extent, and they’re interested to hear what I have to say.
|
||||
|
||||
I often like to remind people why they’re getting the email, especially if I haven’t emailed that list for a long time – “you signed up to get announcements when I release a new zine, so here’s an announcement!”. I think the technical email marketing term for this is a list being “cold” and “warm”, like if you don’t email a list for too long it’s “cold” and your subscribers might have forgotten that they’re on it.
|
||||
|
||||
### that’s all!
|
||||
|
||||
When I started, I was really convinced that email marketing was this terrible, awful thing that I could not do that mostly involved tricking people into getting emails they don’t want (ok, I’m exaggerating a bit, but I really struggled with it). But it’s possible to do it in a transparent way where I’m mostly just sending people helpful emails that they do want!
|
||||
|
||||
The big surprise for me was that email marketing is not a monolithic thing. I have a lot of choices about how to do it, and if I don’t like the way someone else does email marketing, I can just make different choices when doing it myself!
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://jvns.ca/blog/2020/10/28/a-few-things-i-ve-learned-about-email-marketing/
|
||||
|
||||
作者:[Julia Evans][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://jvns.ca/
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://gist.github.com/jvns/c2aaecbbbf60b7f3adf3e0be18d54a7b
|
||||
[2]: https://mariakillam.com/product/white-is-complicated/
|
||||
[3]: https://30x500.com/academy/
|
||||
[4]: https://stackingthebricks.com/
|
||||
[5]: https://dangerouslyawesome.com
|
||||
[6]: https://wizardzines.com/saturday-comics
|
||||
[7]: https://wizardzines.com/zines/bite-size-command-line/
|
||||
[8]: https://austinkleon.com/
|
@ -0,0 +1,92 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: ( )
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
[#]: subject: (My journey to becoming an open source mentor)
|
||||
[#]: via: (https://opensource.com/article/20/10/open-source-mentor)
|
||||
[#]: author: (Mehant Kammakomati https://opensource.com/users/mehant-kammakomati)
|
||||
|
||||
My journey to becoming an open source mentor
|
||||
======
|
||||
I grew from a teenage open source novice to a 20-year-old frequent
|
||||
contributor and mentor to new users.
|
||||
![Puzzle pieces coming together to form a computer screen][1]
|
||||
|
||||
I was just 16 when I made my first meaningful open source contribution. It was the first code contribution I ever made, and I learned a lot from it. I'm 20 now, and I've been strongly attached to free and open source software (FOSS) ever since. I strive to be a friend to my community colleagues and to help others continue growing, learning, and succeeding.
|
||||
|
||||
### Early days
|
||||
|
||||
I first heard about FOSS through the [Google Code-In][2] contest. I was 16, but I was already learning computer science fundamentals, the C++ programming language, and anything else about computers I could get my hands on. I was very excited about the contest—not just because of the free Google swag, but because it gave me the opportunity to work directly on codebases being used all around the world. I jumped into the contest feet-first and started trying to solve as many open source software tasks as I could in the code, design, documentation, and research.
|
||||
|
||||
![Google Code-in Mehant Kammakomati][3]
|
||||
|
||||
(Mehant Kammakomati, [CC BY-SA 4.0][4])
|
||||
|
||||
It wasn't easy. I didn't know the FOSS community culture, nor much about the software development methodologies they used, nor even how to seek help or interact with others. So, rather than focusing on tasks, I started by focusing on understanding these fundamentals.
|
||||
|
||||
In a way, I spent much of my time during the contest learning more about how open source development works instead of closing tasks. But I wasn't sad about my failure to contribute code during the contest and instead focused on my success in getting acquainted with free software and open source culture.
|
||||
|
||||
### Fundamentals
|
||||
|
||||
I didn't stop my journey there. As a beginner, I learned:
|
||||
|
||||
1. Git
|
||||
2. GitHub
|
||||
3. Using the terminal
|
||||
4. Writing meaningful commit messages
|
||||
5. How to communicate with colleagues and partake in project discussions
|
||||
6. A new way of looking at codebases and project anatomy
|
||||
7. Basic fundamentals of computer science
|
||||
8. Important components of the technical stack and programming languages
|
||||
|
||||
|
||||
|
||||
The following year, I participated again in the Google Code-In contest to implement what I'd learned and try to make better bonds with my new FOSS friends. This time, I was able to complete a good number of tasks and make some valuable contributions that were pushed into production. As a result, I was selected as one of the 50 grand prize winners out of all the participants from all over the world. Being a kid, this gave me the motivation to make FOSS one of my best friends.
|
||||
|
||||
### Programs that got me closer to FOSS
|
||||
|
||||
From my start, I always liked being part of FOSS, and the journey has been amazing and addictive. I wanted to learn more, and I believed participating in FOSS initiatives and programs would help this happen. [Hacktoberfest][5] is one such initiative where I was able to contribute to Microsoft open source software and various other projects in 2018 and 2019. All the lessons I learned in Google Code-In were reinforced and strengthened.
|
||||
|
||||
[Google Summer of Code][6] (GSoC) was another important, engaging, and challenging experience for me. I became part of the GSoC 2019 and 2020 programs as a student with the [Sustainable Computing Research Lab][7]. These were two fast-paced and exciting summers spent hunting down bugs, writing new features, and documenting the work.
|
||||
|
||||
In 2019, [Red Hat's Open Source Contest][8] was another wonderful opportunity to work on open source engineering problems. Red Hat is one of my dream companies—it provides open source software products (particularly interesting to me are container technologies and orchestration tools), so I'm lucky to have been part of the contest. The best part was that I was paired with a Red Hat engineer to mentor me throughout the course of the contest. I contributed to the [ansible-bender][9] project, and the journey absolutely stepped up my skills to the next level.
|
||||
|
||||
![Red Hat Open Source contest certificate][10]
|
||||
|
||||
(Mehant Kammakomati, [CC BY-SA 4.0][4])
|
||||
|
||||
I also made valuable contributions to the [SPDX][11] online tools for their deployment infrastructure. While I was learning about blockchain technology, I contributed to Hyperledger Fabric's Python SDK.
|
||||
|
||||
### Spreading FOSS culture
|
||||
|
||||
I also served as a Google Code-In mentor in 2018 and 2019 and mentored many young aspirants making their very first valuable FOSS contributions. I was able to review around 400+ tasks and had the privilege of helping hundreds of students.
|
||||
|
||||
Through my time as an open source benefactor, I've learned that the open source model is the best way to host a project. It avails you of many benefits, ranging from obtaining contributions from all over the world to getting project funding. Through my time as a contributor to open source programs, I've learned the value of working to inculcate FOSS culture in our institutions and students.
|
||||
|
||||
I strongly believe in FOSS, and I recommend being part of this culture. Maybe you'll find it difficult to start, but if you seek the advice of friendly participants online or in a sponsored program, you'll surely get help. The most important part of the journey is the first few steps; once you get past that, you'll soon feel responsible and proud of each and every contribution you make—code or otherwise—knowing it helps your friends around the world.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/20/10/open-source-mentor
|
||||
|
||||
作者:[Mehant Kammakomati][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/mehant-kammakomati
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/puzzle_computer_solve_fix_tool.png?itok=U0pH1uwj (Puzzle pieces coming together to form a computer screen)
|
||||
[2]: https://en.wikipedia.org/wiki/Google_Code-in
|
||||
[3]: https://opensource.com/sites/default/files/pictures/google_code-in.jpg (Google Code-in Mehant Kammakomati)
|
||||
[4]: https://creativecommons.org/licenses/by-sa/4.0/
|
||||
[5]: https://hacktoberfest.digitalocean.com/
|
||||
[6]: https://summerofcode.withgoogle.com/archive/
|
||||
[7]: https://scorelab.org/
|
||||
[8]: https://research.redhat.com/red-hat-open-source-contest/
|
||||
[9]: https://opensource.com/article/19/10/building-container-images-ansible
|
||||
[10]: https://opensource.com/sites/default/files/pictures/redhatcertificate.jpg (Red Hat Open Source contest certificate)
|
||||
[11]: https://en.wikipedia.org/wiki/Software_Package_Data_Exchange
|
@ -1,90 +0,0 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: ( )
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
[#]: subject: (When Wi-Fi is mission-critical, a mixed-channel architecture is the best option)
|
||||
[#]: via: (https://www.networkworld.com/article/3386376/when-wi-fi-is-mission-critical-a-mixed-channel-architecture-is-the-best-option.html#tk.rss_all)
|
||||
[#]: author: (Zeus Kerravala https://www.networkworld.com/author/Zeus-Kerravala/)
|
||||
|
||||
When Wi-Fi is mission-critical, a mixed-channel architecture is the best option
|
||||
======
|
||||
|
||||
### Multi-channel is the norm for Wi-Fi today, but it’s not always the best choice. Single-channel and hybrid APs offer compelling alternatives when reliable Wi-Fi is a must.
|
||||
|
||||
![Getty Images][1]
|
||||
|
||||
I’ve worked with a number of companies that have implemented digital projects only to see them fail. The ideation was correct, the implementation was sound, and the market opportunity was there. The weak link? The Wi-Fi network.
|
||||
|
||||
For example, a large hospital wanted to improve clinician response times to patient alarms by having telemetry information sent to mobile devices. Without the system, the only way a nurse would know about a patient alarm is from an audible alert. And with all the background noise, it’s often tough to discern where noises are coming from. The problem was the Wi-Fi network in the hospital had not been upgraded in years and caused messages to be significantly delayed in their delivery, often taking four to five minutes to deliver. The long delivery times caused a lack of confidence in the system, so many clinicians stopped using it and went back to manual alerting. As a result, the project was considered a failure.
|
||||
|
||||
I’ve seen similar examples in manufacturing, K-12 education, entertainment, and other industries. Businesses are competing on the basis of customer experience, and that’s driven from the ever-expanding, ubiquitous wireless edge. Great Wi-Fi doesn’t necessarily mean market leadership, but bad Wi-Fi will have a negative impact on customers and employees. And in today’s competitive climate, that’s a recipe for disaster.
|
||||
|
||||
**[ Read also:[Wi-Fi site-survey tips: How to avoid interference, dead spots][2] ]**
|
||||
|
||||
## Wi-Fi performance historically inconsistent
|
||||
|
||||
The problem with Wi-Fi is that it’s inherently flaky. I’m sure everyone reading this has experienced the typical flaws with failed downloads, dropped connections, inconsistent performance, and lengthy wait times to connect to public hot spots.
|
||||
|
||||
Picture sitting in a conference prior to a keynote address and being able to tweet, send email, browse the web, and do other things with no problem. Then the keynote speaker comes on stage and the entire audiences start snapping pics, uploading those pictures, and streaming things – and the Wi-Fi stops working. I find this to be the norm more than the exception, underscoring the need for [no-compromise Wi-Fi][3].
|
||||
|
||||
The question for network professionals is how to get to a place where the Wi-Fi is rock solid 100% of the time. Some say that just beefing up the existing network will do that, and it might, but in some cases, the type of Wi-Fi might not be appropriate.
|
||||
|
||||
The most commonly deployed type of Wi-Fi is multi-channel, also known as micro-cell, where each client connects to the access point (AP) using a radio channel. A high-quality experience is based on two things: good signal strength and minimal interference. Several things can cause interference, such as APs being too close, layout issues, or interference from other equipment. To minimize interference, businesses invest a significant amount of time and money in [site surveys to plan the optimal channel map][2], but even with that’s done well, Wi-Fi glitches can still happen.
|
||||
|
||||
**[[Take this mobile device management course from PluralSight and learn how to secure devices in your company without degrading the user experience.][4] ]**
|
||||
|
||||
## Multi-channel Wi-Fi not always the best choice
|
||||
|
||||
For many carpeted offices, multi-channel Wi-Fi is likely to be solid, but there are some environments where external circumstances will impact performance. A good example of this is a multi-tenant building in which there are multiple Wi-Fi networks transmitting on the same channel and interfering with one another. Another example is a hospital where there are many campus workers moving between APs. The client will also try to connect to the best AP, causing the client to continually disconnect and reconnect resulting in dropped sessions. Then there are environments such as schools, airports, and conference facilities where there is a high number of transient devices and multi-channel can struggle to keep up.
|
||||
|
||||
## Single channel Wi-Fi offers better reliability but with a performance hit
|
||||
|
||||
What’s a network manager to do? Is inconsistent Wi-Fi just a fait accompli? Multi-channel is the norm, but it isn’t designed for dynamic physical environments or those where reliable connectivity is a must.
|
||||
|
||||
Several years ago an alternative architecture was proposed that would solve these problems. As the name suggests, “single channel” Wi-Fi uses a single radio channel for all APs in the network. Think of this as being a single Wi-Fi fabric that operates on one channel. With this architecture, the placement of APs is irrelevant because they all utilize the same channel, so they won’t interfere with one another. This has an obvious simplicity advantage, such as if coverage is poor, there’s no reason to do another expensive site survey. Instead, just drop in APs where they are needed.
|
||||
|
||||
One of the disadvantages of single-channel is that aggregate network throughput was lower than multi-channel because only one channel can be used. This might be fine in environments where reliability trumps performance, but many organizations want both.
|
||||
|
||||
## Hybrid APs offer the best of both worlds
|
||||
|
||||
There has been recent innovation from the manufacturers of single-channel systems that mix channel architectures, creating a “best of both worlds” deployment that offers the throughput of multi-channel with the reliability of single-channel. For example, Allied Telesis offers Hybrid APs that can operate in multi-channel and single-channel mode simultaneously. That means some web clients can be assigned to the multi-channel to have maximum throughput, while others can use single-channel for seamless roaming experience.
|
||||
|
||||
A practical use-case of such a mix might be a logistics facility where the office staff uses multi-channel, but the fork-lift operators use single-channel for continuous connectivity as they move throughout the warehouse.
|
||||
|
||||
Wi-Fi was once a network of convenience, but now it is perhaps the most mission-critical of all networks. A traditional multi-channel system might work, but due diligence should be done to see how it functions under a heavy load. IT leaders need to understand how important Wi-Fi is to digital transformation initiatives and do the proper testing to ensure it’s not the weak link in the infrastructure chain and choose the best technology for today’s environment.
|
||||
|
||||
**Reviews: 4 free, open-source network monitoring tools:**
|
||||
|
||||
* [Icinga: Enterprise-grade, open-source network-monitoring that scales][5]
|
||||
* [Nagios Core: Network-monitoring software with lots of plugins, steep learning curve][6]
|
||||
* [Observium open-source network monitoring tool: Won’t run on Windows but has a great user interface][7]
|
||||
* [Zabbix delivers effective no-frills network monitoring][8]
|
||||
|
||||
|
||||
|
||||
Join the Network World communities on [Facebook][9] and [LinkedIn][10] to comment on topics that are top of mind.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://www.networkworld.com/article/3386376/when-wi-fi-is-mission-critical-a-mixed-channel-architecture-is-the-best-option.html#tk.rss_all
|
||||
|
||||
作者:[Zeus Kerravala][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/Zeus-Kerravala/
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://images.idgesg.net/images/article/2018/09/tablet_graph_wifi_analytics-100771638-large.jpg
|
||||
[2]: https://www.networkworld.com/article/3315269/wi-fi-site-survey-tips-how-to-avoid-interference-dead-spots.html
|
||||
[3]: https://www.alliedtelesis.com/blog/no-compromise-wi-fi
|
||||
[4]: https://pluralsight.pxf.io/c/321564/424552/7490?u=https%3A%2F%2Fwww.pluralsight.com%2Fcourses%2Fmobile-device-management-big-picture
|
||||
[5]: https://www.networkworld.com/article/3273439/review-icinga-enterprise-grade-open-source-network-monitoring-that-scales.html?nsdr=true#nww-fsb
|
||||
[6]: https://www.networkworld.com/article/3304307/nagios-core-monitoring-software-lots-of-plugins-steep-learning-curve.html
|
||||
[7]: https://www.networkworld.com/article/3269279/review-observium-open-source-network-monitoring-won-t-run-on-windows-but-has-a-great-user-interface.html?nsdr=true#nww-fsb
|
||||
[8]: https://www.networkworld.com/article/3304253/zabbix-delivers-effective-no-frills-network-monitoring.html
|
||||
[9]: https://www.facebook.com/NetworkWorld/
|
||||
[10]: https://www.linkedin.com/company/network-world
|
@ -1,210 +0,0 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: (geekpi)
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
[#]: subject: (How to Install Ubuntu Server on a Raspberry Pi)
|
||||
[#]: via: (https://itsfoss.com/install-ubuntu-server-raspberry-pi/)
|
||||
[#]: author: (Dimitrios Savvopoulos https://itsfoss.com/author/dimitrios/)
|
||||
|
||||
How to Install Ubuntu Server on a Raspberry Pi
|
||||
======
|
||||
|
||||
The [Raspberry Pi][1] is the best-known [single-board computer][2]. Initially, the scope of the Raspberry Pi project was targeted to the promotion of teaching of basic computer science in schools and in developing countries.
|
||||
|
||||
Its low cost, portability and very low power consumption, made the models far more popular than anticipated. From weather station to home automation, tinkerers built so many [cool projects using Raspberry Pi][3].
|
||||
|
||||
The [4th generation of the Raspberry Pi][4], is equipped with features and processing power of a regular desktop computer. But this article is not about using RPi as desktop. Instead, I’ll show you how to install Ubuntu server on Raspberry Pi.
|
||||
|
||||
In this tutorial I will use a Raspberry Pi 4 and I will cover the following:
|
||||
|
||||
* Installing Ubuntu Server on a microSD card
|
||||
* Setting up a wireless network connection on the Raspberry Pi
|
||||
* Accessing your Raspberry Pi via SSH
|
||||
|
||||
|
||||
|
||||
![][5]
|
||||
|
||||
**You’ll need the following things for this tutorial**:
|
||||
|
||||
* A micro SD card (8 GB or greater recommended)
|
||||
* A computer (running Linux, Windows or macOS) with a micro SD card reader
|
||||
* A Raspberry Pi 2, 3 or 4
|
||||
* Good internet connection
|
||||
* An HDMI cable for the Pi 2 & 3 and a micro HDMI cable for the Pi 4 (optional)
|
||||
* A USB keyboard set (optional)
|
||||
|
||||
|
||||
|
||||
### Installing Ubuntu Server on a Raspberry Pi
|
||||
|
||||
![][6]
|
||||
|
||||
I have used Ubuntu for creating Raspberry Pi SD card in this tutorial but you may follow it on other Linux distributions, macOS and Windows as well. This is because the steps for preparing the SD card is the same with Raspberry Pi Imager tool.
|
||||
|
||||
The Raspberry Pi Imager tool downloads the image of your [choice of Raspberry Pi OS][7] automatically. This means that you need a good internet connection for downloading data around 1 GB.
|
||||
|
||||
#### Step 1: Prepare the SD Card with Raspberry Pi Imager
|
||||
|
||||
Make sure you have inserted the microSD card into your computer, and install the Raspberry Pi Imager at your computer.
|
||||
|
||||
You can download the Imager tool for your operating system from these links:
|
||||
|
||||
* [Raspberry Pi Imager for Ubuntu/Debian][8]
|
||||
* [Raspberry Pi Imager for Windows][9]
|
||||
* [Raspberry Pi Imager for MacOS][10]
|
||||
|
||||
|
||||
|
||||
Despite I use Ubuntu, I won’t use the Debian package that is listed above, but I will install the snap package using the command line. This method can be applied to wider range of Linux distributions.
|
||||
|
||||
```
|
||||
sudo snap install rpi-imager
|
||||
```
|
||||
|
||||
Once you have installed Raspberry Pi Imager tool, find and open it and click on the “CHOOSE OS” menu.
|
||||
|
||||
![][11]
|
||||
|
||||
Scroll across the menu and click on “Ubuntu” (Core and Server Images).
|
||||
|
||||
![][12]
|
||||
|
||||
From the available images, I choose the Ubuntu 20.04 LTS 64 bit. If you have a Raspberry Pi 2, you are limited to the 32bit image.
|
||||
|
||||
**Important Note: If you use the latest Raspberry Pi 4 – 8 GB RAM model, you should choose the 64bit OS, otherwise you will be able to use 4 GB RAM only.**
|
||||
|
||||
![][13]
|
||||
|
||||
Select your microSD card from the “SD Card” menu, and click on “WRITE”after.
|
||||
|
||||
![][14]
|
||||
|
||||
If it shows some error, try writing it again. It will now download the Ubuntu server image and write it to the micro SD card.
|
||||
|
||||
It will notify you when the process is completed.
|
||||
|
||||
![][15]
|
||||
|
||||
#### Step 2: Add WiFi support to Ubuntu server
|
||||
|
||||
Once the micro SD card flashing is done, you are almost ready to use it. There is one thng that you may want to do before using it and that is to add Wi-Fi support.
|
||||
|
||||
With the SD card still inserted in the card reader, open the file manager and locate the “system-boot” partition on the card.
|
||||
|
||||
The file that you are looking for and need to edit is named `network-config`.
|
||||
|
||||
![][16]
|
||||
|
||||
This process can be done on Windows and MacOS too. Edit the **`network-config`** file as already mentioned to add your Wi-Fi credentials.
|
||||
|
||||
Firstly, uncomment (remove the hashtag “#” at the beginning) from lines that are included in the rectangular box.
|
||||
|
||||
After that, replace myhomewifi with your Wi-Fi network name enclosed in quotation marks, such as “itsfoss” and the “S3kr1t” with the Wi-Fi password enclosed in quotation marks, such as “12345679”.
|
||||
|
||||
![][17]
|
||||
|
||||
It may look like this:
|
||||
|
||||
```
|
||||
wifis:
|
||||
wlan0:
|
||||
dhcp4: true
|
||||
optional: true
|
||||
access-points:
|
||||
"your wifi name":
|
||||
password: "your_wifi_password"
|
||||
```
|
||||
|
||||
Save the file and insert the micro SD card into your Raspberry Pi. During the first boot, if your Raspberry Pi fails connect to the Wi-Fi network, simply reboot your device.
|
||||
|
||||
#### Step 3: Use Ubuntu server on Raspberry Pi (if you have dedicated monitor, keyboard and mouse for Raspberry Pi)
|
||||
|
||||
If you have got an additional set of mouse, keyboard and a monitor for the Raspberry Pi, you can use easily use it like any other computer (but without GUI).
|
||||
|
||||
Simply insert the micro SD card to the Raspberry Pi, plug in the monitor, keyboard and mouse. Now [turn on your Raspberry Pi][18]. It will present TTY login screen (black terminal screen) and aks for username and password.
|
||||
|
||||
* Default username: ubuntu
|
||||
* Default password: ubuntu
|
||||
|
||||
|
||||
|
||||
When prompted, use “**ubuntu**” for the password. Right after a successful login, [Ubuntu will ask you to change the default password][19].
|
||||
|
||||
Enjoy your Ubuntu Server!
|
||||
|
||||
#### Step 3: Connect remotely to your Raspberry Pi via SSH (if you don’t have monitor, keyboard and mouse for Raspberry Pi)
|
||||
|
||||
It is okay if you don’t have a dedicated monitor to be used with Raspberry Pi. Who needs a monitor with a server when you can just SSH into it and use it the way you want?
|
||||
|
||||
**On Ubuntu and Mac OS**, an SSH client is usually already installed. To connect remotely to your Raspberry Pi, you need to discover its IP address. Check the [devices connected to your network][20] and see which one is the Raspberry Pi.
|
||||
|
||||
Since I don’t have access to a Windows machine, you can access a comprehensive guide provided by [Microsoft][21].
|
||||
|
||||
Open a terminal and run the following command:
|
||||
|
||||
```
|
||||
ssh [email protected]_pi_ip_address
|
||||
```
|
||||
|
||||
You will be asked to confirm the connection with the message:
|
||||
|
||||
```
|
||||
Are you sure you want to continue connecting (yes/no/[fingerprint])?
|
||||
```
|
||||
|
||||
Type “yes” and click the enter key.
|
||||
|
||||
![][22]
|
||||
|
||||
When prompted, use “ubuntu” for the password as mentioned earlier. You’ll be asked to change the password of course.
|
||||
|
||||
Once done, you will be automatically logged out and you have to reconnect, using your new password.
|
||||
|
||||
Your Ubuntu server is up and running on a Raspberry Pi!
|
||||
|
||||
**Conclusion**
|
||||
|
||||
Installing Ubuntu Server on a Raspberry Pi is an easy process and it comes pre-configured at a great degree which the use a pleasant experience.
|
||||
|
||||
I have to say that among all the [operating systems that I tried on my Raspberry Pi][7], Ubuntu Server was the easiest to install. I am not exaggerating. Check my guide on [installing Arch Linux on Raspberry Pi][23] for reference.
|
||||
|
||||
I hope this guide helped you in installing Ubuntu server on your Raspberry Pi as well. If you have questions or suggestions, please let me know in the comment section.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://itsfoss.com/install-ubuntu-server-raspberry-pi/
|
||||
|
||||
作者:[Dimitrios Savvopoulos][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/dimitrios/
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://www.raspberrypi.org/
|
||||
[2]: https://itsfoss.com/raspberry-pi-alternatives/
|
||||
[3]: https://itsfoss.com/raspberry-pi-projects/
|
||||
[4]: https://itsfoss.com/raspberry-pi-4/
|
||||
[5]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/09/Ubuntu-Server-20.04.1-LTS-aarch64.png?resize=800%2C600&ssl=1
|
||||
[6]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/09/ubuntu-server-raspberry-pi.png?resize=800%2C450&ssl=1
|
||||
[7]: https://itsfoss.com/raspberry-pi-os/
|
||||
[8]: https://downloads.raspberrypi.org/imager/imager_amd64.deb
|
||||
[9]: https://downloads.raspberrypi.org/imager/imager.exe
|
||||
[10]: https://downloads.raspberrypi.org/imager/imager.dmg
|
||||
[11]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/09/raspberry-pi-imager.png?resize=800%2C600&ssl=1
|
||||
[12]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/09/raspberry-pi-imager-choose-ubuntu.png?resize=800%2C600&ssl=1
|
||||
[13]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/09/raspberry-pi-imager-ubuntu-server.png?resize=800%2C600&ssl=1
|
||||
[14]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/09/raspberry-pi-imager-sd-card.png?resize=800%2C600&ssl=1
|
||||
[15]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/09/ubuntu-server-installed-raspberry-pi.png?resize=799%2C506&ssl=1
|
||||
[16]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/09/ubuntu-server-pi-network-config.png?resize=800%2C565&ssl=1
|
||||
[17]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/09/Ubuntu-server-wifi.png?resize=800%2C600&ssl=1
|
||||
[18]: https://itsfoss.com/turn-on-raspberry-pi/
|
||||
[19]: https://itsfoss.com/change-password-ubuntu/
|
||||
[20]: https://itsfoss.com/how-to-find-what-devices-are-connected-to-network-in-ubuntu/
|
||||
[21]: https://docs.microsoft.com/en-us/windows-server/administration/openssh/openssh_install_firstuse
|
||||
[22]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/09/ubuntu-server-change-password.png?resize=800%2C600&ssl=1
|
||||
[23]: https://itsfoss.com/install-arch-raspberry-pi/
|
@ -1,5 +1,5 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: ( )
|
||||
[#]: translator: (robsean)
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
|
@ -1,5 +1,5 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: ( )
|
||||
[#]: translator: (robsean)
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
|
@ -1,166 +0,0 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: (robsean)
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
[#]: subject: (Add sound to your Python game)
|
||||
[#]: via: (https://opensource.com/article/20/9/add-sound-python-game)
|
||||
[#]: author: (Seth Kenlon https://opensource.com/users/seth)
|
||||
|
||||
Add sound to your Python game
|
||||
======
|
||||
Hear what happens when your hero fights, jumps, collects loot, and more
|
||||
by adding sounds to your game. Learn how in the 13th article in this
|
||||
series on creating a platformer in Pygame.
|
||||
![Colorful sound wave graph][1]
|
||||
|
||||
This is part 13 in an ongoing series about creating video games in [Python 3][2] using the [Pygame][3] module. Previous articles are:
|
||||
|
||||
1. [Learn how to program in Python by building a simple dice game][4]
|
||||
2. [Build a game framework with Python using the Pygame module][5]
|
||||
3. [How to add a player to your Python game][6]
|
||||
4. [Using Pygame to move your game character around][7]
|
||||
5. [What's a hero without a villain? How to add one to your Python game][8]
|
||||
6. [Add platforms to your game][9]
|
||||
7. [Simulate gravity in your Python game][10]
|
||||
8. [Add jumping to your Python platformer game][11]
|
||||
9. [Enable your Python game player to run forward and backward][12]
|
||||
10. [Using Python to set up loot in Pygame][13]
|
||||
11. [Add scorekeeping to your Python game][14]
|
||||
12. [Add throwing mechanics to your Python game][15]
|
||||
|
||||
|
||||
|
||||
Pygame provides an easy way to integrate sounds into your Python video game. Pygame's [mixer module][16] can play one or more sounds on command, and by mixing those sounds together, you can have, for instance, background music playing at the same time you hear the sounds of your hero collecting loot or jumping over enemies.
|
||||
|
||||
It is easy to integrate the mixer module into an existing game, so—rather than giving you code samples showing you exactly where to put them—this article explains the four steps required to get sound in your application.
|
||||
|
||||
### Start the mixer
|
||||
|
||||
First, in your code's setup section, start the mixer process. Your code already starts Pygame and Pygame fonts, so grouping it together with these is a good idea:
|
||||
|
||||
|
||||
```
|
||||
pygame.init()
|
||||
pygame.font.init()
|
||||
pygame.mixer.init() # add this line
|
||||
```
|
||||
|
||||
### Define the sounds
|
||||
|
||||
Next, you must define the sounds you want to use. This requires that you have the sounds on your computer, just as using fonts requires you to have fonts, and using graphics requires you to have graphics.
|
||||
|
||||
You also must bundle those sounds with your game so that anyone playing your game has the sound files.
|
||||
|
||||
To bundle a sound with your game, first create a new directory in your game folder, right along with the directory you created for your images and fonts. Call it `sound`:
|
||||
|
||||
|
||||
```
|
||||
`s = 'sound'`
|
||||
```
|
||||
|
||||
Even though there are plenty of sounds on the internet, it's not necessarily _legal_ to download them and give them away with your game. It seems strange because so many sounds from famous video games are such a part of popular culture, but that's how the law works. If you want to ship a sound with your game, you must find an open source or [Creative Commons][17] sound that gives you permission to give the sound away with your game.
|
||||
|
||||
There are several sites that specialize in free and legal sounds, including:
|
||||
|
||||
* [Freesound][18] hosts sound effects of all sorts.
|
||||
* [Incompetech][19] hosts background music.
|
||||
* [Open Game Art][20] hosts some sound effects and music.
|
||||
|
||||
|
||||
|
||||
Some sound files are free to use only if you give the composer or sound designer credit. Read the conditions of use carefully before bundling any with your game! Musicians and sound designers work just as hard on their sounds as you work on your code, so it's nice to give them credit even when they don't require it.
|
||||
|
||||
To give your sound sources credit, list the sounds that you use in a text file called `CREDIT`, and place the text file in your game folder.
|
||||
|
||||
You might also try making your own music. The excellent [LMMS][21] audio workstation is easy to use and ships with lots of interesting sounds. It's available on all major platforms and exports to [Ogg Vorbis][22] (OGG) audio format.
|
||||
|
||||
### Add sound to Pygame
|
||||
|
||||
When you find a sound that you like, download it. If it comes in a ZIP or TAR file, extract it and move the sounds into the `sound` folder in your game directory.
|
||||
|
||||
If the sound file has a complicated name with spaces or special characters, rename it. The filename is completely arbitrary, and the simpler it is, the easier it is for you to type into your code.
|
||||
|
||||
Most video games use OGG sound files because the format provides high quality in small file sizes. When you download a sound file, it might be an MP3, WAVE, FLAC, or another audio format. To keep your compatibility high and your download size low, convert these to Ogg Vorbis with a tool like [fre:ac][23] or [Miro][24].
|
||||
|
||||
For example, assume you have downloaded a sound file called `ouch.ogg`.
|
||||
|
||||
In your code's setup section, create a variable representing the sound file you want to use:
|
||||
|
||||
|
||||
```
|
||||
`ouch = pygame.mixer.Sound(os.path.join(s, 'ouch.ogg'))`
|
||||
```
|
||||
|
||||
### Trigger a sound
|
||||
|
||||
To use a sound, all you have to do is call the variable when you want to trigger it. For instance, to trigger the `OUCH` sound effect when your player hits an enemy:
|
||||
|
||||
|
||||
```
|
||||
for enemy in enemy_hit_list:
|
||||
pygame.mixer.Sound.play(ouch)
|
||||
score -= 1
|
||||
```
|
||||
|
||||
You can create sounds for all kinds of actions, such as jumping, collecting loot, throwing, colliding, and whatever else you can imagine.
|
||||
|
||||
### Add background music
|
||||
|
||||
If you have music or atmospheric sound effects you want to play in your game's background, you can use the `music` function of Pygame's mixer module. In your setup section, load the music file:
|
||||
|
||||
|
||||
```
|
||||
`music = pygame.mixer.music.load(os.path.join(s, 'music.ogg'))`
|
||||
```
|
||||
|
||||
And start the music:
|
||||
|
||||
|
||||
```
|
||||
`pygame.mixer.music.play(-1)`
|
||||
```
|
||||
|
||||
The `-1` value tells Pygame to loop the music file infinitely. You can set it to anything from `0` and beyond to define how many times the music should loop before stopping.
|
||||
|
||||
### Enjoy the soundscapes
|
||||
|
||||
Music and sound can add a lot of flavor to your game. Try adding some to your Pygame project!
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/20/9/add-sound-python-game
|
||||
|
||||
作者:[Seth Kenlon][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/seth
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/colorful_sound_wave.png?itok=jlUJG0bM (Colorful sound wave graph)
|
||||
[2]: https://www.python.org/
|
||||
[3]: https://www.pygame.org/news
|
||||
[4]: https://opensource.com/article/17/10/python-101
|
||||
[5]: https://opensource.com/article/17/12/game-framework-python
|
||||
[6]: https://opensource.com/article/17/12/game-python-add-a-player
|
||||
[7]: https://opensource.com/article/17/12/game-python-moving-player
|
||||
[8]: https://opensource.com/article/18/5/pygame-enemy
|
||||
[9]: https://opensource.com/article/18/7/put-platforms-python-game
|
||||
[10]: https://opensource.com/article/19/11/simulate-gravity-python
|
||||
[11]: https://opensource.com/article/19/12/jumping-python-platformer-game
|
||||
[12]: https://opensource.com/article/19/12/python-platformer-game-run
|
||||
[13]: https://opensource.com/article/19/12/loot-python-platformer-game
|
||||
[14]: https://opensource.com/article/20/1/add-scorekeeping-your-python-game
|
||||
[15]: https://opensource.com/article/20/9/add-throwing-python-game
|
||||
[16]: https://www.pygame.org/docs/ref/mixer.html
|
||||
[17]: https://opensource.com/article/20/1/what-creative-commons
|
||||
[18]: https://freesound.org
|
||||
[19]: https://incompetech.filmmusic.io
|
||||
[20]: https://opengameart.org
|
||||
[21]: https://opensource.com/life/16/2/linux-multimedia-studio
|
||||
[22]: https://en.wikipedia.org/wiki/Vorbis
|
||||
[23]: https://www.freac.org/index.php/en/downloads-mainmenu-330
|
||||
[24]: http://getmiro.com
|
@ -1,5 +1,5 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: ( )
|
||||
[#]: translator: (HankChow)
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
|
@ -1,104 +0,0 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: ( )
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
[#]: subject: (5 open source tools I can't live without)
|
||||
[#]: via: (https://opensource.com/article/20/10/open-source-tools)
|
||||
[#]: author: (Victoria Martinez de la Cruz https://opensource.com/users/vkmc)
|
||||
|
||||
5 open source tools I can't live without
|
||||
======
|
||||
Increase your productivity inside and outside the terminal by keeping
|
||||
these tools in your own bag of tricks.
|
||||
![woman on laptop sitting at the window][1]
|
||||
|
||||
Some time ago, I engaged with a Twitter thread that went viral among techies. The challenge? Pick only five tools that you cannot live without. I started to think about this in relation to my everyday life, and picking just five tools was not easy. I use many tools that I consider essential, such as my [IRC][2] client to connect with my colleagues and friends (yes, I still use IRC), a good text editor to hack on things, a calendar app to keep organized, and a videoconferencing platform when more direct interaction is needed.
|
||||
|
||||
So let me put a twist on this challenge: Pick just five open source tools that boost your productivity. Here's my list; please share yours in the comments.
|
||||
|
||||
### tmate
|
||||
|
||||
![tmate screenshot][3]
|
||||
|
||||
(Victoria Marinez de la Cruz, [CC BY-SA 4.0][4])
|
||||
|
||||
Oh, I love this tool. tmate is a fork of the well-known [tmux][5] terminal multiplexer that allows you to start a tmux session and share it over SSH. You can use it for [pair programming][6] (which is my primary use case) or for remote control.
|
||||
|
||||
If you collaborate often with your team members, and you want an easy, distro-agnostic, open source way to program with them (and sharing terminal access is enough for you), this is definitely a must-add to your list.
|
||||
|
||||
Get more info on [tmate's website][7], or check out the code on [GitHub][8].
|
||||
|
||||
### ix
|
||||
|
||||
ix is a command-line pastebin. You don't need to install anything; you can create new pastes just by `curl`ing to the [ix.io][9] site. For example, `echo Hello world. | curl -F 'f:1=<-' ix.io` will give you a link to ix.io where the message "Hello world" is pasted. This is very convenient when you want to share logs for debugging purposes or to save config files in servers where you don't have a desktop environment.
|
||||
|
||||
One downside is that the source code is not yet published, even though it is intended to be free and open source. If you are the author and are reading this post, please post the code so that we can contribute to the polishing process.
|
||||
|
||||
### asciinema
|
||||
|
||||
Yes, this is another terminal tool. asciinema allows you to record your terminal. There are many ways to use it, but I generally use it to make demos for presentations. It's very easy to use, and there are packages available for many Linux distributions and other platforms.
|
||||
|
||||
To see how it works, check out this [cool demo][10]. Isn't it great?
|
||||
|
||||
Get more information on [asciinema's website][11] and access its source code on [GitHub][12].
|
||||
|
||||
### GNOME Pomodoro
|
||||
|
||||
![pomodoro timer gnome][13]
|
||||
|
||||
(Victoria Martinez de la Cruz, [CC BY-SA 4.0][4])
|
||||
|
||||
OK, that's enough with the terminal tools. Now I want to share this simple gem for getting and staying organized. Have you heard about the [Pomodoro Technique][14]? Pomodoro is basically a time-management tool. It uses a tomato-shaped timer that helps you split your time into work chunks and breaks (by default, 25 minutes of work followed by five-minute breaks). And, after every four pomodoros, you take a longer break (15 minutes by default). The idea is that you stay focused during the work time, and you stretch and relax on the breaks.
|
||||
|
||||
This sounds very, very simple, and you might be hesitant to allow a tomato-shaped clock to control your life, but it definitely helped me get better organized and avoid exhaustion when trying to focus on many things at the same time.
|
||||
|
||||
Whatever your role, I highly recommend this practice. And among the many different tools that implement it, I recommend the GNOME Pomodoro app. It's available for major GNU/Linux distros, so it requires that you use the GNOME desktop environment (this might be its downside).
|
||||
|
||||
Check out more information on [GNOME Pomodoro's website][15], and access its [GitHub][16] repo to get the source code and learn how you can contribute.
|
||||
|
||||
### Jitsi
|
||||
|
||||
Last but not least is Jitsi. When you're working on a remote, globally distributed team, you need a way to connect with people. Instant messaging is good, but sometimes it's better to have a quick meeting to discuss things face to face (well, seeing each other faces). There are a lot of [videoconferencing tools][17] available, but I like Jitsi a lot. Not only because it's free and open source, but also because it provides a clean, functional interface. You can set up your own Jitsi server (for business purposes), but you can also try out a public Jitsi instance by going to the [Jitsi Meet][18] website.
|
||||
|
||||
A good practice for setting up this kind of meeting: use it only when you have a clear agenda in mind. And always ask yourself, can this meeting be an email instead? Follow these guidelines and use Jitsi with caution, and your workday will be extremely productive!
|
||||
|
||||
Learn more on [Jitsi's website][19] and start contributing by accessing its [GitHub][20] repository.
|
||||
|
||||
* * *
|
||||
|
||||
I hope my list helps you reach the next level in productivity. What are your five, can't-do-without-them, open source productivity tools? Let me know in the comments!
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/20/10/open-source-tools
|
||||
|
||||
作者:[Victoria Martinez de la Cruz][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/vkmc
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/lenovo-thinkpad-laptop-window-focus.png?itok=g0xPm2kD (young woman working on a laptop)
|
||||
[2]: https://en.wikipedia.org/wiki/Internet_Relay_Chat
|
||||
[3]: https://opensource.com/sites/default/files/pictures/tmate-opensource.jpg (tmate screenshot)
|
||||
[4]: https://creativecommons.org/licenses/by-sa/4.0/
|
||||
[5]: https://opensource.com/article/20/7/tmux-cheat-sheet
|
||||
[6]: https://en.wikipedia.org/wiki/Pair_programming
|
||||
[7]: https://tmate.io/
|
||||
[8]: https://github.com/tmate-io/tmate
|
||||
[9]: http://ix.io/
|
||||
[10]: https://asciinema.org/a/239367
|
||||
[11]: https://asciinema.org/
|
||||
[12]: https://github.com/asciinema/asciinema
|
||||
[13]: https://opensource.com/sites/default/files/pictures/pomodoro_timer_gnome.jpg (pomodoro timer gnome)
|
||||
[14]: https://en.wikipedia.org/wiki/Pomodoro_Technique
|
||||
[15]: https://gnomepomodoro.org/
|
||||
[16]: https://github.com/codito/gnome-pomodoro
|
||||
[17]: https://opensource.com/article/20/5/open-source-video-conferencing
|
||||
[18]: https://meet.jit.si/
|
||||
[19]: https://jitsi.org/
|
||||
[20]: https://github.com/jitsi
|
@ -1,117 +0,0 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: (geekpi)
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
[#]: subject: (ninja: a simple way to do builds)
|
||||
[#]: via: (https://jvns.ca/blog/2020/10/26/ninja--a-simple-way-to-do-builds/)
|
||||
[#]: author: (Julia Evans https://jvns.ca/)
|
||||
|
||||
ninja: a simple way to do builds
|
||||
======
|
||||
|
||||
Hello! Every so often I find a new piece of software I really like, and today I want to talk about one of my recent favourites: [ninja][1]!
|
||||
|
||||
### incremental builds are useful
|
||||
|
||||
I do a lot of small projects where I want to set up incremental builds – for example, right now I’m writing a zine about bash, and I have one `.svg` file for each page of the zine. I need to convert the SVGs to PDFs, and I’d been doing it something like this:
|
||||
|
||||
```
|
||||
for i in *.svg
|
||||
do
|
||||
svg2pdf $i $i.pdf # or ${i/.svg/.pdf} if you want to get really fancy
|
||||
done
|
||||
```
|
||||
|
||||
This works fine, but my `svg2pdf` script is a little slow (it uses Inkscape), and it’s annoying to have to wait 90 seconds or whatever to rebuild all the PDFs when I’ve just updated 1 page.
|
||||
|
||||
### build systems are confusing
|
||||
|
||||
In the past I’ve been pretty put off by using a Build System like make or bazel for my small projects because bazel is this Big Complicated Thing and `make` feels a little arcane to me. I don’t really know how to use either of them.
|
||||
|
||||
So for a long time I’ve just written a bash script or something for my builds and resigned myself to just waiting for a minute sometimes.
|
||||
|
||||
### ninja is an EXTREMELY SIMPLE build system
|
||||
|
||||
But ninja is not complicated! Here is literally everything I know about ninja build file syntax: how to create a `rule` and a `build`:
|
||||
|
||||
a `rule` has a command and description (the description is just for humans to read so you can tell what it’s doing when it’s building your code)
|
||||
|
||||
```
|
||||
rule svg2pdf
|
||||
command = inkscape $in --export-text-to-path --export-pdf=$out
|
||||
description = svg2pdf $in $out
|
||||
```
|
||||
|
||||
the syntax for `build` is `build output_file: rule_name input_files`. Here’s one using the `svg2pdf` rule. The output goes in `$out` in the rule and the input goes in `$in`.
|
||||
|
||||
```
|
||||
build pdfs/variables.pdf: svg2pdf variables.svg
|
||||
```
|
||||
|
||||
That’s it! If you put those two things in a file called `build.ninja` and then run `ninja`, ninja will run `inkscape variables.svg --export-text-to-path --export-pdf=pdfs/variables.pdf`. And then if you run it again, it won’t run anything (because it can tell that you’ve already built `pdfs/variables.pdf` and you’re up to date)
|
||||
|
||||
Ninja has a few more features than this (see [the manual][2]), but I haven’t used them yet. It was originally built [for Chromium][3], so even with a small feature set it can support large builds.
|
||||
|
||||
### ninja files are usually automatically generated
|
||||
|
||||
The magic of ninja is that instead of having to use some confusing Build Language that’s hard to remember because you use it so infrequently (like make), instead the ninja language is SUPER simple, and if you want to do something complicated then you just generate the build file you want using any programming language you want.
|
||||
|
||||
I like to make a `build.py` file or that looks something like this, that creates the ninja build file and then runs `ninja`:
|
||||
|
||||
```
|
||||
with open('build.ninja', 'w') as ninja_file:
|
||||
# write some rules
|
||||
ninja_file.write("""
|
||||
rule svg2pdf
|
||||
command = inkscape $in --export-text-to-path --export-pdf=$out
|
||||
description = svg2pdf $in $out
|
||||
""")
|
||||
|
||||
# some for loop with every file I need to build
|
||||
for filename in things_to_convert:
|
||||
ninja_file.write(f"""
|
||||
build {filename.replace('svg', 'pdf')}: svg2pdf {filename}
|
||||
""")
|
||||
|
||||
# run ninja
|
||||
import subprocess
|
||||
subprocess.check_call(['ninja'])
|
||||
```
|
||||
|
||||
I’m sure there are a bunch of ninja best practices, but I don’t know them and for my small projects I find this works well.
|
||||
|
||||
### meson is a build system that generates ninja files
|
||||
|
||||
I don’t know too much about [Meson][4] yet, but recently I was building a C program ([plocate][5], a faster alternative to `locate`) and I noticed that instead of the usual `./configure; make; make install`, there were different build instructions:
|
||||
|
||||
```
|
||||
meson builddir
|
||||
cd builddir
|
||||
ninja
|
||||
```
|
||||
|
||||
It seems like Meson is a build system for C/C++/Java/Rust/Fortran that can use ninja as a backend.
|
||||
|
||||
### that’s all!
|
||||
|
||||
I’ve been using ninja for a few months now. I really like it and it’s caused me approximately 0 build-related headaches which feels pretty magical to me.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://jvns.ca/blog/2020/10/26/ninja--a-simple-way-to-do-builds/
|
||||
|
||||
作者:[Julia Evans][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://jvns.ca/
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://ninja-build.org/
|
||||
[2]: https://ninja-build.org/manual.html
|
||||
[3]: http://neugierig.org/software/chromium/notes/2011/02/ninja.html
|
||||
[4]: https://mesonbuild.com/Tutorial.html
|
||||
[5]: https://blog.sesse.net/blog/tech/2020-09-28-00-37_introducing_plocate
|
@ -0,0 +1,73 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: ( )
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
[#]: subject: (Bring old hardware back to life with OpenBSD)
|
||||
[#]: via: (https://opensource.com/article/20/10/old-hardware-openbsd)
|
||||
[#]: author: (Jonathan Garrido https://opensource.com/users/jgarrido)
|
||||
|
||||
Bring old hardware back to life with OpenBSD
|
||||
======
|
||||
Install OpenBSD and the Xfce desktop to give a new spin to an old
|
||||
machine—for free.
|
||||
![Old UNIX computer][1]
|
||||
|
||||
Almost everyone has (or knows someone who has) old hardware sitting around gathering dust because they believe that no modern operating system (OS) supports such a relic. I know this is wrong because I am one of those geeks who likes to use every piece of equipment as long as it is possibly functional.
|
||||
|
||||
Although most modern OSes do run better on modern hardware, it is also true that there are alternatives for up-to-date 32-bit OSes to run all types of machines, including very old ones. Thanks to a bunch of people with enough determination and skills, there are different types of Linux and BSD distros that you can use, free of charge, to give a new spin to an old machine.
|
||||
|
||||
## What can you do with a new OS on old hardware?
|
||||
|
||||
Besides the obvious benefit of bringing back a piece of equipment that has been idle for a price that is equal to nothing, using an open source 32-bit distro to revive "antique" hardware has several benefits and purposes, including:
|
||||
|
||||
* **Create single-purpose equipment:** Today's networks are complex, and there are a lot of services that interact with one another. After bringing an old machine back to life, you can set it up to fulfill one of those unique services within your infrastructure, such as DHCP, DNS, or SFTP.
|
||||
* **Learn how the OS works:** I always want to know how things work under the hood. Tinkering with old hardware and tiny OSes gives you the chance to understand the interactions between hardware and software, learn how to tune the installation's default settings to make the most of a system, and much, much more.
|
||||
* **Teach others about open source:** Finally, 32-bit OSes and old hardware can teach the next generation about OSes and the open source world. One of the main features of these types of OSes is their simplicity of use with fewer options to overwhelm the user. This makes them an excellent tool to teach and explore the essential components of any operating system.
|
||||
|
||||
|
||||
|
||||
## Distributions to try
|
||||
|
||||
To encourage you, here is a list of distros that I have tried on old hardware with very good results. These are not the only options available, but these are the ones I have used the most:
|
||||
|
||||
* [Linux Lite][2]
|
||||
* [FreeBSD][3]
|
||||
* [OpenBSD][4]
|
||||
* [Lubuntu][5]
|
||||
* [Debian][6]
|
||||
* [Tiny Core Linux][7]
|
||||
* [Slax Linux][8]
|
||||
|
||||
|
||||
|
||||
## Give it a try with OpenBSD
|
||||
|
||||
OpenBSD is one of the main [BSD][9] distros. It is well-known because it is made with security in mind, with almost no security bugs in the default installation and a lot of cryptography tools available to users. Another cool feature, at least for me, is the fact that you can run it on a huge variety of hardware, from new computers to very old machines.
|
||||
|
||||
For this installation, my hardware was a 2005 MacBook with the following specs:
|
||||
|
||||
* A 32-bit, dual-core processor
|
||||
* 2GB of RAM (with no possibility of expansion)
|
||||
* A 32GB hard drive
|
||||
* Two network cards
|
||||
* A CD-ROM (reads only CDs)
|
||||
* A few USB ports
|
||||
|
||||
|
||||
|
||||
### Install OpenBSD
|
||||
|
||||
The installation was very straightforward. I [downloaded][10] the most recent version of OpenBSD and created a boot CD (because there is no other way to boot my old laptop besides the internal drive). The installation went flawlessly. It recognized my hardware, network (including my access point), and time zone; let me choose the layout of my hard drive and manage my users; and asked some questions about the system's security setup. Also, even though the installation has a very small footprint, OpenBSD let me choose what to install and from where.
|
||||
|
||||
I ended up with a brand-new, up-to-date operating system and a screen like this.
|
||||
|
||||
![OpenBSD][11]
|
||||
|
||||
(Jonathan Garrido, [CC BY-SA 4.0][12])
|
||||
|
||||
### Add a graphical desktop
|
||||
|
||||
If you want your desktop to use graphical applications, a black terminal with white letters is not enough. So follow these steps to install the [Xfce desktop][13]:
|
||||
|
||||
1. As root, run: [code]`pkg_add xcfe xfce-extras slim slim-themes consolekit2 polkit`[/code] to install the Xfce environment and the login greeter. In the above, `pkg_add` is the utility to use when you want to d
|
@ -0,0 +1,133 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: ( )
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
[#]: subject: (5 new sudo features you need to know in 2020)
|
||||
[#]: via: (https://opensource.com/article/20/10/sudo-19)
|
||||
[#]: author: (Peter Czanik https://opensource.com/users/czanik)
|
||||
|
||||
5 new sudo features you need to know in 2020
|
||||
======
|
||||
From central session recording through chroot support to Python API,
|
||||
sudo 1.9 offers many new features.
|
||||
![Wratchet set tools][1]
|
||||
|
||||
When you want to perform an action on a [POSIX system][2], one of the safest ways to do so is to use the sudo command. Unlike logging in as the root user and performing what could be a dangerous action, sudo grants any user [designated as a "sudoer"][3] by the sysadmin temporary permission to perform a normally restricted activity.
|
||||
|
||||
This system has helped keep Linux, Unix, and macOS systems safe from silly mistakes and malicious attacks for decades, and it is the default administrative mechanism on all major Linux distributions today.
|
||||
|
||||
When it was released in May 2020, sudo 1.9 brought many new features, including central collection of session recordings, support for chroot within sudo, and a Python API. If you are surprised by any of these, read my article about some [lesser-known features of sudo][4].
|
||||
|
||||
Sudo is a lot more than just a prefix for administrative commands. You can fine-tune permissions, record what is happening on the terminal, extend sudo using plugins, store configurations in LDAP, do extensive logging, and much more.
|
||||
|
||||
Version 1.9.0 and subsequent minor releases added a variety of new features (which I'll describe below), including:
|
||||
|
||||
* A recording service to collect sudo session recordings centrally
|
||||
* Audit plugin API
|
||||
* Approval plugin API
|
||||
* Python support for plugins
|
||||
* Chroot and CWD support built into sudo (starting with 1.9.3)
|
||||
|
||||
|
||||
|
||||
### Where to get sudo 1.9
|
||||
|
||||
Most Linux distributions still package the previous generation of sudo (version 1.8), and it will stay that way in long-term support (LTS) releases for several years. The most complete sudo 1.9 package I am aware of in a Linux distribution is openSUSE [Tumbleweed][5], which is a rolling distro, and the sudo package has Python support available in a subpackage. Recent [Fedora][6] releases include sudo 1.9 but without Python. [FreeBSD Ports][7] has the latest sudo version available, and you can enable Python support if you build sudo yourself instead of using the package.
|
||||
|
||||
If your favorite Linux distribution does not yet include sudo 1.9, check the [sudo binaries page][8] to see if a ready-to-use package is available for your system. This page also has packages for several commercial Unix variants.
|
||||
|
||||
As usual, before you start experimenting with sudo settings, _make sure you know the root password_. Yes, even on Ubuntu. Having a temporary "backdoor" is important; without it, you would have to hack your own system if something goes wrong. And remember: a syntactically correct configuration does not mean that anybody can do anything through sudo on that system!
|
||||
|
||||
### Recording service
|
||||
|
||||
The recording service collects session recordings centrally. This offers many advantages compared to local session log storage:
|
||||
|
||||
* It is more convenient to search in one place instead of visiting individual machines for recordings
|
||||
* Recordings are available even if the sending machine is down
|
||||
* Recordings cannot be deleted by local users who want to cover their tracks
|
||||
|
||||
|
||||
|
||||
For a quick test, you can send sessions through non-encrypted connections to the recording service. My blog contains [instructions][9] for setting it up in just a few minutes. For a production setup, I recommend using encryption. There are many possibilities, so read the [documentation][10] that best suits your environment.
|
||||
|
||||
### Audit plugin API
|
||||
|
||||
The new audit plugin API is not a user-visible feature. In other words, you cannot configure it from the sudoers file. It is an API, meaning that you can access audit information from plugins, including ones written in Python. You can use it in many different ways, like sending events from sudo directly to Elasticsearch or Logging-as-a-Service (LaaS) when something interesting happens. You can also use it for debugging and print otherwise difficult-to-access information to the screen in whatever format you like.
|
||||
|
||||
Depending on how you want to use it, you can find its documentation in the sudo plugin manual page (for C) and the sudo Python plugin manual. [Sample Python code][11] is available in the sudo source code, and there is also a [simplified example][12] on my blog.
|
||||
|
||||
### Approval plugin API
|
||||
|
||||
The approval plugin API makes it possible to include extra restrictions before a command will execute. These will run only after the policy plugin succeeds, so you can effectively add additional policy layers without replacing the policy plugin and thus sudoers. Multiple approval plugins may be defined, and all must succeed for the command to execute.
|
||||
|
||||
As with the audit plugin API, you can use it both from C and Python. The [sample Python code][13] documented on my blog is a good introduction to the API. Once you understand how it works, you can extend it to connect sudo to ticketing systems and approve sessions only with a related open ticket. You can also connect to an HR database so that only the engineer on duty can gain administrative privileges.
|
||||
|
||||
### Python support for plugins
|
||||
|
||||
Even though I am not a programmer, my favorite new sudo 1.9 feature is Python support for plugins. You can use most of the APIs available from C with Python as well. Luckily, sudo is not performance-sensitive, so the relatively slow speed of running Python code is not a problem for sudo. Using Python for extending sudo has many advantages:
|
||||
|
||||
* Easier, faster development
|
||||
* No need to compile; code might even be distributed by configuration management
|
||||
* Many APIs do not have ready-to-use C clients, but Python code is available
|
||||
|
||||
|
||||
|
||||
In addition to the audit and approval plugin APIs, there are a few others available, and you can do very interesting things with them.
|
||||
|
||||
By using the policy plugin API, you can replace the sudo policy engine. Note you will lose most sudo features, and there is no more sudoers-based configuration. This can still be useful in niche cases, but most of the time, it is better to keep using sudoers and create additional policies using the approval plugin API. If you want to give it a try, my [introduction to the Python plugin][14] provides a very simple policy: allowing only the `id` command. Once again, make sure you know the root password, as once this policy is enabled, it prevents any practical use of sudo.
|
||||
|
||||
Using the I/O logs API, you can access input and output from user sessions. This means you can analyze what is happening in a session and even terminate it if you find something suspicious. This API has many possible uses, such as data-leak prevention. You can monitor the screen for keywords and, if any of them appear in the data stream, you can break the connection before the keyword can appear on the user's screen. Another possibility is checking what the user is typing and using that data to reconstruct the command line the user is entering. For example, if a user enters `rm -fr /`, you can disconnect the user even before Enter is hit.
|
||||
|
||||
The group plugin API allows non-Unix group lookups. In a way, this is similar to the approval plugin API as it also extends the policy plugin. You can check if a user is part of a given group and act based on this in later parts of the configuration.
|
||||
|
||||
### Chroot and CWD support
|
||||
|
||||
The latest additions to sudo are chroot and change working directory (CWD) support. Neither option is enabled by default—you need to explicitly enable them in the sudoers file. When they're enabled, you can fine-tune target directories or allow users to specify which directory to use. The logs reflect when these settings were used.
|
||||
|
||||
On most systems, chroot is available only to root. If one of your users needs chroot, you need to give them root access, which gives them a lot more power than just chroot. Alternately, you can allow access to the chroot command through sudo, but it still allows loopholes where they can gain full access. When you use sudo's built-in chroot support, you can easily restrict access to a single directory. You can also give users the flexibility to specify the root directory. Of course, this might lead to disasters (e.g., `sudo --chroot / -s`), but at least the event is logged.
|
||||
|
||||
When you run a command through sudo, it sets the working directory to the current directory. This is the expected behavior, but there may be cases when the command needs to be run in a different directory. For example, I recall using an application that checked my privileges by checking whether my working directory was `/root`.
|
||||
|
||||
### Try the new features
|
||||
|
||||
I hope that this article inspires you to take a closer look at sudo 1.9. Central session recording is both more convenient and secure than storing session logs locally. Chroot and CWD support give you additional security and flexibility. And using Python to extend sudo makes it easy to custom-tailor sudo to your environment. You can try the new features by using one of the latest Linux distributions or the ready-to-use packages from the sudo website.
|
||||
|
||||
If you want to learn more about sudo, here are a few resources:
|
||||
|
||||
* [Sudo website][15]
|
||||
* [Sudo blog][16]
|
||||
* [Sudo on Twitter][17]
|
||||
|
||||
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/20/10/sudo-19
|
||||
|
||||
作者:[Peter Czanik][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/czanik
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/tools_osyearbook2016_sysadmin_cc.png?itok=Y1AHCKI4 (Wratchet set tools)
|
||||
[2]: https://opensource.com/article/19/7/what-posix-richard-stallman-explains
|
||||
[3]: https://opensource.com/article/17/12/using-sudo-delegate
|
||||
[4]: https://opensource.com/article/19/10/know-about-sudo
|
||||
[5]: https://software.opensuse.org/distributions/tumbleweed
|
||||
[6]: https://getfedora.org/
|
||||
[7]: https://www.freebsd.org/ports/
|
||||
[8]: https://www.sudo.ws/download.html#binary
|
||||
[9]: https://blog.sudo.ws/posts/2020/03/whats-new-in-sudo-1.9-recording-service/
|
||||
[10]: https://www.sudo.ws/man/sudo_logsrvd.man.html#EXAMPLES
|
||||
[11]: https://github.com/sudo-project/sudo/blob/master/plugins/python/example_audit_plugin.py
|
||||
[12]: https://blog.sudo.ws/posts/2020/06/sudo-1.9-using-the-new-audit-api-from-python/
|
||||
[13]: https://blog.sudo.ws/posts/2020/08/sudo-1.9-using-the-new-approval-api-from-python/
|
||||
[14]: https://blog.sudo.ws/posts/2020/01/whats-new-in-sudo-1.9-python/
|
||||
[15]: https://www.sudo.ws/
|
||||
[16]: https://blog.sudo.ws/
|
||||
[17]: https://twitter.com/sudoproject
|
@ -1,87 +0,0 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: ( )
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
[#]: subject: (How to Clear Terminal Screen in Ubuntu and Other Linux Distributions [Beginner’s Tip])
|
||||
[#]: via: (https://itsfoss.com/clear-terminal-ubuntu/)
|
||||
[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/)
|
||||
|
||||
How to Clear Terminal Screen in Ubuntu and Other Linux Distributions [Beginner’s Tip]
|
||||
======
|
||||
|
||||
When you are working in the terminal, often you’ll find that your terminal screen is filled up with too many commands and their outputs.
|
||||
|
||||
You may want to clear the terminal to declutter the screen and focus on the next task you are going to perform. Clearing the Linux terminal screen helps a lot, trust me.
|
||||
|
||||
### Clear Linux terminal with clear command
|
||||
|
||||
So, how do you clear terminal in Linux? The simplest and the most common way is to use the clear command:
|
||||
|
||||
```
|
||||
clear
|
||||
```
|
||||
|
||||
You need no option with the clear command. It’s that simple but there are some additional things you need to know about it.
|
||||
|
||||
![][1]
|
||||
|
||||
_**The clear command and other methods of clearing screen may depend on the terminal emulator you are using.**_ Terminal emulator is the terminal application that you use for accessing the Linux shell (command line).
|
||||
|
||||
If you use clear command on Ubuntu with GNOME Terminal, it will clear the screen and you won’t be able to see what else you had on the screen previously.
|
||||
|
||||
In many other terminal emulators or Putty, it may just clear the screen for one page. If you scroll with mouse or PageUp and PageDown keys, you can still access the old screen outputs.
|
||||
|
||||
Frankly, it depends on your need. If you suddenly realize that you need to refer to the output of a previously run command, perhaps having that option available will be helpful.
|
||||
|
||||
### Other ways to clear terminal screen in Linux
|
||||
|
||||
![][2]
|
||||
|
||||
Clear command is not the only way to clear the terminal screen.
|
||||
|
||||
You can use Ctrl+L [keyboard shortcut in Linux][3] to clear the screen. It works in most terminal emulators.
|
||||
|
||||
```
|
||||
Ctrl+L
|
||||
```
|
||||
|
||||
If you use Ctrl+L and clear command in GNOME terminal (default in Ubuntu), you’ll notice the difference between their impact. Ctrl+L moves the screen one page down giving the illusion of a clean screen but you can still access the command output history by scrolling up.
|
||||
|
||||
**Some other terminal emulators have this keyboard shortcut set at Ctrl+Shift+K.**
|
||||
|
||||
You can also use reset command for clearing the terminal screen. Actually, this command performs a complete terminal re-initialization. It could take a bit longer than clear command, though.
|
||||
|
||||
```
|
||||
reset
|
||||
```
|
||||
|
||||
There are a couple of other complicated ways to clear the screen when you want to clear the screen completely. But since the command is a bit complicated, it’s better to use it as [alias in Linux][4]:
|
||||
|
||||
```
|
||||
alias cls='printf "\033c"'
|
||||
```
|
||||
|
||||
You can add this alias to your bash profile so that it is available as command.
|
||||
|
||||
I know this was a pretty basic topic and most Linux users probably already knew it but it doesn’t harm in covering the elementary topics for the new Linux users. Isn’t it?
|
||||
|
||||
Got some secretive tip on clearing terminal screen? Why not share it with us?
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://itsfoss.com/clear-terminal-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://i1.wp.com/itsfoss.com/wp-content/uploads/2020/10/clear-command-linux.gif?resize=800%2C432&ssl=1
|
||||
[2]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/10/clear-terminal-screen-linux.png?resize=800%2C450&ssl=1
|
||||
[3]: https://linuxhandbook.com/linux-shortcuts/
|
||||
[4]: https://linuxhandbook.com/linux-alias-command/
|
@ -0,0 +1,629 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: ( )
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
[#]: subject: (Program in Arm6 assembly language on a Raspberry Pi)
|
||||
[#]: via: (https://opensource.com/article/20/10/arm6-assembly-language)
|
||||
[#]: author: (Marty Kalin https://opensource.com/users/mkalindepauledu)
|
||||
|
||||
Program in Arm6 assembly language on a Raspberry Pi
|
||||
======
|
||||
Assembly language offers special insights into how machines work and how
|
||||
they can be programmed.
|
||||
![An intersection of pipes.][1]
|
||||
|
||||
The [Arm website][2] touts the processor's underlying architecture as "the keystone of the world's largest compute ecosystem," which is plausible given the number of handheld and embedded devices with Arm processors. Arm processors are prevalent in the Internet of Things (IoT), but they are also used in desktop machines, servers, and even high-performance computers, such as the Fugaku HPC. But why look at Arm machines through the lens of assembly language?
|
||||
|
||||
Assembly language is the symbolic language immediately above machine code and thereby offers special insights into how machines work and how they can be programmed efficiently. In this article, I hope to illustrate this point with the Arm6 architecture using a Raspberry Pi 4 mini-desktop machine running Debian.
|
||||
|
||||
The Arm6 family of processors supports two instruction sets:
|
||||
|
||||
* The Arm set, with 32-bit instructions throughout.
|
||||
* The Thumb set, with a mix of 16-bit and 32-bit instructions.
|
||||
|
||||
|
||||
|
||||
The examples in this article use the Arm instruction set. The Arm assembly code is in lowercase, and, for contrast, pseudo-assembly code is in uppercase.
|
||||
|
||||
### Load-store machines
|
||||
|
||||
The RISC/CISC distinction is often seen when comparing the Arm family and the Intel x86 family of processors, both of which are commercial products competing on the market. The terms RISC (reduced instruction set computer) and CISC (complex instruction set computer) date from the middle 1980s. Even then the terms were misleading, in that both RISC (e.g., MIPS) and CISC (e.g., Intel) processors had about 300 instructions in their instruction sets; today the counts for core instructions in Arm and Intel machines are close, although both types of machines have extended their instruction sets. A sharper distinction between Arm and Intel machines draws on an architectural feature other than instruction count.
|
||||
|
||||
An instruction set architecture (ISA) is an abstract model of a computing machine. Processors from Arm and Intel implement different ISAs: Arm processors implement a load-store ISA, whereas their Intel counterparts implement a register-memory ISA. The difference in ISAs can be described as:
|
||||
|
||||
* In a load-store machine, only two instructions move data between a CPU and the memory subsystem:
|
||||
* A load instruction copies bits from memory into a CPU register.
|
||||
* A store instruction copies bits from a CPU register into memory.
|
||||
* Other instructions—in particular, the ones for arithmetic-logic operations—use only CPU registers as source and destination operands. For example, here is pseudo-assembly code on a load-store machine to add two numbers originally in memory, storing their sum back in memory (comments start with `##`): [code] ## R0 is a CPU register, RAM[32] is a memory location
|
||||
LOAD R0, RAM[32] ## R0 = RAM[32]
|
||||
LOAD R1, RAM[64] ## R1 = RAM[64]
|
||||
ADD R2, R0, R1 ## R2 = R0 + R1
|
||||
STORE R2, RAM[32] ## RAM[32] = R2 [/code] The task requires four instructions: two LOADs, one ADD, and one STORE.
|
||||
* By contrast, a register-memory machine allows the operands for arithmetic-logic instructions to be registers or memory locations, usually in any combination. For example, here is pseudo-assembly code on a register-memory machine to add two numbers in memory: [code]`ADD RAM[32], RAM[32], RAM[64] ## RAM[32] += RAM[64]`[/code] The task can be accomplished with a single instruction, although the bits to be added must still be fetched from memory to a CPU, and the sum then must be copied back to memory location RAM[32].
|
||||
|
||||
|
||||
|
||||
Any ISA comes with tradeoffs. As the example above illustrates, a load-store ISA has what architects call "low instruction density": relatively many instructions may be required to perform a task. A register-memory machine has high instruction density, which is an upside. There are upsides, as well, to the load-store ISA.
|
||||
|
||||
Load-store design is an effort to simplify an architecture. For instance, consider the case in which a register-memory machine has an instruction with mixed operands:
|
||||
|
||||
|
||||
```
|
||||
COPY R2, RAM[64] ## R2 = RAM[64]
|
||||
ADD RAM[32], RAM[32], R2 ## RAM[32] = RAM[32] + R2
|
||||
```
|
||||
|
||||
Executing the ADD instruction is tricky in that the access times for the numbers to be added differs—perhaps significantly if the memory operand happens to be only in main memory rather than also in a cache thereof. Load-store machines avoid the problem of mixed access times in arithmetic-logic operations: all operands, as registers, have the same access time.
|
||||
|
||||
Furthermore, load-store architectures emphasize fixed-sized instructions (e.g., 32-bits apiece), limited formats (e.g., one, two, or three fields per instruction), and relatively few addressing modes. These design constraints mean that the processor's control unit (CU) and arithmetic-logic unit (ALU) can be simplified: fewer transistors and wires, less required power and generated heat, and so on. Load-store machines are designed to be architecturally sparse.
|
||||
|
||||
My aim is not to step into the debate over load-store versus register-memory machines but rather to set up a code example in the load-store Arm6 architecture. This first look at load-store helps to explain the code that follows. The two programs (one in C, one in Arm6 assembly) are available on [my website][3].
|
||||
|
||||
### The hstone program in C
|
||||
|
||||
Among my favorite short code examples is the hailstone function, which takes a positive integer as an argument. (I used this example in an [earlier article on WebAssembly][4].) This function is rich enough to highlight important assembly-language details. The function is defined as:
|
||||
|
||||
|
||||
```
|
||||
3N+1 if N is odd
|
||||
hstone(N) =
|
||||
N/2 if N is even
|
||||
```
|
||||
|
||||
For example, hstone(12) evaluates to 6, whereas hstone(11) evaluates to 34. If N is odd, then 3N+1 is even; but if N is even, then N/2 could be either even (e.g., 4/2 = 2) or odd (e.g., 6/2 = 3).
|
||||
|
||||
The hstone function can be used iteratively by passing the returned value as the next argument. The result is a _hailstone sequence_, such as this one, which starts with 24 as the original argument, the returned value 12 as the next argument, and so on:
|
||||
|
||||
|
||||
```
|
||||
`24,12,6,3,10,5,16,8,4,2,1,4,2,1,...`
|
||||
```
|
||||
|
||||
It takes 10 steps for the sequence to converge to 1, at which point the sequence of 4,2,1 repeats indefinitely: (3x1)+1 is 4, which is halved to yield 2, which is halved to yield 1, and so on. For an explanation of why "hailstone" seems an appropriate name for such sequences, see "[Mathematical mysteries: Hailstone sequences][5]."
|
||||
|
||||
Note that powers of 2 converge quickly: 2N requires just N divisions by 2 to reach 1. For example, 32 = 25 has a convergence length of 5, and 512 = 29 has a convergence length of 9. If the hailstone function returns any power of 2, then the sequence converges to 1. Of interest here is the sequence length from the initial argument to the first occurrence of 1.
|
||||
|
||||
The [Collatz conjecture][6] is that a hailstone sequence converges to 1 no matter what the initial argument N > 0 happens to be. Neither a counterexample nor a proof has been found. The conjecture, simple as it is to illustrate with a program, remains a profoundly challenging problem in number theory.
|
||||
|
||||
Below is the C source code for the hstoneC program, which computes the length of the hailstone sequence whose starting value is given as user input. The assembly-language version of the program (hstoneS) is provided after an overview of Arm6 basics. For clarity, the two programs are structurally similar.
|
||||
|
||||
Here is the C source code:
|
||||
|
||||
|
||||
```
|
||||
#include <stdio.h>
|
||||
|
||||
/* Compute steps from n to 1.
|
||||
-- update an odd n to (3 * n) + 1
|
||||
-- update an even n to (n / 2) */
|
||||
unsigned hstone(unsigned n) {
|
||||
unsigned len = 0; /* counter */
|
||||
while (1) {
|
||||
if (1 == n) break;
|
||||
n = (0 == (n & 1)) ? n / 2 : (3 * n) + 1;
|
||||
len++;
|
||||
}
|
||||
return len;
|
||||
}
|
||||
|
||||
int main() {
|
||||
[printf][7]("Integer > 0: ");
|
||||
unsigned num;
|
||||
[scanf][8]("%u", &num);
|
||||
[printf][7]("Steps from %u to 1: %u\n", num, hstone(num));
|
||||
return 0;
|
||||
}
|
||||
```
|
||||
|
||||
When the program is run with an input of 9, the output is:
|
||||
|
||||
|
||||
```
|
||||
`Steps from 9 to 1: 19`
|
||||
```
|
||||
|
||||
The hstoneC program has a simple structure. The `main` function prompts the user for an input N (an integer > 0) and then calls the `hstone` function with this input as an argument. The `hstone` function loops until the sequence from N reaches the first 1, returning the number of steps required.
|
||||
|
||||
The most complicated statement in the program involves C's conditional operator, which is used to update N:
|
||||
|
||||
|
||||
```
|
||||
`n = (0 == (n & 1)) ? n / 2 : (3 * n) + 1;`
|
||||
```
|
||||
|
||||
This is a terse form of an if-then construct. The test `(0 == (n & 1))` checks whether the C variable `n` (representing N) is even or odd depending on whether the bitwise AND of N and 1 is zero: an integer value is even just in case its least-significant (rightmost) bit is zero. If N is even, N/2 becomes the new value; otherwise, 3N+1 becomes the new value. The assembly-language version of the program (hstoneS) likewise avoids an explicit if-else construct in updating its implementation of N.
|
||||
|
||||
My Arm6 mini-desktop machine includes the GNU C toolset, which can generate the corresponding code in assembly language. With `%` as the command-line prompt, the command is:
|
||||
|
||||
|
||||
```
|
||||
`% gcc -S hstoneC.c ## -S flag produces and saves assembly code`
|
||||
```
|
||||
|
||||
This produces the file hstoneC.s, which is about 120 lines of assembly-language source code, including a `nop` ("no operation") instruction. Compiler-generated assembly tends to be hard to read and may have inefficiencies such as the `nop`. A hand-crafted version, such as `hstoneS.s` (below), can be easier to follow and even significantly shorter (e.g., `hstoneS.s` has about 50 lines of code).
|
||||
|
||||
### Assembly language basics
|
||||
|
||||
Arm6, like most modern architectures, is byte-addressable: a memory address is of a byte, even if the addressed item (e.g., a 32-bit instruction) consists of multiple bytes. Instructions are addressed in little-[endian][9] fashion: the address is of the low-order byte. Data items are addressed in little-endian fashion by default, but this can be changed to big-endian so that the address of a multi-byte data item points to the high-order byte. By tradition, the low-order byte is depicted as the rightmost one and the high-order byte as the leftmost one:
|
||||
|
||||
|
||||
```
|
||||
high-order low-order
|
||||
/ /
|
||||
+----+----+----+----+
|
||||
| b1 | b2 | b3 | b4 | ## 4 bytes = 32 bits
|
||||
+----+----+----+----+
|
||||
```
|
||||
|
||||
Addresses are 32-bits in size, and data items come in three standard sizes:
|
||||
|
||||
* A _byte_ is 8 bits in size.
|
||||
* A _halfword_ is 16 bits in size.
|
||||
* A _word_ is 32 bits in size.
|
||||
|
||||
|
||||
|
||||
Aggregates of bytes, halfwords, and words (e.g., arrays and structures) are supported. CPU registers are 32-bits in size.
|
||||
|
||||
Assembly languages, in general, have three key features with a syntax that is close and, at times, identical:
|
||||
|
||||
* Directives in both Arm6 and Intel assembly start with a period. Here are two Arm6 examples, which happen to work in Intel as well:
|
||||
|
||||
|
||||
```
|
||||
.data
|
||||
.align 4
|
||||
```
|
||||
|
||||
The first directive indicates that the following section holds data items rather than code. The `.align 4` directive specifies that data items should be laid out, in memory, on 4-byte boundaries, which is common in modern architectures. As the name suggests, a directive gives direction to the translator (the "assembler") as this does its work.
|
||||
|
||||
By contrast, this directive indicates a code rather than a data section:
|
||||
|
||||
|
||||
```
|
||||
`.text`
|
||||
```
|
||||
|
||||
The term "text" is traditional, and its meaning, in this context, is "read-only": during program execution, code is read-only, whereas data can be read and written.
|
||||
|
||||
* Labels in both recent Arm and Intel assembly end with colons. A label is a memory address for either data items (e.g., variables) or code blocks (e.g., functions). Assembly languages, in general, rely heavily on addresses, which means that manipulating pointers—in particular, dereferencing them to get the values to which they point—takes front stage in assembly-language programming. Here are two labels in the hstoneS program:
|
||||
|
||||
|
||||
```
|
||||
collatz: /* label */
|
||||
mov r0, #0 /* instruction */
|
||||
loop_start: /* label */
|
||||
...
|
||||
```
|
||||
|
||||
The first label marks the start of the `collatz` function, whose first instruction copies the value zero (`#0`) into the register `r0`. (The `mov` for "move" opcode occurs across assembly languages but really means "copy.") The second label, `loop_start:`, is the address of the loop that computes the length of the hailstone sequence. The register `r0` serves as the sequence counter.
|
||||
|
||||
* Instructions, which assembly-sensitive editors usually indent along with directives, specify the operations to be performed (e.g., `mov`) together with operands (in this case, `r0` and `#0`). There are instructions with no operands and others with several.
|
||||
|
||||
|
||||
|
||||
|
||||
The `mov` instruction above does not violate the load-store principle about memory access. In general, a load instruction (`ldr` in Arm6) loads memory contents into a register. By contrast, a `mov` instruction can be used to copy an "immediate value," such as an integer constant, into a register:
|
||||
|
||||
|
||||
```
|
||||
`mov r0, #0 /* copy zero into r0 */`
|
||||
```
|
||||
|
||||
A `mov` instruction also can be used to copy the contents of one register into another:
|
||||
|
||||
|
||||
```
|
||||
`mov r1, r0 /* r1 = r0 */`
|
||||
```
|
||||
|
||||
The load opcode `ldr` would be inappropriate in both cases because a memory location is not in play. Examples of Arm6 `ldr` ("load register") and `str` ("store register") instructions are forthcoming.
|
||||
|
||||
The Arm6 architecture has 16 primary CPU registers (each 32-bits in size), a mix of general-purpose and special-purpose. Table 1 gives a summary, listing special features and uses beyond scratchpad:
|
||||
|
||||
#### Table 1. Primary CPU registers
|
||||
|
||||
Register | Special features
|
||||
---|---
|
||||
r0 | 1st arg to library function, retval
|
||||
r1 | 2nd arg to library function
|
||||
r2 | 3rd arg to library function
|
||||
r3 | 4th arg to library function
|
||||
r4 | callee-saved
|
||||
r5 | callee-saved
|
||||
r6 | callee-saved
|
||||
r7 | callee-saved, system calls
|
||||
r8 | callee-saved
|
||||
r9 | callee-saved
|
||||
r10 | callee-saved
|
||||
r11 | callee-saved, frame pointer
|
||||
r12 | intra-procedure
|
||||
r13 | stack pointer
|
||||
r14 | link register
|
||||
r15 | program counter
|
||||
|
||||
In general, CPU registers serve as a backup for the stack, the area of main memory that provides reusable scratchpad storage for the arguments passed to functions and the local variables used in functions and other code blocks (e.g., the body of a loop). Given that CPU registers reside on the same chip as the CPU, access time is fast. Access to the stack is significantly slower, with the details depending on the particularities of a system. However, registers are scarce. In the case of Arm6, there are only 16 primary CPU registers, and some of these have special uses beyond scratchpad.
|
||||
|
||||
The first four registers, `r0` through `r3`, are used for scratchpad but also to pass arguments along to library functions. For example, calling a library function such as `printf` (used in both the hstoneC and hstoneS programs) requires that the expected arguments be in the expected registers. The `printf` function takes at least one argument (a format string) but usually takes others, as well (the values to be formatted). The address of the format string has to be in register `r0` for the call to succeed. A programmer-defined function can implement its own register strategy, of course, but using the first four registers for function arguments is common in Arm6 programming.
|
||||
|
||||
Register `r0` also has special uses. For example, it typically holds the value returned from a function, as in the `collatz` function of the hstoneS program. If a program calls the `syscall` function, which is used to invoke system functions such as `read` and `write`, register `r0` holds the integer identifier of the system function to be called (e.g., function `write` has 4 as its identifier). In this respect, register `r0` is similar in purpose to register `r7`, which holds such an identifier when function `svc` ("supervisor call") is used instead of `syscall`.
|
||||
|
||||
Registers `r4` through `r11` are general-purpose and "callee saved" (aka "non-volatile" or "call-preserved"). Consider the case in which function F1 calls function F2 using registers to pass arguments to F2. The registers `r0` through `r3` are "caller saved" (aka "volatile" or "call-clobbered") in that, for example, the called function F2 might call some other function F3 by using the very same registers that F1 did—but with new values therein:
|
||||
|
||||
|
||||
```
|
||||
27 13 191 437
|
||||
\ \ \ \
|
||||
r0, r1 r0, r1
|
||||
F1-------->F2-------->F3
|
||||
```
|
||||
|
||||
After F1 calls F2, the contents of registers `r0` and `r1` get changed for F2's call to F3. Accordingly, F1 must not assume that its values in `r0` and `r1` (27 and 13, respectively) have been preserved; instead, these values have been overwritten—clobbered by the new values 191 and 437. Because the first four registers are not "callee saved," called function F2 is not responsible for preserving and later restoring the values in the registers set by F1.
|
||||
|
||||
Callee-saved registers bring responsibility to a called function. For example, if F1 used callee-saved registers `r4` and `r5` in its call to F2, then F2 would be responsible for saving the contents of these registers (typically on the stack) and then restoring the values before returning to F1. F2's code then might start and end as follows:
|
||||
|
||||
|
||||
```
|
||||
push {r4, r5} /* save r4 and r5 values on the stack */
|
||||
... /* reuse r4 and r5 for some other task */
|
||||
pop {r4, r5} /* restore r4 and r5 values */
|
||||
```
|
||||
|
||||
The `push` operation saves the values in `r4` and `r5` to the stack. The matching `pop` operation then recovers these values from the stack and puts them into `r4` and `r5`.
|
||||
|
||||
Other registers in Table 1 can be used as scratchpad, but some have a special use, as well. As noted earlier, register `r7` can be used to make system calls (e.g., to function `write`), which a later example shows in detail. In an `svc` instruction, the integer identifier for a particular system function must be in register `r7` (e.g., 4 to identify the `write` function).
|
||||
|
||||
Register `r11` is aliased as `fp` for "frame pointer," which points to the start of the current call frame. When one function calls another, the called function gets its own area of the stack (a call frame) for use as scratchpad. A frame pointer, unlike the stack pointer described below, typically remains fixed until a called function returns.
|
||||
|
||||
Register `r12`, also known as `ip` ("intra-procedure"), is used by the dynamic linker. Between calls to dynamically linked library functions, however, a program can use this register as scratchpad.
|
||||
|
||||
Register `r13`, which has `sp` ("stack pointer") as an alias, points to the top of the stack and is updated automatically through `push` and `pop` operations. The stack pointer also can be used as a base address with an offset; for example, `sp - #4` points 4 bytes below where the `sp` points. The Arm6 stack, like its Intel counterpart, grows from high to low addresses. (Some authors accordingly describe the stack pointer as pointing to the bottom rather than the top of the stack.)
|
||||
|
||||
Register `r14`, with `lr` as an alias, serves as the "link register" that holds a return address for a function. However, a called function can call another with a `bl` ("branch with link") or `bx` ("branch with exchange") instruction, thereby clobbering the contents of the `lr` register. For example, in the hstoneS program, the function `main` calls four others. Accordingly, function `main` saves the `lr` of its caller on the stack and later restores this value. The pattern occurs regularly in Arm6 assembly language:
|
||||
|
||||
|
||||
```
|
||||
push {lr} /* save caller's lr */
|
||||
... /* call some functions */
|
||||
pop {lr} /* restore caller's lr */
|
||||
```
|
||||
|
||||
Register `r15` is also the `pc` ("program counter"). In most architectures, the program counter points to the "next" instruction to be executed. For historical reasons, the Arm6 `pc` points to _two_ instructions beyond the current one. The `pc` can be manipulated directly (for example, to call a function), but the recommended approach is to use instructions such as `bl` that manipulate the link register.
|
||||
|
||||
Arm6 has the usual assortment of instructions for arithmetic (e.g., add, subtract, multiply, divide), logic (e.g., compare, shift), control (e.g., branch, exit), and input/output (e.g., read, write). The results of comparisons and other operations are saved in the special-purpose register `cpsr` ("current processor status register"). For example, this register records whether an addition caused an overflow or whether two compared integer values are equal.
|
||||
|
||||
It is worth repeating that the Arm6 has exactly two basic data movement instructions: `ldr` to load memory contents into a register and `str` to store register contents in memory. Arm6 includes variations of the basic `ldr` and `str` instructions, but the load-store pattern of moving data between registers and memory remains the same.
|
||||
|
||||
A code example brings these architectural details to life. The next section introduces the hailstone program in assembly language.
|
||||
|
||||
### The hstone program in Arm6 assembly
|
||||
|
||||
The above overview of Arm6 assembly is enough to introduce the full code example for hstoneS. For clarity, the assembly-language program hstoneS has essentially the same structure as the C program hstoneC: two functions, `main` and `collatz`, and mostly straight-line code execution in each function. The behavior of the two programs is the same.
|
||||
|
||||
Here is the source code for hstoneS:
|
||||
|
||||
|
||||
```
|
||||
.data /* data versus code */
|
||||
.balign 4 /* alignment on 4-byte boundaries */
|
||||
|
||||
/* labels (addresses) for user input, formatters, etc. */
|
||||
num: .int 0 /* 4-byte integer */
|
||||
steps: .int 0 /* another for the result */
|
||||
prompt: .asciz "Integer > 0: " /* zero-terminated ASCII string */
|
||||
format: .asciz "%u" /* %u for "unsigned" */
|
||||
report: .asciz "From %u to 1 takes %u steps.\n"
|
||||
|
||||
.text /* code: 'text' in the sense of 'read only' */
|
||||
.global main /* program's entry point must be global */
|
||||
.extern [printf][7] /* library function */
|
||||
.extern [scanf][8] /* ditto */
|
||||
|
||||
collatz: /** collatz function **/
|
||||
mov r0, #0 /* r0 is the step counter */
|
||||
loop_start: /** collatz loop **/
|
||||
cmp r1, #1 /* are we done? (num == 1?) */
|
||||
beq collatz_end /* if so, return to main */
|
||||
|
||||
and r2, r1, #1 /* odd-even test for r1 (num) */
|
||||
cmp r2, #0 /* even? */
|
||||
moveq r1, r1, LSR #1 /* even: divide by 2 via a 1-bit right shift */
|
||||
addne r1, r1, r1, LSL #1 /* odd: multiply by adding and 1-bit left shift */
|
||||
addne r1, #1 /* odd: add the 1 for (3 * num) + 1 */
|
||||
|
||||
add r0, r0, #1 /* increment counter by 1 */
|
||||
b loop_start /* loop again */
|
||||
collatz_end:
|
||||
bx lr /* return to caller (main) */
|
||||
|
||||
main:
|
||||
push {lr} /* save link register to stack */
|
||||
|
||||
/* prompt for and read user input */
|
||||
ldr r0, =prompt /* format string's address into r0 */
|
||||
bl [printf][7] /* call printf, with r0 as only argument */
|
||||
|
||||
ldr r0, =format /* format string for scanf */
|
||||
ldr r1, =num /* address of num into r1 */
|
||||
bl [scanf][8] /* call scanf */
|
||||
|
||||
ldr r1, =num /* address of num into r1 */
|
||||
ldr r1, [r1] /* value at the address into r1 */
|
||||
bl collatz /* call collatz with r1 as the argument */
|
||||
|
||||
/* demo a store */
|
||||
ldr r3, =steps /* load memory address into r3 */
|
||||
str r0, [r3] /* store hailstone steps at mem[r3] */
|
||||
|
||||
/* setup report */
|
||||
mov r2, r0 /* r0 holds hailstone steps: copy into r2 */
|
||||
ldr r1, =num /* get user's input again */
|
||||
ldr r1, [r1] /* dereference address to get value */
|
||||
ldr r0, =report /* format string for report into r0 */
|
||||
bl [printf][7] /* print report */
|
||||
|
||||
pop {lr} /* return to caller */
|
||||
```
|
||||
|
||||
Arm6 assembly supports documentation in either C style (the slash-star and star-slash syntax used here) or one-line comments introduced by the @ sign. The hstoneS program, like its C counterpart, has two functions:
|
||||
|
||||
* The program's entry point is the `main` function, which is identified by the label `main:`; this label marks where the function's first instruction is found. In Arm6 assembly, the entry point must be declared as global:
|
||||
|
||||
|
||||
```
|
||||
`.global main`
|
||||
```
|
||||
|
||||
In C, a function's _name_ is the address of the code block that makes up the function's body, and a C function is `extern` (global) by default. It is unsurprising how much C and assembly language resemble one another; indeed, C is portable assembly language.
|
||||
|
||||
* The `collatz` function expects one argument, which is implemented by the register `r1` to hold the user's input of an unsigned integer value (e.g., 9). This function updates register `r1` until it equals 1, keeping count of the steps involved with register `r0`, which thereby serves as the function's return value.
|
||||
|
||||
|
||||
|
||||
|
||||
An early and interesting code segment in `main` involves the call to the library function `scanf`, a high-level input function that scans a value from the standard input (by default, the keyboard) and converts this value to the desired data type, in this case, a 4-byte unsigned integer. Here is the code segment in full:
|
||||
|
||||
|
||||
```
|
||||
ldr r0, =format /* address of format string into r0 */
|
||||
ldr r1, =num /* address of num into r1 */
|
||||
bl [scanf][8] /* call scanf (bl = branch with link) */
|
||||
|
||||
ldr r1, =num /* address of num into r1 */
|
||||
ldr r1, [r1] /* value at the address into r1 */
|
||||
bl collatz /* call collatz with r1 as the argument */
|
||||
```
|
||||
|
||||
Two labels (addresses) are in play: `format` and `num`, both of which are defined in the `.data` section at the top of the program:
|
||||
|
||||
|
||||
```
|
||||
num: .int 0
|
||||
format: .asciz "%u"
|
||||
```
|
||||
|
||||
The label `num:` is the memory address of a 4-byte integer value, initialized to zero; the label `format:` points to a null-terminated (the "z" in "asciz" for zero) string `"%u"`, which specifies that the scanned input should be converted to an unsigned integer. Accordingly, the first two instructions in the code segment load the address of the format string (`=format`) into register `r0` and the address for the scanned number (`=num`) into register `r1`. Note that each label now starts with an equals sign ("assign address") and that the colon is dropped at the end of each label. The library function `scanf` can take an arbitrary number of arguments, but the first (which `scanf` expects in register `r0`) should be the "address" of a format string. In this example, the second argument to `scanf` is the "address" at which to save the scanned integer.
|
||||
|
||||
The last three instructions in the code segment highlight important assembly details. The first `ldr` instruction loads the _address_ of the memory-based integer (`=num`) into register `r1`. However, the `collatz` function expects the _value_ stored at this address, not the address itself; hence, the address is dereferenced to get the value:
|
||||
|
||||
|
||||
```
|
||||
ldr r1, =num /* load address into r1 */
|
||||
ldr r1, [r1] /* dereference to get value */
|
||||
```
|
||||
|
||||
The square brackets specify memory and `r1` holds a memory address. The expression `[r1]` thus evaluates to the _value_ stored in memory at address `r1`. The example underscores that registers can hold addresses and values stored at addresses: register `r1` first holds an address and then the value stored at this address.
|
||||
|
||||
When the `collatz` function returns to `main`, this function first performs a store operation:
|
||||
|
||||
|
||||
```
|
||||
ldr r3, =steps /* steps is a memory address */
|
||||
str r0, [r3] /* store r0 value at mem[r3] */
|
||||
```
|
||||
|
||||
The label `steps:` is from the `.data` section and register `r0` holds the steps computed in the `collatz` function. The `str` instruction thus saves to memory the length of the hailstone sequence. In a `ldr` instruction, the first operand (a register) is the _target_ for the load; but in a `str` operation, the first operand (also a register) is the _source_ for the store. In both cases, the second operand is a memory location.
|
||||
|
||||
Some additional work in `main` sets up the final report:
|
||||
|
||||
|
||||
```
|
||||
mov r2, r0 /* save count in r2 */
|
||||
ldr r1, =num /* recover user input */
|
||||
ldr r1, [r1] /* dereference r1 */
|
||||
ldr r0, =report /* r0 points to format string */
|
||||
bl [printf][7] /* print report */
|
||||
```
|
||||
|
||||
In the `collatz` function, register `r0` tracks how many steps are needed to reach 1 from the user's input, but the library function `printf` expects its first argument (the address of a format string) to be stored in register `r0`. The return value in register `r0` is therefore copied into register `r2` with the `mov` instruction. The address of the format string for `printf` is then stored in register `r0`.
|
||||
|
||||
The argument to the `collatz` function is the scanned input, which is stored in register `r1`; but this register is updated in the `collatz` loop unless the value happens to be 1 at the start. Accordingly, the address `num:` is again copied into `r1` and then dereferenced to get the user's original input. This value becomes the second argument to `printf`, the starting value of the hailstone sequence. With this setup in place, `main` calls `printf` with the `bl` ("branch with link") instruction.
|
||||
|
||||
At the very start of the `collatz` loop, the program checks whether the sequence has hit a 1:
|
||||
|
||||
|
||||
```
|
||||
cmp r1, #1
|
||||
beq collatz_end
|
||||
```
|
||||
|
||||
If register `r1` has 1 as its value, there is a branch (`beq` for "branch if equal") to the end of the `collatz` function, which means a return to its caller `main` with register `r0` as the return value—the number of steps in the hailstone sequence.
|
||||
|
||||
The `collatz` function introduces new features and opcodes, which illustrate how efficient assembly code can be. The assembly code, like the C code, checks for N's parity, with register `r1` as N:
|
||||
|
||||
|
||||
```
|
||||
and r2, r1, #1 /* r2 = r1 & 1 */
|
||||
cmp r2, #0 /* is the result even? */
|
||||
```
|
||||
|
||||
The result of the bitwise AND operation on register `r1` and 1 is stored in register `r2`. If the least-significant (rightmost) bit of register `r2` is a 1, then N (register `r1`) is odd, and otherwise, it is even. The result of this comparison (saved in the special-purpose register `cpsr`) is used automatically in forthcoming instructions such as `moveq` ("move if equal") and `addne` ("add if not equal").
|
||||
|
||||
The assembly code, like the C code, now avoids an explicit if-else construct. This code segment has the same effect as an if-else test, but the code is more efficient in that no branching is involved—the code executes in straight-line fashion because the conditional tests are built into the instruction opcodes:
|
||||
|
||||
|
||||
```
|
||||
moveq r1, r1, LSR #1 /* right-shift 1 bit if even */
|
||||
addne r1, r1, r1, LSL #1 /* left-shift 1 bit and add otherwise */
|
||||
addne r1, #1 /* add 1 for the + 1 in N = 3N + 1 */
|
||||
```
|
||||
|
||||
The `moveq` (`eq` for "if equal") instruction checks the outcome of the earlier `cmp` test, which determines whether the current value of register `r1` (N) is even or odd. If the value in register `r1` is even, this value must be updated to its half, which is done by a 1-bit right-shift (`LSR #1`). In general, right-shifting an integer is more efficient than explicitly dividing it by two. For example, suppose that register `r1` currently holds 4, whose least significant four bits are:
|
||||
|
||||
|
||||
```
|
||||
`...0100 ## 4 in binary`
|
||||
```
|
||||
|
||||
Shifting right by 1 bit yields:
|
||||
|
||||
|
||||
```
|
||||
`...0010 ## 2 in binary`
|
||||
```
|
||||
|
||||
The `LSR` stands for "logical shift right" and contrasts with `ASR` for "arithmetic shift right." An arithmetic shift is sign-preserving (most significant bit of 1 for negative and 0 for non-negative), whereas a logical shift is not, but the hailstone programs deal exclusively with _unsigned_ (hence, non-negative) values. In a logical shift, the shifted bits are replaced by zeros.
|
||||
|
||||
If register `r1` holds a value with odd parity, similar straight-line code occurs:
|
||||
|
||||
|
||||
```
|
||||
addne r1, r1, r1, LSL #1 /* r1 = r1 * 3 */
|
||||
addne r1, #1 /* r1 = r1 + 1 */
|
||||
```
|
||||
|
||||
The two `addne` instructions (`ne` for "if not equal") execute only if the earlier check for parity indicates an odd value. The first `addne` instruction does multiplication through a 1-bit left-shift and addition. In general, shifting and adding are more efficient than explicitly multiplying. The second `addne` then adds 1 to register `r1` so that the update is from N to 3N+1.
|
||||
|
||||
### Assembling the hstoneS program
|
||||
|
||||
The assembly source code for the hstoneS program needs to be translated ("assembled") into a binary _object module_, which is then linked with appropriate libraries to become executable. The simplest approach is to use the GNU C compiler in the same way as it is used to compile a C program such as hstoneC:
|
||||
|
||||
|
||||
```
|
||||
`% gcc -o hstoneS hstoneS.s`
|
||||
```
|
||||
|
||||
This command does the assembling and linking.
|
||||
|
||||
A slightly more efficient approach is to use the _as_ utility that ships with the GNU toolset. This approach separates the assembling and the linking. Here is the assembling step:
|
||||
|
||||
|
||||
```
|
||||
`% as -o hstoneS.o hstoneS.s ## assemble`
|
||||
```
|
||||
|
||||
The extension `.o` is traditional for object modules. The system utility _ld_ then could be used for the linking, but an easier and equally efficient approach is to revert to the _gcc_ command:
|
||||
|
||||
|
||||
```
|
||||
`% gcc -o hstoneS hstoneS.o ## link`
|
||||
```
|
||||
|
||||
This approach highlights again that the C compiler handles any mix of C and assembly, whether source files or object modules.
|
||||
|
||||
### Wrapping up with an explicit system call
|
||||
|
||||
The two hailstone programs use the high-level input/output functions `scanf` and `printf`. These functions are high-level in that they deal with formatted types (in this case, unsigned integers) rather than with raw bytes. In an embedded system, however, these functions might not be available; the low-level input/output functions `read` and `write`, which ultimately implement their high-level counterparts, then would be used instead. These two system functions are low-level in that they work with raw bytes.
|
||||
|
||||
In Arm6 assembly, a program explicitly calls a system function such as `write` in an indirect manner—by invoking one of the aforementioned functions `svc` or `syscall`, for example:
|
||||
|
||||
|
||||
```
|
||||
calls calls
|
||||
program------->svc------->write
|
||||
```
|
||||
|
||||
The integer identifier for a particular system function (e.g., 4 identifies `write`) goes into the appropriate register (register `r7` for `svc` and register `r0` for `syscall`). The code segments below illustrate, first with `svc` and then with `syscall`.
|
||||
|
||||
The two code segments write the traditional greeting to the standard output, which is the screen by default. The standard output has a _file descriptor_, a non-negative integer value that identifies it. The three predefined descriptors are:
|
||||
|
||||
|
||||
```
|
||||
standard input: 0 (keyboard by default)
|
||||
standard output: 1 (screen by default)
|
||||
standard error: 2 (screen by default)
|
||||
```
|
||||
|
||||
Here is the code segment for a sample system call with `svc`:
|
||||
|
||||
|
||||
```
|
||||
msg: .asciz "Hello, world!\n" /* greeting */
|
||||
...
|
||||
mov r0, #1 /* 1 = standard output */
|
||||
ldr r1, =msg /* address of bytes to write */
|
||||
mov r2, #14 /* message length (in bytes) */
|
||||
mov r7, #4 /* write has 4 as an id */
|
||||
svc #0 /* system call to write */
|
||||
```
|
||||
|
||||
The function `write` takes three arguments and, when called via `svc`, the function's arguments go into the following registers:
|
||||
|
||||
* `r0` holds the target for the write operation, in this case, the standard output (`#1`).
|
||||
* `r1` has the address of the byte(s) to write (`=msg`).
|
||||
* `r2` specifies how many bytes are to be written (`#14`).
|
||||
|
||||
|
||||
|
||||
In the case of the `svc` instruction, register `r7` identifies, with a non-negative integer (in this case, `#4`), which system function to call. The `svc` call returns zero (the `#0`) to signal success but usually a negative value to signal an error.
|
||||
|
||||
The `syscall` and `svc` functions differ in detail, but using either to invoke a system function requires the same two steps:
|
||||
|
||||
* Specify the system function to be called (in `r7` for `svc`, in `r0` for `syscall`).
|
||||
* Put the arguments for the system function in the appropriate registers, which differ between the `svc` and `syscall` variants.
|
||||
|
||||
|
||||
|
||||
Here is the `syscall` example of invoking the `write` function:
|
||||
|
||||
|
||||
```
|
||||
msg: .asciz "Hello, world!\n" /* greeting */
|
||||
...
|
||||
mov r1, #1 /* standard output */
|
||||
ldr r2, =msg /* address of message */
|
||||
mov r3, #14 /* byte count */
|
||||
mov r0, #4 /* identifier for write */
|
||||
syscall
|
||||
```
|
||||
|
||||
C has a thin wrapper not only for the `syscall` function but for the system functions `read` and `write` as well. The C wrapper for `syscall` gives the gist at a high level:
|
||||
|
||||
|
||||
```
|
||||
syscall(SYS_write, /* 4 is the id for write */
|
||||
STDOUT_FILENO, /* 1 is the standard output */
|
||||
"Hello, world!\n", /* message */
|
||||
14); /* byte length */
|
||||
```
|
||||
|
||||
The direct approach in C uses the wrapper for the system `write` function:
|
||||
|
||||
|
||||
```
|
||||
`write(STDOUT_FILENO, "Hello, world!\n", 14);`
|
||||
```
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/20/10/arm6-assembly-language
|
||||
|
||||
作者:[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://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/LAW-Internet_construction_9401467_520x292_0512_dc.png?itok=RPkPPtDe (An intersection of pipes.)
|
||||
[2]: https://www.arm.com/
|
||||
[3]: https://condor.depaul.edu/mkalin
|
||||
[4]: https://opensource.com/article/19/8/webassembly-speed-code-reuse
|
||||
[5]: https://plus.maths.org/content/mathematical-mysteries-hailstone-sequences
|
||||
[6]: https://en.wikipedia.org/wiki/Collatz_conjecture
|
||||
[7]: http://www.opengroup.org/onlinepubs/009695399/functions/printf.html
|
||||
[8]: http://www.opengroup.org/onlinepubs/009695399/functions/scanf.html
|
||||
[9]: https://en.wikipedia.org/wiki/Endianness
|
@ -0,0 +1,369 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: ( )
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
[#]: subject: (Managing resources with cgroups in systemd)
|
||||
[#]: via: (https://opensource.com/article/20/10/cgroups)
|
||||
[#]: author: (David Both https://opensource.com/users/dboth)
|
||||
|
||||
Managing resources with cgroups in systemd
|
||||
======
|
||||
Cgroups manage resources per application rather than by the individual
|
||||
processes that make up an application.
|
||||
![Business woman on laptop sitting in front of window][1]
|
||||
|
||||
There is little more frustrating to me as a sysadmin than unexpectedly running out of a computing resource. On more than one occasion, I have filled all available disk space in a partition, run out of RAM, and not had enough CPU time to perform my tasks in a reasonable amount of time. Resource management is one of the most important tasks that sysadmins do.
|
||||
|
||||
The point of resource management is to ensure that all processes have relatively equal access to the system resources they need. Resource management also involves ensuring that RAM, hard drive space, and CPU capacity are added when necessary or rationed when that is not possible. In addition, users who hog system resources, whether intentionally or accidentally, should be prevented from doing so.
|
||||
|
||||
There are tools that enable sysadmins to monitor and manage various system resources. For example, [top][2] and similar tools allow you to monitor the use of memory, I/O, storage (disk, SSD, etc.), network, swap space, CPU usage, and more. These tools, particularly those that are CPU-centric, are mostly based on the paradigm that the running process is the unit of control. At best, they provide a way to adjust the nice number–and through that, the priority—or to kill a running process. (For information about nice numbers, see [_Monitoring Linux and Windows hosts with Glances_][3].)
|
||||
|
||||
Other tools based on traditional resource management in a SystemV environment are managed by the `/etc/security/limits.conf` file and the local configuration files located in the `/etc/security/limits.d` directory. Resources can be limited in a fairly crude but useful manner by user or group. Resources that can be managed include various aspects of RAM, total CPU time per day, total amount of data, priority, nice number, number of concurrent logins, number of processes, maximum file size, and more.
|
||||
|
||||
### Using cgroups for process management
|
||||
|
||||
One major difference between [systemd and SystemV][4] is how they handle processes. SystemV treats each process as an entity unto itself. systemd collects related processes into control groups, called [cgroups][5] (short for control groups), and manages system resources for the cgroup as a whole. This means resources can be managed per application rather than by the individual processes that make up an application.
|
||||
|
||||
The control units for cgroups are called slice units. Slices are a conceptualization that allows systemd to order processes in a tree format for ease of management.
|
||||
|
||||
### Viewing cgroups
|
||||
|
||||
I'll start with some commands that allow you to view various types of information about cgroups. The `systemctl status <service>` command displays slice information about a specified service, including its slice. This example shows the `at` daemon:
|
||||
|
||||
|
||||
```
|
||||
[root@testvm1 ~]# systemctl status atd.service
|
||||
● atd.service - Deferred execution scheduler
|
||||
Loaded: loaded (/usr/lib/systemd/system/atd.service; enabled; vendor preset: enabled)
|
||||
Active: active (running) since Wed 2020-09-23 12:18:24 EDT; 1 day 3h ago
|
||||
Docs: man:atd(8)
|
||||
Main PID: 1010 (atd)
|
||||
Tasks: 1 (limit: 14760)
|
||||
Memory: 440.0K
|
||||
CPU: 5ms
|
||||
CGroup: /system.slice/atd.service
|
||||
└─1010 /usr/sbin/atd -f
|
||||
|
||||
Sep 23 12:18:24 testvm1.both.org systemd[1]: Started Deferred execution scheduler.
|
||||
[root@testvm1 ~]#
|
||||
```
|
||||
|
||||
This is an excellent example of one reason that I find systemd more usable than SystemV and the old init program. There is so much more information here than SystemV could provide. The cgroup entry includes the hierarchical structure where the `system.slice` is systemd (PID 1), and the `atd.service` is one level below and part of the `system.slice`. The second line of the cgroup entry also shows the process ID (PID) and the command used to start the daemon.
|
||||
|
||||
The `systemctl` command shows multiple cgroup entries. The `--all` option shows all slices, including those that are not currently active:
|
||||
|
||||
|
||||
```
|
||||
[root@testvm1 ~]# systemctl -t slice --all
|
||||
UNIT LOAD ACTIVE SUB DESCRIPTION
|
||||
-.slice loaded active active Root Slice
|
||||
system-getty.slice loaded active active system-getty.slice
|
||||
system-lvm2\x2dpvscan.slice loaded active active system-lvm2\x2dpvscan.slice
|
||||
system-modprobe.slice loaded active active system-modprobe.slice
|
||||
system-sshd\x2dkeygen.slice loaded active active system-sshd\x2dkeygen.slice
|
||||
system-systemd\x2dcoredump.slice loaded inactive dead system-systemd\x2dcoredump.slice
|
||||
system-systemd\x2dfsck.slice loaded active active system-systemd\x2dfsck.slice
|
||||
system.slice loaded active active System Slice
|
||||
user-0.slice loaded active active User Slice of UID 0
|
||||
user-1000.slice loaded active active User Slice of UID 1000
|
||||
user.slice loaded active active User and Session Slice
|
||||
|
||||
LOAD = Reflects whether the unit definition was properly loaded.
|
||||
ACTIVE = The high-level unit activation state, i.e. generalization of SUB.
|
||||
SUB = The low-level unit activation state, values depend on unit type.
|
||||
|
||||
11 loaded units listed.
|
||||
To show all installed unit files use 'systemctl list-unit-files'.
|
||||
[root@testvm1 ~]#
|
||||
```
|
||||
|
||||
The first thing to notice about this data is that it shows user slices for UIDs 0 (root) and 1000, which is my user login. This shows only the slices and not the services that are part of each slice. This data shows that a slice is created for each user at the time they log in. This can provide a way to manage all of a user's tasks as a single cgroup entity.
|
||||
|
||||
### Explore the cgroup hierarchy
|
||||
|
||||
All is well and good so far, but cgroups are hierarchical, and all of the service units run as members of one of the cgroups. Viewing that hierarchy is easy and uses one old command and one new one that is part of systemd.
|
||||
|
||||
The `ps` command can be used to map the processes and their locations in the cgroup hierarchy. Note that it is necessary to specify the desired data columns when using the `ps` command. I significantly reduced the volume of output from this command below, but I tried to leave enough so you can get a feel for what you might find on your systems:
|
||||
|
||||
|
||||
```
|
||||
[root@testvm1 ~]# ps xawf -eo pid,user,cgroup,args
|
||||
PID USER CGROUP COMMAND
|
||||
2 root - [kthreadd]
|
||||
3 root - \\_ [rcu_gp]
|
||||
4 root - \\_ [rcu_par_gp]
|
||||
6 root - \\_ [kworker/0:0H-kblockd]
|
||||
9 root - \\_ [mm_percpu_wq]
|
||||
10 root - \\_ [ksoftirqd/0]
|
||||
11 root - \\_ [rcu_sched]
|
||||
12 root - \\_ [migration/0]
|
||||
13 root - \\_ [cpuhp/0]
|
||||
14 root - \\_ [cpuhp/1]
|
||||
<SNIP>
|
||||
625406 root - \\_ [kworker/3:0-ata_sff]
|
||||
625409 root - \\_ [kworker/u8:0-events_unbound]
|
||||
1 root 0::/init.scope /usr/lib/systemd/systemd --switched-root --system --deserialize 30
|
||||
588 root 0::/system.slice/systemd-jo /usr/lib/systemd/systemd-journald
|
||||
599 root 0::/system.slice/systemd-ud /usr/lib/systemd/systemd-udevd
|
||||
741 root 0::/system.slice/auditd.ser /sbin/auditd
|
||||
743 root 0::/system.slice/auditd.ser \\_ /usr/sbin/sedispatch
|
||||
764 root 0::/system.slice/ModemManag /usr/sbin/ModemManager
|
||||
765 root 0::/system.slice/NetworkMan /usr/sbin/NetworkManager --no-daemon
|
||||
767 root 0::/system.slice/irqbalance /usr/sbin/irqbalance --foreground
|
||||
779 root 0::/system.slice/mcelog.ser /usr/sbin/mcelog --ignorenodev --daemon --foreground
|
||||
781 root 0::/system.slice/rngd.servi /sbin/rngd -f
|
||||
782 root 0::/system.slice/rsyslog.se /usr/sbin/rsyslogd -n
|
||||
<SNIP>
|
||||
893 root 0::/system.slice/sshd.servi sshd: /usr/sbin/sshd -D [listener] 0 of 10-100 startups
|
||||
1130 root 0::/user.slice/user-0.slice \\_ sshd: root [priv]
|
||||
1147 root 0::/user.slice/user-0.slice | \\_ sshd: root@pts/0
|
||||
1148 root 0::/user.slice/user-0.slice | \\_ -bash
|
||||
1321 root 0::/user.slice/user-0.slice | \\_ screen
|
||||
1322 root 0::/user.slice/user-0.slice | \\_ SCREEN
|
||||
1323 root 0::/user.slice/user-0.slice | \\_ /bin/bash
|
||||
498801 root 0::/user.slice/user-0.slice | | \\_ man systemd.resource-control
|
||||
498813 root 0::/user.slice/user-0.slice | | \\_ less
|
||||
1351 root 0::/user.slice/user-0.slice | \\_ /bin/bash
|
||||
123293 root 0::/user.slice/user-0.slice | | \\_ man systemd.slice
|
||||
123305 root 0::/user.slice/user-0.slice | | \\_ less
|
||||
1380 root 0::/user.slice/user-0.slice | \\_ /bin/bash
|
||||
625412 root 0::/user.slice/user-0.slice | | \\_ ps xawf -eo pid,user,cgroup,args
|
||||
625413 root 0::/user.slice/user-0.slice | | \\_ less
|
||||
246795 root 0::/user.slice/user-0.slice | \\_ /bin/bash
|
||||
625338 root 0::/user.slice/user-0.slice | \\_ /usr/bin/mc -P /var/tmp/mc-root/mc.pwd.246795
|
||||
625340 root 0::/user.slice/user-0.slice | \\_ bash -rcfile .bashrc
|
||||
1218 root 0::/user.slice/user-1000.sl \\_ sshd: dboth [priv]
|
||||
1233 dboth 0::/user.slice/user-1000.sl \\_ sshd: dboth@pts/1
|
||||
1235 dboth 0::/user.slice/user-1000.sl \\_ -bash
|
||||
<SNIP>
|
||||
1010 root 0::/system.slice/atd.servic /usr/sbin/atd -f
|
||||
1011 root 0::/system.slice/crond.serv /usr/sbin/crond -n
|
||||
1098 root 0::/system.slice/lxdm.servi /usr/sbin/lxdm-binary
|
||||
1106 root 0::/system.slice/lxdm.servi \\_ /usr/libexec/Xorg -background none :0 vt01 -nolisten tcp -novtswitch -auth /var/run/lxdm/lxdm-:0.auth
|
||||
370621 root 0::/user.slice/user-1000.sl \\_ /usr/libexec/lxdm-session
|
||||
370631 dboth 0::/user.slice/user-1000.sl \\_ xfce4-session
|
||||
370841 dboth 0::/user.slice/user-1000.sl \\_ /usr/bin/ssh-agent /bin/sh -c exec -l bash -c "/usr/bin/startxfce4"
|
||||
370911 dboth 0::/user.slice/user-1000.sl \\_ xfwm4 --display :0.0 --sm-client-id 2dead44ab-0b4d-4101-bca4-e6771f4a8ac2
|
||||
370930 dboth 0::/user.slice/user-1000.sl \\_ xfce4-panel --display :0.0 --sm-client-id 2ce38b8ef-86fd-4189-ace5-deec1d0e0952
|
||||
370942 dboth 0::/user.slice/user-1000.sl | \\_ /usr/lib64/xfce4/panel/wrapper-2.0 /usr/lib64/xfce4/panel/plugins/libsystray.so 6 23068680 systr
|
||||
ay Notification Area Area where notification icons appear
|
||||
370943 dboth 0::/user.slice/user-1000.sl | \\_ /usr/lib64/xfce4/panel/wrapper-2.0 /usr/lib64/xfce4/panel/plugins/libpulseaudio-plugin.so 8 2306
|
||||
8681 pulseaudio PulseAudio Plugin Adjust the audio volume of the PulseAudio sound system
|
||||
370944 dboth 0::/user.slice/user-1000.sl | \\_ /usr/lib64/xfce4/panel/wrapper-2.0 /usr/lib64/xfce4/panel/plugins/libxfce4powermanager.so 9 2306
|
||||
8682 power-manager-plugin Power Manager Plugin Display the battery levels of your devices and control the brightness of your display
|
||||
370945 dboth 0::/user.slice/user-1000.sl | \\_ /usr/lib64/xfce4/panel/wrapper-2.0 /usr/lib64/xfce4/panel/plugins/libnotification-plugin.so 10 2
|
||||
3068683 notification-plugin Notification Plugin Notification plugin for the Xfce panel
|
||||
370948 dboth 0::/user.slice/user-1000.sl | \\_ /usr/lib64/xfce4/panel/wrapper-2.0 /usr/lib64/xfce4/panel/plugins/libactions.so 14 23068684 acti
|
||||
ons Action Buttons Log out, lock or other system actions
|
||||
370934 dboth 0::/user.slice/user-1000.sl \\_ Thunar --sm-client-id 2cfc809d8-4e1d-497a-a5c5-6e4fa509c3fb --daemon
|
||||
370939 dboth 0::/user.slice/user-1000.sl \\_ xfdesktop --display :0.0 --sm-client-id 299be0608-4dca-4055-b4d6-55ec6e73a324
|
||||
370962 dboth 0::/user.slice/user-1000.sl \\_ nm-applet
|
||||
<SNIP>
|
||||
```
|
||||
|
||||
You can view the entire hierarchy with the `systemd-cgls` command, which is a bit simpler because it does not require any complex options.
|
||||
|
||||
I have shortened this tree view considerably. as well, but I left enough to give you some idea of the amount of data as well as the types of entries you should see when you do this on your system. I did this on one of my virtual machines, and it is about 200 lines long; the amount of data from my primary workstation is about 250 lines:
|
||||
|
||||
|
||||
```
|
||||
[root@testvm1 ~]# systemd-cgls
|
||||
Control group /:
|
||||
-.slice
|
||||
├─user.slice
|
||||
│ ├─user-0.slice
|
||||
│ │ ├─session-1.scope
|
||||
│ │ │ ├─ 1130 sshd: root [priv]
|
||||
│ │ │ ├─ 1147 sshd: root@pts/0
|
||||
│ │ │ ├─ 1148 -bash
|
||||
│ │ │ ├─ 1321 screen
|
||||
│ │ │ ├─ 1322 SCREEN
|
||||
│ │ │ ├─ 1323 /bin/bash
|
||||
│ │ │ ├─ 1351 /bin/bash
|
||||
│ │ │ ├─ 1380 /bin/bash
|
||||
│ │ │ ├─123293 man systemd.slice
|
||||
│ │ │ ├─123305 less
|
||||
│ │ │ ├─246795 /bin/bash
|
||||
│ │ │ ├─371371 man systemd-cgls
|
||||
│ │ │ ├─371383 less
|
||||
│ │ │ ├─371469 systemd-cgls
|
||||
│ │ │ └─371470 less
|
||||
│ │ └─[user@0.service][6] …
|
||||
│ │ ├─dbus-broker.service
|
||||
│ │ │ ├─1170 /usr/bin/dbus-broker-launch --scope user
|
||||
│ │ │ └─1171 dbus-broker --log 4 --controller 12 --machine-id 3bccd1140fca488187f8a1439c832f07 --max-bytes 100000000000000 --max-fds 25000000000000 --max->
|
||||
│ │ ├─gvfs-daemon.service
|
||||
│ │ │ └─1173 /usr/libexec/gvfsd
|
||||
│ │ └─init.scope
|
||||
│ │ ├─1137 /usr/lib/systemd/systemd --user
|
||||
│ │ └─1138 (sd-pam)
|
||||
│ └─user-1000.slice
|
||||
│ ├─[user@1000.service][7] …
|
||||
│ │ ├─dbus\x2d:1.2\x2dorg.xfce.Xfconf.slice
|
||||
│ │ │ └─dbus-:[1.2-org.xfce.Xfconf@0.service][8]
|
||||
│ │ │ └─370748 /usr/lib64/xfce4/xfconf/xfconfd
|
||||
│ │ ├─dbus\x2d:1.2\x2dca.desrt.dconf.slice
|
||||
│ │ │ └─dbus-:[1.2-ca.desrt.dconf@0.service][9]
|
||||
│ │ │ └─371262 /usr/libexec/dconf-service
|
||||
│ │ ├─dbus-broker.service
|
||||
│ │ │ ├─1260 /usr/bin/dbus-broker-launch --scope user
|
||||
│ │ │ └─1261 dbus-broker --log 4 --controller 11 --machine-id
|
||||
<SNIP>
|
||||
│ │ └─gvfs-mtp-volume-monitor.service
|
||||
│ │ └─370987 /usr/libexec/gvfs-mtp-volume-monitor
|
||||
│ ├─session-3.scope
|
||||
│ │ ├─1218 sshd: dboth [priv]
|
||||
│ │ ├─1233 sshd: dboth@pts/1
|
||||
│ │ └─1235 -bash
|
||||
│ └─session-7.scope
|
||||
│ ├─370621 /usr/libexec/lxdm-session
|
||||
│ ├─370631 xfce4-session
|
||||
│ ├─370805 /usr/bin/VBoxClient --clipboard
|
||||
│ ├─370806 /usr/bin/VBoxClient --clipboard
|
||||
│ ├─370817 /usr/bin/VBoxClient --seamless
|
||||
│ ├─370818 /usr/bin/VBoxClient --seamless
|
||||
│ ├─370824 /usr/bin/VBoxClient --draganddrop
|
||||
│ ├─370825 /usr/bin/VBoxClient --draganddrop
|
||||
│ ├─370841 /usr/bin/ssh-agent /bin/sh -c exec -l bash -c "/usr/bin/startxfce4"
|
||||
│ ├─370910 /bin/gpg-agent --sh --daemon --write-env-file /home/dboth/.cache/gpg-agent-info
|
||||
│ ├─370911 xfwm4 --display :0.0 --sm-client-id 2dead44ab-0b4d-4101-bca4-e6771f4a8ac2
|
||||
│ ├─370923 xfsettingsd --display :0.0 --sm-client-id 261b4a437-3029-461c-9551-68c2c42f4fef
|
||||
│ ├─370930 xfce4-panel --display :0.0 --sm-client-id 2ce38b8ef-86fd-4189-ace5-deec1d0e0952
|
||||
│ ├─370934 Thunar --sm-client-id 2cfc809d8-4e1d-497a-a5c5-6e4fa509c3fb --daemon
|
||||
│ ├─370939 xfdesktop --display :0.0 --sm-client-id 299be0608-4dca-4055-b4d6-55ec6e73a324
|
||||
<SNIP>
|
||||
└─system.slice
|
||||
├─rngd.service
|
||||
│ └─1650 /sbin/rngd -f
|
||||
├─irqbalance.service
|
||||
│ └─1631 /usr/sbin/irqbalance --foreground
|
||||
├─fprintd.service
|
||||
│ └─303383 /usr/libexec/fprintd
|
||||
├─systemd-udevd.service
|
||||
│ └─956 /usr/lib/systemd/systemd-udevd
|
||||
<SNIP>
|
||||
├─systemd-journald.service
|
||||
│ └─588 /usr/lib/systemd/systemd-journald
|
||||
├─atd.service
|
||||
│ └─1010 /usr/sbin/atd -f
|
||||
├─system-dbus\x2d:1.10\x2dorg.freedesktop.problems.slice
|
||||
│ └─dbus-:[1.10-org.freedesktop.problems@0.service][10]
|
||||
│ └─371197 /usr/sbin/abrt-dbus -t133
|
||||
├─sshd.service
|
||||
│ └─893 sshd: /usr/sbin/sshd -D [listener] 0 of 10-100 startups
|
||||
├─vboxservice.service
|
||||
│ └─802 /usr/sbin/VBoxService -f
|
||||
├─crond.service
|
||||
│ └─1011 /usr/sbin/crond -n
|
||||
├─NetworkManager.service
|
||||
│ └─765 /usr/sbin/NetworkManager --no-daemon
|
||||
├─switcheroo-control.service
|
||||
│ └─787 /usr/libexec/switcheroo-control
|
||||
<SNIP>
|
||||
```
|
||||
|
||||
This tree view shows all of the user and system slices and the services and programs running in each cgroup. Notice the units called "scopes," which group related programs into a management unit, within the `user-1000.slice` in the listing above. The `user-1000.slice/session-7.scope` cgroup contains the GUI desktop program hierarchy, starting with the LXDM display manager session and all of its subtasks, including things like the Bash shell and the Thunar GUI file manager.
|
||||
|
||||
Scope units are not defined in configuration files but are generated programmatically as the result of starting groups of related programs. Scope units do not create or start the processes running as part of that cgroup. All processes within the scope are equal, and there is no internal hierarchy. The life of a scope begins when the first process is created and ends when the last process is destroyed.
|
||||
|
||||
Open several windows on your desktop, such as terminal emulators, LibreOffice, or whatever you want, then switch to an available virtual console and start something like `top` or [Midnight Commander][11]. Run the `systemd-cgls` command on your host, and take note of the overall hierarchy and the scope units.
|
||||
|
||||
The `systemd-cgls` command provides a more complete representation of the cgroup hierarchy (and details of the units that make it up) than any other command I have found. I prefer its cleaner representation of the tree than what the `ps` command provides.
|
||||
|
||||
### With a little help from my friends
|
||||
|
||||
After covering these basics, I had planned to go into more detail about cgroups and how to use them, but I discovered a series of four excellent articles by Red Hat's [Steve Ovens][12] on Opensource.com's sister site [Enable Sysadmin][13]. Rather then basically rewriting Steve's articles, I decided it would be much better to take advantage of his cgroup expertise by linking to them:
|
||||
|
||||
1. [A Linux sysadmin's introduction to cgroups][14]
|
||||
2. [How to manage cgroups with CPUShares][15]
|
||||
3. [Managing cgroups the hard way—manually][16]
|
||||
4. [Managing cgroups with systemd][17]
|
||||
|
||||
|
||||
|
||||
Enjoy and learn from them, as I did.
|
||||
|
||||
### Other resources
|
||||
|
||||
There is a great deal of information about systemd available on the internet, but much is terse, obtuse, or even misleading. In addition to the resources mentioned in this article, the following webpages offer more detailed and reliable information about systemd startup. This list has grown since I started this series of articles to reflect the research I have done.
|
||||
|
||||
* The Fedora Project has a good, practical [guide][18] [to systemd][18]. It has pretty much everything you need to know in order to configure, manage, and maintain a Fedora computer using systemd.
|
||||
* The Fedora Project also has a good [cheat sheet][19] that cross-references the old SystemV commands to comparable systemd ones.
|
||||
* The [systemd.unit(5) manual page][20] contains a nice list of unit file sections and their configuration options along with concise descriptions of each.
|
||||
* Red Hat documentation contains a good description of the [Unit file structure][21] as well as other important information.
|
||||
* For detailed technical information about systemd and the reasons for creating it, check out Freedesktop.org's [description of systemd][22]. This page is one of the best I have found because it contains many links to other important and accurate documentation.
|
||||
* Linux.com's "More systemd fun" offers more advanced systemd [information and tips][23].
|
||||
* See the man page for [systemd.resource-control(5)][24].
|
||||
* In [_The Linux kernel user's and administrator's guide_][25], see the [Control Group v2][26] entry.
|
||||
|
||||
|
||||
|
||||
There is also a series of deeply technical articles for Linux sysadmins by Lennart Poettering, the designer and primary developer of systemd. These articles were written between April 2010 and September 2011, but they are just as relevant now as they were then. Much of everything else good that has been written about systemd and its ecosystem is based on these papers.
|
||||
|
||||
* [Rethinking PID 1][27]
|
||||
* [systemd for Administrators, Part I][28]
|
||||
* [systemd for Administrators, Part II][29]
|
||||
* [systemd for Administrators, Part III][30]
|
||||
* [systemd for Administrators, Part IV][31]
|
||||
* [systemd for Administrators, Part V][32]
|
||||
* [systemd for Administrators, Part VI][33]
|
||||
* [systemd for Administrators, Part VII][34]
|
||||
* [systemd for Administrators, Part VIII][35]
|
||||
* [systemd for Administrators, Part IX][36]
|
||||
* [systemd for Administrators, Part X][37]
|
||||
* [systemd for Administrators, Part XI][38]
|
||||
|
||||
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/20/10/cgroups
|
||||
|
||||
作者:[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://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/lenovo-thinkpad-laptop-concentration-focus-windows-office.png?itok=-8E2ihcF (Woman using laptop concentrating)
|
||||
[2]: https://en.wikipedia.org/wiki/Top_(software)
|
||||
[3]: https://opensource.com/article/19/11/monitoring-linux-glances
|
||||
[4]: https://opensource.com/article/20/4/systemd
|
||||
[5]: https://en.wikipedia.org/wiki/Cgroups
|
||||
[6]: mailto:user@0.service
|
||||
[7]: mailto:user@1000.service
|
||||
[8]: mailto:1.2-org.xfce.Xfconf@0.service
|
||||
[9]: mailto:1.2-ca.desrt.dconf@0.service
|
||||
[10]: mailto:1.10-org.freedesktop.problems@0.service
|
||||
[11]: https://midnight-commander.org/
|
||||
[12]: https://www.redhat.com/sysadmin/users/steve-ovens
|
||||
[13]: https://www.redhat.com/sysadmin/
|
||||
[14]: https://www.redhat.com/sysadmin/cgroups-part-one
|
||||
[15]: https://www.redhat.com/sysadmin/cgroups-part-two
|
||||
[16]: https://www.redhat.com/sysadmin/cgroups-part-three
|
||||
[17]: https://www.redhat.com/sysadmin/cgroups-part-four
|
||||
[18]: https://docs.fedoraproject.org/en-US/quick-docs/understanding-and-administering-systemd/index.html
|
||||
[19]: https://fedoraproject.org/wiki/SysVinit_to_Systemd_Cheatsheet
|
||||
[20]: https://man7.org/linux/man-pages/man5/systemd.unit.5.html
|
||||
[21]: https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/8/html/configuring_basic_system_settings/managing-services-with-systemd_configuring-basic-system-settings#Managing_Services_with_systemd-Unit_File_Structure
|
||||
[22]: https://www.freedesktop.org/wiki/Software/systemd/
|
||||
[23]: https://www.linux.com/training-tutorials/more-systemd-fun-blame-game-and-stopping-services-prejudice/
|
||||
[24]: https://man7.org/linux/man-pages/man5/systemd.resource-control.5.html
|
||||
[25]: https://www.kernel.org/doc/html/latest/admin-guide/index.html
|
||||
[26]: https://www.kernel.org/doc/html/latest/admin-guide/cgroup-v2.html
|
||||
[27]: http://0pointer.de/blog/projects/systemd.html
|
||||
[28]: http://0pointer.de/blog/projects/systemd-for-admins-1.html
|
||||
[29]: http://0pointer.de/blog/projects/systemd-for-admins-2.html
|
||||
[30]: http://0pointer.de/blog/projects/systemd-for-admins-3.html
|
||||
[31]: http://0pointer.de/blog/projects/systemd-for-admins-4.html
|
||||
[32]: http://0pointer.de/blog/projects/three-levels-of-off.html
|
||||
[33]: http://0pointer.de/blog/projects/changing-roots
|
||||
[34]: http://0pointer.de/blog/projects/blame-game.html
|
||||
[35]: http://0pointer.de/blog/projects/the-new-configuration-files.html
|
||||
[36]: http://0pointer.de/blog/projects/on-etc-sysinit.html
|
||||
[37]: http://0pointer.de/blog/projects/instances.html
|
||||
[38]: http://0pointer.de/blog/projects/inetd.html
|
121
sources/tech/20201102 4 reasons why JavaScript is so popular.md
Normal file
121
sources/tech/20201102 4 reasons why JavaScript is so popular.md
Normal file
@ -0,0 +1,121 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: ( )
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
[#]: subject: (4 reasons why JavaScript is so popular)
|
||||
[#]: via: (https://opensource.com/article/20/11/javascript-popular)
|
||||
[#]: author: (Nimisha Mukherjee https://opensource.com/users/nimisha)
|
||||
|
||||
4 reasons why JavaScript is so popular
|
||||
======
|
||||
There are good reasons why JavaScript is consistently among the top
|
||||
programming languages.
|
||||
![JavaScript in Vim][1]
|
||||
|
||||
As this chart from GitHub's _[State of the Octoverse][2]_ report shows, [JavaScript][3] has consistently been most popular programming language based on the number of contributors to projects on GitHub.
|
||||
|
||||
![Top Languages from The State of the Octoverse report][4]
|
||||
|
||||
Top languages, per The State of the Octoverse (© 2019, [GitHub Corp][2])
|
||||
|
||||
In the [previous article][5] in this series, I dove into the history of JavaScript. In this article, I'll share four of [the reasons][6] it is so popular.
|
||||
|
||||
### 1\. JavaScript caters to beginner, intermediate, and advanced developers
|
||||
|
||||
JavaScript does not need any environment setup; just open a browser, like Chrome, navigate to [Developer Tools][7], and start coding. Writing a "Hello World" program is as simple as:
|
||||
|
||||
|
||||
```
|
||||
`console.log("Hello World");`
|
||||
```
|
||||
|
||||
JavaScript's flexibility is best suited for intermediate developers. The language just helps get things done by letting the developer focus on solving the problem. Developers can use a mix of plugins and their own code snippets to get an application working.
|
||||
|
||||
While JavaScript is relatively easy to get started with, it is not straightforward to master. If you want to get to an advanced level, here are some of the concepts you need to know:
|
||||
|
||||
* **JavaScript's [multi-paradigm][8] nature:** JavaScript supports both functional programming and object-oriented programming (OOP).
|
||||
* **Applying [design patterns][9] in JavaScript:** The model-view-* ([MV*][10]) design patterns have been among the most popular and have led to the development of [several modern frameworks][11].
|
||||
* **[Inheritance with prototype chain][12]:** JavaScript cannot implement OOP in the traditional Java class-based model due to its dynamic nature. OOP in JavaScript is achieved through the prototypal inheritance model.
|
||||
* **[Closures][13]:** A closure gives access to an outer function's scope from an inner function.
|
||||
* **[Currying][14]:** Currying is a transformation of functions that translates a function from callable as f(a, b, c) into callable as f(a)(b)(c).
|
||||
* **[Promises][15] and [Observables][16]:** These help you work with asynchronous functions.
|
||||
* **[TypeScript][17]:** This adds static typing to JavaScript.
|
||||
|
||||
|
||||
|
||||
### 2\. Omni-platform
|
||||
|
||||
JavaScript can run everywhere, including:
|
||||
|
||||
* Devices like mobiles, tablets, and laptops
|
||||
* On the client-side as well as the server-side
|
||||
|
||||
|
||||
|
||||
This ability to run everywhere makes JavaScript a universal language.
|
||||
|
||||
### 3\. Open standards and community
|
||||
|
||||
[ECMAScript][18] is the standardized version of JavaScript as well as an open standard language. Companies can use ECMAScript to create a JavaScript implementation. According to [Wikipedia][19], "an ECMAScript engine is a program that executes source code written in a version of the ECMAScript language standard, for example, JavaScript." The most popular engines, [V8][20] and [SpiderMonkey][21], are open source projects.
|
||||
|
||||
JavaScript has been around for 25 years and has a vast community behind it. A developer is spoiled for choice. The community has built so many plugins and frameworks that the phrase "[framework fatigue][22]" was coined.
|
||||
|
||||
### 4\. Modern frameworks
|
||||
|
||||
Modern frameworks like [React][23], [Angular][24], and [Vue.js][25] have stabilized and are being optimized for better performance. Most frameworks are very developer-friendly with good community support.
|
||||
|
||||
### The future
|
||||
|
||||
JavaScript is here to stay. Full-stack development and the modern frontend framework continue to help JavaScript cement its position as one of the most popular programming languages.
|
||||
|
||||
The [next wave of JavaScript][26] might put the spotlight on:
|
||||
|
||||
* **[Deno][27]:** A modern and secure runtime for JavaScript
|
||||
* **Web components:** Reusable custom elements
|
||||
* **Integration with AI and ML:** Projects like [Supernova][28] and [BAYOU][29] have made substantial breakthroughs in integrating JavaScript with artificial intelligence and machine learning.
|
||||
|
||||
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/20/11/javascript-popular
|
||||
|
||||
作者:[Nimisha Mukherjee][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/nimisha
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/javascript_vim.jpg?itok=mqkAeakO (JavaScript in Vim)
|
||||
[2]: https://octoverse.github.com/
|
||||
[3]: https://en.wikipedia.org/wiki/JavaScript
|
||||
[4]: https://opensource.com/sites/default/files/uploads/toplanguages-the_state_of_the_octoverse.png (Top Languages from The State of the Octoverse report)
|
||||
[5]: https://opensource.com/article/20/10/javascript-part-1
|
||||
[6]: https://medium.com/paul-heintzelman/so-why-is-javascript-so-popular-f35bd6cfeb39
|
||||
[7]: https://developers.google.com/web/tools/chrome-devtools
|
||||
[8]: https://medium.com/javascript-in-plain-english/what-are-javascript-programming-paradigms-3ef0f576dfdb
|
||||
[9]: https://addyosmani.com/resources/essentialjsdesignpatterns/book/
|
||||
[10]: https://developpaper.com/javascript-mv-pattern/
|
||||
[11]: https://en.wikipedia.org/wiki/Model%E2%80%93view%E2%80%93viewmodel#JavaScript_frameworks
|
||||
[12]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Inheritance_and_the_prototype_chain
|
||||
[13]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Closures
|
||||
[14]: https://javascript.info/currying-partials
|
||||
[15]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise
|
||||
[16]: https://rxjs-dev.firebaseapp.com/guide/observable
|
||||
[17]: https://en.wikipedia.org/wiki/TypeScript
|
||||
[18]: https://en.wikipedia.org/wiki/ECMAScript
|
||||
[19]: https://en.wikipedia.org/wiki/List_of_ECMAScript_engines
|
||||
[20]: https://en.wikipedia.org/wiki/V8_%28JavaScript_engine%29
|
||||
[21]: https://en.wikipedia.org/wiki/SpiderMonkey
|
||||
[22]: https://teropa.info/blog/2015/07/15/overcoming-javascript-framework-fatigue.html
|
||||
[23]: https://en.wikipedia.org/wiki/React_%28web_framework%29
|
||||
[24]: https://en.wikipedia.org/wiki/Angular_%28web_framework%29
|
||||
[25]: https://en.wikipedia.org/wiki/Vue.js
|
||||
[26]: https://medium.com/@rangleio/the-future-of-javascript-in-the-front-end-world-2544c1814e2
|
||||
[27]: https://en.wikipedia.org/wiki/Deno_%28software%29
|
||||
[28]: https://techcrunch.com/2018/03/13/supernova-studio/
|
||||
[29]: https://futurism.com/military-created-ai-learned-to-program
|
87
sources/tech/20201102 5 reasons to use Linux in 2020.md
Normal file
87
sources/tech/20201102 5 reasons to use Linux in 2020.md
Normal file
@ -0,0 +1,87 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: ( )
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
[#]: subject: (5 reasons to use Linux in 2020)
|
||||
[#]: via: (https://opensource.com/article/20/11/linux-2020)
|
||||
[#]: author: (Seth Kenlon https://opensource.com/users/seth)
|
||||
|
||||
5 reasons to use Linux in 2020
|
||||
======
|
||||
Here's a look back at the year so far and a review of what you need to
|
||||
know about Linux in 2020.
|
||||
![Penguin driving a car with a yellow background][1]
|
||||
|
||||
Some of the best technology is a moving target. When technology stagnates, society tends to outpace and outgrow it. [Linux][2], the widely used open source operating system (OS), is a foundational technology and the basis for some of the most progressive modern computing ideas. So, while it's startlingly unchanged after three decades of development, it also allows adaptation. As a result, Linux is in a unique position of being both a sound investment in skills because it doesn't change and a seemingly eternal driving force for new skills to learn.
|
||||
|
||||
The year 2020 has been a strange one—by any measure—but for Linux, it's been a typical development cycle. Here's a look back at the year so far and a review of what you need to know about Linux in 2020.
|
||||
|
||||
### ZFS on Linux
|
||||
|
||||
The ZFS filesystem offers integrity checking for data and metadata, redundancy with mirroring, support for up to _256 trillion yobibytes_ of storage, hardware-accelerated native encryption, and efficient replication. ZFS is a Sun Microsystems innovation that, unfortunately, has a license that prohibits it from being bundled with Linux by default. However, the [OpenZFS][3] group has ported the project to BSD and Linux so that you can run ZFS on anything from your laptop to your data center.
|
||||
|
||||
Getting started with ZFS is surprisingly simple on Fedora Linux, as Sheng Mao demonstrates in his article on [setting up ZFS on Linux][4].
|
||||
|
||||
### Linux interrupts
|
||||
|
||||
No matter how familiar you are with Linux, there's always an opportunity to dive deeper and discover how it achieves what it does so well. Computers running stock markets, digital film studios, audio workstations, and other performance-intensive tasks need real-time processing, while other computers can afford to be a little lazy when processing requests, and it's no small task to manage the myriad loops happening on a computer at any given millisecond. Understanding how and why the Linux kernel manages interrupt requests (IRQs) may not be vital to the everyday user, but it's a fascinating study no matter what you do on computers. Read Stephan Avenwedde's article "[How the Linux kernel handles interrupts][5]" to learn more.
|
||||
|
||||
### Linux in your pocket
|
||||
|
||||
Since Google's Android OS runs on a Linux kernel, many of us technically have Linux in our pockets. As comforting as that might be, Android's smooth Java frontend doesn't always provide the Linux _feeling_ many Linux users long for. And some users don't have an Android phone at all.
|
||||
|
||||
The good news is that you can use Linux on your Android or iOS device, complete with a terminal, Bash, Python, a package manager, and all the other things you love about your favorite open source desktop OS.
|
||||
|
||||
If you're on Android, read my article about [Termux][6]. And if you're on iOS, read Lee Tusman's excellent article about [running a Linux command line on your iOS device][7].
|
||||
|
||||
### New commands on Linux
|
||||
|
||||
Time marches on, and sometimes the old, quaint commands of yesteryear are insufficient for modern systems. Although your muscle memory may cling to commands like `crontab` and `ifconfig` (and `iwconfig` and `wpa_supplicant`), there are perfectly good replacements for these and more. If you can't bring yourself to abandon your old commands, get familiar with [Bash aliases][8] because these new commands are worth learning.
|
||||
|
||||
* Drop `ifconfig` for `nmcli`. Look, at some point, you have to admit that the unholy combination of `ifconfig` plus `iwconfig` and a foray into `wpa_supplicant` (which you secretly dropped long ago in favor of `wicd` anyway) just isn't efficient. Linux uses `nmcli` now, and it's become a highly usable, sometimes even intuitive way to interface with your network. Read Dave McKay's excellent [nmcli tutorial][9].
|
||||
* Cronjobs, `at`, and `batch` are uniquely timeless commands that probably ought never be replaced. They're great for quick and simple scheduling, but for complex jobs, you might find some features you like in a supplement to them: systemd timers. David Both provides an extensive [systemd timers tutorial][10] that demonstrates how to write and monitor your important custom system tasks.
|
||||
* `gcore` and `gdb` are important debuggers that developers may be familiar with. A new take on `gcore` functionality is Microsoft's ProcDump, which obtains a core dump of a process ID (PID) so that you can analyze it with `gdb`. It's more an alternative than a replacement, but it's worth trying if you're curious about different tools. Read Guarav Kamathe's [ProcDump tutorial][11] for more information.
|
||||
|
||||
|
||||
|
||||
### The cloud runs on Linux
|
||||
|
||||
As "the cloud" continues full steam ahead, Linux remains its main driving force. The cloud is a collection of computers (nodes) with a massively distributed filesystem (such as [Ceph][12]), and it's commonly managed with Kubernetes ("_KOO-burr-net-eez"_] or [OpenShift][13].
|
||||
|
||||
Regardless of how well you know Linux on your laptop or desktop or even in your private data center, there's a whole new world of Linux experimentation available in containers running on the cloud. It can take some adjustment to learn how to get comfortable in an ephemeral container, but with some practice and a little context, you can build some interesting systems and then orchestrate them (that is, cause them to update, scale, and perform as needed) with Kubernetes.
|
||||
|
||||
Jiaqi Liu wrote one of the best overviews of the cloud workflow in "[A beginner's guide to Kubernetes container orchestration][14]." Read it, and then download Chris Collins' [Kubernetes eBook][15] to build your own cloud at home on a Raspberry Pi cluster.
|
||||
|
||||
### Open source growth
|
||||
|
||||
Linux users relish the consistency and stability of Linux, and it's a testament to the original Unix system design that the OS can stay the same while also pushing its boundaries into exciting new forms of technology. Part of the fun of Linux and open source is the sense of discovery you get when you start learning a new command and the sense of accomplishment when it works to make your life easier. Take a look at the latest Linux developments, and get started with something new today!
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/20/11/linux-2020
|
||||
|
||||
作者:[Seth Kenlon][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/seth
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/car-penguin-drive-linux-yellow.png?itok=twWGlYAc (Penguin driving a car with a yellow background)
|
||||
[2]: https://opensource.com/resources/linux
|
||||
[3]: https://openzfs.org/wiki/Main_Page
|
||||
[4]: https://opensource.com/article/20/10/zfs-dnf
|
||||
[5]: https://opensource.com/article/20/10/linux-kernel-interrupts
|
||||
[6]: https://opensource.com/article/20/8/termux
|
||||
[7]: https://opensource.com/article/20/9/run-linux-ios
|
||||
[8]: https://opensource.com/article/19/7/bash-aliases
|
||||
[9]: https://opensource.com/article/20/7/nmcli
|
||||
[10]: https://opensource.com/article/20/7/systemd-timers
|
||||
[11]: https://opensource.com/article/20/7/procdump-linux
|
||||
[12]: https://opensource.com/business/15/1/introduction-ceph-storage-openstack
|
||||
[13]: https://www.redhat.com/en/technologies/cloud-computing/openshift
|
||||
[14]: https://opensource.com/article/20/6/container-orchestration
|
||||
[15]: https://opensource.com/downloads/kubernetes-raspberry-pi
|
@ -0,0 +1,364 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: ( )
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
[#]: subject: (27 Super Cool Raspberry Pi Zero W Projects for DIY Enthusiasts)
|
||||
[#]: via: (https://itsfoss.com/raspberry-pi-zero-projects/)
|
||||
[#]: author: (Chinmay https://itsfoss.com/author/chinmay/)
|
||||
|
||||
27 Super Cool Raspberry Pi Zero W Projects for DIY Enthusiasts
|
||||
======
|
||||
|
||||
The small form factor of the [Raspberry Pi Zero W][1] enables a new range of projects. In fact, a lot of people use the Pi Zero in the final version of the project after prototyping on a different full-sized Pi board. And, that’s because it consumes much less power compared to the flagship Pi boards and makes it ideal to build battery powered gadgets.
|
||||
|
||||
Preview | Product | Price |
|
||||
---|---|---|---
|
||||
![CanaKit Raspberry Pi Zero W \(Wireless\) Complete Starter Kit - 16 GB Edition][2] ![CanaKit Raspberry Pi Zero W \(Wireless\) Complete Starter Kit - 16 GB Edition][2] | [CanaKit Raspberry Pi Zero W (Wireless) Complete Starter Kit - 16 GB Edition][3] | $32.99[][4] | [Buy on Amazon][5]
|
||||
|
||||
After scouring [Instructables][6], [Reddit][7], [Hackaday][8], other maker oriented communities and my own experience with Pi, I have compiled a list of projects built around the Raspberry Pi Zero and the Raspberry Pi Zero W. The community is extremely innovative and all these projects make impressive use of various features of this maker board.
|
||||
|
||||
So, in addition to the awesome list of [Raspberry Pi Projects][9] that we covered earlier, here, we will be focusing on Raspberry Pi Zero!
|
||||
|
||||
### Top Creative Projects You Can Build With Raspberry Pi Zero
|
||||
|
||||
![][10]
|
||||
|
||||
Of course, you’re free to use some [Raspberry Pi Zero alternatives][11] and try the same project ideas mentioned below.
|
||||
|
||||
#### 1\. Portable Game Console
|
||||
|
||||
This is by far my favorite project built around the Raspberry Pi Zero, hence featured at the top. Today we have emulators for most of the retro games. This project puts the Pi Zero in the classic game-boy form factor. You can play most of your favorite retro games and you can play them anywhere.
|
||||
|
||||
This project is also beautifully documented in YouTube video(s) and on Instructables.
|
||||
|
||||
[Portable Game Console][12]
|
||||
|
||||
#### 2\. DIY Smart Speaker Powered by Alexa
|
||||
|
||||
Amazon’s Alexa has always been very tinkerer friendly and makers around the world have built all kinds of Alexa based devices. This project also adds RGB programmable LED’s to make it look a little more like the echo speaker.
|
||||
|
||||
[DIY Smart Speaker][13]
|
||||
|
||||
#### 3\. Home Network Music System
|
||||
|
||||
Getting a proper home music system setup is usually expensive. However, with the inexpensive Raspberry Pi Zero, you can utilize your MP3 collection to set up a home network music system.
|
||||
|
||||
This project uses the [PiDrive][14], PiDrive is basically a Raspberry Pi Zero W attached to a hard disk. Unfortunately, I think it has been discontinued but you can also build it using a normal Pi Zero W in different configurations. You can play local music or even stream from different services.
|
||||
|
||||
[Pi MusicBox][15]
|
||||
|
||||
#### 4\. Network Ad Blocker using Pi-Hole
|
||||
|
||||
This is something I personally use on a daily basis and it has completely changed my internet experience. If you’re someone who doesn’t want to see advertisements while you browse around online, an Ad blocker using Raspberry Pi would be exciting, right?
|
||||
|
||||
[Pi-Hole][16] on a Raspberry Pi can block all the ads on your entire network. Anyone on the network with an active Pi-Hole will have an ad-free experience. It also speeds up your internet experience since the bandwidth used by ads is freed up.
|
||||
|
||||
You can watch Linus’ video to get an idea or refer to the detailed post in Linus Tech Tips forums linked in the button below.
|
||||
|
||||
[Ad-Blocker using Pi Hole][17]
|
||||
|
||||
#### 5\. AirPlay Speaker using Raspberry Pi Zero
|
||||
|
||||
![][18]
|
||||
|
||||
AirPlay is a chromecast equivalent in the Apple ecosystem, you can cast media from your Apple devices to an AirPlay supported speaker.
|
||||
|
||||
This project is built very well with 3D printed parts and you can find detailed instructions for it.
|
||||
|
||||
[AirPlay Speaker][19]
|
||||
|
||||
#### 6\. DIY Google Home with a Bluetooth Speaker
|
||||
|
||||
![][20]
|
||||
|
||||
This is another nifty little project which is a tinkerer’s dream. Building your own smart speaker powered by the Google Assistant? Indeed, exciting!
|
||||
|
||||
Here, a Pi Zero is paired with a Bluetooth speaker, microphone and the Google Assistant SDK to achieve some functionalities. You can ask questions and do most of the things you can with the official Google Home device. This project does not handle the casting part of the Google Home experience though.
|
||||
|
||||
[DIY Google Home][21]
|
||||
|
||||
#### 7\. Pedal Pi – Raspberry Pi Zero Guitar Pedal
|
||||
|
||||
Pedal Pi is a programmable Lo-Fi guitar pedal built using the Pi Zero where you can program your own custom effects. The project is fully open source (including the hardware) as well. It goes to prove how versatile the Pi Zero can be.
|
||||
|
||||
It can be an incredibly fun experience for people who are makers and also into digital music.
|
||||
|
||||
[Pedal Pi][22]
|
||||
|
||||
#### 8\. ZeroBot – FPV Robot
|
||||
|
||||
There are a lot of different robots you can build using the Pi Zero. It is almost perfect for any kind of robot that you can think of building. It has ample amount of [GPIO][23], a decent processor, a camera interface and the choice of software stack and programming language.
|
||||
|
||||
The ZeroBot is an [FPV][24] bot which also has a camera and is able to transmit what it is seeing. It even features a completely 3D printed body.
|
||||
|
||||
You can find [detailed instructions here][25].
|
||||
|
||||
#### 9\. WiFi Security Camera
|
||||
|
||||
Raspberry Pi Zero W comes with a CSI connector where you can connect the camera module. This compatibility also lets you easily build a WiFi-powered CCTV camera(s) for your home at a very reasonable price compared to commercial products.
|
||||
|
||||
The [motionEyeOS][26] is a purposely built to convert your SBC (in this case the Pi Zero) to a surveillance system. You can find more information in the video above or head to the link below.
|
||||
|
||||
[WiFi Security Camera][27]
|
||||
|
||||
#### 10\. PIX-E GIF Camera
|
||||
|
||||
![][28]
|
||||
|
||||
GIF’s have taken over social media and all IM platforms. Just thinking of a dedicated GIF camera makes me chuckle. That’s exactly what this project is all about. I am very curious about how it would turn out with the new HQ camera which has a much better image quality.
|
||||
|
||||
This [project has been documented][29] really well with accompanying videos on Hackaday
|
||||
|
||||
[GIF Camera][29]
|
||||
|
||||
#### 11\. Wearable Timelapse Camera
|
||||
|
||||
One of the sleekest camera project I’ve seen, this is a wearable camera. You can take time-lapses, and videos from a first person’s perspective.
|
||||
|
||||
This is a project by Adafruit and is documented really well. Refer to the video above to get an idea or head to the link below.
|
||||
|
||||
[Wearable Timelapse Camera][30]
|
||||
|
||||
#### 12\. Telescope Camera
|
||||
|
||||
![][31]
|
||||
|
||||
Building a telescope camera is one of the most popular camera based applications for the Pi Zero. Makers around the world have taken amazing pictures with their DIY telescope cameras.
|
||||
|
||||
[Telescope Camera][32]
|
||||
|
||||
#### 13\. Kodi on Pi Zero
|
||||
|
||||
Kodi is one of the best open source [media server software][33] for making a media box for your TV. The amazing part is that it also runs on the Pi Zero W.
|
||||
|
||||
Now you can DIY an alternative to the Amazon Fire TV Stick.
|
||||
|
||||
[Kodi on Pi Zero][34]
|
||||
|
||||
#### 14\. OctoPrint – Wireless 3D Printing
|
||||
|
||||
![][35]
|
||||
|
||||
If you are into 3D printing, you would have heard about [OctoPrint][36] at some point. OctoPrint unlocks many feature comforts we enjoy with normal printers like sending print jobs directly from the computer to the 3D printer instead of using a micro SD card. You can also attach a webcam and monitor your prints and control all aspects of the printer.
|
||||
|
||||
OctoPrint is usually used with the bigger Pi’s but it can also be used with the Raspberry Pi Zero W with some soldering and mods. It is important to note that there is low WiFi interference when using the Pi Zero since it can impact prints. Here are some references talking about OctoPrint on Pi Zero to help you build it yourself:
|
||||
|
||||
* [OctoPrint on Pi Zero][37]
|
||||
* [OctoPrint on Pi Zero (from Prusa 3D)][38]
|
||||
|
||||
|
||||
|
||||
#### 15\. Pirate Radio Station
|
||||
|
||||
This seems like quite a fun idea, you can actually make the Pi Zero W broadcast using FM.
|
||||
|
||||
It also happens to be a simple project and you don’t need many additional components either. You can be your own neighborhood RJ, do make sure to check out the legal aspects of a pirate radio station in your country.
|
||||
|
||||
[Pirate Radio Station][39]
|
||||
|
||||
#### 16\. IoT Smart Alarm Clock
|
||||
|
||||
![][40]
|
||||
|
||||
Here’s a project making something which might sound very trivial but nevertheless is super cool and underrated.
|
||||
|
||||
The freedom of being able to program your own alarm clock, automating it with scripts and making your life a little easier and fun (and still not waking up) sounds exciting!
|
||||
|
||||
[IoT Smart Alarm Clock][41]
|
||||
|
||||
#### 17\. Pi Zero Tesla Coil
|
||||
|
||||
This is the most unexpected yet an amazing project I’ve come across which uses the Pi Zero W.
|
||||
|
||||
It doesn’t get cooler than playing music on a [tesla coil][42] using the Pi. Make sure you watch the video.
|
||||
|
||||
[Tesla Coil with Pi Zero][43]
|
||||
|
||||
#### 18\. Network Performance Monitoring using Pi Zero
|
||||
|
||||
![][44]
|
||||
|
||||
If you like to keep tabs on your network, you should check out this project.
|
||||
|
||||
This is a [bandwidth monitor][45] built using the Pi Zero W that features a nifty little screen to display important stats.
|
||||
|
||||
[Bandwidth Monitor][45]
|
||||
|
||||
#### 19\. Pi Pod – Raspberry Pi Zero Music Player
|
||||
|
||||
![][46]
|
||||
|
||||
It’s 2020 and you might be thinking who would want a portable music player since mobile phones have replaced them almost entirely. But, there are always people (including myself) who would want a device dedicated to music and does not do anything else.
|
||||
|
||||
This project features the Raspberry Pi Zero W in another form and looks pretty neat. It’s called the **Pi Pod**.
|
||||
|
||||
You can also design your own 3D printable enclosure and customize every element of the music player.
|
||||
|
||||
[Pi Pod][47]
|
||||
|
||||
#### 20\. Raspberry Pi Drone
|
||||
|
||||
![][48]
|
||||
|
||||
The Pi Zero packs in enough features and processing power for it be at the heart of a drone. It is light weight, cheaper than some alternative drone specific boards too. You also get the freedom of using different firmware(s) or code one on your own.
|
||||
|
||||
There are also many open source designs available for the frame of the drone on [Thingiverse.][49]
|
||||
|
||||
[Pi Drone][50]
|
||||
|
||||
#### 21\. Internet Connected Info Display
|
||||
|
||||
The Pi Zero W is capable of connecting to the internet via WiFi, it also has all the GPIO and display outputs to make a highly functional device to display information from the internet.
|
||||
|
||||
The freedom of programming means that you can have the display show any information you need. Your google calendar events, stock prices and anything you can find on the internet.
|
||||
Here are a couple of interesting projects which are built around this idea.
|
||||
|
||||
1. [YouTube Subscriber Counter][51]
|
||||
2. [Raspberry Pi Internet Connected Information Display][52]
|
||||
|
||||
|
||||
|
||||
#### 22\. Raspberry Pi Pocket Projector
|
||||
|
||||
Ever since Texas Instruments came out with the mini projector evaluation board, a Raspberry Pi Zero based projector has been a very popular project.
|
||||
|
||||
If you can get your hands on the projector module, this can be a very interesting build. This is not a beginner-friendly project, but a tinkerer should feel right at home. You can find all the relevant details from the video above.
|
||||
|
||||
#### 23\. VPN Server
|
||||
|
||||
![][53]
|
||||
|
||||
In today’s world, extra care needs to be taken about companies barging into one’s privacy and using a VPN is becoming more and more commonplace.
|
||||
|
||||
Fret not, you can utilize the Raspberry Pi Zero W with [OpenVPN][54] to add an extra layer of security to your home network. This can be a great for small families where everyone in the house can be protected and don’t need to separate VPN subscriptions.
|
||||
|
||||
[VPN Server][55]
|
||||
|
||||
#### 24\. Weather Station
|
||||
|
||||
![][56]
|
||||
|
||||
This is a very cool project, a complete weather station which can display various weather metrics for the day and forecasts too. It even includes a 3D printed case which looks pretty sharp. The amazing part is that you can use the display to show things other than weather as well.
|
||||
|
||||
As I also noticed in another similar project on [Instructables][57], you may also tweak it with your own custom database and website.
|
||||
|
||||
[Weather Station][58]
|
||||
|
||||
#### 25\. Ambient Lighting System for TV
|
||||
|
||||
An ambient lighting system enhances the TV experience, this is another amazing project involving the Raspberry Pi Zero.
|
||||
|
||||
In real life this effect feels like a dynamic portrait mode applied to the screen and whatever is being shown on the screen, makes the experience a lot immersive.
|
||||
|
||||
GreatScott (a popular YouTuber) for content based around electronics and DIY shows you around with the project in the video above. You may also refer to the written instructions from the link below.
|
||||
|
||||
[Ambient Lighting System][59]
|
||||
|
||||
#### 26\. Wireless Network Printer
|
||||
|
||||
![][60]
|
||||
|
||||
The Pi Zero W is a great board to make any old printer free from being fixed to one computer and have the freedom of placing it anywhere.
|
||||
|
||||
This way print jobs can be sent from multiple computers, phones on the same network. This is a quality of life improvement which is highly underrated, even in households.
|
||||
|
||||
This project utilizes [CUPS][61] running on Pi Zero W to make your printer wireless.
|
||||
|
||||
[Wireless Network Printer][62]
|
||||
|
||||
#### 27\. Pi Zero Cluster
|
||||
|
||||
![][63]
|
||||
|
||||
You can pack in 10’s of these tiny computers together to have access to massive amounts of parallel processing. The GPU’s on these SBC’s can be utilized for challenging compute needs.
|
||||
|
||||
Regular Raspberry Pi’s have long been used to make clusters and Raspberry Pi based super computers consisting of 100’s – 1000’s of Pi’s. Since the introduction of the Pi Zero with it’s lower price and size, it is possible to put more of them into a small space.
|
||||
|
||||
There are many custom boards which are built to hold multiple Pi Zero’s.
|
||||
|
||||
[Pi Zero Cluster][64]
|
||||
|
||||
#### Closing Thoughts
|
||||
|
||||
The projects featured here are only a tip of the iceberg. You can find many more projects if you look around on the internet. The versatility of the Raspberry Pi Zero is unprecedented, combined with its affordability it is one of the most used SBC by makers and tinkerers around the world.
|
||||
|
||||
What did you build with the Raspberry Pi Zero ? Put it in the comments below along with your favorite projects.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://itsfoss.com/raspberry-pi-zero-projects/
|
||||
|
||||
作者:[Chinmay][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/chinmay/
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://itsfoss.com/raspberry-pi-zero-w/
|
||||
[2]: https://i1.wp.com/m.media-amazon.com/images/I/517BwcAPmTL._SL160_.jpg?ssl=1
|
||||
[3]: https://www.amazon.com/dp/B072N3X39J?tag=chmod7mediate-20&linkCode=ogi&th=1&psc=1 (CanaKit Raspberry Pi Zero W (Wireless) Complete Starter Kit - 16 GB Edition)
|
||||
[4]: https://www.amazon.com/gp/prime/?tag=chmod7mediate-20 (Amazon Prime)
|
||||
[5]: https://www.amazon.com/dp/B072N3X39J?tag=chmod7mediate-20&linkCode=ogi&th=1&psc=1 (Buy on Amazon)
|
||||
[6]: https://www.instructables.com
|
||||
[7]: https://www.reddit.com/r/raspberry_pi
|
||||
[8]: https://hackaday.com
|
||||
[9]: https://itsfoss.com/raspberry-pi-projects/
|
||||
[10]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/10/raspberry-pi-zero-w-projects.png?resize=800%2C450&ssl=1
|
||||
[11]: https://itsfoss.com/raspberry-pi-zero-alternatives/
|
||||
[12]: https://www.instructables.com/DIY-Raspberry-Pi-Zero-Handheld-Game-Console/
|
||||
[13]: https://www.instructables.com/Alexa-Assistant-With-a-10-Raspberry-Pi-Zero-W-and-/
|
||||
[14]: https://www.raspberrypi.org/blog/meet-314gb-pidrive/
|
||||
[15]: https://www.instructables.com/Raspberry-Pi-Home-Network-Music-System/
|
||||
[16]: https://pi-hole.net/
|
||||
[17]: https://linustechtips.com/main/topic/1094810-pi-hole-setup-tutorial/
|
||||
[18]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/10/pi-airplay-speaker.png?resize=800%2C578&ssl=1
|
||||
[19]: https://www.hackster.io/fvdbosch/raspberry-pi-zero-airplay-speaker-d99feb
|
||||
[20]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/10/pi-google-home.png?resize=800%2C541&ssl=1
|
||||
[21]: https://www.instructables.com/DIY-Google-Home-With-Bluetooth-Speaker-on-Raspberr/
|
||||
[22]: https://www.instructables.com/Raspberry-Pi-Zero-Guitar-Pedal/
|
||||
[23]: https://en.wikipedia.org/wiki/General-purpose_input/output
|
||||
[24]: https://en.wikipedia.org/wiki/First-person_view_(radio_control)
|
||||
[25]: https://hackaday.io/project/25092-zerobot-raspberry-pi-zero-fpv-robot
|
||||
[26]: https://github.com/ccrisan/motioneyeos
|
||||
[27]: https://maker.pro/raspberry-pi/projects/how-to-build-a-cctv-network-camera-with-raspberry-pi-zero-w-and-motionpie
|
||||
[28]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/10/pi-gif-camera.jpg?resize=800%2C633&ssl=1
|
||||
[29]: https://hackaday.io/project/16358-pix-e-gif-camera
|
||||
[30]: https://learn.adafruit.com/raspberry-pi-wearable-time-lapse-camera/overview
|
||||
[31]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/10/pi-telescope-camera.png?resize=800%2C555&ssl=1
|
||||
[32]: https://www.instructables.com/Astrophotography-With-the-Raspberry-Pi-Zero/
|
||||
[33]: https://itsfoss.com/best-linux-media-server/
|
||||
[34]: https://dronebotworkshop.com/kodi-raspberry-pi/
|
||||
[35]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/10/octoprint-logo.png?resize=515%2C421&ssl=1
|
||||
[36]: https://octoprint.org
|
||||
[37]: https://toglefritz.com/how-to-run-octoprint-on-a-raspberry-pi-zero/
|
||||
[38]: https://help.prusa3d.com/en/article/octoprint-building-an-image-for-raspberry-pi-zero-w_2182
|
||||
[39]: https://makezine.com/projects/pirate-radio-throwies/
|
||||
[40]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/10/pi-iot-clock.png?resize=800%2C472&ssl=1
|
||||
[41]: https://hackaday.io/project/19230-iot-smart-alarm-clock
|
||||
[42]: https://en.wikipedia.org/wiki/Tesla_coil
|
||||
[43]: https://www.extremeelectronics.co.uk/electronic-tesla-coils/pi-zero-tesla-coil/
|
||||
[44]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/10/pi-network-performance.png?resize=800%2C432&ssl=1
|
||||
[45]: https://www.instructables.com/Bandwidth-Monitor/
|
||||
[46]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/10/pi-pod-music-player.png?resize=743%2C542&ssl=1
|
||||
[47]: https://www.raspberrypi.org/blog/pipod-pi-zero-music-player/
|
||||
[48]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/10/pi-zero-drone.png?resize=736%2C552&ssl=1
|
||||
[49]: https://thingiverse.com
|
||||
[50]: https://www.hackster.io/12590/pi0drone-a-200-smart-drone-with-the-pi-zero-4fec08?f=1
|
||||
[51]: https://www.youtube.com/watch?v=afY_xHqQu-s
|
||||
[52]: https://www.hackster.io/fvdbosch/raspberry-pi-zero-internet-connected-information-display-5cae96
|
||||
[53]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/10/pi-open-vpn.jpg?resize=800%2C296&ssl=1
|
||||
[54]: https://openvpn.net/
|
||||
[55]: https://circuitdigest.com/microcontroller-projects/turn-your-raspberry-pi-zero-in-to-a-vpn-server-using-openvpn
|
||||
[56]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/10/pi-zero-weather-station.png?resize=800%2C599&ssl=1
|
||||
[57]: https://www.instructables.com/Complete-Raspberry-Pi-Weather-Station/
|
||||
[58]: https://www.hackster.io/hartmut-wendt/raspberry-pi-based-weather-station-a9a7dd
|
||||
[59]: https://www.instructables.com/Make-Your-Own-Ambient-Lighting-With-the-Raspberry-/
|
||||
[60]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/10/pi-wireless-printer.jpg?resize=800%2C450&ssl=1
|
||||
[61]: https://www.cups.org/
|
||||
[62]: https://maker.pro/raspberry-pi/projects/how-to-turn-a-usb-printer-into-a-wireless-printer-with-raspberry-pi-zero-w
|
||||
[63]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/10/pi-zero-cluster.png?resize=800%2C531&ssl=1
|
||||
[64]: https://magpi.raspberrypi.org/articles/clusterhat-review-cluster-hat-kit
|
154
sources/tech/20201103 A Brief History of Ubuntu Touch.md
Normal file
154
sources/tech/20201103 A Brief History of Ubuntu Touch.md
Normal file
@ -0,0 +1,154 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: ( )
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
[#]: subject: (A Brief History of Ubuntu Touch)
|
||||
[#]: via: (https://itsfoss.com/ubuntu-touch/)
|
||||
[#]: author: (John Paul https://itsfoss.com/author/john/)
|
||||
|
||||
A Brief History of Ubuntu Touch
|
||||
======
|
||||
|
||||
Sensing the tech trend, Ubuntu tried its hands on creating a Linux-based mobile operating system. The first announcement came a decade back and six years down the line, Ubuntu closed the curtains on the project.
|
||||
|
||||
What went wrong? How it started? Is Ubuntu Touch still alive? Let’s take a look at the history of Ubuntu Touch in chronological order.
|
||||
|
||||
### Shuttleworth Announced Ubuntu Touch
|
||||
|
||||
![][1]
|
||||
|
||||
The [Ubuntu Touch project][2] began with a blog post by Canonical founder [Mark Shuttleworth][3]. The [blog post][4], dated October 31, 2011, started with a bold prediction: “By 14.04 LTS Ubuntu will power tablets, phones, TVs and smart screens from the car to the office kitchen, and it will connect those devices cleanly and seamlessly to the desktop, the server and the cloud.”
|
||||
|
||||
Shuttleworth went on to explain that this move would be accomplished mainly through the use of the company’s new desktop environment, Unity. (Unity was introduced in Ubuntu 10.10.) “Unity, the desktop interface in today’s Ubuntu 11.10, was designed with this specific vision in mind.”
|
||||
|
||||
The whole idea behind Unity was to create an interface that would work on different screen resolutions.
|
||||
|
||||
_**“Unity’s core elements are arranged in exactly the way we need to create coherence across all of those devices. This was the origin of the name Unity – a single core interface framework, that scales across all screens, and supports all toolkits.”**_
|
||||
|
||||
Shuttleworth said that this move was motivated by the increasing use of mobile devices. “Make no mistake – just as the world is changing for manufacturers so is it changing for Linux distributions. Today, 70% of people in Egypt access the Internet solely via the phone. Even in the US that figure is a startling 25%.”
|
||||
|
||||
### Ubuntu Touch is Released to the World
|
||||
|
||||
![][5]
|
||||
|
||||
The Unity desktop environment was originally introduced in the netbook version of Ubuntu 10.10. However, the phone interface wouldn’t be seen by the public until 2013. [Mark Shuttleworth demoed][6] it at the 2013 CES.
|
||||
|
||||
Ubuntu Touch 1.0 was baked into the [Ubuntu 13.10 release][7]. This version primarily supported “Galaxy Nexus and Nexus 4 phone” with other images being available, as well.
|
||||
|
||||
The [system requirements][8] for Ubuntu Touch looked a little bit like this:
|
||||
|
||||
| Entry-level Ubuntu smartphone | High-end Ubuntu “superphone”
|
||||
---|---|---
|
||||
Processor architecture | 1Ghz Cortex A9 | Quad-core A9 or Intel Atom
|
||||
Memory | 512MB – 1GB | Min 1GB
|
||||
Flash storage | 4-8GB eMMC + SD | Min 32GB eMMC + SD
|
||||
Multi-touch | Yes | Yes
|
||||
Desktop convergence | No | Yes
|
||||
|
||||
![Convergence concept][9]
|
||||
|
||||
Note: The last item on the above list (**desktop convergence**) might be a new idea to some people. This meant that you could use your Ubuntu Touch device like a phone, but you could also hook it up to a display, keyboard, and mouse to use it as a desktop. Unfortunately, Ubuntu Touch never gained this feature.
|
||||
|
||||
### Ubuntu Tries to Crowdfund a Phone
|
||||
|
||||
To show off what an ideal Ubuntu phone would look like, Canonical started a crowdfunding campaign to finance the [Ubuntu Edge][10] on July 22, 2013. The goal was to raise $32 million in a month to produce 40,000 devices.
|
||||
|
||||
According to the campaign’s page, Canonical hoped to use the new device “to provide a low-volume, high-technology platform, crowdfunded by enthusiasts and mobile computing professionals. A pioneering project that accelerates the adoption of new technologies and drives them down into the mainstream.”
|
||||
|
||||
The Ubuntu Edge was considered high-end at the time with the following specs:
|
||||
|
||||
Mobile OS | Dual-boots Android and Ubuntu mobile
|
||||
---|---
|
||||
Desktop OS | Ubuntu Desktop
|
||||
RAM | 4GB
|
||||
Internal storage | 128GB
|
||||
Screen | 720 x 1,280, 4.5 inches
|
||||
Protection | Sapphire Glass
|
||||
Connectivity | Dual-LTE, GSM
|
||||
Speakers | Stereo
|
||||
Battery | Silicon-anode Li-ion
|
||||
Price | $695
|
||||
|
||||
Interestingly, several large companies pledged money. For example, [Bloomberg pledged $800,000][11]. They made this pledge because they believed that Ubuntu Touch “could benefit its clients and the future of mobile Relevant Products/Services computing.”
|
||||
|
||||
Ultimately, the campaign didn’t reach its goal. It only reached $12.7 million or 37% of the goal. The amount raised was the biggest a crowdfunding campaign ever saw.
|
||||
|
||||
### Ubuntu Touch Goes into Production (Sort of)
|
||||
|
||||
Though Canonical failed to make its own hardware, it continued working on the software part i.e., developing the Ubuntu Touch mobile operating system.
|
||||
|
||||
![][12]
|
||||
|
||||
Ubuntu Touch was released to device makers in 2014. That same year, [two device makers committed][13] to produce Ubuntu phones. These two companies, Chinese Meizu and Spanish BQ, weren’t exactly global household names, but Shuttleworth said that was all part of the plan.
|
||||
|
||||
_“While we’re happy to work with household names, we want to be involved with partners for whom we can be a significant part of their story, rather than being appended to the more complicated story of other brands.”_
|
||||
|
||||
Both companies produced and released several phones with Ubuntu Touch as the main operating system. BQ also released an Ubuntu Touch tablet. However, no other manufacturer signed up to make Ubuntu Touch devices.
|
||||
|
||||
### Canonical Discontinues Ubuntu Touch
|
||||
|
||||
![Unity 8 was in beta when Ubuntu discontinued Unity and Ubuntu Touch project][14]
|
||||
|
||||
In early April of 2017, Mark Shuttleworth made another [announcement][15]. After mentioning that Canonical had experienced an “excellent quarter and excellent year”, Shuttleworth [announced the end of the Ubuntu Touch and Unity][16]. “I’m writing to let you know that we will end our investment in Unity8, the phone and convergence shell.” Instead, Canonical would focus on desktop Ubuntu.
|
||||
|
||||
He continued:
|
||||
|
||||
> I took the view that, if convergence was the future and we could deliver it as free software, that would be widely appreciated both in the free software community and in the technology industry, where there is substantial frustration with the existing, closed, alternatives available to manufacturers. I was wrong on both counts. In the community, our efforts were seen fragmentation not innovation. And industry has not rallied to the possibility, instead taking a ‘better the devil you know’ approach to those form factors, or investing in home-grown platforms. What the Unity8 team has delivered so far is beautiful, usable and solid, but I respect that markets, and community, ultimately decide which products grow and which disappear.
|
||||
|
||||
He closed by saying that it was a hard decision to make because of his strong belief in the future of convergence.
|
||||
|
||||
### The Community Keeps the Project Alive
|
||||
|
||||
When Shuttleworth’s announcement hit the internet, all the supporters of Ubuntu Touch were shocked. Many were unsure of what would happen to the devices that they owned. Thankfully, the community came to the rescue.
|
||||
|
||||
![][17]
|
||||
|
||||
Shortly after Shuttleworth’s announcement, Marius Gripsgård [announced][18] that the UBports team would be keeping Ubuntu Touch alive. UBports was already well known in the Ubuntu Touch community for their work on porting it to more devices.
|
||||
|
||||
Several other projects tried to do the same with the desktop version of Unity, but most did not last long. One of them had the inventive name of Yunit but I guess it is not actively developed anymore.
|
||||
|
||||
[UBports is the only project][2] that is keeping Ubuntu Touch alive by continuously working on its development.
|
||||
|
||||
### Epilogue
|
||||
|
||||
Ubuntu Touch was not the success that Canonical wanted it to be. It was too early for the market. However, it did lay the groundwork for the Linux phones that we have now.
|
||||
|
||||
I believe that the [PinePhone][19] and the [Purism Librem 5][20] phone would not have come about without Ubuntu Touch sparking interest in a Linux phone. At the same time, the Canonical engineers and programmers solved problems that laid the groundwork for these modern phones. You don’t get successes without a few failures along the way.
|
||||
|
||||
If you found this article interesting, please take a minute to share it on social media, Hacker News, or [Reddit][21].
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://itsfoss.com/ubuntu-touch/
|
||||
|
||||
作者:[John Paul][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/john/
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/10/ubuntu-touch-devices.jpg?resize=800%2C497&ssl=1
|
||||
[2]: https://ubuntu-touch.io/
|
||||
[3]: https://en.wikipedia.org/wiki/Mark_Shuttleworth
|
||||
[4]: https://www.markshuttleworth.com/archives/820
|
||||
[5]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/10/ubuntu-touch-tablet.jpg?resize=625%2C363&ssl=1
|
||||
[6]: https://www.youtube.com/watch?v=RO7QbCqFY7Y
|
||||
[7]: https://wiki.ubuntu.com/SaucySalamander/ReleaseNotes#Ubuntu_for_Phones
|
||||
[8]: https://web.archive.org/web/20130326085927/http://www.ubuntu.com/devices/phone/operators-and-oems
|
||||
[9]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2016/02/convergence-ubuntu.jpg?resize=1024%2C588&ssl=1
|
||||
[10]: https://www.indiegogo.com/projects/ubuntu-edge#/
|
||||
[11]: https://web.archive.org/web/20131020144457/http://www.cio-today.com/story.xhtml?story_title=Ubuntu_Edge_Smartphone_Raises_Millions__Falls_Short&story_id=10200A158ZW0
|
||||
[12]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2015/02/image-phone-overview.jpg?resize=567%2C302&ssl=1
|
||||
[13]: https://www.cnet.com/news/ubuntu-touch-gets-grip-on-its-first-phone-makers/
|
||||
[14]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/02/unity8_ubports.png?resize=800%2C450&ssl=1
|
||||
[15]: https://ubuntu.com/blog/growing-ubuntu-for-cloud-and-iot-rather-than-phone-and-convergence
|
||||
[16]: https://itsfoss.com/ubuntu-unity-shutdown/
|
||||
[17]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/02/ubports.jpeg?resize=720%2C480&ssl=1
|
||||
[18]: https://news.softpedia.com/news/ubuntu-touch-and-unity-8-are-not-dead-ubports-community-will-keep-them-alive-514620.shtml
|
||||
[19]: https://itsfoss.com/pinephone/
|
||||
[20]: https://itsfoss.com/librem-linux-phone/
|
||||
[21]: https://%0Areddit.com/r/linuxusersgroup
|
379
sources/tech/20201103 Create a list in a Flutter mobile app.md
Normal file
379
sources/tech/20201103 Create a list in a Flutter mobile app.md
Normal file
@ -0,0 +1,379 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: ( )
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
[#]: subject: (Create a list in a Flutter mobile app)
|
||||
[#]: via: (https://opensource.com/article/20/11/flutter-lists-mobile-app)
|
||||
[#]: author: (Vitaly Kuprenko https://opensource.com/users/kooper)
|
||||
|
||||
Create a list in a Flutter mobile app
|
||||
======
|
||||
Learn how to create Flutter app screens and pass data between them.
|
||||
![Mobile devices and collaboration leads to staring at our phones][1]
|
||||
|
||||
Flutter is a popular open source toolkit for building cross-platform apps. In "[Create a mobile app with Flutter][2]," I demonstrated how to install [Flutter][3] on Linux and create your first app. In this article, I'll show you how to add a list of items in your app, with each item opening a new screen. This is a common design method for mobile apps, so you've probably seen it before, but here's a screenshot to help you visualize it:
|
||||
|
||||
![Testing the Flutter app][4]
|
||||
|
||||
(Vitaly Kuprenko, [CC BY-SA 4.0][5])
|
||||
|
||||
Flutter uses the [Dart][6] language. In some of the code snippets below, you'll see statements beginning with slashes. Two slashes (`/ /`) is for code comments, which explain certain pieces of code. Three slashes (`/ / /`) denotes Dart's documentation comments, which explain Dart classes and their properties and other useful information.
|
||||
|
||||
### Examine a Flutter app's main parts
|
||||
|
||||
A typical entry point for a Flutter application is a `main()` function, usually found in a file called `lib/main.dart`:
|
||||
|
||||
|
||||
```
|
||||
void main() {
|
||||
runApp(MyApp());
|
||||
}
|
||||
```
|
||||
|
||||
This method is called when the app is launched. It runs `MyApp()`, a StatelessWidget containing all necessary app settings in the `MaterialApp()` widget (app theme, initial page to open, and so on):
|
||||
|
||||
|
||||
```
|
||||
class MyApp extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return MaterialApp(
|
||||
title: 'Flutter Demo',
|
||||
theme: ThemeData(
|
||||
primarySwatch: Colors.blue,
|
||||
visualDensity: VisualDensity.adaptivePlatformDensity,
|
||||
),
|
||||
home: MyHomePage(title: 'Flutter Demo Home Page'),
|
||||
);
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
The initial page generated is called `MyHomePage()`. It's a stateful widget that contains variables that can be passed to a widget constructor parameter (take a look at the code above, where you pass the variable `title` to the page constructor):
|
||||
|
||||
|
||||
```
|
||||
class MyHomePage extends StatefulWidget {
|
||||
MyHomePage({[Key][7] key, this.title}) : super(key: key);
|
||||
|
||||
final [String][8] title;
|
||||
|
||||
@override
|
||||
_MyHomePageState createState() => _MyHomePageState();
|
||||
}
|
||||
```
|
||||
|
||||
StatefulWidget means that this page has its own state: `_MyHomePageState`. It lets you call the `setState()` method there to rebuild the page's user interface (UI):
|
||||
|
||||
|
||||
```
|
||||
class _MyHomePageState extends State<MyHomePage> {
|
||||
int _counter = 0; // Number of taps on + button.
|
||||
|
||||
void _incrementCounter() { // Increase number of taps and update UI by calling setState().
|
||||
setState(() {
|
||||
_counter++;
|
||||
});
|
||||
}
|
||||
...
|
||||
}
|
||||
```
|
||||
|
||||
A `build()` function in stateful and stateless widgets is responsible for UI appearance:
|
||||
|
||||
|
||||
```
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold( // Page widget.
|
||||
appBar: AppBar( // Page app bar with title and back button if user can return to previous screen.
|
||||
title: Text(widget.title), // Text to display page title.
|
||||
),
|
||||
body: Center( // Widget to center child widget.
|
||||
child: Column( // Display children widgets in column.
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: <Widget>[
|
||||
Text( // Static text.
|
||||
'You have pushed the button this many times:',
|
||||
),
|
||||
Text( // Text with our taps number.
|
||||
'$_counter', // $ sign allows us to use variables inside a string.
|
||||
style: Theme.of(context).textTheme.headline4,// Style of the text, “Theme.of(context)” takes our context and allows us to access our global app theme.
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
// Floating action button to increment _counter number.
|
||||
floatingActionButton: FloatingActionButton(
|
||||
onPressed: _incrementCounter,
|
||||
tooltip: 'Increment',
|
||||
child: [Icon][9](Icons.add),
|
||||
),
|
||||
);
|
||||
}
|
||||
```
|
||||
|
||||
### Modify your app
|
||||
|
||||
It's good practice to separate the `main()` method and other pages' code into different files. To do so, you need to create a new .dart file by right-clicking on the **lib** folder then selecting **New > Dart File**:
|
||||
|
||||
![Create a new Dart file][10]
|
||||
|
||||
(Vitaly Kuprenko, [CC BY-SA 4.0][5])
|
||||
|
||||
Name the file `items_list_page`.
|
||||
|
||||
Switch back to your `main.dart` file, cut the `MyHomePage` and `_MyHomePageState` code, and paste it into your new file. Next, set your cursor on `StatefulWidget` (underlined below in red), press Alt+Enter, and select `package:flutter/material.dart`:
|
||||
|
||||
![Importing Flutter package][11]
|
||||
|
||||
(Vitaly Kuprenko, [CC BY-SA 4.0][5])
|
||||
|
||||
This adds `flutter/material.dart` to your file so that you can use the default material widgets Flutter provides.
|
||||
|
||||
Then, right-click on **MyHomePage class > Refactor > Rename…** and rename this class to `ItemsListPage`:
|
||||
|
||||
![Renaming StatefulWidget class][12]
|
||||
|
||||
(Vitaly Kuprenko, [CC BY-SA 4.0][5])
|
||||
|
||||
Flutter recognizes that you renamed the StatefulWidget class and automatically renames its State class:
|
||||
|
||||
![State class renamed automatically][13]
|
||||
|
||||
(Vitaly Kuprenko, [CC BY-SA 4.0][5])
|
||||
|
||||
Return to the `main.dart` file and change the name `MyHomePage` to `ItemsListPage`. Once you start typing, your Flutter integrated development environment (probably IntelliJ IDEA Community Edition, Android Studio, and VS Code or [VSCodium][14]) suggests how to autocomplete your code:
|
||||
|
||||
![IDE suggests autocompleting code][15]
|
||||
|
||||
(Vitaly Kuprenko, [CC BY-SA 4.0][5])
|
||||
|
||||
Press Enter to complete your input. It will add the missing import to the top of the file automatically:
|
||||
|
||||
![Adding missing import ][16]
|
||||
|
||||
(Vitaly Kuprenko, [CC BY-SA 4.0][5])
|
||||
|
||||
You've completed your initial setup. Now you need to create a new .dart file in the **lib** folder and name it `item_model`. (Note that classes have UpperCamelCase names, but files have snake_case names.) Paste this code into the new file:
|
||||
|
||||
|
||||
```
|
||||
/// Class that stores list item info:
|
||||
/// [id] - unique identifier, number.
|
||||
/// [icon] - icon to display in UI.
|
||||
/// [title] - text title of the item.
|
||||
/// [description] - text description of the item.
|
||||
class ItemModel {
|
||||
// class constructor
|
||||
ItemModel(this.id, this.icon, this.title, this.description);
|
||||
|
||||
// class fields
|
||||
final int id;
|
||||
final IconData icon;
|
||||
final [String][8] title;
|
||||
final [String][8] description;
|
||||
}
|
||||
```
|
||||
|
||||
Return to `items_list_page.dart`, and replace the existing `_ItemsListPageState` code with:
|
||||
|
||||
|
||||
```
|
||||
class _ItemsListPageState extends State<ItemsListPage> {
|
||||
|
||||
// Hard-coded list of [ItemModel] to be displayed on our page.
|
||||
final List<ItemModel> _items = [
|
||||
ItemModel(0, Icons.account_balance, 'Balance', 'Some info'),
|
||||
ItemModel(1, Icons.account_balance_wallet, 'Balance wallet', 'Some info'),
|
||||
ItemModel(2, Icons.alarm, 'Alarm', 'Some info'),
|
||||
ItemModel(3, Icons.my_location, 'My location', 'Some info'),
|
||||
ItemModel(4, Icons.laptop, 'Laptop', 'Some info'),
|
||||
ItemModel(5, Icons.backup, 'Backup', 'Some info'),
|
||||
ItemModel(6, Icons.settings, 'Settings', 'Some info'),
|
||||
ItemModel(7, Icons.call, 'Call', 'Some info'),
|
||||
ItemModel(8, Icons.restore, 'Restore', 'Some info'),
|
||||
ItemModel(9, Icons.camera_alt, 'Camera', 'Some info'),
|
||||
];
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: Text(widget.title),
|
||||
),
|
||||
body: [ListView][17].builder( // Widget which creates [ItemWidget] in scrollable list.
|
||||
itemCount: _items.length, // Number of widget to be created.
|
||||
itemBuilder: (context, itemIndex) => // Builder function for every item with index.
|
||||
ItemWidget(_items[itemIndex], () {
|
||||
_onItemTap(context, itemIndex);
|
||||
}),
|
||||
));
|
||||
}
|
||||
|
||||
// Method which uses BuildContext to push (open) new MaterialPageRoute (representation of the screen in Flutter navigation model) with ItemDetailsPage (StateFullWidget with UI for page) in builder.
|
||||
_onItemTap(BuildContext context, int itemIndex) {
|
||||
Navigator.of(context).push(MaterialPageRoute(
|
||||
builder: (context) => ItemDetailsPage(_items[itemIndex])));
|
||||
}
|
||||
}
|
||||
|
||||
// StatelessWidget with UI for our ItemModel-s in ListView.
|
||||
class ItemWidget extends StatelessWidget {
|
||||
const ItemWidget(this.model, this.onItemTap, {[Key][7] key}) : super(key: key);
|
||||
|
||||
final ItemModel model;
|
||||
final Function onItemTap;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return InkWell( // Enables taps for child and add ripple effect when child widget is long pressed.
|
||||
onTap: onItemTap,
|
||||
child: ListTile( // Useful standard widget for displaying something in ListView.
|
||||
leading: [Icon][9](model.icon),
|
||||
title: Text(model.title),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
Consider moving `ItemWidget` to a separate file in the **lib** folder to improve the readability of your code.
|
||||
|
||||
The only thing missing is the `ItemDetailsPage` class. Create a new file in the **lib** folder and name it `item_details_page`. Then copy and paste this code there:
|
||||
|
||||
|
||||
```
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import 'item_model.dart';
|
||||
|
||||
/// Widget for displaying detailed info of [ItemModel]
|
||||
class ItemDetailsPage extends StatefulWidget {
|
||||
final ItemModel model;
|
||||
|
||||
const ItemDetailsPage(this.model, {[Key][7] key}) : super(key: key);
|
||||
|
||||
@override
|
||||
_ItemDetailsPageState createState() => _ItemDetailsPageState();
|
||||
}
|
||||
|
||||
class _ItemDetailsPageState extends State<ItemDetailsPage> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: Text(widget.model.title),
|
||||
),
|
||||
body: Center(
|
||||
child: Column(
|
||||
children: [
|
||||
const SizedBox(height: 16),
|
||||
[Icon][9](
|
||||
widget.model.icon,
|
||||
size: 100,
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
Text(
|
||||
'Item description: ${widget.model.description}',
|
||||
style: TextStyle(fontSize: 18),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
Almost nothing new here. Notice that `_ItemDetailsPageState` is using the `widget.item.title` code. It enables referring to the `StatefulWidget` fields in its `State` class.
|
||||
|
||||
### Add some animation
|
||||
|
||||
Now, it's time to add some basic animation:
|
||||
|
||||
1. Go to `ItemWidget` code.
|
||||
2. Put the cursor on the `Icon()` widget in the `build()` method.
|
||||
3. Press Alt+Enter and select "Wrap with widget…"
|
||||
|
||||
|
||||
|
||||
![Wrap with widget option][18]
|
||||
|
||||
(Vitaly Kuprenko, [CC BY-SA 4.0][5])
|
||||
|
||||
Start typing "Hero" and select the suggestion for `Hero((Key key, @required this, tag, this.create))`:
|
||||
|
||||
![Finding the Hero widget][19]
|
||||
|
||||
(Vitaly Kuprenko, [CC BY-SA 4.0][5])
|
||||
|
||||
Next, add the tag property `tag: model.id` to the Hero widget:
|
||||
|
||||
![Adding the tag property model.id to the Hero widget][20]
|
||||
|
||||
(Vitaly Kuprenko, [CC BY-SA 4.0][5])
|
||||
|
||||
And the final step is to make the same change in the `item_details_page.dart` file:
|
||||
|
||||
![Changing item_details_page.dart file][21]
|
||||
|
||||
(Vitaly Kuprenko, [CC BY-SA 4.0][5])
|
||||
|
||||
The previous steps wrapped the `Icon()` widget with the `Hero()` widget. Do you remember in `ItemModel` you added the `id field` but didn't use it anywhere? The Hero widget takes a unique tag for the child widget. If Hero detects that different app screens (MaterialPageRoute) have a Hero widget with the same tag, it'll automatically animate the transition between these pages.
|
||||
|
||||
Test it out by running the app on an Android emulator or physical device. When you open and close the item details page, you'll see a nice animation of the icon:
|
||||
|
||||
![Testing the Flutter app][4]
|
||||
|
||||
(Vitaly Kuprenko, [CC BY-SA 4.0][5])
|
||||
|
||||
### Wrapping up
|
||||
|
||||
In this tutorial, you learned:
|
||||
|
||||
* The components of a standard, automatically created app
|
||||
* How to add several pages that pass data among each other
|
||||
* How to add a simple animation for those pages
|
||||
|
||||
|
||||
|
||||
If you want to learn more, check out Flutter's [docs][22] (with links to sample projects, videos, and "recipes" for creating Flutter apps) and the [source code][23], which is open source under a BSD 3-Clause License.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/20/11/flutter-lists-mobile-app
|
||||
|
||||
作者:[Vitaly Kuprenko][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/kooper
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/team-phone-collaboration-mobile-device.png?itok=v3EjbRK6 (Mobile devices and collaboration leads to staring at our phones)
|
||||
[2]: https://opensource.com/article/20/9/mobile-app-flutter
|
||||
[3]: https://flutter.dev/
|
||||
[4]: https://opensource.com/sites/default/files/uploads/flutter_test.gif (Testing the Flutter app)
|
||||
[5]: https://creativecommons.org/licenses/by-sa/4.0/
|
||||
[6]: https://dart.dev/
|
||||
[7]: http://www.google.com/search?hl=en&q=allinurl%3Adocs.oracle.com+javase+docs+api+key
|
||||
[8]: http://www.google.com/search?hl=en&q=allinurl%3Adocs.oracle.com+javase+docs+api+string
|
||||
[9]: http://www.google.com/search?hl=en&q=allinurl%3Adocs.oracle.com+javase+docs+api+icon
|
||||
[10]: https://opensource.com/sites/default/files/uploads/flutter_new-dart-file_0.png (Create a new Dart file)
|
||||
[11]: https://opensource.com/sites/default/files/uploads/flutter_import-package.png (Importing Flutter package)
|
||||
[12]: https://opensource.com/sites/default/files/uploads/flutter_rename-class.png (Renaming StatefulWidget class)
|
||||
[13]: https://opensource.com/sites/default/files/uploads/flutter_stateclassrenamed.png (State class renamed automatically)
|
||||
[14]: https://opensource.com/article/20/6/open-source-alternatives-vs-code
|
||||
[15]: https://opensource.com/sites/default/files/uploads/flutter_autocomplete.png (IDE suggests autocompleting code)
|
||||
[16]: https://opensource.com/sites/default/files/uploads/flutter_import-input.png (Adding missing import )
|
||||
[17]: http://www.google.com/search?hl=en&q=allinurl%3Adocs.oracle.com+javase+docs+api+listview
|
||||
[18]: https://opensource.com/sites/default/files/uploads/flutter_wrapwithwidget.png (Wrap with widget option)
|
||||
[19]: https://opensource.com/sites/default/files/uploads/flutter_hero.png (Finding the Hero widget)
|
||||
[20]: https://opensource.com/sites/default/files/uploads/flutter_hero-tag.png (Adding the tag property model.id to the Hero widget)
|
||||
[21]: https://opensource.com/sites/default/files/uploads/flutter_details-tag.png (Changing item_details_page.dart file)
|
||||
[22]: https://flutter.dev/docs
|
||||
[23]: https://github.com/flutter
|
@ -0,0 +1,95 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: (geekpi)
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
[#]: subject: (GnuCash: A Powerful Open Source Accounting Software)
|
||||
[#]: via: (https://itsfoss.com/gnucash/)
|
||||
[#]: author: (Ankush Das https://itsfoss.com/author/ankush/)
|
||||
|
||||
GnuCash: A Powerful Open Source Accounting Software
|
||||
======
|
||||
|
||||
_**Brief: GnuCash is a popular free and open-source accounting software that can be used to manage personal finance as well as business transactions.**_
|
||||
|
||||
Considering the complexities of managing personal finances and business transactions, you will find a lot of online services or software tools that aim to simplify things. Some tools simply let you add expenses and income to keep track of your savings while others offer different features.
|
||||
|
||||
I have already covered several [open source account software][1] in the past. Here, I will be focusing on one of the options — **GnuCash**, which is a popular free accounting software with plenty of features for every user.
|
||||
|
||||
### GnuCash: Free & Open Source Accounting Software
|
||||
|
||||
![][2]
|
||||
|
||||
GnuCash is a free accounting software tailored for professional requirements to track transactions, stocks, etc. It is available for Linux, BSD, macOS, and Windows as well.
|
||||
|
||||
Even though it can be overwhelming to start with, it is easy to use for managing personal transactions as well. You can get a detailed report to analyze after you’ve started managing an account and added transactions to it.
|
||||
|
||||
### Features of GnuCash
|
||||
|
||||
![][3]
|
||||
|
||||
As I mentioned earlier, GnuCash comes loaded with a bunch of features which could be overwhelming for someone new to accounting, but I think it should be worth it:
|
||||
|
||||
* Double-entry Accounting
|
||||
* Stock/Bond/Mutual Fund accounts
|
||||
* Small-business accounting with tax support (like GST in India)
|
||||
* Detailed report for breakdown
|
||||
* Graph for easy analysis
|
||||
* Financial calculations support
|
||||
* Auto-saving feature
|
||||
* Color coding
|
||||
* Online Banking Wizard
|
||||
* Journal
|
||||
* Loan repayment calculator
|
||||
* Price database for quick calculation
|
||||
* Budget balance sheet, flow, graph for each category
|
||||
* Ability to export as CSV
|
||||
* Add Customer, Vendor, and Employee records separately
|
||||
* Scheduled transactions
|
||||
* Ability to set a Budget
|
||||
* Configuring bill generator to ease up the accounting process
|
||||
|
||||
|
||||
|
||||
I’m no expert but this is just the tip of the iceberg. You will find a host of options to customize and set for your accounting needs.
|
||||
|
||||
![Gnucash Report][4]
|
||||
|
||||
### Installing GnuCash on Linux
|
||||
|
||||
You can find GnuCash in the software center of your Linux distribution. Install it from there or use the [package manager of your distribution][5].
|
||||
|
||||
A [Flatpak package][6] is also available for those who want the latest version. In case you didn’t know, I’d suggest you to go through our [Flatpak guide][7].
|
||||
|
||||
Alternatively, you can build it from source or you can head to their [official download page][8] to explore options for your Linux distribution.
|
||||
|
||||
[GnuCash][9]
|
||||
|
||||
### Wrapping Up
|
||||
|
||||
For basic personal finance management, it was a little overwhelming for me because I prefer to use an Android app for simplicity. However, if you take a look around for a few minutes, it is easy to understand and GnuCash seems flexible for most requirements.
|
||||
|
||||
If you like to manage your or your business’s finances, you may give it a try. It is definitely better than keeping data in spreadsheet :)
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://itsfoss.com/gnucash/
|
||||
|
||||
作者:[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://itsfoss.com/open-source-accounting-software/
|
||||
[2]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/11/gnucash.jpg?resize=800%2C633&ssl=1
|
||||
[3]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/11/gnucash-screenshot.jpg?resize=800%2C636&ssl=1
|
||||
[4]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/11/gnucash-report.jpg?resize=800%2C638&ssl=1
|
||||
[5]: https://itsfoss.com/package-manager/
|
||||
[6]: https://flathub.org/apps/details/org.gnucash.GnuCash
|
||||
[7]: https://itsfoss.com/flatpak-guide/
|
||||
[8]: https://www.gnucash.org/download.phtml#distribution
|
||||
[9]: https://www.gnucash.org
|
159
sources/tech/20201103 How the Kubernetes scheduler works.md
Normal file
159
sources/tech/20201103 How the Kubernetes scheduler works.md
Normal file
@ -0,0 +1,159 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: ( )
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
[#]: subject: (How the Kubernetes scheduler works)
|
||||
[#]: via: (https://opensource.com/article/20/11/kubernetes-scheduler)
|
||||
[#]: author: (Mike Calizo https://opensource.com/users/mcalizo)
|
||||
|
||||
How the Kubernetes scheduler works
|
||||
======
|
||||
Understand how the Kubernetes scheduler discovers new pods and assigns
|
||||
them to nodes.
|
||||
![Parts, modules, containers for software][1]
|
||||
|
||||
[Kubernetes][2] has emerged as the standard orchestration engine for containers and containerized workloads. It provides a common, open source abstraction layer that spans public and private cloud environments.
|
||||
|
||||
For those already familiar with Kubernetes and its components, the conversation is usually around maximizing Kubernetes' power. But when you're just learning Kubernetes, it's wise to begin with some general knowledge about Kubernetes and its components (including the [Kubernetes scheduler][3]), as shown in this high-level view, before trying to use it in production.
|
||||
|
||||
![][4]
|
||||
|
||||
Kubernetes also uses control planes and nodes.
|
||||
|
||||
1. **Control plane:** Also known as master, these nodes are responsible for making global decisions about the clusters and detecting or responding to cluster events. The control plane components are:
|
||||
* etcd
|
||||
* kube-apiserver
|
||||
* kube-controller-manager
|
||||
* scheduler
|
||||
2. **Nodes:** Also called worker nodes, these sets of nodes are where a workload resides. They should always talk to the control plane to get the information necessary for the workload to run and to communicate and connect outside the cluster. Worker nodes' components are:
|
||||
* kubelet
|
||||
* kube-proxy
|
||||
* container runtime Interface.
|
||||
|
||||
|
||||
|
||||
I hope this background helps you understand how the Kubernetes components are stacked together.
|
||||
|
||||
### How Kubernetes scheduler works
|
||||
|
||||
A Kubernetes [pod][5] is comprised of one or more containers with shared storage and network resources. The Kubernetes scheduler's task is to ensure that each pod is assigned to a node to run on.
|
||||
|
||||
At a high level, here is how the Kubernetes scheduler works:
|
||||
|
||||
1. Every pod that needs to be scheduled is added to a queue
|
||||
2. When new pods are created, they are also added to the queue
|
||||
3. The scheduler continuously takes pods off that queue and schedules them
|
||||
|
||||
|
||||
|
||||
The [scheduler's code][6] (`scheduler.go`) is large, around 9,000 lines, and fairly complex, but the important bits to tackle are:
|
||||
|
||||
1. **Code that waits/watches for pod creation**
|
||||
The code that watches for pod creation begins on line 8970 of `scheduler.go`; it waits indefinitely for new pods:
|
||||
|
||||
|
||||
```
|
||||
// Run begins watching and scheduling. It waits for cache to be synced, then starts a goroutine and returns immediately.
|
||||
|
||||
func (sched *Scheduler) Run() {
|
||||
if !sched.config.WaitForCacheSync() {
|
||||
return
|
||||
}
|
||||
|
||||
go wait.Until(sched.scheduleOne, 0, sched.config.StopEverything)
|
||||
```
|
||||
|
||||
2. **Code that is responsible for queuing the pod**
|
||||
The function responsible for pod queuing is:
|
||||
|
||||
|
||||
```
|
||||
// queue for pods that need scheduling
|
||||
podQueue *cache.FIFO
|
||||
```
|
||||
|
||||
The code responsible for queuing the pod begins on line 7360 of `scheduler.go`. When the event handler is triggered to indicate that a new pod is available, this piece of code automatically puts the new pod in the queue:
|
||||
|
||||
|
||||
```
|
||||
func (f *ConfigFactory) getNextPod() *v1.Pod {
|
||||
for {
|
||||
pod := cache.Pop(f.podQueue).(*v1.Pod)
|
||||
if f.ResponsibleForPod(pod) {
|
||||
glog.V(4).Infof("About to try and schedule pod %v", pod.Name)
|
||||
return pod
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
3. **Code that handles errors**
|
||||
You will inevitably encounter scheduling errors in pod scheduling. The following code is how the scheduler handles the errors. It listens to `podInformer` and then spits out an error that the pod was not scheduled and terminates:
|
||||
|
||||
|
||||
```
|
||||
// scheduled pod cache
|
||||
podInformer.Informer().AddEventHandler(
|
||||
cache.FilteringResourceEventHandler{
|
||||
FilterFunc: func(obj interface{}) bool {
|
||||
switch t := obj.(type) {
|
||||
case *v1.Pod:
|
||||
return assignedNonTerminatedPod(t)
|
||||
default:
|
||||
runtime.HandleError(fmt.Errorf("unable to handle object in %T: %T", c, obj))
|
||||
return false
|
||||
}
|
||||
},
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
In other words, the Kubernetes scheduler is responsible for:
|
||||
|
||||
* Scheduling the newly created pods on nodes with enough space to satisfy the pod's resource needs
|
||||
* Listening to the kube-apiserver and the controller for the presence of newly created pods and then scheduling them to an available node on the cluster
|
||||
* Watching for unscheduled pods and binding them to nodes by using the `/binding` pod sub-resource API.
|
||||
|
||||
|
||||
|
||||
For example, imagine an application is being deployed that requires 1GB of memory and two CPU cores. Therefore, the pods for the application are created on a node that has enough resources available. Then, the scheduler continues to run forever, watching to see if there are pods that need to be scheduled.
|
||||
|
||||
### Learn more
|
||||
|
||||
To have a working Kubernetes cluster, you need to get all the components above working together in sync. The scheduler is a complex piece of code, but Kubernetes is awesome software, and currently, it's the default choice when talking about adopting cloud-native applications.
|
||||
|
||||
Learning Kubernetes requires time and effort, but having it as one of your skills will give you an edge that should bring rewards in your career. There are a lot of good learning resources available, and the [documentation][7] is good. If you are interested in learning more, I recommend starting with:
|
||||
|
||||
* [Kubernetes the hard way][8]
|
||||
* [Kubernetes the hard way on bare metal][9]
|
||||
* [Kubernetes the hard way on AWS][10]
|
||||
|
||||
|
||||
|
||||
What are your favorite ways to learn about Kubernetes? Please share in the comments.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/20/11/kubernetes-scheduler
|
||||
|
||||
作者:[Mike Calizo][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/mcalizo
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/containers_modules_networking_hardware_parts.png?itok=rPpVj92- (Parts, modules, containers for software)
|
||||
[2]: https://kubernetes.io/
|
||||
[3]: https://kubernetes.io/docs/concepts/scheduling-eviction/kube-scheduler/
|
||||
[4]: https://lh4.googleusercontent.com/egB0SSsAglwrZeWpIgX7MDF6u12oxujfoyY6uIPa8WLqeVHb8TYY_how57B4iqByELxvitaH6-zjAh795wxAB8zenOwoz2YSMIFRqHsMWD9ohvUTc3fNLCzo30r7lUynIHqcQIwmtRo
|
||||
[5]: https://kubernetes.io/docs/concepts/workloads/pods/
|
||||
[6]: https://github.com/kubernetes/kubernetes/blob/e4551d50e57c089aab6f67333412d3ca64bc09ae/plugin/pkg/scheduler/scheduler.go
|
||||
[7]: https://kubernetes.io/docs/home/
|
||||
[8]: https://github.com/kelseyhightower/kubernetes-the-hard-way
|
||||
[9]: https://github.com/Praqma/LearnKubernetes/blob/master/kamran/Kubernetes-The-Hard-Way-on-BareMetal.md
|
||||
[10]: https://github.com/Praqma/LearnKubernetes/blob/master/kamran/Kubernetes-The-Hard-Way-on-AWS.md
|
@ -0,0 +1,49 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: ( )
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
[#]: subject: (6 evening rituals for working in tech)
|
||||
[#]: via: (https://opensource.com/article/20/11/evening-rituals-working-tech)
|
||||
[#]: author: (Jen Wike Huger https://opensource.com/users/jen-wike)
|
||||
|
||||
6 evening rituals for working in tech
|
||||
======
|
||||
After a busy day of virtual meetings, emails, coding, and collaborating,
|
||||
how do you wind down for the night?
|
||||
![A farm road][1]
|
||||
|
||||
This strange time has given us, on one hand, the chance to slow down, yet on the other, it's busier than ever. Especially if you have others in your life to care for in addition to yourself. But you can't give from an empty cup, so, this list of evening rituals is focused on what you can do for yourself right after you turn the computer off, shut the laptop, or say goodbye to the last virtual meeting of the day.
|
||||
|
||||
1\. Head to the nearest door and take a big, deep belly breath in... and out. I don't care if it's snowing. Fill your lungs with fresh air. Stay for a while if you can -- take a lap around the yard, or walk down the street and back.
|
||||
|
||||
2\. If you have some time, make a cup of tea -- black (is caffeinated, so beware), green, or herbal -- and, let it cool down while you get your shoes (and maybe a jacket) on. Pop it in a favorite thermos, and take a stroll around your neighborhood. You don't have to have a plan or a place you're walking to. Set a timer for 15 minutes if you only have a short window.
|
||||
|
||||
3\. Turn on a song that pops into your head or the one you didn't get a chance to jam/relax to earlier today.
|
||||
|
||||
4\. If you have some time, stand up and dance it out or lay all the way down with your feet up. No more sitting. Don't think, just listen. Research shows giving your brain blank space helps you think and deal better later.
|
||||
|
||||
5\. Open your [reader app][2] or pick up a book (the latter is easier on your eyes), and fully indulge, letting the day slip away, or give yourself enough time to read at least one chapter.
|
||||
|
||||
6\. Make food that feels good. Maybe that means a few basic ingredients and simple instructions. Maybe that means putting together that new, complex meal you've been excited about since you picked up the items at the grocery store.
|
||||
|
||||
Can you combine some of these to get even more out of your evening ritual time? If you're working in tech, creating rituals like this—whether they're [in the morning][3], middle of your day, or evening—is critical as we live out a new normal working from home, taking meetings virtually, and missing the energy of in-person connections with colleagues.
|
||||
|
||||
What is your evening ritual?
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/20/11/evening-rituals-working-tech
|
||||
|
||||
作者:[Jen Wike Huger][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/jen-wike
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/EDUCATION_jadud_farm-road.png?itok=of8IuSM5 (A farm road)
|
||||
[2]: https://opensource.com/article/20/2/linux-ebook-readers
|
||||
[3]: https://opensource.com/article/20/10/tech-morning-rituals
|
@ -0,0 +1,111 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: ( )
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
[#]: subject: (Got Kids? Limit Computer Usage Per Account in Linux With Timekpr-nExt)
|
||||
[#]: via: (https://itsfoss.com/timekpr-next/)
|
||||
[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/)
|
||||
|
||||
Got Kids? Limit Computer Usage Per Account in Linux With Timekpr-nExt
|
||||
======
|
||||
|
||||
_**Open source software highlight of this week is Timekpr-nExt. It is a GUI application to limit the computer usage for certain accounts on a Linux system. This is a handy utility for parents who do not want children to spend excessive time on the computer.**_
|
||||
|
||||
### Use Timekpr-nExt to limit computer usage on Linux
|
||||
|
||||
If you have young children at home who spend too much time on computer, you may want to put some sort of restriction on the usage.
|
||||
|
||||
Timekpr-nExt enables you to limit computer usage for certain accounts based on the time of day, number of hours a day, week or month. You may also set time interval to force the account user to take break.
|
||||
|
||||
![][1]
|
||||
|
||||
After the given time expires, the user is automatically logged out and cannot log back in until the restriction conditions are satisfied.
|
||||
|
||||
![][2]
|
||||
|
||||
Of course, this means that you need to have separate non-admin (no sudo access) accounts for the children. If the kids accounts also have admin access, they can change the settings easily. Kids are smart, you know.
|
||||
|
||||
### Features of Timekpr-nExt
|
||||
|
||||
Apart from an annoyingly stylized name, Timekpr-nExt has the following features:
|
||||
|
||||
* Limit system usage as day wise limit, daily limit, weekly or monthly limit
|
||||
* You can also set access restrictions based on time and hour
|
||||
* Users can be shown notification about how much time they have left
|
||||
* Set the lockout action (terminate session, shutdown, suspend or lock screen)
|
||||
* Track the time usage of the accounts
|
||||
|
||||
|
||||
|
||||
Keep the following things in mind:
|
||||
|
||||
* Check carefully which account you are configuring. _**Do not lock yourself out**_.
|
||||
* Hit the apply or set button for each configuration changes otherwise the changes won’t be set.
|
||||
* Children accounts should not have admin action otherwise they can overwrite the settings.
|
||||
|
||||
|
||||
|
||||
Read the [documents about more information on using Timekpr-nExt][3].
|
||||
|
||||
### Installing Timekpr-nExt on Linux
|
||||
|
||||
For Ubuntu-based Linux distributions (like Mint, Linux Lite etc), there is an [official PPA available][4]. You can install it by using the following commands one by one:
|
||||
|
||||
```
|
||||
sudo add-apt-repository ppa:mjasnik/ppa
|
||||
sudo apt update
|
||||
sudo apt install timekpr-next
|
||||
```
|
||||
|
||||
Arch Linux users can [find it in AUR][5]. For others, please check your distribution’s repository. If there is no such package, you may try using the source code.
|
||||
|
||||
[Timekpr-nExt Source Code][6]
|
||||
|
||||
_**Again, do not use Timekpr-nExt for your own main account. You may lock yourself out.**_
|
||||
|
||||
You’ll see two instances of the application. Use the one with (SU) at the beginning.
|
||||
|
||||
![][7]
|
||||
|
||||
#### Removing Timekpr-nExt
|
||||
|
||||
I cannot say for certain if removing Timekpr-nExt will also remove the restrictions you put in place for the users. It will be a good idea to manually restore them (putting 24 hr interval a day). There is no reset button here.
|
||||
|
||||
To remove this application (if you used PPA to install it), use the following command:
|
||||
|
||||
```
|
||||
sudo apt-get remove --purge timekpr-next
|
||||
```
|
||||
|
||||
Delete the PPA repository as well:
|
||||
|
||||
```
|
||||
sudo add-apt-repository -r ppa:mjasnik/ppa
|
||||
```
|
||||
|
||||
Like [blocking adult content on Linux][8], this application is also children specific. Not everyone would find it useful but people with young children at home may use it if they feel the need.
|
||||
|
||||
Do you use some other application to monitor/restrict children from accessing computer?
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://itsfoss.com/timekpr-next/
|
||||
|
||||
作者:[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://i2.wp.com/itsfoss.com/wp-content/uploads/2020/10/timekpr-next-ubuntu.png?resize=800%2C612&ssl=1
|
||||
[2]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/10/timekpr-next-icon-system-notification-area.png?resize=640%2C94&ssl=1
|
||||
[3]: https://mjasnik.gitlab.io/timekpr-next/
|
||||
[4]: https://launchpad.net/~mjasnik/+archive/ubuntu/ppa
|
||||
[5]: https://aur.archlinux.org/packages/timekpr-next/
|
||||
[6]: https://launchpad.net/timekpr-next
|
||||
[7]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/10/timekeeper-next.jpg?resize=799%2C250&ssl=1
|
||||
[8]: https://itsfoss.com/how-to-block-porn-by-content-filtering-on-ubuntu/
|
@ -0,0 +1,129 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: (robsean)
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
[#]: subject: (How to Check Free Disk Space on Linux [Terminal and GUI Methods])
|
||||
[#]: via: (https://itsfoss.com/check-free-disk-space-linux/)
|
||||
[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/)
|
||||
|
||||
How to Check Free Disk Space on Linux [Terminal and GUI Methods]
|
||||
======
|
||||
|
||||
_**How much disk space I have utilized?**_
|
||||
|
||||
The simplest way to find the free disk space on Linux is to [use df command][1]. The df command stands for disk-free and quite obviously, it shows you the free and available disk space on Linux systems.
|
||||
|
||||
```
|
||||
df -h
|
||||
```
|
||||
|
||||
With `-h` option, it shows the disk space in human-readable format (MB and GB).
|
||||
|
||||
Here’s the output of the df command for my Dell XPS system that has only Linux installed with encrypted disk:
|
||||
|
||||
![Checking free disk space with df command in Linux][2]
|
||||
|
||||
If the above output is confusing for you, don’t worry. I’ll explain a few things around checking available disk space in Linux. _**I’ll also show the GUI method for desktop Linux users.**_
|
||||
|
||||
### Method 1: Checking free disk space in Linux with df command (and understanding its output)
|
||||
|
||||
When you use the df command to check disk space, it will show a bunch of ‘file systems’ with their size, used space and free space. Your actual disks should normally be listed as one of the following:
|
||||
|
||||
* /dev/sda
|
||||
* /dev/sdb
|
||||
* /dev/nvme0n1p
|
||||
|
||||
|
||||
|
||||
This is not a hard and fast rule but it gives you an indication to easily recognize the actual disk from the crowd.
|
||||
|
||||
Your Linux system might have several partitions on your disk for boot, EFI, root, swap, home etc. In such cases, these partitions are reflected with a number at the end of the ‘disk name’, like /dev/sda1, /dev/nvme0n1p2 etc.
|
||||
|
||||
You could identify which partition is used for what purpose from its mount point. Root is mounted on /, EFI in /boot/EFI etc.
|
||||
|
||||
In my case, I have used 41% of the 232 GB of disk space under root. If you have 2-3 big partitions (like root, home etc), you’ll have to make a calculation here.
|
||||
|
||||
![Understanding df command output][3]
|
||||
|
||||
* **tmpfs**: The [tmpfs][4] (temporary filesystem) used for keeping files in virtual memory. You can ignore this virtual filesystem comfortably.
|
||||
* **udev**: The [udev filesystem][5] is used for storing information related to devices (like USB, network card, CD ROM etc) plugged to your system. You may ignore it as well.
|
||||
* **/dev/loop**: These are loop devices. You’ll see plenty of them while checking disk space in Ubuntu because of snap applications. Loops are virtual devices that allow normal files to be accessed as block devices. With the loop devices, snap applications are sandboxed in their own virtual disk. Since they are under root, you don’t need to count their used disk space separately.
|
||||
|
||||
|
||||
|
||||
#### Missing disk space? Check if you have mounted all disks and partitions
|
||||
|
||||
Keep in mind that the df command only shows disk space for mounted filesystems. If you are using more than one Linux distribution (or operating systems) on the same disk or you have multiple disks on your system, you need to mount them first in order to see the free space available on those partitions and disks.
|
||||
|
||||
For example, my [Intel NUC][6] has two SSDs and 4 or 5 Linux distributions installed on them. It shows additional disks only when I mount them explicitly.
|
||||
|
||||
![][7]
|
||||
|
||||
You can use the lsblk command to see all the disks and partitions on your system.
|
||||
|
||||
![][8]
|
||||
|
||||
Once you have the disk partition name, you can mount it in this fashion:
|
||||
|
||||
```
|
||||
sudo mount /dev/sdb2 /mnt
|
||||
```
|
||||
|
||||
I hope this gives you a pretty good idea about checking hard drive space on Linux. Let’s see how to do it graphically.
|
||||
|
||||
### Method 2: Check free disk usage graphically
|
||||
|
||||
Checking free disk space graphically is much easier in Ubuntu with the Disk Usage Analyzer tool.
|
||||
|
||||
![Disk Usage Analyzer Tool][9]
|
||||
|
||||
You’ll see all the actual disks and partitions here. You may have to mount some partitions by clicking on them. It displays the disk usage for all the mounted partitions.
|
||||
|
||||
![Disk usage check][10]
|
||||
|
||||
#### Checking free disk space with GNOME Disks utility
|
||||
|
||||
Otherwise, the GNOME Disks utility is also pretty handy tool.
|
||||
|
||||
![GNOME Disks Tool][11]
|
||||
|
||||
Start the tool and select the disk. Select a partition to see the free disk space. If a partition is not mounted, mount it first by clicking the ‘play’ icon.
|
||||
|
||||
![Free Disk Space Check in Ubuntu Desktop][12]
|
||||
|
||||
I think all major desktop environments have some sort of graphical tool to check the disk usage on Linux. You can search for it in the menu of your desktop Linux system.
|
||||
|
||||
**Conclusion**
|
||||
|
||||
There can be more ways and tools to check the disk space of course. I showed you the most common command line and GUI methods for this purpose.
|
||||
|
||||
I also explained a few things that might trouble you in understanding the disk usage. Hope you like it.
|
||||
|
||||
If you have questions or suggestions, please let me know in the comment section.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://itsfoss.com/check-free-disk-space-linux/
|
||||
|
||||
作者:[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://linuxhandbook.com/df-command/
|
||||
[2]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/11/free-disk-space-linux-df-command-output.png?resize=786%2C475&ssl=1
|
||||
[3]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/11/df-command-output.png?resize=800%2C600&ssl=1
|
||||
[4]: https://www.kernel.org/doc/html/latest/filesystems/tmpfs.html
|
||||
[5]: https://wiki.debian.org/udev
|
||||
[6]: https://itsfoss.com/install-linux-on-intel-nuc/
|
||||
[7]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/11/df-command-ubuntu-1.png?resize=786%2C443&ssl=1
|
||||
[8]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/11/lsblk-command-to-see-disks-linux.png?resize=786%2C538&ssl=1
|
||||
[9]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/11/disk-usage-analyzer-tool-linux.jpg?resize=800%2C250&ssl=1
|
||||
[10]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/11/free-disk-space-ubuntu-desktop.png?resize=800%2C648&ssl=1
|
||||
[11]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/11/disks-tool-linux.jpg?resize=800%2C250&ssl=1
|
||||
[12]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/11/free-disk-space-check-ubuntu-desktop.png?resize=800%2C600&ssl=1
|
@ -0,0 +1,75 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: (geekpi)
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
[#]: subject: (Tweak your Git config for multiple user IDs)
|
||||
[#]: via: (https://opensource.com/article/20/10/git-config)
|
||||
[#]: author: (Ramanathan M https://opensource.com/users/muthiahramanathan)
|
||||
|
||||
Tweak your Git config for multiple user IDs
|
||||
======
|
||||
Use the same machine for your work and personal Git commits without
|
||||
manually resetting your config.
|
||||
![Chat via email][1]
|
||||
|
||||
Git's [git config][2] command (hereafter referred to as "config") enables you to set repository or global options for Git. It has many options, and one of them, `includeIf`, is handy when you have dual roles using Git, for example, working full time as a developer and contributing to open source projects in your spare time. Most people in this situation don't want to use a common config for both roles or, at the very least, would rather keep certain portions of their config distinct, especially if they use the same computer in both roles.
|
||||
|
||||
This is my situation, so I keep two separate sets of mail IDs as part of my Git config. This way, commits in repositories related to projects at my workplace carry my office mail ID, whereas the commits made to repositories hosted in my personal GitHub account use my personal mail ID.
|
||||
|
||||
To illustrate, here is a sample snippet from my global config (maintained at `$HOME/.gitconfig`), which I will describe below.
|
||||
|
||||
|
||||
```
|
||||
[includeIf "gitdir:~/priv_scm/"]
|
||||
path = ~/priv_scm/.gitconfig
|
||||
[includeIf "gitdir:~/work_scm/"]
|
||||
path = ~/work_scm/.gitconfig
|
||||
```
|
||||
|
||||
### What's includeIf?
|
||||
|
||||
The `includeIf.condition.path` variable, part of the `include` config directives, allows you to set a custom config conditionally. Also, the path to the custom config can be set as part of the directive.
|
||||
|
||||
This directive supports three keywords: `gitdir`, `gitdir/I`, and `onbranch`. I will briefly explain `gitdir`, which I use in the code snippet above; you can learn about the other two in the [docs][3].
|
||||
|
||||
Using the `gitdir` keyword in the `includeIf` directive causes a conditional check to be performed on the pattern. Per the rule, if the current working directory matches the specified directory pattern in `gitdir`, then it picks the config from the given path. I'll apply this rule on the config snippet to show how it's evaluated.
|
||||
|
||||
In the config snippet, you can see a simple pattern, `~/`, used along with the `gitdir` keyword. This pattern is substituted with the value stored in the `$HOME` environment variable.
|
||||
|
||||
### How to use it
|
||||
|
||||
If you're using the same system to work on open source projects hosted on GitHub or GitLab and committing to Git repositories at work, you can have two top-level directories, like `$HOME/priv_scm` and `$HOME/work_scm`. Within these two directories, you can have two separate `.gitconfig` files with settings related to your `user.name` and `user.email`. However, they can also be included in a global `.gitconfig` stored at `$HOME` that can hold all the customizations common to both environments.
|
||||
|
||||
Here is a snippet of an example `$HOME/priv_scm/.gitconfig`:
|
||||
|
||||
|
||||
```
|
||||
$ cat $HOME/priv_scm/.gitconfig
|
||||
[user]
|
||||
name = Ramanathan Muthiah
|
||||
email = <personal-mailid-goes-here>
|
||||
```
|
||||
|
||||
With this config in place, you can switch directories and start working on open source projects without resetting some of the config related to Git manually. These changes are handled automatically in the main `.gitconfig` with the aid of the `includeIf` conditional directive.
|
||||
|
||||
### Git tips
|
||||
|
||||
I hope this tip helps you organize your Git projects. What are your favorite Git tips? Share them in the comments!
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/20/10/git-config
|
||||
|
||||
作者:[Ramanathan M][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/muthiahramanathan
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/email_chat_communication_message.png?itok=LKjiLnQu (Chat via email)
|
||||
[2]: https://git-scm.com/docs/git-config
|
||||
[3]: https://git-scm.com/docs/git-config#_conditional_includes
|
@ -0,0 +1,224 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: ( )
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
[#]: subject: (11 Linux Distributions You Can Rely on for Your Ancient 32-bit Computer)
|
||||
[#]: via: (https://itsfoss.com/32-bit-linux-distributions/)
|
||||
[#]: author: (Ankush Das https://itsfoss.com/author/ankush/)
|
||||
|
||||
11 Linux Distributions You Can Rely on for Your Ancient 32-bit Computer
|
||||
======
|
||||
|
||||
If you’ve been keeping up with the latest [Linux distributions][1], you must have noticed that 32-bit support has been dropped from [most of the popular Linux distributions][2]. Arch Linux, Ubuntu, Fedora, everyone has dropped the support for this older architecture.
|
||||
|
||||
But, what if you have vintage hardware with you that still needs to be revived or you want to make use of it for something? Fret not, there are still a few options left to choose from for your 32-bit system.
|
||||
|
||||
In this article, I’ve tried to compile some of the best Linux distributions that will keep on supporting 32-bit platform for next few years.
|
||||
|
||||
### Top Linux distributions that still offer 32-bit support
|
||||
|
||||
![][3]
|
||||
|
||||
This list is a bit different from [our earlier list of Linux distributions for old laptops][4]. Even 64-bit computers can be considered old if they were released before 2010. This is why some suggestions listed there included distros that only support 64-bit now.
|
||||
|
||||
The information presented here are correct as per my knowledge and findings but if you find otherwise, please let me know in the comment section.
|
||||
|
||||
Before you go on, I suppose you know [how to check if you have a 32 bit or 64 bit computer][5].
|
||||
|
||||
#### 1\. Debian
|
||||
|
||||
![Image Credits: mrneilypops / Deviantart][6]
|
||||
|
||||
Debian is a fantastic choice for 32-bit systems because they still support it with their latest stable release. At the time of writing this, the latest stable release **Debian 10 “buster”** offers a 32-bit version and is supported until 2024.
|
||||
|
||||
If you’re new to Debian, it is worth mentioning that you get solid documentation for everything on their [official wiki][7]. So, it shouldn’t be an issue to get started.
|
||||
|
||||
You can browse through the [available installers][8] to get it installed. However, before you proceed, I would recommend referring to the list of [things to remember before installing Debian][9] in addition to its [installation manual][10].
|
||||
|
||||
[Debian][11]
|
||||
|
||||
#### 2\. Slax
|
||||
|
||||
![][12]
|
||||
|
||||
If you just want to quickly boot up a device for some temporary work, Slax is an impressive option.
|
||||
|
||||
It is based on Debian but it aims to be a portable and fast option that is meant to be run through USB devices or DVDs. You can download the 32-bit ISO file from their website for free or purchase a rewritable DVD/encrypted pendrive with Slax pre-installed.
|
||||
|
||||
Of course, this isn’t meant to replace a traditional desktop operating system. But, yes, you do get the 32-bit support with Debian as its base.
|
||||
|
||||
[Slax][13]
|
||||
|
||||
#### 3\. AntiX
|
||||
|
||||
![Image Credits: Opensourcefeed][14]
|
||||
|
||||
Yet another impressive Debian-based distribution. AntiX is popularly known as a systemd-free distribution which focuses on performance while being a lightweight installation.
|
||||
|
||||
It is perfectly suitable for just about any old 32-bit system. To give you an idea, it just needs 256 MB RAM and 2.7 GB storage space at the very least. Not just easy to install, but the user experience is focused for both newbies and experienced users as well.
|
||||
|
||||
You should get the latest version based on Debian’s latest stable branch available.
|
||||
|
||||
[AntiX][15]
|
||||
|
||||
#### 4\. openSUSE
|
||||
|
||||
![][16]
|
||||
|
||||
openSUSE is an independent Linux distribution that supports 32-bit systems as well. Even though the latest regular version (Leap) does not offer 32-bit images, the rolling release edition (Tumbleweed) does provide 32-bit image.
|
||||
|
||||
It will be an entirely different experience if you’re new. However, I suggest you to go through the [reasons why you should be using openSUSE.][17]
|
||||
|
||||
It is mostly focused for developers and system administrators but you can utilize it as an average desktop user as well. It is worth noting that openSUSE is not meant to run on vintage hardware — so you have to make sure that you have at least 2 GB RAM, 40+ GB storage space, and a dual core processor.
|
||||
|
||||
[openSUSE][18]
|
||||
|
||||
#### 5\. Emmabuntüs
|
||||
|
||||
![][19]
|
||||
|
||||
Emmabuntus is an interesting distribution that aims to extend the life of the hardware to reduce waste of raw materials with 32-bit support. As a group they’re also involved in providing computers and digital technologies to schools.
|
||||
|
||||
It offers two different editions, one based on Ubuntu and the other based on Debian. If you want a longer 32-bit support, you may want to go with the Debian edition. It may not be the best option, but with a number of pre-configured software to make the Linux learning experience easy and 32-bit support, it is a decent option if you want to support their cause in the process.
|
||||
|
||||
[Emmanbuntus][20]
|
||||
|
||||
#### 6\. NixOS
|
||||
|
||||
![Nixos KDE Edition \(Image Credits: Distrowatch\)][21]
|
||||
|
||||
NixOS is yet another independent Linux distribution that supports 32-bit systems. It focuses on providing a reliable system where packages are isolated from each other.
|
||||
|
||||
This may not be directly geared towards average users but it is a KDE-powered usable distribution with a unique approach to package management. You can learn more about its [features][22] from its official website.
|
||||
|
||||
[NixOS][23]
|
||||
|
||||
#### 7\. Gentoo Linux
|
||||
|
||||
![][24]
|
||||
|
||||
If you’re an experienced Linux user and looking for a 32-bit Linux distributions, Gentoo Linux should be a great choice.
|
||||
|
||||
You can easily configure, compile, and install a kernel through package manager with Gentoo Linux if you want. Not just limited to its configurability, which it is popularly known for, you will also be able to run it without any issues on older hardware.
|
||||
|
||||
Even if you’re not an experienced user and want to give it a try, simply read through the [installation instructions][25] and you will be in for an adventure.
|
||||
|
||||
[Gentoo Linux][26]
|
||||
|
||||
#### 8\. Devuan
|
||||
|
||||
![][27]
|
||||
|
||||
[Devuan][28] is yet another systemd-free distribution. It is technically a fork of Debian, just without systemd and encouraging [Init freedom][29].
|
||||
|
||||
It may not be a very popular Linux distribution for an average user but if you want a systemd-free distribution and 32-bit support, Devuan should be a good option.
|
||||
|
||||
[Devuan][30]
|
||||
|
||||
#### 9\. Void Linux
|
||||
|
||||
![][31]
|
||||
|
||||
Void Linux is an interesting distribution independently developed by volunteers. It aims to be a general purpose OS while offering a stable rolling release cycle. It features runit as the init system instead of systemd and gives you the option of several [desktop environments][32].
|
||||
|
||||
It has an extremely impressive minimum requirement specification with just 96 MB of RAM paired up with Pentium 4 (or equivalent) chip. Try it out!
|
||||
|
||||
[Void Linux][33]
|
||||
|
||||
#### 10\. Q4OS
|
||||
|
||||
![][34]
|
||||
|
||||
Q4OS is another Debian-based distribution that focuses on providing a minimal and fast desktop user experience. It also happens to be one of the [best lightweight Linux distributions][4] in our list. It features the [Trinity desktop][35] for its 32-bit edition and you can find KDE Plasma support on 64-bit version.
|
||||
|
||||
Similar to Void Linux, Q4OS also runs on a bare minimum of at least 128 MB RAM and a 300 MHz CPU with a 3 GB storage space requirement. It should be more than enough for any vintage hardware. So, I’d say, you should definitely try it out!
|
||||
|
||||
To know more about it, you can also check out [our review of Q4OS][36].
|
||||
|
||||
[Q$OS][37]
|
||||
|
||||
#### 11: MX Linux
|
||||
|
||||
![][38]
|
||||
|
||||
If you’ve got a slightly decent configuration (not completely vintage but old), MX Linux would be my personal recommendation for 32-bit systems. It also happens to be one of the [best Linux distributions][2] for every type of user.
|
||||
|
||||
In general, MX Linux is a fantastic lightweight and customizable distribution based on Debian. You get the option to choose from KDE, XFCE or Fluxbox (which is their own desktop environment for older hardware). You can explore more about it on their official website and give it a try.
|
||||
|
||||
[MX Linux][39]
|
||||
|
||||
### Honorable Mention: Funtoo
|
||||
|
||||
Funtoo is a Gentoo-based community-developed Linux distribution. It focuses on giving you the best performance with Gentoo Linux along with some extra packages to make the experience complete for users. It is also interesting to note that the development is actually led by Gentoo Linux’s creator **Daniel Robbins**.
|
||||
|
||||
Of course, if you’re new to Linux, you may not have the best experience here. But, it does support 32-bit systems and works well across many older Intel/AMD chipsets. Explore more about it on its official website to see if you want to try it out.
|
||||
|
||||
[Funtoo][40]
|
||||
|
||||
### Wrapping Up
|
||||
|
||||
I focused the list on Debian-based and some Independent distributions. However, if you don’t mind long term support and just want to get your hands on a 32-bit supported image, you can try any Ubuntu 18.04 based distributions (or any official flavour) as well.
|
||||
|
||||
At the time of writing this, they just have a few more months of software support left. Hence, I avoided mentioning it as the primary options. But, if you like Ubuntu 18.04 based distros or any of its flavours, you do have options like [LXLE][41], [Linux Lite][42], [Zorin Lite 15][43], and other official flavours.
|
||||
|
||||
Even though most modern desktop operating systems based on Ubuntu have dropped support for 32-bit support. You still have plenty of choices to go with.
|
||||
|
||||
What would you prefer to have on your 32-bit system? Let me know your thoughts in the comments below.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://itsfoss.com/32-bit-linux-distributions/
|
||||
|
||||
作者:[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://itsfoss.com/what-is-linux-distribution/
|
||||
[2]: https://itsfoss.com/best-linux-distributions/
|
||||
[3]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/11/32-bit-linux.png?resize=800%2C450&ssl=1
|
||||
[4]: https://itsfoss.com/lightweight-linux-beginners/
|
||||
[5]: https://itsfoss.com/32-bit-64-bit-ubuntu/
|
||||
[6]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/08/debian-screenshot.png?resize=800%2C450&ssl=1
|
||||
[7]: https://wiki.debian.org/FrontPage
|
||||
[8]: https://www.debian.org/releases/buster/debian-installer/
|
||||
[9]: https://itsfoss.com/before-installing-debian/
|
||||
[10]: https://www.debian.org/releases/buster/installmanual
|
||||
[11]: https://www.debian.org/
|
||||
[12]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/04/slax-screenshot.jpg?resize=800%2C600&ssl=1
|
||||
[13]: https://www.slax.org
|
||||
[14]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/10/antiX-19-1.jpg?resize=800%2C500&ssl=1
|
||||
[15]: https://antixlinux.com
|
||||
[16]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/01/opensuse-15-1.png?resize=800%2C500&ssl=1
|
||||
[17]: https://itsfoss.com/why-use-opensuse/
|
||||
[18]: https://www.opensuse.org/
|
||||
[19]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/10/Emmabuntus-xfce.png?resize=800%2C500&ssl=1
|
||||
[20]: https://emmabuntus.org/
|
||||
[21]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/10/nixos-kde.jpg?resize=800%2C500&ssl=1
|
||||
[22]: https://nixos.org/features.html
|
||||
[23]: https://nixos.org/
|
||||
[24]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/08/gentoo-linux.png?resize=800%2C450&ssl=1
|
||||
[25]: https://www.gentoo.org/get-started/
|
||||
[26]: https://www.gentoo.org
|
||||
[27]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/06/devuan-beowulf.jpg?resize=800%2C600&ssl=1
|
||||
[28]: https://itsfoss.com/devuan-3-release/
|
||||
[29]: https://www.devuan.org/os/init-freedom
|
||||
[30]: https://www.devuan.org
|
||||
[31]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/10/void-linux.jpg?resize=800%2C450&ssl=1
|
||||
[32]: https://itsfoss.com/best-linux-desktop-environments/
|
||||
[33]: https://voidlinux.org/
|
||||
[34]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/02/q4os8Debonaire.jpg?resize=800%2C500&ssl=1
|
||||
[35]: https://en.wikipedia.org/wiki/Trinity_Desktop_Environment
|
||||
[36]: https://itsfoss.com/q4os-linux-review/
|
||||
[37]: https://q4os.org/index.html
|
||||
[38]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/08/mx-linux-19-2-kde.jpg?resize=800%2C452&ssl=1
|
||||
[39]: https://mxlinux.org/
|
||||
[40]: https://www.funtoo.org/Welcome
|
||||
[41]: https://www.lxle.net/
|
||||
[42]: https://www.linuxliteos.com
|
||||
[43]: https://zorinos.com/download/15/lite/32/
|
@ -1,56 +0,0 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: ( chenmu-kk )
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
[#]: subject: (My first contribution to open source: Making a decision)
|
||||
[#]: via: (https://opensource.com/article/19/11/my-first-open-source-contribution-mistake-decisions)
|
||||
[#]: author: (Galen Corey https://opensource.com/users/galenemco)
|
||||
|
||||
我的第一次开源贡献:做出决定
|
||||
======
|
||||
一位新的开源贡献者记录了她加入到开源项目后开始犯得五个错误。
|
||||
|
||||
![Lightbulb][1]
|
||||
|
||||
先前,我将大量的责任归咎于[冒充综合症][2]因为这延迟了我的第一个开源贡献。但还有一个我无法忽视的因素:我无法做决定来拯救我的生活。 在[成千上百万][3]的开源项目中抉择时,选择一个要做贡献的项目势不可挡。如此压迫以至于我常常不得不关掉我的笔记本去思考:“或许我可以改天再做一次”。
|
||||
|
||||
错误二是让我对做决定的恐惧妨碍了我做出第一次贡献。在理想世界里,也许我会带着一个我真正关心和想去做的特定项目开始我的开源之旅,但我有的只是总得为开源项目做出的贡献的模糊目标。对于那些处于同一处境的人来说,这儿有一些策略可以为自己的贡献挑选合适的项目(或者至少是一个好的项目)。
|
||||
|
||||
### 我经常使用的工具
|
||||
|
||||
一开始,我不认为有必要将自己局限于已经熟悉的工具或项目。有一些我之前从未使用过,但由于他们活跃的社区,或者他们解决了有趣的问题,因此看起来很有吸引力。
|
||||
|
||||
但是,考虑我投入到这个项目中的时间有限,我决定继续使用我了解的工具。要了解工具需求,你需要熟悉它的工作方式。如果您想为自己不熟悉的项目做贡献,则需要完成一个额外的步骤来了解代码的功能和目标。这个额外的工作量是有趣且值得的,但也会使你的工作时间加倍。因为我的目标主要是贡献,坚持我所知道的是缩小范围一个很好的方式。回馈一个你认为有用的项目也是一种回报。
|
||||
|
||||
### 我经常使用的工具
|
||||
|
||||
一开始,我不认为有必要将自己局限于已经熟悉的工具或项目。有一些我之前从未使用过,但由于他们活跃的社区,或者他们解决了有趣的问题,因此看起来很有吸引力。
|
||||
|
||||
但是,考虑我投入到这个项目中的时间有限,我决定继续使用我了解的工具。要了解工具需求,你需要熟悉它的工作方式。如果您想为自己不熟悉的项目做贡献,则需要完成一个额外的步骤来了解代码的功能和目标。这个额外的工作量是有趣且值得的,但也会使你的工作时间加倍。因为我的目标主要是贡献,坚持我所知道的是缩小范围一个很好的方式。回馈一个你认为有用的项目也是一种回报。
|
||||
|
||||
因为这是我第一次为开源项目做出贡献,在此过程中我有很多问题。一些项目社区非常擅长记录选择问题和提出请求的程序。一些项目社区在记录流程方面很优秀,可以用来挑选其中的项目并提交请求。尽管那时我没有选择它们,因为在此之前我从未使用过该产品,[Gatsby][4]是该实践的一个范例。
|
||||
|
||||
这种细致的文件帮助我们缓解一些不知如何去做的不安全感。它也给了我希望,项目是开放给新的贡献者,并将花时间来查看我的工作。除了贡献准则外,我还查看了问题部分,看看这个项目是否利用了“好的第一个问题”标志。这是该项目对初学者开放的另一个标志(并帮助你学会如何操作)。
|
||||
|
||||
### 总结
|
||||
|
||||
如果你还没有计划好一个项目,那么选择合适的领域进行您的第一个开源贡献已势不可挡。列出一系列标准可以帮助自己缩减选择范围,并为自己的首次提交找到一个好的项目。
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/19/11/my-first-open-source-contribution-mistake-decisions
|
||||
|
||||
作者:[Galen Corey][a]
|
||||
选题:[lujun9972][b]
|
||||
译者:[chenmu-kk](https://github.com/chenmu-kk)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://opensource.com/users/galenemco
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/lightbulb-idea-think-yearbook-lead.png?itok=5ZpCm0Jh (Lightbulb)
|
||||
[2]: https://opensource.com/article/19/10/my-first-open-source-contribution-mistakes
|
||||
[3]: https://github.blog/2018-02-08-open-source-project-trends-for-2018/
|
||||
[4]: https://www.gatsbyjs.org/contributing/
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user