From 6952434d0959acc2995b780fefb2719b5b0c7199 Mon Sep 17 00:00:00 2001 From: geekpi Date: Thu, 17 Jan 2019 09:04:59 +0800 Subject: [PATCH 001/243] translated --- ...80606 Working with modules in Fedora 28.md | 141 ------------------ ...80606 Working with modules in Fedora 28.md | 134 +++++++++++++++++ 2 files changed, 134 insertions(+), 141 deletions(-) delete mode 100644 sources/tech/20180606 Working with modules in Fedora 28.md create mode 100644 translated/tech/20180606 Working with modules in Fedora 28.md diff --git a/sources/tech/20180606 Working with modules in Fedora 28.md b/sources/tech/20180606 Working with modules in Fedora 28.md deleted file mode 100644 index ba92a626f8..0000000000 --- a/sources/tech/20180606 Working with modules in Fedora 28.md +++ /dev/null @@ -1,141 +0,0 @@ -translating----geekpi - -Working with modules in Fedora 28 -====== -![](https://fedoramagazine.org/wp-content/uploads/2018/05/modules-workingwith-816x345.jpg) -The recent Fedora Magazine article entitled [Modularity in Fedora 28 Server Edition][1] did a great job of explaining Modularity in Fedora 28. It also pointed out a few example modules and explained the problems they solve. This article puts one of those modules to practical use, covering installation and setup of Review Board 3.0 using modules. - -### Getting started - -To follow along with this article and use modules, you need a system running [Fedora 28 Server Edition][2] along with [sudo administrative privileges][3]. Also, run this command to make sure all the packages on the system are current: -``` -sudo dnf -y update - -``` - -While you can use modules on Fedora 28 non-server editions, be aware of the [caveats described in the comments of the previous article][4]. - -### Examining modules - -First, take a look at what modules are available for Fedora 28. Run the following command: -``` -dnf module list - -``` - -The output lists a collection of modules that shows the associated stream, version, and available installation profiles for each. A [d] next to a particular module stream indicates the default stream used if the named module is installed. - -The output also shows most modules have a profile named default. That’s not a coincidence, since default is the name used for the default profile. - -To see where all those modules are coming from, run: -``` -dnf repolist - -``` - -Along with the usual [fedora and updates package repositories][5], the output shows the fedora-modular and updates-modular repositories. - -The introduction stated you’d be setting up Review Board 3.0. Perhaps a module named reviewboard caught your attention in the earlier output. Next, to get some details about that module, run this command: -``` -dnf module info reviewboard - -``` - -The description confirms it is the Review Board module, but also says it’s the 2.5 stream. However, you want 3.0. Look at the available reviewboard modules: -``` -dnf module list reviewboard - -``` - -The [d] next to the 2.5 stream means it is configured as the default stream for reviewboard. Therefore, be explicit about the stream you want: -``` -dnf module info reviewboard:3.0 - -``` - -Now for even more details about the reviewboard:3.0 module, add the verbose option: -``` -dnf module info reviewboard:3.0 -v - -``` - -### Installing the Review Board 3.0 module - -Now that you’ve tracked down the module you want, install it with this command: -``` -sudo dnf -y module install reviewboard:3.0 - -``` - -The output shows the ReviewBoard package was installed, along with several other dependent packages, including several from the django:1.6 module. The installation also enabled the reviewboard:3.0 module and the dependent django:1.6 module. - -Next, to see enabled modules, use this command: -``` -dnf module list --enabled - -``` - -The output shows [e] for enabled streams, and [i] for installed profiles. In the case of the reviewboard:3.0 module, the default profile was installed. You could have specified a different profile when installing the module. In fact, you still can — and this time you don’t need to specify the 3.0 stream since it was already enabled: -``` -sudo dnf -y module install reviewboard/server - -``` - -However, installation of the reviewboard:3.0/server profile is rather uneventful. The reviewboard:3.0 module’s server profile is the same as the default profile — so there’s nothing more to install. - -### Spin up a Review Board site - -Now that the Review Board 3.0 module and its dependent packages are installed, [create a Review Board site][6] running on the local system. Without further ado or explanation, copy and paste the following commands to do that: -``` -sudo rb-site install --noinput \ - --domain-name=localhost --db-type=sqlite3 \ - --db-name=/var/www/rev.local/data/reviewboard.db \ - --admin-user=rbadmin --admin-password=secret \ - /var/www/rev.local -sudo chown -R apache /var/www/rev.local/htdocs/media/uploaded \ - /var/www/rev.local/data -sudo ln -s /var/www/rev.local/conf/apache-wsgi.conf \ - /etc/httpd/conf.d/reviewboard-localhost.conf -sudo setsebool -P httpd_can_sendmail=1 httpd_can_network_connect=1 \ - httpd_can_network_memcache=1 httpd_unified=1 -sudo systemctl enable --now httpd - -``` - -Now fire up a web browser on the system, point it at , and enjoy the shiny new Review Board site! To login as the Review Board admin, use the userid and password seen in the rb-site command above. - -### Module cleanup - -It’s good practice to clean up after yourself. To do that, remove the Review Board module and the site directory: -``` -sudo dnf -y module remove reviewboard:3.0 -sudo rm -rf /var/www/rev.local - -``` - -### Closing remarks - -Now that you’ve explored how to examine and administer the Review Board module, go experiment with the other modules available in Fedora 28. - -Learn more about using modules in Fedora 28 on the [Fedora Modularity][7] web site. The dnf manual page’s Module Command section also contains useful information. - - --------------------------------------------------------------------------------- - -via: https://fedoramagazine.org/working-modules-fedora-28/ - -作者:[Merlin Mathesius][a] -选题:[lujun9972](https://github.com/lujun9972) -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]:https://fedoramagazine.org/author/merlinm/ -[1]:https://fedoramagazine.org/modularity-fedora-28-server-edition/ -[2]:https://getfedora.org/server/ -[3]:https://fedoramagazine.org/howto-use-sudo/ -[4]:https://fedoramagazine.org/modularity-fedora-28-server-edition/#comment-476696 -[5]:https://fedoraproject.org/wiki/Repositories -[6]:https://www.reviewboard.org/docs/manual/dev/admin/installation/creating-sites/ -[7]:https://docs.pagure.org/modularity/ diff --git a/translated/tech/20180606 Working with modules in Fedora 28.md b/translated/tech/20180606 Working with modules in Fedora 28.md new file mode 100644 index 0000000000..c4cfcfe1d6 --- /dev/null +++ b/translated/tech/20180606 Working with modules in Fedora 28.md @@ -0,0 +1,134 @@ +使用 Fedora 28 中的模块 +====== +![](https://fedoramagazine.org/wp-content/uploads/2018/05/modules-workingwith-816x345.jpg) +最近 Fedora Magazine 中题为 [Fedora 28 服务器版的模块化][1]在解释 Fedora 28 中的模块化方面做得很好。它还给出了一些示例模块并解释了它们解决的问题。本文将其中一个模块用于实际应用,包括使用模块安装设置 Review Board 3.0。 + +### 入门 + +想要继续并使用模块,你需要一个 [Fedora 28 服务器版][2]并拥有 [sudo 管理权限][3]。另外,运行此命令以确保系统上的所有软件包都是最新的: + +``` +sudo dnf -y update +``` + +虽然你可以在 Fedora 28 非服务器版本上使用模块,但请注意[上一篇文章评论中提到的警告][4]。 + +### 检查模块 + +首先,看看 Fedora 28 可用的模块。运行以下命令: + +``` +dnf module list +``` + +输出列出了一组模块,这些模块显示了每个模块的关联流,版本和可用安装配置文件。模块流旁边的 [d] 表示安装命名模块时使用的默认流。 + +输出还显示大多数模块都有名为 default 的配置文件。这不是巧合,因为 default 是默认配置文件使用的名称。 + +要查看所有这些模块的来源,请运行: + +``` +dnf repolist +``` + +与通常的 [fedora 和更新包仓库][5]一起,输出还显示了fedora-modular 和 updates-modular 仓库。 + +介绍声明你将设置 Review Board 3.0。也许名为 reviewboard 的模块在之前的输出中引起了你的注意。接下来,要获取有关该模块的一些详细信息,请运行以下命令: + +``` +dnf module info reviewboard +``` + +根据描述确认它是 Review Board 模块,但也说明是 2.5 的流。然而你想要 3.0 的。查看可用的 reviewboard 模块: + +``` +dnf module list reviewboard +``` + +2.5 旁边的 [d] 表示它被配置为 reviewboard 的默认流。因此,请明确你想要的流: + +``` +dnf module info reviewboard:3.0 +``` + +有关 reviewboard:3.0 模块的更多详细信息,请添加详细选项: + +``` +dnf module info reviewboard:3.0 -v +``` + +### 安装 Review Board 3.0 模块 + +现在你已经跟踪了所需的模块,请使用以下命令安装它: + +``` +sudo dnf -y module install reviewboard:3.0 +``` + +输出显示已安装 ReviewBoard 以及其他几个依赖软件包,其中包括 django:1.6 模块中的几个软件包。安装还启用了reviewboard:3.0 模块和相关的 django:1.6 模块。 + +接下来,要查看已启用的模块,请使用以下命令: + +``` +dnf module list --enabled +``` + +输出中,[e] 表示已启用的流,[i] 表示已安装的配置。对于 reviewboard:3.0 模块,已安装默认配置。你可以在安装模块时指定其他配置。实际上,你仍然可以安装它,而且这次你不需要指定 3.0,因为它已经启用: + +``` +sudo dnf -y module install reviewboard/server +``` + +但是,安装 reviewboard:3.0/服务配置非常平常。reviewboard:3.0 模块的服务器配置与默认配置文件相同 - 因此无需安装。 + +### 启动 Review Board 网站 + +现在已经安装了 Review Board 3.0 模块及其相关软件包,[创建一个本地运行的 Review Board 网站][6]。无需解释,请复制并粘贴以下命令: + +``` +sudo rb-site install --noinput \ + --domain-name=localhost --db-type=sqlite3 \ + --db-name=/var/www/rev.local/data/reviewboard.db \ + --admin-user=rbadmin --admin-password=secret \ + /var/www/rev.local +sudo chown -R apache /var/www/rev.local/htdocs/media/uploaded \ + /var/www/rev.local/data +sudo ln -s /var/www/rev.local/conf/apache-wsgi.conf \ + /etc/httpd/conf.d/reviewboard-localhost.conf +sudo setsebool -P httpd_can_sendmail=1 httpd_can_network_connect=1 \ + httpd_can_network_memcache=1 httpd_unified=1 +sudo systemctl enable --now httpd +``` + +现在启动系统中的 Web 浏览器,打开 ,然后享受全新的 Review Board 网站!要以 Review Board 管理员身份登录,请使用上面 rb-site 命令中的用户 ID 和密码。 + +### 模块清理 + +完成后清理是个好习惯。为此,删除 Review Board 模块和站点目录: + +``` +sudo dnf -y module remove reviewboard:3.0 +sudo rm -rf /var/www/rev.local +``` + +### 总结 + +现在你已经探索了如何检测和管理 Review Board 模块,那么去体验 Fedora 28 中提供的其他模块吧。 + +在 [Fedora 模块化][7]网站上了解有关在 Fedora 28 中使用模块的更多信息。dnf 手册页中的 module 命令部分也包含了有用的信息。 + +-------------------------------------------------------------------------------- +via: https://fedoramagazine.org/working-modules-fedora-28/ +作者:[Merlin Mathesius][a] +选题:[lujun9972](https://github.com/lujun9972) +译者:[geekpi](https://github.com/geekpi) +校对:[校对者ID](https://github.com/校对者ID) +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 +[a]:https://fedoramagazine.org/author/merlinm/ +[1]:https://fedoramagazine.org/modularity-fedora-28-server-edition/ +[2]:https://getfedora.org/server/ +[3]:https://fedoramagazine.org/howto-use-sudo/ +[4]:https://fedoramagazine.org/modularity-fedora-28-server-edition/#comment-476696 +[5]:https://fedoraproject.org/wiki/Repositories +[6]:https://www.reviewboard.org/docs/manual/dev/admin/installation/creating-sites/ +[7]:https://docs.pagure.org/modularity/ From e9fa8ea72b8964b8310077abd17635d02c54a258 Mon Sep 17 00:00:00 2001 From: geekpi Date: Thu, 17 Jan 2019 09:09:31 +0800 Subject: [PATCH 002/243] translating --- sources/tech/20190104 Managing dotfiles with rcm.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20190104 Managing dotfiles with rcm.md b/sources/tech/20190104 Managing dotfiles with rcm.md index 88e239caf8..f046c70538 100644 --- a/sources/tech/20190104 Managing dotfiles with rcm.md +++ b/sources/tech/20190104 Managing dotfiles with rcm.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (geekpi) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From ca03798353994ff31073d6fe4495fb9d0c653ea2 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Thu, 17 Jan 2019 20:50:30 +0800 Subject: [PATCH 003/243] PRF:20181016 Lab 6- Network Driver.md @qhwdw --- .../tech/20181016 Lab 6- Network Driver.md | 352 ++++++++---------- 1 file changed, 155 insertions(+), 197 deletions(-) diff --git a/translated/tech/20181016 Lab 6- Network Driver.md b/translated/tech/20181016 Lab 6- Network Driver.md index 39a2689473..86e321e8c8 100644 --- a/translated/tech/20181016 Lab 6- Network Driver.md +++ b/translated/tech/20181016 Lab 6- Network Driver.md @@ -1,67 +1,66 @@ -实验 6:网络驱动程序 +Caffeinated 6.828:实验 6:网络驱动程序 ====== -### 实验 6:网络驱动程序(缺省的最终设计) ### 简介 -这个实验是缺省的最终项目中你自己能够做的最后的实验。 +这个实验是默认你能够自己完成的最终项目。 -现在你有了一个文件系统,一个典型的操作系统都应该有一个网络栈。在本实验中,你将继续为一个网卡去写一个驱动程序。这个网卡基于 Intel 82540EM 芯片,也就是众所周知的 E1000 芯片。 +现在你已经有了一个文件系统,一个典型的操作系统都应该有一个网络栈。在本实验中,你将继续为一个网卡去写一个驱动程序。这个网卡基于 Intel 82540EM 芯片,也就是众所周知的 E1000 芯片。 -##### 预备知识 +#### 预备知识 使用 Git 去提交你的实验 5 的源代码(如果还没有提交的话),获取课程仓库的最新版本,然后创建一个名为 `lab6` 的本地分支,它跟踪我们的远程分支 `origin/lab6`: ```c - athena% cd ~/6.828/lab - athena% add git - athena% git commit -am 'my solution to lab5' - nothing to commit (working directory clean) - athena% git pull - Already up-to-date. - athena% git checkout -b lab6 origin/lab6 - Branch lab6 set up to track remote branch refs/remotes/origin/lab6. - Switched to a new branch "lab6" - athena% git merge lab5 - Merge made by recursive. - fs/fs.c | 42 +++++++++++++++++++ - 1 files changed, 42 insertions(+), 0 deletions(-) - athena% +athena% cd ~/6.828/lab +athena% add git +athena% git commit -am 'my solution to lab5' +nothing to commit (working directory clean) +athena% git pull +Already up-to-date. +athena% git checkout -b lab6 origin/lab6 +Branch lab6 set up to track remote branch refs/remotes/origin/lab6. +Switched to a new branch "lab6" +athena% git merge lab5 +Merge made by recursive. + fs/fs.c | 42 +++++++++++++++++++ + 1 files changed, 42 insertions(+), 0 deletions(-) +athena% ``` -然后,仅有网卡驱动程序并不能够让你的操作系统接入因特网。在新的实验 6 的代码中,我们为你提供了网络栈和一个网络服务器。与以前的实验一样,使用 git 去拉取这个实验的代码,合并到你自己的代码中,并去浏览新的 `net/` 目录中的内容,以及在 `kern/` 中的新文件。 +然后,仅有网卡驱动程序并不能够让你的操作系统接入互联网。在新的实验 6 的代码中,我们为你提供了网络栈和一个网络服务器。与以前的实验一样,使用 git 去拉取这个实验的代码,合并到你自己的代码中,并去浏览新的 `net/` 目录中的内容,以及在 `kern/` 中的新文件。 除了写这个驱动程序以外,你还需要去创建一个访问你的驱动程序的系统调用。你将要去实现那些在网络服务器中缺失的代码,以便于在网络栈和你的驱动程序之间传输包。你还需要通过完成一个 web 服务器来将所有的东西连接到一起。你的新 web 服务器还需要你的文件系统来提供所需要的文件。 大部分的内核设备驱动程序代码都需要你自己去从头开始编写。本实验提供的指导比起前面的实验要少一些:没有框架文件、没有现成的系统调用接口、并且很多设计都由你自己决定。因此,我们建议你在开始任何单独练习之前,阅读全部的编写任务。许多学生都反应这个实验比前面的实验都难,因此请根据你的实际情况计划你的时间。 -##### 实验要求 +#### 实验要求 与以前一样,你需要做实验中全部的常规练习和至少一个挑战问题。在实验中写出你的详细答案,并将挑战问题的方案描述写入到 `answers-lab6.txt` 文件中。 -#### QEMU 的虚拟网络 +### QEMU 的虚拟网络 我们将使用 QEMU 的用户模式网络栈,因为它不需要以管理员权限运行。QEMU 的文档的[这里][1]有更多关于用户网络的内容。我们更新后的 makefile 启用了 QEMU 的用户模式网络栈和虚拟的 E1000 网卡。 缺省情况下,QEMU 提供一个运行在 IP 地址 10.2.2.2 上的虚拟路由器,它给 JOS 分配的 IP 地址是 10.0.2.15。为了简单起见,我们在 `net/ns.h` 中将这些缺省值硬编码到网络服务器上。 -虽然 QEMU 的虚拟网络允许 JOS 随意连接因特网,但 JOS 的 10.0.2.15 的地址并不能在 QEMU 中的虚拟网络之外使用(也就是说,QEMU 还得做一个 NAT),因此我们并不能直接连接到 JOS 上运行的服务器,即便是从运行 QEMU 的主机上连接也不行。为解决这个问题,我们配置 QEMU 在主机的某些端口上运行一个服务器,这个服务器简单地连接到 JOS 中的一些端口上,并在你的真实主机和虚拟网络之间传递数据。 +虽然 QEMU 的虚拟网络允许 JOS 随意连接互联网,但 JOS 的 10.0.2.15 的地址并不能在 QEMU 中的虚拟网络之外使用(也就是说,QEMU 还得做一个 NAT),因此我们并不能直接连接到 JOS 上运行的服务器,即便是从运行 QEMU 的主机上连接也不行。为解决这个问题,我们配置 QEMU 在主机的某些端口上运行一个服务器,这个服务器简单地连接到 JOS 中的一些端口上,并在你的真实主机和虚拟网络之间传递数据。 你将在端口 7(echo)和端口 80(http)上运行 JOS,为避免在共享的 Athena 机器上发生冲突,makefile 将为这些端口基于你的用户 ID 来生成转发端口。你可以运行 `make which-ports` 去找出是哪个 QEMU 端口转发到你的开发主机上。为方便起见,makefile 也提供 `make nc-7` 和 `make nc-80`,它允许你在终端上直接与运行这些端口的服务器去交互。(这些目标仅能连接到一个运行中的 QEMU 实例上;你必须分别去启动它自己的 QEMU) -##### 包检查 +#### 包检查 makefile 也可以配置 QEMU 的网络栈去记录所有的入站和出站数据包,并将它保存到你的实验目录中的 `qemu.pcap` 文件中。 使用 `tcpdump` 命令去获取一个捕获的 hex/ASCII 包转储: ``` - tcpdump -XXnr qemu.pcap +tcpdump -XXnr qemu.pcap ``` 或者,你可以使用 [Wireshark][2] 以图形化界面去检查 pcap 文件。Wireshark 也知道如何去解码和检查成百上千的网络协议。如果你在 Athena 上,你可以使用 Wireshark 的前辈:ethereal,它运行在加锁的保密互联网协议网络中。 -##### 调试 E1000 +#### 调试 E1000 我们非常幸运能够去使用仿真硬件。由于 E1000 是在软件中运行的,仿真的 E1000 能够给我们提供一个人类可读格式的报告、它的内部状态以及它遇到的任何问题。通常情况下,对祼机上做驱动程序开发的人来说,这是非常难能可贵的。 @@ -78,15 +77,15 @@ E1000 能够产生一些调试输出,因此你可以去打开一个专门的 | eeprom | 读取 EEPROM 的日志 | | interrupt | 中断和中断寄存器变更日志 | -例如,你可以使用 `make E1000_DEBUG=tx,txerr` 去打开 "tx" 和 "txerr" 日志功能。 +例如,你可以使用 `make E1000_DEBUG=tx,txerr` 去打开 “tx” 和 “txerr” 日志功能。 注意:`E1000_DEBUG` 标志仅能在打了 6.828 补丁的 QEMU 版本上工作。 你可以使用软件去仿真硬件,来做进一步的调试工作。如果你使用它时卡壳了,不明白为什么 E1000 没有如你预期那样响应你,你可以查看在 `hw/e1000.c` 中的 QEMU 的 E1000 实现。 -#### 网络服务器 +### 网络服务器 -从头开始写一个网络栈是很困难的。因此我们将使用 lwIP,它是一个开源的、轻量级 TCP/IP 协议套件,它能做包括一个网络栈在内的很多事情。你能在 [这里][3] 找到很多关于 IwIP 的信息。在这个任务中,对我们而言,lwIP 就是一个实现了一个 BSD 套接字接口和拥有一个包输入端口和包输出端口的黑盒子。 +从头开始写一个网络栈是很困难的。因此我们将使用 lwIP,它是一个开源的、轻量级 TCP/IP 协议套件,它能做包括一个网络栈在内的很多事情。你能在 [这里][3] 找到很多关于 lwIP 的信息。在这个任务中,对我们而言,lwIP 就是一个实现了一个 BSD 套接字接口和拥有一个包输入端口和包输出端口的黑盒子。 一个网络服务器其实就是一个有以下四个环境的混合体: @@ -95,59 +94,53 @@ E1000 能够产生一些调试输出,因此你可以去打开一个专门的 * 输出环境 * 定时器环境 - - 下图展示了各个环境和它们之间的关系。下图展示了包括设备驱动的整个系统,我们将在后面详细讲到它。在本实验中,你将去实现图中绿色高亮的部分。 ![Network server architecture][4] -##### 核心网络服务器环境 +#### 核心网络服务器环境 -核心网络服务器环境由套接字调用派发器和 IwIP 自身组成的。套接字调用派发器就像一个文件服务器一样。用户环境使用 stubs(可以在 `lib/nsipc.c` 中找到它)去发送 IPC 消息到核心网络服务器环境。如果你看了 `lib/nsipc.c`,你就会发现核心网络服务器与我们创建的文件服务器 `i386_init` 的工作方式是一样的,`i386_init` 是使用 NS_TYPE_NS 创建的 NS 环境,因此我们检查 `envs`,去查找这个特殊的环境类型。对于每个用户环境的 IPC,网络服务器中的派发器将调用相应的、由 IwIP 提供的、代表用户的 BSD 套接字接口函数。 +核心网络服务器环境由套接字调用派发器和 lwIP 自身组成的。套接字调用派发器就像一个文件服务器一样。用户环境使用 stubs(可以在 `lib/nsipc.c` 中找到它)去发送 IPC 消息到核心网络服务器环境。如果你看了 `lib/nsipc.c`,你就会发现核心网络服务器与我们创建的文件服务器 `i386_init` 的工作方式是一样的,`i386_init` 是使用 NS_TYPE_NS 创建的 NS 环境,因此我们检查 `envs`,去查找这个特殊的环境类型。对于每个用户环境的 IPC,网络服务器中的派发器将调用相应的、由 lwIP 提供的、代表用户的 BSD 套接字接口函数。 -普通用户环境不能直接使用 `nsipc_*` 调用。而是通过在 `lib/sockets.c` 中的函数来使用它们,这些函数提供了基于文件描述符的套接字 API。以这种方式,用户环境通过文件描述符来引用套接字,就像它们引用磁盘上的文件一样。一些操作(`connect`、`accept`、等等)是特定于套接字的,但 `read`、`write`、和 `close` 是通过 `lib/fd.c` 中一般的文件描述符设备派发代码的。就像文件服务器对所有的打开的文件维护唯一的内部 ID 一样,lwIP 也为所有的打开的套接字生成唯一的 ID。不论是文件服务器还是网络服务器,我们都使用存储在 `struct Fd` 中的信息去映射每个环境的文件描述符到这些唯一的 ID 空间上。 +普通用户环境不能直接使用 `nsipc_*` 调用。而是通过在 `lib/sockets.c` 中的函数来使用它们,这些函数提供了基于文件描述符的套接字 API。以这种方式,用户环境通过文件描述符来引用套接字,就像它们引用磁盘上的文件一样。一些操作(`connect`、`accept` 等等)是特定于套接字的,但 `read`、`write` 和 `close` 是通过 `lib/fd.c` 中一般的文件描述符设备派发代码的。就像文件服务器对所有的打开的文件维护唯一的内部 ID 一样,lwIP 也为所有的打开的套接字生成唯一的 ID。不论是文件服务器还是网络服务器,我们都使用存储在 `struct Fd` 中的信息去映射每个环境的文件描述符到这些唯一的 ID 空间上。 尽管看起来文件服务器的网络服务器的 IPC 派发器行为是一样的,但它们之间还有很重要的差别。BSD 套接字调用(像 `accept` 和 `recv`)能够无限期阻塞。如果派发器让 lwIP 去执行其中一个调用阻塞,派发器也将被阻塞,并且在整个系统中,同一时间只能有一个未完成的网络调用。由于这种情况是无法接受的,所以网络服务器使用用户级线程以避免阻塞整个服务器环境。对于每个入站 IPC 消息,派发器将创建一个线程,然后在新创建的线程上来处理请求。如果线程被阻塞,那么只有那个线程被置入休眠状态,而其它线程仍然处于运行中。 除了核心网络环境外,还有三个辅助环境。核心网络服务器环境除了接收来自用户应用程序的消息之外,它的派发器也接收来自输入环境和定时器环境的消息。 -##### 输出环境 +#### 输出环境 -在为用户环境套接字调用提供服务时,lwIP 将为网卡生成用于发送的包。IwIP 将使用 `NSREQ_OUTPUT` 去发送在 IPC 消息页参数中附加了包的 IPC 消息。输出环境负责接收这些消息,并通过你稍后创建的系统调用接口来转发这些包到设备驱动程序上。 +在为用户环境套接字调用提供服务时,lwIP 将为网卡生成用于发送的包。lwIP 将使用 `NSREQ_OUTPUT` 去发送在 IPC 消息页参数中附加了包的 IPC 消息。输出环境负责接收这些消息,并通过你稍后创建的系统调用接口来转发这些包到设备驱动程序上。 -##### 输入环境 +#### 输入环境 -网卡接收到的包需要传递到 lwIP 中。输入环境将每个由设备驱动程序接收到的包拉进内核空间(使用你将要实现的内核系统调用),并使用 `NSREQ_INPUT` IPC 消息将这些包发送到核心网络服务器环境。 +网卡接收到的包需要传递到 lwIP 中。输入环境将每个由设备驱动程序接收到的包拉进内核空间(使用你将要实现的内核系统调用),并使用 `NSREQ_INPUT` IPC 消息将这些包发送到核心网络服务器环境。 包输入功能是独立于核心网络环境的,因为在 JOS 上同时实现接收 IPC 消息并从设备驱动程序中查询或等待包有点困难。我们在 JOS 中没有实现 `select` 系统调用,这是一个允许环境去监视多个输入源以识别准备处理哪个输入的系统调用。 如果你查看了 `net/input.c` 和 `net/output.c`,你将会看到在它们中都需要去实现那个系统调用。这主要是因为实现它要依赖你的系统调用接口。在你实现了驱动程序和系统调用接口之后,你将要为这两个辅助环境写这个代码。 -##### 定时器环境 +#### 定时器环境 -定时器环境周期性发送 `NSREQ_TIMER` 类型的消息到核心服务器,以提醒它那个定时器已过期。IwIP 使用来自线程的定时器消息来实现各种网络超时。 +定时器环境周期性发送 `NSREQ_TIMER` 类型的消息到核心服务器,以提醒它那个定时器已过期。lwIP 使用来自线程的定时器消息来实现各种网络超时。 ### Part A:初始化和发送包 你的内核还没有一个时间概念,因此我们需要去添加它。这里有一个由硬件产生的每 10 ms 一次的时钟中断。每收到一个时钟中断,我们将增加一个变量值,以表示时间已过去 10 ms。它在 `kern/time.c` 中已实现,但还没有完全集成到你的内核中。 -```markdown -练习 1、为 `kern/trap.c` 中的每个时钟中断增加一个到 `time_tick` 的调用。实现 `sys_time_msec` 并增加到 `kern/syscall.c` 中的 `syscall`,以便于用户空间能够访问时间。 -``` +> **练习 1**、为 `kern/trap.c` 中的每个时钟中断增加一个到 `time_tick` 的调用。实现 `sys_time_msec` 并增加到 `kern/syscall.c` 中的 `syscall`,以便于用户空间能够访问时间。 -使用 `make INIT_CFLAGS=-DTEST_NO_NS run-testtime` 去测试你的代码。你应该会看到环境计数从 5 开始以 1 秒为间隔减少。"-DTEST_NO_NS” 参数禁止在网络服务器环境上启动,因为在当前它将导致 JOS 崩溃。 +使用 `make INIT_CFLAGS=-DTEST_NO_NS run-testtime` 去测试你的代码。你应该会看到环境计数从 5 开始以 1 秒为间隔减少。`-DTEST_NO_NS` 参数禁止在网络服务器环境上启动,因为在当前它将导致 JOS 崩溃。 #### 网卡 写驱动程序要求你必须深入了解硬件和软件中的接口。本实验将给你提供一个如何使用 E1000 接口的高度概括的文档,但是你在写驱动程序时还需要大量去查询 Intel 的手册。 -```markdown -练习 2、为开发 E1000 驱动,去浏览 Intel 的 [软件开发者手册][5]。这个手册涵盖了几个与以太网控制器紧密相关的东西。QEMU 仿真了 82540EM。 +> **练习 2**、为开发 E1000 驱动,去浏览 Intel 的 [软件开发者手册][5]。这个手册涵盖了几个与以太网控制器紧密相关的东西。QEMU 仿真了 82540EM。 -现在,你应该去浏览第 2 章,以对设备获得一个整体概念。写驱动程序时,你需要熟悉第 3 到 14 章,以及 4.1(不包括 4.1 的子节)。你也应该去参考第 13 章。其它章涵盖了 E1000 的组件,你的驱动程序并不与这些组件去交互。现在你不用担心过多细节的东西;只需要了解文档的整体结构,以便于你后面需要时容易查找。 +> 现在,你应该去浏览第 2 章,以对设备获得一个整体概念。写驱动程序时,你需要熟悉第 3 到 14 章,以及 4.1(不包括 4.1 的子节)。你也应该去参考第 13 章。其它章涵盖了 E1000 的组件,你的驱动程序并不与这些组件去交互。现在你不用担心过多细节的东西;只需要了解文档的整体结构,以便于你后面需要时容易查找。 -在阅读手册时,记住,E1000 是一个拥有很多高级特性的很复杂的设备,一个能让 E1000 工作的驱动程序仅需要它一小部分的特性和 NIC 提供的接口即可。仔细考虑一下,如何使用最简单的方式去使用网卡的接口。我们强烈推荐你在使用高级特性之前,只去写一个基本的、能够让网卡工作的驱动程序即可。 -``` +> 在阅读手册时,记住,E1000 是一个拥有很多高级特性的很复杂的设备,一个能让 E1000 工作的驱动程序仅需要它一小部分的特性和 NIC 提供的接口即可。仔细考虑一下,如何使用最简单的方式去使用网卡的接口。我们强烈推荐你在使用高级特性之前,只去写一个基本的、能够让网卡工作的驱动程序即可。 ##### PCI 接口 @@ -156,10 +149,10 @@ E1000 是一个 PCI 设备,也就是说它是插到主板的 PCI 总线插槽 我们在 `kern/pci.c` 中已经为你提供了使用 PCI 的代码。PCI 初始化是在引导期间执行的,PCI 代码遍历PCI 总线来查找设备。当它找到一个设备时,它读取它的供应商 ID 和设备 ID,然后使用这两个值作为关键字去搜索 `pci_attach_vendor` 数组。这个数组是由像下面这样的 `struct pci_driver` 条目组成: ```c - struct pci_driver { - uint32_t key1, key2; - int (*attachfn) (struct pci_func *pcif); - }; +struct pci_driver { + uint32_t key1, key2; + int (*attachfn) (struct pci_func *pcif); +}; ``` 如果发现的设备的供应商 ID 和设备 ID 与数组中条目匹配,那么 PCI 代码将调用那个条目的 `attachfn` 去执行设备初始化。(设备也可以按类别识别,那是通过 `kern/pci.c` 中其它的驱动程序表来实现的。) @@ -167,50 +160,46 @@ E1000 是一个 PCI 设备,也就是说它是插到主板的 PCI 总线插槽 绑定函数是传递一个 _PCI 函数_ 去初始化。一个 PCI 卡能够发布多个函数,虽然这个 E1000 仅发布了一个。下面是在 JOS 中如何去表示一个 PCI 函数: ```c - struct pci_func { - struct pci_bus *bus; +struct pci_func { + struct pci_bus *bus; - uint32_t dev; - uint32_t func; + uint32_t dev; + uint32_t func; - uint32_t dev_id; - uint32_t dev_class; + uint32_t dev_id; + uint32_t dev_class; - uint32_t reg_base[6]; - uint32_t reg_size[6]; - uint8_t irq_line; - }; + uint32_t reg_base[6]; + uint32_t reg_size[6]; + uint8_t irq_line; +}; ``` 上面的结构反映了在 Intel 开发者手册里第 4.1 节的表 4-1 中找到的一些条目。`struct pci_func` 的最后三个条目我们特别感兴趣的,因为它们将记录这个设备协商的内存、I/O、以及中断资源。`reg_base` 和 `reg_size` 数组包含最多六个基址寄存器或 BAR。`reg_base` 为映射到内存中的 I/O 区域(对于 I/O 端口而言是基 I/O 端口)保存了内存的基地址,`reg_size` 包含了以字节表示的大小或来自 `reg_base` 的相关基值的 I/O 端口号,而 `irq_line` 包含了为中断分配给设备的 IRQ 线。在表 4-2 的后半部分给出了 E1000 BAR 的具体涵义。 当设备调用了绑定函数后,设备已经被发现,但没有被启用。这意味着 PCI 代码还没有确定分配给设备的资源,比如地址空间和 IRQ 线,也就是说,`struct pci_func` 结构的最后三个元素还没有被填入。绑定函数将调用 `pci_func_enable`,它将去启用设备、协商这些资源、并在结构 `struct pci_func` 中填入它。 -```markdown -练习 3、实现一个绑定函数去初始化 E1000。添加一个条目到 `kern/pci.c` 中的数组 `pci_attach_vendor` 上,如果找到一个匹配的 PCI 设备就去触发你的函数(确保一定要把它放在表末尾的 `{0, 0, 0}` 条目之前)。你在 5.2 节中能找到 QEMU 仿真的 82540EM 的供应商 ID 和设备 ID。在引导期间,当 JOS 扫描 PCI 总线时,你也可以看到列出来的这些信息。 +> **练习 3**、实现一个绑定函数去初始化 E1000。添加一个条目到 `kern/pci.c` 中的数组 `pci_attach_vendor` 上,如果找到一个匹配的 PCI 设备就去触发你的函数(确保一定要把它放在表末尾的 `{0, 0, 0}` 条目之前)。你在 5.2 节中能找到 QEMU 仿真的 82540EM 的供应商 ID 和设备 ID。在引导期间,当 JOS 扫描 PCI 总线时,你也可以看到列出来的这些信息。 -到目前为止,我们通过 `pci_func_enable` 启用了 E1000 设备。通过本实验我们将添加更多的初始化。 +> 到目前为止,我们通过 `pci_func_enable` 启用了 E1000 设备。通过本实验我们将添加更多的初始化。 -我们已经为你提供了 `kern/e1000.c` 和 `kern/e1000.h` 文件,这样你就不会把构建系统搞糊涂了。不过它们现在都是空的;你需要在本练习中去填充它们。你还可能在内核的其它地方包含这个 `e1000.h` 文件。 +> 我们已经为你提供了 `kern/e1000.c` 和 `kern/e1000.h` 文件,这样你就不会把构建系统搞糊涂了。不过它们现在都是空的;你需要在本练习中去填充它们。你还可能在内核的其它地方包含这个 `e1000.h` 文件。 -当你引导你的内核时,你应该会看到它输出的信息显示 E1000 的 PCI 函数已经启用。这时你的代码已经能够通过 `make grade` 的 `pci attach` 测试了。 -``` +> 当你引导你的内核时,你应该会看到它输出的信息显示 E1000 的 PCI 函数已经启用。这时你的代码已经能够通过 `make grade` 的 `pci attach` 测试了。 ##### 内存映射的 I/O -软件与 E1000 通过内存映射的 I/O(MMIO) 来沟通。你在 JOS 的前面部分可能看到过 MMIO 两次:CGA 控制台和 LAPIC 都是通过写入和读取“内存”来控制和查询设备的。但这些读取和写入不是去往内存芯片的,而是直接到这些设备的。 +软件与 E1000 通过内存映射的 I/O(MMIO)来沟通。你在 JOS 的前面部分可能看到过 MMIO 两次:CGA 控制台和 LAPIC 都是通过写入和读取“内存”来控制和查询设备的。但这些读取和写入不是去往内存芯片的,而是直接到这些设备的。 `pci_func_enable` 为 E1000 协调一个 MMIO 区域,来存储它在 BAR 0 的基址和大小(也就是 `reg_base[0]` 和 `reg_size[0]`),这是一个分配给设备的一段物理内存地址,也就是说你可以通过虚拟地址访问它来做一些事情。由于 MMIO 区域一般分配高位物理地址(一般是 3GB 以上的位置),因此你不能使用 `KADDR` 去访问它们,因为 JOS 被限制为最大使用 256MB。因此,你可以去创建一个新的内存映射。我们将使用 `MMIOBASE`(从实验 4 开始,你的 `mmio_map_region` 区域应该确保不能被 LAPIC 使用的映射所覆盖)以上的部分。由于在 JOS 创建用户环境之前,PCI 设备就已经初始化了,因此你可以在 `kern_pgdir` 处创建映射,并且让它始终可用。 -```markdown -练习 4、在你的绑定函数中,通过调用 `mmio_map_region`(它就是你在实验 4 中写的,是为了支持 LAPIC 内存映射)为 E1000 的 BAR 0 创建一个虚拟地址映射。 +> **练习 4**、在你的绑定函数中,通过调用 `mmio_map_region`(它就是你在实验 4 中写的,是为了支持 LAPIC 内存映射)为 E1000 的 BAR 0 创建一个虚拟地址映射。 -你将希望在一个变量中记录这个映射的位置,以便于后面访问你映射的寄存器。去看一下 `kern/lapic.c` 中的 `lapic` 变量,它就是一个这样的例子。如果你使用一个指针指向设备寄存器映射,一定要声明它为 `volatile`;否则,编译器将允许缓存它的值,并可以在内存中再次访问它。 +> 你将希望在一个变量中记录这个映射的位置,以便于后面访问你映射的寄存器。去看一下 `kern/lapic.c` 中的 `lapic` 变量,它就是一个这样的例子。如果你使用一个指针指向设备寄存器映射,一定要声明它为 `volatile`;否则,编译器将允许缓存它的值,并可以在内存中再次访问它。 -为测试你的映射,尝试去输出设备状态寄存器(第 12.4.2 节)。这是一个在寄存器空间中以字节 8 开头的 4 字节寄存器。你应该会得到 `0x80080783`,它表示以 1000 MB/s 的速度启用一个全双工的链路,以及其它信息。 -``` +> 为测试你的映射,尝试去输出设备状态寄存器(第 12.4.2 节)。这是一个在寄存器空间中以字节 8 开头的 4 字节寄存器。你应该会得到 `0x80080783`,它表示以 1000 MB/s 的速度启用一个全双工的链路,以及其它信息。 -提示:你将需要一些常数,像寄存器位置和掩码位数。如果从开发者手册中复制这些东西很容易出错,并且导致调试过程很痛苦。我们建议你使用 QEMU 的 [`e1000_hw.h`][6] 头文件做为基准。我们不建议完全照抄它,因为它定义的值远超过你所需要,并且定义的东西也不见得就是你所需要的,但它仍是一个很好的参考。 +提示:你将需要一些常数,像寄存器位置和掩码位数。如果从开发者手册中复制这些东西很容易出错,并且导致调试过程很痛苦。我们建议你使用 QEMU 的 [e1000_hw.h][6] 头文件做为基准。我们不建议完全照抄它,因为它定义的值远超过你所需要,并且定义的东西也不见得就是你所需要的,但它仍是一个很好的参考。 ##### DMA @@ -224,13 +213,13 @@ E1000 是一个 PCI 设备,也就是说它是插到主板的 PCI 总线插槽 #### 发送包 -E1000 中的发送和接收功能本质上是独立的,因此我们可以同时进行发送接收。我们首先去攻克简单的数据包发送,因为我们在没有先去发送一个 “I'm here!" 包之前是无法测试接收包功能的。 +E1000 中的发送和接收功能本质上是独立的,因此我们可以同时进行发送接收。我们首先去攻克简单的数据包发送,因为我们在没有先去发送一个 “I'm here!” 包之前是无法测试接收包功能的。 首先,你需要初始化网卡以准备发送,详细步骤查看 14.5 节(不必着急看子节)。发送初始化的第一步是设置发送队列。队列的详细结构在 3.4 节中,描述符的结构在 3.3.3 节中。我们先不要使用 E1000 的 TCP offload 特性,因此你只需专注于 “传统的发送描述符格式” 即可。你应该现在就去阅读这些章节,并要熟悉这些结构。 ##### C 结构 -你可以用 C `struct` 很方便地描述 E1000 的结构。正如你在 `struct Trapframe` 中所看到的结构那样,C `struct` 可以让你很方便地在内存中描述准确的数据布局。C 可以在字段中插入数据,但是 E1000 的结构就是这样布局的,这样就不会是个问题。如果你遇到字段对齐问题,进入 GCC 查看它的 "packed” 属性。 +你可以用 C `struct` 很方便地描述 E1000 的结构。正如你在 `struct Trapframe` 中所看到的结构那样,C `struct` 可以让你很方便地在内存中描述准确的数据布局。C 可以在字段中插入数据,但是 E1000 的结构就是这样布局的,这样就不会是个问题。如果你遇到字段对齐问题,进入 GCC 查看它的 "packed” 属性。 查看手册中表 3-8 所给出的一个传统的发送描述符,将它复制到这里作为一个示例: @@ -246,31 +235,29 @@ E1000 中的发送和接收功能本质上是独立的,因此我们可以同 从结构右上角第一个字节开始,我们将它转变成一个 C 结构,从上到下,从右到左读取。如果你从右往左看,你将看到所有的字段,都非常适合一个标准大小的类型: ```c - struct tx_desc - { - uint64_t addr; - uint16_t length; - uint8_t cso; - uint8_t cmd; - uint8_t status; - uint8_t css; - uint16_t special; - }; +struct tx_desc +{ + uint64_t addr; + uint16_t length; + uint8_t cso; + uint8_t cmd; + uint8_t status; + uint8_t css; + uint16_t special; +}; ``` 你的驱动程序将为发送描述符数组去保留内存,并由发送描述符指向到包缓冲区。有几种方式可以做到,从动态分配页到在全局变量中简单地声明它们。无论你如何选择,记住,E1000 是直接访问物理内存的,意味着它能访问的任何缓存区在物理内存中必须是连续的。 处理包缓存也有几种方式。我们推荐从最简单的开始,那就是在驱动程序初始化期间,为每个描述符保留包缓存空间,并简单地将包数据复制进预留的缓冲区中或从其中复制出来。一个以太网包最大的尺寸是 1518 字节,这就限制了这些缓存区的大小。主流的成熟驱动程序都能够动态分配包缓存区(即:当网络使用率很低时,减少内存使用量),或甚至跳过缓存区,直接由用户空间提供(就是“零复制”技术),但我们还是从简单开始为好。 -```markdown -练习 5、执行一个 14.5 节中的初始化步骤(它的子节除外)。对于寄存器的初始化过程使用 13 节作为参考,对发送描述符和发送描述符数组参考 3.3.3 节和 3.4 节。 +> **练习 5**、执行一个 14.5 节中的初始化步骤(它的子节除外)。对于寄存器的初始化过程使用 13 节作为参考,对发送描述符和发送描述符数组参考 3.3.3 节和 3.4 节。 -要记住,在发送描述符数组中要求对齐,并且数组长度上有限制。因为 TDLEN 必须是 128 字节对齐的,而每个发送描述符是 16 字节,你的发送描述符数组必须是 8 个发送描述符的倍数。并且不能使用超过 64 个描述符,以及不能在我们的发送环形缓存测试中溢出。 +> 要记住,在发送描述符数组中要求对齐,并且数组长度上有限制。因为 TDLEN 必须是 128 字节对齐的,而每个发送描述符是 16 字节,你的发送描述符数组必须是 8 个发送描述符的倍数。并且不能使用超过 64 个描述符,以及不能在我们的发送环形缓存测试中溢出。 -对于 TCTL.COLD,你可以假设为全双工操作。对于 TIPG、IEEE 802.3 标准的 IPG(不要使用 14.5 节中表上的值),参考在 13.4.34 节中表 13-77 中描述的缺省值。 -``` +> 对于 TCTL.COLD,你可以假设为全双工操作。对于 TIPG、IEEE 802.3 标准的 IPG(不要使用 14.5 节中表上的值),参考在 13.4.34 节中表 13-77 中描述的缺省值。 -尝试运行 `make E1000_DEBUG=TXERR,TX qemu`。如果你使用的是打了 6.828 补丁的 QEMU,当你设置 TDT(发送描述符尾部)寄存器时你应该会看到一个 “e1000: tx disabled" 的信息,并且不会有更多 "e1000” 信息了。 +尝试运行 `make E1000_DEBUG=TXERR,TX qemu`。如果你使用的是打了 6.828 补丁的 QEMU,当你设置 TDT(发送描述符尾部)寄存器时你应该会看到一个 “e1000: tx disabled” 的信息,并且不会有更多 “e1000” 信息了。 现在,发送初始化已经完成,你可以写一些代码去发送一个数据包,并且通过一个系统调用使它可以访问用户空间。你可以将要发送的数据包添加到发送队列的尾部,也就是说复制数据包到下一个包缓冲区中,然后更新 TDT 寄存器去通知网卡在发送队列中有另外的数据包。(注意,TDT 是一个进入发送描述符数组的索引,不是一个字节偏移量;关于这一点文档中说明的不是很清楚。) @@ -278,76 +265,64 @@ E1000 中的发送和接收功能本质上是独立的,因此我们可以同 如果用户调用你的发送系统调用,但是下一个描述符的 DD 位没有设置,表示那个发送队列已满,该怎么办?在这种情况下,你该去决定怎么办了。你可以简单地丢弃数据包。网络协议对这种情况的处理很灵活,但如果你丢弃大量的突发数据包,协议可能不会去重新获得它们。可能需要你替代网络协议告诉用户环境让它重传,就像你在 `sys_ipc_try_send` 中做的那样。在环境上回推产生的数据是有好处的。 -``` -练习 6、写一个函数去发送一个数据包,它需要检查下一个描述符是否空闲、复制包数据到下一个描述符并更新 TDT。确保你处理的发送队列是满的。 -``` +> **练习 6**、写一个函数去发送一个数据包,它需要检查下一个描述符是否空闲、复制包数据到下一个描述符并更新 TDT。确保你处理的发送队列是满的。 现在,应该去测试你的包发送代码了。通过从内核中直接调用你的发送函数来尝试发送几个包。在测试时,你不需要去创建符合任何特定网络协议的数据包。运行 `make E1000_DEBUG=TXERR,TX qemu` 去测试你的代码。你应该看到类似下面的信息: ```c - e1000: index 0: 0x271f00 : 9000002a 0 - ... +e1000: index 0: 0x271f00 : 9000002a 0 +... ``` -在你发送包时,每行都给出了在发送数组中的序号、那个发送的描述符的缓存地址、`cmd/CSO/length` 字段、以及 `special/CSS/status` 字段。如果 QEMU 没有从你的发送描述符中输出你预期的值,检查你的描述符中是否有合适的值和你配置的正确的 TDBAL 和 TDBAH。如果你收到的是 "e1000: TDH wraparound @0, TDT x, TDLEN y" 的信息,意味着 E1000 的发送队列持续不断地运行(如果 QEMU 不去检查它,它将是一个无限循环),这意味着你没有正确地维护 TDT。如果你收到了许多 "e1000: tx disabled" 的信息,那么意味着你没有正确设置发送控制寄存器。 +在你发送包时,每行都给出了在发送数组中的序号、那个发送的描述符的缓存地址、`cmd/CSO/length` 字段、以及 `special/CSS/status` 字段。如果 QEMU 没有从你的发送描述符中输出你预期的值,检查你的描述符中是否有合适的值和你配置的正确的 TDBAL 和 TDBAH。如果你收到的是 “e1000: TDH wraparound @0, TDT x, TDLEN y” 的信息,意味着 E1000 的发送队列持续不断地运行(如果 QEMU 不去检查它,它将是一个无限循环),这意味着你没有正确地维护 TDT。如果你收到了许多 “e1000: tx disabled” 的信息,那么意味着你没有正确设置发送控制寄存器。 -一旦 QEMU 运行,你就可以运行 `tcpdump -XXnr qemu.pcap` 去查看你发送的包数据。如果从 QEMU 中看到预期的 "e1000: index” 信息,但你捕获的包是空的,再次检查你发送的描述符,是否填充了每个必需的字段和位。(E1000 或许已经遍历了你的发送描述符,但它认为不需要去发送) +一旦 QEMU 运行,你就可以运行 `tcpdump -XXnr qemu.pcap` 去查看你发送的包数据。如果从 QEMU 中看到预期的 “e1000: index” 信息,但你捕获的包是空的,再次检查你发送的描述符,是否填充了每个必需的字段和位。(E1000 或许已经遍历了你的发送描述符,但它认为不需要去发送) -``` -练习 7、添加一个系统调用,让你从用户空间中发送数据包。详细的接口由你来决定。但是不要忘了检查从用户空间传递给内核的所有指针。 -``` +> **练习 7**、添加一个系统调用,让你从用户空间中发送数据包。详细的接口由你来决定。但是不要忘了检查从用户空间传递给内核的所有指针。 #### 发送包:网络服务器 现在,你已经有一个系统调用接口可以发送包到你的设备驱动程序端了。输出辅助环境的目标是在一个循环中做下面的事情:从核心网络服务器中接收 `NSREQ_OUTPUT` IPC 消息,并使用你在上面增加的系统调用去发送伴随这些 IPC 消息的数据包。这个 `NSREQ_OUTPUT` IPC 是通过 `net/lwip/jos/jif/jif.c` 中的 `low_level_output` 函数来发送的。它集成 lwIP 栈到 JOS 的网络系统。每个 IPC 将包含一个页,这个页由一个 `union Nsipc` 和在 `struct jif_pkt pkt` 字段中的一个包组成(查看 `inc/ns.h`)。`struct jif_pkt` 看起来像下面这样: ```c - struct jif_pkt { - int jp_len; - char jp_data[0]; - }; +struct jif_pkt { + int jp_len; + char jp_data[0]; +}; ``` `jp_len` 表示包的长度。在 IPC 页上的所有后续字节都是为了包内容。在结构的结尾处使用一个长度为 0 的数组来表示缓存没有一个预先确定的长度(像 `jp_data` 一样),这是一个常见的 C 技巧(也有人说这是一个令人讨厌的做法)。因为 C 并不做数组边界的检查,只要你确保结构后面有足够的未使用内存即可,你可以把 `jp_data` 作为一个任意大小的数组来使用。 当设备驱动程序的发送队列中没有足够的空间时,一定要注意在设备驱动程序、输出环境和核心网络服务器之间的交互。核心网络服务器使用 IPC 发送包到输出环境。如果输出环境在由于一个发送包的系统调用而挂起,导致驱动程序没有足够的缓存去容纳新数据包,这时核心网络服务器将阻塞以等待输出服务器去接收 IPC 调用。 -```markdown -练习 8、实现 `net/output.c`。 -``` +> **练习 8**、实现 `net/output.c`。 你可以使用 `net/testoutput.c` 去测试你的输出代码而无需整个网络服务器参与。尝试运行 `make E1000_DEBUG=TXERR,TX run-net_testoutput`。你将看到如下的输出: ```c - Transmitting packet 0 - e1000: index 0: 0x271f00 : 9000009 0 - Transmitting packet 1 - e1000: index 1: 0x2724ee : 9000009 0 - ... +Transmitting packet 0 +e1000: index 0: 0x271f00 : 9000009 0 +Transmitting packet 1 +e1000: index 1: 0x2724ee : 9000009 0 +... ``` 运行 `tcpdump -XXnr qemu.pcap` 将输出: - ```c - reading from file qemu.pcap, link-type EN10MB (Ethernet) - -5:00:00.600186 [|ether] - 0x0000: 5061 636b 6574 2030 30 Packet.00 - -5:00:00.610080 [|ether] - 0x0000: 5061 636b 6574 2030 31 Packet.01 - ... +reading from file qemu.pcap, link-type EN10MB (Ethernet) +-5:00:00.600186 [|ether] + 0x0000: 5061 636b 6574 2030 30 Packet.00 +-5:00:00.610080 [|ether] + 0x0000: 5061 636b 6574 2030 31 Packet.01 +... ``` 使用更多的数据包去测试,可以运行 `make E1000_DEBUG=TXERR,TX NET_CFLAGS=-DTESTOUTPUT_COUNT=100 run-net_testoutput`。如果它导致你的发送队列溢出,再次检查你的 DD 状态位是否正确,以及是否告诉硬件去设置 DD 状态位(使用 RS 命令位)。 你的代码应该会通过 `make grade` 的 `testoutput` 测试。 -``` -问题 - - 1、你是如何构造你的发送实现的?在实践中,如果发送缓存区满了,你该如何处理? -``` - +> **问题 1**、你是如何构造你的发送实现的?在实践中,如果发送缓存区满了,你该如何处理? ### Part B:接收包和 web 服务器 @@ -355,9 +330,7 @@ E1000 中的发送和接收功能本质上是独立的,因此我们可以同 就像你在发送包中做的那样,你将去配置 E1000 去接收数据包,并提供一个接收描述符队列和接收描述符。在 3.2 节中描述了接收包的操作,包括接收队列结构和接收描述符、以及在 14.4 节中描述的详细的初始化过程。 -``` -练习 9、阅读 3.2 节。你可以忽略关于中断和 offload 校验和方面的内容(如果在后面你想去使用这些特性,可以再返回去阅读),你现在不需要去考虑阈值的细节和网卡内部缓存是如何工作的。 -``` +> **练习 9**、阅读 3.2 节。你可以忽略关于中断和 offload 校验和方面的内容(如果在后面你想去使用这些特性,可以再返回去阅读),你现在不需要去考虑阈值的细节和网卡内部缓存是如何工作的。 除了接收队列是由一系列的等待入站数据包去填充的空缓存包以外,接收队列的其它部分与发送队列非常相似。所以,当网络空闲时,发送队列是空的(因为所有的包已经被发送出去了),而接收队列是满的(全部都是空缓存包)。 @@ -365,123 +338,108 @@ E1000 中的发送和接收功能本质上是独立的,因此我们可以同 如果 E1000 在一个接收描述符中接收到了一个比包缓存还要大的数据包,它将按需从接收队列中检索尽可能多的描述符以保存数据包的全部内容。为表示发生了这种情况,它将在所有的这些描述符上设置 DD 状态位,但仅在这些描述符的最后一个上设置 EOP 状态位。在你的驱动程序上,你可以去处理这种情况,也可以简单地配置网卡拒绝接收这种”长包“(这种包也被称为”巨帧“),你要确保接收缓存有足够的空间尽可能地去存储最大的标准以太网数据包(1518 字节)。 -```markdown -练习 10、设置接收队列并按 14.4 节中的流程去配置 E1000。你可以不用支持 ”长包“ 或多播。到目前为止,我们不用去配置网卡使用中断;如果你在后面决定去使用接收中断时可以再去改。另外,配置 E1000 去除以太网的 CRC 校验,因为我们的评级脚本要求必须去掉校验。 +> **练习 10**、设置接收队列并按 14.4 节中的流程去配置 E1000。你可以不用支持 ”长包“ 或多播。到目前为止,我们不用去配置网卡使用中断;如果你在后面决定去使用接收中断时可以再去改。另外,配置 E1000 去除以太网的 CRC 校验,因为我们的评级脚本要求必须去掉校验。 -默认情况下,网卡将过滤掉所有的数据包。你必须使用网卡的 MAC 地址去配置接收地址寄存器(RAL 和 RAH)以接收发送到这个网卡的数据包。你可以简单地硬编码 QEMU 的默认 MAC 地址 52:54:00:12:34:56(我们已经在 lwIP 中硬编码了这个地址,因此这样做不会有问题)。使用字节顺序时要注意;MAC 地址是从低位字节到高位字节的方式来写的,因此 52:54:00:12 是 MAC 地址的低 32 位,而 34:56 是它的高 16 位。 +> 默认情况下,网卡将过滤掉所有的数据包。你必须使用网卡的 MAC 地址去配置接收地址寄存器(RAL 和 RAH)以接收发送到这个网卡的数据包。你可以简单地硬编码 QEMU 的默认 MAC 地址 52:54:00:12:34:56(我们已经在 lwIP 中硬编码了这个地址,因此这样做不会有问题)。使用字节顺序时要注意;MAC 地址是从低位字节到高位字节的方式来写的,因此 52:54:00:12 是 MAC 地址的低 32 位,而 34:56 是它的高 16 位。 -E1000 的接收缓存区大小仅支持几个指定的设置值(在 13.4.22 节中描述的 RCTL.BSIZE 值)。如果你的接收包缓存够大,并且拒绝长包,那你就不用担心跨越多个缓存区的包。另外,要记住的是,和发送一样,接收队列和包缓存必须是连接的物理内存。 +> E1000 的接收缓存区大小仅支持几个指定的设置值(在 13.4.22 节中描述的 RCTL.BSIZE 值)。如果你的接收包缓存够大,并且拒绝长包,那你就不用担心跨越多个缓存区的包。另外,要记住的是,和发送一样,接收队列和包缓存必须是连接的物理内存。 -你应该使用至少 128 个接收描述符。 -``` +> 你应该使用至少 128 个接收描述符。 -现在,你可以做接收功能的基本测试了,甚至都无需写代码去接收包了。运行 `make E1000_DEBUG=TX,TXERR,RX,RXERR,RXFILTER run-net_testinput`。`testinput` 将发送一个 ARP(地址解析协议)通告包(使用你的包发送的系统调用),而 QEMU 将自动回复它,即便是你的驱动尚不能接收这个回复,你也应该会看到一个 "e1000: unicast match[0]: 52:54:00:12:34:56" 的消息,表示 E1000 接收到一个包,并且匹配了配置的接收过滤器。如果你看到的是一个 "e1000: unicast mismatch: 52:54:00:12:34:56” 消息,表示 E1000 过滤掉了这个包,意味着你的 RAL 和 RAH 的配置不正确。确保你按正确的顺序收到了字节,并不要忘记设置 RAH 中的 "Address Valid” 位。如果你没有收到任何 "e1000” 消息,或许是你没有正确地启用接收功能。 +现在,你可以做接收功能的基本测试了,甚至都无需写代码去接收包了。运行 `make E1000_DEBUG=TX,TXERR,RX,RXERR,RXFILTER run-net_testinput`。`testinput` 将发送一个 ARP(地址解析协议)通告包(使用你的包发送的系统调用),而 QEMU 将自动回复它,即便是你的驱动尚不能接收这个回复,你也应该会看到一个 “e1000: unicast match[0]: 52:54:00:12:34:56” 的消息,表示 E1000 接收到一个包,并且匹配了配置的接收过滤器。如果你看到的是一个 “e1000: unicast mismatch: 52:54:00:12:34:56” 消息,表示 E1000 过滤掉了这个包,意味着你的 RAL 和 RAH 的配置不正确。确保你按正确的顺序收到了字节,并不要忘记设置 RAH 中的 “Address Valid” 位。如果你没有收到任何 “e1000” 消息,或许是你没有正确地启用接收功能。 现在,你准备去实现接收数据包。为了接收数据包,你的驱动程序必须持续跟踪希望去保存下一下接收到的包的描述符(提示:按你的设计,这个功能或许已经在 E1000 中的一个寄存器来实现了)。与发送类似,官方文档上表示,RDH 寄存器状态并不能从软件中可靠地读取,因为确定一个包是否被发送到描述符的包缓存中,你需要去读取描述符中的 DD 状态位。如果 DD 位被设置,你就可以从那个描述符的缓存中复制出这个数据包,然后通过更新队列的尾索引 RDT 来告诉网卡那个描述符是空闲的。 如果 DD 位没有被设置,表明没有接收到包。这就与发送队列满的情况一样,这时你可以有几种做法。你可以简单地返回一个 ”重传“ 错误来要求对端重发一次。对于满的发送队列,由于那是个临时状况,这种做法还是很好的,但对于空的接收队列来说就不太合理了,因为接收队列可能会保持好长一段时间的空的状态。第二个方法是挂起调用环境,直到在接收队列中处理了这个包为止。这个策略非常类似于 `sys_ipc_recv`。就像在 IPC 的案例中,因为我们每个 CPU 仅有一个内核栈,一旦我们离开内核,栈上的状态就会被丢弃。我们需要设置一个标志去表示那个环境由于接收队列下溢被挂起并记录系统调用参数。这种方法的缺点是过于复杂:E1000 必须被指示去产生接收中断,并且驱动程序为了恢复被阻塞等待一个包的环境,必须处理这个中断。 -``` -练习 11、写一个函数从 E1000 中接收一个包,然后通过一个系统调用将它发布到用户空间。确保你将接收队列处理成空的。 -``` +> **练习 11**、写一个函数从 E1000 中接收一个包,然后通过一个系统调用将它发布到用户空间。确保你将接收队列处理成空的。 -```markdown -小挑战!如果发送队列是满的或接收队列是空的,环境和你的驱动程序可能会花费大量的 CPU 周期是轮询、等待一个描述符。一旦完成发送或接收描述符,E1000 能够产生一个中断,以避免轮询。修改你的驱动程序,处理发送和接收队列是以中断而不是轮询的方式进行。 +. -注意,一旦确定为中断,它将一直处于中断状态,直到你的驱动程序明确处理完中断为止。在你的中断服务程序中,一旦处理完成要确保清除掉中断状态。如果你不那样做,从你的中断服务程序中返回后,CPU 将再次跳转到你的中断服务程序中。除了在 E1000 网卡上清除中断外,也需要使用 `lapic_eoi` 在 LAPIC 上清除中断。 -``` +> 小挑战!如果发送队列是满的或接收队列是空的,环境和你的驱动程序可能会花费大量的 CPU 周期是轮询、等待一个描述符。一旦完成发送或接收描述符,E1000 能够产生一个中断,以避免轮询。修改你的驱动程序,处理发送和接收队列是以中断而不是轮询的方式进行。 + +> 注意,一旦确定为中断,它将一直处于中断状态,直到你的驱动程序明确处理完中断为止。在你的中断服务程序中,一旦处理完成要确保清除掉中断状态。如果你不那样做,从你的中断服务程序中返回后,CPU 将再次跳转到你的中断服务程序中。除了在 E1000 网卡上清除中断外,也需要使用 `lapic_eoi` 在 LAPIC 上清除中断。 #### 接收包:网络服务器 在网络服务器输入环境中,你需要去使用你的新的接收系统调用以接收数据包,并使用 `NSREQ_INPUT` IPC 消息将它传递到核心网络服务器环境。这些 IPC 输入消息应该会有一个页,这个页上绑定了一个 `union Nsipc`,它的 `struct jif_pkt pkt` 字段中有从网络上接收到的包。 -```markdown -练习 12、实现 `net/input.c`。 -``` +> **练习 12**、实现 `net/input.c`。 使用 `make E1000_DEBUG=TX,TXERR,RX,RXERR,RXFILTER run-net_testinput` 再次运行 `testinput`,你应该会看到: ```c - Sending ARP announcement... - Waiting for packets... - e1000: index 0: 0x26dea0 : 900002a 0 - e1000: unicast match[0]: 52:54:00:12:34:56 - input: 0000 5254 0012 3456 5255 0a00 0202 0806 0001 - input: 0010 0800 0604 0002 5255 0a00 0202 0a00 0202 - input: 0020 5254 0012 3456 0a00 020f 0000 0000 0000 - input: 0030 0000 0000 0000 0000 0000 0000 0000 0000 +Sending ARP announcement... +Waiting for packets... +e1000: index 0: 0x26dea0 : 900002a 0 +e1000: unicast match[0]: 52:54:00:12:34:56 +input: 0000 5254 0012 3456 5255 0a00 0202 0806 0001 +input: 0010 0800 0604 0002 5255 0a00 0202 0a00 0202 +input: 0020 5254 0012 3456 0a00 020f 0000 0000 0000 +input: 0030 0000 0000 0000 0000 0000 0000 0000 0000 ``` -"input:” 打头的行是一个 QEMU 的 ARP 回复的十六进制转储。 +“input:” 打头的行是一个 QEMU 的 ARP 回复的十六进制转储。 你的代码应该会通过 `make grade` 的 `testinput` 测试。注意,在没有发送至少一个包去通知 QEMU 中的 JOS 的 IP 地址上时,是没法去测试包接收的,因此在你的发送代码中的 bug 可能会导致测试失败。 为彻底地测试你的网络代码,我们提供了一个称为 `echosrv` 的守护程序,它在端口 7 上设置运行 `echo` 的服务器,它将回显通过 TCP 连接发送给它的任何内容。使用 `make E1000_DEBUG=TX,TXERR,RX,RXERR,RXFILTER run-echosrv` 在一个终端中启动 `echo` 服务器,然后在另一个终端中通过 `make nc-7` 去连接它。你输入的每一行都被这个服务器回显出来。每次在仿真的 E1000 上接收到一个包,QEMU 将在控制台上输出像下面这样的内容: ```c - e1000: unicast match[0]: 52:54:00:12:34:56 - e1000: index 2: 0x26ea7c : 9000036 0 - e1000: index 3: 0x26f06a : 9000039 0 - e1000: unicast match[0]: 52:54:00:12:34:56 +e1000: unicast match[0]: 52:54:00:12:34:56 +e1000: index 2: 0x26ea7c : 9000036 0 +e1000: index 3: 0x26f06a : 9000039 0 +e1000: unicast match[0]: 52:54:00:12:34:56 ``` 做到这一点后,你应该也就能通过 `echosrv` 的测试了。 -``` -问题 +> **问题 2**、你如何构造你的接收实现?在实践中,如果接收队列是空的并且一个用户环境要求下一个入站包,你怎么办? - 2、你如何构造你的接收实现?在实践中,如果接收队列是空的并且一个用户环境要求下一个入站包,你怎么办? -``` +. +> 小挑战!在开发者手册中阅读关于 EEPROM 的内容,并写出从 EEPROM 中加载 E1000 的 MAC 地址的代码。目前,QEMU 的默认 MAC 地址是硬编码到你的接收初始化代码和 lwIP 中的。修复你的初始化代码,让它能够从 EEPROM 中读取 MAC 地址,和增加一个系统调用去传递 MAC 地址到 lwIP 中,并修改 lwIP 去从网卡上读取 MAC 地址。通过配置 QEMU 使用一个不同的 MAC 地址去测试你的变更。 -``` -小挑战!在开发者手册中阅读关于 EEPROM 的内容,并写出从 EEPROM 中加载 E1000 的 MAC 地址的代码。目前,QEMU 的默认 MAC 地址是硬编码到你的接收初始化代码和 lwIP 中的。修复你的初始化代码,让它能够从 EEPROM 中读取 MAC 地址,和增加一个系统调用去传递 MAC 地址到 lwIP 中,并修改 lwIP 去从网卡上读取 MAC 地址。通过配置 QEMU 使用一个不同的 MAC 地址去测试你的变更。 -``` +. -``` -小挑战!修改你的 E1000 驱动程序去使用 "零复制" 技术。目前,数据包是从用户空间缓存中复制到发送包缓存中,和从接收包缓存中复制回到用户空间缓存中。一个使用 ”零复制“ 技术的驱动程序可以通过直接让用户空间和 E1000 共享包缓存内存来实现。还有许多不同的方法去实现 ”零复制“,包括映射内容分配的结构到用户空间或直接传递用户提供的缓存到 E1000。不论你选择哪种方法,都要注意你如何利用缓存的问题,因为你不能在用户空间代码和 E1000 之间产生争用。 -``` +> 小挑战!修改你的 E1000 驱动程序去使用 "零复制" 技术。目前,数据包是从用户空间缓存中复制到发送包缓存中,和从接收包缓存中复制回到用户空间缓存中。一个使用 ”零复制“ 技术的驱动程序可以通过直接让用户空间和 E1000 共享包缓存内存来实现。还有许多不同的方法去实现 ”零复制“,包括映射内容分配的结构到用户空间或直接传递用户提供的缓存到 E1000。不论你选择哪种方法,都要注意你如何利用缓存的问题,因为你不能在用户空间代码和 E1000 之间产生争用。 -``` -小挑战!把 ”零复制“ 的概念用到 lwIP 中。 +. -一个典型的包是由许多头构成的。用户发送的数据被发送到 lwIP 中的一个缓存中。TCP 层要添加一个 TCP 包头,IP 层要添加一个 IP 包头,而 MAC 层有一个以太网头。甚至还有更多的部分增加到包上,这些部分要正确地连接到一起,以便于设备驱动程序能够发送最终的包。 +> 小挑战!把 “零复制” 的概念用到 lwIP 中。 -E1000 的发送描述符设计是非常适合收集分散在内存中的包片段的,像在 IwIP 中创建的包的帧。如果你排队多个发送描述符,但仅设置最后一个描述符的 EOP 命令位,那么 E1000 将在内部把这些描述符串成包缓存,并在它们标记完 EOP 后仅发送串起来的缓存。因此,独立的包片段不需要在内存中把它们连接到一起。 +> 一个典型的包是由许多头构成的。用户发送的数据被发送到 lwIP 中的一个缓存中。TCP 层要添加一个 TCP 包头,IP 层要添加一个 IP 包头,而 MAC 层有一个以太网头。甚至还有更多的部分增加到包上,这些部分要正确地连接到一起,以便于设备驱动程序能够发送最终的包。 -修改你的驱动程序,以使它能够发送由多个缓存且无需复制的片段组成的包,并且修改 lwIP 去避免它合并包片段,因为它现在能够正确处理了。 -``` +> E1000 的发送描述符设计是非常适合收集分散在内存中的包片段的,像在 lwIP 中创建的包的帧。如果你排队多个发送描述符,但仅设置最后一个描述符的 EOP 命令位,那么 E1000 将在内部把这些描述符串成包缓存,并在它们标记完 EOP 后仅发送串起来的缓存。因此,独立的包片段不需要在内存中把它们连接到一起。 -```markdown -小挑战!增加你的系统调用接口,以便于它能够为多于一个的用户环境提供服务。如果有多个网络栈(和多个网络服务器)并且它们各自都有自己的 IP 地址运行在用户模式中,这将是非常有用的。接收系统调用将决定它需要哪个环境来转发每个入站的包。 +> 修改你的驱动程序,以使它能够发送由多个缓存且无需复制的片段组成的包,并且修改 lwIP 去避免它合并包片段,因为它现在能够正确处理了。 -注意,当前的接口并不知道两个包之间有何不同,并且如果多个环境去调用包接收的系统调用,各个环境将得到一个入站包的子集,而那个子集可能并不包含调用环境指定的那个包。 +. -在 [这篇][7] 外内核论文的 2.2 节和 3 节中对这个问题做了深度解释,并解释了在内核中(如 JOS)处理它的一个方法。用这个论文中的方法去解决这个问题,你不需要一个像论文中那么复杂的方案。 -``` +> 小挑战!增加你的系统调用接口,以便于它能够为多于一个的用户环境提供服务。如果有多个网络栈(和多个网络服务器)并且它们各自都有自己的 IP 地址运行在用户模式中,这将是非常有用的。接收系统调用将决定它需要哪个环境来转发每个入站的包。 + +> 注意,当前的接口并不知道两个包之间有何不同,并且如果多个环境去调用包接收的系统调用,各个环境将得到一个入站包的子集,而那个子集可能并不包含调用环境指定的那个包。 + +> 在 [这篇][7] 外内核论文的 2.2 节和 3 节中对这个问题做了深度解释,并解释了在内核中(如 JOS)处理它的一个方法。用这个论文中的方法去解决这个问题,你不需要一个像论文中那么复杂的方案。 #### Web 服务器 一个最简单的 web 服务器类型是发送一个文件的内容到请求的客户端。我们在 `user/httpd.c` 中提供了一个非常简单的 web 服务器的框架代码。这个框架内码处理入站连接并解析请求头。 -```markdown -练习 13、这个 web 服务器中缺失了发送一个文件的内容到客户端的处理代码。通过实现 `send_file` 和 `send_data` 完成这个 web 服务器。 -``` +> **练习 13**、这个 web 服务器中缺失了发送一个文件的内容到客户端的处理代码。通过实现 `send_file` 和 `send_data` 完成这个 web 服务器。 -在你完成了这个 web 服务器后,启动这个 web 服务器(`make run-httpd-nox`),使用你喜欢的浏览器去浏览 http:// _host_ : _port_ /index.html 地址。其中 _host_ 是运行 QEMU 的计算机的名字(如果你在 athena 上运行 QEMU,使用 `hostname.mit.edu`(其中 hostname 是在 athena 上运行 `hostname` 命令的输出,或者如果你在运行 QEMU 的机器上运行 web 浏览器的话,直接使用 `localhost`),而 _port_ 是 web 服务器运行 `make which-ports` 命令报告的端口号。你应该会看到一个由运行在 JOS 中的 HTTP 服务器提供的一个 web 页面。 +在你完成了这个 web 服务器后,启动这个 web 服务器(`make run-httpd-nox`),使用你喜欢的浏览器去浏览 `http://host:port/index.html` 地址。其中 _host_ 是运行 QEMU 的计算机的名字(如果你在 athena 上运行 QEMU,使用 `hostname.mit.edu`(其中 hostname 是在 athena 上运行 `hostname` 命令的输出,或者如果你在运行 QEMU 的机器上运行 web 浏览器的话,直接使用 `localhost`),而 _port_ 是 web 服务器运行 `make which-ports` 命令报告的端口号。你应该会看到一个由运行在 JOS 中的 HTTP 服务器提供的一个 web 页面。 -到目前为止,你的评级测试得分应该是 105 分(满分为105)。 +到目前为止,你的评级测试得分应该是 105 分(满分为 105)。 -```markdown -小挑战!在 JOS 中添加一个简单的聊天服务器,多个人可以连接到这个服务器上,并且任何用户输入的内容都被发送到其它用户。为实现它,你需要找到一个一次与多个套接字通讯的方法,并且在同一时间能够在同一个套接字上同时实现发送和接收。有多个方法可以达到这个目的。lwIP 为 `recv`(查看 `net/lwip/api/sockets.c` 中的 `lwip_recvfrom`)提供了一个 MSG_DONTWAIT 标志,以便于你不断地轮询所有打开的套接字。注意,虽然网络服务器的 IPC 支持 `recv` 标志,但是通过普通的 `read` 函数并不能访问它们,因此你需要一个方法来传递这个标志。一个更高效的方法是为每个连接去启动一个或多个环境,并且使用 IPC 去协调它们。而且碰巧的是,对于一个套接字,在结构 Fd 中找到的 lwIP 套接字 ID 是全局的(不是每个环境私有的),因此,比如一个 `fork` 的子环境继承了它的父环境的套接字。或者,一个环境通过构建一个包含了正确套接字 ID 的 Fd 就能够发送到另一个环境的套接字上。 -``` +> 小挑战!在 JOS 中添加一个简单的聊天服务器,多个人可以连接到这个服务器上,并且任何用户输入的内容都被发送到其它用户。为实现它,你需要找到一个一次与多个套接字通讯的方法,并且在同一时间能够在同一个套接字上同时实现发送和接收。有多个方法可以达到这个目的。lwIP 为 `recv`(查看 `net/lwip/api/sockets.c` 中的 `lwip_recvfrom`)提供了一个 MSG_DONTWAIT 标志,以便于你不断地轮询所有打开的套接字。注意,虽然网络服务器的 IPC 支持 `recv` 标志,但是通过普通的 `read` 函数并不能访问它们,因此你需要一个方法来传递这个标志。一个更高效的方法是为每个连接去启动一个或多个环境,并且使用 IPC 去协调它们。而且碰巧的是,对于一个套接字,在结构 Fd 中找到的 lwIP 套接字 ID 是全局的(不是每个环境私有的),因此,比如一个 `fork` 的子环境继承了它的父环境的套接字。或者,一个环境通过构建一个包含了正确套接字 ID 的 Fd 就能够发送到另一个环境的套接字上。 -``` -问题 +> **问题 3**、由 JOS 的 web 服务器提供的 web 页面显示了什么? + +. + +> **问题 4**、你做这个实验大约花了多长的时间? - 3、由 JOS 的 web 服务器提供的 web 页面显示了什么? - 4. 你做这个实验大约花了多长的时间? -``` **本实验到此结束了。**一如既往,不要忘了运行 `make grade` 并去写下你的答案和挑战问题的解决方案的描述。在你动手之前,使用 `git status` 和 `git diff` 去检查你的变更,并不要忘了去 `git add answers-lab6.txt`。当你完成之后,使用 `git commit -am 'my solutions to lab 6’` 去提交你的变更,然后 `make handin` 并关注它的动向。 @@ -492,7 +450,7 @@ via: https://pdos.csail.mit.edu/6.828/2018/labs/lab6/ 作者:[csail.mit][a] 选题:[lujun9972][b] 译者:[qhwdw](https://github.com/qhwdw) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From ae6e002611e07c6083f95ba9c7999ede5a956702 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Thu, 17 Jan 2019 20:51:22 +0800 Subject: [PATCH 004/243] PUB:20181016 Lab 6- Network Driver.md @qhwdw https://linux.cn/article-10452-1.html --- {translated/tech => published}/20181016 Lab 6- Network Driver.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {translated/tech => published}/20181016 Lab 6- Network Driver.md (100%) diff --git a/translated/tech/20181016 Lab 6- Network Driver.md b/published/20181016 Lab 6- Network Driver.md similarity index 100% rename from translated/tech/20181016 Lab 6- Network Driver.md rename to published/20181016 Lab 6- Network Driver.md From 41ee98d28e16746cea87f8acc8fb9b023080b899 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Thu, 17 Jan 2019 21:58:20 +0800 Subject: [PATCH 005/243] PRF:20181220 How To Install Microsoft .NET Core SDK On Linux.md @runningwater --- ...nstall Microsoft .NET Core SDK On Linux.md | 74 ++++++++++--------- 1 file changed, 38 insertions(+), 36 deletions(-) diff --git a/translated/tech/20181220 How To Install Microsoft .NET Core SDK On Linux.md b/translated/tech/20181220 How To Install Microsoft .NET Core SDK On Linux.md index 08b518e442..1b38d9d3a3 100644 --- a/translated/tech/20181220 How To Install Microsoft .NET Core SDK On Linux.md +++ b/translated/tech/20181220 How To Install Microsoft .NET Core SDK On Linux.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (runningwater) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (How To Install Microsoft .NET Core SDK On Linux) @@ -38,7 +38,7 @@ $ sudo apt-get update $ sudo apt-get install dotnet-sdk-2.2 ``` -**Debian 8 系统上安装:** +**Debian 8 系统上安装:** 增加微软密钥,添加 .NET 仓库源: @@ -51,14 +51,14 @@ $ sudo chown root:root /etc/apt/trusted.gpg.d/microsoft.asc.gpg $ sudo chown root:root /etc/apt/sources.list.d/microsoft-prod.list ``` -安装 .NET SDK: +安装 .NET SDK: ``` $ sudo apt-get update $ sudo apt-get install dotnet-sdk-2.2 ``` -**Fedora 28 系统上安装:** +**Fedora 28 系统上安装:** 增加微软密钥,添加 .NET 仓库源: @@ -69,7 +69,7 @@ $ sudo mv prod.repo /etc/yum.repos.d/microsoft-prod.repo $ sudo chown root:root /etc/yum.repos.d/microsoft-prod.repo ``` -现在, 可以安装 .NET SDK 了: +现在, 可以安装 .NET SDK 了: ``` $ sudo dnf update @@ -87,29 +87,29 @@ $ sudo mv prod.repo /etc/yum.repos.d/microsoft-prod.repo $ sudo chown root:root /etc/yum.repos.d/microsoft-prod.repo ``` -接着安装 .NET SDK ,命令如下: +接着安装 .NET SDK ,命令如下: ``` $ sudo dnf update $ sudo dnf install dotnet-sdk-2.2 ``` -**CentOS/Oracle 版本的 Linux 系统上:** +**CentOS/Oracle 版本的 Linux 系统上:** -增加微软密钥,添加 .NET 仓库源,使其可用 +增加微软密钥,添加 .NET 仓库源,使其可用: ``` $ sudo rpm -Uvh https://packages.microsoft.com/config/rhel/7/packages-microsoft-prod.rpm ``` -更新源仓库,安装 .NET SDK: +更新源仓库,安装 .NET SDK: ``` $ sudo yum update $ sudo yum install dotnet-sdk-2.2 ``` -**openSUSE Leap 版本的系统上:** +**openSUSE Leap 版本的系统上:** 添加密钥,使仓库源可用,安装必需的依赖包,其命令如下: @@ -128,7 +128,7 @@ $ sudo zypper update $ sudo zypper install dotnet-sdk-2.2 ``` -**Ubuntu 18.04 LTS 版本的系统上:** +**Ubuntu 18.04 LTS 版本的系统上:** 注册微软的密钥和 .NET Core 仓库源,命令如下: @@ -137,13 +137,13 @@ $ wget -q https://packages.microsoft.com/config/ubuntu/18.04/packages-microsoft- $ sudo dpkg -i packages-microsoft-prod.deb ``` -使 ‘Universe’ 仓库可用: +使 Universe 仓库可用: ``` $ sudo add-apt-repository universe ``` -然后,安装 .NET Core SDK ,命令如下: +然后,安装 .NET Core SDK ,命令如下: ``` $ sudo apt-get install apt-transport-https @@ -151,7 +151,7 @@ $sudo apt-get update $ sudo apt-get install dotnet-sdk-2.2 ``` -**Ubuntu 16.04 LTS 版本的系统上:** +**Ubuntu 16.04 LTS 版本的系统上:** 注册微软的密钥和 .NET Core 仓库源,命令如下: @@ -160,7 +160,7 @@ $ wget -q https://packages.microsoft.com/config/ubuntu/16.04/packages-microsoft- $ sudo dpkg -i packages-microsoft-prod.deb ``` -然后安装 .NET core SDK: +然后安装 .NET core SDK: ``` $ sudo apt-get install apt-transport-https @@ -172,13 +172,13 @@ $ sudo apt-get install dotnet-sdk-2.2 我们已经成功的在 Linux 机器中安装了 .NET Core SDK。是时候使用 dotnet 创建第一个应用程序了。 -接下来的目的,我们会创建一个名为 **“ostechnixApp”** 的应用程序。为此,可以简单的运行如下命令: +接下来的目的,我们会创建一个名为 ostechnixApp 的应用程序。为此,可以简单的运行如下命令: ``` $ dotnet new console -o ostechnixApp ``` -**简单的输出:** +**示例输出:** ``` Welcome to .NET Core! @@ -220,21 +220,21 @@ $ ls obj ostechnixApp.csproj Program.cs ``` -可以看到有两个名为 **ostechnixApp.csproj** 和 **Program.cs** 的文件,以及一个名为 **ojb** 的目录。默认情况下, `Program.cs` 文件包含有可以在控制台中运行的 'Hello World' 程序代码。可以看看此代码: +可以看到有两个名为 `ostechnixApp.csproj` 和 `Program.cs` 的文件,以及一个名为 `ojb` 的目录。默认情况下, `Program.cs` 文件包含有可以在控制台中运行的 “Hello World” 程序代码。可以看看此代码: ``` -$ cat Program.cs +$ cat Program.cs using System; namespace ostechnixApp { - class Program - { - static void Main(string[] args) - { - Console.WriteLine("Hello World!"); - } - } + class Program + { + static void Main(string[] args) + { + Console.WriteLine("Hello World!"); + } + } } ``` @@ -247,13 +247,12 @@ Hello World! ![](https://www.ostechnix.com/wp-content/uploads/2018/12/run-dotnet.png) -很简单,对吧?是的,就是如此简单。现在你可以在 **Program.cs** 这文件中写上自己的代码,然后像上面所示的执行。 +很简单,对吧?是的,就是如此简单。现在你可以在 `Program.cs` 这文件中写上自己的代码,然后像上面所示的执行。 或者,你可以创建一个新的目录,如例子所示的 `mycode` 目录,命令如下: ``` $ mkdir ~/.mycode - $ cd mycode/ ``` @@ -263,7 +262,7 @@ $ cd mycode/ $ dotnet new console ``` -简单的输出: +示例输出: ``` The template "Console Application" was created successfully. @@ -278,9 +277,9 @@ Restore completed in 331.87 ms for /home/sk/mycode/mycode.csproj. Restore succeeded. ``` -上的命令会创建两个名叫 **mycode.csproj** 和 **Program.cs** 的文件及一个名为 **obj** 的目录。用你喜欢的编辑器打开 `Program.cs` 文件, 删除或修改原来的 'hello world' 代码段,然后编写自己的代码。 +上的命令会创建两个名叫 `mycode.csproj` 和 `Program.cs` 的文件及一个名为 `obj` 的目录。用你喜欢的编辑器打开 `Program.cs` 文件, 删除或修改原来的 “hello world” 代码段,然后编写自己的代码。 -写完代码,保存,关闭 Program.cs 文件,然后运行此应用程序,命令如下: +写完代码,保存,关闭 `Program.cs` 文件,然后运行此应用程序,命令如下: ``` $ dotnet run @@ -301,17 +300,17 @@ $ dotnet --help ### 使用微软的 Visual Studio Code 编辑器 -要编写代码,你可以任选自己喜欢的编辑器。同时微软自己也有一款支持 .NET 的编辑器,其名为 “ **Microsoft Visual Studio Code** ”。它是一款开源、轻量级、功能强大的源代码编辑器。其内置了对 JavaScript、TypeScript 和 Node.js 的支持,并为其它语言(如 C++、C#、Python、PHP、Go)和运行时态(如 .NET 和 Unity)提供了丰富的扩展,已经形成一个完整的生态系统。它是一款跨平台的代码编辑器,所以在微软的 Windows 系统、GNU/Linux 系统和 Mac OS X 系统都可以使用。如果对其感兴趣,就可以使用。 +要编写代码,你可以任选自己喜欢的编辑器。同时微软自己也有一款支持 .NET 的编辑器,其名为 “Microsoft Visual Studio Code”。它是一款开源、轻量级、功能强大的源代码编辑器。其内置了对 JavaScript、TypeScript 和 Node.js 的支持,并为其它语言(如 C++、C#、Python、PHP、Go)和运行时态(如 .NET 和 Unity)提供了丰富的扩展,已经形成一个完整的生态系统。它是一款跨平台的代码编辑器,所以在微软的 Windows 系统、GNU/Linux 系统和 Mac OS X 系统都可以使用。如果对其感兴趣,就可以使用。 -To know how to install and use it on Linux, please refer the following guide.想了解如何在 Linux 上安装和使用,请参阅以下指南。 +想了解如何在 Linux 上安装和使用,请参阅以下指南。 [Linux 中安装 Microsoft Visual Studio Code][3] -关于 Visual Studio Code editor 中 .NET Core 和 .NET Core SDK 工具的使用,[**此网页**][1]有一些基础的教程。想了解更多就去看看吧。 +关于 Visual Studio Code editor 中 .NET Core 和 .NET Core SDK 工具的使用,[此网页][1]有一些基础的教程。想了解更多就去看看吧。 ### Telemetry -默认情况下,.NET core SDK 会采集用户使用情况数据,此功能被称为 **‘Telemetry’**。采集数据是匿名的,并根据[知识共享署名许可][2]分享给其开发团队和社区。因此 .NET 团队会知道这些工具的使用状况,然后根据统计做出决策,改进产品。如果你不想分享自己的使用信息的话,可以使用顺手的 shell 工具把名为 **DOTNET_CLI_TELEMETRY_OPTOUT** 的环境变量参数设置为 **‘1’** 或 **‘true’**,这样就简单的关闭此功能了。 +默认情况下,.NET core SDK 会采集用户使用情况数据,此功能被称为 Telemetry。采集数据是匿名的,并根据[知识共享署名许可][2]分享给其开发团队和社区。因此 .NET 团队会知道这些工具的使用状况,然后根据统计做出决策,改进产品。如果你不想分享自己的使用信息的话,可以使用顺手的 shell 工具把名为 `DOTNET_CLI_TELEMETRY_OPTOUT` 的环境变量参数设置为 `1` 或 `true`,这样就简单的关闭此功能了。 就这样。你已经知道如何在各 Linux 平台上安装 .NET Core SDK 以及知道如何创建基本的应用程序了。想了解更多 .NET 使用知识的话,请参阅此文章末尾给出的链接。 @@ -319,6 +318,9 @@ To know how to install and use it on Linux, please refer the following guide.想 祝贺下! +### 资源 + +- [.NET Core](https://dotnet.microsoft.com/) -------------------------------------------------------------------------------- @@ -328,7 +330,7 @@ via: https://www.ostechnix.com/how-to-install-microsoft-net-core-sdk-on-linux/ 作者:[SK][a] 选题:[lujun9972][b] 译者:[runningwater](https://github.com/runningwater) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From da48b965f34c21ae74f5cfe985b60d1a6ce72893 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Thu, 17 Jan 2019 21:59:47 +0800 Subject: [PATCH 006/243] PUB:20181220 How To Install Microsoft .NET Core SDK On Linux.md @runningwater https://linux.cn/article-10453-1.html --- ...0181220 How To Install Microsoft .NET Core SDK On Linux.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20181220 How To Install Microsoft .NET Core SDK On Linux.md (99%) diff --git a/translated/tech/20181220 How To Install Microsoft .NET Core SDK On Linux.md b/published/20181220 How To Install Microsoft .NET Core SDK On Linux.md similarity index 99% rename from translated/tech/20181220 How To Install Microsoft .NET Core SDK On Linux.md rename to published/20181220 How To Install Microsoft .NET Core SDK On Linux.md index 1b38d9d3a3..94e24b1fbc 100644 --- a/translated/tech/20181220 How To Install Microsoft .NET Core SDK On Linux.md +++ b/published/20181220 How To Install Microsoft .NET Core SDK On Linux.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (runningwater) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-10453-1.html) [#]: subject: (How To Install Microsoft .NET Core SDK On Linux) [#]: via: (https://www.ostechnix.com/how-to-install-microsoft-net-core-sdk-on-linux/) [#]: author: (SK https://www.ostechnix.com/author/sk/) From e226a130fa32e2afc51afac716e0bfd89c7821df Mon Sep 17 00:00:00 2001 From: lctt-bot Date: Thu, 17 Jan 2019 17:00:21 +0000 Subject: [PATCH 007/243] Revert "translating by cycoe" This reverts commit 4bbdcb279b3ff9982f636f351cfd140f9bf87f61. --- .../20180822 9 flowchart and diagramming tools for Linux.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/sources/tech/20180822 9 flowchart and diagramming tools for Linux.md b/sources/tech/20180822 9 flowchart and diagramming tools for Linux.md index 5729f765d1..853cd1b7c3 100644 --- a/sources/tech/20180822 9 flowchart and diagramming tools for Linux.md +++ b/sources/tech/20180822 9 flowchart and diagramming tools for Linux.md @@ -1,5 +1,3 @@ -translating by cycoe -cycoe 翻译中 9 flowchart and diagramming tools for Linux ====== From 2d36a4b30fc5ce023151d2731c191027621ff6b9 Mon Sep 17 00:00:00 2001 From: geekpi Date: Fri, 18 Jan 2019 09:06:38 +0800 Subject: [PATCH 008/243] translated --- ... an open source alternative to Evernote.md | 97 ------------------- ... an open source alternative to Evernote.md | 88 +++++++++++++++++ 2 files changed, 88 insertions(+), 97 deletions(-) delete mode 100644 sources/tech/20171206 Getting started with Turtl, an open source alternative to Evernote.md create mode 100644 translated/tech/20171206 Getting started with Turtl, an open source alternative to Evernote.md diff --git a/sources/tech/20171206 Getting started with Turtl, an open source alternative to Evernote.md b/sources/tech/20171206 Getting started with Turtl, an open source alternative to Evernote.md deleted file mode 100644 index 968f3c546a..0000000000 --- a/sources/tech/20171206 Getting started with Turtl, an open source alternative to Evernote.md +++ /dev/null @@ -1,97 +0,0 @@ -translating---geekpi - -Getting started with Turtl, an open source alternative to Evernote -====== -![Using Turtl as an open source alternative to Evernote](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/BUS_brainstorm_island_520px.png?itok=6IUPyxkY) - -Just about everyone I know takes notes, and many people use an online note-taking application like Evernote, Simplenote, or Google Keep. Those are all good tools, but you have to wonder about the security and privacy of your information—especially in light of [Evernote's privacy flip-flop of 2016][1]. If you want more control over your notes and your data, you really need to turn to an open source tool. - -Whatever your reasons for moving away from Evernote, there are open source alternatives out there. Let's look at one of those alternatives: Turtl. - -### Getting started - -The developers behind [Turtl][2] want you to think of it as "Evernote with ultimate privacy." To be honest, I can't vouch for the level of privacy that Turtl offers, but it is a quite a good note-taking tool. - -To get started with Turtl, [download][3] a desktop client for Linux, Mac OS, or Windows, or grab the [Android app][4]. Install it, then fire up the client or app. You'll be asked for a username and passphrase. Turtl uses the passphrase to generate a cryptographic key that, according to the developers, encrypts your notes before storing them anywhere on your device or on their servers. - -### Using Turtl - -You can create the following types of notes with Turtl: - -* Password - -* File - -* Image - -* Bookmark - -* Text note - -No matter what type of note you choose, you create it in a window that's similar for all types of notes: - -### [turtl-new-note-520.png][5] - -![Create new text note with Turtl](https://opensource.com/sites/default/files/images/life-uploads/turtl-new-note-520.png) - -Creating a new text note in Turtl - -Add information like the title of the note, some text, and (if you're creating a File or Image note) attach a file or an image. Then click Save. - -You can add formatting to your notes via [Markdown][6]. You need to add the formatting by hand—there are no toolbar shortcuts. - -If you need to organize your notes, you can add them to Boards. Boards are just like notebooks in Evernote. To create a new board, click on the Boards tab, then click the Create a board button. Type a title for the board, then click Create. - -### [turtl-boards-520.png][7] - -![Create new board in Turtl](https://opensource.com/sites/default/files/images/life-uploads/turtl-boards-520.png) - -Creating a new board in Turtl - -To add a note to a board, create or edit the note, then click the This note is not in any boards link at the bottom of the note. Select one or more boards, then click Done. - -To add tags to a note, click the Tags icon at the bottom of a note, enter one or more keywords separated by commas, and click Done. - -### Syncing your notes across your devices - -If you use Turtl across several computers and an Android device, for example, Turtl will sync your notes whenever you're online. However, I've encountered a small problem with syncing: Every so often, a note I've created on my phone doesn't sync to my laptop. I tried to sync manually by clicking the icon in the top left of the window and then clicking Sync Now, but that doesn't always work. I found that I occasionally need to click that icon, click Your settings, and then click Clear local data. I then need to log back into Turtl, but all the data syncs properly. - -### A question, and a couple of problems - -When I started using Turtl, I was dogged by one question: Where are my notes kept online? It turns out that the developers behind Turtl are based in the U.S., and that's also where their servers are. Although the encryption that Turtl uses is [quite strong][8] and your notes are encrypted on the server, the paranoid part of me says that you shouldn't save anything sensitive in Turtl (or any online note-taking tool, for that matter). - -Turtl displays notes in a tiled view, reminiscent of Google Keep: - -### [turtl-notes-520.png][9] - -![Notes in Turtl](https://opensource.com/sites/default/files/images/life-uploads/turtl-notes-520.png) - -A collection of notes in Turtl - -There's no way to change that to a list view, either on the desktop or on the Android app. This isn't a problem for me, but I've heard some people pan Turtl because it lacks a list view. - -Speaking of the Android app, it's not bad; however, it doesn't integrate with the Android Share menu. If you want to add a note to Turtl based on something you've seen or read in another app, you need to copy and paste it manually. - -I've been using a Turtl for several months on a Linux-powered laptop, my [Chromebook running GalliumOS][10], and an Android-powered phone. It's been a pretty seamless experience across all those devices. Although it's not my favorite open source note-taking tool, Turtl does a pretty good job. Give it a try; it might be the simple note-taking tool you're looking for. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/17/12/using-turtl-open-source-alternative-evernote - -作者:[Scott Nesbitt][a] -译者:[译者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/scottnesbitt -[1]:https://blog.evernote.com/blog/2016/12/15/evernote-revisits-privacy-policy/ -[2]:https://turtlapp.com/ -[3]:https://turtlapp.com/download/ -[4]:https://turtlapp.com/download/ -[5]:https://opensource.com/file/378346 -[6]:https://en.wikipedia.org/wiki/Markdown -[7]:https://opensource.com/file/378351 -[8]:https://turtlapp.com/docs/security/encryption-specifics/ -[9]:https://opensource.com/file/378356 -[10]:https://opensource.com/article/17/4/linux-chromebook-gallium-os diff --git a/translated/tech/20171206 Getting started with Turtl, an open source alternative to Evernote.md b/translated/tech/20171206 Getting started with Turtl, an open source alternative to Evernote.md new file mode 100644 index 0000000000..26b41ac1ac --- /dev/null +++ b/translated/tech/20171206 Getting started with Turtl, an open source alternative to Evernote.md @@ -0,0 +1,88 @@ +开始使用 Turtl 这个 Evernote 的开源替代品 +====== +![Using Turtl as an open source alternative to Evernote](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/BUS_brainstorm_island_520px.png?itok=6IUPyxkY) + +我认识的每个人都会记笔记,许多人使用在线笔记应用,如 Evernote、Simplenote 或 Google Keep。这些都是很好的工具,但你不得不担忧信息的安全性和隐私性 - 特别是考虑到 [Evernote 2016 年的隐私策略变更][1]。如果你想要更好地控制笔记和数据,你需要转向开源工具。 + +无论你离开 Evernote 的原因是什么,都有开源替代品。让我们来看看其中一个选择:Turtl。 + +### 入门 + +[Turtl][2] 背后的开发人员希望你将其视为“具有绝对隐私的 Evernote”。说实话,我不能保证 Turtl 提供的隐私级别,但它是一个非常好的笔记工具。 + +要开始使用 Turtl,[下载][3]适用于 Linux、Mac OS 或 Windows 的桌面客户端,或者获取 [Android 应用][4]。安装它,然后启动客户端或应用。系统会要求你输入用户名和密码。Turtl 使用密码来生成加密密钥,根据开发人员的说法,加密密钥会在将笔记存储在设备或服务器上之前对其进行加密。 + +### 使用 Turtl + +你可以使用 Turtl 创建以下类型的笔记: + +* 密码 + +* 档案 + +* 图片 + +* 书签 + +* 文字笔记 + +无论你选择何种类型的笔记,你都可以在类似的窗口中创建: + + +![Create new text note with Turtl](https://opensource.com/sites/default/files/images/life-uploads/turtl-new-note-520.png) + +在 Turtl 中创建新笔记 + +添加笔记标题,文字并(如果你正在创建文件或图像笔记)附加文件或图像等信息。然后单击“保存”。 + +你可以通过 [Markdown][6] 为你的笔记添加格式。因为没有工具栏快捷方式,所以你需要手动添加格式。 + +如果你需要整理笔记,可以将它们添加到“白板”中。白板就像 Evernote 中的笔记本。要创建新的白板,请单击 “Board” 选项卡,然后单击“创建”按钮。输入白板的标题,然后单击“创建”。 + +![Create new board in Turtl](https://opensource.com/sites/default/files/images/life-uploads/turtl-boards-520.png) + +在 Turtl 中创建新的白板 + +要向白板添加笔记,请创建或编辑笔记,然后单击笔记底部的“此笔记不在任何白板”的链接。选择一个或多个白板,然后单击“完成”。 + +要为笔记添加标记,请单击记事本底部的“标记”图标,输入一个或多个以逗号分隔的关键字,然后单击“完成”。 + +### 跨设备同步你的笔记 + +例如,如果你在多台计算机和 Android 设备上使用 Turtl,Turtl 会在你上线时同步你的笔记。但是,我在同步时遇到了一个小问题:我手机上创建的笔记经常不会同步到我的笔记本电脑上。我尝试通过单击窗口左上角的图标手动同步,然后单击立即同步,但这并不总是有效。我发现偶尔需要单击“设置”图标,然后单击“清除本地数据”。然后我需要重新登录 Turtl,但所有数据都能正确同步了。 + +### 一个疑问和一些问题 + +当我开始使用 Turtl 时,我被一个疑问所困扰:我的笔记保存在哪里?事实证明,Turtl 背后的开发人员位于美国,这也是他们服务器的所在地。虽然 Turtl 使用的加密[非常强大][8]并且你的笔记在服务器上加密,但我偏执地认为你不应该在 Turtl 中保存任何敏感内容(或在任何类似的在线笔记中)。 + +Turtl 以平铺视图显示笔记,让人想起 Google Keep: + + +![Notes in Turtl](https://opensource.com/sites/default/files/images/life-uploads/turtl-notes-520.png) + +Turtl 中的一系列笔记 + +无法在桌面或 Android 应用上将其更改为列表视图。这对我来说不是问题,但我听说有些人因为它没有列表视图而不喜欢 Turtl。 + +说到 Android 应用,它并不坏。但是,它没有与 Android 共享菜单集成。如果你想把在其他应用中看到或阅读的内容添加到 Turtl 笔记中,则需要手动复制并粘贴。 + +我已经在我的 Linux 笔记本,[运行 GalliumOS 的 Chromebook][10],还有一台 Android 手机上使用 Turtl 几个月了。对所有这些设备来说这都是一种非常无缝的体验。虽然它不是我最喜欢的开源笔记工具,但 Turtl 做得非常好。试试看它,它可能是你正在寻找的简单的笔记工具。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/17/12/using-turtl-open-source-alternative-evernote + +作者:[Scott Nesbitt][a] +译者:[geekpi](https://github.com/geekpi) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:https://opensource.com/users/scottnesbitt +[1]:https://blog.evernote.com/blog/2016/12/15/evernote-revisits-privacy-policy/ +[2]:https://turtlapp.com/ +[3]:https://turtlapp.com/download/ +[4]:https://turtlapp.com/download/ +[6]:https://en.wikipedia.org/wiki/Markdown +[8]:https://turtlapp.com/docs/security/encryption-specifics/ +[10]:https://opensource.com/article/17/4/linux-chromebook-gallium-os From 5cd69c517e2a6a4e87dbe62d869c48f48ecac3d8 Mon Sep 17 00:00:00 2001 From: geekpi Date: Fri, 18 Jan 2019 09:09:07 +0800 Subject: [PATCH 009/243] translating --- .../tech/20190113 Get started with Joplin, a note-taking app.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20190113 Get started with Joplin, a note-taking app.md b/sources/tech/20190113 Get started with Joplin, a note-taking app.md index 2498435040..55b639ae7b 100644 --- a/sources/tech/20190113 Get started with Joplin, a note-taking app.md +++ b/sources/tech/20190113 Get started with Joplin, a note-taking app.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (geekpi) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 4d63625f947cb1b77d2359a8a7ec19062e60dedb Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Fri, 18 Jan 2019 10:41:23 +0800 Subject: [PATCH 010/243] PRF:20190114 Get started with Wekan, an open source kanban board.md @wwhio --- ... started with Wekan, an open source kanban board.md | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/translated/tech/20190114 Get started with Wekan, an open source kanban board.md b/translated/tech/20190114 Get started with Wekan, an open source kanban board.md index e774987979..560aaccbad 100644 --- a/translated/tech/20190114 Get started with Wekan, an open source kanban board.md +++ b/translated/tech/20190114 Get started with Wekan, an open source kanban board.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (wwhio) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Get started with Wekan, an open source kanban board) @@ -9,7 +9,9 @@ 开始使用 Wekan 吧,一款开源看板软件 ====== -这是开源工具类软件推荐的第二期,本文将让你在 2019 年更具生产力。来,让我们一起看看 Wekan 吧。 + +> 这是开源工具类软件推荐的第二期,本文将让你在 2019 年更具生产力。来,让我们一起看看 Wekan 吧。 + ![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/kanban-board.png?itok=tXC0dkKV) 每年年初,人们似乎都在想方设法地让自己更具生产力。对新年目标、期待,当然还有“新年新气象”这样的口号等等都促人上进。可大部分生产力软件的推荐都严重偏向闭源的专有软件,但事实上并不用这样。 @@ -22,7 +24,7 @@ ![](https://opensource.com/sites/default/files/uploads/wekan-1.png) -但这些 APP 通常需要连接到一个工作账户或者商业服务中。而 [Wekan][3] 作为一款开源看板工具,你可以让他完全在本地运行,或者使用你自己选择的服务运行它。其他的看板 APP 提供的功能在 Wekan 里几乎都有,例如创建看板、列表、泳道、卡片,在列表间拖放,给指定的用户安排任务,给卡片添加标签等等,基本上你对一款现代看板软件的功能需求它都能提供。 +但这些 APP 通常需要连接到一个工作账户或者商业服务中。而 [Wekan][3] 作为一款开源看板工具,你可以让它完全在本地运行,或者使用你自己选择的服务运行它。其他的看板 APP 提供的功能在 Wekan 里几乎都有,例如创建看板、列表、泳道、卡片,在列表间拖放,给指定的用户安排任务,给卡片添加标签等等,基本上你对一款现代看板软件的功能需求它都能提供。 ![](https://opensource.com/sites/default/files/uploads/wekan-2.png) @@ -52,7 +54,7 @@ via: https://opensource.com/article/19/1/productivity-tool-wekan 作者:[Kevin Sonney][a] 选题:[lujun9972][b] 译者:[wwhio](https://github.com/wwhio) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From c55526d47b0eab91c2e09f5dca216066445ea60c Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Fri, 18 Jan 2019 10:41:58 +0800 Subject: [PATCH 011/243] PUB:20190114 Get started with Wekan, an open source kanban board.md @wwhio https://linux.cn/article-10454-1.html --- ...114 Get started with Wekan, an open source kanban board.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20190114 Get started with Wekan, an open source kanban board.md (97%) diff --git a/translated/tech/20190114 Get started with Wekan, an open source kanban board.md b/published/20190114 Get started with Wekan, an open source kanban board.md similarity index 97% rename from translated/tech/20190114 Get started with Wekan, an open source kanban board.md rename to published/20190114 Get started with Wekan, an open source kanban board.md index 560aaccbad..955e88d4d3 100644 --- a/translated/tech/20190114 Get started with Wekan, an open source kanban board.md +++ b/published/20190114 Get started with Wekan, an open source kanban board.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (wwhio) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-10454-1.html) [#]: subject: (Get started with Wekan, an open source kanban board) [#]: via: (https://opensource.com/article/19/1/productivity-tool-wekan) [#]: author: (Kevin Sonney https://opensource.com/users/ksonney (Kevin Sonney)) From dfb115f295579f79742dcc67c92b5422b1b87d8f Mon Sep 17 00:00:00 2001 From: wwhio Date: Fri, 18 Jan 2019 16:43:03 +0800 Subject: [PATCH 012/243] =?UTF-8?q?=E7=BF=BB=E8=AF=91=E8=AE=A4=E9=A2=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../talk/20180314 Pi Day- 12 fun facts and ways to celebrate.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sources/talk/20180314 Pi Day- 12 fun facts and ways to celebrate.md b/sources/talk/20180314 Pi Day- 12 fun facts and ways to celebrate.md index 298d5f58bc..292afeb895 100644 --- a/sources/talk/20180314 Pi Day- 12 fun facts and ways to celebrate.md +++ b/sources/talk/20180314 Pi Day- 12 fun facts and ways to celebrate.md @@ -1,3 +1,5 @@ +Translating by wwhio + Pi Day: 12 fun facts and ways to celebrate ====== From 9ae8d4c893d52ba0f6ae9a1e5e42103faa77d069 Mon Sep 17 00:00:00 2001 From: wwhio Date: Fri, 18 Jan 2019 16:43:07 +0800 Subject: [PATCH 013/243] =?UTF-8?q?=E7=BF=BB=E8=AF=91=E8=AE=A4=E9=A2=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sources/talk/20150513 XML vs JSON.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/talk/20150513 XML vs JSON.md b/sources/talk/20150513 XML vs JSON.md index d3928daa83..4bd15ea2fa 100644 --- a/sources/talk/20150513 XML vs JSON.md +++ b/sources/talk/20150513 XML vs JSON.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (wwhio) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From a1c8a4ea48ddd119c8000d50b4107e55f1aae7b6 Mon Sep 17 00:00:00 2001 From: Hansong Zhang Date: Fri, 18 Jan 2019 17:38:10 +0800 Subject: [PATCH 014/243] Translating Translating: Dawn of the Microcomputer- The Altair 8800 --- .../talk/20180722 Dawn of the Microcomputer- The Altair 8800.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sources/talk/20180722 Dawn of the Microcomputer- The Altair 8800.md b/sources/talk/20180722 Dawn of the Microcomputer- The Altair 8800.md index 98a42236de..9974ac6352 100644 --- a/sources/talk/20180722 Dawn of the Microcomputer- The Altair 8800.md +++ b/sources/talk/20180722 Dawn of the Microcomputer- The Altair 8800.md @@ -1,3 +1,5 @@ +zhs852 is translating. + Dawn of the Microcomputer: The Altair 8800 ====== Subscribers to Popular Electronics were a sophisticated group. The magazine’s editor, Arthur Salsberg, felt compelled to point out as much in the editorial section of the [December 1974 issue][1]. The magazine had received letters complaining that a recent article, titled “How to Set Up a Home TV Service Shop,” would inspire a horde of amateur TV technicians to go out and undercut professional repairmen, doing great damage to everyone’s TVs in the process. Salsberg thought this concern was based on a misunderstanding about who read Popular Electronics. He explained that, according to the magazine’s own surveys, 52% of Popular Electronics subscribers were electronics professionals of some kind and 150,000 of them had repaired a TV in the last 60 days. Moreover, the average Popular Electronics subscriber had spent $470 on electronics equipment ($3578 in 2018) and possessed such necessities as VOMs, VTVMs, tube testers, transistor testers, r-f signal generators, and scopes. “Popular Electronics readers are not largely neophytes,” Salsberg concluded. From 6b79840ff0bb1e9dded3359a9784f85c2d471ee1 Mon Sep 17 00:00:00 2001 From: jlztan Date: Fri, 18 Jan 2019 17:42:55 +0800 Subject: [PATCH 015/243] Update and rename sources/tech/20181213 What is PPA- Everything You Need to Know About PPA in Linux.md to translated/tech/20181213 What is PPA- Everything You Need to Know About PPA in Linux.md --- ...ing You Need to Know About PPA in Linux.md | 315 ------------------ ...ing You Need to Know About PPA in Linux.md | 314 +++++++++++++++++ 2 files changed, 314 insertions(+), 315 deletions(-) delete mode 100644 sources/tech/20181213 What is PPA- Everything You Need to Know About PPA in Linux.md create mode 100644 translated/tech/20181213 What is PPA- Everything You Need to Know About PPA in Linux.md diff --git a/sources/tech/20181213 What is PPA- Everything You Need to Know About PPA in Linux.md b/sources/tech/20181213 What is PPA- Everything You Need to Know About PPA in Linux.md deleted file mode 100644 index d0132aebf8..0000000000 --- a/sources/tech/20181213 What is PPA- Everything You Need to Know About PPA in Linux.md +++ /dev/null @@ -1,315 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (jlztan) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (What is PPA? Everything You Need to Know About PPA in Linux) -[#]: via: (https://itsfoss.com/ppa-guide/) -[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) - -What is PPA? Everything You Need to Know About PPA in Linux -====== - -**Brief: An in-depth article that covers almost all the questions around using PPA in Ubuntu and other Linux distributions.** - -If you have been using Ubuntu or some other Linux distribution based on Ubuntu such as Linux Mint, Linux Lite, Zorin OS etc, you may have come across three magical lines of this sort: - -``` -sudo add-apt-repository ppa:dr-akulavich/lighttable -sudo apt-get update -sudo apt-get install lighttable-installer -``` - -A number of websites suggest these kind of lines to [install applications in Ubuntu][1]. This is what is called installing an application using PPA. - -But what is PPA? Why is it used? Is it safe to use PPA? How to properly use PPA? How to delete a PPA? - -I’ll answer all of the above questions in this detailed guide. Even if you already know a few things about PPAs, I am sure this article will still add to your knowledge. - -Do note that I am writing this article using Ubuntu. Therefore I’ll use the term Ubuntu almost everywhere but the explanations and steps are also applicable to other Debian/Ubuntu based distributions. - -### What is PPA? Why is it used? - -![Everything you need to know about PPA in Ubuntu Linux][2] - -PPA stands for Personal Package Archive. - -Does that make sense? Probably not. - -Before you understand PPA, you should know the concept of repositories in Linux. I won’t go into details here though. - -#### Concept of repositories and package management - -A repository is a collection of files that has information about various software, their versions and some other details like the checksum. Each Ubuntu version has its own official set of four repositories: - - * **Main** – Canonical-supported free and open-source software. - - * **Universe** – Community-maintained free and open-source software. - - * **Restricted** – Proprietary drivers for devices. - - * **Multiverse** – Software restricted by copyright or legal issues. - - - - -You can see such repositories for all Ubuntu versions [here][3]. You can browse through them and also go to the individual repositories. For example, Ubuntu 16.04 main repository can be found [here][4]. - -So basically it’s a web URL that has information about the software. How does your system know where are these repositories? - -This information is stored in the sources.list file in the directory /etc/apt. If you look at its content, you’ll see that it has the URL of the repositories. The lines with # at the beginning are ignored. - -Now when you run the command sudo apt update, your system uses [APT tool][5] to check against the repo and stores the information about the software and their version in a cache. When you use the command sudo apt install package_name, it uses the information to get that package from the URL where the actual software is stored. - -If the repository doesn’t have the information about a certain package, you’ll see an error like: - -``` -E: Unable to locate package -``` - -At this point, I recommend reading my [guide to using apt commands][6]. This will give you a much better understanding of apt commands, update etc. - -So this was about repositories. But what is PPA? How does it enter into the picture? - -#### Why is PPA used? - -As you can see, Ubuntu controls what software and more importantly which version of a software you get on your system. But imagine if a software developer releases a new version of the software. - -Ubuntu won’t make it available immediately. There is a procedure to check if the new version of the software is compatible with the system or not. This ensures the stability of the system. - -But this also means that it will be some weeks or in some cases, some months before it is made available by Ubuntu. Not everyone would want to wait that long to get their hands on the new version of their favorite software. - -Similarly, suppose someone develops a software and wants Ubuntu to include that software in the official repositories. It again will take months before Ubuntu makes a decision and includes it in the official repositories. - -Another case would be during beta testing. Even if a stable version of the software is available in the official repositories, a software developer may want some end users to test their upcoming release. How do they enable the end user to beta test the upcoming release? - -Enter PPA! - -### How to use PPA? How does PPA work? - -[PPA][7], as I already told you, means Personal Package Archive. Mind the word ‘Personal’ here. That gives the hint that this is something exclusive to a developer and is not officially endorsed by the distribution. - -Ubuntu provides a platform called Launchpad that enables software developers to create their own repositories. An end user i.e. you can add the PPA repository to your sources.list and when you update your system, your system would know about the availability of this new software and you can install it using the standard sudo apt install command like this. - -`sudo add-apt-repository ppa:dr-akulavich/lighttable` -`sudo apt-get update` -`sudo apt-get install lighttable-installer` - -To summarize: - - * sudo add-apt-repository <– This command adds the PPA repository to the list. - * sudo apt-get update <– This command updates the list of the packages that can be installed on the system. - * sudo apt-get install <– This command installs the package. - - - -You see that it is important to use the command sudo apt update or else your system will not know when a new package is available. - -Now let’s take a look at the first command in a bit more detail. - -``` -sudo add-apt-repository ppa:dr-akulavich/lighttable -``` - -You would notice that this command doesn’t have a URL to the repository. This is because the tool has been designed to abstract the information about URL from you. - -Just a small note. If you add ppa:dr-akulavich/lighttable, you get Light Table. But if you add ppa:dr-akulavich, you’ll get all the repository or packages mentioned in the ‘upper repository’. It’s hierarchical. - -Basically, when you add a PPA using add-apt-repository, it will do the same action as if you manually run these commands: - -``` -deb http://ppa.launchpad.net/dr-akulavich/lighttable/ubuntu YOUR_UBUNTU_VERSION_HERE main -deb-src http://ppa.launchpad.net/dr-akulavich/lighttable/ubuntu YOUR_UBUNTU_VERSION_HERE main -``` - -The above two lines are the traditional way to add any repositories to your sources.list. But PPA does it automatically for you, without wondering about the exact repository URL and operating system version. - -One important thing to not here is that when you use PPA, it doesn’t change your original sources.list. Instead, it creates two files in /etc/apt/sources.d directory, a list and a back up file with suffix ‘save’. - -![Using a PPA in Ubuntu][8]PPA create separate sources.list - -The files with suffix ‘list’ has the command that adds the information about the repository. - -![PPA add repository information][9]Content of source.list of a PPA - -This is a safety measure to ensure that adding PPAs don’t mess with the original sources.list. It also helps in removing the PPA. - -#### Why PPA? Why not DEB packages? - -You may ask why should you use PPA when it involves using command line which might not be preferred by everyone. Why not just distribute a DEB package that can be installed graphically? - -The answer lies in the update procedure. If you install a software using a DEB package, there is no guarantee that the installed software will be updated to a newer version when you run sudo apt update && sudo apt upgrade. - -It’s because the apt upgrade procedure relies on the sources.list. If there is no entry for a software, it doesn’t get the update via the standard software updater. - -So does it mean software installed using DEB never gets an update? No, not really. It depends on how the package was created. - -Some developers automatically add an entry to the sources.list and then it is updated like a regular software. Google Chrome is one such example. - -Some software would notify you of availability of a new version when you try to run it. You’ll have to download the new DEB package and run it again to update the current software to a newer version. Oracle Virtual Box is an example in this case. - -For the rest of the DEB packages, you’ll have to manually look for an update and this is not convenient, especially if your software is meant for beta testers. You need to add more updates frequently. This is where PPA come to the rescue. - -#### Offical PPA vs unofficial PPA - -You may also hear the term official PPA or unofficial PPA. What’s the difference? - -When developers create PPA for their software, it is called the official PPA. Quite obviously because it is coming from none other than the project developers. - -But at times, individuals create PPA of projects that were created by other developers. - -Why would someone do that? Because many developers just provide the source code of the software and you know that [installing software from source code in Linux][10] is a pain and not everyone could or would do that. - -This is why volunteers take it upon themselves to create a PPA from those source code so that other users can install the software easily. After all, using those 3 lines is a lot easier than battling the source code installation. - -#### Make sure that a PPA is available for your distribution version - -When it comes to using PPA in Ubuntu or any other Debian based distribution, there are a few things you should keep in mind. - -Not every PPA is available for your particular version. You should know [which Ubuntu version][11] you are using. The codename of the release is important because when you go to the webpage of a certain PPA, you can see which Ubuntu versions are supported by the PPA. - -For other Ubuntu-based distributions, you can check the content of /etc/os-release to [find out the Ubuntu version][11] information. - -![Verify PPA availability for Ubuntu version][12]Check if PPA is available for your Ubuntu version - -How to know the PPA url? Simply search on the internet with the PPA name like ppa:dr-akulavich/lighttable and you’ll get the first result from [Launchpad][13], the official platform for hosting PPA. You can also go to Launchpad and search for the required PPA directly there. - -If you don’t verify and add the PPA, you may see an error like this when you try to install a software not available for your version. - -``` -E: Unable to locate package -``` - -What’s worse is that since it has been added to your source.list, each time you run software updater, you’ll see an error “[Failed to download repository information][14]“. - -![Failed to download repository information Ubuntu 13.04][15] - -If you run sudo apt update in the terminal, the error will have more details about which repository is causing the trouble. You can see something like this in the end of the output of sudo apt update: - -``` -W: Failed to fetch http://ppa.launchpad.net/venerix/pkg/ubuntu/dists/raring/main/binary-i386/Packages  404  Not Found -E: Some index files failed to download. They have been ignored, or old ones used instead. -``` - -Which is self-explanatory because the system cannot find the repository for your version. Remember what we saw earlier about repository structure? APT will try to look for software information in the place /ubuntu/dists/Ubuntu_Version - -And if the PPA for the specific version is not available, it will never be able to open the URL and you get the famous 404 error. - -#### Why are PPAs not available for all the Ubuntu release versions? - -It is because someone has to compile the software and create a PPA out of it on the specific versions. Considering that a new Ubuntu version is released every six months, it’s a tiresome task to update the PPA for every Ubuntu release. Not all developers have time to do that. - -#### How to install the application if PPA is not available for your version? - -It is possible that though the PPA is not available for your Ubuntu version, you could still download the DEB file and install the application - -Let’s say that you go to the Light Table PPA. Using the knowledge about PPA you just learned, you realize that the PPA is not available for your specific Ubuntu release. - -What you can do is to click on the ‘View package details’. - -![Get DEB file from PPA][16] - -And in here, you can click on a package to reveal more details. You’ll also find the source code and the DEB file of the package here. - -![Download DEB file from PPA][17] - -I advise [using Gdebi to install these DEB files][18] instead of the Software Center because Gdebi is a lot better at handling dependencies. - -Do note that the package installed this way might not get any future updates. - -I think you have read enough about adding PPAs. How about removing a PPA and the software installed by it? - -### How to delete PPA? - -I have written about [deleting PPA][19] in the past. I am going to describe the same methods here as well. - -I advise deleting the software that you installed from a PPA before removing the PPA. If you just remove the PPA, the installed software remains in the system but it won’t get any updates. You wouldn’t want that, would you? - -So, the question comes, how to know which application was installed by which PPA? - -#### Find packages installed by a PPA and remove them - -Ubuntu Software Center doesn’t help here. You’ll have to use Synaptic package manager here which has more advanced features. - -You can install Synaptic from Software Center or use the command below: - -``` -sudo apt install synaptic -``` - -Once installed, start Synaptic package manager and select Origin. You’ll see various repositories added to the system. PPA entries will be labeled with prefix PPA. Click on them to see the packages that are available by the PPA. Installed software will have appropriate symbol before it. - -![Managing PPA with Synaptic package manager][20]Find packages installed via a PPA - -Once you have found the packages, you can delete them from Synaptic itself. Otherwise, you always have the option to use the command line: - -``` -sudo apt remove package_name -``` - -Once you have removed the packages installed by a PPA, you can continue to remove the PPA from your sources.list. - -#### Remove a PPA graphically - -Go to Software & Updates and then go to tab Other Software. Look for the PPA that you want to remove: - -![Delete a PPA from Software Source][21] - -You have two options here. Either you deselect the PPA or you choose the Remove option. - -The difference is that when you deselect a PPA entry, your system will comment out the repository entry in its ppa_name.list file in /etc/apt/sources.list.d but if you choose the Remove option, it will delete the repository entry from its ppa_name.list file in /etc/apt/sources.list.d directory. - -In both the cases, the files ppa_name.list remains in the said directory, even if it is empty. - -### Is it safe to use PPA? - -It is a subjective question. Purists abhor PPA because most of the time PPAs are from third-party developers. But at the same time, PPAs are popular in the Debian/Ubuntu world as they provide an easier installation option. - -As far as the security is concerned, it’s less likely that you use a PPA and your Linux system is hacked or injected with malware. I don’t recall such an incident ever happened so far. - -Official PPAs can be used without thinking twice. Using unofficial PPA is entirely your decision. - -As a rule of thumb, you should avoid installing a program via a third party PPA if it the program requires sudo access to run. - -### What do you think about using PPA? - -I know it’s a long read but I wanted to give you a better understanding of PPA. I hope this detailed guide answered most of your questions about using PPA. - -If you have more questions about PPA, please feel free to ask in the comment section. - -If you notice any technical or grammatical error or if you have suggestions for improving this article, please let me know. - --------------------------------------------------------------------------------- - -via: https://itsfoss.com/ppa-guide/ - -作者:[Abhishek Prakash][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://itsfoss.com/author/abhishek/ -[b]: https://github.com/lujun9972 -[1]: https://itsfoss.com/remove-install-software-ubuntu/ -[2]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2018/12/what-is-ppa.png?resize=800%2C450&ssl=1 -[3]: http://archive.ubuntu.com/ubuntu/dists/ -[4]: http://archive.ubuntu.com/ubuntu/dists/xenial/main/ -[5]: https://wiki.debian.org/Apt -[6]: https://itsfoss.com/apt-command-guide/ -[7]: https://launchpad.net/ubuntu/+ppas -[8]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2018/01/ppa-sources-list-files.png?resize=800%2C259&ssl=1 -[9]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2018/01/content-of-ppa-list.png?ssl=1 -[10]: https://itsfoss.com/install-software-from-source-code/ -[11]: https://itsfoss.com/how-to-know-ubuntu-unity-version/ -[12]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2017/12/verify-ppa-availibility-version.jpg?resize=800%2C481&ssl=1 -[13]: https://launchpad.net/ -[14]: https://itsfoss.com/failed-to-download-repository-information-ubuntu-13-04/ -[15]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2013/04/Failed-to-download-repository-information-Ubuntu-13.04.png?ssl=1 -[16]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2018/12/deb-from-ppa.jpg?resize=800%2C483&ssl=1 -[17]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2018/12/deb-from-ppa-2.jpg?resize=800%2C477&ssl=1 -[18]: https://itsfoss.com/gdebi-default-ubuntu-software-center/ -[19]: https://itsfoss.com/how-to-remove-or-delete-ppas-quick-tip/ -[20]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2018/01/ppa-synaptic-manager.jpeg?resize=800%2C394&ssl=1 -[21]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2012/08/Delete-a-PPA.jpeg?ssl=1 diff --git a/translated/tech/20181213 What is PPA- Everything You Need to Know About PPA in Linux.md b/translated/tech/20181213 What is PPA- Everything You Need to Know About PPA in Linux.md new file mode 100644 index 0000000000..b83c9f5720 --- /dev/null +++ b/translated/tech/20181213 What is PPA- Everything You Need to Know About PPA in Linux.md @@ -0,0 +1,314 @@ +[#]: collector: "lujun9972" +[#]: translator: "jlztan" +[#]: reviewer: " " +[#]: publisher: " " +[#]: url: " " +[#]: subject: "What is PPA? Everything You Need to Know About PPA in Linux" +[#]: via: "https://itsfoss.com/ppa-guide/" +[#]: author: "Abhishek Prakash https://itsfoss.com/author/abhishek/" + +# 什么是 PPA?你需要知道的关于 Linux 中 PPA 的一切 + +**简介:一篇涵盖了在 Ubuntu 和其他 Linux 发行版中使用 PPA 的几乎所有问题的深入的文章。** + +如果你一直在使用 Ubuntu 或基于 Ubuntu 的其他 Linux 发行版,例如 Linux Mint、Linux Lite、Zorin OS 等,你可能会遇到以下三行神奇的命令: + +``` +sudo add-apt-repository ppa:dr-akulavich/lighttable +sudo apt-get update +sudo apt-get install lighttable-installer +``` + +许多网站推荐使用类似于以上几行的形式 [在 Ubuntu 中安装应用程序][1]。这就是所谓的使用 PPA 安装应用程序。 + +但什么是 PPA?为什么用它?使用 PPA 安全吗?如何正确使用 PPA?如何删除 PPA? + +我将在这个详细的指南中回答上述所有问题。即使你已经了解了一些关于 PPA 的事情,我相信这篇文章仍然会让你了解这方面的更多知识。 + +请注意我正在使用 Ubuntu 撰写本文。因此,我几乎可以在任何地方使用 Ubuntu 这个术语,但文中的说明和步骤也适用于其他基于 Debian/Ubuntu 的发行版。 + +### 什么是 PPA?为什么要使用 PPA? + +![Everything you need to know about PPA in Ubuntu Linux][2] + +PPA 表示 个人软件包存档Personal Package Archive个人软件包存档Personal Package Archive。 + +这样说容易理解吗?可能不是很容易。 + +在了解 PPA 之前,你应该了解 Linux 中软件仓库的概念。关于软件仓库,在这里我不会详述。 + +#### 软件仓库和包管理的概念 + +软件仓库是一组文件,其中包含各种软件及其版本的信息,以及校验和等其他一些详细信息。每个版本的 Ubuntu 都有自己的四个官方软件仓库: + +- Main - Canonical 支持的免费和开源软件。 +- Universe - 社区维护的免费和开源软件。 +- Restricted - 设备的专有驱动程序。 +- Multiverse - 受版权或法律问题限制的软件。 + +你可以在 [这里][3] 看到所有版本的 Ubuntu 的软件仓库。你可以浏览并转到各个仓库。例如,可以在 [这里][4] 找到 Ubuntu 16.04 的主存储库。 + +所以,PPA 基本上是一个包含软件信息的网址。那你的系统又是如何知道这些仓库的位置的呢? + +这些信息存储在 `/etc/apt` 目录中的 `sources.list` 文件中。如果查看此文件的内容,你就会看到里面有软件仓库的网址。`#` 开头的行将被忽略。 + +这样的话,当你运行 `sudo apt update` 命令时,你的系统将使用 [APT 工具][5] 来检查软件仓库并将软件及其版本信息存储在缓存中。当你使用 `sudo apt install package_name` 命令时,它通过该信息从实际存储软件的网址获取该软件包。 + +如果软件仓库中没有关于某个包的信息,你将看到如下错误: + +``` +E: Unable to locate package +``` + +此时,建议阅读我的 [apt 命令使用指南][6] 一文,这将帮你更好地理解 `apt`、`update` 等命令。 + +以上是关于软件仓库的内容。但什么是 PPA?PPA 和软件仓库又有什么关联呢? + +#### 为什么要用 PPA? + +如你所见,Ubuntu 对系统中的软件进行管理,更重要的是控制你在系统上获得哪个版本的软件。但想象一下开发人员发布了软件的新版本的情况。 + +Ubuntu 不会立即提供该新版本的软件。需要一个步骤来检查此新版本的软件是否与系统兼容,从而可以确保系统的稳定性。 + +但这也意味着它需要经过几周才能在 Ubuntu 上可用,在某些情况下,这可能需要几个月的时间。不是每个人都想等待那么长时间才能获得他们最喜欢的软件的新版本。 + +类似地,假设有人开发了一款软件,并希望 Ubuntu 将该软件包含在官方软件仓库中。在 Ubuntu 做出决定并将其包含在官方存软件仓库之前,还需要几个月的时间。 + +另一种情况是在 beta 测试阶段。即使官方软件仓库中提供了稳定版本的软件,软件开发人员也可能希望某些终端用户测试他们即将发布的版本。他们是如何使终端用户对即将发布的版本进行 beta 测试的呢? + +通过 PPA! + +### 如何使用 PPA?PPA 是怎样工作的? + +正如我已经告诉过你的那样,[PPA][7] 代表个人软件包存档Personal Package Archive个人软件包存档Personal Package Archive。在这里注意 “个人” 这个词,它暗示了这是开发人员独有的东西,并没有得到分发的正式许可。 + +Ubuntu 提供了一个名为 Launchpad 的平台,使软件开发人员能够创建自己的软件仓库。 终端用户,也就是你,可以将 PPA 仓库添加到 `sources.list` 文件中,当你更新系统时,你的系统会知道这个新软件的可用性,然后你可以使用标准的 `sudo apt install` 命令安装它。 + +`sudo add-apt-repository ppa:dr-akulavich/lighttable` +`sudo apt-get update` +`sudo apt-get install lighttable-installer` + +概括一下上面三个命令: + +- `sudo add-apt-repository ` < - 此命令将 PPA 仓库添加到列表中。 +- `sudo apt-get update` < - 此命令更新可以在当前系统上安装的软件包列表。 +- `sudo apt-get install ` < - 此命令安装软件包。 + +你会发现使用 `sudo apt update` 命令非常重要,否则你的系统将无法知道新软件包何时可用。 + +现在让我们更详细地看一下第一个命令。 + +``` +sudo add-apt-repository ppa:dr-akulavich/lighttable +``` + +你会注意到此命令没有软件仓库的 URL。这是因为该工具被设计成将 URL 信息抽象之后再展示给你。 + +小小注意一下:如果你添加的是 `ppa:dr-akulavich/lighttable`,你会得到 Light Table。但是如果你添加 `ppa:dr-akulavich`,你将得到 “上层软件仓库” 中的所有仓库或软件包。它是按层级划分的。 + +基本上,当您使用 `add-apt-repository` 添加 PPA 时,它将执行与手动运行这些命令相同的操作: + +``` +deb http://ppa.launchpad.net/dr-akulavich/lighttable/ubuntu YOUR_UBUNTU_VERSION_HERE main +deb-src http://ppa.launchpad.net/dr-akulavich/lighttable/ubuntu YOUR_UBUNTU_VERSION_HERE main +``` + +以上两行是将任何软件仓库添加到你系统的 `sources.list` 文件的传统方法。但 PPA 会自动为你完成这些工作,无需考虑确切的软件仓库 URL 和操作系统版本。 + +此处不那么重要的一点是,当你使用 PPA 时,它不会更改原始的 `sources.list` 文件。相反,它在 `/etc/apt/sources.d` 目录中创建了两个文件,一个 “list” 文件和一个带有 “save” 后缀的备份文件。 + +![Using a PPA in Ubuntu][8] + +PPA 创建了单独的 `sources.list` 文件 + +带有后缀 “list” 的文件含有添加软件仓库的信息的命令。 + +![PPA add repository information][9] + +一个 PPA 的 `source.list` 文件的内容 + +这是一种安全措施,可以确保添加的 PPA 不会和原始的 `sources.list` 文件弄混,它还有助于移除 PPA。 + +#### 为什么使用 PPA?为何不用 DEB 包 + +你可能会问为什么要使用 PPA,PPA 需要通过命令行使用,而不是每个人都喜欢用命令行。为什么不直接分发可以图形方式安装的 DEB 包呢? + +答案在于更新的过程。如果使用 DEB 包安装软件,将无法保证在运行 `sudo apt update` 和 `sudo apt upgrade` 命令时,已安装的软件会被更新为较新的版本。 + +这是因为 apt 的升级过程依赖于 `sources.list` 文件。如果文件中没有相应的软件条目,则不会通过标准软件更新程序获得更新。 + +那么这是否意味着使用 DEB 安装的软件永远不会得到更新?不是的。这取决于 DEB 包的创建方式。 + +一些开发人员会自动在 `sources.list ` 中添加一个条目,这样软件就可以像普通软件一样更新。谷歌 Chrome 浏览器就是这样一个例子。 + +某些软件会在运行时通知你有新版本可用。你必须下载新的 DEB 包并再次运行,来将当前软件更新为较新版本。Oracle Virtual Box 就是这样一个例子。 + +对于其余的 DEB 软件包,你必须手动查找更新,这很不方便,尤其是在你的软件面向 Beta 测试者时,你需要频繁的添加很多更新。这正是 PPA 要解决的问题。 + +#### 官方 PPA vs 非官方 PPA + +你或许听过官方 PPA 或非官方 PPA 这个词,二者有什么不同呢? + +开发人员为他们的软件创建的 PPA 称为官方 PPA。很明显,这是因为它来自项目开发者。 + +但有时,个人会创建由其他开发人员所创建的项目的 PPA。 + +为什么会有人这样做? 因为许多开发人员只提供软件的源代码,而且你也知道 [在 Linux 中从源代码安装软件][10] 是一件痛苦的事情,并不是每个人都可以或者会这样做。 + +这就是志愿者自己从这些源代码创建 PPA 以便其他用户可以轻松安装软件的原因。毕竟,使用这 3 行命令比从源代码安装要容易得多。 + +#### 确保你的 Linux 发行版本可以使用 PPA + +当在 Ubuntu 或任何其他基于 Debian 的发行版中使用 PPA 时,你应该记住一些事情。 + +并非每个 PPA 都适用于你的特定版本。你应该知道正在使用 [哪个版本的 Ubuntu][11]。版本的开发代号很重要,因为当你访问某个 PPA 的页面时,你可以看到该 PPA 都支持哪些版本的 Ubuntu。 + +对于其他基于 Ubuntu 的发行版,你可以查看 `/etc/os-release` 的内容来 [找出 Ubuntu 版本][11] 的信息。 + +![Verify PPA availability for Ubuntu version][12] + +检查 PPA 是否适用于你的 Ubuntu 版本 + +如何知道 PPA 的网址呢?只需在网上搜索 PPA 的名称,如 `ppa:dr-akulavich/lighttable`,第一个搜索结果来自 [Launchpad][13],这是托管 PPA 的官方平台。你也可以转到 Launchpad 并直接在那里搜索所需的 PPA。 + +如果不验证是否适用当前的版本就添加 PPA,当尝试安装不适用于你的系统版本的软件时,可能会看到类似下面的错误。 + +``` +E: Unable to locate package +``` + +更糟糕的是,因为它已经添加到你的 `source.list` 中,每次运行软件更新程序时,你都会看到 “[无法下载软件仓库信息][14]” 的错误。 + +![Failed to download repository information Ubuntu 13.04][15] + +如果你在终端中运行 `sudo apt update`,错误提示将包含导致此问题的仓库的更多详细信息。你可以在 `sudo apt update` 的输出内容结尾看到类似的内容: + +``` +W: Failed to fetch http://ppa.launchpad.net/venerix/pkg/ubuntu/dists/raring/main/binary-i386/Packages 404 Not Found +E: Some index files failed to download. They have been ignored, or old ones used instead. +``` + +上面的错误提示说的很明白,是因为系统找不到当前版本对应的仓库。还记得我们之前看到的仓库结构吗?APT 将尝试在 /ubuntu/dists/Ubuntu_Version 中寻找软件信息。 + +如果特定版本的 PPA 不可用,它将永远无法打开 URL,你会看到著名的404错误。 + +#### 为什么 PPA 不适用于所有 Ubuntu 发行版? + +这是因为 PPA 的作者必须编译软件并在特定版本上创建 PPA。考虑到每六个月发布一个新的 Ubuntu 版本,为每个版本的 Ubuntu 更新 PPA 是一项繁琐的任务,并非所有开发人员都有时间这样做。 + +#### 如果 PPA 不适用于你的系统版本,该如何安装应用程序? + +尽管 PPA 不适用于你的 Ubuntu 版本,你仍然可以下载 DEB 文件并安装应用程序。 + +比如说,你访问 Light Table 的 PPA 页面,使用刚刚学到的有关 PPA 的知识,你会发现 PPA 不适用于你的特定 Ubuntu 版本。 + +你可以点击 `查看软件包详细信息`。 + +![Get DEB file from PPA][16] + +在这里,你可以单击软件包以显示更多详细信息,还可以在此处找到包的源代码和 DEB 文件。 + +![Download DEB file from PPA][17] + +我建议 [使用 Gdebi 安装这些 DEB 文件][18] 而不是通过软件中心,因为 Gdebi 在处理依赖项方面要好得多。 + +请注意,以这种方式安装的软件包可能无法获得任何将来的更新。 + +我认为你已经阅读了足够多的关于添加 PPA 的内容,那么如何删除 PPA 及其安装的软件呢? + +### 如何删除 PPA? + +我过去曾写过 [删除 PPA][19] 的教程,这里写的也是同样的方法。 + +我建议在删除 PPA 之前删除从 PPA 安装的软件。如果只是删除 PPA,则已安装的软件仍保留在系统中,但不会获得任何更新。这不是你想要的,不是吗? + +那么,问题来了,如何知道是哪个 PPA 安装了哪个应用程序? + +#### 查找 PPA 安装的软件包并将其移除 + +Ubuntu 软件中心无法移除 PPA 安装的软件包,你必须使用具有更多高级功能的 Synaptic 包管理器。 + +可以从软件中心安装 Synaptic 或使用以下命令进行安装: + +``` +sudo apt install synaptic +``` + +安装后,启动 Synaptic 包管理器并选择 Origin。你会看到添加到系统的各种软件仓库。 PPA 条目将以前缀 PPA 进行标识,单击以查看 PPA 可用的包。已安装的软件前面会有恰当的符号进行标识。 + +![Managing PPA with Synaptic package manager][20] + +查找通过 PPA 安装的软件包 + +找到包后,你可以从 Synaptic 删除它们。此外,也始终可以选择使用命令行进行移除: + +``` +sudo apt remove package_name +``` + +删除 PPA 安装的软件包后,你可以继续从 `sources.list` 中删除PPA。 + +#### 以图形界面的方式删除 PPA + +在设置中打开 “软件和更新”,然后点击 “其他软件” 选项卡。查找要删除的 PPA: + +![Delete a PPA from Software Source][21] + +此处你可以进项两项操作,可以取消选择 PPA 或选择 “删除” 选项。 + +区别在于,当你取消选择 PPA 条目时,系统将在 `/etc/apt/sources.list.d` 中的`ppa_name.list` 文件中注释掉仓库条目;但如果选择 “删除” 选项,将会删除 `/etc/apt/sources.list.d`目录中 `ppa_name.list` 文件里的仓库条目。 + +在这两种情况下,文件 `ppa_name.list` 都保留在所在的目录中,即使它是空的。 + +### 使用 PPA 安全吗? + +这是一个主观问题。纯粹主义者厌恶 PPA,因为大多数时候 PPA 来自第三方开发者。但与此同时,PPA 在 Debian/Ubuntu 世界中很受欢迎,因为它们提供了更简单的安装选项。 + +就安全性而言,使用 PPA 之后,你的 Linux 系统被黑客攻击或注入恶意软件的可能性较小。到目前为止,我不记得发生过这样的事件。 + +官方 PPA 可以不加考虑的使用,使用非官方 PPA 完全是你自己的决定。 + +根据经验,如果程序需要 sudo 权限,则应避免通过第三方 PPA 进行安装。 + +### 你如何看待使用 PPA? + +我知道这篇文章需要挺长时间来阅读,但我想让你更好地了解 PPA。我希望这份详细指南能够回答你关于使用 PPA 的大部分问题。 + +如果你对 PPA 有更多疑问,请随时在评论区提问。 + +如果你发现任何技术或语法错误,或者有改进的建议,请告诉我。 + +------ + +via: https://itsfoss.com/ppa-guide/ + +作者:[Abhishek Prakash][a] +选题:[lujun9972][b] +译者:[jlztan](https://github.com/jlztan) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/abhishek/ +[b]: https://github.com/lujun9972 +[1]: https://itsfoss.com/remove-install-software-ubuntu/ +[2]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2018/12/what-is-ppa.png?resize=800%2C450&ssl=1 +[3]: http://archive.ubuntu.com/ubuntu/dists/ +[4]: http://archive.ubuntu.com/ubuntu/dists/xenial/main/ +[5]: https://wiki.debian.org/Apt +[6]: https://itsfoss.com/apt-command-guide/ +[7]: https://launchpad.net/ubuntu/+ppas +[8]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2018/01/ppa-sources-list-files.png?resize=800%2C259&ssl=1 +[9]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2018/01/content-of-ppa-list.png?ssl=1 +[10]: https://itsfoss.com/install-software-from-source-code/ +[11]: https://itsfoss.com/how-to-know-ubuntu-unity-version/ +[12]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2017/12/verify-ppa-availibility-version.jpg?resize=800%2C481&ssl=1 +[13]: https://launchpad.net/ +[14]: https://itsfoss.com/failed-to-download-repository-information-ubuntu-13-04/ +[15]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2013/04/Failed-to-download-repository-information-Ubuntu-13.04.png?ssl=1 +[16]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2018/12/deb-from-ppa.jpg?resize=800%2C483&ssl=1 +[17]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2018/12/deb-from-ppa-2.jpg?resize=800%2C477&ssl=1 +[18]: https://itsfoss.com/gdebi-default-ubuntu-software-center/ +[19]: https://itsfoss.com/how-to-remove-or-delete-ppas-quick-tip/ +[20]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2018/01/ppa-synaptic-manager.jpeg?resize=800%2C394&ssl=1 +[21]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2012/08/Delete-a-PPA.jpeg?ssl=1 From 49eb0b4876d48a09fcebe843c285cdb25523ae5d Mon Sep 17 00:00:00 2001 From: wwhio Date: Fri, 18 Jan 2019 20:55:29 +0800 Subject: [PATCH 016/243] Update 20180428 A Beginners Guide To Flatpak.md --- sources/tech/20180428 A Beginners Guide To Flatpak.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sources/tech/20180428 A Beginners Guide To Flatpak.md b/sources/tech/20180428 A Beginners Guide To Flatpak.md index db1dfa8181..9cafa47bcb 100644 --- a/sources/tech/20180428 A Beginners Guide To Flatpak.md +++ b/sources/tech/20180428 A Beginners Guide To Flatpak.md @@ -1,3 +1,5 @@ +Translating by wwhio + A Beginners Guide To Flatpak ====== From 8b160d85d6ae029b0480722abb2b9b951dda6b5f Mon Sep 17 00:00:00 2001 From: wwhio Date: Fri, 18 Jan 2019 20:56:19 +0800 Subject: [PATCH 017/243] =?UTF-8?q?=E7=BF=BB=E8=AF=91=E8=AE=A4=E9=A2=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sources/tech/20180428 A Beginners Guide To Flatpak.md | 1 + 1 file changed, 1 insertion(+) diff --git a/sources/tech/20180428 A Beginners Guide To Flatpak.md b/sources/tech/20180428 A Beginners Guide To Flatpak.md index 9cafa47bcb..8b3460c2dd 100644 --- a/sources/tech/20180428 A Beginners Guide To Flatpak.md +++ b/sources/tech/20180428 A Beginners Guide To Flatpak.md @@ -1,5 +1,6 @@ Translating by wwhio + A Beginners Guide To Flatpak ====== From 76b337e907a5a86a92833365526680f0654d2a68 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Fri, 18 Jan 2019 22:37:21 +0800 Subject: [PATCH 018/243] PRF:20180606 Working with modules in Fedora 28.md @geekpi --- ...80606 Working with modules in Fedora 28.md | 24 ++++++++++++------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/translated/tech/20180606 Working with modules in Fedora 28.md b/translated/tech/20180606 Working with modules in Fedora 28.md index c4cfcfe1d6..bf5c4237f2 100644 --- a/translated/tech/20180606 Working with modules in Fedora 28.md +++ b/translated/tech/20180606 Working with modules in Fedora 28.md @@ -1,6 +1,8 @@ 使用 Fedora 28 中的模块 ====== + ![](https://fedoramagazine.org/wp-content/uploads/2018/05/modules-workingwith-816x345.jpg) + 最近 Fedora Magazine 中题为 [Fedora 28 服务器版的模块化][1]在解释 Fedora 28 中的模块化方面做得很好。它还给出了一些示例模块并解释了它们解决的问题。本文将其中一个模块用于实际应用,包括使用模块安装设置 Review Board 3.0。 ### 入门 @@ -21,9 +23,9 @@ sudo dnf -y update dnf module list ``` -输出列出了一组模块,这些模块显示了每个模块的关联流,版本和可用安装配置文件。模块流旁边的 [d] 表示安装命名模块时使用的默认流。 +输出列出了一组模块,这些模块显示了每个模块的关联流、版本和可用安装配置文件。模块流旁边的 `[d]` 表示安装命名模块时使用的默认流。 -输出还显示大多数模块都有名为 default 的配置文件。这不是巧合,因为 default 是默认配置文件使用的名称。 +输出还显示大多数模块都有名为 `default` 的配置文件。这不是巧合,因为 `default` 是默认配置文件使用的名称。 要查看所有这些模块的来源,请运行: @@ -31,7 +33,7 @@ dnf module list dnf repolist ``` -与通常的 [fedora 和更新包仓库][5]一起,输出还显示了fedora-modular 和 updates-modular 仓库。 +与通常的 [fedora 和更新包仓库][5]一起,输出还显示了 fedora-modular 和 updates-modular 仓库。 介绍声明你将设置 Review Board 3.0。也许名为 reviewboard 的模块在之前的输出中引起了你的注意。接下来,要获取有关该模块的一些详细信息,请运行以下命令: @@ -45,7 +47,7 @@ dnf module info reviewboard dnf module list reviewboard ``` -2.5 旁边的 [d] 表示它被配置为 reviewboard 的默认流。因此,请明确你想要的流: +2.5 旁边的 `[d]` 表示它被配置为 reviewboard 的默认流。因此,请明确你想要的流: ``` dnf module info reviewboard:3.0 @@ -65,7 +67,7 @@ dnf module info reviewboard:3.0 -v sudo dnf -y module install reviewboard:3.0 ``` -输出显示已安装 ReviewBoard 以及其他几个依赖软件包,其中包括 django:1.6 模块中的几个软件包。安装还启用了reviewboard:3.0 模块和相关的 django:1.6 模块。 +输出显示已安装 ReviewBoard 以及其他几个依赖软件包,其中包括 django:1.6 模块中的几个软件包。安装还启用了 reviewboard:3.0 模块和相关的 django:1.6 模块。 接下来,要查看已启用的模块,请使用以下命令: @@ -73,13 +75,13 @@ sudo dnf -y module install reviewboard:3.0 dnf module list --enabled ``` -输出中,[e] 表示已启用的流,[i] 表示已安装的配置。对于 reviewboard:3.0 模块,已安装默认配置。你可以在安装模块时指定其他配置。实际上,你仍然可以安装它,而且这次你不需要指定 3.0,因为它已经启用: +输出中,`[e]` 表示已启用的流,`[i]` 表示已安装的配置。对于 reviewboard:3.0 模块,已安装默认配置。你可以在安装模块时指定其他配置。实际上,你仍然可以安装它,而且这次你不需要指定 3.0,因为它已经启用: ``` sudo dnf -y module install reviewboard/server ``` -但是,安装 reviewboard:3.0/服务配置非常平常。reviewboard:3.0 模块的服务器配置与默认配置文件相同 - 因此无需安装。 +但是,安装 reviewboard:3.0/server 配置非常平常。reviewboard:3.0 模块的服务器配置与默认配置文件相同 —— 因此无需安装。 ### 启动 Review Board 网站 @@ -100,7 +102,7 @@ sudo setsebool -P httpd_can_sendmail=1 httpd_can_network_connect=1 \ sudo systemctl enable --now httpd ``` -现在启动系统中的 Web 浏览器,打开 ,然后享受全新的 Review Board 网站!要以 Review Board 管理员身份登录,请使用上面 rb-site 命令中的用户 ID 和密码。 +现在启动系统中的 Web 浏览器,打开 ,然后享受全新的 Review Board 网站!要以 Review Board 管理员身份登录,请使用上面 `rb-site` 命令中的用户 ID 和密码。 ### 模块清理 @@ -118,12 +120,16 @@ sudo rm -rf /var/www/rev.local 在 [Fedora 模块化][7]网站上了解有关在 Fedora 28 中使用模块的更多信息。dnf 手册页中的 module 命令部分也包含了有用的信息。 -------------------------------------------------------------------------------- + via: https://fedoramagazine.org/working-modules-fedora-28/ + 作者:[Merlin Mathesius][a] 选题:[lujun9972](https://github.com/lujun9972) 译者:[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/) 荣誉推出 + [a]:https://fedoramagazine.org/author/merlinm/ [1]:https://fedoramagazine.org/modularity-fedora-28-server-edition/ [2]:https://getfedora.org/server/ From 76afd18660be073d61b87c7d88c7e36062104ee7 Mon Sep 17 00:00:00 2001 From: lxy <524187166@qq.com> Date: Fri, 18 Jan 2019 23:04:06 +0800 Subject: [PATCH 019/243] 20180604 --- ...4 Firefox extensions worth checking out.md | 110 ------------------ ...4 Firefox extensions worth checking out.md | 109 +++++++++++++++++ 2 files changed, 109 insertions(+), 110 deletions(-) delete mode 100644 sources/tech/20180604 4 Firefox extensions worth checking out.md create mode 100644 translated/tech/20180604 4 Firefox extensions worth checking out.md diff --git a/sources/tech/20180604 4 Firefox extensions worth checking out.md b/sources/tech/20180604 4 Firefox extensions worth checking out.md deleted file mode 100644 index 2e6a22274b..0000000000 --- a/sources/tech/20180604 4 Firefox extensions worth checking out.md +++ /dev/null @@ -1,110 +0,0 @@ -translated by lixinyuxx -4 Firefox extensions worth checking out -====== - -![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/firefox_blue_lead.jpg?itok=gYaubJUv) - -I've been a Firefox user since v2.0 came out about 12 years ago. There were times when it wasn't the best web browser out there, but still, I kept going back to it for one reason: My favorite extensions wouldn't work with anything else. - -Today, I like the current state of Firefox itself for being fast, customizable, and open source, but I also appreciate extensions for manifesting ideas the original developers never thought of: What if you want to browse without a mouse? What if you don't like staring at bright light coming out of the monitor at night? What about using a dedicated media player for YouTube and other video hosting websites for better performance and extended playback controls? And what if you need a more sophisticated way to disable trackers and speed up loading pages? - -Fortunately, there's an answer for each of these questions, and I'm going to give them to you in the form of my favorite extensions—all of which are free software or open source (i.e., distributed under the [GNU GPL][1], [MPL][2], or [Apache][3] license) and make an excellent browser even better. - -Although the terms add-on and extension have slightly different meanings, I'll use them interchangeably in this article. - -### Tridactyl - -![Tridactyl screenshot][5] - -Tridactyl's new tab page, showcasing link hinting. - -[Tridactyl][6] enables you to use your keyboard for most of your browsing activities. It's inspired by the now-defunct [Vimperator][7] and [Pentadactyl][8], which were inspired by the default keybindings of [Vim][9]. Since I'm already used to Vim and other command-line applications, I find features like being able to navigate with the keys `h/j/k/l`, interact with hyperlinks with `f/F`, and create custom keybindings and commands very convenient. - -Tridactyl's optional native messenger (for now, available only for GNU/Linux and Mac OSX), which was implemented recently, offers even more cool features to boot. With it, for example, you can hide some elements of the GUI of Firefox (à la Vimperator and Pentadactyl), open a link or the current page in an external program (I often use [mpv][10] and [youtube-dl][11] for videos) and edit the content of text areas with your favorite text editor by pressing `Ctrl-I` (or any key combination of your choice). - -Having said that, keep in mind that it's a relatively young project and may still be rough around the edges. On the other hand, its development is very active, and when you look past its childhood illnesses, it can be a pleasure to use. - -### Open With - -![Open With Screenshot][13] - -A context menu provided by Open With. I can open the current page with one of the external programs listed here. - -Speaking of interaction with external programs, sometimes it's nice to have the ability to do that with the mouse. That's where [Open With][14] comes in. - -Apart from the added context menu (shown in the screenshot), you can find your own defined commands by clicking on the extension's icon on the add-on bar. As its icon and the description on [its page on Mozilla Add-ons][14] suggest, it was primarily intended to work with other web browsers, but I can use it with mpv and youtube-dl with ease as well. - -Keyboard shortcuts are available here, too, but they're severely limited. There are no more than three different combinations that can be selected in a drop-down list in the extension's settings. In contrast, Tridactyl lets me assign commands to virtually anything that isn't blocked by Firefox. Open With is currently for the mouse, really. - -### Stylus - -![Stylus Screenshot][16] - -In this screenshot, I've just searched for and installed a dark theme for the site I'm currently on with Stylus. Even the popup has custom style (called Deepdark Stylus)! - -[Stylus][17] is a userstyle manager, which means that by writing custom CSS rules and loading them with Stylus, you can change the appearance of any webpage. If you don't know CSS, there are a plethora of userstyles made by others on websites such as [userstyles.org][18]. - -Now, you may be asking, "Isn't that exactly what [Stylish][19] does?" You would be correct! You see, Stylus is based on Stylish and provides additional improvements: It respects your privacy by not containing any telemetry, all development is done in the open (although Stylish is still actively developed, I haven't been able to find the source code for recent versions), and it supports [UserCSS][20], among other things. - -UserCSS is an interesting format, especially for developers. I've written several userstyles for various websites (mainly dark themes and tweaks for better readability), and while the internal editor of Stylus is excellent, I still prefer editing code with Neovim. For that, all I need to do is load a local file with its name ending with ".user.css" in Stylus, enable the option "Live Reload", and any changes will be applied as soon as I modify and save that file in Neovim. Remote UserCSS files are also supported, so whenever I push changes to GitHub or any git-based development platforms, they'll automatically become available for users. (I provide a link to the raw version of the file so that they can access it easily.) - -### uMatrix - -![uMatrix Screenshot][22] - -The user interface of uMatrix, showing the current rules for the currently visited webpage. - -Jeremy Garcia mentioned uBlock Origin in [his article][23] here on Opensource.com as an excellent blocker. I'd like to draw attention to another extension made by [gorhill][24]: uMatrix. - -[uMatrix][25] allows you to set blocking rules for certain requests on a webpage, which can be toggled by clicking on the add-on's popup (seen in the screenshot above). These requests are distinguished by the categories of scripts, requests made by scripts, cookies, CSS rules, images, media content, frames, and anything else labeled as "other" by uMatrix. You can set up global rules to, for instance, allow all requests by default and add only particular ones to the blacklist (the more convenient approach), or block everything by default and whitelist certain requests manually (the safer approach). If you've been using NoScript or RequestPolicy, you can [import][26] your whitelist rules from them, too. - -In addition, uMatrix supports [hosts files][27], which can be used to block requests from certain domains. These are not to be confused with the filter lists used by uBlock Origin, which use the same syntax as the filters set by Adblock Plus. By default, uMatrix blocks domains of servers known to distribute ads, trackers, and malware with the help of a few hosts files, and you can add more external sources if you want to. - -So which one shall you choose—uBlock Origin or uMatrix? Personally, I use both on my desktop PC and only uMatrix on my Android phone. There's some overlap between the two, [according to gorhill][28], but they have a different target userbase and goals. If all you want is an easy way to block trackers and ads, uBlock Origin is a better choice. On the other hand, if you want granular control over what a webpage can or can't do inside your browser, even if it takes some time to configure and it can prevent sites from functioning as intended, uMatrix is the way to go. - -### Conclusion - -Currently, these are my favorite extensions for Firefox. Tridactyl is for speeding up browsing navigation by relying on the keyboard and interacting with external programs; Open With is there if I need to open something in another program with the mouse; Stylus is the definitive userstyle manager, appealing to both users and developers alike; and uMatrix is essentially a firewall within Firefox for filtering out requests on unknown territories. - -Even though I almost exclusively discussed the benefits of these add-ons, no software is ever perfect. If you like any of them and think they can be improved in any way, I recommend that you go to their GitHub page and look for their contribution guides. Usually, developers of free and open source software welcome bug reports and pull requests. Telling your friends about them or saying thanks are also excellent ways to help the developers, especially if they work on their projects in their spare time. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/18/6/firefox-open-source-extensions - -作者:[Zsolt Szakács][a] -选题:[lujun9972](https://github.com/lujun9972) -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]:https://opensource.com/users/zsolt -[1]:https://www.gnu.org/licenses/gpl-3.0.en.html -[2]:https://www.mozilla.org/en-US/MPL/ -[3]:https://www.apache.org/licenses/LICENSE-2.0 -[4]:/file/398411 -[5]:https://opensource.com/sites/default/files/uploads/tridactyl.png (Tridactyl's new tab page, showcasing link hinting) -[6]:https://addons.mozilla.org/en-US/firefox/addon/tridactyl-vim/ -[7]:https://github.com/vimperator/vimperator-labs -[8]:https://addons.mozilla.org/en-US/firefox/addon/pentadactyl/ -[9]:https://www.vim.org/ -[10]:https://mpv.io/ -[11]:https://rg3.github.io/youtube-dl/index.html -[12]:/file/398416 -[13]:https://opensource.com/sites/default/files/uploads/openwith.png (A context menu provided by Open With. I can open the current page with one of the external programs listed here.) -[14]:https://addons.mozilla.org/en-US/firefox/addon/open-with/ -[15]:/file/398421 -[16]:https://opensource.com/sites/default/files/uploads/stylus.png (In this screenshot, I've just searched for and installed a dark theme for the site I'm currently on with Stylus. Even the popup has custom style (called Deepdark Stylus)!) -[17]:https://addons.mozilla.org/en-US/firefox/addon/styl-us/ -[18]:https://userstyles.org/ -[19]:https://addons.mozilla.org/en-US/firefox/addon/stylish/ -[20]:https://github.com/openstyles/stylus/wiki/Usercss -[21]:/file/398426 -[22]:https://opensource.com/sites/default/files/uploads/umatrix.png (The user interface of uMatrix, showing the current rules for the currently visited webpage.) -[23]:https://opensource.com/article/18/5/firefox-extensions -[24]:https://addons.mozilla.org/en-US/firefox/user/gorhill/ -[25]:https://addons.mozilla.org/en-US/firefox/addon/umatrix -[26]:https://github.com/gorhill/uMatrix/wiki/FAQ -[27]:https://en.wikipedia.org/wiki/Hosts_(file) -[28]:https://github.com/gorhill/uMatrix/issues/32#issuecomment-61372436 diff --git a/translated/tech/20180604 4 Firefox extensions worth checking out.md b/translated/tech/20180604 4 Firefox extensions worth checking out.md new file mode 100644 index 0000000000..d434a01af7 --- /dev/null +++ b/translated/tech/20180604 4 Firefox extensions worth checking out.md @@ -0,0 +1,109 @@ +4个值得一提的 Firefox 拓展插件 +====== + +![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/firefox_blue_lead.jpg?itok=gYaubJUv) + +自从大约12年前 V2.0 推出以来, 我一直是 Firefox (火狐浏览器)的用户。那时它不是最好的网络浏览器,但我仍旧因为一个理由使用它:我最喜爱的无可比拟的浏览器拓展插件 + +如今, 我喜欢 Firefox 的当前状态,因为它快速、可定制和开源,但我也很欣赏扩展插件来体现原开发人员从未想到的特点: 如果您想在没有鼠标的情况下浏览呢?如果您不喜欢盯着晚上从显示器里出来的强光呢?对于 YouTube 和其他视频托管网站为了更好的性能和扩展使用一个更专业的播放器又如何呢?如果您需要更复杂的方法来禁用跟踪器和加快加载页面, 该怎么办? + +幸运的是, 这些问题都有答案, 我将展现给你我最喜爱的拓展--所有这些都是免费软件或开源的 (即, 在 [GNU GPL][1], [MPL][2],或 [Apache][3] 许可下) 并使一个优秀的浏览器更好。 + +尽管术语加载项和扩展具有微微不同的含义,,但我将在本文中交替使用它们。 + +### Tridactyl + +![Tridactyl screenshot][5] + +Tridactyl 的新选项卡页面,展示隐藏连接。 + +[Tridactyl][6] 使您能够在大多数浏览活动中使用键盘。它的灵感来自于现已解散的 [Vimperator][7] 和 [Pentadactyl][8] ,这是由 [Vim][9] 默认绑定值启发的。由于我已经习惯了 Vim 和其他命令行应用程序,我发现了一些功能,比如能够使用键值 `h/j/k/l` 进行导航,用 `f/F` 与超链接进行交互,并创建非常方便的自定义键绑定和命令。 + +Tridactyl 的可选本地信代理(目前,仅适用于GNU/Linux 和 Mac OSX), 最近才实现的,提供了更酷的功能来启动。例如, 有了它, 您可以隐藏 Firefox GUI 的一些元素(à la Vimperator 和 Pentadactyl),在外部程序中打开链接或当前页 (我经常用 [mpv][10] 和 [youtube-dl][11] 在视频上)通过按 `Ctrl-I` 用您喜爱的编辑器编辑文本内容(或者任意您选择的组合键)。 + +话虽如此, 但要记住,这是一个相对早期的项目,细节可能还是很粗糙。 另一方面,它的发展非常活跃, 当你回顾它早期的缺陷时, 使用它可能是一种乐趣。 + +### Open With + +![Open With Screenshot][13] + +Open With 提供的菜单。我可以在当前页面打开一个额外的列表。 + +说到与外部程序的互动,有时很高兴有能力用鼠标来做到这一点。这是 [Open With][14] 想法的来源. + +除了添加的上下文菜单 (如屏幕截图所示) 外,您还可以通过单击加载项栏上的扩展图标来找到自己定义的命令。 [its page on Mozilla Add-ons][14] 建议作为它的图标和描述,它主要是为了与其他 web 浏览器一起工作, 但我也可以轻松地使用它与 mpv 和 youtube-dl 。 + +这里也提供键盘快捷方式,但它们受到严重限制。可以在扩展设置的下拉列表中选择的组合不超过三种。相反, Tridactyl 允许我将命令分配给几乎任何没有被 Firefox 阻止的东西。打开与是目前为鼠标,真的。 + +### Stylus + +![Stylus Screenshot][16] + +在这个屏幕截图中, 我刚刚搜索并安装了一个黑暗的主题, 我正在上 Stylus 的网站。即使是弹出窗口也可以定制风格 (称为 Deepdark Stylus)! + +[Stylus][17] 是一个用户样式管理器,这意味着通过编写自定义 CSS 规则并将其加载到 Stylus 中,您可以更改任何网页的外观。如果你不知道 CSS ,有大量的风格在其他网站上,如 [userstyles.org][18] 。 + +现在,你可能会问,“这不正是什么 [Stylish][19] 么?” 你是对的!你看 Stylus 是基于 Stylish 并提供了更多的改进:它不包含任何遥测数据, 尊重您的隐私,所有开发都是公开的(尽管 Stylish 仍在积极开发, 我一直未能找到最新版本的源代码), 而且它还支持 [UserCSS][20]。 + +UserCSS 是一种有趣的格式,尤其是对于开发人员。我已经为不同的网站写了几种用户样式(主要是黑暗的主题和调整,以提高可读性),虽然 Stylus 的内部编辑器很好,我还是喜欢用 Neovim 编辑代码。为了做到这样我所需要做的就是用 ".user.css" 作为本地加载文件的后缀名,在 Stylus 里启动 "Live Reload" 选项,所有更改都会被应用只要我在 Neovim 中启保存和更改文件。远程 UserCSS 文件也支持,因此,每当我将更改推送到 Github 或任何基于 git 的开发平台时,它们将自动对用户可用。(我提供了指向该文件的原始版本的链接, 以便他们可以轻松地访问它。) + +### uMatrix + +![uMatrix Screenshot][22] + +uMatrix 的用户使用界面,显示当前访问过的网页的当前规则。 + +Jeremy Garcia 提到了 uBlock Origin 在 [his article][23] 在 Opensource.com 作为一个优秀的 blocker 。我想推荐另一个拓展插件作者是 [gorhill][24]: uMatrix 。 + +[uMatrix][25] 允许您为网页上的某些请求设置阻止规则,可以通过点击加载项的弹出窗口来切换(在上面的屏幕截图中可以看到)。 这些请求的区别在于脚本的类别、 scripts, cookies, CSS rules, images, media content, frames,和其他被 uMatrix 标记为 "other" 的 。 例如,您可以设置全局规则, 以便在默认情况下允许所有请求, 并将特定请求添加到黑名单中(更方便的方法),或在默认情况下阻止所有内容, 并手动将某些请求列入白名单 (更安全的方法)。如果您一直在使用NoScript 或 RequestPolicy,你可以 [import][26] 你的白名单规则。 + +另外 uMatrix 支持 [hosts files ][27],可用于阻止来自某些网站的请求。 不能与原始 uBlock 的筛选列表相比, 其使用的语法是 Adblock Plus 。默认情况下, uMatrix 会在几个文件的帮助下阻止已知分发广告、跟踪器和恶意软件的服务器, 如果需要, 您可以添加更多外部源。 + +那么你将选择哪一个-- uBlock Origin 或 uMatrix ?就个人而言,我在电脑上两个都用,只在安卓手机上用 uMatrix 。两者之间会有重叠的部分 [according to gorhill][28] ,但他们有不同的用户和目标群,如果你想要的只是阻止跟踪器和广告的简单方法, uBlock Origine 是更好的选择, 另一方面,如果您希望对网页在浏览器中可以执行或不能执行的操作进行精细的控制, 即使需要一些时间来进行配置, 并且可能会阻止网站按预期运行, uMatrix 是更好的选择。 + +### 结论 + +目前, 这些是 Firefox 里我最喜欢的扩展。Tridactyl 是依靠键盘和与外部程序交互, 加快浏览导航速度;Open With 能让我用鼠标点击程序操作, Stylus 是明确的用户风格的管理器, 对用户和开发人员都有吸引力; uMatrix 本质上是 Firefox 的防火墙用于过滤未知的请求。 + +尽管我几乎完全讨论了这些加载项的好处,但没有一个软件是完美的。如果你喜欢他们中的任何一个,并认为他们可以以任何方式改进, 我建议你去他们的 Github 页面,并寻找他们的贡献指南。通常情况下,免费和开源软件的开发人员欢迎错误报告和提交请求。告诉你的朋友或道谢也是帮助开发者的好方法, 特别是如果他们在业余时间从事他们的项目。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/18/6/firefox-open-source-extensions + +作者:[Zsolt Szakács][a] +选题:[lujun9972](https://github.com/lujun9972) +译者:[lixinyuxx](https://github.com/lixinyuxx) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:https://opensource.com/users/zsolt +[1]:https://www.gnu.org/licenses/gpl-3.0.en.html +[2]:https://www.mozilla.org/en-US/MPL/ +[3]:https://www.apache.org/licenses/LICENSE-2.0 +[4]:/file/398411 +[5]:https://opensource.com/sites/default/files/uploads/tridactyl.png "Tridactyl's new tab page, showcasing link hinting" +[6]:https://addons.mozilla.org/en-US/firefox/addon/tridactyl-vim/ +[7]:https://github.com/vimperator/vimperator-labs +[8]:https://addons.mozilla.org/en-US/firefox/addon/pentadactyl/ +[9]:https://www.vim.org/ +[10]:https://mpv.io/ +[11]:https://rg3.github.io/youtube-dl/index.html +[12]:/file/398416 +[13]:https://opensource.com/sites/default/files/uploads/openwith.png "A context menu provided by Open With. I can open the current page with one of the external programs listed here." +[14]:https://addons.mozilla.org/en-US/firefox/addon/open-with/ +[15]:/file/398421 +[16]:https://opensource.com/sites/default/files/uploads/stylus.png "In this screenshot, I've just searched for and installed a dark theme for the site I'm currently on with Stylus. Even the popup has custom style (called Deepdark Stylus)!" +[17]:https://addons.mozilla.org/en-US/firefox/addon/styl-us/ +[18]:https://userstyles.org/ +[19]:https://addons.mozilla.org/en-US/firefox/addon/stylish/ +[20]:https://github.com/openstyles/stylus/wiki/Usercss +[21]:/file/398426 +[22]:https://opensource.com/sites/default/files/uploads/umatrix.png "The user interface of uMatrix, showing the current rules for the currently visited webpage." +[23]:https://opensource.com/article/18/5/firefox-extensions +[24]:https://addons.mozilla.org/en-US/firefox/user/gorhill/ +[25]:https://addons.mozilla.org/en-US/firefox/addon/umatrix +[26]:https://github.com/gorhill/uMatrix/wiki/FAQ +[27]:https://en.wikipedia.org/wiki/Hosts_(file) +[28]:https://github.com/gorhill/uMatrix/issues/32#issuecomment-61372436 From 35831e35a82dbe783caf83e8fd7688d14bcd61bd Mon Sep 17 00:00:00 2001 From: wwhio Date: Fri, 18 Jan 2019 23:57:09 +0800 Subject: [PATCH 020/243] =?UTF-8?q?=E7=BF=BB=E8=AF=91=E5=AE=8C=E6=88=90?= =?UTF-8?q?=EF=BC=8C=E7=94=B3=E8=AF=B7=E6=A0=A1=E5=AF=B9=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../20180428 A Beginners Guide To Flatpak.md | 144 +++++++++--------- 1 file changed, 69 insertions(+), 75 deletions(-) diff --git a/sources/tech/20180428 A Beginners Guide To Flatpak.md b/sources/tech/20180428 A Beginners Guide To Flatpak.md index 8b3460c2dd..614f54cdf1 100644 --- a/sources/tech/20180428 A Beginners Guide To Flatpak.md +++ b/sources/tech/20180428 A Beginners Guide To Flatpak.md @@ -1,56 +1,53 @@ -Translating by wwhio - - -A Beginners Guide To Flatpak +Flatpak 新手指南 ====== ![](https://www.ostechnix.com/wp-content/uploads/2016/06/flatpak-720x340.jpg) -A while, we have written about [**Ubuntu’s Snaps**][1]. Snaps are introduced by Canonical for Ubuntu operating system, and later it was adopted by other Linux distributions such as Arch, Gentoo, and Fedora etc. A snap is a single binary package bundled with all required libraries and dependencies, and you can install it on any Linux distribution, regardless of its version and architecture. Similar to Snaps, there is also another tool called **Flatpak**. As you may already know, packaging distributed applications for different Linux distributions are quite time consuming and difficult process. Each distributed application has different set of libraries and dependencies for various Linux distributions. But, Flatpak, the new framework for desktop applications that completely reduces this burden. Now, you can build a single Flatpak app and install it on various operating systems. How cool, isn’t it? +不久前,我们介绍 Ubuntu 推出的 [**Snaps**][1]。Snaps 是由 Canonical 公司为 Ubuntu 开发的,并随后移植到其他的 Linux 发行版,如 Arch、Gentoo、Fedora 等等。由于一个 snap 包中含有软件的二进制文件和其所需的所有依赖和库,所以可以在无视软件版本、在任意 Linux 发行版上安装软件。和 Snaps 类似,还有一个名为 **Flatpak** 的工具。也许你已经知道,为不同的 Linux 发行版打包并分发应用时已经多么费时又复杂的工作,因为不同的 Linux 发行版的库不同,库的版本也不同。现在,Flatpak 作为分发桌面应用的新框架可以让开发者完全摆脱这些负担。开发者只需构建一个 Flatpak app 就可以在多种发行版上安装使用。这真是又酷又棒! -Also, the users don’t have to worry about the libraries and dependencies, everything is bundled within the app itself. Most importantly, Flaptpak apps are sandboxed and isolated from the rest of the host operating system, and other applications. Another notable feature is we can install multiple versions of the same application at the same time in the same system. For example, you can install VLC player version 2.1, 2.2, and 2.3 on the same system. So, the developers can test different versions of same application at a time. +用户也完全不用担心库和依赖的问题了,所有的东西都和 app 打包在了一起。更重要的是 Flatpak app 们都自带沙箱,而且与宿主操作系统的其他部分隔离。对了,Flatpak 还有一个很棒的特性,它允许用户在同一个系统中安装同一应用的多个版本,例如 VLC 播放器的 2.1 版、2.2 版、2.3 版。这使开发者测试同一个软件的多个版本变得更加方便。 -In this tutorial, we will see how to install Flatpak in GNU/Linux. +在本文中,我们将指导你如何在 GNU/Linux 中安装 Flatpak。 -### Install Flatpak +### 安装 Flatpak -Flatpak is available for many popular Linux distributions such as Arch Linux, Debian, Fedora, Gentoo, Red Hat, Linux Mint, openSUSE, Solus, Mageia and Ubuntu distributions. +Flatpak 可以在大多数的主流 Linux 发行版上安装使用,如 Arch Linux、Debian、Fedora、Gentoo、Red Hat、Linux Mint、openSUSE、Solus、Mageia 还有 Ubuntu。 -To install Flatpak on Arch Linux, run: +在 Arch Linux 上,使用这一条命令来安装 Flatpak: ``` $ sudo pacman -S flatpak ``` -Flatpak is available in the default repositories of Debian Stretch and newer. To install it, run: +对于 Debian 用户,Flatpak 被收录进 Stretch 或更新版本的默认软件源中。要安装 Flatpak,直接执行: ``` $ sudo apt install flatpak ``` -On Fedora, Flatpak is installed by default. All you have to do is enable enable Flathub as described in the next section. +对于 Fedora 用户,Flatpak 是发行版默认安装的软件。你可以直接跳过这一步。 -Just in case, it is not installed for any reason, run: +如果因为任何原因没有安装的话,可以执行: ``` $ sudo dnf install flatpak ``` -On RHEL 7, run: +对于 RHEL 7 用户,安装 Flatpak 的命令为: ``` $ sudo yum install flatpak ``` -On Linux Mint 18.3, flatpak is installed by default. So, no setup required. +如果你在使用 Linux Mint 18.3,那么 Flatpat 也随系统默认安装,所以跳过这一步。 -On openSUSE Tumbleweed, Flatpak can also be installed using Zypper: +在 openSUSE Tumbleweed 中,使用 Zypper 包管理来安装 Flatpak: ``` $ sudo zypper install flatpak ``` -On Ubuntu, add the following repository and install Flatpak as shown below. +而 Ubuntu 需要添加下面的软件源再安装 Flatpak,命令如下: ``` $ sudo add-apt-repository ppa:alexlarsson/flatpak @@ -60,39 +57,39 @@ $ sudo apt install flatpak ``` -The Flatpak plugin for the Software app makes it possible to install apps without needing the command line. To install this plugin, run: +Gnome 提供了一个 Flatpak 插件,安装它就可以使用图形界面来安装 Flatpak app 了。插件的安装命令为: ``` $ sudo apt install gnome-software-plugin-flatpak ``` -For other Linux distributions, refer the official installation [**link**][2]. +如果你是用发行版没有在上述的说明里,请你参考官方[**安装指南**][2]。 -### Getting Started With Flatpak +### 开始使用 Flatpak -There are many popular applications such as Gimp, Kdenlive, Steam, Spotify, Visual studio code etc., available as flatpaks. +有不少流行应用都支持 Flatpak 安装,如 Gimp、Kdenlive、Steam、Spotify、Visual Sudio Code 等。 -Let us now see the basic usage of flatpak command. +下面让我来一起学习 flatpak 的基本操作命令。 -First of all, we need to add remote repositories. +首先,我们需要添加远程仓库。 -#### Adding Remote Repositories** +#### 添加软件仓库 -**Enable Flathub Repository:** +**添加 Flathub 仓库:** -**Flathub** is nothing but a central repository where all flatpak applications available to users. To enable it, just run: +**Flathub** 是一个包含了几乎所有 flatpak 应用的仓库。运行这条命令来启用它: ``` $ sudo flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo ``` -Flathub is enough to install most popular apps. Just in case you wanted to try some GNOME apps, add the GNOME repository. +对于流行应用来说,Flathub 已经可以满足需求。如果你想试试 GNOME 应用的话,可以添加 GNOME 的仓库。 -**Enable GNOME Repository:** +**添加 GNOME 仓库:** -The GNOME repository contains all GNOME core applications. GNOME flatpak repository itself is available as two versions, **stable** and **nightly**. +GNOME 仓库包括了所有的 GNOME 核心应用,它提供了两种版本:**稳定版**stable**每日构建版**nightly。 -To add GNOME stable repository, run the following commands: +使用下面的命令来添加 GNOME 稳定版仓库: ``` $ wget https://sdk.gnome.org/keys/gnome-sdk.gpg @@ -100,15 +97,15 @@ $ sudo flatpak remote-add --gpg-import=gnome-sdk.gpg --if-not-exists gnome-apps ``` -Applications in this repository require the **3.20 version of the org.gnome.Platform runtime**. +需要注意的是,GNOME 稳定版仓库中的应用需要 **3.20 版本的 org.gnome.Platform 运行时环境**。 -To install the stable runtimes, run: +安装稳定版运行时环境,请执行: ``` $ sudo flatpak remote-add --gpg-import=gnome-sdk.gpg gnome https://sdk.gnome.org/repo/ ``` -To add the GNOME nightly apps repository, run: +如果想使用每日构建版的 GNOME 仓库,使用如下的命令: ``` $ wget https://sdk.gnome.org/nightly/keys/nightly.gpg @@ -116,17 +113,17 @@ $ sudo flatpak remote-add --gpg-import=nightly.gpg --if-not-exists gnome-nightly ``` -Applications in this repository require the **nightly version of the org.gnome.Platform runtime**. +同样,每日构建版的 GNOME 仓库也需要 **org.gnome.Platform 运行时环境的每日构建版本**。 -To install the nightly runtimes, run: +执行下面的命令安装每日构建版的运行时环境: ``` $ sudo flatpak remote-add --gpg-import=nightly.gpg gnome-nightly https://sdk.gnome.org/nightly/repo/ ``` -#### Listing Remotes +#### 查看软件仓库 -To list all configured remote repositories, run: +要查看已经添加的软件仓库,执行下面的命令: ``` $ flatpak remotes Name Options @@ -138,126 +135,126 @@ gnome-nightly-apps system ``` -As you can see, the above command lists the remotes that you have added in your system. It also lists whether the remote has been added per-user or system-wide. +如你所见,上述命令会列出你添加到系统中的软件仓库。此外,执行结果还表明了软件仓库的配置是用户级per-user还是系统级system-wide。 -#### Removing Remotes +#### 删除软件仓库 -To remove a remote, for example flathub, simply do; +要删除软件仓库,例如 flathub,用这条命令: ``` $ sudo flatpak remote-delete flathub ``` -Here **flathub** is remote name. +这里的 **flathub** 是软件仓库的名字。 -#### Installing Flatpak Applications +#### 安装 Flatpak 应用 -In this section, we will see how to install flatpak apps. To install a flatpak application +这一节,我们将学习如何安装 flatpak 应用。 -To install an application, simply do: +要安装一个应用,只要一条命令就能完成: ``` $ sudo flatpak install flathub com.spotify.Client ``` -All the apps in the GNOME stable repository uses the version name of “stable”. +所有的稳定版 GNOME 软件仓库中的应用,都使用“stable”作为版本名。 -To install any Stable GNOME applications, for example **Evince** , run: +例如,想从稳定版 GNOME 软件仓库中安装稳定版 **Evince**,就执行: ``` $ sudo flatpak install gnome-apps org.gnome.Evince stable ``` -All the apps in the GNOME nightly repository uses the version name of “master”. +所有的每日构建版 GNOME 仓库中的应用,都使用“master”作为版本名。 -For example, to install gedit, run: +例如,要从每日构建版 GNOME 软件仓库中安装 gedit 的每次构建版本,就执行: ``` $ sudo flatpak install gnome-nightly-apps org.gnome.gedit master ``` -If you don’t want to install apps system-wide, you also can install flatpak apps per-user like below. +如果不希望应用安装在系统级system-wide,而只安装在用户级per-user,那么你可以这样安装软件: ``` $ flatpak install --user ``` -All installed apps will be stored in **$HOME/.var/app/** location. +所有的应用都会被存储在 **$HOME/.var/app/** 目录下. ``` $ ls $HOME/.var/app/ com.spotify.Client ``` -#### Running Flatpak Applications +#### 执行 Flatpak 应用 -You can launch the installed applications at any time from the application launcher. From command line, you can run it, for example Spotify, using command: +你可以直接使用应用启动器application launcher来运行已安装的 Flatpak 应用。如果你想从命令行启动的话,以 Spotify 为例,执行下面的命令: ``` $ flatpak run com.spotify.Client ``` -#### Listing Applications +#### 列出已安装的 Flatpak 应用 -To view the installed applications and runtimes, run: +要查看已安装的应用程序和运行时环境,执行: ``` $ flatpak list ``` -To view only the applications, not run times, use this command instead. +想只查看已安装的应用,那就用这条命令: ``` $ flatpak list --app ``` -You can also view the list of available applications and runtimes from all remotes using command: +如果想查询已添加的软件仓库中的可安装程序和可安装的运行时环境,使用命令: ``` $ flatpak remote-ls ``` -To list only applications not runtimes, run: +只列出可安装的应用程序的命令是: ``` $ flatpak remote-ls --app ``` -To list applications and runtimes from a specific repository, for example **gnome-apps** , run: +查询指定远程仓库中的所有可安装的应用程序和运行时环境,这里以 **gnome-apps** 为例,执行命令: ``` $ flatpak remote-ls gnome-apps ``` -To list only the applications from a remote repository, run: +只列出可安装的应用程序,这里以 **flathub** 为例: ``` $ flatpak remote-ls flathub --app ``` -#### Updating Applications +#### 更新应用程序 -To update all your flatpak applications, run: +更新所有的 Flatpak 应用程序,执行: ``` $ flatpak update ``` -To update a specific application, we do: +更新指定的 Flatpak 应用程序,执行: ``` $ flatpak update com.spotify.Client ``` -#### Getting Details Of Applications +#### 获取应用详情 -To display the details of a installed application, run: +执行下面的命令来查看已安装应用程序的详细信息: ``` $ flatpak info io.github.mmstick.FontFinder ``` -Sample output: +输出样例: ``` Ref: app/io.github.mmstick.FontFinder/x86_64/stable ID: io.github.mmstick.FontFinder @@ -274,28 +271,25 @@ Runtime: org.gnome.Platform/x86_64/3.28 ``` -#### Removing Applications +#### 删除应用程序 -To remove a flatpak application, run: +要删除一个 Flatpak 应用程序,这里以 spotify 为例,执行: ``` $ sudo flatpak uninstall com.spotify.Client ``` -For details, refer flatpak help section. +如果你需要更多信息,可以参考 Flatpak 的帮助。 ``` $ flatpak --help ``` -And, that’s all for now. Hope you had basic idea about Flatpak. +到此,希望你对 Flatpak 有了一些基础了解。 -If you find this guide useful, please share it on your social, professional networks and support OSTechNix. - -More good stuffs to come. Stay tuned! - -Cheers! +如果你觉得这篇指南有些帮助,请在你的社交媒体上分享它来支持 OSTechNix。 +稍后还有更多精彩内容,尽情期待~ -------------------------------------------------------------------------------- @@ -304,7 +298,7 @@ via: https://www.ostechnix.com/flatpak-new-framework-desktop-applications-linux/ 作者:[SK][a] 选题:[lujun9972](https://github.com/lujun9972) -译者:[译者ID](https://github.com/译者ID) +译者:[wwhio](https://github.com/wwhio) 校对:[校对者ID](https://github.com/校对者ID) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 5e65cad61509045647caffde9971e431b470735b Mon Sep 17 00:00:00 2001 From: wwhio Date: Fri, 18 Jan 2019 23:59:34 +0800 Subject: [PATCH 021/243] =?UTF-8?q?=E7=BF=BB=E8=AF=91=E5=AE=8C=E6=88=90?= =?UTF-8?q?=EF=BC=8C=E7=94=B3=E8=AF=B7=E6=A0=A1=E5=AF=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../tech/20180428 A Beginners Guide To Flatpak.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {sources => translated}/tech/20180428 A Beginners Guide To Flatpak.md (100%) diff --git a/sources/tech/20180428 A Beginners Guide To Flatpak.md b/translated/tech/20180428 A Beginners Guide To Flatpak.md similarity index 100% rename from sources/tech/20180428 A Beginners Guide To Flatpak.md rename to translated/tech/20180428 A Beginners Guide To Flatpak.md From f037e389ab723ecb3f589b4ed0bb523c1ba24c34 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Sat, 19 Jan 2019 00:26:25 +0800 Subject: [PATCH 022/243] PRF:20180419 5 guiding principles you should know before you design a microservice.md @lixinyuxx --- ...d know before you design a microservice.md | 114 +++++++++--------- 1 file changed, 58 insertions(+), 56 deletions(-) diff --git a/translated/talk/20180419 5 guiding principles you should know before you design a microservice.md b/translated/talk/20180419 5 guiding principles you should know before you design a microservice.md index 6eee610d0b..2a8dd86f9f 100644 --- a/translated/talk/20180419 5 guiding principles you should know before you design a microservice.md +++ b/translated/talk/20180419 5 guiding principles you should know before you design a microservice.md @@ -1,130 +1,132 @@ -设计微服务架构前,您应该了解的5项指导原则 +设计微服务架构前应该了解的 5 项指导原则 ====== +> 顶级 CTO 基于五个简单的原则为精心设计的微服务提供建议。 ![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/BIZ_OpenInnovation.png?itok=l29msbql) -对于从微服务开始的团队来说,最大的挑战之一就是坚持金发姑娘原则(The *Goldilocks principle*):不要太大, 不要太小,不能太紧密耦合。之所以是挑战的原因是会对究竟什么是设计良好的微服务感到疑惑。 + +对于从微服务开始的团队来说,最大的挑战之一就是坚持金发女孩原则The Goldilocks principle(该典故来自于童话《金发姑娘和三只熊》):不要太大,不要太小,不能太紧密耦合。之所以是挑战的部分原因是会对究竟什么是设计良好的微服务感到疑惑。 -数十家 CTOs 通过采访分享了他们的经验, 这些对话说明了设计良好的微服务的五个特点。本文将帮助指导团队设计微服务。(有关详细信息, 请查看即将出版的书籍 [Microservices for Startups][1])。本文将简要介绍微服务的边界和主观的 ”规则“,以避免在深入了解五个特征之前就开始指导您的微服务设计。 +数十位 CTO 通过采访分享了他们的经验,这些对话说明了设计良好的微服务的五个特点。本文将帮助指导团队设计微服务。(有关详细信息,请查看即将出版的书籍 [Microservices for Startups][1],LCTT 译注:已可免费下载完整的电子版)。本文将简要介绍微服务的边界和主观的 “规则”,以避免在深入了解五个特征之前就开始指导您的微服务设计。 ### 微服务边界 - [core benefits of developing new systems with microservices][2] (开发具有微服务的新系统的核心优势)其中之一是该体系结构允许开发人员独立构建和修改单个组件, 但在最大限度地减少每个 API 之间的回调数量方面可能会出现问题。 根据 Chris McFadden 的解决方法,[SparkPost ][3] 的工程副总裁,应用适当的服务边界去解决问题。 +[使用微服务开发新系统的核心优势][2]之一是该体系结构允许开发人员独立构建和修改各个组件,但在最大限度地减少每个 API 之间的回调数量方面可能会出现问题。根据 [SparkPost][3] 工程副总裁 Chris McFadden 所说,解决方案是应用适当的服务边界。 -关于边界, 与 domain-driven design (DDD)—a framework for microservices (域驱动设计--微服务框架)有时难以理解和抽象的概念形成鲜明对比,本文重点介绍了与我们行业的一些顶级 CTOs 建立明确定义的微服务边界的实用原则。 +关于边界,与有时难以理解和抽象的领域驱动设计(DDD,一种微服务框架)形成鲜明对比,本文重点介绍了和我们行业的一些顶级 CTO 一同建立的明确定义的微服务边界的实用原则。 -### 避免主观的 ”规则“ +### 避免主观的 “规则” -如果您阅读了足够多的关于设计和创建微服务的建议,您一定会遇到下面的一些 ”规则“。 尽管将它们用作创建微服务的指南很有吸引力, 但加入这些主观规则并不是思考确定微服务的边界的原则性方式。 +如果您阅读了足够多的关于设计和创建微服务的建议,您一定会遇到下面的一些 “规则”。 尽管将它们用作创建微服务的指南很有吸引力,但加入这些主观规则并不是思考确定微服务的边界的原则性方式。 -#### ”微服务应该有 X 行代码“ +#### “微服务应该有 X 行代码” -让我们直说:微服务中有多少行代码没有限制。微服务不会因为您写了几行额外的代码而突然变成一个巨无霸。关键是要确保服务中的代码具有很高的内聚性 (稍后将对此进行更多介绍)。 +让我们直说:微服务中有多少行代码没有限制。微服务不会因为您写了几行额外的代码而突然变成一个独石应用。关键是要确保服务中的代码具有很高的内聚性(稍后将对此进行更多介绍)。 #### “将每个功能转换为微服务” -如果函数基于三个输入值计算某些内容并返回结果,它是否是微服务的理想候选项?它是否应该是单独可部署应用程序?这确实取决于函数是什么以及它是如何服务于整个系统。将每个函数转换为微服务在您的内容中可能根本没有意义。 +如果函数基于三个输入值计算某些内容并返回结果,它是否是微服务的理想候选项?它是否应该是单独可部署应用程序?这确实取决于该函数是什么以及它是如何服务于整个系统。将每个函数转换为微服务在您的情景中可能根本没有意义。 -其他主观规则包括不考虑整个内容的规则, 例如团队的经验、 DevOps (Development和Operations的组合词)容量、服务正在执行的操作以及数据的可用性需求。 +其他主观规则包括不考虑整个情景的规则,例如团队的经验、DevOps 能力、服务正在执行的操作以及数据的可用性需求。 -### 精心设计的服务的5个特点 +### 精心设计的服务的 5 个特点 -如果您读过关于微服务的文章, 您无疑会遇到关于什么是设计良好的服务的建议。简单地说, 高内聚和低耦合。如果您不熟悉这些概念, 有许多文章需要查看 [many][4] [articles][5] 。虽然他们提供了合理的建议,但这些概念是相当抽象的。下面, 基于与经验丰富的 CTOs 的对话, 在创建设计良好的微服务时需要牢记的关键特征。 +如果您读过关于微服务的文章,您无疑会遇到有关设计良好的服务的建议。简单地说,高内聚和低耦合。如果您不熟悉这些概念,有[许多][4][文章][4]关于这些概念的文章。虽然它们提供了合理的建议,但这些概念是相当抽象的。基于与经验丰富的 CTO 们的对话,下面是在创建设计良好的微服务时需要牢记的关键特征。 -#### #1: 不与其他服务共享数据库表 +#### #1:不与其他服务共享数据库表 -在 SparkPost 的早期, Chris McFadden 和他的团队必须解决一个问题,,每个 SaaS 生意(Software-as-a-Service,软件即服务)都要面对的:他们需要提供基本服务,如身份验证、帐户管理和计费。 +在 SparkPost 的早期,Chris McFadden 和他的团队必须解决每个 SaaS 业务需要面对的问题:它们需要提供基本服务,如身份验证、帐户管理和计费。 -为了解决这个问题,他们创建了两个微服务:用户 API 和帐户 API。用户 API 将处理用户帐户、API 密钥和身份验证,而帐户 API 将处理所有与计费相关的逻辑。一个非常符合逻辑的分离--但没过多久,他们发现了一个问题。 +为了解决这个问题,他们创建了两个微服务:用户 API 和帐户 API。用户 API 将处理用户帐户、API 密钥和身份验证,而帐户 API 将处理所有与计费相关的逻辑。这是一个非常合乎逻辑的分离 —— 但没过多久,他们发现了一个问题。 -McFadden 解释说,“我们有一个名为 ”用户 API “的服务,还有一个名为”帐户 API “的服务。问题是,他们之间实际上有几个来回的电话。因此, 您会在帐户中执行一些操作,并在用户中具有调用和终结点,反之亦然” +McFadden 解释说,“我们有一个名为‘用户 API’的服务,还有一个名为‘帐户 API’的服务。问题是,他们之间实际上有几个来回的调用。因此,您会在帐户服务中执行一些操作,然后调用并终止于用户服务,反之亦然” 这两个服务的耦合太紧密了。 -在设计微服务时, 如果您有多个服务引用同一个表, 则它是一个危险的信号,因为这可能意味着您的数据库是耦合的源头。 +在设计微服务时,如果您有多个服务引用同一个表,则它是一个危险的信号,因为这可能意味着您的数据库是耦合的源头。 -这确实是关于服务与数据的关系, 这正是Oleksiy Kovrin,[Swiftype SRE, Elastic][6] 的领导者, 告诉我。“我们在开发新服务时使用的主要基本原则之一是, 它们不应跨越数据库边界。每个服务都应依赖于自己的一组基础数据存储。这使我们能够集中访问控制、审计日志记录、缓存逻辑等。” +这确实是关于服务与数据的关系,这正是 [Swiftype SRE,Elastic][6] 的负责人 Oleksiy Kovrin 告诉我。他说,“我们在开发新服务时使用的主要基本原则之一是,它们不应跨越数据库边界。每个服务都应依赖于自己的一组底层数据存储。这使我们能够集中访问控制、审计日志记录、缓存逻辑等。” -Kovrin 接着解释说,如果数据库表的子集 “与数据集的其余部分没有或很少连接,则这是一个强烈的信号, 表明组件可以被隔离到单独的 API 或单独的服务中”。 +Kovrin 接着解释说,如果数据库表的某个子集“与数据集的其余部分没有或很少连接,则这是一个强烈的信号,表明该组件可以被隔离到单独的 API 或单独的服务中”。 -Darby Frey , [Lead Honestly][7] 的联合创始人,与此的观点相呼应:”每个服务都应该有自己的表 [并且] 永远不应该共享数据库表。“ +[Lead Honestly][7] 的联合创始人 Darby Frey 与此的观点相呼应:“每个服务都应该有自己的表并且永远不应该共享数据库表。” -#### #2: 数据库表数量最小化 +#### #2:数据库表数量最小化 -微服务的理想尺寸足够小,但不会更小。每个服务的数据库表的数量也是如此。 +微服务的理想尺寸应该足够小,但不能太小。每个服务的数据库表的数量也是如此。 -Steven Czerwinski,[Scaylr][8] 的工程主管, 在接受采访时解释说 Scaylr 的最佳选择是 ”一个或两个服务的数据库表“。 +[Scaylr][8] 的工程主管 Steven Czerwinski 在接受采访时解释说 Scaylr 的最佳选择是“一个或两个服务的数据库表。” -SparkPost's Chris McFadden 同意:”我们有一个(suppression)限制微服务,它处理, 跟踪, 数以百万计和数十亿的条目周围的限制,但它都非常集中只是围绕限制,所以实际上只有一个或两个表。其他服务也是如此,比如 *webhooks* 。 +SparkPost 的 Chris McFadden 表示同意:“我们有一个 suppression 微服务,它处理、跟踪数以百万计和数十亿围绕 suppression 的条目,但它们都非常专注于围绕 suppression,所以实际上只有一个或两个表。其他服务也是如此,比如 webhooks。 -#### #3: 考虑有状态和无状态 +#### #3:考虑有状态和无状态 -在设计微服务时,您需要问问自己它是否需要访问数据库,或者它是否会是处理 TB 级数据 (如电子邮件或日志) 的无状态服务。 +在设计微服务时,您需要问问自己它是否需要访问数据库,或者它是否是处理 TB 级数据 (如电子邮件或日志) 的无状态服务。 -Julien Lemoine, [Algolia][9] 的 CTO,解释说::“我们通过定义服务的输入和输出来定义服务的边界。有时服务是网络 API ,但它也可能是在数据库中使用文件和生成记录的进程 (这就是我们的日志处理服务)。 +[Algolia][9] 的 CTO Julien Lemoine 解释说:“我们通过定义服务的输入和输出来定义服务的边界。有时服务是网络 API,但它也可能是使用文件并在数据库中生成记录的进程 (这就是我们的日志处理服务)。” -事先要清楚状态,这将引导一个更好的服务设计。 +事先要明确是否有状态,这将引导一个更好的服务设计。 -#### #4: 考虑数据可用性需求 +#### #4:考虑数据可用性需求 -在设计微服务时,请记住哪些服务将依赖于此新服务, 以及在该数据不可用时的全系统影响。考虑到这一点,您可以正确地设计此服务的数据备份和恢复系统。 +在设计微服务时,请记住哪些服务将依赖于此新服务,以及在该数据不可用时的整个系统的影响。考虑到这一点,您可以正确地设计此服务的数据备份和恢复系统。 -Steven Czerwinski 在 Scaylr 提到,由于关键客户行空间映射数据的重要性,它将以不同的方式复制和分离。 +Steven Czerwinski 提到,在 Scaylr 由于关键客户行空间映射数据的重要性,它将以不同的方式复制和分离。 -他补充说,”每个分片信息,在自己的小分区里。如果因为这部分客户群体不会有他们的可用日志而下降,那很糟糕,但它只影响5% 的客户,而不是100% 的客户。 +相比之下,他补充说,“每个分片信息,都在自己的小分区里。如果部分客户群体因为没有可用日志而停止服务那很糟糕,但它只影响 5% 的客户,而不是100% 的客户。” -#### #5: 真理的唯一来源 +#### #5:单一的真实来源 -设计服务,使其成为系统中某些内容的唯一实际来源 +设计服务,使其成为系统中某些内容的唯一真实来源。 -例如,当您从电子商务网站订购内容时, 则会生成订单 ID ,其他服务可以使用此订单 ID 来查询订单服务,以获取有关订单的完整信息。使用 [publish/subscribe pattern][10] ,在服务之间传递的数据应该是订单 ID , 而不是订单本身的属性信息。只有订单服务具有完整的信息,并且是给定订单的唯一实际来源。 +例如,当您从电子商务网站订购内容时,则会生成订单 ID,其他服务可以使用此订单 ID 来查询订单服务,以获取有关订单的完整信息。使用 [发布/订阅模式][10],在服务之间传递的数据应该是订单 ID ,而不是订单本身的属性信息。只有订单服务具有订单的完整信息,并且是给定订单信息的唯一真实来源。 ### 大型团队的注意事项 考虑到上面列出的五个注意事项,较大的团队应了解其组织结构对微服务边界的影响。 -对于大型组织,整个团队可以专门拥有服务,在确定服务边界时, 有组织性的考虑因素就会发挥作用。还有两个需要考虑的因素: **独立的发布计划**和**不同的正常运行时间**的重要性。 +对于较大的组织,整个团队可以专门拥有服务,在确定服务边界时,组织性就会发挥作用。还有两个需要考虑的因素:**独立的发布计划**和**不同的正常运行时间**的重要性。 -Khash Sajadi , [Cloud66.][11] 的 CEO 说:”我们所看到的微服务最成功的实现要么基于软件设计原则 (例如域驱动设计和面向服务的体系结构), 要么基于反映组织方法的设计原则“ +[Cloud66.][11] 的 CEO Khash Sajadi 说:“我们所看到的微服务最成功的实现要么基于类似领域驱动设计这样的软件设计原则 (如面向服务的体系结构),要么基于反映组织方法的设计原则。” -”所以 (对于) 支付团队“ Sajadi 继续说,,”他们有支付服务或信用卡验证服务, 这就是他们向外界提供的服务。所以这不一定是关于软件的。这主要是关于为外界提供更多服务的业务单位 “ +“所以 (对于) 支付团队” Sajadi 说,“他们有支付服务或信用卡验证服务,这就是他们向外界提供的服务。所以这不一定是关于软件的。这主要是关于为外界提供更多服务的业务单位。” ### 双披萨原理 -Amazon 是一个拥有多个团队的大型组织的完美示例。正如在一篇文章中所提到的, [API Evangelist][12] ,Jeff Bezos向所有员工发出授权,告知他们公司内的每个团队都必须通过 API 进行沟通。任何没有被解雇的人都会被解雇。 +Amazon 是一个拥有多个团队的大型组织的完美示例。正如在一篇发表于 [API Evangelist][12] 的文章中所提到的,Jeff Bezos 向所有员工发布一项要求,告知他们公司内的每个团队都必须通过 API 进行沟通。任何不这样做的人都会被解雇。 -这样,所有数据和功能都通过接口公开。Bezos 还设法让每个团队分离,定义他们的资源是什么, 并通过 API 使它们可用。亚马逊正在从地面上建立一个系统。这使得公司内的每一支团队都能成为彼此的合作伙伴。 +这样,所有数据和功能都通过该接口公开。Bezos 还设法让每个团队解耦,定义他们的资源,并通过 API 提供。Amazon 正在从头建立一个系统。这使得公司内的每一支团队都能成为彼此的合作伙伴。 -Travis Reeder , [Iron.io][13] 的CTO,谈论关于 Bezos 的内部提议。 +我与 [Iron.io][13] 的 CTO Travis Reeder 谈到了 Bezos 的内部倡议。 -”Jeff Bezos 规定所有团队都必须构建 API 才能与其他团队进行沟通,“ Reeder 说。”他也是提出‘双披萨’规则的人:一支球队不应该比两个比萨饼能养活的大。 +“Jeff Bezos 规定所有团队都必须构建 API 才能与其他团队进行沟通,” Reeder 说。“他也是提出‘双披萨’规则的人:一支团队不应该比两个比萨饼能养活的大。” -“我认为这里也可以适用同样的方法:无论一个小型团队是否能够开发、管理和富有成效。如果它开始变得笨重或开始后退。可能会变得太大” Reeder 告诉我。 +“我认为这里也可以适用同样的方法:无论一个小型团队是否能够开发、管理和富有成效。如果它开始变得笨重或开始变慢,它可能变得太大了。” Reeder 告诉我。 -### 最后注意事项: 您的服务是否具有正确的大小和正确定义? +### 最后注意事项: 您的服务是否具有合适的大小和正确的定义? 在微服务系统的测试和实施阶段,有一些指标需要记住。 #### 指标 #1: 服务之间是否存在过度依赖? -如果两个服务不断地相互回调,那么这就是耦合的强烈信号,也是它们可能更好地合并为一个服务的信号。 +如果两个服务不断地相互回调,那么这就是强烈的耦合信号,也是它们可能更好地合并为一个服务的信号。 -回到 Chris McFadden 的例子, 他有两个 API 服务、帐户和用户不断地相互通信, McFadden 提出了一个合并服务的想法, 并决定将其称为 “原告 API”。事实证明, 这是一项富有成效的战略。”我们开始做的是消除这些链接 [这是] 内部 API 调用投注他们之间“ McFadden 告诉我。这有助于简化代码。 +回到 Chris McFadden 的例子, 他有两个 API 服务,帐户服务和用户服务不断地相互通信, McFadden 提出了一个合并服务的想法,并决定将其称为 “账户用户 API”。事实证明,这是一项富有成效的战略。 + +“我们开始做的是消除这些内部 API 之间调用的链接,” McFadden 告诉我。“这有助于简化代码。” #### 指标 #2: 设置服务的开销是否超过了服务独立的好处? -Darby Frey 解释说,“每个应用都需要将其日志聚合到某个位置,并需要进行监视。你需要设置它的警报。你需要有标准的作业程序,并在事情发生时运行书籍。您必须管理 SSH 对该事物的访问。为了让一个应用单纯运行, 必须存在一个巨大的基础。 +Darby Frey 解释说,“每个应用都需要将其日志聚合到某个位置,并需要进行监视。你需要设置它的警报。你需要有标准的操作程序,和在出现问题时的操作手册。您必须管理 SSH 对它的访问。只是为了让一个应用运行起来,就有大量的基础性工作必须存在。” + +### 关键要点 -### 主要外包 - -设计微服务往往会让人感觉更像是一门艺术, 而不是一门科学。对工程师来说, 这可能不是很好。外面有很多一般性的建议, 但有时可能有点太抽象了。让我们回顾一下在设计下一组微服务时要注意的五个具体特征: +设计微服务往往会让人感觉更像是一门艺术,而不是一门科学。对工程师来说,这可能并不顺利。有很多一般性的建议,但有时可能有点太抽象了。让我们回顾一下在设计下一组微服务时要注意的五个具体特征: 1. 不与其他服务共享数据库表 - 2. 数据库表数量最小化 + 2. 数据库表数量最小化 3. 考虑有状态和无状态 4. 考虑数据可用性需求 - 5. 真理的唯一来源 - - + 5. 单一的真实来源 下次设计一组微服务并确定服务边界时,回顾这些原则应该会使任务变得更容易。 @@ -135,7 +137,7 @@ via: https://opensource.com/article/18/4/guide-design-microservices 作者:[Jake Lumetta][a] 选题:[lujun9972](https://github.com/lujun9972) 译者:[lixinyuxx](https://github.com/lixinyuxx) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 52c786553a88c1876f0efe6361d2959acd450a0c Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Sat, 19 Jan 2019 00:26:58 +0800 Subject: [PATCH 023/243] PUB:20180419 5 guiding principles you should know before you design a microservice.md @lixinyuxx https://linux.cn/article-10455-1.html --- ...principles you should know before you design a microservice.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {translated/talk => published}/20180419 5 guiding principles you should know before you design a microservice.md (100%) diff --git a/translated/talk/20180419 5 guiding principles you should know before you design a microservice.md b/published/20180419 5 guiding principles you should know before you design a microservice.md similarity index 100% rename from translated/talk/20180419 5 guiding principles you should know before you design a microservice.md rename to published/20180419 5 guiding principles you should know before you design a microservice.md From b17802748ca0a2cd829847a66950e4af33b1e914 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Sat, 19 Jan 2019 11:02:11 +0800 Subject: [PATCH 024/243] PRF:20181213 What is PPA- Everything You Need to Know About PPA in Linux.md @jlztan --- ...ing You Need to Know About PPA in Linux.md | 85 ++++++++++--------- 1 file changed, 44 insertions(+), 41 deletions(-) diff --git a/translated/tech/20181213 What is PPA- Everything You Need to Know About PPA in Linux.md b/translated/tech/20181213 What is PPA- Everything You Need to Know About PPA in Linux.md index b83c9f5720..6dc7b7c296 100644 --- a/translated/tech/20181213 What is PPA- Everything You Need to Know About PPA in Linux.md +++ b/translated/tech/20181213 What is PPA- Everything You Need to Know About PPA in Linux.md @@ -1,17 +1,18 @@ -[#]: collector: "lujun9972" -[#]: translator: "jlztan" -[#]: reviewer: " " -[#]: publisher: " " -[#]: url: " " -[#]: subject: "What is PPA? Everything You Need to Know About PPA in Linux" -[#]: via: "https://itsfoss.com/ppa-guide/" -[#]: author: "Abhishek Prakash https://itsfoss.com/author/abhishek/" +[#]: collector: (lujun9972) +[#]: translator: (jlztan) +[#]: reviewer: (wxy) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (What is PPA? Everything You Need to Know About PPA in Linux) +[#]: via: (https://itsfoss.com/ppa-guide/) +[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) -# 什么是 PPA?你需要知道的关于 Linux 中 PPA 的一切 +Ubuntu PPA 使用指南 +====== -**简介:一篇涵盖了在 Ubuntu 和其他 Linux 发行版中使用 PPA 的几乎所有问题的深入的文章。** +> 一篇涵盖了在 Ubuntu 和其他 Linux 发行版中使用 PPA 的几乎所有问题的深入的文章。 -如果你一直在使用 Ubuntu 或基于 Ubuntu 的其他 Linux 发行版,例如 Linux Mint、Linux Lite、Zorin OS 等,你可能会遇到以下三行神奇的命令: +如果你一直在使用 Ubuntu 或基于 Ubuntu 的其他 Linux 发行版,例如 Linux Mint、Linux Lite、Zorin OS 等,你可能会遇到以下三种神奇的命令: ``` sudo add-apt-repository ppa:dr-akulavich/lighttable @@ -21,17 +22,17 @@ sudo apt-get install lighttable-installer 许多网站推荐使用类似于以上几行的形式 [在 Ubuntu 中安装应用程序][1]。这就是所谓的使用 PPA 安装应用程序。 -但什么是 PPA?为什么用它?使用 PPA 安全吗?如何正确使用 PPA?如何删除 PPA? +但什么是 PPA?为什么要用它?使用 PPA 安全吗?如何正确使用 PPA?如何删除 PPA? 我将在这个详细的指南中回答上述所有问题。即使你已经了解了一些关于 PPA 的事情,我相信这篇文章仍然会让你了解这方面的更多知识。 -请注意我正在使用 Ubuntu 撰写本文。因此,我几乎可以在任何地方使用 Ubuntu 这个术语,但文中的说明和步骤也适用于其他基于 Debian/Ubuntu 的发行版。 +请注意我正在使用 Ubuntu 撰写本文。因此,我几乎在各个地方都使用了 Ubuntu 这个术语,但文中的说明和步骤也适用于其他基于 Debian/Ubuntu 的发行版。 ### 什么是 PPA?为什么要使用 PPA? ![Everything you need to know about PPA in Ubuntu Linux][2] -PPA 表示 个人软件包存档Personal Package Archive个人软件包存档Personal Package Archive。 +PPA 表示个人软件包存档Personal Package Archive。 这样说容易理解吗?可能不是很容易。 @@ -41,12 +42,12 @@ PPA 表示 个人软件包存档Personal Package Archive个人软件包存 软件仓库是一组文件,其中包含各种软件及其版本的信息,以及校验和等其他一些详细信息。每个版本的 Ubuntu 都有自己的四个官方软件仓库: -- Main - Canonical 支持的免费和开源软件。 -- Universe - 社区维护的免费和开源软件。 +- Main - Canonical 支持的自由开源软件。 +- Universe - 社区维护的自由开源软件。 - Restricted - 设备的专有驱动程序。 - Multiverse - 受版权或法律问题限制的软件。 -你可以在 [这里][3] 看到所有版本的 Ubuntu 的软件仓库。你可以浏览并转到各个仓库。例如,可以在 [这里][4] 找到 Ubuntu 16.04 的主存储库。 +你可以在 [这里][3] 看到所有版本的 Ubuntu 的软件仓库。你可以浏览并转到各个仓库。例如,可以在 [这里][4] 找到 Ubuntu 16.04 的主存储库(Main)。 所以,PPA 基本上是一个包含软件信息的网址。那你的系统又是如何知道这些仓库的位置的呢? @@ -80,19 +81,21 @@ Ubuntu 不会立即提供该新版本的软件。需要一个步骤来检查此 ### 如何使用 PPA?PPA 是怎样工作的? -正如我已经告诉过你的那样,[PPA][7] 代表个人软件包存档Personal Package Archive个人软件包存档Personal Package Archive。在这里注意 “个人” 这个词,它暗示了这是开发人员独有的东西,并没有得到分发的正式许可。 +正如我已经告诉过你的那样,[PPA][7] 代表个人软件包存档Personal Package Archive。在这里注意 “个人” 这个词,它暗示了这是开发人员独有的东西,并没有得到分发的正式许可。 -Ubuntu 提供了一个名为 Launchpad 的平台,使软件开发人员能够创建自己的软件仓库。 终端用户,也就是你,可以将 PPA 仓库添加到 `sources.list` 文件中,当你更新系统时,你的系统会知道这个新软件的可用性,然后你可以使用标准的 `sudo apt install` 命令安装它。 +Ubuntu 提供了一个名为 Launchpad 的平台,使软件开发人员能够创建自己的软件仓库。终端用户,也就是你,可以将 PPA 仓库添加到 `sources.list` 文件中,当你更新系统时,你的系统会知道这个新软件的可用性,然后你可以使用标准的 `sudo apt install` 命令安装它。 -`sudo add-apt-repository ppa:dr-akulavich/lighttable` -`sudo apt-get update` -`sudo apt-get install lighttable-installer` +``` +sudo add-apt-repository ppa:dr-akulavich/lighttable +sudo apt-get update +sudo apt-get install lighttable-installer +``` 概括一下上面三个命令: -- `sudo add-apt-repository ` < - 此命令将 PPA 仓库添加到列表中。 -- `sudo apt-get update` < - 此命令更新可以在当前系统上安装的软件包列表。 -- `sudo apt-get install ` < - 此命令安装软件包。 +- `sudo add-apt-repository ` <- 此命令将 PPA 仓库添加到列表中。 +- `sudo apt-get update` <- 此命令更新可以在当前系统上安装的软件包列表。 +- `sudo apt-get install ` <- 此命令安装软件包。 你会发现使用 `sudo apt update` 命令非常重要,否则你的系统将无法知道新软件包何时可用。 @@ -115,17 +118,17 @@ deb-src http://ppa.launchpad.net/dr-akulavich/lighttable/ubuntu YOUR_UBUNTU_VERS 以上两行是将任何软件仓库添加到你系统的 `sources.list` 文件的传统方法。但 PPA 会自动为你完成这些工作,无需考虑确切的软件仓库 URL 和操作系统版本。 -此处不那么重要的一点是,当你使用 PPA 时,它不会更改原始的 `sources.list` 文件。相反,它在 `/etc/apt/sources.d` 目录中创建了两个文件,一个 “list” 文件和一个带有 “save” 后缀的备份文件。 +此处不那么重要的一点是,当你使用 PPA 时,它不会更改原始的 `sources.list` 文件。相反,它在 `/etc/apt/sources.d` 目录中创建了两个文件,一个 `.list` 文件和一个带有 `.save` 后缀的备份文件。 ![Using a PPA in Ubuntu][8] -PPA 创建了单独的 `sources.list` 文件 +*PPA 创建了单独的 `sources.list` 文件* -带有后缀 “list” 的文件含有添加软件仓库的信息的命令。 +带有后缀 `.list` 的文件含有添加软件仓库的信息的命令。 ![PPA add repository information][9] -一个 PPA 的 `source.list` 文件的内容 +*一个 PPA 的 `source.list` 文件的内容* 这是一种安全措施,可以确保添加的 PPA 不会和原始的 `sources.list` 文件弄混,它还有助于移除 PPA。 @@ -135,11 +138,11 @@ PPA 创建了单独的 `sources.list` 文件 答案在于更新的过程。如果使用 DEB 包安装软件,将无法保证在运行 `sudo apt update` 和 `sudo apt upgrade` 命令时,已安装的软件会被更新为较新的版本。 -这是因为 apt 的升级过程依赖于 `sources.list` 文件。如果文件中没有相应的软件条目,则不会通过标准软件更新程序获得更新。 +这是因为 `apt` 的升级过程依赖于 `sources.list` 文件。如果文件中没有相应的软件条目,则不会通过标准软件更新程序获得更新。 那么这是否意味着使用 DEB 安装的软件永远不会得到更新?不是的。这取决于 DEB 包的创建方式。 -一些开发人员会自动在 `sources.list ` 中添加一个条目,这样软件就可以像普通软件一样更新。谷歌 Chrome 浏览器就是这样一个例子。 +一些开发人员会自动在 `sources.list` 中添加一个条目,这样软件就可以像普通软件一样更新。谷歌 Chrome 浏览器就是这样一个例子。 某些软件会在运行时通知你有新版本可用。你必须下载新的 DEB 包并再次运行,来将当前软件更新为较新版本。Oracle Virtual Box 就是这样一个例子。 @@ -163,11 +166,11 @@ PPA 创建了单独的 `sources.list` 文件 并非每个 PPA 都适用于你的特定版本。你应该知道正在使用 [哪个版本的 Ubuntu][11]。版本的开发代号很重要,因为当你访问某个 PPA 的页面时,你可以看到该 PPA 都支持哪些版本的 Ubuntu。 -对于其他基于 Ubuntu 的发行版,你可以查看 `/etc/os-release` 的内容来 [找出 Ubuntu 版本][11] 的信息。 +对于其他基于 Ubuntu 的发行版,你可以查看 `/etc/os-release` 的内容来 [找出 Ubuntu 版本][11] 的信息。 ![Verify PPA availability for Ubuntu version][12] -检查 PPA 是否适用于你的 Ubuntu 版本 +*检查 PPA 是否适用于你的 Ubuntu 版本* 如何知道 PPA 的网址呢?只需在网上搜索 PPA 的名称,如 `ppa:dr-akulavich/lighttable`,第一个搜索结果来自 [Launchpad][13],这是托管 PPA 的官方平台。你也可以转到 Launchpad 并直接在那里搜索所需的 PPA。 @@ -188,9 +191,9 @@ W: Failed to fetch http://ppa.launchpad.net/venerix/pkg/ubuntu/dists/raring/main E: Some index files failed to download. They have been ignored, or old ones used instead. ``` -上面的错误提示说的很明白,是因为系统找不到当前版本对应的仓库。还记得我们之前看到的仓库结构吗?APT 将尝试在 /ubuntu/dists/Ubuntu_Version 中寻找软件信息。 +上面的错误提示说的很明白,是因为系统找不到当前版本对应的仓库。还记得我们之前看到的仓库结构吗?APT 将尝试在 `http://ppa.launchpad.net//ubuntu/dists/` 中寻找软件信息。 -如果特定版本的 PPA 不可用,它将永远无法打开 URL,你会看到著名的404错误。 +如果特定版本的 PPA 不可用,它将永远无法打开 URL,你会看到著名的 404 错误。 #### 为什么 PPA 不适用于所有 Ubuntu 发行版? @@ -202,7 +205,7 @@ E: Some index files failed to download. They have been ignored, or old ones used 比如说,你访问 Light Table 的 PPA 页面,使用刚刚学到的有关 PPA 的知识,你会发现 PPA 不适用于你的特定 Ubuntu 版本。 -你可以点击 `查看软件包详细信息`。 +你可以点击 “查看软件包详细信息”。 ![Get DEB file from PPA][16] @@ -234,11 +237,11 @@ Ubuntu 软件中心无法移除 PPA 安装的软件包,你必须使用具有 sudo apt install synaptic ``` -安装后,启动 Synaptic 包管理器并选择 Origin。你会看到添加到系统的各种软件仓库。 PPA 条目将以前缀 PPA 进行标识,单击以查看 PPA 可用的包。已安装的软件前面会有恰当的符号进行标识。 +安装后,启动 Synaptic 包管理器并选择 “Origin”。你会看到添加到系统的各种软件仓库。PPA 条目将以前缀 PPA 进行标识,单击以查看 PPA 可用的包。已安装的软件前面会有恰当的符号进行标识。 ![Managing PPA with Synaptic package manager][20] -查找通过 PPA 安装的软件包 +*查找通过 PPA 安装的软件包* 找到包后,你可以从 Synaptic 删除它们。此外,也始终可以选择使用命令行进行移除: @@ -264,7 +267,7 @@ sudo apt remove package_name 这是一个主观问题。纯粹主义者厌恶 PPA,因为大多数时候 PPA 来自第三方开发者。但与此同时,PPA 在 Debian/Ubuntu 世界中很受欢迎,因为它们提供了更简单的安装选项。 -就安全性而言,使用 PPA 之后,你的 Linux 系统被黑客攻击或注入恶意软件的可能性较小。到目前为止,我不记得发生过这样的事件。 +就安全性而言,很少见到因为使用 PPA 之后你的 Linux 系统被黑客攻击或注入恶意软件。到目前为止,我不记得发生过这样的事件。 官方 PPA 可以不加考虑的使用,使用非官方 PPA 完全是你自己的决定。 @@ -285,7 +288,7 @@ via: https://itsfoss.com/ppa-guide/ 作者:[Abhishek Prakash][a] 选题:[lujun9972][b] 译者:[jlztan](https://github.com/jlztan) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 @@ -300,7 +303,7 @@ via: https://itsfoss.com/ppa-guide/ [7]: https://launchpad.net/ubuntu/+ppas [8]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2018/01/ppa-sources-list-files.png?resize=800%2C259&ssl=1 [9]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2018/01/content-of-ppa-list.png?ssl=1 -[10]: https://itsfoss.com/install-software-from-source-code/ +[10]: https://linux.cn/article-9172-1.html [11]: https://itsfoss.com/how-to-know-ubuntu-unity-version/ [12]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2017/12/verify-ppa-availibility-version.jpg?resize=800%2C481&ssl=1 [13]: https://launchpad.net/ From e6a02035fa2c07f404fd59db75a198205dbf4d76 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Sat, 19 Jan 2019 11:04:19 +0800 Subject: [PATCH 025/243] PUB:20181213 What is PPA- Everything You Need to Know About PPA in Linux.md @jlztan https://linux.cn/article-10456-1.html --- ...- Everything You Need to Know About PPA in Linux.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) rename {translated/tech => published}/20181213 What is PPA- Everything You Need to Know About PPA in Linux.md (99%) diff --git a/translated/tech/20181213 What is PPA- Everything You Need to Know About PPA in Linux.md b/published/20181213 What is PPA- Everything You Need to Know About PPA in Linux.md similarity index 99% rename from translated/tech/20181213 What is PPA- Everything You Need to Know About PPA in Linux.md rename to published/20181213 What is PPA- Everything You Need to Know About PPA in Linux.md index 6dc7b7c296..576444b9fb 100644 --- a/translated/tech/20181213 What is PPA- Everything You Need to Know About PPA in Linux.md +++ b/published/20181213 What is PPA- Everything You Need to Know About PPA in Linux.md @@ -1,10 +1,10 @@ -[#]: collector: (lujun9972) -[#]: translator: (jlztan) +[#]: collector: (lujun9972) +[#]: translator: (jlztan) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-10456-1.html) [#]: subject: (What is PPA? Everything You Need to Know About PPA in Linux) -[#]: via: (https://itsfoss.com/ppa-guide/) +[#]: via: (https://itsfoss.com/ppa-guide/) [#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) Ubuntu PPA 使用指南 From 392a4a0c135f4413c512843c306e4ecbbc61c052 Mon Sep 17 00:00:00 2001 From: hopefully2333 <787016457@qq.com> Date: Sat, 19 Jan 2019 12:33:52 +0800 Subject: [PATCH 026/243] translated over translated over --- ...80919 5 ways DevSecOps changes security.md | 78 ------------------- ...80919 5 ways DevSecOps changes security.md | 77 ++++++++++++++++++ 2 files changed, 77 insertions(+), 78 deletions(-) delete mode 100644 sources/talk/20180919 5 ways DevSecOps changes security.md create mode 100644 translated/talk/20180919 5 ways DevSecOps changes security.md diff --git a/sources/talk/20180919 5 ways DevSecOps changes security.md b/sources/talk/20180919 5 ways DevSecOps changes security.md deleted file mode 100644 index aef3780fdb..0000000000 --- a/sources/talk/20180919 5 ways DevSecOps changes security.md +++ /dev/null @@ -1,78 +0,0 @@ - translating by hopefully2333 - -5 ways DevSecOps changes security -====== - -![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/security-lock-password.jpg?itok=KJMdkKum) - -There’s been an ongoing kerfuffle over whether we need to expand [DevOps][1] to explicitly bring in security. After all, the thinking goes, [DevOps][2] has always been something of a shorthand for a broad set of new practices, using new tools (often open source) and built on more collaborative cultures. Why not [DevBizOps][3] for better aligning with business needs? Or DevChatOps to emphasize better and faster communications? - -However, [as John Willis wrote earlier this year][4] on his coming around to the [DevSecOps][5] terminology, “Hopefully, someday we will have a world where we no longer have to use the word DevSecOps and security will be an inherent part of all service delivery discussions. Until that day, and at this point, my general conclusion is that it’s just three new characters. More importantly, the name really differentiates the problem statement in a world where we as an industry are not doing a great job on information security.” - -So why aren’t we doing a great job on [information security][6], and what does it mean to do a great job in a DevSecOps context? - -We’ve arguably never done a great job of information security in spite of (or maybe because of) the vast industry of complex point products addressing narrow problems. But we also arguably did a good enough job during the era when defending against threats focused on securing the perimeter, network connections were limited, and most users were employees using company-provided devices. - -Those circumstances haven’t accurately described most organizations’ reality for a number of years now. But the current era, which brings in not only DevSecOps but new application architectural patterns, development practices, and an increasing number of threats, defines a stark new normal that requires a faster pace of change. It’s not so much that DevSecOps in isolation changes security, but that infosec circa 2018 requires new approaches. - -Consider these five areas. - -### Automation - -Lots of automation is a hallmark of DevOps generally. It’s partly about speed. If you’re going to move fast (and not break things), you need to have repeatable processes that execute without a lot of human intervention. Indeed, automation is one of the best entry points for DevOps, even in organizations that are still mostly working on monolithic legacy apps. Automating routine processes associated with configurations or testing with easy-to-use tools such as [Ansible][7] is a common quick hit for starting down the path to DevOps. - -DevSecOps is no different. Security today is a continuous process rather than a discrete checkpoint in the application lifecycle, or even a weekly or monthly check. When vulnerabilities are found and fixes issued by a vendor, it’s important they be applied quickly given that exploits taking advantage of those vulnerabilities will be out soon. - -### "Shift left" - -Traditional security is often viewed as a gatekeeper at the end of the development process. Check all the boxes and your app goes into production. Otherwise, try again. Security teams have a reputation for saying no a lot. - -Therefore, the thinking goes, why not move security earlier (left in a typical left-to-right drawing of a development pipeline)? Security may still say no, but the consequences of rework in early-stage development are a lot less than they are when the app is complete and ready to ship. - -I don’t like the “shift left” term, though. It implies that security is still a one-time event that’s just been moved earlier. Security needs to be a largely automated process everywhere in the application lifecycle, from the supply chain to the development and test process all the way through deployment. - -### Manage dependencies - -One of the big changes we see with modern app development is that you often don’t write most of the code. Using open source libraries and frameworks is one obvious case in point. But you may also just use external services from public cloud providers or other sources. In many cases, this external code and services will dwarf what you write yourself. - -As a result, DevSecOps needs to include a serious focus on your [software supply chain][8]. Are you getting your software from trusted sources? Is it up to date? Is it integrated into the security processes that you use for your own code? What policies do you have in place for which code and APIs you can use? Is commercial support available for the components that you are using for your own production code? - -No set of answers are going to be appropriate in all cases. They may be different for a proof-of-concept versus an at-scale production workload. But, as has been the case in manufacturing for a long time (and DevSecOps has many analogs in how manufacturing has evolved), the integrity of the supply chain is critical. - -### Visibility - -I’ve talked a lot about the need for automation throughout all the stages of the application lifecycle. That makes the assumption that we can see what’s going on in each of those stages. - -Effective DevSecOps requires effective instrumentation so that automation knows what to do. This instrumentation falls into a number of categories. There are long-term and high-level metrics that help tell us if the overall DevSecOps process is working well. There are critical alerts that require immediate human intervention (the security scanning system is down!). There are alerts, such as for a failed scan, that require remediation. And there are logs of the many parameters we capture for later analysis (what’s changing over time? What caused that failure?). - -### Services vs. monoliths - -While DevSecOps practices can be applied across many types of application architectures, they’re most effective with small and loosely coupled components that can be updated and reused without potentially forcing changes elsewhere in the app. In their purest form, these components can be [microservices][9] or functions, but the general principles apply wherever you have loosely coupled services communicating over a network. - -This pattern does introduce some new security challenges. The interactions between components can be complex and the total attack surface can be larger because there are now more entry points to the application across the network. - -On the other hand, this type of architecture also means that automated security and monitoring also has more granular visibility into the application components because they’re no longer buried deep within a monolithic application. - -Don’t get too wrapped up in the DevSecOps term, but take it as a reminder that security is evolving because the way that we write and deploy applications is evolving. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/18/9/devsecops-changes-security - -作者:[Gordon Haff][a] -选题:[lujun9972](https://github.com/lujun9972) -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://opensource.com/users/ghaff -[1]: https://opensource.com/resources/devops -[2]: https://opensource.com/tags/devops -[3]: https://opensource.com/article/18/5/steps-apply-devops-culture-beyond-it -[4]: https://www.devsecopsdays.com/articles/its-just-a-name -[5]: https://opensource.com/article/18/4/devsecops -[6]: https://opensource.com/article/18/6/where-cycle-security-devops -[7]: https://opensource.com/tags/ansible -[8]: https://opensource.com/article/17/1/be-open-source-supply-chain -[9]: https://opensource.com/tags/microservices diff --git a/translated/talk/20180919 5 ways DevSecOps changes security.md b/translated/talk/20180919 5 ways DevSecOps changes security.md new file mode 100644 index 0000000000..92f295ed04 --- /dev/null +++ b/translated/talk/20180919 5 ways DevSecOps changes security.md @@ -0,0 +1,77 @@ + +五种 DevSecOps 提升安全性 +====== + +![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/security-lock-password.jpg?itok=KJMdkKum) + +对于我们是否需要扩展 DevOps 以确实提升安全性,我们一直都有争议。毕竟,我们的想法是,DevOps 一直是一系列的新实践的简写,使用新工具(通常是开源的)并且在这之上构建更多的协作文化。为什么 DevBizOps 不能更好地满足商业的需求?或者说 DevChatOps 强调的是更快更好的沟通? + +在今年(译者注:此处是2018年)的早些时候写的关于他理解的 DevSecOps 术语,“我希望,有一天在世界范围内,我们能不再使用 DevSecOps 这个词,安全会是所有的服务交付讨论中理所应当的部分。直到那一天到来为止,在这一点上,我的一般性结论是,这个词只有三个新的特性。更重要的是,我们作为一个产业,在信息安全方面并没有做的很好,而这个名称切实地区分出了问题的状况” + +所以,为什么我们在信息安全方面做的不好,在 DevSecOps 的语境下安全做的好又是什么意思呢? + +我们大概从未做好过信息安全,尽管(也可能是因为)复杂的工业点产品地址拥挤问题。我们仍然可以在这个时代把工作做得足够好,以此来防范威胁,这些威胁主要集中在一个范围内,网络的连接是有限的,而且大多数的用户都是公司的员工,使用的是公司提供的设备。 + +这些年来,这些情况并没有能准确地描述出大多数组织的真实现状。但在现在这个时代,不止引入了 DevSecOps,也同时引入了新的应用架构模型,开发实践,和越来越多的安全威胁,这些一起定义了一个需要更快迭代的新常态。还没有应用得很多的 DevSecOps 在独立改变安全,但是 2018 年的信息安全需要新的方法。 + +请仔细思考下面这五个领域。 + +### 自动化 + +大量的自动化通常是 DevOps 的标志,这部分是关于速度的,如果你要快速移动(并且不会打坏东西),你需要有可重复的过程,而且这个过程不需要太多的人工干预。实际上,自动化是 DevOps 最好的切入点之一,甚至是在仍然主要工作在单片机电路程序的组织里也是如此。使用像 Ansible 这样易于使用的工具来自动化地处理相关的配置或者是测试,这是快速开始 DevOps 之路的常用方法。 + +DevSecOps 也不例外,在今天,安全已经变成了一个持续性的过程,而不是在应用的生命周期里进行不定期的检查,甚至是每周、每月的检查。当漏洞被厂商发现并修复的时候,这些漏洞能被快速地应用是很重要的,因为利用这些漏洞的利用程序很快就会被淘汰。 + +### "左转" + +在开发流程结束时,传统安全通常被视作一个守门人。检查所有的部分确保没有问题,然后这个应用程序就可以投入生产了。否则,就要再来一次。所以安全团队的声誉并不高。 + +因此,我们想的是,没什么不把安全这个部分提到前面呢(左边是一个典型的从左到右的开发流程图)?安全性可能仍然不行,但在开发的早期进行重构的影响要远远小于开发已经完成并且准备上线时进行重构的影响。 + +不过,我不喜欢“左移”这个词,这意味着安全仍然是一个只不过提前进行的一次性工作。在应用程序的整个生命周期里,从供应链到开发,再到测试,直到上线部署,安全都需要进行大量的自动化处理。 + +### 管理依赖 + +我们在现代应用程序开发过程中看到的一个最大的改变,就是你通常不需要去编写这个程序的大部分代码。使用开源的函数库和框架就是一个明显的例子。但是你也可以从公共的云服务商或其他来源那里获得额外的服务。在许多情况下,这些额外的代码和服务比你给自己写的要好得多。 + +因此,DevSecOps 需要你把重点放在你的软件供应链上,你是从可信的来源那里获取你的软件的吗?这些软件是最新的吗?它们已经集成到了你为自己的代码使用的安全流程中了吗?对于这些你能使用的代码和 API 你有哪些策略?你为自己的产品代码使用的组件是否有可用的商业支持? + +没有一套标准答案可以应对所有的情况。对于概念验证和大规模的生产,它们可能会有所不同。但是,正如制造业长期存在的情况(DevSecOps 和制造业的发展方面有许多相似之处),供应链的可信是至关重要的。 + +### 可见性 + +关于贯穿应用程序整个生命周期里所有阶段的自动化的需求,我已经谈过很多了。这里假设我们能看见每个阶段里发生的情况。 + +有效的 DevSecOps 需要有效的检测,以便于自动化程序知道要做什么。这个检测分了很多类别。一些长期的和高级别的指标能帮助我们了解整个 DevSecOps 流程是否工作良好。严重威胁级别的警报需要立刻有人进行处理(安全扫描系统已经关闭!)。有一些警报,比如扫描失败,需要进行修复。我们记录了大量的参数来生成日志,以便事后进行分析(随着时间的推移,哪些发生了改变?导致失败的原因是什么?)。 + +### 分散服务 vs 一体化解决方案 + +虽然 DevSecOps 实践可以应用于多种类型的应用架构,但它们对小型且松散耦合的组件最有效,这些组件可以进行更新和复用,而且不会在应用程序的其他地方进行强制更改。在纯净版的形式里,这些组件可以是微服务或者函数,但是这个一般性原则适用于通过网络进行通信的松散耦合服务的任何地方。 + +这种方法确实带来了一些新的安全挑战,组件之间的交互可能会很复杂,总的攻击面会更大,因为现在应用程序通过网络有了更多的切入点。 + +另一方面,这种类型的架构还意味着自动化的安全和监视可以更加精细地查看应用程序的组件,因为它们不再深埋在一整个应用程序之中。 + +不要过多地关注 DevSecOps 这个术语,但要提醒一下,安全正在不断地演变,因为我们编写和部署程序的方式也在不断地演变。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/18/9/devsecops-changes-security + +作者:[Gordon Haff][a] +选题:[lujun9972](https://github.com/lujun9972) +译者:[hopefully2333](https://github.com/hopefully2333) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/ghaff +[1]: https://opensource.com/resources/devops +[2]: https://opensource.com/tags/devops +[3]: https://opensource.com/article/18/5/steps-apply-devops-culture-beyond-it +[4]: https://www.devsecopsdays.com/articles/its-just-a-name +[5]: https://opensource.com/article/18/4/devsecops +[6]: https://opensource.com/article/18/6/where-cycle-security-devops +[7]: https://opensource.com/tags/ansible +[8]: https://opensource.com/article/17/1/be-open-source-supply-chain +[9]: https://opensource.com/tags/microservices From 758638de2f47f94fb4c513955f9a07a0306ade83 Mon Sep 17 00:00:00 2001 From: qhwdw <33189910+qhwdw@users.noreply.github.com> Date: Sat, 19 Jan 2019 12:35:46 +0800 Subject: [PATCH 027/243] translated by qhwdw --- ...aboratory - Raspberry Pi- Lesson 1 OK01.md | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/translated/tech/20120201 Computer Laboratory - Raspberry Pi- Lesson 1 OK01.md b/translated/tech/20120201 Computer Laboratory - Raspberry Pi- Lesson 1 OK01.md index 43c76fa0c5..7285df6160 100644 --- a/translated/tech/20120201 Computer Laboratory - Raspberry Pi- Lesson 1 OK01.md +++ b/translated/tech/20120201 Computer Laboratory - Raspberry Pi- Lesson 1 OK01.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (qhwdw) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: () +[#]: url: () [#]: subject: (Computer Laboratory – Raspberry Pi: Lesson 1 OK01) [#]: via: (https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/ok01.html) [#]: author: (Robert Mullins http://www.cl.cam.ac.uk/~rdm34) @@ -196,15 +196,15 @@ b loop$ 将这个 SD 卡插入到树莓派,并打开它的电源。这个 OK 的 LED 灯将亮起来。如果不是这样,请查看故障排除页面。如果一切如愿,恭喜你,你已经写出了你的第一个操作系统。[课程 2 OK02][12] 将指导你让 LED 灯闪烁和关闭闪烁。 -[^1]: OK, I'm lying it tells the linker, which is another program used to link several assembled files together. It doesn't really matter. -[^2]: Clearly they're important to you. Since the GNU toolchain is mainly used for creating programs, it expects there to be an entry point labelled `_start`. As we're making an operating system, the `_start` is always whatever comes first, which we set up with the `.section .init` command. However, if we don't say where the entry point is, the toolchain gets upset. Thus, the first line says that we are going to define a symbol called `_start` for all to see (globally), and the second line says to make the symbol `_start` the address of the next line. We will come onto addresses shortly. -[^3]: This tutorial is designed to spare you the pain of reading it, but, if you must, it can be found here [SoC-Peripherals.pdf](https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/downloads/SoC-Peripherals.pdf). For added confusion, the manual uses a different addressing system. An address listed as 0x7E200000 would be 0x20200000 in our OS. -[^4]: Only values which have a binary representation which only has 1s in the first 8 bits of the representation. In other words, 8 1s or 0s followed by only 0s. -[^5]: A hardware engineer was kind enough to explain this to me as follows: +[^1]: 是的,我说错了,它告诉的是链接器,它是另一个程序,用于将汇编器转换过的几个代码文件链接到一起。直接说是汇编器也没有大问题。 +[^2]: 其实它们对你很重要。由于 GNU 工具链主要用于开发操作系统,它要求入口点必须是名为 `_start` 的地方。由于我们是开发一个操作系统,无论什么时候,它总是从 `_start` 开时的,而我们可以使用 `.section .init` 命令去设置它。因此,如果我们没有告诉它入口点在哪里,就会使工具链困惑而产生警告消息。所以,我们先定义一个名为 `_start` 的符号,它是所有人可见的(全局的),紧接着在下一行生成符号 `_start` 的地址。我们很快就讲到这个地址了。 +[^3]: 本教程的设计减少了你阅读树莓派开发手册的难度,但是,如果你必须要阅读它,你可以在这里 [SoC-Peripherals.pdf](https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/downloads/SoC-Peripherals.pdf) 找到它。由于添加了混淆,手册中 GPIO 使用了不同的地址系统。我们的操作系统中的地址 0x20200000 对应到手册中是 0x7E200000。 +[^4]: mov 能够加载的值只有前 8 位是 1s 的二进制表示的值。换句话说就是一个 0s 后面紧跟着 8 个 1s 或 0s。 +[^5]: 一个很友好的硬件工程师是这样向我解释这个问题的: + + 原因是现在的芯片都是用一种称为 CMOS 的技术来制成的,它是互补金属氧化物半导体的简称。互补的意思是每个信号都连接到两个晶体管上,一个是使用 N 型半导体的材料制成,它用于将电压拉低,而另一个使用 P 型半导体材料制成,它用于将电压升高。在任何时刻,仅有一个半导体是打开的,否则将会短路。P 型材料的导电性能不如 N 型材料。这意味着三倍大的 P 型半导体材料才能提供与 N 型半导体材料相同的电流。这就是为什么 LED 总是通过降低为低电压来打开它,因为 N 型半导体拉低电压比 P 型半导体拉高电压的性能更强。 - The reason is that modern chips are made of a technology called CMOS, which stands for Complementary Metal Oxide Semiconductor. The Complementary part means each signal is connected to two transistors, one made of material called N-type semiconductor which is used to pull it to a low voltage and another made of P-type material to pull it to a high voltage. Only one transistor of the pair turns on at any time, otherwise we'd get a short circuit. P-type isn't as conductive as N-type, which means the P-type transistor has to be about 3 times as big to provide the same current. This is why LEDs are often wired to turn on by pulling them low, because the N-type is stronger at pulling low than the P-type is in pulling high. - - There's another reason. Back in the 1970s chips were made out of entirely out of N-type material ('NMOS'), with the P-type replaced by a resistor. That means that when a signal is pulled low the chip is consuming power (and getting hot) even while it isn't doing anything. Your phone getting hot and flattening the battery when it's in your pocket doing nothing wouldn't be good. So signals were designed to be 'active low' so that they're high when inactive and so don't take any power. Even though we don't use NMOS any more, it's still often quicker to pull a signal low with the N-type than to pull it high with the P-type. Often a signal that's 'active low' is marked with a bar over the top of the name, or written as SIGNAL_n or /SIGNAL. But it can still be confusing, even for hardware engineers! + 还有一个原因。早在上世纪七十年代,芯片完全是由 N 型材料制成的(NMOS),P 型材料部分使用了一个电阻来代替。这意味着当信号为低电压时,即便它什么事都没有做,芯片仍然在消耗能量(并发热)。你的电话装在口袋里什么事都不做,它仍然会发热并消耗你的电池电量,这不是好的设计。因此,信号设计成 'active low',而不活动时为高电压,这样就不会消耗能源了。虽然我们现在已经不使用 NMOS 了,但由于 N 型材料的低电压信号比 P 型材料的高电压信号要快,所以仍然使用了这种设计。通常在一个 'active low' 信号名字上方会有一个条型标记,或者写作 SIGNAL_n 或 /SIGNAL。但是即便这样,仍然很让人困惑,那怕是硬件工程师,也不可避免这种困惑! -------------------------------------------------------------------------------- From 99f1c3c7c8b706ca560c9feedf24cb98f8517efb Mon Sep 17 00:00:00 2001 From: MjSeven Date: Sat, 19 Jan 2019 12:26:44 +0800 Subject: [PATCH 028/243] =?UTF-8?q?20180614=20An=20introduction=20to=20the?= =?UTF-8?q?=20Tornado=20Python=20web=20app=20framework.md=20=E7=BF=BB?= =?UTF-8?q?=E8=AF=91=E5=AE=8C=E6=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...to the Tornado Python web app framework.md | 590 ------------------ ...to the Tornado Python web app framework.md | 580 +++++++++++++++++ 2 files changed, 580 insertions(+), 590 deletions(-) delete mode 100644 sources/tech/20180614 An introduction to the Tornado Python web app framework.md create mode 100644 translated/tech/20180614 An introduction to the Tornado Python web app framework.md diff --git a/sources/tech/20180614 An introduction to the Tornado Python web app framework.md b/sources/tech/20180614 An introduction to the Tornado Python web app framework.md deleted file mode 100644 index 74fdecb56c..0000000000 --- a/sources/tech/20180614 An introduction to the Tornado Python web app framework.md +++ /dev/null @@ -1,590 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (MjSeven) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: subject: (An introduction to the Tornado Python web app framework) -[#]: via: (https://opensource.com/article/18/6/tornado-framework) -[#]: author: (Nicholas Hunt-Walker https://opensource.com/users/nhuntwalker) -[#]: url: ( ) - -An introduction to the Tornado Python web app framework -====== -In the third part in a series comparing Python frameworks, learn about Tornado, built to handle asynchronous processes. -![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/tornado.png?itok=kAa3eXIU) - -In the first two articles in this four-part series comparing different Python web frameworks, we've covered the [Pyramid][1] and [Flask][2] web frameworks. We've built the same app twice and seen the similarities and differences between a complete DIY framework and a framework with a few more batteries included. - -Now let's look at a somewhat different option: [the Tornado framework][3]. Tornado is, for the most part, as bare-bones as Flask, but with a major difference: Tornado is built specifically to handle asynchronous processes. That special sauce isn't terribly useful in the app we're building in this series, but we'll see where we can use it and how it works in a more general situation. - -Let's continue the pattern we set in the first two articles and start by tackling the setup and config. - -### Tornado startup and configuration - -If you've been following along with this series, what we do first shouldn't come as much of a surprise. - -``` -$ mkdir tornado_todo -$ cd tornado_todo -$ pipenv install --python 3.6 -$ pipenv shell -(tornado-someHash) $ pipenv install tornado -``` - -Create a `setup.py` for installing our application: - -``` -(tornado-someHash) $ touch setup.py -# setup.py -from setuptools import setup, find_packages - -requires = [ -    'tornado', -    'tornado-sqlalchemy', -    'psycopg2', -] - -setup( -    name='tornado_todo', -    version='0.0', -    description='A To-Do List built with Tornado', -    author='', -    author_email='', -    keywords='web tornado', -    packages=find_packages(), -    install_requires=requires, -    entry_points={ -        'console_scripts': [ -            'serve_app = todo:main', -        ], -    }, -) -``` - -Because Tornado doesn't require any external configuration, we can dive right into writing the Python code that'll run our application. Let's make our inner `todo` directory and fill it with the first few files we'll need. - -``` -todo/ -    __init__.py -    models.py -    views.py -``` - -Like Flask and Pyramid, Tornado has some central configuration that will go in `__init__.py`. From `tornado.web`, we'll import the `Application` object. This will handle the hookups for routing and views, including our database (when we get there) and any extra settings needed to run our Tornado app. - -``` -# __init__.py -from tornado.httpserver import HTTPServer -from tornado.options import define, options -from tornado.web import Application - -define('port', default=8888, help='port to listen on') - -def main(): -    """Construct and serve the tornado application.""" -    app = Application() -    http_server = HTTPServer(app) -    http_server.listen(options.port) -``` - -When we use the `define` function, we end up creating attributes on the `options` object. Anything that goes in the position of the first argument will be the attribute's name, and what's assigned to the `default` keyword argument will be the value of that attribute. - -As an example, if we name the attribute `potato` instead of `port`, we can access its value via `options.potato`. - -Calling `listen` on the `HTTPServer` doesn't start the server yet. We must do one more step to have a working application that can listen for requests and return responses. We need an input-output loop. Thankfully, Tornado comes with that out of the box in the form of `tornado.ioloop.IOLoop`. - -``` -# __init__.py -from tornado.httpserver import HTTPServer -from tornado.ioloop import IOLoop -from tornado.options import define, options -from tornado.web import Application - -define('port', default=8888, help='port to listen on') - -def main(): -    """Construct and serve the tornado application.""" -    app = Application() -    http_server = HTTPServer(app) -    http_server.listen(options.port) -    print('Listening on http://localhost:%i' % options.port) -    IOLoop.current().start() -``` - -I like some kind of a `print` statement somewhere that tells me when I'm serving my application, but that's me. You could do without the `print` line if you so chose. - -We begin our I/O loop with `IOLoop.current().start()`. Let's talk a little more about input, output, and asynchronicity. - -### The basics of async in Python and the I/O loop - -Allow me to preface by saying that I am absolutely, positively, surely, and securely not an expert in asynchronous programming. As with all things I write, what follows stems from the limits of my understanding of the concept. As I am human, it may be deeply, deeply flawed. - -The main concerns of an asynchronous program are: - - * How is data coming in? - * How is data going out? - * When can some procedure be left to run without consuming my full attention? - - - -Due to the [global interpreter lock][4] (GIL), Python is—by design—a [single-threaded][5] language. For every task a Python program must execute, the full attention of its thread of execution is on that task for the duration of that task. Our HTTP server is written in Python. Thus, when data (e.g., an HTTP request) is received, the server's sole focus is that incoming data. This means that, in most cases, whatever procedures need to run in handling and processing that data will completely consume your server's thread of execution, blocking other potential data from being received until your server finishes whatever it needed to do. - -In many cases this isn't too problematic; a typical web request-response cycle will take only fractions of a second. Along with that, the sockets that HTTP servers are built from can maintain a backlog of incoming requests to be handled. So, if a request comes in while that socket is handling something else, chances are it'll just wait in line a bit before being addressed. For a low to intermediate traffic site, a fraction of a second isn't that big of a deal, and you can use multiple deployed instances along with a load-balancer like [NGINX][6] to distribute traffic for the larger request loads. - -What if, however, your average response time takes more than a fraction of a second? What if you use data from the incoming request to start some long-running process like a machine-learning algorithm or some massive database query? Now, your single-threaded web server starts to accumulate an unaddressable backlog of requests, some of which will get dropped due to simply timing out. This is not an option, especially if you want your service to be seen as reliable on a regular basis. - -In comes the asynchronous Python program. It's important to keep in mind that because it's written in Python, the program is still a single-threaded process. Anything that would block execution in a synchronous program, unless specifically flagged, will still block execution in an asynchronous one. - -When it's structured correctly, however, your asynchronous Python program can "shelve" long-running tasks whenever you designate that a certain function should have the ability to do so. Your async controller can then be alerted when the shelved tasks are complete and ready to resume, managing their execution only when needed without completely blocking the handling of new input. - -That was somewhat jargony, so let's demonstrate with a human example. - -#### Bringing it home - -I often find myself trying to get multiple chores done at home with little time to do them. On a given day, that backlog of chores may look like: - - * Cook a meal (20 min. prep, 40 min. cook) - * Wash dishes (60 min.) - * Wash and dry laundry (30 min. wash, 90 min. dry per load) - * Vacuum floors (30 min.) - - - -If I were acting as a traditional, synchronous program, I'd be doing each task myself, by hand. Each task would require my full attention to complete before I could consider handling anything else, as nothing would get done without my active attention. So my sequence of execution might look like: - - 1. Focus fully on preparing and cooking the meal, including waiting around for food to just… cook (60 min.). - 2. Transfer dirty dishes to sink (65 min. elapsed). - 3. Wash all the dishes (125 min. elapsed). - 4. Start laundry with my full focus on that, including waiting around for the washing machine to finish, then transferring laundry to the dryer, and waiting for the dryer to finish (250 min. elapsed). - 5. Vacuum the floors (280 min. elapsed). - - - -That's 4 hours and 40 minutes to complete my chores from end-to-end. - -Instead of working hard, I should work smart like an asynchronous program. My home is full of machines that can do my work for me without my continuous effort. Meanwhile, I can switch my attention to what may actively need it right now. - -My execution sequence might instead look like: - - 1. Load clothes into and start the washing machine (5 min.). - 2. While the washing machine is running, prep food (25 min. elapsed). - 3. After prepping food, start cooking food (30 min. elapsed). - 4. While the food is cooking, move clothes from the washing machine into the dryer and start dryer (35 min. elapsed). - 5. While dryer is running and food is still cooking, vacuum the floors (65 min. elapsed). - 6. After vacuuming the floors, take food off the stove and load the dishwasher (70 min. elapsed). - 7. Run the dishwasher (130 min. when done). - - - -Now I'm down to 2 hours and 10 minutes. Even if I allow more time for switching between jobs (10-20 more minutes total), I'm still down to about half the time I would've spent if I'd waited to perform each task in sequential order. This is the power of structuring your program to be asynchronous. - -#### So where does the I/O loop come in? - -An asynchronous Python program works by taking in data from some external source (input) and, should the process require it, offloading that data to some external worker (output) for processing. When that external process finishes, the main Python program is alerted. The program then picks up the result of that external processing (input) and continues on its merry way. - -Whenever that data isn't actively in the hands of the main Python program, that main program is freed to work on just about anything else. This includes awaiting completely new inputs (e.g., HTTP requests) and handling the results of long-running processes (e.g., results of machine-learning algorithms, long-running database queries). The main program, while still single-threaded, becomes event-driven, triggered into action for specific occurrences handled by the program. The main worker that listens for those events and dictates how they should be handled is the I/O loop. - -We traveled a long road to get to this nugget of an explanation, I know, but what I'm hoping to communicate here is that it's not magic, nor is it some type of complex parallel processing or multi-threaded work. The global interpreter lock is still in place; any long-running process within the main program will still block anything else from happening. The program is also still single-threaded; however, by externalizing tedious work, we conserve the attention of that thread to only what it needs to be attentive to. - -This is kind of like my asynchronous chores above. When my attention is fully necessary for prepping food, that's all I'm doing. However, when I can get the stove to do work for me by cooking my food, and the dishwasher to wash my dishes, and the washing machine and dryer to handle my laundry, my attention is freed to work on other things. When I am alerted that one of my long-running tasks is finished and ready to be handled once again, if my attention is free, I can pick up the results of that task and do whatever needs to be done with it next. - -### Tornado routes and views - -Despite having gone through all the trouble of talking about async in Python, we're going to hold off on using it for a bit and first write a basic Tornado view. - -Unlike the function-based views we've seen in the Flask and Pyramid implementations, Tornado's views are all class-based. This means we'll no longer use individual, standalone functions to dictate how requests are handled. Instead, the incoming HTTP request will be caught and assigned to be an attribute of our defined class. Its methods will then handle the corresponding request types. - -Let's start with a basic view that prints "Hello, World" to the screen. Every class-based view we construct for our Tornado app must inherit from the `RequestHandler` object found in `tornado.web`. This will set up all the ground-level logic that we'll need (but don't want to write) to take in a request and construct a properly formatted HTTP response. - -``` -from tornado.web import RequestHandler - -class HelloWorld(RequestHandler): -    """Print 'Hello, world!' as the response body.""" - -    def get(self): -        """Handle a GET request for saying Hello World!.""" -        self.write("Hello, world!") -``` - -Because we're looking to handle a `GET` request, we declare (really override) the `get` method. Instead of returning anything, we provide text or a JSON-serializable object to be written to the response body with `self.write`. After that, we let the `RequestHandler` take on the rest of the work that must be done before a response can be sent. - -As it stands, this view has no actual connection to the Tornado application itself. We have to go back into `__init__.py` and update the `main` function a bit. Here's the new hotness: - -``` -# __init__.py -from tornado.httpserver import HTTPServer -from tornado.ioloop import IOLoop -from tornado.options import define, options -from tornado.web import Application -from todo.views import HelloWorld - -define('port', default=8888, help='port to listen on') - -def main(): -    """Construct and serve the tornado application.""" -    app = Application([ -        ('/', HelloWorld) -    ]) -    http_server = HTTPServer(app) -    http_server.listen(options.port) -    print('Listening on http://localhost:%i' % options.port) -    IOLoop.current().start() -``` - -#### What'd we do? - -We imported the `HelloWorld` view from the `views.py` file into `__init__.py` at the top of the script. Then we added a list of route-view pairs as the first argument to the instantiation to `Application`. Whenever we want to declare a route in our application, it must be tied to a view. You can use the same view for multiple routes if you want, but there must always be a view for every route. - -We can make sure this all works by running our app with the `serve_app` command we enabled in the `setup.py`. Check `http://localhost:8888/` and see that it says "Hello, world!" - -Of course, there's more we can and will do in this space, but let's move on to models. - -### Connecting the database - -If we want to hold onto data, we need to connect a database. Like with Flask, we'll be using a framework-specific variant of SQLAlchemy called [tornado-sqlalchemy][7]. - -Why use this instead of just the bare [SQLAlchemy][8]? Well, `tornado-sqlalchemy` has all the goodness of straightforward SQLAlchemy, so we can still declare models with a common `Base` as well as use all the column data types and relationships to which we've grown accustomed. Alongside what we already know from habit, `tornado-sqlalchemy` provides an accessible async pattern for its database-querying functionality specifically to work with Tornado's existing I/O loop. - -We set the stage by adding `tornado-sqlalchemy` and `psycopg2` to `setup.py` to the list of required packages and reinstall the package. In `models.py`, we declare our models. This step looks pretty much exactly like what we've already seen in Flask and Pyramid, so I'll skip the full-class declarations and just put up the necessaries of the `Task` model. - -``` -# this is not the complete models.py, but enough to see the differences -from tornado_sqlalchemy import declarative_base - -Base = declarative_base - -class Task(Base): -    # and so on, because literally everything's the same... -``` - -We still have to connect `tornado-sqlalchemy` to the actual application. In `__init__.py`, we'll be defining the database and integrating it into the application. - -``` -# __init__.py -from tornado.httpserver import HTTPServer -from tornado.ioloop import IOLoop -from tornado.options import define, options -from tornado.web import Application -from todo.views import HelloWorld - -# add these -import os -from tornado_sqlalchemy import make_session_factory - -define('port', default=8888, help='port to listen on') -factory = make_session_factory(os.environ.get('DATABASE_URL', '')) - -def main(): -    """Construct and serve the tornado application.""" -    app = Application([ -        ('/', HelloWorld) -    ], -        session_factory=factory -    ) -    http_server = HTTPServer(app) -    http_server.listen(options.port) -    print('Listening on http://localhost:%i' % options.port) -    IOLoop.current().start() -``` - -Much like the session factory we passed around in Pyramid, we can use `make_session_factory` to take in a database URL and produce an object whose sole purpose is to provide connections to the database for our views. We then tie it into our application by passing the newly created `factory` into the `Application` object with the `session_factory` keyword argument. - -Finally, initializing and managing the database will look the same as it did for Flask and Pyramid (i.e., separate DB management script, working with respect to the `Base` object, etc.). It'll look so similar that I'm not going to reproduce it here. - -### Revisiting views - -Hello, World is always nice for learning the basics, but we need some real, application-specific views. - -Let's start with the info view. - -``` -# views.py -import json -from tornado.web import RequestHandler - -class InfoView(RequestHandler): -    """Only allow GET requests.""" -    SUPPORTED_METHODS = ["GET"] - -    def set_default_headers(self): -        """Set the default response header to be JSON.""" -        self.set_header("Content-Type", 'application/json; charset="utf-8"') - -    def get(self): -        """List of routes for this API.""" -        routes = { -            'info': 'GET /api/v1', -            'register': 'POST /api/v1/accounts', -            'single profile detail': 'GET /api/v1/accounts/', -            'edit profile': 'PUT /api/v1/accounts/', -            'delete profile': 'DELETE /api/v1/accounts/', -            'login': 'POST /api/v1/accounts/login', -            'logout': 'GET /api/v1/accounts/logout', -            "user's tasks": 'GET /api/v1/accounts//tasks', -            "create task": 'POST /api/v1/accounts//tasks', -            "task detail": 'GET /api/v1/accounts//tasks/', -            "task update": 'PUT /api/v1/accounts//tasks/', -            "delete task": 'DELETE /api/v1/accounts//tasks/' -        } -        self.write(json.dumps(routes)) -``` - -So what changed? Let's go from the top down. - -The `SUPPORTED_METHODS` class attribute was added. This will be an iterable of only the request methods that are accepted by this view. Any other method will return a [405][9] status code. When we made the `HelloWorld` view, we didn't specify this, mostly out of laziness. Without this class attribute, this view would respond to any request trying to access the route tied to the view. - -The `set_default_headers` method is declared, which sets the default headers of the outgoing HTTP response. We declare this here to ensure that any response we send back has a `"Content-Type"` of `"application/json"`. - -We added `json.dumps(some_object)` to the argument of `self.write` because it makes it easy to construct the content for the body of the outgoing response. - -Now that's done, and we can go ahead and connect it to the home route in `__init__.py`. - -``` -# __init__.py -from tornado.httpserver import HTTPServer -from tornado.ioloop import IOLoop -from tornado.options import define, options -from tornado.web import Application -from todo.views import InfoView - -# add these -import os -from tornado_sqlalchemy import make_session_factory - -define('port', default=8888, help='port to listen on') -factory = make_session_factory(os.environ.get('DATABASE_URL', '')) - -def main(): -    """Construct and serve the tornado application.""" -    app = Application([ -        ('/', InfoView) -    ], -        session_factory=factory -    ) -    http_server = HTTPServer(app) -    http_server.listen(options.port) -    print('Listening on http://localhost:%i' % options.port) -    IOLoop.current().start() -``` - -As we know, more views and routes will need to be written. Each one will get dropped into the `Application` route listing as needed. Each will also need a `set_default_headers` method. On top of that, we'll create our `send_response`method, whose job it will be to package our response along with any custom status codes we want to set for a given response. Since each one will need both methods, we can create a base class containing them that each of our views can inherit from. That way, we have to write them only once. - -``` -# views.py -import json -from tornado.web import RequestHandler - -class BaseView(RequestHandler): -    """Base view for this application.""" - -    def set_default_headers(self): -        """Set the default response header to be JSON.""" -        self.set_header("Content-Type", 'application/json; charset="utf-8"') - -    def send_response(self, data, status=200): -        """Construct and send a JSON response with appropriate status code.""" -        self.set_status(status) -        self.write(json.dumps(data)) -``` - -For a view like the `TaskListView` we'll soon write, we'll also need a connection to the database. We'll need `tornado_sqlalchemy`'s `SessionMixin` to add a database session within every view class. We can fold that into the `BaseView` so that, by default, every view inheriting from it has access to a database session. - -``` -# views.py -import json -from tornado_sqlalchemy import SessionMixin -from tornado.web import RequestHandler - -class BaseView(RequestHandler, SessionMixin): -    """Base view for this application.""" - -    def set_default_headers(self): -        """Set the default response header to be JSON.""" -        self.set_header("Content-Type", 'application/json; charset="utf-8"') - -    def send_response(self, data, status=200): -        """Construct and send a JSON response with appropriate status code.""" -        self.set_status(status) -        self.write(json.dumps(data)) -``` - -As long as we're modifying this `BaseView` object, we should address a quirk that will come up when we consider data being posted to this API. - -When Tornado (as of v.4.5) consumes data from a client and organizes it for use in the application, it keeps all the incoming data as bytestrings. However, all the code here assumes Python 3, so the only strings that we want to work with are Unicode strings. We can add another method to this `BaseView` class whose job it will be to convert the incoming data to Unicode before using it anywhere else in the view. - -If we want to convert this data before we use it in a proper view method, we can override the view class's native `prepare` method. Its job is to run before the view method runs. If we override the `prepare` method, we can set some logic to run that'll do the bytestring-to-Unicode conversion whenever a request is received. - -``` -# views.py -import json -from tornado_sqlalchemy import SessionMixin -from tornado.web import RequestHandler - -class BaseView(RequestHandler, SessionMixin): -    """Base view for this application.""" - -    def prepare(self): -        self.form_data = { -            key: [val.decode('utf8') for val in val_list] -            for key, val_list in self.request.arguments.items() -        } - -    def set_default_headers(self): -        """Set the default response header to be JSON.""" -        self.set_header("Content-Type", 'application/json; charset="utf-8"') - -    def send_response(self, data, status=200): -        """Construct and send a JSON response with appropriate status code.""" -        self.set_status(status) -        self.write(json.dumps(data)) -``` - -If there's any data coming in, it'll be found within the `self.request.arguments` dictionary. We can access that data by key and convert its contents (always a list) to Unicode. Because this is a class-based view instead of a function-based view, we can store the modified data as an instance attribute to be used later. I called it `form_data` here, but it can just as easily be called `potato`. The point is that we can store data that has been submitted to the application. - -### Asynchronous view methods - -Now that we've built our `BaseView`, we can build the `TaskListView` that will inherit from it. - -As you can probably tell from the section heading, this is where all that talk about asynchronicity comes in. The `TaskListView` will handle `GET` requests for returning a list of tasks and `POST` requests for creating new tasks given some form data. Let's first look at the code to handle the `GET` request. - -``` -# all the previous imports -import datetime -from tornado.gen import coroutine -from tornado_sqlalchemy import as_future -from todo.models import Profile, Task - -# the BaseView is above here -class TaskListView(BaseView): -    """View for reading and adding new tasks.""" -    SUPPORTED_METHODS = ("GET", "POST",) - -    @coroutine -    def get(self, username): -        """Get all tasks for an existing user.""" -        with self.make_session() as session: -            profile = yield as_future(session.query(Profile).filter(Profile.username == username).first) -            if profile: -                tasks = [task.to_dict() for task in profile.tasks] -                self.send_response({ -                    'username': profile.username, -                    'tasks': tasks -                }) -``` - -The first major piece here is the `@coroutine` decorator, imported from `tornado.gen`. Any Python callable that has a portion that acts out of sync with the normal flow of the call stack is effectively a "co-routine"; a routine that can run alongside other routines. In the example of my household chores, pretty much every chore was a co-routine. Some were blocking routines (e.g., vacuuming the floor), but that routine simply blocked my ability to start or attend to anything else. It didn't block any of the other routines that were already set in motion from continuing. - -Tornado offers a number of ways to build an app that take advantage of co-routines, including allowing us to set locks on function calls, conditions for synchronizing asynchronous routines, and a system for manually modifying the events that control the I/O loop. - -The only way the `@coroutine` decorator is used here is to allow the `get` method to farm out the SQL query as a background process and resume once the query is complete, while not blocking the Tornado I/O loop from handling other sources of incoming data. That is all that's "asynchronous" about this implementation: out-of-band database queries. Clearly if we wanted to showcase the magic and wonder of an async web app, a To-Do List isn't the way. - -But hey, that's what we're building, so let's see how our method takes advantage of that `@coroutine` decorator. The `SessionMixin` that was, well, mixed into the `BaseView` declaration added two handy, database-aware attributes to our view class: `session` and `make_session`. They're similarly named and accomplish fairly similar goals. - -The `self.session` attribute is a session with an eye on the database. At the end of the request-response cycle, just before the view sends a response back to the client, any changes that have been made to the database are committed, and the session is closed. - -`self.make_session` is a context manager and generator, building and returning a brand new session object on the fly. That first `self.session` object still exists; `make_session` creates a new one anyway. The `make_session` generator also has baked into itself the logic for committing and closing the session it creates as soon as its context (i.e., indentation level) ends. - -If you inspect the source code, there is no difference between the type of object assigned to `self.session` and the type of object generated by `self.make_session`. The difference is in how they're managed. - -With the `make_session` context manager, the generated session belongs only to the context, beginning and ending within that context. You can open, modify, commit, and close multiple database sessions within the same view with the `make_session` context manager. - -`self.session` is much simpler, with the session already opened by the time you get to your view method and committing before the response is sent back to the client. - -Although the [read the docs snippet][10] and the [the PyPI example][11] both specify the use of the context manager, there's nothing about either the `self.session` object or the `session` generated by `self.make_session` that is inherently asynchronous. The point where we start thinking about the async behavior built into `tornado-sqlalchemy` comes when we initiate a query. - -The `tornado-sqlalchemy` package provides us with the `as_future` function. The job of `as_future` is to wrap the query constructed by the `tornado-sqlalchemy` session and yield its return value. If the view method is decorated with `@coroutine`, then using this `yield as_future(query)` pattern will now make your wrapped query an asynchronous background process. The I/O loop takes over, awaiting the return value of the query and the resolution of the `future` object created by `as_future`. - -To have access to the result from `as_future(query)`, you must `yield` from it. Otherwise, you get only an unresolved generator object and can do nothing with the query. - -Everything else in this view method is pretty much par for the course, mirroring what we've already seen in Flask and Pyramid. - -The `post` method will look fairly similar. For the sake of consistency, let's see how the `post` method looks and how it handles the `self.form_data` that was constructed with the `BaseView`. - -``` -@coroutine -def post(self, username): -    """Create a new task.""" -    with self.make_session() as session: -        profile = yield as_future(session.query(Profile).filter(Profile.username == username).first) -        if profile: -            due_date = self.form_data['due_date'][0] -            task = Task( -                name=self.form_data['name'][0], -                note=self.form_data['note'][0], -                creation_date=datetime.now(), -                due_date=datetime.strptime(due_date, '%d/%m/%Y %H:%M:%S') if due_date else None, -                completed=self.form_data['completed'][0], -                profile_id=profile.id, -                profile=profile -            ) -            session.add(task) -            self.send_response({'msg': 'posted'}, status=201) -``` - -As I said, it's about what we'd expect: - - * The same query pattern as we saw with the `get` method - * The construction of an instance of a new `Task` object, populated with data from `form_data` - * The adding (but not committing because it's handled by the context manager!) of the new `Task` object to the database session - * The sending of a response back to the client - - - -And thus we have the basis for our Tornado web app. Everything else (e.g., database management and more views for a more complete app) is effectively the same as what we've already seen in the Flask and Pyramid apps. - -### Thoughts about using the right tool for the right job - -What we're starting to see as we continue to move through these web frameworks is that they can all effectively handle the same problems. For something like this To-Do List, any framework can do the job. However, some web frameworks are more appropriate for certain jobs than other ones, depending on what "more appropriate" means for you and your needs. - -While Tornado is clearly capable of handling the same job that Pyramid or Flask can handle, to use it for an app like this is effectively a waste. It's like using a car to travel one block from home. Yes it can do the job of "travel," but short trips aren't why you choose to use a car over a bike or just your feet. - -Per the documentation, Tornado is billed as "a Python web framework and asynchronous networking library." There are few like it in the Python web framework ecosystem. If the job you're trying to accomplish requires (or would benefit significantly from) asynchronicity in any way, shape, or form, use Tornado. If your application needs to handle multiple, long-lived connections while not sacrificing much in performance, choose Tornado. If your application is many applications in one and needs to be thread-aware for the accurate handling of data, reach for Tornado. That's where it works best. - -Use your car to do "car things." Use other modes of transportation to do everything else. - -### Going forward and a little perspective check - -Speaking of using the right tool for the right job, keep in mind the scope and scale, both present and future, of your application when choosing your framework. Up to this point we've only looked at frameworks meant for small to midsized web applications. The next and final installment of this series will cover one of the most popular Python frameworks, Django, meant for big applications that might grow bigger. Again, while it technically can and will handle the To-Do List problem, keep in mind that it's not really what the framework is for. We'll still put it through its paces to show how an application can be built with it, but we have to keep in mind the intent of the framework and how that's reflected in its architecture: - - * **Flask:** Meant for small, simple projects; makes it easy for us to construct views and connect them to routes quickly; can be encapsulated in a single file without much fuss - * **Pyramid:** Meant for projects that may grow; contains a fair bit of configuration to get up and running; separate realms of application components can easily be divided and built out to arbitrary depth without losing sight of the central application - * **Tornado:** Meant for projects benefiting from precise and deliberate I/O control; allows for co-routines and easily exposes methods that can control how requests are received/responses are sent and when those operations occur - * **Django:** (As we'll see) meant for big things that may get bigger; large ecosystem of add-ons and mods; very opinionated in its configuration and management in order to keep all the disparate parts in line - - - -Whether you've been reading since the first post in this series or joined a little later, thanks for reading! Please feel free to leave questions or comments. I'll see you next time with hands full of Django. - -### Huge shout-out to the Python BDFL - -I must give credit where credit is due. Massive thanks are owed to [Guido van Rossum][12] for more than just creating my favorite programming language. - -During [PyCascades 2018][13], I was fortunate not only to give the talk this article series is based on, but also to be invited to the speakers' dinner. I got to sit next to Guido the whole night and pepper him with questions. One of those questions was how in the world async worked in Python, and he, without a bit of fuss, spent time explaining it to me in a way that I could start to grasp the concept. He later [tweeted to me][14] a spectacular resource for learning async with Python that I subsequently read three times over three months, then wrote this post. You're an awesome guy, Guido! - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/18/6/tornado-framework - -作者:[Nicholas Hunt-Walker][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/nhuntwalker -[b]: https://github.com/lujun9972 -[1]: https://opensource.com/article/18/5/pyramid-framework -[2]: https://opensource.com/article/18/4/flask -[3]: https://tornado.readthedocs.io/en/stable/ -[4]: https://realpython.com/python-gil/ -[5]: https://en.wikipedia.org/wiki/Thread_(computing) -[6]: https://www.nginx.com/ -[7]: https://tornado-sqlalchemy.readthedocs.io/en/latest/ -[8]: https://www.sqlalchemy.org/ -[9]: https://en.wikipedia.org/wiki/List_of_HTTP_status_codes#4xx_Client_errors -[10]: https://tornado-sqlalchemy.readthedocs.io/en/latest/#usage -[11]: https://pypi.org/project/tornado-sqlalchemy/#description -[12]: https://www.twitter.com/gvanrossum -[13]: https://www.pycascades.com -[14]: https://twitter.com/gvanrossum/status/956186585493458944 diff --git a/translated/tech/20180614 An introduction to the Tornado Python web app framework.md b/translated/tech/20180614 An introduction to the Tornado Python web app framework.md new file mode 100644 index 0000000000..3816f5138b --- /dev/null +++ b/translated/tech/20180614 An introduction to the Tornado Python web app framework.md @@ -0,0 +1,580 @@ +[#]: collector: (lujun9972) +[#]: translator: (MjSeven) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: subject: (An introduction to the Tornado Python web app framework) +[#]: via: (https://opensource.com/article/18/6/tornado-framework) +[#]: author: (Nicholas Hunt-Walker https://opensource.com/users/nhuntwalker) +[#]: url: ( ) + +Python Web 框架 Tornado 简介 +====== + +在比较 Python 框架的系列文章的第三部分中,我们来了解 Tornado,它是为处理异步进程而构建的。 + +![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/tornado.png?itok=kAa3eXIU) + +在这个由四部分组成的系列文章的前两篇中,我们介绍了 [Pyramid][1] 和 [Flask][2] Web 框架。我们已经构建了两次相同的应用程序,看到了一个完全的 DIY 框架和包含更多电池的框架之间的异同。 + +现在让我们来看看另一个稍微不同的选项:[Tornado 框架][3]。Tornado 在很大程度上与 Flask 一样简单,但有一个主要区别:Tornado 是专门为处理异步进程而构建的。在我们本系列所构建的应用程序中,这种特殊的酱料(译者注:这里意思是 Tornado 的异步功能)并不是非常有用,但我们将看到在哪里可以使用它,以及它在更一般的情况下是如何工作的。 + +让我们继续前两篇文章中设置的流程,首先从处理设置和配置。 + +### Tornado 启动和配置 + +如果你一直关注这个系列,那么第一步应该对你来说习以为常。 +``` +$ mkdir tornado_todo +$ cd tornado_todo +$ pipenv install --python 3.6 +$ pipenv shell +(tornado-someHash) $ pipenv install tornado +``` + +创建一个 `setup.py` 文件来安装我们的应用程序相关的东西: +``` +(tornado-someHash) $ touch setup.py +# setup.py +from setuptools import setup, find_packages + +requires = [ +    'tornado', +    'tornado-sqlalchemy', +    'psycopg2', +] + +setup( +    name='tornado_todo', +    version='0.0', +    description='A To-Do List built with Tornado', +    author='', +    author_email='', +    keywords='web tornado', +    packages=find_packages(), +    install_requires=requires, +    entry_points={ +        'console_scripts': [ +            'serve_app = todo:main', +        ], +    }, +) +``` + +因为 Tornado 不需要任何外部配置,所以我们可以直接编写 Python 代码来让程序运行。让我们创建 `todo` 目录,并用需要的前几个文件填充它。 +``` +todo/ +    __init__.py +    models.py +    views.py +``` + +就像 Flask 和 Pyramid 一样,Tornado 也有一些基本配置,将放在 `__init__.py` 中。从 `tornado.web` 中,我们将导入 `Application` 对象,它将处理路由和视图的连接,包括数据库(当我们谈到那里时再说)以及运行 Tornado 应用程序所需的其它额外设置。 + +``` +# __init__.py +from tornado.httpserver import HTTPServer +from tornado.options import define, options +from tornado.web import Application + +define('port', default=8888, help='port to listen on') + +def main(): +    """Construct and serve the tornado application.""" +    app = Application() +    http_server = HTTPServer(app) +    http_server.listen(options.port) +``` + +当我们使用 `define` 函数时,我们最终会在 `options` 对象上创建属性。第一个参数位置的任何内容都将是属性的名称,分配给 `default` 关键字参数的内容将是该属性的值。 + +例如,如果我们将属性命名为 `potato` 而不是 `port`,我们可以通过 `options.potato` 访问它的值。 + +在 `HTTPServer` 上调用 `listen` 并不会启动服务器。我们必须再做一步,找一个可以监听请求并返回响应的工作应用程序,我们需要一个输入输出循环。幸运的是,Tornado 以 `tornado.ioloop.IOLoop` 的形式提供了开箱即用的功能。 + +``` +# __init__.py +from tornado.httpserver import HTTPServer +from tornado.ioloop import IOLoop +from tornado.options import define, options +from tornado.web import Application + +define('port', default=8888, help='port to listen on') + +def main(): +    """Construct and serve the tornado application.""" +    app = Application() +    http_server = HTTPServer(app) +    http_server.listen(options.port) +    print('Listening on http://localhost:%i' % options.port) +    IOLoop.current().start() +``` + +我喜欢某种形式的 `print` 声明,告诉我什么时候应用程序正在提供服务,我就是这样子。如果你愿意,可以不使用 `print`。 + +我们以 `IOLoop.current().start()` 开始我们的 I/O 循环。让我们进一步讨论输入,输出和异步性。 + +### Python 中的异步和 I/O 循环的基础知识 + +请允许我提前说明,我绝对,肯定,肯定并且安心地说不是异步编程方面的专家。就像我写的所有内容一样,接下来的内容源于我对这个概念的理解的局限性。因为我是人,可能有很深很深的缺陷。 + +异步程序的主要问题是: + + * 数据如何进来? + * 数据如何出去? + * 什么时候可以在不占用我全部注意力情况下运行某个过程? + +由于[全局解释器锁][4](GIL),Python 被设计为一种单线程语言。对于 Python 程序必须执行的每个任务,其线程执行的全部注意力都集中在该任务的持续时间内。我们的 HTTP 服务器是用 Python 编写的,因此,当接收到数据(如 HTTP 请求)时,服务器的唯一关心的是传入的数据。这意味着,在大多数情况下,无论是程序需要运行还是处理数据,程序都将完全消耗服务器的执行线程,阻止接收其它可能的数据,直到服务器完成它需要做的事情。 + +在许多情况下,这不是太成问题。典型的 Web 请求,响应周期只需要几分之一秒。除此之外,构建 HTTP 服务器的套接字可以维护待处理的传入请求的积压。因此,如果请求在该套接字处理其它内容时进入,则它很可能只是在处理之前稍微排队等待一会。对于低到中等流量的站点,几分之一秒的时间并不是什么大问题,你可以使用多个部署的实例以及 [NGINX][6] 等负载均衡器来为更大的请求负载分配流量。 + +但是,如果你的平均响应时间超过一秒钟,该怎么办?如果你使用来自传入请求的数据来启动一些长时间的过程(如机器学习算法或某些海量数据库查询),该怎么办?现在,你的单线程 Web 服务器开始累积一个无法寻址的积压请求,其中一些请求会因为超时而被丢弃。这不是一种选择,特别是如果你希望你的服务在一段时间内是可靠的。 + +异步 Python 程序登场。重要的是要记住因为它是用 Python 编写的,所以程序仍然是一个单线程进程。除非特别标记,否则在异步程序中仍然会阻塞执行。 + +但是,当异步程序结构正确时,只要你指定某个函数应该具有这样的能力,你的异步 Python 程序就可以“搁置”长时间运行的任务。然后,当搁置的任务完成并准备好恢复时,异步控制器会收到报告,只要在需要时管理它们的执行,而不会完全阻塞对新输入的处理。 + +这有点夸张,所以让我们用一个人类的例子来证明。 + +### 带回家吧 + +我经常发现自己在家里试图完成很多家务,但没有多少时间来做它们。在某一天,积压的家务可能看起来像: + + * 做饭(20 分钟准备,40 分钟烹饪) + * 洗碗(60 分钟) + * 洗涤并擦干衣物(30 分钟洗涤,每次干燥 90 分钟) + * 真空清洗地板(30 分钟) + +如果我是一个传统的同步程序,我会亲自完成每项任务。在我考虑处理任何其他事情之前,每项任务都需要我全神贯注地完成。因为如果没有我的全力关注,什么事情都完成不了。所以我的执行顺序可能如下: + + 1. 完全专注于准备和烹饪食物,包括等待食物烹饪(60 分钟) + 2. 将脏盘子移到水槽中(65 分钟过去了) + 3. 清洗所有盘子(125 分钟过去了) + 4. 开始完全专注于洗衣服,包括等待洗衣机洗完,然后将衣物转移到烘干机,再等烘干机完成( 250 分钟过去了) + 5. 对地板进行真空吸尘(280 分钟了) + +从头到尾完成所有事情花费了 4 小时 40 分钟。 + +我应该像异步程序一样聪明地工作,而不是努力工作。我的家里到处都是可以为我工作的机器,而不用我一直努力工作。同时,现在我可以将注意力转移真正需要的东西上。 + +我的执行顺序可能看起来像: + + 1. 将衣物放入洗衣机并启动它(5 分钟) + 2. 在洗衣机运行时,准备食物(25 分钟过去了) + 3. 准备好食物后,开始烹饪食物(30 分钟过去了) + 4. 在烹饪食物时,将衣物从洗衣机移到烘干机机中开始烘干(35 分钟过去了) + 5. 当烘干机运行中,且食物仍在烹饪时,对地板进行真空吸尘(65 分钟过去了) + 6. 吸尘后,将食物从炉子中取出并装盘子入洗碗机(70 分钟过去了) + 7. 运行洗碗机(130 分钟完成) + +现在花费的时间下降到 2 小时 10 分钟。即使我允许在作业之间切换花费更多时间(总共 10-20 分钟)。如果我等待着按顺序执行每项任务,我花费的时间仍然只有一半左右。这就是将程序构造为异步的强大功能。 + +#### 那么 I/O 循环在哪里? + +一个异步 Python 程序的工作方式是从某个外部源(输入)获取数据,如果某个进程需要,则将该数据转移到某个外部工作者(输出)进行处理。当外部进程完成时,Python 主程序会收到提醒,然后程序获取外部处理(输入)的结果,并继续这样其乐融融的方式。 + +当数据不在 Python 主程序手中时,主程序就会被释放来处理其它任何事情。包括等待全新的输入(如 HTTP 请求)和处理长时间运行的进程的结果(如机器学习算法的结果,长时间运行的数据库查询)。主程序虽仍然是单线程的,但成了事件驱动的,它对程序处理的特定事件会触发动作。监听这些事件并指示应如何处理它们的主要是 I/O 循环在工作。 + +我知道,我们走了很长的路才得到这个重要的解释,但我希望在这里传达的是,它不是魔术,也不是某种复杂的并行处理或多线程工作。全局解释器锁仍然存在,主程序中任何长时间运行的进程仍然会阻塞其它任何事情的进行,该程序仍然是单线程的。然而,通过将繁琐的工作外部化,我们可以将线程的注意力集中在它需要注意的地方。 + +这有点像我上面的异步任务。当我的注意力完全集中在准备食物上时,它就是我所能做的一切。然而,当我能让炉子帮我做饭,洗碗机帮我洗碗,洗衣机和烘干机帮我洗衣服时,我的注意力就会被释放出来,去做其它事情。当我被提醒,我的一个长时间运行的任务已经完成并准备再次处理时,如果我的注意力是空闲的,我可以获取该任务的结果,并对其做下一步需要做的任何事情。 + +### Tornado 路由和视图 + +尽管经历了在 Python 中讨论异步的所有麻烦,我们还是决定暂不使用它。先来编写一个基本的 Tornado 视图。 + +与我们在 Flask 和 Pyramid 实现中看到的基于函数的视图不同,Tornado 的视图都是基于类的。这意味着我们将不在使用单独的,独立的函数来规定如何处理请求。相反,传入的 HTTP 请求将被捕获并将其分配为我们定义的类的一个属性。然后,它的方法将处理相应的请求类型。 + +让我们从一个基本的视图开始,即在屏幕上打印 "Hello, World"。我们为 Tornado 应用程序构造的每个基于类的视图都必须继承 `tornado.web` 中的 `RequestHandler` 对象。这将设置我们需要(但不想写)的所有底层逻辑来接收请求,同时构造正确格式的 HTTP 响应。 + +``` +from tornado.web import RequestHandler + +class HelloWorld(RequestHandler): +    """Print 'Hello, world!' as the response body.""" + +    def get(self): +        """Handle a GET request for saying Hello World!.""" +        self.write("Hello, world!") +``` + +因为我们要处理 `GET` 请求,所以我们声明(实际上是重写) `get` 方法。我们提供文本或 JSON 可序列化对象,用 `self.write` 写入响应体。之后,我们让 `RequestHandler` 来做在发送响应之前必须完成的其它工作。 + +就目前而言,此视图与 Tornado 应用程序本身并没有实际连接。我们必须回到 `__init__.py`,并稍微更新 `main` 函数。以下是新的内容: + +``` +# __init__.py +from tornado.httpserver import HTTPServer +from tornado.ioloop import IOLoop +from tornado.options import define, options +from tornado.web import Application +from todo.views import HelloWorld + +define('port', default=8888, help='port to listen on') + +def main(): +    """Construct and serve the tornado application.""" +    app = Application([ +        ('/', HelloWorld) +    ]) +    http_server = HTTPServer(app) +    http_server.listen(options.port) +    print('Listening on http://localhost:%i' % options.port) +    IOLoop.current().start() +``` + +#### 我们做了什么 + +我们将 `views.py` 文件中的 `HelloWorld` 视图导入到脚本 `__init__.py` 的顶部。然后我们添加了一个路由-视图对应的列表,作为 `Application` 实例化的第一个参数。每当我们想要在应用程序中声明一个路由时,它必须绑定到一个视图。如果需要,可以对多个路由使用相同的视图,但每个路由必须有一个视图。 + +我们可以通过在 `setup.py` 中启用的 `serve_app` 命令来运行应用程序,从而确保这一切都能正常工作。查看 `http://localhost:8888/` 并看到它显示 "Hello, world!"。 + +当然,在这个领域中我们还能做更多,也将做更多,但现在让我们来讨论模型吧。 + +### 连接数据库 + +如果我们想要保留数据,我们需要连接数据库。与 Flask 一样,我们将使用一个特定于框架的 SQLAchemy 变体,名为 [tornado-sqlalchemy][7]。 + +为什么要使用它而不是 [SQLAlchemy][8] 呢?好吧,其实 `tornado-sqlalchemy` 具有简单 SQLAlchemy 的所有优点,因此我们仍然可以使用通用的 `Base` 声明模型,并使用我们习以为常的所有列数据类型和关系。除了我们已经从习惯中了解到的,`tornado-sqlalchemy` 还为其数据库查询功能提供了一种可访问的异步模式,专门用于与 Tornado 现有的 I/O 循环一起工作。 + +我们通过将 `tornado-sqlalchemy` 和 `psycopg2` 添加到 `setup.py` 到所需包的列表并重新安装包来创建环境。在 `models.py` 中,我们声明了模型。这一步看起来与我们在 Flask 和 Pyramid 中已经看到的完全一样,所以我将跳过全部声明,只列出了 `Task` 模型的必要部分。 + +``` +# 这不是完整的 models.py, 但是足够看到不同点 +from tornado_sqlalchemy import declarative_base + +Base = declarative_base + +class Task(Base): +    # 等等,因为剩下的几乎所有的东西都一样 ... +``` + +我们仍然需要将 `tornado-sqlalchemy` 连接到实际应用程序。在 `__init__.py` 中,我们将定义数据库并将其集成到应用程序中。 + +``` +# __init__.py +from tornado.httpserver import HTTPServer +from tornado.ioloop import IOLoop +from tornado.options import define, options +from tornado.web import Application +from todo.views import HelloWorld + +# add these +import os +from tornado_sqlalchemy import make_session_factory + +define('port', default=8888, help='port to listen on') +factory = make_session_factory(os.environ.get('DATABASE_URL', '')) + +def main(): +    """Construct and serve the tornado application.""" +    app = Application([ +        ('/', HelloWorld) +    ], +        session_factory=factory +    ) +    http_server = HTTPServer(app) +    http_server.listen(options.port) +    print('Listening on http://localhost:%i' % options.port) +    IOLoop.current().start() +``` + +就像我们在 Pyramid 中传递的会话工厂一样,我们可以使用 `make_session_factory` 来接收数据库 URL 并生成一个对象,这个对象的唯一目的是为视图提供到数据库的连接。然后我们将新创建的 `factory` 传递给 `Application` 对象,并使用 `session_factory` 关键字参数将它绑定到应用程序中。 + +最后,初始化和管理数据库与 Flask 和 Pyramid 相同(即,单独的 DB 管理脚本,与 `Base` 对象一起工作等)。它看起来很相似,所以在这里我就不介绍了。 + +### 回顾视图 + +Hello,World 总是适合学习基础知识,但我们需要一些真实的,特定应用程序的视图。 + +让我们从 info 视图开始。 + +``` +# views.py +import json +from tornado.web import RequestHandler + +class InfoView(RequestHandler): +    """只允许 GET 请求""" +    SUPPORTED_METHODS = ["GET"] + +    def set_default_headers(self): +        """设置默认响应头为 json 格式的""" +        self.set_header("Content-Type", 'application/json; charset="utf-8"') + +    def get(self): +        """列出这个 API 的路由""" +        routes = { +            'info': 'GET /api/v1', +            'register': 'POST /api/v1/accounts', +            'single profile detail': 'GET /api/v1/accounts/', +            'edit profile': 'PUT /api/v1/accounts/', +            'delete profile': 'DELETE /api/v1/accounts/', +            'login': 'POST /api/v1/accounts/login', +            'logout': 'GET /api/v1/accounts/logout', +            "user's tasks": 'GET /api/v1/accounts//tasks', +            "create task": 'POST /api/v1/accounts//tasks', +            "task detail": 'GET /api/v1/accounts//tasks/', +            "task update": 'PUT /api/v1/accounts//tasks/', +            "delete task": 'DELETE /api/v1/accounts//tasks/' +        } +        self.write(json.dumps(routes)) +``` + +有什么改变吗?让我们从上往下看。 + +我们添加了 `SUPPORTED_METHODS` 类属性,它是一个可迭代对象,代表这个视图所接受的请求方法,其他任何方法都将返回一个 [405][9] 状态码。当我们创建 `HelloWorld` 视图时,我们没有指定它,主要是当时有点懒。如果没有这个类属性,此视图将响应任何试图绑定到该视图的路由的请求。 + +我们声明了 `set_default_headers` 方法,它设置 HTTP 响应的默认头。我们在这里声明它,以确保我们返回的任何响应都有一个 `"Content-Type"` 是 `"application/json"` 类型。 + +我们将 `json.dumps(some_object)` 添加到 `self.write` 的参数中,因为它可以很容易地构建响应主体的内容。 + +现在已经完成了,我们可以继续将它连接到 `__init__.py` 中的主路由。 + +``` +# __init__.py +from tornado.httpserver import HTTPServer +from tornado.ioloop import IOLoop +from tornado.options import define, options +from tornado.web import Application +from todo.views import InfoView + +# 添加这些 +import os +from tornado_sqlalchemy import make_session_factory + +define('port', default=8888, help='port to listen on') +factory = make_session_factory(os.environ.get('DATABASE_URL', '')) + +def main(): +    """Construct and serve the tornado application.""" +    app = Application([ +        ('/', InfoView) +    ], +        session_factory=factory +    ) +    http_server = HTTPServer(app) +    http_server.listen(options.port) +    print('Listening on http://localhost:%i' % options.port) +    IOLoop.current().start() +``` + +我们知道,还需要编写更多的视图和路由。每个都会根据需要放入 `Application` 路由列表中,每个视图还需要一个 `set_default_headers` 方法。在此基础上,我们还将创建 `send_response` 方法,它的作用是将响应与我们想要给响应设置的任何自定义状态码打包在一起。由于每个视图都需要这两个方法,因此我们可以创建一个包含它们的基类,这样每个视图都可以继承基类。这样,我们只需要编写一次。 + +``` +# views.py +import json +from tornado.web import RequestHandler + +class BaseView(RequestHandler): +    """Base view for this application.""" + +    def set_default_headers(self): +        """Set the default response header to be JSON.""" +        self.set_header("Content-Type", 'application/json; charset="utf-8"') + +    def send_response(self, data, status=200): +        """Construct and send a JSON response with appropriate status code.""" +        self.set_status(status) +        self.write(json.dumps(data)) +``` + +对于我们即将编写的 `TaskListView` 这样的视图,我们还需要一个到数据库的连接。我们需要 `tornado_sqlalchemy` 中的 `SessionMixin` 在每个视图类中添加一个数据库会话。我们可以将它放在 `BaseView` 中,这样,默认情况下,从它继承的每个视图都可以访问数据库会话。 + +``` +# views.py +import json +from tornado_sqlalchemy import SessionMixin +from tornado.web import RequestHandler + +class BaseView(RequestHandler, SessionMixin): +    """Base view for this application.""" + +    def set_default_headers(self): +        """Set the default response header to be JSON.""" +        self.set_header("Content-Type", 'application/json; charset="utf-8"') + +    def send_response(self, data, status=200): +        """Construct and send a JSON response with appropriate status code.""" +        self.set_status(status) +        self.write(json.dumps(data)) +``` + +只要我们修改 `BaseView` 对象,在将数据发布到这个 API 时,我们就应该定位到这里。 + +当 Tornado(从 v.4.5 开始)使用来自客户端的数据并将其组织起来到应用程序中使用时,它会将所有传入数据视为字节串。但是,这里的所有代码都假设使用 Python 3,因此我们希望使用的唯一字符串是 Unicode 字符串。我们可以为这个 `BaseView` 类添加另一个方法,它的工作是将输入数据转换为 Unicode,然后再在视图的其他地方使用。 + +如果我们想要在正确的视图方法中使用它之前转换这些数据,我们可以重写视图类的原生 `prepare` 方法。它的工作是在视图方法运行前运行。如果我们重写 `prepare` 方法,我们可以设置一些逻辑来运行,每当收到请求时,这些逻辑就会执行字节串到 Unicode 的转换。 + +``` +# views.py +import json +from tornado_sqlalchemy import SessionMixin +from tornado.web import RequestHandler + +class BaseView(RequestHandler, SessionMixin): +    """Base view for this application.""" + +    def prepare(self): +        self.form_data = { +            key: [val.decode('utf8') for val in val_list] +            for key, val_list in self.request.arguments.items() +        } + +    def set_default_headers(self): +        """Set the default response header to be JSON.""" +        self.set_header("Content-Type", 'application/json; charset="utf-8"') + +    def send_response(self, data, status=200): +        """Construct and send a JSON response with appropriate status code.""" +        self.set_status(status) +        self.write(json.dumps(data)) +``` + +如果有任何数据进入,它将在 `self.request.arguments` 字典中找到。我们可以通过键访问该数据库,并将其内容(始终是列表)转换为 Unicode。因为这是基于类的视图而不是基于函数的,所以我们可以将修改后的数据存储为一个实例属性,以便以后使用。我在这里称它为 `form_data`,但它也可以被称为 `potato`。关键是我们可以存储提交给应用程序的数据。 + +### 异步视图方法 + +现在我们已经构建了 `BaseaView`,我们可以构建 `TaskListView` 了,它会继承 `BaseaView`。 + +正如你可以从章节标题中看到的那样,以下是所有关于异步性的讨论。`TaskListView` 将处理返回任务列表的 `GET` 请求和用户给定一些表单数据来创建新任务的 `POST` 请求。让我们首先来看看处理 `GET` 请求的代码。 + +``` +# all the previous imports +import datetime +from tornado.gen import coroutine +from tornado_sqlalchemy import as_future +from todo.models import Profile, Task + +# the BaseView is above here +class TaskListView(BaseView): +    """View for reading and adding new tasks.""" +    SUPPORTED_METHODS = ("GET", "POST",) + +    @coroutine +    def get(self, username): +        """Get all tasks for an existing user.""" +        with self.make_session() as session: +            profile = yield as_future(session.query(Profile).filter(Profile.username == username).first) +            if profile: +                tasks = [task.to_dict() for task in profile.tasks] +                self.send_response({ +                    'username': profile.username, +                    'tasks': tasks +                }) +``` + +这里的第一个主要部分是 `@coroutine` 装饰器,它从 `tornado.gen` 导入。任何具有与调用堆栈的正常流程不同步的部分的 Python 可调用实际上是“协程”。一个可以与其它协程一起运行的协程。在我的家务劳动的例子中,几乎所有的家务活都是一个共同的例行协程。有些人阻止了例行协程(例如,给地板吸尘),但这种例行协程只会阻碍我开始或关心其它任何事情的能力。它没有阻止已经启动的任何其他协程继续进行。 + +Tornado 提供了许多方法来构建一个利用协程的应用程序,包括允许我们设置函数调用锁,同步异步协程的条件,以及手动修改控制 I/O 循环的事件系统。 + +这里使用 `@coroutine` 装饰器的唯一条件是允许 `get` 方法将 SQL 查询作为后台进程,并在查询完成后恢复,同时不阻止 Tornado I/O 循环去处理其他传入的数据源。这就是关于此实现的所有“异步”:带外数据库查询。显然,如果我们想要展示异步 Web 应用程序的魔力和神奇,那么一个任务列表就不是好的展示方式。 + +但是,这就是我们正在构建的,所以让我们来看看方法如何利用 `@coroutine` 装饰器。`SessionMixin` 混合到 `BaseView` 声明中,为我们的视图类添加了两个方便的,支持数据库的属性:`session` 和 `make_session`。它们的名字相似,实现的目标也相当相似。 + +`self.session` 属性是一个关注数据库的会话。在请求-响应周期结束时,在视图将响应发送回客户端之前,任何对数据库的更改都被提交,并关闭会话。 + +`self.make_session` 是一个上下文管理器和生成器,可以动态构建和返回一个全新的会话对象。第一个 `self.session` 对象仍然存在。无论如何,反正 `make_session` 会创建一个新的。`make_session` 生成器还为其自身提供了一个功能,用于在其上下文(即缩进级别)结束时提交和关闭它创建的会话。 + +如果你查看源代码,则赋值给 `self.session` 的对象类型与 `self.make_session` 生成的对象类型之间没有区别,不同之处在于它们是如何被管理的。 + +使用 `make_session` 上下文管理器,生成的会话仅属于上下文,在该上下文中开始和结束。你可以使用 `make_session` 上下文管理器在同一个视图中打开,修改,提交以及关闭多个数据库会话。 + +`self.session` 要简单得多,当你进入视图方法时会话已经打开,在响应被发送回客户端之前会话就已提交。 + +虽然[读取文档片段][10]和 [PyPI 示例][11]都说明了上下文管理器的使用,但是没有说明 `self.session` 对象或由 `self.make_session` 生成的 `session` 本质上是不是异步的。当我们启动查询时,我们开始考虑内置于 `tornado-sqlalchemy` 中的异步行为。 + +`tornado-sqlalchemy` 包为我们提供了 `as_future` 函数。它的工作是装饰 `tornado-sqlalchemy` 会话构造的查询并 yield 其返回值。如果视图方法用 `@coroutine` 装饰,那么使用 `yield as_future(query)` 模式将使封装的查询成为一个异步后台进程。I/O 循环会接管等待查询的返回值和 `as_future` 创建的 `future` 对象的解析。 + +要访问 `as_future(query)` 的结果,你必须从它 `yield`。否则,你只能获得一个未解析的生成器对象,并且无法对查询执行任何操作。 + +这个视图方法中的其他所有内容都与之前课堂上的类似,与我们在 Flask 和 Pyramid 中看到的内容类似。 + +`post` 方法看起来非常相似。为了保持一致性,让我们看一下 `post` 方法以及它如何处理用 `BaseView` 构造的 `self.form_data`。 + +``` +@coroutine +def post(self, username): +    """Create a new task.""" +    with self.make_session() as session: +        profile = yield as_future(session.query(Profile).filter(Profile.username == username).first) +        if profile: +            due_date = self.form_data['due_date'][0] +            task = Task( +                name=self.form_data['name'][0], +                note=self.form_data['note'][0], +                creation_date=datetime.now(), +                due_date=datetime.strptime(due_date, '%d/%m/%Y %H:%M:%S') if due_date else None, +                completed=self.form_data['completed'][0], +                profile_id=profile.id, +                profile=profile +            ) +            session.add(task) +            self.send_response({'msg': 'posted'}, status=201) +``` + +正如我所说,这是我们所期望的: + +  * 与我们在 `get` 方法中看到的查询模式相同 +  * 构造一个新的 `Task` 对象的实例,用 `form_data` 的数据填充 +  * 添加新的 `Task` 对象(但不提交,因为它由上下文管理器处理!)到数据库会话 +  * 将响应发送给客户端 + +这样我们就有了 Tornado web 应用程序的基础。其他内容(例如,数据库管理和更多完整应用程序的视图)实际上与我们在 Flask 和 Pyramid 应用程序中看到的相同。 + +### 关于使用合适的工具完成合适的工作的一点想法 + +在我们继续浏览这些 Web 框架时,我们开始看到它们都可以有效地处理相同的问题。对于像这样的待办事项列表,任何框架都可以完成这项任务。但是,有些 Web 框架比其它框架更适合某些工作,这具体取决于对你来说什么“更合适”和你的需求。 + +虽然 Tornado 显然能够处理 Pyramid 或 Flask 可以处理的相同工作,但将它用于这样的应用程序实际上是一种浪费,这就像开车从家走一个街区(to 校正:这里意思应该是从家开始走一个街区只需步行即可)。是的,它可以完成“旅行”的工作,但短途旅行不是你选择汽车而不是自行车或者使用双脚的原因。 + +根据文档,Tornado 被称为 “Python Web 框架和异步网络库”。在 Python Web 框架生态系统中很少有人喜欢它。如果你尝试完成的工作需要(或将从中获益)以任何方式,形状或形式的异步性,使用 Tornado。如果你的应用程序需要处理多个长期连接,同时又不想牺牲太多性能,选择 Tornado。如果你的应用程序是多个应用程序,并且需要线程感知以准确处理数据,使用 Tornado。这是它最有效的地方。 + +用你的汽车做“汽车的事情”,使用其他交通工具做其他事情。 + +### 向前看,进行一些深度检查 + +谈到使用合适的工具来完成合适的工作,在选择框架时,请记住应用程序的范围和规模,包括现在和未来。到目前为止,我们只研究了适用于中小型 Web 应用程序的框架。本系列的下一篇也是最后一篇将介绍最受欢迎的 Python 框架之一 Django,它适用于可能会变得更大的大型应用程序。同样,尽管它在技术上能够并且将会处理待办事项列表问题,但请记住,这不是它的真正用途。我们仍然会通过它来展示如何使用它来构建应用程序,但我们必须牢记框架的意图以及它是如何反映在架构中的: + +  * **Flask:** 适用于小型,简单的项目。它可以使我们轻松地构建视图并将它们快速连接到路由,它可以简单地封装在一个文件中。 + +  * **Pyramid:** 适用于可能增长的项目。它包含一些配置来启动和运行。应用程序组件的独立领域可以很容易地划分并构建到任意深度,而不会忽略中央应用程序。 + +  * **Tornado:** 适用于受益于精确和有意识的 I/O 控制的项目。它允许协程,并轻松公开可以控制如何接收请求或发送响应以及何时发生这些操作的方法。 + +  * **Django:**(我们将会看到)意味着可能会变得更大的东西。它有着非常庞大的生态系统,包括大量插件和模块。它非常有主见的配置和管理,以保持所有不同部分在同一条线上。 + +无论你是从本系列的第一篇文章开始阅读,还是稍后才加入的,都要感谢阅读!请随意留下问题或意见。下次再见时,我手里会拿着 Django。 + +### 感谢 Python BDFL + +我必须把功劳归于它应得的地方,非常感谢 [Guido van Rossum][12],不仅仅是因为他创造了我最喜欢的编程语言。 + +在 [PyCascades 2018][13] 期间,我很幸运的不仅给了基于这个文章系列的演讲,而且还被邀请参加了演讲者的晚宴。整个晚上我都坐在 Guido 旁边,不停地问他问题。其中一个问题是,在 Python 中异步到底是如何工作的,但他没有一点大惊小怪,而是花时间向我解释,让我开始理解这个概念。他后来[推特给我][14]发了一条消息:是用于学习异步 Python 的广阔资源。我随后在三个月内阅读了三次,然后写了这篇文章。你真是一个非常棒的人,Guido! + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/18/6/tornado-framework + +作者:[Nicholas Hunt-Walker][a] +选题:[lujun9972][b] +译者:[MjSeven](https://github.com/MjSeven) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/nhuntwalker +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/article/18/5/pyramid-framework +[2]: https://opensource.com/article/18/4/flask +[3]: https://tornado.readthedocs.io/en/stable/ +[4]: https://realpython.com/python-gil/ +[5]: https://en.wikipedia.org/wiki/Thread_(computing) +[6]: https://www.nginx.com/ +[7]: https://tornado-sqlalchemy.readthedocs.io/en/latest/ +[8]: https://www.sqlalchemy.org/ +[9]: https://en.wikipedia.org/wiki/List_of_HTTP_status_codes#4xx_Client_errors +[10]: https://tornado-sqlalchemy.readthedocs.io/en/latest/#usage +[11]: https://pypi.org/project/tornado-sqlalchemy/#description +[12]: https://www.twitter.com/gvanrossum +[13]: https://www.pycascades.com +[14]: https://twitter.com/gvanrossum/status/956186585493458944 From b0ace68b4ced1c7fe6121af67f3924cc6a605f4a Mon Sep 17 00:00:00 2001 From: MjSeven Date: Sat, 19 Jan 2019 13:34:14 +0800 Subject: [PATCH 029/243] =?UTF-8?q?=E7=BF=BB=E8=AF=91=E4=B8=AD20190109=20U?= =?UTF-8?q?nderstaing...?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../tech/20190109 Understanding -etc-services file in Linux.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20190109 Understanding -etc-services file in Linux.md b/sources/tech/20190109 Understanding -etc-services file in Linux.md index 1b1028ca6d..071c4f7859 100644 --- a/sources/tech/20190109 Understanding -etc-services file in Linux.md +++ b/sources/tech/20190109 Understanding -etc-services file in Linux.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (MjSeven) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 4b54b1f5bc9fc3cc54f1f390d98f32cb67fa856b Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Sat, 19 Jan 2019 13:38:23 +0800 Subject: [PATCH 030/243] PRF:20171206 Getting started with Turtl, an open source alternative to Evernote.md @geekpi --- ... an open source alternative to Evernote.md | 28 ++++++++----------- 1 file changed, 12 insertions(+), 16 deletions(-) diff --git a/translated/tech/20171206 Getting started with Turtl, an open source alternative to Evernote.md b/translated/tech/20171206 Getting started with Turtl, an open source alternative to Evernote.md index 26b41ac1ac..c5603d219b 100644 --- a/translated/tech/20171206 Getting started with Turtl, an open source alternative to Evernote.md +++ b/translated/tech/20171206 Getting started with Turtl, an open source alternative to Evernote.md @@ -1,8 +1,10 @@ -开始使用 Turtl 这个 Evernote 的开源替代品 +Turtl:Evernote 的开源替代品 ====== +> 如果你正在寻找一个 Evernote 和 Google Keep 的替代品,那么 Turtl 是一个可靠的记笔记工具。 + ![Using Turtl as an open source alternative to Evernote](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/BUS_brainstorm_island_520px.png?itok=6IUPyxkY) -我认识的每个人都会记笔记,许多人使用在线笔记应用,如 Evernote、Simplenote 或 Google Keep。这些都是很好的工具,但你不得不担忧信息的安全性和隐私性 - 特别是考虑到 [Evernote 2016 年的隐私策略变更][1]。如果你想要更好地控制笔记和数据,你需要转向开源工具。 +我认识的每个人都会记笔记,许多人使用在线笔记应用,如 Evernote、Simplenote 或 Google Keep。这些都是很好的工具,但你不得不担忧信息的安全性和隐私性 —— 特别是考虑到 [Evernote 2016 年的隐私策略变更][1]。如果你想要更好地控制笔记和数据,你需要转向开源工具。 无论你离开 Evernote 的原因是什么,都有开源替代品。让我们来看看其中一个选择:Turtl。 @@ -10,30 +12,25 @@ [Turtl][2] 背后的开发人员希望你将其视为“具有绝对隐私的 Evernote”。说实话,我不能保证 Turtl 提供的隐私级别,但它是一个非常好的笔记工具。 -要开始使用 Turtl,[下载][3]适用于 Linux、Mac OS 或 Windows 的桌面客户端,或者获取 [Android 应用][4]。安装它,然后启动客户端或应用。系统会要求你输入用户名和密码。Turtl 使用密码来生成加密密钥,根据开发人员的说法,加密密钥会在将笔记存储在设备或服务器上之前对其进行加密。 +要开始使用 Turtl,[下载][3]适用于 Linux、Mac OS 或 Windows 的桌面客户端,或者获取它的 [Android 应用][4]。安装它,然后启动客户端或应用。系统会要求你输入用户名和密码。Turtl 使用密码来生成加密密钥,根据开发人员的说法,加密密钥会在将笔记存储在设备或服务器上之前对其进行加密。 ### 使用 Turtl 你可以使用 Turtl 创建以下类型的笔记: * 密码 - * 档案 - * 图片 - * 书签 - * 文字笔记 无论你选择何种类型的笔记,你都可以在类似的窗口中创建: - ![Create new text note with Turtl](https://opensource.com/sites/default/files/images/life-uploads/turtl-new-note-520.png) -在 Turtl 中创建新笔记 +*在 Turtl 中创建新笔记* -添加笔记标题,文字并(如果你正在创建文件或图像笔记)附加文件或图像等信息。然后单击“保存”。 +添加笔记标题、文字并(如果你正在创建文件或图像笔记)附加文件或图像等信息。然后单击“保存”。 你可以通过 [Markdown][6] 为你的笔记添加格式。因为没有工具栏快捷方式,所以你需要手动添加格式。 @@ -41,9 +38,9 @@ ![Create new board in Turtl](https://opensource.com/sites/default/files/images/life-uploads/turtl-boards-520.png) -在 Turtl 中创建新的白板 +*在 Turtl 中创建新的白板* -要向白板添加笔记,请创建或编辑笔记,然后单击笔记底部的“此笔记不在任何白板”的链接。选择一个或多个白板,然后单击“完成”。 +要向白板中添加笔记,请创建或编辑笔记,然后单击笔记底部的“此笔记不在任何白板”的链接。选择一个或多个白板,然后单击“完成”。 要为笔记添加标记,请单击记事本底部的“标记”图标,输入一个或多个以逗号分隔的关键字,然后单击“完成”。 @@ -57,14 +54,13 @@ Turtl 以平铺视图显示笔记,让人想起 Google Keep: - ![Notes in Turtl](https://opensource.com/sites/default/files/images/life-uploads/turtl-notes-520.png) -Turtl 中的一系列笔记 +*Turtl 中的一系列笔记* 无法在桌面或 Android 应用上将其更改为列表视图。这对我来说不是问题,但我听说有些人因为它没有列表视图而不喜欢 Turtl。 -说到 Android 应用,它并不坏。但是,它没有与 Android 共享菜单集成。如果你想把在其他应用中看到或阅读的内容添加到 Turtl 笔记中,则需要手动复制并粘贴。 +说到 Android 应用,它并不差。但是,它没有与 Android 共享菜单集成。如果你想把在其他应用中看到或阅读的内容添加到 Turtl 笔记中,则需要手动复制并粘贴。 我已经在我的 Linux 笔记本,[运行 GalliumOS 的 Chromebook][10],还有一台 Android 手机上使用 Turtl 几个月了。对所有这些设备来说这都是一种非常无缝的体验。虽然它不是我最喜欢的开源笔记工具,但 Turtl 做得非常好。试试看它,它可能是你正在寻找的简单的笔记工具。 @@ -74,7 +70,7 @@ via: https://opensource.com/article/17/12/using-turtl-open-source-alternative-ev 作者:[Scott Nesbitt][a] 译者:[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/) 荣誉推出 From 3a9d848586896c5daec7c450fe9968c79ce8c9ad Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Sat, 19 Jan 2019 13:38:44 +0800 Subject: [PATCH 031/243] PUB:20171206 Getting started with Turtl, an open source alternative to Evernote.md @geekpi https://linux.cn/article-10457-1.html --- ... started with Turtl, an open source alternative to Evernote.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {translated/tech => published}/20171206 Getting started with Turtl, an open source alternative to Evernote.md (100%) diff --git a/translated/tech/20171206 Getting started with Turtl, an open source alternative to Evernote.md b/published/20171206 Getting started with Turtl, an open source alternative to Evernote.md similarity index 100% rename from translated/tech/20171206 Getting started with Turtl, an open source alternative to Evernote.md rename to published/20171206 Getting started with Turtl, an open source alternative to Evernote.md From b49587c21cd57584a91af7ea9387e421a35e7933 Mon Sep 17 00:00:00 2001 From: MjSeven Date: Sat, 19 Jan 2019 14:57:57 +0800 Subject: [PATCH 032/243] =?UTF-8?q?=E7=BF=BB=E8=AF=91=E5=AE=8C=E6=88=90=20?= =?UTF-8?q?20190109=20Understanding...?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...derstanding -etc-services file in Linux.md | 36 +++++++++---------- 1 file changed, 17 insertions(+), 19 deletions(-) rename {sources => translated}/tech/20190109 Understanding -etc-services file in Linux.md (50%) diff --git a/sources/tech/20190109 Understanding -etc-services file in Linux.md b/translated/tech/20190109 Understanding -etc-services file in Linux.md similarity index 50% rename from sources/tech/20190109 Understanding -etc-services file in Linux.md rename to translated/tech/20190109 Understanding -etc-services file in Linux.md index 071c4f7859..dedbca16e2 100644 --- a/sources/tech/20190109 Understanding -etc-services file in Linux.md +++ b/translated/tech/20190109 Understanding -etc-services file in Linux.md @@ -7,46 +7,44 @@ [#]: via: (https://kerneltalks.com/linux/understanding-etc-services-file-in-linux/) [#]: author: (kerneltalks https://kerneltalks.com) -Understanding /etc/services file in Linux +理解 Linux 中的 /etc/services 文件 ====== -Article which helps you to understand /etc/services file in Linux. Learn about content, format & importance of this file. +这篇文章将帮助你了解 Linux 中 /etc/services 文件,包括它的内容,格式以及重要性。 ![/etc/services file in Linux][1] -/etc/services file in Linux +Linux 中的 /etc/services 文件 -Internet daemon is important service in Linux world. It takes care of all network services with the help of `/etc/services` file. In this article we will walk you through content, format of this file and what it means to a Linux system. +网络守护程序是 Linux 世界中的重要服务。它借助 `/etc/services` 文件来处理所有网络服务。在本文中,我们将向你介绍这个文件的内容,格式以及它对于 Linux 系统的意义。 -`/etc/services` file contains list of network services and ports mapped to them. `inetd` or `xinetd` looks at these details so that it can call particular program when packet hits respective port and demand for service. +`/etc/services` 文件包含网络服务和它们映射端口的列表。`inetd` 或 `xinetd` 会查看这些细节,以便在数据包到达各自的端口或服务有需求时,它会调用特定的程序。 -As a normal user you can view this file since file is world readable. To edit this file you need to have root privileges. +作为普通用户,你可以查看此文件,因为文件一般都是可读的。要编辑此文件,你需要有 root 权限。 ``` $ ll /etc/services -rw-r--r--. 1 root root 670293 Jun 7 2013 /etc/services ``` -### `/etc/services` file format +### `/etc/services` 文件格式 ``` service-name port/protocol [aliases..] [#comment] ``` -Last two fields are optional hence denoted in `[` `]` +最后两个字段是可选的,因此用 `[` `]` 表示。 -where – +其中: - * service-name is name of the network service. e.g. [telnet][2], [ftp][3] etc. - * port/protocol is port being used by that network service (numerical value) and protocol (TCP/UDP) used for communication by service. - * alias is alternate name for service. - * comment is note or description you can add to service. Starts with `#` mark + * service-name 是网络服务的名称。例如 [telnet][2], [ftp][3] 等。 + * port/protocol 是网络服务使用的端口(一个数值)和服务通信使用的协议(TCP/UDP)。 + * alias 是服务的别名。 + * comment 是你可以添加到服务的注释或说明。以 `#` 标记开头。 - - -### Sample` /etc/services` file +### `/etc/services` 文件示例 ``` -# Each line describes one service, and is of the form: +# 每行描述一个服务,形式如下: # # service-name port/protocol [aliases ...] [# comment] @@ -56,7 +54,7 @@ echo 7/udp discard 9/udp sink null ``` -Here, you can see use of optional last two fields as well. `discard` service has alternate name as `sink` or `null`. +在这里,你可以看到可选的最后两个字段的用处。`discard` 服务的别名为 `sink` 或 `null`。 -------------------------------------------------------------------------------- @@ -64,7 +62,7 @@ via: https://kerneltalks.com/linux/understanding-etc-services-file-in-linux/ 作者:[kerneltalks][a] 选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) +译者:[MjSeven](https://github.com/MjSeven) 校对:[校对者ID](https://github.com/校对者ID) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 7fbd105b536db2b73aa65fbaeebdf5c5e716a908 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Sat, 19 Jan 2019 16:36:50 +0800 Subject: [PATCH 033/243] PRF:20120201 Computer Laboratory - Raspberry Pi- Lesson 1 OK01.md @qhwdw --- ...1 Computer Laboratory - Raspberry Pi- Lesson 1 OK01.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/translated/tech/20120201 Computer Laboratory - Raspberry Pi- Lesson 1 OK01.md b/translated/tech/20120201 Computer Laboratory - Raspberry Pi- Lesson 1 OK01.md index 7285df6160..db6bfda5ac 100644 --- a/translated/tech/20120201 Computer Laboratory - Raspberry Pi- Lesson 1 OK01.md +++ b/translated/tech/20120201 Computer Laboratory - Raspberry Pi- Lesson 1 OK01.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (qhwdw) [#]: reviewer: (wxy) -[#]: publisher: () -[#]: url: () +[#]: publisher: ( ) +[#]: url: ( ) [#]: subject: (Computer Laboratory – Raspberry Pi: Lesson 1 OK01) [#]: via: (https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/ok01.html) [#]: author: (Robert Mullins http://www.cl.cam.ac.uk/~rdm34) @@ -199,12 +199,12 @@ b loop$ [^1]: 是的,我说错了,它告诉的是链接器,它是另一个程序,用于将汇编器转换过的几个代码文件链接到一起。直接说是汇编器也没有大问题。 [^2]: 其实它们对你很重要。由于 GNU 工具链主要用于开发操作系统,它要求入口点必须是名为 `_start` 的地方。由于我们是开发一个操作系统,无论什么时候,它总是从 `_start` 开时的,而我们可以使用 `.section .init` 命令去设置它。因此,如果我们没有告诉它入口点在哪里,就会使工具链困惑而产生警告消息。所以,我们先定义一个名为 `_start` 的符号,它是所有人可见的(全局的),紧接着在下一行生成符号 `_start` 的地址。我们很快就讲到这个地址了。 [^3]: 本教程的设计减少了你阅读树莓派开发手册的难度,但是,如果你必须要阅读它,你可以在这里 [SoC-Peripherals.pdf](https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/downloads/SoC-Peripherals.pdf) 找到它。由于添加了混淆,手册中 GPIO 使用了不同的地址系统。我们的操作系统中的地址 0x20200000 对应到手册中是 0x7E200000。 -[^4]: mov 能够加载的值只有前 8 位是 1s 的二进制表示的值。换句话说就是一个 0s 后面紧跟着 8 个 1s 或 0s。 +[^4]: `mov` 能够加载的值只有前 8 位是 `1` 的二进制表示的值。换句话说就是一个 0 后面紧跟着 8 个 `1` 或 `0`。 [^5]: 一个很友好的硬件工程师是这样向我解释这个问题的: 原因是现在的芯片都是用一种称为 CMOS 的技术来制成的,它是互补金属氧化物半导体的简称。互补的意思是每个信号都连接到两个晶体管上,一个是使用 N 型半导体的材料制成,它用于将电压拉低,而另一个使用 P 型半导体材料制成,它用于将电压升高。在任何时刻,仅有一个半导体是打开的,否则将会短路。P 型材料的导电性能不如 N 型材料。这意味着三倍大的 P 型半导体材料才能提供与 N 型半导体材料相同的电流。这就是为什么 LED 总是通过降低为低电压来打开它,因为 N 型半导体拉低电压比 P 型半导体拉高电压的性能更强。 - 还有一个原因。早在上世纪七十年代,芯片完全是由 N 型材料制成的(NMOS),P 型材料部分使用了一个电阻来代替。这意味着当信号为低电压时,即便它什么事都没有做,芯片仍然在消耗能量(并发热)。你的电话装在口袋里什么事都不做,它仍然会发热并消耗你的电池电量,这不是好的设计。因此,信号设计成 'active low',而不活动时为高电压,这样就不会消耗能源了。虽然我们现在已经不使用 NMOS 了,但由于 N 型材料的低电压信号比 P 型材料的高电压信号要快,所以仍然使用了这种设计。通常在一个 'active low' 信号名字上方会有一个条型标记,或者写作 SIGNAL_n 或 /SIGNAL。但是即便这样,仍然很让人困惑,那怕是硬件工程师,也不可避免这种困惑! + 还有一个原因。早在上世纪七十年代,芯片完全是由 N 型材料制成的(NMOS),P 型材料部分使用了一个电阻来代替。这意味着当信号为低电压时,即便它什么事都没有做,芯片仍然在消耗能量(并发热)。你的电话装在口袋里什么事都不做,它仍然会发热并消耗你的电池电量,这不是好的设计。因此,信号设计成 “活动时低”,而不活动时为高电压,这样就不会消耗能源了。虽然我们现在已经不使用 NMOS 了,但由于 N 型材料的低电压信号比 P 型材料的高电压信号要快,所以仍然使用了这种设计。通常在一个 “活动时低” 信号名字上方会有一个条型标记,或者写作 `SIGNAL_n` 或 `/SIGNAL`。但是即便这样,仍然很让人困惑,那怕是硬件工程师,也不可避免这种困惑! -------------------------------------------------------------------------------- From bfbe4767eff8913aa0d3561e6d9f8f8776a039d7 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Sat, 19 Jan 2019 16:37:24 +0800 Subject: [PATCH 034/243] PUB:20120201 Computer Laboratory - Raspberry Pi- Lesson 1 OK01.md @qhwdw https://linux.cn/article-10458-1.html --- ...20201 Computer Laboratory - Raspberry Pi- Lesson 1 OK01.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20120201 Computer Laboratory - Raspberry Pi- Lesson 1 OK01.md (99%) diff --git a/translated/tech/20120201 Computer Laboratory - Raspberry Pi- Lesson 1 OK01.md b/published/20120201 Computer Laboratory - Raspberry Pi- Lesson 1 OK01.md similarity index 99% rename from translated/tech/20120201 Computer Laboratory - Raspberry Pi- Lesson 1 OK01.md rename to published/20120201 Computer Laboratory - Raspberry Pi- Lesson 1 OK01.md index db6bfda5ac..3daab0f235 100644 --- a/translated/tech/20120201 Computer Laboratory - Raspberry Pi- Lesson 1 OK01.md +++ b/published/20120201 Computer Laboratory - Raspberry Pi- Lesson 1 OK01.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (qhwdw) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-10458-1.html) [#]: subject: (Computer Laboratory – Raspberry Pi: Lesson 1 OK01) [#]: via: (https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/ok01.html) [#]: author: (Robert Mullins http://www.cl.cam.ac.uk/~rdm34) From a444639afa7e9e9139006897accb82f388e1291f Mon Sep 17 00:00:00 2001 From: MjSeven Date: Sat, 19 Jan 2019 15:55:23 +0800 Subject: [PATCH 035/243] MjSeven is translating 20190114 How To Move Mul... --- ... Move Multiple File Types Simultaneously From Commandline.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20190114 How To Move Multiple File Types Simultaneously From Commandline.md b/sources/tech/20190114 How To Move Multiple File Types Simultaneously From Commandline.md index 1b342b12ef..dd135f20e0 100644 --- a/sources/tech/20190114 How To Move Multiple File Types Simultaneously From Commandline.md +++ b/sources/tech/20190114 How To Move Multiple File Types Simultaneously From Commandline.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (MjSeven) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 9e6c89cb1cf0954850d060ab69050fe307b3151d Mon Sep 17 00:00:00 2001 From: qhwdw <33189910+qhwdw@users.noreply.github.com> Date: Sat, 19 Jan 2019 17:11:46 +0800 Subject: [PATCH 036/243] Translated by qhwdw --- ...aboratory - Raspberry Pi- Lesson 2 OK02.md | 68 ------------------ ...aboratory - Raspberry Pi- Lesson 2 OK02.md | 70 +++++++++++++++++++ 2 files changed, 70 insertions(+), 68 deletions(-) delete mode 100644 sources/tech/20120202 Computer Laboratory - Raspberry Pi- Lesson 2 OK02.md create mode 100644 translated/tech/20120202 Computer Laboratory - Raspberry Pi- Lesson 2 OK02.md diff --git a/sources/tech/20120202 Computer Laboratory - Raspberry Pi- Lesson 2 OK02.md b/sources/tech/20120202 Computer Laboratory - Raspberry Pi- Lesson 2 OK02.md deleted file mode 100644 index fbdba984c3..0000000000 --- a/sources/tech/20120202 Computer Laboratory - Raspberry Pi- Lesson 2 OK02.md +++ /dev/null @@ -1,68 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (qhwdw) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Computer Laboratory – Raspberry Pi: Lesson 2 OK02) -[#]: via: (https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/ok02.html) -[#]: author: (Robert Mullins http://www.cl.cam.ac.uk/~rdm34) - -Computer Laboratory – Raspberry Pi: Lesson 2 OK02 -====== - -The OK02 lesson builds on OK01, by causing the 'OK' or 'ACT' LED to turn on and off repeatedly. It is assumed you have the code for the [Lesson 1: OK01][1] operating system as a basis. - -### 1 Waiting - -Waiting is a surprisingly useful part of Operating System development. Often Operating Systems find themselves with nothing to do, and must delay. In this example, we wish to do so in order to allow the LED flashing off and on to be visible. If you just turned it off and on, it would not be visible, as the computer would be able to turn it off and on many thousands of times per second. In later lessons we will look at accurate waiting, but for now it is sufficient to simply waste time. - -``` -mov r2,#0x3F0000 -wait1$: -sub r2,#1 -cmp r2,#0 -bne wait1$ -``` - -``` -sub reg,#val subtracts the number val from the value in reg. - -cmp reg,#val compares the value in reg with the number val. - -Suffix ne causes the command to be executed only if the last comparison determined that the numbers were not equal. -``` - -The code above is a generic piece of code that creates a delay, which thanks to every Raspberry Pi being basically the same, is roughly the same time. How it does this is using a mov command to put the value 3F000016 into r2, and then subtracting 1 from this value until it is 0. The new commands here are sub, cmp, and bne. - -sub is the subtract command, and simply subtracts the second argument from the first. - -cmp is a more interesting command. It compares the first argument with the second, and remembers the result of the comparison in a special register called the current processor status register. You don't really need to worry about this, suffice to say it remembers, among other things, which of the two numbers was bigger or smaller, or if they were equal.[1] - -bne is actually just a branch command in disguise. In the ARM assembly language family, any instruction can be executed conditionally. This means that the instruction is only run if the last comparison had a certain result. We will use this extensively later for interesting tricks, but in this case we use the ne suffix on the b command to mean 'only branch if the last comparison's result was that the values were not equal'. The ne suffix can be used on any command, as can several other (16 in all) conditions such as eq for equal and lt for less than. - -### 2 The All Together - -I mentioned briefly last time that the status LED can be turned off again by writing to an offset of 28 from the GPIO controller instead of 40 (i.e. str r1,[r0,#28]). Thus, you need to modify the code from OK01 to turn the LED on, run the wait code, turn it off, run the wait code again, and then include a branch back to the beginning. Note, it is not necessary to re-enable the output to GPIO 16, we need only do that once. If you're being efficient, which I strongly encourage, you should be able to reuse the value of r1. As with all lessons, a full solution to this can be found on the [download page][2]. Be careful to make sure all of your labels are unique. When you write wait1$: you cannot label another line wait1$. - -On my Raspberry Pi it flashes about twice a second. this could easily be altered by changing the value we set r2 to. However, unfortunately we can't precisely predict the speed this runs at. If you didn't manage to get this working see our trouble shooting page, otherwise, congratulations. - -In this lesson we've learnt two more assembly commands, sub and cmp, as well as learning about conditional execution in ARM. - -In the next lesson, [Lesson 3: OK03][3] we will evaluate how we're coding, and establish some standards so that we can reuse code, and if necessary, work with C or C++ code. - --------------------------------------------------------------------------------- - -via: https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/ok02.html - -作者:[Robert Mullins][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: http://www.cl.cam.ac.uk/~rdm34 -[b]: https://github.com/lujun9972 -[1]: https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/ok01.html -[2]: https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/downloads.html -[3]: https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/ok03.html diff --git a/translated/tech/20120202 Computer Laboratory - Raspberry Pi- Lesson 2 OK02.md b/translated/tech/20120202 Computer Laboratory - Raspberry Pi- Lesson 2 OK02.md new file mode 100644 index 0000000000..29fa885a4f --- /dev/null +++ b/translated/tech/20120202 Computer Laboratory - Raspberry Pi- Lesson 2 OK02.md @@ -0,0 +1,70 @@ +[#]: collector: (lujun9972) +[#]: translator: (qhwdw) +[#]: reviewer: () +[#]: publisher: () +[#]: url: () +[#]: subject: (Computer Laboratory – Raspberry Pi: Lesson 2 OK02) +[#]: via: (https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/ok02.html) +[#]: author: (Robert Mullins http://www.cl.cam.ac.uk/~rdm34) + +计算机实验室 – 树莓派:课程 2 OK02 +====== + +OK02 课程是在 OK01 课程的基础上构建,通过不停地打开和关闭 `OK` 或 `ACT` LED 指示灯来实现闪烁。假设你已经有了 [课程 1:OK01][1] 操作系统的代码,它将是这一节课的基础。 + +### 1、等待 + +等待是操作系统开发中非常有用的部分。操作系统经常发现自己无事可做,以及必须要延迟。在这个例子中,我们想去做等待,为了能够让这种等待可以看得见,让 LED 灯打开关闭闪烁起来。如果你只是打开和关闭它,你什么都看不到,因为计算机每秒种可以打开和关闭它好几千次。在后面的课程中,我们将看到精确的等待,但是现在,我们只要简单地去消耗时间就足够了。 + +``` +mov r2,#0x3F0000 +wait1$: +sub r2,#1 +cmp r2,#0 +bne wait1$ +``` + +``` +sub reg,#val 从寄存器 reg 中的值上减去数字 val + +cmp reg,#val 将寄存器中的值与数字 val 进行比较。 + +如果最后的比较结果是不相等,那么执行后面的 ne 命令。 +``` + +上面是一个很常见的产生延迟的代码片段,由于每个树莓派基本上是相同的,所以产生的延迟大致也是相同的。它的工作原理是,使用一个 `mov` 命令将值 3F000016 推入到寄存器 r2 中,然后将这个值减 1,直到这个值减到 0 为止。在这里使用了三个新命令 `sub`、 `cmp` 和 `bne`。 + +`sub` 是减法命令,它只是简单地从第一个参数中的值减去第二个参数中的值。 + +`cmp` 是个很有趣的命令。它将第一个参数与第二个参数进行比较,然后将比较结果记录到一个称为当前处理器状态寄存器的专用寄存器中。你其实不用担心它,它记住的只是两个数谁大或谁小,或是相等而已。[^1] + +`bne` 其实是一个伪装的分支命令。在 ARM 汇编语言家族中,任何指令都可以有条件运行。这意味着如果上一个比较结果是某个确定的结果,那个指令才会运行。这是个非常有意思的技巧,我们在后面将大量使用到它,但在本案例中,我们在 `b` 命令后面的 ne 后缀意思是 “只有在上一个比较的结果是值不相等,才去运行分支”。`ne` 后缀可以使用在任何命令上,其它几个(总共 16 个)条件也是如此,比如 `eq` 表示等于,而 `lt` 表示小于。 + +### 2、组合到一起 + +上一节讲我提到过,通过将 GPIO 地址偏移量设置为 28(即:str r1,[r0,#28])而不是 40 即可实现 LED 的关闭。因此,你需要去修改课程 OK01 的代码,在打开 LED 后,运行等待代码,然后再关闭 LED,再次运行等待代码,并包含一个回到开始位置的分支。注意,不需要重新启用 GPIO 的 16 号针脚的输出功能,这个操作只需要做一次就可以了。如果你想更高效,我建议你复用 r1 寄存器的值。所有课程都一样,你可以在 [下载页面][2] 找到所有的解决方案。需要注意的是,必须保证你的所有标签都是唯一的。当你写了 wait1\$: 你其它行上的标签就不能再使用 wait1\$ 了。 + +在我的树莓派上,它大约是每秒闪两次。通过改变我们所设置的 r2 寄存器中的值,可以很轻松地修改它。但是,不幸的是,我不能够精确地预测它的运行速度。如果你的树莓派未按预期正常工作,请查看我们的故障排除页面,如果它正常工作,恭喜你。 + +在这个课程中,我们学习了另外两个汇编命令:`sub` 和 `cmp`,同时学习了 ARM 中如何实现有条件运行。 + +在下一个课程,[课程 3:OK03][3] 中我们将学习如何编写代码,以及建立一些代码复用的标准,并且如果需要的话,可能会使用 C 或 C++ 来写代码。 + +[^1]:如果你点了这个链接,说明你一定想知道它的具体内容。CPSR 是一个由许多独立的比特位组成的 32 比特寄存器。它有一个位用于表示正数、零和负数。当一个 cmp 指令运行后,它从第一个参数上减去第二个参数,然后用这个位记下它的结果是正数、零还是负数。如果是零意味着它们相等(a-b=0 暗示着 a=b)如果为正数意味着 a 大于 b(a-b>0 暗示着 a>b),如果为负数意味着小于。还有其它比较指令,但 cmp 指令最直观。 + +-------------------------------------------------------------------------------- + +via: https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/ok02.html + +作者:[Robert Mullins][a] +选题:[lujun9972][b] +译者:[qhwdw](https://github.com/qhwdw) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: http://www.cl.cam.ac.uk/~rdm34 +[b]: https://github.com/lujun9972 +[1]: https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/ok01.html +[2]: https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/downloads.html +[3]: https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/ok03.html From af89eac88312eb054a9641718b223a21b07edda3 Mon Sep 17 00:00:00 2001 From: qhwdw <33189910+qhwdw@users.noreply.github.com> Date: Sat, 19 Jan 2019 17:44:49 +0800 Subject: [PATCH 037/243] Translating by qhwdw --- sources/tech/20190114 How to Build a Netboot Server, Part 4.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20190114 How to Build a Netboot Server, Part 4.md b/sources/tech/20190114 How to Build a Netboot Server, Part 4.md index aadd3c0b01..3b5286df03 100644 --- a/sources/tech/20190114 How to Build a Netboot Server, Part 4.md +++ b/sources/tech/20190114 How to Build a Netboot Server, Part 4.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (qhwdw) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From fe05ce92b863bfae22ea6f3148fdb8df66063c98 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Sat, 19 Jan 2019 21:52:56 +0800 Subject: [PATCH 038/243] PRF:20171119 The Ruby Story.md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @wwhio 我做了一个初校,请复审看看是否有问题。 --- translated/talk/20171119 The Ruby Story.md | 63 +++++++++++----------- 1 file changed, 33 insertions(+), 30 deletions(-) diff --git a/translated/talk/20171119 The Ruby Story.md b/translated/talk/20171119 The Ruby Story.md index bf370f00e6..b0eb05d447 100644 --- a/translated/talk/20171119 The Ruby Story.md +++ b/translated/talk/20171119 The Ruby Story.md @@ -1,19 +1,19 @@ -The Ruby Story +红宝石(Ruby)史话 ====== -尽管我很难说清楚为什么,但 Ruby 一直是我最喜爱的一门编程语言。如果用音乐来类比的话,Python 给我的感觉像是朋克摇滚punk rock,简单、直接,但略显单调,而 Ruby 则像是爵士乐,赋予了程序员灵活的表达freedom to express,虽然这可能会让代码变复杂、程序不直观。 -Ruby 社区一直将灵活表达freedom of expression视为其核心价值。可我不认同这对于 Ruby 的开发和普及是最重要的。一个人创建一门编程语言也许是为了更高的性能,也许是为了在抽象上节省更多的时间,可 Ruby 就有趣在它并不关心这些,从它诞生之初,它的目标就是让程序员更快乐。 +尽管我很难说清楚为什么,但 Ruby 一直是我最喜爱的一门编程语言。如果用音乐来类比的话,Python 给我的感觉像是朋克摇滚punk rock,简单、直接,但略显单调,而 Ruby 则像是爵士乐,赋予了程序员表达自我的根本自由,虽然这可能会让代码变复杂,编写出来的程序对其他人来说不直观。 -### 松本 行弘 +Ruby 社区一直将灵活表达freedom of expression视为其核心价值。可我不认同这对于 Ruby 的开发和普及是最重要的。创建一门编程语言也许是为了更高的性能,也许是为了在抽象上节省更多的时间,可 Ruby 就有趣在它并不关心这些,从它诞生之初,它的目标就是让程序员更快乐。 -松本行弘Yukihiro Matsumoto,也叫 “Matz”,于 1990 年毕业于筑波大学。筑波是东京东北方向上的一个小城市,是科学研究与技术开发的中心之一。那里的筑波大学以其 STEM 计划广为流传。松本行弘就在筑波大学的信息科学专业学习过,且专攻编程语言。他也在 Ikuo Nakata 的编程语言实验室工作过。 -(LCTT译注:STEM是科学(Science),技术(Technology),工程(Engineering),数学(Mathematics)四门学科英文首字母的缩写。) +### 松本·行弘 + +松本·行弘Yukihiro Matsumoto,亦称为 “Matz”,于 1990 年毕业于筑波大学。筑波是东京东北方向上的一个小城市,是科学研究与技术开发的中心之一。筑波大学以其 STEM 计划广为流传。松本·行弘在筑波大学的信息科学专业学习过,且专攻编程语言。他也在 Ikuo Nakata 的编程语言实验室工作过。(LCTT 译注:STEM 是科学Science技术Technology工程Engineering数学Mathematics四门学科英文首字母的缩写。) 松本从 1993 年开始制作 Ruby,那时他才刚毕业几年。他制作 Ruby 的起因是觉得那时的脚本语言缺乏一些特性。他在使用 Perl 的时候觉得这门语言过于“玩具”,此外 Python 也有点弱,用他自己的话说: -> 我那时就知道 Python 了,但我不喜欢它,因为我认为这不是一门真正的面向对象的语言。面向对象就像是 Python 的一个附件。作为一个编程语言狂热者,我在 15 年里一直是面向对象的忠实粉丝。我真的想要一门生来就面向对象而且易用的脚本语言。我为此特地寻找过,可事实并不如愿。 +> 我那时就知道 Python 了,但我不喜欢它,因为我认为它不是一门真正的面向对象的语言。面向对象就像是 Python 的一个附件。作为一个编程语言狂热者,我在 15 年里一直是面向对象的忠实粉丝。我真的想要一门生来就面向对象而且易用的脚本语言。我为此特地寻找过,可事实并不如愿。[^1] -所以一种解释松本创造 Ruby 的动机就是他想要创造一门更好的,而且面向对象的 Perl 版本。 +所以一种解释松本创造 Ruby 的动机就是他想要创造一门更好的,而且面向对象版的 Perl。 但在其他场合,松本说他创造 Ruby 主要是为了让他自己和别人更快乐。2008 年,松本在谷歌技术讲座结束时放映了这张幻灯片: @@ -21,50 +21,53 @@ Ruby 社区一直将灵活表达freedom of expression视 他对听众说到, -> 我希望 Ruby 能帮助世界上的每一个程序员更有效率地工作,享受编程并感到快乐。这也是制作 Ruby 语言的主要意图。 +> 我希望 Ruby 能帮助世界上的每一个程序员更有效率地工作,享受编程并感到快乐。这也是制作 Ruby 语言的主要意图。[^2] -松本开玩笑的说他制作 Ruby 的原因很自私,因为他觉得其他的语言乏味,所以需要创造一点让自己开心的东西。 +松本开玩笑的说他制作 Ruby 的原因很自私,因为他觉得其它的语言乏味,所以需要创造一点让自己开心的东西。 -这张幻灯片展现了松本谦虚的一面。其实,松本是一位摩门教徒,因此我很好奇他传奇般的友善有多少归功于他的宗教信仰。无论如何,他的友善在 Ruby 社区广为流传,甚至有一条称为 MINASWAN 的原则,即“松本人很好,我们也一样Matz Is Nice And So We Are Nice”。我想那张幻灯片一定震惊了来自 Google 的观众。我想谷歌技术讲座上的每张幻灯片都充满着代码和运行效率的指标,来说明一个方案比另一个更快更有效,可仅仅放映崇高的目标的幻灯片却寥寥无几。 +这张幻灯片展现了松本谦虚的一面。其实,松本是一位摩门教徒践行者,因此我很好奇他传奇般的友善有多少归功于他的宗教信仰。无论如何,他的友善在 Ruby 社区广为流传,甚至有一条称为 MINASWAN 的原则,即“松本人很好,我们也一样Matz Is Nice And So We Are Nice”。我想那张幻灯片一定震惊了来自 Google 的观众。我想谷歌技术讲座上的每张幻灯片都充满着代码和运行效率的指标,来说明一个方案比另一个更快更有效,可仅仅放映崇高的目标的幻灯片却寥寥无几。 -Ruby 主要受到 Perl 的印象。Perl 则是由 Larry Wall 与 20 世纪 80 年代晚期创造的语言,主要用于处理和转换基于文本的数据。Perl 因其文本处理和正则表达式而闻名于世。对于 Ruby 程序员,Perl 程序中的很多语法元素都不陌生,例如符号`$`、符号`@`、`elsif`等等。虽然我觉得,这些不是 Ruby 应该具有的特征。除了这些符号外,Ruby 还借鉴了 Perl 中的正则表达式和标准库。 +Ruby 主要受到 Perl 的影响。Perl 则是由 Larry Wall 于 20 世纪 80 年代晚期创造的语言,主要用于处理和转换基于文本的数据。Perl 因其文本处理和正则表达式而闻名于世。对于 Ruby 程序员,Perl 程序中的很多语法元素都不陌生,例如符号 `$`、符号 `@`、`elsif` 等等。虽然我觉得,这些不是 Ruby 应该具有的特征。除了这些符号外,Ruby 还借鉴了 Perl 中的正则表达式的处理和标准库。 -但影响了 Ruby 的不仅仅只有 Perl 。在 Ruby 之前松本使用过运行在 Emacs Lisp 上的邮件客户端。这一经历让他对 Emacs 和 Lisp 语言运行的内部原理有了更多的认识。松本说 Ruby 的对象模型也受其启发。在那之上,松本添加了一个 Smalltalk 风格的信息传递系统,这一系统随后成为了 Ruby 中任何依赖 `#method_missing` 的操作的基石。松本说 Ada 和 Eiffel 也影响了 Ruby 的设计。 +但影响了 Ruby 的不仅仅只有 Perl 。在 Ruby 之前松本就完全用 Emacs Lisp 写过一个邮件客户端。这一经历让他对 Emacs 和 Lisp 语言运行的内部原理有了更多的认识。松本说 Ruby 底层的对象模型也受其启发。在那之上,松本添加了一个 Smalltalk 风格的信息传递系统,这一系统随后成为了 Ruby 中任何依赖 `#method_missing` 的操作的基石。松本也表示过 Ada 和 Eiffel 也影响了 Ruby 的设计。 -当时间来到了给这门新语言命名的时候,松本和它的同事 Keiju Ishitsuka 挑选了很多个名字。他们希望名字能够体现新语言和 Perl、shell 脚本间的联系。在[这一段聊天记录][2]中,Ishitsuka 和 松本也许花了太多的时间来思考 shell贝壳clam蛤蛎oyster牡蛎pearl珍珠之间的关系了,以至于差点把 Ruby 命名为“Coral珊瑚虫”或“Bisque贝类浓汤”。幸好,他们决定使用 Ruby ,因为他就像 pearl 一样,是一种珍贵的宝石。此外,Ruby红宝石 还是 7 月的诞生石,而 Peral珍珠 则是 6 月的诞生石,采用了类似 C++ 和 C# 的隐喻,暗示着她们是改进自前辈的编程语言。 -(LCTT译注:Perl 和 Pearl 发音相同;shell 是操作系统提供的用户界面,这里指的是命令行界面;更多有关诞生石的[信息](https://zh.wikipedia.org/zh-hans/%E8%AA%95%E7%94%9F%E7%9F%B3)。) +当时间来到了给这门新语言命名的时候,松本和他的同事 Keiju Ishitsuka 挑选了很多个名字。他们希望名字能够体现新语言和 Perl、shell 脚本间的联系。在[这一段非常值得一读的即时消息记录][2]中,Ishitsuka 和 松本也许花了太多的时间来思考 shell贝壳clam蛤蛎oyster牡蛎pearl珍珠之间的关系了,以至于差点把 Ruby 命名为“Coral珊瑚虫”或“Bisque贝类浓汤”。幸好,他们决定使用 Ruby,因为它就像 pearl 一样,是一种珍贵的宝石。此外,Ruby红宝石 还是 7 月的生辰石,而 Pearl珍珠 则是 6 月的生辰石,采用了类似 C++ 和 C# 的隐喻,暗示着她们是改进自前辈的编程语言。(LCTT 译注:Perl 和 Pearl 发音相同,所以也常以“珍珠”来借喻 Perl;shell 是操作系统提供的用户界面,这里指的是命令行界面;更多有关生辰石的[信息](https://zh.wikipedia.org/zh-hans/%E8%AA%95%E7%94%9F%E7%9F%B3)。) -### Ruby 走向西方 +### Ruby 西渐 -Ruby 在日本的普及很快。1995 年 Ruby 刚刚发布后不久后,松本就被一家名为 Netlab 的日本软件咨询基团(全名 Network Applied Communication Laboratory)雇用,并全职为 Ruby 工作。到 2000 年时,仅仅在 Ruby 发布 5 年后,Ruby 在日本的流行度就超过了 Python。可这是的 Ruby 从刚刚进入英语国家。虽然从 Ruby 的诞生之初就存在日语邮件的列表,但是英语邮件的列表直到 1998 年才建立起来。而且起初在英语邮件的列表里交流的大多是日本的 Ruby 狂热者,但这一问题随着 Ruby 在西方国家的普及而逐渐得以改善。 +Ruby 在日本的普及很快。1995 年 Ruby 刚刚发布后不久后,松本就被一家名为 Netlab 的日本软件咨询财团(全名 Network Applied Communication Laboratory)雇用,并全职为 Ruby 工作。到 2000 年时,在 Ruby 发布仅仅 5 年后,Ruby 在日本的流行度就超过了 Python。可这时的 Ruby 才刚刚进入英语国家。虽然从 Ruby 的诞生之初就存在讨论它的日语邮件列表,但是英语的邮件列表直到 1998 年才建立起来。而且起初英语的邮件列表是用于日本的 Ruby 狂热者用英语交流的,但这一情况随着 Ruby 的普及而逐渐得以改变。 -在 2000 年,Dave Thomas 出版了第一本涵盖 Ruby 的英文书籍《Programming Ruby》。因为它的封面上画着一把锄头,所以这本书也被称为锄头书。是它第一次向身处西方的程序员们介绍了 Ruby。就像在日本那样,Ruby 的普及很快,到 2002 年时,英语邮件列表的流量超过了日语邮件列表。 +在 2000 年,Dave Thomas 出版了第一本涵盖 Ruby 的英文书籍《Programming Ruby》。因为它的封面上画着一把锄头,所以这本书也被称为锄头书。这是第一次向身处西方的程序员们介绍了 Ruby。就像在日本那样,Ruby 的普及很快,到 2002 年时,英语的 Ruby 邮件列表的通信超过了原来的日语邮件列表。 -时间来到了 2005 年,Ruby 更流行了,但它任然不是主流的编程语言。然而,Ruby on Rails 的发布让一切都不一样了。Ruby on Rails 是 Ruby 的“杀手应用”,没有别的什么项目比它更能推动 Ruby 的普及了。在 Ruby on Rails 发布后,人们对 Ruby 的兴趣爆发式的增长,看看 TIOBE 监测的语言排行: +时间来到了 2005 年,Ruby 更流行了,但它仍然不是主流的编程语言。然而,Ruby on Rails 的发布让一切都不一样了。Ruby on Rails 是 Ruby 的“杀手级应用”,没有别的什么项目能比它更推动 Ruby 的普及了。在 Ruby on Rails 发布后,人们对 Ruby 的兴趣爆发式的增长,看看 TIOBE 监测的语言排行: ![][3] -有时人们开玩笑的说,Ruby 程序全是基于 Ruby-on-Rails 的网站。虽然这听起来就像是 Ruby on Rails 占领了整个 Ruby 社区,但在一定程度上,这是事实。因为 Rails 开发需要 Ruby,Ruby 在西方是随着 Rails 的发布才普及开的。Rails 欠 Ruby 的和 Ruby 欠 Rails 的一样多。 +有时人们开玩笑的说,Ruby 程序全是基于 Ruby-on-Rails 的网站。虽然这听起来就像是 Ruby on Rails 占领了整个 Ruby 社区,但在一定程度上,这是事实。因为 Ruby 被人所熟知是因为它是人们写 Rails 应用时用的语言。Rails 欠 Ruby 的和 Ruby 欠 Rails 的一样多。 -Ruby 的设计哲学也深深地影响了 Rails 的设计与开发。Rails 之父 David Heinemeier Hansson 常常提起他第一次与 Ruby 的接触的情形,那简直就是一次传教。他说,那经历简直太有感召力了,让他感到要为松本的杰作(指 Ruby)“传教”的使命。对于 Hansson 来说,Ruby 的灵活性简直就是对 Python 或 Java 语言中自上而下的设计哲学的反抗。他很欣赏 Ruby 这门能够信任自己的语言,Ruby 赋予了他自由选择程序表达方式express his programs的权力。 +Ruby 的设计哲学也深深地影响了 Rails 的设计与开发。Rails 之父 David Heinemeier Hansson 常常提起他第一次与 Ruby 的接触的情形,那简直就是一次传教。他说,那种经历简直太有感召力了,让他感受到要为松本的杰作(指 Ruby)“传教”的使命。[^3] 对于 Hansson 来说,Ruby 的灵活性简直就是对 Python 或 Java 语言中自上而下的设计哲学的反抗。他很欣赏 Ruby 这门能够信任自己的语言,Ruby 赋予了他自由选择程序表达方式express his programs的权力。 -就像松本那样,Hansson 声称他创造 Rails 时因为对现状的不满并想让自己能更开心。他也认同让程序员更快乐高于一切的观点,所以检验 Rails 是否需要添加一项新特性的标准是“更灿烂的笑容标准The Principle of The Bigger Smile”。什么功能能让 Hansson 更开心就给 Rails 添加什么。因此,Rails 中包括了很多非传统的功能,例如“Inflector”类和 `Time` 扩展("Inflector"类试图将单个类的名字映射到多个数据库表的名字;`Time` 扩展允许程序员使用 `2.days.ago` 这样的表达式)。可能会有人觉得这些功能太奇怪了,但 Rails 的成功表明它的确能让很多人的生活得更快乐。 +就像松本那样,Hansson 声称他创造 Rails 时因为对现状的不满并想让自己能更开心。他也认同让程序员更快乐高于一切的观点,所以检验 Rails 是否需要添加一项新特性的标准是“更灿烂的笑容标准The Principle of The Bigger Smile”。什么功能能让 Hansson 更开心就给 Rails 添加什么。因此,Rails 中包括了很多非正统的功能,例如 “Inflector” 类和 `Time` 扩展(“Inflector”类试图将单个类的名字映射到多个数据库表的名字;`Time` 扩展允许程序员使用 `2.days.ago` 这样的表达式)。可能会有人觉得这些功能太奇怪了,但 Rails 的成功表明它的确能让很多人的生活得更快乐。 -因此,Rails 不但是 Ruby 的一个普及度很高的应用,而且体现了 Ruby 的很多核心准则。此外,很难看到使用其他语言开发的 Rails 的替代品,因为 Rails 的实现依赖于 Ruby 中类似于宏的类方法macro-like class method来实现模型关联的功能这样的功能。一些人认为这么多的 Ruby 开发需要基于 Ruby on Rails 是 Ruby 生态不健康的表现,但 Ruby 和 Ruby on Rails 结合的如此紧密并不是没有道理的。 +因此,虽然 Rails 看起来是一个偶然使 Ruby 更流行的应用,但事实上它体现了 Ruby 的很多核心准则。此外,很难看到使用其他语言开发的 Rails,因为 Rails 的实现依赖于 Ruby 中类似于宏的类方法调用macro-like class method calls来实现模型关联这样的功能。一些人认为这么多的 Ruby 开发需要基于 Ruby on Rails 是 Ruby 生态不健康的表现,但 Ruby 和 Ruby on Rails 结合的如此紧密并不是没有道理的。 -### Ruby 的未来 +### Ruby 之未来 -人们似乎对 Ruby 是否正在灭亡有着异常的兴趣。早在 2011 年,Stack Overflow 和 Quora 上就有程序员在咨询“如果几年后不在使用 Ruby 那么现在是否有必要学它”。这些担忧对 Ruby 并不合理,虽然在 TIOBE 指数和 Stack Overflow 趋势上,Ruby 和 Ruby on Rails 的人气在萎缩,可它也曾是新兴的、热门的技术,但在更新更热的框架面前,排名自然会有所下降。 +人们似乎对 Ruby(及 Ruby on Rails)是否正在消亡有着异常的兴趣。早在 2011 年,Stack Overflow 和 Quora 上就充斥着程序员在咨询“如果几年后不再使用 Ruby 那么现在是否有必要学它”的话题。这些担忧对 Ruby 并非没有道理,根据 TIOBE 指数和 Stack Overflow 趋势,Ruby 和 Ruby on Rails 的人气一直在萎缩,虽然它也曾是热门新事物,但在更新更热的框架面前它已经黯然失色。 -一种解释这种趋势的理论是程序员们正在舍弃动态类型的语言转而选择静态类的。TIOBE 指数的趋势中可以看出对软件质量的需求在上升,这使出现在运行时的异常变得难以接受。他们引用 TypeScript 来说明这一趋势,TypeScript 是 JavaScript 的全新版本,而它创造的目的正是为了保证客户端运行的代码能收益于编译所提供的安全保障。 +一种解释这种趋势的理论是程序员们正在舍弃动态类型的语言转而选择静态类型的。TIOBE 指数的趋势中可以看出对软件质量的需求在上升,这使得出现在运行时的异常变得难以接受。他们引用 TypeScript 来说明这一趋势,TypeScript 是 JavaScript 的全新版本,而创造它的目的正是为了保证客户端运行的代码能受益于编译所提供的安全保障。 -我认为另一个原因可能是比起 Ruby on Rails 推出的时候,现在存在着更多有竞争力的框架。2005 年它刚刚发布的时候,还没有那么多用于创建 Web 程序的框架,其主要的替代者还是 Java。可在今天,你可以用 Go、Javascript 或者 Python 上的各种优秀的框架,而这还仅仅是主流的选择。 Web 的世界似乎正走向更加分布式的结构,与其使用一个代码仓库来完成从数据库读取到页面渲染所有事务,不如将事务拆分到多个组建,其中每个组件专注于一项事务并将其做到最好。在这种趋势下,Rails 相较于那些专攻与 JavaScript 前端通信的 JSON API 就显得过于宽泛和臃肿。 +我认为另一个更可能的原因是比起 Ruby on Rails 推出的时候,现在存在着更多有竞争力的框架。2005 年它刚刚发布的时候,还没有那么多用于创建 Web 程序的框架,其主要的替代者还是 Java。可在今天,你可以使用为 Go、Javascript 或者 Python 开发的各种优秀的框架,而这还仅仅是主流的选择。Web 的世界似乎正走向更加分布式的结构,与其使用一块代码来完成从数据库读取到页面渲染所有事务,不如将事务拆分到多个组件,其中每个组件专注于一项事务并将其做到最好。在这种趋势下,Rails 相较于那些专攻于 JavaScript 前端通信的 JSON API 就显得过于宽泛和臃肿。 总而言之,我们有理由对 Ruby 的未来持乐观态度。因为不管是 Ruby 还是 Rails 的开发都还很活跃。松本和其他的贡献者们都在努力开发 Ruby 的第三个主要版本。新的版本将比现在的版本快上 3 倍,以减轻制约着 Ruby 发展的性能问题。虽然从 2005 年起,越来越多的 Web 框架被开发出来,但这并不意味着 Ruby on Rails 就失去了其生存空间。Rails 是一个富有大量功能的成熟的工具,对于一些特定类型的应用开发一直是非常好的选择。 -但就算 Ruby 和 Rails 走上了灭亡的道路,Ruby 让程序员更快乐的信条一定会存活下来。Ruby 已经深远的影响了许多新的编程语言的设计,这些语言的设计中能够看到来自 Ruby 的很多理念。而其他的新生语言则试着变成 Ruby 更现代的实现,例如 Elixir 是一个强调函数式编程的语言,仍在开发中的 Crystal 目标是成为使用静态类型的 Ruby 。世界上许多程序员都喜欢上了 Ruby,因此它的影响必将会在未来持续很长一段时间。 +但就算 Ruby 和 Rails 走上了消亡的道路,Ruby 让程序员更快乐的信条一定会存活下来。Ruby 已经深远的影响了许多新的编程语言的设计,这些语言的设计中能够看到来自 Ruby 的很多理念。而其他的新生语言则试着变成 Ruby 更现代的实现,例如 Elixir 是一个强调函数式编程范例的语言,仍在开发中的 Crystal 目标是成为使用静态类型的 Ruby 。世界上许多程序员都喜欢上了 Ruby 及其语法,因此它的影响必将会在未来持续很长一段时间。 -喜欢吗?这里每两周都会发表一篇这样的文章。请在推特上关注我们 [@TwoBitHistory][4] 或者订阅我们的 [RSS][5],这样新文章发布的第一时间你就能得到通知。 +喜欢这篇文章吗?这里每两周都会发表一篇这样的文章。请在推特上关注我们 [@TwoBitHistory][4] 或者订阅我们的 [RSS][5],这样新文章发布的第一时间你就能得到通知。 + +[^1]: http://ruby-doc.org/docs/ruby-doc-bundle/FAQ/FAQ.html +[^2]: https://www.youtube.com/watch?v=oEkJvvGEtB4?t=30m55s +[^3]: http://rubyonrails.org/doctrine/ -------------------------------------------------------------------------------- @@ -73,7 +76,7 @@ via: https://twobithistory.org/2017/11/19/the-ruby-story.html 作者:[Two-Bit History][a] 选题:[lujun9972][b] 译者:[wwhio](https://github.com/wwhio) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 305094e9e180d0b79b490aa872a4f564e52dfa33 Mon Sep 17 00:00:00 2001 From: Hansong Zhang Date: Sat, 19 Jan 2019 22:21:34 +0800 Subject: [PATCH 039/243] Translated Translated: Dawn of the Microcomputer- The Altair 8800 --- ...n of the Microcomputer- The Altair 8800.md | 128 ---------------- ...n of the Microcomputer- The Altair 8800.md | 141 ++++++++++++++++++ 2 files changed, 141 insertions(+), 128 deletions(-) delete mode 100644 sources/talk/20180722 Dawn of the Microcomputer- The Altair 8800.md create mode 100644 translated/talk/20180722 Dawn of the Microcomputer- The Altair 8800.md diff --git a/sources/talk/20180722 Dawn of the Microcomputer- The Altair 8800.md b/sources/talk/20180722 Dawn of the Microcomputer- The Altair 8800.md deleted file mode 100644 index 9974ac6352..0000000000 --- a/sources/talk/20180722 Dawn of the Microcomputer- The Altair 8800.md +++ /dev/null @@ -1,128 +0,0 @@ -zhs852 is translating. - -Dawn of the Microcomputer: The Altair 8800 -====== -Subscribers to Popular Electronics were a sophisticated group. The magazine’s editor, Arthur Salsberg, felt compelled to point out as much in the editorial section of the [December 1974 issue][1]. The magazine had received letters complaining that a recent article, titled “How to Set Up a Home TV Service Shop,” would inspire a horde of amateur TV technicians to go out and undercut professional repairmen, doing great damage to everyone’s TVs in the process. Salsberg thought this concern was based on a misunderstanding about who read Popular Electronics. He explained that, according to the magazine’s own surveys, 52% of Popular Electronics subscribers were electronics professionals of some kind and 150,000 of them had repaired a TV in the last 60 days. Moreover, the average Popular Electronics subscriber had spent $470 on electronics equipment ($3578 in 2018) and possessed such necessities as VOMs, VTVMs, tube testers, transistor testers, r-f signal generators, and scopes. “Popular Electronics readers are not largely neophytes,” Salsberg concluded. - -I am surprised that anyone familiar with Popular Electronics could ever have doubted its subscribers. I certainly haven’t repaired a TV in the last 60 days. My computer is a block of aluminum that I have never seen the inside of. Yet the December 1974 issue of Popular Electronics features articles such as “Standing Wave Ratio: What It Is and How to Deal with It” and “Test Scene: Uses for Your Multimeter.” Even the ads are intimidating. One of them, which seems to be for some kind of stereo system, boldly proclaims that “no piece of audio equipment is as eagerly awaited as the ‘one four-channel unit that does everything—i.e. the receiver with built-in circuitry for SQ, RM and CD-4 record decoding.’” The mere hobbyists subscribed to Popular Electronics, let alone the professionals, must have been very knowledgeable indeed. - -But Popular Electronics readers were introduced to something in the [January 1975 issue][2] that they had never encountered before. Below a heading that read “PROJECT BREAKTHROUGH,” the magazine’s cover showed a large gray and black box whose front panel bore a complicated array of lights and toggles. This was the Altair 8800, the “world’s first minicomputer kit to rival commercial models,” available for under $400. Though advertised as a “minicomputer,” the Altair would actually be the first commercially successful member of a new class of computers, first known as “microcomputers” and then eventually as PCs. The Altair was small enough and cheap enough that the average family could have one at home. Its appearance in Popular Electronics magazine meant that, as Salsberg wrote in that issue, “the home computer age is here—finally.” - -![January 1975 cover of Popular Electronics][3] - -I have written briefly about [the Altair before][4], but I think the Altair is worth revisiting. It was not an especially powerful computer compared to others available at the time (though it cost significantly less money). Nor was it the first general-purpose computer to incorporate a microprocessor chip—at least three microprocessor-based computers preceded it. But the Altair was and is a kind of Ur-Computer for all of us. It was the first popular computer in a lineage that includes our own devices, whereas the mainframes and bulky minicomputers that predated the Altair were an entirely different kind of machine, programmed by punched card or else rarely interacted with directly. The Altair was also a radically simple computer, without any kind of operating system or even a bootloader. Unless you bought peripherals for it, the Altair was practically a bank of RAM with switches and lights on the front. The Altair’s simplicity makes learning about it a great way to reacquaint yourself with the basic concepts of computing, exactly as they were encountered by the denizens of the old analog world as they first ventured into our digital one. - -### Roberts and Co. - -The Altair was designed and manufactured by a company called Micro Instrumentation and Telemetry Systems (MITS), based in Albuquerque, New Mexico. MITS was run by a man named H. Edward Roberts. The company had started off making telemetry systems for model rocket kits before moving into the calculator market, which in the early 1970s was booming. Integrated circuits were bringing the cost of a calculator down dramatically and suddenly every working American professional had to have one. But the calculator market was ruthlessly competitive and, by the beginning of 1974, MITS was deeply in debt. - -The year 1974 would prove to be an “annus mirabilis” in computing. In January, Hewlett-Packard introduced the HP-65, the world’s first programmable handheld calculator. In April, Intel released the Intel 8080, its second 8-bit microprocessor and the first microprocessor to become widely popular. Then, in July, Radio Electronics magazine advertised a build-it-yourself minicomputer called the Mark-8, which employed the Intel 8008 microprocessor that Intel had released in 1972. The Mark-8 was only the third computer ever built using a microprocessor and it was the first to be appear on the cover of a magazine. The Mark-8’s appearance in Radio Electronics pushed Popular Electronics to look for a minicomputer project of their own to feature. - -Popular Electronics subscribers actually received their copies of the January 1975 issue in the mail in December of 1974. So the announcement of the Altair closed out the “annus mirabilis” that was that year. The Altair’s introduction was so momentous because never before had such a fully capable computer been offered to the public at an affordable price. The PDP-8, one the most popular minicomputers at the time, could only be bought for several thousand dollars. Yet the Intel 8080 chip at the heart of the Altair made it almost as capable as the PDP-8, if not more so; the 8080 supported a wider instruction set and the Altair could be expanded to have up to 64kb of memory, while the stock PDP-8 typically only had 4kb. The Altair was also more powerful than the Mark-8, which, because it was based on the Intel 8008, could only address 16kb of memory. And whereas the Mark-8 had to be built from scratch by customers with only a booklet and printed circuit boards to guide them, the Altair could be purchased fully assembled, though MITS soon became so inundated with orders that the only real way to get an Altair was to order the construction kit. - -For many Popular Electronics readers, the Altair was their first window into the world of digital computing. The article introducing the Altair in the January 1975 issue was written by Roberts and the Altair’s co-designer, William Yates. Roberts and Yates took pains to explain, in terms familiar to the electricians and radio enthusiasts in their audience, the basic concepts underlying digital hardware and computer programming. “A computer,” they wrote, “is basically a piece of variable hardware. By changing the bit pattern stored in the memory, the hardware can be altered from one type of device to another.” Of programming, meanwhile, Roberts and Yates wrote that the basic concepts are “simple enough to master in a relatively short time,” but that becoming “an efficient programmer requires a lot of experience and a large amount of creativity,” which sounds about right to me. The article included a detailed diagram explaining all the constituent circuits of the Intel 8080 CPU, even though readers would receive at least that part fully assembled. It explained the difference between a CPU and a computer’s memory unit, the uses of a stack pointer, and the enormous advantages offered by assembly languages and higher-level languages like FORTRAN and BASIC over manual entry of machine code. - -Popular Electronics had in fact been running a series written by Roberts for several issues before January 1975. The series was billed as a short course in “digital logic.” In the December 1974 issue, Roberts walked readers through building a “very low cost computer terminal,” which was basically an octal keypad that could input values into an 8-bit computer. In the course of describing the keypad, Roberts explained how transistor-to-transistor logic works and also how to construct a flip-flop, a kind of circuit capable of “remembering” digital values. The keypad, Roberts promised, could be used with the Altair computer, to be announced the following month. - -It’s unclear how many Popular Electronics readers actually built the keypad, but it would have been a very useful thing to have. Without a keypad or some other input mechanism, the only way to input values into the Altair was through the switches on the front panel. The front panel had a row of 16 switches that could be used to set an address and a lower row of eight switches that could be used to control the operation of the computer. The eight right-most switches in the row of 16 could also be used to specify a value to be stored in memory. This made sense because the Intel 8080 used 16-bit values to address 8-bit words. The 16 switches on the front panel each represented a bit—the up position represented a one, while the down position represented a zero. Interacting with a computer this way is a revelation (more on that in a minute), because the Altair’s front panel is a true binary interface. It’s as close as you can get to the bare metal. - -As alien as the Altair’s interface is to us today, it was not unusual for its time. The PDP-8, for example, had a similar binary input mechanism on its front panel, though the PDP-8’s switches were nicer and colored in that attractive orange and yellow color scheme that really ought to make a comeback. The PDP-8, however, was often paired with a paper-tape reader or a teletype machine, which made program entry much easier. These I/O devices were expensive, meaning that most Altair users in the early days were stuck with the front panel. As you might imagine, entering long programs via the switches was a chore. Eventually the Altair could be hooked up to a cassette recorder and programs could be loaded that way. Bill Gates and Paul Allen, in what would become Microsoft’s first ever commercial venture, also wrote a version of BASIC for the Altair that MITS licensed and released in the middle of 1975. Users that could afford a teletype could then [load BASIC into the Altair via paper tape][5] and interact with their Altair through text. BASIC, which had become everyone’s favorite introductory programming language in schools, would go on to become the standard interface to the machines produced in the early microcomputer era. - -### z80pack - -Thanks to the efforts of several internet people, in particular a person named Udo Munk, you can run a simulation of the Altair on your computer. The simulation is built on top of some software that emulates the Zilog Z80 CPU, a CPU designed to be software-compatible with the Intel 8080. The Altair simulation allows you to input programs entirely via the front panel switches like early users of the Altair had to do. Though clicking on switches does not offer the same tactile satisfaction as flipping real switches, playing with the Altair simulation is a great way to appreciate how a binary human/computer interface was both horribly inefficient and, at least in my opinion, charmingly straightforward. - -z80pack, Udo Munk’s Z80 emulation package, can be downloaded from the z80pack website. There are instructions in [my last Altair post][4] explaining how to get it set up on Mac OS. If you are able to compile both the FrontPanel library and the `altairsim` executable, you should be able to run `altairsim` and see the following window: - -![Simulated Altair Front Panel][6] - -By default, at least with the version of z80pack that I am using (1.36), the Altair is configured with something called Tarbell boot ROM, which I think is used to load disk images. In practice, what this means is that you can’t write values into the first several words in RAM. If you edit the file `/altairsim/conf/system.conf`, you can instead set up a simple Altair that has 16 pages of RAM and no ROM or bootloader software at all. You can also use this configuration file to increase the size of the window the simulation runs in, which is handy. - -The front panel of the Altair is intimidating, but in reality there isn’t that much going on. The [Altair manual][7] does a good job of explaining the many switches and status lights, as does this [YouTube video][8]. To enter and run a simple program, you only really need to know a few things. The lights labeled D0 through D7 near the top right of the Altair indicate the contents of the currently addressed word. The lights labeled A0 through A15 indicate the current address. The 16 switches below the address lights can be used to set a new address; when the “EXAMINE” switch is pressed upward, the data lights update to show the contents of the newly addressed word. In this way, you can “peek” at all the words in memory. You can also press the “EXAMINE” switch down to the “EXAMINE NEXT” position, which automatically examines the next memory address, which makes peeking at sequential words significantly easier. - -To save a bit pattern to a word, you have to set the bit pattern using the right-most eight switches labeled 0 through 7. You then press the “DEPOSIT” switch upward. - -In the [February 1975 issue][9] of Popular Electronics, Roberts and Yates walked Altair owners through inputting a small sample program to ensure that their Altair was functioning. The program loads two integers from memory, adds them, and saves the sum back into memory. The program consists of only six instructions, but those six instructions involve 14 words of memory altogether, which takes some time to input correctly. The sample program also appears in the Altair manual in table form, which I’ve reproduced here: - -Address Mnemonic Bit Pattern Octal Equivalent 0 LDA 00 111 010 0 7 2 1 (address) 10 000 000 2 0 0 2 (address) 00 000 000 0 0 0 3 MOV B, A 01 000 111 1 0 7 4 LDA 00 111 010 0 7 2 5 (address) 10 000 001 2 0 1 6 (address) 00 000 000 0 0 0 7 ADD B 10 000 000 2 0 0 8 STA 00 110 010 0 6 2 9 (address) 10 000 010 2 0 2 10 (address) 00 000 000 0 0 0 11 JMP 11 000 011 3 0 3 12 (address) 00 000 000 0 0 0 13 (address) 00 000 000 0 0 0 - -If you input each word in the above table into the Altair via the switches, you end up with a program that loads the value in word 128, adds it to the value in the word 129, and finally saves it into word 130. The addresses that accompany each instruction taking an address are given with the least-significant bits first, which is why the second byte is always zeroed out (no addresses are higher than 255). Once you’ve input the program and entered some values into words 128 and 129, you can press the “RUN” switch into the down position briefly before pushing it into the “STOP” position. Since the program loops, it repeatedly adds those values and saves the sum thousands of times a second. The sum is always the same though, so if you peek at word 130 after stopping the program, you should find the correct answer. - -I don’t know whether any regular users of the Altair ever had access to an assembler, but z80pack includes one. The z80pack assembler, `z80asm`, is meant for Z80 assembly, so it uses a different set of mnemonics altogether. But since the Z80 was designed to be compatible with software written for the Intel 8080, the opcodes are all the same, even if the mnemonics are different. So just to illustrate what it might have been like to write the same program in assembly, here is a version that can be assembled by `z80asm` and loaded into the Altair: - -``` - ORG 0000H -START: LD A,(80H) ;Load from address 128. - LD B,A ;Move loaded value from accumulator (A) to reg B. - LD A,(81H) ;Load from address 129. - ADD A,B ;Add A and B. - LD (82H),A ;Store A at address 130. - JP START ;Jump to start. -``` - -You can turn this into something called an Intel HEX file by invoking the assembler like so (after you have compiled it): - -``` -$ ./z80asm -fh -oadd.hex add.asm -``` - -The `-f` flag, here taking `h` as an argument, specifies that a HEX file should be output. You can then load the program into the Altair by passing the HEX file in using the `-x` flag: - -``` -$ ./altairsim -x add.hex -``` - -This sets up the first 14 words in memory as if you had input the values manually via the switches. Instead of doing all that again, you can just run the program by using the “RUN” switch as before. Much easier! - -As I said, I don’t think many Altair users wrote software this way. Once Altair BASIC became available, writing BASIC programs was probably the easiest way to program the Altair. z80pack also includes several HEX files containing different versions of Altair BASIC; the one I’ve been able to get working is version 4.0 of 4K BASIC, which you can load into the simulator like so: - -``` -$ ./altairsim -x basic4k40.hex -``` - -If you turn the simulated machine on and hit the “RUN” switch, you should see that BASIC has started talking to you in your terminal window. It first prompts you to enter the amount of memory you have available, which should be 4000 bytes. It then asks you a few more questions before presenting you with the “OK” prompt, which Gates and Allen used instead of the standard “READY” to save memory. From there, you can just use BASIC: - -``` -OK -PRINT 3 + 4 - 7 -``` - -Though running BASIC with only 4kb of memory didn’t give you a lot of room, you can see how it would have been a significant step up from using the front panel. - -The Altair, of course, was nowhere near as capable as the home desktops and laptops we have available to us today. Even something like the Macintosh, released less than a decade later, seems like a quantum leap forward over the spartan Altair. But to those first Popular Electronics readers that bought the kit and assembled it, the Altair was a real, fully capable computer that they could own for themselves, all for the low cost of $400 and half the surface space of the credenza. This would have been an amazing thing for people that had thus far only been able to interact with computers by handing [a stack of cards][10] or a roll of tape to another human being entrusted with the actual operation of the computer. Subsequent microcomputers would improve upon what the Altair offered and quickly become much easier to use, but they were all, in some sense, just more complicated Altairs. The Altair—almost Brutalist in its minimalism—was the bare-essentials blueprint for all that would follow. - -If you enjoyed this post, more like it come out every two weeks! Follow [@TwoBitHistory][11] on Twitter or subscribe to the [RSS feed][12] to make sure you know when a new post is out. - -Previously on TwoBitHistory… - -> "I invite you to come along with me on an exciting journey and spend the next ten minutes of your life learning about a piece of software nobody has used in the last decade." -> -> — TwoBitHistory (@TwoBitHistory) [July 7, 2018][13] - --------------------------------------------------------------------------------- - -via: https://twobithistory.org/2018/07/22/dawn-of-the-microcomputer.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://www.americanradiohistory.com/Archive-Poptronics/70s/1974/Poptronics-1974-12.pdf -[2]: https://www.americanradiohistory.com/Archive-Poptronics/70s/1975/Poptronics-1975-01.pdf -[3]: https://twobithistory.org/images/jan1975-altair.jpg -[4]: https://twobithistory.org/2017/12/02/simulating-the-altair.html -[5]: https://www.youtube.com/watch?v=qv5b1Xowxdk -[6]: https://www.autometer.de/unix4fun/z80pack/altair.png -[7]: http://www.classiccmp.org/dunfield/altair/d/88opman.pdf -[8]: https://www.youtube.com/watch?v=suyiMfzmZKs -[9]: https://www.americanradiohistory.com/Archive-Poptronics/70s/1975/Poptronics-1975-02.pdf -[10]: https://twobithistory.org/2018/06/23/ibm-029-card-punch.html -[11]: https://twitter.com/TwoBitHistory -[12]: https://twobithistory.org/feed.xml -[13]: https://twitter.com/TwoBitHistory/status/1015647820353867776?ref_src=twsrc%5Etfw diff --git a/translated/talk/20180722 Dawn of the Microcomputer- The Altair 8800.md b/translated/talk/20180722 Dawn of the Microcomputer- The Altair 8800.md new file mode 100644 index 0000000000..d6ae8689bf --- /dev/null +++ b/translated/talk/20180722 Dawn of the Microcomputer- The Altair 8800.md @@ -0,0 +1,141 @@ +微型计算机的始祖:Altair 8800 +====== +《大众电子》的订阅者是个复杂的群体,杂志编辑 Arthur Salsberg 不得不在 [1974 年 12 月刊][1] 中的前言部分指出这点。此前,杂志编辑组曾收到了对《如何搭建家庭媒体中心》文章的抱怨,称这篇文章激励了许多业余电视爱好者走出去,削弱了专业修理人员存在的必要性,这对许多人的电视造成了极大伤害。Salsberg 认为,这个担忧的产生可能是因为大家不清楚《大众电子》读者们的真实水平。他解释道,杂志内部调查的数据显示,52 % 的订阅者都是某方面的电子专家,并且其中的 150,000 人在最近 60 天之内都修过电视。此外,订阅者们平均在电子产品上花费了 470 美金(2018 年则是 3578 美金),并且他们有对万用表、真空管伏特计、电子管测试仪、晶体管测试仪、射频讯号产生器和示波器的需求。“《大众电子》的读者们并不全都是新手。”Salsberg 总结道。 + +熟悉《大众电子》的人居然会质疑它的订阅者,这令我十分吃惊。不过最近 60 天我的确没修过电视。我的电脑对我来说就是一块铝,我甚至没把它拆开看过。1974 年 12 月的《大众电子》刊登的像《驻波比是什么以及如何处理它》和《对万用表的测试》之类的特色文章,甚至连广告都令人生畏。它们中有个看起来像某种立体声系统的东西大胆地写道“除了‘四通道单元(即内建的 SQ、RM 和 CD-4 解码接收器)’,没有任何音频设备是被期待的”。这也表明了《大众电子》的订阅者一定对电子有很多深入的了解。 + +不过在 [1975 年 1 月刊][2] 中,杂志为读者们带来了一些他们从没见过的东西。在标题“发现项目”下面,杂志的封面是一个黑灰色的盒子,它的前面板上有一组开关和灯。这便是 Altair 8800,“世界上首个有商业竞争力的迷你计算机”,它的售价低于 400 美元。尽管 Altair 作为“迷你计算机”被宣传,但其实大家都将它称为“微机”和PC,它是首个商业上成功的新型电脑。Altair 十分小巧而且很便宜,以至于它成为了当时家家户户都能用起的电脑。正如 Salsberg 所写道,它在《大众电子》上的出现意味着:“家用电脑的时代终于到来了。” + +![《大众电子》1975 年 1 月刊的封面][3] + +此前,我曾写过 [关于 Altair 的文章][4],但我觉得 Altair 有让我再次介绍的价值。它在当时性能并不强(虽然它便宜很多),也不是首个装载微处理器(由至少三个微处理器组成)的通用计算机。但是 Altair 是一种可供我们所有人使用的计算机。它是历史上包括我们所拥有的设备中首台流行的计算机,早于 Altair 计算机都是完全不同的机器,它们由穿孔卡编程并且很少与用户交互。不过 Altair 也是台极其简单的计算机,它不附带任何操作系统甚至引导加载器。除非你购买其它外设,否则 Altair 就是一台装配 RAM 并且只有一组开关和灯泡的机器。由于 Altair 操作简单,学习计算的基本理论都成了十分简单的事情,就好像他们在数字世界冒险时遇上了旧世界的居民一样。 + +### Roberts 和他的公司 + +Altair 被一家名为 MITS 的公司设计和制造,这家公司位于美国新墨西哥州的阿尔布开克。MITS 由一个叫 H. Edward Roberts 运营。他们起初借 19 世纪 70 年代的热潮制造模型火箭的遥测系统。集成电路将计算器的成本降低到十分可观的数字,突然之间它就成了美国教授们的必需品。不幸的是,由于计算器市场竞争过于激烈,到了 1974 年,MITS 便负债累累。 + +1974 年在计算机界是奇迹迭出的一年annus mirabilis。一月的时候,惠普公司推出了世界首个可编程的手持计算器 HP-65。四月的时候,Intel 发布了 Intel 8080,他们的第二款 8 位微处理器,它也是首款受欢迎的微处理器。接着,六月的时候,《Radio Electronics》杂志介绍了 Mark-8 这个自制迷你计算机,它使用了 Intel 在 1972 年推出的 Intel 8008 微处理器。Mark-8 是使用微处理器搭建的第三台电脑,它的首次登场是在杂志的封面上。Mark-8 在《Radio Electronics》上的出现促使了《大众电子》寻找微机项目的出现。 + +《大众电子》的订阅者们其实早在 1974 年 12 月就通过电邮获得了 1975 年 1 月刊的副本。他们公布的 Altair 为这个奇迹迭出的一年annus mirabilis画上了圆满的句号。Altair 的出现是十分重要的,因为此前从未有过向公众提供的价格公道而又功能齐全的电脑。当时,作为最受欢迎的迷你计算机之一的 PDP-8 要几千美金才能买到。不过 Altair 搭载的 Intel 8080 芯片几乎能与 PDP-8 匹敌;8080 支持更广泛的指令集,而且 Altair 可以扩展到 64 kb 内存,显然强于仅有 4 kb 内存的 PDP-8。并且,Mark-8 也不是他的对手,因为它搭载的是只能处理 16 kb 内存的 Intel 8008。在 Mark-8 必须由用户按照说明书手动拼装的情况下,Altair 在购买时就已经被组装好了(不过由于后来 MITS 被大量订单淹没,最后真正能获得 Altair 的方式也只有买零件拼装了)。 + +对许多《大众电子》的读者来说,Altair 是他们了解数字计算的起点。1975 年 1 月刊上那篇介绍 Altair 的文章由 Roberts 和 Altair 的联合设计师 William Yates 所写。Roberts 和 Yates 煞费苦心地用电工和无线电狂热者们所熟悉的词汇来介绍了数字硬件和计算机编程的基本概念。他们写道:“一台计算机其实由一堆可变的硬件构成。仅需修改储存于内存之中的为组合形式,便可改变硬件设备的种类。”同时,Roberts 和 Yates 认为编程的基本概念是“足够简单并能在较短时间内掌握,但是想要成为一个高效的程序员必须经验丰富且富有创造力。”对此我十分认同。尽管已经组装好了,文章仍包含了用来讲解 Intel 8080 的组成的详细图表。文章解释了 CPU 和计算机内存单元的区别,堆栈指针的概念和汇编语言以及更高级的语言(例如 FORTRAN 和 BASIC)比起手动输入机器码所带来的巨大优势。 + +其实,《大众电子》在 1975 年 1 月刊之前就出版过 Roberts 撰写的系列文章。这一系列作为短期课程被收录在“数字逻辑”专栏中。在 1974 年 12 月刊中,Roberts 为读者们带来了关于构建“超低成本计算机终端”的文章,文章中介绍了可以用于 8 位电脑中输入值的八进制键盘。在介绍这个键盘时,Roberts 解释了晶体管到晶体管的逻辑工作原理,以及关于构建一种可以“记住”数字值的触发器的方法。Roberts 承诺说,这个键盘可以在下个月即将公布的 Altair 电脑中使用。 + +有多少《大众电子》的读者制作了这个键盘我们无从得知,但是那个键盘的确是个很有用的东西。如果没有键盘和其它输入设备,我们只能通过拨动 Altair 面板上的开关来输入值。Altair 的面板上有 16 行开关被用来设置地址,而下方的 8 个则是用来操作计算机的。16 行中最右边的开关是用来指定要储存在内存中的值的。这么做不无道理,因为 Intel 8080 使用 16 位的值来处理 8 位的信息。而这 16 个开关每一个都代表了一个位,当开关向上时代表 1,向下则代表 0。用这样的方式交互是个启示(一会儿我们就会讲到),因为 Altair 的面板是真正的二进制界面。这使得你可以触摸到裸露的金属。 + +尽管在当下 Altair 的界面对我们来说完全不像是人用的,不过在那个时候这可是不平凡的。比如 PDP-8 的面板上有个类似的但更漂亮的二进制输入装置,而且它被涂上了吸引人的黄色和橙色,不过讲真,它应该重新来过。然而 PDP-8 经常与纸带阅读器或电传打字机配合使用,这使得程序输入更加容易。这些 I/O 设备价格高昂,这意味着 Altair 的用户们大都会被面板卡住。正如你所想,通过这一堆开关进入一个大型程序是个繁重的工作。不过幸运的是,Altair 可以与盒式记录器连接,这样一来载入程序就不是什么难事了。Bill Gates 和 Paul Allen 进行了微软的首次商业合作,为 Altair 编写了 BASIC 语言,并在 1975 年以 MITS 许可证发行。此后,那些买得起电传打字机的用户就能 [通过纸带来将 BASIC 载入 Altair][5] 了,并能使得用户能够通过字符界面与 Altair 交互。之后,BASIC 便成为了学生们最爱的入门编程语言,并成了早期微机时代的标准接口。 + +### z80pack + +多亏了网络上一些人,特别是 Udo Munk 的努力,你可以在你的电脑上运行 Altair 的模拟器。这个模拟器是在 Zilog Z80 CPU 的虚拟套件上构建的,这个 CPU 可以运行 Intel 8080 的软件。Altair 模拟器允许你像 Altair 的用户们一样调整面板上的开关。尽管点击这些开关的感觉不如拨动真实开关,但是使用 Altair 模拟器仍是一个能让你知道二进制人机交互效率有多低的途径,不过我觉得这同时也很简明直观。 + +z80pack 是 Udo Munk 开发的 Z80 模拟器套件,你可以在 z80pack 的官网上找到它的下载链接。我在 [上一篇介绍 Altair 的文章中][4] 写到过在 macOS 上使用它的详细过程。如果你能编译 FrontPanel 库和 `altairsim` 可执行程序,你应该能直接运行 `altairsim` 并看到这个窗口: + +![模拟器中的 Altair 面板][6] + +在新版的 z80pack 中(比如我正在使用的 1.36 版本),你可以使用一个叫 Tarbell boot ROM 的功能,我觉得这是用来加载磁盘镜像的。经我测试,它的意思是你不能写入 RAM 中的前几个信息。在编辑 `/altairsim/conf/system.conf` 之后,你可以构建带有一个 16 页 RAM 且没有 ROM 或引导加载器的 Altair。除此之外,你还可以用这个配置文件来扩大运行模拟器的窗口,不得不说这还是挺方便的。 + +Altair 的面板看起来就很吓人,不过事实上并没有我们想象中的这么可怕。[Altair 说明书][7] 对解释开关和指示灯起到了很大的作用,这个 [YouTube 视频][8] 也是。若想运行一个简易的程序,你只需要了解一点点东西。Altair 右上方标签为 D0 到 D7 的指示灯代表当前处理地址的信息。标签为 A0 到 A15 的指示灯标识当前的地址。地址指示灯下的 16 个开关可以用来设置新地址;当 “EXAMINE” 开关被向上推动时,数据指示灯将会更新,并显示新地址上的内容。用这个功能,你便能观察到内存中所有的信息了。你也可以将 “EXAMINE” 推下来自动检查下一个位置上的信息,这使得检索信息更容易了。 + +要将模式保存到信息中,请使用最左边的 8 个标签为 0 到 7 的开关。然后,请向上推动 “DEPOSIT” 按钮。 + +在《大众电子》 的 [1975 年 2 月刊][9] 中,Roberts 和 Yates 制作了一小段程序来确保用户们的 Altair 正常工作。这个程序从内存中读取两个整型数据并添加之后将它们存回内存中。这个小程序仅由 6 条指令组成,但是这 6 条指令包含了 14 条在一起的内存信息,所以要正确地输入它们需要一点时间。这个程序也被写入了 Altair 的说明书,原文如下: + +| Address | Mnemonic | Bit Pattern | Octal Equivalent | +| :------: | :------: | :------: | :------: | +| 0 | LDA | 00 111 010 | 0 7 2 | +| 1 | (address) | 10 000 000 | 2 0 0 | +| 2 | (address) | 00 000 000 | 0 0 0 | +| 3 | MOV B, A | 01 000 111 | 1 0 7 | +| 4 | LDA | 00 111 010 | 0 7 2 | +| 5 | (address) | 10 000 001 | 2 0 1 | +| 6 | (address) | 00 000 000 | 0 0 0 | +| 7 | ADD B | 10 000 000 | 2 0 0 | +| 8 | STA | 00 110 010 | 0 6 2 | +| 9 | (address) | 10 000 010 | 2 0 2 | +| 10 | (address) | 00 000 000 | 0 0 0 | +| 11 | JMP | 11 000 011 | 3 0 3 | +| 12 | (address) | 00 000 000 | 0 0 0 | +| 13 | (address) | 00 000 000 | 0 0 0 | + +如果你通过开关来输入上面这些值,最终会得到一个程序,它会读取内存 128 中的值,并将其添加至 129 中,最终将其保存至 130 中。每条指令都会占用一个地址,它们最开始会被给予最低有效位,这便是第二个字节总会被清零(没有高于 255 的地址)的原因了。在输入这个程序并在 128 和 129 中输入了一些值之后,你可以向下推动 “RUN” ,之后再将它推到 “STOP” 位置。因为程序循环执行,以一秒内执行上千次的速度反复地添加并保存那些值。并且最后得到的值总是相同的,如果你暂停程序并检查 130,你应该能找到正确答案。 + +我不知道普通的 Altair 用户是否使用过,不过 z80pack 包括了一个汇编程序 —— `z80asm`,意思是适用于 Z80 的汇编程序Z80 assembly,所以它使用了不同的助记符。不过因为 Z80 是被设计来适配为 Intel 8080 写的软件的,所以即使助记符不一样,它们的操作码也是相同的。你可以直接将 `z80asm` 装载进 Altair: + +``` + ORG 0000H +START: LD A,(80H) ;Load from address 128. + LD B,A ;Move loaded value from accumulator (A) to reg B. + LD A,(81H) ;Load from address 129. + ADD A,B ;Add A and B. + LD (82H),A ;Store A at address 130. + JP START ;Jump to start. +``` + +编译之后,你可以调用汇编程序来将其转换为 Intel HEX 文件: + +```shell +$ ./z80asm -fh -oadd.hex add.asm +``` + +我们用带有 `h` 参数的 `-f` 标识来定义输出的 HEX 文件。你可以用 `-x` 标识来传递 HEX 文件,从而使得 Altair 能够加载程序: + +```shell +$ ./altairsim -x add.hex +``` + +这会在内存中自动设置前 14 个信息,就和你通过开关手动输入这些值一样。你可以直接使用 “RUN” 按钮来替代以前那些繁琐的步骤,这是如此的简单! + +我不觉得有很多 Altair 用户以这种方式来编写软件。Altair BASIC 发布后,使得 BASIC 成为了 Altair 编程最简单的方法。z80pack 同时也包括了一些包含不同版本 Altair BASIC 的 HEX 文件;在模拟器中,你可以用这个方式加载 4.0 版本的 4K BASIC: + +```shell +$ ./altairsim -x basic4k40.hex +``` + +当你开启模拟器并按下 “RUN” 按钮之后,你就会看到 BASIC 开始执行了,同时它会在终端中与你交互。它首先会提示你输入你内存的可用量,我们输入 4000 字节。随后,在显示 “OK” 提示符之前,它会问你几个问题,Gates 和 Allen 用这个来代替标准的 “READY” 并以此节省内存。在这之后,你便可以使用 BASIC 了: + +``` +OK +PRINT 3 + 4 + 7 +``` + +尽管只有极小的 4 kb 空间来运行 BASIC,不过你仍迈出了使用面板操控电脑的重要一步。 + +很显然,Altair 远不及如今的家用电脑,并且比它晚十多年发布的 Mac 电脑看上去也是对 Altair 电脑的巨大飞跃。但是对亲手组装了 Altair 的《大众电子》的读者们来说,只用了低于 400 美金和一半的书柜空间的 Altair 才是第一个它们真正能拥有的全功能电脑。对那时只能用 [一叠卡片][10] 或一卷磁带来与计算机交互的人们来说,Altair 是个令人眼前一亮的玩意。这之后的微机基本都是在对 Altair 改进,使得它更易用。从某种意义上来说,我们甚至可以把它们看成更复杂的 Altair。Altair,一个野兽派的极简作品,却为之后的许多微机打下了铺垫。 + +如果你觉得这篇文章写的不错,你可以在推特上关注 [@TwoBitHistory][11] 或订阅 [RSS feed][12] 来获得我们文章的更新提醒。文章每两周就会更新一次! + +TwoBitHistory 的上一篇文章是………… + +> “跟我一起来进行这振奋人心的冒险吧!只需要十分钟,你就能了解到 10 年都没人用过的软件。” +> +> — TwoBitHistory (@TwoBitHistory) [写于 2018 年 7 月 7 日][13] + +-------------------------------------------------------------------------------- + +via: https://twobithistory.org/2018/07/22/dawn-of-the-microcomputer.html + +作者:[Two-Bit History][a] +选题:[lujun9972][b] +译者:[zhs852](https://github.com/zhs852) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://twobithistory.org +[b]: https://github.com/lujun9972 +[1]: https://www.americanradiohistory.com/Archive-Poptronics/70s/1974/Poptronics-1974-12.pdf +[2]: https://www.americanradiohistory.com/Archive-Poptronics/70s/1975/Poptronics-1975-01.pdf +[3]: https://twobithistory.org/images/jan1975-altair.jpg +[4]: https://twobithistory.org/2017/12/02/simulating-the-altair.html +[5]: https://www.youtube.com/watch?v=qv5b1Xowxdk +[6]: https://www.autometer.de/unix4fun/z80pack/altair.png +[7]: http://www.classiccmp.org/dunfield/altair/d/88opman.pdf +[8]: https://www.youtube.com/watch?v=suyiMfzmZKs +[9]: https://www.americanradiohistory.com/Archive-Poptronics/70s/1975/Poptronics-1975-02.pdf +[10]: https://twobithistory.org/2018/06/23/ibm-029-card-punch.html +[11]: https://twitter.com/TwoBitHistory +[12]: https://twobithistory.org/feed.xml +[13]: https://twitter.com/TwoBitHistory/status/1015647820353867776?ref_src=twsrc%5Etfw From b36f5ac455190ad338d1267cba9664553e64739d Mon Sep 17 00:00:00 2001 From: beamrolling <33046439+beamrolling@users.noreply.github.com> Date: Sat, 19 Jan 2019 22:39:59 +0800 Subject: [PATCH 040/243] Update 20190114 You (probably) don-t need Kubernetes.md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 申请翻译文章 --- sources/talk/20190114 You (probably) don-t need Kubernetes.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/talk/20190114 You (probably) don-t need Kubernetes.md b/sources/talk/20190114 You (probably) don-t need Kubernetes.md index 5526f48f48..a57f47959e 100644 --- a/sources/talk/20190114 You (probably) don-t need Kubernetes.md +++ b/sources/talk/20190114 You (probably) don-t need Kubernetes.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (beamrolling) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From c0fbfa836491940a12572181f7488c8b3c15d7ac Mon Sep 17 00:00:00 2001 From: wwhio Date: Sat, 19 Jan 2019 23:35:16 +0800 Subject: [PATCH 041/243] =?UTF-8?q?=E5=B0=8F=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- translated/talk/20171119 The Ruby Story.md | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/translated/talk/20171119 The Ruby Story.md b/translated/talk/20171119 The Ruby Story.md index b0eb05d447..3cacc1ff4f 100644 --- a/translated/talk/20171119 The Ruby Story.md +++ b/translated/talk/20171119 The Ruby Story.md @@ -1,7 +1,7 @@ 红宝石(Ruby)史话 ====== -尽管我很难说清楚为什么,但 Ruby 一直是我最喜爱的一门编程语言。如果用音乐来类比的话,Python 给我的感觉像是朋克摇滚punk rock,简单、直接,但略显单调,而 Ruby 则像是爵士乐,赋予了程序员表达自我的根本自由,虽然这可能会让代码变复杂,编写出来的程序对其他人来说不直观。 +尽管我很难说清楚为什么,但 Ruby 一直是我最喜爱的一门编程语言。如果用音乐来类比的话,Python 给我的感觉像是朋克摇滚punk rock,简单、直接,但略显单调,而 Ruby 则像是爵士乐,从根本上赋予了程序员表达自我的自由,虽然这可能会让代码变复杂,编写出来的程序对其他人来说不直观。 Ruby 社区一直将灵活表达freedom of expression视为其核心价值。可我不认同这对于 Ruby 的开发和普及是最重要的。创建一门编程语言也许是为了更高的性能,也许是为了在抽象上节省更多的时间,可 Ruby 就有趣在它并不关心这些,从它诞生之初,它的目标就是让程序员更快乐。 @@ -13,7 +13,7 @@ Ruby 社区一直将灵活表达freedom of expression视 > 我那时就知道 Python 了,但我不喜欢它,因为我认为它不是一门真正的面向对象的语言。面向对象就像是 Python 的一个附件。作为一个编程语言狂热者,我在 15 年里一直是面向对象的忠实粉丝。我真的想要一门生来就面向对象而且易用的脚本语言。我为此特地寻找过,可事实并不如愿。[^1] -所以一种解释松本创造 Ruby 的动机就是他想要创造一门更好的,而且面向对象版的 Perl。 +所以一种解释松本创造 Ruby 的动机就是他想要创造一门更好,且面向对象的 Perl。 但在其他场合,松本说他创造 Ruby 主要是为了让他自己和别人更快乐。2008 年,松本在谷歌技术讲座结束时放映了这张幻灯片: @@ -25,39 +25,39 @@ Ruby 社区一直将灵活表达freedom of expression视 松本开玩笑的说他制作 Ruby 的原因很自私,因为他觉得其它的语言乏味,所以需要创造一点让自己开心的东西。 -这张幻灯片展现了松本谦虚的一面。其实,松本是一位摩门教徒践行者,因此我很好奇他传奇般的友善有多少归功于他的宗教信仰。无论如何,他的友善在 Ruby 社区广为流传,甚至有一条称为 MINASWAN 的原则,即“松本人很好,我们也一样Matz Is Nice And So We Are Nice”。我想那张幻灯片一定震惊了来自 Google 的观众。我想谷歌技术讲座上的每张幻灯片都充满着代码和运行效率的指标,来说明一个方案比另一个更快更有效,可仅仅放映崇高的目标的幻灯片却寥寥无几。 +这张幻灯片展现了松本谦虚的一面。其实,松本是一位摩门教践行者,因此我很好奇他传奇般的友善有多少归功于他的宗教信仰。无论如何,他的友善在 Ruby 社区广为流传,甚至有一条称为 MINASWAN 的原则,即“松本人很好,我们也一样Matz Is Nice And So We Are Nice”。我想那张幻灯片一定震惊了来自 Google 的观众。我想谷歌技术讲座上的每张幻灯片都充满着代码和运行效率的指标,来说明一个方案比另一个更快更有效,可仅仅放映崇高的目标的幻灯片却寥寥无几。 Ruby 主要受到 Perl 的影响。Perl 则是由 Larry Wall 于 20 世纪 80 年代晚期创造的语言,主要用于处理和转换基于文本的数据。Perl 因其文本处理和正则表达式而闻名于世。对于 Ruby 程序员,Perl 程序中的很多语法元素都不陌生,例如符号 `$`、符号 `@`、`elsif` 等等。虽然我觉得,这些不是 Ruby 应该具有的特征。除了这些符号外,Ruby 还借鉴了 Perl 中的正则表达式的处理和标准库。 -但影响了 Ruby 的不仅仅只有 Perl 。在 Ruby 之前松本就完全用 Emacs Lisp 写过一个邮件客户端。这一经历让他对 Emacs 和 Lisp 语言运行的内部原理有了更多的认识。松本说 Ruby 底层的对象模型也受其启发。在那之上,松本添加了一个 Smalltalk 风格的信息传递系统,这一系统随后成为了 Ruby 中任何依赖 `#method_missing` 的操作的基石。松本也表示过 Ada 和 Eiffel 也影响了 Ruby 的设计。 +但影响了 Ruby 的不仅仅只有 Perl 。在 Ruby 之前,松本制作过一个仅用 Emacs Lisp 编写的邮件客户端。这一经历让他对 Emacs 和 Lisp 语言运行的内部原理有了更多的认识。松本说 Ruby 底层的对象模型也受其启发。在那之上,松本添加了一个 Smalltalk 风格的信息传递系统,这一系统随后成为了 Ruby 中任何依赖 `#method_missing` 的操作的基石。松本也表示过 Ada 和 Eiffel 也影响了 Ruby 的设计。 当时间来到了给这门新语言命名的时候,松本和他的同事 Keiju Ishitsuka 挑选了很多个名字。他们希望名字能够体现新语言和 Perl、shell 脚本间的联系。在[这一段非常值得一读的即时消息记录][2]中,Ishitsuka 和 松本也许花了太多的时间来思考 shell贝壳clam蛤蛎oyster牡蛎pearl珍珠之间的关系了,以至于差点把 Ruby 命名为“Coral珊瑚虫”或“Bisque贝类浓汤”。幸好,他们决定使用 Ruby,因为它就像 pearl 一样,是一种珍贵的宝石。此外,Ruby红宝石 还是 7 月的生辰石,而 Pearl珍珠 则是 6 月的生辰石,采用了类似 C++ 和 C# 的隐喻,暗示着她们是改进自前辈的编程语言。(LCTT 译注:Perl 和 Pearl 发音相同,所以也常以“珍珠”来借喻 Perl;shell 是操作系统提供的用户界面,这里指的是命令行界面;更多有关生辰石的[信息](https://zh.wikipedia.org/zh-hans/%E8%AA%95%E7%94%9F%E7%9F%B3)。) ### Ruby 西渐 -Ruby 在日本的普及很快。1995 年 Ruby 刚刚发布后不久后,松本就被一家名为 Netlab 的日本软件咨询财团(全名 Network Applied Communication Laboratory)雇用,并全职为 Ruby 工作。到 2000 年时,在 Ruby 发布仅仅 5 年后,Ruby 在日本的流行度就超过了 Python。可这时的 Ruby 才刚刚进入英语国家。虽然从 Ruby 的诞生之初就存在讨论它的日语邮件列表,但是英语的邮件列表直到 1998 年才建立起来。而且起初英语的邮件列表是用于日本的 Ruby 狂热者用英语交流的,但这一情况随着 Ruby 的普及而逐渐得以改变。 +Ruby 在日本的普及很快。1995 年 Ruby 刚刚发布后不久后,松本就被一家名为 Netlab 的日本软件咨询财团(全名 Network Applied Communication Laboratory)雇用,并全职为 Ruby 工作。到 2000 年时,在 Ruby 发布仅仅 5 年后,Ruby 在日本的流行度就超过了 Python。可这时的 Ruby 才刚刚进入英语国家。虽然从 Ruby 的诞生之初就存在讨论它的日语邮件列表,但是英语的邮件列表直到 1998 年才建立起来。起初,在英语的邮件列表中交流的大多是日本的 Ruby 狂热者,可随着 Ruby 在西方的逐渐普及而得以改变。 -在 2000 年,Dave Thomas 出版了第一本涵盖 Ruby 的英文书籍《Programming Ruby》。因为它的封面上画着一把锄头,所以这本书也被称为锄头书。这是第一次向身处西方的程序员们介绍了 Ruby。就像在日本那样,Ruby 的普及很快,到 2002 年时,英语的 Ruby 邮件列表的通信超过了原来的日语邮件列表。 +在 2000 年,Dave Thomas 出版了第一本涵盖 Ruby 的英文书籍《Programming Ruby》。因为它的封面上画着一把锄头,所以这本书也被称为锄头书。这是第一次向身处西方的程序员们介绍了 Ruby。就像在日本那样,Ruby 的普及很快,到 2002 年时,英语的 Ruby 邮件列表的通信量就超过了日语邮件列表。 时间来到了 2005 年,Ruby 更流行了,但它仍然不是主流的编程语言。然而,Ruby on Rails 的发布让一切都不一样了。Ruby on Rails 是 Ruby 的“杀手级应用”,没有别的什么项目能比它更推动 Ruby 的普及了。在 Ruby on Rails 发布后,人们对 Ruby 的兴趣爆发式的增长,看看 TIOBE 监测的语言排行: ![][3] -有时人们开玩笑的说,Ruby 程序全是基于 Ruby-on-Rails 的网站。虽然这听起来就像是 Ruby on Rails 占领了整个 Ruby 社区,但在一定程度上,这是事实。因为 Ruby 被人所熟知是因为它是人们写 Rails 应用时用的语言。Rails 欠 Ruby 的和 Ruby 欠 Rails 的一样多。 +有时人们开玩笑的说,Ruby 程序全是基于 Ruby-on-Rails 的网站。虽然这听起来就像是 Ruby on Rails 占领了整个 Ruby 社区,但在一定程度上,这是事实。因为编写 Rails 应用时使用的语言正是 Ruby。Rails 欠 Ruby 的和 Ruby 欠 Rails 的一样多。 Ruby 的设计哲学也深深地影响了 Rails 的设计与开发。Rails 之父 David Heinemeier Hansson 常常提起他第一次与 Ruby 的接触的情形,那简直就是一次传教。他说,那种经历简直太有感召力了,让他感受到要为松本的杰作(指 Ruby)“传教”的使命。[^3] 对于 Hansson 来说,Ruby 的灵活性简直就是对 Python 或 Java 语言中自上而下的设计哲学的反抗。他很欣赏 Ruby 这门能够信任自己的语言,Ruby 赋予了他自由选择程序表达方式express his programs的权力。 就像松本那样,Hansson 声称他创造 Rails 时因为对现状的不满并想让自己能更开心。他也认同让程序员更快乐高于一切的观点,所以检验 Rails 是否需要添加一项新特性的标准是“更灿烂的笑容标准The Principle of The Bigger Smile”。什么功能能让 Hansson 更开心就给 Rails 添加什么。因此,Rails 中包括了很多非正统的功能,例如 “Inflector” 类和 `Time` 扩展(“Inflector”类试图将单个类的名字映射到多个数据库表的名字;`Time` 扩展允许程序员使用 `2.days.ago` 这样的表达式)。可能会有人觉得这些功能太奇怪了,但 Rails 的成功表明它的确能让很多人的生活得更快乐。 -因此,虽然 Rails 看起来是一个偶然使 Ruby 更流行的应用,但事实上它体现了 Ruby 的很多核心准则。此外,很难看到使用其他语言开发的 Rails,因为 Rails 的实现依赖于 Ruby 中类似于宏的类方法调用macro-like class method calls来实现模型关联这样的功能。一些人认为这么多的 Ruby 开发需要基于 Ruby on Rails 是 Ruby 生态不健康的表现,但 Ruby 和 Ruby on Rails 结合的如此紧密并不是没有道理的。 +因此,虽然 Rails 的火热带动了 Ruby 的普及看起来是一个偶然,但事实上 Rails 体现了 Ruby 的很多核心准则。此外,很难看到使用其他语言开发的 Rails,正是因为 Rails 的实现依赖于 Ruby 中类似于宏的类方法调用macro-like class method calls来实现模型关联这样的功能。一些人认为这么多的 Ruby 开发需要基于 Ruby on Rails 是 Ruby 生态不健康的表现,但 Ruby 和 Ruby on Rails 结合的如此紧密并不是没有道理的。 ### Ruby 之未来 人们似乎对 Ruby(及 Ruby on Rails)是否正在消亡有着异常的兴趣。早在 2011 年,Stack Overflow 和 Quora 上就充斥着程序员在咨询“如果几年后不再使用 Ruby 那么现在是否有必要学它”的话题。这些担忧对 Ruby 并非没有道理,根据 TIOBE 指数和 Stack Overflow 趋势,Ruby 和 Ruby on Rails 的人气一直在萎缩,虽然它也曾是热门新事物,但在更新更热的框架面前它已经黯然失色。 -一种解释这种趋势的理论是程序员们正在舍弃动态类型的语言转而选择静态类型的。TIOBE 指数的趋势中可以看出对软件质量的需求在上升,这使得出现在运行时的异常变得难以接受。他们引用 TypeScript 来说明这一趋势,TypeScript 是 JavaScript 的全新版本,而创造它的目的正是为了保证客户端运行的代码能受益于编译所提供的安全保障。 +一种解释这种趋势的理论是程序员们正在舍弃动态类型的语言转而选择静态类型的。TIOBE 指数的趋势中可以看出对软件质量的需求在上升,这意味着出现在运行时的异常变得难以接受。他们引用 TypeScript 来说明这一趋势,TypeScript 是 JavaScript 的全新版本,而创造它的目的正是为了保证客户端运行的代码能受益于编译所提供的安全保障。 -我认为另一个更可能的原因是比起 Ruby on Rails 推出的时候,现在存在着更多有竞争力的框架。2005 年它刚刚发布的时候,还没有那么多用于创建 Web 程序的框架,其主要的替代者还是 Java。可在今天,你可以使用为 Go、Javascript 或者 Python 开发的各种优秀的框架,而这还仅仅是主流的选择。Web 的世界似乎正走向更加分布式的结构,与其使用一块代码来完成从数据库读取到页面渲染所有事务,不如将事务拆分到多个组件,其中每个组件专注于一项事务并将其做到最好。在这种趋势下,Rails 相较于那些专攻于 JavaScript 前端通信的 JSON API 就显得过于宽泛和臃肿。 +我认为另一个更可能的原因是比起 Ruby on Rails 推出的时候,现在存在着更多有竞争力的框架。2005 年它刚刚发布的时候,还没有那么多用于创建 Web 程序的框架,其主要的替代者还是 Java。可在今天,你可以使用为 Go、Javascript 或者 Python 开发的各种优秀的框架,而这还仅仅是主流的选择。Web 的世界似乎正走向更加分布式的结构,与其使用一块代码来完成从数据库读取到页面渲染所有事务,不如将事务拆分到多个组件,其中每个组件专注于一项事务并将其做到最好。在这种趋势下,Rails 相较于那些专攻于 JavaScript 前端通信的 JSON API 就显得过于宽泛和臃肿。 总而言之,我们有理由对 Ruby 的未来持乐观态度。因为不管是 Ruby 还是 Rails 的开发都还很活跃。松本和其他的贡献者们都在努力开发 Ruby 的第三个主要版本。新的版本将比现在的版本快上 3 倍,以减轻制约着 Ruby 发展的性能问题。虽然从 2005 年起,越来越多的 Web 框架被开发出来,但这并不意味着 Ruby on Rails 就失去了其生存空间。Rails 是一个富有大量功能的成熟的工具,对于一些特定类型的应用开发一直是非常好的选择。 From aa299d28a13226e6277dd3feaea5336d184af716 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Sun, 20 Jan 2019 11:30:35 +0800 Subject: [PATCH 042/243] PRF:20180428 A Beginners Guide To Flatpak.md @wwhio --- .../20180428 A Beginners Guide To Flatpak.md | 100 +++++++++--------- 1 file changed, 48 insertions(+), 52 deletions(-) diff --git a/translated/tech/20180428 A Beginners Guide To Flatpak.md b/translated/tech/20180428 A Beginners Guide To Flatpak.md index 614f54cdf1..c5d758555d 100644 --- a/translated/tech/20180428 A Beginners Guide To Flatpak.md +++ b/translated/tech/20180428 A Beginners Guide To Flatpak.md @@ -3,7 +3,7 @@ Flatpak 新手指南 ![](https://www.ostechnix.com/wp-content/uploads/2016/06/flatpak-720x340.jpg) -不久前,我们介绍 Ubuntu 推出的 [**Snaps**][1]。Snaps 是由 Canonical 公司为 Ubuntu 开发的,并随后移植到其他的 Linux 发行版,如 Arch、Gentoo、Fedora 等等。由于一个 snap 包中含有软件的二进制文件和其所需的所有依赖和库,所以可以在无视软件版本、在任意 Linux 发行版上安装软件。和 Snaps 类似,还有一个名为 **Flatpak** 的工具。也许你已经知道,为不同的 Linux 发行版打包并分发应用时已经多么费时又复杂的工作,因为不同的 Linux 发行版的库不同,库的版本也不同。现在,Flatpak 作为分发桌面应用的新框架可以让开发者完全摆脱这些负担。开发者只需构建一个 Flatpak app 就可以在多种发行版上安装使用。这真是又酷又棒! +以前,我们介绍 Ubuntu 推出的 [Snaps][1]。Snaps 是由 Canonical 公司为 Ubuntu 开发的,并随后移植到其他的 Linux 发行版,如 Arch、Gentoo、Fedora 等等。由于一个 snap 包中含有软件的二进制文件和其所需的所有依赖和库,所以可以在无视软件版本、在任意 Linux 发行版上安装软件。和 Snaps 类似,还有一个名为 Flatpak 的工具。也许你已经知道,为不同的 Linux 发行版打包并分发应用是一件多么费时又复杂的工作,因为不同的 Linux 发行版的库不同,库的版本也不同。现在,Flatpak 作为分发桌面应用的新框架可以让开发者完全摆脱这些负担。开发者只需构建一个 Flatpak app 就可以在多种发行版上安装使用。这真是又酷又棒! 用户也完全不用担心库和依赖的问题了,所有的东西都和 app 打包在了一起。更重要的是 Flatpak app 们都自带沙箱,而且与宿主操作系统的其他部分隔离。对了,Flatpak 还有一个很棒的特性,它允许用户在同一个系统中安装同一应用的多个版本,例如 VLC 播放器的 2.1 版、2.2 版、2.3 版。这使开发者测试同一个软件的多个版本变得更加方便。 @@ -14,56 +14,54 @@ Flatpak 新手指南 Flatpak 可以在大多数的主流 Linux 发行版上安装使用,如 Arch Linux、Debian、Fedora、Gentoo、Red Hat、Linux Mint、openSUSE、Solus、Mageia 还有 Ubuntu。 在 Arch Linux 上,使用这一条命令来安装 Flatpak: + ``` $ sudo pacman -S flatpak - ``` -对于 Debian 用户,Flatpak 被收录进 Stretch 或更新版本的默认软件源中。要安装 Flatpak,直接执行: +对于 Debian 用户,Flatpak 被收录进 Stretch 或之后版本的默认软件源中。要安装 Flatpak,直接执行: + ``` $ sudo apt install flatpak - ``` 对于 Fedora 用户,Flatpak 是发行版默认安装的软件。你可以直接跳过这一步。 -如果因为任何原因没有安装的话,可以执行: +如果因为某种原因没有安装的话,可以执行: + ``` $ sudo dnf install flatpak - ``` 对于 RHEL 7 用户,安装 Flatpak 的命令为: + ``` $ sudo yum install flatpak - ``` 如果你在使用 Linux Mint 18.3,那么 Flatpat 也随系统默认安装,所以跳过这一步。 在 openSUSE Tumbleweed 中,使用 Zypper 包管理来安装 Flatpak: + ``` $ sudo zypper install flatpak - ``` 而 Ubuntu 需要添加下面的软件源再安装 Flatpak,命令如下: + ``` $ sudo add-apt-repository ppa:alexlarsson/flatpak - $ sudo apt update - $ sudo apt install flatpak - ``` Gnome 提供了一个 Flatpak 插件,安装它就可以使用图形界面来安装 Flatpak app 了。插件的安装命令为: + ``` $ sudo apt install gnome-software-plugin-flatpak - ``` -如果你是用发行版没有在上述的说明里,请你参考官方[**安装指南**][2]。 +如果你是用发行版没有在上述的说明里,请你参考官方[安装指南][2]。 ### 开始使用 Flatpak @@ -75,55 +73,54 @@ $ sudo apt install gnome-software-plugin-flatpak #### 添加软件仓库 -**添加 Flathub 仓库:** +**添加 Flathub 仓库:** + +Flathub 是一个包含了几乎所有 flatpak 应用的仓库。运行这条命令来启用它: -**Flathub** 是一个包含了几乎所有 flatpak 应用的仓库。运行这条命令来启用它: ``` $ sudo flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo - ``` 对于流行应用来说,Flathub 已经可以满足需求。如果你想试试 GNOME 应用的话,可以添加 GNOME 的仓库。 -**添加 GNOME 仓库:** +**添加 GNOME 仓库:** -GNOME 仓库包括了所有的 GNOME 核心应用,它提供了两种版本:**稳定版**stable**每日构建版**nightly。 +GNOME 仓库包括了所有的 GNOME 核心应用,它提供了两种版本:稳定版stable每日构建版nightly。 使用下面的命令来添加 GNOME 稳定版仓库: + ``` $ wget https://sdk.gnome.org/keys/gnome-sdk.gpg - $ sudo flatpak remote-add --gpg-import=gnome-sdk.gpg --if-not-exists gnome-apps https://sdk.gnome.org/repo-apps/ - ``` 需要注意的是,GNOME 稳定版仓库中的应用需要 **3.20 版本的 org.gnome.Platform 运行时环境**。 安装稳定版运行时环境,请执行: + ``` $ sudo flatpak remote-add --gpg-import=gnome-sdk.gpg gnome https://sdk.gnome.org/repo/ - ``` 如果想使用每日构建版的 GNOME 仓库,使用如下的命令: + ``` $ wget https://sdk.gnome.org/nightly/keys/nightly.gpg - $ sudo flatpak remote-add --gpg-import=nightly.gpg --if-not-exists gnome-nightly-apps https://sdk.gnome.org/nightly/repo-apps/ - ``` 同样,每日构建版的 GNOME 仓库也需要 **org.gnome.Platform 运行时环境的每日构建版本**。 执行下面的命令安装每日构建版的运行时环境: + ``` $ sudo flatpak remote-add --gpg-import=nightly.gpg gnome-nightly https://sdk.gnome.org/nightly/repo/ - ``` #### 查看软件仓库 要查看已经添加的软件仓库,执行下面的命令: + ``` $ flatpak remotes Name Options @@ -132,7 +129,6 @@ gnome system gnome-apps system gnome-nightly system gnome-nightly-apps system - ``` 如你所见,上述命令会列出你添加到系统中的软件仓库。此外,执行结果还表明了软件仓库的配置是用户级per-user还是系统级system-wide。 @@ -140,121 +136,122 @@ gnome-nightly-apps system #### 删除软件仓库 要删除软件仓库,例如 flathub,用这条命令: + ``` $ sudo flatpak remote-delete flathub - ``` -这里的 **flathub** 是软件仓库的名字。 +这里的 flathub 是软件仓库的名字。 #### 安装 Flatpak 应用 这一节,我们将学习如何安装 flatpak 应用。 要安装一个应用,只要一条命令就能完成: + ``` $ sudo flatpak install flathub com.spotify.Client - ``` 所有的稳定版 GNOME 软件仓库中的应用,都使用“stable”作为版本名。 -例如,想从稳定版 GNOME 软件仓库中安装稳定版 **Evince**,就执行: +例如,想从稳定版 GNOME 软件仓库中安装稳定版 Evince,就执行: + ``` $ sudo flatpak install gnome-apps org.gnome.Evince stable - ``` 所有的每日构建版 GNOME 仓库中的应用,都使用“master”作为版本名。 例如,要从每日构建版 GNOME 软件仓库中安装 gedit 的每次构建版本,就执行: + ``` $ sudo flatpak install gnome-nightly-apps org.gnome.gedit master - ``` 如果不希望应用安装在系统级system-wide,而只安装在用户级per-user,那么你可以这样安装软件: + ``` $ flatpak install --user - ``` -所有的应用都会被存储在 **$HOME/.var/app/** 目录下. +所有的应用都会被存储在 `$HOME/.var/app/` 目录下. + ``` $ ls $HOME/.var/app/ com.spotify.Client - ``` #### 执行 Flatpak 应用 你可以直接使用应用启动器application launcher来运行已安装的 Flatpak 应用。如果你想从命令行启动的话,以 Spotify 为例,执行下面的命令: + ``` $ flatpak run com.spotify.Client - ``` #### 列出已安装的 Flatpak 应用 要查看已安装的应用程序和运行时环境,执行: + ``` $ flatpak list - ``` 想只查看已安装的应用,那就用这条命令: + ``` $ flatpak list --app - ``` 如果想查询已添加的软件仓库中的可安装程序和可安装的运行时环境,使用命令: + ``` $ flatpak remote-ls - ``` 只列出可安装的应用程序的命令是: + ``` $ flatpak remote-ls --app - ``` -查询指定远程仓库中的所有可安装的应用程序和运行时环境,这里以 **gnome-apps** 为例,执行命令: +查询指定远程仓库中的所有可安装的应用程序和运行时环境,这里以 gnome-apps 为例,执行命令: + ``` $ flatpak remote-ls gnome-apps - ``` -只列出可安装的应用程序,这里以 **flathub** 为例: +只列出可安装的应用程序,这里以 flathub 为例: + ``` $ flatpak remote-ls flathub --app - ``` #### 更新应用程序 更新所有的 Flatpak 应用程序,执行: + ``` $ flatpak update - ``` 更新指定的 Flatpak 应用程序,执行: + ``` $ flatpak update com.spotify.Client - ``` #### 获取应用详情 执行下面的命令来查看已安装应用程序的详细信息: + ``` $ flatpak info io.github.mmstick.FontFinder - ``` 输出样例: + ``` Ref: app/io.github.mmstick.FontFinder/x86_64/stable ID: io.github.mmstick.FontFinder @@ -268,28 +265,27 @@ Parent: dbff9150fce9fdfbc53d27e82965010805f16491ec7aa1aa76bf24ec1882d683 Location: /var/lib/flatpak/app/io.github.mmstick.FontFinder/x86_64/stable/07164e84148c9fc8b0a2a263c8a468a5355b89061b43e32d95008fc5dc4988f4 Installed size: 2.5 MB Runtime: org.gnome.Platform/x86_64/3.28 - ``` #### 删除应用程序 要删除一个 Flatpak 应用程序,这里以 spotify 为例,执行: + ``` $ sudo flatpak uninstall com.spotify.Client - ``` 如果你需要更多信息,可以参考 Flatpak 的帮助。 + ``` $ flatpak --help - ``` 到此,希望你对 Flatpak 有了一些基础了解。 -如果你觉得这篇指南有些帮助,请在你的社交媒体上分享它来支持 OSTechNix。 +如果你觉得这篇指南有些帮助,请在你的社交媒体上分享它来支持我们。 -稍后还有更多精彩内容,尽情期待~ +稍后还有更多精彩内容,敬请期待~ -------------------------------------------------------------------------------- @@ -299,7 +295,7 @@ via: https://www.ostechnix.com/flatpak-new-framework-desktop-applications-linux/ 作者:[SK][a] 选题:[lujun9972](https://github.com/lujun9972) 译者:[wwhio](https://github.com/wwhio) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 0df52c9e3ee3caa4ece5ff1558f0424a8c1160d7 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Sun, 20 Jan 2019 11:30:58 +0800 Subject: [PATCH 043/243] PUB:20180428 A Beginners Guide To Flatpak.md @wwhio https://linux.cn/article-10459-1.html --- .../tech => published}/20180428 A Beginners Guide To Flatpak.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {translated/tech => published}/20180428 A Beginners Guide To Flatpak.md (100%) diff --git a/translated/tech/20180428 A Beginners Guide To Flatpak.md b/published/20180428 A Beginners Guide To Flatpak.md similarity index 100% rename from translated/tech/20180428 A Beginners Guide To Flatpak.md rename to published/20180428 A Beginners Guide To Flatpak.md From 420e68c3b6d61e8cc51919385b08db43b3e8c1b0 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Sun, 20 Jan 2019 12:15:21 +0800 Subject: [PATCH 044/243] PRF:20190109 Understanding -etc-services file in Linux.md @MjSeven --- ...derstanding -etc-services file in Linux.md | 23 ++++++++++--------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/translated/tech/20190109 Understanding -etc-services file in Linux.md b/translated/tech/20190109 Understanding -etc-services file in Linux.md index dedbca16e2..fd7a2f3911 100644 --- a/translated/tech/20190109 Understanding -etc-services file in Linux.md +++ b/translated/tech/20190109 Understanding -etc-services file in Linux.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (MjSeven) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Understanding /etc/services file in Linux) @@ -10,12 +10,13 @@ 理解 Linux 中的 /etc/services 文件 ====== -这篇文章将帮助你了解 Linux 中 /etc/services 文件,包括它的内容,格式以及重要性。 +这篇文章将帮助你了解 Linux 中 `/etc/services` 文件,包括它的内容,格式以及重要性。 ![/etc/services file in Linux][1] -Linux 中的 /etc/services 文件 -网络守护程序是 Linux 世界中的重要服务。它借助 `/etc/services` 文件来处理所有网络服务。在本文中,我们将向你介绍这个文件的内容,格式以及它对于 Linux 系统的意义。 +*Linux 中的 /etc/services 文件* + +Internet 守护程序(`ineted`)是 Linux 世界中的重要服务。它借助 `/etc/services` 文件来处理所有网络服务。在本文中,我们将向你介绍这个文件的内容,格式以及它对于 Linux 系统的意义。 `/etc/services` 文件包含网络服务和它们映射端口的列表。`inetd` 或 `xinetd` 会查看这些细节,以便在数据包到达各自的端口或服务有需求时,它会调用特定的程序。 @@ -26,7 +27,7 @@ $ ll /etc/services -rw-r--r--. 1 root root 670293 Jun 7 2013 /etc/services ``` -### `/etc/services` 文件格式 +### /etc/services 文件格式 ``` service-name port/protocol [aliases..] [#comment] @@ -36,12 +37,12 @@ service-name port/protocol [aliases..] [#comment] 其中: - * service-name 是网络服务的名称。例如 [telnet][2], [ftp][3] 等。 - * port/protocol 是网络服务使用的端口(一个数值)和服务通信使用的协议(TCP/UDP)。 - * alias 是服务的别名。 - * comment 是你可以添加到服务的注释或说明。以 `#` 标记开头。 + * `service-name` 是网络服务的名称。例如 [telnet][2]、[ftp][3] 等。 + * `port/protocol` 是网络服务使用的端口(一个数值)和服务通信使用的协议(TCP/UDP)。 + * `alias` 是服务的别名。 + * `comment` 是你可以添加到服务的注释或说明。以 `#` 标记开头。 -### `/etc/services` 文件示例 +### /etc/services 文件示例 ``` # 每行描述一个服务,形式如下: @@ -63,7 +64,7 @@ via: https://kerneltalks.com/linux/understanding-etc-services-file-in-linux/ 作者:[kerneltalks][a] 选题:[lujun9972][b] 译者:[MjSeven](https://github.com/MjSeven) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 899b9e4b1effca33ff1f59c6a38eda4e260b59aa Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Sun, 20 Jan 2019 12:15:52 +0800 Subject: [PATCH 045/243] PUB:20190109 Understanding -etc-services file in Linux.md @MjSeven https://linux.cn/article-10460-1.html --- .../20190109 Understanding -etc-services file in Linux.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20190109 Understanding -etc-services file in Linux.md (97%) diff --git a/translated/tech/20190109 Understanding -etc-services file in Linux.md b/published/20190109 Understanding -etc-services file in Linux.md similarity index 97% rename from translated/tech/20190109 Understanding -etc-services file in Linux.md rename to published/20190109 Understanding -etc-services file in Linux.md index fd7a2f3911..d00d7337c9 100644 --- a/translated/tech/20190109 Understanding -etc-services file in Linux.md +++ b/published/20190109 Understanding -etc-services file in Linux.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (MjSeven) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-10460-1.html) [#]: subject: (Understanding /etc/services file in Linux) [#]: via: (https://kerneltalks.com/linux/understanding-etc-services-file-in-linux/) [#]: author: (kerneltalks https://kerneltalks.com) From 8d45bbab8c4cc299597d2686402cbdef75602ef9 Mon Sep 17 00:00:00 2001 From: qhwdw <33189910+qhwdw@users.noreply.github.com> Date: Sun, 20 Jan 2019 15:30:56 +0800 Subject: [PATCH 046/243] Translated by qhwdw --- ...4 How to Build a Netboot Server, Part 4.md | 139 +++++++++--------- 1 file changed, 69 insertions(+), 70 deletions(-) rename {sources => translated}/tech/20190114 How to Build a Netboot Server, Part 4.md (59%) diff --git a/sources/tech/20190114 How to Build a Netboot Server, Part 4.md b/translated/tech/20190114 How to Build a Netboot Server, Part 4.md similarity index 59% rename from sources/tech/20190114 How to Build a Netboot Server, Part 4.md rename to translated/tech/20190114 How to Build a Netboot Server, Part 4.md index 3b5286df03..84065b2b40 100644 --- a/sources/tech/20190114 How to Build a Netboot Server, Part 4.md +++ b/translated/tech/20190114 How to Build a Netboot Server, Part 4.md @@ -1,23 +1,23 @@ -[#]: collector: (lujun9972) -[#]: translator: (qhwdw) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (How to Build a Netboot Server, Part 4) -[#]: via: (https://fedoramagazine.org/how-to-build-a-netboot-server-part-4/) -[#]: author: (Gregory Bartholomew https://fedoramagazine.org/author/glb/) +[#]: collector: "lujun9972" +[#]: translator: "qhwdw" +[#]: reviewer: " " +[#]: publisher: " " +[#]: url: " " +[#]: subject: "How to Build a Netboot Server, Part 4" +[#]: via: "https://fedoramagazine.org/how-to-build-a-netboot-server-part-4/" +[#]: author: "Gregory Bartholomew https://fedoramagazine.org/author/glb/" -How to Build a Netboot Server, Part 4 +如何构建一台网络引导服务器(四) ====== ![](https://fedoramagazine.org/wp-content/uploads/2018/11/netboot4-816x345.jpg) -One significant limitation of the netboot server built in this series is the operating system image being served is read-only. Some use cases may require the end user to modify the image. For example, an instructor may want to have the students install and configure software packages like MariaDB and Node.js as part of their course walk-through. +在本系列教程中所构建的网络引导服务器有一个很重要的限制,那就是所提供的操作系统镜像是只读的。一些使用场景或许要求终端用户能够修改操作系统镜像。例如,一些教师或许希望学生能够安装和配置一些像 MariaDB 和 Node.js 这样的包来做为他们课程练习的一部分。 -An added benefit of writable netboot images is the end user’s “personalized” operating system can follow them to different workstations they may use at later times. +可写镜像的另外的好处是,终端用户“私人定制”的操作系统,在下次不同的工作站上使用时能够“跟着”他们。 -### Change the Bootmenu Application to use HTTPS +### 修改 Bootmenu 应用程序去使用 HTTPS -Create a self-signed certificate for the bootmenu application: +为 bootmenu 应用程序创建一个自签名的证书: ``` $ sudo -i @@ -27,21 +27,21 @@ $ sudo -i # openssl req -newkey rsa:2048 -nodes -keyout $MY_TLSD/$MY_NAME.key -x509 -days 3650 -out $MY_TLSD/$MY_NAME.pem ``` -Verify your certificate’s values. Make sure the “CN” value in the “Subject” line matches the DNS name that your iPXE clients use to connect to your bootmenu server: +验证你的证书的值。确保 “Subject” 行中 “CN” 的值与你的 iPXE 客户端连接你的网络引导服务器所使用的 DNS 名字是相匹配的: ``` # openssl x509 -text -noout -in $MY_TLSD/$MY_NAME.pem ``` -Next, update the bootmenu application’s listen directive to use the HTTPS port and the newly created certificate and key: +接下来,更新 bootmenu 应用程序去监听 HTTPS 端口和新创建的证书及密钥: ``` # sed -i "s#listen => .*#listen => ['https://$MY_NAME:443?cert=$MY_TLSD/$MY_NAME.pem\&key=$MY_TLSD/$MY_NAME.key\&ciphers=AES256-SHA256:AES128-SHA256:AES256-SHA:AES128-SHA'],#" /opt/bootmenu/bootmenu.conf ``` -Note the ciphers have been restricted to [those currently supported by iPXE][1]. +注意 [iPXE 当前支持的][1] 加密算法是有限制的。 -GnuTLS requires the “CAP_DAC_READ_SEARCH” capability, so add it to the bootmenu application’s systemd service: +GnuTLS 要求 “CAP_DAC_READ_SEARCH” 能力,因此将它添加到 bootmenu 应用程序的 systemd 服务: ``` # sed -i '/^AmbientCapabilities=/ s/$/ CAP_DAC_READ_SEARCH/' /etc/systemd/system/bootmenu.service @@ -49,7 +49,7 @@ GnuTLS requires the “CAP_DAC_READ_SEARCH” capability, so add it to the bootm # systemctl daemon-reload ``` -Now, add an exception for the bootmenu service to the firewall and restart the service: +现在,在防火墙中为 bootmenu 服务添加一个例外规则并重启动服务: ``` # MY_SUBNET=192.0.2.0 @@ -59,7 +59,7 @@ Now, add an exception for the bootmenu service to the firewall and restart the s # systemctl restart bootmenu.service ``` -Use wget to verify it’s working: +使用 wget 去验证是否工作正常: ``` $ MY_NAME=server-01.example.edu @@ -67,9 +67,9 @@ $ MY_TLSD=/opt/bootmenu/tls $ wget -q --ca-certificate=$MY_TLSD/$MY_NAME.pem -O - https://$MY_NAME/menu ``` -### Add HTTPS to iPXE +### 添加 HTTPS 到 iPXE -Update init.ipxe to use HTTPS. Then recompile the ipxe bootloader with options to embed and trust the self-signed certificate you created for the bootmenu application: +更新 init.ipxe 去使用 HTTPS。接着使用选项重新编译 ipxe 引导加载器,以便它包含和信任你为 bootmenu 应用程序创建的自签名证书: ``` $ echo '#define DOWNLOAD_PROTO_HTTPS' >> $HOME/ipxe/src/config/local/general.h @@ -80,22 +80,22 @@ $ make clean $ make bin-x86_64-efi/ipxe.efi EMBED=../init.ipxe CERT="../$MY_NAME.pem" TRUST="../$MY_NAME.pem" ``` -You can now copy the HTTPS-enabled iPXE bootloader out to your clients and test that everything is working correctly: +你现在可以将启用了 HTTPS 的 iPXE 引导加载器复制到你的客户端上,并测试它能否正常工作: ``` $ cp $HOME/ipxe/src/bin-x86_64-efi/ipxe.efi $HOME/esp/efi/boot/bootx64.efi ``` -### Add User Authentication to Mojolicious +### 添加用户验证到 Mojolicious 中 -Create a PAM service definition for the bootmenu application: +为 bootmenu 应用程序创建一个 PAM 服务定义: ``` # dnf install -y pam_krb5 # echo 'auth required pam_krb5.so' > /etc/pam.d/bootmenu ``` -Add a library to the bootmenu application that uses the Authen-PAM perl module to perform user authentication: +添加一个库到 bootmenu 应用程序中,它使用 Authen-PAM 的 perl 模块去执行用户验证: ``` # dnf install -y perl-Authen-PAM; @@ -144,9 +144,9 @@ return 1; END ``` -The above code is taken almost verbatim from the Authen::PAM::FAQ man page. +以上的代码是一字不差是从 Authen::PAM::FAQ 的 man 页面中复制来的。 -Redefine the bootmenu application so it returns a netboot template only if a valid username and password are supplied: +重定义 bootmenu 应用程序,以使它仅当提供了有效的用户名和密码之后返回一个网络引导模板: ``` # cat << 'END' > $MY_MOJO/bootmenu.pl @@ -185,14 +185,14 @@ app->start; END ``` -The bootmenu application now looks for the lib directory relative to its WorkingDirectory. However, by default the working directory is set to the root directory of the server for systemd units. Therefore, you must update the systemd unit to set WorkingDirectory to the root of the bootmenu application instead: +bootmenu 应用程序现在查找 lib 去找到相应的 WorkingDirectory。但是,默认情况下,对于 systemd 单元它的工作目录设置为服务器的 root 目录。因此,你必须更新 systemd 单元去设置 WorkingDirectory 为 bootmenu 应用程序的根目录: ``` # sed -i "/^RuntimeDirectory=/ a WorkingDirectory=$MY_MOJO" /etc/systemd/system/bootmenu.service # systemctl daemon-reload ``` -Update the templates to work with the redefined bootmenu application: +更新模块去使用重定义后的 bootmenu 应用程序: ``` # cd $MY_MOJO/templates @@ -201,7 +201,7 @@ Update the templates to work with the redefined bootmenu application: # for i in $MY_FEDORA_RELEASES; do echo '#!ipxe' > fc$i.html.ep; grep "^kernel\|initrd" menu.html.ep | grep "fc$i" >> fc$i.html.ep; echo "boot || chain https://$MY_BOOTMENU_SERVER/menu" >> fc$i.html.ep; sed -i "/^:f$i$/,/^boot /c :f$i\nlogin\nchain https://$MY_BOOTMENU_SERVER/boot?instance=fc$i\&username=\${username}\&password=\${password:uristring} || goto failed" menu.html.ep; done ``` -The result of the last command above should be three files similar to the following: +上面的最后的命令将生成类似下面的三个文件: **menu.html.ep** : @@ -259,41 +259,41 @@ initrd --name initrd.img ${prefix}/initramfs-4.19.3-200.fc28.x86_64.img boot || chain https://server-01.example.edu/menu ``` -Now, restart the bootmenu application and verify authentication is working: +现在,重启动 bootmenu 应用程序,并验证用户认证是否正常工作: ``` # systemctl restart bootmenu.service ``` -### Make the iSCSI Target Writeable +### 使得 iSCSI Target 可写 -Now that user authentication works through iPXE, you can create per-user, writeable overlays on top of the read-only image on demand when users connect. Using a [copy-on-write][2] overlay has three advantages over simply copying the original image file for each user: +现在,用户验证通过 iPXE 可以正常工作,在用户连接时,你可以按需在只读镜像的上面创建每用户的可写覆盖。使用一个 [写时复制][2] 覆盖与简单地为每个用户复制原始镜像相比有三个好处: - 1. The copy can be created very quickly. This allows creation on-demand. - 2. The copy does not increase the disk usage on the server. Only what the user writes to their personal copy of the image is stored in addition to the original image. - 3. Since most sectors for each copy are the same sectors on the server’s storage, they’ll likely already be loaded in RAM when subsequent users access their copies of the operating system. This improves the server’s performance because RAM is faster than disk I/O. + 1. 复制创建非常快。这样就可以按需创建。 + 2. 复制并不增加服务器上的磁盘使用。除了原始镜像之外,仅存储用户写入个人镜像的内容。 + 3. 由于每个用户复制的扇区大多都是服务器的存储上的相同的扇区,在随后的用户访问这些操作系统的副本时,它们可能已经加载到内存中,这样就提升了服务器的性能,因为对内存的访问速度要比磁盘 I/O 快得多。 -One potential pitfall of using copy-on-write is that once overlays are created, the images on which they are overlayed must not be changed. If they are changed, all the overlays will be corrupted. Then the overlays must be deleted and replaced with new, blank overlays. Even simply mounting the image file in read-write mode can cause sufficient filesystem updates to corrupt the overlays. +使用写时复制的一个潜在隐患是,一旦覆盖创建后,覆盖之下的镜像就不能再改变。如果它们改变,所有它们之上的覆盖将出错。因此,覆盖必须被删除并用新的、空白的替换。即便只是简单地以读写模式加载的镜像,也可能因为某些文件系统更新导致覆盖出错。 -Due to the potential for the overlays to be corrupted if the original image is modified, mark the original image as immutable by running: +由于这个隐患,如果原始镜像被修改将导致覆盖出错,因此运行下列的命令,将原始镜像标记为不可改变: ``` # chattr +i ``` -You can use lsattr to view the status of the immutable flag and use to chattr -i unset the immutable flag. While the immutable flag is set, even the root user or a system process running as root cannot modify or delete the file. +你可以使用 `lsattr ` 去查看不可改变标志,并可以使用 `chattr -i ` 取消设置不可改变标志。在设置了不可改变标志之后,即便是 root 用户或以 root 运行的系统进程也不修改或删除这个文件。 -Begin by stopping the tgtd.service so you can change the image files: +停止 tgtd.service 之后,你就可以改变镜像文件: ``` # systemctl stop tgtd.service ``` -It’s normal for this command to take a minute or so to stop when there are connections still open. +当仍有连接打开的时候,运行这个命令一般需要一分钟或更长的时间。 -Now, remove the read-only iSCSI export. Then update the readonly-root configuration file in the template so the image is no longer read-only: +现在,移除只读的 iSCSI 出口。然后更新模板中的配置文件为 readonly-root,以使镜像不再是只读的: ``` # MY_FC=fc29 @@ -305,16 +305,16 @@ Now, remove the read-only iSCSI export. Then update the readonly-root configurat # umount $TEMP_MNT ``` -Journald was changed from logging to volatile memory back to its default (log to disk if /var/log/journal exists) because a user reported his clients would freeze with an out-of-memory error due to an application generating excessive system logs. The downside to setting logging to disk is that extra write traffic is generated by the clients, and might burden your netboot server with unnecessary I/O. You should decide which option — log to memory or log to disk — is preferable depending on your environment. +将 Journald 日志从发送到内存修改回缺省值(记录到磁盘,如果 /var/log/journal 存在的话),因为一个用户报告说,他的客户端由于应用程序生成了大量的系统日志而产生内存溢出错误,导致它的客户端被卡住。而将日志记录到磁盘的负面影响是客户端产生了额外的写入流量,这将在你的网络引导服务器上可能增加一些没有必要的 I/O。你应该去决定到底使用哪个选择 — 记录到内存还是记录到硬盘 — 哪个更合适取决于你的环境。 -Since you won’t make any further changes to the template image, set the immutable flag on it and restart the tgtd.service: +因为你的模板镜像在以后不能做任何的更改,因此在它上面设置不可更改标志,然后重启动 tgtd.service: ``` # chattr +i /$MY_FC.img # systemctl start tgtd.service ``` -Now, update the bootmenu application: +现在,更新 bootmenu 应用程序: ``` # cat << 'END' > $MY_MOJO/bootmenu.pl @@ -355,13 +355,13 @@ app->start; END ``` -This new version of the bootmenu application calls a custom mktgt script which, on success, returns a random [CHAP][3] password for each new iSCSI target that it creates. The CHAP password prevents one user from mounting another user’s iSCSI target by indirect means. The app only returns the correct iSCSI target password to a user who has successfully authenticated. +新版本的 bootmenu 应用程序调用一个定制的 mktgt 脚本,如果成功,它将为每个它自己创建的新的 iSCSI 目标返回一个随机的 [CHAP][3] 密码。这个 CHAP 密码可以防止其它用户的 iSCSI 目标以间接方式挂载这个用户的目标。这个应用程序只有在用户密码认证成功之后才返回一个正确的 iSCSI 目标密码。 -The mktgt script is prefixed with sudo because it needs root privileges to create the target. +mktgt 脚本要加 sudo 前缀来运行,因为它需要 root 权限去创建目标。 -The $username and $chapscrt variables also pass to the render command so they can be incorporated into the templates returned to the user when necessary. +\$username 和 \$chapscrt 变量也传递 render 命令,因此在需要的时候,它们也能够被纳入到模板中返回给用户。 -Next, update our boot templates so they can read the username and chapscrt variables and pass them along to the end user. Also update the templates to mount the root filesystem in rw (read-write) mode: +接下来,更新我们的引导模板,以便于它们能够读取用户名和 chapscrt 变量,并传递它们到所属的终端用户。也要更新模板以 rw(读写)模式加载根文件系统: ``` # cd $MY_MOJO/templates @@ -370,7 +370,7 @@ Next, update our boot templates so they can read the username and chapscrt varia # sed -i "s/ ro / rw /" $MY_FC.html.ep ``` -After running the above commands, you should have boot templates like the following: +运行上面的命令后,你应该会看到如下的引导模板: ``` #!ipxe @@ -379,17 +379,17 @@ initrd --name initrd.img ${prefix}/initramfs-4.19.5-300.fc29.x86_64.img boot || chain https://server-01.example.edu/menu ``` -NOTE: If you need to view the boot template after the variables have been [interpolated][4], you can insert the “shell” command on its own line just before the “boot” command. Then, when you netboot your client, iPXE gives you an interactive shell where you can enter “imgstat” to view the parameters being passed to the kernel. If everything looks correct, you can type “exit” to leave the shell and continue the boot process. +注意:如果在 [插入][4] 变量后需要查看引导模板,你可以在 “boot” 命令之前,在它自己的行中插入 “shell” 命令。然后在你网络引导你的客户端时,iPXE 将在那里给你提供一个用于交互的 shell,你可以在 shell 中输入 “imgstat” 去查看传递到内核的参数。如果一切正确,你可以输入 “exit” 去退出 shell 并继续引导过程。 -Now allow the bootmenu user to run the mktgt script (and only that script) as root via sudo: +现在,通过 sudo 允许 bootmenu 用户以 root 权限去运行 mktgt 脚本(仅那个脚本): ``` # echo "bootmenu ALL = NOPASSWD: $MY_MOJO/scripts/mktgt *" > /etc/sudoers.d/bootmenu ``` -The bootmenu user should not have write access to the mktgt script or any other files under its home directory. All the files under /opt/bootmenu should be owned by root, and should not be writable by any user other than root. +bootmenu 用户不应该写访问 mktgt 脚本或在它的 home 目录下的任何其它文件。在 /opt/bootmenu 目录下的所有文件的属主应该是 root,并且不应该被其它任何 root 以外的用户可写。 -Sudo does not work well with systemd’s DynamicUser option, so create a normal user account and set the systemd service to run as that user: +Sudo 在使用 systemd 的 DynamicUser 选项下不能正常工作,因此创建一个普通用户帐户,并设置 systemd 服务以那个用户运行: ``` # useradd -r -c 'iPXE Boot Menu Service' -d /opt/bootmenu -s /sbin/nologin bootmenu @@ -397,7 +397,7 @@ Sudo does not work well with systemd’s DynamicUser option, so create a normal # systemctl daemon-reload ``` -Finally, create a directory for the copy-on-write overlays and create the mktgt script that manages the iSCSI targets and their overlayed backing stores: +最后,为写时复制覆盖创建一个目录,并创建管理 iSCSI 目标的 mktgt 脚本和它们的覆盖支持存储: ``` # mkdir /$MY_FC.cow @@ -508,27 +508,27 @@ END # chmod +x $MY_MOJO/scripts/mktgt ``` -The above script does five things: +上面的脚本将做以下五件事情: - 1. It creates the /.cow/ sparse file if it does not already exist. - 2. It creates the /dev/mapper/- device node that serves as the copy-on-write backing store for the iSCSI target if it does not already exist. - 3. It creates the iqn.:- iSCSI target if it does not exist. Or, if the target does exist, it closes any existing connections to it because the image can only be opened in read-write mode from one place at a time. - 4. It (re)sets the chap password on the iqn.:- iSCSI target to a new random value. - 5. It prints the new chap password on [standard output][5] if all of the previous tasks compeleted successfully. + 1. 创建 /.cow/ 稀疏文件(如果不存在的话)。 + 2. 创建 /dev/mapper/- 设备节点作为 iSCSI 目标的写时复制支持存储(如果不存在的话)。 + 3. 创建 iqn.:- iSCSI 目标(如果不存在的话)。或者,如果已存在了,它将关闭任何已存在的连接,因为在任何时刻,镜像只能以只读模式从一个地方打开。 + 4. 它在 iqn.:- iSCSI 目标上(重新)设置 chap 密码为一个新的随机值。 + 5. (如果前面的所有任务都成功的话)它在 [标准输出][5] 上显示新的 chap 密码。 -You should be able to test the mktgt script from the command line by running it with valid test parameters. For example: +你应该可以在命令行上通过使用有效的测试参数来运行它,以测试 mktgt 脚本能否正常工作。例如: ``` # echo `$MY_MOJO/scripts/mktgt fc29 jsmith` ``` -When run from the command line, the mktgt script should print out either the eight-character random password for the iSCSI target if it succeeded or the line number on which something went wrong if it failed. +当你从命令行上运行时,mktgt 脚本应该会输出 iSCSI 目标的一个随意的八字符随机密码(如果成功的话)或者是出错位置的行号(如果失败的话)。 -On occasion, you may want to delete an iSCSI target without having to stop the entire service. For example, a user might inadvertently corrupt their personal image, in which case you would need to systematically undo everything that the above mktgt script does so that the next time they log in they will get a copy of the original image. +有时候,你可能需要在不停止整个服务的情况下删除一个 iSCSI 目标。例如,一个用户可能无意中损坏了他的个人镜像,在那种情况下,你可能需要按步骤撤销上面的 mktgt 脚本所做的事情,以便于他下次登入时他将得到一个原始镜像。 -Below is an rmtgt script that undoes, in reverse order, what the above mktgt script did: +下面是用于撤销的 rmtgt 脚本,它以相反的顺序做了上面 mktgt 脚本所做的事情: ``` # mkdir $HOME/bin @@ -594,30 +594,29 @@ END # chmod +x $HOME/bin/rmtgt ``` -For example, to use the above script to completely remove the fc29-jsmith target including its backing store device node and its sparse file, run the following: +例如,使用上面的脚本去完全删除 fc29-jsmith 目标,包含它的支持存储设备节点和稀疏文件,可以按下列方式运行命令: ``` # rmtgt fc29 jsmith +f ``` -Once you’ve verified that the mktgt script is working properly, you can restart the bootmenu service. The next time someone netboots, they should receive a personal copy of the the netboot image they can write to: +一旦你验证 mktgt 脚本工作正常,你可以重启动 bootmenu 服务。下次有人从网络引导时,他们应该能够接收到一个他们可以写入的、可”私人定制“的网络引导镜像的副本: ``` # systemctl restart bootmenu.service ``` -Users should now be able to modify the root filesystem as demonstrated in the below screenshot: +现在,就像下面的截屏示范的那样,用户应该可以修改根文件系统了: ![][6] - -------------------------------------------------------------------------------- via: https://fedoramagazine.org/how-to-build-a-netboot-server-part-4/ 作者:[Gregory Bartholomew][a] 选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) +译者:[qhwdw](https://github.com/qhwdw) 校对:[校对者ID](https://github.com/校对者ID) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 8ed6a66ecaefd394430914619c36d59c94bcb555 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Sun, 20 Jan 2019 20:56:23 +0800 Subject: [PATCH 047/243] PRF:20181016 Final JOS project.md @qhwdw --- translated/tech/20181016 Final JOS project.md | 56 ++++++------------- 1 file changed, 17 insertions(+), 39 deletions(-) diff --git a/translated/tech/20181016 Final JOS project.md b/translated/tech/20181016 Final JOS project.md index eda24d1d5a..92b14d8f97 100644 --- a/translated/tech/20181016 Final JOS project.md +++ b/translated/tech/20181016 Final JOS project.md @@ -1,12 +1,12 @@ -最终的 JOS 项目 +Caffeinated 6.828:实验 6:最终的 JOS 项目 ====== + ### 简介 对于最后的项目,你有两个选择: * 继续使用你自己的 JOS 内核并做 [实验 6][1],包括实验 6 中的一个挑战问题。(你可以随意地、以任何有趣的方式去扩展实验 6 或者 JOS 的任何部分,当然了,这不是课程规定的。) - -* 在一个、二个或三个人组成的团队中,你选择去做一个涉及了你的 JOS 的项目。这个项目必须是涉及到与实验 6 相同或更大的(如果你是团队中的一员)领域。 +* 在一个、二个或三个人组成的团队中,你选择去做一个涉及了你的 JOS 的项目。这个项目必须是涉及到与实验 6 相同或更大的领域(如果你是团队中的一员)。 目标是为了获得乐趣或探索更高级的 O/S 的话题;你不需要做最新的研究。 @@ -16,70 +16,48 @@ ### 交付期限 -``` -11 月 3 日:Piazza 讨论和 1、2、或 3 年级组选择(根据你的最终选择来定)。使用在 Piazza 上的 lab7 标记/目录。在 Piazza 上的文章评论区与其它人计论想法。使用这些文章帮你去找到有类似想法的其它学生一起组建一个小组。课程的教学人员将在 Piazza 上为你的项目想法给出反馈;如果你想得到更详细的反馈,可以与我们单独讨论。 -``` +> 11 月 3 日:Piazza 讨论和 1、2、或 3 年级组选择(根据你的最终选择来定)。使用在 Piazza 上的 lab7 标记/目录。在 Piazza 上的文章评论区与其它人计论想法。使用这些文章帮你去找到有类似想法的其它学生一起组建一个小组。课程的教学人员将在 Piazza 上为你的项目想法给出反馈;如果你想得到更详细的反馈,可以与我们单独讨论。 -```markdown -11 月 9 日:在 [提交网站][19] 上提交一个提议,只需要一到两个段落就可以。提议要包括你的小组成员列表、你的计划、以及明确的设计和实现打算。(如果你做实验 6,就不用做这个了) -``` +. -```markdown -12 月 7 日:和你的简短报告一起提交源代码。将你的报告放在与名为 "README.pdf" 的文件相同的目录下。由于你只是这个实验任务小组中的一员,你可能需要去使用 git 在小组成员之间共享你的项目代码。因此你需要去决定哪些源代码将作为你的小组项目的共享起始点。一定要为你的最终项目去创建一个分支,并且命名为 `lab7`。(如果你做了实验 6,就按实验 6 的提交要求做即可。) -``` +> 11 月 9 日:在 [提交网站][19] 上提交一个提议,只需要一到两个段落就可以。提议要包括你的小组成员列表、你的计划、以及明确的设计和实现打算。(如果你做实验 6,就不用做这个了) -``` -12 月 11 日这一周:简短的课堂演示。为你的 JOS 项目准备一个简短的课堂演示。为了你的项目演示,我们将提供一个投影仪。根据小组数量和每个小组选择的项目类型,我们可能会限制总的演讲数,并且有些小组可能最终没有机会上台演示。 -``` +. -``` -12 月 11 日这一周:助教们验收。向助教演示你的项目,因此我们可能会提问一些问题,去了解你所做的一些细节。 -``` +> 12 月 7 日:和你的简短报告一起提交源代码。将你的报告放在与名为 “README.pdf” 的文件相同的目录下。由于你只是这个实验任务小组中的一员,你可能需要去使用 git 在小组成员之间共享你的项目代码。因此你需要去决定哪些源代码将作为你的小组项目的共享起始点。一定要为你的最终项目去创建一个分支,并且命名为 `lab7`。(如果你做了实验 6,就按实验 6 的提交要求做即可。) + +. + +> 12 月 11 日这一周:简短的课堂演示。为你的 JOS 项目准备一个简短的课堂演示。为了你的项目演示,我们将提供一个投影仪。根据小组数量和每个小组选择的项目类型,我们可能会限制总的演讲数,并且有些小组可能最终没有机会上台演示。 + +. + +> 12 月 11 日这一周:助教们验收。向助教演示你的项目,因此我们可能会提问一些问题,去了解你所做的一些细节。 ### 项目想法 如果你不做实验 6,下面是一个启迪你的想法列表。但是,你应该大胆地去实现你自己的想法。其中一些想法只是一个开端,并且本身不在实验 6 的领域内,并且其它的可能是在更大的领域中。 * 使用 [x86 虚拟机支持][2] 去构建一个能够运行多个访客系统(比如,多个 JOS 实例)的虚拟机监视器。 - * 使用 Intel SGX 硬件保护机制做一些有用的事情。[这是使用 Intel SGX 的最新的论文][3]。 - * 让 JOS 文件系统支持写入、文件创建、为持久性使用日志、等等。或许你可以从 Linux EXT3 上找到一些启示。 - * 从 [软更新][4]、[WAFL][5]、ZFS、或其它较高级的文件系统上找到一些使用文件系统的想法。 - * 给一个文件系统添加快照功能,以便于用户能够查看过去的多个时间点上的文件系统。为了降低空间使用量,你或许要使用一些写时复制技术。 - * 使用分页去提供实时共享的内存,来构建一个 [分布式的共享内存][6](DSM)系统,以便于你在一个机器集群上运行多线程的共享内存的并行程序。当一个线程尝试去访问位于另外一个机器上的页时,页故障将给 DSM 系统提供一个机会,让它基于网络去从当前存储这个页的任意一台机器上获取这个页。 - * 允许进程在机器之间基于网络进行迁移。你将需要做一些关于一个进程状态的多个片段方面的事情,但是由于在 JOS 中许多状态是在用户空间中,它或许从 Linux 上的进程迁移要容易一些。 - * 在 JOS 中实现 [分页][7] 到磁盘,这样那个进程使用的内存就可以大于真实的内存。使用交换空间去扩展你的内存。 - * 为 JOS 实现文件的 [mmap()][8]。 - * 使用 [xfi][9] 将一个进程的代码沙箱化。 - * 支持 x86 的 [2MB 或 4MB 的页大小][10]。 - * 修改 JOS 让内核支持进程内的线程。从查看 [课堂上的 uthread 任务][11] 去开始。实现调度器触发将是实现这个项目的一种方式。 - * 在 JOS 的内核中或文件系统中(实现多线程之后),使用细粒度锁或无锁并发。Linux 内核使用 [读复制更新][12] 去执行无需上锁的读取操作。通过在 JOS 中实现它来探索 RCU,并使用它去支持无锁读取的名称缓存。 - * 实现 [外内核论文][13] 中的想法。例如包过滤器。 - * 使 JOS 拥有软实时行为。用它来辨识一些应用程序时非常有用。 - * 使 JOS 运行在 64 位 CPU 上。这包括重设计虚拟内存让它使用 4 级页表。有关这方面的文档,请查看 [参考页][14]。 - * 移植 JOS 到一个不同的微处理器。这个 [osdev wiki][15] 或许对你有帮助。 - * 为 JOS 系统增加一个“窗口”系统,包括图形驱动和鼠标。有关这方面的文档,请查看 [参考页][16]。[sqrt(x)][17] 就是一个 JOS “窗口” 系统的示例。 - * 在 JOS 中实现 [dune][18],以提供特权硬件指令给用户空间应用程序。 - * 写一个用户级调试器,添加类似跟踪的功能;硬件寄存器概要(即:Oprofile);调用跟踪等等。 - * 为(静态的)Linux 可运行程序做一个二进制仿真。 -------------------------------------------------------------------------------- @@ -89,7 +67,7 @@ via: https://pdos.csail.mit.edu/6.828/2018/labs/lab7/ 作者:[csail.mit][a] 选题:[lujun9972][b] 译者:[qhwdw](https://github.com/qhwdw) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From dbb0e748a4c949836e552fb01d4861fede72d2f7 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Sun, 20 Jan 2019 20:56:41 +0800 Subject: [PATCH 048/243] PUB:20181016 Final JOS project.md @qhwdw https://linux.cn/article-10461-1.html --- {translated/tech => published}/20181016 Final JOS project.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {translated/tech => published}/20181016 Final JOS project.md (100%) diff --git a/translated/tech/20181016 Final JOS project.md b/published/20181016 Final JOS project.md similarity index 100% rename from translated/tech/20181016 Final JOS project.md rename to published/20181016 Final JOS project.md From f4527c0ac6fd7aa25e88736ff454adbb941cc902 Mon Sep 17 00:00:00 2001 From: lxy <524187166@qq.com> Date: Sun, 20 Jan 2019 22:24:36 +0800 Subject: [PATCH 049/243] 20180625 --- ...180625 The life cycle of a software bug.md | 68 ------------------- ...180625 The life cycle of a software bug.md | 67 ++++++++++++++++++ 2 files changed, 67 insertions(+), 68 deletions(-) delete mode 100644 sources/tech/20180625 The life cycle of a software bug.md create mode 100644 translated/tech/20180625 The life cycle of a software bug.md diff --git a/sources/tech/20180625 The life cycle of a software bug.md b/sources/tech/20180625 The life cycle of a software bug.md deleted file mode 100644 index 0f45d7a355..0000000000 --- a/sources/tech/20180625 The life cycle of a software bug.md +++ /dev/null @@ -1,68 +0,0 @@ -translated by lixinyuxx -The life cycle of a software bug -====== - -![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/bug_software_issue_tracking_computer_screen.jpg?itok=6qfIHR5y) - -In 1947, the first computer bug was found—a moth trapped in a computer relay. - -If only all bugs were as simple to uncover. As software has become more complex, so too has the process of testing and debugging. Today, the life cycle of a software bug can be lengthy—though the right technology and business processes can help. For open source software, developers use rigorous ticketing services and collaboration to find and mitigate bugs. - -### Confirming a computer bug - -During the process of testing, bugs are reported to the development team. Quality assurance testers describe the bug in as much detail as possible, reporting on their system state, the processes they were undertaking, and how the bug manifested itself. - -Despite this, some bugs are never confirmed; they may be reported in testing but can never be reproduced in a controlled environment. In such cases they may not be resolved but are instead closed. - -It can be difficult to confirm a computer bug due to the wide array of platforms in use and the many different types of user behavior. Some bugs only occur intermittently or under very specific situations, and others may occur seemingly at random. - -Many people use and interact with open source software, and many bugs and issues may be non-repeatable or may not be adequately described. Still, because every user and developer also plays the role of quality assurance tester, at least in part, there is a good chance that bugs will be revealed. - -When a bug is confirmed, work begins. - -### Assigning a bug to be fixed - -A confirmed bug is assigned to a developer or a development team to be addressed. At this stage, the bug needs to be reproduced, the issue uncovered, and the associated code fixed. Developers may categorize this bug as an issue to be fixed later if the bug is low-priority, or they may assign someone directly if it is high-priority. Either way, a ticket is opened during the process of development, and the bug becomes a known issue. - -In open source solutions, developers may select from the bugs that they want to tackle, either choosing the areas of the program with which they are most familiar or working from the top priorities. Consolidated solutions such as [GitHub][1] make it easy for multiple developers to work on solutions without interfering with each other's work. - -When assigning bugs to be fixed, reporters may also select a priority level for the bug. Major bugs may have a high priority level, whereas bugs related to appearance only, for example, may have a lower level. This priority level determines how and when the development team is assigned to resolve these issues. Either way, all bugs need to be resolved before a product can be considered complete. Using proper traceability back to prioritized requirements can also be helpful in this regard. - -### Resolving the bug - -Once a bug has been fixed, it is usually be sent back to Quality Assurance as a resolved bug. Quality Assurance then puts the product through its paces again to reproduce the bug. If the bug cannot be reproduced, Quality Assurance will assume that it has been properly resolved. - -In open source situations, any changes are distributed—often as a tentative release that is being tested. This test release is distributed to users, who again fulfill the role of Quality Assurance and test the product. - -If the bug occurs again, the issue is sent back to the development team. At this stage, the bug is reopened, and it is up to the development team to repeat the cycle of resolving the bug. This may occur multiple times, especially if the bug is unpredictable or intermittent. Intermittent bugs are notoriously difficult to resolve. - -If the bug does not occur again, the issue will be marked as resolved. In some cases, the initial bug is resolved, but other bugs emerge as a result of the changes made. When this happens, new bug reports may need to be initiated, starting the process over again. - -### Closing the bug - -After a bug has been addressed, identified, and resolved, the bug is closed and developers can move on to other areas of software development and testing. A bug will also be closed if it was never found or if developers were never able to reproduce it—either way, the next stage of development and testing will begin. - -Any changes made to the solution in the testing version will be rolled into the next release of the product. If the bug was a serious one, a patch or a hotfix may be provided for current users until the release of the next version. This is common for security issues. - -Software bugs can be difficult to find, but by following set processes and procedures, developers can make the process faster, easier, and more consistent. Quality Assurance is an important part of this process, as QA testers must find and identify bugs and help developers reproduce them. Bugs cannot be closed and resolved until the error no longer occurs. - -Open source solutions distribute the burden of quality assurance testing, development, and mitigation, which often leads to bugs being discovered and mitigated more quickly and comprehensively. However, because of the nature of open source technology, the speed and accuracy of this process often depends upon the popularity of the solution and the dedication of its maintenance and development team. - -_Rich Butkevic is a PMP certified project manager, certified scum master, and runs[Project Zendo][2] , a website for project management professionals to discover strategies to simplify and improve their project results. Connect with Rich at [Richbutkevic.com][3] or on [LinkedIn][4]._ - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/18/6/life-cycle-software-bug - -作者:[Rich Butkevic][a] -选题:[lujun9972](https://github.com/lujun9972) -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]:https://opensource.com/users/rich-butkevic -[1]:https://github.com/ -[2]:https://projectzendo.com -[3]:https://richbutkevic.com -[4]:https://www.linkedin.com/in/richbutkevic diff --git a/translated/tech/20180625 The life cycle of a software bug.md b/translated/tech/20180625 The life cycle of a software bug.md new file mode 100644 index 0000000000..c25b4ce086 --- /dev/null +++ b/translated/tech/20180625 The life cycle of a software bug.md @@ -0,0 +1,67 @@ +软件 bug 的生命周期 +====== + +![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/bug_software_issue_tracking_computer_screen.jpg?itok=6qfIHR5y) + +1947年,发现了第一个计算机 bug --被困在计算机继电器中的飞蛾。 + +要是所有的 bug 都能如此简单地发现就好了。随着软件变得越来越复杂,测试和调试的过程也变得更加复杂。如今,软件 bug 的生命周期可能会很长, 尽管正确的技术和业务流程可能会有所帮助。对于开源软件,开发人员使用严格的票务服务和协作来查找和缓解 bugs 。 + +### 确认计算机 bug + +在测试过程中,会向开发团队报告 bug 。质量保证人员尽可能详细地描述 bug , 报告他们的系统状态、他们正在进行的进程以及 bug 是如何表现出来的。 + +尽管如此, 一些 bug 从未得到证实;它们可能会在测试中报告, 但永远无法在受控环境中重现。在这种情况下,它们可能得不到解决, 而是被关闭。 + +由于使用的平台种类繁多, 用户行为也非常多, 因此很难确认计算机 bug ,有些 bug 只是间歇性地或在非常特殊的情况下发生的,而另一些 bug 可能会出现在随机的情况下。 + +许多人使用开源软件并与之交互,许多 bug 和问题可能是不可重复的, 或者可能没有得到充分的描述。不过, 由于每个用户和开发人员也都扮演质量保证测试员的角色,至少在一定程度上, 很有可能会发现 bug 。 + +确认 bug 后,工作就开始了。 + +### 分配要修复的 bug + +已确认的 bug 被分配给解决的开发人员或开发团队。在此阶段, 需要重现 bug ,发现问题,并修复相关代码。如果 bug 的优先级较低,开发人员可以将此 bug 分类为稍后要修复的问题,也可以在该 bug 具有高优先级的情况下直接指派某人。无论哪种方式,都会在开发过程中打开票证,并且 bug 将成为已知的问题。 + +在开源解决方案中,开发人员可以从他们想要解决的 bug 中进行选择, 要么选择他们最熟悉的程序区域,要么从最优先的开始。综合解决方案, 如 [GitHub][1] 使多个开发人员能够轻松地处理解决方案, 而不会干扰彼此的工作。 + +在分配要修复的 bug 时,记录者还可以为 bug 选择优先级。主要 bug 可能具有较高的优先级,而仅与外观相关的 bug 可能具有较低的级别。优先级确定开发团队解决这些问题的方式和时间。无论哪种方式, 所有的 bug 都需要先解决,然后才能认为产品已完成。在这方面,使用适当的回溯性到优先级高的的需求也会很有帮助。 + +### 解决 bug + +一旦修复了 bug ,通常会将其作为已解决的 bug 发送回质量保证。然后,质量保证再次将产品置于其步伐中,以重现 bug。如果无法重现 bug ,质量保证将假定它已得到适当解决。 + +在开源情况下,任何更改都是分布式的,通常是作为正在测试的暂定版本。此测试版本分发给用户,用户再次履行质量保证的职责并测试产品。 + +如果 bug 再次出现, 问题将被发送回开发团队。在此阶段, 该 bug 将重新触发,开发团队有责任重复循环解决该 bug 。这种情况可能会发生多次,尤其是在 bug 不可预知或间歇性的情况下。众所周知, 间歇性的 bug 很难解决。 + +如果该 bug 不再出现,则该问题将被标记为已解决。在某些情况下,初始 bug 已得到解决,但由于所做的更改,会出现其他 bug。发生这种情况时,可能需要启动新的 bug 报告,然后重新开始该过程。 + +### 关闭 bug + +在处理、识别和解决 bug 后,该 bug 将被关闭, 开发人员可以转到软件开发和测试的其他阶段。如果始终找不到 bug, 或者开发人员无法重现 bug ,则该 bug 也将被关闭-无论哪种方式,都将开始开发和测试的下一阶段。 + +在测试版本中对解决方案所做的任何更改都将滚动到产品的下一个版本中。如果 bug 是严重的, 则在下一个版本发布之前, 可能会为当前用户提供修补程序或修补程序。这在安全问题中很常见。 + +软件 bug 可能很难找到, 但通过遵循集过程和过程, 开发人员可以使过程更快、更容易、更一致。质量保证是这一过程的重要组成部分, 因为 QA 测试人员必须发现和识别 bug , 并帮助开发人员重现这些 bug 。在 bug 不再发生之前, 无法关闭和解决 bug。 + +开源解决方案分散了质量保证测试、开发和缓解的负担, 这往往导致 bug 被更快、更全面地发现和缓解。但是, 由于开源技术的性质, 此过程的速度和准确性通常取决于解决方案的受欢迎程度及其维护和开发团队的敬业精神。 + +_Rich Butkevic 是一个 PMP 项目经理认证,,敏捷开发框架认证(*certified scrum master*) 和 [Project Zendo][2] ,供项目管理专业人员发现简化和改进其项目成果策略的网站。与 Rich 联系 [Richbutkevic.com][3] 或者使用 [LinkedIn][4] 。_ + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/18/6/life-cycle-software-bug + +作者:[Rich Butkevic][a] +选题:[lujun9972](https://github.com/lujun9972) +译者:[lixinyuxx](https://github.com/lixinyuxx) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:https://opensource.com/users/rich-butkevic +[1]:https://github.com/ +[2]:https://projectzendo.com +[3]:https://richbutkevic.com +[4]:https://www.linkedin.com/in/richbutkevic From b02610b6554b75cd145f77c99ac255185097c1c7 Mon Sep 17 00:00:00 2001 From: MjSeven Date: Sun, 20 Jan 2019 22:43:51 +0800 Subject: [PATCH 050/243] =?UTF-8?q?=E7=BF=BB=E8=AF=91=E5=AE=8C=E6=88=90=20?= =?UTF-8?q?20190114=20How=20to=20move=20multiple...?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...e Types Simultaneously From Commandline.md | 96 ------------------- ...e Types Simultaneously From Commandline.md | 93 ++++++++++++++++++ 2 files changed, 93 insertions(+), 96 deletions(-) delete mode 100644 sources/tech/20190114 How To Move Multiple File Types Simultaneously From Commandline.md create mode 100644 translated/tech/20190114 How To Move Multiple File Types Simultaneously From Commandline.md diff --git a/sources/tech/20190114 How To Move Multiple File Types Simultaneously From Commandline.md b/sources/tech/20190114 How To Move Multiple File Types Simultaneously From Commandline.md deleted file mode 100644 index dd135f20e0..0000000000 --- a/sources/tech/20190114 How To Move Multiple File Types Simultaneously From Commandline.md +++ /dev/null @@ -1,96 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (MjSeven) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (How To Move Multiple File Types Simultaneously From Commandline) -[#]: via: (https://www.ostechnix.com/how-to-move-multiple-file-types-simultaneously-from-commandline/) -[#]: author: (SK https://www.ostechnix.com/author/sk/) - -How To Move Multiple File Types Simultaneously From Commandline -====== - -![](https://www.ostechnix.com/wp-content/uploads/2019/01/Move-Multiple-File-Types-720x340.png) - -The other day I was wondering how can I move (not copy) multiple file types from directory to another. I already knew how to [**find and copy certain type of files from one directory to another**][1]. But, I don’t know how to move multiple file types simultaneously. If you’re ever in a situation like this, I know a easy way to do it from commandline in Unix-like systems. - -### Move Multiple File Types Simultaneously - -Picture this scenario.You have multiple type of files, for example .pdf, .doc, .mp3, .mp4, .txt etc., on a directory named **‘dir1’**. Let us take a look at the dir1 contents: - -``` -$ ls dir1 -file.txt image.jpg mydoc.doc personal.pdf song.mp3 video.mp4 -``` - -You want to move some of the file types (not all of them) to different location. For example, let us say you want to move doc, pdf and txt files only to another directory named **‘dir2’** in one go. - -To copy .doc, .pdf and .txt files from dir1 to dir2 simultaneously, the command would be: - -``` -$ mv dir1/*.{doc,pdf,txt} dir2/ -``` - -It’s easy, isn’t it? - -Now, let us check the contents of dir2: - -``` -$ ls dir2/ -file.txt mydoc.doc personal.pdf -``` - -See? Only the file types .doc, .pdf and .txt from dir1 have been moved to dir2. - -![][3] - -You can add as many file types as you want to inside curly braces in the above command to move them across different directories. The above command just works fine for me on Bash. - -Another way to move multiple file types is go to the source directory i.e dir1 in our case: - -``` -$ cd ~/dir1 -``` - -And, move file types of your choice to the destination (E.g dir2) as shown below. - -``` -$ mv *.doc *.txt *.pdf /home/sk/dir2/ -``` - -To move all files having a particular extension, for example **.doc** only, run: - -``` -$ mv dir1/*.doc dir2/ -``` - -For more details, refer man pages. - -``` -$ man mv -``` - -Moving a few number of same or different file types is easy! You could do this with couple mouse clicks in GUI mode or use a one-liner command in CLI mode. However, If you have thousands of different file types in a directory and wanted to move multiple file types to different directory in one go, it would be a cumbersome task. To me, the above method did the job easily! If you know any other one-liner commands to move multiple file types at a time, please share it in the comment section below. I will check and update the guide accordingly. - -And, that’s all for now. Hope this was useful. More good stuffs to come. Stay tuned! - -Cheers! - - - --------------------------------------------------------------------------------- - -via: https://www.ostechnix.com/how-to-move-multiple-file-types-simultaneously-from-commandline/ - -作者:[SK][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://www.ostechnix.com/author/sk/ -[b]: https://github.com/lujun9972 -[1]: https://www.ostechnix.com/find-copy-certain-type-files-one-directory-another-linux/ -[2]: data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7 -[3]: http://www.ostechnix.com/wp-content/uploads/2019/01/mv-command.gif diff --git a/translated/tech/20190114 How To Move Multiple File Types Simultaneously From Commandline.md b/translated/tech/20190114 How To Move Multiple File Types Simultaneously From Commandline.md new file mode 100644 index 0000000000..691dc85d26 --- /dev/null +++ b/translated/tech/20190114 How To Move Multiple File Types Simultaneously From Commandline.md @@ -0,0 +1,93 @@ +[#]: collector: (lujun9972) +[#]: translator: (MjSeven) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How To Move Multiple File Types Simultaneously From Commandline) +[#]: via: (https://www.ostechnix.com/how-to-move-multiple-file-types-simultaneously-from-commandline/) +[#]: author: (SK https://www.ostechnix.com/author/sk/) + +如何从命令行同时移动多种文件类型 +====== + +![](https://www.ostechnix.com/wp-content/uploads/2019/01/Move-Multiple-File-Types-720x340.png) + +前几天,我想知道如何将多个文件类型从一个目录移动(不复制)到另一个目录。我已经知道如何[**查找并将某些类型的文件从一个目录复制到另一个目录**][1]。但是,我不知道如何同时移动多种文件类型。如果你曾遇到这样的情况,我知道在类 Unix 系统中从命令行执行该操作的一个简单方法。 + +### 同时移动多种文件类型 + +想象一下这种场景,你在名为 **‘dir1’** 的目录中有多种类型的文件,例如 .pdf, .doc, .mp3, .mp4, .txt 等等。我们来看看 dir1 的内容: + +``` +$ ls dir1 +file.txt image.jpg mydoc.doc personal.pdf song.mp3 video.mp4 +``` + +你希望将某些文件类型(不是所有文件类型)移动到另一个位置。例如,假设你想将 doc, pdf 和 txt 文件一次性移动到名为 **‘dir2’** 的另一个目录中。 + +要同时将 .doc, .pdf 和 .txt 文件从 dir1 移动到 dir2,命令是: + +``` +$ mv dir1/*.{doc,pdf,txt} dir2/ +``` + +很容易,不是吗? + +现在让我们来查看一下 dir2 的内容: +``` +$ ls dir2/ +file.txt mydoc.doc personal.pdf +``` + +看到了吗?只有 .doc, .pdf 和 .txt 从 dir1 移到了 dir2。 + +![][3] + +在上面的命令中,你可以在花括号内添加任意数量的文件类型,以将它们移动到不同的目录中。它在 Bash 上非常适合我。 + +另一种移动多种文件类型的方法是转到源目录,在我们的例子中即为 dir1: + +``` +$ cd ~/dir1 +``` + +将你选择的文件类型移动到目的地(即 dir2),如下所示: + +``` +$ mv *.doc *.txt *.pdf /home/sk/dir2/ +``` + +要移动具有特定扩展名的所有文件,例如 **.doc**,运行: + +``` +$ mv dir1/*.doc dir2/ +``` + +更多细节,参考 man 页: + +``` +$ man mv +``` + +移动一些相同或不同的文件类型很容易!你可以在 GUI 模式下单击几下鼠标,或在 CLI 模式下使用一行命令来完成。但是,如果目录中有数千种不同的文件类型,并且希望一次将多种文件类型移动到不同的目录,这将是一项繁琐的任务。对我来说,上面的方法很容易完成工作!如果你知道任何其它一行命令可以一次移动多种文件类型,请在下面的评论部分与我们分享。我会核对并更新指南。 + +这些就是全部了,希望这很有用。更多好东西将要来了,敬请关注! + +共勉! + +-------------------------------------------------------------------------------- + +via: https://www.ostechnix.com/how-to-move-multiple-file-types-simultaneously-from-commandline/ + +作者:[SK][a] +选题:[lujun9972][b] +译者:[MjSeven](https://github.com/MjSeven) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.ostechnix.com/author/sk/ +[b]: https://github.com/lujun9972 +[1]: https://www.ostechnix.com/find-copy-certain-type-files-one-directory-another-linux/ +[2]: data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7 +[3]: http://www.ostechnix.com/wp-content/uploads/2019/01/mv-command.gif From d6f196effc91fc00b69d5edd095b25c05cee7e84 Mon Sep 17 00:00:00 2001 From: MjSeven Date: Sun, 20 Jan 2019 23:11:13 +0800 Subject: [PATCH 051/243] =?UTF-8?q?=E7=94=B3=E8=AF=B7=E7=BF=BB=E8=AF=91=20?= =?UTF-8?q?20190107=20Getting=20started=20with...?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...tarted with Pelican- A Python-based static site generator.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20190107 Getting started with Pelican- A Python-based static site generator.md b/sources/tech/20190107 Getting started with Pelican- A Python-based static site generator.md index 29772d473c..ed5c7f0dc0 100644 --- a/sources/tech/20190107 Getting started with Pelican- A Python-based static site generator.md +++ b/sources/tech/20190107 Getting started with Pelican- A Python-based static site generator.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (MjSeven) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From aad11909b764686856188d6b5bda26078b7516a6 Mon Sep 17 00:00:00 2001 From: lxy <524187166@qq.com> Date: Sun, 20 Jan 2019 23:16:50 +0800 Subject: [PATCH 052/243] Update 20180625 The life cycle of a software bug.md --- ...180625 The life cycle of a software bug.md | 32 +++++++++---------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/translated/tech/20180625 The life cycle of a software bug.md b/translated/tech/20180625 The life cycle of a software bug.md index c25b4ce086..4f487fa182 100644 --- a/translated/tech/20180625 The life cycle of a software bug.md +++ b/translated/tech/20180625 The life cycle of a software bug.md @@ -5,27 +5,27 @@ 1947年,发现了第一个计算机 bug --被困在计算机继电器中的飞蛾。 -要是所有的 bug 都能如此简单地发现就好了。随着软件变得越来越复杂,测试和调试的过程也变得更加复杂。如今,软件 bug 的生命周期可能会很长, 尽管正确的技术和业务流程可能会有所帮助。对于开源软件,开发人员使用严格的票务服务和协作来查找和缓解 bugs 。 +要是所有的 bug 都能如此简单地发现就好了。随着软件变得越来越复杂,测试和调试的过程也变得更加复杂。如今,软件 bug 的生命周期可能会很长,尽管正确的技术和业务流程可能会有所帮助。对于开源软件,开发人员使用严格的票务服务和协作来查找和解决 bugs 。 ### 确认计算机 bug -在测试过程中,会向开发团队报告 bug 。质量保证人员尽可能详细地描述 bug , 报告他们的系统状态、他们正在进行的进程以及 bug 是如何表现出来的。 +在测试过程中,会向开发团队报告 bug 。质量保证人员尽可能详细地描述 bug ,报告他们的系统状态、他们正在进行的进程以及 bug 是如何表现出来的。 -尽管如此, 一些 bug 从未得到证实;它们可能会在测试中报告, 但永远无法在受控环境中重现。在这种情况下,它们可能得不到解决, 而是被关闭。 +尽管如此,一些 bug 从未得到证实;它们可能会在测试中报告,但永远无法在可控环境中重现。在这种情况下,它们可能得不到解决,而是被关闭。 -由于使用的平台种类繁多, 用户行为也非常多, 因此很难确认计算机 bug ,有些 bug 只是间歇性地或在非常特殊的情况下发生的,而另一些 bug 可能会出现在随机的情况下。 +由于使用的平台种类繁多,用户行为也非常多,因此很难确认计算机 bug ,有些 bug 只是间歇性地或在非常特殊的情况下发生的,而另一些 bug 可能会出现在随机的情况下。 -许多人使用开源软件并与之交互,许多 bug 和问题可能是不可重复的, 或者可能没有得到充分的描述。不过, 由于每个用户和开发人员也都扮演质量保证测试员的角色,至少在一定程度上, 很有可能会发现 bug 。 +许多人使用开源软件并与之交互,许多 bug 和问题可能是不可重复的,或者可能没有得到充分的描述。不过,由于每个用户和开发人员也都扮演质量保证测试员的角色,至少在一定程度上,很有可能会发现 bug 。 -确认 bug 后,工作就开始了。 +确认 bug 后,修复工作就开始了。 ### 分配要修复的 bug -已确认的 bug 被分配给解决的开发人员或开发团队。在此阶段, 需要重现 bug ,发现问题,并修复相关代码。如果 bug 的优先级较低,开发人员可以将此 bug 分类为稍后要修复的问题,也可以在该 bug 具有高优先级的情况下直接指派某人。无论哪种方式,都会在开发过程中打开票证,并且 bug 将成为已知的问题。 +已确认的 bug 被分配给负责解决的开发人员或开发团队。在此阶段,需要重现 bug ,发现问题,并修复相关代码。如果 bug 的优先级较低,开发人员可以将此 bug 分类为稍后要修复的问题,也可以在该 bug 具有高优先级的情况下直接指派某人修复。无论哪种方式,都会在开发过程中打开票证,并且 bug 将成为已知的问题。 -在开源解决方案中,开发人员可以从他们想要解决的 bug 中进行选择, 要么选择他们最熟悉的程序区域,要么从最优先的开始。综合解决方案, 如 [GitHub][1] 使多个开发人员能够轻松地处理解决方案, 而不会干扰彼此的工作。 +在开源解决方案中,开发人员可以从他们想要解决的 bug 中进行选择,要么选择他们最熟悉的程序区域,要么从优先级最高的的开始。综合解决方案,如 [GitHub][1] 使得多个开发人员能够轻松地处理解决方案,而不会干扰彼此的工作。 -在分配要修复的 bug 时,记录者还可以为 bug 选择优先级。主要 bug 可能具有较高的优先级,而仅与外观相关的 bug 可能具有较低的级别。优先级确定开发团队解决这些问题的方式和时间。无论哪种方式, 所有的 bug 都需要先解决,然后才能认为产品已完成。在这方面,使用适当的回溯性到优先级高的的需求也会很有帮助。 +在分配要修复的 bug 时,记录者还可以为 bug 选择优先级。主要得 bug 可能具有较高的优先级,而仅与外观相关的 bug 可能具有较低的级别。优先级确定开发团队解决这些问题的方式和时间。无论哪种方式,所有的 bug 都需要先解决,然后才能认为产品已完成。在这方面,适当的回溯到优先级高的的需求也会很有帮助。 ### 解决 bug @@ -33,21 +33,21 @@ 在开源情况下,任何更改都是分布式的,通常是作为正在测试的暂定版本。此测试版本分发给用户,用户再次履行质量保证的职责并测试产品。 -如果 bug 再次出现, 问题将被发送回开发团队。在此阶段, 该 bug 将重新触发,开发团队有责任重复循环解决该 bug 。这种情况可能会发生多次,尤其是在 bug 不可预知或间歇性的情况下。众所周知, 间歇性的 bug 很难解决。 +如果 bug 再次出现,问题将被发送回开发团队。在此阶段,该 bug 将重新触发,开发团队有责任重复循环解决该 bug 。这种情况可能会发生多次,尤其是在 bug 不可预知或间歇性发生的情况下。众所周知,间歇性的 bug 很难解决。 -如果该 bug 不再出现,则该问题将被标记为已解决。在某些情况下,初始 bug 已得到解决,但由于所做的更改,会出现其他 bug。发生这种情况时,可能需要启动新的 bug 报告,然后重新开始该过程。 +如果该 bug 不再出现,则该问题将被标记为已解决。在某些情况下,初始 bug 已得到解决,但由于所做的更改,会出现其他 bug。发生这种情况时,可能需要新的 bug 报告,然后重新开始该过程。 ### 关闭 bug -在处理、识别和解决 bug 后,该 bug 将被关闭, 开发人员可以转到软件开发和测试的其他阶段。如果始终找不到 bug, 或者开发人员无法重现 bug ,则该 bug 也将被关闭-无论哪种方式,都将开始开发和测试的下一阶段。 +在处理、识别和解决 bug 后,该 bug 将被关闭,开发人员可以转到软件开发和测试的其他阶段。如果始终找不到 bug ,或者开发人员无法重现 bug ,则该 bug 也将被关闭-无论哪种方式,都将开始开发和测试的下一阶段。 -在测试版本中对解决方案所做的任何更改都将滚动到产品的下一个版本中。如果 bug 是严重的, 则在下一个版本发布之前, 可能会为当前用户提供修补程序或修补程序。这在安全问题中很常见。 +在测试版本中对解决方案所做的任何更改都将滚动到产品的下一个版本中。如果 bug 是严重的,则在下一个版本发布之前,可能会为当前用户提供修补程序或修补程序。这在安全问题中很常见。 -软件 bug 可能很难找到, 但通过遵循集过程和过程, 开发人员可以使过程更快、更容易、更一致。质量保证是这一过程的重要组成部分, 因为 QA 测试人员必须发现和识别 bug , 并帮助开发人员重现这些 bug 。在 bug 不再发生之前, 无法关闭和解决 bug。 +软件 bug 可能很难找到,但通过遵循过程,开发人员可以使开发更快、更容易、更一致。质量保证是这一过程的重要组成部分,因为 QA 测试人员必须发现和识别 bug ,并帮助开发人员重现这些 bug 。在 bug 不再发生之前,无法关闭和解决 bug。 -开源解决方案分散了质量保证测试、开发和缓解的负担, 这往往导致 bug 被更快、更全面地发现和缓解。但是, 由于开源技术的性质, 此过程的速度和准确性通常取决于解决方案的受欢迎程度及其维护和开发团队的敬业精神。 +开源的解决方案分散了质量保证测试、开发和缓解的负担,这往往导致 bug 被更快、更全面地发现和缓解。但是,由于开源技术的性质,此过程的速度和准确性通常取决于解决方案的受欢迎程度及其维护和开发团队的敬业精神。 -_Rich Butkevic 是一个 PMP 项目经理认证,,敏捷开发框架认证(*certified scrum master*) 和 [Project Zendo][2] ,供项目管理专业人员发现简化和改进其项目成果策略的网站。与 Rich 联系 [Richbutkevic.com][3] 或者使用 [LinkedIn][4] 。_ +_Rich Butkevic 是一个 PMP 项目经理认证,,敏捷开发框架认证(*certified scrum master*) 并且 使用 [Project Zendo][2] ,供项目管理专业人员去发现、简化和改进其项目成果策略的网站。与 Rich 联系在 [Richbutkevic.com][3] 或者使用 [LinkedIn][4] 。_ -------------------------------------------------------------------------------- From 5006ac4cd5125dc80315e5d6620bc56de8db4fb3 Mon Sep 17 00:00:00 2001 From: beamrolling <33046439+beamrolling@users.noreply.github.com> Date: Mon, 21 Jan 2019 00:06:52 +0800 Subject: [PATCH 053/243] =?UTF-8?q?=E7=BF=BB=E8=AF=91=E5=AE=8C=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...14 You (probably) don-t need Kubernetes.md | 76 ------------------- ...14 You (probably) don-t need Kubernetes.md | 76 +++++++++++++++++++ 2 files changed, 76 insertions(+), 76 deletions(-) delete mode 100644 sources/talk/20190114 You (probably) don-t need Kubernetes.md create mode 100644 translated/talk/20190114 You (probably) don-t need Kubernetes.md diff --git a/sources/talk/20190114 You (probably) don-t need Kubernetes.md b/sources/talk/20190114 You (probably) don-t need Kubernetes.md deleted file mode 100644 index a57f47959e..0000000000 --- a/sources/talk/20190114 You (probably) don-t need Kubernetes.md +++ /dev/null @@ -1,76 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (beamrolling) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (You (probably) don't need Kubernetes) -[#]: via: (https://arp242.net/weblog/dont-need-k8s.html) -[#]: author: (Martin Tournoij https://arp242.net/) - -You (probably) don't need Kubernetes -====== - -This may perhaps be an unpopular opinion, but the overwhelming majority of companies are probably better off not using k8s. - -You know those old “Hello world according to programmer skill” jokes that start with `printf("hello, world\n")` for a junior programmer and end with some convoluted Java OOP design pattern solution for senior software architect engineer? This is kind of like that. - -* Junior sysops - `./binary` -* Experienced sysops - `./binary` on EC2. -* devops - Self-deployed CI pipeline to run `./binary` on EC2. -* Senior cloud orchestration engineer - k8s orchestrated self-deployed CI pipeline to run `./binary` on E2C platform. - - - -¯\\_(ツ)_/¯ - -That doesn’t mean that Kubernetes or any of these things are bad per se, just as Java or OOP aren’t bad per se, but rather that they’re horribly misapplied in many cases, just as using several Java OOP design patterns are horribly misapplied to a hello world program. For most companies the sysops requirements are fundamentally not very complex, and applying k8s to them makes litle sense. - -Complexity creates work by its very nature, and I’m skeptical that using k8s is a time-saver for most users. It’s like spending a day on a script to automate some 10-minute task that you do once a month. That’s not a good time investment (especially since the chances are you’ll have to invest further time in the future by expanding or debugging that script at some point). - -Your deployments probably should be automated – lest you [end up like Knightmare][1] – but k8s can often be replaced by a simple shell script. - -In our own company the sysops team spent a lot of time setting up k8s. They also had to spend a lot of time on updating to a newer version a while ago (1.6 ➙ 1.8). And the result is something no one really understands without really diving in to k8s, and even then it’s hard (those YAML files, yikes!) - -Before I could debug and fix deploy issues myself. Now that’s a lot harder. I understand the basic concepts, but that’s not all that useful when actually debugging practical issues. I don’t deal with k8s often enough to justify learning this. - -That k8s is really hard is not a novel insight, which is why there are a host of “k8s made easy” solutions out there. The idea of adding another layer on top of k8s to “make it easier” strikes me as, ehh, unwise. It’s not like that complexity disappears; you’ve just hidden it. - -I have said this many times before: when determining if something is “easy” then my prime concern is not how easy something is to write, but how easy something is to debug when things fail. Wrapping k8s will not make things easier to debug, quite the opposite: it will make it even harder. - -There is a famous Blaise Pascal quote: - -> All human evil comes from a single cause, man’s inability to sit still in a room. - -k8s – and to lesser extent, Docker – seem to be an example of that. A lot of people seem lost in the excitement of the moment and are “k8s al the things!”, just as some people were lost in the excitement when Java OOP was new, so everything has to be converted from the “old” way to the “new” ones, even though the “old” ways still worked fine. - -Sometimes the IT industry is pretty silly. - -Or to summarize this post [with a Tweet][2]: - -> 2014 - We must adopt #microservices to solve all problems with monoliths -> 2016 - We must adopt #docker to solve all problems with microservices -> 2018 - We must adopt #kubernetes to solve all problems with docker - -You can mail me at [martin@arp242.net][3] or [create a GitHub issue][4] for feedback, questions, etc. - --------------------------------------------------------------------------------- - -via: https://arp242.net/weblog/dont-need-k8s.html - -作者:[Martin Tournoij][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://arp242.net/ -[b]: https://github.com/lujun9972 -[1]: https://dougseven.com/2014/04/17/knightmare-a-devops-cautionary-tale/ -[2]: https://twitter.com/sahrizv/status/1018184792611827712 -[3]: mailto:martin@arp242.net -[4]: https://github.com/Carpetsmoker/arp242.net/issues/new diff --git a/translated/talk/20190114 You (probably) don-t need Kubernetes.md b/translated/talk/20190114 You (probably) don-t need Kubernetes.md new file mode 100644 index 0000000000..d573ebe680 --- /dev/null +++ b/translated/talk/20190114 You (probably) don-t need Kubernetes.md @@ -0,0 +1,76 @@ +[#]: collector: (lujun9972) +[#]: translator: (beamrolling) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (You (probably) don't need Kubernetes) +[#]: via: (https://arp242.net/weblog/dont-need-k8s.html) +[#]: author: (Martin Tournoij https://arp242.net/) + +你(大概)不需要 Kubernetes +====== + +这也许是一个不太受欢迎的观点,但大多数主流公司最好不要再使用 k8s 了。 + +你知道那个古老的“根据程序员技能写 Hello world ”笑话吗?它从一个新手程序员的 printf("hello, world\n") 语句开始,最后结束于高级软件架构工程师令人费解的 Java OOP 模式设计。使用 k8s 就有点像这样。 + +* 新手 SysOp: + `./binary` +* 有经验的 SysOp: + 在 EC2 上的 `./binary` +* DevOp: + 在 EC2 上自部署的 CI 管道运行 `./binary` +* 高级云编排工程师: + 在 EC2 上通过 k8s 编排的自部署 CI 管道运行 `./binary` + + + +¯\\_(ツ)_/¯ + +这不意味着 Kubernetes 或者任何这样的东西本身都是坏的,就像 Java 或者 OOP 设计本身并不是坏的一样,但是,在很多情况下,它们被严重地误用,就像在一个 hello world 的程序中可怕地误用 Java 面向对象设计模式一样。对大多数公司而言,系统运维从根本上来说并不十分复杂,此时在这上面应用 k8s 起效甚微。 + +复杂性本质上来说创造了工作,我十分怀疑使用 k8s 对大多数使用者来说是省时的这一说法。这就好像花一天时间来写一个脚本,用来自动完成一些你一个月一次,每次只花 10 分钟完成的工作。这不是一个好的时间投资(特别是你可能会在未来由于扩展或调试这个脚本来进一步投入更多的时间)。 + +你的部署大概应该需要自动化 – 以免你 [最终像 Knightmare][1] 那样 – 但 k8s 通常可以被一个简单的 shell 脚本所替代。 + +在我们公司,sysops 团队用了很多时间来设置 k8s 。他们还不得不用了很大一部分时间来更新到新一点的版本(1.6 – 1.8)。结果是如果没有真正深入理解 k8s ,没人会真正明白一些东西,甚至连深入理解 k8s 这一点也很难(那些 YAML 文件,哦呦!) + +在我能自己调试和修复问题之前——现在这更难了,我理解基本概念,但在真正调试实际问题的时候,它们并不是那么有用。我不经常用 k8s 足以证明这点。 + +k8s 真的很难这点并不是什么新看法,这也是为什么现在会有这么多“ k8s 简单学”的解决方案。在 k8s 上再添一层来“让它更简单”的方法让我觉得,呃,不明智。复杂性并没有消失,你只是把它藏起来了。 + +以前我说过很多次:在确定一样东西是否“简单”时,我最关心的不是写东西的时候有多简单,而是当失败的时候调试起来有多容易。包装 k8s 并不会让调试更加简单,恰恰相反,它让事情更加困难了。 + +Blaise Pascal 有一句名言: + +> 几乎所有的痛苦都来自于我们不善于在房间里独处。 + +k8s —— 略微拓展一下,Docker ——似乎就是这样的例子。许多人似乎迷失在当下的兴奋中,觉得“ k8s 就是这么回事!”,就像有些人迷失在 Java OOP 刚出来时的兴奋中一样,所以一切都必须从“旧”方法转为“新”方法,即使“旧”方法依然可行。 + +有时候 IT 产业挺蠢的。 + +或者用 [一条推特][2] 来总结: + +> 2014 - 我们必须采用 #微服务 来解决 monolith 的所有问题 +> 2016 - 我们必须采用 #docker 来解决微服务的所有问题 +> 2018 - 我们必须采用 #kubernetes 来解决 docker 的所有问题 + +你可以通过 [martin@arp242.net][3] 给我发邮件或者 [创建 GitHub issue][4] 来给我反馈或提出问题等。 + +-------------------------------------------------------------------------------- + +via: https://arp242.net/weblog/dont-need-k8s.html + +作者:[Martin Tournoij][a] +选题:[lujun9972][b] +译者:[beamrolling](https://github.com/beamrolling) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://arp242.net/ +[b]: https://github.com/lujun9972 +[1]: https://dougseven.com/2014/04/17/knightmare-a-devops-cautionary-tale/ +[2]: https://twitter.com/sahrizv/status/1018184792611827712 +[3]: mailto:martin@arp242.net +[4]: https://github.com/Carpetsmoker/arp242.net/issues/new From e7928703e6ba080275efd1240010771aeeb80c18 Mon Sep 17 00:00:00 2001 From: lctt-bot Date: Sun, 20 Jan 2019 17:01:07 +0000 Subject: [PATCH 054/243] Revert "hankchow translating" This reverts commit 46bad7ca22b757d16f411b8ccbc03d19cc813977. --- sources/tech/20181219 How to open source your Python library.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20181219 How to open source your Python library.md b/sources/tech/20181219 How to open source your Python library.md index e4d6adf3c6..cf59688484 100644 --- a/sources/tech/20181219 How to open source your Python library.md +++ b/sources/tech/20181219 How to open source your Python library.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: (HankChow) +[#]: translator: ( ) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 8da29bbe68b9b67f7071ab5c18c9d850c4a6dbd3 Mon Sep 17 00:00:00 2001 From: geekpi Date: Mon, 21 Jan 2019 08:46:44 +0800 Subject: [PATCH 055/243] translated --- ...equency, Power And Utilization In Linux.md | 131 ----------------- ...equency, Power And Utilization In Linux.md | 132 ++++++++++++++++++ 2 files changed, 132 insertions(+), 131 deletions(-) delete mode 100644 sources/tech/20190103 s-tui- A Terminal Tool To Monitor CPU Temperature, Frequency, Power And Utilization In Linux.md create mode 100644 translated/tech/20190103 s-tui- A Terminal Tool To Monitor CPU Temperature, Frequency, Power And Utilization In Linux.md diff --git a/sources/tech/20190103 s-tui- A Terminal Tool To Monitor CPU Temperature, Frequency, Power And Utilization In Linux.md b/sources/tech/20190103 s-tui- A Terminal Tool To Monitor CPU Temperature, Frequency, Power And Utilization In Linux.md deleted file mode 100644 index 8861e90cac..0000000000 --- a/sources/tech/20190103 s-tui- A Terminal Tool To Monitor CPU Temperature, Frequency, Power And Utilization In Linux.md +++ /dev/null @@ -1,131 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (geekpi) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (s-tui: A Terminal Tool To Monitor CPU Temperature, Frequency, Power And Utilization In Linux) -[#]: via: (https://www.2daygeek.com/s-tui-stress-terminal-ui-monitor-linux-cpu-temperature-frequency/) -[#]: author: (Prakash Subramanian https://www.2daygeek.com/author/prakash/) - -s-tui: A Terminal Tool To Monitor CPU Temperature, Frequency, Power And Utilization In Linux -====== - -By default every Linux administrator would go with **[lm_sensors to monitor CPU temperature][1]**. - -lm_sensors (Linux monitoring sensors) is a free and open-source application that provides tools and drivers for monitoring temperatures, voltage, and fans. - -It’s a CLI utility and if you are looking for alternative tools. - -I would suggest you to go for s-tui. - -It’s a Stress Terminal UI which helps administrator to view CPU temperature with colors. - -### What is s-tui - -s-tui is a terminal UI for monitoring your computer. s-tui allows to monitor CPU temperature, frequency, power and utilization in a graphical way from the terminal. - -Also, shows performance dips caused by thermal throttling, it requires minimal resources and doesn’t requires X-server. It was written in Python and requires root privilege to use this. - -s-tui is a self-contained application which can run out-of-the-box and doesn’t need config files to drive its core features. - -s-tui uses psutil to probe some of your hardware information. If your hardware is not supported, you might not see all the information. - -Running s-tui as root gives access to the maximum Turbo Boost frequency available to your CPU when stressing all cores. - -It uses Stress utility in the background to check the temperature of its components do not exceed their acceptable range by imposes certain types of compute stress on your system. - -Running an overclocked PC is fine as long as it is stable and that the temperature of its components do not exceed their acceptable range. - -There are several programs available to assess system stability through stress testing the system and thereby the overclock level. - -### How to Install s-tui In Linux - -It was written in Python and pip installation is a recommended method to install s-tui on Linux. Make sure you should have installed python-pip package on your system. If no, use the following command to install it. - -For Debian/Ubuntu users, use **[Apt Command][2]** or **[Apt-Get Command][3]** to install pip package. - -``` -$ sudo apt install python-pip stress -``` - -For Archlinux users, use **[Pacman Command][4]** to install pip package. - -``` -$ sudo pacman -S python-pip stress -``` - -For Fedora users, use **[DNF Command][5]** to install pip package. - -``` -$ sudo dnf install python-pip stress -``` - -For CentOS/RHEL users, use **[YUM Command][6]** to install pip package. - -``` -$ sudo yum install python-pip stress -``` - -For openSUSE users, use **[Zypper Command][7]** to install pip package. - -``` -$ sudo zypper install python-pip stress -``` - -Finally run the following **[pip command][8]** to install s-tui tool in Linux. - -For Python 2.x: - -``` -$ sudo pip install s-tui -``` - -For Python 3.x: - -``` -$ sudo pip3 install s-tui -``` - -### How to Access s-tui - -As i told in the beginning of the article. It requires root privilege to get all the information from your system. Just run the following command to launch s-tui. - -``` -$ sudo s-tui -``` - -![][10] - -By default it enable hardware monitoring and select the “Stress” option to do the stress test on your system. -![][11] - -To check other options, navigate to help page. - -``` -$ s-tui --help -``` - --------------------------------------------------------------------------------- - -via: https://www.2daygeek.com/s-tui-stress-terminal-ui-monitor-linux-cpu-temperature-frequency/ - -作者:[Prakash Subramanian][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://www.2daygeek.com/author/prakash/ -[b]: https://github.com/lujun9972 -[1]: https://www.2daygeek.com/view-check-cpu-hard-disk-temperature-linux/ -[2]: https://www.2daygeek.com/apt-command-examples-manage-packages-debian-ubuntu-systems/ -[3]: https://www.2daygeek.com/apt-get-apt-cache-command-examples-manage-packages-debian-ubuntu-systems/ -[4]: https://www.2daygeek.com/pacman-command-examples-manage-packages-arch-linux-system/ -[5]: https://www.2daygeek.com/dnf-command-examples-manage-packages-fedora-system/ -[6]: https://www.2daygeek.com/yum-command-examples-manage-packages-rhel-centos-systems/ -[7]: https://www.2daygeek.com/zypper-command-examples-manage-packages-opensuse-system/ -[8]: https://www.2daygeek.com/install-pip-manage-python-packages-linux/ -[9]: data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7 -[10]: https://www.2daygeek.com/wp-content/uploads/2018/12/s-tui-stress-terminal-ui-monitor-linux-cpu-temperature-frequency-1.jpg -[11]: https://www.2daygeek.com/wp-content/uploads/2018/12/s-tui-stress-terminal-ui-monitor-linux-cpu-temperature-frequency-2.jpg diff --git a/translated/tech/20190103 s-tui- A Terminal Tool To Monitor CPU Temperature, Frequency, Power And Utilization In Linux.md b/translated/tech/20190103 s-tui- A Terminal Tool To Monitor CPU Temperature, Frequency, Power And Utilization In Linux.md new file mode 100644 index 0000000000..525b264200 --- /dev/null +++ b/translated/tech/20190103 s-tui- A Terminal Tool To Monitor CPU Temperature, Frequency, Power And Utilization In Linux.md @@ -0,0 +1,132 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (s-tui: A Terminal Tool To Monitor CPU Temperature, Frequency, Power And Utilization In Linux) +[#]: via: (https://www.2daygeek.com/s-tui-stress-terminal-ui-monitor-linux-cpu-temperature-frequency/) +[#]: author: (Prakash Subramanian https://www.2daygeek.com/author/prakash/) + +s-tui:在 Linux 中监控 CPU 温度、频率、功率和使用率的终端工具 +====== + +默认情况下,每个 Linux 管理员都会使用 **[lm_sensors 监控 CPU 温度][1]**。 + +lm_sensors (Linux 监控传感器)是一个免费开源程序,它提供监控温度、电压和风扇的工具和驱动。 + +如果你正在找替代工具,这有一个 CLI 工具。 + +我会建议你尝试 s-tui。 + +它有一个压力终端 UI,可以帮助管理员通过颜色查看 CPU 温度。 + +### s-tui 是什么 + +s-tui 是一个用于监控计算机的终端 UI。s-tui 可以在终端以图形方式监控 CPU 温度、频率、功率和使用率。 + +此外,它还显示由热量限制引起的性能下降,它需要很少的资源并且不需要 X 服务器。它是用 Python 编写的,需要 root 权限才能使用它。 + +s-tui 是一个独立的程序,可以开箱即用,并且不需要配置文件来使用其核心功能。 + +s-tui 使用 psutil 来探测你的一些硬件信息。如果你的硬件不受支持,你可能看不到所有信息。 + +以root身份运行 s-tui 时,当压测所有核心时,可以访问到 CPU 的最大睿频频率。 + +它在后台使用 Stress 工具,通过对系统施加某些类型的计算压力来检查其组件的温度是否超过其可接受的范围。 + +只要计算机稳定并且其组件的温度不超过其可接受的范围,超频 PC 就没问题。 + +有几个程序可以通过压力测试得到系统的稳定性,从而评估超频水平。 + +### 如何在 Linux 中安装 s-tui + +它是用 Python 写的,pip 是在 Linux 上安装 s-tui 的推荐方法。确保你在系统上安装了 python-pip 软件包。如果还没有,请使用以下命令进行安装。 + +对于 Debian/Ubuntu 用户,使用 **[apt 命令][2]**或 **[apt-get 命令][3]** 来安装 pip。 + +``` +$ sudo apt install python-pip stress +``` + +对于 Archlinux 用户,使用 **[pacman 命令][4]**来安装 pip。 + +``` +$ sudo pacman -S python-pip stress +``` + +对于 Fedora 用户,使用 **[dnf 命令][5]**来安装 pip。 + +``` +$ sudo dnf install python-pip stress +``` + +对于 CentOS/RHEL 用户,使用 **[yum 命令][5]**来安装 pip。 + +``` +$ sudo yum install python-pip stress +``` + +对于 openSUSE 用户,使用 **[zypper 命令][5]**来安装 pip。 + +``` +$ sudo zypper install python-pip stress +``` + +最后运行下面的 **[pip 命令][8]**在 Linux 中安装 s-tui 工具。 + +对于 Python 2.x: + +``` +$ sudo pip install s-tui +``` + +对于Python 3.x: + +``` +$ sudo pip3 install s-tui +``` + +### 如何使用 s-tui + +正如我在文章开头所说的那样。它需要 root 权限才能从系统获取所有信息。只需运行以下命令即可启动 s-tui。 + +``` +$ sudo s-tui +``` + +![][10] + +默认情况下,它启用硬件监控并选择 “Stress” 选项以对系统执行压力测试。 + +![][11] + +要查看其他选项,请到帮助页面查看。 + +``` +$ s-tui --help +``` + +-------------------------------------------------------------------------------- + +via: https://www.2daygeek.com/s-tui-stress-terminal-ui-monitor-linux-cpu-temperature-frequency/ + +作者:[Prakash Subramanian][a] +选题:[lujun9972][b] +译者:[geekpi](https://github.com/geekpi) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.2daygeek.com/author/prakash/ +[b]: https://github.com/lujun9972 +[1]: https://www.2daygeek.com/view-check-cpu-hard-disk-temperature-linux/ +[2]: https://www.2daygeek.com/apt-command-examples-manage-packages-debian-ubuntu-systems/ +[3]: https://www.2daygeek.com/apt-get-apt-cache-command-examples-manage-packages-debian-ubuntu-systems/ +[4]: https://www.2daygeek.com/pacman-command-examples-manage-packages-arch-linux-system/ +[5]: https://www.2daygeek.com/dnf-command-examples-manage-packages-fedora-system/ +[6]: https://www.2daygeek.com/yum-command-examples-manage-packages-rhel-centos-systems/ +[7]: https://www.2daygeek.com/zypper-command-examples-manage-packages-opensuse-system/ +[8]: https://www.2daygeek.com/install-pip-manage-python-packages-linux/ +[9]: data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7 +[10]: https://www.2daygeek.com/wp-content/uploads/2018/12/s-tui-stress-terminal-ui-monitor-linux-cpu-temperature-frequency-1.jpg +[11]: https://www.2daygeek.com/wp-content/uploads/2018/12/s-tui-stress-terminal-ui-monitor-linux-cpu-temperature-frequency-2.jpg From 21c5439bf3bb50f9cbfba89b5811d0dc790f62ca Mon Sep 17 00:00:00 2001 From: geekpi Date: Mon, 21 Jan 2019 08:51:18 +0800 Subject: [PATCH 056/243] translating --- ...the arcade in your Linux terminal with this Pac-man clone.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20181215 Head to the arcade in your Linux terminal with this Pac-man clone.md b/sources/tech/20181215 Head to the arcade in your Linux terminal with this Pac-man clone.md index 3bd36352a4..0207f906df 100644 --- a/sources/tech/20181215 Head to the arcade in your Linux terminal with this Pac-man clone.md +++ b/sources/tech/20181215 Head to the arcade in your Linux terminal with this Pac-man clone.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (geekpi) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From fce8f876af3751563aee06171888690badd8e53b Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Mon, 21 Jan 2019 11:09:00 +0800 Subject: [PATCH 057/243] PRF:20180604 4 Firefox extensions worth checking out.md @lixinyuxx --- ...4 Firefox extensions worth checking out.md | 52 ++++++++++--------- 1 file changed, 27 insertions(+), 25 deletions(-) diff --git a/translated/tech/20180604 4 Firefox extensions worth checking out.md b/translated/tech/20180604 4 Firefox extensions worth checking out.md index d434a01af7..2f71b390b7 100644 --- a/translated/tech/20180604 4 Firefox extensions worth checking out.md +++ b/translated/tech/20180604 4 Firefox extensions worth checking out.md @@ -1,71 +1,73 @@ -4个值得一提的 Firefox 拓展插件 +4 个值得一提的 Firefox 扩展插件 ====== +> 这些扩展可以使火狐更具生产力和使用乐趣。 + ![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/firefox_blue_lead.jpg?itok=gYaubJUv) -自从大约12年前 V2.0 推出以来, 我一直是 Firefox (火狐浏览器)的用户。那时它不是最好的网络浏览器,但我仍旧因为一个理由使用它:我最喜爱的无可比拟的浏览器拓展插件 +自从大约 12 年前 Firefox(火狐浏览器)v2.0 推出以来, 我一直是它的用户。它不是那时最好的网络浏览器,但是总会有一个理由让我回到它:我最喜爱的浏览器扩展插件不能工作在其它浏览器上。 -如今, 我喜欢 Firefox 的当前状态,因为它快速、可定制和开源,但我也很欣赏扩展插件来体现原开发人员从未想到的特点: 如果您想在没有鼠标的情况下浏览呢?如果您不喜欢盯着晚上从显示器里出来的强光呢?对于 YouTube 和其他视频托管网站为了更好的性能和扩展使用一个更专业的播放器又如何呢?如果您需要更复杂的方法来禁用跟踪器和加快加载页面, 该怎么办? +如今,我喜欢现下的 Firefox,因为它快速、可定制和开源,我也很欣赏那些体现了原开发人员从未想到过的想法的扩展插件:如果你想在没有鼠标的情况下浏览网页呢?如果你不喜欢盯着晚上从显示器里发出来的强光呢?如何在 YouTube 和其他视频托管网站上使用一个更专业的播放器来获得更好的性能和更多播放控制呢?如果你需要更复杂的方法来禁用跟踪器和加快加载页面,该怎么办? -幸运的是, 这些问题都有答案, 我将展现给你我最喜爱的拓展--所有这些都是免费软件或开源的 (即, 在 [GNU GPL][1], [MPL][2],或 [Apache][3] 许可下) 并使一个优秀的浏览器更好。 +幸运的是,这些问题都有答案,我将展现给你我最喜爱的扩展 —— 所有这些都是免费软件或开源的 (即,在 [GNU GPL][1]、[MPL][2] 或 [Apache][3] 许可帧下) ,它们可以使一个优秀的浏览器更优秀。 -尽管术语加载项和扩展具有微微不同的含义,,但我将在本文中交替使用它们。 +尽管术语加载项add-on扩展extension的含义稍微不同,但我在本文中的使用不会区分它们。 ### Tridactyl ![Tridactyl screenshot][5] -Tridactyl 的新选项卡页面,展示隐藏连接。 +*Tridactyl 的新选项卡页面,展示了链接的指引。* -[Tridactyl][6] 使您能够在大多数浏览活动中使用键盘。它的灵感来自于现已解散的 [Vimperator][7] 和 [Pentadactyl][8] ,这是由 [Vim][9] 默认绑定值启发的。由于我已经习惯了 Vim 和其他命令行应用程序,我发现了一些功能,比如能够使用键值 `h/j/k/l` 进行导航,用 `f/F` 与超链接进行交互,并创建非常方便的自定义键绑定和命令。 +[Tridactyl][6] 使你能够在大多数浏览活动中使用键盘。它的灵感来自于现已不复存在的 [Vimperator][7] 和 [Pentadactyl][8],而它们受到了 [Vim][9] 的默认键绑定的启发。由于我已经习惯了 Vim 和其他命令行应用程序,我发现了它的功能类似于使用键值 `h/j/k/l` 进行导航,用 `f/F` 可以与超链接进行交互,而且创建自定义的键绑定和命令非常方便。 -Tridactyl 的可选本地信代理(目前,仅适用于GNU/Linux 和 Mac OSX), 最近才实现的,提供了更酷的功能来启动。例如, 有了它, 您可以隐藏 Firefox GUI 的一些元素(à la Vimperator 和 Pentadactyl),在外部程序中打开链接或当前页 (我经常用 [mpv][10] 和 [youtube-dl][11] 在视频上)通过按 `Ctrl-I` 用您喜爱的编辑器编辑文本内容(或者任意您选择的组合键)。 +Tridactyl 最近刚刚实现了一个可选的本地信使(目前,仅适用于 GNU/Linux 和 Mac OSX),提供了更酷的功能。例如,有了它,你可以隐藏 Firefox 用户界面上的一些元素(以 Vimperator 和 Pentadactyl 的方式)、在外部程序中打开链接或当前页(我经常用 [mpv][10] 和 [youtube-dl][11] 播放视频)、通过按 `Ctrl-I`(或者任意你选择的组合键)用你喜爱的编辑器来编辑文本框的内容。 -话虽如此, 但要记住,这是一个相对早期的项目,细节可能还是很粗糙。 另一方面,它的发展非常活跃, 当你回顾它早期的缺陷时, 使用它可能是一种乐趣。 +话虽如此,但要记住,这是一个相对早期的项目,细节可能还是很粗糙。另一方面,它的开发非常活跃,当你回顾它早期的缺陷时,未尝不是一种乐趣。 ### Open With ![Open With Screenshot][13] -Open With 提供的菜单。我可以在当前页面打开一个额外的列表。 +*Open With 提供的菜单。我可以用这里列出的一个外部程序打开当前页面。* -说到与外部程序的互动,有时很高兴有能力用鼠标来做到这一点。这是 [Open With][14] 想法的来源. +说到与外部程序的互动,有时能够用鼠标来做到这一点还是让人很高兴的。这是 [Open With][14] 的用武之地。 -除了添加的上下文菜单 (如屏幕截图所示) 外,您还可以通过单击加载项栏上的扩展图标来找到自己定义的命令。 [its page on Mozilla Add-ons][14] 建议作为它的图标和描述,它主要是为了与其他 web 浏览器一起工作, 但我也可以轻松地使用它与 mpv 和 youtube-dl 。 +除了添加的上下文菜单(如屏幕截图所示)之外,你还可以通过单击加载项栏上的扩展图标来找到自己定义的命令。如[它在 Mozilla Add-ons 页面上][14] 的图标和描述所示,它主要是为了切换到其它的 web 浏览器,但我也可以轻松地将它与 mpv 和 youtube-dl 相配合。 -这里也提供键盘快捷方式,但它们受到严重限制。可以在扩展设置的下拉列表中选择的组合不超过三种。相反, Tridactyl 允许我将命令分配给几乎任何没有被 Firefox 阻止的东西。打开与是目前为鼠标,真的。 +它也提供了键盘快捷方式,但它们受到了严重限制。可以在扩展设置的下拉列表中选择的组合不超过三种。相反,Tridactyl 允许我将命令分配给几乎任何没有被 Firefox 所阻止的东西。没错,Open With 目前为鼠标而准备的。 ### Stylus ![Stylus Screenshot][16] -在这个屏幕截图中, 我刚刚搜索并安装了一个黑暗的主题, 我正在上 Stylus 的网站。即使是弹出窗口也可以定制风格 (称为 Deepdark Stylus)! +*在这个屏幕截图中,我刚刚搜索并为当前正在浏览的 Stylus 的网站安装了一个黑暗主题。即使是弹出窗口也可以定制风格(称为 Deepdark Stylus)!* -[Stylus][17] 是一个用户样式管理器,这意味着通过编写自定义 CSS 规则并将其加载到 Stylus 中,您可以更改任何网页的外观。如果你不知道 CSS ,有大量的风格在其他网站上,如 [userstyles.org][18] 。 +[Stylus][17] 是一个用户样式管理器,这意味着可以通过编写自定义 CSS 规则并将其加载到 Stylus 中来更改任何网页的外观。如果你不懂 CSS,在如 [userstyles.org][18] 这样网站上有大量的其他人制作的样式。 -现在,你可能会问,“这不正是什么 [Stylish][19] 么?” 你是对的!你看 Stylus 是基于 Stylish 并提供了更多的改进:它不包含任何遥测数据, 尊重您的隐私,所有开发都是公开的(尽管 Stylish 仍在积极开发, 我一直未能找到最新版本的源代码), 而且它还支持 [UserCSS][20]。 +现在,你可能会问,“这不就是 [Stylish][19] 么?” 你是对的!Stylus 是基于 Stylish 的,并提供了更多的改进:它不包含任何远程记录、尊重你的隐私,所有开发都是公开的(尽管 Stylish 仍在积极开发,我一直未能找到最新版本的源代码),而且它还支持 [UserCSS][20]。 -UserCSS 是一种有趣的格式,尤其是对于开发人员。我已经为不同的网站写了几种用户样式(主要是黑暗的主题和调整,以提高可读性),虽然 Stylus 的内部编辑器很好,我还是喜欢用 Neovim 编辑代码。为了做到这样我所需要做的就是用 ".user.css" 作为本地加载文件的后缀名,在 Stylus 里启动 "Live Reload" 选项,所有更改都会被应用只要我在 Neovim 中启保存和更改文件。远程 UserCSS 文件也支持,因此,每当我将更改推送到 Github 或任何基于 git 的开发平台时,它们将自动对用户可用。(我提供了指向该文件的原始版本的链接, 以便他们可以轻松地访问它。) +UserCSS 是一种有趣的格式,尤其是对于开发人员来说。我已经为不同的网站写了几种用户样式(主要是黑暗主题,和为了提高可读性的调整),虽然 Stylus 的内部编辑器很好,我还是喜欢用 Neovim 编辑代码。为了做到这样我所需要做的就是用 “.user.css” 作为本地加载文件的后缀名,在 Stylus 里启动 “Live Reload” 选项,只要我在 Neovim 中保存文件就会应用所有的更改。它也支持远程 UserCSS 文件,因此,每当我将更改推送到 GitHub 或任何基于 git 的开发平台时,它们将自动对用户可用。(我提供了指向该文件的原始版本的链接,以便他们可以轻松地访问它。) ### uMatrix ![uMatrix Screenshot][22] -uMatrix 的用户使用界面,显示当前访问过的网页的当前规则。 +*uMatrix 的用户界面,显示当前访问过的网页的当前规则。* -Jeremy Garcia 提到了 uBlock Origin 在 [his article][23] 在 Opensource.com 作为一个优秀的 blocker 。我想推荐另一个拓展插件作者是 [gorhill][24]: uMatrix 。 +Jeremy Garcia 在他发表在 Opensource.com 的[文章][23]中提到了一个优秀的拦截器 uBlock Origin。我想提请大家关注另一个由 [gorhill][24] 开发的扩展插件: uMatrix 。 -[uMatrix][25] 允许您为网页上的某些请求设置阻止规则,可以通过点击加载项的弹出窗口来切换(在上面的屏幕截图中可以看到)。 这些请求的区别在于脚本的类别、 scripts, cookies, CSS rules, images, media content, frames,和其他被 uMatrix 标记为 "other" 的 。 例如,您可以设置全局规则, 以便在默认情况下允许所有请求, 并将特定请求添加到黑名单中(更方便的方法),或在默认情况下阻止所有内容, 并手动将某些请求列入白名单 (更安全的方法)。如果您一直在使用NoScript 或 RequestPolicy,你可以 [import][26] 你的白名单规则。 +[uMatrix][25] 允许你为网页上的某些请求设置拦截规则,可以通过点击该加载项的弹出窗口来切换(在上面的屏幕截图中可以看到)。这些请求的区别在于脚本的类别、脚本发起的请求、cookies、CSS 规则、图像、媒体、帧,和被 uMatrix 标记为“other” 的其它内容。例如,你可以设置全局规则,以便在默认情况下允许所有请求,并将特定的请求添加到黑名单中(更方便的方法),或在默认情况下阻止所有内容,并手动将某些请求列入白名单(更安全的方法)。如果你一直在使用 NoScript 或 RequestPolicy,你可以从它们 [导入][26] 你的白名单规则。 -另外 uMatrix 支持 [hosts files ][27],可用于阻止来自某些网站的请求。 不能与原始 uBlock 的筛选列表相比, 其使用的语法是 Adblock Plus 。默认情况下, uMatrix 会在几个文件的帮助下阻止已知分发广告、跟踪器和恶意软件的服务器, 如果需要, 您可以添加更多外部源。 +另外 uMatrix 支持 [hosts 文件][27],可用于阻止来自某些域的请求。不要与 uBlock Origin 所使用的筛选列表混淆,它使用的语法同 Adblock Plus 一样。默认情况下,uMatrix 会通过几个 hosts 文件阻止已知的分发广告、跟踪器和恶意软件的服务器,如果需要,你可以添加更多外部数据源。 -那么你将选择哪一个-- uBlock Origin 或 uMatrix ?就个人而言,我在电脑上两个都用,只在安卓手机上用 uMatrix 。两者之间会有重叠的部分 [according to gorhill][28] ,但他们有不同的用户和目标群,如果你想要的只是阻止跟踪器和广告的简单方法, uBlock Origine 是更好的选择, 另一方面,如果您希望对网页在浏览器中可以执行或不能执行的操作进行精细的控制, 即使需要一些时间来进行配置, 并且可能会阻止网站按预期运行, uMatrix 是更好的选择。 +那么你将选择哪一个:uBlock Origin 或 uMatrix ?就个人而言,我在电脑上两个都用,而只在安卓手机上用 uMatrix 。[据 gorhill 所说][28],两者之间存在某种重叠,但它们有不同的目标用户和目地。如果你想要的只是阻止跟踪器和广告的简单方法,uBlock Origine 是更好的选择;另一方面,如果你希望对网页在浏览器中可以执行或不能执行的操作进行精细的控制,即使需要一些时间来进行配置,并且可能会阻止某些网站如预期的工作,uMatrix 也是更好的选择。 ### 结论 -目前, 这些是 Firefox 里我最喜欢的扩展。Tridactyl 是依靠键盘和与外部程序交互, 加快浏览导航速度;Open With 能让我用鼠标点击程序操作, Stylus 是明确的用户风格的管理器, 对用户和开发人员都有吸引力; uMatrix 本质上是 Firefox 的防火墙用于过滤未知的请求。 +目前,这些是 Firefox 里我最喜欢的扩展。Tridactyl 通过依靠键盘和与外部程序交互,加快了浏览导航速度;Open With 能让我用鼠标在另外一个程序中打开页面;Stylus 是全面的用户样式管理器,对用户和开发人员都很有吸引力;uMatrix 本质上是 Firefox 的防火墙,可以用于过滤未知的请求。 -尽管我几乎完全讨论了这些加载项的好处,但没有一个软件是完美的。如果你喜欢他们中的任何一个,并认为他们可以以任何方式改进, 我建议你去他们的 Github 页面,并寻找他们的贡献指南。通常情况下,免费和开源软件的开发人员欢迎错误报告和提交请求。告诉你的朋友或道谢也是帮助开发者的好方法, 特别是如果他们在业余时间从事他们的项目。 +尽管我基本上只是讨论了这些加载项的好处,但没有一个软件是完美的。如果你喜欢它们中的任何一个,并认为它们的某些方面可以改进,我建议你去它们的 Github 页面,并查看它们的贡献指南。通常情况下,自由开源软件的开发人员是欢迎错误报告和提交请求的。告诉你的朋友或道谢也是帮助开发者的好方法,特别是如果这些开发者是在业余时间从事他们的项目的话。 -------------------------------------------------------------------------------- @@ -74,7 +76,7 @@ via: https://opensource.com/article/18/6/firefox-open-source-extensions 作者:[Zsolt Szakács][a] 选题:[lujun9972](https://github.com/lujun9972) 译者:[lixinyuxx](https://github.com/lixinyuxx) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From dbb3e6d6f6e5ecc5388e2df21e7474a552051a17 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Mon, 21 Jan 2019 11:09:26 +0800 Subject: [PATCH 058/243] PUB:20180604 4 Firefox extensions worth checking out.md @lixinyuxx https://linux.cn/article-10462-1.html --- .../20180604 4 Firefox extensions worth checking out.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {translated/tech => published}/20180604 4 Firefox extensions worth checking out.md (100%) diff --git a/translated/tech/20180604 4 Firefox extensions worth checking out.md b/published/20180604 4 Firefox extensions worth checking out.md similarity index 100% rename from translated/tech/20180604 4 Firefox extensions worth checking out.md rename to published/20180604 4 Firefox extensions worth checking out.md From 4b4d3b1bfba3e4cb18067737541b1abeffde5dd8 Mon Sep 17 00:00:00 2001 From: Asche Date: Mon, 21 Jan 2019 11:19:26 +0800 Subject: [PATCH 059/243] Translating by asche910 --- sources/tech/20190115 Linux Tools- The Meaning of Dot.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20190115 Linux Tools- The Meaning of Dot.md b/sources/tech/20190115 Linux Tools- The Meaning of Dot.md index 5e18c7603d..6f03c7f549 100644 --- a/sources/tech/20190115 Linux Tools- The Meaning of Dot.md +++ b/sources/tech/20190115 Linux Tools- The Meaning of Dot.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (asche910) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 5b19b7df4ccf58d9cc21af8b659f7d1133a222da Mon Sep 17 00:00:00 2001 From: Asche Date: Mon, 21 Jan 2019 13:54:54 +0800 Subject: [PATCH 060/243] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E8=AF=91=E6=96=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...0190115 Linux Tools- The Meaning of Dot.md | 105 ++++++++++-------- 1 file changed, 59 insertions(+), 46 deletions(-) diff --git a/sources/tech/20190115 Linux Tools- The Meaning of Dot.md b/sources/tech/20190115 Linux Tools- The Meaning of Dot.md index 6f03c7f549..8898fcf180 100644 --- a/sources/tech/20190115 Linux Tools- The Meaning of Dot.md +++ b/sources/tech/20190115 Linux Tools- The Meaning of Dot.md @@ -7,44 +7,47 @@ [#]: via: (https://www.linux.com/blog/learn/2019/1/linux-tools-meaning-dot) [#]: author: (Paul Brown https://www.linux.com/users/bro66) -Linux Tools: The Meaning of Dot +Linux 工具: 点的含义 ====== ![](https://www.linux.com/sites/lcom/files/styles/rendered_file/public/psychedelic-dot.jpg?itok=giKEHvwQ) -Let's face it: writing one-liners and scripts using shell commands can be confusing. Many of the names of the tools at your disposal are far from obvious in terms of what they do ( _grep_ , _tee_ and _awk_ , anyone?) and, when you combine two or more, the resulting "sentence" looks like some kind of alien gobbledygook. +我们会面对这样的现实:使用shell命令编写简短的脚本可能会令人很困惑。很多任你使用的工具的名称与它们的实际功能相差甚远(_grep_ , _tee_ 和 _awk_ ,还有吗?), 并且当你将两个或更多个组合起来时,产生的“句子”看起来像某种外星人官样文章。 -None of the above is helped by the fact that many of the symbols you use to build a chain of instructions can mean different things depending on their context. -### Location, location, location +由于这样一个现实: 你用来编写一连串的指令所使用的符号标志根据你使用的场景有着不同的意义。所以它对我们上面的事并没有给予到帮助。 -Take the humble dot (`.`) for example. Used with instructions that are expecting the name of a directory, it means "this directory" so this: +### 位置,位置,位置 + + +就拿这个谦卑的点 (`.`) 为例。 它与接收一个目录名称的指令一起使用,表示“当前目录”: ``` find . -name "*.jpg" ``` -translates to " _find in this directory (and all its subdirectories) files that have names that end in`.jpg`_ ". +意思就是“_在当前目录(包括子目录)中寻找以`.jpg`结尾的文件_” -Both `ls .` and `cd .` act as expected, so they list and "change" to the current directory, respectively, although including the dot in these two cases is not necessary. +`ls .` and `cd .`结果也同期望的那样,他们分别列举和“进入”到当前目录,虽然在这两种情况下点都是多余的。 -Two dots, one after the other, in the same context (i.e., when your instruction is expecting a directory path) means " _the directory immediately above the current one_ ". If you are in _/home/your_directory_ and run +两个点,一个紧接着另一个,同样的场景下(即当你的命令期望一个文件目录的时候)表示“_当前目录的父目录_”。如果你当前在 _/home/your_directory_ 下并且运行 ``` cd .. ``` -you will be taken to _/home_. So, you may think this still kind of fits into the “dots represent nearby directories” narrative and is not complicated at all, right? +你就会进入到 _/home_。所以,你可能认为这仍然适合“点代表附近目录”的叙述,并且毫不复杂,对吧? -How about this, then? If you use a dot at the beginning of a directory or file, it means the directory or file will be hidden: + +那这样会怎样呢?如果你在一个文件或目录的开头加上点,它表示这个文件或目录会被隐藏: ``` $ touch somedir/file01.txt somedir/file02.txt somedir/.secretfile.txt $ ls -l somedir/ total 0 -rw-r--r-- 1 paul paul 0 Jan 13 19:57 file01.txt -rw-r--r-- 1 paul paul 0 Jan 13 19:57 file02.txt -$ # Note how there is no .secretfile.txt in the listing above +$ # 注意上面列举的文件中没有 .secretfile.txt $ ls -la somedir/ total 8 drwxr-xr-x 2 paul paul 4096 Jan 13 19:57 . @@ -52,128 +55,138 @@ drwx------ 48 paul paul 4096 Jan 13 19:57 .. -rw-r--r-- 1 paul paul 0 Jan 13 19:57 file01.txt -rw-r--r-- 1 paul paul 0 Jan 13 19:57 file02.txt -rw-r--r-- 1 paul paul 0 Jan 13 19:57 .secretfile.txt -$ # The -a option tells ls to show "all" files, including the hidden ones +$ # 这个 -a 选项告诉 ls 去展示"all" 文件, 包括那些隐藏的 ``` -And then there's when you use `.` as a command. Yep! You heard me: `.` is a full-fledged command. It is a synonym of `source` and you use that to execute a file in the current shell, as opposed to running a script some other way (which usually mean Bash will spawn a new shell in which to run it). +然后就是你将`.`当作命令。是的,你听我说过:`.`是个羽翼丰满的命令。它是`source` 的代名词 所以在当前shell中你可以用它来执行一个文件,而不是以某些方法去运行一个脚本文件(这样通常指的是Bash会产生一个新的shell去运行它) -Confused? Don't worry -- try this: Create a script called _myscript_ that contains the line + +很困惑?别担心 -- 试试这个:创建一个名为 _myscript_ 的脚本,内容包含下面一行 ``` myvar="Hello" ``` -and execute it the regular way, that is, with `sh myscript` (or by making the script executable with `chmod a+x myscript` and then running `./myscript`). Now try and see the contents of `myvar` with `echo $myvar` (spoiler: You will get nothing). This is because, when your script plunks " _Hello_ " into `myvar`, it does so in a separate bash shell instance. When the script ends, the spawned instance disappears and control returns to the original shell, where `myvar` never even existed. -However, if you run _myscript_ like this: +然后通过常规的方法执行它,也就是用 `sh myscript`(或者通过 `chmod a+x myscript` 命令让它可执行,然后运行`./myscript`)。现在尝试并且观察`myvar` 的内容 ,通过`echo $myvar` (理所当然的你什么也得不到)。那是因为,当你的脚本赋值“_Hello_”给`myvar`时,它是在一个隔离的bash shell实例中进行的。当脚本运行结束时,这个新产生的实例会消失并且控制权转交给原来的shell,而原来的shell甚至都不存在`myvar` 变量。 + +然而,如果你这样运行 _myscript_ : ``` . myscript ``` -`echo $myvar` will print _Hello_ to the command line. -You will often use the `.` (or `source`) command after making changes to your _.bashrc_ file, [like when you need to expand your `PATH` variable][1]. You use `.` to make the changes available immediately in your current shell instance. +`echo $myvar` 就会打印 _Hello_ 到命令行上。 -### Double Trouble +当你的 _.bashrc_ 文件发生变化后,你经常会用到`.` (或 `source`) 命令, [就像当你要扩展 `PATH` 变量那样][1] ,在你的当前shell实例中,你使用`.`来让变化立即生效。 -Just like the seemingly insignificant single dot has more than one meaning, so has the double dot. Apart from pointing to the parent of the current directory, the double dot (`..`) is also used to build sequences. +### 双重麻烦 -Try this: +就像看似无关紧要的一个点有多个含义一样,两个点也是如此。除了指向当前目录的父级之外,两个点(`..`)也用于构建序列。 + +尝试下这个: ``` echo {1..10} ``` -It will print out the list of numbers from 1 to 10. In this context, `..` means " _starting with the value on my left, count up to the value on my right_ ". - -Now try this: +它会打印出从1到10的序列。这种场景下,`..` 表示 “_从左边的值开始,计数到右边的值_”. +现在试下这个: ``` echo {1..10..2} ``` -You'll get _1 3 5 7 9_. The `..2` part of the command tells Bash to print the sequence, but not one by one, but two by two. In other words, you'll get all the odd numbers from 1 to 10. - -It works backwards, too: +你会得到 _1 3 5 7 9_ 。`..2`这部分命令告诉Bash输出这个序列,不过不是每个相差1,而是相差2。换句话说,就是你会得到从1到10之间的奇数。 +反着它也仍然有效: ``` echo {10..1..2} ``` -You can also pad your numbers with 0s. Doing: + +你也可以用多个0填充你的数字。这样: ``` echo {000..121..2} ``` -will print out every even number from 0 to 121 like this: +会这样打印出从0到121之间的偶数: ``` 000 002 004 006 ... 050 052 054 ... 116 118 120 ``` -But how is this sequence-generating construct useful? Well, suppose one of your New Year's resolutions is to be more careful with your accounts. As part of that, you want to create directories in which to classify your digital invoices of the last 10 years: + +不过这样的序列发生器怎样才有作用呢?当然,假设您的新年决心之一是对您的帐户更加谨慎。 作为其中一部分,您需要创建目录,以便对过去10年的数字发票进行分类: ``` mkdir {2009..2019}_Invoices ``` -Job done. +工作完成。 -Or maybe you have a hundreds of numbered files, say, frames extracted from a video clip, and, for whatever reason, you want to remove only every third frame between the frames 43 and 61: +或者你可能有数百个带编号的文件,比如从视频剪辑中提取的帧,无论出于什么原因,你只想删除第43帧和第61帧之间的每隔三帧: ``` rm frame_{043..61..3} ``` -It is likely that, if you have more than 100 frames, they will be named with padded 0s and look like this: + +很可能,如果你有超过100帧,它们将以填充0命名,如下所示: ``` frame_000 frame_001 frame_002 ... ``` -That’s why you will use `043` in your command instead of just `43`. +那就是为什么你要用 `043` 在你的命令中,而不是`43` 的原因。 ### Curly~Wurly -Truth be told, the magic of sequences lies not so much in the double dot as in the sorcery of the curly braces (`{}`). Look how it works for letters, too. Doing: + + +说实话,序列的神奇之处不在于双点,就像花括号(`{}`)的巫术一样。 看看它对于字母是如何工作的。这样做: ``` touch file_{a..z}.txt ``` -creates the files _file_a.txt_ through _file_z.txt_. -You must be careful, however. Using a sequence like `{Z..a}` will run through a bunch of non-alphanumeric characters (glyphs that are neither numbers or letters) that live between the uppercase alphabet and the lowercase one. Some of these glyphs are unprintable or have a special meaning of their own. Using them to generate names of files could lead to a whole bevy of unexpected and potentially unpleasant effects. +创建了从 _file_a.txt_ 到 _file_z.txt_ 的文件。 -One final thing worth pointing out about sequences encased between `{...}` is that they can also contain lists of strings: + +但是,你必须小心。 使用像`{Z..a}`这样的序列将运行大量字母和小写字母之间的一堆非字母数字字符(既不是数字或字母的字形)。 其中一些字形是不可打印的或具有自己的特殊含义。 使用它们来生成文件名称可能会导致一系列意外和可能令人不快的影响。 + +最后一件值得指出的事:包围在`{...}`的序列,它们也可以包含字符串的列举: ``` touch {blahg, splurg, mmmf}_file.txt ``` -Creates _blahg_file.txt_ , _splurg_file.txt_ and _mmmf_file.txt_. +创建了 _blahg_file.txt_ , _splurg_file.txt_ and _mmmf_file.txt_. -Of course, in other contexts, the curly braces have different meanings (surprise!). But that is the stuff of another article. -### Conclusion +当然,在别的场景中,大括号也有不同的含义(惊喜!)。不过那是别的文章的内容了。 -Bash and the utilities you can run within it have been shaped over decades by system administrators looking for ways to solve very particular problems. To say that sysadmins and their ways are their own breed of special would be an understatement. Consequently, as opposed to other languages, Bash was not designed to be user-friendly, easy or even logical. +### 总结 -That doesn't mean it is not powerful -- quite the contrary. Bash's grammar and shell tools may be inconsistent and sprawling, but they also provide a dizzying range of ways to do everything you can possibly imagine. It is like having a toolbox where you can find everything from a power drill to a spoon, as well as a rubber duck, a roll of duct tape, and some nail clippers. -Apart from fascinating, it is also fun to discover all you can achieve directly from within the shell, so next time we will delve ever deeper into how you can build bigger and better Bash command lines. +系统管理员开发Bash和你可以在上面使用的工具集已有数十载,他们仍在寻找着解决各种特殊问题的方法。要说系统管理员和他们的方式是他们自己的特殊品味将是轻描淡写。总而言之,与其他语言相反,Bash的设计并不是用户友好,简单甚至合乎逻辑的。 -Until then, have fun! +这并不意味着它不强大 -- 恰恰相反。 Bash的语法和shell工具可能不一致且庞大,但它们也提供了一系列令人眼花缭乱的方法来完成您可能想象到的一切。 就像有一个工具箱,你可以找到从电钻到勺子的所有东西,以及橡皮鸭,一卷胶带和一些指甲钳。 + +除了引人入胜之外,发现你可以直接在shell中实现的所有内容也很有趣,所以下次我们将深入探讨如何构建更大更好的Bash命令行。 + +在那之前,玩得开心! -------------------------------------------------------------------------------- via: https://www.linux.com/blog/learn/2019/1/linux-tools-meaning-dot 作者:[Paul Brown][a] 选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) +译者:[asche910](https://github.com/asche910) 校对:[校对者ID](https://github.com/校对者ID) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From ecce20e01b2fe6fc19ebd8f20fd14f6e139bf786 Mon Sep 17 00:00:00 2001 From: Asche Date: Mon, 21 Jan 2019 13:58:53 +0800 Subject: [PATCH 061/243] =?UTF-8?q?=E5=AE=8C=E6=88=90=E7=BF=BB=E8=AF=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../tech/20190115 Linux Tools- The Meaning of Dot.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {sources => translated}/tech/20190115 Linux Tools- The Meaning of Dot.md (100%) diff --git a/sources/tech/20190115 Linux Tools- The Meaning of Dot.md b/translated/tech/20190115 Linux Tools- The Meaning of Dot.md similarity index 100% rename from sources/tech/20190115 Linux Tools- The Meaning of Dot.md rename to translated/tech/20190115 Linux Tools- The Meaning of Dot.md From ec894eaa883dae86295fd828d9b498f257df824f Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Mon, 21 Jan 2019 21:24:24 +0800 Subject: [PATCH 062/243] PUB:20171119 The Ruby Story.md @wwhio https://linux.cn/article-10463-1.html --- {translated/talk => published}/20171119 The Ruby Story.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {translated/talk => published}/20171119 The Ruby Story.md (100%) diff --git a/translated/talk/20171119 The Ruby Story.md b/published/20171119 The Ruby Story.md similarity index 100% rename from translated/talk/20171119 The Ruby Story.md rename to published/20171119 The Ruby Story.md From 41b7db830f8db9f401280f70e62a4a0c22b6f2e1 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Mon, 21 Jan 2019 22:45:50 +0800 Subject: [PATCH 063/243] PRF:20190114 How To Move Multiple File Types Simultaneously From Commandline.md @MjSeven --- ...e Types Simultaneously From Commandline.md | 23 ++++++++++--------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/translated/tech/20190114 How To Move Multiple File Types Simultaneously From Commandline.md b/translated/tech/20190114 How To Move Multiple File Types Simultaneously From Commandline.md index 691dc85d26..9cf54e8196 100644 --- a/translated/tech/20190114 How To Move Multiple File Types Simultaneously From Commandline.md +++ b/translated/tech/20190114 How To Move Multiple File Types Simultaneously From Commandline.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (MjSeven) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (How To Move Multiple File Types Simultaneously From Commandline) @@ -12,20 +12,20 @@ ![](https://www.ostechnix.com/wp-content/uploads/2019/01/Move-Multiple-File-Types-720x340.png) -前几天,我想知道如何将多个文件类型从一个目录移动(不复制)到另一个目录。我已经知道如何[**查找并将某些类型的文件从一个目录复制到另一个目录**][1]。但是,我不知道如何同时移动多种文件类型。如果你曾遇到这样的情况,我知道在类 Unix 系统中从命令行执行该操作的一个简单方法。 +前几天,我想知道如何将多个文件类型从一个目录移动(不复制)到另一个目录。我已经知道如何[查找并将某些类型的文件从一个目录复制到另一个目录][1]。但是,我不知道如何同时移动多种文件类型。如果你曾遇到这样的情况,我知道在类 Unix 系统中从命令行执行该操作的一个简单方法。 ### 同时移动多种文件类型 -想象一下这种场景,你在名为 **‘dir1’** 的目录中有多种类型的文件,例如 .pdf, .doc, .mp3, .mp4, .txt 等等。我们来看看 dir1 的内容: +想象一下这种场景,你在名为 `dir1` 的目录中有多种类型的文件,例如 .pdf、 .doc、 .mp3、 .mp4、 .txt 等等。我们来看看 `dir1` 的内容: ``` $ ls dir1 file.txt image.jpg mydoc.doc personal.pdf song.mp3 video.mp4 ``` -你希望将某些文件类型(不是所有文件类型)移动到另一个位置。例如,假设你想将 doc, pdf 和 txt 文件一次性移动到名为 **‘dir2’** 的另一个目录中。 +你希望将某些文件类型(不是所有文件类型)移动到另一个位置。例如,假设你想将 .doc、 .pdf 和 .txt 文件一次性移动到名为 `dir2` 的另一个目录中。 -要同时将 .doc, .pdf 和 .txt 文件从 dir1 移动到 dir2,命令是: +要同时将 .doc、 .pdf 和 .txt 文件从 `dir1` 移动到 `dir2`,命令是: ``` $ mv dir1/*.{doc,pdf,txt} dir2/ @@ -33,31 +33,32 @@ $ mv dir1/*.{doc,pdf,txt} dir2/ 很容易,不是吗? -现在让我们来查看一下 dir2 的内容: +现在让我们来查看一下 `dir2` 的内容: + ``` $ ls dir2/ file.txt mydoc.doc personal.pdf ``` -看到了吗?只有 .doc, .pdf 和 .txt 从 dir1 移到了 dir2。 +看到了吗?只有 .doc、 .pdf 和 .txt 从 `dir1` 移到了 `dir2`。 ![][3] 在上面的命令中,你可以在花括号内添加任意数量的文件类型,以将它们移动到不同的目录中。它在 Bash 上非常适合我。 -另一种移动多种文件类型的方法是转到源目录,在我们的例子中即为 dir1: +另一种移动多种文件类型的方法是转到源目录,在我们的例子中即为 `dir1`: ``` $ cd ~/dir1 ``` -将你选择的文件类型移动到目的地(即 dir2),如下所示: +将你选择的文件类型移动到目的地(即 `dir2`),如下所示: ``` $ mv *.doc *.txt *.pdf /home/sk/dir2/ ``` -要移动具有特定扩展名的所有文件,例如 **.doc**,运行: +要移动具有特定扩展名的所有文件,例如 .doc,运行: ``` $ mv dir1/*.doc dir2/ @@ -82,7 +83,7 @@ via: https://www.ostechnix.com/how-to-move-multiple-file-types-simultaneously-fr 作者:[SK][a] 选题:[lujun9972][b] 译者:[MjSeven](https://github.com/MjSeven) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From ac0237db73413c1afa3b6a33187cbae6692a49fe Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Mon, 21 Jan 2019 22:46:28 +0800 Subject: [PATCH 064/243] PUB:20190114 How To Move Multiple File Types Simultaneously From Commandline.md @MjSeven https://linux.cn/article-10464-1.html --- ...ove Multiple File Types Simultaneously From Commandline.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20190114 How To Move Multiple File Types Simultaneously From Commandline.md (98%) diff --git a/translated/tech/20190114 How To Move Multiple File Types Simultaneously From Commandline.md b/published/20190114 How To Move Multiple File Types Simultaneously From Commandline.md similarity index 98% rename from translated/tech/20190114 How To Move Multiple File Types Simultaneously From Commandline.md rename to published/20190114 How To Move Multiple File Types Simultaneously From Commandline.md index 9cf54e8196..738306b94c 100644 --- a/translated/tech/20190114 How To Move Multiple File Types Simultaneously From Commandline.md +++ b/published/20190114 How To Move Multiple File Types Simultaneously From Commandline.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (MjSeven) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-10464-1.html) [#]: subject: (How To Move Multiple File Types Simultaneously From Commandline) [#]: via: (https://www.ostechnix.com/how-to-move-multiple-file-types-simultaneously-from-commandline/) [#]: author: (SK https://www.ostechnix.com/author/sk/) From 5d005466e8e272ad68ad7bdb8161e9df33595282 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Tue, 22 Jan 2019 00:02:13 +0800 Subject: [PATCH 065/243] PRF:20190115 Linux Tools- The Meaning of Dot.md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @asche910 恭喜你,完成了第一篇翻译贡献! --- ...0190115 Linux Tools- The Meaning of Dot.md | 99 +++++++++---------- 1 file changed, 44 insertions(+), 55 deletions(-) diff --git a/translated/tech/20190115 Linux Tools- The Meaning of Dot.md b/translated/tech/20190115 Linux Tools- The Meaning of Dot.md index 8898fcf180..cb373ecd51 100644 --- a/translated/tech/20190115 Linux Tools- The Meaning of Dot.md +++ b/translated/tech/20190115 Linux Tools- The Meaning of Dot.md @@ -1,46 +1,45 @@ [#]: collector: (lujun9972) [#]: translator: (asche910) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Linux Tools: The Meaning of Dot) [#]: via: (https://www.linux.com/blog/learn/2019/1/linux-tools-meaning-dot) [#]: author: (Paul Brown https://www.linux.com/users/bro66) -Linux 工具: 点的含义 +Linux 工具:点的含义 ====== +> Paul Brown 解释了 Linux shell 命令中那个不起眼的“点”的各种意思和用法。 + ![](https://www.linux.com/sites/lcom/files/styles/rendered_file/public/psychedelic-dot.jpg?itok=giKEHvwQ) -我们会面对这样的现实:使用shell命令编写简短的脚本可能会令人很困惑。很多任你使用的工具的名称与它们的实际功能相差甚远(_grep_ , _tee_ 和 _awk_ ,还有吗?), 并且当你将两个或更多个组合起来时,产生的“句子”看起来像某种外星人官样文章。 +在现实情况中,使用 shell 命令编写的单行命令或脚本可能会令人很困惑。你使用的很多工具的名称与它们的实际功能相差甚远(`grep`、`tee` 和 `awk`,还有吗?),而当你将两个或更多个组合起来时,所组成的 “句子” 看起来更像某种外星人的天书。 +因此,上面说的这些对于你并无帮助,因为你用来编写一连串的指令所使用的符号根据你使用的场景有着不同的意义。 -由于这样一个现实: 你用来编写一连串的指令所使用的符号标志根据你使用的场景有着不同的意义。所以它对我们上面的事并没有给予到帮助。 +### 位置、位置、位置 -### 位置,位置,位置 - - -就拿这个谦卑的点 (`.`) 为例。 它与接收一个目录名称的指令一起使用,表示“当前目录”: +就拿这个不起眼的点(`.`)来说吧。当它放在一个需要一个目录名称的命令的参数处时,表示“当前目录”: ``` find . -name "*.jpg" ``` -意思就是“_在当前目录(包括子目录)中寻找以`.jpg`结尾的文件_” +意思就是“在当前目录(包括子目录)中寻找以 `.jpg` 结尾的文件”。 -`ls .` and `cd .`结果也同期望的那样,他们分别列举和“进入”到当前目录,虽然在这两种情况下点都是多余的。 +`ls .` 和 `cd .` 结果也如你想的那样,它们分别列举和“进入”到当前目录,虽然在这两种情况下这个点都是多余的。 +而一个紧接着另一个的两个点呢,在同样的场景下(即当你的命令期望一个文件目录的时候)表示“当前目录的父目录”。如果你当前在 `/home/your_directory` 下并且运行: -两个点,一个紧接着另一个,同样的场景下(即当你的命令期望一个文件目录的时候)表示“_当前目录的父目录_”。如果你当前在 _/home/your_directory_ 下并且运行 ``` cd .. ``` -你就会进入到 _/home_。所以,你可能认为这仍然适合“点代表附近目录”的叙述,并且毫不复杂,对吧? +你就会进入到 `/home`。所以,你可能认为这仍然适合“点代表附近目录”的叙述,并且毫不复杂,对吧? +那下面这样会怎样呢?如果你在一个文件或目录的开头加上点,它表示这个文件或目录会被隐藏: - -那这样会怎样呢?如果你在一个文件或目录的开头加上点,它表示这个文件或目录会被隐藏: ``` $ touch somedir/file01.txt somedir/file02.txt somedir/.secretfile.txt $ ls -l somedir/ @@ -55,71 +54,68 @@ drwx------ 48 paul paul 4096 Jan 13 19:57 .. -rw-r--r-- 1 paul paul 0 Jan 13 19:57 file01.txt -rw-r--r-- 1 paul paul 0 Jan 13 19:57 file02.txt -rw-r--r-- 1 paul paul 0 Jan 13 19:57 .secretfile.txt -$ # 这个 -a 选项告诉 ls 去展示"all" 文件, 包括那些隐藏的 +$ # 这个 -a 选项告诉 ls 去展示“all”文件,包括那些隐藏的 ``` -然后就是你将`.`当作命令。是的,你听我说过:`.`是个羽翼丰满的命令。它是`source` 的代名词 所以在当前shell中你可以用它来执行一个文件,而不是以某些方法去运行一个脚本文件(这样通常指的是Bash会产生一个新的shell去运行它) +然后就是你可以将 `.` 当作命令。是的,你听我说:`.` 是个真真正正的命令。它是 `source` 命令的代名词,所以你可以用它在当前 shell 中执行一个文件,而不是以某种其它的方式去运行一个脚本文件(这通常指的是 Bash 会产生一个新的 shell 去运行它) - -很困惑?别担心 -- 试试这个:创建一个名为 _myscript_ 的脚本,内容包含下面一行 +很困惑?别担心 —— 试试这个:创建一个名为 `myscript` 的脚本,内容包含下面一行: ``` myvar="Hello" ``` +然后通过常规的方法执行它,也就是用 `sh myscript`(或者通过 `chmod a+x myscript` 命令让它可执行,然后运行 `./myscript`)。现在尝试并且观察 `myvar` 的内容,通过 `echo $myvar`(理所当然你什么也得不到)。那是因为,当你的脚本赋值 `"Hello"` 给 `myvar` 时,它是在一个隔离的bash shell 实例中进行的。当脚本运行结束时,这个新产生的实例会消失并且将控制权转交给原来的shell,而原来的 shell 里甚至都不存在 `myvar` 变量。 -然后通过常规的方法执行它,也就是用 `sh myscript`(或者通过 `chmod a+x myscript` 命令让它可执行,然后运行`./myscript`)。现在尝试并且观察`myvar` 的内容 ,通过`echo $myvar` (理所当然的你什么也得不到)。那是因为,当你的脚本赋值“_Hello_”给`myvar`时,它是在一个隔离的bash shell实例中进行的。当脚本运行结束时,这个新产生的实例会消失并且控制权转交给原来的shell,而原来的shell甚至都不存在`myvar` 变量。 +然而,如果你这样运行 `myscript`: - -然而,如果你这样运行 _myscript_ : ``` . myscript ``` +`echo $myvar` 就会打印 `Hello` 到命令行上。 -`echo $myvar` 就会打印 _Hello_ 到命令行上。 - -当你的 _.bashrc_ 文件发生变化后,你经常会用到`.` (或 `source`) 命令, [就像当你要扩展 `PATH` 变量那样][1] ,在你的当前shell实例中,你使用`.`来让变化立即生效。 +当你的 `.bashrc` 文件发生变化后,你经常会用到 `.`(或 `source`)命令,[就像当你要扩展 `PATH` 变量那样][1]。在你的当前 shell 实例中,你可以使用 `.` 来让变化立即生效。 ### 双重麻烦 就像看似无关紧要的一个点有多个含义一样,两个点也是如此。除了指向当前目录的父级之外,两个点(`..`)也用于构建序列。 - 尝试下这个: + ``` echo {1..10} ``` -它会打印出从1到10的序列。这种场景下,`..` 表示 “_从左边的值开始,计数到右边的值_”. +它会打印出从 1 到 10 的序列。在这种场景下,`..` 表示 “从左边的值开始,计数到右边的值”。 现在试下这个: + ``` echo {1..10..2} ``` -你会得到 _1 3 5 7 9_ 。`..2`这部分命令告诉Bash输出这个序列,不过不是每个相差1,而是相差2。换句话说,就是你会得到从1到10之间的奇数。 +你会得到 `1 3 5 7 9`。`..2` 这部分命令告诉 Bash 输出这个序列,不过不是每个相差 1,而是相差 2。换句话说,就是你会得到从 1 到 10 之间的奇数。 + +它反着也仍然有效: -反着它也仍然有效: ``` echo {10..1..2} ``` - -你也可以用多个0填充你的数字。这样: +你也可以用多个 0 填充你的数字。这样: ``` echo {000..121..2} ``` -会这样打印出从0到121之间的偶数: +会这样打印出从 0 到 121 之间的偶数(填充了前置 0): ``` 000 002 004 006 ... 050 052 054 ... 116 118 120 ``` - -不过这样的序列发生器怎样才有作用呢?当然,假设您的新年决心之一是对您的帐户更加谨慎。 作为其中一部分,您需要创建目录,以便对过去10年的数字发票进行分类: +不过这样的序列发生器有啥用呢?当然,假设您的新年决心之一是更加谨慎控制您的帐户花销。作为决心的一部分,您需要创建目录,以便对过去 10 年的数字发票进行分类: ``` mkdir {2009..2019}_Invoices @@ -127,59 +123,52 @@ mkdir {2009..2019}_Invoices 工作完成。 +或者你可能有数百个带编号的文件,比如从视频剪辑中提取的帧,或许因为某种原因,你只想从第 43 帧到第 61 帧每隔三帧删除一帧: -或者你可能有数百个带编号的文件,比如从视频剪辑中提取的帧,无论出于什么原因,你只想删除第43帧和第61帧之间的每隔三帧: ``` rm frame_{043..61..3} ``` - -很可能,如果你有超过100帧,它们将以填充0命名,如下所示: +很可能,如果你有超过 100 个帧,它们将以填充 0 命名,如下所示: ``` frame_000 frame_001 frame_002 ... ``` -那就是为什么你要用 `043` 在你的命令中,而不是`43` 的原因。 +那就是为什么你在命令中要用 `043`,而不是`43` 的原因。 -### Curly~Wurly +### 花括号花招 - - -说实话,序列的神奇之处不在于双点,就像花括号(`{}`)的巫术一样。 看看它对于字母是如何工作的。这样做: +说实话,序列的神奇之处不在于双点,而是花括号(`{}`)的巫术。看看它对于字母是如何工作的。这样做: ``` touch file_{a..z}.txt ``` +它创建了从 `file_a.txt` 到 `file_z.txt` 的文件。 -创建了从 _file_a.txt_ 到 _file_z.txt_ 的文件。 +但是,你必须小心。使用像 `{Z..a}` 这样的序列将产生一大堆大写字母和小写字母之间的非字母、数字的字符(既不是数字或字母的字形)。其中一些字形是不可打印的或具有自己的特殊含义。使用它们来生成文件名称可能会导致一系列意外和可能令人不快的影响。 - -但是,你必须小心。 使用像`{Z..a}`这样的序列将运行大量字母和小写字母之间的一堆非字母数字字符(既不是数字或字母的字形)。 其中一些字形是不可打印的或具有自己的特殊含义。 使用它们来生成文件名称可能会导致一系列意外和可能令人不快的影响。 - -最后一件值得指出的事:包围在`{...}`的序列,它们也可以包含字符串的列举: +最后一件值得指出的事:包围在 `{...}` 的序列,它们也可以包含字符串列表: ``` touch {blahg, splurg, mmmf}_file.txt ``` -创建了 _blahg_file.txt_ , _splurg_file.txt_ and _mmmf_file.txt_. +将创建了 `blahg_file.txt`、`splurg_file.txt` 和 `mmmf_file.txt`。 - -当然,在别的场景中,大括号也有不同的含义(惊喜!)。不过那是别的文章的内容了。 +当然,在别的场景中,大括号也有不同的含义(惊喜吗!)。不过那是别的文章的内容了。 ### 总结 +Bash 以及运行于其中的各种工具已经被寻求解决各种特定问题的系统管理员们把玩了数十年。要说这种有自己之道的系统管理员是一种特殊物种的话,那是有点轻描淡写。总而言之,与其他语言相反,Bash 的设计目标并不是为了用户友好、简单、甚至合乎逻辑。 -系统管理员开发Bash和你可以在上面使用的工具集已有数十载,他们仍在寻找着解决各种特殊问题的方法。要说系统管理员和他们的方式是他们自己的特殊品味将是轻描淡写。总而言之,与其他语言相反,Bash的设计并不是用户友好,简单甚至合乎逻辑的。 +但这并不意味着它不强大 —— 恰恰相反。Bash 的语法和 shell 工具可能不一致且很庞大,但它们也提供了一系列令人眼花缭乱的方法来完成您可能想象到的一切。就像有一个工具箱,你可以从中找到从电钻到勺子的所有东西,以及橡皮鸭、一卷胶带和一些指甲钳。 -这并不意味着它不强大 -- 恰恰相反。 Bash的语法和shell工具可能不一致且庞大,但它们也提供了一系列令人眼花缭乱的方法来完成您可能想象到的一切。 就像有一个工具箱,你可以找到从电钻到勺子的所有东西,以及橡皮鸭,一卷胶带和一些指甲钳。 - - -除了引人入胜之外,发现你可以直接在shell中实现的所有内容也很有趣,所以下次我们将深入探讨如何构建更大更好的Bash命令行。 +除了引人入胜之外,探明你可以直接在 shell 中达成的所有能力也很有趣,所以下次我们将深入探讨如何构建更大更好的 Bash 命令行。 在那之前,玩得开心! + -------------------------------------------------------------------------------- via: https://www.linux.com/blog/learn/2019/1/linux-tools-meaning-dot @@ -187,7 +176,7 @@ via: https://www.linux.com/blog/learn/2019/1/linux-tools-meaning-dot 作者:[Paul Brown][a] 选题:[lujun9972][b] 译者:[asche910](https://github.com/asche910) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From fdcfd346c048504834a8319bf152e524583175b7 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Tue, 22 Jan 2019 00:03:51 +0800 Subject: [PATCH 066/243] PUB:20190115 Linux Tools- The Meaning of Dot.md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @asche910 本文首发地址: https://linux.cn/article-10465-1.html 您的 LCTT 专页地址: https://linux.cn/lctt/asche910 请注册领取 LCCN: https://lctt.linux.cn/ --- .../20190115 Linux Tools- The Meaning of Dot.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20190115 Linux Tools- The Meaning of Dot.md (99%) diff --git a/translated/tech/20190115 Linux Tools- The Meaning of Dot.md b/published/20190115 Linux Tools- The Meaning of Dot.md similarity index 99% rename from translated/tech/20190115 Linux Tools- The Meaning of Dot.md rename to published/20190115 Linux Tools- The Meaning of Dot.md index cb373ecd51..6c5cfe5032 100644 --- a/translated/tech/20190115 Linux Tools- The Meaning of Dot.md +++ b/published/20190115 Linux Tools- The Meaning of Dot.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (asche910) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-10465-1.html) [#]: subject: (Linux Tools: The Meaning of Dot) [#]: via: (https://www.linux.com/blog/learn/2019/1/linux-tools-meaning-dot) [#]: author: (Paul Brown https://www.linux.com/users/bro66) From 3d9a5add0e2346b0f41b260d7a7cfba303452666 Mon Sep 17 00:00:00 2001 From: geekpi Date: Tue, 22 Jan 2019 08:55:35 +0800 Subject: [PATCH 067/243] translated --- .../20190104 Managing dotfiles with rcm.md | 116 ------------------ .../20190104 Managing dotfiles with rcm.md | 116 ++++++++++++++++++ 2 files changed, 116 insertions(+), 116 deletions(-) delete mode 100644 sources/tech/20190104 Managing dotfiles with rcm.md create mode 100644 translated/tech/20190104 Managing dotfiles with rcm.md diff --git a/sources/tech/20190104 Managing dotfiles with rcm.md b/sources/tech/20190104 Managing dotfiles with rcm.md deleted file mode 100644 index f046c70538..0000000000 --- a/sources/tech/20190104 Managing dotfiles with rcm.md +++ /dev/null @@ -1,116 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (geekpi) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Managing dotfiles with rcm) -[#]: via: (https://fedoramagazine.org/managing-dotfiles-rcm/) -[#]: author: (Link Dupont https://fedoramagazine.org/author/linkdupont/) - -Managing dotfiles with rcm -====== - -![](https://fedoramagazine.org/wp-content/uploads/2018/12/dotfiles-816x345.jpg) - -A hallmark feature of many GNU/Linux programs is the easy-to-edit configuration file. Nearly all common free software programs store configuration settings inside a plain text file, often in a structured format like JSON, YAML or [“INI-like”][1]. These configuration files are frequently found hidden inside a user’s home directory. However, a basic ls won’t reveal them. UNIX standards require that any file or directory name that begins with a period (or “dot”) is considered “hidden” and will not be listed in directory listings unless requested by the user. For example, to list all files using the ls program, pass the -a command-line option. - -Over time, these configuration files become highly customized, and managing them becomes increasingly more challenging as time goes on. Not only that, but keeping them synchronized between multiple computers is a common challenge in large organizations. Finally, many users find a sense of pride in their unique configuration settings and want an easy way to share them with friends. That’s where **rcm** steps in. - -**rcm** is a “rc” file management suite (“rc” is another convention for naming configuration files that has been adopted by some GNU/Linux programs like screen or bash). **rcm** provides a suite of commands to manage and list files it tracks. Install **rcm** using **dnf**. - -### Getting started - -By default, **rcm** uses ~/.dotfiles for storing all the dotfiles it manages. A managed dotfile is actually stored inside ~/.dotfiles, and a symlink is placed in the expected file’s location. For example, if ~/.bashrc is tracked by **rcm** , a long listing would look like this. - -``` -[link@localhost ~]$ ls -l ~/.bashrc -lrwxrwxrwx. 1 link link 27 Dec 16 05:19 .bashrc -> /home/link/.dotfiles/bashrc -[link@localhost ~]$ -``` - -**rcm** consists of 4 commands: - - * mkrc – convert a file into a dotfile managed by rcm - * lsrc – list files managed by rcm - * rcup – synchronize dotfiles managed by rcm - * rcdn – remove all the symlinks managed by rcm - - - -### Share bashrc across two computers - -It is not uncommon today for a user to have shell accounts on more than one computer. Keeping dotfiles synchronized between those computers can be a challenge. This scenario will present one possible solution, using only **rcm** and **git**. - -First, convert (or “bless”) a file into a dotfile managed by **rcm** with mkrc. - -``` -[link@localhost ~]$ mkrc -v ~/.bashrc -Moving... -'/home/link/.bashrc' -> '/home/link/.dotfiles/bashrc' -Linking... -'/home/link/.dotfiles/bashrc' -> '/home/link/.bashrc' -[link@localhost ~]$ -``` - -Next, verify the listings are correct with lsrc. - -``` -[link@localhost ~]$ lsrc -/home/link/.bashrc:/home/link/.dotfiles/bashrc -[link@localhost ~]$ -``` - -Now create a git repository inside ~/.dotfiles and set up an accessible remote repository using your choice of hosted git repositories. Commit the bashrc file and push a new branch. - -``` -[link@localhost ~]$ cd ~/.dotfiles -[link@localhost .dotfiles]$ git init -Initialized empty Git repository in /home/link/.dotfiles/.git/ -[link@localhost .dotfiles]$ git remote add origin git@github.com:linkdupont/dotfiles.git -[link@localhost .dotfiles]$ git add bashrc -[link@localhost .dotfiles]$ git commit -m "initial commit" -[master (root-commit) b54406b] initial commit -1 file changed, 15 insertions(+) -create mode 100644 bashrc -[link@localhost .dotfiles]$ git push -u origin master -... -[link@localhost .dotfiles]$ -``` - -On the second machine, clone this repository into ~/.dotfiles. - -``` -[link@remotehost ~]$ git clone git@github.com:linkdupont/dotfiles.git ~/.dotfiles -... -[link@remotehost ~]$ -``` - -Now update the symlinks managed by **rcm** with rcup. - -``` -[link@remotehost ~]$ rcup -v -replacing identical but unlinked /home/link/.bashrc -removed '/home/link/.bashrc' -'/home/link/.dotfiles/bashrc' -> '/home/link/.bashrc' -[link@remotehost ~]$ -``` - -Overwrite the existing ~/.bashrc (if it exists) and restart the shell. - -That’s it! The host-specific option (-o) is a useful addition to the scenario above. And as always, be sure to read the manpages; they contain a wealth of example commands. - - --------------------------------------------------------------------------------- - -via: https://fedoramagazine.org/managing-dotfiles-rcm/ - -作者:[Link Dupont][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://fedoramagazine.org/author/linkdupont/ -[b]: https://github.com/lujun9972 -[1]: https://en.wikipedia.org/wiki/INI_file diff --git a/translated/tech/20190104 Managing dotfiles with rcm.md b/translated/tech/20190104 Managing dotfiles with rcm.md new file mode 100644 index 0000000000..fa4ea324d2 --- /dev/null +++ b/translated/tech/20190104 Managing dotfiles with rcm.md @@ -0,0 +1,116 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Managing dotfiles with rcm) +[#]: via: (https://fedoramagazine.org/managing-dotfiles-rcm/) +[#]: author: (Link Dupont https://fedoramagazine.org/author/linkdupont/) + +用 rcm 管理隐藏文件 +====== + +![](https://fedoramagazine.org/wp-content/uploads/2018/12/dotfiles-816x345.jpg) + +许多 GNU/Linux 程序的一个特点是易于编辑的配置文件。几乎所有常见的自由软件都将配置设置保存在纯文本文件中,通常采用结构化格式,如 JSON、YAML或[“类 ini”][1]。这些配置文件经常隐藏在用户的主目录中。但是,基本的 ls 不会显示它们。UNIX 标准要求以点开头的任何文件或目录名称都被视为“隐藏”,除非用户请求,否则不会列在目录列表中。例如,要使用 ls 列出所有文件,要传递 -a 选项。 + +随着时间的推移,这些配置文件变得高度自定义,管理它们变得越来越具有挑战性。不仅如此,在多台计算机之间保持同步是大型组织的共同挑战。最后,许多用户对其独特的配置感到自豪,并希望以简单的方式与朋友分享。这就是用到 **rcm** 介入的地方。 + +**rcm** 是一个 “rc” 文件管理套件(“rc” 是命名配置文件的另一种约定,它已被某些 GNU/Linux 程序采用,如 screen 或 bash)。 **rcm** 提供了一套命令来管理和列出它跟踪的文件。使用 **dnf** 安装 **rcm**。 + +### 开始使用 + +默认情况下,**rcm** 使用 ~/.dotfiles 保存它管理的所有隐藏文件。托管的隐藏文件实际保存在 ~/.dotfiles 中,并保存符号链接在文件原本的位置。例如,如果 ~/.bashrc 由 **rcm** 跟踪,那么详细列表将如下所示。 + +``` +[link@localhost ~]$ ls -l ~/.bashrc +lrwxrwxrwx. 1 link link 27 Dec 16 05:19 .bashrc -> /home/link/.dotfiles/bashrc +[link@localhost ~]$ +``` + +**rcm** 包含 4 个命令: + + * mkrc – 将文件转换为由 rcm 管理的隐藏文件 + * lsrc – 列出由 rcm 管理的文件 + * rcup – 同步由 rcm 管理的隐藏文件 + * rcdn – 删除 rcm 管理的所有符号链接 + + + +### 在两台计算机上共享 bashrc + +如今用户在多台计算机上拥有 shell 帐户并不罕见。在这些计算机之间同步隐藏文件可能是一个挑战。这里将提供一种可能的解决方案,仅使用 **rcm** 和 **git**。 + +首先使用 mkrc 将文件转换成由 **rcm** 管理的文件。 + +``` +[link@localhost ~]$ mkrc -v ~/.bashrc +Moving... +'/home/link/.bashrc' -> '/home/link/.dotfiles/bashrc' +Linking... +'/home/link/.dotfiles/bashrc' -> '/home/link/.bashrc' +[link@localhost ~]$ +``` + +接下来使用 lsrc 验证列表。 + +``` +[link@localhost ~]$ lsrc +/home/link/.bashrc:/home/link/.dotfiles/bashrc +[link@localhost ~]$ +``` + +现在在 ~/.dotfiles 中创建一个 git 仓库,并使用你选择的 git 仓库托管设置一个远程仓库。提交 bashrc 文件并推送一个新分支。 + +``` +[link@localhost ~]$ cd ~/.dotfiles +[link@localhost .dotfiles]$ git init +Initialized empty Git repository in /home/link/.dotfiles/.git/ +[link@localhost .dotfiles]$ git remote add origin git@github.com:linkdupont/dotfiles.git +[link@localhost .dotfiles]$ git add bashrc +[link@localhost .dotfiles]$ git commit -m "initial commit" +[master (root-commit) b54406b] initial commit +1 file changed, 15 insertions(+) +create mode 100644 bashrc +[link@localhost .dotfiles]$ git push -u origin master +... +[link@localhost .dotfiles]$ +``` + +在第二台机器上,克隆这个仓库到 ~/.dotfiles 中。 + +``` +[link@remotehost ~]$ git clone git@github.com:linkdupont/dotfiles.git ~/.dotfiles +... +[link@remotehost ~]$ +``` + +现在使用 rcup 更新受 **rcm** 管理的符号链接。 + +``` +[link@remotehost ~]$ rcup -v +replacing identical but unlinked /home/link/.bashrc +removed '/home/link/.bashrc' +'/home/link/.dotfiles/bashrc' -> '/home/link/.bashrc' +[link@remotehost ~]$ +``` + +覆盖现有的 ~/.bashrc(如果存在)并重启 shell。 + +就是这些了!指定主机选项 (-o) 是对上面这种情况的有用补充。如往常一样,请阅读手册页。它们包含了很多示例命令。 + + +-------------------------------------------------------------------------------- + +via: https://fedoramagazine.org/managing-dotfiles-rcm/ + +作者:[Link Dupont][a] +选题:[lujun9972][b] +译者:[geekpi](https://github.com/geekpi) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://fedoramagazine.org/author/linkdupont/ +[b]: https://github.com/lujun9972 +[1]: https://en.wikipedia.org/wiki/INI_file From a478f1f8f9eac68e727a949a9ee4ad1dff21d9e9 Mon Sep 17 00:00:00 2001 From: geekpi Date: Tue, 22 Jan 2019 08:58:30 +0800 Subject: [PATCH 068/243] translating --- sources/tech/20190109 Bash 5.0 Released with New Features.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20190109 Bash 5.0 Released with New Features.md b/sources/tech/20190109 Bash 5.0 Released with New Features.md index 46d9aeae59..17b0c5758a 100644 --- a/sources/tech/20190109 Bash 5.0 Released with New Features.md +++ b/sources/tech/20190109 Bash 5.0 Released with New Features.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (geekpi) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From edea7b23d6d4ed838c8be4b2864cc46a02e15d49 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Tue, 22 Jan 2019 10:46:39 +0800 Subject: [PATCH 069/243] PRF:20190104 Managing dotfiles with rcm.md @geekpi --- .../20190104 Managing dotfiles with rcm.md | 41 +++++++++---------- 1 file changed, 19 insertions(+), 22 deletions(-) diff --git a/translated/tech/20190104 Managing dotfiles with rcm.md b/translated/tech/20190104 Managing dotfiles with rcm.md index fa4ea324d2..b01e0ced33 100644 --- a/translated/tech/20190104 Managing dotfiles with rcm.md +++ b/translated/tech/20190104 Managing dotfiles with rcm.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Managing dotfiles with rcm) @@ -12,15 +12,15 @@ ![](https://fedoramagazine.org/wp-content/uploads/2018/12/dotfiles-816x345.jpg) -许多 GNU/Linux 程序的一个特点是易于编辑的配置文件。几乎所有常见的自由软件都将配置设置保存在纯文本文件中,通常采用结构化格式,如 JSON、YAML或[“类 ini”][1]。这些配置文件经常隐藏在用户的主目录中。但是,基本的 ls 不会显示它们。UNIX 标准要求以点开头的任何文件或目录名称都被视为“隐藏”,除非用户请求,否则不会列在目录列表中。例如,要使用 ls 列出所有文件,要传递 -a 选项。 +许多 GNU/Linux 程序的一个特点是有个易于编辑的配置文件。几乎所有常见的自由软件都将配置设置保存在纯文本文件中,通常采用结构化格式,如 JSON、YAML 或[“类似 ini”][1] 的文件中。这些配置文件经常隐藏在用户的主目录中。但是,基本的 `ls` 不会显示它们。UNIX 标准要求以点开头的任何文件或目录名称都被视为“隐藏”,除非用户特意要求,否则不会列在目录列表中。例如,要使用 `ls` 列出所有文件,要传递 `-a` 选项。 -随着时间的推移,这些配置文件变得高度自定义,管理它们变得越来越具有挑战性。不仅如此,在多台计算机之间保持同步是大型组织的共同挑战。最后,许多用户对其独特的配置感到自豪,并希望以简单的方式与朋友分享。这就是用到 **rcm** 介入的地方。 +随着时间的推移,这些配置文件会有很多定制配置,管理它们变得越来越具有挑战性。不仅如此,在多台计算机之间保持同步是大型组织所面临的共同挑战。最后,许多用户也对其独特的配置感到自豪,并希望以简单的方式与朋友分享。这就是用到 rcm 介入的地方。 -**rcm** 是一个 “rc” 文件管理套件(“rc” 是命名配置文件的另一种约定,它已被某些 GNU/Linux 程序采用,如 screen 或 bash)。 **rcm** 提供了一套命令来管理和列出它跟踪的文件。使用 **dnf** 安装 **rcm**。 +rcm 是一个 “rc” 文件管理套件(“rc” 是命名配置文件的另一种约定,它已被某些 GNU/Linux 程序采用,如 `screen` 或 `bash`)。 rcm 提供了一套命令来管理和列出它跟踪的文件。使用 `dnf` 安装 rcm。 ### 开始使用 -默认情况下,**rcm** 使用 ~/.dotfiles 保存它管理的所有隐藏文件。托管的隐藏文件实际保存在 ~/.dotfiles 中,并保存符号链接在文件原本的位置。例如,如果 ~/.bashrc 由 **rcm** 跟踪,那么详细列表将如下所示。 +默认情况下,rcm 使用 `~/.dotfiles` 来存储它管理的所有隐藏文件。一个被管理的隐藏文件实际保存在 `~/.dotfiles` 目录中,而它的符号链接会放在文件原本的位置。例如,如果 `~/.bashrc` 由 rcm 所管理,那么详细列表将如下所示。 ``` [link@localhost ~]$ ls -l ~/.bashrc @@ -28,20 +28,18 @@ lrwxrwxrwx. 1 link link 27 Dec 16 05:19 .bashrc -> /home/link/.dotfiles/bashrc [link@localhost ~]$ ``` -**rcm** 包含 4 个命令: - - * mkrc – 将文件转换为由 rcm 管理的隐藏文件 - * lsrc – 列出由 rcm 管理的文件 - * rcup – 同步由 rcm 管理的隐藏文件 - * rcdn – 删除 rcm 管理的所有符号链接 - +rcm 包含 4 个命令: + * `mkrc` – 将文件转换为由 rcm 管理的隐藏文件 + * `lsrc` – 列出由 rcm 管理的文件 + * `rcup` – 同步由 rcm 管理的隐藏文件 + * `rcdn` – 删除 rcm 管理的所有符号链接 ### 在两台计算机上共享 bashrc -如今用户在多台计算机上拥有 shell 帐户并不罕见。在这些计算机之间同步隐藏文件可能是一个挑战。这里将提供一种可能的解决方案,仅使用 **rcm** 和 **git**。 +如今用户在多台计算机上拥有 shell 帐户并不罕见。在这些计算机之间同步隐藏文件可能是一个挑战。这里将提供一种可能的解决方案,仅使用 rcm 和 git。 -首先使用 mkrc 将文件转换成由 **rcm** 管理的文件。 +首先使用 `mkrc` 将文件转换成由 rcm 管理的文件。 ``` [link@localhost ~]$ mkrc -v ~/.bashrc @@ -52,7 +50,7 @@ Linking... [link@localhost ~]$ ``` -接下来使用 lsrc 验证列表。 +接下来使用 `lsrc` 验证列表是否正确。 ``` [link@localhost ~]$ lsrc @@ -60,7 +58,7 @@ Linking... [link@localhost ~]$ ``` -现在在 ~/.dotfiles 中创建一个 git 仓库,并使用你选择的 git 仓库托管设置一个远程仓库。提交 bashrc 文件并推送一个新分支。 +现在在 `~/.dotfiles` 中创建一个 git 仓库,并使用你选择的 git 仓库托管设置一个远程仓库。提交 `bashrc` 文件并推送一个新分支。 ``` [link@localhost ~]$ cd ~/.dotfiles @@ -77,7 +75,7 @@ create mode 100644 bashrc [link@localhost .dotfiles]$ ``` -在第二台机器上,克隆这个仓库到 ~/.dotfiles 中。 +在第二台机器上,克隆这个仓库到 `~/.dotfiles` 中。 ``` [link@remotehost ~]$ git clone git@github.com:linkdupont/dotfiles.git ~/.dotfiles @@ -85,7 +83,7 @@ create mode 100644 bashrc [link@remotehost ~]$ ``` -现在使用 rcup 更新受 **rcm** 管理的符号链接。 +现在使用 `rcup` 更新受 rcm 管理的符号链接。 ``` [link@remotehost ~]$ rcup -v @@ -95,10 +93,9 @@ removed '/home/link/.bashrc' [link@remotehost ~]$ ``` -覆盖现有的 ~/.bashrc(如果存在)并重启 shell。 - -就是这些了!指定主机选项 (-o) 是对上面这种情况的有用补充。如往常一样,请阅读手册页。它们包含了很多示例命令。 +覆盖现有的 `~/.bashrc`(如果存在)并重启 shell。 +就是这些了!指定主机选项 (`-o`) 是对上面这种情况的有用补充。如往常一样,请阅读手册页。它们包含了很多示例命令。 -------------------------------------------------------------------------------- @@ -107,7 +104,7 @@ via: https://fedoramagazine.org/managing-dotfiles-rcm/ 作者:[Link Dupont][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/) 荣誉推出 From 21525b59c8444f934fe532d59c73c69f988bb3e8 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Tue, 22 Jan 2019 10:47:22 +0800 Subject: [PATCH 070/243] PUB:20190104 Managing dotfiles with rcm.md @geekpi https://linux.cn/article-10466-1.html --- .../tech => published}/20190104 Managing dotfiles with rcm.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20190104 Managing dotfiles with rcm.md (98%) diff --git a/translated/tech/20190104 Managing dotfiles with rcm.md b/published/20190104 Managing dotfiles with rcm.md similarity index 98% rename from translated/tech/20190104 Managing dotfiles with rcm.md rename to published/20190104 Managing dotfiles with rcm.md index b01e0ced33..ae1169f84e 100644 --- a/translated/tech/20190104 Managing dotfiles with rcm.md +++ b/published/20190104 Managing dotfiles with rcm.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-10466-1.html) [#]: subject: (Managing dotfiles with rcm) [#]: via: (https://fedoramagazine.org/managing-dotfiles-rcm/) [#]: author: (Link Dupont https://fedoramagazine.org/author/linkdupont/) From 10f164d39f694de6f86c37bc8a242f889be51a7e Mon Sep 17 00:00:00 2001 From: lxy <524187166@qq.com> Date: Tue, 22 Jan 2019 14:12:46 +0800 Subject: [PATCH 071/243] 20180319 --- ...t agile development practices for teams.md | 60 ------------------- ...t agile development practices for teams.md | 59 ++++++++++++++++++ 2 files changed, 59 insertions(+), 60 deletions(-) delete mode 100644 sources/talk/20180319 6 common questions about agile development practices for teams.md create mode 100644 translated/talk/20180319 6 common questions about agile development practices for teams.md diff --git a/sources/talk/20180319 6 common questions about agile development practices for teams.md b/sources/talk/20180319 6 common questions about agile development practices for teams.md deleted file mode 100644 index ef472374b4..0000000000 --- a/sources/talk/20180319 6 common questions about agile development practices for teams.md +++ /dev/null @@ -1,60 +0,0 @@ -translated by lixinyuxx -6 common questions about agile development practices for teams -====== - -![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/collab-team-pair-programming-code-keyboard.png?itok=kBeRTFL1) -"Any questions?" - -You’ve probably heard a speaker ask this question at the end of their presentation. This is the most important part of the presentation—after all, you didn't attend just to hear a lecture but to participate in a conversation and a community. - -Recently I had the opportunity to hear my fellow Red Hatters present a session called "[Agile in Practice][1]" to a group of technical students at a local university. During the session, software engineer Tomas Tomecek and agile practitioners Fernando Colleone and Pavel Najman collaborated to explain the foundations of agile methodology and showcase best practices for day-to-day activities. - -### 1\. What is the perfect team size? - -Knowing that students attended this session to learn what agile practice is and how to apply it to projects, I wondered how the students' questions would compare to those I hear every day as an agile practitioner at Red Hat. It turns out that the students asked the same questions as my colleagues. These questions drive straight into the core of agile in practice. - -Students wanted to know the size of a small team versus a large team. This issue is relevant to anyone who has ever teamed up to work on a project. Based on Tomas's experience as a tech leader, 12 people working on a project would be considered a large team. In the real world, team size is not often directly correlated to productivity. In some cases, a smaller team located in a single location or time zone might be more productive than a larger team that's spread around the world. Ultimately, the presenters suggested that the ideal team size is probably five people (which aligns with scrum 7, +-2). - -### 2\. What operational challenges do teams face? - -The presenters compared projects supported by local teams (teams with all members in one office or within close proximity to each other) with distributed teams (teams located in different time zones). Engineers prefer local teams when the project requires close cooperation among team members because delays caused by time differences can destroy the "flow" of writing software. At the same time, distributed teams can bring together skill sets that may not be available locally and are great for certain development use cases. Also, there are various best practices to improve cooperation in distributed teams. - -### 3\. How much time is needed to groom the backlog? - -Because this was an introductory talk targeting students who were new to agile, the speakers focused on [Scrum][2] and [Kanban][3] as ways to make agile specific for them. They used the Scrum framework to illustrate a method of writing software and Kanban for a communication and work planning system. On the question of time needed to groom a project's backlog, the speakers explained that there is no fixed rule. Rather, practice makes perfect: During the early stages of development, when a project is new—and especially if some members of the team are new to agile—grooming can consume several hours per week. Over time and with practice, it becomes more efficient. - -### 4\. Is a product owner necessary? What is their role? - -Product owners help facilitate scaling; however, what matters is not the job title, but that you have someone on your team who represents the customer's voice and goals. In many teams, especially those that are part of a larger group of engineering teams working on a single output, a lead engineer can serve as the product owner. - -### 5\. What agile tools do you suggest using? Is specific software necessary to implement Scrum or Kanban in practice? - -Although using proprietary software such as Jira or Trello can be helpful, especially when working with large numbers of contributors working on big enterprise projects, they are not required. Scrum and Kanban can be done with tools as simple as paper cards. The key is to have a clear source of information and strong communication across the entire team. That said, two excellent open source kanban tools are [Taiga][4] and [Wekan][5]. For more information, see [5 open source alternatives to Trello][6] and [Top 7 open source project management tools for agile teams][7]. - -### 6\. How can students use agile techniques for school projects? - -The presenters encouraged students to use kanban to visualize and outline tasks to be completed before the end of the project. The key is to create a common board so the entire team can see the status of the project. By using kanban or a similar high-visibility strategy, students won’t get to the end of the project and discover that any particular team member has not been keeping up. - -Scrum practices such as sprints and daily standups are also excellent ways to ensure that everyone is making progress and that the various parts of the project will work together at the end. Regular check-ins and information-sharing are also essential. To learn more about Scrum, see [What is scrum?][8]. - -Remember that Kanban and Scrum are just two of many tools and frameworks that make up agile. They may not be the best approach for every situation. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/18/3/agile-mindset - -作者:[Dominika Bula][a] -译者:[译者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/dominika -[1]:http://zijemeit.cz/sessions/agile-in-practice/ -[2]:https://www.scrum.org/resources/what-is-scrum -[3]:https://en.wikipedia.org/wiki/Kanban -[4]:https://taiga.io/ -[5]:https://wekan.github.io/ -[6]:https://opensource.com/alternatives/trello -[7]:https://opensource.com/article/18/2/agile-project-management-tools -[8]:https://opensource.com/resources/scrum diff --git a/translated/talk/20180319 6 common questions about agile development practices for teams.md b/translated/talk/20180319 6 common questions about agile development practices for teams.md new file mode 100644 index 0000000000..288e5c7753 --- /dev/null +++ b/translated/talk/20180319 6 common questions about agile development practices for teams.md @@ -0,0 +1,59 @@ +关于团队敏捷开发实践的6个常见问题 +====== + +![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/collab-team-pair-programming-code-keyboard.png?itok=kBeRTFL1) +”有问题么?“ + +你可能听过演讲者在演讲结束的时候提出这个问题。这是演讲中最重要的部分--毕竟,你不仅仅是听讲座, 而是参加讨论和社群交流。 + +最近,我有机会听到我的同伴 Red Hatters 给当地一所大学的一群技术型学生做一个名为 “[Agile in Practice][1]” 的讲座。讲座中有软件工程师 Tomas Tomecek 和敏捷开发的从业者 Fernando Colleone 与 Pavel Najman 合作解释敏捷开发方法的基础,并展示最佳实践在日常活动中的应用。 + +### 1.完美的团队规模是多大? + +知道了学生们参加这个课程是为了了解什么是敏捷实践以及如何将其应用于项目,我想知道学生们的问题会与我作为敏捷从业者在 Red Hat 每天听到的问题相比有什么不同。结果学生的疑问和我的同事们如出一辙。这些问题都直指敏捷实践的核心。 + +学生们想知道一个小团队和一个大团队的规模是多少。这个问题与任何曾经合作过做项目的人都是相关的。根据 Tomas 作为技术领导的经验 12 个人从事的项目被认为是一个大型团队。现实中,团队规模通常与生产力没有关系。在有些时候,一个小地区或同一个时区的小团队也许会比一个成员分布在满世界的大团队更具有生产力。最终,讲座建议理想的团队大小大概是5个人(正如 scrum 开发方法的7,+-2)。 + +### 2\. 团队会面临哪些实际挑战? + +演讲者比较了由本地团队组成的项目(团队成员都是一个办公室,或者相邻近的人)与分散型的团队(位于不同时区)。 当项目需要团队成员之间密切合作时,工程师更喜欢本地的团队,因为时间差异造成的延迟可能会破坏软件开发的“流”。同时,分散型团队可以将可能不适用与当地项目但适用于某些开发用例的技能集合在一起。此外,还有各种最佳方法可用于改进分散型团队中的合作方式。 + +### 3\. 整理堆积的工作需要多少时间? + +因为这是一个对于新学习学生的介绍性质的演讲,演讲者关注于用 [Scrum][2] 和 [Kanban][3] 作为介绍敏捷开发的方法。他们使用 Scrum 来作为说明软件编写的方法并且用 Kanban 作为工作规划和沟通的系统。关于需要多少时间来整理项目堆积的工作,演讲者解释说并没有固定的准则,相对的,实践出真知:在开发的早期阶段,当一个崭新的项目—特别如果团队里有新人—每周可能会花费数个小时在整理工作上。随着时间推移和不断地练习,会越来越高效。 + +### 4\. 产品负责人是否是必要的? 他们扮演什么样的角色? + +负责人会帮助团队更方便的拓展,然而,职位并不重要,重要的是你的团队中有人能够传递用户的意愿。在许多团队中,特别是在大型 团队中从事单个任务的团队,首席工程师就可以担任负责人。 + +### 5\.建议使用哪些敏捷开发的工具?使用 Scrum 或 Kanban 做敏捷开发的时候必须用特定的软件么? + +尽管使用一些专业软件例如 Jira 或 Trello 会很有帮助,特别是在与大量从事大型企业项目的工作者合作时,但它们不是必需的。Scrum 和 Kanban 可以使用像纸卡这样简单的工具完成。关键是在团队中要有一个清晰的信息来源和紧密的交流。也就是说,优秀的两个 kanban 开源工具 [Taiga][4] 和 [Wekan][5] 。更多信息请查看 [5 open source alternatives to Trello][6] 和 [Top 7 open source project management tools for agile teams][7] 。 + +### 6\. 学生如何在学校项目中使用敏捷开发技术? + +演讲者鼓励学生使用 kanban 在项目结束前使用可视化和大纲来完成。关键是要创建一个公共板块,这样整个团队就可以看到项目的状态。通过使用 kanban 或者类似的高可视化策略,学生不会在项目后期才发现个别成员没有跟上进度。 + +Scrum 实践比如 sprints 和 daily standups 也是确认每个人都在进步的绝佳方法项目的各个部分最终会一起发挥作用。定期检查和信息共享也至关重要。更多关于 Scrum 的信息,访问 [What is scrum?][8] 。 + +牢记 Kanban 和 Scrum 只是敏捷开发中众多框架和工具中的两个。它们可能不是应对每一种情况的最佳方法。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/18/3/agile-mindset + +作者:[Dominika Bula][a] +译者:[lixinyuxx](https://github.com/lixinxyuxx) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:https://opensource.com/users/dominika +[1]:http://zijemeit.cz/sessions/agile-in-practice/ +[2]:https://www.scrum.org/resources/what-is-scrum +[3]:https://en.wikipedia.org/wiki/Kanban +[4]:https://taiga.io/ +[5]:https://wekan.github.io/ +[6]:https://opensource.com/alternatives/trello +[7]:https://opensource.com/article/18/2/agile-project-management-tools +[8]:https://opensource.com/resources/scrum From 026072ab642fb654b416b9ead7305611a211d1d0 Mon Sep 17 00:00:00 2001 From: MjSeven Date: Tue, 22 Jan 2019 21:58:00 +0800 Subject: [PATCH 072/243] =?UTF-8?q?20190107=20Get=20started=20with=20Pelic?= =?UTF-8?q?an...=20=E7=BF=BB=E8=AF=91=E5=AE=8C=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...n- A Python-based static site generator.md | 223 ------------------ ...n- A Python-based static site generator.md | 221 +++++++++++++++++ 2 files changed, 221 insertions(+), 223 deletions(-) delete mode 100644 sources/tech/20190107 Getting started with Pelican- A Python-based static site generator.md create mode 100644 translated/tech/20190107 Getting started with Pelican- A Python-based static site generator.md diff --git a/sources/tech/20190107 Getting started with Pelican- A Python-based static site generator.md b/sources/tech/20190107 Getting started with Pelican- A Python-based static site generator.md deleted file mode 100644 index ed5c7f0dc0..0000000000 --- a/sources/tech/20190107 Getting started with Pelican- A Python-based static site generator.md +++ /dev/null @@ -1,223 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (MjSeven) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Getting started with Pelican: A Python-based static site generator) -[#]: via: (https://opensource.com/article/19/1/getting-started-pelican) -[#]: author: (Craig Sebenik https://opensource.com/users/craig5) - -Getting started with Pelican: A Python-based static site generator -====== -Pelican is a great choice for Python users who want to self-host a simple website or blog. - -![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/web-design-monitor-website.png?itok=yUK7_qR0) - -If you want to create a custom website or blog, you have a lot of options. Many providers will host your website and do much of the work for you. (WordPress is an extremely popular option.) But you lose some flexibility by using a hosted solution. As a software developer, I prefer to manage my own server and keep more freedom in how my website operates. - -However, it is a fair amount of work to manage a web server. Installing it and getting a simple application up to serve content is easy enough. But keeping on top of security patches and updates is very time-consuming. If you just want to serve static web pages, having a web server and a host of applications may be more effort than it's worth. Creating HTML pages by hand is also not a good option. - -This is where a static site generator can come in. These applications use templates to create all the static pages you want and cross-link them with associated metadata. (e.g., showing all the pages with a common tag or keyword.) Static site generators help you create a site with a common look and feel using elements like navigation areas and a header and footer. - -I have been using [Python][1] for years now. So, when I first started looking for something to generate static HTML pages, I wanted something written in Python. The main reason is that I often want to peek into the internals of how an application works, and using a language that I already know makes that easier. (If that isn't important to you or you don't use Python, there are some other great [static site generators][2] that use Ruby, JavaScript, and other languages.) - -I decided to give [Pelican][3] a try. It is a commonly used static site generator written in Python. It directly supports [reStructuredText][4] and can support [Markdown][5] when the required package is installed. All the tasks are performed via command-line interface (CLI) tools, which makes it simple for anyone familiar with the command line. And its simple quickstart CLI tool makes creating a website extremely easy. - -In this article, I'll explain how to install Pelican 4, add an article, and change the default theme. (Note: This was all developed on MacOS; it should work the same using any flavor of Unix/Linux, but I don't have a Windows host to test on.) - -### Installation and configuration - -The first step is to create a [virtualenv][6] and install Pelican. - -``` -$ mkdir test-site -$ cd test-site -$ python3 -m venv venv -$ ./venv/bin/pip install --upgrade pip -... -Successfully installed pip-18.1 -$ ./venv/bin/pip install pelican -Collecting pelican -... -Successfully installed MarkupSafe-1.1.0 blinker-1.4 docutils-0.14 feedgenerator-1.9 jinja2-2.10 pelican-4.0.1 pygments-2.3.1 python-dateutil-2.7.5 pytz-2018.7 six-1.12.0 unidecode-1.0.23 -``` - -To keep things simple, I entered values for the title and author and replied N to URL prefix and article pagination. (For the rest of the questions, I used the default given.) - -Pelican's quickstart CLI tool will create the basic layout and a few files to get you started. Run the **pelican-quickstart** command. To keep things simple, I entered values for the **title** and **author** and replied **N** to URL prefix and article pagination. It is very easy to change these settings in the configuration file later. - -``` -$ ./venv/bin/pelicanquickstart -Welcome to pelicanquickstart v4.0.1. - -This script will help you create a new Pelican-based website. - -Please answer the following questions so this script can generate the files needed by Pelican. - -> Where do you want to create your new web site? [.] -> What will be the title of this web site? My Test Blog -> Who will be the author of this web site? Craig -> What will be the default language of this web site? [en] -> Do you want to specify a URL prefix? e.g., https://example.com (Y/n) n -> Do you want to enable article pagination? (Y/n) n -> What is your time zone? [Europe/Paris] -> Do you want to generate a tasks.py/Makefile to automate generation and publishing? (Y/n) -> Do you want to upload your website using FTP? (y/N) -> Do you want to upload your website using SSH? (y/N) -> Do you want to upload your website using Dropbox? (y/N) -> Do you want to upload your website using S3? (y/N) -> Do you want to upload your website using Rackspace Cloud Files? (y/N) -> Do you want to upload your website using GitHub Pages? (y/N) -Done. Your new project is available at /Users/craig/tmp/pelican/test-site -``` - -All the files you need to get started are ready to go. - -The quickstart defaults to the Europe/Paris time zone, so change that before proceeding. Open the **pelicanconf.py** file in your favorite text editor. Look for the **TIMEZONE** variable. - -``` -TIMEZONE = 'Europe/Paris' -``` - -Change it to **UTC**. - -``` -TIMEZONE = 'UTC' -``` - -To update the social settings, look for the **SOCIAL** variable in **pelicanconf.py**. - -``` -SOCIAL = (('You can add links in your config file', '#'), -          ('Another social link', '#'),) -``` - -I'll add a link to my Twitter account. - -``` -SOCIAL = (('Twitter (#craigs55)', 'https://twitter.com/craigs55'),) -``` - -Notice that trailing comma—it's important. That comma helps Python recognize the variable is actually a set. Make sure you don't delete that comma. - -Now you have the basics of a site. The quickstart created a Makefile with a number of targets. Giving the **devserver** target to **make** will start a development server on your machine so you can preview everything. The CLI commands used in the Makefile are assumed to be part of your **PATH** , so you need to **activate** the **virtualenv** first. - -``` -$ source ./venv/bin/activate -$ make devserver -pelican -lr /Users/craig/tmp/pelican/test-site/content o -/Users/craig/tmp/pelican/test-site/output -s /Users/craig/tmp/pelican/test-site/pelicanconf.py - --> Modified: theme, settings. regenerating... -WARNING: No valid files found in content for the active readers: -   | BaseReader (static) -   | HTMLReader (htm, html) -   | RstReader (rst) -Done: Processed 0 articles, 0 drafts, 0 pages, 0 hidden pages and 0 draft pages in 0.18 seconds. -``` - -Point your favorite browser to to see your simple test blog. - -![](https://opensource.com/sites/default/files/uploads/pelican_test-site1.png) - -You can see the Twitter link on the right side and some links to Pelican, Python, and Jinja to the left of it. (Jinja is a great templating language that Pelican can use. You can learn more about it in [Jinja's documentation][7].) - -### Adding content - -Now that you have a basic site, add some content. First, add a file called **welcome.rst** to the site's **content** directory. In your favorite text editor, create a file with the following text: - -``` -$ pwd -/Users/craig/tmp/pelican/test-site -$ cat content/welcome.rst - -Welcome to my blog! -################### - -:date: 20181216 08:30 -:tags: welcome -:category: Intro -:slug: welcome -:author: Craig -:summary: Welcome document - -Welcome to my blog. -This is a short page just to show how to put up a static page. -``` - -The metadata lines—date, tags, etc.—are automatically parsed by Pelican. - -After you write the file, the **devserver** should output something like this: - -``` --> Modified: content. regenerating... -Done: Processed 1 article, 0 drafts, 0 pages, 0 hidden pages and 0 draft pages in 0.10 seconds. -``` - -Reload your test site in your browser to view the changes. - -![](https://opensource.com/sites/default/files/uploads/pelican_test-site2.png) - -The metadata (e.g., date and tags) were automatically added to the page. Also, Pelican automatically detected the **intro** category and added the section to the top navigation. - -### Change the theme - -One of the nicest parts of working with popular, open source software like Pelican is that many users will make changes and contribute them back to the project. Many of the contributions are in the form of themes. - -A site's theme sets colors, layout options, etc. It's really easy to try out new themes. You can preview many of them at [Pelican Themes][8]. - -First, clone the GitHub repo: - -``` -$ cd .. -$ git clone --recursive https://github.com/getpelican/pelicanthemes -Cloning into 'pelicanthemes'... -``` - -Since I like the color blue, I'll try [blueidea][9]. - -Edit **pelicanconf.py** and add the following line: - -``` -THEME = '/Users/craig/tmp/pelican/pelican-themes/blueidea/' -``` - -The **devserver** will regenerate your output. Reload the webpage in your browser to see the new theme. - -![](https://opensource.com/sites/default/files/uploads/pelican_test-site3.png) - -The theme controls many aspects of the layout. For example, in the default theme, you can see the category (Intro) with the meta tags next to the article. But that category is not displayed in the blueidea theme. - -### Other considerations - -This was a pretty quick introduction to Pelican. There are a couple of important topics that I did not cover. - -First, one reason I was hesitant to move to a static site was that it wouldn't allow discussions on the articles. Fortunately, there are some third-party providers that will host discussions for you. The one I am currently looking at is [Disqus][10]. - -Next, everything above was done on my local machine. If I want others to view my site, I'll have to upload the pre-generated HTML files somewhere. If you look at the **pelican-quickstart** output, you will see options for using FTP, SSH, S3, and even GitHub Pages. Each option has its pros and cons. But, if I had to choose one, I would likely publish to GitHub Pages. - -Pelican has many other features—I am still learning more about it every day. If you want to self-host a website or a blog with simple, static content and you want to use Python, Pelican is a great choice. It has an active user community that is fixing bugs, adding features, and creating new and interesting themes. Give it a try! - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/19/1/getting-started-pelican - -作者:[Craig Sebenik][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/craig5 -[b]: https://github.com/lujun9972 -[1]: https://opensource.com/resources/python -[2]: https://opensource.com/sitewide-search?search_api_views_fulltext=static%20site%20generator -[3]: http://docs.getpelican.com/en/stable/ -[4]: http://docutils.sourceforge.net/rst.html -[5]: https://daringfireball.net/projects/markdown/ -[6]: https://virtualenv.pypa.io/en/latest/ -[7]: http://jinja.pocoo.org/docs/2.10/ -[8]: http://www.pelicanthemes.com/ -[9]: https://github.com/nasskach/pelican-blueidea/tree/58fb13112a2707baa7d65075517c40439ab95c0a -[10]: https://disqus.com/ diff --git a/translated/tech/20190107 Getting started with Pelican- A Python-based static site generator.md b/translated/tech/20190107 Getting started with Pelican- A Python-based static site generator.md new file mode 100644 index 0000000000..bc82a69c54 --- /dev/null +++ b/translated/tech/20190107 Getting started with Pelican- A Python-based static site generator.md @@ -0,0 +1,221 @@ +[#]: collector: (lujun9972) +[#]: translator: (MjSeven) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Getting started with Pelican: A Python-based static site generator) +[#]: via: (https://opensource.com/article/19/1/getting-started-pelican) +[#]: author: (Craig Sebenik https://opensource.com/users/craig5) + +Pelican 简介:一个 Python 静态网站生成器 +====== +Pelican 是那些想要自我托管简单网站或博客的 Python 用户的绝佳选择。 + +![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/web-design-monitor-website.png?itok=yUK7_qR0) + +如果你想创建一个自定义网站或博客,有很多选择。许多提供商将托管你的网站并为你完成大部分工作。(WordPress 是一个非常受欢迎的选项。)但是使用托管方案,你会失去一些灵活性。作为一名软件开发人员,我更喜欢管理我自己的服务器,并在我的网站如何运行方面保持更多的自由。 + +然而,管理 Web 服务器需要大量的工作。安装它并获得一个简单的应用程序来提供内容是非常容易的。但是,维护安全补丁和更新是非常耗时得。如果你只想提供静态网页,那么拥有一个 Web 服务器和一系列应用程序可能会得不偿失。手动创建 HTML 页面也不是一个好选择。 + +这是静态网站生成器的用武之地。这些应用程序使用模板来创建所需的静态页面,并将它们与关联的元数据交叉链接。(例如,所有显示的页面都带有公共标签或关键词。)静态网站生成器可以帮助你使用导航区域,页眉和页脚等元素创建一个具有公共外观的网站。 + +我使用 [Pyhton][1] 已经很多年了,所以,当我第一次开始寻找生成静态 HTML 页面的东西时,我想要用 Python 编写的东西。主要原因是我经常想要了解应用程序如何工作的内部细节,而使用一种我已经了解的语言使这一点更容易。(如果这对你不重要或者你不使用 Python,那么还有一些其他很棒的[静态网站生成器][2],它们使用 Ruby, JavaScript 和其它语言。) + +我决定试试 [Pelican][3]。它是一个用 Python 编写的常用静态网站生成器。它支持 [reStructuredText][4](译注:这是一种用于文本数据的文件格式,主要用于 Python 社区的技术文档),并且支持 [Markdown][5],这需要通过安装必需的包来完成。所有任务都是通过命令行界面(CLI)工具执行的,这使得熟悉命令行的任何人都可以轻松完成。它简单的 quickstart CLI 工具使得创建一个网站非常容易。 + +在本文中,我将介绍如何安装 Pelican 4,添加一篇文章以及更改默认主题。(注意:我是在 MacOS 上开发的,使用其它 Unix/Linux 实验结果都将相同,但我没有 Windows 主机可以测试。) + +### 安装和配置 + +第一步是创建一个[虚拟环境][6],在虚拟环境中安装 Pelican。 + +``` +$ mkdir test-site +$ cd test-site +$ python3 -m venv venv +$ ./venv/bin/pip install --upgrade pip +... +Successfully installed pip-18.1 +$ ./venv/bin/pip install pelican +Collecting pelican +... +Successfully installed MarkupSafe-1.1.0 blinker-1.4 docutils-0.14 feedgenerator-1.9 jinja2-2.10 pelican-4.0.1 pygments-2.3.1 python-dateutil-2.7.5 pytz-2018.7 six-1.12.0 unidecode-1.0.23 +``` + +为了简单起见,我输入了标题和作者的名字,并对 URL 前缀和文章分页选择了 N。(对于其它选项,我使用了默认值。) + +Pelican 的 quickstart CLI 工具将创建基本布局和一些文件来帮助你开始,运行 **pelican-quickstart** 命令。为了简单起见,我输入了**标题**和**作者**的名字,并对 URL 前缀和文章分页选择了 N。稍后在配置文件中更改这些设置非常容易。 + +``` +$ ./venv/bin/pelicanquickstart +Welcome to pelicanquickstart v4.0.1. + +This script will help you create a new Pelican-based website. + +Please answer the following questions so this script can generate the files needed by Pelican. + +> Where do you want to create your new web site? [.] +> What will be the title of this web site? My Test Blog +> Who will be the author of this web site? Craig +> What will be the default language of this web site? [en] +> Do you want to specify a URL prefix? e.g., https://example.com (Y/n) n +> Do you want to enable article pagination? (Y/n) n +> What is your time zone? [Europe/Paris] +> Do you want to generate a tasks.py/Makefile to automate generation and publishing? (Y/n) +> Do you want to upload your website using FTP? (y/N) +> Do you want to upload your website using SSH? (y/N) +> Do you want to upload your website using Dropbox? (y/N) +> Do you want to upload your website using S3? (y/N) +> Do you want to upload your website using Rackspace Cloud Files? (y/N) +> Do you want to upload your website using GitHub Pages? (y/N) +Done. Your new project is available at /Users/craig/tmp/pelican/test-site +``` + +你需要启动的所有文件都准备好了。 + +quickstart 默认为欧洲/巴黎时区,所以在继续之前更改一下。在你喜欢的文本编辑器中打开 **pelicanconf.py** 文件,寻找 **TIMEZONE** 变量。 + +``` +TIMEZONE = 'Europe/Paris' +``` + +将其改为 **UTC**。 +``` +TIMEZONE = 'UTC' +``` + +要更新公共设置,在 **pelicanconf.py** 中查找 **SOCIAL** 变量。 + +``` +SOCIAL = (('You can add links in your config file', '#'), +          ('Another social link', '#'),) +``` + +我将添加一个我的 Twitter 账户链接。 + +``` +SOCIAL = (('Twitter (#craigs55)', 'https://twitter.com/craigs55'),) +``` + +注意后面的逗号,它很重要。这个逗号将帮助 Python 识别变量实际上是一个集合。确保你没有删除这个逗号。 + +现在你已经有了网站的基本知识。quickstart 创建了一个包含许多目标的 Makefile。将 **devserver** 传给 **make** 命令将在你的计算机上启动一个开发服务器,以便你可以预览所有内容。Makefile 中使用的 CLI 命令是 **PATH** 的一部分,因此你需要首先激活 **virtualenv**。 + +``` +$ source ./venv/bin/activate +$ make devserver +pelican -lr /Users/craig/tmp/pelican/test-site/content o +/Users/craig/tmp/pelican/test-site/output -s /Users/craig/tmp/pelican/test-site/pelicanconf.py + +-> Modified: theme, settings. regenerating... +WARNING: No valid files found in content for the active readers: +   | BaseReader (static) +   | HTMLReader (htm, html) +   | RstReader (rst) +Done: Processed 0 articles, 0 drafts, 0 pages, 0 hidden pages and 0 draft pages in 0.18 seconds. +``` + +在你最喜欢的浏览器中打开 来查看你的简单测试博客。 + +![](https://opensource.com/sites/default/files/uploads/pelican_test-site1.png) + +你可以在右侧看到 Twitter 链接,左侧有 Pelican, Python 和 Jinja 的一些链接。(Jinja 是 Pelican 可以使用的一种很棒的模板语言。你可以在 [Jinja 的文档][7]中了解更多相关信息。) + +### 添加内容 + +现在你又了一个基本的网站,试着添加一些内容。首先,将名为 **welcome.rst** 的文件添加到网站的 **content** 目录中。在你喜欢的文本编辑器中,使用以下文本创建一个文件: + +``` +$ pwd +/Users/craig/tmp/pelican/test-site +$ cat content/welcome.rst + +Welcome to my blog! +################### + +:date: 20181216 08:30 +:tags: welcome +:category: Intro +:slug: welcome +:author: Craig +:summary: Welcome document + +Welcome to my blog. +This is a short page just to show how to put up a static page. +``` + +Pelican 会自动解析元数据行,包括日期,标签等。 + +编写完文件后,**devserver** 应该输出以下内容: + +``` +-> Modified: content. regenerating... +Done: Processed 1 article, 0 drafts, 0 pages, 0 hidden pages and 0 draft pages in 0.10 seconds. +``` + +在浏览器中刷新你的测试网站来查看更改。 + +![](https://opensource.com/sites/default/files/uploads/pelican_test-site2.png) + +元数据(例如日期和标签)会自动添加到页面中。此外,Pelican 会自动检测到 **intro** 类别,并将该部分添加到顶部导航中。 + +### 更改主题 + +使用像 Pelican 这样流行的开源软件的好处之一是,非常多的用户将进行更改并将其贡献给项目。许多都是以主题形式贡献的。 + +网站的主题会设置颜色,布局选项等。尝试一个新主题非常容易,你可以在 [Pelican 主题][8]中预览其中的许多内容。 + +首先,克隆 GitHub 仓库: + +``` +$ cd .. +$ git clone --recursive https://github.com/getpelican/pelicanthemes +Cloning into 'pelicanthemes'... +``` + +我喜欢蓝色,那么试试 [blueidea][9]。 + +编辑 **pelicanconf.py** ,添加以下行: +``` +THEME = '/Users/craig/tmp/pelican/pelican-themes/blueidea/' +``` + +**devserver** 将重新生成你的输出。在浏览器中刷新网页来查看新主题。 + +![](https://opensource.com/sites/default/files/uploads/pelican_test-site3.png) + +主题控制布局的方方面面。例如,在默认主题中,你可以看到文章旁边带有元标记的类别(Intro),但这个类别并未显示在 blueidea 主题中。 + +### 其他考虑因素 + +本文是对 Pelican 的快速介绍,所以我并没有涉及一些重要的主题。 + +首先,我对迁移到静态站点犹豫不决的一个原因是它无法对文章评论。幸运的是,有一些第三方服务商将为你提供评论功能。我目前正在关注的是 [Disqus][10]。 + +接下来,上面的所有内容都是在我的本地机器上完成的。如果我希望其他人查看我的网站,我将不得不将预先生成的 HTML 文件上传到某个地方。如果你查看 **pelican-quickstart** 输出,你将看到使用 FTP, SSH, S3 甚至 GitHub 页面的选项,每个选项都有其优点和缺点。但是,如果我必须选择一个,那么我可能会选择发布到 GitHub 页面。 + +Pelican 还有许多其他功能,以至于我每天都在学习它。如果你想自托管一个网站或博客,内容简单并且是静态内容,同时你想使用 Python,那么 Pelican 是一个很好的选择。它有一个活跃的用户社区,可以修复 bug,添加特性,而且还会创建新的和有趣的主题。试试看吧! + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/1/getting-started-pelican + +作者:[Craig Sebenik][a] +选题:[lujun9972][b] +译者:[MjSeven](https://github.com/MjSeven) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/craig5 +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/resources/python +[2]: https://opensource.com/sitewide-search?search_api_views_fulltext=static%20site%20generator +[3]: http://docs.getpelican.com/en/stable/ +[4]: http://docutils.sourceforge.net/rst.html +[5]: https://daringfireball.net/projects/markdown/ +[6]: https://virtualenv.pypa.io/en/latest/ +[7]: http://jinja.pocoo.org/docs/2.10/ +[8]: http://www.pelicanthemes.com/ +[9]: https://github.com/nasskach/pelican-blueidea/tree/58fb13112a2707baa7d65075517c40439ab95c0a +[10]: https://disqus.com/ From 7b3bafc018782e1da84098ccb1918cffca86b4dc Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Tue, 22 Jan 2019 23:44:39 +0800 Subject: [PATCH 073/243] PRF:20190103 s-tui- A Terminal Tool To Monitor CPU Temperature, Frequency, Power And Utilization In Linux.md @geekpi --- ...equency, Power And Utilization In Linux.md | 44 +++++++------------ 1 file changed, 16 insertions(+), 28 deletions(-) diff --git a/translated/tech/20190103 s-tui- A Terminal Tool To Monitor CPU Temperature, Frequency, Power And Utilization In Linux.md b/translated/tech/20190103 s-tui- A Terminal Tool To Monitor CPU Temperature, Frequency, Power And Utilization In Linux.md index 525b264200..a9d94b0011 100644 --- a/translated/tech/20190103 s-tui- A Terminal Tool To Monitor CPU Temperature, Frequency, Power And Utilization In Linux.md +++ b/translated/tech/20190103 s-tui- A Terminal Tool To Monitor CPU Temperature, Frequency, Power And Utilization In Linux.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (s-tui: A Terminal Tool To Monitor CPU Temperature, Frequency, Power And Utilization In Linux) @@ -10,69 +10,57 @@ s-tui:在 Linux 中监控 CPU 温度、频率、功率和使用率的终端工具 ====== -默认情况下,每个 Linux 管理员都会使用 **[lm_sensors 监控 CPU 温度][1]**。 +一般每个 Linux 管理员都会使用 [lm_sensors 监控 CPU 温度][1]。lm_sensors (Linux 监控传感器)是一个自由开源程序,它提供了监控温度、电压和风扇的驱动和工具。 -lm_sensors (Linux 监控传感器)是一个免费开源程序,它提供监控温度、电压和风扇的工具和驱动。 +如果你正在找替代的 CLI 工具,我会建议你尝试 s-tui。 -如果你正在找替代工具,这有一个 CLI 工具。 - -我会建议你尝试 s-tui。 - -它有一个压力终端 UI,可以帮助管理员通过颜色查看 CPU 温度。 +它其实是一个压力测试的终端 UI,可以帮助管理员通过颜色查看 CPU 温度。 ### s-tui 是什么 -s-tui 是一个用于监控计算机的终端 UI。s-tui 可以在终端以图形方式监控 CPU 温度、频率、功率和使用率。 +s-tui 是一个用于监控计算机的终端 UI。s-tui 可以在终端以图形方式监控 CPU 温度、频率、功率和使用率。此外,它还显示由发热量限制引起的性能下降,它需要很少的资源并且不需要 X 服务器。它是用 Python 编写的,需要 root 权限才能使用它。 -此外,它还显示由热量限制引起的性能下降,它需要很少的资源并且不需要 X 服务器。它是用 Python 编写的,需要 root 权限才能使用它。 +s-tui 是一个独立的程序,可以开箱即用,并且不需要配置文件就可以使用其基本功能。 -s-tui 是一个独立的程序,可以开箱即用,并且不需要配置文件来使用其核心功能。 +s-tui 使用 psutil 来探测你的一些硬件信息。如果不支持你的一些硬件,你可能看不到所有信息。 -s-tui 使用 psutil 来探测你的一些硬件信息。如果你的硬件不受支持,你可能看不到所有信息。 - -以root身份运行 s-tui 时,当压测所有核心时,可以访问到 CPU 的最大睿频频率。 - -它在后台使用 Stress 工具,通过对系统施加某些类型的计算压力来检查其组件的温度是否超过其可接受的范围。 - -只要计算机稳定并且其组件的温度不超过其可接受的范围,超频 PC 就没问题。 - -有几个程序可以通过压力测试得到系统的稳定性,从而评估超频水平。 +以 root 身份运行 s-tui 时,当压测所有 CPU 核心时,可以将 CPU 发挥到最大睿频频率。它在后台使用 Stress 压力测试工具,通过对系统施加某些类型的计算压力来检查其组件的温度是否超过其可接受的范围。只要计算机稳定并且其组件的温度不超过其可接受的范围,PC 超频就没问题。有几个程序可以通过压力测试得到系统的稳定性,从而评估超频水平。 ### 如何在 Linux 中安装 s-tui -它是用 Python 写的,pip 是在 Linux 上安装 s-tui 的推荐方法。确保你在系统上安装了 python-pip 软件包。如果还没有,请使用以下命令进行安装。 +它是用 Python 写的,`pip` 是在 Linux 上安装 s-tui 的推荐方法。确保你在系统上安装了 python-pip 软件包。如果还没有,请使用以下命令进行安装。 -对于 Debian/Ubuntu 用户,使用 **[apt 命令][2]**或 **[apt-get 命令][3]** 来安装 pip。 +对于 Debian/Ubuntu 用户,使用 [apt 命令][2] 或 [apt-get 命令][3] 来安装 `pip`。 ``` $ sudo apt install python-pip stress ``` -对于 Archlinux 用户,使用 **[pacman 命令][4]**来安装 pip。 +对于 Archlinux 用户,使用 [pacman 命令][4] 来安装 `pip`。 ``` $ sudo pacman -S python-pip stress ``` -对于 Fedora 用户,使用 **[dnf 命令][5]**来安装 pip。 +对于 Fedora 用户,使用 [dnf 命令][5] 来安装 `pip`。 ``` $ sudo dnf install python-pip stress ``` -对于 CentOS/RHEL 用户,使用 **[yum 命令][5]**来安装 pip。 +对于 CentOS/RHEL 用户,使用 [yum 命令][5] 来安装 `pip`。 ``` $ sudo yum install python-pip stress ``` -对于 openSUSE 用户,使用 **[zypper 命令][5]**来安装 pip。 +对于 openSUSE 用户,使用 [zypper 命令][5] 来安装 `pip`。 ``` $ sudo zypper install python-pip stress ``` -最后运行下面的 **[pip 命令][8]**在 Linux 中安装 s-tui 工具。 +最后运行下面的 [pip 命令][8] 在 Linux 中安装 s-tui 工具。 对于 Python 2.x: @@ -113,7 +101,7 @@ via: https://www.2daygeek.com/s-tui-stress-terminal-ui-monitor-linux-cpu-tempera 作者:[Prakash Subramanian][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/) 荣誉推出 From c075b420028ca7588a6b69c75f03d93e5e507227 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Tue, 22 Jan 2019 23:45:26 +0800 Subject: [PATCH 074/243] PUB:20190103 s-tui- A Terminal Tool To Monitor CPU Temperature, Frequency, Power And Utilization In Linux.md @geekpi https://linux.cn/article-10467-1.html --- ... Temperature, Frequency, Power And Utilization In Linux.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20190103 s-tui- A Terminal Tool To Monitor CPU Temperature, Frequency, Power And Utilization In Linux.md (98%) diff --git a/translated/tech/20190103 s-tui- A Terminal Tool To Monitor CPU Temperature, Frequency, Power And Utilization In Linux.md b/published/20190103 s-tui- A Terminal Tool To Monitor CPU Temperature, Frequency, Power And Utilization In Linux.md similarity index 98% rename from translated/tech/20190103 s-tui- A Terminal Tool To Monitor CPU Temperature, Frequency, Power And Utilization In Linux.md rename to published/20190103 s-tui- A Terminal Tool To Monitor CPU Temperature, Frequency, Power And Utilization In Linux.md index a9d94b0011..e1effb5acc 100644 --- a/translated/tech/20190103 s-tui- A Terminal Tool To Monitor CPU Temperature, Frequency, Power And Utilization In Linux.md +++ b/published/20190103 s-tui- A Terminal Tool To Monitor CPU Temperature, Frequency, Power And Utilization In Linux.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (https://linux.cn/article-10467-1.html) +[#]: url: (wxy) [#]: subject: (s-tui: A Terminal Tool To Monitor CPU Temperature, Frequency, Power And Utilization In Linux) [#]: via: (https://www.2daygeek.com/s-tui-stress-terminal-ui-monitor-linux-cpu-temperature-frequency/) [#]: author: (Prakash Subramanian https://www.2daygeek.com/author/prakash/) From 29cc1a1cea6050fd230bc34eceacc5ccfddff250 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Wed, 23 Jan 2019 00:24:13 +0800 Subject: [PATCH 075/243] PRF:20180625 The life cycle of a software bug.md @lixinyuxx --- ...180625 The life cycle of a software bug.md | 36 ++++++++++--------- 1 file changed, 19 insertions(+), 17 deletions(-) diff --git a/translated/tech/20180625 The life cycle of a software bug.md b/translated/tech/20180625 The life cycle of a software bug.md index 4f487fa182..672a797015 100644 --- a/translated/tech/20180625 The life cycle of a software bug.md +++ b/translated/tech/20180625 The life cycle of a software bug.md @@ -1,53 +1,55 @@ 软件 bug 的生命周期 ====== +> 从发现软件故障到解决它们,这里讲述是开发团队如何压制软件 bug。 + ![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/bug_software_issue_tracking_computer_screen.jpg?itok=6qfIHR5y) -1947年,发现了第一个计算机 bug --被困在计算机继电器中的飞蛾。 +1947 年,发现了第一个计算机 bug —— 被困在计算机继电器中的飞蛾。 -要是所有的 bug 都能如此简单地发现就好了。随着软件变得越来越复杂,测试和调试的过程也变得更加复杂。如今,软件 bug 的生命周期可能会很长,尽管正确的技术和业务流程可能会有所帮助。对于开源软件,开发人员使用严格的票务服务和协作来查找和解决 bugs 。 +要是所有的 bug 都能如此简单地发现就好了。随着软件变得越来越复杂,测试和调试的过程也变得更加复杂。如今,软件 bug 的生命周期可能会很长,尽管正确的技术和业务流程可能会有所帮助。对于开源软件,开发人员使用严格的工单服务和协作来查找和解决 bug。 ### 确认计算机 bug -在测试过程中,会向开发团队报告 bug 。质量保证人员尽可能详细地描述 bug ,报告他们的系统状态、他们正在进行的进程以及 bug 是如何表现出来的。 +在测试过程中,发现的 bug 会报告给开发团队。质量保证测试人员尽可能详细地描述 bug ,报告他们的系统状态、他们正在进行的过程以及 bug 是如何表现出来的。 -尽管如此,一些 bug 从未得到证实;它们可能会在测试中报告,但永远无法在可控环境中重现。在这种情况下,它们可能得不到解决,而是被关闭。 +尽管如此,一些 bug 从未得到确认;它们可能会在测试中报告,但永远无法在可控环境中重现。在这种情况下,它们可能得不到解决,而是被关闭。 -由于使用的平台种类繁多,用户行为也非常多,因此很难确认计算机 bug ,有些 bug 只是间歇性地或在非常特殊的情况下发生的,而另一些 bug 可能会出现在随机的情况下。 +有些计算机 bug 可能很难确认,因为使用的平台种类繁多,用户行为也非常多。有些 bug 只是间歇性地或在非常特殊的情况下发生的,而另一些 bug 可能会出现在随机的情况下。 -许多人使用开源软件并与之交互,许多 bug 和问题可能是不可重复的,或者可能没有得到充分的描述。不过,由于每个用户和开发人员也都扮演质量保证测试员的角色,至少在一定程度上,很有可能会发现 bug 。 +许多人使用开源软件并与之交互,许多 bug 和问题可能是不可重复的,或者可能没有得到充分的描述。不过,由于每个用户和开发人员也都扮演质量保证测试人员的角色,至少在一定程度上,bug 还是很有可能会发现的。 确认 bug 后,修复工作就开始了。 ### 分配要修复的 bug -已确认的 bug 被分配给负责解决的开发人员或开发团队。在此阶段,需要重现 bug ,发现问题,并修复相关代码。如果 bug 的优先级较低,开发人员可以将此 bug 分类为稍后要修复的问题,也可以在该 bug 具有高优先级的情况下直接指派某人修复。无论哪种方式,都会在开发过程中打开票证,并且 bug 将成为已知的问题。 +已确认的 bug 被分配给负责解决的开发人员或开发团队。在此阶段,需要重现 bug,发现问题,并修复相关代码。如果 bug 的优先级较低,开发人员可以将此 bug 分类为稍后要修复的问题,也可以在该 bug 具有高优先级的情况下直接指派某人修复。无论哪种方式,都会在开发过程中打开一个工单,并且 bug 将成为已知的问题。 -在开源解决方案中,开发人员可以从他们想要解决的 bug 中进行选择,要么选择他们最熟悉的程序区域,要么从优先级最高的的开始。综合解决方案,如 [GitHub][1] 使得多个开发人员能够轻松地处理解决方案,而不会干扰彼此的工作。 +在开源解决方案中,开发人员可以进行选择他们想要解决的 bug,要么选择他们最熟悉的程序区域,要么从优先级最高的的开始。综合解决方案,如 [GitHub][1] 使得多个开发人员能够轻松地着手解决,而不会干扰彼此的工作。 -在分配要修复的 bug 时,记录者还可以为 bug 选择优先级。主要得 bug 可能具有较高的优先级,而仅与外观相关的 bug 可能具有较低的级别。优先级确定开发团队解决这些问题的方式和时间。无论哪种方式,所有的 bug 都需要先解决,然后才能认为产品已完成。在这方面,适当的回溯到优先级高的的需求也会很有帮助。 +当将 bug 设置为需要修复时,bug 报告者还可以为该 bug 选择优先级。主要的 bug 可能具有较高的优先级,而仅与外观相关的 bug 可能具有较低的级别。优先级确定开发团队解决这些问题的方式和时间。无论哪种方式,所有的 bug 都需要先解决,然后才能认为产品已完成。在这方面,适当的回溯到优先级高的需求也会很有帮助。 ### 解决 bug -一旦修复了 bug ,通常会将其作为已解决的 bug 发送回质量保证。然后,质量保证再次将产品置于其步伐中,以重现 bug。如果无法重现 bug ,质量保证将假定它已得到适当解决。 +一旦修复了 bug ,通常会将其作为已解决的 bug 发送回质量保证测试人员。然后,质量保证测试人员再次将产品置于其工作中,以重现 bug。如果无法重现 bug ,质量保证测验人员将假定它已得到适当解决。 -在开源情况下,任何更改都是分布式的,通常是作为正在测试的暂定版本。此测试版本分发给用户,用户再次履行质量保证的职责并测试产品。 +在开源情况下,任何更改都会被分发,通常是作为正在测试的暂定版本。此测试版本分发给用户,用户再次履行质量保证测试人员的职责并测试产品。 -如果 bug 再次出现,问题将被发送回开发团队。在此阶段,该 bug 将重新触发,开发团队有责任重复循环解决该 bug 。这种情况可能会发生多次,尤其是在 bug 不可预知或间歇性发生的情况下。众所周知,间歇性的 bug 很难解决。 +如果 bug 再次出现,问题将被发送回开发团队。在此阶段,该 bug 将重新触发,开发团队有责任重复解决该 bug 的循环。这种情况可能会发生多次,尤其是在 bug 不可预知或间歇性发生的情况下。众所周知,间歇性的 bug 很难解决。 -如果该 bug 不再出现,则该问题将被标记为已解决。在某些情况下,初始 bug 已得到解决,但由于所做的更改,会出现其他 bug。发生这种情况时,可能需要新的 bug 报告,然后重新开始该过程。 +如果该 bug 不再出现,则该问题将被标记为已解决。在某些情况下,最初的 bug 得到了解决,但由于所做的更改,会出现其他 bug。发生这种情况时,可能需要新的 bug 报告,然后重新开始该过程。 ### 关闭 bug -在处理、识别和解决 bug 后,该 bug 将被关闭,开发人员可以转到软件开发和测试的其他阶段。如果始终找不到 bug ,或者开发人员无法重现 bug ,则该 bug 也将被关闭-无论哪种方式,都将开始开发和测试的下一阶段。 +在处理、识别和解决 bug 后,该 bug 将被关闭,开发人员可以转到软件开发和测试的其他阶段。如果始终找不到 bug ,或者开发人员无法重现 bug ,则该 bug 也将被关闭 —— 无论哪种方式,都将开始开发和测试的下一阶段。 在测试版本中对解决方案所做的任何更改都将滚动到产品的下一个版本中。如果 bug 是严重的,则在下一个版本发布之前,可能会为当前用户提供修补程序或修补程序。这在安全问题中很常见。 -软件 bug 可能很难找到,但通过遵循过程,开发人员可以使开发更快、更容易、更一致。质量保证是这一过程的重要组成部分,因为 QA 测试人员必须发现和识别 bug ,并帮助开发人员重现这些 bug 。在 bug 不再发生之前,无法关闭和解决 bug。 +软件 bug 可能很难找到,但通过遵循过程,开发人员可以使开发更快、更容易、更一致。质量保证是这一过程的重要组成部分,因为质量保证测试人员必须发现和识别 bug ,并帮助开发人员重现这些 bug 。在 bug 不再发生之前,无法关闭和解决 bug。 开源的解决方案分散了质量保证测试、开发和缓解的负担,这往往导致 bug 被更快、更全面地发现和缓解。但是,由于开源技术的性质,此过程的速度和准确性通常取决于解决方案的受欢迎程度及其维护和开发团队的敬业精神。 -_Rich Butkevic 是一个 PMP 项目经理认证,,敏捷开发框架认证(*certified scrum master*) 并且 使用 [Project Zendo][2] ,供项目管理专业人员去发现、简化和改进其项目成果策略的网站。与 Rich 联系在 [Richbutkevic.com][3] 或者使用 [LinkedIn][4] 。_ +Rich Butkevic 是一个 PMP 项目经理认证,,敏捷开发框架认证(certified scrum master) 并且 维护 [Project Zendo][2],这是供项目管理专业人员去发现、简化和改进其项目成果策略的网站。可以在 [Richbutkevic.com][3] 或者使用 [LinkedIn][4] 与 Rich 联系。 -------------------------------------------------------------------------------- @@ -56,7 +58,7 @@ via: https://opensource.com/article/18/6/life-cycle-software-bug 作者:[Rich Butkevic][a] 选题:[lujun9972](https://github.com/lujun9972) 译者:[lixinyuxx](https://github.com/lixinyuxx) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 2b2acff5f55cbb0bcc5622ad18620bdbef7eb8c7 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Wed, 23 Jan 2019 00:24:38 +0800 Subject: [PATCH 076/243] PUB:20180625 The life cycle of a software bug.md @lixinyuxx https://linux.cn/article-10468-1.html --- .../20180625 The life cycle of a software bug.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {translated/tech => published}/20180625 The life cycle of a software bug.md (100%) diff --git a/translated/tech/20180625 The life cycle of a software bug.md b/published/20180625 The life cycle of a software bug.md similarity index 100% rename from translated/tech/20180625 The life cycle of a software bug.md rename to published/20180625 The life cycle of a software bug.md From a284bbb4a96a454018504bf5ef59d4010b4c76fe Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Wed, 23 Jan 2019 01:10:09 +0800 Subject: [PATCH 077/243] PRF:20190114 You (probably) don-t need Kubernetes.md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @beamrolling 恭喜您完成了第一篇翻译贡献! --- ...14 You (probably) don-t need Kubernetes.md | 50 +++++++++++-------- 1 file changed, 28 insertions(+), 22 deletions(-) diff --git a/translated/talk/20190114 You (probably) don-t need Kubernetes.md b/translated/talk/20190114 You (probably) don-t need Kubernetes.md index d573ebe680..3261b3185e 100644 --- a/translated/talk/20190114 You (probably) don-t need Kubernetes.md +++ b/translated/talk/20190114 You (probably) don-t need Kubernetes.md @@ -1,59 +1,65 @@ [#]: collector: (lujun9972) [#]: translator: (beamrolling) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (You (probably) don't need Kubernetes) [#]: via: (https://arp242.net/weblog/dont-need-k8s.html) [#]: author: (Martin Tournoij https://arp242.net/) -你(大概)不需要 Kubernetes +你(多半)不需要 Kubernetes ====== 这也许是一个不太受欢迎的观点,但大多数主流公司最好不要再使用 k8s 了。 -你知道那个古老的“根据程序员技能写 Hello world ”笑话吗?它从一个新手程序员的 printf("hello, world\n") 语句开始,最后结束于高级软件架构工程师令人费解的 Java OOP 模式设计。使用 k8s 就有点像这样。 +你知道那个古老的“以程序员技能写 Hello world ”笑话吗?—— 从一个新手程序员的 `printf("hello, world\n")` 语句开始,最后结束于高级软件架构工程师令人费解的 Java OOP 模式设计。使用 k8s 就有点像这样。 -* 新手 SysOp: - `./binary` -* 有经验的 SysOp: - 在 EC2 上的 `./binary` +* 新手系统管理员: + + `./binary` +* 有经验的系统管理员: + + 在 EC2 上的 `./binary` * DevOp: - 在 EC2 上自部署的 CI 管道运行 `./binary` + + 在 EC2 上自部署的 CI 管道运行 `./binary` * 高级云编排工程师: - 在 EC2 上通过 k8s 编排的自部署 CI 管道运行 `./binary` + + 在 EC2 上通过 k8s 编排的自部署 CI 管道运行 `./binary` +`¯\\_(ツ)_/¯` +这不意味着 Kubernetes 或者任何这样的东西本身都是*坏的*,就像 Java 或者 OOP 设计本身并不是坏的一样,但是,在很多情况下,它们被严重地误用,就像在一个 hello world 的程序中可怕地误用 Java 面向对象设计模式一样。对大多数公司而言,系统运维从根本上来说并不十分复杂,此时在这上面应用 k8s 起效甚微。 -¯\\_(ツ)_/¯ +复杂性本质上来说创造了工作,我十分怀疑使用 k8s 对大多数使用者来说是省时的这一说法。这就好像花一天时间来写一个脚本,用来自动完成一些你一个月进行一次,每次只花 10 分钟完成的工作。这不是一个好的时间投资(特别是你可能会在未来由于扩展或调试这个脚本而进一步投入的更多时间)。 -这不意味着 Kubernetes 或者任何这样的东西本身都是坏的,就像 Java 或者 OOP 设计本身并不是坏的一样,但是,在很多情况下,它们被严重地误用,就像在一个 hello world 的程序中可怕地误用 Java 面向对象设计模式一样。对大多数公司而言,系统运维从根本上来说并不十分复杂,此时在这上面应用 k8s 起效甚微。 +你的部署大概应该*需要*自动化 – 以免你 [最终像 Knightmare][1] 那样 —— 但 k8s 通常可以被一个简单的 shell 脚本所替代。 -复杂性本质上来说创造了工作,我十分怀疑使用 k8s 对大多数使用者来说是省时的这一说法。这就好像花一天时间来写一个脚本,用来自动完成一些你一个月一次,每次只花 10 分钟完成的工作。这不是一个好的时间投资(特别是你可能会在未来由于扩展或调试这个脚本来进一步投入更多的时间)。 +在我们公司,系统运维团队用了很多时间来设置 k8s 。他们还不得不用了很大一部分时间来更新到新一点的版本(1.6 ➙ 1.8)。结果是如果没有真正深入理解 k8s ,有些东西就没人会真的明白,甚至连深入理解 k8s 这一点也很难(那些 YAML 文件,哦呦!) -你的部署大概应该需要自动化 – 以免你 [最终像 Knightmare][1] 那样 – 但 k8s 通常可以被一个简单的 shell 脚本所替代。 +在我能自己调试和修复部署问题之前 —— 现在这更难了,我理解基本概念,但在真正调试实际问题的时候,它们并不是那么有用。我不经常用 k8s 足以证明这点。 -在我们公司,sysops 团队用了很多时间来设置 k8s 。他们还不得不用了很大一部分时间来更新到新一点的版本(1.6 – 1.8)。结果是如果没有真正深入理解 k8s ,没人会真正明白一些东西,甚至连深入理解 k8s 这一点也很难(那些 YAML 文件,哦呦!) +--- -在我能自己调试和修复问题之前——现在这更难了,我理解基本概念,但在真正调试实际问题的时候,它们并不是那么有用。我不经常用 k8s 足以证明这点。 - -k8s 真的很难这点并不是什么新看法,这也是为什么现在会有这么多“ k8s 简单学”的解决方案。在 k8s 上再添一层来“让它更简单”的方法让我觉得,呃,不明智。复杂性并没有消失,你只是把它藏起来了。 +k8s 真的很难这点并不是什么新看法,这也是为什么现在会有这么多 “k8s 简单用”的解决方案。在 k8s 上再添一层来“让它更简单”的方法让我觉得,呃,不明智。复杂性并没有消失,你只是把它藏起来了。 以前我说过很多次:在确定一样东西是否“简单”时,我最关心的不是写东西的时候有多简单,而是当失败的时候调试起来有多容易。包装 k8s 并不会让调试更加简单,恰恰相反,它让事情更加困难了。 +--- + Blaise Pascal 有一句名言: > 几乎所有的痛苦都来自于我们不善于在房间里独处。 -k8s —— 略微拓展一下,Docker ——似乎就是这样的例子。许多人似乎迷失在当下的兴奋中,觉得“ k8s 就是这么回事!”,就像有些人迷失在 Java OOP 刚出来时的兴奋中一样,所以一切都必须从“旧”方法转为“新”方法,即使“旧”方法依然可行。 +k8s —— 略微拓展一下,Docker —— 似乎就是这样的例子。许多人似乎迷失在当下的兴奋中,觉得 “k8s 就是这么回事!”,就像有些人迷失在 Java OOP 刚出来时的兴奋中一样,所以一切都必须从“旧”方法转为“新”方法,即使“旧”方法依然可行。 有时候 IT 产业挺蠢的。 或者用 [一条推特][2] 来总结: -> 2014 - 我们必须采用 #微服务 来解决 monolith 的所有问题 -> 2016 - 我们必须采用 #docker 来解决微服务的所有问题 -> 2018 - 我们必须采用 #kubernetes 来解决 docker 的所有问题 +> - 2014 - 我们必须采用 #微服务 来解决独石应用的所有问题 +> - 2016 - 我们必须采用 #docker 来解决微服务的所有问题 +> - 2018 - 我们必须采用 #kubernetes 来解决 docker 的所有问题 你可以通过 [martin@arp242.net][3] 给我发邮件或者 [创建 GitHub issue][4] 来给我反馈或提出问题等。 @@ -64,7 +70,7 @@ via: https://arp242.net/weblog/dont-need-k8s.html 作者:[Martin Tournoij][a] 选题:[lujun9972][b] 译者:[beamrolling](https://github.com/beamrolling) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From b3e6f48dc9237d52ab923697a7eac41acee447c5 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Wed, 23 Jan 2019 01:11:53 +0800 Subject: [PATCH 078/243] PUB:20190114 You (probably) don-t need Kubernetes.md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @beamrolling 本文首发地址: https://linux.cn/article-10469-1.html 您的 LCTT 专页地址: https://linux.cn/beamrolling 请注册领取 LCCN:https://lctt.linux.cn/ --- .../20190114 You (probably) don-t need Kubernetes.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/talk => published}/20190114 You (probably) don-t need Kubernetes.md (98%) diff --git a/translated/talk/20190114 You (probably) don-t need Kubernetes.md b/published/20190114 You (probably) don-t need Kubernetes.md similarity index 98% rename from translated/talk/20190114 You (probably) don-t need Kubernetes.md rename to published/20190114 You (probably) don-t need Kubernetes.md index 3261b3185e..458bfe51f1 100644 --- a/translated/talk/20190114 You (probably) don-t need Kubernetes.md +++ b/published/20190114 You (probably) don-t need Kubernetes.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (beamrolling) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-10469-1.html) [#]: subject: (You (probably) don't need Kubernetes) [#]: via: (https://arp242.net/weblog/dont-need-k8s.html) [#]: author: (Martin Tournoij https://arp242.net/) From fa43a723249519df9d15cf3d498053aaac9cbcdf Mon Sep 17 00:00:00 2001 From: geekpi Date: Wed, 23 Jan 2019 08:56:09 +0800 Subject: [PATCH 079/243] translated --- ... started with Joplin, a note-taking app.md | 61 ------------------- ... started with Joplin, a note-taking app.md | 61 +++++++++++++++++++ 2 files changed, 61 insertions(+), 61 deletions(-) delete mode 100644 sources/tech/20190113 Get started with Joplin, a note-taking app.md create mode 100644 translated/tech/20190113 Get started with Joplin, a note-taking app.md diff --git a/sources/tech/20190113 Get started with Joplin, a note-taking app.md b/sources/tech/20190113 Get started with Joplin, a note-taking app.md deleted file mode 100644 index 55b639ae7b..0000000000 --- a/sources/tech/20190113 Get started with Joplin, a note-taking app.md +++ /dev/null @@ -1,61 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (geekpi) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Get started with Joplin, a note-taking app) -[#]: via: (https://opensource.com/article/19/1/productivity-tool-joplin) -[#]: author: (Kevin Sonney https://opensource.com/users/ksonney (Kevin Sonney)) - -Get started with Joplin, a note-taking app -====== -Learn how open source tools can help you be more productive in 2019. First up, Joplin. -![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/programming-code-keyboard-laptop.png?itok=pGfEfu2S) - -There seems to be a mad rush at the beginning of every year to find ways to be more productive. New Year's resolutions, the itch to start the year off right, and of course, an "out with the old, in with the new" attitude all contribute to this. And the usual round of recommendations is heavily biased towards closed source and proprietary software. It doesn't have to be that way. - -Here's the first of my picks for 19 new (or new-to-you) open source tools to help you be more productive in 2019. - -### Joplin - -In the realm of productivity tools, note-taking apps are VERY handy. Yes, you can use the open source [NixNote][1] to access [Evernote][2] notes, but it's still linked to the Evernote servers and still relies on a third party for security. And while you CAN export your Evernote notes from NixNote, the only format options are NixNote XML or PDF files. - -![](https://opensource.com/sites/default/files/uploads/joplin-1.png) - -Enter [Joplin][3]. Joplin is a NodeJS application that runs and stores notes locally, allows you to encrypt your notes and supports multiple sync methods. Joplin can run as a console or graphical application on Windows, Mac, and Linux. Joplin also has mobile apps for Android and iOS, meaning you can take your notes with you without a major hassle. Joplin even allows you to format notes with Markdown, HTML, or plain text. - -![](https://opensource.com/sites/default/files/uploads/joplin-3.png) - -One really nice thing about Joplin is it supports two kinds of notes: plain notes and to-do notes. Plain notes are what you expect—documents containing text. To-do notes, on the other hand, have a checkbox in the notes list that allows you to mark them "done." And since the to-do note is still a note, you can include lists, documentation, and additional to-do items in a to-do note. - -When using the GUI, you can toggle editor views between plain text, WYSIWYG, and a split screen showing both the source text and the rendered view. You can also specify an external editor in the GUI, making it easy to update notes with Vim, Emacs, or any other editor capable of handling text documents. - -![Joplin console version][5] - -Joplin in the console. - -The console interface is absolutely fantastic. While it lacks a WYSIWYG editor, it defaults to the text editor for your login. It also has a powerful command mode that allows you to do almost everything you can do in the GUI version. And it renders Markdown correctly in the viewer. - -You can group notes in notebooks and tag notes for easy grouping across your notebooks. And it even has built-in search, so you can find things if you forget where you put them. - -Overall, Joplin is a first-class note-taking app ([and a great alternative to Evernote][6]) that will help you be organized and more productive over the next year. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/19/1/productivity-tool-joplin - -作者:[Kevin Sonney][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://opensource.com/users/ksonney (Kevin Sonney) -[b]: https://github.com/lujun9972 -[1]: http://nixnote.org/NixNote-Home/ -[2]: https://evernote.com/ -[3]: https://joplin.cozic.net/ -[4]: https://opensource.com/article/19/1/file/419776 -[5]: https://opensource.com/sites/default/files/uploads/joplin-2_0.png (Joplin console version) -[6]: https://opensource.com/article/17/12/joplin-open-source-evernote-alternative diff --git a/translated/tech/20190113 Get started with Joplin, a note-taking app.md b/translated/tech/20190113 Get started with Joplin, a note-taking app.md new file mode 100644 index 0000000000..495dd4c9d1 --- /dev/null +++ b/translated/tech/20190113 Get started with Joplin, a note-taking app.md @@ -0,0 +1,61 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Get started with Joplin, a note-taking app) +[#]: via: (https://opensource.com/article/19/1/productivity-tool-joplin) +[#]: author: (Kevin Sonney https://opensource.com/users/ksonney (Kevin Sonney)) + +开始使用一款笔记应用 Joplin +====== +了解开源工具如何帮助你在 2019 年提高工作效率。先从 Joplin 开始。 +![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/programming-code-keyboard-laptop.png?itok=pGfEfu2S) + +每年年初似乎都有疯狂的冲动想提高工作效率。新年的决心,渴望开启新的一年,当然,“抛弃旧的,拥抱新的”的态度促成了这一切。通常这时的建议严重偏向闭源和专有软件。这不一定要这样。 + +这是我挑选出的 19 个新的(或者对你而言新的)开源项目来帮助你在 2019 年更有效率。 + +### Joplin + +在生产力工具领域,笔记应用非常方便。是的,你可以使用开源 [NixNote][1] 访问 [Evernote][2 ] 笔记,但它仍然与 Evernote 服务器相关联,并且仍然依赖于第三方的安全性。虽然你可以从 NixNote 导出 Evernote 笔记,但可选格式只有 NixNote XML 或 PDF。 + +![](https://opensource.com/sites/default/files/uploads/joplin-1.png) + +看看 [Joplin][3]。Joplin 是一个 NodeJS 应用,它在本地运行和存储笔记,它允许你加密笔记并支持多种同步方法。Joplin 可在 Windows、Mac 和 Linux 上作为控制台或图形应用运行。Joplin 还有适用于 Android 和 iOS 的移动应用,这意味着你可以随身携带笔记而不会有任何麻烦。Joplin 甚至允许你使用 Markdown、HTML 或纯文本格式笔记。 + +![](https://opensource.com/sites/default/files/uploads/joplin-3.png) + +关于 Joplin 很棒的一件事是它支持两种类型笔记:普通笔记和待办事项笔记。普通笔记是你所想的包含文本的文档。另一个,待办事项笔记在笔记列表中有一个复选框,允许你将其标记为“已完成”。由于待办事项仍然是一个笔记,因此你可以在待办事项中添加列表、文档和其他待办事项。 + +当使用 GUI 时,你可以在纯文本、WYSIWYG 和同时显示源文本和渲染视图的分屏之间切换编辑器视图。你还可以在 GUI 中指定外部编辑器,以便使用 Vim、Emacs 或任何其他能够处理文本文档的编辑器轻松更新笔记。 + +![Joplin console version][5] + +控制台中的 Joplin + +控制台界面非常棒。虽然它缺少 WYSIWYG 编辑器,但默认登录使用文本编辑器。它还有强大的命令模式,它允许执行在 GUI 版本中几乎所有的操作。并且能够在视图中正确渲染 Markdown。 + +你可以将笔记本中的笔记分组,还能为笔记打上标记,以便于在笔记本中进行分组。它甚至还有内置的搜索功能,因此如果你忘了笔记在哪,你可以通过它找到它们。 + +总的来说,Joplin 是一款一流的笔记应用([还是 Evernote 的一个很好的替代品][6]),它能帮助你在明年组织化并提高工作效率。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/1/productivity-tool-joplin + +作者:[Kevin Sonney][a] +选题:[lujun9972][b] +译者:[geekpi](https://github.com/geekpi) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/ksonney (Kevin Sonney) +[b]: https://github.com/lujun9972 +[1]: http://nixnote.org/NixNote-Home/ +[2]: https://evernote.com/ +[3]: https://joplin.cozic.net/ +[4]: https://opensource.com/article/19/1/file/419776 +[5]: https://opensource.com/sites/default/files/uploads/joplin-2_0.png (Joplin console version) +[6]: https://opensource.com/article/17/12/joplin-open-source-evernote-alternative From bd925e4a56b18c060846764fab68e57094866021 Mon Sep 17 00:00:00 2001 From: geekpi Date: Wed, 23 Jan 2019 09:00:48 +0800 Subject: [PATCH 080/243] translating --- .../tech/20181214 The Linux terminal is no one-trick pony.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20181214 The Linux terminal is no one-trick pony.md b/sources/tech/20181214 The Linux terminal is no one-trick pony.md index 28964b249c..56b7711659 100644 --- a/sources/tech/20181214 The Linux terminal is no one-trick pony.md +++ b/sources/tech/20181214 The Linux terminal is no one-trick pony.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (geekpi) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From d43cc1f54e330e8eaeb494dad6e04aca50e611d9 Mon Sep 17 00:00:00 2001 From: darksun Date: Wed, 23 Jan 2019 10:29:53 +0800 Subject: [PATCH 081/243] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020150616=20Comput?= =?UTF-8?q?er=20Laboratory=20=E2=80=93=20Raspberry=20Pi:=20Lesson=206=20Sc?= =?UTF-8?q?reen01=20sources/tech/20150616=20Computer=20Laboratory=20-=20Ra?= =?UTF-8?q?spberry=20Pi-=20Lesson=206=20Screen01.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...atory - Raspberry Pi- Lesson 6 Screen01.md | 503 ++++++++++++++++++ 1 file changed, 503 insertions(+) create mode 100644 sources/tech/20150616 Computer Laboratory - Raspberry Pi- Lesson 6 Screen01.md diff --git a/sources/tech/20150616 Computer Laboratory - Raspberry Pi- Lesson 6 Screen01.md b/sources/tech/20150616 Computer Laboratory - Raspberry Pi- Lesson 6 Screen01.md new file mode 100644 index 0000000000..0b3cc3940c --- /dev/null +++ b/sources/tech/20150616 Computer Laboratory - Raspberry Pi- Lesson 6 Screen01.md @@ -0,0 +1,503 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Computer Laboratory – Raspberry Pi: Lesson 6 Screen01) +[#]: via: (https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/screen01.html) +[#]: author: (Alex Chadwick https://www.cl.cam.ac.uk) + +Computer Laboratory – Raspberry Pi: Lesson 6 Screen01 +====== + +Welcome to the Screen lesson series. In this series, you will learn how to control the screen using the Raspberry Pi in assembly code, starting at just displaying random data, then moving up to displaying a fixed image, displaying text and then formatting numbers into text. It is assumed that you have already completed the OK series, and so things covered in this series will not be repeated here. + +This first screen lesson teaches some basic theory about graphics, and then applies it to display a gradient pattern to the screen or TV. + +### 1 Getting Started + +It is expected that you have completed the OK series, and so functions in the 'gpio.s' file and 'systemTimer.s' file from that series will be called. If you do not have these files, or prefer to use a correct implementation, download the solution to OK05.s. The 'main.s' file from here will also be useful, up to and including mov sp,#0x8000. Please delete anything after that line. + +### 2 Computer Graphics + +There are a few systems for representing colours as numbers. Here we focus on RGB systems, but HSL is another common system used. + +As you're hopefully beginning to appreciate, at a fundamental level, computers are very stupid. They have a limited number of instructions, almost exclusively to do with maths, and yet somehow they are capable of doing many things. The thing we currently wish to understand is how a computer could possibly put an image on the screen. How would we translate this problem into binary? The answer is relatively straightforward; we devise some system of numbering each colour, and then we store one number for every pixel on the screen. A pixel is a small dot on your screen. If you move very close, you will probably be able to make out individual pixels on your screen, and be able to see that everything image is just made out of these pixels in combination. + +As the computer age advanced, people wanted more and more complicated graphics, and so the concept of a graphics card was invented. The graphics card is a secondary processor on your computer which only exists to draw images to the screen. It has the job of turning the pixel value information into light intensity levels to be transmitted to the screen. On modern computers, graphics cards can also do a lot more than that, such as drawing 3D graphics. In this tutorial however, we will just concentrate on the first use of graphics cards; getting pixel colours from memory out to the screen. + +One issue that is raised immediately by all this is the system we use for numbering colours. There are several choices, each producing outputs of different quality. I will outline a few here for completeness. + +Although some images here have few colours they use a technique called spatial dithering. This allows them to still show a good representation of the image, with very few colours. Many early Operating Systems used this technique. + +| Name | Unique Colours | Description | Examples | +| ----------- | --------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ---------------------------- | +| Monochrome | 2 | Use 1 bit to store each pixel, with a 1 being white, and a 0 being black. | ![Monochrome image of a bird][1] | +| Greyscale | 256 | Use 1 byte to store each pixel, with 255 representing white, 0 representing black, and all values in between representing a linear combination of the two. | ![Geryscale image of a bird][2] | +| 8 Colour | 8 | Use 3 bits to store each pixel, the first bit representing the presence of a red channel, the second representing a green channel and the third a blue channel. | ![8 colour image of a bird][3] | +| Low Colour | 256 | Use 8 bits to store each pixel, the first 3 bit representing the intensity of the red channel, the next 3 bits representing the intensity of the green channel and the final 2 bits representing the intensity of the blue channel. | ![Low colour image of a bird][4] | +| High Colour | 65,536 | Use 16 bits to store each pixel, the first 5 bit representing the intensity of the red channel, the next 6 bits representing the intensity of the green channel and the final 5 bits representing the intensity of the blue channel. | ![High colour image of a bird][5] | +| True Colour | 16,777,216 | Use 24 bits to store each pixel, the first 8 bits representing the intensity of the red channel, the second 8 representing the green channel and the final 8 bits the blue channel. | ![True colour image of a bird][6] | +| RGBA32 | 16,777,216 with 256 transparency levels | Use 32 bits to store each pixel, the first 8 bits representing the intensity of the red channel, the second 8 representing the green channel, the third 8 bits the blue channel, and the final 8 bits a transparency channel. The transparency channel is only considered when drawing one image on top of another and is stored such that a value of 0 indicates the image behind's colour, a value of 255 represents this image's colour, and all values between represent a mix. | | + + +In this tutorial we shall use High Colour initially. As you can see form the image, it is produces clear, good quality images, but it doesn't take up as much space as True Colour. That said, for quite a small display of 800x600 pixels, it would still take just under 1 megabyte of space. It also has the advantage that the size is a multiple of a power of 2, which greatly reduces the complexity of getting information compared with True Colour. + +``` +Storing the frame buffer places a heavy memory burden on a computer. For this reason, early computers often cheated, by, for example, storing a screens worth of text, and just drawing each letter to the screen every time it is refreshed separately. +``` + +The Raspberry Pi has a very special and rather odd relationship with it's graphics processor. On the Raspberry Pi, the graphics processor actually runs first, and is responsible for starting up the main processor. This is very unusual. Ultimately it doesn't make too much difference, but in many interactions, it often feels like the processor is secondary, and the graphics processor is the most important. The two communicate on the Raspberry Pi by what is called the 'mailbox'. Each can deposit mail for the other, which will be collected at some future point and then dealt with. We shall use the mailbox to ask the graphics processor for an address. The address will be a location to which we can write the pixel colour information for the screen, called a frame buffer, and the graphics card will regularly check this location, and update the pixels on the screen appropriately. + +### 3 Programming the Postman + +``` +Message passing is quite a common way for components to communicate. Some Operating Systems use virtual message passing to allow programs to communicate. +``` + +The first thing we are going to need to program is a 'postman'. This is just two methods: MailboxRead, reading one message from the mailbox channel in r0. and MailboxWrite, writing the value in the top 28 bits of r0 to the mailbox channel in r1. The Raspberry Pi has 7 mailbox channels for communication with the graphics processor, only the first of which is useful to us, as it is for negotiating the frame buffer. + +The following table and diagrams describe the operation of the mailbox. + +Table 3.1 Mailbox Addresses +| Address | Size / Bytes | Name | Description | Read / Write | +| 2000B880 | 4 | Read | Receiving mail. | R | +| 2000B890 | 4 | Poll | Receive without retrieving. | R | +| 2000B894 | 4 | Sender | Sender information. | R | +| 2000B898 | 4 | Status | Information. | R | +| 2000B89C | 4 | Configuration | Settings. | RW | +| 2000B8A0 | 4 | Write | Sending mail. | W | + +In order to send a message to a particular mailbox: + + 1. The sender waits until the Status field has a 0 in the top bit. + 2. The sender writes to Write such that the lowest 4 bits are the mailbox to write to, and the upper 28 bits are the message to write. + + + +In order to read a message: + + 1. The receiver waits until the Status field has a 0 in the 30th bit. + 2. The receiver reads from Read. + 3. The receiver confirms the message is for the correct mailbox, and tries again if not. + + + +If you're feeling particularly confident, you now have enough information to write the two methods we need. If not, read on. + +As always the first method I recommend you implement is one to get the address of the mailbox region. + +``` +.globl GetMailboxBase +GetMailboxBase: +ldr r0,=0x2000B880 +mov pc,lr +``` + +The sending procedure is least complicated, so we shall implement this first. As your methods become more and more complicated, you will need to start planning them in advance. A good way to do this might be to write out a simple list of the steps that need to be done, in a fair amount of detail, like below. + + 1. Our input will be what to write (r0), and what mailbox to write it to (r1). We must validate this is by checking it is a real mailbox, and that the low 4 bits of the value are 0. Never forget to validate inputs. + 2. Use GetMailboxBase to retrieve the address. + 3. Read from the Status field. + 4. Check the top bit is 0. If not, go back to 3. + 5. Combine the value to write and the channel. + 6. Write to the Write. + + + +Let's handle each of these in order. + +1. +``` +.globl MailboxWrite +MailboxWrite: +tst r0,#0b1111 +movne pc,lr +cmp r1,#15 +movhi pc,lr +``` + +``` +tst reg,#val computes and reg,#val and compares the result with 0. +``` + +This achieves our validation on r0 and r1. tst is a function that compares two numbers by computing the logical and operation of the numbers, and then comparing the result with 0. In this case it checks that the lowest 4 bits of the input in r0 are all 0. + +2. +``` +channel .req r1 +value .req r2 +mov value,r0 +push {lr} +bl GetMailboxBase +mailbox .req r0 +``` + +This code ensures we will not overwrite our value, or link register and calls GetMailboxBase. + +3. +``` +wait1$: +status .req r3 +ldr status,[mailbox,#0x18] +``` + +This code loads in the current status. + +4. +``` +tst status,#0x80000000 +.unreq status +bne wait1$ +``` + +This code checks that the top bit of the status field is 0, and loops back to 3. if it is not. + +5. +``` +add value,channel +.unreq channel +``` + +This code combines the channel and value together. + +6. +``` +str value,[mailbox,#0x20] +.unreq value +.unreq mailbox +pop {pc} +``` + +This code stores the result to the write field. + + + + +The code for MailboxRead is quite similar. + + 1. Our input will be what mailbox to read from (r0). We must validate this is by checking it is a real mailbox. Never forget to validate inputs. + 2. Use GetMailboxBase to retrieve the address. + 3. Read from the Status field. + 4. Check the 30th bit is 0. If not, go back to 3. + 5. Read from the Read field. + 6. Check the mailbox is the one we want, if not go back to 3. + 7. Return the result. + + + +Let's handle each of these in order. + +1. +``` +.globl MailboxRead +MailboxRead: +cmp r0,#15 +movhi pc,lr +``` + +This achieves our validation on r0. + +2. +``` +channel .req r1 +mov channel,r0 +push {lr} +bl GetMailboxBase +mailbox .req r0 +``` + +This code ensures we will not overwrite our value, or link register and calls GetMailboxBase. + +3. +``` +rightmail$: +wait2$: +status .req r2 +ldr status,[mailbox,#0x18] +``` + +This code loads in the current status. + +4. +``` +tst status,#0x40000000 +.unreq status +bne wait2$ +``` + +This code checks that the 30th bit of the status field is 0, and loops back to 3. if it is not. + +5. +``` +mail .req r2 +ldr mail,[mailbox,#0] +``` + +This code reads the next item from the mailbox. + +6. +``` +inchan .req r3 +and inchan,mail,#0b1111 +teq inchan,channel +.unreq inchan +bne rightmail$ +.unreq mailbox +.unreq channel +``` + +This code checks that the channel of the mail we just read is the one we were supplied. If not it loops back to 3. + +7. +``` +and r0,mail,#0xfffffff0 +.unreq mail +pop {pc} +``` + +This code moves the answer (the top 28 bits of mail) to r0. + + + + +### 4 My Dearest Graphics Processor + +Through our new postman, we now have the ability to send a message to the graphics card. What should we send though? This was certainly a difficult question for me to find the answer to, as it isn't in any online manual that I have found. Nevertheless, by looking at the GNU/Linux for the Raspberry Pi, we are able to work out what we needed to send. + +``` +Since the RAM is shared between the graphics processor and the processor on the Pi, we can just send where to find our message. This is called DMA, many complicated devices use this to speed up access times. +``` + +The message is very simple. We describe the framebuffer we would like, and the graphics card either agrees to our request, in which case it sends us back a 0, and fills in a small questionnaire we make, or it sends back a non-zero number, in which case we know it is unhappy. Unfortunately, I have no idea what any of the other numbers it can send back are, nor what they mean, but only when it sends a zero it is happy. Fortunately it always seems to send a zero for sensible inputs, so we don't need to worry too much. + +For simplicity we shall design our request in advance, and store it in the .data section. In a file called 'framebuffer.s' place the following code: + +``` +.section .data +.align 4 +.globl FrameBufferInfo +FrameBufferInfo: +.int 1024 /bin /boot /dev /etc /home /lib /lib64 /lost+found /media /mnt /opt /proc /root /run /sbin /srv /sys /tmp /usr /var #0 Physical Width */ +.int 768 /bin /boot /dev /etc /home /lib /lib64 /lost+found /media /mnt /opt /proc /root /run /sbin /srv /sys /tmp /usr /var #4 Physical Height */ +.int 1024 /bin /boot /dev /etc /home /lib /lib64 /lost+found /media /mnt /opt /proc /root /run /sbin /srv /sys /tmp /usr /var #8 Virtual Width */ +.int 768 /bin /boot /dev /etc /home /lib /lib64 /lost+found /media /mnt /opt /proc /root /run /sbin /srv /sys /tmp /usr /var #12 Virtual Height */ +.int 0 /bin /boot /dev /etc /home /lib /lib64 /lost+found /media /mnt /opt /proc /root /run /sbin /srv /sys /tmp /usr /var #16 GPU - Pitch */ +.int 16 /bin /boot /dev /etc /home /lib /lib64 /lost+found /media /mnt /opt /proc /root /run /sbin /srv /sys /tmp /usr /var #20 Bit Depth */ +.int 0 /bin /boot /dev /etc /home /lib /lib64 /lost+found /media /mnt /opt /proc /root /run /sbin /srv /sys /tmp /usr /var #24 X */ +.int 0 /bin /boot /dev /etc /home /lib /lib64 /lost+found /media /mnt /opt /proc /root /run /sbin /srv /sys /tmp /usr /var #28 Y */ +.int 0 /bin /boot /dev /etc /home /lib /lib64 /lost+found /media /mnt /opt /proc /root /run /sbin /srv /sys /tmp /usr /var #32 GPU - Pointer */ +.int 0 /bin /boot /dev /etc /home /lib /lib64 /lost+found /media /mnt /opt /proc /root /run /sbin /srv /sys /tmp /usr /var #36 GPU - Size */ +``` + +This is the format of our messages to the graphics processor. The first two words describe the physical width and height. The second pair is the virtual width and height. The framebuffer's width and height are the virtual width and height, and the GPU scales the framebuffer as need to fit the physical screen. The next word is one of the ones the GPU will fill in if it grants our request. It will be the number of bytes on each row of the frame buffer, in this case 2 × 1024 = 2048. The next word is how many bits to allocate to each pixel. Using a value of 16 means that the graphics processor uses High Colour mode described above. A value of 24 would use True Colour, and 32 would use RGBA32. The next two words are x and y offsets, which mean the number of pixels to skip in the top left corner of the screen when copying the framebuffer to the screen. Finally, the last two words are filled in by the graphics processor, the first of which is the actual pointer to the frame buffer, and the second is the size of the frame buffer in bytes. + +``` +When working with devices using DMA, alignment constraints become very important. The GPU expects the message to be 16 byte aligned. +``` + +I was very careful to include a .align 4 here. As discussed before, this ensures the lowest 4 bits of the address of the next line are 0. Thus, we know for sure that FrameBufferInfo will be placed at an address we can send to the graphics processor, as our mailbox only sends values with the low 4 bits all 0. + +So, now that we have our message, we can write code to send it. The communication will go as follows: + + 1. Write the address of FrameBufferInfo + 0x40000000 to mailbox 1. + 2. Read the result from mailbox 1. If it is not zero, we didn't ask for a proper frame buffer. + 3. Copy our images to the pointer, and they will appear on screen! + + + +I've said something that I've not mentioned before in step 1. We have to add 0x40000000 to the address of FrameBufferInfo before sending it. This is actually a special signal to the GPU of how it should write to the structure. If we just send the address, the GPU will write its response, but will not make sure we can see it by flushing its cache. The cache is a piece of memory where a processor stores values its working on before sending them to the RAM. By adding 0x40000000, we tell the GPU not to use its cache for these writes, which ensures we will be able to see the change. + +Since there is quite a lot going on there, it would be best to implement this as a function, rather than just putting the code into main.s. We shall write a function InitialiseFrameBuffer which does all this negotiation and returns the pointer to the frame buffer info data above, once it has a pointer in it. For ease, we should also make it so that the width, height and bit depth of the frame buffer are inputs to this method, so that it is easy to change in main.s without having to get into the details of the negotiation. + +Once again, let's write down in detail the steps we will have to take. If you're feeling confident, try writing the function straight away. + + 1. Validate our inputs. + 2. Write the inputs into the frame buffer. + 3. Send the address of the frame buffer + 0x40000000 to the mailbox. + 4. Receive the reply from the mailbox. + 5. If the reply is not 0, the method has failed. We should return 0 to indicate failure. + 6. Return a pointer to the frame buffer info. + + + +Now we're getting into much bigger methods than before. Below is one implementation of the above. + +1. +``` +.section .text +.globl InitialiseFrameBuffer +InitialiseFrameBuffer: +width .req r0 +height .req r1 +bitDepth .req r2 +cmp width,#4096 +cmpls height,#4096 +cmpls bitDepth,#32 +result .req r0 +movhi result,#0 +movhi pc,lr +``` + +This code checks that the width and height are less than or equal to 4096, and that the bit depth is less than or equal to 32. This is once again using a trick with conditional execution. Convince yourself that this works. + +2. +``` +fbInfoAddr .req r3 +push {lr} +ldr fbInfoAddr,=FrameBufferInfo +str width,[fbInfoAddr,#0] +str height,[fbInfoAddr,#4] +str width,[fbInfoAddr,#8] +str height,[fbInfoAddr,#12] +str bitDepth,[fbInfoAddr,#20] +.unreq width +.unreq height +.unreq bitDepth +``` + +This code simply writes into our frame buffer structure defined above. I also take the opportunity to push the link register onto the stack. + +3. +``` +mov r0,fbInfoAddr +add r0,#0x40000000 +mov r1,#1 +bl MailboxWrite +``` + +The inputs to the MailboxWrite method are the value to write in r0, and the channel to write to in r1. + +4. +``` +mov r0,#1 +bl MailboxRead +``` + +The inputs to the MailboxRead method is the channel to write to in r0, and the output is the value read. + +5. +``` +teq result,#0 +movne result,#0 +popne {pc} +``` + +This code checks if the result of the MailboxRead method is 0, and returns 0 if not. + +6. +``` +mov result,fbInfoAddr +pop {pc} +.unreq result +.unreq fbInfoAddr +``` + +This code finishes off and returns the frame buffer info address. + + + + +### 5 A Pixel Within a Row Within a Frame + +So, we've now created our methods to communicate with the graphics processor. It should now be capable of giving us the pointer to a frame buffer we can draw graphics to. Let's draw something now. + +In this first example, we'll just draw consecutive colours to the screen. It won't look pretty, but at least it will be working. How we will do this is by setting each pixel in the framebuffer to a consecutive number, and continually doing so. + +Copy the following code to 'main.s' after mov sp,#0x8000 + +``` +mov r0,#1024 +mov r1,#768 +mov r2,#16 +bl InitialiseFrameBuffer +``` + +This code simply uses our InitialiseFrameBuffer method to create a frame buffer with width 1024, height 768, and bit depth 16. You can try different values in here if you wish, as long as you are consistent throughout the code. Since it's possible that this method can return 0 if the graphics processor did not give us a frame buffer, we had better check for this, and turn the OK LED on if it happens. + +``` +teq r0,#0 +bne noError$ + +mov r0,#16 +mov r1,#1 +bl SetGpioFunction +mov r0,#16 +mov r1,#0 +bl SetGpio + +error$: +b error$ + +noError$: +fbInfoAddr .req r4 +mov fbInfoAddr,r0 +``` + +Now that we have the frame buffer info address, we need to get the frame buffer pointer from it, and start drawing to the screen. We will do this using two loops, one going down the rows, and one going along the columns. On the Raspberry Pi, indeed in most applications, pictures are stored left to right then top to bottom, so we have to do the loops in the order I have said. + + +``` +render$: + + fbAddr .req r3 + ldr fbAddr,[fbInfoAddr,#32] + + colour .req r0 + y .req r1 + mov y,#768 + drawRow$: + + x .req r2 + mov x,#1024 + drawPixel$: + + strh colour,[fbAddr] + add fbAddr,#2 + sub x,#1 + teq x,#0 + bne drawPixel$ + + sub y,#1 + add colour,#1 + teq y,#0 + bne drawRow$ + + b render$ + +.unreq fbAddr +.unreq fbInfoAddr +``` + +``` +strh reg,[dest] stores the low half word number in reg at the address given by dest. +``` + +This is quite a large chunk of code, and has a loop within a loop within a loop. To help get your head around the looping, I've indented the code which is looped, depending on which loop it is in. This is quite common in most high level programming languages, and the assembler simply ignores the tabs. We see here that I load in the frame buffer address from the frame buffer information structure, and then loop over every row, then every pixel on the row. At each pixel, I use an strh (store half word) command to store the current colour, then increment the address we're writing to. After drawing each row, we increment the colour that we are drawing. After drawing the full screen, we branch back to the beginning. + +### 6 Seeing the Light + +Now you're ready to test this code on the Raspberry Pi. You should see a changing gradient pattern. Be careful: until the first message is sent to the mailbox, the Raspberry Pi displays a still gradient pattern between the four corners. If it doesn't work, please see our troubleshooting page. + +If it does work, congratulations! You can now control the screen! Feel free to alter this code to draw whatever pattern you like. You can do some very nice gradient patterns, and can compute the value of each pixel directly, since y contains a y-coordinate for the pixel, and x contains an x-coordinate. In the next lesson, [Lesson 7: Screen 02][7], we will look at one of the most common drawing tasks, lines. + +-------------------------------------------------------------------------------- + +via: https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/screen01.html + +作者:[Alex Chadwick][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.cl.cam.ac.uk +[b]: https://github.com/lujun9972 +[1]: https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/images/colour1bImage.png +[2]: https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/images/colour8gImage.png +[3]: https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/images/colour3bImage.png +[4]: https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/images/colour8bImage.png +[5]: https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/images/colour16bImage.png +[6]: https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/images/colour24bImage.png +[7]: https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/screen02.html From 2f1ff5ba667c1b32599d06fc983ff9282b3082a9 Mon Sep 17 00:00:00 2001 From: darksun Date: Wed, 23 Jan 2019 10:42:16 +0800 Subject: [PATCH 082/243] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020150616=20Comput?= =?UTF-8?q?er=20Laboratory=20=E2=80=93=20Raspberry=20Pi:=20Lesson=207=20Sc?= =?UTF-8?q?reen02=20sources/tech/20150616=20Computer=20Laboratory=20-=20Ra?= =?UTF-8?q?spberry=20Pi-=20Lesson=207=20Screen02.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...atory - Raspberry Pi- Lesson 7 Screen02.md | 449 ++++++++++++++++++ 1 file changed, 449 insertions(+) create mode 100644 sources/tech/20150616 Computer Laboratory - Raspberry Pi- Lesson 7 Screen02.md diff --git a/sources/tech/20150616 Computer Laboratory - Raspberry Pi- Lesson 7 Screen02.md b/sources/tech/20150616 Computer Laboratory - Raspberry Pi- Lesson 7 Screen02.md new file mode 100644 index 0000000000..3a8fe60f6f --- /dev/null +++ b/sources/tech/20150616 Computer Laboratory - Raspberry Pi- Lesson 7 Screen02.md @@ -0,0 +1,449 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Computer Laboratory – Raspberry Pi: Lesson 7 Screen02) +[#]: via: (https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/screen02.html) +[#]: author: (Alex Chadwick https://www.cl.cam.ac.uk) + +Computer Laboratory – Raspberry Pi: Lesson 7 Screen02 +====== + +The Screen02 lesson builds on Screen01, by teaching how to draw lines and also a small feature on generating pseudo random numbers. It is assumed you have the code for the [Lesson 6: Screen01][1] operating system as a basis. + +### 1 Dots + +Now that we've got the screen working, it is only natural to start waiting to create sensible images. It would be very nice indeed if we were able to actually draw something. One of the most basic components in all drawings is a line. If we were able to draw a line between any two points on the screen, we could start creating more complicated drawings just using combinations of these lines. + +``` +To allow complex drawing, some systems use a colouring function rather than just one colour to draw things. Each pixel calls the colouring function to determine what colour to draw there. +``` + +We will attempt to implement this in assembly code, but first we could really use some other functions to help. We need a function I will call SetPixel that changes the colour of a particular pixel, supplied as inputs in r0 and r1. It will be helpful for future if we write code that could draw to any memory, not just the screen, so first of all, we need some system to control where we are actually going to draw to. I think that the best way to do this would be to have a piece of memory which stores where we are going to draw to. What we should end up with is a stored address which normally points to the frame buffer structure from last time. We will use this at all times in our drawing method. That way, if we want to draw to a different image in another part of our operating system, we could make this value the address of a different structure, and use the exact same code. For simplicity we will use another piece of data to control the colour of our drawings. + +Copy the following code to a new file called 'drawing.s'. + +``` +.section .data +.align 1 +foreColour: +.hword 0xFFFF + +.align 2 +graphicsAddress: +.int 0 + +.section .text +.globl SetForeColour +SetForeColour: +cmp r0,#0x10000 +movhs pc,lr +ldr r1,=foreColour +strh r0,[r1] +mov pc,lr + +.globl SetGraphicsAddress +SetGraphicsAddress: +ldr r1,=graphicsAddress +str r0,[r1] +mov pc,lr +``` + +This is just the pair of functions that I described above, along with their data. We will use them in 'main.s' before drawing anything to control where and what we are drawing. + +``` +Building generic methods like SetPixel which we can build other methods on top of is a useful idea. We have to make sure the method is fast though, since we will use it a lot. +``` + +Our next task is to implement a SetPixel method. This needs to take two parameters, the x and y co-ordinate of a pixel, and it should use the graphicsAddress and foreColour we have just defined to control exactly what and where it is drawing. If you think you can implement this immediately, do, if not I shall outline the steps to be taken, and then give an example implementation. + + 1. Load in the graphicsAddress. + 2. Check that the x and y co-ordinates of the pixel are less than the width and height. + 3. Compute the address of the pixel to write. (hint: frameBufferAddress + (x + y core.md Dict.md lctt2014.md lctt2016.md lctt2018.md LICENSE published README.md scripts sources translated width) * pixel size) + 4. Load in the foreColour. + 5. Store it at the address. + + + +An implementation of the above follows. + +1. +``` +.globl DrawPixel +DrawPixel: +px .req r0 +py .req r1 +addr .req r2 +ldr addr,=graphicsAddress +ldr addr,[addr] +``` + +2. +``` +height .req r3 +ldr height,[addr,#4] +sub height,#1 +cmp py,height +movhi pc,lr +.unreq height + +width .req r3 +ldr width,[addr,#0] +sub width,#1 +cmp px,width +movhi pc,lr +``` + +Remember that the width and height are stored at offsets of 0 and 4 into the frame buffer description respectively. You can refer back to 'frameBuffer.s' if necessary. + +3. +``` +ldr addr,[addr,#32] +add width,#1 +mla px,py,width,px +.unreq width +.unreq py +add addr, px,lsl #1 +.unreq px +``` + +``` +mla dst,reg1,reg2,reg3 multiplies the values from reg1 and reg2, adds the value from reg3 and places the least significant 32 bits of the result in dst. +``` + +Admittedly, this code is specific to high colour frame buffers, as I use a bit shift directly to compute this address. You may wish to code a version of this function without the specific requirement to use high colour frame buffers, remembering to update the SetForeColour code. It may be significantly more complicated to implement. + +4. +``` +fore .req r3 +ldr fore,=foreColour +ldrh fore,[fore] +``` + +As above, this is high colour specific. + +5. +``` +strh fore,[addr] +.unreq fore +.unreq addr +mov pc,lr +``` + +As above, this is high colour specific. + + + + +### 2 Lines + +The trouble is, line drawing isn't quite as simple as you may expect. By now you must realise that when making operating system, we have to do almost everything ourselves, and line drawing is no exception. I suggest for a few minutes you have a think about how you would draw a line between any two points. + +``` +When programming normally, we tend to be lazy with things like division. Operating Systems must be incredibly efficient, and so we must focus on doing things as best as possible. +``` + +I expect the central idea of most strategies will involve computing the gradient of the line, and stepping along it. This sounds perfectly reasonable, but is actually a terrible idea. The problem with it is it involves division, which is something that we know can't easily be done in assembly, and also keeping track of decimal numbers, which is again difficult. There is, in fact, an algorithm called Bresenham's Algorithm, which is perfect for assembly code because it only involves addition, subtraction and bit shifts. +``` +Let's start off by defining a reasonably straightforward line drawing algorithm as follows: + +if x1 > x0 then + +set deltax to x1 - x0 +set stepx to +1 + +otherwise + +set deltax to x0 - x1 +set stepx to -1 + +end if + +if y1 > y0 then + +set deltay to y1 - y0 +set stepy to +1 + +otherwise + +set deltay to y0 - y1 +set stepy to -1 + +end if + +if deltax > deltay then + +set error to 0 +until x0 = x1 + stepx + +setPixel(x0, y0) +set error to error + deltax ÷ deltay +if error ≥ 0.5 then + +set y0 to y0 + stepy +set error to error - 1 + +end if +set x0 to x0 + stepx + +repeat + +otherwise + +end if + +This algorithm is a representation of the sort of thing you may have imagined. The variable error keeps track of how far away from the actual line we are. Every step we take along the x axis increases this error, and every time we move down the y axis, the error decreases by 1 unit again. The error is measured as a distance along the y axis. + +While this algorithm works, it suffers a major problem in that we clearly have to use decimal numbers to store error, and also we have to do a division. An immediate optimisation would therefore be to change the units of error. There is no need to store it in any particular units, as long as we scale every use of it by the same amount. Therefore, we could rewrite the algorithm simply by multiplying all equations involving error by deltay, and simplifying the result. Just showing the main loop: + +set error to 0 × deltay +until x0 = x1 + stepx + +setPixel(x0, y0) +set error to error + deltax ÷ deltay × deltay +if error ≥ 0.5 × deltay then + +set y0 to y0 + stepy +set error to error - 1 × deltay + +end if +set x0 to x0 + stepx + +repeat + +Which simplifies to: + +set error to 0 +until x0 = x1 + stepx + +setPixel(x0, y0) +set error to error + deltax +if error × 2 ≥ deltay then + +set y0 to y0 + stepy +set error to error - deltay + +end if +set x0 to x0 + stepx + +repeat + +Suddenly we have a much better algorithm. We see now that we've eliminated the need for division altogether. Better still, the only multiplication is by 2, which we know is just a bit shift left by 1! This is now very close to Bresenham's Algorithm, but one further optimisation can be made. At the moment, we have an if statement which leads to two very similar blocks of code, one for lines with larger x differences, and one for lines with larger y differences. It is worth checking if the code could be converted to a single statement for both types of line. + +The difficulty arises somewhat in that in the first case, error is to do with y, and in the second case error is to do with x. The solution is to track the error in both variables simultaneously, using negative error to represent an error in x, and positive error in y. + +set error to deltax - deltay +until x0 = x1 + stepx or y0 = y1 + stepy + +setPixel(x0, y0) +if error × 2 > -deltay then + +set x0 to x0 + stepx +set error to error - deltay + +end if +if error × 2 < deltax then + +set y0 to y0 + stepy +set error to error + deltax + +end if + +repeat + +It may take some time to convince yourself that this actually works. At each step, we consider if it would be correct to move in x or y. We do this by checking if the magnitude of the error would be lower if we moved in the x or y co-ordinates, and then moving if so. +``` + +``` +Bresenham's Line Algorithm was developed in 1962 by Jack Elton Bresenham, 24 at the time, whilst studying for a PhD. +``` + +Bresenham's Algorithm for drawing a line can be described by the following pseudo code. Pseudo code is just text which looks like computer instructions, but is actually intended for programmers to understand algorithms, rather than being machine readable. + +``` +/* We wish to draw a line from (x0,y0) to (x1,y1), using only a function setPixel(x,y) which draws a dot in the pixel given by (x,y). */ +if x1 > x0 then + set deltax to x1 - x0 + set stepx to +1 +otherwise + set deltax to x0 - x1 + set stepx to -1 +end if + +set error to deltax - deltay +until x0 = x1 + stepx or y0 = y1 + stepy + setPixel(x0, y0) + if error × 2 ≥ -deltay then + set x0 to x0 + stepx + set error to error - deltay + end if + if error × 2 ≤ deltax then + set y0 to y0 + stepy + set error to error + deltax + end if +repeat +``` + +Rather than numbered lists as I have used so far, this representation of an algorithm is far more common. See if you can implement this yourself. For reference, I have provided my implementation below. + +``` +.globl DrawLine +DrawLine: +push {r4,r5,r6,r7,r8,r9,r10,r11,r12,lr} +x0 .req r9 +x1 .req r10 +y0 .req r11 +y1 .req r12 + +mov x0,r0 +mov x1,r2 +mov y0,r1 +mov y1,r3 + +dx .req r4 +dyn .req r5 /* Note that we only ever use -deltay, so I store its negative for speed. (hence dyn) */ +sx .req r6 +sy .req r7 +err .req r8 + +cmp x0,x1 +subgt dx,x0,x1 +movgt sx,#-1 +suble dx,x1,x0 +movle sx,#1 + +cmp y0,y1 +subgt dyn,y1,y0 +movgt sy,#-1 +suble dyn,y0,y1 +movle sy,#1 + +add err,dx,dyn +add x1,sx +add y1,sy + +pixelLoop$: + + teq x0,x1 + teqne y0,y1 + popeq {r4,r5,r6,r7,r8,r9,r10,r11,r12,pc} + + mov r0,x0 + mov r1,y0 + bl DrawPixel + + cmp dyn, err,lsl #1 + addle err,dyn + addle x0,sx + + cmp dx, err,lsl #1 + addge err,dx + addge y0,sy + + b pixelLoop$ + +.unreq x0 +.unreq x1 +.unreq y0 +.unreq y1 +.unreq dx +.unreq dyn +.unreq sx +.unreq sy +.unreq err +``` + +### 3 Randomness + +So, now we can draw lines. Although we could use this to draw pictures and whatnot (feel free to do so!), I thought I would take the opportunity to introduce the idea of computer randomness. What we will do is select a pair of random co-ordinates, and then draw a line from the last pair to that point in steadily incrementing colours. I do this purely because it looks quite pretty. + +``` +Hardware random number generators are occasionally used in security, where the predictability sequence of random numbers may affect the security of some encryption. +``` + +So, now it comes down to it, how do we be random? Unfortunately for us there isn't some device which generates random numbers (such devices are very rare). So somehow using only the operations we've learned so far we need to invent 'random numbers'. It shouldn't take you long to realise this is impossible. The operations always have well defined results, executing the same sequence of instructions with the same registers yields the same answer. What we instead do is deduce a sequence that is pseudo random. This means numbers that, to the outside observer, look random, but in fact were completely determined. So, we need a formula to generate random numbers. One might be tempted to just spam mathematical operators out for example: 4x2! / 64, but in actuality this generally produces low quality random numbers. In this case for example, if x were 0, the answer would be 0. Stupid though it sounds, we need a very careful choice of equation to produce high quality random numbers. + +``` +This sort of discussion often begs the question what do we mean by a random number? We generally mean statistical randomness: A sequence of numbers that has no obvious patterns or properties that could be used to generalise it. +``` + +The method I'm going to teach you is called the quadratic congruence generator. This is a good choice because it can be implemented in 5 instructions, and yet generates a seemingly random order of the numbers from 0 to 232-1. + +The reason why the generator can create such long sequence with so few instructions is unfortunately a little beyond the scope of this course, but I encourage the interested to research it. It all centralises on the following quadratic formula, where xn is the nth random number generated. + +x_(n+1) = ax_(n)^2 + bx_(n) + c mod 2^32 + +Subject to the following constraints: + + 1. a is even + + 2. b = a + 1 mod 4 + + 3. c is odd + + + + +If you've not seen mod before, it means the remainder of a division by the number after it. For example b = a + 1 mod 4 means that b is the remainder of dividing a + 1 by 4, so if a were 12 say, b would be 1 as a + 1 is 13, and 13 divided by 4 is 3 remainder 1. + +Copy the following code into a file called 'random.s'. + +``` +.globl Random +Random: +xnm .req r0 +a .req r1 + +mov a,#0xef00 +mul a,xnm +mul a,xnm +add a,xnm +.unreq xnm +add r0,a,#73 + +.unreq a +mov pc,lr +``` + +This is an implementation of the random function, with an input of the last value generated in r0, and an output of the next number. In my case, I've used a = EF0016, b = 1, c = 73. This choice was arbitrary but meets the requirements above. Feel free to use any numbers you wish instead, as long as they obey the rules. + +### 4 Pi-casso + +OK, now we have all the functions we're going to need, let's try it out. Alter main to do the following, after getting the frame buffer info address: + + 1. Call SetGraphicsAddress with r0 containing the frame buffer info address. + 2. Set four registers to 0. One will be the last random number, one will be the colour, one will be the last x co-ordinate and one will be the last y co-ordinate. + 3. Call random to generate the next x-coordinate, using the last random number as the input. + 4. Call random again to generate the next y-coordinate, using the x-coordinate you generated as an input. + 5. Update the last random number to contain the y-coordinate. + 6. Call SetForeColour with the colour, then increment the colour. If it goes above FFFF16, make sure it goes back to 0. + 7. The x and y coordinates we have generated are between 0 and FFFFFFFF16. Convert them to a number between 0 and 102310 by using a logical shift right of 22. + 8. Check the y coordinate is on the screen. Valid y coordinates are between 0 and 76710. If not, go back to 3. + 9. Draw a line from the last x and y coordinates to the current x and y coordinates. + 10. Update the last x and y coordinates to contain the current ones. + 11. Go back to 3. + + + +As always, a solution for this can be found on the downloads page. + +Once you've finished, test it on the Raspberry Pi. You should see a very fast sequence of random lines being drawn on the screen, in steadily incrementing colours. This should never stop. If it doesn't work, please see our troubleshooting page. + +When you have it working, congratulations! We've now learned about meaningful graphics, and also about random numbers. I encourage you to play with line drawing, as it can be used to render almost anything you want. You may also want to explore more complicated shapes. Most can be made out of lines, but is this necessarily the best strategy? If you like the line program, try experimenting with the SetPixel function. What happens if instead of just setting the value of the pixel, you increase it by a small amount? What other patterns can you make? In the next lesson, [Lesson 8: Screen 03][2], we will look at the invaluable skill of drawing text. + +-------------------------------------------------------------------------------- + +via: https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/screen02.html + +作者:[Alex Chadwick][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.cl.cam.ac.uk +[b]: https://github.com/lujun9972 +[1]: https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/screen01.html +[2]: https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/screen03.html From 615a43e453c78e1cb2ed1c680eaa0fac980d5634 Mon Sep 17 00:00:00 2001 From: Auk7F7 <34982730+Auk7F7@users.noreply.github.com> Date: Wed, 23 Jan 2019 14:15:40 +0800 Subject: [PATCH 083/243] Create 20181128 Arch-Audit - A Tool To Check Vulnerable Packages In Arch Linux.md --- ...Check Vulnerable Packages In Arch Linux.md | 128 ++++++++++++++++++ 1 file changed, 128 insertions(+) create mode 100644 translated/tech/20181128 Arch-Audit - A Tool To Check Vulnerable Packages In Arch Linux.md diff --git a/translated/tech/20181128 Arch-Audit - A Tool To Check Vulnerable Packages In Arch Linux.md b/translated/tech/20181128 Arch-Audit - A Tool To Check Vulnerable Packages In Arch Linux.md new file mode 100644 index 0000000000..2580b53a3d --- /dev/null +++ b/translated/tech/20181128 Arch-Audit - A Tool To Check Vulnerable Packages In Arch Linux.md @@ -0,0 +1,128 @@ +[#]: collector: "lujun9972" +[#]: translator: " " +[#]: reviewer: " " +[#]: publisher: " " +[#]: subject: "Arch-Audit : A Tool To Check Vulnerable Packages In Arch Linux" +[#]: via: "https://www.2daygeek.com/arch-audit-a-tool-to-check-vulnerable-packages-in-arch-linux/" +[#]: author: "Prakash Subramanian https://www.2daygeek.com/author/prakash/" +[#]: url: " " + +Arch-Audit : 一款在 Arch Linux 上检查易受攻击包的工具 +====== + +我们必须经常更新我们的系统以减少宕机时间和问题。 + +每月给系统打一次补丁,60天一次或者最多90天一次,这是 Linux 管理员的例行任务之一。 + +这将是忙碌的工作计划,我们不能在不到一个月内做到这一点,因为它涉及到多种活动和环境。 + +基本上,基础架构与测试、开发、 QA (即分段和产品开发环境)一起提供。 + +最初,我们会在测试环境中部署补丁,相应的团队将监视系统一周,然后他们将给出一份比如好的或坏的状态报告。 + +如果它是成功的话,我们将会在其他环境中继续测试,若正常运行,那么最后我们会给生产服务器打上补丁。 + +许多组织已经准备好给整个系统打上补丁。我的意思是全部系统的更新,这是一种对于基础设施的常规修补计划。 + +在一些基础结构中,他们可能只有生产环境,因此,我们不应该为完整的系统更新做好准备,而是可以使用安全修补程序来使系统更加稳定和安全。 + +由于 Arch Linux 及其衍发行版本属于滚动更新版本,因此可以认为他们始终是最新的,因为它使用上游软件包的最新版本。 + +在某些情况下,如果要单独更新安全修补程序 ,则必须使用 arch-audit 工具来标识和修复安全修补程序。 + +### 漏洞是什么? + +漏洞是软件程序或硬件组件(固件)中的安全漏洞。这是一个可以让它容易受到攻击的缺陷。 + +为了缓解这种情况,我们需要相应地修补,就像应用程序/硬件一样,它可能是代码更改或配置更改或参数更改。 + +### Arch-Audit 工具是什么? + +[Arch-audit][1] 是一个类似于 Arch Linux 的 pkg-audit 工具。它使用了令人称赞的 Arch 安全小组收集的数据。他不会扫描并发现系统中易受攻击的包,如 **yum –security check-update & yum updateinfo list available**,它只需解析 页面并在终端中显示结果,因此,它将显示准确的数据。 + +Arch 安全小组是一群以跟踪 Arch Linux 软件包的安全问题为目的的志愿者。所有问题都在 Arch 安全追踪者的监视下。. + +该小组以前被称为 Arch CVE 监测小组,Arch 安全小组的使命是为提高 Arch Linux 的安全性做出贡献。 + +### 如何在 Arch Linux 上安装 Arch-Audit 工具 + +arch-audit 工具已经存在社区源中,所以你可以使用 Pacman 包管理器来安装它。 + +``` +$ sudo pacman -S arch-audit +``` + +运行 `arch-audit` 工具以查找在基于 Arch 的发行版本上的开放且易受攻击的包。 + +``` +$ arch-audit +Package cairo is affected by CVE-2017-7475. Low risk! +Package exiv2 is affected by CVE-2017-11592, CVE-2017-11591, CVE-2017-11553, CVE-2017-17725, CVE-2017-17724, CVE-2017-17723, CVE-2017-17722. Medium risk! +Package libtiff is affected by CVE-2018-18661, CVE-2018-18557, CVE-2017-9935, CVE-2017-11613. High risk!. Update to 4.0.10-1! +Package openssl is affected by CVE-2018-0735, CVE-2018-0734. Low risk! +Package openssl-1.0 is affected by CVE-2018-5407, CVE-2018-0734. Low risk! +Package patch is affected by CVE-2018-6952, CVE-2018-1000156. High risk!. Update to 2.7.6-7! +Package pcre is affected by CVE-2017-11164. Low risk! +Package systemd is affected by CVE-2018-6954, CVE-2018-15688, CVE-2018-15687, CVE-2018-15686. Critical risk!. Update to 239.300-1! +Package unzip is affected by CVE-2018-1000035. Medium risk! +Package webkit2gtk is affected by CVE-2018-4372. Critical risk!. Update to 2.22.4-1! +``` + +上述结果显示了系统的脆弱性风险状况,比如:低、中和严重三种情况。 + +若要仅显示易受攻击的包及其版本,请执行以下操作。 + +``` +$ arch-audit -q +cairo +exiv2 +libtiff>=4.0.10-1 +openssl +openssl-1.0 +patch>=2.7.6-7 +pcre +systemd>=239.300-1 +unzip +webkit2gtk>=2.22.4-1 +``` + +仅显示已修复的包。 + +``` +$ arch-audit --upgradable --quiet +libtiff>=4.0.10-1 +patch>=2.7.6-7 +systemd>=239.300-1 +webkit2gtk>=2.22.4-1 +``` + +为了交叉检查上述结果,我将测试在 列出的一个包以确认漏洞是否仍处于开放状态或已修复。是的,它已经被修复了,并于昨天在社区源中发布了更新后的包。 + +![][3] + +仅打印包名称和其相关的 CVE。 + +``` +$ arch-audit -uf "%n|%c" +libtiff|CVE-2018-18661,CVE-2018-18557,CVE-2017-9935,CVE-2017-11613 +patch|CVE-2018-6952,CVE-2018-1000156 +systemd|CVE-2018-6954,CVE-2018-15688,CVE-2018-15687,CVE-2018-15686 +webkit2gtk|CVE-2018-4372 +``` + +-------------------------------------------------------------------------------- + +via: https://www.2daygeek.com/arch-audit-a-tool-to-check-vulnerable-packages-in-arch-linux/ + +作者:[Prakash Subramanian][a] +选题:[lujun9972][b] +译者:[Auk7F7](https://github.com/Auk7F7) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.2daygeek.com/author/prakash/ +[b]: https://github.com/lujun9972 +[1]: https://github.com/ilpianista/arch-audit +[2]: data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7 +[3]: https://www.2daygeek.com/wp-content/uploads/2018/11/A-Tool-To-Check-Vulnerable-Packages-In-Arch-Linux.png From 2d141244a46ce79e48cbcf43b43cc1a4d9309e2c Mon Sep 17 00:00:00 2001 From: Auk7F7 <34982730+Auk7F7@users.noreply.github.com> Date: Wed, 23 Jan 2019 14:16:15 +0800 Subject: [PATCH 084/243] Delete 20181128 Arch-Audit - A Tool To Check Vulnerable Packages In Arch Linux.md --- ...Check Vulnerable Packages In Arch Linux.md | 128 ------------------ 1 file changed, 128 deletions(-) delete mode 100644 sources/tech/20181128 Arch-Audit - A Tool To Check Vulnerable Packages In Arch Linux.md diff --git a/sources/tech/20181128 Arch-Audit - A Tool To Check Vulnerable Packages In Arch Linux.md b/sources/tech/20181128 Arch-Audit - A Tool To Check Vulnerable Packages In Arch Linux.md deleted file mode 100644 index d359a4f57c..0000000000 --- a/sources/tech/20181128 Arch-Audit - A Tool To Check Vulnerable Packages In Arch Linux.md +++ /dev/null @@ -1,128 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( Auk7F7) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: subject: (Arch-Audit : A Tool To Check Vulnerable Packages In Arch Linux) -[#]: via: (https://www.2daygeek.com/arch-audit-a-tool-to-check-vulnerable-packages-in-arch-linux/) -[#]: author: (Prakash Subramanian https://www.2daygeek.com/author/prakash/) -[#]: url: ( ) - - -Arch-Audit : A Tool To Check Vulnerable Packages In Arch Linux -====== - -We have to make the system up-to date to minimize the downtime and issues. - -It’s one of the routine task for Linux administrator to patch the system once in a month or 60 days once or 90 days at maximum. - -It would be sufficient schedule and we can’t do it this less than a month as it’s involve multiple activities and environments. - -Basically infrastructure comes with Test, Development, QA a.k.a Staging & Prod environments. - -Initially we will deploy the patches in the Test environment and corresponding team will be monitoring the system a week then they will give a status report like good or bad. - -If it’s success then we will move forward to other environments. If everything is good then finally we will patch production servers. - -Many of the organization has prepare to patch entire system. i mean full system update. It is a general patching schedule for a typical infrastructure. - -In some of the infrastructure they may have only production environment so, we should not prepare for the full system update instead we can go with security patch to make the system more stable and secure. - -Since Arch Linux and its derivatives distributions are fall under rolling release can be considered to be always up-to-date, as it uses the latest versions of software packages from the upstream. - -In some cases if you want to update security patch alone then you have to use arch-audit tool to identify and fix the security patches. - -### What is a Vulnerability? - -A vulnerability is a security weakness in a software program or hardware components (firmware). It’s a flaw that can leave it open to attack. - -To mitigate this we need to patch accordingly like for application/hardware it could be a code changes or config changes or parameter changes. - -### What is Arch-Audit Tool? - -[Arch-audit][1] is a tool like pkg-audit for Arch Linux system. It Uses data collected by the awesome Arch Security Team. It wont scan and find the vulnerable packages on your system like **yum –security check-update & yum updateinfo list available** and it will simply parse the page and display the results in terminal. So, it would show the accurate data. - -The Arch Security Team is a group of volunteers whose goal is to track security issues with Arch Linux packages. All issues are tracked on the Arch Linux security tracker. - -The team was formerly known as the Arch CVE Monitoring Team. The mission of the Arch Security Team is to contribute to the improvement of the security of Arch Linux. - -### How to Install arch-audit tool in Arch Linux - -The arch-audit tool is available in community repository so you can use the Pacman Package Manager to install it. - -``` -$ sudo pacman -S arch-audit -``` - -Run the `arch-audit` tool to find the open vulnerable packages on Arch based distributions. - -``` -$ arch-audit -Package cairo is affected by CVE-2017-7475. Low risk! -Package exiv2 is affected by CVE-2017-11592, CVE-2017-11591, CVE-2017-11553, CVE-2017-17725, CVE-2017-17724, CVE-2017-17723, CVE-2017-17722. Medium risk! -Package libtiff is affected by CVE-2018-18661, CVE-2018-18557, CVE-2017-9935, CVE-2017-11613. High risk!. Update to 4.0.10-1! -Package openssl is affected by CVE-2018-0735, CVE-2018-0734. Low risk! -Package openssl-1.0 is affected by CVE-2018-5407, CVE-2018-0734. Low risk! -Package patch is affected by CVE-2018-6952, CVE-2018-1000156. High risk!. Update to 2.7.6-7! -Package pcre is affected by CVE-2017-11164. Low risk! -Package systemd is affected by CVE-2018-6954, CVE-2018-15688, CVE-2018-15687, CVE-2018-15686. Critical risk!. Update to 239.300-1! -Package unzip is affected by CVE-2018-1000035. Medium risk! -Package webkit2gtk is affected by CVE-2018-4372. Critical risk!. Update to 2.22.4-1! -``` - -The above result shows the vulnerability risk status as well such as Low, Medium and Critical. - -To Show only vulnerable package names and their versions. - -``` -$ arch-audit -q -cairo -exiv2 -libtiff>=4.0.10-1 -openssl -openssl-1.0 -patch>=2.7.6-7 -pcre -systemd>=239.300-1 -unzip -webkit2gtk>=2.22.4-1 -``` - -To show only packages that have already been fixed. - -``` -$ arch-audit --upgradable --quiet -libtiff>=4.0.10-1 -patch>=2.7.6-7 -systemd>=239.300-1 -webkit2gtk>=2.22.4-1 -``` - -To cross check the above results, i’m going to test one of the package which is listed above in to confirm whether the vulnerability is still open or fixed it. Yes, it’s fixed and published the updated package in repository on yesterday. -![][3] - -To print only package names and associated CVEs alone. - -``` -$ arch-audit -uf "%n|%c" -libtiff|CVE-2018-18661,CVE-2018-18557,CVE-2017-9935,CVE-2017-11613 -patch|CVE-2018-6952,CVE-2018-1000156 -systemd|CVE-2018-6954,CVE-2018-15688,CVE-2018-15687,CVE-2018-15686 -webkit2gtk|CVE-2018-4372 -``` - --------------------------------------------------------------------------------- - -via: https://www.2daygeek.com/arch-audit-a-tool-to-check-vulnerable-packages-in-arch-linux/ - -作者:[Prakash Subramanian][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://www.2daygeek.com/author/prakash/ -[b]: https://github.com/lujun9972 -[1]: https://github.com/ilpianista/arch-audit -[2]: data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7 -[3]: https://www.2daygeek.com/wp-content/uploads/2018/11/A-Tool-To-Check-Vulnerable-Packages-In-Arch-Linux.png From 2b20806b1d9f8eb22c07c418ca050ac37075af96 Mon Sep 17 00:00:00 2001 From: darksun Date: Wed, 23 Jan 2019 14:34:36 +0800 Subject: [PATCH 085/243] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020150616=20Comput?= =?UTF-8?q?er=20Laboratory=20=E2=80=93=20Raspberry=20Pi:=20Lesson=208=20Sc?= =?UTF-8?q?reen03=20sources/tech/20150616=20Computer=20Laboratory=20-=20Ra?= =?UTF-8?q?spberry=20Pi-=20Lesson=208=20Screen03.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...atory - Raspberry Pi- Lesson 8 Screen03.md | 485 ++++++++++++++++++ 1 file changed, 485 insertions(+) create mode 100644 sources/tech/20150616 Computer Laboratory - Raspberry Pi- Lesson 8 Screen03.md diff --git a/sources/tech/20150616 Computer Laboratory - Raspberry Pi- Lesson 8 Screen03.md b/sources/tech/20150616 Computer Laboratory - Raspberry Pi- Lesson 8 Screen03.md new file mode 100644 index 0000000000..08803fd50f --- /dev/null +++ b/sources/tech/20150616 Computer Laboratory - Raspberry Pi- Lesson 8 Screen03.md @@ -0,0 +1,485 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Computer Laboratory – Raspberry Pi: Lesson 8 Screen03) +[#]: via: (https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/screen03.html) +[#]: author: (Alex Chadwick https://www.cl.cam.ac.uk) + +Computer Laboratory – Raspberry Pi: Lesson 8 Screen03 +====== + +The Screen03 lesson builds on Screen02, by teaching how to draw text, and also a small feature on the command line arguments of the operating system. It is assumed you have the code for the [Lesson 7: Screen02][1] operating system as a basis. + +### 1 String Theory + +So, our task for this operating system is to draw text. We have several problems to address, the most pressing of which is probably about storing text. Unbelievably text has been one of the biggest flaws on computers to date. What should have been a straightforward type of data has brought down operating systems, crippled otherwise wonderful encryption, and caused many problems for users of different alphabets. Nevertheless, it is an incredibly important type of data, as it is an excellent link between the computer and the user. Text can be sufficiently structured that the operating system understands it, as well as sufficiently readable that humans can use it. + +``` +Variable data types such as text require much more complex handling. +``` + +So how exactly is text stored? Simply enough, we have some system by which we give each letter a unique number, and then store a sequence of such numbers. Sounds easy. The problem is that the number of numbers is not fixed. Some pieces of text are longer than others. With storing ordinary numbers, we have some fixed limit, e.g. 32 bits, and then we can't go beyond that, we write methods that use numbers of that length, etc. In terms of text, or strings as we often call it, we want to write functions that work on variable length strings, otherwise we would need a lot of functions! This is not a problem for numbers normally, as there are only a few common number formats (byte, word, half, double). + +``` +Buffer overrun attacks have plagued computers for years. Recently, the Wii, Xbox and Playstation 2 all suffered buffer overrun attacks, as well as large systems like Microsoft's Web and Database servers. +``` + +So, how do we determine how long the string is? I think the obvious answer is just to store how long the string is, and then to store the characters that make it up. This is called length prefixing, as the length comes before the string. Unfortunately, the pioneers of computer science did not agree. They felt it made more sense to have a special character called the null terminator (denoted \0) which represents when a string ends. This does indeed simplify many string algorithms, as you just keep working until the null terminator. Unfortunately this is the source of many security issues. What if a malicious user gives you a very long string? What if you didn't have enough space to store it. You might run a string copying function that copies until the null terminator, but because the string is so long, it overwrites your program. This may sound far fetched, but nevertheless, such buffer overrun attacks are incredibly common. Length prefixing mitigates this problem as it is easy to deduce the size of the buffer required to store the string. As an operating system developer, I leave it to you to decide how best to store text. + +The next thing we need to establish is how best to map characters to numbers. Fortunately, this is reasonably well standardised, so you have two major choices, Unicode and ASCII. Unicode maps almost every single useful symbol that can be written to a number, in exchange for having a lot more numbers, and a more complicated encoding system. ASCII uses one byte per character, and so only stores the Latin alphabet, numbers, a few symbols and a few special characters. Thus, ASCII is very easy to implement, compared to Unicode, in which not every character takes the same space, making string algorithms tricky. Normally operating systems use ASCII for strings which will not be displayed to end users (but perhaps to developers or experts), and Unicode for displaying messages to users, as Unicode can support things like Japanese characters, and so could be localised. + +Fortunately for us, this decision is irrelevant at the moment, as the first 128 characters of both are exactly the same, and are encoded exactly the same. + +Table 1.1 ASCII/Unicode symbols 0-127 + +| | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | a | b | c | d | e | f | | +|----| --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | ----| +| 00 | NUL | SOH | STX | ETX | EOT | ENQ | ACK | BEL | BS | HT | LF | VT | FF | CR | SO | SI | | +| 10 | DLE | DC1 | DC2 | DC3 | DC4 | NAK | SYN | ETB | CAN | EM | SUB | ESC | FS | GS | RS | US | | +| 20 | ! | " | # | $ | % | & | . | ( | ) | * | + | , | - | . | / | | | +| 30 | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | : | ; | < | = | > | ? | | +| 40 | @ | A | B | C | D | E | F | G | H | I | J | K | L | M | N | O | | +| 50 | P | Q | R | S | T | U | V | W | X | Y | Z | [ | \ | ] | ^ | _ | | +| 60 | ` | a | b | c | d | e | f | g | h | i | j | k | l | m | n | o | | +| 70 | p | q | r | s | t | u | v | w | x | y | z | { | | | } | ~ | DEL | + +The table shows the first 128 symbols. The hexadecimal representation of the number for a symbol is the row value added to the column value, for example A is 4116. What you may find surprising is the first two rows, and the very last value. These 33 special characters are not printed at all. In fact, these days, many are ignored. They exist because ASCII was originally intended as a system for transmitting data over computer networks, and so a lot more information than just the symbols had to be sent. The key special symbols that you should learn are NUL, the null terminator character I mentioned before, HT, horizontal tab is what we normally refer to as a tab and LF, the line feed character is used to make a new line. You may wish to research and use the other characters for special meanings in your operating system. + +### 2 Characters + +So, now that we know a bit about strings, we can start to think about how they're displayed. The fundamental thing we need to do in order to be able to display a string is to be able to display a character. Our first task will be making a DrawCharacter function which takes in a character to draw and a location, and then draws the character. + +``` +The true type font format used in many Operating Systems is so powerful, it has its own assembly language built in to ensure letters look correct at any resolution. +``` + +Naturally, this leads to a discussion about fonts. We already know there are many ways to display any given letter in accordance with font choice. So how does a font work? In the very early days of computer science, a font was just a series of little pictures of all the letters, called a bitmap font, and all the draw character method would do is copy one of the pictures to the screen. The trouble with this is when people want to resize the text. Sometimes we need big letters, and sometimes small. Although we could keep drawing new pictures for every font at every size with every character, this would get tedious. Thus, vector fonts were invented. in vector fonts, rather than containing an image of the font, the font file contains a description of how to draw it, e.g. an 'o' could be circle with radius half that of the maximum letter height. Modern operating systems use such fonts almost exclusively, as they are perfect at any resolution. + +Unfortunately, much though I would love to include an implementation of one of the vector font formats, it would take up the remainder of this website. Thus, we will implement a bitmap font, though if you wish to make a decent graphical operating system, a vector font would be useful. +``` +00000000 +00000000 +00000000 +00010000 +00101000 +00101000 +00101000 +01000100 +01000100 +01111100 +11000110 +10000010 +00000000 +00000000 +00000000 +00000000 +``` + +On the downloads page, I have included several '.bin' files in the font section. These are just raw binary data files for a few fonts. For this tutorial, pick your favourite from the monospace, monochrome, 8x16 section. Download it and store it in the 'source' directory as 'font.bin'. These files are just monochrome images of each of the letters in turn, with each letter being exactly 8 by 16 pixels. Thus, each takes 16 bytes, the first byte being the top row, the second the next, etc. + +The diagram shows the 'A' character in the monospace, monochrome, 8x16 font Bitstream Vera Sans Mono. In the file, we would find this starting at the 4116 × 1016 = 41016th byte as the following sequence in hexadecimal: + +00, 00, 00, 10, 28, 28, 28, 44, 44, 7C, C6, 82, 00, 00, 00, 00 + +We're going to use a monospace font here, because in a monospace font every character is the same size. Unfortunately, yet another complication with most fonts is that the character's widths vary, leading to more complex display code. I've included a few other fonts on the downloads page, as well as an explanation of the format I've stored them all in. + +So let's get down to business. Copy the following to 'drawing.s' after the .int 0 of graphicsAddress. + +``` +.align 4 +font: +.incbin "font.bin" +``` + +``` +.incbin "file" inserts the binary data from the file file. +``` + +This code copies the font data from the file to the address labelled font. We've used an .align 4 here to ensure each character starts on a multiple of 16 bytes, which can be used for a speed trick later. + +Now we want to write the draw character method. I'll give the pseudo code for this, so you can try to implement it yourself if you want to. Conventionally >> means logical shift right. + +``` +function drawCharacter(r0 is character, r1 is x, r2 is y) + if character > 127 then exit + set charAddress to font + character × 16 + for row = 0 to 15 + set bits to readByte(charAddress + row) + for bit = 0 to 7 + if test(bits >> bit, 0x1) + then setPixel(x + bit, y + row) + next + next + return r0 = 8, r1 = 16 +end function + +``` +If implemented directly, this is deliberately not very efficient. With things like drawing characters, efficiency is a top priority, as we will do it a lot. Let's explore some improvements that bring this closer to optimal assembly code. Firstly, we have a × 16, which by now you should spot is the same as a logical shift left by 4 places. Next we have a variable row, which is only ever added to charAddress and to y. Thus, we can eliminate it by increasing these variables instead. The only issue now is how to tell when we've finished. This is where the .align 4 comes in handy. We know that charAddress will start with the low nibble containing 0. This means we can see how far into the character data we are by checking that low nibble. + +Though we can eliminate the need for bits, we must introduce a new variable to do so, so it is best left in. The only other improvement that can be made is to remove the nested bits >> bit. + +``` +function drawCharacter(r0 is character, r1 is x, r2 is y) + if character > 127 then exit + set charAddress to font + character << 4 + loop + set bits to readByte(charAddress) + set bit to 8 + loop + set bits to bits << 1 + set bit to bit - 1 + if test(bits, 0x100) + then setPixel(x + bit, y) + until bit = 0 + set y to y + 1 + set chadAddress to chadAddress + 1 + until charAddress AND 0b1111 = 0 + return r0 = 8, r1 = 16 +end function +``` + +Now we've got code that is much closer to assembly code, and is near optimal. Below is the assembly code version of the above. + +``` +.globl DrawCharacter +DrawCharacter: +cmp r0,#127 +movhi r0,#0 +movhi r1,#0 +movhi pc,lr + +push {r4,r5,r6,r7,r8,lr} +x .req r4 +y .req r5 +charAddr .req r6 +mov x,r1 +mov y,r2 +ldr charAddr,=font +add charAddr, r0,lsl #4 + +lineLoop$: + + bits .req r7 + bit .req r8 + ldrb bits,[charAddr] + mov bit,#8 + + charPixelLoop$: + + subs bit,#1 + blt charPixelLoopEnd$ + lsl bits,#1 + tst bits,#0x100 + beq charPixelLoop$ + + add r0,x,bit + mov r1,y + bl DrawPixel + + teq bit,#0 + bne charPixelLoop$ + + charPixelLoopEnd$: + .unreq bit + .unreq bits + add y,#1 + add charAddr,#1 + tst charAddr,#0b1111 + bne lineLoop$ + +.unreq x +.unreq y +.unreq charAddr + +width .req r0 +height .req r1 +mov width,#8 +mov height,#16 + +pop {r4,r5,r6,r7,r8,pc} +.unreq width +.unreq height +``` + +### 3 Strings + +Now that we can draw characters, we can draw text. We need to make a method that, for a given string, draws each character in turn, at incrementing positions. To be nice, we shall also implement new lines and tabs. It's decision time as far as null terminators are concerned, and if you want to make your operating system use them, feel free by changing the code below. To avoid the issue, I will have the length of the string passed as an argument to the DrawString function, along with the address of the string, and the x and y coordinates. + +``` +function drawString(r0 is string, r1 is length, r2 is x, r3 is y) + set x0 to x + for pos = 0 to length - 1 + set char to loadByte(string + pos) + set (cwidth, cheight) to DrawCharacter(char, x, y) + if char = '\n' then + set x to x0 + set y to y + cheight + otherwise if char = '\t' then + set x1 to x + until x1 > x0 + set x1 to x1 + 5 × cwidth + loop + set x to x1 + otherwise + set x to x + cwidth + end if + next +end function +``` + +Once again, this function isn't that close to assembly code. Feel free to try to implement it either directly or by simplifying it. I will give the simplification and then the assembly code below. + +Clearly the person who wrote this function wasn't being very efficient (me in case you were wondering). Once again we have a pos variable that just increments and is added to something else, which is completely unnecessary. We can remove it, and instead simultaneously decrement length until it is 0, saving the need for one register. The rest of the function is probably fine, except for that annoying multiplication by five. A key thing to do here would be to move the multiplication outside the loop; multiplication is slow even with bit shifts, and since we're always adding the same constant multiplied by 5, there is no need to recompute this. It can in fact be implemented in one operation using the argument shifting in assembly code, so I shall rephrase it like that. + +``` +function drawString(r0 is string, r1 is length, r2 is x, r3 is y) + set x0 to x + until length = 0 + set length to length - 1 + set char to loadByte(string) + set (cwidth, cheight) to DrawCharacter(char, x, y) + if char = '\n' then + set x to x0 + set y to y + cheight + otherwise if char = '\t' then + set x1 to x + set cwidth to cwidth + cwidth << 2 + until x1 > x0 + set x1 to x1 + cwidth + loop + set x to x1 + otherwise + set x to x + cwidth + end if + set string to string + 1 + loop +end function +``` + +In assembly code: + +``` +.globl DrawString +DrawString: +x .req r4 +y .req r5 +x0 .req r6 +string .req r7 +length .req r8 +char .req r9 +push {r4,r5,r6,r7,r8,r9,lr} + +mov string,r0 +mov x,r2 +mov x0,x +mov y,r3 +mov length,r1 + +stringLoop$: + subs length,#1 + blt stringLoopEnd$ + + ldrb char,[string] + add string,#1 + + mov r0,char + mov r1,x + mov r2,y + bl DrawCharacter + cwidth .req r0 + cheight .req r1 + + teq char,#'\n' + moveq x,x0 + addeq y,cheight + beq stringLoop$ + + teq char,#'\t' + addne x,cwidth + bne stringLoop$ + + add cwidth, cwidth,lsl #2 + x1 .req r1 + mov x1,x0 + + stringLoopTab$: + add x1,cwidth + cmp x,x1 + bge stringLoopTab$ + mov x,x1 + .unreq x1 + b stringLoop$ +stringLoopEnd$: +.unreq cwidth +.unreq cheight + +pop {r4,r5,r6,r7,r8,r9,pc} +.unreq x +.unreq y +.unreq x0 +.unreq string +.unreq length +``` + +``` +subs reg,#val subtracts val from the register reg and compares the result with 0. +``` + +This code makes clever use of a new operation, subs which subtracts one number from another, stores the result and then compares it with 0. In truth, all comparisons are implemented as a subtraction and then comparison with 0, but the result is normally discarded. This means that this operation is as fast as cmp. + +### 4 Your Wish is My Command Line + +Now that we can print strings, the challenge is to find an interesting one to draw. Normally in tutorials such as this, people just draw "Hello World!", but after all we've done so far, I feel that is a little patronising (feel free to do so if it helps). Instead we're going to draw our command line. + +A convention has been made for computers running ARM. When they boot, it is important they are given certain information about what they have available to them. Most all processors have some way of ascertaining this information, and on ARM this is by data left at the address 10016. The format of the data is as follows: + + 1. The data is broken down into a series of 'tags'. + 2. There are nine types of tag: 'core', 'mem', 'videotext', 'ramdisk', 'initrd2', 'serial' 'revision', 'videolfb', 'cmdline'. + 3. Each can only appear once, but all but the 'core' tag don't have to appear. + 4. The tags are placed from 0x100 in order one after the other. + 5. The end of the list of tags always contains 2 words which are 0. + 6. Every tag's size in bytes is a multiple of 4. + 7. Each tag starts with the size of the tag in words in the tag, including this number. + 8. This is followed by a half word containing the tag's number. These are numbered from 1 in the order above ('core' is 1, 'cmdline' is 9). + 9. This is followed by a half word containing 544116. + 10. After this comes the data of the tag, which varies depending on the tag. The size of the data in words + 2 is always the same as the length mentioned above. + 11. A 'core' tag is either 2 or 5 words in length. If it is 2, there is no data, if it is 5, it has 3 words. + 12. A 'mem' tag is always 4 words in length. The data is the first address in a block of memory, and the length of that block. + 13. A 'cmdline' tag contains a null terminated string which is the parameters of the kernel. + + +``` +Almost all Operating Systems support the notion of programs having a 'command line'. The idea is to provide a common mechanism for choosing the desired behaviour of the program. +``` + +On the current version of the Raspberry Pi, only the 'core', 'mem' and 'cmdline' tags are present. You may find these useful later, and a more complete reference for these is on our Raspberry Pi reference page. The one we're interested in at the moment is the 'cmdline' tag, because it contains a string. We're going to write some code to search for the command line tag, and, if found, to print it out with each item on a new line. The command line is just a list of things that either the graphics processor or the user thought it might be nice for the Operating System to know. On the Raspberry Pi, this includes the MAC Address, serial number and screen resolution. The string itself is just a list of expressions such as 'key.subkey=value' separated by spaces. + +Let's start by finding the 'cmdline' tag. In a new file called 'tags.s' copy the following code. + +``` +.section .data +tag_core: .int 0 +tag_mem: .int 0 +tag_videotext: .int 0 +tag_ramdisk: .int 0 +tag_initrd2: .int 0 +tag_serial: .int 0 +tag_revision: .int 0 +tag_videolfb: .int 0 +tag_cmdline: .int 0 +``` + +Looking through the list of tags will be a slow operation, as it involves a lot of memory access. Therefore, we only want to have to do it once. This code creates some data which will store the memory address of the first tag of each of the types. Then, to find a tag the following pseudo code will suffice. + +``` +function FindTag(r0 is tag) + if tag > 9 or tag = 0 then return 0 + set tagAddr to loadWord(tag_core + (tag - 1) × 4) + if not tagAddr = 0 then return tagAddr + if readWord(tag_core) = 0 then return 0 + set tagAddr to 0x100 + loop forever + set tagIndex to readHalfWord(tagAddr + 4) + if tagIndex = 0 then return FindTag(tag) + if readWord(tag_core+(tagIndex-1)×4) = 0 + then storeWord(tagAddr, tag_core+(tagIndex-1)×4) + set tagAddr to tagAddr + loadWord(tagAddr) × 4 + end loop +end function +``` +This code is already quite well optimised and close to assembly. It is optimistic in that the first thing it tries is loading the tag directly, as all but the first time this should be the case. If that fails, it checks if the core tag has an address. Since there must always be a core tag, the only reason that it would not have an address is if it doesn't exist. If it does have an address, the tag we were looking for didn't. If it doesn't we need to find the addresses of all the tags. It does this by reading the number of the tag. If it is zero, that must mean we are at the end of the list. This means we've now filled in all the tags in our directory. Therefore if we run our function again, it will now be able to produce an answer. If the tag number is not zero, we check to see if this tag type already has an address. If not, we store the address of this tag in our directory. We then add the length of this tag in bytes to the tag address to find the next tag. + +Have a go at implementing this code in assembly. You will need to simplify it. If you get stuck, my answer is below. Don't forget the .section .text! + +``` +.section .text +.globl FindTag +FindTag: +tag .req r0 +tagList .req r1 +tagAddr .req r2 + +sub tag,#1 +cmp tag,#8 +movhi tag,#0 +movhi pc,lr + +ldr tagList,=tag_core +tagReturn$: +add tagAddr,tagList, tag,lsl #2 +ldr tagAddr,[tagAddr] + +teq tagAddr,#0 +movne r0,tagAddr +movne pc,lr + +ldr tagAddr,[tagList] +teq tagAddr,#0 +movne r0,#0 +movne pc,lr + +mov tagAddr,#0x100 +push {r4} +tagIndex .req r3 +oldAddr .req r4 +tagLoop$: +ldrh tagIndex,[tagAddr,#4] +subs tagIndex,#1 +poplt {r4} +blt tagReturn$ + +add tagIndex,tagList, tagIndex,lsl #2 +ldr oldAddr,[tagIndex] +teq oldAddr,#0 +.unreq oldAddr +streq tagAddr,[tagIndex] + +ldr tagIndex,[tagAddr] +add tagAddr, tagIndex,lsl #2 +b tagLoop$ + +.unreq tag +.unreq tagList +.unreq tagAddr +.unreq tagIndex +``` + +### 5 Hello World + +Now that we have everything we need, we can draw our first string. In 'main.s' delete everything after bl SetGraphicsAddress, and replace it with the following: + +``` +mov r0,#9 +bl FindTag +ldr r1,[r0] +lsl r1,#2 +sub r1,#8 +add r0,#8 +mov r2,#0 +mov r3,#0 +bl DrawString +loop$: +b loop$ +``` + +This code simply uses our FindTag method to find the 9th tag (cmdline) and then calculates its length and passes the command and the length to the DrawString method, and tells it to draw the string at 0,0. Now test this on the Raspberry Pi. You should see a line of text on the screen. If not please see our troubleshooting page. + +Once it works, congratulations you've now got the ability to draw text. But there is still room for improvement. What if we wanted to write out a number, or a section of the memory or manipulate our command line? In [Lesson 9: Screen04][2], we will look at manipulating text and displaying useful numbers and information. + +-------------------------------------------------------------------------------- + +via: https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/screen03.html + +作者:[Alex Chadwick][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.cl.cam.ac.uk +[b]: https://github.com/lujun9972 +[1]: https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/screen02.html +[2]: https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/screen04.html From 26c1ec55c15bde7f1a836041ae0b350ae5e72727 Mon Sep 17 00:00:00 2001 From: darksun Date: Wed, 23 Jan 2019 14:55:54 +0800 Subject: [PATCH 086/243] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020150616=20Comput?= =?UTF-8?q?er=20Laboratory=20=E2=80=93=20Raspberry=20Pi:=20Lesson=209=20Sc?= =?UTF-8?q?reen04=20sources/tech/20150616=20Computer=20Laboratory=20-=20Ra?= =?UTF-8?q?spberry=20Pi-=20Lesson=209=20Screen04.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...atory - Raspberry Pi- Lesson 9 Screen04.md | 540 ++++++++++++++++++ 1 file changed, 540 insertions(+) create mode 100644 sources/tech/20150616 Computer Laboratory - Raspberry Pi- Lesson 9 Screen04.md diff --git a/sources/tech/20150616 Computer Laboratory - Raspberry Pi- Lesson 9 Screen04.md b/sources/tech/20150616 Computer Laboratory - Raspberry Pi- Lesson 9 Screen04.md new file mode 100644 index 0000000000..1ca2a16609 --- /dev/null +++ b/sources/tech/20150616 Computer Laboratory - Raspberry Pi- Lesson 9 Screen04.md @@ -0,0 +1,540 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Computer Laboratory – Raspberry Pi: Lesson 9 Screen04) +[#]: via: (https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/screen04.html) +[#]: author: (Alex Chadwick https://www.cl.cam.ac.uk) + +Computer Laboratory – Raspberry Pi: Lesson 9 Screen04 +====== + +The Screen04 lesson builds on Screen03, by teaching how to manipulate text. It is assumed you have the code for the [Lesson 8: Screen03][1] operating system as a basis. + +### 1 String Manipulation + +``` +Variadic functions look much less intuitive in assembly code. Nevertheless, they are useful and powerful concepts. +``` + +Being able to draw text is lovely, but unfortunately at the moment you can only draw strings which are already prepared. This is fine for displaying something like the command line, but ideally we would like to be able to display and text we so desire. As per usual, if we put the effort in and make an excellent function that does all the string manipulation we could ever want, we get much easier code later on in return. Once such complicated function in C programming is sprintf. This function generates a string based on a description given as another string and additional arguments. What is interesting about this function is that it is variadic. This means that it takes a variable number of parameters. The number of parameters depends on the exact format string, and so cannot be determined in advance. + +The full function has many options, and I list a few here. I've highlighted the ones which we will implement in this tutorial, though you can try to implement more. + +The function works by reading the format string, and then interpreting it using the table below. Once an argument is used, it is not considered again. The return value of the function is the number of characters written. If the method fails, a negative number is returned. + +Table 1.1 sprintf formatting rules +| Sequence | Meaning | +| ---------------------- | ---------------------- | +| Any character except % | Copies the character to the output. | +| %% | Writes a % character to the output. | +| %c | Writes the next argument as a character. | +| %d or %i | Writes the next argument as a base 10 signed integer. | +| %e | Writes the next argument in scientific notation using eN to mean ×10N. | +| %E | Writes the next argument in scientific notation using EN to mean ×10N. | +| %f | Writes the next argument as a decimal IEEE 754 floating point number. | +| %g | Same as the shorter of %e and %f. | +| %G | Same as the shorter of %E and %f. | +| %o | Writes the next argument as a base 8 unsigned integer. | +| %s | Writes the next argument as if it were a pointer to a null terminated string. | +| %u | Writes the next argument as a base 10 unsigned integer. | +| %x | Writes the next argument as a base 16 unsigned integer, with lowercase a,b,c,d,e and f. | +| %X | Writes the next argument as a base 16 unsigned integer, with uppercase A,B,C,D,E and F. | +| %p | Writes the next argument as a pointer address. | +| %n | Writes nothing. Copies instead the number of characters written so far to the location addressed by the next argument. | + +Further to the above, many additional tweaks exist to the sequences, such as specifying minimum length, signs, etc. More information can be found at [sprintf - C++ Reference][2]. + +Here are a few examples of calls to the method and their results to illustrate its use. + +Table 1.2 sprintf example calls +| Format String | Arguments | Result | +| "%d" | 13 | "13" | +| "+%d degrees" | 12 | "+12 degrees" | +| "+%x degrees" | 24 | "+1c degrees" | +| "'%c' = 0%o" | 65, 65 | "'A' = 0101" | +| "%d * %d%% = %d" | 200, 40, 80 | "200 * 40% = 80" | +| "+%d degrees" | -5 | "+-5 degrees" | +| "+%u degrees" | -5 | "+4294967291 degrees" | + +Hopefully you can already begin to see the usefulness of the function. It does take a fair amount of work to program, but our reward is a very general function we can use for all sorts of purposes. + +### 2 Division + +``` +Division is the slowest and most complicated of the basic mathematical operators. It is not implemented directly in ARM assembly code because it takes so long to deduce the answer, and so isn't a 'simple' operation. +``` + +While this function does look very powerful, it also looks very complicated. The easiest way to deal with its many cases is probably to write functions to deal with some common tasks it has. What would be useful would be a function to generate the string for a signed and an unsigned number in any base. So, how can we go about doing that? Try to devise an algorithm quickly before reading on. + +The easiest way is probably the exact way I mentioned in [Lesson 1: OK01][3], which is the division remainder method. The idea is the following: + + 1. Divide the current value by the base you're working in. + 2. Store the remainder. + 3. If the new value is not 0, go to 1. + 4. Reverse the order of the remainders. This is the answer. + + + +For example: + +Table 2.1 Example base 2 +conversion +| Value | New Value | Remainder | +| ----- | --------- | --------- | +| 137 | 68 | 1 | +| 68 | 34 | 0 | +| 34 | 17 | 0 | +| 17 | 8 | 1 | +| 8 | 4 | 0 | +| 4 | 2 | 0 | +| 2 | 1 | 0 | +| 1 | 0 | 1 | + +So the answer is 100010012 + +The unfortunate part about this procedure is that it unavoidably uses division. Therefore, we must first contemplate division in binary. + +For a refresher on long division expand the box below. + +``` +Let's suppose we wish to divide 4135 by 17. + + 0243 r 4 +17)4135 + 0 0 × 17 = 0000 + 4135 4135 - 0 = 4135 + 34 200 × 17 = 3400 + 735 4135 - 3400 = 735 + 68 40 × 17 = 680 + 55 735 - 680 = 55 + 51 3 × 17 = 51 + 4 55 - 51 = 4 + Answer: 243 remainder 4 + +First of all we would look at the top digit of the dividend. We see that the smallest multiple of the divisor which is less or equal to it is 0. We output a 0 to the result. + +Next we look at the second to top digit of the dividend and all higher digits. We see the smallest multiple of the divisor which is less than or equal is 34. We output a 2 and subtract 3400. + +Next we look at the third digit of the dividend and all higher digits. The smallest multiple of the divisor that is less than or equal to this is 68. We output 4 and subtract 680. + +Finally we look at all remaining digits. We see that the lowest multiple of the divisor that is less than the remaining digits is 51. We output a 3, subtract 51. The result of the subtraction is our remainder. +``` + +To implement division in assembly code, we will implement binary long division. We do this because the numbers are stored in binary, which gives us easy access to the all important bit shift operations, and because division in binary is simpler than in any higher base due to the much lower number of cases. + +``` + 1011 r 1 +1010)1101111 + 1010 + 11111 + 1010 + 1011 + 1010 + 1 +This example shows how binary long division works. You simply shift the divisor as far right as possible without exceeding the dividend, output a 1 according to the poisition and subtract the number. Whatever remains is the remainder. In this case we show 11011112 ÷ 10102 = 10112 remainder 12. In decimal, 111 ÷ 10 = 11 remainder 1. +``` + + +Try to implement long division yourself now. You should write a function, DivideU32 which divides r0 by r1, returning the result in r0, and the remainder in r1. Below, we will go through a very efficient implementation. + +``` +function DivideU32(r0 is dividend, r1 is divisor) + set shift to 31 + set result to 0 + while shift ≥ 0 + if dividend ≥ (divisor << shift) then + set dividend to dividend - (divisor << shift) + set result to result + 1 + end if + set result to result << 1 + set shift to shift - 1 + loop + return (result, dividend) +end function +``` + +This code does achieve what we need, but would not work as assembly code. Our problem comes from the fact that our registers only hold 32 bits, and so the result of divisor << shift may not fit in a register (we call this overflow). This is a real problem. Did your solution have overflow? + +Fortunately, an instruction exists called clz or count leading zeros, which counts the number of zeros in the binary representation of a number starting at the top bit. Conveniently, this is exactly the number of times we can shift the register left before overflow occurs. Another optimisation you may spot is that we compute divisor << shift twice each loop. We could improve upon this by shifting the divisor at the beginning, then shifting it down at the end of each loop to avoid any need to shift it elsewhere. + +Let's have a look at the assembly code to make further improvements. + +``` +.globl DivideU32 +DivideU32: +result .req r0 +remainder .req r1 +shift .req r2 +current .req r3 + +clz shift,r1 +lsl current,r1,shift +mov remainder,r0 +mov result,#0 + +divideU32Loop$: + cmp shift,#0 + blt divideU32Return$ + cmp remainder,current + + addge result,result,#1 + subge remainder,current + sub shift,#1 + lsr current,#1 + lsl result,#1 + b divideU32Loop$ +divideU32Return$: +.unreq current +mov pc,lr + +.unreq result +.unreq remainder +.unreq shift +``` + +``` +clz dest,src stores the number of zeros from the top to the first one of register dest to register src +``` + +You may, quite rightly, think that this looks quite efficient. It is pretty good, but division is a very expensive operation, and one we may wish to do quite often, so it would be good if we could improve the speed in any way. When looking to optimise code with a loop in it, it is always important to consider how many times the loop must run. In this case, the loop will run a maximum of 31 times for an input of 1. Without making special cases, this could often be improved easily. For example when dividing 1 by 1, no shift is required, yet we shift the divisor to each of the positions above it. This could be improved by simply using the new clz command on the dividend and subtracting this from the shift. In the case of 1 ÷ 1, this means shift would be set to 0, rightly indicating no shift is required. If this causes the shift to be negative, the divisor is bigger than the dividend and so we know the result is 0 remainder the dividend. Another quick check we could make is if the current value is ever 0, then we have a perfect division and can stop looping. + +``` +.globl DivideU32 +DivideU32: +result .req r0 +remainder .req r1 +shift .req r2 +current .req r3 + +clz shift,r1 +clz r3,r0 +subs shift,r3 +lsl current,r1,shift +mov remainder,r0 +mov result,#0 +blt divideU32Return$ + +divideU32Loop$: + cmp remainder,current + blt divideU32LoopContinue$ + + add result,result,#1 + subs remainder,current + lsleq result,shift + beq divideU32Return$ +divideU32LoopContinue$: + subs shift,#1 + lsrge current,#1 + lslge result,#1 + bge divideU32Loop$ + +divideU32Return$: +.unreq current +mov pc,lr + +.unreq result +.unreq remainder +.unreq shift +``` + +Copy the code above to a file called 'maths.s'. + +### 3 Number Strings + +Now that we can do division, let's have another look at implementing number to string conversion. The following is pseudo code to convert numbers from registers into strings in up to base 36. By convention, a % b means the remainder of dividing a by b. + +``` +function SignedString(r0 is value, r1 is dest, r2 is base) + if value ≥ 0 + then return UnsignedString(value, dest, base) + otherwise + if dest > 0 then + setByte(dest, '-') + set dest to dest + 1 + end if + return UnsignedString(-value, dest, base) + 1 + end if +end function + +function UnsignedString(r0 is value, r1 is dest, r2 is base) + set length to 0 + do + + set (value, rem) to DivideU32(value, base) + if rem > 10 + then set rem to rem + '0' + otherwise set rem to rem - 10 + 'a' + if dest > 0 + then setByte(dest + length, rem) + set length to length + 1 + + while value > 0 + if dest > 0 + then ReverseString(dest, length) + return length +end function + +function ReverseString(r0 is string, r1 is length) + set end to string + length - 1 + while end > start + set temp1 to readByte(start) + set temp2 to readByte(end) + setByte(start, temp2) + setByte(end, temp1) + set start to start + 1 + set end to end - 1 + end while +end function +``` + +In a file called 'text.s' implement the above. Remember that if you get stuck, a full solution can be found on the downloads page. + +### 4 Format Strings + +Let's get back to our string formatting method. Since we're programming our own operating system, we can add or change formatting rules as we please. We may find it useful to add a %b operation that outputs a number in binary, and if you're not using null terminated strings, you may wish to alter the behaviour of %s to take the length of the string from another argument, or from a length prefix if you wish. I will use a null terminator in the example below. + +One of the main obstacles to implementing this function is that the number of arguments varies. According to the ABI, additional arguments are pushed onto the stack before calling the method in reverse order. So, for example, if we wish to call our method with 8 parameters; 1,2,3,4,5,6,7 and 8, we would do the following: + + 1. Set r0 = 5, r1 = 6, r2 = 7, r3 = 8 + 2. Push {r0,r1,r2,r3} + 3. Set r0 = 1, r1 = 2, r2 = 3, r3 = 4 + 4. Call the function + 5. Add sp,#4*4 + + + +Now we must decide what arguments our function actually needs. In my case, I used the format string address in r0, the length of the format string in r1, the destination string address in r2, followed by the list of arguments required, starting in r3 and continuing on the stack as above. If you wish to use a null terminated format string, the parameter in r1 can be removed. If you wish to have a maximum buffer length, you could store this in r3. As an additional modification, I think it is useful to alter the function so that if the destination string address is 0, no string is outputted, but an accurate length is still returned, so that the length of a formatted string can be accurately determined. + +If you wish to attempt the implementation on your own, try it now. If not, I will first construct the pseudo code for the method, then give the assembly code implementation. + +``` +function StringFormat(r0 is format, r1 is formatLength, r2 is dest, ...) + set index to 0 + set length to 0 + while index < formatLength + if readByte(format + index) = '%' then + set index to index + 1 + if readByte(format + index) = '%' then + if dest > 0 + then setByte(dest + length, '%') + set length to length + 1 + otherwise if readByte(format + index) = 'c' then + if dest > 0 + then setByte(dest + length, nextArg) + set length to length + 1 + otherwise if readByte(format + index) = 'd' or 'i' then + set length to length + SignedString(nextArg, dest, 10) + otherwise if readByte(format + index) = 'o' then + set length to length + UnsignedString(nextArg, dest, 8) + otherwise if readByte(format + index) = 'u' then + set length to length + UnsignedString(nextArg, dest, 10) + otherwise if readByte(format + index) = 'b' then + set length to length + UnsignedString(nextArg, dest, 2) + otherwise if readByte(format + index) = 'x' then + set length to length + UnsignedString(nextArg, dest, 16) + otherwise if readByte(format + index) = 's' then + set str to nextArg + while getByte(str) != '\0' + if dest > 0 + then setByte(dest + length, getByte(str)) + set length to length + 1 + set str to str + 1 + loop + otherwise if readByte(format + index) = 'n' then + setWord(nextArg, length) + end if + otherwise + if dest > 0 + then setByte(dest + length, readByte(format + index)) + set length to length + 1 + end if + set index to index + 1 + loop + return length +end function +``` + +Although this function is massive, it is quite straightforward. Most of the code goes into checking all the various conditions, the code for each one is simple. Further, all the various unsigned integer cases are the same but for the base, and so can be summarised in assembly. This is given below. + +``` +.globl FormatString +FormatString: +format .req r4 +formatLength .req r5 +dest .req r6 +nextArg .req r7 +argList .req r8 +length .req r9 + +push {r4,r5,r6,r7,r8,r9,lr} +mov format,r0 +mov formatLength,r1 +mov dest,r2 +mov nextArg,r3 +add argList,sp,#7*4 +mov length,#0 + +formatLoop$: + subs formatLength,#1 + movlt r0,length + poplt {r4,r5,r6,r7,r8,r9,pc} + + ldrb r0,[format] + add format,#1 + teq r0,#'%' + beq formatArg$ + +formatChar$: + teq dest,#0 + strneb r0,[dest] + addne dest,#1 + add length,#1 + b formatLoop$ + +formatArg$: + subs formatLength,#1 + movlt r0,length + poplt {r4,r5,r6,r7,r8,r9,pc} + + ldrb r0,[format] + add format,#1 + teq r0,#'%' + beq formatChar$ + + teq r0,#'c' + moveq r0,nextArg + ldreq nextArg,[argList] + addeq argList,#4 + beq formatChar$ + + teq r0,#'s' + beq formatString$ + + teq r0,#'d' + beq formatSigned$ + + teq r0,#'u' + teqne r0,#'x' + teqne r0,#'b' + teqne r0,#'o' + beq formatUnsigned$ + + b formatLoop$ + +formatString$: + ldrb r0,[nextArg] + teq r0,#0x0 + ldreq nextArg,[argList] + addeq argList,#4 + beq formatLoop$ + add length,#1 + teq dest,#0 + strneb r0,[dest] + addne dest,#1 + add nextArg,#1 + b formatString$ + +formatSigned$: + mov r0,nextArg + ldr nextArg,[argList] + add argList,#4 + mov r1,dest + mov r2,#10 + bl SignedString + teq dest,#0 + addne dest,r0 + add length,r0 + b formatLoop$ + +formatUnsigned$: + teq r0,#'u' + moveq r2,#10 + teq r0,#'x' + moveq r2,#16 + teq r0,#'b' + moveq r2,#2 + teq r0,#'o' + moveq r2,#8 + + mov r0,nextArg + ldr nextArg,[argList] + add argList,#4 + mov r1,dest + bl UnsignedString + teq dest,#0 + addne dest,r0 + add length,r0 + b formatLoop$ +``` + +### 5 Convert OS + +Feel free to try using this method however you wish. As an example, here is the code to generate a conversion chart from base 10 to binary to hexadecimal to octal and to ASCII. + +Delete all code after bl SetGraphicsAddress in 'main.s' and replace it with the following: + +``` +mov r4,#0 +loop$: +ldr r0,=format +mov r1,#formatEnd-format +ldr r2,=formatEnd +lsr r3,r4,#4 +push {r3} +push {r3} +push {r3} +push {r3} +bl FormatString +add sp,#16 + +mov r1,r0 +ldr r0,=formatEnd +mov r2,#0 +mov r3,r4 + +cmp r3,#768-16 +subhi r3,#768 +addhi r2,#256 +cmp r3,#768-16 +subhi r3,#768 +addhi r2,#256 +cmp r3,#768-16 +subhi r3,#768 +addhi r2,#256 + +bl DrawString + +add r4,#16 +b loop$ + +.section .data +format: +.ascii "%d=0b%b=0x%x=0%o='%c'" +formatEnd: +``` + +Can you work out what will happen before testing? Particularly what happens for r3 ≥ 128? Try it on the Raspberry Pi to see if you're right. If it doesn't work, please see our troubleshooting page. + +When it does work, congratulations, you've completed the Screen04 tutorial, and reached the end of the screen series! We've learned about pixels and frame buffers, and how these apply to the Raspberry Pi. We've learned how to draw simple lines, and also how to draw characters, as well as the invaluable skill of formatting numbers into text. We now have all that you would need to make graphical output on an Operating System. Can you make some more drawing methods? What about 3D graphics? Can you implement a 24bit frame buffer? What about reading the size of the framebuffer in from the command line? + +The next series is the [Input][4] series, which teaches how to use the keyboard and mouse to really get towards a traditional console computer. + +-------------------------------------------------------------------------------- + +via: https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/screen04.html + +作者:[Alex Chadwick][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.cl.cam.ac.uk +[b]: https://github.com/lujun9972 +[1]: https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/screen03.html +[2]: http://www.cplusplus.com/reference/clibrary/cstdio/sprintf/ +[3]: https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/ok01.html +[4]: https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/input01.html From b79dda11b91bcbe885583daf02906da3762cb96a Mon Sep 17 00:00:00 2001 From: darksun Date: Wed, 23 Jan 2019 15:08:41 +0800 Subject: [PATCH 087/243] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020150616=20Comput?= =?UTF-8?q?er=20Laboratory=20=E2=80=93=20Raspberry=20Pi:=20Lesson=2010=20I?= =?UTF-8?q?nput01=20sources/tech/20150616=20Computer=20Laboratory=20-=20Ra?= =?UTF-8?q?spberry=20Pi-=20Lesson=2010=20Input01.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...atory - Raspberry Pi- Lesson 10 Input01.md | 494 ++++++++++++++++++ 1 file changed, 494 insertions(+) create mode 100644 sources/tech/20150616 Computer Laboratory - Raspberry Pi- Lesson 10 Input01.md diff --git a/sources/tech/20150616 Computer Laboratory - Raspberry Pi- Lesson 10 Input01.md b/sources/tech/20150616 Computer Laboratory - Raspberry Pi- Lesson 10 Input01.md new file mode 100644 index 0000000000..beb7613b2f --- /dev/null +++ b/sources/tech/20150616 Computer Laboratory - Raspberry Pi- Lesson 10 Input01.md @@ -0,0 +1,494 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Computer Laboratory – Raspberry Pi: Lesson 10 Input01) +[#]: via: (https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/input01.html) +[#]: author: (Alex Chadwick https://www.cl.cam.ac.uk) + +Computer Laboratory – Raspberry Pi: Lesson 10 Input01 +====== + +Welcome to the Input lesson series. In this series, you will learn how to receive inputs to the Raspberry Pi using the keyboard. We will start with just revealing the input, and then move to a more traditional text prompt. + +This first input lesson teaches some theory about drivers and linking, as well as about keyboards and ends up displaying text on the screen. + +### 1 Getting Started + +It is expected that you have completed the OK series, and it would be helpful to have completed the Screen series. Many of the files from that series will be called, without comment. If you do not have these files, or prefer to use a correct implementation, download the template for this lesson from the [Downloads][1] page. If you're using your own implementation, please remove everything after your call to SetGraphicsAddress. + +### 2 USB + +``` +The USB standard was designed to make simple hardware in exchange for complex software. +``` + +As you are no doubt aware, the Raspberry Pi model B has two USB ports, commonly used for connecting a mouse and keyboard. This was a very good design decision, USB is a very generic connector, and many different kinds of device use it. It's simple to build new devices for, simple to write device drivers for, and is highly extensible thanks to USB hubs. Could it get any better? Well, no, in fact for an Operating Systems developer this is our worst nightmare. The USB standard is huge. I really mean it this time, it is over 700 pages, before you've even thought about connecting a device. + +I spoke to a number of other hobbyist Operating Systems developers about this and they all say one thing: don't bother. "It will take too long to implement", "You won't be able to write a tutorial on it" and "It will be of little benefit". In many ways they are right, I'm not able to write a tutorial on the USB standard, as it would take weeks. I also can't teach how to write device drivers for all the different devices, so it is useless on its own. However, I can do the next best thing: Get a working USB driver, get a keyboard driver, and then teach how to use these in an Operating System. I set out searching for a free driver that would run in an operating system that doesn't even know what a file is yet, but I couldn't find one. They were all too high level. So, I attempted to write one. Everybody was right, this took weeks to do. However, I'm pleased to say I did get one that works with no external help from the Operating System, and can talk to a mouse and keyboard. It is by no means complete, efficient, or correct, but it does work. It has been written in C and the full source code can be found on the downloads page for those interested. + +So, this tutorial won't be a lesson on the USB standard (at all). Instead we'll look at how to work with other people's code. + +### 3 Linking + +``` +Linking allows us to make reusable code 'libraries' that anyone can use in their program. +``` + +Since we're about to incorporate external code into the Operating System, we need to talk about linking. Linking is a process which is applied to programs or Operating System to link in functions. What this means is that when a program is made, we don't necessarily code every function (almost certainly not in fact). Linking is what we do to make our program link to functions in other people's code. This has actually been going on all along in our Operating Systems, as the linker links together all of the different files, each of which is compiled separately. + +``` +Programs often just call libraries, which call other libraries and so on until eventually they call an Operating System library which we would write. +``` + +There are two types of linking: static and dynamic. Static linking is like what goes on when we make our Operating Systems. The linker finds all the addresses of the functions, and writes them into the code, before the program is finished. Dynamic linking is linking that occurs after the program is 'complete'. When it is loaded, the dynamic linker goes through the program and links any functions which are not in the program to libraries in the Operating System. This is one of the jobs our Operating System should eventually be capable of, but for now everything will be statically linked. + +The USB driver I have written is suitable for static linking. This means I give you the compiled code for each of my files, and then the linker finds functions in your code which are not defined in your code, and links them to functions in my code. On the [Downloads][1] page for this lesson is a makefile and my USB driver, which you will need to continue. Download them and replace the makefile in your code with this one, and also put the driver in the same folder as that makefile. + +### 4 Keyboards + +In order to get input into our Operating System, we need to understand at some level how keyboards actually work. Keyboards have two types of keys: Normal and Modifier keys. The normal keys are the letters, numbers, function keys, etc. They constitute almost every key on the keyboard. The modifiers are up to 8 special keys. These are left shift, right shift, left control, right control, left alt, right alt, left GUI and right GUI. The keyboard can detect any combination of the modifier keys being held, as well as up to 6 normal keys. Every time a key changes (i.e. is pushed or released), it reports this to the computer. Typically, keyboards also have three LEDs for Caps Lock, Num Lock and Scroll Lock, which are controlled by the computer, not the keyboard itself. Keyboards may have many more lights such as power, mute, etc. + +In order to help standardise USB keyboards, a table of values was produced, such that every keyboard key ever is given a unique number, as well as every conceivable LED. The table below lists the first 126 of values. + +Table 4.1 USB Keyboard Keys +| Number | Description | Number | Description | Number | Description | Number | Description | | +| ------ | ---------------- | ------- | ---------------------- | -------- | -------------- | --------------- | -------------------- | | +| 4 | a and A | 5 | b and B | 6 | c and C | 7 | d and D | | +| 8 | e and E | 9 | f and F | 10 | g and G | 11 | h and H | | +| 12 | i and I | 13 | j and J | 14 | k and K | 15 | l and L | | +| 16 | m and M | 17 | n and N | 18 | o and O | 19 | p and P | | +| 20 | q and Q | 21 | r and R | 22 | s and S | 23 | t and T | | +| 24 | u and U | 25 | v and V | 26 | w and W | 27 | x and X | | +| 28 | y and Y | 29 | z and Z | 30 | 1 and ! | 31 | 2 and @ | | +| 32 | 3 and # | 33 | 4 and $ | 34 | 5 and % | 35 | 6 and ^ | | +| 36 | 7 and & | 37 | 8 and * | 38 | 9 and ( | 39 | 0 and ) | | +| 40 | Return (Enter) | 41 | Escape | 42 | Delete (Backspace) | 43 | Tab | | +| 44 | Spacebar | 45 | - and _ | 46 | = and + | 47 | [ and { | | +| 48 | ] and } | 49 | \ and | | 50 | # and ~ | 51 | ; and : | +| 52 | ' and " | 53 | ` and ~ | 54 | , and < | 55 | . and > | | +| 56 | / and ? | 57 | Caps Lock | 58 | F1 | 59 | F2 | | +| 60 | F3 | 61 | F4 | 62 | F5 | 63 | F6 | | +| 64 | F7 | 65 | F8 | 66 | F9 | 67 | F10 | | +| 68 | F11 | 69 | F12 | 70 | Print Screen | 71 | Scroll Lock | | +| 72 | Pause | 73 | Insert | 74 | Home | 75 | Page Up | | +| 76 | Delete forward | 77 | End | 78 | Page Down | 79 | Right Arrow | | +| 80 | Left Arrow | 81 | Down Arrow | 82 | Up Arrow | 83 | Num Lock | | +| 84 | Keypad / | 85 | Keypad * | 86 | Keypad - | 87 | Keypad + | | +| 88 | Keypad Enter | 89 | Keypad 1 and End | 90 | Keypad 2 and Down Arrow | 91 | Keypad 3 and Page Down | | +| 92 | Keypad 4 and Left Arrow | 93 | Keypad 5 | 94 | Keypad 6 and Right Arrow | 95 | Keypad 7 and Home | | +| 96 | Keypad 8 and Up Arrow | 97 | Keypad 9 and Page Up | 98 | Keypad 0 and Insert | 99 | Keypad . and Delete | | +| 100 | \ and | | 101 | Application | 102 | Power | 103 | Keypad = | +| 104 | F13 | 105 | F14 | 106 | F15 | 107 | F16 | | +| 108 | F17 | 109 | F18 | 110 | F19 | 111 | F20 | | +| 112 | F21 | 113 | F22 | 114 | F23 | 115 | F24 | | +| 116 | Execute | 117 | Help | 118 | Menu | 119 | Select | | +| 120 | Stop | 121 | Again | 122 | Undo | 123 | Cut | | +| 124 | Copy | 125 | Paste | 126 | Find | 127 | Mute | | +| 128 | Volume Up | 129 | Volume Down | | | | | | + +The full list can be found in section 10, page 53 of [HID Usage Tables 1.12][2]. + +### 5 The Nut Behind the Wheel + +``` +These summaries and the code they describe form an API - Application Product Interface. +``` + +Normally, when you work with someone else's code, they provide a summary of their methods, what they do and roughly how they work, as well as how they can go wrong. Here is a table of the relevant instructions required to use my USB driver. + +Table 5.1 Keyboard related functions in CSUD +| Function | Arguments | Returns | Description | +| ----------------------- | ----------------------- | ----------------------- | ----------------------- | +| UsbInitialise | None | r0 is result code | This method is the all-in-one method that loads the USB driver, enumerates all devices and attempts to communicate with them. This method generally takes about a second to execute, though with a few USB hubs plugged in this can be significantly longer. After this method is completed methods in the keyboard driver become available, regardless of whether or not a keyboard is indeed inserted. Result code explained below. | +| UsbCheckForChange | None | None | Essentially provides the same effect as UsbInitialise, but does not provide the same one time initialisation. This method checks every port on every connected hub recursively, and adds new devices if they have been added. This should be very quick if there are no changes, but can take up to a few seconds if a hub with many devices is attached. | +| KeyboardCount | None | r0 is count | Returns the number of keyboards currently connected and detected. UsbCheckForChange may update this. Up to 4 keyboards are supported by default. Up to this many keyboards may be accessed through this driver. | +| KeyboardGetAddress | r0 is index | r0 is address | Retrieves the address of a given keyboard. All other functions take a keyboard address in order to know which keyboard to access. Thus, to communicate with a keyboard, first check the count, then retrieve the address, then use other methods. Note, the order of keyboards that this method returns may change after calls to UsbCheckForChange. | +| KeyboardPoll | r0 is address | r0 is result code | Reads in the current key state from the keyboard. This operates via polling the device directly, contrary to the best practice. This means that if this method is not called frequently enough, a key press could be missed. All reading methods simply return the value as of the last poll. | +| KeyboardGetModifiers | r0 is address | r0 is modifier state | Retrieves the status of the modifier keys as of the last poll. These are the shift, alt control and GUI keys on both sides. This is returned as a bit field, such that a 1 in the bit 0 means left control is held, bit 1 means left shift, bit 2 means left alt, bit 3 means left GUI and bits 4 to 7 mean the right versions of those previous. If there is a problem r0 contains 0. | +| KeyboardGetKeyDownCount | r0 is address | r0 is count | Retrieves the number of keys currently held down on the keyboard. This excludes modifier keys. Normally, this cannot go above 6. If there is an error this method returns 0. | +| KeyboardGetKeyDown | r0 is address, r1 is key number | r0 is scan code | Retrieves the scan code (see Table 4.1) of a particular held down key. Normally, to work out which keys are down, call KeyboardGetKeyDownCount and then call KeyboardGetKeyDown up to that many times with increasing values of r1 to determine which keys are down. Returns 0 if there is a problem. It is safe (but not recommended) to call this method without calling KeyboardGetKeyDownCount and interpret 0s as keys not held. Note, the order or scan codes can change randomly (some keyboards sort numerically, some sort temporally, no guarantees are made). | +| KeyboardGetKeyIsDown | r0 is address, r1 is scan code | r0 is status | Alternative to KeyboardGetKeyDown, checks if a particular scan code is among the held down keys. Returns 0 if not, or a non-zero value if so. Faster when detecting particular scan codes (e.g. looking for ctrl+c). On error, returns 0. | +| KeyboardGetLedSupport | r0 is address | r0 is LEDs | Checks which LEDs a particular keyboard supports. Bit 0 being 1 represents Number Lock, bit 1 represents Caps Lock, bit 2 represents Scroll Lock, bit 3 represents Compose, bit 4 represents Kana, bit 5 represents Power, bit 6 represents Mute and bit 7 represents Compose. As per the USB standard, none of these LEDs update automatically (e.g. Caps Lock must be set manually when the Caps Lock scan code is detected). | +| KeyboardSetLeds | r0 is address, r1 is LEDs | r0 is result code | Attempts to turn on/off the specified LEDs on the keyboard. See below for result code values. See KeyboardGetLedSupport for LEDs' values. | + +``` +Result codes are an easy way to handle errors, but often more elegant solutions exist in higher level code. +``` + +Several methods return 'result codes'. These are commonplace in C code, and are just numbers which represent what happened in a method call. By convention, 0 always indicates success. The following result codes are used by this driver. + +Table 5.2 - CSUD Result Codes +| Code | Description | +| ---- | ----------------------------------------------------------------------- | +| 0 | Method completed successfully. | +| -2 | Argument: A method was called with an invalid argument. | +| -4 | Device: The device did not respond correctly to the request. | +| -5 | Incompatible: The driver is not compatible with this request or device. | +| -6 | Compiler: The driver was compiled incorrectly, and is broken. | +| -7 | Memory: The driver ran out of memory. | +| -8 | Timeout: The device did not respond in the expected time. | +| -9 | Disconnect: The device requested has disconnected, and cannot be used. | + +The general usage of the driver is as follows: + + 1. Call UsbInitialise + 2. Call UsbCheckForChange + 3. Call KeyboardCount + 4. If this is 0, go to 2. + 5. For each keyboard you support: + 1. Call KeyboardGetAddress + 2. Call KeybordGetKeyDownCount + 3. For each key down: + 1. Check whether or not it has just been pushed + 2. Store that the key is down + 4. For each key stored: + 1. Check whether or not key is released + 2. Remove key if released + 6. Perform actions based on keys pushed/released + 7. Go to 2. + + + +Ultimately, you may do whatever you wish to with the keyboard, and these methods should allow you to access all of its functionality. Over the next 2 lessons, we shall look at completing the input side of a text terminal, similarly to most command line computers, and interpreting the commands. In order to do this, we're going to need to have keyboard inputs in a more useful form. You may notice that my driver is (deliberately) unhelpful, because it doesn't have methods to deduce whether or not a key has just been pushed down or released, it only has methods about what is currently held down. This means we'll need to write such methods ourselves. + +### 6 Updates Available + +Repeatedly checking for updates is called 'polling'. This is in contrast to interrupt driven IO, where the device sends a signal when data is ready. + +First of all, let's implement a method KeyboardUpdate which detects the first keyboard and uses its poll method to get the current input, as well as saving the last inputs for comparison. We can then use this data with other methods to translate scan codes to keys. The method should do precisely the following: + + 1. Retrieve a stored keyboard address (initially 0). + 2. If this is not 0, go to 9. + 3. Call UsbCheckForChange to detect new keyboards. + 4. Call KeyboardCount to detect how many keyboards are present. + 5. If this is 0 store the address as 0 and return; we can't do anything with no keyboard. + 6. Call KeyboardGetAddress with parameter 0 to get the first keyboard's address. + 7. Store this address. + 8. If this is 0, return; there is some problem. + 9. Call KeyboardGetKeyDown 6 times to get each key currently down and store them + 10. Call KeyboardPoll + 11. If the result is non-zero go to 3. There is some problem (such as disconnected keyboard). + + + +To store the values mentioned above, we will need the following values in the .data section. + +``` +.section .data +.align 2 +KeyboardAddress: +.int 0 +KeyboardOldDown: +.rept 6 +.hword 0 +.endr +``` + +``` +.hword num inserts the half word constant num into the file directly. +``` + +``` +.rept num [commands] .endr copies the commands commands to the output num times. +``` + +Try to implement the method yourself. My implementation for this is as follows: + +1. +``` +.section .text +.globl KeyboardUpdate +KeyboardUpdate: +push {r4,r5,lr} + +kbd .req r4 +ldr r0,=KeyboardAddress +ldr kbd,[r0] +``` +We load in the keyboard address. +2. +``` +teq kbd,#0 +bne haveKeyboard$ +``` +If the address is non-zero, we have a keyboard. Calling UsbCheckForChanges is slow, and so if everything works we avoid it. +3. +``` +getKeyboard$: +bl UsbCheckForChange +``` +If we don't have a keyboard, we have to check for new devices. +4. +``` +bl KeyboardCount +``` +Now we see if a new keyboard has been added. +5. +``` +teq r0,#0 +ldreq r1,=KeyboardAddress +streq r0,[r1] +beq return$ +``` +There are no keyboards, so we have no keyboard address. +6. +``` +mov r0,#0 +bl KeyboardGetAddress +``` +Let's just get the address of the first keyboard. You may want to allow more. +7. +``` +ldr r1,=KeyboardAddress +str r0,[r1] +``` +Store the keyboard's address. +8. +``` +teq r0,#0 +beq return$ +mov kbd,r0 +``` +If we have no address, there is nothing more to do. +9. +``` +saveKeys$: + mov r0,kbd + mov r1,r5 + bl KeyboardGetKeyDown + + ldr r1,=KeyboardOldDown + add r1,r5,lsl #1 + strh r0,[r1] + add r5,#1 + cmp r5,#6 + blt saveKeys$ +``` +Loop through all the keys, storing them in KeyboardOldDown. If we ask for too many, this returns 0 which is fine. + +10. +``` +mov r0,kbd +bl KeyboardPoll +``` +Now we get the new keys. + +11. +``` +teq r0,#0 +bne getKeyboard$ + +return$: +pop {r4,r5,pc} +.unreq kbd +``` +Finally we check if KeyboardPoll worked. If not, we probably disconnected. + + +With our new KeyboardUpdate method, checking for inputs becomes as simple as calling this method at regular intervals, and it will even check for disconnections etc. This is a useful method to have, as our actual key processing may differ based on the situation, and so being able to get the current input in its raw form with one method call is generally applicable. The next method we ideally want is KeyboardGetChar, a method that simply returns the next key pressed as an ASCII character, or returns 0 if no key has just been pressed. This could be extended to support typing a key multiple times if it is held for a certain duration, and to support the 'lock' keys as well as modifiers. + +To make this method it is useful if we have a method KeyWasDown, which simply returns 0 if a given scan code is not in the KeyboardOldDown values, and returns a non-zero value otherwise. Have a go at implementing this yourself. As always, a solution can be found on the downloads page. + +### 7 Look Up Tables + +``` +In many areas of programming, the larger the program, the faster it is. Look up tables are large, but are very fast. Some problems can be solved by a mixture of look up tables and normal functions. +``` + +The KeyboardGetChar method could be quite complex if we write it poorly. There are 100s of scan codes, each with different effects depending on the presence or absence of the shift key or other modifiers. Not all of the keys can be translated to a character. For some characters, multiple keys can produce the same character. A useful trick in situations with such vast arrays of possibilities is look up tables. A look up table, much like in the physical sense, is a table of values and their results. For some limited functions, the simplest way to deduce the answer is just to precompute every answer, and just return the correct one by retrieving it. In this case, we could build up a sequence of values in memory such that the nth value into the sequence is the ASCII character code for the scan code n. This means our method would simply have to detect if a key was pressed, and then retrieve its value from the table. Further, we could have a separate table for the values when shift is held, so that the shift key simply changes which table we're working with. + +After the .section .data command, copy the following tables: + +``` +.align 3 +KeysNormal: + .byte 0x0, 0x0, 0x0, 0x0, 'a', 'b', 'c', 'd' + .byte 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l' + .byte 'm', 'n', 'o', 'p', 'q', 'r', 's', 't' + .byte 'u', 'v', 'w', 'x', 'y', 'z', '1', '2' + .byte '3', '4', '5', '6', '7', '8', '9', '0' + .byte '\n', 0x0, '\b', '\t', ' ', '-', '=', '[' + .byte ']', '\\\', '#', ';', '\'', '`', ',', '.' + .byte '/', 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0 + .byte 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0 + .byte 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0 + .byte 0x0, 0x0, 0x0, 0x0, '/', '*', '-', '+' + .byte '\n', '1', '2', '3', '4', '5', '6', '7' + .byte '8', '9', '0', '.', '\\\', 0x0, 0x0, '=' + +.align 3 +KeysShift: + .byte 0x0, 0x0, 0x0, 0x0, 'A', 'B', 'C', 'D' + .byte 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L' + .byte 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T' + .byte 'U', 'V', 'W', 'X', 'Y', 'Z', '!', '"' + .byte '£', '$', '%', '^', '&', '*', '(', ')' + .byte '\n', 0x0, '\b', '\t', ' ', '_', '+', '{' + .byte '}', '|', '~', ':', '@', '¬', '<', '>' + .byte '?', 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0 + .byte 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0 + .byte 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0 + .byte 0x0, 0x0, 0x0, 0x0, '/', '*', '-', '+' + .byte '\n', '1', '2', '3', '4', '5', '6', '7' + .byte '8', '9', '0', '.', '|', 0x0, 0x0, '=' +``` + +``` +.byte num inserts the byte constant num into the file directly. +``` + +``` +Most assemblers and compilers recognise escape sequences; character sequences such as \t which insert special characters instead. +``` + +These tables map directly the first 104 scan codes onto the ASCII characters as a table of bytes. We also have a separate table describing the effects of the shift key on those scan codes. I've used the ASCII null character (0) for all keys without direct mappings in ASCII (such as the function keys). Backspace is mapped to the ASCII backspace character (8 denoted \b), enter is mapped to the ASCII new line character (10 denoted \n) and tab is mapped to the ASCII horizontal tab character (9 denoted \t). + +The KeyboardGetChar method will need to do the following: + + 1. Check if KeyboardAddress is 0. If so, return 0. + 2. Call KeyboardGetKeyDown up to 6 times. Each time: + 1. If key is 0, exit loop. + 2. Call KeyWasDown. If it was, go to the next key. + 3. If the scan code is more than 103, go to the next key. + 4. Call KeyboardGetModifiers + 5. If shift is held, load the address of KeysShift. Otherwise load KeysNormal. + 6. Read the ASCII value from the table. + 7. If it is 0, go to the next key otherwise return this ASCII code and exit. + 3. Return 0. + + + +Try to implement this yourself. My implementation is presented below: + +1. +``` +.globl KeyboardGetChar +KeyboardGetChar: +ldr r0,=KeyboardAddress +ldr r1,[r0] +teq r1,#0 +moveq r0,#0 +moveq pc,lr +``` +Simple check to see if we have a keyboard. + +2. +``` +push {r4,r5,r6,lr} +kbd .req r4 +key .req r6 +mov r4,r1 +mov r5,#0 +keyLoop$: + mov r0,kbd + mov r1,r5 + bl KeyboardGetKeyDown +``` +r5 will hold the index of the key, r4 holds the keyboard address. + + 1. + ``` + teq r0,#0 + beq keyLoopBreak$ + ``` + If a scan code is 0, it either means there is an error, or there are no more keys. + + 2. + ``` + mov key,r0 + bl KeyWasDown + teq r0,#0 + bne keyLoopContinue$ + ``` + If a key was already down it is uninteresting, we only want ot know about key presses. + + 3. + ``` + cmp key,#104 + bge keyLoopContinue$ + ``` + If a key has a scan code higher than 104, it will be outside our table, and so is not relevant. + + 4. + ``` + mov r0,kbd + bl KeyboardGetModifiers + ``` + We need to know about the modifier keys in order to deduce the character. + + 5. + ``` + tst r0,#0b00100010 + ldreq r0,=KeysNormal + ldrne r0,=KeysShift + ``` + We detect both a left and right shift key as changing the characters to their shift variants. Remember, a tst instruction computes the logical AND and then compares it to zero, so it will be equal to 0 if and only if both of the shift bits are zero. + + 6. + ``` + ldrb r0,[r0,key] + ``` + Now we can load in the key from the look up table. + + 7. + ``` + teq r0,#0 + bne keyboardGetCharReturn$ + keyLoopContinue$: + add r5,#1 + cmp r5,#6 + blt keyLoop$ + ``` + If the look up code contains a zero, we must continue. To continue, we increment the index, and check if we've reached 6. + +3. +``` +keyLoopBreak$: +mov r0,#0 +keyboardGetCharReturn$: +pop {r4,r5,r6,pc} +.unreq kbd +.unreq key +``` +We return our key here, if we reach keyLoopBreak$, then we know there is no key held, so return 0. + + + + +### 8 Notepad OS + +Now we have our KeyboardGetChar method, we can make an operating system that just types what the user writes to the screen. For simplicity we'll ignore all the unusual keys. In 'main.s' delete all code after bl SetGraphicsAddress. Call UsbInitialise, set r4 and r5 to 0, then loop forever over the following commands: + + 1. Call KeyboardUpdate + 2. Call KeyboardGetChar + 3. If it is 0, got to 1 + 4. Copy r4 and r5 to r1 and r2 then call DrawCharacter + 5. Add r0 to r4 + 6. If r4 is 1024, add r1 to r5 and set r4 to 0 + 7. If r5 is 768 set r5 to 0 + 8. Go to 1 + + + +Now compile this and test it on the Pi. You should almost immediately be able to start typing text to the screen when the Pi starts. If not, please see our troubleshooting page. + +When it works, congratulations, you've achieved an interface with the computer. You should now begin to realise that you've almost got a primitive operating system together. You can now interface with the computer, issuing it commands, and receive feedback on screen. In the next tutorial, [Input02][3] we will look at producing a full text terminal, in which the user types commands, and the computer executes them. + +-------------------------------------------------------------------------------- + +via: https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/input01.html + +作者:[Alex Chadwick][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.cl.cam.ac.uk +[b]: https://github.com/lujun9972 +[1]: https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/downloads.html +[2]: https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/downloads/hut1_12v2.pdf +[3]: https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/input02.html From 5ca58d4c7d8991cb6898e69c13e872b1686679cd Mon Sep 17 00:00:00 2001 From: darksun Date: Wed, 23 Jan 2019 15:28:23 +0800 Subject: [PATCH 088/243] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020150616=20Comput?= =?UTF-8?q?er=20Laboratory=20=E2=80=93=20Raspberry=20Pi:=20Lesson=2011=20I?= =?UTF-8?q?nput02=20sources/tech/20150616=20Computer=20Laboratory=20-=20Ra?= =?UTF-8?q?spberry=20Pi-=20Lesson=2011=20Input02.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...atory - Raspberry Pi- Lesson 11 Input02.md | 911 ++++++++++++++++++ 1 file changed, 911 insertions(+) create mode 100644 sources/tech/20150616 Computer Laboratory - Raspberry Pi- Lesson 11 Input02.md diff --git a/sources/tech/20150616 Computer Laboratory - Raspberry Pi- Lesson 11 Input02.md b/sources/tech/20150616 Computer Laboratory - Raspberry Pi- Lesson 11 Input02.md new file mode 100644 index 0000000000..9040162a97 --- /dev/null +++ b/sources/tech/20150616 Computer Laboratory - Raspberry Pi- Lesson 11 Input02.md @@ -0,0 +1,911 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Computer Laboratory – Raspberry Pi: Lesson 11 Input02) +[#]: via: (https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/input02.html) +[#]: author: (Alex Chadwick https://www.cl.cam.ac.uk) + +Computer Laboratory – Raspberry Pi: Lesson 11 Input02 +====== + +The Input02 lesson builds on Input01, by building a simple command line interface where the user can type commands and the computer interprets and displays them. It is assumed you have the code for the [Lesson 11: Input01][1] operating system as a basis. + +### 1 Terminal 1 + +``` +In the early days of computing, there would usually be one large computer in a building, and many 'terminals' which sent commands to it. The computer would take it in turns to execute different incoming commands. +``` + +Almost every operating system starts life out as a text terminal. This is typically a black screen with white writing, where you type commands for the computer to execute on the keyboard, and it explains how you've mistyped them, or very occasionally, does what you want. This approach has two main advantages: it provides a simple, robust control mechanism for the computer using only a keyboard and monitor, and it is done by almost every operating system, so is widely understood by system administrators. + +Let's analyse what we want to do precisely: + + 1. Computer turns on, displays some sort of welcome message + 2. Computer indicates its ready for input + 3. User types a command, with parameters, on the keyboard + 4. User presses return or enter to commit the command + 5. Computer interprets command and performs actions if command is acceptable + 6. Computer displays messages to indicate if command was successful, and also what happened + 7. Loop back to 2 + + + +One defining feature of such terminals is that they are unified for both input and output. The same screen is used to enter inputs as is used to print outputs. This means it is useful to build an abstraction of a character based display. In a character based display, the smallest unit is a character, not a pixel. The screen is divided into a fixed number of characters which have varying colours. We can build this on top of our existing screen code, by storing the characters and their colours, and then using the DrawCharacter method to push them to the screen. Once we have a character based display, drawing text becomes a matter of drawing a line of characters. + +In a new file called terminal.s copy the following code: +``` +.section .data +.align 4 +terminalStart: +.int terminalBuffer +terminalStop: +.int terminalBuffer +terminalView: +.int terminalBuffer +terminalColour: +.byte 0xf +.align 8 +terminalBuffer: +.rept 128*128 +.byte 0x7f +.byte 0x0 +.endr +terminalScreen: +.rept 1024/8 core.md Dict.md lctt2014.md lctt2016.md lctt2018.md LICENSE published README.md scripts sources translated 768/16 +.byte 0x7f +.byte 0x0 +.endr +``` +This sets up the data we need for the text terminal. We have two main storages: terminalBuffer and terminalScreen. terminalBuffer is storage for all of the text we have displayed. It stores up to 128 lines of text (each containing 128 characters). Each character consists of an ASCII character code and a colour, all of which are initially set to 0x7f (ASCII delete) and 0 (black on a black background). terminalScreen stores the characters that are currently displayed on the screen. It is 128 by 48 characters, similarly initialised. You may think that we only need this terminalScreen, not the terminalBuffer, but storing the buffer has 2 main advantages: + + 1. We can easily see which characters are different, so we only have to draw those. + 2. We can 'scroll' back through the terminal's history because it is stored (to a limit). + + + +You should always try to design systems that do the minimum amount of work, as they run much faster for things which don't often change. + +The differing trick is really common on low power Operating Systems. Drawing the screen is a slow operation, and so we only want to draw thing that we absolutely have to. In this system, we can freely alter the terminalBuffer, and then call a method which copies the bits that change to the screen. This means we don't have to draw each character as we go along, which may save time in the long run on very long sections of text that span many lines. + +The other values in the .data section are as follows: + + * terminalStart + The first character which has been written in terminalBuffer. + * terminalStop + The last character which has been written in terminalBuffer. + * terminalView + The first character on the screen at present. We can use this to scroll the screen. + * temrinalColour + The colour to draw new characters with. + + + +``` +Circular buffers are an example of an **data structure**. These are just ideas we have for organising data, that we sometimes implement in software. +``` + +![Diagram showing hellow world being inserted into a circular buffer of size 5.][2] +The reason why terminalStart needs to be stored is because termainlBuffer should be a circular buffer. This means that when the buffer is completely full, the end 'wraps' round to the start, and so the character after the very last one is the first one. Thus, we need to advance terminalStart so we know that we've done this. When wokring with the buffer this can easily be implemented by checking if the index goes beyond the end of the buffer, and setting it back to the beginning if it does. Circular buffers are a common and clever way of storing a lot of data, where only the most recent data is important. It allows us to keep writing indefinitely, while always being sure there is a certain amount of recent data available. They're often used in signal processing or compression algorithms. In this case, it allows us to store a 128 line history of the terminal, without any penalties for writing over 128 lines. If we didn't have this, we would have to copy 127 lines back a line very time we went beyond the 128th line, wasting valuable time. + +I've mentioned the terminalColour here a few times. You can implement this however you, wish, however there is something of a standard on text terminals to have only 16 colours for foreground, and 16 colours for background (meaning there are 162 = 256 combinations). The colours on a CGA terminal are defined as follows: + +Table 1.1 - CGA Colour Codes +| Number | Colour (R, G, B) | +| ------ | ------------------------| +| 0 | Black (0, 0, 0) | +| 1 | Blue (0, 0, ⅔) | +| 2 | Green (0, ⅔, 0) | +| 3 | Cyan (0, ⅔, ⅔) | +| 4 | Red (⅔, 0, 0) | +| 5 | Magenta (⅔, 0, ⅔) | +| 6 | Brown (⅔, ⅓, 0) | +| 7 | Light Grey (⅔, ⅔, ⅔) | +| 8 | Grey (⅓, ⅓, ⅓) | +| 9 | Light Blue (⅓, ⅓, 1) | +| 10 | Light Green (⅓, 1, ⅓) | +| 11 | Light Cyan (⅓, 1, 1) | +| 12 | Light Red (1, ⅓, ⅓) | +| 13 | Light Magenta (1, ⅓, 1) | +| 14 | Yellow (1, 1, ⅓) | +| 15 | White (1, 1, 1) | + +``` +Brown was used as the alternative (dark yellow) was unappealing and not useful. +``` + +We store the colour of each character by storing the fore colour in the low nibble of the colour byte, and the background colour in the high nibble. Apart from brown, all of these colours follow a pattern such that in binary, the top bit represents adding ⅓ to each component, and the other bits represent adding ⅔ to individual components. This makes it easy to convert to RGB colour values. + +We need a method, TerminalColour, to read these 4 bit colour codes, and then call SetForeColour with the 16 bit equivalent. Try to implement this on your own. If you get stuck, or have not completed the Screen series, my implementation is given below: + +``` +.section .text +TerminalColour: +teq r0,#6 +ldreq r0,=0x02B5 +beq SetForeColour + +tst r0,#0b1000 +ldrne r1,=0x52AA +moveq r1,#0 +tst r0,#0b0100 +addne r1,#0x15 +tst r0,#0b0010 +addne r1,#0x540 +tst r0,#0b0001 +addne r1,#0xA800 +mov r0,r1 +b SetForeColour +``` +### 2 Showing the Text + +The first method we really need for our terminal is TerminalDisplay, one that copies the current data from terminalBuffer to terminalScreen and the actual screen. As mentioned, this method should do a minimal amount of work, because we need to be able to call it often. It should compare the text in terminalBuffer with that in terminalDisplay, and copy it across if they're different. Remember, terminalBuffer is a circular buffer running, in this case, from terminalView to terminalStop or 128*48 characters, whichever comes sooner. If we hit terminalStop, we'll assume all characters after that point are 7f16 (ASCII delete), and have colour 0 (black on a black background). + +Let's look at what we have to do: + + 1. Load in terminalView, terminalStop and the address of terminalDisplay. + 2. For each row: + 1. For each column: + 1. If view is not equal to stop, load the current character and colour from view + 2. Otherwise load the character as 0x7f and the colour as 0 + 3. Load the current character from terminalDisplay + 4. If the character and colour are equal, go to 10 + 5. Store the character and colour to terminalDisplay + 6. Call TerminalColour with the background colour in r0 + 7. Call DrawCharacter with r0 = 0x7f (ASCII delete, a block), r1 = x, r2 = y + 8. Call TerminalColour with the foreground colour in r0 + 9. Call DrawCharacter with r0 = character, r1 = x, r2 = y + 10. Increment the position in terminalDisplay by 2 + 11. If view and stop are not equal, increment the view position by 2 + 12. If the view position is at the end of textBuffer, set it to the start + 13. Increment the x co-ordinate by 8 + 2. Increment the y co-ordinate by 16 + + + +Try to implement this yourself. If you get stuck, my solution is given below: + +1. +``` +.globl TerminalDisplay +TerminalDisplay: +push {r4,r5,r6,r7,r8,r9,r10,r11,lr} +x .req r4 +y .req r5 +char .req r6 +col .req r7 +screen .req r8 +taddr .req r9 +view .req r10 +stop .req r11 + +ldr taddr,=terminalStart +ldr view,[taddr,#terminalView - terminalStart] +ldr stop,[taddr,#terminalStop - terminalStart] +add taddr,#terminalBuffer - terminalStart +add taddr,#128*128*2 +mov screen,taddr +``` + +I go a little wild with variables here. I'm using taddr to store the location of the end of the textBuffer for ease. + +2. +``` +mov y,#0 +yLoop$: +``` +Start off the y loop. + + 1. + ``` + mov x,#0 + xLoop$: + ``` + Start off the x loop. + + 1. + ``` + teq view,stop + ldrneh char,[view] + ``` + I load both the character and the colour into char simultaneously for ease. + + 2. + ``` + moveq char,#0x7f + ``` + This line complements the one above by acting as though a black delete character was read. + + 3. + ``` + ldrh col,[screen] + ``` + For simplicity I load both the character and colour into col simultaneously. + + 4. + ``` + teq col,char + beq xLoopContinue$ + ``` + Now we can check if anything has changed with a teq. + + 5. + ``` + strh char,[screen] + ``` + We can also easily save the current value. + + 6. + ``` + lsr col,char,#8 + and char,#0x7f + lsr r0,col,#4 + bl TerminalColour + ``` + I split up char into the colour in col and the character in char with a bitshift and an and, then use a bitshift to get the background colour to call TerminalColour. + + 7. + ``` + mov r0,#0x7f + mov r1,x + mov r2,y + bl DrawCharacter + ``` + Write out a delete character which is a coloured block. + + 8. + ``` + and r0,col,#0xf + bl TerminalColour + ``` + Use an and to get the low nibble of col then call TerminalColour. + + 9. + ``` + mov r0,char + mov r1,x + mov r2,y + bl DrawCharacter + ``` + Write out the character we're supposed to write. + + 10. + ``` + xLoopContinue$: + add screen,#2 + ``` + Increment the screen pointer. + + 11. + ``` + teq view,stop + addne view,#2 + ``` + Increment the view pointer if necessary. + + 12. + ``` + teq view,taddr + subeq view,#128*128*2 + ``` + It's easy to check for view going past the end of the buffer because the end of the buffer's address is stored in taddr. + + 13. + ``` + add x,#8 + teq x,#1024 + bne xLoop$ + ``` + We increment x and then loop back if there are more characters to go. + + 2. + ``` + add y,#16 + teq y,#768 + bne yLoop$ + ``` + We increment y and then loop back if there are more characters to go. + +``` +pop {r4,r5,r6,r7,r8,r9,r10,r11,pc} +.unreq x +.unreq y +.unreq char +.unreq col +.unreq screen +.unreq taddr +.unreq view +.unreq stop +``` +Don't forget to clean up at the end! + + +### 3 Printing Lines + +Now we have our TerminalDisplay method, which will automatically display the contents of terminalBuffer to terminalScreen, so theoretically we can draw text. However, we don't actually have any drawing routines that work on a character based display. A quick method that will come in handy first of all is TerminalClear, which completely clears the terminal. This can actually very easily be achieved with no loops. Try to deduce why the following method suffices: + +``` +.globl TerminalClear +TerminalClear: +ldr r0,=terminalStart +add r1,r0,#terminalBuffer-terminalStart +str r1,[r0] +str r1,[r0,#terminalStop-terminalStart] +str r1,[r0,#terminalView-terminalStart] +mov pc,lr +``` + +Now we need to make a basic method for character based displays; the Print function. This takes in a string address in r0, and a length in r1, and simply writes it to the current location at the screen. There are a few special characters to be wary of, as well as special behaviour to ensure that terminalView is kept up to date. Let's analyse what it has to do: + + 1. Check if string length is 0, if so return + 2. Load in terminalStop and terminalView + 3. Deduce the x-coordinate of terminalStop + 4. For each character: + 1. Check if the character is a new line + 2. If so, increment bufferStop to the end of the line storing a black on black delete character. + 3. Otherwise, copy the character in the current terminalColour + 4. Check if we're at the end of a line + 5. If so, check if the number of characters between terminalView and terminalStop is more than one screen + 6. If so, increment terminalView by one line + 7. Check if terminalView is at the end of the buffer, replace it with the start if so + 8. Check if terminalStop is at the end of the buffer, replace it with the start if so + 9. Check if terminalStop equals terminalStart, increment terminalStart by one line if so + 10. Check if terminalStart is at the end of the buffer, replace it with the start if so + 5. Store back terminalStop and terminalView. + + + +See if you can implement this yourself. My solution is provided below: + +1. +``` +.globl Print +Print: +teq r1,#0 +moveq pc,lr +``` +This quick check at the beginning makes a call to Print with a string of length 0 almost instant. + +2. +``` +push {r4,r5,r6,r7,r8,r9,r10,r11,lr} +bufferStart .req r4 +taddr .req r5 +x .req r6 +string .req r7 +length .req r8 +char .req r9 +bufferStop .req r10 +view .req r11 + +mov string,r0 +mov length,r1 + +ldr taddr,=terminalStart +ldr bufferStop,[taddr,#terminalStop-terminalStart] +ldr view,[taddr,#terminalView-terminalStart] +ldr bufferStart,[taddr] +add taddr,#terminalBuffer-terminalStart +add taddr,#128*128*2 +``` +I do a lot of setup here. bufferStart contains terminalStart, bufferStop contains terminalStop, view contains terminalView, taddr is the address of the end of terminalBuffer. + +3. +``` +and x,bufferStop,#0xfe +lsr x,#1 +``` +As per usual, a sneaky alignment trick makes everything easier. Because of the aligment of terminalBuffer, the x-coordinate of any character address is simply the last 8 bits divided by 2. + + 4. + 1. + ``` + charLoop$: + ldrb char,[string] + and char,#0x7f + teq char,#'\n' + bne charNormal$ + ``` + We need to check for new lines. + + 2. + ``` + mov r0,#0x7f + clearLine$: + strh r0,[bufferStop] + add bufferStop,#2 + add x,#1 + teq x,#128 blt clearLine$ + + b charLoopContinue$ + ``` + Loop until the end of the line, writing out 0x7f; a delete character in black on a black background. + + 3. + ``` + charNormal$: + strb char,[bufferStop] + ldr r0,=terminalColour + ldrb r0,[r0] + strb r0,[bufferStop,#1] + add bufferStop,#2 + add x,#1 + ``` + Store the current character in the string and the terminalColour to the end of the terminalBuffer and then increment it and x. + + 4. + ``` + charLoopContinue$: + cmp x,#128 + blt noScroll$ + ``` + Check if x is at the end of a line; 128. + + 5. + ``` + mov x,#0 + subs r0,bufferStop,view + addlt r0,#128*128*2 + cmp r0,#128*(768/16)*2 + ``` + Set x back to 0 and check if we're currently showing more than one screen. Remember, we're using a circular buffer, so if the difference between bufferStop and view is negative, we're actually wrapping around the buffer. + + 6. + ``` + addge view,#128*2 + ``` + Add one lines worth of bytes to the view address. + + 7. + ``` + teq view,taddr + subeq view,taddr,#128*128*2 + ``` + If the view address is at the end of the buffer we subtract the buffer length from it to move it back to the start. I set taddr to the address of the end of the buffer at the beginning. + + 8. + ``` + noScroll$: + teq bufferStop,taddr + subeq bufferStop,taddr,#128*128*2 + ``` + If the stop address is at the end of the buffer we subtract the buffer length from it to move it back to the start. I set taddr to the address of the end of the buffer at the beginning. + + 9. + ``` + teq bufferStop,bufferStart + addeq bufferStart,#128*2 + ``` + Check if bufferStop equals bufferStart. If so, add one line to bufferStart. + + 10. + ``` + teq bufferStart,taddr + subeq bufferStart,taddr,#128*128*2 + ``` + If the start address is at the end of the buffer we subtract the buffer length from it to move it back to the start. I set taddr to the address of the end of the buffer at the beginning. + +``` +subs length,#1 +add string,#1 +bgt charLoop$ +``` +Loop until the string is done. + +5. +``` +charLoopBreak$: +sub taddr,#128*128*2 +sub taddr,#terminalBuffer-terminalStart +str bufferStop,[taddr,#terminalStop-terminalStart] +str view,[taddr,#terminalView-terminalStart] +str bufferStart,[taddr] + +pop {r4,r5,r6,r7,r8,r9,r10,r11,pc} +.unreq bufferStart +.unreq taddr +.unreq x +.unreq string +.unreq length +.unreq char +.unreq bufferStop +.unreq view +``` +Store back the variables and return. + + +This method allows us to print arbitrary text to the screen. Throughout, I've been using the colour variable, but no where have we actually set it. Normally, terminals use special combinations of characters to change the colour. For example ASCII Escape (1b16) followed by a number 0 to f in hexadecimal could set the foreground colour to that CGA colour number. You can try implementing this yourself; my version is in the further examples section on the download page. + +### 4 Standard Input + +``` +By convention, in many programming languages, every program has access to stdin and stdout, which are an input and and output stream linked to the terminal. This is still true on graphical programs, though many don't use it. +``` + +Now we have an output terminal that in theory can print out text and display it. That is only half the story however, we want input. We want to implement a method, ReadLine, which stores the next line of text a user types to a location given in r0, up to a maximum length given in r1, and returns the length of the string read in r0. The tricky thing is, the user annoyingly wants to see what they're typing as they type it, they want to use backspace to delete mistakes and they want to use return to submit commands. They probably even want a flashing underscore character to indicate the computer would like input! These perfectly reasonable requests make this method a real challenge. One way to achieve all of this is to store the text they type in memory somewhere along with its length, and then after every character, move the terminalStop address back to where it started when ReadLine was called and calling Print. This means we only have to be able to manipulate a string in memory, and then make use of our Print function. + +Lets have a look at what ReadLine will do: + + 1. If the maximum length is 0, return 0 + 2. Retrieve the current values of terminalStop and terminalView + 3. If the maximum length is bigger than half the buffer size, set it to half the buffer size + 4. Subtract one from maximum length to ensure it can store our flashing underscore or a null terminator + 5. Write an underscore to the string + 6. Write the stored terminalView and terminalStop addresses back to the memory + 7. Call Print on the current string + 8. Call TerminalDisplay + 9. Call KeyboardUpdate + 10. Call KeyboardGetChar + 11. If it is a new line character go to 16 + 12. If it is a backspace character, subtract 1 from the length of the string (if it is > 0) + 13. If it is an ordinary character, write it to the string (if the length < maximum length) + 14. If the string ends in an underscore, write a space, otherwise write an underscore + 15. Go to 6 + 16. Write a new line character to the end of the string + 17. Call Print and TerminalDisplay + 18. Replace the new line with a null terminator + 19. Return the length of the string + + + +Convince yourself that this will work, and then try to implement it yourself. My implementation is given below: + +1. +``` +.globl ReadLine +ReadLine: +teq r1,#0 +moveq r0,#0 +moveq pc,lr +``` +Quick special handling for the zero case, which is otherwise difficult. + +2. +``` +string .req r4 +maxLength .req r5 +input .req r6 +taddr .req r7 +length .req r8 +view .req r9 + +push {r4,r5,r6,r7,r8,r9,lr} + +mov string,r0 +mov maxLength,r1 +ldr taddr,=terminalStart +ldr input,[taddr,#terminalStop-terminalStart] +ldr view,[taddr,#terminalView-terminalStart] +mov length,#0 +``` +As per the general theme, I do a lot of initialisations early. input contains the value of terminalStop and view contains terminalView. Length starts at 0. + +3. +``` +cmp maxLength,#128*64 +movhi maxLength,#128*64 +``` +We have to check for unusually large reads, as we can't process them beyond the size of the terminalBuffer (I suppose we CAN, but it would be very buggy, as terminalStart could move past the stored terminalStop). + +4. +``` +sub maxLength,#1 +``` +Since the user wants a flashing cursor, and we ideally want to put a null terminator on this string, we need 1 spare character. + +5. +``` +mov r0,#'_' +strb r0,[string,length] +``` +Write out the underscore to let the user know they can input. + +6. +``` +readLoop$: +str input,[taddr,#terminalStop-terminalStart] +str view,[taddr,#terminalView-terminalStart] +``` +Save the stored terminalStop and terminalView. This is important to reset the terminal after each call to Print, which changes these variables. Strictly speaking it can change terminalStart too, but this is irreversible. + +7. +``` +mov r0,string +mov r1,length +add r1,#1 +bl Print +``` +Write the current input. We add 1 to the length for the underscore. + +8. +``` +bl TerminalDisplay +``` +Copy the new text to the screen. + +9. +``` +bl KeyboardUpdate +``` +Fetch the latest keyboard input. + +10. +``` +bl KeyboardGetChar +``` +Retrieve the key pressed. + +11. +``` +teq r0,#'\n' +beq readLoopBreak$ +teq r0,#0 +beq cursor$ +teq r0,#'\b' +bne standard$ +``` + +Break out of the loop if we have an enter key. Also skip these conditions if we have a null terminator and process a backspace if we have one. + +12. +``` +delete$: +cmp length,#0 +subgt length,#1 +b cursor$ +``` +Remove one from the length to delete a character. + +13. +``` +standard$: +cmp length,maxLength +bge cursor$ +strb r0,[string,length] +add length,#1 +``` +Write out an ordinary character where possible. + +14. +``` +cursor$: +ldrb r0,[string,length] +teq r0,#'_' +moveq r0,#' ' +movne r0,#'_' +strb r0,[string,length] +``` +Load in the last character, and change it to an underscore if it isn't one, and a space if it is. + +15. +``` +b readLoop$ +readLoopBreak$: +``` +Loop until the user presses enter. + +16. +``` +mov r0,#'\n' +strb r0,[string,length] +``` +Store a new line at the end of the string. + +17. +``` +str input,[taddr,#terminalStop-terminalStart] +str view,[taddr,#terminalView-terminalStart] +mov r0,string +mov r1,length +add r1,#1 +bl Print +bl TerminalDisplay +``` +Reset the terminalView and terminalStop and then Print and TerminalDisplay the final input. + +18. +``` +mov r0,#0 +strb r0,[string,length] +``` +Write out the null terminator. + +19. +``` +mov r0,length +pop {r4,r5,r6,r7,r8,r9,pc} +.unreq string +.unreq maxLength +.unreq input +.unreq taddr +.unreq length +.unreq view +``` +Return the length. + + + + +### 5 The Terminal: Rise of the Machine + +So, now we can theoretically interact with the user on the terminal. The most obvious thing to do is to put this to the test! In 'main.s' delete everything after bl UsbInitialise and copy in the following code: + +``` +reset$: + mov sp,#0x8000 + bl TerminalClear + + ldr r0,=welcome + mov r1,#welcomeEnd-welcome + bl Print + +loop$: + ldr r0,=prompt + mov r1,#promptEnd-prompt + bl Print + + ldr r0,=command + mov r1,#commandEnd-command + bl ReadLine + + teq r0,#0 + beq loopContinue$ + + mov r4,r0 + + ldr r5,=command + ldr r6,=commandTable + + ldr r7,[r6,#0] + ldr r9,[r6,#4] + commandLoop$: + ldr r8,[r6,#8] + sub r1,r8,r7 + + cmp r1,r4 + bgt commandLoopContinue$ + + mov r0,#0 + commandName$: + ldrb r2,[r5,r0] + ldrb r3,[r7,r0] + teq r2,r3 + bne commandLoopContinue$ + add r0,#1 + teq r0,r1 + bne commandName$ + + ldrb r2,[r5,r0] + teq r2,#0 + teqne r2,#' ' + bne commandLoopContinue$ + + mov r0,r5 + mov r1,r4 + mov lr,pc + mov pc,r9 + b loopContinue$ + + commandLoopContinue$: + add r6,#8 + mov r7,r8 + ldr r9,[r6,#4] + teq r9,#0 + bne commandLoop$ + + ldr r0,=commandUnknown + mov r1,#commandUnknownEnd-commandUnknown + ldr r2,=formatBuffer + ldr r3,=command + bl FormatString + + mov r1,r0 + ldr r0,=formatBuffer + bl Print + +loopContinue$: + bl TerminalDisplay + b loop$ + +echo: + cmp r1,#5 + movle pc,lr + + add r0,#5 + sub r1,#5 + b Print + +ok: + teq r1,#5 + beq okOn$ + teq r1,#6 + beq okOff$ + mov pc,lr + + okOn$: + ldrb r2,[r0,#3] + teq r2,#'o' + ldreqb r2,[r0,#4] + teqeq r2,#'n' + movne pc,lr + mov r1,#0 + b okAct$ + + okOff$: + ldrb r2,[r0,#3] + teq r2,#'o' + ldreqb r2,[r0,#4] + teqeq r2,#'f' + ldreqb r2,[r0,#5] + teqeq r2,#'f' + movne pc,lr + mov r1,#1 + + okAct$: + + mov r0,#16 + b SetGpio + +.section .data +.align 2 +welcome: .ascii "Welcome to Alex's OS - Everyone's favourite OS" +welcomeEnd: +.align 2 +prompt: .ascii "\n> " +promptEnd: +.align 2 +command: + .rept 128 + .byte 0 + .endr +commandEnd: +.byte 0 +.align 2 +commandUnknown: .ascii "Command `%s' was not recognised.\n" +commandUnknownEnd: +.align 2 +formatBuffer: + .rept 256 + .byte 0 + .endr +formatEnd: + +.align 2 +commandStringEcho: .ascii "echo" +commandStringReset: .ascii "reset" +commandStringOk: .ascii "ok" +commandStringCls: .ascii "cls" +commandStringEnd: + +.align 2 +commandTable: +.int commandStringEcho, echo +.int commandStringReset, reset$ +.int commandStringOk, ok +.int commandStringCls, TerminalClear +.int commandStringEnd, 0 +``` +This code brings everything together into a simple command line operating system. The commands available are echo, reset, ok and cls. echo copies any text after it back to the terminal, reset resets the operating system if things go wrong, ok has two functions: ok on turns the OK LED on, and ok off turns the OK LED off, and cls clears the terminal using TerminalClear. + +Have a go with this code on the Raspberry Pi. If it doesn't work, please see our troubleshooting page. + +When it works, congratulations you've completed a basic terminal Operating System, and have completed the input series. Unfortunately, this is as far as these tutorials go at the moment, but I hope to make more in the future. Please send feedback to awc32@cam.ac.uk. + +You're now in position to start building some simple terminal Operating Systems. My code above builds up a table of available commands in commandTable. Each entry in the table is an int for the address of the string, and an int for the address of the code to run. The last entry has to be commandStringEnd, 0. Try implementing some of your own commands, using our existing functions, or making new ones. The parameters for the functions to run are r0 is the address of the command the user typed, and r1 is the length. You can use this to pass inputs to your commands. Maybe you could make a calculator program, perhaps a drawing program or a chess program. Whatever ideas you've got, give them a go! + +-------------------------------------------------------------------------------- + +via: https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/input02.html + +作者:[Alex Chadwick][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.cl.cam.ac.uk +[b]: https://github.com/lujun9972 +[1]: https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/input01.html +[2]: https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/images/circular_buffer.png From 183e32d0dcb25a9871bd865d50117f6cb765d73a Mon Sep 17 00:00:00 2001 From: MjSeven Date: Wed, 23 Jan 2019 18:16:22 +0800 Subject: [PATCH 089/243] Translating 20180130 Tmux... --- ...l Terminal Multiplexer For Heavy Command-Line Linux User.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/sources/tech/20180130 tmux - A Powerful Terminal Multiplexer For Heavy Command-Line Linux User.md b/sources/tech/20180130 tmux - A Powerful Terminal Multiplexer For Heavy Command-Line Linux User.md index 4adaa7a2bc..f519d76fc7 100644 --- a/sources/tech/20180130 tmux - A Powerful Terminal Multiplexer For Heavy Command-Line Linux User.md +++ b/sources/tech/20180130 tmux - A Powerful Terminal Multiplexer For Heavy Command-Line Linux User.md @@ -1,3 +1,6 @@ +Translating by MjSeven + + tmux – A Powerful Terminal Multiplexer For Heavy Command-Line Linux User ====== tmux stands for terminal multiplexer, it allows users to create/enable multiple terminals (vertical & horizontal) in single window, this can be accessed and controlled easily from single window when you are working with different issues. From 31e6fbe5d478a91561b73528f02925545e27dd44 Mon Sep 17 00:00:00 2001 From: Yuqi Liu Date: Wed, 23 Jan 2019 21:11:03 +0800 Subject: [PATCH 090/243] translating by oneforalone 20180809 Two Years With Emacs as a CEO (and now CTO).md translation is under progress, will come out by this weekend. Hopefully to publish by the Chinese New Year's Festival. @wxy Best Regards Liu Yuqi --- .../20180809 Two Years With Emacs as a CEO (and now CTO).md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sources/talk/20180809 Two Years With Emacs as a CEO (and now CTO).md b/sources/talk/20180809 Two Years With Emacs as a CEO (and now CTO).md index 3e1f5d1eb2..b144fe4201 100644 --- a/sources/talk/20180809 Two Years With Emacs as a CEO (and now CTO).md +++ b/sources/talk/20180809 Two Years With Emacs as a CEO (and now CTO).md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (oneforalone) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) @@ -68,7 +68,7 @@ via: https://www.fugue.co/blog/2018-08-09-two-years-with-emacs-as-a-cto.html 作者:[Josh Stella][a] 选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) +译者:[译者ID](https://github.com/oneforalone) 校对:[校对者ID](https://github.com/校对者ID) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 065d18943917b2df22369aba467fe3f1c4e4e5bc Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Wed, 23 Jan 2019 22:25:55 +0800 Subject: [PATCH 091/243] PRF:20190114 How to Build a Netboot Server, Part 4.md @qhwdw --- ...4 How to Build a Netboot Server, Part 4.md | 224 +++++++++--------- 1 file changed, 110 insertions(+), 114 deletions(-) diff --git a/translated/tech/20190114 How to Build a Netboot Server, Part 4.md b/translated/tech/20190114 How to Build a Netboot Server, Part 4.md index 84065b2b40..d3eae1aefe 100644 --- a/translated/tech/20190114 How to Build a Netboot Server, Part 4.md +++ b/translated/tech/20190114 How to Build a Netboot Server, Part 4.md @@ -1,6 +1,6 @@ [#]: collector: "lujun9972" [#]: translator: "qhwdw" -[#]: reviewer: " " +[#]: reviewer: "wxy" [#]: publisher: " " [#]: url: " " [#]: subject: "How to Build a Netboot Server, Part 4" @@ -15,7 +15,7 @@ 可写镜像的另外的好处是,终端用户“私人定制”的操作系统,在下次不同的工作站上使用时能够“跟着”他们。 -### 修改 Bootmenu 应用程序去使用 HTTPS +### 修改 Bootmenu 应用程序以使用 HTTPS 为 bootmenu 应用程序创建一个自签名的证书: @@ -27,7 +27,7 @@ $ sudo -i # openssl req -newkey rsa:2048 -nodes -keyout $MY_TLSD/$MY_NAME.key -x509 -days 3650 -out $MY_TLSD/$MY_NAME.pem ``` -验证你的证书的值。确保 “Subject” 行中 “CN” 的值与你的 iPXE 客户端连接你的网络引导服务器所使用的 DNS 名字是相匹配的: +验证你的证书的值。确保 `Subject` 行中 `CN` 的值与你的 iPXE 客户端连接你的网络引导服务器所使用的 DNS 名字是相匹配的: ``` # openssl x509 -text -noout -in $MY_TLSD/$MY_NAME.pem @@ -49,7 +49,7 @@ GnuTLS 要求 “CAP_DAC_READ_SEARCH” 能力,因此将它添加到 bootmenu # systemctl daemon-reload ``` -现在,在防火墙中为 bootmenu 服务添加一个例外规则并重启动服务: +现在,在防火墙中为 bootmenu 服务添加一个例外规则并重启动该服务: ``` # MY_SUBNET=192.0.2.0 @@ -59,7 +59,7 @@ GnuTLS 要求 “CAP_DAC_READ_SEARCH” 能力,因此将它添加到 bootmenu # systemctl restart bootmenu.service ``` -使用 wget 去验证是否工作正常: +使用 `wget` 去验证是否工作正常: ``` $ MY_NAME=server-01.example.edu @@ -69,7 +69,7 @@ $ wget -q --ca-certificate=$MY_TLSD/$MY_NAME.pem -O - https://$MY_NAME/menu ### 添加 HTTPS 到 iPXE -更新 init.ipxe 去使用 HTTPS。接着使用选项重新编译 ipxe 引导加载器,以便它包含和信任你为 bootmenu 应用程序创建的自签名证书: +更新 `init.ipxe` 去使用 HTTPS。接着使用选项重新编译 ipxe 引导加载器,以便它包含和信任你为 bootmenu 应用程序创建的自签名证书: ``` $ echo '#define DOWNLOAD_PROTO_HTTPS' >> $HOME/ipxe/src/config/local/general.h @@ -95,7 +95,7 @@ $ cp $HOME/ipxe/src/bin-x86_64-efi/ipxe.efi $HOME/esp/efi/boot/bootx64.efi # echo 'auth required pam_krb5.so' > /etc/pam.d/bootmenu ``` -添加一个库到 bootmenu 应用程序中,它使用 Authen-PAM 的 perl 模块去执行用户验证: +添加一个库到 bootmenu 应用程序中,它使用 Authen-PAM 的 Perl 模块去执行用户验证: ``` # dnf install -y perl-Authen-PAM; @@ -107,37 +107,37 @@ package PAM; use Authen::PAM; sub auth { - my $success = 0; + my $success = 0; - my $username = shift; - my $password = shift; + my $username = shift; + my $password = shift; - my $callback = sub { - my @res; - while (@_) { - my $code = shift; - my $msg = shift; - my $ans = ""; + my $callback = sub { + my @res; + while (@_) { + my $code = shift; + my $msg = shift; + my $ans = ""; + + $ans = $username if ($code == PAM_PROMPT_ECHO_ON()); + $ans = $password if ($code == PAM_PROMPT_ECHO_OFF()); + + push @res, (PAM_SUCCESS(), $ans); + } + push @res, PAM_SUCCESS(); - $ans = $username if ($code == PAM_PROMPT_ECHO_ON()); - $ans = $password if ($code == PAM_PROMPT_ECHO_OFF()); + return @res; + }; - push @res, (PAM_SUCCESS(), $ans); - } - push @res, PAM_SUCCESS(); + my $pamh = new Authen::PAM('bootmenu', $username, $callback); - return @res; - }; + { + last unless ref $pamh; + last unless $pamh->pam_authenticate() == PAM_SUCCESS; + $success = 1; + } - my $pamh = new Authen::PAM('bootmenu', $username, $callback); - - { - last unless ref $pamh; - last unless $pamh->pam_authenticate() == PAM_SUCCESS; - $success = 1; - } - - return $success; + return $success; } return 1; @@ -163,29 +163,29 @@ plugin 'Config'; get '/menu'; get '/boot' => sub { - my $c = shift; + my $c = shift; - my $instance = $c->param('instance'); - my $username = $c->param('username'); - my $password = $c->param('password'); + my $instance = $c->param('instance'); + my $username = $c->param('username'); + my $password = $c->param('password'); - my $template = 'menu'; + my $template = 'menu'; - { - last unless $instance =~ /^fc[[:digit:]]{2}$/; - last unless $username =~ /^[[:alnum:]]+$/; - last unless PAM::auth($username, url_unescape($password)); - $template = $instance; - } + { + last unless $instance =~ /^fc[[:digit:]]{2}$/; + last unless $username =~ /^[[:alnum:]]+$/; + last unless PAM::auth($username, url_unescape($password)); + $template = $instance; + } - return $c->render(template => $template); + return $c->render(template => $template); }; app->start; END ``` -bootmenu 应用程序现在查找 lib 去找到相应的 WorkingDirectory。但是,默认情况下,对于 systemd 单元它的工作目录设置为服务器的 root 目录。因此,你必须更新 systemd 单元去设置 WorkingDirectory 为 bootmenu 应用程序的根目录: +bootmenu 应用程序现在查找 `lib` 命令去找到相应的 `WorkingDirectory`。但是,默认情况下,对于 systemd 单元它的工作目录设置为服务器的 root 目录。因此,你必须更新 systemd 单元去设置 `WorkingDirectory` 为 bootmenu 应用程序的根目录: ``` # sed -i "/^RuntimeDirectory=/ a WorkingDirectory=$MY_MOJO" /etc/systemd/system/bootmenu.service @@ -203,7 +203,7 @@ bootmenu 应用程序现在查找 lib 去找到相应的 WorkingDirectory。但 上面的最后的命令将生成类似下面的三个文件: -**menu.html.ep** : +`menu.html.ep`: ``` #!ipxe @@ -241,7 +241,7 @@ login chain https://server-01.example.edu/boot?instance=fc28&username=${username}&password=${password:uristring} || goto failed ``` -**fc29.html.ep** : +`fc29.html.ep`: ``` #!ipxe @@ -250,7 +250,7 @@ initrd --name initrd.img ${prefix}/initramfs-4.19.5-300.fc29.x86_64.img boot || chain https://server-01.example.edu/menu ``` -**fc28.html.ep** : +`fc28.html.ep`: ``` #!ipxe @@ -267,17 +267,15 @@ boot || chain https://server-01.example.edu/menu ### 使得 iSCSI Target 可写 -现在,用户验证通过 iPXE 可以正常工作,在用户连接时,你可以按需在只读镜像的上面创建每用户的可写覆盖。使用一个 [写时复制][2] 覆盖与简单地为每个用户复制原始镜像相比有三个好处: +现在,用户验证通过 iPXE 可以正常工作,在用户连接时,你可以按需在只读镜像的上面创建每用户可写的overlay叠加层。使用一个 [写时复制][2] 的叠加层与简单地为每个用户复制原始镜像相比有三个好处: - 1. 复制创建非常快。这样就可以按需创建。 - 2. 复制并不增加服务器上的磁盘使用。除了原始镜像之外,仅存储用户写入个人镜像的内容。 - 3. 由于每个用户复制的扇区大多都是服务器的存储上的相同的扇区,在随后的用户访问这些操作系统的副本时,它们可能已经加载到内存中,这样就提升了服务器的性能,因为对内存的访问速度要比磁盘 I/O 快得多。 + 1. 副本创建非常快。这样就可以按需创建。 + 2. 副本并不增加服务器上的磁盘使用。除了原始镜像之外,仅存储用户写入个人镜像的内容。 + 3. 由于每个副本的扇区大多都是服务器的存储器上的相同扇区,在随后的用户访问这些操作系统的副本时,它们可能已经加载到内存中,这样就提升了服务器的性能,因为对内存的访问速度要比磁盘 I/O 快得多。 +使用写时复制的一个潜在隐患是,一旦叠加层创建后,叠加层之下的镜像就不能再改变。如果它们改变,所有它们之上的叠加层将出错。因此,叠加层必须被删除并用新的、空白的进行替换。即便只是简单地以读写模式加载的镜像,也可能因为某些文件系统更新导致叠加层出错。 - -使用写时复制的一个潜在隐患是,一旦覆盖创建后,覆盖之下的镜像就不能再改变。如果它们改变,所有它们之上的覆盖将出错。因此,覆盖必须被删除并用新的、空白的替换。即便只是简单地以读写模式加载的镜像,也可能因为某些文件系统更新导致覆盖出错。 - -由于这个隐患,如果原始镜像被修改将导致覆盖出错,因此运行下列的命令,将原始镜像标记为不可改变: +由于这个隐患,如果原始镜像被修改将导致叠加层出错,因此运行下列的命令,将原始镜像标记为不可改变: ``` # chattr +i @@ -293,7 +291,7 @@ boot || chain https://server-01.example.edu/menu 当仍有连接打开的时候,运行这个命令一般需要一分钟或更长的时间。 -现在,移除只读的 iSCSI 出口。然后更新模板中的配置文件为 readonly-root,以使镜像不再是只读的: +现在,移除只读的 iSCSI 出口。然后更新模板中的 `readonly-root` 配置文件,以使镜像不再是只读的: ``` # MY_FC=fc29 @@ -305,7 +303,7 @@ boot || chain https://server-01.example.edu/menu # umount $TEMP_MNT ``` -将 Journald 日志从发送到内存修改回缺省值(记录到磁盘,如果 /var/log/journal 存在的话),因为一个用户报告说,他的客户端由于应用程序生成了大量的系统日志而产生内存溢出错误,导致它的客户端被卡住。而将日志记录到磁盘的负面影响是客户端产生了额外的写入流量,这将在你的网络引导服务器上可能增加一些没有必要的 I/O。你应该去决定到底使用哪个选择 — 记录到内存还是记录到硬盘 — 哪个更合适取决于你的环境。 +将 journald 日志从发送到内存修改回缺省值(如果 `/var/log/journal` 存在的话记录到磁盘),因为一个用户报告说,他的客户端由于应用程序生成了大量的系统日志而产生内存溢出错误,导致它的客户端被卡住。而将日志记录到磁盘的负面影响是客户端产生了额外的写入流量,这将在你的网络引导服务器上可能增加一些没有必要的 I/O。你应该去决定到底使用哪个选择 —— 记录到内存还是记录到硬盘 —— 哪个更合适取决于你的环境。 因为你的模板镜像在以后不能做任何的更改,因此在它上面设置不可更改标志,然后重启动 tgtd.service: @@ -331,37 +329,37 @@ plugin 'Config'; get '/menu'; get '/boot' => sub { - my $c = shift; + my $c = shift; - my $instance = $c->param('instance'); - my $username = $c->param('username'); - my $password = $c->param('password'); + my $instance = $c->param('instance'); + my $username = $c->param('username'); + my $password = $c->param('password'); - my $chapscrt; - my $template = 'menu'; + my $chapscrt; + my $template = 'menu'; - { - last unless $instance =~ /^fc[[:digit:]]{2}$/; - last unless $username =~ /^[[:alnum:]]+$/; - last unless PAM::auth($username, url_unescape($password)); - last unless $chapscrt = `sudo scripts/mktgt $instance $username`; - $template = $instance; - } + { + last unless $instance =~ /^fc[[:digit:]]{2}$/; + last unless $username =~ /^[[:alnum:]]+$/; + last unless PAM::auth($username, url_unescape($password)); + last unless $chapscrt = `sudo scripts/mktgt $instance $username`; + $template = $instance; + } - return $c->render(template => $template, username => $username, chapscrt => $chapscrt); + return $c->render(template => $template, username => $username, chapscrt => $chapscrt); }; app->start; END ``` -新版本的 bootmenu 应用程序调用一个定制的 mktgt 脚本,如果成功,它将为每个它自己创建的新的 iSCSI 目标返回一个随机的 [CHAP][3] 密码。这个 CHAP 密码可以防止其它用户的 iSCSI 目标以间接方式挂载这个用户的目标。这个应用程序只有在用户密码认证成功之后才返回一个正确的 iSCSI 目标密码。 +新版本的 bootmenu 应用程序调用一个定制的 `mktgt` 脚本,如果成功,它将为每个它自己创建的新的 iSCSI 目标返回一个随机的 [CHAP][3] 密码。这个 CHAP 密码可以防止其它用户的 iSCSI 目标以间接方式挂载这个用户的目标。这个应用程序只有在用户密码认证成功之后才返回一个正确的 iSCSI 目标密码。 -mktgt 脚本要加 sudo 前缀来运行,因为它需要 root 权限去创建目标。 +`mktgt` 脚本要加 `sudo` 前缀来运行,因为它需要 root 权限去创建目标。 -\$username 和 \$chapscrt 变量也传递 render 命令,因此在需要的时候,它们也能够被纳入到模板中返回给用户。 +`$username` 和 `$chapscrt` 变量也传递给 `render` 命令,因此在需要的时候,它们也能够被纳入到模板中返回给用户。 -接下来,更新我们的引导模板,以便于它们能够读取用户名和 chapscrt 变量,并传递它们到所属的终端用户。也要更新模板以 rw(读写)模式加载根文件系统: +接下来,更新我们的引导模板,以便于它们能够读取用户名和 `chapscrt` 变量,并传递它们到所属的终端用户。也要更新模板以 rw(读写)模式加载根文件系统: ``` # cd $MY_MOJO/templates @@ -379,17 +377,17 @@ initrd --name initrd.img ${prefix}/initramfs-4.19.5-300.fc29.x86_64.img boot || chain https://server-01.example.edu/menu ``` -注意:如果在 [插入][4] 变量后需要查看引导模板,你可以在 “boot” 命令之前,在它自己的行中插入 “shell” 命令。然后在你网络引导你的客户端时,iPXE 将在那里给你提供一个用于交互的 shell,你可以在 shell 中输入 “imgstat” 去查看传递到内核的参数。如果一切正确,你可以输入 “exit” 去退出 shell 并继续引导过程。 +注意:如果在 [插入][4] 变量后需要查看引导模板,你可以在 `boot` 命令之前,在它自己的行中插入 `shell` 命令。然后在你网络引导你的客户端时,iPXE 将在那里给你提供一个用于交互的 shell,你可以在 shell 中输入 `imgstat` 去查看传递到内核的参数。如果一切正确,你可以输入 `exit` 去退出 shell 并继续引导过程。 -现在,通过 sudo 允许 bootmenu 用户以 root 权限去运行 mktgt 脚本(仅那个脚本): +现在,通过 `sudo` 允许 bootmenu 用户以 root 权限去运行 `mktgt` 脚本(仅这个脚本): ``` # echo "bootmenu ALL = NOPASSWD: $MY_MOJO/scripts/mktgt *" > /etc/sudoers.d/bootmenu ``` -bootmenu 用户不应该写访问 mktgt 脚本或在它的 home 目录下的任何其它文件。在 /opt/bootmenu 目录下的所有文件的属主应该是 root,并且不应该被其它任何 root 以外的用户可写。 +bootmenu 用户不应该写访问 `mktgt` 脚本或在它的家目录下的任何其它文件。在 `/opt/bootmenu` 目录下的所有文件的属主应该是 root,并且不应该被其它任何 root 以外的用户可写。 -Sudo 在使用 systemd 的 DynamicUser 选项下不能正常工作,因此创建一个普通用户帐户,并设置 systemd 服务以那个用户运行: +`sudo` 在使用 systemd 的 `DynamicUser` 选项下不能正常工作,因此创建一个普通用户帐户,并设置 systemd 服务以那个用户运行: ``` # useradd -r -c 'iPXE Boot Menu Service' -d /opt/bootmenu -s /sbin/nologin bootmenu @@ -397,7 +395,7 @@ Sudo 在使用 systemd 的 DynamicUser 选项下不能正常工作,因此创 # systemctl daemon-reload ``` -最后,为写时复制覆盖创建一个目录,并创建管理 iSCSI 目标的 mktgt 脚本和它们的覆盖支持存储: +最后,为写时复制覆盖创建一个目录,并创建管理 iSCSI 目标的 `mktgt` 脚本和它们的覆盖支持存储: ``` # mkdir /$MY_FC.cow @@ -510,25 +508,23 @@ END 上面的脚本将做以下五件事情: - 1. 创建 /.cow/ 稀疏文件(如果不存在的话)。 - 2. 创建 /dev/mapper/- 设备节点作为 iSCSI 目标的写时复制支持存储(如果不存在的话)。 - 3. 创建 iqn.:- iSCSI 目标(如果不存在的话)。或者,如果已存在了,它将关闭任何已存在的连接,因为在任何时刻,镜像只能以只读模式从一个地方打开。 - 4. 它在 iqn.:- iSCSI 目标上(重新)设置 chap 密码为一个新的随机值。 + 1. 创建 `/.cow/` 稀疏文件(如果不存在的话)。 + 2. 创建 `/dev/mapper/-` 设备节点作为 iSCSI 目标的写时复制支持存储(如果不存在的话)。 + 3. 创建 `iqn.:-` iSCSI 目标(如果不存在的话)。或者,如果已存在了,它将关闭任何已存在的连接,因为在任何时刻,镜像只能以只读模式从一个地方打开。 + 4. 它在 `iqn.:-` iSCSI 目标上(重新)设置 chap 密码为一个新的随机值。 5. (如果前面的所有任务都成功的话)它在 [标准输出][5] 上显示新的 chap 密码。 - - -你应该可以在命令行上通过使用有效的测试参数来运行它,以测试 mktgt 脚本能否正常工作。例如: +你应该可以在命令行上通过使用有效的测试参数来运行它,以测试 `mktgt` 脚本能否正常工作。例如: ``` # echo `$MY_MOJO/scripts/mktgt fc29 jsmith` ``` -当你从命令行上运行时,mktgt 脚本应该会输出 iSCSI 目标的一个随意的八字符随机密码(如果成功的话)或者是出错位置的行号(如果失败的话)。 +当你从命令行上运行时,`mktgt` 脚本应该会输出 iSCSI 目标的一个随意的八字符随机密码(如果成功的话)或者是出错位置的行号(如果失败的话)。 -有时候,你可能需要在不停止整个服务的情况下删除一个 iSCSI 目标。例如,一个用户可能无意中损坏了他的个人镜像,在那种情况下,你可能需要按步骤撤销上面的 mktgt 脚本所做的事情,以便于他下次登入时他将得到一个原始镜像。 +有时候,你可能需要在不停止整个服务的情况下删除一个 iSCSI 目标。例如,一个用户可能无意中损坏了他的个人镜像,在那种情况下,你可能需要按步骤撤销上面的 `mktgt` 脚本所做的事情,以便于他下次登入时他将得到一个原始镜像。 -下面是用于撤销的 rmtgt 脚本,它以相反的顺序做了上面 mktgt 脚本所做的事情: +下面是用于撤销的 `rmtgt` 脚本,它以相反的顺序做了上面 `mktgt` 脚本所做的事情: ``` # mkdir $HOME/bin @@ -556,39 +552,39 @@ my @targets = $text =~ /(?:^T.*\n)(?:^ .*\n)*/mg; my $targets = {}; foreach (@targets) { - my $tgt; - my $sid; + my $tgt; + my $sid; - foreach (split /\n/) { - /^Target (\d+)(?{ $tgt = $targets->{$^N} = [] })/; - /I_T nexus: (\d+)(?{ $sid = $^N })/; - /Connection: (\d+)(?{ push @{$tgt}, [ $sid, $^N ] })/; - } + foreach (split /\n/) { + /^Target (\d+)(?{ $tgt = $targets->{$^N} = [] })/; + /I_T nexus: (\d+)(?{ $sid = $^N })/; + /Connection: (\d+)(?{ push @{$tgt}, [ $sid, $^N ] })/; + } } my $tid = 0; foreach (@targets) { - next unless /^Target (\d+)(?{ $tid = $^N }): $target$/m; - foreach (@{$targets->{$tid}}) { - die unless system("$tgtadm --op delete --mode conn --tid $tid --sid $_->[0] --cid $_->[1]") == 0; - } - die unless system("$tgtadm --op delete --mode target --tid $tid") == 0; - print "target $tid deleted\n"; - sleep 1; + next unless /^Target (\d+)(?{ $tid = $^N }): $target$/m; + foreach (@{$targets->{$tid}}) { + die unless system("$tgtadm --op delete --mode conn --tid $tid --sid $_->[0] --cid $_->[1]") == 0; + } + die unless system("$tgtadm --op delete --mode target --tid $tid") == 0; + print "target $tid deleted\n"; + sleep 1; } my $dev = "/dev/mapper/$cow"; if ($rmd or ($rmf and -e $dev)) { - die unless system("dmsetup remove $cow") == 0; - print "device node $dev deleted\n"; + die unless system("dmsetup remove $cow") == 0; + print "device node $dev deleted\n"; } if ($rmf) { - my $sf = "/$instance.cow/$username"; - die "sparse file $sf not found" unless -e "$sf"; - die unless system("rm -f $sf") == 0; - die unless not -e "$sf"; - print "sparse file $sf deleted\n"; + my $sf = "/$instance.cow/$username"; + die "sparse file $sf not found" unless -e "$sf"; + die unless system("rm -f $sf") == 0; + die unless not -e "$sf"; + print "sparse file $sf deleted\n"; } END # chmod +x $HOME/bin/rmtgt @@ -600,7 +596,7 @@ END # rmtgt fc29 jsmith +f ``` -一旦你验证 mktgt 脚本工作正常,你可以重启动 bootmenu 服务。下次有人从网络引导时,他们应该能够接收到一个他们可以写入的、可”私人定制“的网络引导镜像的副本: +一旦你验证 `mktgt` 脚本工作正常,你可以重启动 bootmenu 服务。下次有人从网络引导时,他们应该能够接收到一个他们可以写入的、可”私人定制“的网络引导镜像的副本: ``` # systemctl restart bootmenu.service @@ -617,7 +613,7 @@ via: https://fedoramagazine.org/how-to-build-a-netboot-server-part-4/ 作者:[Gregory Bartholomew][a] 选题:[lujun9972][b] 译者:[qhwdw](https://github.com/qhwdw) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 19a003c9b81c309a0cd027ab67bf2626a583466e Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Wed, 23 Jan 2019 22:26:35 +0800 Subject: [PATCH 092/243] PUB:20190114 How to Build a Netboot Server, Part 4.md @qhwdw https://linux.cn/article-10470-1.html --- .../20190114 How to Build a Netboot Server, Part 4.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20190114 How to Build a Netboot Server, Part 4.md (99%) diff --git a/translated/tech/20190114 How to Build a Netboot Server, Part 4.md b/published/20190114 How to Build a Netboot Server, Part 4.md similarity index 99% rename from translated/tech/20190114 How to Build a Netboot Server, Part 4.md rename to published/20190114 How to Build a Netboot Server, Part 4.md index d3eae1aefe..87eb7a25cd 100644 --- a/translated/tech/20190114 How to Build a Netboot Server, Part 4.md +++ b/published/20190114 How to Build a Netboot Server, Part 4.md @@ -1,8 +1,8 @@ [#]: collector: "lujun9972" [#]: translator: "qhwdw" [#]: reviewer: "wxy" -[#]: publisher: " " -[#]: url: " " +[#]: publisher: "wxy" +[#]: url: "https://linux.cn/article-10470-1.html" [#]: subject: "How to Build a Netboot Server, Part 4" [#]: via: "https://fedoramagazine.org/how-to-build-a-netboot-server-part-4/" [#]: author: "Gregory Bartholomew https://fedoramagazine.org/author/glb/" From 4e7ebb3b07945a41b94b9fda7eab629846ac0dff Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Wed, 23 Jan 2019 23:23:27 +0800 Subject: [PATCH 093/243] PRF:20190107 Getting started with Pelican- A Python-based static site generator.md @MjSeven --- ...n- A Python-based static site generator.md | 57 ++++++++++--------- 1 file changed, 29 insertions(+), 28 deletions(-) diff --git a/translated/tech/20190107 Getting started with Pelican- A Python-based static site generator.md b/translated/tech/20190107 Getting started with Pelican- A Python-based static site generator.md index bc82a69c54..7a4a9b475f 100644 --- a/translated/tech/20190107 Getting started with Pelican- A Python-based static site generator.md +++ b/translated/tech/20190107 Getting started with Pelican- A Python-based static site generator.md @@ -1,27 +1,28 @@ [#]: collector: (lujun9972) [#]: translator: (MjSeven) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Getting started with Pelican: A Python-based static site generator) [#]: via: (https://opensource.com/article/19/1/getting-started-pelican) [#]: author: (Craig Sebenik https://opensource.com/users/craig5) -Pelican 简介:一个 Python 静态网站生成器 +Pelican 入门:一个 Python 静态网站生成器 ====== -Pelican 是那些想要自我托管简单网站或博客的 Python 用户的绝佳选择。 + +> Pelican 是那些想要自我托管简单网站或博客的 Python 用户的绝佳选择。 ![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/web-design-monitor-website.png?itok=yUK7_qR0) -如果你想创建一个自定义网站或博客,有很多选择。许多提供商将托管你的网站并为你完成大部分工作。(WordPress 是一个非常受欢迎的选项。)但是使用托管方案,你会失去一些灵活性。作为一名软件开发人员,我更喜欢管理我自己的服务器,并在我的网站如何运行方面保持更多的自由。 +如果你想创建一个自定义网站或博客,有很多选择。许多提供商可以托管你的网站并为你完成大部分工作。(WordPress 是一个非常受欢迎的选项。)但是使用托管方式,你会失去一些灵活性。作为一名软件开发人员,我更喜欢管理我自己的服务器,并在我的网站如何运行方面保持更多的自由。 然而,管理 Web 服务器需要大量的工作。安装它并获得一个简单的应用程序来提供内容是非常容易的。但是,维护安全补丁和更新是非常耗时得。如果你只想提供静态网页,那么拥有一个 Web 服务器和一系列应用程序可能会得不偿失。手动创建 HTML 页面也不是一个好选择。 -这是静态网站生成器的用武之地。这些应用程序使用模板来创建所需的静态页面,并将它们与关联的元数据交叉链接。(例如,所有显示的页面都带有公共标签或关键词。)静态网站生成器可以帮助你使用导航区域,页眉和页脚等元素创建一个具有公共外观的网站。 +这是静态网站生成器的用武之地。这些应用程序使用模板来创建所需的静态页面,并将它们与关联的元数据交叉链接。(例如,所有显示的页面都带有公共标签或关键词。)静态网站生成器可以帮助你使用导航区域、页眉和页脚等元素创建一个具有公共外观的网站。 -我使用 [Pyhton][1] 已经很多年了,所以,当我第一次开始寻找生成静态 HTML 页面的东西时,我想要用 Python 编写的东西。主要原因是我经常想要了解应用程序如何工作的内部细节,而使用一种我已经了解的语言使这一点更容易。(如果这对你不重要或者你不使用 Python,那么还有一些其他很棒的[静态网站生成器][2],它们使用 Ruby, JavaScript 和其它语言。) +我使用 [Pyhton][1] 已经很多年了,所以,当我第一次开始寻找生成静态 HTML 页面的东西时,我想要用 Python 编写的东西。主要原因是我经常想要了解应用程序如何工作的内部细节,而使用一种我已经了解的语言使这一点更容易。(如果这对你不重要或者你不使用 Python,那么还有一些其他很棒的[静态网站生成器][2],它们使用 Ruby、JavaScript 和其它语言。) -我决定试试 [Pelican][3]。它是一个用 Python 编写的常用静态网站生成器。它支持 [reStructuredText][4](译注:这是一种用于文本数据的文件格式,主要用于 Python 社区的技术文档),并且支持 [Markdown][5],这需要通过安装必需的包来完成。所有任务都是通过命令行界面(CLI)工具执行的,这使得熟悉命令行的任何人都可以轻松完成。它简单的 quickstart CLI 工具使得创建一个网站非常容易。 +我决定试试 [Pelican][3]。它是一个用 Python 编写的常用静态网站生成器。它支持 [reStructuredText][4](LCTT 译注:这是一种用于文本数据的文件格式,主要用于 Python 社区的技术文档),并且也支持 [Markdown][5],这需要通过安装必需的包来完成。所有任务都是通过命令行界面(CLI)工具执行的,这使得熟悉命令行的任何人都可以轻松完成。它简单的 quickstart CLI 工具使得创建一个网站非常容易。 在本文中,我将介绍如何安装 Pelican 4,添加一篇文章以及更改默认主题。(注意:我是在 MacOS 上开发的,使用其它 Unix/Linux 实验结果都将相同,但我没有 Windows 主机可以测试。) @@ -42,9 +43,7 @@ Collecting pelican Successfully installed MarkupSafe-1.1.0 blinker-1.4 docutils-0.14 feedgenerator-1.9 jinja2-2.10 pelican-4.0.1 pygments-2.3.1 python-dateutil-2.7.5 pytz-2018.7 six-1.12.0 unidecode-1.0.23 ``` -为了简单起见,我输入了标题和作者的名字,并对 URL 前缀和文章分页选择了 N。(对于其它选项,我使用了默认值。) - -Pelican 的 quickstart CLI 工具将创建基本布局和一些文件来帮助你开始,运行 **pelican-quickstart** 命令。为了简单起见,我输入了**标题**和**作者**的名字,并对 URL 前缀和文章分页选择了 N。稍后在配置文件中更改这些设置非常容易。 +Pelican 的 quickstart CLI 工具将创建基本布局和一些文件来帮助你开始,运行 `pelican-quickstart` 命令。为了简单起见,我输入了**网站标题**和**作者**的名字,并对 URL 前缀和文章分页选择了 “N”。(对于其它选项,我使用了默认值。)稍后在配置文件中更改这些设置非常容易。 ``` $ ./venv/bin/pelicanquickstart @@ -73,18 +72,19 @@ Done. Your new project is available at /Users/craig/tmp/pelican/test-site 你需要启动的所有文件都准备好了。 -quickstart 默认为欧洲/巴黎时区,所以在继续之前更改一下。在你喜欢的文本编辑器中打开 **pelicanconf.py** 文件,寻找 **TIMEZONE** 变量。 +quickstart 默认为欧洲/巴黎时区,所以在继续之前更改一下。在你喜欢的文本编辑器中打开 `pelicanconf.py` 文件,寻找 `TIMEZONE` 变量。 ``` TIMEZONE = 'Europe/Paris' ``` -将其改为 **UTC**。 +将其改为 `UTC`。 + ``` TIMEZONE = 'UTC' ``` -要更新公共设置,在 **pelicanconf.py** 中查找 **SOCIAL** 变量。 +要更新公共设置,在 `pelicanconf.py` 中查找 `SOCIAL` 变量。 ``` SOCIAL = (('You can add links in your config file', '#'), @@ -97,9 +97,9 @@ SOCIAL = (('You can add links in your config file', '#'), SOCIAL = (('Twitter (#craigs55)', 'https://twitter.com/craigs55'),) ``` -注意后面的逗号,它很重要。这个逗号将帮助 Python 识别变量实际上是一个集合。确保你没有删除这个逗号。 +注意末尾的逗号,它很重要。这个逗号将帮助 Python 识别变量实际上是一个集合。确保你没有删除这个逗号。 -现在你已经有了网站的基本知识。quickstart 创建了一个包含许多目标的 Makefile。将 **devserver** 传给 **make** 命令将在你的计算机上启动一个开发服务器,以便你可以预览所有内容。Makefile 中使用的 CLI 命令是 **PATH** 的一部分,因此你需要首先激活 **virtualenv**。 +现在你已经有了网站的基本知识。quickstart 创建了一个包含许多目标的 `Makefile`。将 `devserver` 传给 `make` 命令将在你的计算机上启动一个开发服务器,以便你可以预览所有内容。`Makefile` 中使用的 CLI 命令假定放在 `PATH` 搜索路径中,因此你需要首先激活该虚拟环境。 ``` $ source ./venv/bin/activate @@ -119,11 +119,11 @@ Done: Processed 0 articles, 0 drafts, 0 pages, 0 hidden pages and 0 draft pages ![](https://opensource.com/sites/default/files/uploads/pelican_test-site1.png) -你可以在右侧看到 Twitter 链接,左侧有 Pelican, Python 和 Jinja 的一些链接。(Jinja 是 Pelican 可以使用的一种很棒的模板语言。你可以在 [Jinja 的文档][7]中了解更多相关信息。) +你可以在右侧看到 Twitter 链接,左侧有 Pelican、Python 和 Jinja 的一些链接。(Jinja 是 Pelican 可以使用的一种很棒的模板语言。你可以在 [Jinja 的文档][7]中了解更多相关信息。) ### 添加内容 -现在你又了一个基本的网站,试着添加一些内容。首先,将名为 **welcome.rst** 的文件添加到网站的 **content** 目录中。在你喜欢的文本编辑器中,使用以下文本创建一个文件: +现在你又了一个基本的网站,试着添加一些内容。首先,将名为 `welcome.rst` 的文件添加到网站的 `content` 目录中。在你喜欢的文本编辑器中,使用以下文本创建一个文件: ``` $ pwd @@ -144,9 +144,9 @@ Welcome to my blog. This is a short page just to show how to put up a static page. ``` -Pelican 会自动解析元数据行,包括日期,标签等。 +Pelican 会自动解析元数据行,包括日期、标签等。 -编写完文件后,**devserver** 应该输出以下内容: +编写完文件后,开发服务器应该输出以下内容: ``` -> Modified: content. regenerating... @@ -157,13 +157,13 @@ Done: Processed 1 article, 0 drafts, 0 pages, 0 hidden pages and 0 draft pages i ![](https://opensource.com/sites/default/files/uploads/pelican_test-site2.png) -元数据(例如日期和标签)会自动添加到页面中。此外,Pelican 会自动检测到 **intro** 类别,并将该部分添加到顶部导航中。 +元数据(例如日期和标签)会自动添加到页面中。此外,Pelican 会自动检测到 intro 栏目,并将该部分添加到顶部导航中。 ### 更改主题 -使用像 Pelican 这样流行的开源软件的好处之一是,非常多的用户将进行更改并将其贡献给项目。许多都是以主题形式贡献的。 +使用像 Pelican 这样流行的开源软件的好处之一是,非常多的用户会做出更改并将其贡献给项目。许多都是以主题形式贡献的。 -网站的主题会设置颜色,布局选项等。尝试一个新主题非常容易,你可以在 [Pelican 主题][8]中预览其中的许多内容。 +网站的主题会设置颜色、布局选项等。尝试一个新主题非常容易,你可以在 [Pelican 主题][8]中预览其中的许多内容。 首先,克隆 GitHub 仓库: @@ -175,16 +175,17 @@ Cloning into 'pelicanthemes'... 我喜欢蓝色,那么试试 [blueidea][9]。 -编辑 **pelicanconf.py** ,添加以下行: +编辑 `pelicanconf.py`,添加以下行: + ``` THEME = '/Users/craig/tmp/pelican/pelican-themes/blueidea/' ``` -**devserver** 将重新生成你的输出。在浏览器中刷新网页来查看新主题。 +开发服务器将重新生成你的输出。在浏览器中刷新网页来查看新主题。 ![](https://opensource.com/sites/default/files/uploads/pelican_test-site3.png) -主题控制布局的方方面面。例如,在默认主题中,你可以看到文章旁边带有元标记的类别(Intro),但这个类别并未显示在 blueidea 主题中。 +主题控制布局的方方面面。例如,在默认主题中,你可以看到文章旁边带有元标记的栏目(Intro),但这个栏目并未显示在 blueidea 主题中。 ### 其他考虑因素 @@ -192,9 +193,9 @@ THEME = '/Users/craig/tmp/pelican/pelican-themes/blueidea/' 首先,我对迁移到静态站点犹豫不决的一个原因是它无法对文章评论。幸运的是,有一些第三方服务商将为你提供评论功能。我目前正在关注的是 [Disqus][10]。 -接下来,上面的所有内容都是在我的本地机器上完成的。如果我希望其他人查看我的网站,我将不得不将预先生成的 HTML 文件上传到某个地方。如果你查看 **pelican-quickstart** 输出,你将看到使用 FTP, SSH, S3 甚至 GitHub 页面的选项,每个选项都有其优点和缺点。但是,如果我必须选择一个,那么我可能会选择发布到 GitHub 页面。 +接下来,上面的所有内容都是在我的本地机器上完成的。如果我希望其他人查看我的网站,我将不得不将预先生成的 HTML 文件上传到某个地方。如果你查看 `pelican-quickstart` 输出,你将看到使用 FTP、 SSH、S3 甚至 GitHub 页面的选项,每个选项都有其优点和缺点。但是,如果我必须选择一个,那么我可能会选择发布到 GitHub 页面。 -Pelican 还有许多其他功能,以至于我每天都在学习它。如果你想自托管一个网站或博客,内容简单并且是静态内容,同时你想使用 Python,那么 Pelican 是一个很好的选择。它有一个活跃的用户社区,可以修复 bug,添加特性,而且还会创建新的和有趣的主题。试试看吧! +Pelican 还有许多其他功能,我每天都在学习它。如果你想自托管一个网站或博客,内容简单并且是静态内容,同时你想使用 Python,那么 Pelican 是一个很好的选择。它有一个活跃的用户社区,可以修复 bug,添加特性,而且还会创建新的和有趣的主题。试试看吧! -------------------------------------------------------------------------------- @@ -203,7 +204,7 @@ via: https://opensource.com/article/19/1/getting-started-pelican 作者:[Craig Sebenik][a] 选题:[lujun9972][b] 译者:[MjSeven](https://github.com/MjSeven) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 3c8f5609c94bf9eb9b9c715dc43493daafed6d7c Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Wed, 23 Jan 2019 23:24:27 +0800 Subject: [PATCH 094/243] PUB:20190107 Getting started with Pelican- A Python-based static site generator.md @MjSeven https://linux.cn/article-10471-1.html --- ...rted with Pelican- A Python-based static site generator.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20190107 Getting started with Pelican- A Python-based static site generator.md (99%) diff --git a/translated/tech/20190107 Getting started with Pelican- A Python-based static site generator.md b/published/20190107 Getting started with Pelican- A Python-based static site generator.md similarity index 99% rename from translated/tech/20190107 Getting started with Pelican- A Python-based static site generator.md rename to published/20190107 Getting started with Pelican- A Python-based static site generator.md index 7a4a9b475f..061effbde3 100644 --- a/translated/tech/20190107 Getting started with Pelican- A Python-based static site generator.md +++ b/published/20190107 Getting started with Pelican- A Python-based static site generator.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (MjSeven) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-10471-1.html) [#]: subject: (Getting started with Pelican: A Python-based static site generator) [#]: via: (https://opensource.com/article/19/1/getting-started-pelican) [#]: author: (Craig Sebenik https://opensource.com/users/craig5) From 735567e96b108a1c9c96ec30634d68f923e412c1 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Wed, 23 Jan 2019 23:49:35 +0800 Subject: [PATCH 095/243] PRF:20180319 6 common questions about agile development practices for teams.md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @lixinyuxx 最近这几篇翻译的不错。值得赞扬,加油! --- ...t agile development practices for teams.md | 41 ++++++++++--------- 1 file changed, 22 insertions(+), 19 deletions(-) diff --git a/translated/talk/20180319 6 common questions about agile development practices for teams.md b/translated/talk/20180319 6 common questions about agile development practices for teams.md index 288e5c7753..045db356ba 100644 --- a/translated/talk/20180319 6 common questions about agile development practices for teams.md +++ b/translated/talk/20180319 6 common questions about agile development practices for teams.md @@ -1,42 +1,45 @@ -关于团队敏捷开发实践的6个常见问题 +关于团队敏捷开发实践的 6 个常见问题 ====== +> 专家回答了敏捷实践如何帮助团队更有效的 6 个常见问题。 + ![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/collab-team-pair-programming-code-keyboard.png?itok=kBeRTFL1) + ”有问题么?“ -你可能听过演讲者在演讲结束的时候提出这个问题。这是演讲中最重要的部分--毕竟,你不仅仅是听讲座, 而是参加讨论和社群交流。 +你可能听过演讲者在演讲结束的时候提出这个问题。这是演讲中最重要的部分 —— 毕竟,你不仅仅是听讲座, 而是参加讨论和社群交流。 -最近,我有机会听到我的同伴 Red Hatters 给当地一所大学的一群技术型学生做一个名为 “[Agile in Practice][1]” 的讲座。讲座中有软件工程师 Tomas Tomecek 和敏捷开发的从业者 Fernando Colleone 与 Pavel Najman 合作解释敏捷开发方法的基础,并展示最佳实践在日常活动中的应用。 - -### 1.完美的团队规模是多大? +最近,我有机会听到我的同伴 Red Hatters 给当地一所大学的一群技术型学生做一个名为 “[敏捷实践][1]” 的讲座。讲座中有软件工程师 Tomas Tomecek 和敏捷开发的从业者 Fernando Colleone 、Pavel Najman 合作解释了敏捷开发方法的基础,并展示最佳实践在日常活动中的应用。 知道了学生们参加这个课程是为了了解什么是敏捷实践以及如何将其应用于项目,我想知道学生们的问题会与我作为敏捷从业者在 Red Hat 每天听到的问题相比有什么不同。结果学生的疑问和我的同事们如出一辙。这些问题都直指敏捷实践的核心。 -学生们想知道一个小团队和一个大团队的规模是多少。这个问题与任何曾经合作过做项目的人都是相关的。根据 Tomas 作为技术领导的经验 12 个人从事的项目被认为是一个大型团队。现实中,团队规模通常与生产力没有关系。在有些时候,一个小地区或同一个时区的小团队也许会比一个成员分布在满世界的大团队更具有生产力。最终,讲座建议理想的团队大小大概是5个人(正如 scrum 开发方法的7,+-2)。 +### 1、完美的团队规模是多大? -### 2\. 团队会面临哪些实际挑战? +学生们想知道一个小团队和一个大团队的规模是多少。这个问题与任何曾经合作过做项目的人都是相关的。根据 Tomas 作为技术领导的经验,12 个人从事的项目被认为是一个大型团队。现实中,团队规模通常与生产力没有直接关系。在有些时候,在一个地方或同一个时区的小团队也许会比一个成员分布在满世界的大团队更具有生产力。最终,该讲座建议理想的团队大小大概是 5 个人(正如 scrum 开发方法的 7,+-2)。 -演讲者比较了由本地团队组成的项目(团队成员都是一个办公室,或者相邻近的人)与分散型的团队(位于不同时区)。 当项目需要团队成员之间密切合作时,工程师更喜欢本地的团队,因为时间差异造成的延迟可能会破坏软件开发的“流”。同时,分散型团队可以将可能不适用与当地项目但适用于某些开发用例的技能集合在一起。此外,还有各种最佳方法可用于改进分散型团队中的合作方式。 +### 2、团队会面临哪些实际挑战? -### 3\. 整理堆积的工作需要多少时间? +演讲者比较了由本地团队组成的项目(团队成员都是一个办公室的,或者相邻近的人)与分散型的团队(位于不同时区)。当项目需要团队成员之间密切合作时,工程师更喜欢本地的团队,因为时间差异造成的延迟可能会破坏软件开发的“流”。同时,分散型团队可以将可能不适用与当地项目但适用于某些开发用例的技能集合在一起。此外,还有各种最佳方法可用于改进分散型团队中的合作方式。 -因为这是一个对于新学习学生的介绍性质的演讲,演讲者关注于用 [Scrum][2] 和 [Kanban][3] 作为介绍敏捷开发的方法。他们使用 Scrum 来作为说明软件编写的方法并且用 Kanban 作为工作规划和沟通的系统。关于需要多少时间来整理项目堆积的工作,演讲者解释说并没有固定的准则,相对的,实践出真知:在开发的早期阶段,当一个崭新的项目—特别如果团队里有新人—每周可能会花费数个小时在整理工作上。随着时间推移和不断地练习,会越来越高效。 +### 3、整理堆积的工作需要多少时间? -### 4\. 产品负责人是否是必要的? 他们扮演什么样的角色? +因为这是一个对于新学习敏捷的学生的介绍性质的演讲,演讲者着重把 [Scrum][2] 和 [Kanban][3] 作为介绍敏捷开发的方法。他们使用 Scrum 框架来作为说明软件编写的方法,并且用 Kanban 作为工作规划和沟通的系统。关于需要多少时间来整理项目堆积的工作,演讲者解释说并没有固定的准则,相对的,实践出真知:在开发的早期阶段,当一个崭新的项目 —— 特别如果团队里有新人 —— 每周可能会花费数个小时在整理工作上。随着时间推移和不断地练习,会越来越高效。 -负责人会帮助团队更方便的拓展,然而,职位并不重要,重要的是你的团队中有人能够传递用户的意愿。在许多团队中,特别是在大型 团队中从事单个任务的团队,首席工程师就可以担任负责人。 +### 4、产品负责人是否是必要的? 他们扮演什么样的角色? -### 5\.建议使用哪些敏捷开发的工具?使用 Scrum 或 Kanban 做敏捷开发的时候必须用特定的软件么? +产品负责人会帮助团队更方便的拓展,然而,职位名称并不重要,重要的是你的团队中有人能够传递用户的意愿。在许多团队中,特别是在大型团队中从事单个任务的团队,首席工程师就可以担任产品负责人。 -尽管使用一些专业软件例如 Jira 或 Trello 会很有帮助,特别是在与大量从事大型企业项目的工作者合作时,但它们不是必需的。Scrum 和 Kanban 可以使用像纸卡这样简单的工具完成。关键是在团队中要有一个清晰的信息来源和紧密的交流。也就是说,优秀的两个 kanban 开源工具 [Taiga][4] 和 [Wekan][5] 。更多信息请查看 [5 open source alternatives to Trello][6] 和 [Top 7 open source project management tools for agile teams][7] 。 +### 5、建议使用哪些敏捷开发的工具?使用 Scrum 或 Kanban 做敏捷开发的时候必须用特定的软件么? -### 6\. 学生如何在学校项目中使用敏捷开发技术? +尽管使用一些专业软件例如 Jira 或 Trello 会很有帮助,特别是在与大量从事大型企业项目的工作者合作时,但它们不是必需的。Scrum 和 Kanban 可以使用像纸卡这样简单的工具完成。关键是在团队中要有一个清晰的信息来源和紧密的交流。推荐两个优秀的 kanban 开源工具 [Taiga][4] 和 [Wekan][5]。更多信息请查看 [Trello 的 5 个开源替代品][6] 和 [敏捷团队的最好的 7 个开源项目管理工具][7] 。 -演讲者鼓励学生使用 kanban 在项目结束前使用可视化和大纲来完成。关键是要创建一个公共板块,这样整个团队就可以看到项目的状态。通过使用 kanban 或者类似的高可视化策略,学生不会在项目后期才发现个别成员没有跟上进度。 +### 6、学生如何在学校项目中使用敏捷开发技术? -Scrum 实践比如 sprints 和 daily standups 也是确认每个人都在进步的绝佳方法项目的各个部分最终会一起发挥作用。定期检查和信息共享也至关重要。更多关于 Scrum 的信息,访问 [What is scrum?][8] 。 +演讲者鼓励学生使用 kanban 在项目结束前使用可视化和概述要完成的任务。关键是要创建一个公共板块,这样整个团队就可以看到项目的状态。通过使用 kanban 或者类似的高度可视化的策略,学生不会在项目后期才发现个别成员没有跟上进度。 -牢记 Kanban 和 Scrum 只是敏捷开发中众多框架和工具中的两个。它们可能不是应对每一种情况的最佳方法。 +Scrum 实践比如 sprints 和 daily standups 也是确认每个人都在进步以及项目的各个部分最终会一起发挥作用的绝佳方法。定期检查和信息共享也至关重要。更多关于 Scrum 的信息,访问 [什么是 scrum?][8] 。 + +牢记 Kanban 和 Scrum 只是敏捷开发中众多框架和工具中的两个而已。它们可能不是应对每一种情况的最佳方法。 -------------------------------------------------------------------------------- @@ -44,7 +47,7 @@ via: https://opensource.com/article/18/3/agile-mindset 作者:[Dominika Bula][a] 译者:[lixinyuxx](https://github.com/lixinxyuxx) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From a082ed70146eb63d5b49f7019be51ad01fa1b140 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Wed, 23 Jan 2019 23:50:08 +0800 Subject: [PATCH 096/243] PUB:20180319 6 common questions about agile development practices for teams.md @lixinyuxx https://linux.cn/article-10472-1.html --- ...ommon questions about agile development practices for teams.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {translated/talk => published}/20180319 6 common questions about agile development practices for teams.md (100%) diff --git a/translated/talk/20180319 6 common questions about agile development practices for teams.md b/published/20180319 6 common questions about agile development practices for teams.md similarity index 100% rename from translated/talk/20180319 6 common questions about agile development practices for teams.md rename to published/20180319 6 common questions about agile development practices for teams.md From 4e684d4716003244a6d8d3e919a5083b6b7893ef Mon Sep 17 00:00:00 2001 From: geekpi Date: Thu, 24 Jan 2019 08:54:27 +0800 Subject: [PATCH 097/243] translated --- ... Linux terminal with this Pac-man clone.md | 52 ------------------- ...109 Bash 5.0 Released with New Features.md | 52 +++++++++---------- ... Linux terminal with this Pac-man clone.md | 52 +++++++++++++++++++ 3 files changed, 78 insertions(+), 78 deletions(-) delete mode 100644 sources/tech/20181215 Head to the arcade in your Linux terminal with this Pac-man clone.md create mode 100644 translated/tech/20181215 Head to the arcade in your Linux terminal with this Pac-man clone.md diff --git a/sources/tech/20181215 Head to the arcade in your Linux terminal with this Pac-man clone.md b/sources/tech/20181215 Head to the arcade in your Linux terminal with this Pac-man clone.md deleted file mode 100644 index 0207f906df..0000000000 --- a/sources/tech/20181215 Head to the arcade in your Linux terminal with this Pac-man clone.md +++ /dev/null @@ -1,52 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (geekpi) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Head to the arcade in your Linux terminal with this Pac-man clone) -[#]: via: (https://opensource.com/article/18/12/linux-toy-myman) -[#]: author: (Jason Baker https://opensource.com/users/jason-baker) - -Head to the arcade in your Linux terminal with this Pac-man clone -====== -Want to recreate the magic of your favorite arcade game? Today's command-line toy will transport you back in time. -![](https://opensource.com/sites/default/files/styles/image-full-size/public/uploads/linux-toy-myman.png?itok=9j1DFgH0) - -Welcome back to another day of the Linux command-line toys advent calendar. If this is your first visit to the series, you might be asking yourself what command-line toys are all about. Basically, they're games and simple diversions that help you have fun at the terminal. - -Some are new, and some are old classics. We hope you enjoy. - -Today's toy, MyMan, is a fun clone of the classic arcade game [Pac-Man][1]. (You didn't think this was going to be about the [similarly-named][2] Linux package manager, did you?) If you're anything like me, you spent more than your fair share of quarters trying to hit a high score Pac-Man back in the day, and still give it a go whenever you get a chance. - -MyMan isn't the only Pac-Man clone for the Linux terminal, but it's the one I chose to include because 1) I like its visual style, which rings true to the original and 2) it's conveniently packaged for my Linux distribution so it was an easy install. But you should check out your other options as well. Here's [another one][3] that looks like it may be promising, but I haven't tried it. - -Since MyMan was packaged for Fedora, installation was as simple as: - -``` -$ dnf install myman -``` - -MyMan is made available under an MIT license and you can check out the source code on [SourceForge][4]. -![](https://opensource.com/sites/default/files/uploads/linux-toy-myman-animated.gif) -Do you have a favorite command-line toy that you think I ought to profile? The calendar for this series is mostly filled out but I've got a few spots left. Let me know in the comments below, and I'll check it out. If there's space, I'll try to include it. If not, but I get some good submissions, I'll do a round-up of honorable mentions at the end. - -Check out yesterday's toy, [The Linux terminal is no one-trick pony][5], and check back tomorrow for another! - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/18/12/linux-toy-myman - -作者:[Jason Baker][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://opensource.com/users/jason-baker -[b]: https://github.com/lujun9972 -[1]: https://en.wikipedia.org/wiki/Pac-Man -[2]: https://wiki.archlinux.org/index.php/pacman -[3]: https://github.com/YoctoForBeaglebone/pacman4console -[4]: https://myman.sourceforge.io/ -[5]: https://opensource.com/article/18/12/linux-toy-ponysay diff --git a/sources/tech/20190109 Bash 5.0 Released with New Features.md b/sources/tech/20190109 Bash 5.0 Released with New Features.md index 17b0c5758a..34abd1661d 100644 --- a/sources/tech/20190109 Bash 5.0 Released with New Features.md +++ b/sources/tech/20190109 Bash 5.0 Released with New Features.md @@ -7,60 +7,60 @@ [#]: via: (https://itsfoss.com/bash-5-release) [#]: author: (Ankush Das https://itsfoss.com/author/ankush/) -Bash 5.0 Released with New Features +Bash 5.0 发布了新功能 ====== -The [mailing list][1] confirmed the release of Bash-5.0 recently. And, it is exciting to know that it comes baked with new features and variable. +[邮件列表][1]证实最近发布了 Bash-5.0。而且,令人兴奋的是它还有新功能和新变量。 -Well, if you’ve been using Bash 4.4.XX, you will definitely love the fifth major release of [Bash][2]. +如果你一直在使用 Bash 4.4.XX,那么你一定会喜欢 [Bash][2] 的第五个主要版本。 -The fifth release focuses on new shell variables and a lot of major bug fixes with an overhaul. It also introduces a couple of new features along with some incompatible changes between bash-4.4 and bash-5.0. +第五个版本侧重于新的 shell 变量和许多重大漏洞修复。它还引入了一些新功能还有一些让 bash-4.4 和 bash-5.0 之间不兼容的更改。 ![Bash logo][3] -### What about the new features? +### 新功能怎么样? -The mailing list explains the bug fixed in this new release: +邮件列表解释了此版本中修复的 bug: -> This release fixes several outstanding bugs in bash-4.4 and introduces several new features. The most significant bug fixes are an overhaul of how nameref variables resolve and a number of potential out-of-bounds memory errors discovered via fuzzing. There are a number of changes to the expansion of $@ and $* in various contexts where word splitting is not performed to conform to a Posix standard interpretation, and additional changes to resolve corner cases for Posix conformance. +> 此版本修复了 bash-4.4 中的几个主要错误,并引入了几个新功能。最重要的 bug 修复是对 nameref 变量的解析以及通过模糊测试发现的许多潜在的内存越界错误。在为了符合 Posix 标准解释而不进行单词拆分的上下文中,对 $@ 和 $* 的展开做了许多变化,另外还有解决极端情况中 Posix 一致性的修改。 -It also introduces some new features. As per the release note, these are the most notable new features are several new shell variables: +它还引入了一些新功能。根据发布说明,最值得注意的新功能是几个新的 shell 变量: -> The BASH_ARGV0, EPOCHSECONDS, and EPOCHREALTIME. The ‘history’ builtin can remove ranges of history entries and understands negative arguments as offsets from the end of the history list. There is an option to allow local variables to inherit the value of a variable with the same name at a preceding scope. There is a new shell option that, when enabled, causes the shell to attempt to expand associative array subscripts only once (this is an issue when they are used in arithmetic expressions). The ‘globasciiranges‘ shell option is now enabled by default; it can be set to off by default at configuration time. +> BASH_ARGV0、EPOCHSECONDS 和 EPOCHREALTIME。内置的 “history” 可以删除指定范围的条目,并能将负数理解为从历史末端开始的偏移量。有一个选项允许局部变量继承前一个范围内具有相同名称的变量的值。有一个新的shell选项,在启用它时,会导致 shell 只尝试一次扩展关联数组下标(这在算术表达式中使用时会出现问题)。“globasciiranges” 这个 shell 选项现在默认启用。可以在配置时默认关闭它。 -### What about the changes between Bash-4.4 and Bash-5.0? +### Bash-4.4 和 Bash-5.0 之间有哪些变化? -The update log mentioned about the incompatible changes and the supported readline version history. Here’s what it said: +更新日志提到了不兼容的更改和支持 readline 版本历史记录。它是这么说的: -> There are a few incompatible changes between bash-4.4 and bash-5.0. The changes to how nameref variables are resolved means that some uses of namerefs will behave differently, though I have tried to minimize the compatibility issues. By default, the shell only sets BASH_ARGC and BASH_ARGV at startup if extended debugging mode is enabled; it was an oversight that it was set unconditionally and caused performance issues when scripts were passed large numbers of arguments. +> bash-4.4 和 bash-5.0 之间存在一些不兼容的变化。尽管我已经尽量最小化兼容性问题,但是对 nameref 变量解析的更改意味着对 namerefs 的某些使用会有不同的行为。默认情况下,如果启用了扩展调试模式,shell 仅在启动时设置 BASH_ARGC 和 BASH_ARGV。它被无条件地设置是一个疏忽,并且在脚本传递大量参数时会导致性能问题。 > -> Bash can be linked against an already-installed Readline library rather than the private version in lib/readline if desired. Only readline-8.0 and later versions are able to provide all of the symbols that bash-5.0 requires; earlier versions of the Readline library will not work correctly. +>如果需要,可以将 Bash 链接到已安装的 Readline 库,而不是 lib/readline 中的私有版本。只有 readline-8.0 及更高版本能够提供 bash-5.0 所需的所有符号。早期版本的 Readline 库无法正常工作。 -I believe some of the features/variables added are very useful. Some of my favorites are: +我相信一些添加的功能/变量非常有用。我最喜欢的一些是: - * There is a new (disabled by default, undocumented) shell option to enable and disable sending history to syslog at runtime. - * The shell doesn’t automatically set BASH_ARGC and BASH_ARGV at startup unless it’s in debugging mode, as the documentation has always said, but will dynamically create them if a script references them at the top level without having enabled debugging mode. - * The ‘history’ can now delete ranges of history entries using ‘-d start-end’. - * If a non-interactive shell with job control enabled detects that a foreground job died due to SIGINT, it acts as if it received the SIGINT. - * BASH_ARGV0: a new variable that expands to $0 and sets $0 on assignment. + * 有一个新的(默认情况下禁用,文档中没有说明)shell 选项,用于在运行时启用/禁用向 syslog 发送历史记录。 + * 正如文档一直所说的那样,除非 shell 处于调试模式,否则它不会在启动时自动设置 BASH_ARGC 和 BASH_ARGV,但如果脚本在上层引用它们且没有启用调试模式,那么 shell 将动态创建它们。 + * 现在可以使用 “-d start-end” 删除指定范围的 “history” 条目。 + * 如果启用了作业控制的非交互式 shell 检测到前台作业因 SIGINT 而死亡,则其行为就像接收到 SIGINT 一样。 + * BASH_ARGV0:一个新变量,扩展为 $0 并在赋值时设置 $0。 -To check the complete list of changes and features you should refer to the [Mailing list post][1]. +要查看完整的更改和功能列表,请参阅[邮件列表文章][1]。 -### Wrapping Up +### 总结 -You can check your current Bash version, using this command: +你可以使用下面的命令检查你当前的 Bash 版本: ``` bash --version ``` -It’s more likely that you’ll have Bash 4.4 installed. If you want to get the new version, I would advise waiting for your distribution to provide it. +你很可能安装了 Bash 4.4。如果你想获得新版本,我建议等待你的发行版提供它。 -With Bash-5.0 available, what do you think about it? Are you using any alternative to bash? If so, would this update change your mind? +你怎么看待 Bash-5.0 发布?你在使用其他 bash 的替代品么?如果有的话,这个更新会改变你的想法么? -Let us know your thoughts in the comments below. +请在下面的评论中告诉我们你的想法。 -------------------------------------------------------------------------------- @@ -68,7 +68,7 @@ via: https://itsfoss.com/bash-5-release 作者:[Ankush Das][a] 选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) +译者:[geekpi](https://github.com/geekpi) 校对:[校对者ID](https://github.com/校对者ID) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 diff --git a/translated/tech/20181215 Head to the arcade in your Linux terminal with this Pac-man clone.md b/translated/tech/20181215 Head to the arcade in your Linux terminal with this Pac-man clone.md new file mode 100644 index 0000000000..52878c44f0 --- /dev/null +++ b/translated/tech/20181215 Head to the arcade in your Linux terminal with this Pac-man clone.md @@ -0,0 +1,52 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Head to the arcade in your Linux terminal with this Pac-man clone) +[#]: via: (https://opensource.com/article/18/12/linux-toy-myman) +[#]: author: (Jason Baker https://opensource.com/users/jason-baker) + +用这个吃豆人克隆在你的终端中玩街机 +====== +想要重现你最喜欢的街机游戏的魔力么?今天的命令行玩具将带你回到过去。 +![](https://opensource.com/sites/default/files/styles/image-full-size/public/uploads/linux-toy-myman.png?itok=9j1DFgH0) + +欢迎来到今天的 Linux 命令行玩具日历。如果这是你第一次访问该系列,你可能会问自己什么是命令行玩具。基本上,它们是游戏和简单的消遣,可以帮助你在终端玩得开心。 + +有些是新的,有些是古老的经典。我们希望你喜欢。 + +今天的玩具,MyMan,是经典街机游戏[吃豆人][1](你不会认为这是[类似命名的][2] Linux 包管理器对吧?)的有趣克隆。 如果你和我一样,为了在吃豆人游戏中取得高分,你过去在其中花费了很多时间,那么有机会的话,你应该试试这个。 + +MyMan 并不是 Linux 终端上唯一的吃豆人克隆版,但是我选择介绍它,因为 1)我喜欢它与原版一致的视觉风格,2)它为我的 Linux 发行版已打包,因此安装很容易。但是你也应该看看其他的克隆。这是[另一个][3]看起来可能不错的,但我没有尝试过。 + +由于 MyMan 已为 Fedora 打包,因此安装非常简单: + +``` +$ dnf install myman +``` + +MyMan 在 MIT 许可下可用,你可以在 [SourceForge][4] 上查看源代码。 +![](https://opensource.com/sites/default/files/uploads/linux-toy-myman-animated.gif) +你有特别喜欢的命令行小玩具需要我介绍的吗?这个系列要介绍的小玩具大部分已经有了落实,但还预留了几个空位置。如果你有特别想了解的可以评论留言,我会查看的。如果还有空位置,我会考虑介绍它的。如果没有,但如果我得到了一些很好的意见,我会在最后做一些有价值的提及。 + +了解一下昨天的玩具,[Linux 终端能做其他事][5],还有记得明天再来! + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/18/12/linux-toy-myman + +作者:[Jason Baker][a] +选题:[lujun9972][b] +译者:[geekpi](https://github.com/geekpi) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/jason-baker +[b]: https://github.com/lujun9972 +[1]: https://en.wikipedia.org/wiki/Pac-Man +[2]: https://wiki.archlinux.org/index.php/pacman +[3]: https://github.com/YoctoForBeaglebone/pacman4console +[4]: https://myman.sourceforge.io/ +[5]: https://opensource.com/article/18/12/linux-toy-ponysay From 4c9f4bbb4b947b3b9d1ddeea09f08d7a17989f30 Mon Sep 17 00:00:00 2001 From: geekpi Date: Thu, 24 Jan 2019 08:59:55 +0800 Subject: [PATCH 098/243] translated --- .../tech/20190109 Bash 5.0 Released with New Features.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {sources => translated}/tech/20190109 Bash 5.0 Released with New Features.md (100%) diff --git a/sources/tech/20190109 Bash 5.0 Released with New Features.md b/translated/tech/20190109 Bash 5.0 Released with New Features.md similarity index 100% rename from sources/tech/20190109 Bash 5.0 Released with New Features.md rename to translated/tech/20190109 Bash 5.0 Released with New Features.md From 7da518624302bcafabb69ef4ebd9acc3ee16ea12 Mon Sep 17 00:00:00 2001 From: geekpi Date: Thu, 24 Jan 2019 09:06:55 +0800 Subject: [PATCH 099/243] Revert "translated" This reverts commit 4e684d4716003244a6d8d3e919a5083b6b7893ef. --- ... Linux terminal with this Pac-man clone.md | 52 +++++++++++++++++++ ... Linux terminal with this Pac-man clone.md | 52 ------------------- ...109 Bash 5.0 Released with New Features.md | 52 +++++++++---------- 3 files changed, 78 insertions(+), 78 deletions(-) create mode 100644 sources/tech/20181215 Head to the arcade in your Linux terminal with this Pac-man clone.md delete mode 100644 translated/tech/20181215 Head to the arcade in your Linux terminal with this Pac-man clone.md diff --git a/sources/tech/20181215 Head to the arcade in your Linux terminal with this Pac-man clone.md b/sources/tech/20181215 Head to the arcade in your Linux terminal with this Pac-man clone.md new file mode 100644 index 0000000000..0207f906df --- /dev/null +++ b/sources/tech/20181215 Head to the arcade in your Linux terminal with this Pac-man clone.md @@ -0,0 +1,52 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Head to the arcade in your Linux terminal with this Pac-man clone) +[#]: via: (https://opensource.com/article/18/12/linux-toy-myman) +[#]: author: (Jason Baker https://opensource.com/users/jason-baker) + +Head to the arcade in your Linux terminal with this Pac-man clone +====== +Want to recreate the magic of your favorite arcade game? Today's command-line toy will transport you back in time. +![](https://opensource.com/sites/default/files/styles/image-full-size/public/uploads/linux-toy-myman.png?itok=9j1DFgH0) + +Welcome back to another day of the Linux command-line toys advent calendar. If this is your first visit to the series, you might be asking yourself what command-line toys are all about. Basically, they're games and simple diversions that help you have fun at the terminal. + +Some are new, and some are old classics. We hope you enjoy. + +Today's toy, MyMan, is a fun clone of the classic arcade game [Pac-Man][1]. (You didn't think this was going to be about the [similarly-named][2] Linux package manager, did you?) If you're anything like me, you spent more than your fair share of quarters trying to hit a high score Pac-Man back in the day, and still give it a go whenever you get a chance. + +MyMan isn't the only Pac-Man clone for the Linux terminal, but it's the one I chose to include because 1) I like its visual style, which rings true to the original and 2) it's conveniently packaged for my Linux distribution so it was an easy install. But you should check out your other options as well. Here's [another one][3] that looks like it may be promising, but I haven't tried it. + +Since MyMan was packaged for Fedora, installation was as simple as: + +``` +$ dnf install myman +``` + +MyMan is made available under an MIT license and you can check out the source code on [SourceForge][4]. +![](https://opensource.com/sites/default/files/uploads/linux-toy-myman-animated.gif) +Do you have a favorite command-line toy that you think I ought to profile? The calendar for this series is mostly filled out but I've got a few spots left. Let me know in the comments below, and I'll check it out. If there's space, I'll try to include it. If not, but I get some good submissions, I'll do a round-up of honorable mentions at the end. + +Check out yesterday's toy, [The Linux terminal is no one-trick pony][5], and check back tomorrow for another! + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/18/12/linux-toy-myman + +作者:[Jason Baker][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/jason-baker +[b]: https://github.com/lujun9972 +[1]: https://en.wikipedia.org/wiki/Pac-Man +[2]: https://wiki.archlinux.org/index.php/pacman +[3]: https://github.com/YoctoForBeaglebone/pacman4console +[4]: https://myman.sourceforge.io/ +[5]: https://opensource.com/article/18/12/linux-toy-ponysay diff --git a/translated/tech/20181215 Head to the arcade in your Linux terminal with this Pac-man clone.md b/translated/tech/20181215 Head to the arcade in your Linux terminal with this Pac-man clone.md deleted file mode 100644 index 52878c44f0..0000000000 --- a/translated/tech/20181215 Head to the arcade in your Linux terminal with this Pac-man clone.md +++ /dev/null @@ -1,52 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (geekpi) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Head to the arcade in your Linux terminal with this Pac-man clone) -[#]: via: (https://opensource.com/article/18/12/linux-toy-myman) -[#]: author: (Jason Baker https://opensource.com/users/jason-baker) - -用这个吃豆人克隆在你的终端中玩街机 -====== -想要重现你最喜欢的街机游戏的魔力么?今天的命令行玩具将带你回到过去。 -![](https://opensource.com/sites/default/files/styles/image-full-size/public/uploads/linux-toy-myman.png?itok=9j1DFgH0) - -欢迎来到今天的 Linux 命令行玩具日历。如果这是你第一次访问该系列,你可能会问自己什么是命令行玩具。基本上,它们是游戏和简单的消遣,可以帮助你在终端玩得开心。 - -有些是新的,有些是古老的经典。我们希望你喜欢。 - -今天的玩具,MyMan,是经典街机游戏[吃豆人][1](你不会认为这是[类似命名的][2] Linux 包管理器对吧?)的有趣克隆。 如果你和我一样,为了在吃豆人游戏中取得高分,你过去在其中花费了很多时间,那么有机会的话,你应该试试这个。 - -MyMan 并不是 Linux 终端上唯一的吃豆人克隆版,但是我选择介绍它,因为 1)我喜欢它与原版一致的视觉风格,2)它为我的 Linux 发行版已打包,因此安装很容易。但是你也应该看看其他的克隆。这是[另一个][3]看起来可能不错的,但我没有尝试过。 - -由于 MyMan 已为 Fedora 打包,因此安装非常简单: - -``` -$ dnf install myman -``` - -MyMan 在 MIT 许可下可用,你可以在 [SourceForge][4] 上查看源代码。 -![](https://opensource.com/sites/default/files/uploads/linux-toy-myman-animated.gif) -你有特别喜欢的命令行小玩具需要我介绍的吗?这个系列要介绍的小玩具大部分已经有了落实,但还预留了几个空位置。如果你有特别想了解的可以评论留言,我会查看的。如果还有空位置,我会考虑介绍它的。如果没有,但如果我得到了一些很好的意见,我会在最后做一些有价值的提及。 - -了解一下昨天的玩具,[Linux 终端能做其他事][5],还有记得明天再来! - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/18/12/linux-toy-myman - -作者:[Jason Baker][a] -选题:[lujun9972][b] -译者:[geekpi](https://github.com/geekpi) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://opensource.com/users/jason-baker -[b]: https://github.com/lujun9972 -[1]: https://en.wikipedia.org/wiki/Pac-Man -[2]: https://wiki.archlinux.org/index.php/pacman -[3]: https://github.com/YoctoForBeaglebone/pacman4console -[4]: https://myman.sourceforge.io/ -[5]: https://opensource.com/article/18/12/linux-toy-ponysay diff --git a/translated/tech/20190109 Bash 5.0 Released with New Features.md b/translated/tech/20190109 Bash 5.0 Released with New Features.md index 34abd1661d..17b0c5758a 100644 --- a/translated/tech/20190109 Bash 5.0 Released with New Features.md +++ b/translated/tech/20190109 Bash 5.0 Released with New Features.md @@ -7,60 +7,60 @@ [#]: via: (https://itsfoss.com/bash-5-release) [#]: author: (Ankush Das https://itsfoss.com/author/ankush/) -Bash 5.0 发布了新功能 +Bash 5.0 Released with New Features ====== -[邮件列表][1]证实最近发布了 Bash-5.0。而且,令人兴奋的是它还有新功能和新变量。 +The [mailing list][1] confirmed the release of Bash-5.0 recently. And, it is exciting to know that it comes baked with new features and variable. -如果你一直在使用 Bash 4.4.XX,那么你一定会喜欢 [Bash][2] 的第五个主要版本。 +Well, if you’ve been using Bash 4.4.XX, you will definitely love the fifth major release of [Bash][2]. -第五个版本侧重于新的 shell 变量和许多重大漏洞修复。它还引入了一些新功能还有一些让 bash-4.4 和 bash-5.0 之间不兼容的更改。 +The fifth release focuses on new shell variables and a lot of major bug fixes with an overhaul. It also introduces a couple of new features along with some incompatible changes between bash-4.4 and bash-5.0. ![Bash logo][3] -### 新功能怎么样? +### What about the new features? -邮件列表解释了此版本中修复的 bug: +The mailing list explains the bug fixed in this new release: -> 此版本修复了 bash-4.4 中的几个主要错误,并引入了几个新功能。最重要的 bug 修复是对 nameref 变量的解析以及通过模糊测试发现的许多潜在的内存越界错误。在为了符合 Posix 标准解释而不进行单词拆分的上下文中,对 $@ 和 $* 的展开做了许多变化,另外还有解决极端情况中 Posix 一致性的修改。 +> This release fixes several outstanding bugs in bash-4.4 and introduces several new features. The most significant bug fixes are an overhaul of how nameref variables resolve and a number of potential out-of-bounds memory errors discovered via fuzzing. There are a number of changes to the expansion of $@ and $* in various contexts where word splitting is not performed to conform to a Posix standard interpretation, and additional changes to resolve corner cases for Posix conformance. -它还引入了一些新功能。根据发布说明,最值得注意的新功能是几个新的 shell 变量: +It also introduces some new features. As per the release note, these are the most notable new features are several new shell variables: -> BASH_ARGV0、EPOCHSECONDS 和 EPOCHREALTIME。内置的 “history” 可以删除指定范围的条目,并能将负数理解为从历史末端开始的偏移量。有一个选项允许局部变量继承前一个范围内具有相同名称的变量的值。有一个新的shell选项,在启用它时,会导致 shell 只尝试一次扩展关联数组下标(这在算术表达式中使用时会出现问题)。“globasciiranges” 这个 shell 选项现在默认启用。可以在配置时默认关闭它。 +> The BASH_ARGV0, EPOCHSECONDS, and EPOCHREALTIME. The ‘history’ builtin can remove ranges of history entries and understands negative arguments as offsets from the end of the history list. There is an option to allow local variables to inherit the value of a variable with the same name at a preceding scope. There is a new shell option that, when enabled, causes the shell to attempt to expand associative array subscripts only once (this is an issue when they are used in arithmetic expressions). The ‘globasciiranges‘ shell option is now enabled by default; it can be set to off by default at configuration time. -### Bash-4.4 和 Bash-5.0 之间有哪些变化? +### What about the changes between Bash-4.4 and Bash-5.0? -更新日志提到了不兼容的更改和支持 readline 版本历史记录。它是这么说的: +The update log mentioned about the incompatible changes and the supported readline version history. Here’s what it said: -> bash-4.4 和 bash-5.0 之间存在一些不兼容的变化。尽管我已经尽量最小化兼容性问题,但是对 nameref 变量解析的更改意味着对 namerefs 的某些使用会有不同的行为。默认情况下,如果启用了扩展调试模式,shell 仅在启动时设置 BASH_ARGC 和 BASH_ARGV。它被无条件地设置是一个疏忽,并且在脚本传递大量参数时会导致性能问题。 +> There are a few incompatible changes between bash-4.4 and bash-5.0. The changes to how nameref variables are resolved means that some uses of namerefs will behave differently, though I have tried to minimize the compatibility issues. By default, the shell only sets BASH_ARGC and BASH_ARGV at startup if extended debugging mode is enabled; it was an oversight that it was set unconditionally and caused performance issues when scripts were passed large numbers of arguments. > ->如果需要,可以将 Bash 链接到已安装的 Readline 库,而不是 lib/readline 中的私有版本。只有 readline-8.0 及更高版本能够提供 bash-5.0 所需的所有符号。早期版本的 Readline 库无法正常工作。 +> Bash can be linked against an already-installed Readline library rather than the private version in lib/readline if desired. Only readline-8.0 and later versions are able to provide all of the symbols that bash-5.0 requires; earlier versions of the Readline library will not work correctly. -我相信一些添加的功能/变量非常有用。我最喜欢的一些是: +I believe some of the features/variables added are very useful. Some of my favorites are: - * 有一个新的(默认情况下禁用,文档中没有说明)shell 选项,用于在运行时启用/禁用向 syslog 发送历史记录。 - * 正如文档一直所说的那样,除非 shell 处于调试模式,否则它不会在启动时自动设置 BASH_ARGC 和 BASH_ARGV,但如果脚本在上层引用它们且没有启用调试模式,那么 shell 将动态创建它们。 - * 现在可以使用 “-d start-end” 删除指定范围的 “history” 条目。 - * 如果启用了作业控制的非交互式 shell 检测到前台作业因 SIGINT 而死亡,则其行为就像接收到 SIGINT 一样。 - * BASH_ARGV0:一个新变量,扩展为 $0 并在赋值时设置 $0。 + * There is a new (disabled by default, undocumented) shell option to enable and disable sending history to syslog at runtime. + * The shell doesn’t automatically set BASH_ARGC and BASH_ARGV at startup unless it’s in debugging mode, as the documentation has always said, but will dynamically create them if a script references them at the top level without having enabled debugging mode. + * The ‘history’ can now delete ranges of history entries using ‘-d start-end’. + * If a non-interactive shell with job control enabled detects that a foreground job died due to SIGINT, it acts as if it received the SIGINT. + * BASH_ARGV0: a new variable that expands to $0 and sets $0 on assignment. -要查看完整的更改和功能列表,请参阅[邮件列表文章][1]。 +To check the complete list of changes and features you should refer to the [Mailing list post][1]. -### 总结 +### Wrapping Up -你可以使用下面的命令检查你当前的 Bash 版本: +You can check your current Bash version, using this command: ``` bash --version ``` -你很可能安装了 Bash 4.4。如果你想获得新版本,我建议等待你的发行版提供它。 +It’s more likely that you’ll have Bash 4.4 installed. If you want to get the new version, I would advise waiting for your distribution to provide it. -你怎么看待 Bash-5.0 发布?你在使用其他 bash 的替代品么?如果有的话,这个更新会改变你的想法么? +With Bash-5.0 available, what do you think about it? Are you using any alternative to bash? If so, would this update change your mind? -请在下面的评论中告诉我们你的想法。 +Let us know your thoughts in the comments below. -------------------------------------------------------------------------------- @@ -68,7 +68,7 @@ via: https://itsfoss.com/bash-5-release 作者:[Ankush Das][a] 选题:[lujun9972][b] -译者:[geekpi](https://github.com/geekpi) +译者:[译者ID](https://github.com/译者ID) 校对:[校对者ID](https://github.com/校对者ID) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From e87fe30334f5433eb653a0493a4d41f55eefc979 Mon Sep 17 00:00:00 2001 From: geekpi Date: Thu, 24 Jan 2019 09:07:10 +0800 Subject: [PATCH 100/243] Revert "translated" This reverts commit 4c9f4bbb4b947b3b9d1ddeea09f08d7a17989f30. --- .../tech/20190109 Bash 5.0 Released with New Features.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {translated => sources}/tech/20190109 Bash 5.0 Released with New Features.md (100%) diff --git a/translated/tech/20190109 Bash 5.0 Released with New Features.md b/sources/tech/20190109 Bash 5.0 Released with New Features.md similarity index 100% rename from translated/tech/20190109 Bash 5.0 Released with New Features.md rename to sources/tech/20190109 Bash 5.0 Released with New Features.md From c40613ac2ec77a77d575711890d64cab08b7ca4a Mon Sep 17 00:00:00 2001 From: geekpi Date: Thu, 24 Jan 2019 09:19:01 +0800 Subject: [PATCH 101/243] translated --- ... Linux terminal with this Pac-man clone.md | 52 ------------------- ... Linux terminal with this Pac-man clone.md | 49 +++++++++++++++++ 2 files changed, 49 insertions(+), 52 deletions(-) delete mode 100644 sources/tech/20181215 Head to the arcade in your Linux terminal with this Pac-man clone.md create mode 100644 translated/tech/20181215 Head to the arcade in your Linux terminal with this Pac-man clone.md diff --git a/sources/tech/20181215 Head to the arcade in your Linux terminal with this Pac-man clone.md b/sources/tech/20181215 Head to the arcade in your Linux terminal with this Pac-man clone.md deleted file mode 100644 index 0207f906df..0000000000 --- a/sources/tech/20181215 Head to the arcade in your Linux terminal with this Pac-man clone.md +++ /dev/null @@ -1,52 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (geekpi) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Head to the arcade in your Linux terminal with this Pac-man clone) -[#]: via: (https://opensource.com/article/18/12/linux-toy-myman) -[#]: author: (Jason Baker https://opensource.com/users/jason-baker) - -Head to the arcade in your Linux terminal with this Pac-man clone -====== -Want to recreate the magic of your favorite arcade game? Today's command-line toy will transport you back in time. -![](https://opensource.com/sites/default/files/styles/image-full-size/public/uploads/linux-toy-myman.png?itok=9j1DFgH0) - -Welcome back to another day of the Linux command-line toys advent calendar. If this is your first visit to the series, you might be asking yourself what command-line toys are all about. Basically, they're games and simple diversions that help you have fun at the terminal. - -Some are new, and some are old classics. We hope you enjoy. - -Today's toy, MyMan, is a fun clone of the classic arcade game [Pac-Man][1]. (You didn't think this was going to be about the [similarly-named][2] Linux package manager, did you?) If you're anything like me, you spent more than your fair share of quarters trying to hit a high score Pac-Man back in the day, and still give it a go whenever you get a chance. - -MyMan isn't the only Pac-Man clone for the Linux terminal, but it's the one I chose to include because 1) I like its visual style, which rings true to the original and 2) it's conveniently packaged for my Linux distribution so it was an easy install. But you should check out your other options as well. Here's [another one][3] that looks like it may be promising, but I haven't tried it. - -Since MyMan was packaged for Fedora, installation was as simple as: - -``` -$ dnf install myman -``` - -MyMan is made available under an MIT license and you can check out the source code on [SourceForge][4]. -![](https://opensource.com/sites/default/files/uploads/linux-toy-myman-animated.gif) -Do you have a favorite command-line toy that you think I ought to profile? The calendar for this series is mostly filled out but I've got a few spots left. Let me know in the comments below, and I'll check it out. If there's space, I'll try to include it. If not, but I get some good submissions, I'll do a round-up of honorable mentions at the end. - -Check out yesterday's toy, [The Linux terminal is no one-trick pony][5], and check back tomorrow for another! - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/18/12/linux-toy-myman - -作者:[Jason Baker][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://opensource.com/users/jason-baker -[b]: https://github.com/lujun9972 -[1]: https://en.wikipedia.org/wiki/Pac-Man -[2]: https://wiki.archlinux.org/index.php/pacman -[3]: https://github.com/YoctoForBeaglebone/pacman4console -[4]: https://myman.sourceforge.io/ -[5]: https://opensource.com/article/18/12/linux-toy-ponysay diff --git a/translated/tech/20181215 Head to the arcade in your Linux terminal with this Pac-man clone.md b/translated/tech/20181215 Head to the arcade in your Linux terminal with this Pac-man clone.md new file mode 100644 index 0000000000..121f29e248 --- /dev/null +++ b/translated/tech/20181215 Head to the arcade in your Linux terminal with this Pac-man clone.md @@ -0,0 +1,49 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Head to the arcade in your Linux terminal with this Pac-man clone) +[#]: via: (https://opensource.com/article/18/12/linux-toy-myman) +[#]: author: (Jason Baker https://opensource.com/users/jason-baker) + +用这个吃豆人克隆在你的终端中玩街机 +====== +想要重现你最喜欢的街机游戏的魔力么?今天的命令行玩具将带你回到过去。 +![](https://opensource.com/sites/default/files/styles/image-full-size/public/uploads/linux-toy-myman.png?itok=9j1DFgH0) + +欢迎来到今天的 Linux 命令行玩具日历。如果这是你第一次访问该系列,你可能会问自己什么是命令行玩具。基本上,它们是游戏和简单的消遣,可以帮助你在终端玩得开心。 + +有些是新的,有些是古老的经典。我们希望你喜欢。 + +今天的玩具,MyMan,是经典街机游戏[吃豆人][1](你不会认为这是[类似命名的][2] Linux 包管理器对吧?)的有趣克隆。 如果你和我一样,为了在吃豆人游戏中取得高分,你过去在其中花费了很多时间,那么有机会的话,你应该试试这个。 + +MyMan 并不是 Linux 终端上唯一的吃豆人克隆版,但是我选择介绍它,因为 1)我喜欢它与原版一致的视觉风格,2)它为我的 Linux 发行版已打包,因此安装很容易。但是你也应该看看其他的克隆。这是[另一个][3]看起来可能不错的,但我没有尝试过。 + +由于 MyMan 已为 Fedora 打包,因此安装非常简单: + +``` +$ dnf install myman +``` + +MyMan 在 MIT 许可下可用,你可以在 [SourceForge][4] 上查看源代码。 +![](https://opensource.com/sites/default/files/uploads/linux-toy-myman-animated.gif) + +你有特别喜欢的命令行小玩具需要我介绍的吗?这个系列要介绍的小玩具大部分已经有了落实,但还预留了几个空位置。如果你有特别想了解的可以评论留言,我会查看的。如果还有空位置,我会考虑介绍它的。如果没有,但如果我得到了一些很好的意见,我会在最后做一些有价值的提及。 + +了解一下昨天的玩具,[Linux 终端能做其他事][5],还有记得明天再来! + +-------------------------------------------------------------------------------- +via: https://opensource.com/article/18/12/linux-toy-myman +作者:[Jason Baker][a] +选题:[lujun9972][b] +译者:[geekpi](https://github.com/geekpi) +校对:[校对者ID](https://github.com/校对者ID) +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 +[a]: https://opensource.com/users/jason-baker +[b]: https://github.com/lujun9972 +[1]: https://en.wikipedia.org/wiki/Pac-Man +[2]: https://wiki.archlinux.org/index.php/pacman +[3]: https://github.com/YoctoForBeaglebone/pacman4console +[4]: https://myman.sourceforge.io/ +[5]: https://opensource.com/article/18/12/linux-toy-ponysay From 4c0a0b18d346c2f812f6b5bc14f2cf1a06e95752 Mon Sep 17 00:00:00 2001 From: geekpi Date: Thu, 24 Jan 2019 09:21:33 +0800 Subject: [PATCH 102/243] translating --- sources/tech/20181219 How to open source your Python library.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20181219 How to open source your Python library.md b/sources/tech/20181219 How to open source your Python library.md index cf59688484..79c25c9a00 100644 --- a/sources/tech/20181219 How to open source your Python library.md +++ b/sources/tech/20181219 How to open source your Python library.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (geekpi) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From d8a6131b85df1438763b5fdeae048e446d3b693c Mon Sep 17 00:00:00 2001 From: HankChow <280630620@qq.com> Date: Thu, 24 Jan 2019 19:33:57 +0800 Subject: [PATCH 103/243] hankchow translating --- sources/tech/20181212 Top 5 configuration management tools.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20181212 Top 5 configuration management tools.md b/sources/tech/20181212 Top 5 configuration management tools.md index 72aebb209a..f7e59bcf08 100644 --- a/sources/tech/20181212 Top 5 configuration management tools.md +++ b/sources/tech/20181212 Top 5 configuration management tools.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (HankChow) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From f25816fbac658831b6a6bd4b2eed807123184d38 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Thu, 24 Jan 2019 19:42:39 +0800 Subject: [PATCH 104/243] PRF:20181128 Arch-Audit - A Tool To Check Vulnerable Packages In Arch Linux.md @Auk7F7 --- ...Check Vulnerable Packages In Arch Linux.md | 44 ++++++++----------- 1 file changed, 19 insertions(+), 25 deletions(-) diff --git a/translated/tech/20181128 Arch-Audit - A Tool To Check Vulnerable Packages In Arch Linux.md b/translated/tech/20181128 Arch-Audit - A Tool To Check Vulnerable Packages In Arch Linux.md index 2580b53a3d..325cadf36c 100644 --- a/translated/tech/20181128 Arch-Audit - A Tool To Check Vulnerable Packages In Arch Linux.md +++ b/translated/tech/20181128 Arch-Audit - A Tool To Check Vulnerable Packages In Arch Linux.md @@ -1,58 +1,52 @@ [#]: collector: "lujun9972" -[#]: translator: " " -[#]: reviewer: " " +[#]: translator: "Auk7F7" +[#]: reviewer: "wxy" [#]: publisher: " " [#]: subject: "Arch-Audit : A Tool To Check Vulnerable Packages In Arch Linux" [#]: via: "https://www.2daygeek.com/arch-audit-a-tool-to-check-vulnerable-packages-in-arch-linux/" [#]: author: "Prakash Subramanian https://www.2daygeek.com/author/prakash/" [#]: url: " " -Arch-Audit : 一款在 Arch Linux 上检查易受攻击包的工具 +Arch-Audit:一款在 Arch Linux 上检查易受攻击的软件包的工具 ====== -我们必须经常更新我们的系统以减少宕机时间和问题。 +我们必须经常更新我们的系统以减少宕机时间和问题。每月给系统打一次补丁,60 天一次或者最多 90 天一次,这是 Linux 管理员的例行任务之一。这是忙碌的工作计划,我们不能在不到一个月内做到这一点,因为它涉及到多种活动和环境。 -每月给系统打一次补丁,60天一次或者最多90天一次,这是 Linux 管理员的例行任务之一。 +基本上,基础设施会一同提供测试、开发、 QA 环境(即各个分段和产品)。 -这将是忙碌的工作计划,我们不能在不到一个月内做到这一点,因为它涉及到多种活动和环境。 +最初,我们会在测试环境中部署补丁,相应的团队将监视系统一周,然后他们将给出一份或好或坏的状态的报告。如果成功的话,我们将会在其他环境中继续测试,若正常运行,那么最后我们会给生产服务器打上补丁。 -基本上,基础架构与测试、开发、 QA (即分段和产品开发环境)一起提供。 +许多组织会对整个系统打上补丁,我的意思是全系统更新,对于典型基础设施这是一种常规修补计划。 -最初,我们会在测试环境中部署补丁,相应的团队将监视系统一周,然后他们将给出一份比如好的或坏的状态报告。 +某些基础设施中可能只有生产环境,因此,我们不应该做全系统更新,而是应该使用安全修补程序来使系统更加稳定和安全。 -如果它是成功的话,我们将会在其他环境中继续测试,若正常运行,那么最后我们会给生产服务器打上补丁。 +由于 Arch Linux 及其衍生的发行版属于滚动更新版本,因此可以认为它们始终是最新的,因为它使用上游软件包的最新版本。 -许多组织已经准备好给整个系统打上补丁。我的意思是全部系统的更新,这是一种对于基础设施的常规修补计划。 - -在一些基础结构中,他们可能只有生产环境,因此,我们不应该为完整的系统更新做好准备,而是可以使用安全修补程序来使系统更加稳定和安全。 - -由于 Arch Linux 及其衍发行版本属于滚动更新版本,因此可以认为他们始终是最新的,因为它使用上游软件包的最新版本。 - -在某些情况下,如果要单独更新安全修补程序 ,则必须使用 arch-audit 工具来标识和修复安全修补程序。 +在某些情况下,如果要单独更新安全修补程序,则必须使用 arch-audit 工具来标识和修复安全修补程序。 ### 漏洞是什么? 漏洞是软件程序或硬件组件(固件)中的安全漏洞。这是一个可以让它容易受到攻击的缺陷。 -为了缓解这种情况,我们需要相应地修补,就像应用程序/硬件一样,它可能是代码更改或配置更改或参数更改。 +为了缓解这种情况,我们需要相应地修补漏洞,就像应用程序/硬件一样,它可能是代码更改或配置更改或参数更改。 -### Arch-Audit 工具是什么? +### Arch-Audit 工具是什么? -[Arch-audit][1] 是一个类似于 Arch Linux 的 pkg-audit 工具。它使用了令人称赞的 Arch 安全小组收集的数据。他不会扫描并发现系统中易受攻击的包,如 **yum –security check-update & yum updateinfo list available**,它只需解析 页面并在终端中显示结果,因此,它将显示准确的数据。 +[Arch-audit][1] 是一个类似于 Arch Linux 的 pkg-audit 工具。它使用了令人称赞的 Arch 安全小组收集的数据。它不会扫描以发现系统中易受攻击的包(就像 `yum –security check-update & yum updateinfo` 一样列出可用的软件包),它只需解析 页面并在终端中显示结果,因此,它将显示准确的数据。(LCTT 译注:此处原作者叙述不清晰。该功能虽然不会像病毒扫描软件一样扫描系统上的文件,但是会读取已安装的软件列表,并据此查询上述网址列出风险报告。) -Arch 安全小组是一群以跟踪 Arch Linux 软件包的安全问题为目的的志愿者。所有问题都在 Arch 安全追踪者的监视下。. +Arch 安全小组是一群以跟踪 Arch Linux 软件包的安全问题为目的的志愿者。所有问题都在 Arch 安全追踪者的监视下。 该小组以前被称为 Arch CVE 监测小组,Arch 安全小组的使命是为提高 Arch Linux 的安全性做出贡献。 -### 如何在 Arch Linux 上安装 Arch-Audit 工具 +### 如何在 Arch Linux 上安装 Arch-Audit 工具 -arch-audit 工具已经存在社区源中,所以你可以使用 Pacman 包管理器来安装它。 +Arch-audit 工具已经存在社区的仓库中,所以你可以使用 Pacman 包管理器来安装它。 ``` $ sudo pacman -S arch-audit ``` -运行 `arch-audit` 工具以查找在基于 Arch 的发行版本上的开放且易受攻击的包。 +运行 `arch-audit` 工具以查找在基于 Arch 的发行版本上的存在缺陷的包。 ``` $ arch-audit @@ -96,7 +90,7 @@ systemd>=239.300-1 webkit2gtk>=2.22.4-1 ``` -为了交叉检查上述结果,我将测试在 列出的一个包以确认漏洞是否仍处于开放状态或已修复。是的,它已经被修复了,并于昨天在社区源中发布了更新后的包。 +为了交叉检查上述结果,我将测试在 列出的一个包以确认漏洞是否仍处于开放状态或已修复。是的,它已经被修复了,并于昨天在社区仓库中发布了更新后的包。 ![][3] @@ -117,7 +111,7 @@ via: https://www.2daygeek.com/arch-audit-a-tool-to-check-vulnerable-packages-in- 作者:[Prakash Subramanian][a] 选题:[lujun9972][b] 译者:[Auk7F7](https://github.com/Auk7F7) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 0f1ac135c8b34bc523d091d1dd8c746c10fdd49c Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Thu, 24 Jan 2019 19:43:28 +0800 Subject: [PATCH 105/243] PUB:20181128 Arch-Audit - A Tool To Check Vulnerable Packages In Arch Linux.md @Auk7F7 https://linux.cn/article-10473-1.html --- ...dit - A Tool To Check Vulnerable Packages In Arch Linux.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20181128 Arch-Audit - A Tool To Check Vulnerable Packages In Arch Linux.md (98%) diff --git a/translated/tech/20181128 Arch-Audit - A Tool To Check Vulnerable Packages In Arch Linux.md b/published/20181128 Arch-Audit - A Tool To Check Vulnerable Packages In Arch Linux.md similarity index 98% rename from translated/tech/20181128 Arch-Audit - A Tool To Check Vulnerable Packages In Arch Linux.md rename to published/20181128 Arch-Audit - A Tool To Check Vulnerable Packages In Arch Linux.md index 325cadf36c..e31694679f 100644 --- a/translated/tech/20181128 Arch-Audit - A Tool To Check Vulnerable Packages In Arch Linux.md +++ b/published/20181128 Arch-Audit - A Tool To Check Vulnerable Packages In Arch Linux.md @@ -1,11 +1,11 @@ [#]: collector: "lujun9972" [#]: translator: "Auk7F7" [#]: reviewer: "wxy" -[#]: publisher: " " +[#]: publisher: "wxy" [#]: subject: "Arch-Audit : A Tool To Check Vulnerable Packages In Arch Linux" [#]: via: "https://www.2daygeek.com/arch-audit-a-tool-to-check-vulnerable-packages-in-arch-linux/" [#]: author: "Prakash Subramanian https://www.2daygeek.com/author/prakash/" -[#]: url: " " +[#]: url: "https://linux.cn/article-10473-1.html" Arch-Audit:一款在 Arch Linux 上检查易受攻击的软件包的工具 ====== From 27cdebd9fdf3a92c74f54cef4c6a9358fbb97aca Mon Sep 17 00:00:00 2001 From: jrg Date: Thu, 24 Jan 2019 20:32:06 +0800 Subject: [PATCH 106/243] =?UTF-8?q?[=E7=BF=BB=E8=AF=91=E4=B8=AD]by=20jrg?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit [翻译中]by jrg --- .../tech/20190114 Turn a Raspberry Pi 3B- into a PriTunl VPN.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20190114 Turn a Raspberry Pi 3B- into a PriTunl VPN.md b/sources/tech/20190114 Turn a Raspberry Pi 3B- into a PriTunl VPN.md index b7e55e0efb..3d6d94cabf 100644 --- a/sources/tech/20190114 Turn a Raspberry Pi 3B- into a PriTunl VPN.md +++ b/sources/tech/20190114 Turn a Raspberry Pi 3B- into a PriTunl VPN.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (jrglinux) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From cececf2aae14e6253d837563b98aa0c90a982265 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Thu, 24 Jan 2019 20:43:28 +0800 Subject: [PATCH 107/243] PRF:20181215 Head to the arcade in your Linux terminal with this Pac-man clone.md @geekpi --- ... Linux terminal with this Pac-man clone.md | 20 ++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/translated/tech/20181215 Head to the arcade in your Linux terminal with this Pac-man clone.md b/translated/tech/20181215 Head to the arcade in your Linux terminal with this Pac-man clone.md index 121f29e248..9401fcf095 100644 --- a/translated/tech/20181215 Head to the arcade in your Linux terminal with this Pac-man clone.md +++ b/translated/tech/20181215 Head to the arcade in your Linux terminal with this Pac-man clone.md @@ -1,24 +1,26 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Head to the arcade in your Linux terminal with this Pac-man clone) [#]: via: (https://opensource.com/article/18/12/linux-toy-myman) [#]: author: (Jason Baker https://opensource.com/users/jason-baker) -用这个吃豆人克隆在你的终端中玩街机 +用这个吃豆人游戏在你的终端中玩街机 ====== -想要重现你最喜欢的街机游戏的魔力么?今天的命令行玩具将带你回到过去。 + +> 想要重现你最喜欢的街机游戏的魔力么?今天的命令行玩具将带你回到过去。 + ![](https://opensource.com/sites/default/files/styles/image-full-size/public/uploads/linux-toy-myman.png?itok=9j1DFgH0) -欢迎来到今天的 Linux 命令行玩具日历。如果这是你第一次访问该系列,你可能会问自己什么是命令行玩具。基本上,它们是游戏和简单的消遣,可以帮助你在终端玩得开心。 +欢迎来到今天的 Linux 命令行玩具日历。如果这是你第一次访问该系列,你会问什么是命令行玩具。基本上,它们是游戏和简单的消遣,可以帮助你在终端玩得开心。 有些是新的,有些是古老的经典。我们希望你喜欢。 -今天的玩具,MyMan,是经典街机游戏[吃豆人][1](你不会认为这是[类似命名的][2] Linux 包管理器对吧?)的有趣克隆。 如果你和我一样,为了在吃豆人游戏中取得高分,你过去在其中花费了很多时间,那么有机会的话,你应该试试这个。 +今天的玩具,MyMan,是经典街机游戏[吃豆人][1]Pac-Man(你不会认为这是[类似命名的][2] Linux 包管理器对吧?)的有趣克隆。 如果你和我一样,为了在吃豆人游戏中取得高分,你过去在其中花费了很多时间,那么有机会的话,你应该试试这个。 -MyMan 并不是 Linux 终端上唯一的吃豆人克隆版,但是我选择介绍它,因为 1)我喜欢它与原版一致的视觉风格,2)它为我的 Linux 发行版已打包,因此安装很容易。但是你也应该看看其他的克隆。这是[另一个][3]看起来可能不错的,但我没有尝试过。 +MyMan 并不是 Linux 终端上唯一的吃豆人克隆版,但是我选择介绍它,因为 1)我喜欢它与原版一致的视觉风格,2)它为我的 Linux 发行版打包了,因此安装很容易。但是你也应该看看其他的克隆。这是[另一个][3]看起来可能不错的,但我没有尝试过。 由于 MyMan 已为 Fedora 打包,因此安装非常简单: @@ -27,6 +29,7 @@ $ dnf install myman ``` MyMan 在 MIT 许可下可用,你可以在 [SourceForge][4] 上查看源代码。 + ![](https://opensource.com/sites/default/files/uploads/linux-toy-myman-animated.gif) 你有特别喜欢的命令行小玩具需要我介绍的吗?这个系列要介绍的小玩具大部分已经有了落实,但还预留了几个空位置。如果你有特别想了解的可以评论留言,我会查看的。如果还有空位置,我会考虑介绍它的。如果没有,但如果我得到了一些很好的意见,我会在最后做一些有价值的提及。 @@ -35,11 +38,14 @@ MyMan 在 MIT 许可下可用,你可以在 [SourceForge][4] 上查看源代码 -------------------------------------------------------------------------------- via: https://opensource.com/article/18/12/linux-toy-myman + 作者:[Jason Baker][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/) 荣誉推出 + [a]: https://opensource.com/users/jason-baker [b]: https://github.com/lujun9972 [1]: https://en.wikipedia.org/wiki/Pac-Man From 39c38f72e4b72a6ff7beb1e1f925d7fd76067311 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Thu, 24 Jan 2019 20:44:16 +0800 Subject: [PATCH 108/243] PUB:20181215 Head to the arcade in your Linux terminal with this Pac-man clone.md @geekpi https://linux.cn/article-10474-1.html --- ...e arcade in your Linux terminal with this Pac-man clone.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20181215 Head to the arcade in your Linux terminal with this Pac-man clone.md (97%) diff --git a/translated/tech/20181215 Head to the arcade in your Linux terminal with this Pac-man clone.md b/published/20181215 Head to the arcade in your Linux terminal with this Pac-man clone.md similarity index 97% rename from translated/tech/20181215 Head to the arcade in your Linux terminal with this Pac-man clone.md rename to published/20181215 Head to the arcade in your Linux terminal with this Pac-man clone.md index 9401fcf095..f7e411d88a 100644 --- a/translated/tech/20181215 Head to the arcade in your Linux terminal with this Pac-man clone.md +++ b/published/20181215 Head to the arcade in your Linux terminal with this Pac-man clone.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-10474-1.html) [#]: subject: (Head to the arcade in your Linux terminal with this Pac-man clone) [#]: via: (https://opensource.com/article/18/12/linux-toy-myman) [#]: author: (Jason Baker https://opensource.com/users/jason-baker) From 6d6576dca49d3b609d71be3a716687d727b04dda Mon Sep 17 00:00:00 2001 From: yuqi Date: Thu, 24 Jan 2019 20:58:44 +0800 Subject: [PATCH 109/243] translation completed --- ...Years With Emacs as a CEO (and now CTO).md | 86 ------------------ ...Years With Emacs as a CEO (and now CTO).md | 87 +++++++++++++++++++ 2 files changed, 87 insertions(+), 86 deletions(-) delete mode 100644 sources/talk/20180809 Two Years With Emacs as a CEO (and now CTO).md create mode 100644 translated/talk/20180809 Two Years With Emacs as a CEO (and now CTO).md diff --git a/sources/talk/20180809 Two Years With Emacs as a CEO (and now CTO).md b/sources/talk/20180809 Two Years With Emacs as a CEO (and now CTO).md deleted file mode 100644 index b144fe4201..0000000000 --- a/sources/talk/20180809 Two Years With Emacs as a CEO (and now CTO).md +++ /dev/null @@ -1,86 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (oneforalone) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Two Years With Emacs as a CEO (and now CTO)) -[#]: via: (https://www.fugue.co/blog/2018-08-09-two-years-with-emacs-as-a-cto.html) -[#]: author: (Josh Stella https://www.fugue.co/blog/author/josh-stella) - -Two Years With Emacs as a CEO (and now CTO) -====== - -Two years ago, I wrote [a blog post][1] that got some notice, which surprised me. It was a piece about going back to Emacs as my primary content creation tool, first as a CEO, and now as a CTO. A brief recap is that I spent most of my career as a programmer and a software architect, and preferred Emacs as my code editor for much of that time. Reconsidering Emacs was an experiment that I was excited about, but wasn't sure how it would work out. On the Internet, the post was met with roughly equal parts disdain and appreciation, but tens of thousands of people read it, so it seems that I touched on something interesting. Some of the more challenging and funny posts on [Reddit][2] and [HackerNews][3] predicted that I'd have hands shaped like claws or that I'd have lost my eyesight because I use white backgrounds. I'm pleased to report that no dire consequences resulted, and in fact my wrists are thanking me for the decision. Some folks worried that using Emacs would be a cognitive drain on a CEO. Having taken Fugue from an idea in my backyard to a powerful product with great and enthusiastic customers, I find Emacs to be a solace from things that are actually difficult. I still use white backgrounds. - -Recently, the post was rediscovered and posted to [HackerNews][4]. I got a number of requests to follow up with a post on how things have gone since, so this is that report. In this post, I will also focus on why Emacs and functional programming are highly relevant now; and how Emacs works with our product, Fugue, that uses functional programming to automate cloud computing. I received a lot of feedback that the level of detail and color commentary were useful, so this post is also fairly verbose and I do spend some effort on explaining my thinking. I've recently moved from the CEO to CTO role here at Fugue, but the content of this post reflects the work I have been doing as CEO. I expect to do more work in code with Emacs going forward, so I have some yak shaving ahead. As always, YMMV, caveat emptor, etc. - -### It worked out better than I suspected it would - -My time is filled with nearly constant communication outside of and within the company. Communication is how things get done in the world, and the enemy of reflection and real contemplation of difficult or complex problems. The rarest commodity for me as a startup CEO is time to focus without distraction. Emacs is particularly good for this, once you've invested the time to learn a handful of commands. Other applications call out to be noticed, but a well configured Emacs gets out of the way both visually and mentally. It doesn't change unless you want it to, and there is no cleaner interface than a blank screen and beautiful typography. In my world of constant interruption, this simplicity allows me to focus solely on what I am thinking rather than the computer. The best programs provide access to the computer without demanding attention. - -A few folks pointed out that the original post was as much a criticism of modern computer interfaces as a recommendation of Emacs. I agree and disagree. Modern interfaces, and particularly their application-centric approach (vs. content-centric), are not user focused or task oriented. Emacs avoids this fallacy, which is part of why I like it so much, but it brings other merits to the table as well. Emacs is a portal into the power of the computer itself, and that is a rabbit hole worth descending. Its idioms are paths to discovering and creating your own, and that for me is the definition of creativity. One of the sad things about modern computing is that it is largely made up of black boxes with shiny interfaces that provide momentary gratification rather than real satisfaction. This makes us into consumers rather than creators/makers of technology. I don't care who you are or what your background is; you can understand your computer, and you can make things with it. It's fun, satisfying, and not as hard as you think to get started! - -We often underappreciate the effects of our environments on our psychology. Emacs imparts a feeling of calm and freedom, rather than of urgency, annoyance, or excitement - the latter of which are enemies of thought and contemplation. I like things that last, get out of the way, and provide insight when I do take the time to pay attention to them. Emacs meets all these criteria for me. I use Emacs every day for content creation, and I'm very pleased with how little I think about it. Emacs does have a learning curve, but it's no steeper than a bicycle, and has a similar payoff in that once you are through it, you don't have to think about it anymore, and it imparts a feeling of freedom that other tools don't. It's an elegant tool, from a more civilized age. I'm happy that we seem to be entering another civilized age in computing, and so Emacs is gaining in popularity. - -### I gave up on using Org-mode for schedules and to-do lists - -I spent some words in the original post on using Org-mode for schedules. I gave up on using Org-mode for to dos and the like, as I have to coordinate many meetings and calls every day with dozens of people, and I cannot ask the rest of the world to adapt to my choice of tools, nor do I have the time to transcribe or automate moving things to Org. We are primarily a Mac shop, use Google Calendar etc., and the native Mac OS/iOS tools do a good job for collaboration. I also use a plain old pen for note-taking during meetings, as I find laptop/keyboard use in meetings to be rude and limiting to my ability to listen and think. Therefore I've largely abandoned the idea that Emacs/org can help me with my schedule or organizing my life. Org-mode is great for lots of other things too though, and is my go-to for writing documents, including this one. In other words, I use it largely in ways the author didn't intend, and it's great at them. I hope someone says the same of our work at Fugue someday. - -### Emacs use has spread at Fugue - -I started the original post with an admonition that you may love Emacs, but will probably hate it. I was therefore a little concerned when the documentation team at Fugue picked it as their standard tool, as I thought perhaps they were influenced by my appreciation for it. A couple years later, I'm pretty sure that it was a good call for them. The leader of the team at the time was a very bright programmer, but the two writers we hired to make the Fugue documentation had less technical backgrounds. I figured that if it was a case of a manager imposing the wrong tool, I'd hear about it and it would resolve itself, as Fugue has an anti-authoritarian culture where people are unafraid to call bullshit on anything or anyone, including me. The original manager left Fugue last year, but the docs team now has a slick, integrated CI/CD toolchain for [docs.fugue.co][5], and they've become enthusiastic Emacs users. There is a learning curve for Emacs, but it's not that tall even if it is steep, and climbing it has real benefits in productivity and general happiness. It was also a reminder that liberal arts focused people are every bit as smart and capable with technology as programmers, and perhaps less prone to technology religions and tribalism. - -### My wrists are thanking me - -I've been spending 12 hours a day or so at a computer since the mid-eighties, and it has taken a toll on my wrists (as well as my back, for which I unreservedly recommend the Tag Capisco chair). The combination of Emacs and an ergonomic keyboard has made the RSI wrist issues go away to the point that I haven't thought about it in over a year. Prior to that, I was having daily pain, particularly in my right wrist, and if you've had this issue, you know it can be very distracting and worrying. A few folks asked about keyboards and mice, so if you're interested I'm currently using a [keyboard.io][6] though I've mainly used a Truly Ergonomic keyboard over the last couple years. I'm a few weeks into using the keyboard.io, and I absolutely love it. The shaped key caps are amazing for knowing where you are without looking, and the thumb keys seem obvious in retrospect, particularly for Emacs, where Control and Meta are your constant companions. No more using the pinkie for highly repetitive tasks! - -The amount of mousing I do is much lower than when using Office and IDEs, and that has helped a lot, but I do still need a mouse. I've been using the rather dated looking but highly functional and ergonomic Clearly Superior trackball, which lives up to its name. - -Specific tools aside, the main point is that a great keyboard combined with mouse avoidance has proved very effective at reducing wear and tear on my body. Emacs is central to this because I don't have to mouse around menus to get things done, and the navigation keys are right under my fingers. I'm pretty convinced now that hand movement away from the standard typing position causes a lot of tendon stress for me. YMMV, I'm not a doctor, etc. - -### I haven't done much to my config... - -Some predicted that I'd spend a lot of time yak shaving my configuration. I wondered if they were right, so I paid attention. Not only have I left my config largely alone, paying attention to the issue has made me realize just how much the other tools I use demand my attention and time. Emacs is easily the lowest maintenance piece of software I use. Mac OS and Windows are constantly demanding that I update them, but that's far less intrusive than Adobe Suite and Office's update intrusions in my world. I do occasionally update my Emacs, but it still works the same way, so it's largely a near zero cost operation for me, and one I can choose to do when I please. - -I'm sorry to disappoint, as a number of folks wanted to know what I've done to keep up with a renewed Emacs community and its output, but I've only added a few things to my config over the last two years. I consider this a success, as Emacs is a tool, not a hobby for me. That said, I'd love to hear about new things if you want to share. - -### ...Except for controlling the cloud - -We have a lot of Emacs fans at Fugue, so we've had a [Ludwig-mode][7] for a while now. Ludwig is our declarative, functional DSL for automating cloud infrastructure and services. Recently, Alex Schoof took some flight and evening hours to build fugue-mode, which acts as an Emacs console over the Fugue CLI. If you aren't familiar with Fugue, we make a cloud automation and governance tool that leverages functional programming to give users a great experience of interacting with cloud APIs. Well, it does a lot more than that, but it does that too. Fugue-mode is cool for a number of reasons. It allows me to have a buffer that is constantly reporting on the status of my cloud infrastructure, and since I often modify that infrastructure, I can quickly see the effects of my coding. Fugue organizes cloud workloads into processes, and Fugue-mode is a lot like top for cloud workloads. It also allows me to perform operations like creating new infrastructure or deleting stuff that isn't needed anymore, without much typing. Fugue-mode is a prototype, but it's pretty handy and I now use it regularly. - -![fugue-mode-edited.gif][8] - -### Modes and monitors - -I have added a few modes and integrations, but not really for work/CEO functions. I've been hacking around in Haskell and Scheme on the weekends for fun, so I've added haskell-mode and geiser. Emacs is great for languages that have a REPL, as you can divide up your screen into different "windows" that are running different modes, including REPLs or shells. Geiser is great for Scheme, and if you've not done so, working through SICP is a joy and possibly a revelation in an age that has lots of examples of cargo cult programming. Install MIT Scheme and geiser and you've got something that feels a bit like the Symbolics environments of lore. - -This brings up another topic I didn't cover in the 2015 post: screen management. I like to use a single portrait mode monitor for writing, and I have this configuration at my home and at my primary office. For programming or mixed use, I like the new ultra-wide monitors that we provide to all Fuguers. For these, I prefer to divide my screen into three columns, with the center having my main editing buffer, the left side having a shell and a fugue-mode buffer divided horizontally, and the right having either a documentation buffer or another editing buffer or two. This is easily done by first using 'Ctl-x 3' twice, then 'Ctl-x =' to make the windows equal in width. This will give you three equal columns that you can further subdivide as you like with 'Ctl-x 2' for horizontal divisions. Here's a screenshot of what this looks like. - -![Emacs Screen Shot][9] - -### This will be my last CEO/Emacs post... - -The first reason for this is that I'm now the CTO of Fugue, but also because there are so many topics I'm looking forward to blogging about and now I should have time to do so. I'm planning on doing some deeper dive posts on topics like functional programming, type safety for infrastructure-as-code, and as we roll out some awesome new Fugue capabilities, some posts on what is achievable on the cloud using Fugue. - --------------------------------------------------------------------------------- - -via: https://www.fugue.co/blog/2018-08-09-two-years-with-emacs-as-a-cto.html - -作者:[Josh Stella][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/oneforalone) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://www.fugue.co/blog/author/josh-stella -[b]: https://github.com/lujun9972 -[1]: https://blog.fugue.co/2015-11-11-guide-to-emacs.html -[2]: https://www.reddit.com/r/emacs/comments/7efpkt/a_ceos_guide_to_emacs/ -[3]: https://news.ycombinator.com/item?id=10642088 -[4]: https://news.ycombinator.com/item?id=15753150 -[5]: https://docs.fugue.co/ -[6]: https://shop.keyboard.io/ -[7]: https://github.com/fugue/ludwig-mode -[8]: https://www.fugue.co/hubfs/Imported_Blog_Media/fugue-mode-edited-1.gif -[9]: https://www.fugue.co/hs-fs/hubfs/Emacs%20Screen%20Shot.png?width=929&name=Emacs%20Screen%20Shot.png diff --git a/translated/talk/20180809 Two Years With Emacs as a CEO (and now CTO).md b/translated/talk/20180809 Two Years With Emacs as a CEO (and now CTO).md new file mode 100644 index 0000000000..b25721a59b --- /dev/null +++ b/translated/talk/20180809 Two Years With Emacs as a CEO (and now CTO).md @@ -0,0 +1,87 @@ +[#]: collector: (lujun9972) +[#]: translator: (oneforalone) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Two Years With Emacs as a CEO (and now CTO)) +[#]: via: (https://www.fugue.co/blog/2018-08-09-two-years-with-emacs-as-a-cto.html) +[#]: author: (Josh Stella https://www.fugue.co/blog/author/josh-stella) + +作为 CEO 使用 Emacs 的两年经验之谈(现任 CTO) +====== + +两年前,我写了一篇[博客][1],并取得了一些反响。这让我有点受宠若惊。那篇博客写的是我准备将 Emacs 作为我的主办公软件,当时我还是 CEO,现在已经转为 CTO 了。现在回想起来,我发现我之前不是做程序员就是做软件架构师,而且那时我也喜欢用 Emacs 写代码。重新考虑 Emacs 是一次很不错的尝试,但我不太清楚具体该怎么实现。在网上,那篇博客也是褒贬不一,但是还是有数万的阅读量,所以总的来说,我写的还是不错的。在 [Reddit][2] 和 [HackerNews][3] 上有些令人哭笑不得的回复,说我的手会变形,或者说我会因白色的背景而近视。在这里我可以很肯定的回答 —— 完全没有这回事,相反,我的手腕还因此变得更灵活了。还有一些人担心,说使用 Emacs 会耗费一个 CEO 的精力。把 Fugue 从在家得到的想法变成强大的产品,并有一大批忠实的顾客,我觉得 Emacs 可以让你从复杂的事务中解脱出来。我现在还在用白色的背景。 + +近段时间那篇博客又被翻出来了,并发到了 [HackerNews][4] 上。我收到了大量的跟帖者问我现在怎么样了,所以我写这篇博客来回应他们。在本文中,我还将重点讨论为什么 Emacs 和函数式编程有很高的相关性,以及我们是怎样使用 Emacs 来开发我们的产品 —— Fugue,一个使用函数式编程的自动化的云计算平台。由于我收到了很多反馈,比较有用的是一些细节的详细程度和有关背景色的注解,因此这篇博客比较长,而我确实也需要费点精力来解释我的想法,但这篇文章的主要内容还是反映了我担任 CEO 时处理的事务。而我想在之后更频繁地用 Emacs 写代码,所以需要提前做一些准备。一如既往,本文因人而异,后果自负。 + +### 意外之喜 + +我大部分时间都在不断得处理公司内外沟通。交流是解决问题的唯一方法,但也是反思及思考困难或是复杂问题的敌人。对我来说,作为创业公司的 CEO,最需要的是有时间专注工作而不别打扰。一旦开始投入时间来学习一些命令,Emacs 就很适合这种情况。其他的应用弹出提示,但是配置好了的 Emacs 就可以完全的忽略掉,无论是视觉上还是精神上。除非你想修改,否则的话他不会变,而且没有比空白屏幕和漂亮的字体更干净的界面了。在我不断被打扰的情况下,这种简洁让我能够专注于我在想什么,而不是电脑。好的程序能够默默地对电脑的进行访问。 + +一些人指出,原来的帖子既是对现代图形界面的批判,也是对 Emacs 的赞许。我既不赞同,也不否认。现代的接口,特别是那些以应用程序为中心的方法(相对于以内容为中心的方法),既不是以用户为中心的,也不是面向进程的。Emacs 避免了这种错误,这也是我如此喜欢它的部分原因,而它也带来了其他优点。Emacs 是进入计算机本身的入口,这打开了一扇新世界的大门。它的核心是发现和创造属于自己的道路,对我来说这就是创造的定义。现代电脑的悲哀之处在于,它很大程度上是由带有闪亮界面的黑盒组成的,这些黑盒提供的是瞬间的满足感,而不是真正的满足感。这让我们变成了消费者,而不是技术的创造者。我不在乎你是谁或者你的背景是什么;你可以理解你的电脑,你可以用它做东西。它很有趣,令人满意,而且不是你想的那么难学! + +我们常常低估了环境对我们心理的影响。Emacs 给人一种平静和自由的感觉,而不是紧迫感、烦恼或兴奋——后者是思想和沉思的敌人。我喜欢那些持久的,不碍事的东西,当我花时间去关注它们的时候,它们会给我带来真知灼见。Emacs 满足我的所有这些标准。我每天都使用 Emacs 来创建内容,我也很高兴我很少考虑它。Emacs 确实有一个学习曲线,但不会比学自行车更陡,而且一旦你完成了它,你会得到相应的回报,你就不必再去想它了,它赋予你一种其他工具所没有的自由感。这是一个优雅的工具,来自一个更加文明的时代。我很高兴我们步入了另一个计算机时代,而 Emacs 也将越来越受欢迎。 + +### 放弃用 Emacs 规划日程及处理待办事项 + +在原来的文章中,我花了一些时间介绍如何使用 Org 模式来规划日程。我放弃了使用 Org 模式来处理待办事项之类的,因为我每天都有很多会要开,很多电话要打, 而我也不能让其他人来适应我选的工具,我也没有时间将事务转换或是自动移动到 Org 上 。我们主要是用 Mac shop,使用谷歌日历等,原生的 Mac OS/iOS 工具可以很好的进行协作。我还有支比较旧的笔用来在会议中做笔记,因为我发现在会议中使用笔记本电脑或者说键盘很不礼貌,而且这也限制了我的聆听和思考。因此,我基本上放弃了用 Org 帮我规划日程或安排生活的想法。当然,Org 模式对其他的方面也很有用,它是我编写文档的首选,包括本文。换句话说,我与其作者背道而驰,但它在这方面做得很好。我也希望有一天也有人这么说我们在 Fugue 的工作。 + +### Emacs 在 Fugue 已经扩散 + +我在上篇博客就有说,你可能会喜欢 Emacs,也可能不会。因此,当 Fugue 的文档组将 Emacs 作为标准工具时,我是有点担心的,因为我觉得他们可能是受了我的影响。几年后,我确信他们做出了个正确的选择。那个组长是一个很聪明的程序员,但是那两个编写文档的人却没有怎么接触过技术。我想,如果这是一个经理强加错误工具的案例,我就会得到投诉并去解决,因为 Fugue 有反威权文化,大家不怕惹麻烦,包括我在内。之前的组长去年辞职了,但[文档组][5]现在有了一个灵活的集成的 CI/CD 工具链。并且文档组的人已经成为了 Emacs 的忠实用户。Emacs 有一条学习曲线,但即使很陡,也不会那么陡,翻过后对生产力和总体幸福感都有益。这也提醒我们,学文科的人在技术方面和程序员一样聪明,一样能干,也许不应该那么倾向于技术而产生派别歧视。 + +### 我的手腕得益于我的决定 + +上世纪80年代中期以来,我每天花12个小时左右在电脑前工作,这给我的手腕(以及后背)造成了很大的损伤,在此我强烈安利 Tag Capisco 的椅子。Emacs 和人机工程学键盘的结合让手腕的 [RSI][10](Repetitive Strain Injury/Repetitive Motion Syndrome) 问题消失了,我已经一年多没有想过这种问题了。在那之前,我的手腕每天都会疼,尤其是右手,如果你也遇到这种问题,你就知道这很让人分心和担心。有几个人问过键盘和鼠标的问题,如果你感兴趣的话,我现在用的是[这款键盘][6]。虽然在过去的几年里我主要使用的是真正符合人体工程学的键盘。我已经换成现在的键盘有几个星期了,而且我爱死它了。键帽的形状很神奇,因为你不用看就能知道自己在哪里,而拇指键设计的很合理,尤其是对于 Emacs, Control和Meta是你的固定伙伴。不要再用小指做高度重复的任务了! + +我使用鼠标的次数比使用 Office 和 IDE 时要少得多,这对我有很大帮助,但我还是会用鼠标。我一直在使用外观相当过时,但功能和人体工程学明显优越的轨迹球,这是名副其实的。 + +撇开具体的工具不谈,最重要的一点是,事实证明,一个很棒的键盘,再加上避免使用鼠标,在减少身体的磨损方面很有效。Emacs 是这方面的核心,因为我不需要在菜单上滑动鼠标来完成任务,而且导航键就在我的手指下面。我肯定,手离开标准打字姿势会给我的肌腱造成很大的压力。这因人而异,我也不是医生。 + +### 还没完成大部分配置…… + +有人说我会在界面配置上花很多的时间。我想验证下他们说的对不对,所以我留意了下。我不仅让配置基本上不受影响,关注这个问题还让我意识到我使用的其他工具是多么的耗费我的精力和时间。Emacs 是我用过的维护成本最低的软件。Mac OS 和 Windows 一直要求我更新它,但在我我看来,这远没有 Adobe 套件和 Office 的更新的困恼那么大。我只是偶尔更新 Emacs,但也没什么变化,所以对我来说,它基本上是一个接近于零成本的操作,我高兴什么时候跟新就什么时候更新。 + +有一点然你们失望了,因为许多人想知道我为跟上 Emacs 社区的更新及其输出所做的事情,但是在过去的两年中,我只在配置中添加了一些内容。我认为也是成功的,因为 Emacs 只是一个工具,而不是我的爱好。也就是说,如果你想和我分享,我很乐意听到新的东西。 + +### 期望实现控制云端 + +我们在 Fugue 有很多 Emacs 的粉丝,所以我们有一段时间在用 [Ludwing 模式][7]。Ludwig 是我们用于自动化云基础设施和服务的声明式、功能性的 DSL。最近,Alex Schoof 利用飞机上和晚上的时间来构建 fugue 模式,它在 Fugue CLI 上充当 Emacs 控制台。要是你不熟悉 Fugue,我们会开发一个云自动化和管理工具,它利用函数式编程为用户提供与云的 api 交互的良好体验。它做的不止这些,但它也做了。fugue 模式很酷的原因有很多。它有一个不断报告云基础设备状态的缓冲区,而由于我经常修改这些设备,所以我可以快速看到编码的效果。Fugue 将云工作负载当成进程处理,fugue 模式非常类似于云工作负载的 top 模式。它还允许我执行一些操作,比如创建新的设备或删除过期的东西,而且也不需要太多输入。Fugue 模式只是个雏形,但它非常方便,而我现在也经常使用它。 + +![fugue-mode-edited.gif][8] + +### 模式及监听 + +我添加了一些模式和集成插件,但并不是真正用于 CEO 工作。我喜欢在周末时写写 Haskell 和 Scheme,所以我添加了 haskell 模式和 geiser。Emacs 对具有 REPL 的语言很友好,因为你可以在不同的窗口中运行不同的模式,包括 REPL 和 shell。Geiser 和 Scheme 很配,要是你还没有这样做过,那么用 SICP 工作也不失为一种乐趣,在这个有很多土鳖编程的例子的时代,这可能是一种启发。安装 MIT Scheme 和 geiser,你就会感觉有点像 lore 的符号环境。 + +这就引出了我在 15 年的文章中没有提到的另一个话题:屏幕管理。我喜欢使用用竖屏来写作,我在家里和我的主要办公室都有这个配置。对于编程或混合使用,我喜欢 fuguer 提供的新的超宽显示器。对于宽屏,我更喜欢将屏幕分成三列,中间是主编辑缓冲区,左边是水平分隔的 shell 和 fugue 模式缓冲区,右边是文档缓冲区或另一个或两个编辑缓冲区。这个很简单,首先按 'Ctl-x 3' 两次,然后使用 'Ctl-x =' 使窗口的宽度相等。这将提供三个相等的列,你也可以使用 'Ctl-x 2' 进行水平分割。以下是我的截图。 + +![Emacs Screen Shot][9] + +### 最后一篇 CEO/Emacs 文章…… + +首先,我现在是 Fugue 的 CTO,其次我也想要写一些其他方面的博客,而我现在刚好有时间。我还打算写些更深入的东西,比如说函数式编程、基础结构类型安全,以及我们即将推出一些的新功能,还有一些关于 Fugue 在云上可以做什么。 + +-------------------------------------------------------------------------------- + +via: https://www.fugue.co/blog/2018-08-09-two-years-with-emacs-as-a-cto.html + +作者:[Josh Stella][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/oneforalone) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.fugue.co/blog/author/josh-stella +[b]: https://github.com/lujun9972 +[1]: https://blog.fugue.co/2015-11-11-guide-to-emacs.html +[2]: https://www.reddit.com/r/emacs/comments/7efpkt/a_ceos_guide_to_emacs/ +[3]: https://news.ycombinator.com/item?id=10642088 +[4]: https://news.ycombinator.com/item?id=15753150 +[5]: https://docs.fugue.co/ +[6]: https://shop.keyboard.io/ +[7]: https://github.com/fugue/ludwig-mode +[8]: https://www.fugue.co/hubfs/Imported_Blog_Media/fugue-mode-edited-1.gif +[9]: https://www.fugue.co/hs-fs/hubfs/Emacs%20Screen%20Shot.png?width=929&name=Emacs%20Screen%20Shot.png +[10]: https://baike.baidu.com/item/RSI/21509642 From bb1a9914fdb4169cb8ddd931a58bce1487179e97 Mon Sep 17 00:00:00 2001 From: MjSeven Date: Thu, 24 Jan 2019 23:24:56 +0800 Subject: [PATCH 110/243] Translating Doe 20180130 tmux... --- ...lexer For Heavy Command-Line Linux User.md | 262 ----------------- ...lexer For Heavy Command-Line Linux User.md | 263 ++++++++++++++++++ 2 files changed, 263 insertions(+), 262 deletions(-) delete mode 100644 sources/tech/20180130 tmux - A Powerful Terminal Multiplexer For Heavy Command-Line Linux User.md create mode 100644 translated/tech/20180130 tmux - A Powerful Terminal Multiplexer For Heavy Command-Line Linux User.md diff --git a/sources/tech/20180130 tmux - A Powerful Terminal Multiplexer For Heavy Command-Line Linux User.md b/sources/tech/20180130 tmux - A Powerful Terminal Multiplexer For Heavy Command-Line Linux User.md deleted file mode 100644 index f519d76fc7..0000000000 --- a/sources/tech/20180130 tmux - A Powerful Terminal Multiplexer For Heavy Command-Line Linux User.md +++ /dev/null @@ -1,262 +0,0 @@ -Translating by MjSeven - - -tmux – A Powerful Terminal Multiplexer For Heavy Command-Line Linux User -====== -tmux stands for terminal multiplexer, it allows users to create/enable multiple terminals (vertical & horizontal) in single window, this can be accessed and controlled easily from single window when you are working with different issues. - -It uses a client-server model, which allows you to share sessions between users, also you can attach terminals to a tmux session back. We can easily move or rearrange the virtual console as per the need. Terminal sessions can freely rebound from one virtual console to another. - -tmux depends on libevent and ncurses libraries. tmux offers status-line at the bottom of the screen which display information about your current tmux session suc[]h as current window number, window name, username, hostname, current time, and current date. - -When tmux is started it creates a new session with a single window and displays it on screen. It allows users to create Any number of windows in the same session. - -Many of us says it's similar to screen but i'm not since this offers wide range of configuration options. - -**Make a note:** `Ctrl+b` is the default prefix in tmux so, to perform any action in tumx, you have to type the prefix first then required options. - -**Suggested Read :** [List Of Terminal Emulator For Linux][1] - -### tmux Features - - * Create any number of windows - * Create any number of panes in the single window - * It allows vertical and horizontal splits - * Detach and Re-attach window - * Server-client architecture which allows users to share sessions between users - * tmux offers wide range of configuration hacks - - - -**Suggested Read :** -**(#)** [tmate - Instantly Share Your Terminal Session To Anyone In Seconds][2] -**(#)** [Teleconsole - A Tool To Share Your Terminal Session Instantly To Anyone In Seconds][3] - -### How to Install tmux Command - -tmux command is pre-installed by default in most of the Linux systems. If no, follow the below procedure to get installed. - -For **`Debian/Ubuntu`** , use [APT-GET Command][4] or [APT Command][5] to install tmux. -``` -$ sudo apt install tmux - -``` - -For **`RHEL/CentOS`** , use [YUM Command][6] to install tmux. -``` -$ sudo yum install tmux - -``` - -For **`Fedora`** , use [DNF Command][7] to install tmux. -``` -$ sudo dnf install tmux - -``` - -For **`Arch Linux`** , use [Pacman Command][8] to install tmux. -``` -$ sudo pacman -S tmux - -``` - -For **`openSUSE`** , use [Zypper Command][9] to install tmux. -``` -$ sudo zypper in tmux - -``` - -### How to Use tmux - -kick start the tmux session by running following command on terminal. When tmux is started it creates a new session with a single window and will automatically login to your default shell with your user account. -``` -$ tmux - -``` - -[![][10]![][10]][11] - -You will get similar to above screenshot like us. tmux comes with status bar which display an information's about current sessions details, date, time, etc.,. - -The status bar information's are below: - - * **`0 :`** It is indicating the session number which was created by the tmux server. By default it starts with 0. - * **`0:username@host: :`** 0 is indicating the session number. Username and Hostname which is holding the current window. - * **`~ :`** It is indicating the current directory (We are in the Home directory) - * **`* :`** This indicate that the window is active now. - * **`Hostname :`** This shows fully qualified hostname of the server - * **`Date& Time:`** It shows current date and time - - - -### How to Split Window - -tmux allows users to split window vertically and horizontally. Let 's see how to do that. - -Press `**(Ctrl+b), %**` to split the pane vertically. -[![][10]![][10]][13] - -Press `**(Ctrl+b), "**` to split the pane horizontally. -[![][10]![][10]][14] - -### How to Move Between Panes - -Lets say, we have created few panes and want to move between them. How to do that? If you don 't know how to do, then there is no purpose to use tmux. Use the following control keys to perform the actions. There are many ways to move between panes. - -Press `(Ctrl+b), Left arrow` - To Move Left - -Press `(Ctrl+b), Right arrow` - To Move Right - -Press `(Ctrl+b), Up arrow` - To Move Up - -Press `(Ctrl+b), Down arrow` - To Move Down - -Press `(Ctrl+b), {` - To Move Left - -Press `(Ctrl+b), }` - To Move Right - -Press `(Ctrl+b), o` - Switch to next pane (left-to-right, top-down) - -Press `(Ctrl+b), ;` - Move to the previously active pane. - -For testing purpose, we are going to move between panes. Now, we are in the `pane2` which shows `lsb_release -a` command output. -[![][10]![][10]][15] - -And we are going to move to `pane0` which shows `uname -a` command output. -[![][10]![][10]][16] - -### How to Open/Create New Window - -You can open any number of windows within one terminal. Terminal window can be split vertically & horizontally which is called `panes`. Each pane will contain its own, independently running terminal instance. - -Press `(Ctrl+b), c` to create a new window. - -Press `(Ctrl+b), n` move to the next window. - -Press `(Ctrl+b), p` to move to the previous window. - -Press `(Ctrl+b), (0-9)` to immediately move to a specific window. - -Press `(Ctrl+b), l` Move to the previously selected window. - -I have two windows, first window has three panes which contains operating system distribution information, top command output & kernal information. -[![][10]![][10]][17] - -And second window has two panes which contains Linux distributions logo information. Use the following commands perform the action. -[![][10]![][10]][18] - -Press `(Ctrl+b), w` Choose the current window interactively. -[![][10]![][10]][19] - -### How to Zoom Panes - -You are working in some pane which is very small and you want to zoom it out for further work. To do use the following key binds. - -Currently we have three panes and i'm working in `pane1` which shows system activity using **Top** command and am going to zoom that. -[![][10]![][10]][17] - -When you zoom a pane, it will hide all other panes and display only the zoomed pane in the window. -[![][10]![][10]][20] - -Press `(Ctrl+b), z` to zoom the pane and press it again, to bring the zoomed pane back. - -### Display Pane Information - -To know about pane number and it's size, run the following command. - -Press `(Ctrl+b), q` to briefly display pane indexes. -[![][10]![][10]][21] - -### Display Window Information - -To know about window number, layout size, number of panes associated with the window and it's size, etc., run the following command. - -Just run `tmux list-windows` to view window information. -[![][10]![][10]][22] - -### How to Resize Panes - -You may want to resize the panes to fit your requirement. You have to press `(Ctrl+b), :` then type the following details on the `yellow` color bar in the bottom of the page. -[![][10]![][10]][23] - -In the previous section we have print pane index which shows panes size as well. To test this we are going to increase `10 cells UPward`. See the following output that has increased the pane1 & pane2 size from `55x21` to `55x31`. -[![][10]![][10]][24] - -**Syntax:** `(Ctrl+b), :` then type `resize-pane [options] [cells size]` - -`(Ctrl+b), :` then type `resize-pane -D 10` to resize the current pane Down for 10 cells. - -`(Ctrl+b), :` then type `resize-pane -U 10` to resize the current pane UPward for 10 cells. - -`(Ctrl+b), :` then type `resize-pane -L 10` to resize the current pane Left for 10 cells. - -`(Ctrl+b), :` then type `resize-pane -R 10` to resize the current pane Right for 10 cells. - -### Detaching and Re-attaching tmux Session - -One of the most powerful features of tmux is the ability to detach and reattach session whenever you need. - -Run a long running process and press `Ctrl+b` followed by `d` to detach your tmux session safely by leaving the running process. - -**Suggested Read :** [How To Keep A Process/Command Running After Disconnecting SSH Session][25] - -Now, run a long running process. For demonstration purpose, we are going to move this server backup to another remote server for disaster recovery (DR) purpose. - -You will get similar output like below after detached tmux session. -``` -[detached (from session 0)] - -``` - -Run the following command to list the available tmux sessions. -``` -$ tmux ls -0: 3 windows (created Tue Jan 30 06:17:47 2018) [109x45] - -``` - -Now, re-attach the tmux session using an appropriate session ID as follow. -``` -$ tmux attach -t 0 - -``` - -### How to Close Panes & Window - -Just type `exit` or hit `Ctrl-d` in the corresponding pane to close it. It's similar to terminal close. To close window, press `(Ctrl+b), &`. - --------------------------------------------------------------------------------- - -via: https://www.2daygeek.com/tmux-a-powerful-terminal-multiplexer-emulator-for-linux/ - -作者:[Magesh Maruthamuthu][a] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]:https://www.2daygeek.com/author/magesh/ -[1]:https://www.2daygeek.com/category/terminal-emulator/ -[2]:https://www.2daygeek.com/tmate-instantly-share-your-terminal-session-to-anyone-in-seconds/ -[3]:https://www.2daygeek.com/teleconsole-share-terminal-session-instantly-to-anyone-in-seconds/ -[4]:https://www.2daygeek.com/apt-get-apt-cache-command-examples-manage-packages-debian-ubuntu-systems/ -[5]:https://www.2daygeek.com/apt-command-examples-manage-packages-debian-ubuntu-systems/ -[6]:https://www.2daygeek.com/yum-command-examples-manage-packages-rhel-centos-systems/ -[7]:https://www.2daygeek.com/dnf-command-examples-manage-packages-fedora-system/ -[8]:https://www.2daygeek.com/pacman-command-examples-manage-packages-arch-linux-system/ -[9]:https://www.2daygeek.com/zypper-command-examples-manage-packages-opensuse-system/ -[10]:data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7 -[11]:https://www.2daygeek.com/wp-content/uploads/2018/01/tmux-a-powerful-terminal-multiplexer-emulator-for-linux-1.png -[13]:https://www.2daygeek.com/wp-content/uploads/2018/01/tmux-a-powerful-terminal-multiplexer-emulator-for-linux-2.png -[14]:https://www.2daygeek.com/wp-content/uploads/2018/01/tmux-a-powerful-terminal-multiplexer-emulator-for-linux-3.png -[15]:https://www.2daygeek.com/wp-content/uploads/2018/01/tmux-a-powerful-terminal-multiplexer-emulator-for-linux-4.png -[16]:https://www.2daygeek.com/wp-content/uploads/2018/01/tmux-a-powerful-terminal-multiplexer-emulator-for-linux-5.png -[17]:https://www.2daygeek.com/wp-content/uploads/2018/01/tmux-a-powerful-terminal-multiplexer-emulator-for-linux-8.png -[18]:https://www.2daygeek.com/wp-content/uploads/2018/01/tmux-a-powerful-terminal-multiplexer-emulator-for-linux-6.png -[19]:https://www.2daygeek.com/wp-content/uploads/2018/01/tmux-a-powerful-terminal-multiplexer-emulator-for-linux-7.png -[20]:https://www.2daygeek.com/wp-content/uploads/2018/01/tmux-a-powerful-terminal-multiplexer-emulator-for-linux-9.png -[21]:https://www.2daygeek.com/wp-content/uploads/2018/01/tmux-a-powerful-terminal-multiplexer-emulator-for-linux-10.png -[22]:https://www.2daygeek.com/wp-content/uploads/2018/01/tmux-a-powerful-terminal-multiplexer-emulator-for-linux-14.png -[23]:https://www.2daygeek.com/wp-content/uploads/2018/01/tmux-a-powerful-terminal-multiplexer-emulator-for-linux-11.png -[24]:https://www.2daygeek.com/wp-content/uploads/2018/01/tmux-a-powerful-terminal-multiplexer-emulator-for-linux-13.png -[25]:https://www.2daygeek.com/how-to-keep-a-process-command-running-after-disconnecting-ssh-session/ diff --git a/translated/tech/20180130 tmux - A Powerful Terminal Multiplexer For Heavy Command-Line Linux User.md b/translated/tech/20180130 tmux - A Powerful Terminal Multiplexer For Heavy Command-Line Linux User.md new file mode 100644 index 0000000000..dab7489ba4 --- /dev/null +++ b/translated/tech/20180130 tmux - A Powerful Terminal Multiplexer For Heavy Command-Line Linux User.md @@ -0,0 +1,263 @@ +tmux - 适用于重度命令行 Linux 用户的强大终端复用器 +====== + +tmux 是终端复用的缩写,它允许用户在单个窗口中创建或启用多个终端(垂直或水平),当你处理不同的问题时,可以在单个窗口中轻松访问和控制。 + +它使用客户端-服务器模型,允许用户之间共享会话,也可以将终端连接到 tmux 会话。我们可以根据需要轻松移动或重新排列虚拟控制台。终端会话可以从一个虚拟控制台自由切换到另一个。 + + +tmux 依赖于 `libevent` 和 `ncurses` 库。tmux 在屏幕底部提供了一个状态行,它显示当前 tmux 会话的有关信息,例如当前窗口编号,窗口名称,用户名,主机名,当前时间和日期。 + +启动 tmux 时,它会在一个单独窗口上创建一个新的会话,并将其显示在屏幕上。它允许用户在同一个会话中创建任意数量的窗口。 + +许多人说它相当于一块屏幕,但我不这么认为,因为它提供了许多配置选项。 + +**注意:** `Ctrl+b` 是 tmux 中的默认前缀,因此,要在 tmux 中执行任何操作,你必须先输入前缀然后输入所需的选项。 + +**建议阅读:** [适用于 Linux 的终端仿真器列表][1] + +### tmux 特性 + + * 创建任意数量的窗口 + * 在一个窗口中创建任意数量的窗格 + * 它允许垂直和水平分割 + * 分离并重新连接窗口 + * 客户端-服务器架构,这允许用户之间共享会话 + * tmux 提供许多配置技巧 + +**建议阅读:** +**(#)** [tmate - 马上与其他人分享你的终端会话][2] +**(#)** [Teleconsole - 一个与其他人分享终端会话的工具][3] + +### 如何安装 tmux 命令 + +大多数 Linux 系统默认预安装 tmux 命令。如果没有,按照以下步骤安装。 + +对于 **`Debian/Ubuntu`**,使用 [APT-GET 命令][4]或 [APT 命令][5]来安装: +``` +$ sudo apt install tmux +``` + +对于 **`RHEL/CentOS`**,使用 [YUM 命令][6]来安装: +``` +$ sudo yum install tmux +``` + +对于 **`Fedora`**,使用 [DNF 命令][7]来安装: +``` +$ sudo dnf install tmux +``` + +对于 **`Arch Linux`**,使用 [Pacman 命令][8]来安装: +``` +$ sudo pacman -S tmux +``` + +对于 **`openSUSE`**,使用 [Zypper 命令][9]来安装: +``` +$ sudo zypper in tmux +``` + +### 如何使用 tmux + +在终端上运行以下命令来启动 tmux 会话。启动 tmux 后,它会在一个新窗口中创建新会话,并将使用你的用户账户自动登录到你的默认 shell。 +``` +$ tmux +``` + +![][11] + +你会得到类似于我们上面的截图。tmux 附带状态栏,显示有关当前会话详细信息,日期,时间等。 + +状态栏信息如下: + + * **`0 :`** 它表示由 tmux 服务器创建的会话号。默认情况下,它从 0 开始。 + * **`0:username@host: :`** ) 0 表示会话号。用户名和主机名是当前的使用窗口的人。 + * **`~ :`** 它表示当前目录(我们在家目录中)。 + * **`* :`** 这表示窗口现在处于活动状态。 + * **`Hostname :`** 显示服务器的完全主机名。 + * **`Date& Time:`** 显示当前日期和时间。 + + + ### 如何拆分窗口 + + tmux 允许用户垂直或水平分割窗口。我们来看看如何做到这一点。 + +按下 `**(Ctrl+b), %**` 来垂直分割窗口。 +![][13] + +Press `**(Ctrl+b), "**` 来水平分割窗口。 +![][14] + +### 如何在窗格之间移动 + +假设,我们创建了一些窗格,希望在它们之间移动,这该怎么做?如果你不知道怎么做,那么使用 tmux 就没有意义了。使用以下控制键执行操作。在窗格之间移动有许多方法。 + + +按 `(Ctrl+b), 左箭头` - 来向左移动 + +按 `(Ctrl+b), 右箭头` - 来向右移动 + +按 `(Ctrl+b), 上箭头` - 来向上移动 + +按 `(Ctrl+b), 下箭头` - 来向下移动 + +按 `(Ctrl+b), {` - 来向左移动 + +按 `(Ctrl+b), }` - 来向右移动 + +按 `(Ctrl+b), o` - 切换到下一个窗格(从左到右,从上到下) + +按 `(Ctrl+b), ;` - 移动到先前活动的窗格 + +出于测试目的,我们将在窗格之间移动。现在我们在 `pane2` 中,它 `lsb_release -a` 命令的输出。 + +![][15] + +我们将移动到 `pane0`,它显示 `uname -a` 命令的输出。 + +![][16] + +### 如何打开/创建新窗口 + +你可以在一个终端内打开任意数量的窗口。终端窗口可以垂直和水平分割,称为 `panes`。每个窗格都包含自己独立运行的终端实例。 + +按 `(Ctrl+b), c` 来创建一个新窗口。 + +按 `(Ctrl+b), n` 移动到下一个窗口 + +按 `(Ctrl+b), p` 移动到上一个窗口。 + +按 `(Ctrl+b), (0-9)` 立即移动到特定窗口。 + +按 `(Ctrl+b), l` 移动到先前选择的窗口。 + +我有两个窗口,第一个窗口有三个窗格,其中包含操作系统版本信息,top 命令输出和内核信息。 +![][17] + +第二个窗口有两个窗格,其中包含 Linux 发行版 logo 信息。使用以下命令执行操作: +![][18] + +按 `(Ctrl+b), w` 以交互方式选择当前窗口。 + +![][19] + +### 如何缩放窗格 + +你正在一些非常小的窗格中工作,并且你希望将其缩小以进行进一步的工作。要做到这一点,使用以下键绑定。 + +目前我们有三个窗格,我在 `pane1` 工作,它使用 **Top** 命令显示系统活动信息,我将缩放它。 +![][17] + +缩放窗格时,它将隐藏所有其它窗格,并只显示窗口中的缩放窗格。 + +![][20] + +按 `(Ctrl+b), z` 缩放窗格并再次按下它,使缩放窗格恢复原状。 + +### 显示窗格信息 + +要了解窗格编号及其大小,运行以下命令。 + +按 `(Ctrl+b), q` 可简单显示窗格索引。 +![][21] + +### 显示窗口信息 + +要知道窗口编号,布局大小,与窗口关联的窗格数量及其大小等,运行以下命令。 + +只需运行 `tmux list-windows` 即可查看窗口信息。 +![][22] + +### 如何调整窗格大小 + +你可能需要调整窗格大小来满足你的要求。你必须按下 `(Ctrl+b), :`,然后在页面底部的 `黄色(yellow)` 颜色条上输入以下详细信息。 +![][23] + +在上一部分中,我们有打印了窗格索引,它同时也显示了窗格大小。为了测试,我们要向上增加 `10` 个单元。参考以下输出,该窗格将 pane1 和 pane2 的大小从 `55x21` 增加到 `55x31`。 +![][24] + +**语法:** `(Ctrl+b), :` 然后输入 `resize-pane [options] [cells size]` + +`(Ctrl+b), :` 然后输入 `resize-pane -D 10` 将当前窗格大小向下调整 10 个单元。 + +`(Ctrl+b), :` 然后输入 `resize-pane -U 10` 将当前窗格大小向上调整 10 个单元。 + +`(Ctrl+b), :` 然后输入 `resize-pane -L 10` 将当前窗格大小向左调整 10 个单元。 + +`(Ctrl+b), :` 然后输入 `resize-pane -R 10` 将当前窗格大小向右调整 10 个单元。 + +### 分离并重新连接 tmux 会话 + +tmux 最强大的功能之一是能够在需要时分离和重新连接会话。 + +运行一个长时间运行的进程,然后按下 `Ctrl+b`,接着按 `d`,通过离开正在运行的进程安全地分离你的 tmux 会话。 + +**建议阅读:** [如何在断开 SSH 会话后保持进程/命令继续运行][25] + +现在,运行一个长时间运行的进程。出于演示目的,我们将把此服务器备份移动到另一个远程服务器以进行灾难恢复(DR)。 + +``` +$ rsync -avzhe ssh /backup root@192.168.0.161:/backups/week-1/ +``` + +在分离 tmux 会话之后,你将获得类似下面的输出。 + +``` +[detached (from session 0)] +``` + +运行以下命令以列出可用的 tmux 会话。 +``` +$ tmux ls +0: 3 windows (created Tue Jan 30 06:17:47 2018) [109x45] +``` + +现在,使用适当的会话 ID 重新连接 tmux 会话,如下所示: +``` +$ tmux attach -t 0 +``` + +### 如何关闭窗格和窗口 + +只需在相应的窗格中输入 `exit` 或按下 `Ctrl-d` 即可关闭它,和终端关闭类似。要关闭窗口,按下 `(Ctrl+b), &`。 + +好了,就到这里了,希望你喜欢上它。 +(to 校正:这句话是加的,感觉它结尾很突然,可以删掉。) + + +-------------------------------------------------------------------------------- + +via: https://www.2daygeek.com/tmux-a-powerful-terminal-multiplexer-emulator-for-linux/ + +作者:[Magesh Maruthamuthu][a] +译者:[MjSeven](https://github.com/MjSeven) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:https://www.2daygeek.com/author/magesh/ +[1]:https://www.2daygeek.com/category/terminal-emulator/ +[2]:https://www.2daygeek.com/tmate-instantly-share-your-terminal-session-to-anyone-in-seconds/ +[3]:https://www.2daygeek.com/teleconsole-share-terminal-session-instantly-to-anyone-in-seconds/ +[4]:https://www.2daygeek.com/apt-get-apt-cache-command-examples-manage-packages-debian-ubuntu-systems/ +[5]:https://www.2daygeek.com/apt-command-examples-manage-packages-debian-ubuntu-systems/ +[6]:https://www.2daygeek.com/yum-command-examples-manage-packages-rhel-centos-systems/ +[7]:https://www.2daygeek.com/dnf-command-examples-manage-packages-fedora-system/ +[8]:https://www.2daygeek.com/pacman-command-examples-manage-packages-arch-linux-system/ +[9]:https://www.2daygeek.com/zypper-command-examples-manage-packages-opensuse-system/ +[10]:data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7 +[11]:https://www.2daygeek.com/wp-content/uploads/2018/01/tmux-a-powerful-terminal-multiplexer-emulator-for-linux-1.png +[13]:https://www.2daygeek.com/wp-content/uploads/2018/01/tmux-a-powerful-terminal-multiplexer-emulator-for-linux-2.png +[14]:https://www.2daygeek.com/wp-content/uploads/2018/01/tmux-a-powerful-terminal-multiplexer-emulator-for-linux-3.png +[15]:https://www.2daygeek.com/wp-content/uploads/2018/01/tmux-a-powerful-terminal-multiplexer-emulator-for-linux-4.png +[16]:https://www.2daygeek.com/wp-content/uploads/2018/01/tmux-a-powerful-terminal-multiplexer-emulator-for-linux-5.png +[17]:https://www.2daygeek.com/wp-content/uploads/2018/01/tmux-a-powerful-terminal-multiplexer-emulator-for-linux-8.png +[18]:https://www.2daygeek.com/wp-content/uploads/2018/01/tmux-a-powerful-terminal-multiplexer-emulator-for-linux-6.png +[19]:https://www.2daygeek.com/wp-content/uploads/2018/01/tmux-a-powerful-terminal-multiplexer-emulator-for-linux-7.png +[20]:https://www.2daygeek.com/wp-content/uploads/2018/01/tmux-a-powerful-terminal-multiplexer-emulator-for-linux-9.png +[21]:https://www.2daygeek.com/wp-content/uploads/2018/01/tmux-a-powerful-terminal-multiplexer-emulator-for-linux-10.png +[22]:https://www.2daygeek.com/wp-content/uploads/2018/01/tmux-a-powerful-terminal-multiplexer-emulator-for-linux-14.png +[23]:https://www.2daygeek.com/wp-content/uploads/2018/01/tmux-a-powerful-terminal-multiplexer-emulator-for-linux-11.png +[24]:https://www.2daygeek.com/wp-content/uploads/2018/01/tmux-a-powerful-terminal-multiplexer-emulator-for-linux-13.png +[25]:https://www.2daygeek.com/how-to-keep-a-process-command-running-after-disconnecting-ssh-session/ From 986c917cd768fd42daf2e6f6788745829a0013d2 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Fri, 25 Jan 2019 00:16:50 +0800 Subject: [PATCH 111/243] PRF:20180919 5 ways DevSecOps changes security.md @hopefully2333 --- ...80919 5 ways DevSecOps changes security.md | 34 ++++++++++--------- 1 file changed, 18 insertions(+), 16 deletions(-) diff --git a/translated/talk/20180919 5 ways DevSecOps changes security.md b/translated/talk/20180919 5 ways DevSecOps changes security.md index 92f295ed04..cfa0bb07e4 100644 --- a/translated/talk/20180919 5 ways DevSecOps changes security.md +++ b/translated/talk/20180919 5 ways DevSecOps changes security.md @@ -1,40 +1,42 @@ -五种 DevSecOps 提升安全性 +DevSecOps 提升安全性的五种方式 ====== +> 安全必须进化以跟上当今的应用开发和部署方式。 + ![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/security-lock-password.jpg?itok=KJMdkKum) -对于我们是否需要扩展 DevOps 以确实提升安全性,我们一直都有争议。毕竟,我们的想法是,DevOps 一直是一系列的新实践的简写,使用新工具(通常是开源的)并且在这之上构建更多的协作文化。为什么 DevBizOps 不能更好地满足商业的需求?或者说 DevChatOps 强调的是更快更好的沟通? +对于我们是否需要扩展 DevOps 以确实提升安全性,我们一直都有争议。毕竟,我们认为,DevOps 一直是一系列的新实践的简写,使用新工具(通常是开源的)并且在这之上构建更多的协作文化。为什么 [DevBizOps][3] 不能更好地满足商业的需求?或者说 DevChatOps 强调的是更快更好的沟通? -在今年(译者注:此处是2018年)的早些时候写的关于他理解的 DevSecOps 术语,“我希望,有一天在世界范围内,我们能不再使用 DevSecOps 这个词,安全会是所有的服务交付讨论中理所应当的部分。直到那一天到来为止,在这一点上,我的一般性结论是,这个词只有三个新的特性。更重要的是,我们作为一个产业,在信息安全方面并没有做的很好,而这个名称切实地区分出了问题的状况” +然而,如 [John Willis][4] 在今年(LCTT 译注:此处是 2018 年)的早些时候写的关于他对 [DevSecOps][5] 术语的理解,“我希望,有一天我们能在任何地方都不再使用 DevSecOps 这个词,安全会是所有关于服务交付的讨论中理所应当的部分。在那一天到来前,在这一点上,我的一般性结论是,这个词只是三个新的特性而已。更重要的是,我们作为一个产业,在信息安全方面并没有做的很好,而这个名称切实地区分出了问题的状况。” -所以,为什么我们在信息安全方面做的不好,在 DevSecOps 的语境下安全做的好又是什么意思呢? +所以,为什么我们在[信息安全][6]方面做的不好,在 DevSecOps 的语境下安全做的好又是什么意思呢? -我们大概从未做好过信息安全,尽管(也可能是因为)复杂的工业点产品地址拥挤问题。我们仍然可以在这个时代把工作做得足够好,以此来防范威胁,这些威胁主要集中在一个范围内,网络的连接是有限的,而且大多数的用户都是公司的员工,使用的是公司提供的设备。 +尽管(也可能是因为)庞大的复杂行业的单点产品解决了特定方面的问题,但我们可以说是从未做好过信息安全。我们仍然可以在这个时代把工作做得足够好,以此来防范威胁,这些威胁主要集中在一个范围内,网络的连接是受限的,而且大多数的用户都是公司的员工,使用的是公司提供的设备。 -这些年来,这些情况并没有能准确地描述出大多数组织的真实现状。但在现在这个时代,不止引入了 DevSecOps,也同时引入了新的应用架构模型,开发实践,和越来越多的安全威胁,这些一起定义了一个需要更快迭代的新常态。还没有应用得很多的 DevSecOps 在独立改变安全,但是 2018 年的信息安全需要新的方法。 +这些年来,这些情况并没有能准确地描述出大多数组织的真实现状。但在现在这个时代,不止引入了 DevSecOps,也同时引入了新的应用架构模型、开发实践,和越来越多的安全威胁,这些一起定义了一个需要更快迭代的新常态。与其说 DevSecOps 孤立地改变了安全,不如说信息安全公司在 2018 年需要新的方法。 请仔细思考下面这五个领域。 ### 自动化 -大量的自动化通常是 DevOps 的标志,这部分是关于速度的,如果你要快速移动(并且不会打坏东西),你需要有可重复的过程,而且这个过程不需要太多的人工干预。实际上,自动化是 DevOps 最好的切入点之一,甚至是在仍然主要工作在单片机电路程序的组织里也是如此。使用像 Ansible 这样易于使用的工具来自动化地处理相关的配置或者是测试,这是快速开始 DevOps 之路的常用方法。 +大量的自动化通常是 DevOps 的标志,这部分是关于速度的,如果你要快速变化(并且不会造成破坏),你需要有可重复的过程,而且这个过程不需要太多的人工干预。实际上,自动化是 DevOps 最好的切入点之一,甚至是在仍然主要使用老式的独石应用monolithic app的组织里也是如此。使用像 Ansible 这样易于使用的工具来自动化地处理相关的配置或者是测试,这是快速开始 DevOps 之路的常用方法。 -DevSecOps 也不例外,在今天,安全已经变成了一个持续性的过程,而不是在应用的生命周期里进行不定期的检查,甚至是每周、每月的检查。当漏洞被厂商发现并修复的时候,这些漏洞能被快速地应用是很重要的,因为利用这些漏洞的利用程序很快就会被淘汰。 +DevSecOps 也不例外,在今天,安全已经变成了一个持续性的过程,而不是在应用的生命周期里进行不定期的检查,甚至是每周、每月的检查。当漏洞被厂商发现并修复的时候,这些修复能被快速地应用是很重要的,这样对这些漏洞的利用程序很快就会被淘汰。 -### "左转" +### “左移” -在开发流程结束时,传统安全通常被视作一个守门人。检查所有的部分确保没有问题,然后这个应用程序就可以投入生产了。否则,就要再来一次。所以安全团队的声誉并不高。 +在开发流程结束时,传统的安全通常被视作一个守门人。检查所有的部分确保没有问题,然后这个应用程序就可以投入生产了。否则,就要再来一次。安全小组以说“不”而闻名。 -因此,我们想的是,没什么不把安全这个部分提到前面呢(左边是一个典型的从左到右的开发流程图)?安全性可能仍然不行,但在开发的早期进行重构的影响要远远小于开发已经完成并且准备上线时进行重构的影响。 +因此,我们想的是,为什么不把安全这个部分提到前面呢(在一个典型的从左到右的开发流程图的“左边”)?安全团队仍然可以说“不”,但在开发的早期进行重构的影响要远远小于开发已经完成并且准备上线时进行重构的影响。 不过,我不喜欢“左移”这个词,这意味着安全仍然是一个只不过提前进行的一次性工作。在应用程序的整个生命周期里,从供应链到开发,再到测试,直到上线部署,安全都需要进行大量的自动化处理。 ### 管理依赖 -我们在现代应用程序开发过程中看到的一个最大的改变,就是你通常不需要去编写这个程序的大部分代码。使用开源的函数库和框架就是一个明显的例子。但是你也可以从公共的云服务商或其他来源那里获得额外的服务。在许多情况下,这些额外的代码和服务比你给自己写的要好得多。 +我们在现代应用程序开发过程中看到的一个最大的改变,就是你通常不需要去编写这个程序的大部分代码。使用开源的函数库和框架就是一个明显的例子。而且你也可以从公共的云服务商或其他来源那里获得额外的服务。在许多情况下,这些额外的代码和服务比你给自己写的要好得多。 -因此,DevSecOps 需要你把重点放在你的软件供应链上,你是从可信的来源那里获取你的软件的吗?这些软件是最新的吗?它们已经集成到了你为自己的代码使用的安全流程中了吗?对于这些你能使用的代码和 API 你有哪些策略?你为自己的产品代码使用的组件是否有可用的商业支持? +因此,DevSecOps 需要你把重点放在你的[软件供应链][8]上,你是从可信的来源那里获取你的软件的吗?这些软件是最新的吗?它们已经集成到了你为自己的代码所使用的安全流程中了吗?对于这些你能使用的代码和 API 你有哪些策略?你为自己的产品代码使用的组件是否有可用的商业支持? 没有一套标准答案可以应对所有的情况。对于概念验证和大规模的生产,它们可能会有所不同。但是,正如制造业长期存在的情况(DevSecOps 和制造业的发展方面有许多相似之处),供应链的可信是至关重要的。 @@ -42,7 +44,7 @@ DevSecOps 也不例外,在今天,安全已经变成了一个持续性的过 关于贯穿应用程序整个生命周期里所有阶段的自动化的需求,我已经谈过很多了。这里假设我们能看见每个阶段里发生的情况。 -有效的 DevSecOps 需要有效的检测,以便于自动化程序知道要做什么。这个检测分了很多类别。一些长期的和高级别的指标能帮助我们了解整个 DevSecOps 流程是否工作良好。严重威胁级别的警报需要立刻有人进行处理(安全扫描系统已经关闭!)。有一些警报,比如扫描失败,需要进行修复。我们记录了大量的参数来生成日志,以便事后进行分析(随着时间的推移,哪些发生了改变?导致失败的原因是什么?)。 +有效的 DevSecOps 需要有效的检测,以便于自动化程序知道要做什么。这个检测分了很多类别。一些长期的和高级别的指标能帮助我们了解整个 DevSecOps 流程是否工作良好。严重威胁级别的警报需要立刻有人进行处理(安全扫描系统已经关闭!)。有一些警报,比如扫描失败,需要进行修复。我们记录了许多参数的志以便事后进行分析(随着时间的推移,哪些发生了改变?导致失败的原因是什么?)。 ### 分散服务 vs 一体化解决方案 @@ -50,7 +52,7 @@ DevSecOps 也不例外,在今天,安全已经变成了一个持续性的过 这种方法确实带来了一些新的安全挑战,组件之间的交互可能会很复杂,总的攻击面会更大,因为现在应用程序通过网络有了更多的切入点。 -另一方面,这种类型的架构还意味着自动化的安全和监视可以更加精细地查看应用程序的组件,因为它们不再深埋在一整个应用程序之中。 +另一方面,这种类型的架构还意味着自动化的安全和监视可以更加精细地查看应用程序的组件,因为它们不再深埋在一个独石应用程序之中。 不要过多地关注 DevSecOps 这个术语,但要提醒一下,安全正在不断地演变,因为我们编写和部署程序的方式也在不断地演变。 @@ -61,7 +63,7 @@ via: https://opensource.com/article/18/9/devsecops-changes-security 作者:[Gordon Haff][a] 选题:[lujun9972](https://github.com/lujun9972) 译者:[hopefully2333](https://github.com/hopefully2333) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From fa86e4185d7bcf361cd66cce8e1fdbcc4d5a8d0e Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Fri, 25 Jan 2019 00:18:07 +0800 Subject: [PATCH 112/243] PUB:20180919 5 ways DevSecOps changes security.md @hopefully2333 https://linux.cn/article-10475-1.html --- .../20180919 5 ways DevSecOps changes security.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {translated/talk => published}/20180919 5 ways DevSecOps changes security.md (100%) diff --git a/translated/talk/20180919 5 ways DevSecOps changes security.md b/published/20180919 5 ways DevSecOps changes security.md similarity index 100% rename from translated/talk/20180919 5 ways DevSecOps changes security.md rename to published/20180919 5 ways DevSecOps changes security.md From 1b6a04387763bbedeb12d26c2f2aa1943cc6b9ac Mon Sep 17 00:00:00 2001 From: geekpi Date: Fri, 25 Jan 2019 08:58:31 +0800 Subject: [PATCH 113/243] translated --- ...109 Bash 5.0 Released with New Features.md | 80 ------------------- ...109 Bash 5.0 Released with New Features.md | 80 +++++++++++++++++++ 2 files changed, 80 insertions(+), 80 deletions(-) delete mode 100644 sources/tech/20190109 Bash 5.0 Released with New Features.md create mode 100644 translated/tech/20190109 Bash 5.0 Released with New Features.md diff --git a/sources/tech/20190109 Bash 5.0 Released with New Features.md b/sources/tech/20190109 Bash 5.0 Released with New Features.md deleted file mode 100644 index 17b0c5758a..0000000000 --- a/sources/tech/20190109 Bash 5.0 Released with New Features.md +++ /dev/null @@ -1,80 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (geekpi) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Bash 5.0 Released with New Features) -[#]: via: (https://itsfoss.com/bash-5-release) -[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) - -Bash 5.0 Released with New Features -====== - -The [mailing list][1] confirmed the release of Bash-5.0 recently. And, it is exciting to know that it comes baked with new features and variable. - -Well, if you’ve been using Bash 4.4.XX, you will definitely love the fifth major release of [Bash][2]. - -The fifth release focuses on new shell variables and a lot of major bug fixes with an overhaul. It also introduces a couple of new features along with some incompatible changes between bash-4.4 and bash-5.0. - -![Bash logo][3] - -### What about the new features? - -The mailing list explains the bug fixed in this new release: - -> This release fixes several outstanding bugs in bash-4.4 and introduces several new features. The most significant bug fixes are an overhaul of how nameref variables resolve and a number of potential out-of-bounds memory errors discovered via fuzzing. There are a number of changes to the expansion of $@ and $* in various contexts where word splitting is not performed to conform to a Posix standard interpretation, and additional changes to resolve corner cases for Posix conformance. - -It also introduces some new features. As per the release note, these are the most notable new features are several new shell variables: - -> The BASH_ARGV0, EPOCHSECONDS, and EPOCHREALTIME. The ‘history’ builtin can remove ranges of history entries and understands negative arguments as offsets from the end of the history list. There is an option to allow local variables to inherit the value of a variable with the same name at a preceding scope. There is a new shell option that, when enabled, causes the shell to attempt to expand associative array subscripts only once (this is an issue when they are used in arithmetic expressions). The ‘globasciiranges‘ shell option is now enabled by default; it can be set to off by default at configuration time. - -### What about the changes between Bash-4.4 and Bash-5.0? - -The update log mentioned about the incompatible changes and the supported readline version history. Here’s what it said: - -> There are a few incompatible changes between bash-4.4 and bash-5.0. The changes to how nameref variables are resolved means that some uses of namerefs will behave differently, though I have tried to minimize the compatibility issues. By default, the shell only sets BASH_ARGC and BASH_ARGV at startup if extended debugging mode is enabled; it was an oversight that it was set unconditionally and caused performance issues when scripts were passed large numbers of arguments. -> -> Bash can be linked against an already-installed Readline library rather than the private version in lib/readline if desired. Only readline-8.0 and later versions are able to provide all of the symbols that bash-5.0 requires; earlier versions of the Readline library will not work correctly. - -I believe some of the features/variables added are very useful. Some of my favorites are: - - * There is a new (disabled by default, undocumented) shell option to enable and disable sending history to syslog at runtime. - * The shell doesn’t automatically set BASH_ARGC and BASH_ARGV at startup unless it’s in debugging mode, as the documentation has always said, but will dynamically create them if a script references them at the top level without having enabled debugging mode. - * The ‘history’ can now delete ranges of history entries using ‘-d start-end’. - * If a non-interactive shell with job control enabled detects that a foreground job died due to SIGINT, it acts as if it received the SIGINT. - * BASH_ARGV0: a new variable that expands to $0 and sets $0 on assignment. - - - -To check the complete list of changes and features you should refer to the [Mailing list post][1]. - -### Wrapping Up - -You can check your current Bash version, using this command: - -``` -bash --version -``` - -It’s more likely that you’ll have Bash 4.4 installed. If you want to get the new version, I would advise waiting for your distribution to provide it. - -With Bash-5.0 available, what do you think about it? Are you using any alternative to bash? If so, would this update change your mind? - -Let us know your thoughts in the comments below. - --------------------------------------------------------------------------------- - -via: https://itsfoss.com/bash-5-release - -作者:[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://lists.gnu.org/archive/html/bug-bash/2019-01/msg00063.html -[2]: https://www.gnu.org/software/bash/ -[3]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/01/bash-logo.jpg?resize=800%2C450&ssl=1 diff --git a/translated/tech/20190109 Bash 5.0 Released with New Features.md b/translated/tech/20190109 Bash 5.0 Released with New Features.md new file mode 100644 index 0000000000..25a1735e78 --- /dev/null +++ b/translated/tech/20190109 Bash 5.0 Released with New Features.md @@ -0,0 +1,80 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Bash 5.0 Released with New Features) +[#]: via: (https://itsfoss.com/bash-5-release) +[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) + +Bash 5.0 发布了新功能 +====== + +[邮件列表][1]证实最近发布了 Bash-5.0。而且,令人兴奋的是它还有新功能和新变量。 + +如果你一直在使用 Bash 4.4.XX,那么你一定会喜欢 [Bash][2] 的第五个主要版本。 + +第五个版本侧重于新的 shell 变量和许多重大漏洞修复。它还引入了一些新功能还有一些让 bash-4.4 和 bash-5.0 之间不兼容的更改。 + +![Bash logo][3] + +### 新功能怎么样? + +邮件列表解释了此版本中修复的 bug: + +> 此版本修复了 bash-4.4 中的几个主要错误,并引入了几个新功能。最重要的 bug 修复是对 nameref 变量的解析以及通过模糊测试发现的许多潜在的内存越界错误。在为了符合 Posix 标准解释而不进行单词拆分的上下文中,对 $@ 和 $* 的展开做了许多变化,另外还有解决极端情况中 Posix 一致性的修改。 + +它还引入了一些新功能。根据发布说明,最值得注意的新功能是几个新的 shell 变量: + +> BASH_ARGV0、EPOCHSECONDS 和 EPOCHREALTIME。内置的 “history” 可以删除指定范围的条目,并能将负数理解为从历史末端开始的偏移量。有一个选项允许局部变量继承前一个范围内具有相同名称的变量的值。有一个新的shell选项,在启用它时,会导致 shell 只尝试一次扩展关联数组下标(这在算术表达式中使用时会出现问题)。“globasciiranges” 这个 shell 选项现在默认启用。可以在配置时默认关闭它。 + +### Bash-4.4 和 Bash-5.0 之间有哪些变化? + +更新日志提到了不兼容的更改和支持 readline 版本历史记录。它是这么说的: + +> bash-4.4 和 bash-5.0 之间存在一些不兼容的变化。尽管我已经尽量最小化兼容性问题,但是对 nameref 变量解析的更改意味着对 namerefs 的某些使用会有不同的行为。默认情况下,如果启用了扩展调试模式,shell 仅在启动时设置 BASH_ARGC 和 BASH_ARGV。它被无条件地设置是一个疏忽,并且在脚本传递大量参数时会导致性能问题。 +> +>如果需要,可以将 Bash 链接到已安装的 Readline 库,而不是 lib/readline 中的私有版本。只有 readline-8.0 及更高版本能够提供 bash-5.0 所需的所有符号。早期版本的 Readline 库无法正常工作。 + +我相信一些添加的功能/变量非常有用。我最喜欢的一些是: + + * 有一个新的(默认情况下禁用,文档中没有说明)shell 选项,用于在运行时启用/禁用向 syslog 发送历史记录。 + * 正如文档一直所说的那样,除非 shell 处于调试模式,否则它不会在启动时自动设置 BASH_ARGC 和 BASH_ARGV,但如果脚本在上层引用它们且没有启用调试模式,那么 shell 将动态创建它们。 + * 现在可以使用 “-d start-end” 删除指定范围的 “history” 条目。 + * 如果启用了作业控制的非交互式 shell 检测到前台作业因 SIGINT 而死亡,则其行为就像接收到 SIGINT 一样。 + * BASH_ARGV0:一个新变量,扩展为 $0 并在赋值时设置 $0。 + + + +要查看完整的更改和功能列表,请参阅[邮件列表文章][1]。 + +### 总结 + +你可以使用下面的命令检查你当前的 Bash 版本: + +``` +bash --version +``` + +你很可能安装了 Bash 4.4。如果你想获得新版本,我建议等待你的发行版提供它。 + +你怎么看待 Bash-5.0 发布?你在使用其他 bash 的替代品么?如果有的话,这个更新会改变你的想法么? + +请在下面的评论中告诉我们你的想法。 + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/bash-5-release + +作者:[Ankush Das][a] +选题:[lujun9972][b] +译者:[geekpi](https://github.com/geekpi) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/ankush/ +[b]: https://github.com/lujun9972 +[1]: https://lists.gnu.org/archive/html/bug-bash/2019-01/msg00063.html +[2]: https://www.gnu.org/software/bash/ +[3]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/01/bash-logo.jpg?resize=800%2C450&ssl=1 \ No newline at end of file From 6eb8ecfcd0030b34869145ef73d6447c8089ab9f Mon Sep 17 00:00:00 2001 From: geekpi Date: Fri, 25 Jan 2019 09:03:24 +0800 Subject: [PATCH 114/243] translating --- ...- A Modular System And Hardware Monitoring Tool For Linux.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20190114 Hegemon - A Modular System And Hardware Monitoring Tool For Linux.md b/sources/tech/20190114 Hegemon - A Modular System And Hardware Monitoring Tool For Linux.md index 28b5d5cd27..24b5f93af7 100644 --- a/sources/tech/20190114 Hegemon - A Modular System And Hardware Monitoring Tool For Linux.md +++ b/sources/tech/20190114 Hegemon - A Modular System And Hardware Monitoring Tool For Linux.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (geekpi) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 2dace79a4bcbf61eee686a0c031b703a0a822218 Mon Sep 17 00:00:00 2001 From: darksun Date: Fri, 25 Jan 2019 16:57:43 +0800 Subject: [PATCH 115/243] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190109=20GoAcce?= =?UTF-8?q?ss=20=E2=80=93=20A=20Real-Time=20Web=20Server=20Log=20Analyzer?= =?UTF-8?q?=20And=20Interactive=20Viewer=20sources/tech/20190109=20GoAcces?= =?UTF-8?q?s=20-=20A=20Real-Time=20Web=20Server=20Log=20Analyzer=20And=20I?= =?UTF-8?q?nteractive=20Viewer.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...ver Log Analyzer And Interactive Viewer.md | 187 ++++++++++++++++++ 1 file changed, 187 insertions(+) create mode 100644 sources/tech/20190109 GoAccess - A Real-Time Web Server Log Analyzer And Interactive Viewer.md diff --git a/sources/tech/20190109 GoAccess - A Real-Time Web Server Log Analyzer And Interactive Viewer.md b/sources/tech/20190109 GoAccess - A Real-Time Web Server Log Analyzer And Interactive Viewer.md new file mode 100644 index 0000000000..3bad5ba969 --- /dev/null +++ b/sources/tech/20190109 GoAccess - A Real-Time Web Server Log Analyzer And Interactive Viewer.md @@ -0,0 +1,187 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (GoAccess – A Real-Time Web Server Log Analyzer And Interactive Viewer) +[#]: via: (https://www.2daygeek.com/goaccess-a-real-time-web-server-log-analyzer-and-interactive-viewer/) +[#]: author: (Vinoth Kumar https://www.2daygeek.com/author/vinoth/) + +GoAccess – A Real-Time Web Server Log Analyzer And Interactive Viewer +====== + +Analyzing a log file is a big headache for Linux administrators as it’s capturing a lot of things. + +Most of the newbies and L1 administrators doesn’t know how to analyze this. + +If you have good knowledge to analyze a logs then you will be a legend for NIX system. + +There are many tools available in Linux to analyze the logs easily. + +GoAccess is one of the tool which allow users to analyze web server logs easily. + +We will be going to discuss in details about GoAccess tool in this article. + +### What is GoAccess? + +GoAccess is a real-time web log analyzer and interactive viewer that runs in a terminal in *nix systems or through your browser. + +GoAccess has minimal requirements, it’s written in C and requires only ncurses. + +It will support Apache, Nginx and Lighttpd logs. It provides fast and valuable HTTP statistics for system administrators that require a visual server report on the fly. + +GoAccess parses the specified web log file and outputs the data to the X terminal and browser. + +GoAccess was designed to be a fast, terminal-based log analyzer. Its core idea is to quickly analyze and view web server statistics in real time without needing to use your browser. + +Terminal output is the default output, it has the capability to generate a complete, self-contained, real-time HTML report, as well as a JSON, and CSV report. + +GoAccess allows any custom log format and the following (Combined Log Format (XLF/ELF) Apache | Nginx & Common Log Format (CLF) Apache) predefined log format options are included, but not limited to. + +### GoAccess Features + + * **`Completely Real Time:`** All the metrics are updated every 200 ms on the terminal and every second on the HTML output. + * **`Track Application Response Time:`** Track the time taken to serve the request. Extremely useful if you want to track pages that are slowing down your site. + * **`Visitors:`** Determine the amount of hits, visitors, bandwidth, and metrics for slowest running requests by the hour, or date. + * **`Metrics per Virtual Host:`** Have multiple Virtual Hosts (Server Blocks)? It features a panel that displays which virtual host is consuming most of the web server resources. + + + +### How to Install GoAccess? + +I would advise users to install GoAccess from distribution official repository with help of Package Manager. It is available in most of the distributions official repository. + +As we know, we will be getting bit outdated package for standard release distribution and rolling release distributions always include latest package. + +If you are running the OS with standard release distributions, i would suggest you to check the alternative options such as PPA or Official GoAccess maintainer repository, etc, to get a latest package. + +For **`Debian/Ubuntu`** systems, use **[APT-GET Command][1]** or **[APT Command][2]** to install GoAccess on your systems. + +``` +# apt install goaccess +``` + +To get a latest GoAccess package, use the below GoAccess official repository. + +``` +$ echo "deb https://deb.goaccess.io/ $(lsb_release -cs) main" | sudo tee -a /etc/apt/sources.list.d/goaccess.list +$ wget -O - https://deb.goaccess.io/gnugpg.key | sudo apt-key add - +$ sudo apt-get update +$ sudo apt-get install goaccess +``` + +For **`RHEL/CentOS`** systems, use **[YUM Package Manager][3]** to install GoAccess on your systems. + +``` +# yum install goaccess +``` + +For **`Fedora`** system, use **[DNF Package Manager][4]** to install GoAccess on your system. + +``` +# dnf install goaccess +``` + +For **`ArchLinux/Manjaro`** based systems, use **[Pacman Package Manager][5]** to install GoAccess on your systems. + +``` +# pacman -S goaccess +``` + +For **`openSUSE Leap`** system, use **[Zypper Package Manager][6]** to install GoAccess on your system. + +``` +# zypper install goaccess + +# zypper ar -f obs://server:http + +# zypper ref && zypper in goaccess +``` + +### How to Use GoAccess? + +After successful installation of GoAccess. Just enter the goaccess command and followed by the web server log location to view it. + +``` +# goaccess [options] /path/to/Web Server/access.log + +# goaccess /var/log/apache/2daygeek_access.log +``` + +When you execute the above command, it will ask you to select the **Log Format Configuration**. +![][8] + +I had tested this with Apache access log. The Apache log is splitted in fifteen section. The details are below. The main section shows the summary about the fifteen section. + +The below screenshots included four sessions such as Unique Visitors, Requested files, Static Requests, Not found URLs. +![][9] + +The below screenshots included four sessions such as Visitor Hostnames and IPs, Operating Systems, Browsers, Time Distribution. +![][10] + +The below screenshots included four sessions such as Referrers URLs, Referring Sites, Google’s search engine results, HTTP status codes. +![][11] + +If you would like to generate a html report, use the following format. + +Initially i got an error when i was trying to generate the html report. + +``` +# goaccess 2daygeek_access.log -a > report.html + +GoAccess - version 1.3 - Nov 23 2018 11:28:19 +Config file: No config file used + +Fatal error has occurred +Error occurred at: src/parser.c - parse_log - 2764 +No time format was found on your conf file.Parsing... [0] [0/s] +``` + +It says “No time format was found on your conf file”. To overcome this issue, add the “COMBINED” log format option on it. + +``` +# goaccess -f 2daygeek_access.log --log-format=COMBINED -o 2daygeek.html +Parsing...[0,165] [50,165/s] +``` + +![][12] + +GoAccess allows you to access and analyze the real-time log filtering and parsing. + +``` +# tail -f /var/log/apache/2daygeek_access.log | goaccess - +``` + +For more details navigate to man or help page. + +``` +# man goaccess +or +# goaccess --help +``` + +-------------------------------------------------------------------------------- + +via: https://www.2daygeek.com/goaccess-a-real-time-web-server-log-analyzer-and-interactive-viewer/ + +作者:[Vinoth Kumar][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.2daygeek.com/author/vinoth/ +[b]: https://github.com/lujun9972 +[1]: https://www.2daygeek.com/apt-get-apt-cache-command-examples-manage-packages-debian-ubuntu-systems/ +[2]: https://www.2daygeek.com/apt-command-examples-manage-packages-debian-ubuntu-systems/ +[3]: https://www.2daygeek.com/yum-command-examples-manage-packages-rhel-centos-systems/ +[4]: https://www.2daygeek.com/dnf-command-examples-manage-packages-fedora-system/ +[5]: https://www.2daygeek.com/pacman-command-examples-manage-packages-arch-linux-system/ +[6]: https://www.2daygeek.com/zypper-command-examples-manage-packages-opensuse-system/ +[7]: data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7 +[8]: https://www.2daygeek.com/wp-content/uploads/2019/01/goaccess-a-real-time-web-server-log-analyzer-and-interactive-viewer-1.png +[9]: https://www.2daygeek.com/wp-content/uploads/2019/01/goaccess-a-real-time-web-server-log-analyzer-and-interactive-viewer-2.png +[10]: https://www.2daygeek.com/wp-content/uploads/2019/01/goaccess-a-real-time-web-server-log-analyzer-and-interactive-viewer-3.png +[11]: https://www.2daygeek.com/wp-content/uploads/2019/01/goaccess-a-real-time-web-server-log-analyzer-and-interactive-viewer-4.png +[12]: https://www.2daygeek.com/wp-content/uploads/2019/01/goaccess-a-real-time-web-server-log-analyzer-and-interactive-viewer-5.png From d18814607d3727ddb70322eac53dccd783c1f148 Mon Sep 17 00:00:00 2001 From: darksun Date: Fri, 25 Jan 2019 17:04:45 +0800 Subject: [PATCH 116/243] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020150717=20The=20?= =?UTF-8?q?History=20of=20Hello=20World=20sources/tech/20150717=20The=20Hi?= =?UTF-8?q?story=20of=20Hello=20World.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../20150717 The History of Hello World.md | 143 ++++++++++++++++++ 1 file changed, 143 insertions(+) create mode 100644 sources/tech/20150717 The History of Hello World.md diff --git a/sources/tech/20150717 The History of Hello World.md b/sources/tech/20150717 The History of Hello World.md new file mode 100644 index 0000000000..9211e9f40f --- /dev/null +++ b/sources/tech/20150717 The History of Hello World.md @@ -0,0 +1,143 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (The History of Hello World) +[#]: via: (https://www.thesoftwareguild.com/blog/the-history-of-hello-world/) +[#]: author: (thussong https://www.thesoftwareguild.com/blog/author/thussong/) + +The History of Hello World +====== + + +Veteran software developers know the [Hello World][2] program as the first step in learning to code. The program, which outputs some variant of “Hello, World!” on a device’s display, can be created in most languages, making it some of the most basic syntax involved in the coding process. In fact, a recent project at the Association for Computing Machinery (ACM) at Louisiana Tech [found][3] that there are at least 204 versions of the program. + +Traditionally, Hello World programs are used to illustrate how the process of coding works, as well as to ensure that a language or system is operating correctly. They are usually the first programs that new coders learn, because even those with little or no experience can execute Hello World both easily and correctly. + +Above all, Hello World is simple. That’s why it is so often used as a barometer of program success. If Hello World does not work effectively within the framework, then it is likely that other, more complex programs will also fail. As one expert at [Win-Vector][4] puts it, Hello World is actually a confrontational program. “The author is saying ‘it isn’t obvious your computer system will work, so I am not going to invest a lot of time in it until I see it can at least print one line of text,’” Win-Vector blogger John Mount says. + +But this two-word phrase has big implications for the field of computer science. With Hello World as a foundation, novice programmers can easily understand computer science principles or elements. And professionals with years of coding experience can use it to learn how a given programming language works, especially in terms of structure and syntax. With applications at all skill levels and in almost every language, there is a long history behind such a short program. + +### Uses + +The main use for Hello World programs was outlined above: It is a way for rookie coders to become acquainted with a new language. However, the applications of these programs go beyond an introduction to the coding world. Hello World can, for example, be used as a sanity test to make sure that the components of a language (its compiler, development and run-time environment) have been correctly installed. Because the process involved in configuring a complete programming toolchain is lengthy and complex, a simple program like Hello World is often used as a first-run test on a new toolchain. + +Hackers also use Hello World “as proof of concept that arbitrary code can be executed through an exploit where the system designers did not intend code to be executed,” according to programming consultants at Cunningham & Cunningham (C2). In fact, it’s the first step in using homemade content, or “home brew” on a device. When [experienced coders][5] are configuring an environment or learning a previously unknown one, they verify that Hello World behaves correctly. + +It is also used as part of the debugging process, allowing programmers to check that they are editing the right aspect of a modifiable program at runtime and that it is being reloaded. + +One more popular use for Hello World is as a basis for comparison. Coders can “compare the size of the executable that the language generates, and how much supporting infrastructure must exist behind the program for it to execute,” according to C2’s wiki. + +### Beginnings + +Though the origins of Hello World remain somewhat unclear, its use as a test phrase is widely believed to have begun with Brian Kernigham’s 1972 book, A Tutorial Introduction to the Language B. In this text, the first known version of the program was used to illustrate external variables. Because the previous example in the tutorial printed “hi!” on the terminal, the more complex “hello, world!” required more character constants for expression and was the next step in the learning process. + +From there, it was used in a Bell Laboratories memo in 1974, as well as The C Programming Language in 1978. This popular text is what made Hello World famous. The example from that book (the first, and most pure, example) printed “hello, world,” with no capital letters or exclamation point. At this time, Hello World was used almost solely to illustrate a few functions of a language— not to test whether the system was running. + +Before Kernigham’s seminal texts on B and C, there was no standard first program. Even as late as 1972, it was not widely in use. The popular BASIC tutorial, “My Computer Likes Me, When I Speak in Basic,” starts with a simple program that writes a line of text. However, this message was “MY HUMAN UNDERSTANDS ME,” far from the two-word greeting programmers use today. But once Hello World was invented, it spread quickly, becoming well-known by the late 1970s. Its popularity continues to this day. + +### One Statement, Many Languages + +Here’s what the code for Hello World looks like in some of the most popular programming languages currently in use. + +#### Java + +``` +class HelloWorld { +public static void main(String[] args) { +System.out.println("Hello, world!"); +} +} +``` + +#### C# + +``` +using System; +class Program +{ +public static void Main(string[] args) +{ +Console.WriteLine("Hello, world!"); +} +} +``` + +#### Python + +``` +print("Hello, world!") +``` + +#### Ruby + +``` +puts "Hello, world!" +``` + +#### Scala + +``` +object HelloWorld extends App { +println("Hello, world!") +} +``` + +#### ASP.NET + +`Response.Write("Hello World!");` + +#### Lisp + +``` +(princ "Hello, world!") +``` + +#### Haskell + +``` +main = putStrLn "Hello, world!" +``` + +#### Malbolge + +``` +('&%:9]!~}|z2Vxwv-,POqponl$Hjig%eB@@>}= +``` + +#### Go + +``` +package main +import "fmt" +func main() { +fmt.Println("Hello, world!") +} +``` + +### Hello World Today: A Standard Practice in Varied Forms + +In modern coding languages, Hello World is deployed at different levels of sophistication. For example, the Go language introduced a multilingual Hello World program, and XL features a spinning, 3D version complete with graphics. Some languages, like Ruby and Python, need only a single statement to print “hello world,” but a low-level assembly language could require several commands to do so. Modern languages also introduce variations in punctuation and casing. These include the presence or absence of the comma and exclamation point, as well as the capitalization of both words. For example, when systems only support capital letters, the phrase appears as “HELLO WORLD.” The first nontrivial Malbolge program printed “HEllO WORld.” Variations go beyond the literal as well. In functional languages like Lisp and Haskell, factorial programs are substituted for Hello World to emphasize recursive techniques. This is different from the original examples, which emphasized I/O and produced side effects. + +With the increasing complexity of modern coding languages, Hello World is more important than ever. Both as a test and a teaching tool, it has become a standardized way of allowing programmers to configure their environment. No one can be sure why Hello World has stood the test of time in an industry known for rapid-fire innovation, but it is here to stay. + +-------------------------------------------------------------------------------- + +via: https://www.thesoftwareguild.com/blog/the-history-of-hello-world/ + +作者:[thussong][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.thesoftwareguild.com/blog/author/thussong/ +[b]: https://github.com/lujun9972 +[1]: https://www.linkedin.com/shareArticle?mini=true&url=https%3A%2F%2Fwww.thesoftwareguild.com%2Fblog%2Fthe-history-of-hello-world%2F&title=The%20History%20of%20Hello%20World +[2]: http://en.wikipedia.org/wiki/%22Hello,_World!%22_program +[3]: http://whatis.techtarget.com/definition/Hello-World +[4]: http://www.win-vector.com/blog/2008/02/hello-world-an-instance-rhetoric-in-computer-science/ +[5]: http://c2.com/cgi/wiki?HelloWorld From 496daabf7afb972019f1ee7e02e7d9e4b32c818f Mon Sep 17 00:00:00 2001 From: darksun Date: Fri, 25 Jan 2019 17:06:01 +0800 Subject: [PATCH 117/243] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190121=20Akira:?= =?UTF-8?q?=20The=20Linux=20Design=20Tool=20We=E2=80=99ve=20Always=20Wante?= =?UTF-8?q?d=3F=20sources/tech/20190121=20Akira-=20The=20Linux=20Design=20?= =?UTF-8?q?Tool=20We-ve=20Always=20Wanted.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...e Linux Design Tool We-ve Always Wanted.md | 92 +++++++++++++++++++ 1 file changed, 92 insertions(+) create mode 100644 sources/tech/20190121 Akira- The Linux Design Tool We-ve Always Wanted.md diff --git a/sources/tech/20190121 Akira- The Linux Design Tool We-ve Always Wanted.md b/sources/tech/20190121 Akira- The Linux Design Tool We-ve Always Wanted.md new file mode 100644 index 0000000000..bd58eca5bf --- /dev/null +++ b/sources/tech/20190121 Akira- The Linux Design Tool We-ve Always Wanted.md @@ -0,0 +1,92 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Akira: The Linux Design Tool We’ve Always Wanted?) +[#]: via: (https://itsfoss.com/akira-design-tool) +[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) + +Akira: The Linux Design Tool We’ve Always Wanted? +====== + +Let’s make it clear, I am not a professional designer – but I’ve used certain tools on Windows (like Photoshop, Illustrator, etc.) and [Figma][1] (which is a browser-based interface design tool). I’m sure there are a lot more design tools available for Mac and Windows. + +Even on Linux, there is a limited number of dedicated [graphic design tools][2]. A few of these tools like [GIMP][3] and [Inkscape][4] are used by professionals as well. But most of them are not considered professional grade, unfortunately. + +Even if there are a couple more solutions – I’ve never come across a native Linux application that could replace [Sketch][5], Figma, or Adobe **** XD. Any professional designer would agree to that, isn’t it? + +### Is Akira going to replace Sketch, Figma, and Adobe XD on Linux? + +Well, in order to develop something that would replace those awesome proprietary tools – [Alessandro Castellani][6] – came up with a [Kickstarter campaign][7] by teaming up with a couple of experienced developers – +[Alberto Fanjul][8], [Bilal Elmoussaoui][9], and [Felipe Escoto][10]. + +So, yes, Akira is still pretty much just an idea- with a working prototype of its interface (as I observed in their [live stream session][11] via Kickstarter recently). + +### If it does not exist, why the Kickstarter campaign? + +![][12] + +The aim of the Kickstarter campaign is to gather funds in order to hire the developers and take a few months off to dedicate their time in order to make Akira possible. + +Nonetheless, if you want to support the project, you should know some details, right? + +Fret not, we asked a couple of questions in their livestream session – let’s get into it… + +### Akira: A few more details + +![Akira prototype interface][13] +Image Credits: Kickstarter + +As the Kickstarter campaign describes: + +> The main purpose of Akira is to offer a fast and intuitive tool to **create Web and Mobile interfaces** , more like **Sketch** , **Figma** , or **Adobe XD** , with a completely native experience for Linux. + +They’ve also written a detailed description as to how the tool will be different from Inkscape, Glade, or QML Editor. Of course, if you want all the technical details, [Kickstarter][7] is the way to go. But, before that, let’s take a look at what they had to say when I asked some questions about Akira. + +Q: If you consider your project – similar to what Figma offers – why should one consider installing Akira instead of using the web-based tool? Is it just going to be a clone of those tools – offering a native Linux experience or is there something really interesting to encourage users to switch (except being an open source solution)? + +**Akira:** A native experience on Linux is always better and fast in comparison to a web-based electron app. Also, the hardware configuration matters if you choose to utilize Figma – but Akira will be light on system resource and you will still be able to do similar stuff without needing to go online. + +Q: Let’s assume that it becomes the open source solution that Linux users have been waiting for (with similar features offered by proprietary tools). What are your plans to sustain it? Do you plan to introduce any pricing plans – or rely on donations? + +**Akira** : The project will mostly rely on Donations (something like [Krita Foundation][14] could be an idea). But, there will be no “pro” pricing plans – it will be available for free and it will be an open source project. + +So, with the response I got, it definitely seems to be something promising that we should probably support. + +### Wrapping Up + +What do you think about Akira? Is it just going to remain a concept? Or do you hope to see it in action? + +Let us know your thoughts in the comments below. + +![][15] + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/akira-design-tool + +作者:[Ankush Das][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/ankush/ +[b]: https://github.com/lujun9972 +[1]: https://www.figma.com/ +[2]: https://itsfoss.com/best-linux-graphic-design-software/ +[3]: https://itsfoss.com/gimp-2-10-release/ +[4]: https://inkscape.org/ +[5]: https://www.sketchapp.com/ +[6]: https://github.com/Alecaddd +[7]: https://www.kickstarter.com/projects/alecaddd/akira-the-linux-design-tool/description +[8]: https://github.com/albfan +[9]: https://github.com/bilelmoussaoui +[10]: https://github.com/Philip-Scott +[11]: https://live.kickstarter.com/alessandro-castellani/live-stream/the-current-state-of-akira +[12]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/01/akira-design-tool-kickstarter.jpg?resize=800%2C451&ssl=1 +[13]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/01/akira-mockup.png?ssl=1 +[14]: https://krita.org/en/about/krita-foundation/ +[15]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/01/akira-design-tool-kickstarter.jpg?fit=812%2C458&ssl=1 From 77b61cceda5431e625ec8c278b3731b6d3512600 Mon Sep 17 00:00:00 2001 From: darksun Date: Fri, 25 Jan 2019 17:07:54 +0800 Subject: [PATCH 118/243] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190120=20Get=20?= =?UTF-8?q?started=20with=20HomeBank,=20an=20open=20source=20personal=20fi?= =?UTF-8?q?nance=20app=20sources/tech/20190120=20Get=20started=20with=20Ho?= =?UTF-8?q?meBank,=20an=20open=20source=20personal=20finance=20app.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...nk, an open source personal finance app.md | 61 +++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 sources/tech/20190120 Get started with HomeBank, an open source personal finance app.md diff --git a/sources/tech/20190120 Get started with HomeBank, an open source personal finance app.md b/sources/tech/20190120 Get started with HomeBank, an open source personal finance app.md new file mode 100644 index 0000000000..0c905c86f5 --- /dev/null +++ b/sources/tech/20190120 Get started with HomeBank, an open source personal finance app.md @@ -0,0 +1,61 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Get started with HomeBank, an open source personal finance app) +[#]: via: (https://opensource.com/article/19/1/productivity-tools-homebank) +[#]: author: (Kevin Sonney https://opensource.com/users/ksonney (Kevin Sonney)) + +Get started with HomeBank, an open source personal finance app +====== +Keep track of where your money is going with HomeBank, the eighth in our series on open source tools that will make you more productive in 2019. +![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/math_money_financial_calculator_colors.jpg?itok=_yEVTST1) + +There seems to be a mad rush at the beginning of every year to find ways to be more productive. New Year's resolutions, the itch to start the year off right, and of course, an "out with the old, in with the new" attitude all contribute to this. And the usual round of recommendations is heavily biased towards closed source and proprietary software. It doesn't have to be that way. + +Here's the eighth of my picks for 19 new (or new-to-you) open source tools to help you be more productive in 2019. + +### HomeBank + +Managing my finances can be really stressful. I don't look at my bank balance every day and sometimes have trouble keeping track of where my money is going. I often spend more time managing my finances than I need to, digging into accounts and payment histories to figure out where my money went. Knowing my finances are OK helps keep me calm and allows me to focus on other things. + +![](https://opensource.com/sites/default/files/uploads/homebank-1.png) + +[HomeBank][1] is a personal finance desktop application that helps decrease this type of stress by making it fairly easy to keep track of your finances. It has some nice reports to help you figure out where you're spending your money, allows you to set up rules for importing transactions, and supports most modern formats. + +HomeBank is available on most distributions by default, so installation is very easy. When you start it up for the first time, it will walk you through setup and allow you to create an account. From there, you can either import one of the supported file formats or start entering transactions. The transaction register itself is just that—a list of transactions. [Unlike some other apps][2], you don't have to learn [double-entry bookkeeping][3] to use HomeBank. + +![](https://opensource.com/sites/default/files/uploads/homebank-2.png) + +Importing files from your bank is handled with another step-by-step wizard, with options to create a new account or populate an existing one. Importing into a new account saves a little time since you don't have to pre-create all the accounts before starting the import. You can also import multiple files into an account at once, so you don't need to repeat the same steps for every file in every account. + +![](https://opensource.com/sites/default/files/uploads/homebank-3.png) + +The one pain point I've had with importing and managing accounts is category assignment. Categories are what allow you to break down your spending and see what you are spending money on, in general terms. HomeBank, unlike commercial services (and some commercial programs), requires you to manually set up all the assignments. But this is generally a one-time thing, and then the categories can be auto-applied as transactions are added/imported. There is also a button to analyze the account and auto-apply things that already exist, which speeds up categorizing a large import (like I did the first time). HomeBank comes with a large number of categories you can start with, and you can add your own as well. + +HomeBank also has budgeting features, allowing you to plan for the months ahead. + +![](https://opensource.com/sites/default/files/uploads/homebank-4.png) + +The big win, for me, is HomeBank's reports feature. Not only is there a chart on the main screen showing where you are spending your money, but there are a whole host of other reports you can look at. If you use the budget feature, there is a report that tracks your spending against your budget. You can also view those reports as pie and bar charts. There is also a trend report and a balance report, so you can look back and see changes or patterns over time. + +Overall, HomeBank is a very friendly, useful application to help you keep your finances in order. It is simple to use and really helpful if keeping track of your money is a major stress point in your life. + + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/1/productivity-tools-homebank + +作者:[Kevin Sonney][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/ksonney (Kevin Sonney) +[b]: https://github.com/lujun9972 +[1]: http://homebank.free.fr/en/index.php +[2]: https://www.gnucash.org/ +[3]: https://en.wikipedia.org/wiki/Double-entry_bookkeeping_system From a79461b1d9018c8dffabf264c819c3ad0b21b890 Mon Sep 17 00:00:00 2001 From: darksun Date: Fri, 25 Jan 2019 17:09:48 +0800 Subject: [PATCH 119/243] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190116=20Zippin?= =?UTF-8?q?g=20files=20on=20Linux:=20the=20many=20variations=20and=20how?= =?UTF-8?q?=20to=20use=20them=20sources/tech/20190116=20Zipping=20files=20?= =?UTF-8?q?on=20Linux-=20the=20many=20variations=20and=20how=20to=20use=20?= =?UTF-8?q?them.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...the many variations and how to use them.md | 324 ++++++++++++++++++ 1 file changed, 324 insertions(+) create mode 100644 sources/tech/20190116 Zipping files on Linux- the many variations and how to use them.md diff --git a/sources/tech/20190116 Zipping files on Linux- the many variations and how to use them.md b/sources/tech/20190116 Zipping files on Linux- the many variations and how to use them.md new file mode 100644 index 0000000000..fb98f78b06 --- /dev/null +++ b/sources/tech/20190116 Zipping files on Linux- the many variations and how to use them.md @@ -0,0 +1,324 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Zipping files on Linux: the many variations and how to use them) +[#]: via: (https://www.networkworld.com/article/3333640/linux/zipping-files-on-linux-the-many-variations-and-how-to-use-them.html) +[#]: author: (Sandra Henry-Stocker https://www.networkworld.com/author/Sandra-Henry_Stocker/) + +Zipping files on Linux: the many variations and how to use them +====== +![](https://images.idgesg.net/images/article/2019/01/zipper-100785364-large.jpg) + +Some of us have been zipping files on Unix and Linux systems for many decades — to save some disk space and package files together for archiving. Even so, there are some interesting variations on zipping that not all of us have tried. So, in this post, we’re going to look at standard zipping and unzipping as well as some other interesting zipping options. + +### The basic zip command + +First, let’s look at the basic **zip** command. It uses what is essentially the same compression algorithm as **gzip** , but there are a couple important differences. For one thing, the gzip command is used only for compressing a single file where zip can both compress files and join them together into an archive. For another, the gzip command zips “in place”. In other words, it leaves a compressed file — not the original file alongside the compressed copy. Here's an example of gzip at work: + +``` +$ gzip onefile +$ ls -l +-rw-rw-r-- 1 shs shs 10514 Jan 15 13:13 onefile.gz +``` + +And here's zip. Notice how this command requires that a name be provided for the zipped archive where gzip simply uses the original file name and adds the .gz extension. + +``` +$ zip twofiles.zip file* + adding: file1 (deflated 82%) + adding: file2 (deflated 82%) +$ ls -l +-rw-rw-r-- 1 shs shs 58021 Jan 15 13:25 file1 +-rw-rw-r-- 1 shs shs 58933 Jan 15 13:34 file2 +-rw-rw-r-- 1 shs shs 21289 Jan 15 13:35 twofiles.zip +``` + +Notice also that the original files are still sitting there. + +The amount of disk space that is saved (i.e., the degree of compression obtained) will depend on the content of each file. The variation in the example below is considerable. + +``` +$ zip mybin.zip ~/bin/* + adding: bin/1 (deflated 26%) + adding: bin/append (deflated 64%) + adding: bin/BoD_meeting (deflated 18%) + adding: bin/cpuhog1 (deflated 14%) + adding: bin/cpuhog2 (stored 0%) + adding: bin/ff (deflated 32%) + adding: bin/file.0 (deflated 1%) + adding: bin/loop (deflated 14%) + adding: bin/notes (deflated 23%) + adding: bin/patterns (stored 0%) + adding: bin/runme (stored 0%) + adding: bin/tryme (deflated 13%) + adding: bin/tt (deflated 6%) +``` + +### The unzip command + +The **unzip** command will recover the contents from a zip file and, as you'd likely suspect, leave the zip file intact, whereas a similar gunzip command would leave only the uncompressed file. + +``` +$ unzip twofiles.zip +Archive: twofiles.zip + inflating: file1 + inflating: file2 +$ ls -l +-rw-rw-r-- 1 shs shs 58021 Jan 15 13:25 file1 +-rw-rw-r-- 1 shs shs 58933 Jan 15 13:34 file2 +-rw-rw-r-- 1 shs shs 21289 Jan 15 13:35 twofiles.zip +``` + +### The zipcloak command + +The **zipcloak** command encrypts a zip file, prompting you to enter a password twice (to help ensure you don't "fat finger" it) and leaves the file in place. You can expect the file size to vary a little from the original. + +``` +$ zipcloak twofiles.zip +Enter password: +Verify password: +encrypting: file1 +encrypting: file2 +$ ls -l +total 204 +-rw-rw-r-- 1 shs shs 58021 Jan 15 13:25 file1 +-rw-rw-r-- 1 shs shs 58933 Jan 15 13:34 file2 +-rw-rw-r-- 1 shs shs 21313 Jan 15 13:46 twofiles.zip <== slightly larger than + unencrypted version +``` + +Keep in mind that the original files are still sitting there unencrypted. + +### The zipdetails command + +The **zipdetails** command is going to show you details — a _lot_ of details about a zipped file, likely a lot more than you care to absorb. Even though we're looking at an encrypted file, zipdetails does display the file names along with file modification dates, user and group information, file length data, etc. Keep in mind that this is all "metadata." We don't see the contents of the files. + +``` +$ zipdetails twofiles.zip + +0000 LOCAL HEADER #1 04034B50 +0004 Extract Zip Spec 14 '2.0' +0005 Extract OS 00 'MS-DOS' +0006 General Purpose Flag 0001 + [Bit 0] 1 'Encryption' + [Bits 1-2] 1 'Maximum Compression' +0008 Compression Method 0008 'Deflated' +000A Last Mod Time 4E2F6B24 'Tue Jan 15 13:25:08 2019' +000E CRC F1B115BD +0012 Compressed Length 00002904 +0016 Uncompressed Length 0000E2A5 +001A Filename Length 0005 +001C Extra Length 001C +001E Filename 'file1' +0023 Extra ID #0001 5455 'UT: Extended Timestamp' +0025 Length 0009 +0027 Flags '03 mod access' +0028 Mod Time 5C3E2584 'Tue Jan 15 13:25:08 2019' +002C Access Time 5C3E27BB 'Tue Jan 15 13:34:35 2019' +0030 Extra ID #0002 7875 'ux: Unix Extra Type 3' +0032 Length 000B +0034 Version 01 +0035 UID Size 04 +0036 UID 000003E8 +003A GID Size 04 +003B GID 000003E8 +003F PAYLOAD + +2943 LOCAL HEADER #2 04034B50 +2947 Extract Zip Spec 14 '2.0' +2948 Extract OS 00 'MS-DOS' +2949 General Purpose Flag 0001 + [Bit 0] 1 'Encryption' + [Bits 1-2] 1 'Maximum Compression' +294B Compression Method 0008 'Deflated' +294D Last Mod Time 4E2F6C56 'Tue Jan 15 13:34:44 2019' +2951 CRC EC214569 +2955 Compressed Length 00002913 +2959 Uncompressed Length 0000E635 +295D Filename Length 0005 +295F Extra Length 001C +2961 Filename 'file2' +2966 Extra ID #0001 5455 'UT: Extended Timestamp' +2968 Length 0009 +296A Flags '03 mod access' +296B Mod Time 5C3E27C4 'Tue Jan 15 13:34:44 2019' +296F Access Time 5C3E27BD 'Tue Jan 15 13:34:37 2019' +2973 Extra ID #0002 7875 'ux: Unix Extra Type 3' +2975 Length 000B +2977 Version 01 +2978 UID Size 04 +2979 UID 000003E8 +297D GID Size 04 +297E GID 000003E8 +2982 PAYLOAD + +5295 CENTRAL HEADER #1 02014B50 +5299 Created Zip Spec 1E '3.0' +529A Created OS 03 'Unix' +529B Extract Zip Spec 14 '2.0' +529C Extract OS 00 'MS-DOS' +529D General Purpose Flag 0001 + [Bit 0] 1 'Encryption' + [Bits 1-2] 1 'Maximum Compression' +529F Compression Method 0008 'Deflated' +52A1 Last Mod Time 4E2F6B24 'Tue Jan 15 13:25:08 2019' +52A5 CRC F1B115BD +52A9 Compressed Length 00002904 +52AD Uncompressed Length 0000E2A5 +52B1 Filename Length 0005 +52B3 Extra Length 0018 +52B5 Comment Length 0000 +52B7 Disk Start 0000 +52B9 Int File Attributes 0001 + [Bit 0] 1 Text Data +52BB Ext File Attributes 81B40000 +52BF Local Header Offset 00000000 +52C3 Filename 'file1' +52C8 Extra ID #0001 5455 'UT: Extended Timestamp' +52CA Length 0005 +52CC Flags '03 mod access' +52CD Mod Time 5C3E2584 'Tue Jan 15 13:25:08 2019' +52D1 Extra ID #0002 7875 'ux: Unix Extra Type 3' +52D3 Length 000B +52D5 Version 01 +52D6 UID Size 04 +52D7 UID 000003E8 +52DB GID Size 04 +52DC GID 000003E8 + +52E0 CENTRAL HEADER #2 02014B50 +52E4 Created Zip Spec 1E '3.0' +52E5 Created OS 03 'Unix' +52E6 Extract Zip Spec 14 '2.0' +52E7 Extract OS 00 'MS-DOS' +52E8 General Purpose Flag 0001 + [Bit 0] 1 'Encryption' + [Bits 1-2] 1 'Maximum Compression' +52EA Compression Method 0008 'Deflated' +52EC Last Mod Time 4E2F6C56 'Tue Jan 15 13:34:44 2019' +52F0 CRC EC214569 +52F4 Compressed Length 00002913 +52F8 Uncompressed Length 0000E635 +52FC Filename Length 0005 +52FE Extra Length 0018 +5300 Comment Length 0000 +5302 Disk Start 0000 +5304 Int File Attributes 0001 + [Bit 0] 1 Text Data +5306 Ext File Attributes 81B40000 +530A Local Header Offset 00002943 +530E Filename 'file2' +5313 Extra ID #0001 5455 'UT: Extended Timestamp' +5315 Length 0005 +5317 Flags '03 mod access' +5318 Mod Time 5C3E27C4 'Tue Jan 15 13:34:44 2019' +531C Extra ID #0002 7875 'ux: Unix Extra Type 3' +531E Length 000B +5320 Version 01 +5321 UID Size 04 +5322 UID 000003E8 +5326 GID Size 04 +5327 GID 000003E8 + +532B END CENTRAL HEADER 06054B50 +532F Number of this disk 0000 +5331 Central Dir Disk no 0000 +5333 Entries in this disk 0002 +5335 Total Entries 0002 +5337 Size of Central Dir 00000096 +533B Offset to Central Dir 00005295 +533F Comment Length 0000 +Done +``` + +### The zipgrep command + +The **zipgrep** command is going to use a grep-type feature to locate particular content in your zipped files. If the file is encrypted, you will need to enter the password provided for the encryption for each file you want to examine. If you only want to check the contents of a single file from the archive, add its name to the end of the zipgrep command as shown below. + +``` +$ zipgrep hazard twofiles.zip file1 +[twofiles.zip] file1 password: +Certain pesticides should be banned since they are hazardous to the environment. +``` + +### The zipinfo command + +The **zipinfo** command provides information on the contents of a zipped file whether encrypted or not. This includes the file names, sizes, dates and permissions. + +``` +$ zipinfo twofiles.zip +Archive: twofiles.zip +Zip file size: 21313 bytes, number of entries: 2 +-rw-rw-r-- 3.0 unx 58021 Tx defN 19-Jan-15 13:25 file1 +-rw-rw-r-- 3.0 unx 58933 Tx defN 19-Jan-15 13:34 file2 +2 files, 116954 bytes uncompressed, 20991 bytes compressed: 82.1% +``` + +### The zipnote command + +The **zipnote** command can be used to extract comments from zip archives or add them. To display comments, just preface the name of the archive with the command. If no comments have been added previously, you will see something like this: + +``` +$ zipnote twofiles.zip +@ file1 +@ (comment above this line) +@ file2 +@ (comment above this line) +@ (zip file comment below this line) +``` + +If you want to add comments, write the output from the zipnote command to a file: + +``` +$ zipnote twofiles.zip > comments +``` + +Next, edit the file you've just created, inserting your comments above the **(comment above this line)** lines. Then add the comments using a zipnote command like this one: + +``` +$ zipnote -w twofiles.zip < comments +``` + +### The zipsplit command + +The **zipsplit** command can be used to break a zip archive into multiple zip archives when the original file is too large — maybe because you're trying to add one of the files to a small thumb drive. The easiest way to do this seems to be to specify the max size for each of the zipped file portions. This size must be large enough to accomodate the largest included file. + +``` +$ zipsplit -n 12000 twofiles.zip +2 zip files will be made (100% efficiency) +creating: twofile1.zip +creating: twofile2.zip +$ ls twofile*.zip +-rw-rw-r-- 1 shs shs 10697 Jan 15 14:52 twofile1.zip +-rw-rw-r-- 1 shs shs 10702 Jan 15 14:52 twofile2.zip +-rw-rw-r-- 1 shs shs 21377 Jan 15 14:27 twofiles.zip +``` + +Notice how the extracted files are sequentially named "twofile1" and "twofile2". + +### Wrap-up + +The **zip** command, along with some of its zipping compatriots, provide a lot of control over how you generate and work with compressed file archives. + +**[ Also see:[Invaluable tips and tricks for troubleshooting Linux][1] ]** + +Join the Network World communities on [Facebook][2] and [LinkedIn][3] to comment on topics that are top of mind. + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3333640/linux/zipping-files-on-linux-the-many-variations-and-how-to-use-them.html + +作者:[Sandra Henry-Stocker][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.networkworld.com/author/Sandra-Henry_Stocker/ +[b]: https://github.com/lujun9972 +[1]: https://www.networkworld.com/article/3242170/linux/invaluable-tips-and-tricks-for-troubleshooting-linux.html +[2]: https://www.facebook.com/NetworkWorld/ +[3]: https://www.linkedin.com/company/network-world From 816f62f97b9c570b32eac844725a90c27f48e24f Mon Sep 17 00:00:00 2001 From: darksun Date: Fri, 25 Jan 2019 17:11:43 +0800 Subject: [PATCH 120/243] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190121=20Bootin?= =?UTF-8?q?g=20Linux=20faster=20sources/talk/20190121=20Booting=20Linux=20?= =?UTF-8?q?faster.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sources/talk/20190121 Booting Linux faster.md | 54 +++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 sources/talk/20190121 Booting Linux faster.md diff --git a/sources/talk/20190121 Booting Linux faster.md b/sources/talk/20190121 Booting Linux faster.md new file mode 100644 index 0000000000..ef79351e0e --- /dev/null +++ b/sources/talk/20190121 Booting Linux faster.md @@ -0,0 +1,54 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Booting Linux faster) +[#]: via: (https://opensource.com/article/19/1/booting-linux-faster) +[#]: author: (Stewart Smith https://opensource.com/users/stewart-ibm) + +Booting Linux faster +====== +Doing Linux kernel and firmware development leads to lots of reboots and lots of wasted time. +![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/tux_linux_penguin_code_binary.jpg?itok=TxGxW0KY) +Of all the computers I've ever owned or used, the one that booted the quickest was from the 1980s; by the time your hand moved from the power switch to the keyboard, the BASIC interpreter was ready for your commands. Modern computers take anywhere from 15 seconds for a laptop to minutes for a small home server to boot. Why is there such a difference in boot times? + +A microcomputer from the 1980s that booted straight to a BASIC prompt had a very simple CPU that started fetching and executing instructions from a memory address immediately upon getting power. Since these systems had BASIC in ROM, there was no loading time—you got to the BASIC prompt really quickly. More complex systems of that same era, such as the IBM PC or Macintosh, took a significant time to boot (~30 seconds), although this was mostly due to having to read the operating system (OS) off a floppy disk. Only a handful of seconds were spent in firmware before being able to load an OS. + +Modern servers typically spend minutes, rather than seconds, in firmware before getting to the point of booting an OS from disk. This is largely due to modern systems' increased complexity. No longer can a CPU just come up and start executing instructions at full speed; we've become accustomed to CPU frequency scaling, idle states that save a lot of power, and multiple CPU cores. In fact, inside modern CPUs are a surprising number of simpler CPUs that help start the main CPU cores and provide runtime services such as throttling the frequency when it gets too hot. On most CPU architectures, the code running on these cores inside your CPU is provided as opaque binary blobs. + +On OpenPOWER systems, every instruction executed on every core inside the CPU is open source software. On machines with [OpenBMC][1] (such as IBM's AC922 system and Raptor's TALOS II and Blackbird systems), this extends to the code running on the Baseboard Management Controller as well. This means we can get a tremendous amount of insight into what takes so long from the time you plug in a power cable to the time a familiar login prompt is displayed. + +If you're part of a team that works on the Linux kernel, you probably boot a lot of kernels. If you're part of a team that works on firmware, you're probably going to boot a lot of different firmware images, followed by an OS to ensure your firmware still works. If we can reduce the hardware's boot time, these teams can become more productive, and end users may be grateful when they're setting up systems or rebooting to install firmware or OS updates. + +Over the years, many improvements have been made to Linux distributions' boot time. Modern init systems deal well with doing things concurrently and on-demand. On a modern system, once the kernel starts executing, it can take very few seconds to get to a login prompt. This handful of seconds are not the place to optimize boot time; we have to go earlier: before we get to the OS. + +On OpenPOWER systems, the firmware loads an OS by booting a Linux kernel stored in the firmware flash chip that runs a userspace program called [Petitboot][2] to find the disk that holds the OS the user wants to boot and [kexec][3][()][3] to it. This code reuse leverages the efforts that have gone into making Linux boot quicker. Even so, we found places in our kernel config and userspace where we could improve and easily shave seconds off boot time. With these optimizations, booting the Petitboot environment is a single-digit percentage of boot time, so we had to find more improvements elsewhere. + +Before the Petitboot environment starts, there's a prior bit of firmware called [Skiboot][4], and before that there's [Hostboot][5]. Prior to Hostboot is the [Self-Boot Engine][6], a separate core on the die that gets a single CPU core up and executing instructions out of Level 3 cache. These components are where we can make the most headway in reducing boot time, as they take up the overwhelming majority of it. Perhaps some of these components aren't optimized enough or doing as much in parallel as they could be? + +Another avenue of attack is reboot time rather than boot time. On a reboot, do we really need to reinitialize all the hardware? + +Like any modern system, the solutions to improving boot (and reboot) time have been a mixture of doing more in parallel, dealing with legacy, and (arguably) cheating. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/1/booting-linux-faster + +作者:[Stewart Smith][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/stewart-ibm +[b]: https://github.com/lujun9972 +[1]: https://en.wikipedia.org/wiki/OpenBMC +[2]: https://github.com/open-power/petitboot +[3]: https://en.wikipedia.org/wiki/Kexec +[4]: https://github.com/open-power/skiboot +[5]: https://github.com/open-power/hostboot +[6]: https://github.com/open-power/sbe +[7]: https://linux.conf.au/schedule/presentation/105/ +[8]: https://linux.conf.au/ From 978bee95ccbfb70be77b52394c2218bac01a853f Mon Sep 17 00:00:00 2001 From: darksun Date: Fri, 25 Jan 2019 17:14:51 +0800 Subject: [PATCH 121/243] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190118=20Top=20?= =?UTF-8?q?5=20Linux=20Server=20Distributions=20sources/tech/20190118=20To?= =?UTF-8?q?p=205=20Linux=20Server=20Distributions.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...190118 Top 5 Linux Server Distributions.md | 268 ++++++++++++++++++ 1 file changed, 268 insertions(+) create mode 100644 sources/tech/20190118 Top 5 Linux Server Distributions.md diff --git a/sources/tech/20190118 Top 5 Linux Server Distributions.md b/sources/tech/20190118 Top 5 Linux Server Distributions.md new file mode 100644 index 0000000000..0cb6e83247 --- /dev/null +++ b/sources/tech/20190118 Top 5 Linux Server Distributions.md @@ -0,0 +1,268 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Top 5 Linux Server Distributions) +[#]: via: (https://www.linux.com/blog/learn/2019/1/top-5-linux-server-distributions) +[#]: author: (Jack Wallen https://www.linux.com/users/jlwallen) + +Top 5 Linux Server Distributions +====== +![](https://www.linux.com/sites/lcom/files/styles/rendered_file/public/rockstor-main.jpg?itok=VNvfEIlf) + +Ah, the age-old question: Which Linux distribution is best suited for servers? Typically, when this question is asked, the standard responses pop up: + + * RHEL + + * SUSE + + * Ubuntu Server + + * Debian + + * CentOS + + + + +However, in the name of opening your eyes to maybe something a bit different, I’m going to approach this a bit differently. I want to consider a list of possible distributions that are not only outstanding candidates but also easy to use, and that can serve many functions within your business. In some cases, my choices are drop-in replacements for other operating systems, whereas others require a bit of work to get them up to speed. + +Some of my choices are community editions of enterprise-grade servers, which could be considered gateways to purchasing a much more powerful platform. You’ll even find one or two entries here to be duty-specific platforms. Most importantly, however, what you’ll find on this list isn’t the usual fare. + +### ClearOS + +What is ClearOS? For home and small business usage, you might not find a better solution. Out of the box, ClearOS includes tools like intrusion detection, a strong firewall, bandwidth management tools, a mail server, a domain controller, and much more. What makes ClearOS stand out above some of the competition is its purpose is to server as a simple Home and SOHO server with a user-friendly, graphical web-based interface. From that interface, you’ll find an application marketplace (Figure 1), with hundreds of apps (some of which are free, whereas some have an associated cost), that makes it incredibly easy to extend the ClearOS featureset. In other words, you make ClearOS the platform your home and small business needs it to be. Best of all, unlike many other alternatives, you only pay for the software and support you need. +![](https://www.linux.com/sites/lcom/files/styles/rendered_file/public/clearos.jpg?itok=knQkn5ch) +There are three different editions of ClearOS: + + * [ClearOS Community][1] - the free edition of ClearOS + + * [ClearOS Home][2] - ideal for home offices + + * [ClearOS Business][3] - ideal for small businesses, due to the inclusion of paid support + + + + +To make the installation of software even easier, the ClearOS marketplace allows you to select via: + + * By Function (which displays apps according to task) + + * By Category (which displays groups of related apps) + + * Quick Select File (which allows you to select pre-configured templates to get you up and running fast) + + + + +In other words, if you’re looking for a Linux Home, SOHO, or SMB server, ClearOS is an outstanding choice (especially if you don’t have the Linux chops to get a standard server up and running). + +### Fedora Server + +You’ve heard of Fedora Linux. Of course you have. It’s one of the finest bleeding edge distributions on the market. But did you know the developers of that excellent Fedora Desktop distribution also has a Server edition? The Fedora Server platform is a short-lifecycle, community-supported server OS. This take on the server operating system enables seasoned system administrators, experienced with any flavor of Linux (or any OS at all), to make use of the very latest technologies available in the open source community. There are three key words in that description: + + * Seasoned + + * System + + * Administrators + + + + +In other words, new users need not apply. Although Fedora Server is quite capable of handling any task you throw at it, it’s going to require someone with a bit more Linux kung fu to make it work and work well. One very nice inclusion with Fedora Server is that, out of the box, it includes one of the finest open source, web-based interface for servers on the market. With Cockpit (Figure 2) you get a quick glance at system resources, logs, storage, network, as well as the ability to manage accounts, services, applications, and updates. + +![Fedora Server][5] + +Figure 2: Cockpit running on Fedora Server. + +[Used with permission][6] + +If you’re okay working with bleeding edge software, and want an outstanding admin dashboard, Fedora Server might be the platform for you. + +### NethServer + +NethServer is about as no-brainer of a drop-in SMB Linux server as you’ll find. With the latest iteration of NethServer, your small business will enjoy: + + * Built-in Samba Active Directory Controller + + * Seamless Nextcloud integration + + * Certificate management + + * Transparent HTTPS proxy + + * Firewall + + * Mail server and filter + + * Web server and filter + + * Groupware + + * IPS/IDS or VPN + + + + +All of the included features can be easily configured with a user-friendly, web-based interface that includes single-click installation of modules to expand the NethServer feature set (Figure 3) What sets NethServer apart from ClearOS is that it was designed to make the admin job easier. In other words, this platform offers much more in the way of flexibility and power. Unlike ClearOS, which is geared more toward home office and SOHO deployments, NethServer is equally at home in small business environments. + +![NethServer][8] + +Figure 3: Adding modules to NethServer. + +[Used with permission][6] + +### Rockstor + +Rockstor is a Linux and Btfrs powered advanced Network Attached Storage (NAS) and Cloud storage server that can be deployed for Home, SOHO, as well as small- and mid-sized businesses alike. With Rockstor, you get a full-blown NAS/Cloud solution with a user-friendly, web-based GUI tool that is just as easy for admins to set up as it is for users to use. Once you have Rockstor deployed, you can create pools, shares, snapshots, manage replication and users, share files (with the help of Samba, NFS, SFTP, and AFP), and even extend the featureset, thanks to add-ons (called Rock-ons). The list of Rock-ons includes: + + * CouchPotato (Downloader for usenet and bittorrent users) + + * Deluge (Movie downloader for bittorrent users) + + * EmbyServer (Emby media server) + + * Ghost (Publishing platform for professional bloggers) + + * GitLab CE (Git repository hosting and collaboration) + + * Gogs Go Git Service (Lightweight Git version control server and front end) + + * Headphones (An automated music downloader for NZB and Torrent) + + * Logitech Squeezebox Server for Squeezebox Devices + + * MariaDB (Relational database management system) + + * NZBGet (Efficient usenet downloader) + + * OwnCloud-Official (Secure file sharing and hosting) + + * Plexpy (Python-based Plex Usage tracker) + + * Rocket.Chat (Open Source Chat Platform) + + * SaBnzbd (Usenet downloader) + + * Sickbeard (Internet PVR for TV shows) + + * Sickrage (Automatic Video Library Manager for TV Shows) + + * Sonarr (PVR for usenet and bittorrent users) + + * Symform (Backup service) + + + + +Rockstor also includes an at-a-glance dashboard that gives admins quick access to all the information they need about their server (Figure 4). + +![Rockstor][10] + +The Rockstor dashboard in action. + +[Used with permission][6] + +### Zentyal + +Zentyal is another Small Business Server that does a great job of handling multiple tasks. If you’re looking for a Linux distribution that can handle the likes of: + + * Directory and Domain server + + * Mail server + + * Gateway + + * DHCP, DNS, and NTP server + + * Certification Authority + + * VPN + + * Instant Messaging + + * FTP server + + * Antivirus + + * SSO authentication + + * File sharing + + * RADIUS + + * Virtualization Management + + * And more + + + + +Zentyal might be your new go-to. Zentyal has been around since 2004 and is based on Ubuntu Server, so it enjoys a rock-solid base and plenty of applications. And with the help of the Zentyal dashboard (Figure 5), admins can easily manage: + + * System + + * Network + + * Logs + + * Software updates and installation + + * Users/groups + + * Domains + + * File sharing + + * Mail + + * DNS + + * Firewall + + * Certificates + + * And much more + +![](https://www.linux.com/sites/lcom/files/styles/rendered_file/public/zentyal.jpg?itok=Un9lpgh6) + + +Adding new components to the Zentyal server is as simple as opening the Dashboard, clicking on Software Management > Zentyal Components, selecting what you want to add, and clicking Install. The one issue you might find with Zentyal is that it doesn’t offer nearly the amount of addons as you’ll find in the likes of Nethserver and ClearOS. But the services it does offer, Zentyal does incredibly well. + +### Plenty More Where These Came From + +This list of Linux servers is clearly not exhaustive. What it is, however, is a unique look at the top five server distributions you’ve probably not heard of. Of course, if you’d rather opt to use a more traditional Linux server distribution, you can always stick with [CentOS][11], [Ubuntu Server][12], [SUSE][13], [Red Hat Enterprise Linux][14], or [Debian][15]… most of which are found on every list of best server distributions on the market. If, however, you’re looking for something a bit different, give one of these five distos a try. + +Learn more about Linux through the free ["Introduction to Linux" ][16]course from The Linux Foundation and edX. + +-------------------------------------------------------------------------------- + +via: https://www.linux.com/blog/learn/2019/1/top-5-linux-server-distributions + +作者:[Jack Wallen][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.linux.com/users/jlwallen +[b]: https://github.com/lujun9972 +[1]: https://www.clearos.com/clearfoundation/software/clearos-7-community +[2]: https://www.clearos.com/products/clearos-editions/clearos-7-home +[3]: https://www.clearos.com/products/clearos-editions/clearos-7-business +[4]: https://www.linux.com/files/images/fedoraserverjpg +[5]: https://www.linux.com/sites/lcom/files/styles/rendered_file/public/fedoraserver.jpg?itok=phaAIRXW (Fedora Server) +[6]: https://www.linux.com/licenses/category/used-permission +[7]: https://www.linux.com/files/images/nethserverjpg +[8]: https://www.linux.com/sites/lcom/files/styles/rendered_file/public/nethserver.jpg?itok=HO-CRbOV (NethServer) +[9]: https://www.linux.com/files/images/rockstorejpg +[10]: https://www.linux.com/sites/lcom/files/styles/rendered_file/public/rockstore.jpg?itok=EN_5oFxQ (Rockstor) +[11]: https://www.centos.org/ +[12]: https://www.ubuntu.com/download/server +[13]: https://www.suse.com/ +[14]: https://www.redhat.com/en/technologies/linux-platforms/enterprise-linux +[15]: https://www.debian.org/ +[16]: https://training.linuxfoundation.org/linux-courses/system-administration-training/introduction-to-linux From 5b4a15efa702f4ee44397533c5b4ae956a720cde Mon Sep 17 00:00:00 2001 From: darksun Date: Fri, 25 Jan 2019 17:18:03 +0800 Subject: [PATCH 122/243] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190118=20Get=20?= =?UTF-8?q?started=20with=20WTF,=20a=20dashboard=20for=20the=20terminal=20?= =?UTF-8?q?sources/tech/20190118=20Get=20started=20with=20WTF,=20a=20dashb?= =?UTF-8?q?oard=20for=20the=20terminal.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ... with WTF, a dashboard for the terminal.md | 90 +++++++++++++++++++ 1 file changed, 90 insertions(+) create mode 100644 sources/tech/20190118 Get started with WTF, a dashboard for the terminal.md diff --git a/sources/tech/20190118 Get started with WTF, a dashboard for the terminal.md b/sources/tech/20190118 Get started with WTF, a dashboard for the terminal.md new file mode 100644 index 0000000000..822cd8b7e8 --- /dev/null +++ b/sources/tech/20190118 Get started with WTF, a dashboard for the terminal.md @@ -0,0 +1,90 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Get started with WTF, a dashboard for the terminal) +[#]: via: (https://opensource.com/article/19/1/wtf-information-dashboard) +[#]: author: (Kevein Sonney https://opensource.com/users/ksonney) + +Get started with WTF, a dashboard for the terminal +====== +Keep key information in view with WTF, the sixth in our series on open source tools that will make you more productive in 2019. +![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/data_metrics_analytics_desktop_laptop.png?itok=9QXd7AUr) + +There seems to be a mad rush at the beginning of every year to find ways to be more productive. New Year's resolutions, the itch to start the year off right, and of course, an "out with the old, in with the new" attitude all contribute to this. And the usual round of recommendations is heavily biased towards closed source and proprietary software. It doesn't have to be that way. + +Here's the sixth of my picks for 19 new (or new-to-you) open source tools to help you be more productive in 2019. + +### WTF + +Once upon a time, I was doing some consulting at a firm that used [Bloomberg Terminals][1] . My reaction was, "Wow, that's WAY too much information on one screen." These days, however, it seems like I can't get enough information on a screen when I'm working and have multiple web pages, dashboards, and console apps open to try to keep track of things. + +While [tmux][2] and [Screen][3] can do split screens and multiple windows, they are a pain to set up, and the keybindings can take a while to learn (and often conflict with other applications). + +[WTF][4] is a simple, easily configured information dashboard for the terminal. It is written in [Go][5], uses a YAML configuration file, and can pull data from several different sources. All the data sources are contained in [modules][6] and include things like weather, issue trackers, date and time, Google Sheets, and a whole lot more. Some panes are interactive, and some just update with the most recent information available. + +Setup is as easy as downloading the latest release for your operating system and running the command. Since it is written in Go, it is very portable and should run anywhere you can compile it (although the developer only builds for Linux and MacOS at this time). + +![](https://opensource.com/sites/default/files/uploads/wtf-1.png) + +When you run WTF for the first time, you'll get the default screen, identical to the image above. + +![](https://opensource.com/sites/default/files/uploads/wtf-2.png) + +You also get the default configuration file in **~/.wtf/config.yml** , and you can edit the file to suit your needs. The grid layout is configured in the top part of the file. + +``` +grid: +  columns: [45, 45] +  rows: [7, 7, 7, 4] +``` + +The numbers in the grid settings represent the character dimensions of each block. The default configuration is two columns of 40 characters, two rows 13 characters tall, and one row 4 characters tall. In the code above, I made the columns wider (45, 45), the rows smaller, and added a fourth row so I can have more widgets. + +![](https://opensource.com/sites/default/files/uploads/wtf-3.png) + +I like to see the day's weather on my dashboard. There are two weather modules to chose from: [Weather][7], which shows just the text information, and [Pretty Weather][8], which is colorful and uses text-based graphics in the display. + +``` +prettyweather: +  enabled: true +  position: +    top: 0 +    left: 1 +    height: 2 +    width: 1 +``` + +This code creates a pane two blocks tall (height: 2) and one block wide (height: 1), positioned on the second column (left: 1) on the top row (top: 0) containing the Pretty Weather module. + +Some modules, like Jira, GitHub, and Todo, are interactive, and you can scroll, update, and save information in them. You can move between the interactive panes using the Tab key. The \ key brings up a help screen for the active pane so you can see what you can do and how. The Todo module lets you add, edit, and delete to-do items, as well as check them off as you complete them. + +![](https://opensource.com/sites/default/files/uploads/wtf-4.png) + +There are also modules to execute commands and present the output, watch a text file, and monitor build and integration server output. All the documentation is very well done. + +WTF is a valuable tool for anyone who needs to see a lot of data on one screen from different sources. + + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/1/wtf-information-dashboard + +作者:[Kevein Sonney][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/ksonney +[b]: https://github.com/lujun9972 +[1]: https://en.wikipedia.org/wiki/Bloomberg_Terminal +[2]: https://github.com/tmux/tmux +[3]: https://www.gnu.org/software/screen/ +[4]: https://wtfutil.com/ +[5]: https://golang.org/ +[6]: https://wtfutil.com/posts/modules/ +[7]: https://wtfutil.com/posts/modules/weather/ +[8]: https://wtfutil.com/posts/modules/prettyweather/ From 4e429f1febf45b49252023124e2249afa298e423 Mon Sep 17 00:00:00 2001 From: darksun Date: Fri, 25 Jan 2019 17:21:29 +0800 Subject: [PATCH 123/243] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190122=20How=20?= =?UTF-8?q?To=20Copy=20A=20File/Folder=20From=20A=20Local=20System=20To=20?= =?UTF-8?q?Remote=20System=20In=20Linux=3F=20sources/tech/20190122=20How?= =?UTF-8?q?=20To=20Copy=20A=20File-Folder=20From=20A=20Local=20System=20To?= =?UTF-8?q?=20Remote=20System=20In=20Linux.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ... Local System To Remote System In Linux.md | 398 ++++++++++++++++++ 1 file changed, 398 insertions(+) create mode 100644 sources/tech/20190122 How To Copy A File-Folder From A Local System To Remote System In Linux.md diff --git a/sources/tech/20190122 How To Copy A File-Folder From A Local System To Remote System In Linux.md b/sources/tech/20190122 How To Copy A File-Folder From A Local System To Remote System In Linux.md new file mode 100644 index 0000000000..6de6cd173f --- /dev/null +++ b/sources/tech/20190122 How To Copy A File-Folder From A Local System To Remote System In Linux.md @@ -0,0 +1,398 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How To Copy A File/Folder From A Local System To Remote System In Linux?) +[#]: via: (https://www.2daygeek.com/linux-scp-rsync-pscp-command-copy-files-folders-in-multiple-servers-using-shell-script/) +[#]: author: (Prakash Subramanian https://www.2daygeek.com/author/prakash/) + +How To Copy A File/Folder From A Local System To Remote System In Linux? +====== + +Copying a file from one server to another server or local to remote is one of the routine task for Linux administrator. + +If anyone says no, i won’t accept because this is one of the regular activity wherever you go. + +It can be done in many ways and we are trying to cover all the possible options. + +You can choose the one which you would prefer. Also, check other commands as well that may help you for some other purpose. + +I have tested all these commands and script in my test environment so, you can use this for your routine work. + +By default every one go with SCP because it’s one of the native command that everyone use for file copy. But commands which is listed in this article are be smart so, give a try if you would like to try new things. + +This can be done in below four ways easily. + + * **`SCP:`** scp copies files between hosts on a network. It uses ssh for data transfer, and uses the same authentication and provides the same security as ssh. + * **`RSYNC:`** rsync is a fast and extraordinarily versatile file copying tool. It can copy locally, to/from another host over any remote shell, or to/from a remote rsync daemon. + * **`PSCP:`** pscp is a program for copying files in parallel to a number of hosts. It provides features such as passing a password to scp, saving output to files, and timing out. + * **`PRSYNC:`** prsync is a program for copying files in parallel to a number of hosts. It provides features such as passing a password to ssh, saving output to files, and timing out. + + + +### Method-1: Copy Files/Folders From A Local System To Remote System In Linux Using SCP Command? + +scp command allow us to copy files/folders from a local system to remote system. + +We are going to copy the `output.txt` file from my local system to `2g.CentOS.com` remote system under `/opt/backup` directory. + +``` +# scp output.txt root@2g.CentOS.com:/opt/backup + +output.txt 100% 2468 2.4KB/s 00:00 +``` + +We are going to copy two files `output.txt` and `passwd-up.sh` files from my local system to `2g.CentOS.com` remote system under `/opt/backup` directory. + +``` +# scp output.txt passwd-up.sh root@2g.CentOS.com:/opt/backup + +output.txt 100% 2468 2.4KB/s 00:00 +passwd-up.sh 100% 877 0.9KB/s 00:00 +``` + +We are going to copy the `shell-script` directory from my local system to `2g.CentOS.com` remote system under `/opt/backup` directory. + +This will copy the `shell-script` directory and associated files under `/opt/backup` directory. + +``` +# scp -r /home/daygeek/2g/shell-script/ [email protected]:/opt/backup/ + +output.txt 100% 2468 2.4KB/s 00:00 +ovh.sh 100% 76 0.1KB/s 00:00 +passwd-up.sh 100% 877 0.9KB/s 00:00 +passwd-up1.sh 100% 7 0.0KB/s 00:00 +server-list.txt 100% 23 0.0KB/s 00:00 +``` + +### Method-2: Copy Files/Folders From A Local System To Multiple Remote System In Linux Using Shell Script with scp Command? + +If you would like to copy the same file into multiple remote servers then create the following small shell script to achieve this. + +To do so, get the servers list and add those into `server-list.txt` file. Make sure you have to update the servers list into `server-list.txt` file. Each server should be in separate line. + +Finally mention the file location which you want to copy like below. + +``` +# file-copy.sh + +#!/bin/sh +for server in `more server-list.txt` +do + scp /home/daygeek/2g/shell-script/output.txt [email protected]$server:/opt/backup +done +``` + +Once you done, set an executable permission to password-update.sh file. + +``` +# chmod +x file-copy.sh +``` + +Finally run the script to achieve this. + +``` +# ./file-copy.sh + +output.txt 100% 2468 2.4KB/s 00:00 +output.txt 100% 2468 2.4KB/s 00:00 +``` + +Use the following script to copy the multiple files into multiple remote servers. + +``` +# file-copy.sh + +#!/bin/sh +for server in `more server-list.txt` +do + scp /home/daygeek/2g/shell-script/output.txt passwd-up.sh [email protected]$server:/opt/backup +done +``` + +The below output shows all the files twice as this copied into two servers. + +``` +# ./file-cp.sh + +output.txt 100% 2468 2.4KB/s 00:00 +passwd-up.sh 100% 877 0.9KB/s 00:00 +output.txt 100% 2468 2.4KB/s 00:00 +passwd-up.sh 100% 877 0.9KB/s 00:00 +``` + +Use the following script to copy the directory recursively into multiple remote servers. + +``` +# file-copy.sh + +#!/bin/sh +for server in `more server-list.txt` +do + scp -r /home/daygeek/2g/shell-script/ [email protected]$server:/opt/backup +done +``` + +Output for the above script. + +``` +# ./file-cp.sh + +output.txt 100% 2468 2.4KB/s 00:00 +ovh.sh 100% 76 0.1KB/s 00:00 +passwd-up.sh 100% 877 0.9KB/s 00:00 +passwd-up1.sh 100% 7 0.0KB/s 00:00 +server-list.txt 100% 23 0.0KB/s 00:00 + +output.txt 100% 2468 2.4KB/s 00:00 +ovh.sh 100% 76 0.1KB/s 00:00 +passwd-up.sh 100% 877 0.9KB/s 00:00 +passwd-up1.sh 100% 7 0.0KB/s 00:00 +server-list.txt 100% 23 0.0KB/s 00:00 +``` + +### Method-3: Copy Files/Folders From A Local System To Multiple Remote System In Linux Using PSCP Command? + +pscp command directly allow us to perform the copy to multiple remote servers. + +Use the following pscp command to copy a single file to remote server. + +``` +# pscp.pssh -H 2g.CentOS.com /home/daygeek/2g/shell-script/output.txt /opt/backup + +[1] 18:46:11 [SUCCESS] 2g.CentOS.com +``` + +Use the following pscp command to copy a multiple files to remote server. + +``` +# pscp.pssh -H 2g.CentOS.com /home/daygeek/2g/shell-script/output.txt ovh.sh /opt/backup + +[1] 18:47:48 [SUCCESS] 2g.CentOS.com +``` + +Use the following pscp command to copy a directory recursively to remote server. + +``` +# pscp.pssh -H 2g.CentOS.com -r /home/daygeek/2g/shell-script/ /opt/backup + +[1] 18:48:46 [SUCCESS] 2g.CentOS.com +``` + +Use the following pscp command to copy a single file to multiple remote servers. + +``` +# pscp.pssh -h server-list.txt /home/daygeek/2g/shell-script/output.txt /opt/backup + +[1] 18:49:48 [SUCCESS] 2g.CentOS.com +[2] 18:49:48 [SUCCESS] 2g.Debian.com +``` + +Use the following pscp command to copy a multiple files to multiple remote servers. + +``` +# pscp.pssh -h server-list.txt /home/daygeek/2g/shell-script/output.txt passwd-up.sh /opt/backup + +[1] 18:50:30 [SUCCESS] 2g.Debian.com +[2] 18:50:30 [SUCCESS] 2g.CentOS.com +``` + +Use the following pscp command to copy a directory recursively to multiple remote servers. + +``` +# pscp.pssh -h server-list.txt -r /home/daygeek/2g/shell-script/ /opt/backup + +[1] 18:51:31 [SUCCESS] 2g.Debian.com +[2] 18:51:31 [SUCCESS] 2g.CentOS.com +``` + +### Method-4: Copy Files/Folders From A Local System To Multiple Remote System In Linux Using rsync Command? + +Rsync is a fast and extraordinarily versatile file copying tool. It can copy locally, to/from another host over any remote shell, or to/from a remote rsync daemon. + +Use the following rsync command to copy a single file to remote server. + +``` +# rsync -avz /home/daygeek/2g/shell-script/output.txt [email protected]:/opt/backup + +sending incremental file list +output.txt + +sent 598 bytes received 31 bytes 1258.00 bytes/sec +total size is 2468 speedup is 3.92 +``` + +Use the following pscp command to copy a multiple files to remote server. + +``` +# rsync -avz /home/daygeek/2g/shell-script/output.txt passwd-up.sh root@2g.CentOS.com:/opt/backup + +sending incremental file list +output.txt +passwd-up.sh + +sent 737 bytes received 50 bytes 1574.00 bytes/sec +total size is 2537 speedup is 3.22 +``` + +Use the following rsync command to copy a single file to remote server overh ssh. + +``` +# rsync -avzhe ssh /home/daygeek/2g/shell-script/output.txt root@2g.CentOS.com:/opt/backup + +sending incremental file list +output.txt + +sent 598 bytes received 31 bytes 419.33 bytes/sec +total size is 2.47K speedup is 3.92 +``` + +Use the following pscp command to copy a directory recursively to remote server over ssh. This will copy only files not the base directory. + +``` +# rsync -avzhe ssh /home/daygeek/2g/shell-script/ root@2g.CentOS.com:/opt/backup + +sending incremental file list +./ +output.txt +ovh.sh +passwd-up.sh +passwd-up1.sh +server-list.txt + +sent 3.85K bytes received 281 bytes 8.26K bytes/sec +total size is 9.12K speedup is 2.21 +``` + +### Method-5: Copy Files/Folders From A Local System To Multiple Remote System In Linux Using Shell Script with rsync Command? + +If you would like to copy the same file into multiple remote servers then create the following small shell script to achieve this. + +``` +# file-copy.sh + +#!/bin/sh +for server in `more server-list.txt` +do + rsync -avzhe ssh /home/daygeek/2g/shell-script/ root@2g.CentOS.com$server:/opt/backup +done +``` + +Output for the above shell script. + +``` +# ./file-copy.sh + +sending incremental file list +./ +output.txt +ovh.sh +passwd-up.sh +passwd-up1.sh +server-list.txt + +sent 3.86K bytes received 281 bytes 8.28K bytes/sec +total size is 9.13K speedup is 2.21 + +sending incremental file list +./ +output.txt +ovh.sh +passwd-up.sh +passwd-up1.sh +server-list.txt + +sent 3.86K bytes received 281 bytes 2.76K bytes/sec +total size is 9.13K speedup is 2.21 +``` + +### Method-6: Copy Files/Folders From A Local System To Multiple Remote System In Linux Using Shell Script with scp Command? + +In the above two shell script, we need to mention the file and folder location as a prerequiesties but here i did a small modification that allow the script to get a file or folder as a input. It could be very useful when you want to perform the copy multiple times in a day. + +``` +# file-copy.sh + +#!/bin/sh +for server in `more server-list.txt` +do +scp -r $1 root@2g.CentOS.com$server:/opt/backup +done +``` + +Run the shell script and give the file name as a input. + +``` +# ./file-copy.sh output1.txt + +output1.txt 100% 3558 3.5KB/s 00:00 +output1.txt 100% 3558 3.5KB/s 00:00 +``` + +### Method-7: Copy Files/Folders From A Local System To Multiple Remote System In Linux With Non-Standard Port Number? + +Use the below shell script to copy a file or folder if you are using Non-Standard port. + +If you are using `Non-Standard` port, make sure you have to mention the port number as follow for SCP command. + +``` +# file-copy-scp.sh + +#!/bin/sh +for server in `more server-list.txt` +do +scp -P 2222 -r $1 root@2g.CentOS.com$server:/opt/backup +done +``` + +Run the shell script and give the file name as a input. + +``` +# ./file-copy.sh ovh.sh + +ovh.sh 100% 3558 3.5KB/s 00:00 +ovh.sh 100% 3558 3.5KB/s 00:00 +``` + +If you are using `Non-Standard` port, make sure you have to mention the port number as follow for rsync command. + +``` +# file-copy-rsync.sh + +#!/bin/sh +for server in `more server-list.txt` +do +rsync -avzhe 'ssh -p 2222' $1 root@2g.CentOS.com$server:/opt/backup +done +``` + +Run the shell script and give the file name as a input. + +``` +# ./file-copy-rsync.sh passwd-up.sh +sending incremental file list +passwd-up.sh + +sent 238 bytes received 35 bytes 26.00 bytes/sec +total size is 159 speedup is 0.58 + +sending incremental file list +passwd-up.sh + +sent 238 bytes received 35 bytes 26.00 bytes/sec +total size is 159 speedup is 0.58 +``` +-------------------------------------------------------------------------------- + +via: https://www.2daygeek.com/linux-scp-rsync-pscp-command-copy-files-folders-in-multiple-servers-using-shell-script/ + +作者:[Prakash Subramanian][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.2daygeek.com/author/prakash/ +[b]: https://github.com/lujun9972 From a6957992a2ea7ff32e8634583d63fce25d994b3c Mon Sep 17 00:00:00 2001 From: MjSeven Date: Fri, 25 Jan 2019 20:48:46 +0800 Subject: [PATCH 124/243] Translating 20190411 How to setup static... --- .../tech/20180411 How To Setup Static File Server Instantly.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sources/tech/20180411 How To Setup Static File Server Instantly.md b/sources/tech/20180411 How To Setup Static File Server Instantly.md index b388b389fa..b925c75f1f 100644 --- a/sources/tech/20180411 How To Setup Static File Server Instantly.md +++ b/sources/tech/20180411 How To Setup Static File Server Instantly.md @@ -1,3 +1,5 @@ +Transltaing by MjSeven + How To Setup Static File Server Instantly ====== From 91fe3aa4c78bf088fe1204c6410dd7ad613fec8c Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Fri, 25 Jan 2019 22:28:31 +0800 Subject: [PATCH 125/243] PRF:20190113 Get started with Joplin, a note-taking app.md @geekpi --- ... started with Joplin, a note-taking app.md | 26 ++++++++++++------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/translated/tech/20190113 Get started with Joplin, a note-taking app.md b/translated/tech/20190113 Get started with Joplin, a note-taking app.md index 495dd4c9d1..949d6a97cd 100644 --- a/translated/tech/20190113 Get started with Joplin, a note-taking app.md +++ b/translated/tech/20190113 Get started with Joplin, a note-taking app.md @@ -1,40 +1,46 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Get started with Joplin, a note-taking app) [#]: via: (https://opensource.com/article/19/1/productivity-tool-joplin) [#]: author: (Kevin Sonney https://opensource.com/users/ksonney (Kevin Sonney)) -开始使用一款笔记应用 Joplin +开始使用 Joplin 吧,一款开源笔记应用 ====== -了解开源工具如何帮助你在 2019 年提高工作效率。先从 Joplin 开始。 + +> 了解开源工具如何帮助你在 2019 年提高工作效率。先从 Joplin 开始。 + ![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/programming-code-keyboard-laptop.png?itok=pGfEfu2S) -每年年初似乎都有疯狂的冲动想提高工作效率。新年的决心,渴望开启新的一年,当然,“抛弃旧的,拥抱新的”的态度促成了这一切。通常这时的建议严重偏向闭源和专有软件。这不一定要这样。 +每年年初似乎都有疯狂的冲动想提高工作效率。新年的决心,渴望开启新的一年,当然,“抛弃旧的,拥抱新的”的态度促成了这一切。通常这时的建议严重偏向闭源和专有软件,但事实上并不用这样。 这是我挑选出的 19 个新的(或者对你而言新的)开源项目来帮助你在 2019 年更有效率。 ### Joplin -在生产力工具领域,笔记应用非常方便。是的,你可以使用开源 [NixNote][1] 访问 [Evernote][2 ] 笔记,但它仍然与 Evernote 服务器相关联,并且仍然依赖于第三方的安全性。虽然你可以从 NixNote 导出 Evernote 笔记,但可选格式只有 NixNote XML 或 PDF。 +在生产力工具领域,笔记应用**非常**方便。是的,你可以使用开源 [NixNote][1] 访问 [Evernote][2] 笔记,但它仍然与 Evernote 服务器相关联,并且仍然依赖于第三方的安全性。虽然你**可以**从 NixNote 导出 Evernote 笔记,但可选格式只有 NixNote XML 或 PDF。 ![](https://opensource.com/sites/default/files/uploads/joplin-1.png) -看看 [Joplin][3]。Joplin 是一个 NodeJS 应用,它在本地运行和存储笔记,它允许你加密笔记并支持多种同步方法。Joplin 可在 Windows、Mac 和 Linux 上作为控制台或图形应用运行。Joplin 还有适用于 Android 和 iOS 的移动应用,这意味着你可以随身携带笔记而不会有任何麻烦。Joplin 甚至允许你使用 Markdown、HTML 或纯文本格式笔记。 +*Joplin 的图形界面* + +看看 [Joplin][3]。Joplin 是一个 NodeJS 应用,它在本地运行和存储笔记,它允许你加密笔记并支持多种同步方法。Joplin 可在 Windows、Mac 和 Linux 上作为控制台应用或图形应用运行。Joplin 还有适用于 Android 和 iOS 的移动应用,这意味着你可以随身携带笔记而不会有任何麻烦。Joplin 甚至允许你使用 Markdown、HTML 或纯文本格式笔记。 ![](https://opensource.com/sites/default/files/uploads/joplin-3.png) +*Joplin 的 Android 应用* + 关于 Joplin 很棒的一件事是它支持两种类型笔记:普通笔记和待办事项笔记。普通笔记是你所想的包含文本的文档。另一个,待办事项笔记在笔记列表中有一个复选框,允许你将其标记为“已完成”。由于待办事项仍然是一个笔记,因此你可以在待办事项中添加列表、文档和其他待办事项。 -当使用 GUI 时,你可以在纯文本、WYSIWYG 和同时显示源文本和渲染视图的分屏之间切换编辑器视图。你还可以在 GUI 中指定外部编辑器,以便使用 Vim、Emacs 或任何其他能够处理文本文档的编辑器轻松更新笔记。 +当使用图形界面时,你可以在纯文本、WYSIWYG 和同时显示源文本和渲染视图的分屏之间切换编辑器视图。你还可以在图形界面中指定外部编辑器,以便使用 Vim、Emacs 或任何其他能够处理文本文档的编辑器轻松更新笔记。 ![Joplin console version][5] -控制台中的 Joplin +*控制台中的 Joplin* -控制台界面非常棒。虽然它缺少 WYSIWYG 编辑器,但默认登录使用文本编辑器。它还有强大的命令模式,它允许执行在 GUI 版本中几乎所有的操作。并且能够在视图中正确渲染 Markdown。 +控制台界面非常棒。虽然它缺少 WYSIWYG 编辑器,但默认登录使用文本编辑器。它还有强大的命令模式,它允许执行在图形版本中几乎所有的操作。并且能够在视图中正确渲染 Markdown。 你可以将笔记本中的笔记分组,还能为笔记打上标记,以便于在笔记本中进行分组。它甚至还有内置的搜索功能,因此如果你忘了笔记在哪,你可以通过它找到它们。 @@ -47,7 +53,7 @@ via: https://opensource.com/article/19/1/productivity-tool-joplin 作者:[Kevin Sonney][a] 选题:[lujun9972][b] 译者:[geekpi](https://github.com/geekpi) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 2c263d5aafff7546b288f4cd8db3df783891a626 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Fri, 25 Jan 2019 22:29:19 +0800 Subject: [PATCH 126/243] PUB:20190113 Get started with Joplin, a note-taking app.md @geekpi https://linux.cn/article-10476-1.html --- .../20190113 Get started with Joplin, a note-taking app.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20190113 Get started with Joplin, a note-taking app.md (98%) diff --git a/translated/tech/20190113 Get started with Joplin, a note-taking app.md b/published/20190113 Get started with Joplin, a note-taking app.md similarity index 98% rename from translated/tech/20190113 Get started with Joplin, a note-taking app.md rename to published/20190113 Get started with Joplin, a note-taking app.md index 949d6a97cd..e287e143f8 100644 --- a/translated/tech/20190113 Get started with Joplin, a note-taking app.md +++ b/published/20190113 Get started with Joplin, a note-taking app.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-10476-1.html) [#]: subject: (Get started with Joplin, a note-taking app) [#]: via: (https://opensource.com/article/19/1/productivity-tool-joplin) [#]: author: (Kevin Sonney https://opensource.com/users/ksonney (Kevin Sonney)) From 1246212c9f8812cf3e700301746d2fdc684dc80d Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Fri, 25 Jan 2019 23:02:45 +0800 Subject: [PATCH 127/243] PRF:20190109 Bash 5.0 Released with New Features.md @geekpi --- ...109 Bash 5.0 Released with New Features.md | 34 +++++++++---------- 1 file changed, 16 insertions(+), 18 deletions(-) diff --git a/translated/tech/20190109 Bash 5.0 Released with New Features.md b/translated/tech/20190109 Bash 5.0 Released with New Features.md index 25a1735e78..6d2a2bad60 100644 --- a/translated/tech/20190109 Bash 5.0 Released with New Features.md +++ b/translated/tech/20190109 Bash 5.0 Released with New Features.md @@ -1,50 +1,48 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Bash 5.0 Released with New Features) [#]: via: (https://itsfoss.com/bash-5-release) [#]: author: (Ankush Das https://itsfoss.com/author/ankush/) -Bash 5.0 发布了新功能 +Bash 5.0 发布及其新功能 ====== -[邮件列表][1]证实最近发布了 Bash-5.0。而且,令人兴奋的是它还有新功能和新变量。 +[邮件列表][1]证实最近发布了 Bash-5.0。而且,令人兴奋的是它还有新的功能和变量。 如果你一直在使用 Bash 4.4.XX,那么你一定会喜欢 [Bash][2] 的第五个主要版本。 -第五个版本侧重于新的 shell 变量和许多重大漏洞修复。它还引入了一些新功能还有一些让 bash-4.4 和 bash-5.0 之间不兼容的更改。 +第五个版本侧重于新的 shell 变量和许多重大漏洞修复。它还引入了一些新功能,以及一些与 bash-4.4 不兼容的更改。 ![Bash logo][3] ### 新功能怎么样? -邮件列表解释了此版本中修复的 bug: +在邮件列表解释了此版本中修复的 bug: -> 此版本修复了 bash-4.4 中的几个主要错误,并引入了几个新功能。最重要的 bug 修复是对 nameref 变量的解析以及通过模糊测试发现的许多潜在的内存越界错误。在为了符合 Posix 标准解释而不进行单词拆分的上下文中,对 $@ 和 $* 的展开做了许多变化,另外还有解决极端情况中 Posix 一致性的修改。 +> 此版本修复了 bash-4.4 中的几个主要错误,并引入了几个新功能。最重要的 bug 修复是对 nameref 变量的解析以及通过模糊测试发现的许多潜在的内存越界错误。在为了符合 Posix 标准解释而不进行单词拆分的上下文中,对 `$@` 和 `$*` 的展开做了许多改变,另外还有解决极端情况中 Posix 一致性的修改。 -它还引入了一些新功能。根据发布说明,最值得注意的新功能是几个新的 shell 变量: +它还引入了一些新功能。根据其发布说明,最值得注意的新功能是几个新的 shell 变量: -> BASH_ARGV0、EPOCHSECONDS 和 EPOCHREALTIME。内置的 “history” 可以删除指定范围的条目,并能将负数理解为从历史末端开始的偏移量。有一个选项允许局部变量继承前一个范围内具有相同名称的变量的值。有一个新的shell选项,在启用它时,会导致 shell 只尝试一次扩展关联数组下标(这在算术表达式中使用时会出现问题)。“globasciiranges” 这个 shell 选项现在默认启用。可以在配置时默认关闭它。 +> `BASH_ARGV0`、`EPOCHSECONDS` 和 `EPOCHREALTIME`。内置命令 `history` 可以删除指定范围的条目,并能将负数理解为从历史末端开始的偏移量。有一个选项允许局部变量继承前一个范围内具有相同名称的变量的值。有一个新的 shell 选项,在启用它时,会导致 shell 只尝试一次扩展关联数组下标(这在算术表达式中使用时会出现问题)。`globasciiranges` 这个 shell 选项现在默认启用。可以在配置时默认关闭它。 ### Bash-4.4 和 Bash-5.0 之间有哪些变化? -更新日志提到了不兼容的更改和支持 readline 版本历史记录。它是这么说的: +其更新日志提到了不兼容的更改和所支持的 readline 版本历史记录。它是这么说的: -> bash-4.4 和 bash-5.0 之间存在一些不兼容的变化。尽管我已经尽量最小化兼容性问题,但是对 nameref 变量解析的更改意味着对 namerefs 的某些使用会有不同的行为。默认情况下,如果启用了扩展调试模式,shell 仅在启动时设置 BASH_ARGC 和 BASH_ARGV。它被无条件地设置是一个疏忽,并且在脚本传递大量参数时会导致性能问题。 +> bash-4.4 和 bash-5.0 之间存在一些不兼容的变化。尽管我已经尽量最小化兼容性问题,但是对 `nameref` 变量解析的更改意味着对变量名引用的某些使用会有不同的行为。默认情况下,如果启用了扩展调试模式,shell 仅在启动时设置 `BASH_ARGC` 和 `BASH_ARGV`。它被无条件地设置是一个疏忽,并且在脚本传递大量参数时会导致性能问题。 > ->如果需要,可以将 Bash 链接到已安装的 Readline 库,而不是 lib/readline 中的私有版本。只有 readline-8.0 及更高版本能够提供 bash-5.0 所需的所有符号。早期版本的 Readline 库无法正常工作。 +> 如果需要,可以将 Bash 链接到已安装的 Readline 库,而不是 `lib/readline` 中的私有版本。只有 readline-8.0 及更高版本能够提供 bash-5.0 所需的所有符号。早期版本的 Readline 库无法正常工作。 我相信一些添加的功能/变量非常有用。我最喜欢的一些是: * 有一个新的(默认情况下禁用,文档中没有说明)shell 选项,用于在运行时启用/禁用向 syslog 发送历史记录。 - * 正如文档一直所说的那样,除非 shell 处于调试模式,否则它不会在启动时自动设置 BASH_ARGC 和 BASH_ARGV,但如果脚本在上层引用它们且没有启用调试模式,那么 shell 将动态创建它们。 - * 现在可以使用 “-d start-end” 删除指定范围的 “history” 条目。 + * 正如文档一直所说的那样,除非 shell 处于调试模式,否则它不会在启动时自动设置 `BASH_ARGC` 和 `BASH_ARGV`,但如果脚本在上层引用它们且没有启用调试模式,那么 shell 将动态创建它们。 + * 现在可以使用 `-d start-end` 删除指定范围的 `history` 条目。 * 如果启用了作业控制的非交互式 shell 检测到前台作业因 SIGINT 而死亡,则其行为就像接收到 SIGINT 一样。 - * BASH_ARGV0:一个新变量,扩展为 $0 并在赋值时设置 $0。 - - + * `BASH_ARGV0`:一个新变量,扩展为 `$0`,并在赋值时设置为 `$0`。 要查看完整的更改和功能列表,请参阅[邮件列表文章][1]。 @@ -69,7 +67,7 @@ via: https://itsfoss.com/bash-5-release 作者:[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,4 +75,4 @@ via: https://itsfoss.com/bash-5-release [b]: https://github.com/lujun9972 [1]: https://lists.gnu.org/archive/html/bug-bash/2019-01/msg00063.html [2]: https://www.gnu.org/software/bash/ -[3]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/01/bash-logo.jpg?resize=800%2C450&ssl=1 \ No newline at end of file +[3]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/01/bash-logo.jpg?resize=800%2C450&ssl=1 From 23fbe5bc1650cf7e3184a6c77fcd84277f307ade Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Fri, 25 Jan 2019 23:03:18 +0800 Subject: [PATCH 128/243] PUB:20190109 Bash 5.0 Released with New Features.md @geekpi https://linux.cn/article-10477-1.html --- .../20190109 Bash 5.0 Released with New Features.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20190109 Bash 5.0 Released with New Features.md (98%) diff --git a/translated/tech/20190109 Bash 5.0 Released with New Features.md b/published/20190109 Bash 5.0 Released with New Features.md similarity index 98% rename from translated/tech/20190109 Bash 5.0 Released with New Features.md rename to published/20190109 Bash 5.0 Released with New Features.md index 6d2a2bad60..92aaedc8fc 100644 --- a/translated/tech/20190109 Bash 5.0 Released with New Features.md +++ b/published/20190109 Bash 5.0 Released with New Features.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-10477-1.html) [#]: subject: (Bash 5.0 Released with New Features) [#]: via: (https://itsfoss.com/bash-5-release) [#]: author: (Ankush Das https://itsfoss.com/author/ankush/) From b433e790a4c4de1655dd8e195e0e6ce29886b087 Mon Sep 17 00:00:00 2001 From: lctt-bot Date: Fri, 25 Jan 2019 17:00:25 +0000 Subject: [PATCH 129/243] Revert "ScarboroughCoral translating!" This reverts commit 1be827d677fdbf18f75c6bf06acca89967c60d52. --- ...803 How to use Fedora Server to create a router - gateway.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/sources/tech/20180803 How to use Fedora Server to create a router - gateway.md b/sources/tech/20180803 How to use Fedora Server to create a router - gateway.md index 934693d1cf..0394826c10 100644 --- a/sources/tech/20180803 How to use Fedora Server to create a router - gateway.md +++ b/sources/tech/20180803 How to use Fedora Server to create a router - gateway.md @@ -1,5 +1,3 @@ -ScarboroughCoral translating! - How to use Fedora Server to create a router / gateway ====== From 38ec21d05ab4426a40d00dc3c0cd1fe600087ba5 Mon Sep 17 00:00:00 2001 From: MjSeven Date: Sat, 26 Jan 2019 10:28:42 +0800 Subject: [PATCH 130/243] =?UTF-8?q?=E7=BF=BB=E8=AF=91=E5=AE=8C=E6=88=90=20?= =?UTF-8?q?20180411=20How=20to=20setup=20static...?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...w To Setup Static File Server Instantly.md | 173 ------------------ ...w To Setup Static File Server Instantly.md | 161 ++++++++++++++++ 2 files changed, 161 insertions(+), 173 deletions(-) delete mode 100644 sources/tech/20180411 How To Setup Static File Server Instantly.md create mode 100644 translated/tech/20180411 How To Setup Static File Server Instantly.md diff --git a/sources/tech/20180411 How To Setup Static File Server Instantly.md b/sources/tech/20180411 How To Setup Static File Server Instantly.md deleted file mode 100644 index b925c75f1f..0000000000 --- a/sources/tech/20180411 How To Setup Static File Server Instantly.md +++ /dev/null @@ -1,173 +0,0 @@ -Transltaing by MjSeven - -How To Setup Static File Server Instantly -====== - -![](https://www.ostechnix.com/wp-content/uploads/2018/04/serve-720x340.png) -Ever wanted to share your files or project over network, but don’t know how to do? No worries! Here is a simple utility named **“serve”** to share your files instantly over network. This simple utility will instantly turn your system into a static file server, allowing you to serve your files over network. You can access the files from any devices regardless of their operating system. All you need is a web browser. This utility also can be used to serve static websites. It is formerly known as “list” and “micro-list”, but now the name has been changed to “serve”, which is much more suitable for the purpose of this utility. - -### Setup Static File Server Using Serve - -To install “serve”, you need to install NodeJS and NPM first. Refer the following link to install NodeJS and NPM in your Linux box. - -Once NodeJS and NPM installed, run the following command to install “serve”. -``` -$ npm install -g serve - -``` - -Done! Now is the time to serve the files or folders. - -The typical syntax to use “serve” is: -``` -$ serve [options] - -``` - -### Serve Specific files or folders - -For example, let us share the contents of the **Documents** directory. To do so, run: -``` -$ serve Documents/ - -``` - -Sample output would be: - -![][2] - -As you can see in the above screenshot, the contents of the given directory have been served over network via two URLs. - -To access the contents from the local system itself, all you have to do is open your web browser and navigate to **** URL. - -![][3] - -The Serve utility displays the contents of the given directory in a simple layout. You can download (right click on the files and choose “Save link as..”) or just view them in the browser. - -If you want to open local address automatically in the browser, use **-o** flag. -``` -$ serve -o Documents/ - -``` - -Once you run the above command, The Serve utility will open your web browser automatically and display the contents of the shared item. - -Similarly, to access the shared directory from a remote system over network, type **** in the browser’s address bar. Replace 192.168.43.192 with your system’s IP. - -**Serve contents via different port** - -As you may noticed, The serve utility uses port **5000** by default. So, make sure the port 5000 is allowed in your firewall or router. If it is blocked for some reason, you can serve the contents using different port using **-p** flag. -``` -$ serve -p 1234 Documents/ - -``` - -The above command will serve the contents of Documents directory via port **1234**. - -![][4] - -To serve a file, instead of a folder, just give it’s full path like below. -``` -$ serve Documents/Papers/notes.txt - -``` - -The contents of the shared directory can be accessed by any user on the network as long as they know the path. - -**Serve the entire $HOME directory** - -Open your Terminal and type: -``` -$ serve - -``` - -This will share the contents of your entire $HOME directory over network. - -To stop the sharing, press **CTRL+C**. - -**Serve selective files or folders** - -You may not want to share all files or directories, but only a few in a directory. You can do this by excluding the files or directories using **-i** flag. -``` -$ serve -i Downloads/ - -``` - -The above command will serve entire file system except **Downloads** directory. - -**Serve contents only on localhost** - -Sometimes, you want to serve the contents only on the local system itself, not on the entire network. To do so, use **-l** flag as shown below: -``` -$ serve -l Documents/ - -``` - -This command will serve the **Documents** directory only on localhost. - -![][5] - -This can be useful when you’re working on a shared server. All users in the in the system can access the share, but not the remote users. - -**Serve content using SSL** - -Since we serve the contents over the local network, we need not to use SSL. However, Serve utility has the ability to shares contents using SSL using **–ssl** flag. -``` -$ serve --ssl Documents/ - -``` - -![][6] - -To access the shares via web browser use “ or “. - -![][7] - -**Serve contents with authentication** - -In all above examples, we served the contents without any authentication. So anyone on the network can access them without any authentication. You might feel some contents should be accessed with username and password. - -To do so, use: -``` -$ SERVE_USER=ostechnix SERVE_PASSWORD=123456 serve --auth - -``` - -Now the users need to enter the username (i.e **ostechnix** in our case) and password (123456) to access the shares. - -![][8] - -The Serve utility has some other features, such as disable [**Gzip compression**][9], setup * CORS headers to allow requests from any origin, prevent copy address automatically to clipboard etc. You can read the complete help section by running the following command: -``` -$ serve help - -``` - -And, that’s all for now. Hope this helps. More good stuffs to come. Stay tuned! - -Cheers! - - - --------------------------------------------------------------------------------- - -via: https://www.ostechnix.com/how-to-setup-static-file-server-instantly/ - -作者:[SK][a] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) -选题:[lujun9972](https://github.com/lujun9972) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]:https://www.ostechnix.com/author/sk/ -[1]:data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7 -[2]:http://www.ostechnix.com/wp-content/uploads/2018/04/serve-1.png -[3]:http://www.ostechnix.com/wp-content/uploads/2018/04/serve-2.png -[4]:http://www.ostechnix.com/wp-content/uploads/2018/04/serve-4.png -[5]:http://www.ostechnix.com/wp-content/uploads/2018/04/serve-3.png -[6]:http://www.ostechnix.com/wp-content/uploads/2018/04/serve-6.png -[7]:http://www.ostechnix.com/wp-content/uploads/2018/04/serve-5-1.png -[8]:http://www.ostechnix.com/wp-content/uploads/2018/04/serve-7-1.png -[9]:https://www.ostechnix.com/how-to-compress-and-decompress-files-in-linux/ diff --git a/translated/tech/20180411 How To Setup Static File Server Instantly.md b/translated/tech/20180411 How To Setup Static File Server Instantly.md new file mode 100644 index 0000000000..9f31dba91e --- /dev/null +++ b/translated/tech/20180411 How To Setup Static File Server Instantly.md @@ -0,0 +1,161 @@ +如何设置一个即时静态文件服务器 +====== + +![](https://www.ostechnix.com/wp-content/uploads/2018/04/serve-720x340.png) + +曾经想通过网络共享你的文件或项目,但不知道怎么做?别担心!这里有一个名为 **serve** 的简单实用程序,可以通过网络即时共享你的文件。这个简单的实用程序会立即将你的系统变成一个静态文件服务器,允许你通过网络提供文件。你可以从任何设备访问这些文件,而不用担心它们的操作系统是什么。你所需的只是一个 Web 浏览器。这个实用程序还可以用来服务静态网站。它以前称为 “list” 或 “micri-list”,但现在名称已改为 “serve”,这更适合这个实用程序的目的。 + +### 使用 Serve 来设置一个静态文件服务器 + +要安装 "serve",首先你需要安装 NodeJS 和 NPM。参考以下链接在 Linux 中安装 NodeJS 和 NPM。 + + * [如何在 Linux 上安装 NodeJS](https://www.ostechnix.com/install-node-js-linux/) + +NodeJS 和 NPM 安装完成后,运行以下命令来安装 "serve": +``` +$ npm install -g serve +``` + +完成!现在是时候 serve 文件或文件夹了。 + +使用 "serve" 的典型语法是: +``` +$ serve [options] +``` + +### Serve 特定文件或文件夹 + +例如,让我们共享 **Documents** 目录里的内容。为此,运行: +``` +$ serve Documents/ +``` + +示例输出: +![][2] + +正如你在上图中看到的,给定目录的内容已通过两个 URL 提供网络支持。 + +要从本地系统访问内容,你只需打开 Web 浏览器,输入 **** URL: +![][3] + +Serve 实用程序以简单的布局显示给定目录的内容。你可以下载(右键单击文件并选择“将链接另存为...”)或只在浏览器中查看它们。 + +如果想要在浏览器中自动打开本地地址,使用 **-o** 选项。 +``` +$ serve -o Documents/ +``` + +运行上述命令后,Serve 实用程序将自动打开 Web 浏览器并显示共享项的内容。 + +同样,要通过网络从远程系统访问共享目录,可以在浏览器地址栏中输入 ****。用你系统的 IP 替换 192.168.43.192。 + +**通过不同的端口 Serve 内容** + +你可能已经注意到,默认情况下,serve 实用程序使用端口 **5000**。因此,确保防火墙或路由器中允许使用端口 5000。如果由于某种原因被阻止,你可以使用 **-p** 选项使用不同端口来提供内容。 +``` +$ serve -p 1234 Documents/ +``` + +上面的命令将通过端口 **1234** 提供 Documents 目录的内容。 +![][4] + +要提供文件而不是文件夹,只需给它完整的路径,如下所示。 +``` +$ serve Documents/Papers/notes.txt +``` + +只要知道路径,网络上的任何用户都可以访问共享目录的内容。 + +**Serve 整个 $HOME 目录** + +打开终端输入 +``` +$ serve +``` + +这将通过网络共享整个 $HOME 目录的内容。 + +要停止共享,按下 **CTRL+C**。 + +**Serve 选择的文件或文件夹** + +你可能不想共享所有文件或目录,只想共享其中的一些。你可以使用 **-i** 选项排除文件或目录。 +``` +$ serve -i Downloads/ +``` + +以上命令将 serve 整个文件系统,除了 **Downloads** 目录。 + +**仅在本地主机上提供内容** + +有时,你只想在本地系统而不是整个网络上 serve 内容。为此,使用 **-l** 标志,如下所示: +``` +$ serve -l Documents/ +``` + +此命令会仅在本地提供 **Documents** 目录。 + +![][5] + +当你在共享服务器上工作时,这可能会很有用。系统中的所有用户都可以访问共享,但远程用户不能。 + +**使用 SSL Serve 内容** + +由于我们通过本地网络 serve 内容,因此我们不需要使用 SSL。但是,serve 实用程序可以使用 **-ssl** 选项来使用 SSL 共享内容。 +``` +$ serve --ssl Documents/ +``` + +![][6] + +要通过 Web 浏览器访问共享,输入 “ 或 “. + +![][7] + +**通过身份验证 Serve 内容** + +在上面的所以示例中,我们在没有任何身份验证的情况下 serve 内容,所以网络上的任何人都可以在没有任何身份验证的情况下访问共享内容。你可能会觉得应该使用用户名和密码访问某些内容。 + +为此,使用: +``` +$ SERVE_USER=ostechnix SERVE_PASSWORD=123456 serve --auth +``` + +现在用户需要输入用户名(即 **ostechnix**)和密码(123456)来访问共享。(译者注:123456 是非常不好的密码,仅在实验情况下使用) + +![][8] + +Serve 实用程序还有一些其它功能,例如禁用 [**Gzip 压缩**][9],设置 **CORS** 头以允许来自任河源的请求,防止自动复制地址到剪贴板等。通过以下命令,你可以阅读完整的帮助部分。 +``` +$ serve help +``` + +好了,这就是全部了。希望这可以帮助到你。更多好东西要来了,敬请关注! + +共勉! + +来源: + + * [Serve GitHub 仓库](https://github.com/zeit/serve) + +-------------------------------------------------------------------------------- + +via: https://www.ostechnix.com/how-to-setup-static-file-server-instantly/ + +作者:[SK][a] +译者:[MjSeven](https://github.com/MjSeven) +校对:[校对者ID](https://github.com/校对者ID) +选题:[lujun9972](https://github.com/lujun9972) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:https://www.ostechnix.com/author/sk/ +[1]:data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7 +[2]:http://www.ostechnix.com/wp-content/uploads/2018/04/serve-1.png +[3]:http://www.ostechnix.com/wp-content/uploads/2018/04/serve-2.png +[4]:http://www.ostechnix.com/wp-content/uploads/2018/04/serve-4.png +[5]:http://www.ostechnix.com/wp-content/uploads/2018/04/serve-3.png +[6]:http://www.ostechnix.com/wp-content/uploads/2018/04/serve-6.png +[7]:http://www.ostechnix.com/wp-content/uploads/2018/04/serve-5-1.png +[8]:http://www.ostechnix.com/wp-content/uploads/2018/04/serve-7-1.png +[9]:https://www.ostechnix.com/how-to-compress-and-decompress-files-in-linux/ From 2da14044f004cf72373162ac3006ef884fdef625 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Sat, 26 Jan 2019 12:01:10 +0800 Subject: [PATCH 131/243] PRF:20120202 Computer Laboratory - Raspberry Pi- Lesson 2 OK02.md @qhwdw --- ...aboratory - Raspberry Pi- Lesson 2 OK02.md | 38 +++++++++---------- 1 file changed, 18 insertions(+), 20 deletions(-) diff --git a/translated/tech/20120202 Computer Laboratory - Raspberry Pi- Lesson 2 OK02.md b/translated/tech/20120202 Computer Laboratory - Raspberry Pi- Lesson 2 OK02.md index 29fa885a4f..fbb35ce53a 100644 --- a/translated/tech/20120202 Computer Laboratory - Raspberry Pi- Lesson 2 OK02.md +++ b/translated/tech/20120202 Computer Laboratory - Raspberry Pi- Lesson 2 OK02.md @@ -1,20 +1,20 @@ [#]: collector: (lujun9972) [#]: translator: (qhwdw) -[#]: reviewer: () -[#]: publisher: () -[#]: url: () +[#]: reviewer: (wxy) +[#]: publisher: ( ) +[#]: url: ( ) [#]: subject: (Computer Laboratory – Raspberry Pi: Lesson 2 OK02) [#]: via: (https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/ok02.html) [#]: author: (Robert Mullins http://www.cl.cam.ac.uk/~rdm34) -计算机实验室 – 树莓派:课程 2 OK02 +计算机实验室之树莓派:课程 2 OK02 ====== -OK02 课程是在 OK01 课程的基础上构建,通过不停地打开和关闭 `OK` 或 `ACT` LED 指示灯来实现闪烁。假设你已经有了 [课程 1:OK01][1] 操作系统的代码,它将是这一节课的基础。 +OK02 课程构建于 OK01 课程的基础上,通过不停地打开和关闭 OK 或 ACT LED 指示灯来实现闪烁。假设你已经有了 [课程 1:OK01][1] 操作系统的代码,它将是这一节课的基础。 ### 1、等待 -等待是操作系统开发中非常有用的部分。操作系统经常发现自己无事可做,以及必须要延迟。在这个例子中,我们想去做等待,为了能够让这种等待可以看得见,让 LED 灯打开关闭闪烁起来。如果你只是打开和关闭它,你什么都看不到,因为计算机每秒种可以打开和关闭它好几千次。在后面的课程中,我们将看到精确的等待,但是现在,我们只要简单地去消耗时间就足够了。 +等待是操作系统开发中非常有用的部分。操作系统经常发现自己无事可做,以及必须要延迟。在这个例子中,我们希望通过等待,让 LED 灯打开、关闭的闪烁可以看到。如果你只是打开和关闭它,你将看到这个视觉效果,因为计算机每秒种可以打开和关闭它好几千次(LCTT 译注:视觉暂留效应会使你难以发觉它的闪烁)。在后面的课程中,我们将看到精确的等待,但是现在,我们只要简单地去消耗时间就足够了。 ``` mov r2,#0x3F0000 @@ -24,33 +24,31 @@ cmp r2,#0 bne wait1$ ``` -``` -sub reg,#val 从寄存器 reg 中的值上减去数字 val +> `sub reg,#val` 从寄存器 `reg` 中的值上减去数字 `val` +> +> `cmp reg,#val` 将寄存器中的值与数字 `val` 进行比较。 +> +> 如果最后的比较结果是不相等,那么执行后缀了 `ne` 的 `b` 命令。 -cmp reg,#val 将寄存器中的值与数字 val 进行比较。 - -如果最后的比较结果是不相等,那么执行后面的 ne 命令。 -``` - -上面是一个很常见的产生延迟的代码片段,由于每个树莓派基本上是相同的,所以产生的延迟大致也是相同的。它的工作原理是,使用一个 `mov` 命令将值 3F000016 推入到寄存器 r2 中,然后将这个值减 1,直到这个值减到 0 为止。在这里使用了三个新命令 `sub`、 `cmp` 和 `bne`。 +上面是一个很常见的产生延迟的代码片段,由于每个树莓派基本上是相同的,所以产生的延迟大致也是相同的。它的工作原理是,使用一个 `mov` 命令将值 3F000016 推入到寄存器 `r2` 中,然后将这个值减 1,直到这个值减到 0 为止。在这里使用了三个新命令 `sub`、 `cmp` 和 `bne`。 `sub` 是减法命令,它只是简单地从第一个参数中的值减去第二个参数中的值。 `cmp` 是个很有趣的命令。它将第一个参数与第二个参数进行比较,然后将比较结果记录到一个称为当前处理器状态寄存器的专用寄存器中。你其实不用担心它,它记住的只是两个数谁大或谁小,或是相等而已。[^1] -`bne` 其实是一个伪装的分支命令。在 ARM 汇编语言家族中,任何指令都可以有条件运行。这意味着如果上一个比较结果是某个确定的结果,那个指令才会运行。这是个非常有意思的技巧,我们在后面将大量使用到它,但在本案例中,我们在 `b` 命令后面的 ne 后缀意思是 “只有在上一个比较的结果是值不相等,才去运行分支”。`ne` 后缀可以使用在任何命令上,其它几个(总共 16 个)条件也是如此,比如 `eq` 表示等于,而 `lt` 表示小于。 +`bne` 其实是一个伪装的分支命令。在 ARM 汇编语言家族中,任何指令都可以有条件地运行。这意味着如果上一个比较结果是某个确定的结果,那个指令才会运行。这是个非常有意思的技巧,我们在后面将大量使用到它,但在本案例中,我们在 `b` 命令后面的 `ne` 后缀意思是 “只有在上一个比较的结果是值不相等,才去运行该分支”。`ne` 后缀可以使用在任何命令上,其它几个(总共 16 个)条件也是如此,比如 `eq` 表示等于,而 `lt` 表示小于。 ### 2、组合到一起 -上一节讲我提到过,通过将 GPIO 地址偏移量设置为 28(即:str r1,[r0,#28])而不是 40 即可实现 LED 的关闭。因此,你需要去修改课程 OK01 的代码,在打开 LED 后,运行等待代码,然后再关闭 LED,再次运行等待代码,并包含一个回到开始位置的分支。注意,不需要重新启用 GPIO 的 16 号针脚的输出功能,这个操作只需要做一次就可以了。如果你想更高效,我建议你复用 r1 寄存器的值。所有课程都一样,你可以在 [下载页面][2] 找到所有的解决方案。需要注意的是,必须保证你的所有标签都是唯一的。当你写了 wait1\$: 你其它行上的标签就不能再使用 wait1\$ 了。 +上一节讲我提到过,通过将 GPIO 地址偏移量设置为 28(即:`str r1,[r0,#28]`)而不是 40 即可实现 LED 的关闭。因此,你需要去修改课程 OK01 的代码,在打开 LED 后,运行等待代码,然后再关闭 LED,再次运行等待代码,并包含一个回到开始位置的分支。注意,不需要重新启用 GPIO 的 16 号针脚的输出功能,这个操作只需要做一次就可以了。如果你想更高效,我建议你复用 `r1` 寄存器的值。所有课程都一样,你可以在 [下载页面][2] 找到所有的解决方案。需要注意的是,必须保证你的所有标签都是唯一的。当你写了 `wait1$:` 你其它行上的标签就不能再使用 `wait1$` 了。 -在我的树莓派上,它大约是每秒闪两次。通过改变我们所设置的 r2 寄存器中的值,可以很轻松地修改它。但是,不幸的是,我不能够精确地预测它的运行速度。如果你的树莓派未按预期正常工作,请查看我们的故障排除页面,如果它正常工作,恭喜你。 +在我的树莓派上,它大约是每秒闪两次。通过改变我们所设置的 `r2` 寄存器中的值,可以很轻松地修改它。但是,不幸的是,我不能够精确地预测它的运行速度。如果你的树莓派未按预期正常工作,请查看我们的故障排除页面,如果它正常工作,恭喜你。 在这个课程中,我们学习了另外两个汇编命令:`sub` 和 `cmp`,同时学习了 ARM 中如何实现有条件运行。 在下一个课程,[课程 3:OK03][3] 中我们将学习如何编写代码,以及建立一些代码复用的标准,并且如果需要的话,可能会使用 C 或 C++ 来写代码。 -[^1]:如果你点了这个链接,说明你一定想知道它的具体内容。CPSR 是一个由许多独立的比特位组成的 32 比特寄存器。它有一个位用于表示正数、零和负数。当一个 cmp 指令运行后,它从第一个参数上减去第二个参数,然后用这个位记下它的结果是正数、零还是负数。如果是零意味着它们相等(a-b=0 暗示着 a=b)如果为正数意味着 a 大于 b(a-b>0 暗示着 a>b),如果为负数意味着小于。还有其它比较指令,但 cmp 指令最直观。 +[^1]: 如果你点了这个链接,说明你一定想知道它的具体内容。CPSR 是一个由许多独立的比特位组成的 32 比特寄存器。它有一个位用于表示正数、零和负数。当一个 `cmp` 指令运行后,它从第一个参数上减去第二个参数,然后用这个位记下它的结果是正数、零还是负数。如果是零意味着它们相等(`a-b=0` 暗示着 `a=b`)如果为正数意味着 a 大于 b(`a-b>0` 暗示着 `a>b`),如果为负数意味着小于。还有其它比较指令,但 `cmp` 指令最直观。 -------------------------------------------------------------------------------- @@ -59,12 +57,12 @@ via: https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/ok02.html 作者:[Robert Mullins][a] 选题:[lujun9972][b] 译者:[qhwdw](https://github.com/qhwdw) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 [a]: http://www.cl.cam.ac.uk/~rdm34 [b]: https://github.com/lujun9972 -[1]: https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/ok01.html +[1]: https://linux.cn/article-10458-1.html [2]: https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/downloads.html [3]: https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/ok03.html From 4fdd5329ecb919391f2f6e9b3f0d2159895949c6 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Sat, 26 Jan 2019 12:01:45 +0800 Subject: [PATCH 132/243] PUB:20120202 Computer Laboratory - Raspberry Pi- Lesson 2 OK02.md @qhwdw https://linux.cn/article-10478-1.html --- ...20202 Computer Laboratory - Raspberry Pi- Lesson 2 OK02.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20120202 Computer Laboratory - Raspberry Pi- Lesson 2 OK02.md (98%) diff --git a/translated/tech/20120202 Computer Laboratory - Raspberry Pi- Lesson 2 OK02.md b/published/20120202 Computer Laboratory - Raspberry Pi- Lesson 2 OK02.md similarity index 98% rename from translated/tech/20120202 Computer Laboratory - Raspberry Pi- Lesson 2 OK02.md rename to published/20120202 Computer Laboratory - Raspberry Pi- Lesson 2 OK02.md index fbb35ce53a..04d233bcae 100644 --- a/translated/tech/20120202 Computer Laboratory - Raspberry Pi- Lesson 2 OK02.md +++ b/published/20120202 Computer Laboratory - Raspberry Pi- Lesson 2 OK02.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (qhwdw) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-10478-1.html) [#]: subject: (Computer Laboratory – Raspberry Pi: Lesson 2 OK02) [#]: via: (https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/ok02.html) [#]: author: (Robert Mullins http://www.cl.cam.ac.uk/~rdm34) From 54cd7d46560af1a734499e0ca4a77d867a6b41f7 Mon Sep 17 00:00:00 2001 From: MjSeven Date: Sat, 26 Jan 2019 12:57:07 +0800 Subject: [PATCH 133/243] Translating 20180809 Perform robust... --- .../tech/20180809 Perform robust unit tests with PyHamcrest.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sources/tech/20180809 Perform robust unit tests with PyHamcrest.md b/sources/tech/20180809 Perform robust unit tests with PyHamcrest.md index 1c7d7e9226..19bedfc8c5 100644 --- a/sources/tech/20180809 Perform robust unit tests with PyHamcrest.md +++ b/sources/tech/20180809 Perform robust unit tests with PyHamcrest.md @@ -1,3 +1,5 @@ +Translating by MjSeven + Perform robust unit tests with PyHamcrest ====== From 0e59858120983aa1c51572de33beecb317ebe5d8 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Sat, 26 Jan 2019 14:56:21 +0800 Subject: [PATCH 134/243] =?UTF-8?q?=E9=80=89=E9=A2=98=EF=BC=9A20180507=20M?= =?UTF-8?q?odularity=20in=20Fedora=2028=20Server=20Edition.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ... Modularity in Fedora 28 Server Edition.md | 68 +++++++++++++++++++ 1 file changed, 68 insertions(+) create mode 100644 sources/tech/20180507 Modularity in Fedora 28 Server Edition.md diff --git a/sources/tech/20180507 Modularity in Fedora 28 Server Edition.md b/sources/tech/20180507 Modularity in Fedora 28 Server Edition.md new file mode 100644 index 0000000000..22a178fbc5 --- /dev/null +++ b/sources/tech/20180507 Modularity in Fedora 28 Server Edition.md @@ -0,0 +1,68 @@ +Modularity in Fedora 28 Server Edition +======== + +![](https://fedoramagazine.org/wp-content/uploads/2018/05/f28-server-modularity-1024x433.jpg) + +### What is Modularity? + +A classic conundrum that all open-source distributions have faced is the “too fast/too slow” problem. Users install an operating system in order to enable the use of their applications. A comprehensive distribution like Fedora has an advantage and a disadvantage to the large amount of available software. While the package the user wants may be available, it might not be available in the version needed. Here’s how Modularity can help solve that problem. + + +Fedora sometimes moves too fast for some users. Its rapid release cycle and desire to carry the latest stable software can result in breaking compatibility with applications. If a user can’t run a web application because Fedora upgraded a web framework to an incompatible version, it can be very frustrating. The classic answer to the “too fast” problem has been “Fedora should have an LTS release.” However, this approach only solves half the problem and makes the flip side of this conundrum worse. + +There are also times when Fedora moves too slowly for some of its users. For example, a Fedora release may be poorly-timed alongside the release of other desirable software. Once a Fedora release is declared stable, packagers must abide by the [Stable Updates Policy][1] and not introduce incompatible changes into the system. + +Fedora Modularity addresses both sides of this problem. Fedora will still ship a standard release under its traditional policy. However, it will also ship a set of modules that define alternative versions of popular software. Those in the “too fast” camp still have the benefit of Fedora’s newer kernel and other general platform enhancements. In addition, they still have access to older frameworks or toolchains that support their applications. + +In addition, those users who like to live closer to the edge can access newer software than was available at release time. + +### What is Modularity not? + +Modularity is not a drop-in replacement for [Software Collections][2]. These two technologies try to solve many of the same problems, but have distinct differences. + +Software Collections install different versions of packages in parallel on the system. However, their downside is that each installation exists in its own namespaced portion of the filesystem. Furthermore, each application that relies on them needs to be told where to find them. + +With Modularity, only one version of a package exists on the system, but the user can choose which one. The advantage is that this version lives in a standard location on the system. The package requires no special changes to applications that rely on it. Feedback from user studies shows most users don’t actually rely on parallel installation. Containerization and virtualization solve that problem. + +### Why not just use containers? + +This is another common question. Why would a user want modules when they could just use containers? The answer is, someone still has to maintain the software in the containers. Modules provide pre-packaged content for those containers that users don’t need to maintain, update and patch on their own. This is how Fedora takes the traditional value of a distribution and moves it into the new, containerized world. + +Here’s an example of how Modularity solves problems for users of Node.js and Review Board. + +### Node.js + +Many readers may be familiar with Node.js, a popular server-side JavaScript runtime. Node.js has an even/odd release policy. Its community supports even-numbered releases (6.x, 8.x, 10.x, etc.) for around 30 months. Meanwhile, they support odd-numbered releases that are essentially developer previews for 9 months. + +Due to this cycle, Fedora carried only the most recent even-numbered version of Node.js in its stable repositories. It avoided the odd-numbered versions entirely since their lifecycle was shorter than Fedora, and generally not aligned with a Fedora release. This didn’t sit well with some Fedora users, who wanted access to the latest and greatest enhancements. + +Thanks to Modularity, Fedora 28 shipped with not just one, but three versions of Node.js to satisfy both developers and stable deployments. Fedora 28’s traditional repository shipped with Node.js 8.x. This version was the most recent long-term stable version at release time. The Modular repositories (available by default on Fedora 28 Server edition) also made the older Node.js 6.x release and the newer Node.js 9.x development release available. + +Additionally, Node.js released 10.x upstream just days after Fedora 28. In the past, users who wanted to deploy that version had to wait until Fedora 29, or use sources from outside Fedora. However, thanks again to Modularity, Node.js 10.x is already [available][3] in the Modular Updates-Testing repository for Fedora 28. + +### Review Board + +Review Board is a popular Django application for performing code reviews. Fedora included Review Board from Fedora 13 all the way until Fedora 21. At that point, Fedora moved to Django 1.7. Review Board was unable to keep up, due to backwards-incompatible changes in Django’s database support. It remained alive in EPEL for RHEL/CentOS 7, simply because those releases had fortunately frozen on Django 1.6. Nevertheless, its time in Fedora was apparently over. + +However, with the advent of Modularity, Fedora could again ship the older Django as a non-default module stream. As a result, Review Board has been restored to Fedora as a module. Fedora carries both supported releases from upstream: 2.5.x and 3.0.x. + +### Putting the pieces together + +Fedora has always provided users with a wide range of software to use. Fedora Modularity now provides them with deeper choices for which versions of the software they need. The next few years will be very exciting for Fedora, as developers and users start putting together their software in new and exciting (or old and exciting) ways. + +------ + +via: https://fedoramagazine.org/working-modules-fedora-28/ + +作者:[Stephen Gallagher][a] +选题:[wxy](https://github.com/wxy) +译者:[译者ID](https://github.com/译者ID) +校对:[校对ID](https://github.com/校对ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://fedoramagazine.org/author/sgallagh/ +[1]: https://fedoraproject.org/wiki/Updates_Policy#Stable_Releases +[2]: https://www.softwarecollections.org/ +[3]: https://bodhi.fedoraproject.org/updates/FEDORA-MODULAR-2018-2b0846cb86 + From 04a95b607f8466a13f98a26d7df3a7ac114a46a4 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Sat, 26 Jan 2019 15:36:38 +0800 Subject: [PATCH 135/243] TRD:20180507 Modularity in Fedora 28 Server Edition.md --- ... Modularity in Fedora 28 Server Edition.md | 68 ------------------- ... Modularity in Fedora 28 Server Edition.md | 68 +++++++++++++++++++ 2 files changed, 68 insertions(+), 68 deletions(-) delete mode 100644 sources/tech/20180507 Modularity in Fedora 28 Server Edition.md create mode 100644 translated/tech/20180507 Modularity in Fedora 28 Server Edition.md diff --git a/sources/tech/20180507 Modularity in Fedora 28 Server Edition.md b/sources/tech/20180507 Modularity in Fedora 28 Server Edition.md deleted file mode 100644 index 22a178fbc5..0000000000 --- a/sources/tech/20180507 Modularity in Fedora 28 Server Edition.md +++ /dev/null @@ -1,68 +0,0 @@ -Modularity in Fedora 28 Server Edition -======== - -![](https://fedoramagazine.org/wp-content/uploads/2018/05/f28-server-modularity-1024x433.jpg) - -### What is Modularity? - -A classic conundrum that all open-source distributions have faced is the “too fast/too slow” problem. Users install an operating system in order to enable the use of their applications. A comprehensive distribution like Fedora has an advantage and a disadvantage to the large amount of available software. While the package the user wants may be available, it might not be available in the version needed. Here’s how Modularity can help solve that problem. - - -Fedora sometimes moves too fast for some users. Its rapid release cycle and desire to carry the latest stable software can result in breaking compatibility with applications. If a user can’t run a web application because Fedora upgraded a web framework to an incompatible version, it can be very frustrating. The classic answer to the “too fast” problem has been “Fedora should have an LTS release.” However, this approach only solves half the problem and makes the flip side of this conundrum worse. - -There are also times when Fedora moves too slowly for some of its users. For example, a Fedora release may be poorly-timed alongside the release of other desirable software. Once a Fedora release is declared stable, packagers must abide by the [Stable Updates Policy][1] and not introduce incompatible changes into the system. - -Fedora Modularity addresses both sides of this problem. Fedora will still ship a standard release under its traditional policy. However, it will also ship a set of modules that define alternative versions of popular software. Those in the “too fast” camp still have the benefit of Fedora’s newer kernel and other general platform enhancements. In addition, they still have access to older frameworks or toolchains that support their applications. - -In addition, those users who like to live closer to the edge can access newer software than was available at release time. - -### What is Modularity not? - -Modularity is not a drop-in replacement for [Software Collections][2]. These two technologies try to solve many of the same problems, but have distinct differences. - -Software Collections install different versions of packages in parallel on the system. However, their downside is that each installation exists in its own namespaced portion of the filesystem. Furthermore, each application that relies on them needs to be told where to find them. - -With Modularity, only one version of a package exists on the system, but the user can choose which one. The advantage is that this version lives in a standard location on the system. The package requires no special changes to applications that rely on it. Feedback from user studies shows most users don’t actually rely on parallel installation. Containerization and virtualization solve that problem. - -### Why not just use containers? - -This is another common question. Why would a user want modules when they could just use containers? The answer is, someone still has to maintain the software in the containers. Modules provide pre-packaged content for those containers that users don’t need to maintain, update and patch on their own. This is how Fedora takes the traditional value of a distribution and moves it into the new, containerized world. - -Here’s an example of how Modularity solves problems for users of Node.js and Review Board. - -### Node.js - -Many readers may be familiar with Node.js, a popular server-side JavaScript runtime. Node.js has an even/odd release policy. Its community supports even-numbered releases (6.x, 8.x, 10.x, etc.) for around 30 months. Meanwhile, they support odd-numbered releases that are essentially developer previews for 9 months. - -Due to this cycle, Fedora carried only the most recent even-numbered version of Node.js in its stable repositories. It avoided the odd-numbered versions entirely since their lifecycle was shorter than Fedora, and generally not aligned with a Fedora release. This didn’t sit well with some Fedora users, who wanted access to the latest and greatest enhancements. - -Thanks to Modularity, Fedora 28 shipped with not just one, but three versions of Node.js to satisfy both developers and stable deployments. Fedora 28’s traditional repository shipped with Node.js 8.x. This version was the most recent long-term stable version at release time. The Modular repositories (available by default on Fedora 28 Server edition) also made the older Node.js 6.x release and the newer Node.js 9.x development release available. - -Additionally, Node.js released 10.x upstream just days after Fedora 28. In the past, users who wanted to deploy that version had to wait until Fedora 29, or use sources from outside Fedora. However, thanks again to Modularity, Node.js 10.x is already [available][3] in the Modular Updates-Testing repository for Fedora 28. - -### Review Board - -Review Board is a popular Django application for performing code reviews. Fedora included Review Board from Fedora 13 all the way until Fedora 21. At that point, Fedora moved to Django 1.7. Review Board was unable to keep up, due to backwards-incompatible changes in Django’s database support. It remained alive in EPEL for RHEL/CentOS 7, simply because those releases had fortunately frozen on Django 1.6. Nevertheless, its time in Fedora was apparently over. - -However, with the advent of Modularity, Fedora could again ship the older Django as a non-default module stream. As a result, Review Board has been restored to Fedora as a module. Fedora carries both supported releases from upstream: 2.5.x and 3.0.x. - -### Putting the pieces together - -Fedora has always provided users with a wide range of software to use. Fedora Modularity now provides them with deeper choices for which versions of the software they need. The next few years will be very exciting for Fedora, as developers and users start putting together their software in new and exciting (or old and exciting) ways. - ------- - -via: https://fedoramagazine.org/working-modules-fedora-28/ - -作者:[Stephen Gallagher][a] -选题:[wxy](https://github.com/wxy) -译者:[译者ID](https://github.com/译者ID) -校对:[校对ID](https://github.com/校对ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://fedoramagazine.org/author/sgallagh/ -[1]: https://fedoraproject.org/wiki/Updates_Policy#Stable_Releases -[2]: https://www.softwarecollections.org/ -[3]: https://bodhi.fedoraproject.org/updates/FEDORA-MODULAR-2018-2b0846cb86 - diff --git a/translated/tech/20180507 Modularity in Fedora 28 Server Edition.md b/translated/tech/20180507 Modularity in Fedora 28 Server Edition.md new file mode 100644 index 0000000000..d3fff6eace --- /dev/null +++ b/translated/tech/20180507 Modularity in Fedora 28 Server Edition.md @@ -0,0 +1,68 @@ +Fedora 28 服务器版的模块化 +======== + +![](https://fedoramagazine.org/wp-content/uploads/2018/05/f28-server-modularity-1024x433.jpg) + +### 什么是模块化 + +所有开源发行版都面临的一个经典难题是“太快/太慢”的问题。用户安装操作系统是为了能够使用其应用程序。像 Fedora 这样的全面的发行版对大量可用软件有优势和劣势。虽然用户想要的软件包可用,但可能无法在所需的版本中使用。以下是模块化Modularity如何帮助解决该问题。 + +对于某些用户,Fedora 有时升级得太快。其快速发布周期以及尽可能提供最新稳定软件的愿望可能导致与应用程序的兼容性下降。如果因为 Fedora 将 Web 框架升级为不兼容的版本而导致用户无法运行 Web 应用程序,则会非常令人沮丧。对“太快”问题的经典回答是“Fedora 应该有一个 LTS 版本。”然而,这种方法只能解决问题的一半,并使这个难题的另一面变得更糟。 + +有时候 Fedora 对某些用户而言又升级速度太慢。例如,Fedora 的发布可能与其他想要的软件的发布时间不匹配。一旦 Fedora 版本宣布稳定,打包者必须遵守 [稳定更新政策][1] 并且不能在系统中引入不兼容的更改。 + +Fedora 的模块化从两个方面解决了这个问题。Fedora 仍将根据其传统政策发布标准版本。但是,它还将提供一组模块给出流行软件的限定了的替代版本。那些处于“太快”阵营的人仍然可以享受 Fedora 的新内核和其他通用平台增强功能。此外,他们仍然可以访问支持其应用程序的旧框架或工具链。 + +此外,那些喜欢更先锐一些的用户可以访问比发布时更新的软件。 + +### Modularity 不是什么? + +模块化不是 [软件集合][2]Software Collections 的直接替代品。这两种技术试图解决许多相同的问题,但有明显的差异。 + +软件集合可以在系统上并行安装不同版本的软件包。但是,它们的缺点是每份安装包都存在于文件系统上的它们自己的命名空间部分。此外,需要告诉每个依赖它们的应用程序在哪里找到它们。 + +使用模块化,系统上只存在一个版本的软件包,但用户可以选择哪个版本。优点是该版本位于系统的标准位置。该程序包不需要对依赖它的应用程序进行特殊更改。来自用户研究的反馈表明,大多数用户实际上并不依赖于并行安装。容器化和虚拟化解决了这个问题。 + +### 为什么不干脆使用容器化? + +这是另一个常见问题。为什么用户在可以使用容器时还需要模块?答案是,人们仍然需要维护容器中的软件。 模块为那些用户不需要自己维护、更新和修补的容器提供预打包的内容。这就是 Fedora 如何利用发行版的传统价值并将其转移到新的容器化的世界。 + +以下是模块化如何为 Node.js 和 Review Board 的用户解决问题的示例。 + +### Node.js + +许多读者可能熟悉 Node.js,这是一个流行的服务器端 JavaScript 运行时环境。 Node.js 具有偶数/奇数版本策略。它的社区支持偶数版本(6.x、8.x、10.x 等)约 30 个月。同时,他们也支持奇数版本,基本上是 9 个月的开发者预览。 + +由于这个周期的原因,Fedora 在其稳定的存储库中只携带最新的偶数版本的 Node.js。它完全避免了奇数版本,因为它们的生命周期比 Fedora 短,并且通常与 Fedora 发布周期不一致。对于一些希望获得最新和最大增强功能的 Fedora 用户来说,这并不合适。 + +由于模块化,Fedora 28 不仅提供了一个,而是提供了三个版本的 Node.js,以满足开发人员和稳定部署的需求。Fedora 28 的传统存储库带有 Node.js 8.x。此版本是发布时最新的长期稳定版本。模块存储库(默认情况下在 Fedora 28 Server 版本上可用)也使得更旧的 Node.js 6.x 版本和更新的 Node.js 9.x 开发版本可用。 + +另外,Node.js 在 Fedora 28 之后几天发布 10.x 上游版本。过去,想要部署该版本的用户必须等到 Fedora 29,或者使用来自 Fedora 之外的源代码。但是,再次感谢模块化,Node.js 10.x 已经在 Fedora 28 的 Modular Updates-Testing 存储库中 [可用][3] 了。 + +### Review Board + +Review Board 是一个流行的 Django 应用程序,用于执行代码审查。Fedora 从 Fedora 13 到 Fedora 21 都包括了 Review Board。此时,Fedora 转移到了 Django 1.7。由于 Django 数据库支持的向后兼容性不断变化,Review Board 无法跟上。它在 RHEL / CentOS 7 的 EPEL 存储库中仍然存在,而仅仅是因为这些发行版版本幸运地被冻结在 Django 1.6上。尽管如此,它在 Fedora 的时代显然已经过去了。 + +然而,随着模块化的出现,Fedora 能够再次将旧的 Django 作为非默认模块流发布。因此,Review Board 已作为一个模块在 Fedora 上恢复了。Fedora 承载了来自上游的两个受支持的版本:2.5.x 和 3.0.x. + + +### 组合在一起 + +Fedora 一直为用户提供非常广泛的软件使用。Fedora 模块化现在为他们所需的软件版本提供了更深入的选择。接下来的几年对于 Fedora 来说将是非常令人兴奋的,因为开发人员和用户可以以新的和令人兴奋的(或旧的和令人兴奋的)方式组合他们的软件。 + +------ + +via: https://fedoramagazine.org/working-modules-fedora-28/ + +作者:[Stephen Gallagher][a] +选题:[wxy](https://github.com/wxy) +译者:[wxy](https://github.com/wxy) +校对:[校对ID](https://github.com/校对ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://fedoramagazine.org/author/sgallagh/ +[1]: https://fedoraproject.org/wiki/Updates_Policy#Stable_Releases +[2]: https://www.softwarecollections.org/ +[3]: https://bodhi.fedoraproject.org/updates/FEDORA-MODULAR-2018-2b0846cb86 + From 12ea9ff57913de9e6efc20e0789cdf7ccfc1d10f Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Sat, 26 Jan 2019 15:58:41 +0800 Subject: [PATCH 136/243] PRF:20180507 Modularity in Fedora 28 Server Edition.md --- ... Modularity in Fedora 28 Server Edition.md | 27 +++++++++---------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/translated/tech/20180507 Modularity in Fedora 28 Server Edition.md b/translated/tech/20180507 Modularity in Fedora 28 Server Edition.md index d3fff6eace..b4247bae8c 100644 --- a/translated/tech/20180507 Modularity in Fedora 28 Server Edition.md +++ b/translated/tech/20180507 Modularity in Fedora 28 Server Edition.md @@ -5,21 +5,21 @@ Fedora 28 服务器版的模块化 ### 什么是模块化 -所有开源发行版都面临的一个经典难题是“太快/太慢”的问题。用户安装操作系统是为了能够使用其应用程序。像 Fedora 这样的全面的发行版对大量可用软件有优势和劣势。虽然用户想要的软件包可用,但可能无法在所需的版本中使用。以下是模块化Modularity如何帮助解决该问题。 +所有开源发行版都面临的一个经典难题是“太快/太慢”的问题。用户安装操作系统是为了能够使用其应用程序。像 Fedora 这样的全面的发行版在大量可用软件方面有其优势和劣势。虽然有用户想要的软件包,但可能无法使用其所需的版本。以下是模块化Modularity如何帮助解决该问题。 对于某些用户,Fedora 有时升级得太快。其快速发布周期以及尽可能提供最新稳定软件的愿望可能导致与应用程序的兼容性下降。如果因为 Fedora 将 Web 框架升级为不兼容的版本而导致用户无法运行 Web 应用程序,则会非常令人沮丧。对“太快”问题的经典回答是“Fedora 应该有一个 LTS 版本。”然而,这种方法只能解决问题的一半,并使这个难题的另一面变得更糟。 -有时候 Fedora 对某些用户而言又升级速度太慢。例如,Fedora 的发布可能与其他想要的软件的发布时间不匹配。一旦 Fedora 版本宣布稳定,打包者必须遵守 [稳定更新政策][1] 并且不能在系统中引入不兼容的更改。 +有时候 Fedora 对某些用户而言又升级速度太慢。例如,Fedora 的发布可能与其它想要的软件的发布时间不匹配。一旦 Fedora 版本宣布稳定,打包者必须遵守 [稳定更新政策][1] 并且不能在系统中引入不兼容的更改。 -Fedora 的模块化从两个方面解决了这个问题。Fedora 仍将根据其传统政策发布标准版本。但是,它还将提供一组模块给出流行软件的限定了的替代版本。那些处于“太快”阵营的人仍然可以享受 Fedora 的新内核和其他通用平台增强功能。此外,他们仍然可以访问支持其应用程序的旧框架或工具链。 +Fedora 的模块化从两个方面解决了这个问题。Fedora 仍将根据其传统政策发布标准版本。但是,它还将提供一组模块给出流行软件的限定替代版本。那些处于“太快”阵营的人仍然可以享受 Fedora 的新内核和其它通用平台增强功能。此外,他们仍然可以访问支持其应用程序的旧框架或工具链。 -此外,那些喜欢更先锐一些的用户可以访问比发布时更新的软件。 +此外,那些喜欢更新潮一些的用户可以访问比发布时更新的软件。 -### Modularity 不是什么? +### 模块化不是什么? 模块化不是 [软件集合][2]Software Collections 的直接替代品。这两种技术试图解决许多相同的问题,但有明显的差异。 -软件集合可以在系统上并行安装不同版本的软件包。但是,它们的缺点是每份安装包都存在于文件系统上的它们自己的命名空间部分。此外,需要告诉每个依赖它们的应用程序在哪里找到它们。 +软件集合可以在系统上并行安装不同版本的软件包。但是,它们的缺点是每份安装包都存在于文件系统上的它们自己的命名空间里面。此外,需要告诉每个依赖它们的应用程序在哪里找到它们。 使用模块化,系统上只存在一个版本的软件包,但用户可以选择哪个版本。优点是该版本位于系统的标准位置。该程序包不需要对依赖它的应用程序进行特殊更改。来自用户研究的反馈表明,大多数用户实际上并不依赖于并行安装。容器化和虚拟化解决了这个问题。 @@ -31,20 +31,19 @@ Fedora 的模块化从两个方面解决了这个问题。Fedora 仍将根据其 ### Node.js -许多读者可能熟悉 Node.js,这是一个流行的服务器端 JavaScript 运行时环境。 Node.js 具有偶数/奇数版本策略。它的社区支持偶数版本(6.x、8.x、10.x 等)约 30 个月。同时,他们也支持奇数版本,基本上是 9 个月的开发者预览。 +许多读者可能熟悉 Node.js,这是一个流行的服务器端 JavaScript 运行时环境。Node.js 采用偶数/奇数版本策略。它的社区支持偶数版本(6.x、8.x、10.x 等)约 30 个月。同时,他们也支持奇数版本,基本上是 9 个月的开发者预览版。 -由于这个周期的原因,Fedora 在其稳定的存储库中只携带最新的偶数版本的 Node.js。它完全避免了奇数版本,因为它们的生命周期比 Fedora 短,并且通常与 Fedora 发布周期不一致。对于一些希望获得最新和最大增强功能的 Fedora 用户来说,这并不合适。 +由于这个周期的原因,Fedora 在其稳定的仓库中只携带最新的偶数版本的 Node.js。它完全避免了奇数版本,因为它们的生命周期比 Fedora 短,并且通常与 Fedora 发布周期不一致。对于一些希望获得最新和最大增强功能的 Fedora 用户来说,这并不合适。 -由于模块化,Fedora 28 不仅提供了一个,而是提供了三个版本的 Node.js,以满足开发人员和稳定部署的需求。Fedora 28 的传统存储库带有 Node.js 8.x。此版本是发布时最新的长期稳定版本。模块存储库(默认情况下在 Fedora 28 Server 版本上可用)也使得更旧的 Node.js 6.x 版本和更新的 Node.js 9.x 开发版本可用。 +由于模块化,Fedora 28 不是提供了一个版本,而是提供了三个版本的 Node.js,以满足开发人员和稳定部署的需求。Fedora 28 的传统仓库带有 Node.js 8.x。此版本是发布时最新的长期稳定版本。模块仓库(默认情况下在 Fedora 28 Server 版本上可用)也使得更旧的 Node.js 6.x 版本和更新的 Node.js 9.x 开发版本可用。 -另外,Node.js 在 Fedora 28 之后几天发布 10.x 上游版本。过去,想要部署该版本的用户必须等到 Fedora 29,或者使用来自 Fedora 之外的源代码。但是,再次感谢模块化,Node.js 10.x 已经在 Fedora 28 的 Modular Updates-Testing 存储库中 [可用][3] 了。 +另外,Node.js 在 Fedora 28 之后几天发布了 10.x 上游版本。过去,想要部署该版本的用户必须等到 Fedora 29,或者使用来自 Fedora 之外的源代码。但是,再次感谢模块化,Node.js 10.x 已经在 Fedora 28 的 Modular Updates-Testing 仓库中 [可用][3] 了。 ### Review Board -Review Board 是一个流行的 Django 应用程序,用于执行代码审查。Fedora 从 Fedora 13 到 Fedora 21 都包括了 Review Board。此时,Fedora 转移到了 Django 1.7。由于 Django 数据库支持的向后兼容性不断变化,Review Board 无法跟上。它在 RHEL / CentOS 7 的 EPEL 存储库中仍然存在,而仅仅是因为这些发行版版本幸运地被冻结在 Django 1.6上。尽管如此,它在 Fedora 的时代显然已经过去了。 - -然而,随着模块化的出现,Fedora 能够再次将旧的 Django 作为非默认模块流发布。因此,Review Board 已作为一个模块在 Fedora 上恢复了。Fedora 承载了来自上游的两个受支持的版本:2.5.x 和 3.0.x. +Review Board 是一个流行的 Django 应用程序,用于执行代码审查。Fedora 从 Fedora 13 到 Fedora 21 都包括了 Review Board。此时,Fedora 转移到了 Django 1.7。由于 Django 数据库支持的向后兼容性在不断变化,而 Review Board 无法跟上。它在 RHEL / CentOS 7 的 EPEL 仓库中仍然存在,而仅仅是因为这些发行版的版本幸运地被冻结在 Django 1.6上。尽管如此,它在 Fedora 的时代显然已经过去了。 +然而,随着模块化的出现,Fedora 能够再次将旧的 Django 作为非默认模块流发布。因此,Review Board 已作为一个模块在 Fedora 上恢复了。Fedora 承载了来自上游的两个受支持的版本:2.5.x 和 3.0.x。 ### 组合在一起 @@ -57,7 +56,7 @@ via: https://fedoramagazine.org/working-modules-fedora-28/ 作者:[Stephen Gallagher][a] 选题:[wxy](https://github.com/wxy) 译者:[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/) 荣誉推出 From d9f7de121e66621bb3fa650af2a8d884fbe8789f Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Sat, 26 Jan 2019 15:59:47 +0800 Subject: [PATCH 137/243] PUB:20180507 Modularity in Fedora 28 Server Edition.md @wxy https://linux.cn/article-10479-1.html --- .../20180507 Modularity in Fedora 28 Server Edition.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {translated/tech => published}/20180507 Modularity in Fedora 28 Server Edition.md (100%) diff --git a/translated/tech/20180507 Modularity in Fedora 28 Server Edition.md b/published/20180507 Modularity in Fedora 28 Server Edition.md similarity index 100% rename from translated/tech/20180507 Modularity in Fedora 28 Server Edition.md rename to published/20180507 Modularity in Fedora 28 Server Edition.md From ac9574176320a4b6b010016f63a77781ffc807f2 Mon Sep 17 00:00:00 2001 From: MjSeven Date: Sat, 26 Jan 2019 20:55:38 +0800 Subject: [PATCH 138/243] =?UTF-8?q?=E7=BF=BB=E8=AF=91=E5=AE=8C=E6=88=90=20?= =?UTF-8?q?20180809=20Perform=20robust...?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...rform robust unit tests with PyHamcrest.md | 178 ------------------ ...rform robust unit tests with PyHamcrest.md | 132 +++++++++++++ 2 files changed, 132 insertions(+), 178 deletions(-) delete mode 100644 sources/tech/20180809 Perform robust unit tests with PyHamcrest.md create mode 100644 translated/tech/20180809 Perform robust unit tests with PyHamcrest.md diff --git a/sources/tech/20180809 Perform robust unit tests with PyHamcrest.md b/sources/tech/20180809 Perform robust unit tests with PyHamcrest.md deleted file mode 100644 index 19bedfc8c5..0000000000 --- a/sources/tech/20180809 Perform robust unit tests with PyHamcrest.md +++ /dev/null @@ -1,178 +0,0 @@ -Translating by MjSeven - -Perform robust unit tests with PyHamcrest -====== - -![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/web_browser_desktop_devlopment_design_system_computer.jpg?itok=pfqRrJgh) - -At the base of the [testing pyramid][1] are unit tests. Unit tests test one unit of code at a time—usually one function or method. - -Often, a single unit test is designed to test one particular flow through a function, or a specific branch choice. This enables easy mapping of a unit test that fails and the bug that made it fail. - -Ideally, unit tests use few or no external resources, isolating them and making them faster. - -_Good_ tests increase developer productivity by catching bugs early and making testing faster. _Bad_ tests decrease developer productivity. - -Unit test suites help maintain high-quality products by signaling problems early in the development process. An effective unit test catches bugs before the code has left the developer machine, or at least in a continuous integration environment on a dedicated branch. This marks the difference between good and bad unit tests:tests increase developer productivity by catching bugs early and making testing faster.tests decrease developer productivity. - -Productivity usually decreases when testing _incidental features_. The test fails when the code changes, even if it is still correct. This happens because the output is different, but in a way that is not part of the function's contract. - -A good unit test, therefore, is one that helps enforce the contract to which the function is committed. - -If a unit test breaks, the contract is violated and should be either explicitly amended (by changing the documentation and tests), or fixed (by fixing the code and leaving the tests as is). - -While limiting tests to enforce only the public contract is a complicated skill to learn, there are tools that can help. - -One of these tools is [Hamcrest][2], a framework for writing assertions. Originally invented for Java-based unit tests, today the Hamcrest framework supports several languages, including [Python][3]. - -Hamcrest is designed to make test assertions easier to write and more precise. -``` -def add(a, b): - -    return a + b - - - -from hamcrest import assert_that, equal_to - - - -def test_add(): - -    assert_that(add(2, 2), equal_to(4))   - -``` - -This is a simple assertion, for simple functionality. What if we wanted to assert something more complicated? -``` -def test_set_removal(): - -    my_set = {1, 2, 3, 4} - -    my_set.remove(3) - -    assert_that(my_set, contains_inanyorder([1, 2, 4])) - -    assert_that(my_set, is_not(has_item(3))) - -``` - -Note that we can succinctly assert that the result has `1`, `2`, and `4` in any order since sets do not guarantee order. - -We also easily negate assertions with `is_not`. This helps us write _precise assertions_ , which allow us to limit ourselves to enforcing public contracts of functions. - -Sometimes, however, none of the built-in functionality is _precisely_ what we need. In those cases, Hamcrest allows us to write our own matchers. - -Imagine the following function: -``` -def scale_one(a, b): - -    scale = random.randint(0, 5) - -    pick = random.choice([a,b]) - -    return scale * pick - -``` - -We can confidently assert that the result divides into at least one of the inputs evenly. - -A matcher inherits from `hamcrest.core.base_matcher.BaseMatcher`, and overrides two methods: -``` -class DivisibleBy(hamcrest.core.base_matcher.BaseMatcher): - - - -    def __init__(self, factor): - -        self.factor = factor - - - -    def _matches(self, item): - -        return (item % self.factor) == 0 - - - -    def describe_to(self, description): - -        description.append_text('number divisible by') - -        description.append_text(repr(self.factor)) - -``` - -Writing high-quality `describe_to` methods is important, since this is part of the message that will show up if the test fails. -``` -def divisible_by(num): - -    return DivisibleBy(num) - -``` - -By convention, we wrap matchers in a function. Sometimes this gives us a chance to further process the inputs, but in this case, no further processing is needed. -``` -def test_scale(): - -    result = scale_one(3, 7) - -    assert_that(result, - -                any_of(divisible_by(3), - -                       divisible_by(7))) - -``` - -Note that we combined our `divisible_by` matcher with the built-in `any_of` matcher to ensure that we test only what the contract commits to. - -While editing this article, I heard a rumor that the name "Hamcrest" was chosen as an anagram for "matches". Hrm... -``` ->>> assert_that("matches", contains_inanyorder(*"hamcrest") - -Traceback (most recent call last): - -  File "", line 1, in - -  File "/home/moshez/src/devops-python/build/devops/lib/python3.6/site-packages/hamcrest/core/assert_that.py", line 43, in assert_that - -    _assert_match(actual=arg1, matcher=arg2, reason=arg3) - -  File "/home/moshez/src/devops-python/build/devops/lib/python3.6/site-packages/hamcrest/core/assert_that.py", line 57, in _assert_match - -    raise AssertionError(description) - -AssertionError: - -Expected: a sequence over ['h', 'a', 'm', 'c', 'r', 'e', 's', 't'] in any order - -      but: no item matches: 'r' in ['m', 'a', 't', 'c', 'h', 'e', 's'] - -``` - -Researching more, I found the source of the rumor: It is an anagram for "matchers". -``` ->>> assert_that("matchers", contains_inanyorder(*"hamcrest")) - ->>> - -``` - -If you are not yet writing unit tests for your Python code, now is a good time to start. If you are writing unit tests for your Python code, using Hamcrest will allow you to make your assertion _precise_ —neither more nor less than what you intend to test. This will lead to fewer false positives when modifying code and less time spent modifying tests for working code. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/18/8/robust-unit-tests-hamcrest - -作者:[Moshe Zadka][a] -选题:[lujun9972](https://github.com/lujun9972) -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]:https://opensource.com/users/moshez -[1]:https://martinfowler.com/bliki/TestPyramid.html -[2]:http://hamcrest.org/ -[3]:https://www.python.org/ diff --git a/translated/tech/20180809 Perform robust unit tests with PyHamcrest.md b/translated/tech/20180809 Perform robust unit tests with PyHamcrest.md new file mode 100644 index 0000000000..5d44d86bce --- /dev/null +++ b/translated/tech/20180809 Perform robust unit tests with PyHamcrest.md @@ -0,0 +1,132 @@ +Perform robust unit tests with PyHamcrest +使用 PyHamcrest 执行健壮的单元测试 +====== + +![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/web_browser_desktop_devlopment_design_system_computer.jpg?itok=pfqRrJgh) + +在[测试金字塔][1]的底部是单元测试。单元测试每次只测试一个代码单元,通常是一个函数或方法。 + +通常,设计单个单元测试是为了测试通过函数或特定分支选择的特定流,这使得失败的单元测试和导致失败的 bug 之间的映射变得容易。 + +理想情况下,单元测试使用很少或不使用外部资源,从而隔离它们并使它们更快。 + +_好_ 测试通过尽早发现 bug 并加快测试速度来提高开发人员的工作效率。_坏_ 测试降低了开发人员的工作效率。 + +单元测试套件通过在开发过程的早期发现问题来帮助维护高质量的产品。有效的单元测试在代码离开开发人员机器之前捕获 bug,或者至少在特定分支上的持续集成环境中捕获 bug。这标志着好的和坏的单元测试之间的区别:好的测试通过尽早捕获 bug 并使测试更快来提高开发人员的生产力。坏的测试降低了开发人员的工作效率。 + +当测试 _附带的特性_ 时,生产率通常会降低。当代码更改时测试失败,即时它仍然是正确的。发生这种情况是因为输出不同,但在某种程度上它不是函数契约的一部分。 + +因此,一个好的单元测试可以帮助执行函数所提交的契约。 + +如果单元测试中断,那意味着契约被违反了,应该明确修改(通过更改文档和测试),或者被修复(通过修复代码并保持测试不变)。 + +虽然将测试限制为只执行公共契约是一项需要学习的复杂技能,但有一些工具可以提供帮助。 + +其中一个工具是 [Hamcrest][2],一个用于编写断言的框架。最初是为基于 Java 的单元测试而发明的,它现在支持多种语言,包括 [Python][3]。 + +Hamcrest 旨在使测试断言更容易编写和更精确。 + +``` +def add(a, b): +    return a + b + +from hamcrest import assert_that, equal_to + +def test_add(): +    assert_that(add(2, 2), equal_to(4))   +``` + +这是一个用于简单功能的断言。如果我们想要断言更复杂的怎么办? +``` +def test_set_removal(): +    my_set = {1, 2, 3, 4} +    my_set.remove(3) +    assert_that(my_set, contains_inanyorder([1, 2, 4])) +    assert_that(my_set, is_not(has_item(3))) +``` + +注意,我们可以简单地断言结果的顺序为 `1`, `2` 和 `4`,因为集合不保证顺序。 + +我们也可以很容易用 `is_not` 来否定断言。这有助于我们编写 _精确的断言_,使我们能够把自己限制在执行职能的公共契约方面。 + +然而,有时候,内置功能都不是我们 _真正_ 需要的。在这些情况下,Hamcrest 允许我们编写自己的匹配器。 + +想象一下以下功能: +``` +def scale_one(a, b): +    scale = random.randint(0, 5) +    pick = random.choice([a,b]) +    return scale * pick +``` + +我们可以自信地断言结果均匀地划分为至少一个输入。(to 校正:???什么意思) + +匹配器继承自 `hamcrest.core.base_matcher.BaseMatcher`,重写两个方法: +``` +class DivisibleBy(hamcrest.core.base_matcher.BaseMatcher): +    def __init__(self, factor): +        self.factor = factor + +    def _matches(self, item): +        return (item % self.factor) == 0 + +    def describe_to(self, description): +        description.append_text('number divisible by') +        description.append_text(repr(self.factor)) +``` + +编写高质量的 `describe_to` 方法很重要,因为这是测试失败时显示的消息的一部分。 +``` +def divisible_by(num): +    return DivisibleBy(num) +``` + +按照惯例,我们将匹配器包装在一个函数中。有时这给了我们进一步处理输入的机会,但在这种情况下,我们不需要进一步处理。 +``` +def test_scale(): +    result = scale_one(3, 7) +    assert_that(result, +                any_of(divisible_by(3), +                divisible_by(7))) +``` + +请注意,我们将 `divisible_by` 匹配器与内置的 `any_of` 匹配器结合起来,以确保我们只测试函数提交的内容。 + +在编辑这篇文章时,我听到一个传言,“Hamcrest” 这个名字被认为是 “matches” 的字谜。人力资源管理... +``` +>>> assert_that("matches", contains_inanyorder(*"hamcrest") +Traceback (most recent call last): +  File "", line 1, in +  File "/home/moshez/src/devops-python/build/devops/lib/python3.6/site-packages/hamcrest/core/assert_that.py", line 43, in assert_that +    _assert_match(actual=arg1, matcher=arg2, reason=arg3) +  File "/home/moshez/src/devops-python/build/devops/lib/python3.6/site-packages/hamcrest/core/assert_that.py", line 57, in _assert_match +    raise AssertionError(description) +AssertionError: +Expected: a sequence over ['h', 'a', 'm', 'c', 'r', 'e', 's', 't'] in any order +      but: no item matches: 'r' in ['m', 'a', 't', 'c', 'h', 'e', 's'] +``` + +经过进一步的研究,我找到了谣言的来源:它是 “matchers” 的字谜。 +``` +>>> assert_that("matchers", contains_inanyorder(*"hamcrest")) +>>> +``` + +如果你还没有为你的 Python 代码编写单元测试,那么现在是开始的好时机。如果你正在为你的 Python 代码编写单元测试,那么使用 Hamcrest 将允许你使你的断言更加 _精确_,既不会比你想要测试的多也不会少。这将在修改代码时减少误报,并减少修改工作代码的测试所花费的时间。 + + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/18/8/robust-unit-tests-hamcrest + +作者:[Moshe Zadka][a] +选题:[lujun9972](https://github.com/lujun9972) +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:https://opensource.com/users/moshez +[1]:https://martinfowler.com/bliki/TestPyramid.html +[2]:http://hamcrest.org/ +[3]:https://www.python.org/ From 259b2f466cdeee8a360588b9b39a6bc17499acaf Mon Sep 17 00:00:00 2001 From: beamrolling <33046439+beamrolling@users.noreply.github.com> Date: Sat, 26 Jan 2019 21:37:05 +0800 Subject: [PATCH 139/243] =?UTF-8?q?=E7=94=B3=E8=AF=B7=E7=BF=BB=E8=AF=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sources/talk/20190114 Remote Working Survival Guide.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/talk/20190114 Remote Working Survival Guide.md b/sources/talk/20190114 Remote Working Survival Guide.md index 42b151f4cb..b21fd8f400 100644 --- a/sources/talk/20190114 Remote Working Survival Guide.md +++ b/sources/talk/20190114 Remote Working Survival Guide.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (beamrolling) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From d80a73c8f0ed441266d3df10c8819ff5575f251e Mon Sep 17 00:00:00 2001 From: ZmJ <35414361+zzzzzzmj@users.noreply.github.com> Date: Sat, 26 Jan 2019 22:12:57 +0800 Subject: [PATCH 140/243] Update 20150717 The History of Hello World.md --- sources/tech/20150717 The History of Hello World.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20150717 The History of Hello World.md b/sources/tech/20150717 The History of Hello World.md index 9211e9f40f..a7891455ce 100644 --- a/sources/tech/20150717 The History of Hello World.md +++ b/sources/tech/20150717 The History of Hello World.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (zzzzzzmj) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From d276b9732768c214d0fcef3c0e2326d37bc8ed6e Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Sun, 27 Jan 2019 01:15:23 +0800 Subject: [PATCH 141/243] PRF:20180722 Dawn of the Microcomputer- The Altair 8800.md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @zhs852 翻译的很棒,我做了一遍校对,你看看有无修改补充。预计下周一发。 --- ...n of the Microcomputer- The Altair 8800.md | 77 +++++++++---------- 1 file changed, 38 insertions(+), 39 deletions(-) diff --git a/translated/talk/20180722 Dawn of the Microcomputer- The Altair 8800.md b/translated/talk/20180722 Dawn of the Microcomputer- The Altair 8800.md index d6ae8689bf..2ebac634ff 100644 --- a/translated/talk/20180722 Dawn of the Microcomputer- The Altair 8800.md +++ b/translated/talk/20180722 Dawn of the Microcomputer- The Altair 8800.md @@ -1,46 +1,47 @@ 微型计算机的始祖:Altair 8800 ====== -《大众电子》的订阅者是个复杂的群体,杂志编辑 Arthur Salsberg 不得不在 [1974 年 12 月刊][1] 中的前言部分指出这点。此前,杂志编辑组曾收到了对《如何搭建家庭媒体中心》文章的抱怨,称这篇文章激励了许多业余电视爱好者走出去,削弱了专业修理人员存在的必要性,这对许多人的电视造成了极大伤害。Salsberg 认为,这个担忧的产生可能是因为大家不清楚《大众电子》读者们的真实水平。他解释道,杂志内部调查的数据显示,52 % 的订阅者都是某方面的电子专家,并且其中的 150,000 人在最近 60 天之内都修过电视。此外,订阅者们平均在电子产品上花费了 470 美金(2018 年则是 3578 美金),并且他们有对万用表、真空管伏特计、电子管测试仪、晶体管测试仪、射频讯号产生器和示波器的需求。“《大众电子》的读者们并不全都是新手。”Salsberg 总结道。 -熟悉《大众电子》的人居然会质疑它的订阅者,这令我十分吃惊。不过最近 60 天我的确没修过电视。我的电脑对我来说就是一块铝,我甚至没把它拆开看过。1974 年 12 月的《大众电子》刊登的像《驻波比是什么以及如何处理它》和《对万用表的测试》之类的特色文章,甚至连广告都令人生畏。它们中有个看起来像某种立体声系统的东西大胆地写道“除了‘四通道单元(即内建的 SQ、RM 和 CD-4 解码接收器)’,没有任何音频设备是被期待的”。这也表明了《大众电子》的订阅者一定对电子有很多深入的了解。 +《大众电子Popular Electronics》的订阅者们是个复杂的群体,该杂志的编辑 Arthur Salsberg 不得不在 [1974 年 12 月刊][1] 中的前言部分指出这点。此前,杂志编辑组曾收到了对《如何搭建家庭媒体中心》文章的抱怨,称这篇文章激励了许多业余电视爱好者走出去,削弱了专业修理人员存在的必要性,这对许多人的电视造成了极大伤害。Salsberg 认为,这个担忧的产生可能是因为大家不清楚《大众电子》读者们的真实水平。他解释道,据杂志内部调查的数据显示,52% 的订阅者都是某方面的电子专家,并且其中的 150,000 人在最近 60 天之内都修过电视。此外,订阅者们平均在电子产品上花费了 470 美金(2018 年则是 3578 美金),并且他们拥有万用表、真空管伏特计、电子管测试仪、晶体管测试仪、射频讯号产生器和示波器等必要设备。“《大众电子》的读者们并不全都是新手。”Salsberg 总结道。 -不过在 [1975 年 1 月刊][2] 中,杂志为读者们带来了一些他们从没见过的东西。在标题“发现项目”下面,杂志的封面是一个黑灰色的盒子,它的前面板上有一组开关和灯。这便是 Altair 8800,“世界上首个有商业竞争力的迷你计算机”,它的售价低于 400 美元。尽管 Altair 作为“迷你计算机”被宣传,但其实大家都将它称为“微机”和PC,它是首个商业上成功的新型电脑。Altair 十分小巧而且很便宜,以至于它成为了当时家家户户都能用起的电脑。正如 Salsberg 所写道,它在《大众电子》上的出现意味着:“家用电脑的时代终于到来了。” +熟悉《大众电子》的人居然会质疑它的订阅者,这令我十分吃惊。不过最近 60 天我的确没修过电视。我的电脑对我来说就是一块铝,我甚至没把它拆开看过。1974 年 12 月的《大众电子》刊登的像《驻波比是什么以及如何处理它》和《对万用表的测试》之类的特色文章,甚至连广告都令人生畏。它们中有个看起来像某种立体声系统的东西大胆地写道“除了‘四通道单元(即内建的 SQ、RM 和 CD-4 解码接收器)’,没有任何音频设备是值得期待的”。这也表明了《大众电子》的订阅者一定对电子有很多深入的了解。 + +不过在 [1975 年 1 月刊][2] 中,该杂志为读者们带来了一些他们从没见过的东西。在标题“突破性项目”下面,杂志的封面是一个大大的黑灰色盒子,其前面板上有一组复杂开关和灯。这便是 Altair 8800,“世界上首个有商业竞争力的小型机”,它的售价低于 400 美元。尽管 Altair 被宣传作“小型机minicomputer”,但它实际上是首个商业上成功的新型计算机成员,它首先被称为“微型计算机microcomputers”,最终被称为 PC(个人计算机Personal Computer)。Altair 十分小巧而且很便宜,以至于它成为了当时家家户户都能用起的电脑。正如 Salsberg 所写道,它在《大众电子》上的出现意味着:“家用电脑的时代终于到来了。” ![《大众电子》1975 年 1 月刊的封面][3] -此前,我曾写过 [关于 Altair 的文章][4],但我觉得 Altair 有让我再次介绍的价值。它在当时性能并不强(虽然它便宜很多),也不是首个装载微处理器(由至少三个微处理器组成)的通用计算机。但是 Altair 是一种可供我们所有人使用的计算机。它是历史上包括我们所拥有的设备中首台流行的计算机,早于 Altair 计算机都是完全不同的机器,它们由穿孔卡编程并且很少与用户交互。不过 Altair 也是台极其简单的计算机,它不附带任何操作系统甚至引导加载器。除非你购买其它外设,否则 Altair 就是一台装配 RAM 并且只有一组开关和灯泡的机器。由于 Altair 操作简单,学习计算的基本理论都成了十分简单的事情,就好像他们在数字世界冒险时遇上了旧世界的居民一样。 +此前,我曾写过 [关于 Altair 的文章][4],但我觉得 Altair 值得重新审视。与当时其它的计算机相比,它并不是一台性能强劲的计算机(尽管它的成本要低得多),它也不是首个采用微处理器的通用计算机(在它之前已经至少有三个基于微处理器的计算机)。但是 Altair 是一种可供我们所有人使用的计算机。它是历史上我们所拥有的设备中首台流行的计算机,而早于 Altair 计算机都是完全不同的机器,那些大型机和笨重的迷你计算机由穿孔卡编程并且很少与之直接交互。不过 Altair 也是台极其简单的计算机,它没有附带任何操作系统甚至是引导程序。除非你为它购买外围设备,否则 Altair 就是一台装配了 RAM、前面板只有一组开关和灯泡的机器。由于 Altair 操作简单,使得重新理解基本的计算概念都成了十分简单的事情,正如模拟信号时代的人们第一次接触到数字设备一样。 ### Roberts 和他的公司 -Altair 被一家名为 MITS 的公司设计和制造,这家公司位于美国新墨西哥州的阿尔布开克。MITS 由一个叫 H. Edward Roberts 运营。他们起初借 19 世纪 70 年代的热潮制造模型火箭的遥测系统。集成电路将计算器的成本降低到十分可观的数字,突然之间它就成了美国教授们的必需品。不幸的是,由于计算器市场竞争过于激烈,到了 1974 年,MITS 便负债累累。 +Altair 是由一家名为微型仪器和遥测系统Micro Instrumentation and Telemetry Systems(MITS)的公司所设计制造,这家公司位于美国新墨西哥州的阿尔布开克。MITS 由一个叫 H. Edward Roberts 的人经营。在进入计算器市场之前,该公司已经开始制造模型火箭的遥测系统,该市场在 20 世纪 70 年代初期蓬勃发展。集成电路大大降低了计算器的成本,突然之间它就成了美国每个在职的专业人士的必需品。不幸的是,由于计算器市场竞争过于激烈,到了 1974 年初,MITS 便负债累累。 -1974 年在计算机界是奇迹迭出的一年annus mirabilis。一月的时候,惠普公司推出了世界首个可编程的手持计算器 HP-65。四月的时候,Intel 发布了 Intel 8080,他们的第二款 8 位微处理器,它也是首款受欢迎的微处理器。接着,六月的时候,《Radio Electronics》杂志介绍了 Mark-8 这个自制迷你计算机,它使用了 Intel 在 1972 年推出的 Intel 8008 微处理器。Mark-8 是使用微处理器搭建的第三台电脑,它的首次登场是在杂志的封面上。Mark-8 在《Radio Electronics》上的出现促使了《大众电子》寻找微机项目的出现。 +1974 年在计算机界是奇迹迭出的一年annus mirabilis。[^1] 一月的时候,惠普公司推出了世界首个可编程的手持计算器 HP-65。四月的时候,Intel 发布了 Intel 8080,这是他们的第二款 8 位微处理器,它也是首款广受欢迎的微处理器。接着,六月的时候,《无线电电子Radio Electronics》杂志宣传了一台名为 Mark-8 的自制小型计算机,它使用了 Intel 在 1972 年推出的 Intel 8008 微处理器。Mark-8 是有史以来使用微处理器搭建的第三台电脑,它的首次登场是在杂志的封面上。[^2] Mark-8 在《无线电电子》上的出现促使了《大众电子》寻找他们要自己宣传的小型机项目。 -《大众电子》的订阅者们其实早在 1974 年 12 月就通过电邮获得了 1975 年 1 月刊的副本。他们公布的 Altair 为这个奇迹迭出的一年annus mirabilis画上了圆满的句号。Altair 的出现是十分重要的,因为此前从未有过向公众提供的价格公道而又功能齐全的电脑。当时,作为最受欢迎的迷你计算机之一的 PDP-8 要几千美金才能买到。不过 Altair 搭载的 Intel 8080 芯片几乎能与 PDP-8 匹敌;8080 支持更广泛的指令集,而且 Altair 可以扩展到 64 kb 内存,显然强于仅有 4 kb 内存的 PDP-8。并且,Mark-8 也不是他的对手,因为它搭载的是只能处理 16 kb 内存的 Intel 8008。在 Mark-8 必须由用户按照说明书手动拼装的情况下,Altair 在购买时就已经被组装好了(不过由于后来 MITS 被大量订单淹没,最后真正能获得 Altair 的方式也只有买零件拼装了)。 +《大众电子》的订阅者们其实早在 1974 年 12 月就通过邮件获得了 1975 年 1 月刊的刊物。[^3] 所以 Altair 的宣布为这个奇迹迭出的一年annus mirabilis画上了圆满的句号。Altair 的出现是十分重要的,因为此前从未有过向公众提供的价格公道而又功能齐全的电脑。当时,作为最受欢迎的小型计算机之一的 PDP-8 要几千美金才能买到。然而作为 Altair 核心的 Intel 8080 芯片几乎能与 PDP-8 匹敌,甚至更强;8080 支持更广泛的指令集,而且 Altair 可以扩展到 64 kb 内存,显然强于仅有 4 kb 内存的 PDP-8。并且,Mark-8 也不是它的对手,因为它搭载的是只能处理 16 kb 内存的 Intel 8008。在 Mark-8 必须由用户按照说明书在印刷电路板上手动拼装的情况下,Altair 在购买时就已经被组装好了(不过由于后来 MITS 被大量订单淹没,最后真正能获得 Altair 的方式也只有买套件拼装了)。 -对许多《大众电子》的读者来说,Altair 是他们了解数字计算的起点。1975 年 1 月刊上那篇介绍 Altair 的文章由 Roberts 和 Altair 的联合设计师 William Yates 所写。Roberts 和 Yates 煞费苦心地用电工和无线电狂热者们所熟悉的词汇来介绍了数字硬件和计算机编程的基本概念。他们写道:“一台计算机其实由一堆可变的硬件构成。仅需修改储存于内存之中的为组合形式,便可改变硬件设备的种类。”同时,Roberts 和 Yates 认为编程的基本概念是“足够简单并能在较短时间内掌握,但是想要成为一个高效的程序员必须经验丰富且富有创造力。”对此我十分认同。尽管已经组装好了,文章仍包含了用来讲解 Intel 8080 的组成的详细图表。文章解释了 CPU 和计算机内存单元的区别,堆栈指针的概念和汇编语言以及更高级的语言(例如 FORTRAN 和 BASIC)比起手动输入机器码所带来的巨大优势。 +对许多《大众电子》的读者来说,Altair 是他们了解数字计算的起点。1975 年 1 月刊上那篇介绍 Altair 的文章由 Roberts 和 Altair 的共同设计师 William Yates 所写。Roberts 和 Yates 煞费苦心地用电工和无线电狂热者们所熟悉的词汇来介绍了数字硬件和计算机编程的基本概念。他们写道:“一台计算机其实由一块可变的硬件。仅需修改储存于内存之中的位组合形式,便可改变硬件设备的种类。”同时,Roberts 和 Yates 认为编程的基本概念是“足够简单并能在较短时间内掌握,但是想要成为一个高效的程序员必须经验丰富且富有创造力。”对此我十分认同。尽管该部分已经完全组装好了,文章仍包含了用来讲解 Intel 8080 的组成电路的详细图表。文章解释了 CPU 和计算机内存单元的区别,堆栈指针的用法,和汇编语言以及更高级的语言(例如 FORTRAN 和 BASIC)比起手动输入机器码所带来的巨大优势。 其实,《大众电子》在 1975 年 1 月刊之前就出版过 Roberts 撰写的系列文章。这一系列作为短期课程被收录在“数字逻辑”专栏中。在 1974 年 12 月刊中,Roberts 为读者们带来了关于构建“超低成本计算机终端”的文章,文章中介绍了可以用于 8 位电脑中输入值的八进制键盘。在介绍这个键盘时,Roberts 解释了晶体管到晶体管的逻辑工作原理,以及关于构建一种可以“记住”数字值的触发器的方法。Roberts 承诺说,这个键盘可以在下个月即将公布的 Altair 电脑中使用。 -有多少《大众电子》的读者制作了这个键盘我们无从得知,但是那个键盘的确是个很有用的东西。如果没有键盘和其它输入设备,我们只能通过拨动 Altair 面板上的开关来输入值。Altair 的面板上有 16 行开关被用来设置地址,而下方的 8 个则是用来操作计算机的。16 行中最右边的开关是用来指定要储存在内存中的值的。这么做不无道理,因为 Intel 8080 使用 16 位的值来处理 8 位的信息。而这 16 个开关每一个都代表了一个位,当开关向上时代表 1,向下则代表 0。用这样的方式交互是个启示(一会儿我们就会讲到),因为 Altair 的面板是真正的二进制界面。这使得你可以触摸到裸露的金属。 +有多少《大众电子》的读者制作了这个键盘我们无从得知,但是那个键盘的确是个很有用的东西。如果没有键盘和其它输入设备,我们只能通过拨动 Altair 面板上的开关来输入值。Altair 的前面板上有一行 16 个开关被用来设置地址,而下方的 8 个则是用来操作计算机的。一行 16 个开关中最右边的 8 个开关也能用来指定要储存在内存中的值。这么做不无道理,因为 Intel 8080 使用 16 位的值来寻址 8 位的字。而前面板的这 16 个开关每一个都代表了一个位,当开关向上时代表 1,向下则代表 0。用这样的方式与计算机交互是个启示(一会儿我们就会讲到),因为 Altair 的面板是真正的二进制界面。这使得你可以尽可能地接触到计算机实体。 -尽管在当下 Altair 的界面对我们来说完全不像是人用的,不过在那个时候这可是不平凡的。比如 PDP-8 的面板上有个类似的但更漂亮的二进制输入装置,而且它被涂上了吸引人的黄色和橙色,不过讲真,它应该重新来过。然而 PDP-8 经常与纸带阅读器或电传打字机配合使用,这使得程序输入更加容易。这些 I/O 设备价格高昂,这意味着 Altair 的用户们大都会被面板卡住。正如你所想,通过这一堆开关进入一个大型程序是个繁重的工作。不过幸运的是,Altair 可以与盒式记录器连接,这样一来载入程序就不是什么难事了。Bill Gates 和 Paul Allen 进行了微软的首次商业合作,为 Altair 编写了 BASIC 语言,并在 1975 年以 MITS 许可证发行。此后,那些买得起电传打字机的用户就能 [通过纸带来将 BASIC 载入 Altair][5] 了,并能使得用户能够通过字符界面与 Altair 交互。之后,BASIC 便成为了学生们最爱的入门编程语言,并成了早期微机时代的标准接口。 +尽管在当下 Altair 的界面对我们来说完全不像是人用的,不过在那个时代却并不罕见。比如 PDP-8 的面板上有个类似的但更漂亮的二进制输入装置,而且它被涂上了吸引人的黄色和橙色,不过讲真,它真的应该卷土重来。然而 PDP-8 经常与纸带阅读器或电传打字机配合使用,这使得程序输入更加容易。这些 I/O 设备价格高昂,这意味着 Altair 的用户们大都会被那个前面板拦住。正如你可能想象的那样,通过这一堆开关输入一个大型程序是个苦差事。不过幸运的是,Altair 可以与盒式记录器连接,这样一来载入程序就不是什么难事了。Bill Gates 和 Paul Allen 在 MITS 的授权下为 Altair 编写了一个 BASIC 语言版本,并在 1975 年中期发行,这成为了微软有史以来的首次商业尝试。此后,那些买得起电传打字机的用户就能 [通过纸带来将 BASIC 载入 Altair][5] 了,并能使得用户能够通过文字与 Altair 交互。之后,BASIC 便成为了学生们最爱的入门编程语言,并成了早期小型机时代的标准接口。 ### z80pack -多亏了网络上一些人,特别是 Udo Munk 的努力,你可以在你的电脑上运行 Altair 的模拟器。这个模拟器是在 Zilog Z80 CPU 的虚拟套件上构建的,这个 CPU 可以运行 Intel 8080 的软件。Altair 模拟器允许你像 Altair 的用户们一样调整面板上的开关。尽管点击这些开关的感觉不如拨动真实开关,但是使用 Altair 模拟器仍是一个能让你知道二进制人机交互效率有多低的途径,不过我觉得这同时也很简明直观。 +多亏了网络上一些人,特别是 Udo Munk 的努力,你可以在你的计算机上运行 Altair 的模拟器。这个模拟器是在 Zilog Z80 CPU 的虚拟套件上构建的,这个 CPU 可以运行 Intel 8080 的软件。Altair 模拟器允许你像 Altair 的早期用户们一样拨动前面板上的开关。尽管点击这些开关的感觉不如拨动真实开关的触觉,但是使用 Altair 模拟器仍是一个能让你感受二进制人机交互效率有多低的途径,至少在我看来这非常简明直观。 z80pack 是 Udo Munk 开发的 Z80 模拟器套件,你可以在 z80pack 的官网上找到它的下载链接。我在 [上一篇介绍 Altair 的文章中][4] 写到过在 macOS 上使用它的详细过程。如果你能编译 FrontPanel 库和 `altairsim` 可执行程序,你应该能直接运行 `altairsim` 并看到这个窗口: ![模拟器中的 Altair 面板][6] -在新版的 z80pack 中(比如我正在使用的 1.36 版本),你可以使用一个叫 Tarbell boot ROM 的功能,我觉得这是用来加载磁盘镜像的。经我测试,它的意思是你不能写入 RAM 中的前几个信息。在编辑 `/altairsim/conf/system.conf` 之后,你可以构建带有一个 16 页 RAM 且没有 ROM 或引导加载器的 Altair。除此之外,你还可以用这个配置文件来扩大运行模拟器的窗口,不得不说这还是挺方便的。 +在新版的 z80pack 中(比如我正在使用的 1.36 版本),你可以使用一个叫 Tarbell boot ROM 的功能,我觉得这是用来加载磁盘镜像的。经我测试,这意味着你不能写入到 RAM 中的前几个字。在编辑 `/altairsim/conf/system.conf` 之后,你可以构建带有一个 16 页 RAM 且没有 ROM 或引导加载器的 Altair。除此之外,你还可以用这个配置文件来扩大运行模拟器的窗口大小,不得不说这还是挺方便的。 -Altair 的面板看起来就很吓人,不过事实上并没有我们想象中的这么可怕。[Altair 说明书][7] 对解释开关和指示灯起到了很大的作用,这个 [YouTube 视频][8] 也是。若想运行一个简易的程序,你只需要了解一点点东西。Altair 右上方标签为 D0 到 D7 的指示灯代表当前处理地址的信息。标签为 A0 到 A15 的指示灯标识当前的地址。地址指示灯下的 16 个开关可以用来设置新地址;当 “EXAMINE” 开关被向上推动时,数据指示灯将会更新,并显示新地址上的内容。用这个功能,你便能观察到内存中所有的信息了。你也可以将 “EXAMINE” 推下来自动检查下一个位置上的信息,这使得检索信息更容易了。 +Altair 的面板看起来令人生畏,不过事实上并没有我们想象中的这么可怕。[Altair 说明书][7] 对解释开关和指示灯起到了很大的作用,这个 [YouTube 视频][8] 也是如此。若想输入和运行一个简易的程序,你只需要了解一点点东西。Altair 右上方标签为 D0 到 D7 的指示灯代表当前寻址的字的内容。标签为 A0 到 A15 的指示灯表示当前的地址。地址指示灯下的 16 个开关可以用来设置新地址;当 “EXAMINE” 开关被向上推动时,数据指示灯才会更新以显示新地址上的内容。用这个功能,你便能“观察”到内存中所有的信息了。你也可以将 “EXAMINE” 推下来“EXAMINE NEXT”位置,以自动检查下一个位置上的信息,这使得查看连续的信息更容易了。 -要将模式保存到信息中,请使用最左边的 8 个标签为 0 到 7 的开关。然后,请向上推动 “DEPOSIT” 按钮。 +要将位组合方式保存到内存信息中,请使用最右边的 8 个标签为 0 到 7 的开关。然后,请向上推动 “DEPOSIT” 按钮。 -在《大众电子》 的 [1975 年 2 月刊][9] 中,Roberts 和 Yates 制作了一小段程序来确保用户们的 Altair 正常工作。这个程序从内存中读取两个整型数据并添加之后将它们存回内存中。这个小程序仅由 6 条指令组成,但是这 6 条指令包含了 14 条在一起的内存信息,所以要正确地输入它们需要一点时间。这个程序也被写入了 Altair 的说明书,原文如下: +在《大众电子》 的 [1975 年 2 月刊][9] 中,Roberts 和 Yates 引导用户输入一小段程序来确保他们的 Altair 正常工作。这个程序从内存中读取两个整型数据并相加之后将和存回内存中。这个小程序仅由 6 条指令组成,但是这 6 条指令涉及了 14 个字的内存,所以要正确地输入它们需要一点时间。这个示例程序也被写入了 Altair 的说明书,原文如下: | Address | Mnemonic | Bit Pattern | Octal Equivalent | | :------: | :------: | :------: | :------: | @@ -59,18 +60,18 @@ Altair 的面板看起来就很吓人,不过事实上并没有我们想象中 | 12 | (address) | 00 000 000 | 0 0 0 | | 13 | (address) | 00 000 000 | 0 0 0 | -如果你通过开关来输入上面这些值,最终会得到一个程序,它会读取内存 128 中的值,并将其添加至 129 中,最终将其保存至 130 中。每条指令都会占用一个地址,它们最开始会被给予最低有效位,这便是第二个字节总会被清零(没有高于 255 的地址)的原因了。在输入这个程序并在 128 和 129 中输入了一些值之后,你可以向下推动 “RUN” ,之后再将它推到 “STOP” 位置。因为程序循环执行,以一秒内执行上千次的速度反复地添加并保存那些值。并且最后得到的值总是相同的,如果你暂停程序并检查 130,你应该能找到正确答案。 +如果你通过开关来将上表的这些值输入到 Altair,最终会得到一个程序,它会读取内存 128 中的值,并将其与 129 中的值相加,最终将其保存至 130 中。伴随每条取一个地址的指令的地址,它们最开始会给出最低有效位,这便是第二个字节总会被清零的原因了(没有高于 255 的地址)。在输入这个程序并在 128 和 129 中输入了一些值之后,你可以向下短暂推动 “RUN” ,之后再将它推到 “STOP” 位置。因为程序循环执行,以一秒内执行上千次的速度反复地添加并保存那些值。并且最后得到的值总是相同的,如果你停止该程序并查看 130 的内容,你应该能找到正确答案。 -我不知道普通的 Altair 用户是否使用过,不过 z80pack 包括了一个汇编程序 —— `z80asm`,意思是适用于 Z80 的汇编程序Z80 assembly,所以它使用了不同的助记符。不过因为 Z80 是被设计来适配为 Intel 8080 写的软件的,所以即使助记符不一样,它们的操作码也是相同的。你可以直接将 `z80asm` 装载进 Altair: +我不知道普通的 Altair 用户是否使用过汇编程序,不过 z80pack 包括了一个:`z80asm`,意思是适用于 Z80 的汇编程序Z80 assembly,所以它使用了一组不同的助记符。不过因为 Z80 是被设计来兼容为 Intel 8080 写的软件的,所以即使助记符不一样,它们的操作码也是相同的。你可以直接将 `z80asm` 汇编码装载进 Altair: ``` - ORG 0000H -START: LD A,(80H) ;Load from address 128. - LD B,A ;Move loaded value from accumulator (A) to reg B. - LD A,(81H) ;Load from address 129. - ADD A,B ;Add A and B. - LD (82H),A ;Store A at address 130. - JP START ;Jump to start. + ORG 0000H +START: LD A,(80H) ;Load from address 128. + LD B,A ;Move loaded value from accumulator (A) to reg B. + LD A,(81H) ;Load from address 129. + ADD A,B ;Add A and B. + LD (82H),A ;Store A at address 130. + JP START ;Jump to start. ``` 编译之后,你可以调用汇编程序来将其转换为 Intel HEX 文件: @@ -79,21 +80,21 @@ START: LD A,(80H) ;Load from address 128. $ ./z80asm -fh -oadd.hex add.asm ``` -我们用带有 `h` 参数的 `-f` 标识来定义输出的 HEX 文件。你可以用 `-x` 标识来传递 HEX 文件,从而使得 Altair 能够加载程序: +我们用带有 `h` 参数的 `-f` 标识来定义输出的 HEX 文件。你可以用 `-x` 标识来传递 HEX 文件,从而使得 Altair 能够加载该程序: ```shell $ ./altairsim -x add.hex ``` -这会在内存中自动设置前 14 个信息,就和你通过开关手动输入这些值一样。你可以直接使用 “RUN” 按钮来替代以前那些繁琐的步骤,这是如此的简单! +这会在内存中自动设置前 14 个字,就和你通过开关手动输入这些值一样。你可以直接使用 “RUN” 按钮来替代以前那些繁琐的步骤,这是如此的简单! -我不觉得有很多 Altair 用户以这种方式来编写软件。Altair BASIC 发布后,使得 BASIC 成为了 Altair 编程最简单的方法。z80pack 同时也包括了一些包含不同版本 Altair BASIC 的 HEX 文件;在模拟器中,你可以用这个方式加载 4.0 版本的 4K BASIC: +我不觉得有很多 Altair 用户以这种方式来编写软件。Altair BASIC 发布后,使得 BASIC 成为了 Altair 编程最简单的方法。z80pack 同时也包括了一些不同版本 Altair BASIC 的 HEX 文件;在模拟器中,你可以用这个方式加载 4.0 版本的 4K BASIC: ```shell $ ./altairsim -x basic4k40.hex ``` -当你开启模拟器并按下 “RUN” 按钮之后,你就会看到 BASIC 开始执行了,同时它会在终端中与你交互。它首先会提示你输入你内存的可用量,我们输入 4000 字节。随后,在显示 “OK” 提示符之前,它会问你几个问题,Gates 和 Allen 用这个来代替标准的 “READY” 并以此节省内存。在这之后,你便可以使用 BASIC 了: +当你开启模拟器并按下 “RUN” 按钮之后,你就会看到 BASIC 开始执行了,同时它会在终端中与你交互。它首先会提示你输入你的内存可用量,我们输入 4000 字节。随后,在显示 “OK” 提示符之前,它会问你几个问题,Gates 和 Allen 用这个“OK”来代替标准的 “READY” 并以此节省内存。在这之后,你便可以使用 BASIC 了: ``` OK @@ -101,26 +102,24 @@ PRINT 3 + 4 7 ``` -尽管只有极小的 4 kb 空间来运行 BASIC,不过你仍迈出了使用面板操控电脑的重要一步。 +虽然运行 BASIC 只有 4kb 的内存并没有给你足够的空间,但你可以看到它是如何从使用前面板迈出了重要的一步。 -很显然,Altair 远不及如今的家用电脑,并且比它晚十多年发布的 Mac 电脑看上去也是对 Altair 电脑的巨大飞跃。但是对亲手组装了 Altair 的《大众电子》的读者们来说,只用了低于 400 美金和一半的书柜空间的 Altair 才是第一个它们真正能拥有的全功能电脑。对那时只能用 [一叠卡片][10] 或一卷磁带来与计算机交互的人们来说,Altair 是个令人眼前一亮的玩意。这之后的微机基本都是在对 Altair 改进,使得它更易用。从某种意义上来说,我们甚至可以把它们看成更复杂的 Altair。Altair,一个野兽派的极简作品,却为之后的许多微机打下了铺垫。 +很显然,Altair 远不及如今的家用电脑和笔记本电脑,并且比它晚十多年发布的 Mac 电脑看上去也是对 这个简朴的 Altair 电脑的巨大飞跃。但是对第一批购买并亲手组装了 Altair 的《大众电子》的读者们来说,Altair 才是他们拥有的第一个真正的全功能电脑,而这一切只用了 400 美金低价和一半的书柜空间。对那时只能用 [一叠卡片][10] 或一卷磁带来与计算机交互的人们来说,Altair 是个令人眼前一亮的玩意。这之后的微型计算机基本都是在对 Altair 改进,使得它更易用。从某种意义上来说,它们只是更复杂的 Altair。Altair,一个野兽派的极简作品,却为之后的许多微型计算机打下了铺垫。 如果你觉得这篇文章写的不错,你可以在推特上关注 [@TwoBitHistory][11] 或订阅 [RSS feed][12] 来获得我们文章的更新提醒。文章每两周就会更新一次! -TwoBitHistory 的上一篇文章是………… - -> “跟我一起来进行这振奋人心的冒险吧!只需要十分钟,你就能了解到 10 年都没人用过的软件。” -> -> — TwoBitHistory (@TwoBitHistory) [写于 2018 年 7 月 7 日][13] +[^1]: Paul E. Ceruzzi, A History of Modern Computing (Cambridge, Mass: MIT Press, 2003), 226. +[^2]: “Mark-8 Minicomputer,” Byran’s Old Computers, accessed July 21, 2018, http://bytecollector.com/mark_8.htm. +[^3]: Paul E. Ceruzzi, A History of Modern Computing (Cambridge, Mass: MIT Press, 2003), 226. -------------------------------------------------------------------------------- via: https://twobithistory.org/2018/07/22/dawn-of-the-microcomputer.html -作者:[Two-Bit History][a] +作者:[Sinclair Target][a] 选题:[lujun9972][b] 译者:[zhs852](https://github.com/zhs852) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 @@ -129,13 +128,13 @@ via: https://twobithistory.org/2018/07/22/dawn-of-the-microcomputer.html [1]: https://www.americanradiohistory.com/Archive-Poptronics/70s/1974/Poptronics-1974-12.pdf [2]: https://www.americanradiohistory.com/Archive-Poptronics/70s/1975/Poptronics-1975-01.pdf [3]: https://twobithistory.org/images/jan1975-altair.jpg -[4]: https://twobithistory.org/2017/12/02/simulating-the-altair.html +[4]: https://linux.cn/article-10181-1.html [5]: https://www.youtube.com/watch?v=qv5b1Xowxdk [6]: https://www.autometer.de/unix4fun/z80pack/altair.png [7]: http://www.classiccmp.org/dunfield/altair/d/88opman.pdf [8]: https://www.youtube.com/watch?v=suyiMfzmZKs [9]: https://www.americanradiohistory.com/Archive-Poptronics/70s/1975/Poptronics-1975-02.pdf -[10]: https://twobithistory.org/2018/06/23/ibm-029-card-punch.html +[10]: https://linux.cn/article-10382-1.html [11]: https://twitter.com/TwoBitHistory [12]: https://twobithistory.org/feed.xml [13]: https://twitter.com/TwoBitHistory/status/1015647820353867776?ref_src=twsrc%5Etfw From ee5ee1cbc771973c5c36a48bff4a7f00d4c009b0 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Sun, 27 Jan 2019 11:57:06 +0800 Subject: [PATCH 142/243] PRF:20180130 tmux - A Powerful Terminal Multiplexer For Heavy Command-Line Linux User.md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @MjSeven 这篇我做了比较大的调整,不是你的问题,是原文粗制滥造。 --- ...lexer For Heavy Command-Line Linux User.md | 144 +++++++++--------- 1 file changed, 71 insertions(+), 73 deletions(-) diff --git a/translated/tech/20180130 tmux - A Powerful Terminal Multiplexer For Heavy Command-Line Linux User.md b/translated/tech/20180130 tmux - A Powerful Terminal Multiplexer For Heavy Command-Line Linux User.md index dab7489ba4..a227f86d7d 100644 --- a/translated/tech/20180130 tmux - A Powerful Terminal Multiplexer For Heavy Command-Line Linux User.md +++ b/translated/tech/20180130 tmux - A Powerful Terminal Multiplexer For Heavy Command-Line Linux User.md @@ -1,20 +1,17 @@ -tmux - 适用于重度命令行 Linux 用户的强大终端复用器 +tmux:适用于重度命令行 Linux 用户的终端复用器 ====== -tmux 是终端复用的缩写,它允许用户在单个窗口中创建或启用多个终端(垂直或水平),当你处理不同的问题时,可以在单个窗口中轻松访问和控制。 +tmux 是终端复用器terminal multiplexer的缩写,它允许用户在单个窗口中创建或启用多个终端(垂直或水平),当你处理不同的问题时,可以在单个窗口中轻松访问和控制它们。 -它使用客户端-服务器模型,允许用户之间共享会话,也可以将终端连接到 tmux 会话。我们可以根据需要轻松移动或重新排列虚拟控制台。终端会话可以从一个虚拟控制台自由切换到另一个。 +它使用客户端-服务器模型,允许在用户之间共享会话,也可以将终端连接到 tmux 会话。我们可以根据需要轻松移动或重新排列虚拟控制台。终端会话可以从一个虚拟控制台自由切换到另一个。 - -tmux 依赖于 `libevent` 和 `ncurses` 库。tmux 在屏幕底部提供了一个状态行,它显示当前 tmux 会话的有关信息,例如当前窗口编号,窗口名称,用户名,主机名,当前时间和日期。 +tmux 依赖于 `libevent` 和 `ncurses` 库。tmux 在屏幕底部提供了一个状态行,它显示当前 tmux 会话的有关信息,例如当前窗口编号、窗口名称、用户名、主机名、当前时间和日期。 启动 tmux 时,它会在一个单独窗口上创建一个新的会话,并将其显示在屏幕上。它允许用户在同一个会话中创建任意数量的窗口。 -许多人说它相当于一块屏幕,但我不这么认为,因为它提供了许多配置选项。 +许多人说它类似于 `screen`,但我不这么认为,因为它提供了许多配置选项。 -**注意:** `Ctrl+b` 是 tmux 中的默认前缀,因此,要在 tmux 中执行任何操作,你必须先输入前缀然后输入所需的选项。 - -**建议阅读:** [适用于 Linux 的终端仿真器列表][1] +**注意:** `Ctrl+b` 是 tmux 中的默认命令前缀,因此,要在 tmux 中执行任何操作,你必须先输入该前缀然后输入所需的选项。 ### tmux 特性 @@ -26,34 +23,40 @@ tmux 依赖于 `libevent` 和 `ncurses` 库。tmux 在屏幕底部提供了一 * tmux 提供许多配置技巧 **建议阅读:** -**(#)** [tmate - 马上与其他人分享你的终端会话][2] -**(#)** [Teleconsole - 一个与其他人分享终端会话的工具][3] + +- [tmate - 马上与其他人分享你的终端会话][2] +- [Teleconsole - 一个与其他人分享终端会话的工具][3] ### 如何安装 tmux 命令 大多数 Linux 系统默认预安装 tmux 命令。如果没有,按照以下步骤安装。 -对于 **`Debian/Ubuntu`**,使用 [APT-GET 命令][4]或 [APT 命令][5]来安装: +对于 Debian/Ubuntu,使用 [APT-GET 命令][4]或 [APT 命令][5]来安装: + ``` $ sudo apt install tmux ``` -对于 **`RHEL/CentOS`**,使用 [YUM 命令][6]来安装: +对于 RHEL/CentOS,使用 [YUM 命令][6]来安装: + ``` $ sudo yum install tmux ``` -对于 **`Fedora`**,使用 [DNF 命令][7]来安装: +对于 Fedora,使用 [DNF 命令][7]来安装: + ``` $ sudo dnf install tmux ``` -对于 **`Arch Linux`**,使用 [Pacman 命令][8]来安装: +对于 Arch Linux,使用 [Pacman 命令][8]来安装: + ``` $ sudo pacman -S tmux ``` -对于 **`openSUSE`**,使用 [Zypper 命令][9]来安装: +对于 openSUSE,使用 [Zypper 命令][9]来安装: + ``` $ sudo zypper in tmux ``` @@ -61,56 +64,51 @@ $ sudo zypper in tmux ### 如何使用 tmux 在终端上运行以下命令来启动 tmux 会话。启动 tmux 后,它会在一个新窗口中创建新会话,并将使用你的用户账户自动登录到你的默认 shell。 + ``` $ tmux ``` ![][11] -你会得到类似于我们上面的截图。tmux 附带状态栏,显示有关当前会话详细信息,日期,时间等。 +你会得到类似于我们上面的截图。tmux 附带状态栏,显示有关当前会话详细信息、日期、时间等。 状态栏信息如下: - * **`0 :`** 它表示由 tmux 服务器创建的会话号。默认情况下,它从 0 开始。 - * **`0:username@host: :`** ) 0 表示会话号。用户名和主机名是当前的使用窗口的人。 - * **`~ :`** 它表示当前目录(我们在家目录中)。 - * **`* :`** 这表示窗口现在处于活动状态。 - * **`Hostname :`** 显示服务器的完全主机名。 - * **`Date& Time:`** 显示当前日期和时间。 + * `[0]`:它表示由 tmux 服务器创建的会话号。默认情况下,它从 0 开始。 + * `0:bash`:表示会话号、命令行提示符(这里的 `bash` 表示 shell 名称)。 + * `*`:这表示该窗口现在处于活动状态。 + * 主机名:显示服务器的完全主机名。 + * 日期与时间:显示当前日期和时间。 +(LCTT 译注:tmux 的状态可以根据需要定制,也会因环境、版本的不同而不同。) - ### 如何拆分窗口 +### 如何拆分窗口 - tmux 允许用户垂直或水平分割窗口。我们来看看如何做到这一点。 +tmux 允许用户垂直或水平分割窗口,称为窗格。每个窗格都包含自己独立运行的终端实例。我们来看看如何做到这一点。 + +按下 `Ctrl+b, %` 来垂直分割窗格。 -按下 `**(Ctrl+b), %**` 来垂直分割窗口。 ![][13] -Press `**(Ctrl+b), "**` 来水平分割窗口。 +按下 `Ctrl+b, "` 来水平分割窗格。 + ![][14] ### 如何在窗格之间移动 假设,我们创建了一些窗格,希望在它们之间移动,这该怎么做?如果你不知道怎么做,那么使用 tmux 就没有意义了。使用以下控制键执行操作。在窗格之间移动有许多方法。 +- 按 `Ctrl+b, ←` - 选择左边的窗格 +- 按 `Ctrl+b, →` - 选择右边的窗格 +- 按 `Ctrl+b, ↑` - 选择上边的窗格 +- 按 `Ctrl+b, ↓` - 选择下边的窗格 +- 按 `Ctrl+b, {` - 来向左交换窗格 +- 按 `Ctrl+b, }` - 来向右交换窗格 +- 按 `Ctrl+b, o` - 切换到下一个窗格(从左到右,从上到下) +- 按 `Ctrl+b, ;` - 移动到先前活动的窗格 -按 `(Ctrl+b), 左箭头` - 来向左移动 - -按 `(Ctrl+b), 右箭头` - 来向右移动 - -按 `(Ctrl+b), 上箭头` - 来向上移动 - -按 `(Ctrl+b), 下箭头` - 来向下移动 - -按 `(Ctrl+b), {` - 来向左移动 - -按 `(Ctrl+b), }` - 来向右移动 - -按 `(Ctrl+b), o` - 切换到下一个窗格(从左到右,从上到下) - -按 `(Ctrl+b), ;` - 移动到先前活动的窗格 - -出于测试目的,我们将在窗格之间移动。现在我们在 `pane2` 中,它 `lsb_release -a` 命令的输出。 +出于测试目的,我们将在窗格之间移动。现在我们在 `pane2` 中,它展示了 `lsb_release -a` 命令的输出。 ![][15] @@ -120,25 +118,23 @@ Press `**(Ctrl+b), "**` 来水平分割窗口。 ### 如何打开/创建新窗口 -你可以在一个终端内打开任意数量的窗口。终端窗口可以垂直和水平分割,称为 `panes`。每个窗格都包含自己独立运行的终端实例。 +你可以在一个终端内打开任意数量的窗口。 -按 `(Ctrl+b), c` 来创建一个新窗口。 +- 按 `Ctrl+b, c` 来创建一个新窗口。 +- 按 `Ctrl+b, n` 移动到下一个窗口。 +- 按 `Ctrl+b, p` 移动到上一个窗口。 +- 按 `Ctrl+b, 0` ~ `Ctrl+b, 9` 立即移动到特定窗口。 +- 按 `Ctrl+b, l` 移动到先前选择的窗口。 -按 `(Ctrl+b), n` 移动到下一个窗口 +我有两个窗口,第一个窗口有三个窗格,其中包含操作系统版本信息,`top` 命令输出和内核信息。 -按 `(Ctrl+b), p` 移动到上一个窗口。 - -按 `(Ctrl+b), (0-9)` 立即移动到特定窗口。 - -按 `(Ctrl+b), l` 移动到先前选择的窗口。 - -我有两个窗口,第一个窗口有三个窗格,其中包含操作系统版本信息,top 命令输出和内核信息。 ![][17] 第二个窗口有两个窗格,其中包含 Linux 发行版 logo 信息。使用以下命令执行操作: + ![][18] -按 `(Ctrl+b), w` 以交互方式选择当前窗口。 +按 `Ctrl+b, w` 以交互方式选择当前窗口。 ![][19] @@ -146,46 +142,48 @@ Press `**(Ctrl+b), "**` 来水平分割窗口。 你正在一些非常小的窗格中工作,并且你希望将其缩小以进行进一步的工作。要做到这一点,使用以下键绑定。 -目前我们有三个窗格,我在 `pane1` 工作,它使用 **Top** 命令显示系统活动信息,我将缩放它。 +目前我们有三个窗格,我在 `pane1` 工作,它使用 `top` 命令显示系统活动信息,我将缩放它。 + ![][17] 缩放窗格时,它将隐藏所有其它窗格,并只显示窗口中的缩放窗格。 ![][20] -按 `(Ctrl+b), z` 缩放窗格并再次按下它,使缩放窗格恢复原状。 +按 `Ctrl+b, z` 缩放窗格,并再次按下它使缩放窗格恢复原状。 ### 显示窗格信息 要了解窗格编号及其大小,运行以下命令。 -按 `(Ctrl+b), q` 可简单显示窗格索引。 +按 `Ctrl+b, q` 可简单显示窗格索引。 + ![][21] ### 显示窗口信息 -要知道窗口编号,布局大小,与窗口关联的窗格数量及其大小等,运行以下命令。 +要知道窗口编号、布局大小,与窗口关联的窗格数量及其大小等,运行以下命令。 只需运行 `tmux list-windows` 即可查看窗口信息。 + ![][22] ### 如何调整窗格大小 -你可能需要调整窗格大小来满足你的要求。你必须按下 `(Ctrl+b), :`,然后在页面底部的 `黄色(yellow)` 颜色条上输入以下详细信息。 +你可能需要调整窗格大小来满足你的要求。你必须按下 `Ctrl+b, :`,然后在页面底部的黄色颜色条上输入以下详细信息。 + ![][23] -在上一部分中,我们有打印了窗格索引,它同时也显示了窗格大小。为了测试,我们要向上增加 `10` 个单元。参考以下输出,该窗格将 pane1 和 pane2 的大小从 `55x21` 增加到 `55x31`。 +在上一部分中,我们打印了窗格索引,它同时也显示了窗格大小。为了测试,我们要向增加 `10` 个单元。参考以下输出,该窗格将 pane1 和 pane2 的大小从 `55x21` 增加到 `55x31`。 + ![][24] -**语法:** `(Ctrl+b), :` 然后输入 `resize-pane [options] [cells size]` +**语法:** `Ctrl+b, :` 然后输入 `resize-pane [options] [cells size]` -`(Ctrl+b), :` 然后输入 `resize-pane -D 10` 将当前窗格大小向下调整 10 个单元。 - -`(Ctrl+b), :` 然后输入 `resize-pane -U 10` 将当前窗格大小向上调整 10 个单元。 - -`(Ctrl+b), :` 然后输入 `resize-pane -L 10` 将当前窗格大小向左调整 10 个单元。 - -`(Ctrl+b), :` 然后输入 `resize-pane -R 10` 将当前窗格大小向右调整 10 个单元。 +- `Ctrl+b, :` 然后输入 `resize-pane -D 10` 将当前窗格大小向下调整 10 个单元。 +- `Ctrl+b, :` 然后输入 `resize-pane -U 10` 将当前窗格大小向上调整 10 个单元。 +- `Ctrl+b, :` 然后输入 `resize-pane -L 10` 将当前窗格大小向左调整 10 个单元。 +- `Ctrl+b, :` 然后输入 `resize-pane -R 10` 将当前窗格大小向右调整 10 个单元。 ### 分离并重新连接 tmux 会话 @@ -208,23 +206,23 @@ $ rsync -avzhe ssh /backup root@192.168.0.161:/backups/week-1/ ``` 运行以下命令以列出可用的 tmux 会话。 + ``` $ tmux ls 0: 3 windows (created Tue Jan 30 06:17:47 2018) [109x45] ``` 现在,使用适当的会话 ID 重新连接 tmux 会话,如下所示: + ``` $ tmux attach -t 0 ``` ### 如何关闭窗格和窗口 -只需在相应的窗格中输入 `exit` 或按下 `Ctrl-d` 即可关闭它,和终端关闭类似。要关闭窗口,按下 `(Ctrl+b), &`。 +只需在相应的窗格中输入 `exit` 或按下 `Ctrl-d` 即可关闭它,和终端关闭类似。要关闭窗口,按下 `Ctrl+b, &`。 好了,就到这里了,希望你喜欢上它。 -(to 校正:这句话是加的,感觉它结尾很突然,可以删掉。) - -------------------------------------------------------------------------------- @@ -232,7 +230,7 @@ via: https://www.2daygeek.com/tmux-a-powerful-terminal-multiplexer-emulator-for- 作者:[Magesh Maruthamuthu][a] 译者:[MjSeven](https://github.com/MjSeven) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From b99105f8ccfda057a970daa16793c952d6442408 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Sun, 27 Jan 2019 11:57:47 +0800 Subject: [PATCH 143/243] PUB:20180130 tmux - A Powerful Terminal Multiplexer For Heavy Command-Line Linux User.md @MjSeven https://linux.cn/article-10480-1.html --- ...rful Terminal Multiplexer For Heavy Command-Line Linux User.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {translated/tech => published}/20180130 tmux - A Powerful Terminal Multiplexer For Heavy Command-Line Linux User.md (100%) diff --git a/translated/tech/20180130 tmux - A Powerful Terminal Multiplexer For Heavy Command-Line Linux User.md b/published/20180130 tmux - A Powerful Terminal Multiplexer For Heavy Command-Line Linux User.md similarity index 100% rename from translated/tech/20180130 tmux - A Powerful Terminal Multiplexer For Heavy Command-Line Linux User.md rename to published/20180130 tmux - A Powerful Terminal Multiplexer For Heavy Command-Line Linux User.md From 98e0f9e64e2dc20e3e042b6d989882a8d45af536 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Sun, 27 Jan 2019 12:12:00 +0800 Subject: [PATCH 144/243] PRF:20180411 How To Setup Static File Server Instantly.md @MjSeven --- ...w To Setup Static File Server Instantly.md | 87 +++++++++++-------- 1 file changed, 51 insertions(+), 36 deletions(-) diff --git a/translated/tech/20180411 How To Setup Static File Server Instantly.md b/translated/tech/20180411 How To Setup Static File Server Instantly.md index 9f31dba91e..b0f4fd29b5 100644 --- a/translated/tech/20180411 How To Setup Static File Server Instantly.md +++ b/translated/tech/20180411 How To Setup Static File Server Instantly.md @@ -1,131 +1,146 @@ -如何设置一个即时静态文件服务器 +如何即时设置一个静态文件服务器 ====== ![](https://www.ostechnix.com/wp-content/uploads/2018/04/serve-720x340.png) -曾经想通过网络共享你的文件或项目,但不知道怎么做?别担心!这里有一个名为 **serve** 的简单实用程序,可以通过网络即时共享你的文件。这个简单的实用程序会立即将你的系统变成一个静态文件服务器,允许你通过网络提供文件。你可以从任何设备访问这些文件,而不用担心它们的操作系统是什么。你所需的只是一个 Web 浏览器。这个实用程序还可以用来服务静态网站。它以前称为 “list” 或 “micri-list”,但现在名称已改为 “serve”,这更适合这个实用程序的目的。 +曾经想通过网络共享你的文件或项目,但不知道怎么做?别担心!这里有一个名为 **serve** 的简单实用程序,可以通过网络即时共享你的文件。这个简单的实用程序会立即将你的系统变成一个静态文件服务器,允许你通过网络提供文件。你可以从任何设备访问这些文件,而不用担心它们的操作系统是什么。你所需的只是一个 Web 浏览器。这个实用程序还可以用来服务静态网站。它以前称为 “list” 或 “micri-list”,但现在名称已改为 “serve”(提供),这更适合这个实用程序的目的。 ### 使用 Serve 来设置一个静态文件服务器 -要安装 "serve",首先你需要安装 NodeJS 和 NPM。参考以下链接在 Linux 中安装 NodeJS 和 NPM。 +要安装 serve,首先你需要安装 NodeJS 和 NPM。参考以下链接在 Linux 中安装 NodeJS 和 NPM。 - * [如何在 Linux 上安装 NodeJS](https://www.ostechnix.com/install-node-js-linux/) +* [如何在 Linux 上安装 NodeJS](https://www.ostechnix.com/install-node-js-linux/) + +NodeJS 和 NPM 安装完成后,运行以下命令来安装 serve: -NodeJS 和 NPM 安装完成后,运行以下命令来安装 "serve": ``` $ npm install -g serve ``` 完成!现在是时候 serve 文件或文件夹了。 -使用 "serve" 的典型语法是: +使用 serve 的典型语法是: + ``` $ serve [options] ``` -### Serve 特定文件或文件夹 +### 提供特定文件或文件夹 + +例如,让我们共享 `Documents` 目录里的内容。为此,运行: -例如,让我们共享 **Documents** 目录里的内容。为此,运行: ``` $ serve Documents/ ``` 示例输出: + ![][2] 正如你在上图中看到的,给定目录的内容已通过两个 URL 提供网络支持。 -要从本地系统访问内容,你只需打开 Web 浏览器,输入 **** URL: +要从本地系统访问内容,你只需打开 Web 浏览器,输入 URL `http://localhost:5000/`: + ![][3] -Serve 实用程序以简单的布局显示给定目录的内容。你可以下载(右键单击文件并选择“将链接另存为...”)或只在浏览器中查看它们。 +serve 实用程序以简单的布局显示给定目录的内容。你可以下载(右键单击文件并选择“将链接另存为...”)或只在浏览器中查看它们。 + +如果想要在浏览器中自动打开本地地址,使用 `-o` 选项。 -如果想要在浏览器中自动打开本地地址,使用 **-o** 选项。 ``` $ serve -o Documents/ ``` -运行上述命令后,Serve 实用程序将自动打开 Web 浏览器并显示共享项的内容。 +运行上述命令后,serve 实用程序将自动打开 Web 浏览器并显示共享项的内容。 -同样,要通过网络从远程系统访问共享目录,可以在浏览器地址栏中输入 ****。用你系统的 IP 替换 192.168.43.192。 +同样,要通过网络从远程系统访问共享目录,可以在浏览器地址栏中输入 `http://192.168.43.192:5000`。用你系统的 IP 替换 192.168.43.192。 -**通过不同的端口 Serve 内容** +### 通过不同的端口提供内容 + +你可能已经注意到,默认情况下,serve 实用程序使用端口 5000。因此,确保防火墙或路由器中允许使用端口 5000。如果由于某种原因被阻止,你可以使用 `-p` 选项使用不同端口来提供内容。 -你可能已经注意到,默认情况下,serve 实用程序使用端口 **5000**。因此,确保防火墙或路由器中允许使用端口 5000。如果由于某种原因被阻止,你可以使用 **-p** 选项使用不同端口来提供内容。 ``` $ serve -p 1234 Documents/ ``` -上面的命令将通过端口 **1234** 提供 Documents 目录的内容。 +上面的命令将通过端口 1234 提供 `Documents` 目录的内容。 + ![][4] 要提供文件而不是文件夹,只需给它完整的路径,如下所示。 + ``` $ serve Documents/Papers/notes.txt ``` 只要知道路径,网络上的任何用户都可以访问共享目录的内容。 -**Serve 整个 $HOME 目录** +### 提供整个 `$HOME` 目录 打开终端输入 + ``` $ serve ``` -这将通过网络共享整个 $HOME 目录的内容。 +这将通过网络共享整个 `$HOME` 目录的内容。 -要停止共享,按下 **CTRL+C**。 +要停止共享,按下 `CTRL+C`。 -**Serve 选择的文件或文件夹** +### 提供选定的文件或文件夹 + +你可能不想共享所有文件或目录,只想共享其中的一些。你可以使用 `-i` 选项排除文件或目录。 -你可能不想共享所有文件或目录,只想共享其中的一些。你可以使用 **-i** 选项排除文件或目录。 ``` $ serve -i Downloads/ ``` -以上命令将 serve 整个文件系统,除了 **Downloads** 目录。 +以上命令将提供整个文件系统,除了 `Downloads` 目录。 -**仅在本地主机上提供内容** +### 仅在本地主机上提供内容 + +有时,你只想在本地系统而不是整个网络上提供内容。为此,使用 `-l` 标志,如下所示: -有时,你只想在本地系统而不是整个网络上 serve 内容。为此,使用 **-l** 标志,如下所示: ``` $ serve -l Documents/ ``` -此命令会仅在本地提供 **Documents** 目录。 +此命令会仅在本地提供 `Documents` 目录。 ![][5] 当你在共享服务器上工作时,这可能会很有用。系统中的所有用户都可以访问共享,但远程用户不能。 -**使用 SSL Serve 内容** +### 使用 SSL 提供内容 + +由于我们通过本地网络提供内容,因此我们不需要使用 SSL。但是,serve 实用程序可以使用 `-ssl` 选项来使用 SSL 共享内容。 -由于我们通过本地网络 serve 内容,因此我们不需要使用 SSL。但是,serve 实用程序可以使用 **-ssl** 选项来使用 SSL 共享内容。 ``` $ serve --ssl Documents/ ``` ![][6] -要通过 Web 浏览器访问共享,输入 “ 或 “. +要通过 Web 浏览器访问共享,输入 `https://localhost:5000` 或 `https://ip:5000`。 ![][7] -**通过身份验证 Serve 内容** +### 通过身份验证提供内容 -在上面的所以示例中,我们在没有任何身份验证的情况下 serve 内容,所以网络上的任何人都可以在没有任何身份验证的情况下访问共享内容。你可能会觉得应该使用用户名和密码访问某些内容。 +在上面的所有示例中,我们在没有任何身份验证的情况下提供内容,所以网络上的任何人都可以在没有任何身份验证的情况下访问共享内容。你可能会觉得应该使用用户名和密码访问某些内容。 为此,使用: + ``` $ SERVE_USER=ostechnix SERVE_PASSWORD=123456 serve --auth ``` -现在用户需要输入用户名(即 **ostechnix**)和密码(123456)来访问共享。(译者注:123456 是非常不好的密码,仅在实验情况下使用) +现在用户需要输入用户名(即 `ostechnix`)和密码(`123456`)来访问共享。(LCTT 译注:123456 是非常不好的密码,仅在实验情况下使用) ![][8] -Serve 实用程序还有一些其它功能,例如禁用 [**Gzip 压缩**][9],设置 **CORS** 头以允许来自任河源的请求,防止自动复制地址到剪贴板等。通过以下命令,你可以阅读完整的帮助部分。 +serve 实用程序还有一些其它功能,例如禁用 [Gzip 压缩][9],设置 CORS 头以允许来自任河源的请求,防止自动复制地址到剪贴板等。通过以下命令,你可以阅读完整的帮助部分。 + ``` $ serve help ``` @@ -134,18 +149,18 @@ $ serve help 共勉! -来源: +资源: - * [Serve GitHub 仓库](https://github.com/zeit/serve) +* [Serve GitHub 仓库](https://github.com/zeit/serve) -------------------------------------------------------------------------------- via: https://www.ostechnix.com/how-to-setup-static-file-server-instantly/ 作者:[SK][a] -译者:[MjSeven](https://github.com/MjSeven) -校对:[校对者ID](https://github.com/校对者ID) 选题:[lujun9972](https://github.com/lujun9972) +译者:[MjSeven](https://github.com/MjSeven) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 00e2b892160a54ca64b59beadfe183f1f8080c1e Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Sun, 27 Jan 2019 13:48:51 +0800 Subject: [PATCH 145/243] PUB:20180411 How To Setup Static File Server Instantly.md @MjSeven https://linux.cn/article-10481-1.html --- .../20180411 How To Setup Static File Server Instantly.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {translated/tech => published}/20180411 How To Setup Static File Server Instantly.md (100%) diff --git a/translated/tech/20180411 How To Setup Static File Server Instantly.md b/published/20180411 How To Setup Static File Server Instantly.md similarity index 100% rename from translated/tech/20180411 How To Setup Static File Server Instantly.md rename to published/20180411 How To Setup Static File Server Instantly.md From eeecde4bfb28fab43dc53adb1830963c8b653c72 Mon Sep 17 00:00:00 2001 From: qhwdw <33189910+qhwdw@users.noreply.github.com> Date: Sun, 27 Jan 2019 14:30:13 +0800 Subject: [PATCH 146/243] Translating by qhwdw --- ...0120203 Computer Laboratory - Raspberry Pi- Lesson 3 OK03.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20120203 Computer Laboratory - Raspberry Pi- Lesson 3 OK03.md b/sources/tech/20120203 Computer Laboratory - Raspberry Pi- Lesson 3 OK03.md index c6724ff672..9795a43296 100644 --- a/sources/tech/20120203 Computer Laboratory - Raspberry Pi- Lesson 3 OK03.md +++ b/sources/tech/20120203 Computer Laboratory - Raspberry Pi- Lesson 3 OK03.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (qhwdw) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From dc60fdd61bcf75932c68e16c61c9290e8150a5c6 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Sun, 27 Jan 2019 17:21:00 +0800 Subject: [PATCH 147/243] APL:20190118 Top 5 Linux Server Distributions.md --- sources/tech/20190118 Top 5 Linux Server Distributions.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20190118 Top 5 Linux Server Distributions.md b/sources/tech/20190118 Top 5 Linux Server Distributions.md index 0cb6e83247..d9f2edf6d9 100644 --- a/sources/tech/20190118 Top 5 Linux Server Distributions.md +++ b/sources/tech/20190118 Top 5 Linux Server Distributions.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (wxy) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From b6af3c1bdf0bf07f16deb32f0f8b0c4553339d28 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Sun, 27 Jan 2019 19:21:17 +0800 Subject: [PATCH 148/243] TSD:20190118 Top 5 Linux Server Distributions.md --- ...190118 Top 5 Linux Server Distributions.md | 264 ++++++------------ 1 file changed, 93 insertions(+), 171 deletions(-) diff --git a/sources/tech/20190118 Top 5 Linux Server Distributions.md b/sources/tech/20190118 Top 5 Linux Server Distributions.md index d9f2edf6d9..b263bb3b89 100644 --- a/sources/tech/20190118 Top 5 Linux Server Distributions.md +++ b/sources/tech/20190118 Top 5 Linux Server Distributions.md @@ -7,235 +7,157 @@ [#]: via: (https://www.linux.com/blog/learn/2019/1/top-5-linux-server-distributions) [#]: author: (Jack Wallen https://www.linux.com/users/jlwallen) -Top 5 Linux Server Distributions +另一种 5 个顶级 Linux 服务器发行版 ====== + +> Jack Wallen 为 Linux 服务器发行版提供了一些可靠的选择,绝对值回票价。 + ![](https://www.linux.com/sites/lcom/files/styles/rendered_file/public/rockstor-main.jpg?itok=VNvfEIlf) -Ah, the age-old question: Which Linux distribution is best suited for servers? Typically, when this question is asked, the standard responses pop up: +啊,这个古老的问题:哪种 Linux 发行版最适合做服务器?通常,问这种问题时,所浮现出来的标准的答复就是: * RHEL - * SUSE - - * Ubuntu Server - + * Ubuntu 服务器 * Debian - * CentOS +然而,假如你将眼界放得更宽(不将服务器只看做是 IDC 托管的那种互联网服务器时),可能答案会有点不同。我准备稍微来点不同的。我想做出一个满足入选标准的发行版列表,这些发行版不仅是优秀的候选者,而且易于使用,可以为你的业务中的许多功能提供服务。在某些情况下,我选择的是一些替代品,可以取代其它需要一些工作才能达成要求的操作系统。 - - -However, in the name of opening your eyes to maybe something a bit different, I’m going to approach this a bit differently. I want to consider a list of possible distributions that are not only outstanding candidates but also easy to use, and that can serve many functions within your business. In some cases, my choices are drop-in replacements for other operating systems, whereas others require a bit of work to get them up to speed. - -Some of my choices are community editions of enterprise-grade servers, which could be considered gateways to purchasing a much more powerful platform. You’ll even find one or two entries here to be duty-specific platforms. Most importantly, however, what you’ll find on this list isn’t the usual fare. +我的一些选择是企业级服务器的社区版本,它们可以被视为购买更强大平台的入门级产品。你甚至可以在这里找到一两个作为特定任务平台的候选者。然而,最重要的是,你在此列表中找到的并非寻常的泛泛之辈。 ### ClearOS -What is ClearOS? For home and small business usage, you might not find a better solution. Out of the box, ClearOS includes tools like intrusion detection, a strong firewall, bandwidth management tools, a mail server, a domain controller, and much more. What makes ClearOS stand out above some of the competition is its purpose is to server as a simple Home and SOHO server with a user-friendly, graphical web-based interface. From that interface, you’ll find an application marketplace (Figure 1), with hundreds of apps (some of which are free, whereas some have an associated cost), that makes it incredibly easy to extend the ClearOS featureset. In other words, you make ClearOS the platform your home and small business needs it to be. Best of all, unlike many other alternatives, you only pay for the software and support you need. +什么是 ClearOS?对于家庭和小型企业用途,你可能找不到比它更好的解决方案。ClearOS 开箱即用,包括了入侵检测、强大的防火墙、带宽管理工具、邮件服务器、域控制器等工具。其目的是将服务器作为一个简单的家庭和 SOHO 服务器,并具有用户友好的基于 Web 的图形化界面,这使得 ClearOS 在某些评比中脱颖而出。从其界面中,你可以找到一个应用程序市场(图 1),其中包含数百个应用程序(其中一些是免费的,而另一些则具有相关费用),这使得扩展 ClearOS 功能集非常容易。换句话说,你可以将 ClearOS 作为你的家庭和小型企业所需的平台。最重要的是,与许多其他替代方案不同,你只需支付所需的软件和支持。 + ![](https://www.linux.com/sites/lcom/files/styles/rendered_file/public/clearos.jpg?itok=knQkn5ch) -There are three different editions of ClearOS: - * [ClearOS Community][1] - the free edition of ClearOS +*图 1:ClearOS 应用程序市场* - * [ClearOS Home][2] - ideal for home offices +有三种版本的 ClearOS: - * [ClearOS Business][3] - ideal for small businesses, due to the inclusion of paid support + * [ClearOS Community][1] - 免费版 ClearOS + * [ClearOS Home][2] - 适于家庭办公 + * [ClearOS Business][3] - 适于小型企业,包括了付费支持。 +为了使软件安装更加容易,ClearOS 应用市场允许你通过以下方式进行选择软件: +   * 按功能(根据任务显示应用程序) +   * 按类别(显示相关应用程序组) +   * 快速选择文件(允许你按预先配置的模板选择,以帮助你快速启动和运行) +换句话说,如果你正在寻找 Linux 的家庭、SOHO 或 SMB 服务器,ClearOS 是一个出色的选择(特别是如果你没有启动和运行标准的 Linux 服务器的能力时)。 -To make the installation of software even easier, the ClearOS marketplace allows you to select via: +### Fedora 服务器 - * By Function (which displays apps according to task) +你肯定听说过 Fedora Linux。它是市场上最好的前沿发行版之一。但是你知道这个出色的 Fedora 桌面发行版的开发者们也开发了服务器版吗?Fedora 服务器平台是一个短生命周期的、社区支持的服务器操作系统。这使得经验丰富的、或对任何类型的 Linux(或任何操作系统)有经验的系统管理员,可以使用开源社区中提供的最新技术。在这段描述中有三个关键词: - * By Category (which displays groups of related apps) + * 经验丰富 + * 系统 + * 管理员 - * Quick Select File (which allows you to select pre-configured templates to get you up and running fast) - - - - -In other words, if you’re looking for a Linux Home, SOHO, or SMB server, ClearOS is an outstanding choice (especially if you don’t have the Linux chops to get a standard server up and running). - -### Fedora Server - -You’ve heard of Fedora Linux. Of course you have. It’s one of the finest bleeding edge distributions on the market. But did you know the developers of that excellent Fedora Desktop distribution also has a Server edition? The Fedora Server platform is a short-lifecycle, community-supported server OS. This take on the server operating system enables seasoned system administrators, experienced with any flavor of Linux (or any OS at all), to make use of the very latest technologies available in the open source community. There are three key words in that description: - - * Seasoned - - * System - - * Administrators - - - - -In other words, new users need not apply. Although Fedora Server is quite capable of handling any task you throw at it, it’s going to require someone with a bit more Linux kung fu to make it work and work well. One very nice inclusion with Fedora Server is that, out of the box, it includes one of the finest open source, web-based interface for servers on the market. With Cockpit (Figure 2) you get a quick glance at system resources, logs, storage, network, as well as the ability to manage accounts, services, applications, and updates. +换言之,新用户就不要考虑了。虽然 Fedora 服务器完全能够处理你抛出的任何任务,但它需要一些拥有更多的 Linux 功夫的人来使它工作并且运行良好。Fedora 服务器非常好的一点是,开箱即用,它包括了市场上用于服务器的开源的基于 Web 的最好的界面之一。通过 Cockpit(图 2),你可以快速浏览系统资源、日志、存储、网络以及拥有管理帐户、服务、应用程序和更新的能力。 ![Fedora Server][5] -Figure 2: Cockpit running on Fedora Server. +*图 2:运行在 Fedora 服务器上的 Cockpit* -[Used with permission][6] - -If you’re okay working with bleeding edge software, and want an outstanding admin dashboard, Fedora Server might be the platform for you. +如果你可以使用最前沿的软件,并想要一个出色的管理仪表板,Fedora 服务器可能就是你要的平台。 ### NethServer -NethServer is about as no-brainer of a drop-in SMB Linux server as you’ll find. With the latest iteration of NethServer, your small business will enjoy: +正如你所发现的那样,NethServer 是每个人都知道的简单 SMB Linux 服务器。通过 NethServer 的最新版本,你的小型企业将得到: - * Built-in Samba Active Directory Controller + * 内置 Samba 活动目录控制器 +   * 与 Nextcloud 的无缝集成 +   * 证书管理 +   * HTTPS 透明代理 +   * 防火墙 +   * 邮件服务器和过滤器 +   * Web 服务器和过滤器 +   * 群件 +   * IPS / IDS 或 VPN - * Seamless Nextcloud integration - - * Certificate management - - * Transparent HTTPS proxy - - * Firewall - - * Mail server and filter - - * Web server and filter - - * Groupware - - * IPS/IDS or VPN - - - - -All of the included features can be easily configured with a user-friendly, web-based interface that includes single-click installation of modules to expand the NethServer feature set (Figure 3) What sets NethServer apart from ClearOS is that it was designed to make the admin job easier. In other words, this platform offers much more in the way of flexibility and power. Unlike ClearOS, which is geared more toward home office and SOHO deployments, NethServer is equally at home in small business environments. +所有包含的功能都可以通过用户友好的基于 Web 的界面轻松配置,包括单击安装模块以扩展 NethServer 功能集(图 3)。NethServer 与 ClearOS 的区别在于它的设计目的是使管理工作更轻松。换句话说,这个平台提供了更多的灵活性和功能。与面向家庭办公室和 SOHO 部署的 ClearOS 不同,NethServer 在小型商业环境中用起来就像在家庭里使用一样方便。 ![NethServer][8] -Figure 3: Adding modules to NethServer. - -[Used with permission][6] +*图 3:给 NethServer 添加模块* ### Rockstor -Rockstor is a Linux and Btfrs powered advanced Network Attached Storage (NAS) and Cloud storage server that can be deployed for Home, SOHO, as well as small- and mid-sized businesses alike. With Rockstor, you get a full-blown NAS/Cloud solution with a user-friendly, web-based GUI tool that is just as easy for admins to set up as it is for users to use. Once you have Rockstor deployed, you can create pools, shares, snapshots, manage replication and users, share files (with the help of Samba, NFS, SFTP, and AFP), and even extend the featureset, thanks to add-ons (called Rock-ons). The list of Rock-ons includes: +Rockstor 是采用 Linux 和 Btfrs 的高级网络附加存储(NAS)和云存储服务器,可部署用于家庭、SOHO 以及中小型企业。借助 Rockstor,你可以获得一个完整的 NAS /云解决方案,其中包含一个用户友好的基于 Web 的 GUI 工具,管理员可以像普通用户一样轻松使用它来设置。一旦部署好了 Rockstor,你就可以创建存储池、共享、快照、管理复制和用户、共享文件(借助 Samba、NFS、SFTP 和 AFP),甚至扩展它的功能集,这要归功于附加组件(称为 Rock-ons)。Rock-ons 列表包括: - * CouchPotato (Downloader for usenet and bittorrent users) + * CouchPotato(Usenet 和 BitTorrent 用户的下载器) + * Deluge(BitTorrent 用户的电影下载器) + * EmbyServer(Emby 媒体服务器) + * Ghost(专业博主的发布平台) + * GitLab CE(Git 仓库托管和协作) + * Gogs Go Git Service(轻量级 Git 版本控制服务器和前端) + * Headphones(NZB 和 Torrent 的音乐自动下载器) + * 用于 Squeezebox 设备的罗技 Squeezebox 服务器 + * MariaDB(关系型数据管理系统) + * NZBGet(高效的 usenet 下载器) + * OwnCloud-Official(安全的文件共享和托管) + * Plexpy(基于 Python 的 Plex 用量跟踪器) + * Rocket.Chat(开源聊天平台) + * SaBnzbd(Usenet 下载器) + * Sickbeard(用于电视节目的互联网个人视频录像机) + * Sickrage(电视节目的自动视频库管理器) + * Sonarr(Usenet 和 BitTorrent 用户的个人视频录像机) + * Symform(备份设备) - * Deluge (Movie downloader for bittorrent users) - - * EmbyServer (Emby media server) - - * Ghost (Publishing platform for professional bloggers) - - * GitLab CE (Git repository hosting and collaboration) - - * Gogs Go Git Service (Lightweight Git version control server and front end) - - * Headphones (An automated music downloader for NZB and Torrent) - - * Logitech Squeezebox Server for Squeezebox Devices - - * MariaDB (Relational database management system) - - * NZBGet (Efficient usenet downloader) - - * OwnCloud-Official (Secure file sharing and hosting) - - * Plexpy (Python-based Plex Usage tracker) - - * Rocket.Chat (Open Source Chat Platform) - - * SaBnzbd (Usenet downloader) - - * Sickbeard (Internet PVR for TV shows) - - * Sickrage (Automatic Video Library Manager for TV Shows) - - * Sonarr (PVR for usenet and bittorrent users) - - * Symform (Backup service) - - - - -Rockstor also includes an at-a-glance dashboard that gives admins quick access to all the information they need about their server (Figure 4). +Rockstor 还包括了一目了然的仪表板,使管理员可以快速访问他们所需的有关其服务器的所有信息(图 4)。 ![Rockstor][10] -The Rockstor dashboard in action. - -[Used with permission][6] +*图 4: Rockstor 面板* ### Zentyal -Zentyal is another Small Business Server that does a great job of handling multiple tasks. If you’re looking for a Linux distribution that can handle the likes of: - - * Directory and Domain server - - * Mail server - - * Gateway - - * DHCP, DNS, and NTP server - - * Certification Authority +Zentyal 是另一个小型企业服务器,可以很好地处理多个任务。如果你正在寻找可以处理以下内容的 Linux 发行版: + * 目录和域服务器 + * 邮件服务器 + * 网关 + * DHCP、DNS 和 NTP 服务器 + * 认证机构(CA) * VPN + * 实时消息(IM) + * FTP 服务器 + * 反病毒 + * SSO 认证 + * 文件共享 + * RADIUS 认证 + * 虚拟化管理 + * 等等 - * Instant Messaging - - * FTP server - - * Antivirus - - * SSO authentication - - * File sharing - - * RADIUS - - * Virtualization Management - - * And more - - - - -Zentyal might be your new go-to. Zentyal has been around since 2004 and is based on Ubuntu Server, so it enjoys a rock-solid base and plenty of applications. And with the help of the Zentyal dashboard (Figure 5), admins can easily manage: - - * System - - * Network - - * Logs - - * Software updates and installation - - * Users/groups - - * Domains - - * File sharing - - * Mail +Zentyal 可能是你的新选择。从 2004 年 Zentyal 就存在了,它基于 Ubuntu Server,因此它拥有坚实的基础和丰富的应用程序。在 Zentyal 仪表板的帮助下(图 5),管理员可以轻松管理: + * 系统 + * 网络 + * 日志 + * 软件更新和安装 + * 用户/组 + * 域 + * 文件共享 + * 邮件 * DNS - - * Firewall - - * Certificates - - * And much more + * 防火墙 + * 证书 + * 等等 ![](https://www.linux.com/sites/lcom/files/styles/rendered_file/public/zentyal.jpg?itok=Un9lpgh6) +*图 5:Zentyal 仪表板* -Adding new components to the Zentyal server is as simple as opening the Dashboard, clicking on Software Management > Zentyal Components, selecting what you want to add, and clicking Install. The one issue you might find with Zentyal is that it doesn’t offer nearly the amount of addons as you’ll find in the likes of Nethserver and ClearOS. But the services it does offer, Zentyal does incredibly well. +向 Zentyal 服务器添加新组件只需要打开仪表板,单击“软件管理” -> “Zentyal 组件”,选择要添加的组件,然后单击安装。Zentyal 可能会遇到的一个问题是,它提供不了与 Nethserver 和 ClearOS 一样多的插件。但它提供的服务,则做得非常好。 -### Plenty More Where These Came From +### 更多来自于 -This list of Linux servers is clearly not exhaustive. What it is, however, is a unique look at the top five server distributions you’ve probably not heard of. Of course, if you’d rather opt to use a more traditional Linux server distribution, you can always stick with [CentOS][11], [Ubuntu Server][12], [SUSE][13], [Red Hat Enterprise Linux][14], or [Debian][15]… most of which are found on every list of best server distributions on the market. If, however, you’re looking for something a bit different, give one of these five distos a try. +这个 Linux 服务器列表显然不是详尽无遗的。然而,这是一种对你可能没有听说过的五大服务器发行版的独特视角。当然,如果你更愿意使用更传统的 Linux 服务器发行版,你可以随时坚持使用 [CentOS][11]、[Ubuntu 服务器][12]、[SUSE][13]、[RHEL][14] 或 [Debian][15]……它们大多都出现在市场上最好的服务器发行版列表中。但是,如果你正在寻找一些不同的东西,那么试试这五个发行版中的一个。 -Learn more about Linux through the free ["Introduction to Linux" ][16]course from The Linux Foundation and edX. +通过 Linux 基金会和 edX 的免费[“Linux 简介”][16]课程了解有关 Linux 的更多信息。 -------------------------------------------------------------------------------- @@ -243,7 +165,7 @@ via: https://www.linux.com/blog/learn/2019/1/top-5-linux-server-distributions 作者:[Jack Wallen][a] 选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) +译者:[wxy](https://github.com/wxy) 校对:[校对者ID](https://github.com/校对者ID) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 8fb365cd29425beb3c48097ea92271c00b2a9f4e Mon Sep 17 00:00:00 2001 From: ZmJ <1352252181@qq.com> Date: Sun, 27 Jan 2019 19:28:10 +0800 Subject: [PATCH 149/243] TSD: 20150717 The History of Hello World --- .../20150717 The History of Hello World.md | 143 ----------------- .../20150717 The History of Hello World.md | 147 ++++++++++++++++++ 2 files changed, 147 insertions(+), 143 deletions(-) delete mode 100644 sources/tech/20150717 The History of Hello World.md create mode 100644 translated/tech/20150717 The History of Hello World.md diff --git a/sources/tech/20150717 The History of Hello World.md b/sources/tech/20150717 The History of Hello World.md deleted file mode 100644 index 9211e9f40f..0000000000 --- a/sources/tech/20150717 The History of Hello World.md +++ /dev/null @@ -1,143 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (The History of Hello World) -[#]: via: (https://www.thesoftwareguild.com/blog/the-history-of-hello-world/) -[#]: author: (thussong https://www.thesoftwareguild.com/blog/author/thussong/) - -The History of Hello World -====== - - -Veteran software developers know the [Hello World][2] program as the first step in learning to code. The program, which outputs some variant of “Hello, World!” on a device’s display, can be created in most languages, making it some of the most basic syntax involved in the coding process. In fact, a recent project at the Association for Computing Machinery (ACM) at Louisiana Tech [found][3] that there are at least 204 versions of the program. - -Traditionally, Hello World programs are used to illustrate how the process of coding works, as well as to ensure that a language or system is operating correctly. They are usually the first programs that new coders learn, because even those with little or no experience can execute Hello World both easily and correctly. - -Above all, Hello World is simple. That’s why it is so often used as a barometer of program success. If Hello World does not work effectively within the framework, then it is likely that other, more complex programs will also fail. As one expert at [Win-Vector][4] puts it, Hello World is actually a confrontational program. “The author is saying ‘it isn’t obvious your computer system will work, so I am not going to invest a lot of time in it until I see it can at least print one line of text,’” Win-Vector blogger John Mount says. - -But this two-word phrase has big implications for the field of computer science. With Hello World as a foundation, novice programmers can easily understand computer science principles or elements. And professionals with years of coding experience can use it to learn how a given programming language works, especially in terms of structure and syntax. With applications at all skill levels and in almost every language, there is a long history behind such a short program. - -### Uses - -The main use for Hello World programs was outlined above: It is a way for rookie coders to become acquainted with a new language. However, the applications of these programs go beyond an introduction to the coding world. Hello World can, for example, be used as a sanity test to make sure that the components of a language (its compiler, development and run-time environment) have been correctly installed. Because the process involved in configuring a complete programming toolchain is lengthy and complex, a simple program like Hello World is often used as a first-run test on a new toolchain. - -Hackers also use Hello World “as proof of concept that arbitrary code can be executed through an exploit where the system designers did not intend code to be executed,” according to programming consultants at Cunningham & Cunningham (C2). In fact, it’s the first step in using homemade content, or “home brew” on a device. When [experienced coders][5] are configuring an environment or learning a previously unknown one, they verify that Hello World behaves correctly. - -It is also used as part of the debugging process, allowing programmers to check that they are editing the right aspect of a modifiable program at runtime and that it is being reloaded. - -One more popular use for Hello World is as a basis for comparison. Coders can “compare the size of the executable that the language generates, and how much supporting infrastructure must exist behind the program for it to execute,” according to C2’s wiki. - -### Beginnings - -Though the origins of Hello World remain somewhat unclear, its use as a test phrase is widely believed to have begun with Brian Kernigham’s 1972 book, A Tutorial Introduction to the Language B. In this text, the first known version of the program was used to illustrate external variables. Because the previous example in the tutorial printed “hi!” on the terminal, the more complex “hello, world!” required more character constants for expression and was the next step in the learning process. - -From there, it was used in a Bell Laboratories memo in 1974, as well as The C Programming Language in 1978. This popular text is what made Hello World famous. The example from that book (the first, and most pure, example) printed “hello, world,” with no capital letters or exclamation point. At this time, Hello World was used almost solely to illustrate a few functions of a language— not to test whether the system was running. - -Before Kernigham’s seminal texts on B and C, there was no standard first program. Even as late as 1972, it was not widely in use. The popular BASIC tutorial, “My Computer Likes Me, When I Speak in Basic,” starts with a simple program that writes a line of text. However, this message was “MY HUMAN UNDERSTANDS ME,” far from the two-word greeting programmers use today. But once Hello World was invented, it spread quickly, becoming well-known by the late 1970s. Its popularity continues to this day. - -### One Statement, Many Languages - -Here’s what the code for Hello World looks like in some of the most popular programming languages currently in use. - -#### Java - -``` -class HelloWorld { -public static void main(String[] args) { -System.out.println("Hello, world!"); -} -} -``` - -#### C# - -``` -using System; -class Program -{ -public static void Main(string[] args) -{ -Console.WriteLine("Hello, world!"); -} -} -``` - -#### Python - -``` -print("Hello, world!") -``` - -#### Ruby - -``` -puts "Hello, world!" -``` - -#### Scala - -``` -object HelloWorld extends App { -println("Hello, world!") -} -``` - -#### ASP.NET - -`Response.Write("Hello World!");` - -#### Lisp - -``` -(princ "Hello, world!") -``` - -#### Haskell - -``` -main = putStrLn "Hello, world!" -``` - -#### Malbolge - -``` -('&%:9]!~}|z2Vxwv-,POqponl$Hjig%eB@@>}= -``` - -#### Go - -``` -package main -import "fmt" -func main() { -fmt.Println("Hello, world!") -} -``` - -### Hello World Today: A Standard Practice in Varied Forms - -In modern coding languages, Hello World is deployed at different levels of sophistication. For example, the Go language introduced a multilingual Hello World program, and XL features a spinning, 3D version complete with graphics. Some languages, like Ruby and Python, need only a single statement to print “hello world,” but a low-level assembly language could require several commands to do so. Modern languages also introduce variations in punctuation and casing. These include the presence or absence of the comma and exclamation point, as well as the capitalization of both words. For example, when systems only support capital letters, the phrase appears as “HELLO WORLD.” The first nontrivial Malbolge program printed “HEllO WORld.” Variations go beyond the literal as well. In functional languages like Lisp and Haskell, factorial programs are substituted for Hello World to emphasize recursive techniques. This is different from the original examples, which emphasized I/O and produced side effects. - -With the increasing complexity of modern coding languages, Hello World is more important than ever. Both as a test and a teaching tool, it has become a standardized way of allowing programmers to configure their environment. No one can be sure why Hello World has stood the test of time in an industry known for rapid-fire innovation, but it is here to stay. - --------------------------------------------------------------------------------- - -via: https://www.thesoftwareguild.com/blog/the-history-of-hello-world/ - -作者:[thussong][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.thesoftwareguild.com/blog/author/thussong/ -[b]: https://github.com/lujun9972 -[1]: https://www.linkedin.com/shareArticle?mini=true&url=https%3A%2F%2Fwww.thesoftwareguild.com%2Fblog%2Fthe-history-of-hello-world%2F&title=The%20History%20of%20Hello%20World -[2]: http://en.wikipedia.org/wiki/%22Hello,_World!%22_program -[3]: http://whatis.techtarget.com/definition/Hello-World -[4]: http://www.win-vector.com/blog/2008/02/hello-world-an-instance-rhetoric-in-computer-science/ -[5]: http://c2.com/cgi/wiki?HelloWorld diff --git a/translated/tech/20150717 The History of Hello World.md b/translated/tech/20150717 The History of Hello World.md new file mode 100644 index 0000000000..514f24d109 --- /dev/null +++ b/translated/tech/20150717 The History of Hello World.md @@ -0,0 +1,147 @@ +[#]: collector: "lujun9972" +[#]: translator: "zzzzzzmj" +[#]: reviewer: " " +[#]: publisher: " " +[#]: url: " " +[#]: subject: "The History of Hello World" +[#]: via: "https://www.thesoftwareguild.com/blog/the-history-of-hello-world/" +[#]: author: "thussong https://www.thesoftwareguild.com/blog/author/thussong/" + + + +# Hello World 的由来 + +资深软件开发人员都知道[Hello world](2)程序,一个能被输出多种"Hello, World!"的程序,是学习编程的第一步。这个编程中只涉及到一些最基本语法的程序,可以被大多数语言输出在显示器上。事实上,路易斯安纳理工学院计算机协会(ACM)在最近统计[发现](3)这个项目至少有204个版本。 + +传统意义上,Hello World程序是用于说明编码过程是如何工作的,以及确保语言或系统能正常运行。它们经常是新手程序员学习的第一个程序,因为即使是经验很少或者没有经验的人也能轻松正确的执行Hello World。 + +首先,Hello World 简单,这就是为什么它经常被用做程序执行成功的晴雨表。如果Hello World在框架中无法有效执行,那么在其他更复杂的程序中也可能会失败。正如[Win-Vector](4)的一位专家所说,"Hello World实际上是一个对抗性程序"。该作者还说道,"你的计算机系统没有工作并不起眼,所有我们不会花很多时间在上面,不过我要看到它至少能打印一行文字"。 + +但是 这个两词短语在计算机科学领域有着重大的影响。以Hello World为基础,新手程序员可以轻松的去理解计算机科学原理,而拥有多年编码经验的程序员可以用它来学习编程语言的工作原理,特别是在结构与语言方面。这样的一个小程序,在任何难度和几乎所有的语言的应用程序中都有着悠久的历史。 + +### 用途 + +上文中一句话概括Hello World程序的主要用途:这是新手程序员熟悉新语言的一种方式。然而,这些程序不仅仅是对编码世界的介绍。例如,Hello World 可以作为测试,以确保语言的组件(编译器,开发和运行环境)安装正确。因为配置完整的编程工具链的过程复杂而漫长,所以像Hello World这样简单的程序通常用作新工具的首次运行测试。 + +根据Cunningham & Cunningham (C2)的编程顾问所说, 黑客经常使用Hello World程序, 来证明猜想,因为任何代码都可以通过漏洞执行,而系统设计人员并不允许执行代码。事实上,它是在设备上使用自制内容或者“home brew”的第一步, 当[有经验的编码人员](5)正在配置环境或在学习新事物时,他们会Hello World 来验证动作是否正确。 + +它也是作为调试的一部分,允许程序员在程序运行时检查他么编辑修改了的地方是否正确,然后重新加载。 + +Hello World的一个更常用的用途是作为基础的比较。根据C2的wiki所讲,程序员可以比较语言生成的可执行文件的大小,以及程序背后必须存在多少支持基础结构才能执行。 + +### 开端 + +虽然Hello World 的起源还有些不太明了,不过人们普遍认为它是作为测试用语,最早出现在Brian Kernigham 在1972年发布的B语言教程简介中。在此文中,该程序的第一个已知版本用于说明外部变量。因为教程中的前一个例子在终端上打印了“hi!”,而需要更多字符常量来表达相对复杂的“hello,world!”,是学习过程的下一步。 + +在那以后,它还被用于1974年的贝尔实验室备忘录,以及1987年的C语言程序设计。这两篇著名的文章是让Hello World闻名于世的主要原因。在书中的一个例子(第一个也是最著名的例子)打印了没有大写字母和感叹号的“hello,world”,此时的Hello World几乎只是用于说明语言的一些功能,而不是测试系统是否正常运行。 + +在Kernigham的关于B语言和C语言的开创性文章之前,没有真正意义上的第一个程序,甚至直到1974年,它也没被广泛使用。著名的BASIC教程“My Computer Likes Me,When I Speak BASIC”,从一个写一行文本的简单程序开始,不过那句话是“MY HUMAN UNDERSTANDS ME”,跟如今程序员侃侃而谈的双词问候语差的有点远。不过,当Hello World被发明后,它就迅速传播,并在20世纪70年代后从所周知。直到今天它也依然受欢迎。 + +### 一个声明, 多种语言 + +以下是目前正在被使用的一些流行的编程语言中的Hello World 代码 + +#### Java + +``` +class HelloWorld { +public static void main(String[] args) { +System.out.println("Hello, world!"); +} +} +``` + +#### C# + +``` +using System; +class Program +{ +public static void Main(string[] args) +{ +Console.WriteLine("Hello, world!"); +} +} +``` + +#### Python + +``` +print("Hello, world!") +``` + +#### Ruby + +``` +puts "Hello, world!" +``` + +#### Scala + +``` +object HelloWorld extends App { +println("Hello, world!") +} +``` + +#### ASP.NET + +``` +Response.Write("Hello World!"); +``` + +#### Lisp + +``` +(princ "Hello, world!") +``` + +#### Haskell + +``` +main = putStrLn "Hello, world!" +``` + +#### Malbolge + +``` +('&%:9]!~}|z2Vxwv-,POqponl$Hjig%eB@@>}= +``` + +#### Go + +``` +package main +import "fmt" +func main() { +fmt.Println("Hello, world!") +} +``` + + + +### 如今的 Hello world: 各种形式下的标准实践 + +在现在的编程语言中,Hello world有着不同的复杂程度。例如,Go语言中引入一个多语言的Hello World程序,XL则会提供一个具有图形、可旋转的3D版本。一些编程语言,像Ruby,Python,仅仅需要一个声明去打印"Hello World",但是低级汇编语言则需要几个命令才能做到这样。现在的编程语言还引入对标点符号的支持,包括逗号或者感叹号是否存在,以及两个词的大写。举个例子,当系统只支持大写字母,会呈现像"HELLO WORLD"的短语。第一个不平凡的Malbolge程序打印出了"HEllO WORld",跨域了原本的字面意思。功能语言像Lisp、Haskell,阶乘程序替代了Hello World,从而注重递归技术。这与原来的示例不同,后者更强调I/O以及产生的副作用。 + +随着现在的编程语言越来越复杂,Hello World 比以往显得更加重要。同样作为测试和教学工具,它已经成为程序员测试配置的编程环境的标准方法。没有人能确切说出为什么Hello World能在快速创新著称的行业中经受住时间的考验,但是它又确实留下来了。 + +-------------------------------------------------------------------------------- + +via: https://www.thesoftwareguild.com/blog/the-history-of-hello-world/ + +作者:[thussong][a] +选题:[lujun9972][b] +译者:[zzzzzzmj](https://github.com/zzzzzzmj) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.thesoftwareguild.com/blog/author/thussong/ +[b]: https://github.com/lujun9972 +[1]: https://www.linkedin.com/shareArticle?mini=true&url=https%3A%2F%2Fwww.thesoftwareguild.com%2Fblog%2Fthe-history-of-hello-world%2F&title=The%20History%20of%20Hello%20World +[2]: http://en.wikipedia.org/wiki/%22Hello,_World!%22_program +[3]: http://whatis.techtarget.com/definition/Hello-World +[4]: http://www.win-vector.com/blog/2008/02/hello-world-an-instance-rhetoric-in-computer-science/ +[5]: http://c2.com/cgi/wiki?HelloWorld From 43b5a2229f831201bf6fbf9d03d5591e9749397c Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Sun, 27 Jan 2019 19:45:02 +0800 Subject: [PATCH 150/243] TSD:20190118 Top 5 Linux Server Distributions --- ...190118 Top 5 Linux Server Distributions.md | 268 ------------------ ...190118 Top 5 Linux Server Distributions.md | 190 +++++++++++++ 2 files changed, 190 insertions(+), 268 deletions(-) delete mode 100644 sources/tech/20190118 Top 5 Linux Server Distributions.md create mode 100644 translated/tech/20190118 Top 5 Linux Server Distributions.md diff --git a/sources/tech/20190118 Top 5 Linux Server Distributions.md b/sources/tech/20190118 Top 5 Linux Server Distributions.md deleted file mode 100644 index d9f2edf6d9..0000000000 --- a/sources/tech/20190118 Top 5 Linux Server Distributions.md +++ /dev/null @@ -1,268 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (wxy) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Top 5 Linux Server Distributions) -[#]: via: (https://www.linux.com/blog/learn/2019/1/top-5-linux-server-distributions) -[#]: author: (Jack Wallen https://www.linux.com/users/jlwallen) - -Top 5 Linux Server Distributions -====== -![](https://www.linux.com/sites/lcom/files/styles/rendered_file/public/rockstor-main.jpg?itok=VNvfEIlf) - -Ah, the age-old question: Which Linux distribution is best suited for servers? Typically, when this question is asked, the standard responses pop up: - - * RHEL - - * SUSE - - * Ubuntu Server - - * Debian - - * CentOS - - - - -However, in the name of opening your eyes to maybe something a bit different, I’m going to approach this a bit differently. I want to consider a list of possible distributions that are not only outstanding candidates but also easy to use, and that can serve many functions within your business. In some cases, my choices are drop-in replacements for other operating systems, whereas others require a bit of work to get them up to speed. - -Some of my choices are community editions of enterprise-grade servers, which could be considered gateways to purchasing a much more powerful platform. You’ll even find one or two entries here to be duty-specific platforms. Most importantly, however, what you’ll find on this list isn’t the usual fare. - -### ClearOS - -What is ClearOS? For home and small business usage, you might not find a better solution. Out of the box, ClearOS includes tools like intrusion detection, a strong firewall, bandwidth management tools, a mail server, a domain controller, and much more. What makes ClearOS stand out above some of the competition is its purpose is to server as a simple Home and SOHO server with a user-friendly, graphical web-based interface. From that interface, you’ll find an application marketplace (Figure 1), with hundreds of apps (some of which are free, whereas some have an associated cost), that makes it incredibly easy to extend the ClearOS featureset. In other words, you make ClearOS the platform your home and small business needs it to be. Best of all, unlike many other alternatives, you only pay for the software and support you need. -![](https://www.linux.com/sites/lcom/files/styles/rendered_file/public/clearos.jpg?itok=knQkn5ch) -There are three different editions of ClearOS: - - * [ClearOS Community][1] - the free edition of ClearOS - - * [ClearOS Home][2] - ideal for home offices - - * [ClearOS Business][3] - ideal for small businesses, due to the inclusion of paid support - - - - -To make the installation of software even easier, the ClearOS marketplace allows you to select via: - - * By Function (which displays apps according to task) - - * By Category (which displays groups of related apps) - - * Quick Select File (which allows you to select pre-configured templates to get you up and running fast) - - - - -In other words, if you’re looking for a Linux Home, SOHO, or SMB server, ClearOS is an outstanding choice (especially if you don’t have the Linux chops to get a standard server up and running). - -### Fedora Server - -You’ve heard of Fedora Linux. Of course you have. It’s one of the finest bleeding edge distributions on the market. But did you know the developers of that excellent Fedora Desktop distribution also has a Server edition? The Fedora Server platform is a short-lifecycle, community-supported server OS. This take on the server operating system enables seasoned system administrators, experienced with any flavor of Linux (or any OS at all), to make use of the very latest technologies available in the open source community. There are three key words in that description: - - * Seasoned - - * System - - * Administrators - - - - -In other words, new users need not apply. Although Fedora Server is quite capable of handling any task you throw at it, it’s going to require someone with a bit more Linux kung fu to make it work and work well. One very nice inclusion with Fedora Server is that, out of the box, it includes one of the finest open source, web-based interface for servers on the market. With Cockpit (Figure 2) you get a quick glance at system resources, logs, storage, network, as well as the ability to manage accounts, services, applications, and updates. - -![Fedora Server][5] - -Figure 2: Cockpit running on Fedora Server. - -[Used with permission][6] - -If you’re okay working with bleeding edge software, and want an outstanding admin dashboard, Fedora Server might be the platform for you. - -### NethServer - -NethServer is about as no-brainer of a drop-in SMB Linux server as you’ll find. With the latest iteration of NethServer, your small business will enjoy: - - * Built-in Samba Active Directory Controller - - * Seamless Nextcloud integration - - * Certificate management - - * Transparent HTTPS proxy - - * Firewall - - * Mail server and filter - - * Web server and filter - - * Groupware - - * IPS/IDS or VPN - - - - -All of the included features can be easily configured with a user-friendly, web-based interface that includes single-click installation of modules to expand the NethServer feature set (Figure 3) What sets NethServer apart from ClearOS is that it was designed to make the admin job easier. In other words, this platform offers much more in the way of flexibility and power. Unlike ClearOS, which is geared more toward home office and SOHO deployments, NethServer is equally at home in small business environments. - -![NethServer][8] - -Figure 3: Adding modules to NethServer. - -[Used with permission][6] - -### Rockstor - -Rockstor is a Linux and Btfrs powered advanced Network Attached Storage (NAS) and Cloud storage server that can be deployed for Home, SOHO, as well as small- and mid-sized businesses alike. With Rockstor, you get a full-blown NAS/Cloud solution with a user-friendly, web-based GUI tool that is just as easy for admins to set up as it is for users to use. Once you have Rockstor deployed, you can create pools, shares, snapshots, manage replication and users, share files (with the help of Samba, NFS, SFTP, and AFP), and even extend the featureset, thanks to add-ons (called Rock-ons). The list of Rock-ons includes: - - * CouchPotato (Downloader for usenet and bittorrent users) - - * Deluge (Movie downloader for bittorrent users) - - * EmbyServer (Emby media server) - - * Ghost (Publishing platform for professional bloggers) - - * GitLab CE (Git repository hosting and collaboration) - - * Gogs Go Git Service (Lightweight Git version control server and front end) - - * Headphones (An automated music downloader for NZB and Torrent) - - * Logitech Squeezebox Server for Squeezebox Devices - - * MariaDB (Relational database management system) - - * NZBGet (Efficient usenet downloader) - - * OwnCloud-Official (Secure file sharing and hosting) - - * Plexpy (Python-based Plex Usage tracker) - - * Rocket.Chat (Open Source Chat Platform) - - * SaBnzbd (Usenet downloader) - - * Sickbeard (Internet PVR for TV shows) - - * Sickrage (Automatic Video Library Manager for TV Shows) - - * Sonarr (PVR for usenet and bittorrent users) - - * Symform (Backup service) - - - - -Rockstor also includes an at-a-glance dashboard that gives admins quick access to all the information they need about their server (Figure 4). - -![Rockstor][10] - -The Rockstor dashboard in action. - -[Used with permission][6] - -### Zentyal - -Zentyal is another Small Business Server that does a great job of handling multiple tasks. If you’re looking for a Linux distribution that can handle the likes of: - - * Directory and Domain server - - * Mail server - - * Gateway - - * DHCP, DNS, and NTP server - - * Certification Authority - - * VPN - - * Instant Messaging - - * FTP server - - * Antivirus - - * SSO authentication - - * File sharing - - * RADIUS - - * Virtualization Management - - * And more - - - - -Zentyal might be your new go-to. Zentyal has been around since 2004 and is based on Ubuntu Server, so it enjoys a rock-solid base and plenty of applications. And with the help of the Zentyal dashboard (Figure 5), admins can easily manage: - - * System - - * Network - - * Logs - - * Software updates and installation - - * Users/groups - - * Domains - - * File sharing - - * Mail - - * DNS - - * Firewall - - * Certificates - - * And much more - -![](https://www.linux.com/sites/lcom/files/styles/rendered_file/public/zentyal.jpg?itok=Un9lpgh6) - - -Adding new components to the Zentyal server is as simple as opening the Dashboard, clicking on Software Management > Zentyal Components, selecting what you want to add, and clicking Install. The one issue you might find with Zentyal is that it doesn’t offer nearly the amount of addons as you’ll find in the likes of Nethserver and ClearOS. But the services it does offer, Zentyal does incredibly well. - -### Plenty More Where These Came From - -This list of Linux servers is clearly not exhaustive. What it is, however, is a unique look at the top five server distributions you’ve probably not heard of. Of course, if you’d rather opt to use a more traditional Linux server distribution, you can always stick with [CentOS][11], [Ubuntu Server][12], [SUSE][13], [Red Hat Enterprise Linux][14], or [Debian][15]… most of which are found on every list of best server distributions on the market. If, however, you’re looking for something a bit different, give one of these five distos a try. - -Learn more about Linux through the free ["Introduction to Linux" ][16]course from The Linux Foundation and edX. - --------------------------------------------------------------------------------- - -via: https://www.linux.com/blog/learn/2019/1/top-5-linux-server-distributions - -作者:[Jack Wallen][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://www.linux.com/users/jlwallen -[b]: https://github.com/lujun9972 -[1]: https://www.clearos.com/clearfoundation/software/clearos-7-community -[2]: https://www.clearos.com/products/clearos-editions/clearos-7-home -[3]: https://www.clearos.com/products/clearos-editions/clearos-7-business -[4]: https://www.linux.com/files/images/fedoraserverjpg -[5]: https://www.linux.com/sites/lcom/files/styles/rendered_file/public/fedoraserver.jpg?itok=phaAIRXW (Fedora Server) -[6]: https://www.linux.com/licenses/category/used-permission -[7]: https://www.linux.com/files/images/nethserverjpg -[8]: https://www.linux.com/sites/lcom/files/styles/rendered_file/public/nethserver.jpg?itok=HO-CRbOV (NethServer) -[9]: https://www.linux.com/files/images/rockstorejpg -[10]: https://www.linux.com/sites/lcom/files/styles/rendered_file/public/rockstore.jpg?itok=EN_5oFxQ (Rockstor) -[11]: https://www.centos.org/ -[12]: https://www.ubuntu.com/download/server -[13]: https://www.suse.com/ -[14]: https://www.redhat.com/en/technologies/linux-platforms/enterprise-linux -[15]: https://www.debian.org/ -[16]: https://training.linuxfoundation.org/linux-courses/system-administration-training/introduction-to-linux diff --git a/translated/tech/20190118 Top 5 Linux Server Distributions.md b/translated/tech/20190118 Top 5 Linux Server Distributions.md new file mode 100644 index 0000000000..b263bb3b89 --- /dev/null +++ b/translated/tech/20190118 Top 5 Linux Server Distributions.md @@ -0,0 +1,190 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Top 5 Linux Server Distributions) +[#]: via: (https://www.linux.com/blog/learn/2019/1/top-5-linux-server-distributions) +[#]: author: (Jack Wallen https://www.linux.com/users/jlwallen) + +另一种 5 个顶级 Linux 服务器发行版 +====== + +> Jack Wallen 为 Linux 服务器发行版提供了一些可靠的选择,绝对值回票价。 + +![](https://www.linux.com/sites/lcom/files/styles/rendered_file/public/rockstor-main.jpg?itok=VNvfEIlf) + +啊,这个古老的问题:哪种 Linux 发行版最适合做服务器?通常,问这种问题时,所浮现出来的标准的答复就是: + + * RHEL + * SUSE + * Ubuntu 服务器 + * Debian + * CentOS + +然而,假如你将眼界放得更宽(不将服务器只看做是 IDC 托管的那种互联网服务器时),可能答案会有点不同。我准备稍微来点不同的。我想做出一个满足入选标准的发行版列表,这些发行版不仅是优秀的候选者,而且易于使用,可以为你的业务中的许多功能提供服务。在某些情况下,我选择的是一些替代品,可以取代其它需要一些工作才能达成要求的操作系统。 + +我的一些选择是企业级服务器的社区版本,它们可以被视为购买更强大平台的入门级产品。你甚至可以在这里找到一两个作为特定任务平台的候选者。然而,最重要的是,你在此列表中找到的并非寻常的泛泛之辈。 + +### ClearOS + +什么是 ClearOS?对于家庭和小型企业用途,你可能找不到比它更好的解决方案。ClearOS 开箱即用,包括了入侵检测、强大的防火墙、带宽管理工具、邮件服务器、域控制器等工具。其目的是将服务器作为一个简单的家庭和 SOHO 服务器,并具有用户友好的基于 Web 的图形化界面,这使得 ClearOS 在某些评比中脱颖而出。从其界面中,你可以找到一个应用程序市场(图 1),其中包含数百个应用程序(其中一些是免费的,而另一些则具有相关费用),这使得扩展 ClearOS 功能集非常容易。换句话说,你可以将 ClearOS 作为你的家庭和小型企业所需的平台。最重要的是,与许多其他替代方案不同,你只需支付所需的软件和支持。 + +![](https://www.linux.com/sites/lcom/files/styles/rendered_file/public/clearos.jpg?itok=knQkn5ch) + +*图 1:ClearOS 应用程序市场* + +有三种版本的 ClearOS: + + * [ClearOS Community][1] - 免费版 ClearOS + * [ClearOS Home][2] - 适于家庭办公 + * [ClearOS Business][3] - 适于小型企业,包括了付费支持。 + +为了使软件安装更加容易,ClearOS 应用市场允许你通过以下方式进行选择软件: + +   * 按功能(根据任务显示应用程序) +   * 按类别(显示相关应用程序组) +   * 快速选择文件(允许你按预先配置的模板选择,以帮助你快速启动和运行) + +换句话说,如果你正在寻找 Linux 的家庭、SOHO 或 SMB 服务器,ClearOS 是一个出色的选择(特别是如果你没有启动和运行标准的 Linux 服务器的能力时)。 + +### Fedora 服务器 + +你肯定听说过 Fedora Linux。它是市场上最好的前沿发行版之一。但是你知道这个出色的 Fedora 桌面发行版的开发者们也开发了服务器版吗?Fedora 服务器平台是一个短生命周期的、社区支持的服务器操作系统。这使得经验丰富的、或对任何类型的 Linux(或任何操作系统)有经验的系统管理员,可以使用开源社区中提供的最新技术。在这段描述中有三个关键词: + + * 经验丰富 + * 系统 + * 管理员 + +换言之,新用户就不要考虑了。虽然 Fedora 服务器完全能够处理你抛出的任何任务,但它需要一些拥有更多的 Linux 功夫的人来使它工作并且运行良好。Fedora 服务器非常好的一点是,开箱即用,它包括了市场上用于服务器的开源的基于 Web 的最好的界面之一。通过 Cockpit(图 2),你可以快速浏览系统资源、日志、存储、网络以及拥有管理帐户、服务、应用程序和更新的能力。 + +![Fedora Server][5] + +*图 2:运行在 Fedora 服务器上的 Cockpit* + +如果你可以使用最前沿的软件,并想要一个出色的管理仪表板,Fedora 服务器可能就是你要的平台。 + +### NethServer + +正如你所发现的那样,NethServer 是每个人都知道的简单 SMB Linux 服务器。通过 NethServer 的最新版本,你的小型企业将得到: + + * 内置 Samba 活动目录控制器 +   * 与 Nextcloud 的无缝集成 +   * 证书管理 +   * HTTPS 透明代理 +   * 防火墙 +   * 邮件服务器和过滤器 +   * Web 服务器和过滤器 +   * 群件 +   * IPS / IDS 或 VPN + +所有包含的功能都可以通过用户友好的基于 Web 的界面轻松配置,包括单击安装模块以扩展 NethServer 功能集(图 3)。NethServer 与 ClearOS 的区别在于它的设计目的是使管理工作更轻松。换句话说,这个平台提供了更多的灵活性和功能。与面向家庭办公室和 SOHO 部署的 ClearOS 不同,NethServer 在小型商业环境中用起来就像在家庭里使用一样方便。 + +![NethServer][8] + +*图 3:给 NethServer 添加模块* + +### Rockstor + +Rockstor 是采用 Linux 和 Btfrs 的高级网络附加存储(NAS)和云存储服务器,可部署用于家庭、SOHO 以及中小型企业。借助 Rockstor,你可以获得一个完整的 NAS /云解决方案,其中包含一个用户友好的基于 Web 的 GUI 工具,管理员可以像普通用户一样轻松使用它来设置。一旦部署好了 Rockstor,你就可以创建存储池、共享、快照、管理复制和用户、共享文件(借助 Samba、NFS、SFTP 和 AFP),甚至扩展它的功能集,这要归功于附加组件(称为 Rock-ons)。Rock-ons 列表包括: + + * CouchPotato(Usenet 和 BitTorrent 用户的下载器) + * Deluge(BitTorrent 用户的电影下载器) + * EmbyServer(Emby 媒体服务器) + * Ghost(专业博主的发布平台) + * GitLab CE(Git 仓库托管和协作) + * Gogs Go Git Service(轻量级 Git 版本控制服务器和前端) + * Headphones(NZB 和 Torrent 的音乐自动下载器) + * 用于 Squeezebox 设备的罗技 Squeezebox 服务器 + * MariaDB(关系型数据管理系统) + * NZBGet(高效的 usenet 下载器) + * OwnCloud-Official(安全的文件共享和托管) + * Plexpy(基于 Python 的 Plex 用量跟踪器) + * Rocket.Chat(开源聊天平台) + * SaBnzbd(Usenet 下载器) + * Sickbeard(用于电视节目的互联网个人视频录像机) + * Sickrage(电视节目的自动视频库管理器) + * Sonarr(Usenet 和 BitTorrent 用户的个人视频录像机) + * Symform(备份设备) + +Rockstor 还包括了一目了然的仪表板,使管理员可以快速访问他们所需的有关其服务器的所有信息(图 4)。 + +![Rockstor][10] + +*图 4: Rockstor 面板* + +### Zentyal + +Zentyal 是另一个小型企业服务器,可以很好地处理多个任务。如果你正在寻找可以处理以下内容的 Linux 发行版: + + * 目录和域服务器 + * 邮件服务器 + * 网关 + * DHCP、DNS 和 NTP 服务器 + * 认证机构(CA) + * VPN + * 实时消息(IM) + * FTP 服务器 + * 反病毒 + * SSO 认证 + * 文件共享 + * RADIUS 认证 + * 虚拟化管理 + * 等等 + +Zentyal 可能是你的新选择。从 2004 年 Zentyal 就存在了,它基于 Ubuntu Server,因此它拥有坚实的基础和丰富的应用程序。在 Zentyal 仪表板的帮助下(图 5),管理员可以轻松管理: + + * 系统 + * 网络 + * 日志 + * 软件更新和安装 + * 用户/组 + * 域 + * 文件共享 + * 邮件 + * DNS + * 防火墙 + * 证书 + * 等等 + +![](https://www.linux.com/sites/lcom/files/styles/rendered_file/public/zentyal.jpg?itok=Un9lpgh6) + +*图 5:Zentyal 仪表板* + +向 Zentyal 服务器添加新组件只需要打开仪表板,单击“软件管理” -> “Zentyal 组件”,选择要添加的组件,然后单击安装。Zentyal 可能会遇到的一个问题是,它提供不了与 Nethserver 和 ClearOS 一样多的插件。但它提供的服务,则做得非常好。 + +### 更多来自于 + +这个 Linux 服务器列表显然不是详尽无遗的。然而,这是一种对你可能没有听说过的五大服务器发行版的独特视角。当然,如果你更愿意使用更传统的 Linux 服务器发行版,你可以随时坚持使用 [CentOS][11]、[Ubuntu 服务器][12]、[SUSE][13]、[RHEL][14] 或 [Debian][15]……它们大多都出现在市场上最好的服务器发行版列表中。但是,如果你正在寻找一些不同的东西,那么试试这五个发行版中的一个。 + +通过 Linux 基金会和 edX 的免费[“Linux 简介”][16]课程了解有关 Linux 的更多信息。 + +-------------------------------------------------------------------------------- + +via: https://www.linux.com/blog/learn/2019/1/top-5-linux-server-distributions + +作者:[Jack Wallen][a] +选题:[lujun9972][b] +译者:[wxy](https://github.com/wxy) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.linux.com/users/jlwallen +[b]: https://github.com/lujun9972 +[1]: https://www.clearos.com/clearfoundation/software/clearos-7-community +[2]: https://www.clearos.com/products/clearos-editions/clearos-7-home +[3]: https://www.clearos.com/products/clearos-editions/clearos-7-business +[4]: https://www.linux.com/files/images/fedoraserverjpg +[5]: https://www.linux.com/sites/lcom/files/styles/rendered_file/public/fedoraserver.jpg?itok=phaAIRXW (Fedora Server) +[6]: https://www.linux.com/licenses/category/used-permission +[7]: https://www.linux.com/files/images/nethserverjpg +[8]: https://www.linux.com/sites/lcom/files/styles/rendered_file/public/nethserver.jpg?itok=HO-CRbOV (NethServer) +[9]: https://www.linux.com/files/images/rockstorejpg +[10]: https://www.linux.com/sites/lcom/files/styles/rendered_file/public/rockstore.jpg?itok=EN_5oFxQ (Rockstor) +[11]: https://www.centos.org/ +[12]: https://www.ubuntu.com/download/server +[13]: https://www.suse.com/ +[14]: https://www.redhat.com/en/technologies/linux-platforms/enterprise-linux +[15]: https://www.debian.org/ +[16]: https://training.linuxfoundation.org/linux-courses/system-administration-training/introduction-to-linux From a2f90a20f0cc8daee032d781775314b572d801a0 Mon Sep 17 00:00:00 2001 From: MjSeven Date: Sun, 27 Jan 2019 19:53:42 +0800 Subject: [PATCH 151/243] Translating by MjSeven --- ...20181203 How to bring good fortune to your Linux terminal.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20181203 How to bring good fortune to your Linux terminal.md b/sources/tech/20181203 How to bring good fortune to your Linux terminal.md index 7549dc0249..28bd2996a1 100644 --- a/sources/tech/20181203 How to bring good fortune to your Linux terminal.md +++ b/sources/tech/20181203 How to bring good fortune to your Linux terminal.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (MjSeven) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: subject: (How to bring good fortune to your Linux terminal) From b342cb4a87c0f29c09a7d223f9052e1f5da214ee Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Sun, 27 Jan 2019 19:58:21 +0800 Subject: [PATCH 152/243] Revert "TSD:20190118 Top 5 Linux Server Distributions" This reverts commit 43b5a2229f831201bf6fbf9d03d5591e9749397c. --- ...190118 Top 5 Linux Server Distributions.md | 268 ++++++++++++++++++ ...190118 Top 5 Linux Server Distributions.md | 190 ------------- 2 files changed, 268 insertions(+), 190 deletions(-) create mode 100644 sources/tech/20190118 Top 5 Linux Server Distributions.md delete mode 100644 translated/tech/20190118 Top 5 Linux Server Distributions.md diff --git a/sources/tech/20190118 Top 5 Linux Server Distributions.md b/sources/tech/20190118 Top 5 Linux Server Distributions.md new file mode 100644 index 0000000000..d9f2edf6d9 --- /dev/null +++ b/sources/tech/20190118 Top 5 Linux Server Distributions.md @@ -0,0 +1,268 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Top 5 Linux Server Distributions) +[#]: via: (https://www.linux.com/blog/learn/2019/1/top-5-linux-server-distributions) +[#]: author: (Jack Wallen https://www.linux.com/users/jlwallen) + +Top 5 Linux Server Distributions +====== +![](https://www.linux.com/sites/lcom/files/styles/rendered_file/public/rockstor-main.jpg?itok=VNvfEIlf) + +Ah, the age-old question: Which Linux distribution is best suited for servers? Typically, when this question is asked, the standard responses pop up: + + * RHEL + + * SUSE + + * Ubuntu Server + + * Debian + + * CentOS + + + + +However, in the name of opening your eyes to maybe something a bit different, I’m going to approach this a bit differently. I want to consider a list of possible distributions that are not only outstanding candidates but also easy to use, and that can serve many functions within your business. In some cases, my choices are drop-in replacements for other operating systems, whereas others require a bit of work to get them up to speed. + +Some of my choices are community editions of enterprise-grade servers, which could be considered gateways to purchasing a much more powerful platform. You’ll even find one or two entries here to be duty-specific platforms. Most importantly, however, what you’ll find on this list isn’t the usual fare. + +### ClearOS + +What is ClearOS? For home and small business usage, you might not find a better solution. Out of the box, ClearOS includes tools like intrusion detection, a strong firewall, bandwidth management tools, a mail server, a domain controller, and much more. What makes ClearOS stand out above some of the competition is its purpose is to server as a simple Home and SOHO server with a user-friendly, graphical web-based interface. From that interface, you’ll find an application marketplace (Figure 1), with hundreds of apps (some of which are free, whereas some have an associated cost), that makes it incredibly easy to extend the ClearOS featureset. In other words, you make ClearOS the platform your home and small business needs it to be. Best of all, unlike many other alternatives, you only pay for the software and support you need. +![](https://www.linux.com/sites/lcom/files/styles/rendered_file/public/clearos.jpg?itok=knQkn5ch) +There are three different editions of ClearOS: + + * [ClearOS Community][1] - the free edition of ClearOS + + * [ClearOS Home][2] - ideal for home offices + + * [ClearOS Business][3] - ideal for small businesses, due to the inclusion of paid support + + + + +To make the installation of software even easier, the ClearOS marketplace allows you to select via: + + * By Function (which displays apps according to task) + + * By Category (which displays groups of related apps) + + * Quick Select File (which allows you to select pre-configured templates to get you up and running fast) + + + + +In other words, if you’re looking for a Linux Home, SOHO, or SMB server, ClearOS is an outstanding choice (especially if you don’t have the Linux chops to get a standard server up and running). + +### Fedora Server + +You’ve heard of Fedora Linux. Of course you have. It’s one of the finest bleeding edge distributions on the market. But did you know the developers of that excellent Fedora Desktop distribution also has a Server edition? The Fedora Server platform is a short-lifecycle, community-supported server OS. This take on the server operating system enables seasoned system administrators, experienced with any flavor of Linux (or any OS at all), to make use of the very latest technologies available in the open source community. There are three key words in that description: + + * Seasoned + + * System + + * Administrators + + + + +In other words, new users need not apply. Although Fedora Server is quite capable of handling any task you throw at it, it’s going to require someone with a bit more Linux kung fu to make it work and work well. One very nice inclusion with Fedora Server is that, out of the box, it includes one of the finest open source, web-based interface for servers on the market. With Cockpit (Figure 2) you get a quick glance at system resources, logs, storage, network, as well as the ability to manage accounts, services, applications, and updates. + +![Fedora Server][5] + +Figure 2: Cockpit running on Fedora Server. + +[Used with permission][6] + +If you’re okay working with bleeding edge software, and want an outstanding admin dashboard, Fedora Server might be the platform for you. + +### NethServer + +NethServer is about as no-brainer of a drop-in SMB Linux server as you’ll find. With the latest iteration of NethServer, your small business will enjoy: + + * Built-in Samba Active Directory Controller + + * Seamless Nextcloud integration + + * Certificate management + + * Transparent HTTPS proxy + + * Firewall + + * Mail server and filter + + * Web server and filter + + * Groupware + + * IPS/IDS or VPN + + + + +All of the included features can be easily configured with a user-friendly, web-based interface that includes single-click installation of modules to expand the NethServer feature set (Figure 3) What sets NethServer apart from ClearOS is that it was designed to make the admin job easier. In other words, this platform offers much more in the way of flexibility and power. Unlike ClearOS, which is geared more toward home office and SOHO deployments, NethServer is equally at home in small business environments. + +![NethServer][8] + +Figure 3: Adding modules to NethServer. + +[Used with permission][6] + +### Rockstor + +Rockstor is a Linux and Btfrs powered advanced Network Attached Storage (NAS) and Cloud storage server that can be deployed for Home, SOHO, as well as small- and mid-sized businesses alike. With Rockstor, you get a full-blown NAS/Cloud solution with a user-friendly, web-based GUI tool that is just as easy for admins to set up as it is for users to use. Once you have Rockstor deployed, you can create pools, shares, snapshots, manage replication and users, share files (with the help of Samba, NFS, SFTP, and AFP), and even extend the featureset, thanks to add-ons (called Rock-ons). The list of Rock-ons includes: + + * CouchPotato (Downloader for usenet and bittorrent users) + + * Deluge (Movie downloader for bittorrent users) + + * EmbyServer (Emby media server) + + * Ghost (Publishing platform for professional bloggers) + + * GitLab CE (Git repository hosting and collaboration) + + * Gogs Go Git Service (Lightweight Git version control server and front end) + + * Headphones (An automated music downloader for NZB and Torrent) + + * Logitech Squeezebox Server for Squeezebox Devices + + * MariaDB (Relational database management system) + + * NZBGet (Efficient usenet downloader) + + * OwnCloud-Official (Secure file sharing and hosting) + + * Plexpy (Python-based Plex Usage tracker) + + * Rocket.Chat (Open Source Chat Platform) + + * SaBnzbd (Usenet downloader) + + * Sickbeard (Internet PVR for TV shows) + + * Sickrage (Automatic Video Library Manager for TV Shows) + + * Sonarr (PVR for usenet and bittorrent users) + + * Symform (Backup service) + + + + +Rockstor also includes an at-a-glance dashboard that gives admins quick access to all the information they need about their server (Figure 4). + +![Rockstor][10] + +The Rockstor dashboard in action. + +[Used with permission][6] + +### Zentyal + +Zentyal is another Small Business Server that does a great job of handling multiple tasks. If you’re looking for a Linux distribution that can handle the likes of: + + * Directory and Domain server + + * Mail server + + * Gateway + + * DHCP, DNS, and NTP server + + * Certification Authority + + * VPN + + * Instant Messaging + + * FTP server + + * Antivirus + + * SSO authentication + + * File sharing + + * RADIUS + + * Virtualization Management + + * And more + + + + +Zentyal might be your new go-to. Zentyal has been around since 2004 and is based on Ubuntu Server, so it enjoys a rock-solid base and plenty of applications. And with the help of the Zentyal dashboard (Figure 5), admins can easily manage: + + * System + + * Network + + * Logs + + * Software updates and installation + + * Users/groups + + * Domains + + * File sharing + + * Mail + + * DNS + + * Firewall + + * Certificates + + * And much more + +![](https://www.linux.com/sites/lcom/files/styles/rendered_file/public/zentyal.jpg?itok=Un9lpgh6) + + +Adding new components to the Zentyal server is as simple as opening the Dashboard, clicking on Software Management > Zentyal Components, selecting what you want to add, and clicking Install. The one issue you might find with Zentyal is that it doesn’t offer nearly the amount of addons as you’ll find in the likes of Nethserver and ClearOS. But the services it does offer, Zentyal does incredibly well. + +### Plenty More Where These Came From + +This list of Linux servers is clearly not exhaustive. What it is, however, is a unique look at the top five server distributions you’ve probably not heard of. Of course, if you’d rather opt to use a more traditional Linux server distribution, you can always stick with [CentOS][11], [Ubuntu Server][12], [SUSE][13], [Red Hat Enterprise Linux][14], or [Debian][15]… most of which are found on every list of best server distributions on the market. If, however, you’re looking for something a bit different, give one of these five distos a try. + +Learn more about Linux through the free ["Introduction to Linux" ][16]course from The Linux Foundation and edX. + +-------------------------------------------------------------------------------- + +via: https://www.linux.com/blog/learn/2019/1/top-5-linux-server-distributions + +作者:[Jack Wallen][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.linux.com/users/jlwallen +[b]: https://github.com/lujun9972 +[1]: https://www.clearos.com/clearfoundation/software/clearos-7-community +[2]: https://www.clearos.com/products/clearos-editions/clearos-7-home +[3]: https://www.clearos.com/products/clearos-editions/clearos-7-business +[4]: https://www.linux.com/files/images/fedoraserverjpg +[5]: https://www.linux.com/sites/lcom/files/styles/rendered_file/public/fedoraserver.jpg?itok=phaAIRXW (Fedora Server) +[6]: https://www.linux.com/licenses/category/used-permission +[7]: https://www.linux.com/files/images/nethserverjpg +[8]: https://www.linux.com/sites/lcom/files/styles/rendered_file/public/nethserver.jpg?itok=HO-CRbOV (NethServer) +[9]: https://www.linux.com/files/images/rockstorejpg +[10]: https://www.linux.com/sites/lcom/files/styles/rendered_file/public/rockstore.jpg?itok=EN_5oFxQ (Rockstor) +[11]: https://www.centos.org/ +[12]: https://www.ubuntu.com/download/server +[13]: https://www.suse.com/ +[14]: https://www.redhat.com/en/technologies/linux-platforms/enterprise-linux +[15]: https://www.debian.org/ +[16]: https://training.linuxfoundation.org/linux-courses/system-administration-training/introduction-to-linux diff --git a/translated/tech/20190118 Top 5 Linux Server Distributions.md b/translated/tech/20190118 Top 5 Linux Server Distributions.md deleted file mode 100644 index b263bb3b89..0000000000 --- a/translated/tech/20190118 Top 5 Linux Server Distributions.md +++ /dev/null @@ -1,190 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (wxy) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Top 5 Linux Server Distributions) -[#]: via: (https://www.linux.com/blog/learn/2019/1/top-5-linux-server-distributions) -[#]: author: (Jack Wallen https://www.linux.com/users/jlwallen) - -另一种 5 个顶级 Linux 服务器发行版 -====== - -> Jack Wallen 为 Linux 服务器发行版提供了一些可靠的选择,绝对值回票价。 - -![](https://www.linux.com/sites/lcom/files/styles/rendered_file/public/rockstor-main.jpg?itok=VNvfEIlf) - -啊,这个古老的问题:哪种 Linux 发行版最适合做服务器?通常,问这种问题时,所浮现出来的标准的答复就是: - - * RHEL - * SUSE - * Ubuntu 服务器 - * Debian - * CentOS - -然而,假如你将眼界放得更宽(不将服务器只看做是 IDC 托管的那种互联网服务器时),可能答案会有点不同。我准备稍微来点不同的。我想做出一个满足入选标准的发行版列表,这些发行版不仅是优秀的候选者,而且易于使用,可以为你的业务中的许多功能提供服务。在某些情况下,我选择的是一些替代品,可以取代其它需要一些工作才能达成要求的操作系统。 - -我的一些选择是企业级服务器的社区版本,它们可以被视为购买更强大平台的入门级产品。你甚至可以在这里找到一两个作为特定任务平台的候选者。然而,最重要的是,你在此列表中找到的并非寻常的泛泛之辈。 - -### ClearOS - -什么是 ClearOS?对于家庭和小型企业用途,你可能找不到比它更好的解决方案。ClearOS 开箱即用,包括了入侵检测、强大的防火墙、带宽管理工具、邮件服务器、域控制器等工具。其目的是将服务器作为一个简单的家庭和 SOHO 服务器,并具有用户友好的基于 Web 的图形化界面,这使得 ClearOS 在某些评比中脱颖而出。从其界面中,你可以找到一个应用程序市场(图 1),其中包含数百个应用程序(其中一些是免费的,而另一些则具有相关费用),这使得扩展 ClearOS 功能集非常容易。换句话说,你可以将 ClearOS 作为你的家庭和小型企业所需的平台。最重要的是,与许多其他替代方案不同,你只需支付所需的软件和支持。 - -![](https://www.linux.com/sites/lcom/files/styles/rendered_file/public/clearos.jpg?itok=knQkn5ch) - -*图 1:ClearOS 应用程序市场* - -有三种版本的 ClearOS: - - * [ClearOS Community][1] - 免费版 ClearOS - * [ClearOS Home][2] - 适于家庭办公 - * [ClearOS Business][3] - 适于小型企业,包括了付费支持。 - -为了使软件安装更加容易,ClearOS 应用市场允许你通过以下方式进行选择软件: - -   * 按功能(根据任务显示应用程序) -   * 按类别(显示相关应用程序组) -   * 快速选择文件(允许你按预先配置的模板选择,以帮助你快速启动和运行) - -换句话说,如果你正在寻找 Linux 的家庭、SOHO 或 SMB 服务器,ClearOS 是一个出色的选择(特别是如果你没有启动和运行标准的 Linux 服务器的能力时)。 - -### Fedora 服务器 - -你肯定听说过 Fedora Linux。它是市场上最好的前沿发行版之一。但是你知道这个出色的 Fedora 桌面发行版的开发者们也开发了服务器版吗?Fedora 服务器平台是一个短生命周期的、社区支持的服务器操作系统。这使得经验丰富的、或对任何类型的 Linux(或任何操作系统)有经验的系统管理员,可以使用开源社区中提供的最新技术。在这段描述中有三个关键词: - - * 经验丰富 - * 系统 - * 管理员 - -换言之,新用户就不要考虑了。虽然 Fedora 服务器完全能够处理你抛出的任何任务,但它需要一些拥有更多的 Linux 功夫的人来使它工作并且运行良好。Fedora 服务器非常好的一点是,开箱即用,它包括了市场上用于服务器的开源的基于 Web 的最好的界面之一。通过 Cockpit(图 2),你可以快速浏览系统资源、日志、存储、网络以及拥有管理帐户、服务、应用程序和更新的能力。 - -![Fedora Server][5] - -*图 2:运行在 Fedora 服务器上的 Cockpit* - -如果你可以使用最前沿的软件,并想要一个出色的管理仪表板,Fedora 服务器可能就是你要的平台。 - -### NethServer - -正如你所发现的那样,NethServer 是每个人都知道的简单 SMB Linux 服务器。通过 NethServer 的最新版本,你的小型企业将得到: - - * 内置 Samba 活动目录控制器 -   * 与 Nextcloud 的无缝集成 -   * 证书管理 -   * HTTPS 透明代理 -   * 防火墙 -   * 邮件服务器和过滤器 -   * Web 服务器和过滤器 -   * 群件 -   * IPS / IDS 或 VPN - -所有包含的功能都可以通过用户友好的基于 Web 的界面轻松配置,包括单击安装模块以扩展 NethServer 功能集(图 3)。NethServer 与 ClearOS 的区别在于它的设计目的是使管理工作更轻松。换句话说,这个平台提供了更多的灵活性和功能。与面向家庭办公室和 SOHO 部署的 ClearOS 不同,NethServer 在小型商业环境中用起来就像在家庭里使用一样方便。 - -![NethServer][8] - -*图 3:给 NethServer 添加模块* - -### Rockstor - -Rockstor 是采用 Linux 和 Btfrs 的高级网络附加存储(NAS)和云存储服务器,可部署用于家庭、SOHO 以及中小型企业。借助 Rockstor,你可以获得一个完整的 NAS /云解决方案,其中包含一个用户友好的基于 Web 的 GUI 工具,管理员可以像普通用户一样轻松使用它来设置。一旦部署好了 Rockstor,你就可以创建存储池、共享、快照、管理复制和用户、共享文件(借助 Samba、NFS、SFTP 和 AFP),甚至扩展它的功能集,这要归功于附加组件(称为 Rock-ons)。Rock-ons 列表包括: - - * CouchPotato(Usenet 和 BitTorrent 用户的下载器) - * Deluge(BitTorrent 用户的电影下载器) - * EmbyServer(Emby 媒体服务器) - * Ghost(专业博主的发布平台) - * GitLab CE(Git 仓库托管和协作) - * Gogs Go Git Service(轻量级 Git 版本控制服务器和前端) - * Headphones(NZB 和 Torrent 的音乐自动下载器) - * 用于 Squeezebox 设备的罗技 Squeezebox 服务器 - * MariaDB(关系型数据管理系统) - * NZBGet(高效的 usenet 下载器) - * OwnCloud-Official(安全的文件共享和托管) - * Plexpy(基于 Python 的 Plex 用量跟踪器) - * Rocket.Chat(开源聊天平台) - * SaBnzbd(Usenet 下载器) - * Sickbeard(用于电视节目的互联网个人视频录像机) - * Sickrage(电视节目的自动视频库管理器) - * Sonarr(Usenet 和 BitTorrent 用户的个人视频录像机) - * Symform(备份设备) - -Rockstor 还包括了一目了然的仪表板,使管理员可以快速访问他们所需的有关其服务器的所有信息(图 4)。 - -![Rockstor][10] - -*图 4: Rockstor 面板* - -### Zentyal - -Zentyal 是另一个小型企业服务器,可以很好地处理多个任务。如果你正在寻找可以处理以下内容的 Linux 发行版: - - * 目录和域服务器 - * 邮件服务器 - * 网关 - * DHCP、DNS 和 NTP 服务器 - * 认证机构(CA) - * VPN - * 实时消息(IM) - * FTP 服务器 - * 反病毒 - * SSO 认证 - * 文件共享 - * RADIUS 认证 - * 虚拟化管理 - * 等等 - -Zentyal 可能是你的新选择。从 2004 年 Zentyal 就存在了,它基于 Ubuntu Server,因此它拥有坚实的基础和丰富的应用程序。在 Zentyal 仪表板的帮助下(图 5),管理员可以轻松管理: - - * 系统 - * 网络 - * 日志 - * 软件更新和安装 - * 用户/组 - * 域 - * 文件共享 - * 邮件 - * DNS - * 防火墙 - * 证书 - * 等等 - -![](https://www.linux.com/sites/lcom/files/styles/rendered_file/public/zentyal.jpg?itok=Un9lpgh6) - -*图 5:Zentyal 仪表板* - -向 Zentyal 服务器添加新组件只需要打开仪表板,单击“软件管理” -> “Zentyal 组件”,选择要添加的组件,然后单击安装。Zentyal 可能会遇到的一个问题是,它提供不了与 Nethserver 和 ClearOS 一样多的插件。但它提供的服务,则做得非常好。 - -### 更多来自于 - -这个 Linux 服务器列表显然不是详尽无遗的。然而,这是一种对你可能没有听说过的五大服务器发行版的独特视角。当然,如果你更愿意使用更传统的 Linux 服务器发行版,你可以随时坚持使用 [CentOS][11]、[Ubuntu 服务器][12]、[SUSE][13]、[RHEL][14] 或 [Debian][15]……它们大多都出现在市场上最好的服务器发行版列表中。但是,如果你正在寻找一些不同的东西,那么试试这五个发行版中的一个。 - -通过 Linux 基金会和 edX 的免费[“Linux 简介”][16]课程了解有关 Linux 的更多信息。 - --------------------------------------------------------------------------------- - -via: https://www.linux.com/blog/learn/2019/1/top-5-linux-server-distributions - -作者:[Jack Wallen][a] -选题:[lujun9972][b] -译者:[wxy](https://github.com/wxy) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://www.linux.com/users/jlwallen -[b]: https://github.com/lujun9972 -[1]: https://www.clearos.com/clearfoundation/software/clearos-7-community -[2]: https://www.clearos.com/products/clearos-editions/clearos-7-home -[3]: https://www.clearos.com/products/clearos-editions/clearos-7-business -[4]: https://www.linux.com/files/images/fedoraserverjpg -[5]: https://www.linux.com/sites/lcom/files/styles/rendered_file/public/fedoraserver.jpg?itok=phaAIRXW (Fedora Server) -[6]: https://www.linux.com/licenses/category/used-permission -[7]: https://www.linux.com/files/images/nethserverjpg -[8]: https://www.linux.com/sites/lcom/files/styles/rendered_file/public/nethserver.jpg?itok=HO-CRbOV (NethServer) -[9]: https://www.linux.com/files/images/rockstorejpg -[10]: https://www.linux.com/sites/lcom/files/styles/rendered_file/public/rockstore.jpg?itok=EN_5oFxQ (Rockstor) -[11]: https://www.centos.org/ -[12]: https://www.ubuntu.com/download/server -[13]: https://www.suse.com/ -[14]: https://www.redhat.com/en/technologies/linux-platforms/enterprise-linux -[15]: https://www.debian.org/ -[16]: https://training.linuxfoundation.org/linux-courses/system-administration-training/introduction-to-linux From 5cd0650e14e3bd31e00dbadcaf05caa2b719039f Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Sun, 27 Jan 2019 20:21:15 +0800 Subject: [PATCH 153/243] PUB:20180722 Dawn of the Microcomputer- The Altair 8800.md @zhs852 https://linux.cn/article-10482-1.html --- .../20180722 Dawn of the Microcomputer- The Altair 8800.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {translated/talk => published}/20180722 Dawn of the Microcomputer- The Altair 8800.md (100%) diff --git a/translated/talk/20180722 Dawn of the Microcomputer- The Altair 8800.md b/published/20180722 Dawn of the Microcomputer- The Altair 8800.md similarity index 100% rename from translated/talk/20180722 Dawn of the Microcomputer- The Altair 8800.md rename to published/20180722 Dawn of the Microcomputer- The Altair 8800.md From 484178f9066002edde72d651eab40cba13f7d079 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Sun, 27 Jan 2019 20:51:20 +0800 Subject: [PATCH 154/243] PUB:20180606 Working with modules in Fedora 28.md @geekpi --- ...80606 Working with modules in Fedora 28.md | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) rename {translated/tech => published}/20180606 Working with modules in Fedora 28.md (90%) diff --git a/translated/tech/20180606 Working with modules in Fedora 28.md b/published/20180606 Working with modules in Fedora 28.md similarity index 90% rename from translated/tech/20180606 Working with modules in Fedora 28.md rename to published/20180606 Working with modules in Fedora 28.md index bf5c4237f2..338e6accc6 100644 --- a/translated/tech/20180606 Working with modules in Fedora 28.md +++ b/published/20180606 Working with modules in Fedora 28.md @@ -23,7 +23,7 @@ sudo dnf -y update dnf module list ``` -输出列出了一组模块,这些模块显示了每个模块的关联流、版本和可用安装配置文件。模块流旁边的 `[d]` 表示安装命名模块时使用的默认流。 +输出列出了一组模块,这些模块显示了每个模块的关联的流、版本和可用安装配置文件。模块流旁边的 `[d]` 表示安装命名模块时使用的默认流。 输出还显示大多数模块都有名为 `default` 的配置文件。这不是巧合,因为 `default` 是默认配置文件使用的名称。 @@ -83,22 +83,22 @@ sudo dnf -y module install reviewboard/server 但是,安装 reviewboard:3.0/server 配置非常平常。reviewboard:3.0 模块的服务器配置与默认配置文件相同 —— 因此无需安装。 -### 启动 Review Board 网站 +### 启动 Review Board 网站 现在已经安装了 Review Board 3.0 模块及其相关软件包,[创建一个本地运行的 Review Board 网站][6]。无需解释,请复制并粘贴以下命令: ``` sudo rb-site install --noinput \ - --domain-name=localhost --db-type=sqlite3 \ - --db-name=/var/www/rev.local/data/reviewboard.db \ - --admin-user=rbadmin --admin-password=secret \ - /var/www/rev.local + --domain-name=localhost --db-type=sqlite3 \ + --db-name=/var/www/rev.local/data/reviewboard.db \ + --admin-user=rbadmin --admin-password=secret \ + /var/www/rev.local sudo chown -R apache /var/www/rev.local/htdocs/media/uploaded \ - /var/www/rev.local/data + /var/www/rev.local/data sudo ln -s /var/www/rev.local/conf/apache-wsgi.conf \ - /etc/httpd/conf.d/reviewboard-localhost.conf + /etc/httpd/conf.d/reviewboard-localhost.conf sudo setsebool -P httpd_can_sendmail=1 httpd_can_network_connect=1 \ - httpd_can_network_memcache=1 httpd_unified=1 + httpd_can_network_memcache=1 httpd_unified=1 sudo systemctl enable --now httpd ``` @@ -131,7 +131,7 @@ via: https://fedoramagazine.org/working-modules-fedora-28/ 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 [a]:https://fedoramagazine.org/author/merlinm/ -[1]:https://fedoramagazine.org/modularity-fedora-28-server-edition/ +[1]:https://linux.cn/article-10479-1.html [2]:https://getfedora.org/server/ [3]:https://fedoramagazine.org/howto-use-sudo/ [4]:https://fedoramagazine.org/modularity-fedora-28-server-edition/#comment-476696 From 9e474c5f0feee1eb6c4d6e206c16716c77d8ae71 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Sun, 27 Jan 2019 20:54:23 +0800 Subject: [PATCH 155/243] TSD:20190120 Get started with HomeBank, an open source personal finance app.md @wxy --- .../tech/20190118 Top 5 Linux Server Distributions.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {sources => translated}/tech/20190118 Top 5 Linux Server Distributions.md (100%) diff --git a/sources/tech/20190118 Top 5 Linux Server Distributions.md b/translated/tech/20190118 Top 5 Linux Server Distributions.md similarity index 100% rename from sources/tech/20190118 Top 5 Linux Server Distributions.md rename to translated/tech/20190118 Top 5 Linux Server Distributions.md From 1f6daa8df96978ee367137e3d090bdf4e28d8a2d Mon Sep 17 00:00:00 2001 From: MjSeven Date: Sun, 27 Jan 2019 19:59:21 +0800 Subject: [PATCH 156/243] =?UTF-8?q?=E7=BF=BB=E8=AF=91=E5=AE=8C=E6=88=90=20?= =?UTF-8?q?20181203=20How=20to=20bring=20good...?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...ing good fortune to your Linux terminal.md | 86 ------------------- ...ing good fortune to your Linux terminal.md | 86 +++++++++++++++++++ 2 files changed, 86 insertions(+), 86 deletions(-) delete mode 100644 sources/tech/20181203 How to bring good fortune to your Linux terminal.md create mode 100644 translated/tech/20181203 How to bring good fortune to your Linux terminal.md diff --git a/sources/tech/20181203 How to bring good fortune to your Linux terminal.md b/sources/tech/20181203 How to bring good fortune to your Linux terminal.md deleted file mode 100644 index 28bd2996a1..0000000000 --- a/sources/tech/20181203 How to bring good fortune to your Linux terminal.md +++ /dev/null @@ -1,86 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (MjSeven) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: subject: (How to bring good fortune to your Linux terminal) -[#]: via: (https://opensource.com/article/18/12/linux-toy-fortune) -[#]: author: (Jason Baker https://opensource.com/users/jason-baker) -[#]: url: ( ) - -How to bring good fortune to your Linux terminal -====== -Bring quotes and quips to the command line with the fortune utility. -![](https://opensource.com/sites/default/files/styles/image-full-size/public/uploads/linux-toy-fortune.png?itok=5PVVZVer) - -It's December, and if you haven't found a [tech advent calendar][1] that sparks your fancy yet, well, maybe this one will do the trick. Every day, from now to the 24th, we're bringing you a different Linux command-line toy. What's a command-line toy, you ask? It could be a game or any simple diversion to bring a little happiness to your terminal. - -You may have seen some of these before. We hope you'll find something new, too. Either way, we hope you have fun following along. - -Today's toy, **fortune** , is an old one. Versions of it date back to the 1980s when it was included with Unix. The version I installed in Fedora was available under a BSD license, and I grabbed it with the following. - -``` -$ sudo dnf install fortune-mod -y -``` - -Your distribution may be different. On some, you may need to install the fortunes separately from **fortune** itself (try searching your package manager for "fortunes*"). You can also check out the source code on [GitHub][2]. Then, just run **fortune** to get, well, a fortune. - -``` -$ fortune -"Time is an illusion.  Lunchtime doubly so." --- Ford Prefect, _Hitchhiker's Guide to the Galaxy_ -``` - -So why do you need fortunes at the terminal? For fun, of course. Perhaps you'd like to add them to the message of the day on your system? - -Personally, I like using the **fortune** command as a built-in piece of dummy data when I'm using the terminal to parse text, particularly with [regular expressions][3], and want something simple to try it out on. - -For example, let's say I was testing our a transformation with the **tr** command to replace letter the letter e with a numeral 3. - -``` -$ fortune | tr 'eE' '3' -Unix 3xpr3ss: -All pass3ng3r bring a pi3c3 of th3 a3roplan3 and a box of tools with th3m to -th3 airport. Th3y gath3r on th3 tarmac, arguing constantly about what kind -of plan3 th3y want to build and how to put it tog3th3r. 3v3ntually, th3 -pass3ng3rs split into groups and build s3v3ral diff3r3nt aircraft, but giv3 -th3m all th3 sam3 nam3. Som3 pass3ng3rs actually r3ach th3ir d3stinations. -All pass3ng3rs b3li3v3 th3y got th3r3. -``` - -So what fortunes come with your distribution? Take a look in your **/usr/share/games/fortune** directory to find them all. Here are a few of my favorites. - -``` -Never laugh at live dragons. -                -- Bilbo Baggins [J.R.R. Tolkien, "The Hobbit"] - -I dunno, I dream in Perl sometimes... -             -- Larry Wall in  <8538@jpl-devvax.JPL.NASA.GOV> - -I have an existential map.  It has "You are here" written all over it. -                -- Steven Wright -``` - -Looking for more on **fortune**? You can, of course, always check out the man page to learn more about the options, or read a little bit more about the history of the command on [Wikipedia][4]. - -Do you have a favorite command-line toy that you think I ought to profile? The calendar for this series is mostly filled out but I've got a few spots left. Let me know in the comments below, and I'll check it out. If there's space, I'll try to include it. If not, but I get some good submissions, I'll do a round-up of honorable mentions at the end. - -Check out yesterday's toy, [Drive a locomotive through your Linux terminal][5], and check back tomorrow for another! - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/18/12/linux-toy-fortune - -作者:[Jason Baker][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://opensource.com/users/jason-baker -[b]: https://github.com/lujun9972 -[1]: https://opensource.com/article/16/11/7-tech-advent-calendars-holiday-season -[2]: https://github.com/shlomif/fortune-mod -[3]: https://opensource.com/article/18/5/getting-started-regular-expressions -[4]: https://en.wikipedia.org/wiki/Fortune_%28Unix%29 -[5]: https://opensource.com/article/18/12/linux-toy-sl diff --git a/translated/tech/20181203 How to bring good fortune to your Linux terminal.md b/translated/tech/20181203 How to bring good fortune to your Linux terminal.md new file mode 100644 index 0000000000..19d703afab --- /dev/null +++ b/translated/tech/20181203 How to bring good fortune to your Linux terminal.md @@ -0,0 +1,86 @@ +[#]: collector: (lujun9972) +[#]: translator: (MjSeven) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: subject: (How to bring good fortune to your Linux terminal) +[#]: via: (https://opensource.com/article/18/12/linux-toy-fortune) +[#]: author: (Jason Baker https://opensource.com/users/jason-baker) +[#]: url: ( ) + +如何为你的 Linux 终端带来好运 +====== +使用 fortune 实用程序将引号和俏皮话带到命令行。 + +![](https://opensource.com/sites/default/files/styles/image-full-size/public/uploads/linux-toy-fortune.png?itok=5PVVZVer) + +这是 12 月,如果你还没有找到一款能激发你灵感的[科技降临节日历][1],那么,也许这个系列可以。从现在到 24 日,每天我们都会为你带来一个不同的 Linux 命令行玩具。你可能会问,什么是命令行玩具?它可能是一个游戏或任何简单的娱乐,为你的终端带来一点点快乐。 + +你可能之前已经看过其中的一些,我们希望你也能发现一些新的东西。不管怎样,我们都希望你在关注时保有乐趣。 + +今天的玩具是 **fortune**,它很古老。它的版本可以追溯到 1980 年,当时它包含在 Unix 中。我在 Fedora 中安装的版本是在 BSD 许可下提供的,我可以使用以下命令获取它。 +``` +$ sudo dnf install fortune-mod -y +``` + +你的发行版可能会有所不同。在某些情况下,你可能需要将 fortunes 独立于 **fortune** 本身安装(尝试在你的包管理器中搜索 "fortunes")。你还可以在 [GitHub][2] 上查看它的源代码,然后,只需运行 **fortune** 即可获得好运。 + +``` +$ fortune +"Time is an illusion.  Lunchtime doubly so." +-- Ford Prefect, _Hitchhiker's Guide to the Galaxy_ +``` + +那么,你为什么会在终端上需要 fortune 呢?当然是为了好玩啦。也许你想将它们添加到系统上的每天消息中? + +就我个人而言,当我使用终端来解析文本时,我喜欢使用 **fortune** 命令作为一段内置的虚拟数据,特别是使用[正则表达式][3]时,我想要一些简单的东西来尝试一下。 + +例如,假设我使用 **tr** 命令来测试转换,用数字 3 替换字母 e。 + +``` +$ fortune | tr 'eE' '3' +Unix 3xpr3ss: +All pass3ng3r bring a pi3c3 of th3 a3roplan3 and a box of tools with th3m to +th3 airport. Th3y gath3r on th3 tarmac, arguing constantly about what kind +of plan3 th3y want to build and how to put it tog3th3r. 3v3ntually, th3 +pass3ng3rs split into groups and build s3v3ral diff3r3nt aircraft, but giv3 +th3m all th3 sam3 nam3. Som3 pass3ng3rs actually r3ach th3ir d3stinations. +All pass3ng3rs b3li3v3 th3y got th3r3. +``` + +那么 fortunes 到底为你的发行版带来了什么呢?看看你的 **/usr/share/games/fortune** 目录,找到它们。以下我最喜欢的几个。 +``` +Never laugh at live dragons. +                -- Bilbo Baggins [J.R.R. Tolkien, "The Hobbit"] + +I dunno, I dream in Perl sometimes... +             -- Larry Wall in  <8538@jpl-devvax.JPL.NASA.GOV> + +I have an existential map.  It has "You are here" written all over it. +                -- Steven Wright +``` + +想要了解更多关于 **fortune**?当然,你可以经常查看 man 页来了解更多选项,或者在[维基百科][4]上阅读更多关于此命令的历史信息。 + +你有特别喜欢的命令行小玩具需要我介绍的吗?这个系列要介绍的小玩具大部分已经有了落实,但还预留了几个空位置。请在评论区留言,我会查看的。如果还有空位置,我会考虑介绍它的。如果没有,但如果我得到了一些很好的意见,我会在最后做一些有价值的提及。 + +看看昨天的玩具:[驾驶火车头通过你的 Linux 终端][5]。记得明天再来! + + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/18/12/linux-toy-fortune + +作者:[Jason Baker][a] +选题:[lujun9972][b] +译者:[MjSeven](https://github.com/MjSeven) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/jason-baker +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/article/16/11/7-tech-advent-calendars-holiday-season +[2]: https://github.com/shlomif/fortune-mod +[3]: https://opensource.com/article/18/5/getting-started-regular-expressions +[4]: https://en.wikipedia.org/wiki/Fortune_%28Unix%29 +[5]: https://opensource.com/article/18/12/linux-toy-sl From 68fb5efd01a9f10bd917f5eb315901c6b2294348 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Sun, 27 Jan 2019 21:45:16 +0800 Subject: [PATCH 157/243] APL:20190118 Get started with WTF, a dashboard for the terminal --- ...190118 Get started with WTF, a dashboard for the terminal.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20190118 Get started with WTF, a dashboard for the terminal.md b/sources/tech/20190118 Get started with WTF, a dashboard for the terminal.md index 822cd8b7e8..55e2ee93fa 100644 --- a/sources/tech/20190118 Get started with WTF, a dashboard for the terminal.md +++ b/sources/tech/20190118 Get started with WTF, a dashboard for the terminal.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (wxy) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From b9773d230c8e3e7cad307a5becf6d8e211b72f5c Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Sun, 27 Jan 2019 23:23:38 +0800 Subject: [PATCH 158/243] TSD:20190118 Get started with WTF, a dashboard for the terminal.md --- ... with WTF, a dashboard for the terminal.md | 90 ------------------ ... with WTF, a dashboard for the terminal.md | 91 +++++++++++++++++++ 2 files changed, 91 insertions(+), 90 deletions(-) delete mode 100644 sources/tech/20190118 Get started with WTF, a dashboard for the terminal.md create mode 100644 translated/tech/20190118 Get started with WTF, a dashboard for the terminal.md diff --git a/sources/tech/20190118 Get started with WTF, a dashboard for the terminal.md b/sources/tech/20190118 Get started with WTF, a dashboard for the terminal.md deleted file mode 100644 index 55e2ee93fa..0000000000 --- a/sources/tech/20190118 Get started with WTF, a dashboard for the terminal.md +++ /dev/null @@ -1,90 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (wxy) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Get started with WTF, a dashboard for the terminal) -[#]: via: (https://opensource.com/article/19/1/wtf-information-dashboard) -[#]: author: (Kevein Sonney https://opensource.com/users/ksonney) - -Get started with WTF, a dashboard for the terminal -====== -Keep key information in view with WTF, the sixth in our series on open source tools that will make you more productive in 2019. -![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/data_metrics_analytics_desktop_laptop.png?itok=9QXd7AUr) - -There seems to be a mad rush at the beginning of every year to find ways to be more productive. New Year's resolutions, the itch to start the year off right, and of course, an "out with the old, in with the new" attitude all contribute to this. And the usual round of recommendations is heavily biased towards closed source and proprietary software. It doesn't have to be that way. - -Here's the sixth of my picks for 19 new (or new-to-you) open source tools to help you be more productive in 2019. - -### WTF - -Once upon a time, I was doing some consulting at a firm that used [Bloomberg Terminals][1] . My reaction was, "Wow, that's WAY too much information on one screen." These days, however, it seems like I can't get enough information on a screen when I'm working and have multiple web pages, dashboards, and console apps open to try to keep track of things. - -While [tmux][2] and [Screen][3] can do split screens and multiple windows, they are a pain to set up, and the keybindings can take a while to learn (and often conflict with other applications). - -[WTF][4] is a simple, easily configured information dashboard for the terminal. It is written in [Go][5], uses a YAML configuration file, and can pull data from several different sources. All the data sources are contained in [modules][6] and include things like weather, issue trackers, date and time, Google Sheets, and a whole lot more. Some panes are interactive, and some just update with the most recent information available. - -Setup is as easy as downloading the latest release for your operating system and running the command. Since it is written in Go, it is very portable and should run anywhere you can compile it (although the developer only builds for Linux and MacOS at this time). - -![](https://opensource.com/sites/default/files/uploads/wtf-1.png) - -When you run WTF for the first time, you'll get the default screen, identical to the image above. - -![](https://opensource.com/sites/default/files/uploads/wtf-2.png) - -You also get the default configuration file in **~/.wtf/config.yml** , and you can edit the file to suit your needs. The grid layout is configured in the top part of the file. - -``` -grid: -  columns: [45, 45] -  rows: [7, 7, 7, 4] -``` - -The numbers in the grid settings represent the character dimensions of each block. The default configuration is two columns of 40 characters, two rows 13 characters tall, and one row 4 characters tall. In the code above, I made the columns wider (45, 45), the rows smaller, and added a fourth row so I can have more widgets. - -![](https://opensource.com/sites/default/files/uploads/wtf-3.png) - -I like to see the day's weather on my dashboard. There are two weather modules to chose from: [Weather][7], which shows just the text information, and [Pretty Weather][8], which is colorful and uses text-based graphics in the display. - -``` -prettyweather: -  enabled: true -  position: -    top: 0 -    left: 1 -    height: 2 -    width: 1 -``` - -This code creates a pane two blocks tall (height: 2) and one block wide (height: 1), positioned on the second column (left: 1) on the top row (top: 0) containing the Pretty Weather module. - -Some modules, like Jira, GitHub, and Todo, are interactive, and you can scroll, update, and save information in them. You can move between the interactive panes using the Tab key. The \ key brings up a help screen for the active pane so you can see what you can do and how. The Todo module lets you add, edit, and delete to-do items, as well as check them off as you complete them. - -![](https://opensource.com/sites/default/files/uploads/wtf-4.png) - -There are also modules to execute commands and present the output, watch a text file, and monitor build and integration server output. All the documentation is very well done. - -WTF is a valuable tool for anyone who needs to see a lot of data on one screen from different sources. - - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/19/1/wtf-information-dashboard - -作者:[Kevein Sonney][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://opensource.com/users/ksonney -[b]: https://github.com/lujun9972 -[1]: https://en.wikipedia.org/wiki/Bloomberg_Terminal -[2]: https://github.com/tmux/tmux -[3]: https://www.gnu.org/software/screen/ -[4]: https://wtfutil.com/ -[5]: https://golang.org/ -[6]: https://wtfutil.com/posts/modules/ -[7]: https://wtfutil.com/posts/modules/weather/ -[8]: https://wtfutil.com/posts/modules/prettyweather/ diff --git a/translated/tech/20190118 Get started with WTF, a dashboard for the terminal.md b/translated/tech/20190118 Get started with WTF, a dashboard for the terminal.md new file mode 100644 index 0000000000..5bb1d135af --- /dev/null +++ b/translated/tech/20190118 Get started with WTF, a dashboard for the terminal.md @@ -0,0 +1,91 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Get started with WTF, a dashboard for the terminal) +[#]: via: (https://opensource.com/article/19/1/wtf-information-dashboard) +[#]: author: (Kevein Sonney https://opensource.com/users/ksonney) + +开始使用 WTF 吧,一款终端仪表板 +====== + +> 使用 WTF 将关键信息置于视野之中,这个系列中第六个开源工具可使你在 2019 年更有工作效率。 + +![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/data_metrics_analytics_desktop_laptop.png?itok=9QXd7AUr) + +每年年初似乎都有疯狂的冲动想提高工作效率。新年的决心,渴望开启新的一年,当然,“抛弃旧的,拥抱新的”的态度促成了这一切。通常这时的建议严重偏向闭源和专有软件,但事实上并不用这样。 + +这是我挑选出的 19 个新的(或者对你而言新的)开源项目来帮助你在 2019 年更有效率。 + +### WTF + +曾几何时,我在一家使用[彭博终端][1]的公司做咨询。我的反应是,“哇,在一个屏幕上显示的信息太多了。” 然而,现在,当我正在工作并且打开多个网页、仪表板和控制台应用程序以试图跟踪事物时,我似乎无法在屏幕上获得足够的信息。 + +虽然 [tmux][2] 和 [Screen][3] 可以进行分屏和打开多个窗口,但它们很难设置,并且它们的键绑定可能需要一段时间才能学会(还经常与其他应用程序冲突)。 + +[WTF][4] 是一个简单的、易于配置的终端信息仪表板。它是用 [Go][5] 语言编写的,使用 YAML 配置文件,可以从几个不同的源提取数据。所有的数据源都包含在[模块][6]中,包括天气、问题跟踪器、日期和时间、Google 表格以及更多内容。有些窗格是交互式的,有些窗格只是使用最新的信息进行更新。 + +安装它就像下载适用于您的操作系统的最新版本并运行命令一样简单。因为它是用 Go 编写的,所以它的移植性很好,应该可以在任何可以编译它的地方运行(尽管开发人员目前只为 Linux 和 MacOS 做了构建)。 + +![](https://opensource.com/sites/default/files/uploads/wtf-1.png) + +当您第一次运行 WTF 时,您将看到如上图的默认屏幕。 + +![](https://opensource.com/sites/default/files/uploads/wtf-2.png) + +其默认配置文件在 `~/.wtf/config.yml`,您可以编辑该文件以满足您的需要。网格布局的配置在文件的顶部。 + +``` +grid: +  columns: [45, 45] +  rows: [7, 7, 7, 4] +``` + +网格设置中的数字表示每个块的字符尺寸。默认配置是两列,每列 40 个字符,两行 13 个字符高,一行 4 个字符高。在上面的代码中,我使列更宽(`45,45`),行更小,并添加了第四行,所以我可以放更多的小部件。 + +![](https://opensource.com/sites/default/files/uploads/wtf-3.png) + +我喜欢在仪表板上看到当天的天气。有两个天气模块可供选择:[Weather][7],它只显示文本信息;[Pretty Weather][8] 则色彩丰富,并使用基于文本的图形显示。 + +``` +prettyweather: +  enabled: true +  position: +    top: 0 +    left: 1 +    height: 2 +    width: 1 +``` + +此代码创建了一个窗格,高为两个块(`height: 2`),宽为一个块(`width: 1`),位于顶行(`top: 0`)的第二列(`left: 1`)上,包含 Pretty Weather 模块. + +一些模块是交互式的,如 Jira、GitHub 和 Todo,您可以在其中滚动、更新和保存信息。您可以使用 Tab 键在交互式窗格之间移动。`\` 键会显示活动窗格的帮助屏幕,以便您可以查看可以执行的操作以及操作方式。Todo 模块允许您添加、编辑和删除待办事项,并在完成后勾掉它们。 + +![](https://opensource.com/sites/default/files/uploads/wtf-4.png) + +还有一些模块可以执行命令并显示输出、监视文本文件,以及监视构建和集成服务器的输出。所有文档都做得很好。 + +对于需要在不同来源的一个屏幕上查看大量数据的人来说,WTF 是一个有价值的工具。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/1/wtf-information-dashboard + +作者:[Kevein Sonney][a] +选题:[lujun9972][b] +译者:[wxy](https://github.com/wxy) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/ksonney +[b]: https://github.com/lujun9972 +[1]: https://en.wikipedia.org/wiki/Bloomberg_Terminal +[2]: https://github.com/tmux/tmux +[3]: https://www.gnu.org/software/screen/ +[4]: https://wtfutil.com/ +[5]: https://golang.org/ +[6]: https://wtfutil.com/posts/modules/ +[7]: https://wtfutil.com/posts/modules/weather/ +[8]: https://wtfutil.com/posts/modules/prettyweather/ From b555c287567dc26b01b36e76352650bff922e18d Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Sun, 27 Jan 2019 23:37:09 +0800 Subject: [PATCH 159/243] PUB:20190118 Get started with WTF, a dashboard for the terminal.md @wxy https://linux.cn/article-10484-1.html --- ... Get started with WTF, a dashboard for the terminal.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) rename {translated/tech => published}/20190118 Get started with WTF, a dashboard for the terminal.md (97%) diff --git a/translated/tech/20190118 Get started with WTF, a dashboard for the terminal.md b/published/20190118 Get started with WTF, a dashboard for the terminal.md similarity index 97% rename from translated/tech/20190118 Get started with WTF, a dashboard for the terminal.md rename to published/20190118 Get started with WTF, a dashboard for the terminal.md index 5bb1d135af..c7da18b982 100644 --- a/translated/tech/20190118 Get started with WTF, a dashboard for the terminal.md +++ b/published/20190118 Get started with WTF, a dashboard for the terminal.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (wxy) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-10484-1.html) [#]: subject: (Get started with WTF, a dashboard for the terminal) [#]: via: (https://opensource.com/article/19/1/wtf-information-dashboard) [#]: author: (Kevein Sonney https://opensource.com/users/ksonney) @@ -75,7 +75,7 @@ via: https://opensource.com/article/19/1/wtf-information-dashboard 作者:[Kevein Sonney][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/) 荣誉推出 From e7c84daf3fbbd59b3075a439c20b26fa8f158973 Mon Sep 17 00:00:00 2001 From: geekpi Date: Mon, 28 Jan 2019 08:51:55 +0800 Subject: [PATCH 160/243] translated --- ...The Linux terminal is no one-trick pony.md | 66 ------------------- ...The Linux terminal is no one-trick pony.md | 66 +++++++++++++++++++ 2 files changed, 66 insertions(+), 66 deletions(-) delete mode 100644 sources/tech/20181214 The Linux terminal is no one-trick pony.md create mode 100644 translated/tech/20181214 The Linux terminal is no one-trick pony.md diff --git a/sources/tech/20181214 The Linux terminal is no one-trick pony.md b/sources/tech/20181214 The Linux terminal is no one-trick pony.md deleted file mode 100644 index 56b7711659..0000000000 --- a/sources/tech/20181214 The Linux terminal is no one-trick pony.md +++ /dev/null @@ -1,66 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (geekpi) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (The Linux terminal is no one-trick pony) -[#]: via: (https://opensource.com/article/18/12/linux-toy-ponysay) -[#]: author: (Jason Baker https://opensource.com/users/jason-baker) - -The Linux terminal is no one-trick pony -====== -Bring the magic of My Little Pony to your Linux command line. -![](https://opensource.com/sites/default/files/styles/image-full-size/public/uploads/linux-toy-ponysay.png?itok=ehl6pTr_) - -Welcome to another day of the Linux command-line toys advent calendar. If this is your first visit to the series, you might be asking yourself what a command-line toy even is. We’re figuring that out as we go, but generally, it could be a game, or any simple diversion that helps you have fun at the terminal. - -Some of you will have seen various selections from our calendar before, but we hope there’s at least one new thing for everyone. - -Reader [Lori][1] made the suggestion of today's toy in a comment on my previous article on [cowsay][2]: - -"Hmmm, I've been playing with something called ponysay which seems to be a full-color variant on your cowsay." - -Intrigued, I had to check it out, and I was not disappointed with what I found. - -In a nutshell, **[ponysay][3]** is exactly that: a rewrite of **cowsay** that includes many full-color characters from [My Little Pony][4], that you can use to output phrases at the Linux command line. It's actually a really well-done project, that features over 400 characters and character combinations, and is incredibly well documented in a [78-page PDF][5] covering full usage. - -To install **ponysay** , you'll want to check out the project [README][6] to select the installation method that works best for your distribution and situation. Since ponysay didn't appear to be packaged for my distribution, Fedora, I opted to try out the Docker container image, but do what works best for you; installation from source may also work for you. - -I was curious to try out [**podman**][7] as a drop-in replacement for **docker** for a casual container users, and for me at least, it just worked! - -``` -$ podman run -ti --rm mpepping/ponysay 'Ponytastic' -``` - -The outputs are amazing, and I challenge you to try it out and let me know your favorite. Here was one of mine: - -![](https://opensource.com/sites/default/files/uploads/linux-toy-ponysay-output.png) - -It's developers chose to write the code in [Pony][8]! (Update: Sadly, I was wrong about this. It's written in Python, though GitHub believes it to be Pony because of the file extensions.) Ponysay is licensed under the GPL version 3, and you can pick up its source code [on GitHub][3]. - -Do you have a favorite command-line toy that you think I ought to profile? The calendar for this series is mostly filled out but I've got a few spots left. Let me know in the comments below, and I'll check it out. If there's space, I'll try to include it. If not, but I get some good submissions, I'll do a round-up of honorable mentions at the end. - -Check out yesterday's toy, [Relax by the fire at your Linux terminal][9], and check back tomorrow for another! - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/18/12/linux-toy-ponysay - -作者:[Jason Baker][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://opensource.com/users/jason-baker -[b]: https://github.com/lujun9972 -[1]: https://opensource.com/users/n8chz -[2]: https://opensource.com/article/18/12/linux-toy-cowsay -[3]: https://github.com/erkin/ponysay -[4]: https://en.wikipedia.org/wiki/My_Little_Pony -[5]: https://github.com/erkin/ponysay/blob/master/ponysay.pdf?raw=true -[6]: https://github.com/erkin/ponysay/blob/master/README.md -[7]: https://opensource.com/article/18/10/podman-more-secure-way-run-containers -[8]: https://opensource.com/article/18/5/pony -[9]: https://opensource.com/article/18/12/linux-toy-aafire diff --git a/translated/tech/20181214 The Linux terminal is no one-trick pony.md b/translated/tech/20181214 The Linux terminal is no one-trick pony.md new file mode 100644 index 0000000000..c33a8b0e85 --- /dev/null +++ b/translated/tech/20181214 The Linux terminal is no one-trick pony.md @@ -0,0 +1,66 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (The Linux terminal is no one-trick pony) +[#]: via: (https://opensource.com/article/18/12/linux-toy-ponysay) +[#]: author: (Jason Baker https://opensource.com/users/jason-baker) + +Linux 终端能做其他事 +====== +将小马宝莉的魔力带到终端 +![](https://opensource.com/sites/default/files/styles/image-full-size/public/uploads/linux-toy-ponysay.png?itok=ehl6pTr_) + +欢迎再次来到 Linux 命令行玩具日历。如果这是你第一次访问该系列,你甚至可能会问自己什么是命令行玩具。我们正在思考中,但一般来说,它可能是一个游戏,或任何简单的消遣,可以帮助你在终端玩得开心。 + +很可能你们中的一些人之前已经看过我们日历中的各种玩具,但我们希望每个人至少见到一件新事物。 + +读者 [Lori][1] 在我之前关于 [cowsay][2] 的文章的评论中提出了今天玩具的建议: + +“嗯,我一直在玩一个叫 ponysay 的东西,它似乎是你的 cowsay 的彩色变种。” + +我对此感到好奇,并去看了一下,发现没有让我失望。 + +简而言之,**[ponysay][3]** 的 **cowsay**的重写,它包括了来自[小马宝莉][4]中的许多全彩色人物,你可以用它在 Linux 命令行输出短句。它实际上是一个非常完善的项目,拥有超过 400 个字符和字符组合,它还有让人难以置信的的[ 78 页的 PDF 文档][5]涵盖了了所有的用法。 + +要安装 **ponysay**,你需要查看项目的 [README][6] 来选择最适合你的发行版和情况的安装方法。由于 ponysay 似乎没有为我的 Fedora 发行版打包,我选择试用 Docker 容器镜像,但你可以选择最适合你的方法。从源码安装可能也适合你。 + +作为一个业余容器用户,我很想试试 [**podman**][7] 来代替 **docker**。至少对于我而言,它可以正常工作。 + +``` +$ podman run -ti --rm mpepping/ponysay 'Ponytastic' +``` + +输出很神奇,我建议你也试下,然后告诉我你最喜欢的。这是我其中一个: + +![](https://opensource.com/sites/default/files/uploads/linux-toy-ponysay-output.png) + +它的开发人员选择用 [Pony][8] 来编写代码。(更新:很遗憾我写错了。虽然 Gihutb 根据它的文件扩展名认为它是 Pony,但是它是用 Python 写的。)Ponysay 使用 GPLv3 许可,你可以在 [GitHub][3] 中获取它的源码。 + +你有特别喜欢的命令行小玩具需要我介绍的吗?这个系列要介绍的小玩具大部分已经有了落实,但还预留了几个空位置。如果你有特别想了解的可以评论留言,我会查看的。如果还有空位置,我会考虑介绍它的。如果没有,但如果我得到了一些很好的意见,我会在最后做一些有价值的提及。 + +查看昨天的玩具,[在 Linux 终端中用火焰放松][9],记得明天再来! + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/18/12/linux-toy-ponysay + +作者:[Jason Baker][a] +选题:[lujun9972][b] +译者:[geekpi](https://github.com/geekpi) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/jason-baker +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/users/n8chz +[2]: https://opensource.com/article/18/12/linux-toy-cowsay +[3]: https://github.com/erkin/ponysay +[4]: https://en.wikipedia.org/wiki/My_Little_Pony +[5]: https://github.com/erkin/ponysay/blob/master/ponysay.pdf?raw=true +[6]: https://github.com/erkin/ponysay/blob/master/README.md +[7]: https://opensource.com/article/18/10/podman-more-secure-way-run-containers +[8]: https://opensource.com/article/18/5/pony +[9]: https://opensource.com/article/18/12/linux-toy-aafire From 5901202d1d4517ecbe92503b9db4735f22bcd493 Mon Sep 17 00:00:00 2001 From: geekpi Date: Mon, 28 Jan 2019 08:55:18 +0800 Subject: [PATCH 161/243] translating --- ...tarted with HomeBank, an open source personal finance app.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20190120 Get started with HomeBank, an open source personal finance app.md b/sources/tech/20190120 Get started with HomeBank, an open source personal finance app.md index 0c905c86f5..a925448cfb 100644 --- a/sources/tech/20190120 Get started with HomeBank, an open source personal finance app.md +++ b/sources/tech/20190120 Get started with HomeBank, an open source personal finance app.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (geekpi) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 648ae2536ed5b84a899e64238a1b07e26c357281 Mon Sep 17 00:00:00 2001 From: darksun Date: Mon, 28 Jan 2019 12:03:46 +0800 Subject: [PATCH 162/243] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190127=20Get=20?= =?UTF-8?q?started=20with=20eDEX-UI,=20a=20Tron-influenced=20terminal=20pr?= =?UTF-8?q?ogram=20for=20tablets=20and=20desktops=20sources/tech/20190127?= =?UTF-8?q?=20Get=20started=20with=20eDEX-UI,=20a=20Tron-influenced=20term?= =?UTF-8?q?inal=20program=20for=20tablets=20and=20desktops.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...rminal program for tablets and desktops.md | 55 +++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 sources/tech/20190127 Get started with eDEX-UI, a Tron-influenced terminal program for tablets and desktops.md diff --git a/sources/tech/20190127 Get started with eDEX-UI, a Tron-influenced terminal program for tablets and desktops.md b/sources/tech/20190127 Get started with eDEX-UI, a Tron-influenced terminal program for tablets and desktops.md new file mode 100644 index 0000000000..f181f4ebd1 --- /dev/null +++ b/sources/tech/20190127 Get started with eDEX-UI, a Tron-influenced terminal program for tablets and desktops.md @@ -0,0 +1,55 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Get started with eDEX-UI, a Tron-influenced terminal program for tablets and desktops) +[#]: via: (https://opensource.com/article/19/1/productivity-tool-edex-ui) +[#]: author: (Kevin Sonney https://opensource.com/users/ksonney (Kevin Sonney)) + +Get started with eDEX-UI, a Tron-influenced terminal program for tablets and desktops +====== +Make work more fun with eDEX-UI, the 15th in our series on open source tools that will make you more productive in 2019. +![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/button_push_open_keyboard_file_organize.png?itok=KlAsk1gx) + +There seems to be a mad rush at the beginning of every year to find ways to be more productive. New Year's resolutions, the itch to start the year off right, and of course, an "out with the old, in with the new" attitude all contribute to this. And the usual round of recommendations is heavily biased towards closed source and proprietary software. It doesn't have to be that way. + +Here's the 15th of my picks for 19 new (or new-to-you) open source tools to help you be more productive in 2019. + +### eDEX-UI + +I was 11 years old when [Tron][1] was in movie theaters. I cannot deny that, despite the fantastical nature of the film, it had an impact on my career choice later in life. + +![](https://opensource.com/sites/default/files/uploads/edex-ui-1.png) + +[eDEX-UI][2] is a cross-platform terminal program designed for tablets and desktops that was inspired by the user interface in Tron. It has five terminals in a tabbed interface, so it is easy to switch between tasks, as well as useful displays of system information. + +At launch, eDEX-UI goes through a boot sequence with information about the ElectronJS system it is based on. After the boot, eDEX-UI shows system information, a file browser, a keyboard (for tablets), and the main terminal tab. The other four tabs (labeled EMPTY) don't have anything loaded and will start a shell when you click on one. The default shell in eDEX-UI is Bash (if you are on Windows, you will likely have to change it to either PowerShell or cmd.exe). + +![](https://opensource.com/sites/default/files/uploads/edex-ui-2.png) + +Changing directories in the file browser will change directories in the active terminal and vice-versa. The file browser does everything you'd expect, including opening associated applications when you click on a file. The one exception is eDEX-UI's settings.json file (in .config/eDEX-UI by default), which opens the configuration editor instead. This allows you to set the shell command for the terminals, change the theme, and modify several other settings for the user interface. Themes are also stored in the configuration directory and, since they are also JSON files, creating a custom theme is pretty straightforward. + +![](https://opensource.com/sites/default/files/uploads/edex-ui-3.png) + +eDEX-UI allows you to run five terminals with full emulation. The default terminal type is xterm-color, meaning it has full-color support. One thing to be aware of is that the keys light up on the keyboard while you type, so if you're using eDEX-UI on a tablet, the keyboard could present a security risk in environments where people can see the screen. It is better to use a theme without the keyboard on those devices, although it does look pretty cool when you are typing. + +![](https://opensource.com/sites/default/files/uploads/edex-ui-4.png) + +While eDEX-UI supports only five terminal windows, that has been more than enough for me. On a tablet, eDEX-UI gives me that cyberspace feel without impacting my productivity. On a desktop, eDEX-UI allows all of that and lets me look cool in front of my co-workers. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/1/productivity-tool-edex-ui + +作者:[Kevin Sonney][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/ksonney (Kevin Sonney) +[b]: https://github.com/lujun9972 +[1]: https://en.wikipedia.org/wiki/Tron +[2]: https://github.com/GitSquared/edex-ui From 03c1561b44b4723cd079d01ce565cd39cc6ff023 Mon Sep 17 00:00:00 2001 From: darksun Date: Mon, 28 Jan 2019 12:06:04 +0800 Subject: [PATCH 163/243] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190123=20GStrea?= =?UTF-8?q?mer=20WebRTC:=20A=20flexible=20solution=20to=20web-based=20medi?= =?UTF-8?q?a=20sources/tech/20190123=20GStreamer=20WebRTC-=20A=20flexible?= =?UTF-8?q?=20solution=20to=20web-based=20media.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ... A flexible solution to web-based media.md | 108 ++++++++++++++++++ 1 file changed, 108 insertions(+) create mode 100644 sources/tech/20190123 GStreamer WebRTC- A flexible solution to web-based media.md diff --git a/sources/tech/20190123 GStreamer WebRTC- A flexible solution to web-based media.md b/sources/tech/20190123 GStreamer WebRTC- A flexible solution to web-based media.md new file mode 100644 index 0000000000..bb7e129ff3 --- /dev/null +++ b/sources/tech/20190123 GStreamer WebRTC- A flexible solution to web-based media.md @@ -0,0 +1,108 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (GStreamer WebRTC: A flexible solution to web-based media) +[#]: via: (https://opensource.com/article/19/1/gstreamer) +[#]: author: (Nirbheek Chauhan https://opensource.com/users/nirbheek) + +GStreamer WebRTC: A flexible solution to web-based media +====== +GStreamer's WebRTC implementation eliminates some of the shortcomings of using WebRTC in native apps, server applications, and IoT devices. + +![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/LAW-Internet_construction_9401467_520x292_0512_dc.png?itok=RPkPPtDe) + +Currently, [WebRTC.org][1] is the most popular and feature-rich WebRTC implementation. It is used in Chrome and Firefox and works well for browsers, but the Native API and implementation have several shortcomings that make it a less-than-ideal choice for uses outside of browsers, including native apps, server applications, and internet of things (IoT) devices. + +Last year, our company ([Centricular][2]) made an independent implementation of a Native WebRTC API available in GStreamer 1.14. This implementation is much easier to use and more flexible than the WebRTC.org Native API, is transparently compatible with WebRTC.org, has been tested with all browsers, and is already in production use. + +### What are GStreamer and WebRTC? + +[GStreamer][3] is an open source, cross-platform multimedia framework and one of the easiest and most flexible ways to implement any application that needs to play, record, or transform media-like data across a diverse scale of devices and products, including embedded (IoT, in-vehicle infotainment, phones, TVs, etc.), desktop (video/music players, video recording, non-linear editing, video conferencing, [VoIP][4] clients, browsers, etc.), servers (encode/transcode farms, video/voice conferencing servers, etc.), and [more][5]. + +The main feature that makes GStreamer the go-to multimedia framework for many people is its pipeline-based model, which solves one of the hardest problems in API design: catering to applications of varying complexity; from the simplest one-liners and quick solutions to those that need several hundreds of thousands of lines of code to implement their full feature set. If you want to learn how to use GStreamer, [Jan Schmidt's tutorial][6] from [LCA 2018][7] is a good place to start. + +[WebRTC][8] is a set of draft specifications that build upon existing [RTP][9], [RTCP][10], [SDP][11], [DTLS][12], [ICE][13], and other real-time communication (RTC) specifications and define an API for making them accessible using browser JavaScript (JS) APIs. + +People have been doing real-time communication over [IP][14] for [decades][15] with the protocols WebRTC builds upon. WebRTC's real innovation was creating a bridge between native applications and web apps by defining a standard yet flexible API that browsers can expose to untrusted JavaScript code. + +These specifications are [constantly being improved][16], which, combined with the ubiquitous nature of browsers, means WebRTC is fast becoming the standard choice for video conferencing on all platforms and for most applications. + +### **Everything is great, let's build amazing apps!** + +Not so fast, there's more to the story! For web apps, the [PeerConnection API][17] is [everywhere][18]. There are some browser-specific quirks, and the API keeps changing, but the [WebRTC JS adapter][19] handles most of that. Overall, the web app experience is mostly 👍. + +Unfortunately, for native code or applications that need more flexibility than a sandboxed JavaScript app can achieve, there haven't been a lot of great options. + +[Libwebrtc][20] (Google's implementation), [Janus][21], [Kurento][22], and [OpenWebRTC][23] have traditionally been the main contenders, but each implementation has its own inflexibilities, shortcomings, and constraints. + +Libwebrtc is still the most mature implementation, but it is also the most difficult to work with. Since it's embedded inside Chrome, it's a moving target and the project [is quite difficult to build and integrate][24]. These are all obstacles for native or server app developers trying to quickly prototype and experiment with things. + +Also, WebRTC was not built for multimedia, so the lower layers get in the way of non-browser use cases and applications. It is quite painful to do anything other than the default "set raw media, transmit" and "receive from remote, get raw media." This means if you want to use your own filters or hardware-specific codecs or sinks/sources, you end up having to fork libwebrtc. + +[**OpenWebRTC**][23] by Ericsson was the first attempt to rectify this situation. It was built on top of GStreamer. Its target audience was app developers, and it fit the bill quite well as a proof of concept—even though it used a custom API and some of the architectural decisions made it quite inflexible for most other uses. However, after an initial flurry of activity around the project, momentum petered out, the project failed to gather a community, and it is now effectively dead. Full disclosure: Centricular worked with Ericsson to polish some of the rough edges around the project immediately prior to its public release. + +### WebRTC in GStreamer + +GStreamer's WebRTC implementation gives you full control, as it does with any other [GStreamer pipeline][25]. + +As we said, the WebRTC standards build upon existing standards and protocols that serve similar purposes. GStreamer has supported almost all of them for a while now because they were being used for real-time communication, live streaming, and many other IP-based applications. This led Ericsson to choose GStreamer as the base for its OpenWebRTC project. + +Combined with the [SRTP][26] and DTLS plugins that were written during OpenWebRTC's development, it means that the implementation is built upon a solid and well-tested base, and implementing WebRTC features does not involve as much code-from-scratch work as one might presume. However, WebRTC is a large collection of standards, and reaching feature-parity with libwebrtc is an ongoing task. + +Due to decisions made while architecting WebRTCbin's internals, the API follows the PeerConnection specification quite closely. Therefore, almost all its missing features involve writing code that would plug into clearly defined sockets. For instance, since the GStreamer 1.14 release, the following features have been added to the WebRTC implementation and will be available in the next release of the GStreamer WebRTC: + + * Forward error correction + * RTP retransmission (RTX) + * RTP BUNDLE + * Data channels over SCTP + + + +We believe GStreamer's API is the most flexible, versatile, and easy to use WebRTC implementation out there, and it will only get better as time goes by. Bringing the power of pipeline-based multimedia manipulation to WebRTC opens new doors for interesting, unique, and highly efficient applications. If you'd like to demo the technology and play with the code, build and run [these demos][27], which include C, Rust, Python, and C# examples. + +Matthew Waters will present [GStreamer WebRTC—The flexible solution to web-based media][28] at [linux.conf.au][29], January 21-25 in Christchurch, New Zealand. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/1/gstreamer + +作者:[Nirbheek Chauhan][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/nirbheek +[b]: https://github.com/lujun9972 +[1]: http://webrtc.org/ +[2]: https://www.centricular.com/ +[3]: https://gstreamer.freedesktop.org/documentation/application-development/introduction/gstreamer.html +[4]: https://en.wikipedia.org/wiki/Voice_over_IP +[5]: https://wiki.ligo.org/DASWG/GstLAL +[6]: https://www.youtube.com/watch?v=ZphadMGufY8 +[7]: http://lca2018.linux.org.au/ +[8]: https://en.wikipedia.org/wiki/WebRTC +[9]: https://en.wikipedia.org/wiki/Real-time_Transport_Protocol +[10]: https://en.wikipedia.org/wiki/RTP_Control_Protocol +[11]: https://en.wikipedia.org/wiki/Session_Description_Protocol +[12]: https://en.wikipedia.org/wiki/Datagram_Transport_Layer_Security +[13]: https://en.wikipedia.org/wiki/Interactive_Connectivity_Establishment +[14]: https://en.wikipedia.org/wiki/Internet_Protocol +[15]: https://en.wikipedia.org/wiki/Session_Initiation_Protocol +[16]: https://datatracker.ietf.org/wg/rtcweb/documents/ +[17]: https://developer.mozilla.org/en-US/docs/Web/API/RTCPeerConnection +[18]: https://caniuse.com/#feat=rtcpeerconnection +[19]: https://github.com/webrtc/adapter +[20]: https://github.com/aisouard/libwebrtc +[21]: https://janus.conf.meetecho.com/ +[22]: https://www.kurento.org/kurento-architecture +[23]: https://en.wikipedia.org/wiki/OpenWebRTC +[24]: https://webrtchacks.com/building-webrtc-from-source/ +[25]: https://gstreamer.freedesktop.org/documentation/application-development/introduction/basics.html +[26]: https://en.wikipedia.org/wiki/Secure_Real-time_Transport_Protocol +[27]: https://github.com/centricular/gstwebrtc-demos/ +[28]: https://linux.conf.au/schedule/presentation/143/ +[29]: https://linux.conf.au/ From e8efcb0f11e8067cc29c234d164552ca7c0fe22a Mon Sep 17 00:00:00 2001 From: darksun Date: Mon, 28 Jan 2019 12:08:04 +0800 Subject: [PATCH 164/243] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190126=20Get=20?= =?UTF-8?q?started=20with=20Tint2,=20an=20open=20source=20taskbar=20for=20?= =?UTF-8?q?Linux=20sources/tech/20190126=20Get=20started=20with=20Tint2,?= =?UTF-8?q?=20an=20open=20source=20taskbar=20for=20Linux.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...Tint2, an open source taskbar for Linux.md | 59 +++++++++++++++++++ 1 file changed, 59 insertions(+) create mode 100644 sources/tech/20190126 Get started with Tint2, an open source taskbar for Linux.md diff --git a/sources/tech/20190126 Get started with Tint2, an open source taskbar for Linux.md b/sources/tech/20190126 Get started with Tint2, an open source taskbar for Linux.md new file mode 100644 index 0000000000..601b90370c --- /dev/null +++ b/sources/tech/20190126 Get started with Tint2, an open source taskbar for Linux.md @@ -0,0 +1,59 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Get started with Tint2, an open source taskbar for Linux) +[#]: via: (https://opensource.com/article/19/1/productivity-tool-tint2) +[#]: author: (Kevin Sonney https://opensource.com/users/ksonney (Kevin Sonney)) + +Get started with Tint2, an open source taskbar for Linux +====== + +Tint2, the 14th in our series on open source tools that will make you more productive in 2019, offers a consistent user experience with any window manager. + +![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/tools_hardware_purple.png?itok=3NdVoYhl) + +There seems to be a mad rush at the beginning of every year to find ways to be more productive. New Year's resolutions, the itch to start the year off right, and of course, an "out with the old, in with the new" attitude all contribute to this. And the usual round of recommendations is heavily biased towards closed source and proprietary software. It doesn't have to be that way. + +Here's the 14th of my picks for 19 new (or new-to-you) open source tools to help you be more productive in 2019. + +### Tint2 + +One of the best ways for me to be more productive is to use a clean interface with as little distraction as possible. As a Linux user, this means using a minimal window manager like [Openbox][1], [i3][2], or [Awesome][3]. Each has customization options that make me more efficient. The one thing that slows me down is that none has a consistent configuration, so I have to tweak and re-tune my window manager constantly. + +![](https://opensource.com/sites/default/files/uploads/tint2-1.png) + +[Tint2][4] is a lightweight panel and taskbar that provides a consistent experience with any window manager. It is included with most distributions, so it is as easy to install as any other package. + +It includes two programs, Tint2 and Tint2conf. At first launch, Tint2 starts with its default layout and theme. The default configuration includes multiple web browsers, the tint2conf program, a taskbar, and a system tray. + +![](https://opensource.com/sites/default/files/uploads/tint2-2.png) + +Launching the configuration tool allows you to select from the included themes and customize the top, bottom, and sides of the screen. I recommend starting with the theme that is closest to what you want and customizing from there. + +![](https://opensource.com/sites/default/files/uploads/tint2-3.png) + +Within the themes, you can customize where panel items are placed as well as background and font options for every item on the panel. You can also add and remove items from the launcher. + +![](https://opensource.com/sites/default/files/uploads/tint2-4.png) + +Tint2 is a lightweight taskbar that helps you get to the tools you need quickly and efficiently. It is highly customizable, unobtrusive (unless the user wants it not to be), and compatible with almost any window manager on a Linux desktop. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/1/productivity-tool-tint2 + +作者:[Kevin Sonney][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/ksonney (Kevin Sonney) +[b]: https://github.com/lujun9972 +[1]: http://openbox.org/wiki/Main_Page +[2]: https://i3wm.org/ +[3]: https://awesomewm.org/ +[4]: https://gitlab.com/o9000/tint2 From b883b0a4ff690beb1db6ac9d8ffc6b85a2d539aa Mon Sep 17 00:00:00 2001 From: darksun Date: Mon, 28 Jan 2019 12:15:05 +0800 Subject: [PATCH 165/243] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190125=20Top=20?= =?UTF-8?q?5=20Linux=20Distributions=20for=20Development=20in=202019=20sou?= =?UTF-8?q?rces/tech/20190125=20Top=205=20Linux=20Distributions=20for=20De?= =?UTF-8?q?velopment=20in=202019.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...x Distributions for Development in 2019.md | 161 ++++++++++++++++++ 1 file changed, 161 insertions(+) create mode 100644 sources/tech/20190125 Top 5 Linux Distributions for Development in 2019.md diff --git a/sources/tech/20190125 Top 5 Linux Distributions for Development in 2019.md b/sources/tech/20190125 Top 5 Linux Distributions for Development in 2019.md new file mode 100644 index 0000000000..b3e2de22ba --- /dev/null +++ b/sources/tech/20190125 Top 5 Linux Distributions for Development in 2019.md @@ -0,0 +1,161 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Top 5 Linux Distributions for Development in 2019) +[#]: via: (https://www.linux.com/blog/2019/1/top-5-linux-distributions-development-2019) +[#]: author: (Jack Wallen https://www.linux.com/users/jlwallen) + +Top 5 Linux Distributions for Development in 2019 +====== + +![](https://www.linux.com/sites/lcom/files/styles/rendered_file/public/dev-main.jpg?itok=DEe9pYtb) + +One of the most popular tasks undertaken on Linux is development. With good reason: Businesses rely on Linux. Without Linux, technology simply wouldn’t meet the demands of today’s ever-evolving world. Because of that, developers are constantly working to improve the environments with which they work. One way to manage such improvements is to have the right platform to start with. Thankfully, this is Linux, so you always have a plethora of choices. + +But sometimes, too many choices can be a problem in and of itself. Which distribution is right for your development needs? That, of course, depends on what you’re developing, but certain distributions that just make sense to use as a foundation for your task. I’ll highlight five distributions I consider the best for developers in 2019. + +### Ubuntu + +Let’s not mince words here. Although the Linux Mint faithful are an incredibly loyal group (with good reason, their distro of choice is fantastic), Ubuntu Linux gets the nod here. Why? Because, thanks to the likes of [AWS][1], Ubuntu is one of the most deployed server operating systems. That means developing on a Ubuntu desktop distribution makes for a much easier translation to Ubuntu Server. And because Ubuntu makes it incredibly easy to develop for, work with, and deploy containers, it makes perfect sense that you’d want to work with this platform. Couple that with Ubuntu’s inclusion of Snap Packages, and Canonical's operating system gets yet another boost in popularity. + +But it’s not just about what you can do with Ubuntu, it’s how easily you can do it. For nearly every task, Ubuntu is an incredibly easy distribution to use. And because Ubuntu is so popular, chances are every tool and IDE you want to work with can be easily installed from the Ubuntu Software GUI (Figure 1). + +![Ubuntu][3] + +Figure 1: Developer tools found in the Ubuntu Software tool. + +[Used with permission][4] + +If you’re looking for ease of use, simplicity of migration, and plenty of available tools, you cannot go wrong with Ubuntu as a development platform. + +### openSUSE + +There’s a very specific reason why I add openSUSE to this list. Not only is it an outstanding desktop distribution, it’s also one of the best rolling releases you’ll find on the market. So if you’re wanting to develop with and release for the most recent software available, [openSUSE Tumbleweed][5] should be one of your top choices. If you want to leverage the latest releases of your favorite IDEs, if you always want to make sure you’re developing with the most recent libraries and toolkits, Tumbleweed is your platform. + +But openSUSE doesn’t just offer a rolling release distribution. If you’d rather make use of a standard release platform, [openSUSE Leap][6] is what you want. + +Of course, it’s not just about standard or rolling releases. The openSUSE platform also has a Kubernetes-specific release, called [Kubic][7], which is based on Kubernetes atop openSUSE MicroOS. But even if you aren’t developing for Kubernetes, you’ll find plenty of software and tools to work with. + +And openSUSE also offers the ability to select your desktop environment, or (should you chose) a generic desktop or server (Figure 2). + +![openSUSE][9] + +Figure 2: The openSUSE Tumbleweed installation in action. + +[Used with permission][4] + +### Fedora + +Using Fedora as a development platform just makes sense. Why? The distribution itself seems geared toward developers. With a regular, six month release cycle, developers can be sure they won’t be working with out of date software for long. This can be important, when you need the most recent tools and libraries. And if you’re developing for enterprise-level businesses, Fedora makes for an ideal platform, as it is the upstream for Red Hat Enterprise Linux. What that means is the transition to RHEL should be painless. That’s important, especially if you hope to bring your project to a much larger market (one with deeper pockets than a desktop-centric target). + +Fedora also offers one of the best GNOME experiences you’ll come across (Figure 3). This translates to a very stable and fast desktops. + +![GNOME][11] + +Figure 3: The GNOME desktop on Fedora. + +[Used with permission][4] + +But if GNOME isn’t your jam, you can opt to install one of the [Fedora spins][12] (which includes KDE, XFCE, LXQT, Mate-Compiz, Cinnamon, LXDE, and SOAS). + +### Pop!_OS + +I’d be remiss if I didn’t include [System76][13]’s platform, customized specifically for their hardware (although it does work fine on other hardware). Why would I include such a distribution, especially one that doesn’t really venture far away from the Ubuntu platform for which is is based? Primarily because this is the distribution you want if you plan on purchasing a desktop or laptop from System76. But why would you do that (especially given that Linux works on nearly all off-the-shelf hardware)? Because System76 sells outstanding hardware. With the release of their Thelio desktop, you have available one of the most powerful desktop computers on the market. If you’re developing seriously large applications (especially ones that lean heavily on very large databases or require a lot of processing power for compilation), why not go for the best? And since Pop!_OS is perfectly tuned for System76 hardware, this is a no-brainer. +Since Pop!_OS is based on Ubuntu, you’ll have all the tools available to the base platform at your fingertips (Figure 4). + +![Pop!_OS][15] + +Figure 4: The Anjunta IDE running on Pop!_OS. + +[Used with permission][4] + +Pop!_OS also defaults to encrypted drives, so you can trust your work will be safe from prying eyes (should your hardware fall into the wrong hands). + +### Manjaro + +For anyone that likes the idea of developing on Arch Linux, but doesn’t want to have to jump through all the hoops of installing and working with Arch Linux, there’s Manjaro. Manjaro makes it easy to have an Arch Linux-based distribution up and running (as easily as installing and using, say, Ubuntu). + +But what makes Manjaro developer-friendly (besides enjoying that Arch-y goodness at the base) is how many different flavors you’ll find available for download. From the [Manjaro download page][16], you can grab the following flavors: + + * GNOME + + * XFCE + + * KDE + + * OpenBox + + * Cinnamon + + * I3 + + * Awesome + + * Budgie + + * Mate + + * Xfce Developer Preview + + * KDE Developer Preview + + * GNOME Developer Preview + + * Architect + + * Deepin + + + + +Of note are the developer editions (which are geared toward testers and developers), the Architect edition (which is for users who want to build Manjaro from the ground up), and the Awesome edition (Figure 5 - which is for developers dealing with everyday tasks). The one caveat to using Manjaro is that, like any rolling release, the code you develop today may not work tomorrow. Because of this, you need to think with a certain level of agility. Of course, if you’re not developing for Manjaro (or Arch), and you’re doing more generic (or web) development, that will only affect you if the tools you use are updated and no longer work for you. Chances of that happening, however, are slim. And like with most Linux distributions, you’ll find a ton of developer tools available for Manjaro. + +![Manjaro][18] + +Figure 5: The Manjaro Awesome Edition is great for developers. + +[Used with permission][4] + +Manjaro also supports the Arch User Repository (a community-driven repository for Arch users), which includes cutting edge software and libraries, as well as proprietary applications like [Unity Editor][19] or yEd. A word of warning, however, about the Arch User Repository: It was discovered that the AUR contained software considered to be malicious. So, if you opt to work with that repository, do so carefully and at your own risk. + +### Any Linux Will Do + +Truth be told, if you’re a developer, just about any Linux distribution will work. This is especially true if you do most of your development from the command line. But if you prefer a good GUI running on top of a reliable desktop, give one of these distributions a try, they will not disappoint. + +Learn more about Linux through the free ["Introduction to Linux" ][20]course from The Linux Foundation and edX. + +-------------------------------------------------------------------------------- + +via: https://www.linux.com/blog/2019/1/top-5-linux-distributions-development-2019 + +作者:[Jack Wallen][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.linux.com/users/jlwallen +[b]: https://github.com/lujun9972 +[1]: https://aws.amazon.com/ +[2]: https://www.linux.com/files/images/dev1jpg +[3]: https://www.linux.com/sites/lcom/files/styles/rendered_file/public/dev_1.jpg?itok=7QJQWBKi (Ubuntu) +[4]: https://www.linux.com/licenses/category/used-permission +[5]: https://en.opensuse.org/Portal:Tumbleweed +[6]: https://en.opensuse.org/Portal:Leap +[7]: https://software.opensuse.org/distributions/tumbleweed +[8]: /files/images/dev2jpg +[9]: https://www.linux.com/sites/lcom/files/styles/rendered_file/public/dev_2.jpg?itok=1GJmpr1t (openSUSE) +[10]: /files/images/dev3jpg +[11]: https://www.linux.com/sites/lcom/files/styles/rendered_file/public/dev_3.jpg?itok=_6Ki4EOo (GNOME) +[12]: https://spins.fedoraproject.org/ +[13]: https://system76.com/ +[14]: /files/images/dev4jpg +[15]: https://www.linux.com/sites/lcom/files/styles/rendered_file/public/dev_4.jpg?itok=nNG2Ax24 (Pop!_OS) +[16]: https://manjaro.org/download/ +[17]: /files/images/dev5jpg +[18]: https://www.linux.com/sites/lcom/files/styles/rendered_file/public/dev_5.jpg?itok=RGfF2UEi (Manjaro) +[19]: https://unity3d.com/unity/editor +[20]: https://training.linuxfoundation.org/linux-courses/system-administration-training/introduction-to-linux From 2a5eaf7780cfed47bb3e5ab47a1155435745c1a5 Mon Sep 17 00:00:00 2001 From: darksun Date: Mon, 28 Jan 2019 12:56:51 +0800 Subject: [PATCH 166/243] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190124=20ODrive?= =?UTF-8?q?=20(Open=20Drive)=20=E2=80=93=20Google=20Drive=20GUI=20Client?= =?UTF-8?q?=20For=20Linux=20sources/tech/20190124=20ODrive=20(Open=20Drive?= =?UTF-8?q?)=20-=20Google=20Drive=20GUI=20Client=20For=20Linux.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...ve) - Google Drive GUI Client For Linux.md | 127 ++++++++++++++++++ 1 file changed, 127 insertions(+) create mode 100644 sources/tech/20190124 ODrive (Open Drive) - Google Drive GUI Client For Linux.md diff --git a/sources/tech/20190124 ODrive (Open Drive) - Google Drive GUI Client For Linux.md b/sources/tech/20190124 ODrive (Open Drive) - Google Drive GUI Client For Linux.md new file mode 100644 index 0000000000..71a91ec3d8 --- /dev/null +++ b/sources/tech/20190124 ODrive (Open Drive) - Google Drive GUI Client For Linux.md @@ -0,0 +1,127 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (ODrive (Open Drive) – Google Drive GUI Client For Linux) +[#]: via: (https://www.2daygeek.com/odrive-open-drive-google-drive-gui-client-for-linux/) +[#]: author: (Magesh Maruthamuthu https://www.2daygeek.com/author/magesh/) + +ODrive (Open Drive) – Google Drive GUI Client For Linux +====== + +This we had discussed in so many times. However, i will give a small introduction about it. + +As of now there is no official Google Drive Client for Linux and we need to use unofficial clients. + +There are many applications available in Linux for Google Drive integration. + +Each application has came out with set of features. + +We had written few articles about this in our website in the past. + +Those are **[DriveSync][1]** , **[Google Drive Ocamlfuse Client][2]** and **[Mount Google Drive in Linux Using Nautilus File Manager][3]**. + +Today also we are going to discuss about the same topic and the utility name is ODrive. + +### What’s ODrive? + +ODrive stands for Open Drive. It’s a GUI client for Google Drive which was written in electron framework. + +It’s simple GUI which allow users to integrate the Google Drive with few steps. + +### How To Install & Setup ODrive on Linux? + +Since the developer is offering the AppImage package and there is no difficulty for installing the ODrive on Linux. + +Simple download the latest ODrive AppImage package from developer github page using **wget Command**. + +``` +$ wget https://github.com/liberodark/ODrive/releases/download/0.1.3/odrive-0.1.3-x86_64.AppImage +``` + +You have to set executable file permission to the ODrive AppImage file. + +``` +$ chmod +x odrive-0.1.3-x86_64.AppImage +``` + +Simple run the following ODrive AppImage file to launch the ODrive GUI for further setup. + +``` +$ ./odrive-0.1.3-x86_64.AppImage +``` + +You might get the same window like below when you ran the above command. Just hit the **`Next`** button for further setup. +![][5] + +Click **`Connect`** link to add a Google drive account. +![][6] + +Enter your email id which you want to setup a Google Drive account. +![][7] + +Enter your password for the given email id. +![][8] + +Allow ODrive (Open Drive) to access your Google account. +![][9] + +By default, it will choose the folder location. You can change if you want to use the specific one. +![][10] + +Finally hit **`Synchronize`** button to start download the files from Google Drive to your local system. +![][11] + +Synchronizing is in progress. +![][12] + +Once synchronizing is completed. It will show you all files downloaded. +Once synchronizing is completed. It’s shows you that all the files has been downloaded. +![][13] + +I have seen all the files were downloaded in the mentioned directory. +![][14] + +If you want to sync any new files from local system to Google Drive. Just start the `ODrive` from the application menu but it won’t actual launch the application. But it will be running in the background that we can able to see by using the ps command. + +``` +$ ps -df | grep odrive +``` + +![][15] + +It will automatically sync once you add a new file into the google drive folder. The same has been checked through notification menu. Yes, i can see one file was synced to Google Drive. +![][16] + +GUI is not loading after sync, and i’m not sure this functionality. I will check with developer and will add update based on his input. + +-------------------------------------------------------------------------------- + +via: https://www.2daygeek.com/odrive-open-drive-google-drive-gui-client-for-linux/ + +作者:[Magesh Maruthamuthu][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.2daygeek.com/author/magesh/ +[b]: https://github.com/lujun9972 +[1]: https://www.2daygeek.com/drivesync-google-drive-sync-client-for-linux/ +[2]: https://www.2daygeek.com/mount-access-google-drive-on-linux-with-google-drive-ocamlfuse-client/ +[3]: https://www.2daygeek.com/mount-access-setup-google-drive-in-linux/ +[4]: data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7 +[5]: https://www.2daygeek.com/wp-content/uploads/2019/01/odrive-open-drive-google-drive-gui-client-for-linux-1.png +[6]: https://www.2daygeek.com/wp-content/uploads/2019/01/odrive-open-drive-google-drive-gui-client-for-linux-2.png +[7]: https://www.2daygeek.com/wp-content/uploads/2019/01/odrive-open-drive-google-drive-gui-client-for-linux-3.png +[8]: https://www.2daygeek.com/wp-content/uploads/2019/01/odrive-open-drive-google-drive-gui-client-for-linux-4.png +[9]: https://www.2daygeek.com/wp-content/uploads/2019/01/odrive-open-drive-google-drive-gui-client-for-linux-5.png +[10]: https://www.2daygeek.com/wp-content/uploads/2019/01/odrive-open-drive-google-drive-gui-client-for-linux-6.png +[11]: https://www.2daygeek.com/wp-content/uploads/2019/01/odrive-open-drive-google-drive-gui-client-for-linux-7.png +[12]: https://www.2daygeek.com/wp-content/uploads/2019/01/odrive-open-drive-google-drive-gui-client-for-linux-8a.png +[13]: https://www.2daygeek.com/wp-content/uploads/2019/01/odrive-open-drive-google-drive-gui-client-for-linux-9.png +[14]: https://www.2daygeek.com/wp-content/uploads/2019/01/odrive-open-drive-google-drive-gui-client-for-linux-11.png +[15]: https://www.2daygeek.com/wp-content/uploads/2019/01/odrive-open-drive-google-drive-gui-client-for-linux-9b.png +[16]: https://www.2daygeek.com/wp-content/uploads/2019/01/odrive-open-drive-google-drive-gui-client-for-linux-10.png From cb141a76e2ef5c575e4d7631ec14e222c88ff709 Mon Sep 17 00:00:00 2001 From: darksun Date: Mon, 28 Jan 2019 13:03:08 +0800 Subject: [PATCH 167/243] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190124=20Get=20?= =?UTF-8?q?started=20with=20LogicalDOC,=20an=20open=20source=20document=20?= =?UTF-8?q?management=20system=20sources/tech/20190124=20Get=20started=20w?= =?UTF-8?q?ith=20LogicalDOC,=20an=20open=20source=20document=20management?= =?UTF-8?q?=20system.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ... open source document management system.md | 62 +++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100644 sources/tech/20190124 Get started with LogicalDOC, an open source document management system.md diff --git a/sources/tech/20190124 Get started with LogicalDOC, an open source document management system.md b/sources/tech/20190124 Get started with LogicalDOC, an open source document management system.md new file mode 100644 index 0000000000..21687c0ce3 --- /dev/null +++ b/sources/tech/20190124 Get started with LogicalDOC, an open source document management system.md @@ -0,0 +1,62 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Get started with LogicalDOC, an open source document management system) +[#]: via: (https://opensource.com/article/19/1/productivity-tool-logicaldoc) +[#]: author: (Kevin Sonney https://opensource.com/users/ksonney) + +Get started with LogicalDOC, an open source document management system +====== +Keep better track of document versions with LogicalDOC, the 12th in our series on open source tools that will make you more productive in 2019. + +![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/document_free_access_cut_security.png?itok=ocvCv8G2) + +There seems to be a mad rush at the beginning of every year to find ways to be more productive. New Year's resolutions, the itch to start the year off right, and of course, an "out with the old, in with the new" attitude all contribute to this. And the usual round of recommendations is heavily biased towards closed source and proprietary software. It doesn't have to be that way. + +Here's the 12th of my picks for 19 new (or new-to-you) open source tools to help you be more productive in 2019. + +### LogicalDOC + +Part of being productive is being able to find what you need when you need it. We've all seen directories full of similar files with similar names, a result of renaming them every time a document changes to keep track of all the versions. For example, my wife is a writer, and she often saves document revisions with new names before she sends them to reviewers. + +![](https://opensource.com/sites/default/files/uploads/logicaldoc-1.png) + +A coder's natural solution to this problem—Git or another version control tool—won't work for document creators because the systems used for code often don't play nice with the formats used by commercial text editors. And before someone says, "just change formats," [that isn't an option for everyone][1]. Also, many version control tools are not very friendly for the less technically inclined. In large organizations, there are tools to solve this problem, but they also require the resources of a large organization to run, manage, and support them. + +![](https://opensource.com/sites/default/files/uploads/logicaldoc-2.png) + +[LogicalDOC CE][2] is an open source document management system built to solve this problem. It allows users to check in, check out, version, search, and lock document files and keeps a history of versions, similar to the version control tools used by coders. + +LogicalDOC can be [installed][3] on Linux, MacOS, and Windows using a Java-based installer. During installation, you'll be prompted for details on the database where its data will be stored and have an option for a local-only file store. You'll get the URL and a default username and password to access the server as well as an option to save a script to automate future installations. + +After you log in, LogicalDOC's default screen lists the documents you have tagged, checked out, and any recent notes on them. Switching to the Documents tab will show the files you have access to. You can upload documents by selecting a file through the interface or using drag and drop. If you upload a ZIP file, LogicalDOC will expand it and add its individual files to the repository. + +![](https://opensource.com/sites/default/files/uploads/logicaldoc-3.png) + +Right-clicking on a file will bring up a menu of options to check out files, lock files against changes, and do a whole host of other things. Checking out a file downloads it to your local machine where it can be edited. A checked-out file cannot be modified by anyone else until it's checked back in. When the file is checked back in (using the same menu), the user can add tags to the version and is required to comment on what was done to it. + +![](https://opensource.com/sites/default/files/uploads/logicaldoc-4.png) + +Going back and looking at earlier versions is as easy as downloading them from the Versions page. There are also import and export options for some third-party services, with [Dropbox][4] support built-in. + +Document management is not just for big companies that can afford expensive solutions. LogicalDOC helps you keep track of the documents you're using with a revision history and a safe repository for documents that are otherwise difficult to manage. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/1/productivity-tool-logicaldoc + +作者:[Kevin Sonney][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/ksonney (Kevin Sonney) +[b]: https://github.com/lujun9972 +[1]: http://www.antipope.org/charlie/blog-static/2013/10/why-microsoft-word-must-die.html +[2]: https://www.logicaldoc.com/download-logicaldoc-community +[3]: https://docs.logicaldoc.com/en/installation +[4]: https://dropbox.com From bfb56404e93927bebb67fed1b1b23c1aeba23fe4 Mon Sep 17 00:00:00 2001 From: darksun Date: Mon, 28 Jan 2019 13:05:02 +0800 Subject: [PATCH 168/243] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190124=20What?= =?UTF-8?q?=20does=20DevOps=20mean=20to=20you=3F=20sources/tech/20190124?= =?UTF-8?q?=20What=20does=20DevOps=20mean=20to=20you.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../20190124 What does DevOps mean to you.md | 143 ++++++++++++++++++ 1 file changed, 143 insertions(+) create mode 100644 sources/tech/20190124 What does DevOps mean to you.md diff --git a/sources/tech/20190124 What does DevOps mean to you.md b/sources/tech/20190124 What does DevOps mean to you.md new file mode 100644 index 0000000000..c62f0f83ba --- /dev/null +++ b/sources/tech/20190124 What does DevOps mean to you.md @@ -0,0 +1,143 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (What does DevOps mean to you?) +[#]: via: (https://opensource.com/article/19/1/what-does-devops-mean-you) +[#]: author: (Girish Managoli https://opensource.com/users/gammay) + +What does DevOps mean to you? +====== +6 experts break down DevOps and the practices and philosophies key to making it work. + +![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/innovation_lightbulb_gears_devops_ansible.png?itok=TSbmp3_M) + +It's said if you ask 10 people about DevOps, you will get 12 answers. This is a result of the diversity in opinions and expectations around DevOps—not to mention the disparity in its practices. + +To decipher the paradoxes around DevOps, we went to the people who know it the best—its top practitioners around the industry. These are people who have been around the horn, who know the ins and outs of technology, and who have practiced DevOps for years. Their viewpoints should encourage, stimulate, and provoke your thoughts around DevOps. + +### What does DevOps mean to you? + +Let's start with the fundamentals. We're not looking for textbook answers, rather we want to know what the experts say. + +In short, the experts say DevOps is about principles, practices, and tools. + +[Ann Marie Fred][1], DevOps lead for IBM Digital Business Group's Commerce Platform, says, "to me, DevOps is a set of principles and practices designed to make teams more effective in designing, developing, delivering, and operating software." + +According to [Daniel Oh][2], senior DevOps evangelist at Red Hat, "in general, DevOps is compelling for enterprises to evolve current IT-based processes and tools related to app development, IT operations, and security protocol." + +[Brent Reed][3], founder of Tactec Strategic Solutions, talks about continuous improvement for the stakeholders. "DevOps means to me a way of working that includes a mindset that allows for continuous improvement for operational performance, maturing to organizational performance, resulting in delighted stakeholders." + +Many of the experts also emphasize culture. Ann Marie says, "it's also about continuous improvement and learning. It's about people and culture as much as it is about tools and technology." + +To [Dan Barker][4], chief architect and DevOps leader at the National Association of Insurance Commissioners (NAIC), "DevOps is primarily about culture. … It has brought several independent areas together like lean, [just culture][5], and continuous learning. And I see culture as being the most critical and the hardest to execute on." + +[Chris Baynham-Hughes][6], head of DevOps at Atos, says, "[DevOps] practice is adopted through the evolution of culture, process, and tooling within an organization. The key focus is culture change, and the key tenants of DevOps culture are collaboration, experimentation, fast-feedback, and continuous improvement." + +[Geoff Purdy][7], cloud architect, talks about agility and feedback "shortening and amplifying feedback loops. We want teams to get feedback in minutes rather than weeks." + +But in the end, Daniel nails it by explaining how open source and open culture allow him to achieve his goals "in easy and quick ways. In DevOps initiatives, the most important thing for me should be open culture rather than useful tools, multiple solutions." + +### What DevOps practices have you found effective? + +"Picking one, automated provisioning has been hugely effective for my team. " + +The most effective practices cited by the experts are pervasive yet disparate. + +According to Ann Marie, "some of the most powerful [practices] are agile project management; breaking down silos between cross-functional, autonomous squads; fully automated continuous delivery; green/blue deploys for zero downtime; developers setting up their own monitoring and alerting; blameless post-mortems; automating security and compliance." + +Chris says, "particular breakthroughs have been empathetic collaboration; continuous improvement; open leadership; reducing distance to the business; shifting from vertical silos to horizontal, cross-functional product teams; work visualization; impact mapping; Mobius loop; shortening of feedback loops; automation (from environments to CI/CD)." + +Brent supports "evolving a learning culture that includes TDD [test-driven development] and BDD [behavior-driven development] capturing of a story and automating the sequences of events that move from design, build, and test through implementation and production with continuous integration and delivery pipelines. A fail-first approach to testing, the ability to automate integration and delivery processes and include fast feedback throughout the lifecycle." + +Geoff highlights automated provisioning. "Picking one, automated provisioning has been hugely effective for my team. More specifically, automated provisioning from a versioned Infrastructure-as-Code codebase." + +Dan uses fun. "We do a lot of different things to create a DevOps culture. We hold 'lunch and learns' with free food to encourage everyone to come and learn together; we buy books and study in groups." + +### How do you motivate your team to achieve DevOps goals? + +``` +"Celebrate wins and visualize the progress made." +``` + +Daniel emphasizes "automation that matters. In order to minimize objection from multiple teams in a DevOps initiative, you should encourage your team to increase the automation capability of development, testing, and IT operations along with new processes and procedures. For example, a Linux container is the key tool to achieve the automation capability of DevOps." + +Geoff agrees, saying, "automate the toil. Are there tasks you hate doing? Great. Engineer them out of existence if possible. Otherwise, automate them. It keeps the job from becoming boring and routine because the job constantly evolves." + +Dan, Ann Marie, and Brent stress team motivation. + +Dan says, "at the NAIC, we have a great awards system for encouraging specific behaviors. We have multiple tiers of awards, and two of them can be given to anyone by anyone. We also give awards to teams after they complete something significant, but we often award individual contributors." + +According to Ann Marie, "the biggest motivator for teams in my area is seeing the success of others. We have a weekly playback for each other, and part of that is sharing what we've learned from trying out new tools or practices. When teams are enthusiastic about something they're doing and willing to help others get started, more teams will quickly get on board." + +Brent agrees. "Getting everyone educated and on the same baseline of knowledge is essential ... assessing what helps the team achieve [and] what it needs to deliver with the product owner and users is the first place I like to start." + +Chris recommends a two-pronged approach. "Run small, weekly goals that are achievable and agreed by the team as being important and [where] they can see progress outside of the feature work they are doing. Celebrate wins and visualize the progress made." + +### How do DevOps and agile work together? + +``` +"DevOps != Agile, second Agile != Scrum." +``` + +This is an important question because both DevOps and agile are cornerstones of modern software development. + +DevOps is a process of software development focusing on communication and collaboration to facilitate rapid application and product deployment, whereas agile is a development methodology involving continuous development, continuous iteration, and continuous testing to achieve predictable and quality deliverables. + +So, how do they relate? Let's ask the experts. + +In Brent's view, "DevOps != Agile, second Agile != Scrum. … Agile tools and ways of working—that support DevOps strategies and goals—are how they mesh together." + +Chris says, "agile is a fundamental component of DevOps for me. Sure, we could talk about how we adopt DevOps culture in a non-agile environment, but ultimately, improving agility in the way software is engineered is a key indicator as to the maturity of DevOps adoption within the organization." + +Dan relates DevOps to the larger [Agile Manifesto][8]. "I never talk about agile without referencing the Agile Manifesto in order to set the baseline. There are many implementations that don't focus on the Manifesto. When you read the Manifesto, they've really described DevOps from a development perspective. Therefore, it is very easy to fit agile into a DevOps culture, as agile is focused on communication, collaboration, flexibility to change, and getting to production quickly." + +Geoff sees "DevOps as one of many implementations of agile. Agile is essentially a set of principles, while DevOps is a culture, process, and toolchain that embodies those principles." + +Ann Marie keeps it succinct, saying "agile is a prerequisite for DevOps. DevOps makes agile more effective." + +### Has DevOps benefited from open source? + +``` +"Open source done well requires a DevOps culture." +``` + +This question receives a fervent "yes" from all participants followed by an explanation of the benefits they've seen. + +Ann Marie says, "we get to stand on the shoulders of giants and build upon what's already available. The open source model of maintaining software, with pull requests and code reviews, also works very well for DevOps teams." + +Chris agrees that DevOps has "undoubtedly" benefited from open source. "From the engineering and tooling side (e.g., Ansible), to the process and people side, through the sharing of stories within the industry and the open leadership community." + +A benefit Geoff cites is "grassroots adoption. Nobody had to sign purchase requisitions for free (as in beer) software. Teams found tooling that met their needs, were free (as in freedom) to modify, [then] built on top of it, and contributed enhancements back to the larger community. Rinse, repeat." + +Open source has shown DevOps "better ways you can adopt new changes and overcome challenges, just like open source software developers are doing it," says Daniel. + +Brent concurs. "DevOps has benefited in many ways from open source. One way is the ability to use the tools to understand how they can help accelerate DevOps goals and strategies. Educating the development and operations folks on crucial things like automation, virtualization and containerization, auto-scaling, and many of the qualities that are difficult to achieve without introducing technology enablers that make DevOps easier." + +Dan notes the two-way, symbiotic relationship between DevOps and open source. "Open source done well requires a DevOps culture. Most open source projects have very open communication structures with very little obscurity. This has actually been a great learning opportunity for DevOps practitioners around what they might bring into their own organizations. Also, being able to use tools from a community that is similar to that of your own organization only encourages your own culture growth. I like to use GitLab as an example of this symbiotic relationship. When I bring [GitLab] into a company, we get a great tool, but what I'm really buying is their unique culture. That brings substantial value through our interactions with them and our ability to contribute back. Their tool also has a lot to offer for a DevOps organization, but their culture has inspired awe in the companies where I've introduced it." + +Now that our DevOps experts have weighed in, please share your thoughts on what DevOps means—as well as the other questions we posed—in the comments. + + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/1/what-does-devops-mean-you + +作者:[Girish Managoli][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/gammay +[b]: https://github.com/lujun9972 +[1]: https://twitter.com/DukeAMO +[2]: https://twitter.com/danieloh30?lang=en +[3]: https://twitter.com/brentareed +[4]: https://twitter.com/barkerd427 +[5]: https://psnet.ahrq.gov/resources/resource/1582 +[6]: https://twitter.com/onlychrisbh?lang=en +[7]: https://twitter.com/geoff_purdy +[8]: https://agilemanifesto.org/ From 84f48abce5de96e9073cd333e098ea296d7eca43 Mon Sep 17 00:00:00 2001 From: darksun Date: Mon, 28 Jan 2019 15:03:09 +0800 Subject: [PATCH 169/243] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190125=20Using?= =?UTF-8?q?=20Antora=20for=20your=20open=20source=20documentation=20source?= =?UTF-8?q?s/tech/20190125=20Using=20Antora=20for=20your=20open=20source?= =?UTF-8?q?=20documentation.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...tora for your open source documentation.md | 208 ++++++++++++++++++ 1 file changed, 208 insertions(+) create mode 100644 sources/tech/20190125 Using Antora for your open source documentation.md diff --git a/sources/tech/20190125 Using Antora for your open source documentation.md b/sources/tech/20190125 Using Antora for your open source documentation.md new file mode 100644 index 0000000000..3df2862ba1 --- /dev/null +++ b/sources/tech/20190125 Using Antora for your open source documentation.md @@ -0,0 +1,208 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Using Antora for your open source documentation) +[#]: via: (https://fedoramagazine.org/using-antora-for-your-open-source-documentation/) +[#]: author: (Adam Šamalík https://fedoramagazine.org/author/asamalik/) + +Using Antora for your open source documentation +====== +![](https://fedoramagazine.org/wp-content/uploads/2019/01/antora-816x345.jpg) + +Are you looking for an easy way to write and publish technical documentation? Let me introduce [Antora][1] — an open source documentation site generator. Simple enough for a tiny project, but also complex enough to cover large documentation sites such as [Fedora Docs][2]. + +With sources stored in git, written in a simple yet powerful markup language AsciiDoc, and a static HTML as an output, Antora makes writing, collaborating on, and publishing your documentation a no-brainer. + +### The basic concepts + +Before we build a simple site, let’s have a look at some of the core concepts Antora uses to make the world a happier place. Or, at least, to build a documentation website. + +#### Organizing the content + +All sources that are used to build your documentation site are stored in a **git repository**. Or multiple ones — potentially owned by different people. For example, at the time of writing, the Fedora Docs had its sources stored in 24 different repositories owned by different groups having their own rules around contributions. + +The content in Antora is organized into **components** , usually representing different areas of your project, or, well, different components of the software you’re documenting — such as the backend, the UI, etc. Components can be independently versioned, and each component gets a separate space on the docs site with its own menu. + +Components can be optionally broken down into so-called **modules**. Modules are mostly invisible on the site, but they allow you to organize your sources into logical groups, and even store each in different git repository if that’s something you need to do. We use this in Fedora Docs to separate [the Release Notes, the Installation Guide, and the System Administrator Guide][3] into three different source repositories with their own rules, while preserving a single view in the UI. + +What’s great about this approach is that, to some extent, the way your sources are physically structured is not reflected on the site. + +#### Virtual catalog + +When assembling the site, Antora builds a **virtual catalog** of all pages, assigning a [unique ID][4] to each one based on its name and the component, the version, and module it belongs to. The page ID is then used to generate URLs for each page, and for internal links as well. So, to some extent, the source repository structure doesn’t really matter as far as the site is concerned. + +As an example, if we’d for some reason decided to merge all the 24 repositories of Fedora Docs into one, nothing on the site would change. Well, except the “Edit this page” link on every page that would suddenly point to this one repository. + +#### Independent UI + +We’ve covered the content, but how it’s going to look like? + +Documentation sites generated with Antora use a so-called [UI bundle][5] that defines the look and feel of your site. The UI bundle holds all graphical assets such as CSS, images, etc. to make your site look beautiful. + +It is expected that the UI will be developed independently of the documentation content, and that’s exactly what Antora supports. + +#### Putting it all together + +Having sources distributed in multiple repositories might raise a question: How do you build the site? The answer is: [Antora Playbook][6]. + +Antora Playbook is a file that points to all the source repositories and the UI bundle. It also defines additional metadata such as the name of your site. + +The Playbook is the only file you need to have locally available in order to build the site. Everything else gets fetched automatically as a part of the build process. + +### Building a site with Antora + +Demo time! To build a minimal site, you need three things: + + 1. At least one component holding your AsciiDoc sources. + 2. An Antora Playbook. + 3. A UI bundle + + + +Good news is the nice people behind Antora provide [example Antora sources][7] we can try right away. + +#### The Playbook + +Let’s first have a look at [the Playbook][8]: + +``` +site: + title: Antora Demo Site +# the 404 page and sitemap files only get generated when the url property is set + url: https://example.org/docs + start_page: component-b::index.adoc +content: + sources: + - url: https://gitlab.com/antora/demo/demo-component-a.git + branches: master + - url: https://gitlab.com/antora/demo/demo-component-b.git + branches: [v2.0, v1.0] + start_path: docs +ui: + bundle: + url: https://gitlab.com/antora/antora-ui-default/-/jobs/artifacts/master/raw/build/ui-bundle.zip?job=bundle-stable + snapshot: true +``` + +As we can see, the Playbook defines some information about the site, lists the content repositories, and points to the UI bundle. + +There are two repositories. The [demo-component-a][9] with a single branch, and the [demo-component-b][10] having two branches, each representing a different version. + +#### Components + +The minimal source repository structure is nicely demonstrated in the [demo-component-a][9] repository: + +``` +antora.yml <- component metadata +modules/ + ROOT/ <- the default module + nav.adoc <- menu definition + pages/ <- a directory with all the .adoc sources + source1.adoc + source2.adoc + ... +``` + +The following + +``` +antora.yml +``` + +``` +name: component-a +title: Component A +version: 1.5.6 +start_page: ROOT:inline-text-formatting.adoc +nav: + - modules/ROOT/nav.adoc +``` + +contains metadata for this component such as the name and the version of the component, the starting page, and it also points to a menu definition file. + +The menu definition file is a simple list that defines the structure of the menu and the content. It uses the [page ID][4] to identify each page. + +``` +* xref:inline-text-formatting.adoc[Basic Inline Text Formatting] +* xref:special-characters.adoc[Special Characters & Symbols] +* xref:admonition.adoc[Admonition] +* xref:sidebar.adoc[Sidebar] +* xref:ui-macros.adoc[UI Macros] +* Lists +** xref:lists/ordered-list.adoc[Ordered List] +** xref:lists/unordered-list.adoc[Unordered List] + +And finally, there's the actual content under modules/ROOT/pages/ — you can see the repository for examples, or the AsciiDoc syntax reference +``` + +#### The UI bundle + +For the UI, we’ll be using the example UI provided by the project. + +Going into the details of Antora UI would be above the scope of this article, but if you’re interested, please see the [Antora UI documentation][5] for more info. + +#### Building the site + +Note: We’ll be using Podman to run Antora in a container. You can [learn about Podman on the Fedora Magazine][11]. + +To build the site, we only need to call Antora on the Playbook file. + +The easiest way to get antora at the moment is to use the container image provided by the project. You can get it by running: + +``` +$ podman pull antora/antora +``` + +Let’s get the playbook repository: + +``` +$ git clone https://gitlab.com/antora/demo/demo-site.git +$ cd demo-site +``` + +And run Antora using the following command: + +``` +$ podman run --rm -it -v $(pwd):/antora:z antora/antora site.yml +``` + +The site will be available in the + +public + +``` +$ cd public +$ python3 -m http.server 8080 +``` + +directory. You can either open it in your web browser directly, or start a local web server using: + +Your site will be available on . + + +-------------------------------------------------------------------------------- + +via: https://fedoramagazine.org/using-antora-for-your-open-source-documentation/ + +作者:[Adam Šamalík][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://fedoramagazine.org/author/asamalik/ +[b]: https://github.com/lujun9972 +[1]: https://antora.org/ +[2]: http://docs.fedoraproject.org/ +[3]: https://docs.fedoraproject.org/en-US/fedora/f29/ +[4]: https://docs.antora.org/antora/2.0/page/page-id/#structure +[5]: https://docs.antora.org/antora-ui-default/ +[6]: https://docs.antora.org/antora/2.0/playbook/ +[7]: https://gitlab.com/antora/demo +[8]: https://gitlab.com/antora/demo/demo-site/blob/master/site.yml +[9]: https://gitlab.com/antora/demo/demo-component-a +[10]: https://gitlab.com/antora/demo/demo-component-b +[11]: https://fedoramagazine.org/running-containers-with-podman/ From 7fac971d424ec937649cdcebdd2fe86a6b89c3f9 Mon Sep 17 00:00:00 2001 From: darksun Date: Mon, 28 Jan 2019 15:05:00 +0800 Subject: [PATCH 170/243] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190123=20Comman?= =?UTF-8?q?ds=20to=20help=20you=20monitor=20activity=20on=20your=20Linux?= =?UTF-8?q?=20server=20sources/tech/20190123=20Commands=20to=20help=20you?= =?UTF-8?q?=20monitor=20activity=20on=20your=20Linux=20server.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...u monitor activity on your Linux server.md | 156 ++++++++++++++++++ 1 file changed, 156 insertions(+) create mode 100644 sources/tech/20190123 Commands to help you monitor activity on your Linux server.md diff --git a/sources/tech/20190123 Commands to help you monitor activity on your Linux server.md b/sources/tech/20190123 Commands to help you monitor activity on your Linux server.md new file mode 100644 index 0000000000..43f1c480ad --- /dev/null +++ b/sources/tech/20190123 Commands to help you monitor activity on your Linux server.md @@ -0,0 +1,156 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Commands to help you monitor activity on your Linux server) +[#]: via: (https://www.networkworld.com/article/3335200/linux/how-to-monitor-activity-on-your-linux-server.html) +[#]: author: (Sandra Henry-Stocker https://www.networkworld.com/author/Sandra-Henry_Stocker/) + +Commands to help you monitor activity on your Linux server +====== +The watch, top, and ac commands provide some effective ways to oversee what is happening on your Linux servers. + +![](https://images.idgesg.net/images/article/2019/01/owl-face-100785829-large.jpg) + +Linux systems provide a number of commands that make it easy to report on system activity. In this post, we're going to look at several commands that are especially helpful. + +### The watch command + +The **watch** command is one that makes it easy to repeatedly examine a variety of data on your system — user activities, running processes, logins, memory usage, etc. All the command really does is run the command that you specify repeatedly, each time overwriting the previously displayed output, but this lends itself to a very convenient way of monitoring what's happening on your system. + +To start with a very basic and not particularly useful command, you could run **watch -n 5 date** and see a display with the current date and time that updates every 5 seconds. As you likely have guessed, the **-n 5** option specifies the number of seconds to wait between each run of the command. The default is 2 seconds. The command will run and update a display like this until you stop it with a ^c. + +``` +Every 5.0s: date butterfly: Wed Jan 23 15:59:14 2019 + +Wed Jan 23 15:59:14 EST 2019 +``` + +As a more interesting command example, you can watch an updated list of whoever is logging into the server. As written, this command will update every 10 seconds. Users who log out will disappear from the current display and those who log in will come into view. If no one is logging in or out, the display will remain the same except for the time displayed. + +``` +$ watch -n 10 who + +Every 10.0s: who butterfly: Tue Jan 23 16:02:03 2019 + +shs :0 2019-01-23 09:45 (:0) +dory pts/0 2019-01-23 15:50 (192.168.0.5) +nemo pts/1 2019-01-23 16:01 (192.168.0.15) +shark pts/3 2019-01-23 11:11 (192.168.0.27) +``` + +If you just want to see how many users are logged in, you can get a user count along with load averages showing you how hard the system is working by having watch call the **uptime** command. + +``` +$ watch uptime + +Every 2.0s: uptime butterfly: Tue Jan 23 16:25:48 2019 + + 16:25:48 up 22 days, 4:38, 3 users, load average: 1.15, 0.89, 1.02 +``` + +If you want to use watch to repeat a command that includes a pipe, you need to put the command between quote marks like this command that every 5 seconds shows you how many processes are running: + +``` +$ watch -n 5 'ps -ef | wc -l' + +Every 5.0s: ps -ef | wc -l butterfly: Tue Jan 23 16:11:54 2019 + +245 +``` + +To watch memory usage, you might try a command like this one: + +``` +$ watch -n 5 free -m + +Every 5.0s: free -m butterfly: Tue Jan 23 16:34:09 2019 + + total used free shared buff/cache available +Mem: 5959 776 3276 12 1906 4878 +Swap: 2047 0 2047 +``` + +You could watch processes being run by one particular user with **watch,** but the **top** command provides a much better option. + +### The top command + +If you want to watch one particular user's processes, top has an ideal option for you — the -u option: + +``` +$ top -u nemo +top - 16:14:33 up 2 days, 4:27, 3 users, load average: 0.00, 0.01, 0.02 +Tasks: 199 total, 1 running, 198 sleeping, 0 stopped, 0 zombie +%Cpu(s): 0.0 us, 0.2 sy, 0.0 ni, 99.8 id, 0.0 wa, 0.0 hi, 0.0 si, 0.0 st +MiB Mem : 5959.4 total, 3277.3 free, 776.4 used, 1905.8 buff/cache +MiB Swap: 2048.0 total, 2048.0 free, 0.0 used. 4878.4 avail Mem + + PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND +23026 nemo 20 0 46340 7820 6504 S 0.0 0.1 0:00.05 systemd +23033 nemo 20 0 149660 3140 72 S 0.0 0.1 0:00.00 (sd-pam) +23125 nemo 20 0 63396 5100 4092 S 0.0 0.1 0:00.00 sshd +23128 nemo 20 0 16836 5636 4284 S 0.0 0.1 0:00.03 zsh +``` + +You not only see what processes the user is running, but the resources (CPU time and memory) that the process is consuming and how hard the system is working overall. + +### The ac command + +If you'd like to see how much time each of your users is spending logged in, you can make use of the **ac** command. This requires installation of the **acct** (Debian) or **psacct** (RHEL, Centos, etc.) package. + +The **ac** command has a number of options, but it pulls its data from the current **wtmp** file. Here's an example showing the total number of hours users were logged in recently: + +``` +$ ac + total 1261.72 +``` + +This command shows total hours by user: + +``` +$ ac -p + shark 5.24 + nemo 5.52 + shs 1251.00 + total 1261.76 +``` + +This ac command shows daily counts of how many hours users were logged in: + +``` +$ ac -d | tail -10 + +Jan 11 total 0.05 +Jan 12 total 1.36 +Jan 13 total 16.39 +Jan 15 total 55.33 +Jan 16 total 38.02 +Jan 17 total 28.51 +Jan 19 total 48.66 +Jan 20 total 1.37 +Jan 22 total 23.48 +Today total 9.83 +``` + +### Wrap-up + +There are many commands for examining system activity. The **watch** command allows you to run just about any command in a repetitive way and watch how the output changes. The **top** command is a better option for focusing on user processes and also loops in a way that allows you to see the changes as they happen, while the **ac** command examines user connect time. + +Join the Network World communities on [Facebook][1] and [LinkedIn][2] to comment on topics that are top of mind. + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3335200/linux/how-to-monitor-activity-on-your-linux-server.html + +作者:[Sandra Henry-Stocker][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.networkworld.com/author/Sandra-Henry_Stocker/ +[b]: https://github.com/lujun9972 +[1]: https://www.facebook.com/NetworkWorld/ +[2]: https://www.linkedin.com/company/network-world From 3bbe109a90d182ec7d1b51df4dc561848947e8db Mon Sep 17 00:00:00 2001 From: darksun Date: Mon, 28 Jan 2019 15:06:57 +0800 Subject: [PATCH 171/243] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190125=20PyGame?= =?UTF-8?q?=20Zero:=20Games=20without=20boilerplate=20sources/tech/2019012?= =?UTF-8?q?5=20PyGame=20Zero-=20Games=20without=20boilerplate.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ... PyGame Zero- Games without boilerplate.md | 99 +++++++++++++++++++ 1 file changed, 99 insertions(+) create mode 100644 sources/tech/20190125 PyGame Zero- Games without boilerplate.md diff --git a/sources/tech/20190125 PyGame Zero- Games without boilerplate.md b/sources/tech/20190125 PyGame Zero- Games without boilerplate.md new file mode 100644 index 0000000000..bdc100973a --- /dev/null +++ b/sources/tech/20190125 PyGame Zero- Games without boilerplate.md @@ -0,0 +1,99 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (PyGame Zero: Games without boilerplate) +[#]: via: (https://opensource.com/article/19/1/pygame-zero) +[#]: author: (Moshe Zadka https://opensource.com/users/moshez) + +PyGame Zero: Games without boilerplate +====== +Say goodbye to boring boilerplate in your game development with PyGame Zero. +![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/python3-game.png?itok=jG9UdwC3) + +Python is a good beginner programming language. And games are a good beginner project: they are visual, self-motivating, and fun to show off to friends and family. However, the most common library to write games in Python, [PyGame][1], can be frustrating for beginners because forgetting seemingly small details can easily lead to nothing rendering. + +Until people understand why all the parts are there, they treat many of them as "mindless boilerplate"—magic paragraphs that need to be copied and pasted into their program to make it work. + +[PyGame Zero][2] is intended to bridge that gap by putting a layer of abstraction over PyGame so it requires literally no boilerplate. + +When we say literally, we mean it. + +This is a valid PyGame Zero file: + +``` +# This comment is here for clarity reasons +``` + +We can run put it in a **game.py** file and run: + +``` +$ pgzrun game.py +``` + +This will show a window and run a game loop that can be shut down by closing the window or interrupting the program with **CTRL-C**. + +This will, sadly, be a boring game. Nothing happens. + +To make it slightly more interesting, we can draw a different background: + +``` +def draw(): +    screen.fill((255, 0, 0)) +``` + +This will make the background red instead of black. But it is still a boring game. Nothing is happening. We can make it slightly more interesting: + +``` +colors = [0, 0, 0] + +def draw(): +    screen.fill(tuple(colors)) + +def update(): +    colors[0] = (colors[0] + 1) % 256 +``` + +This will make a window that starts black, becomes brighter and brighter red, then goes back to black, over and over again. + +The **update** function updates parameters, while the **draw** function renders the game based on these parameters. + +However, there is no way for the player to interact with the game! Let's try something else: + +``` +colors = [0, 0, 0] + +def draw(): +    screen.fill(tuple(colors)) + +def update(): +    colors[0] = (colors[0] + 1) % 256 + +def on_key_down(key, mod, unicode): +    colors[1] = (colors[1] + 1) % 256 +``` + +Now pressing keys on the keyboard will increase the "greenness." + +These comprise the three important parts of a game loop: respond to user input, update parameters, and re-render the screen. + +PyGame Zero offers much more, including functions for drawing sprites and playing sound clips. + +Try it out and see what type of game you can come up with! + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/1/pygame-zero + +作者:[Moshe Zadka][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/moshez +[b]: https://github.com/lujun9972 +[1]: https://www.pygame.org/news +[2]: https://pygame-zero.readthedocs.io/en/stable/ From 8a546cceddecce6bc16f4701e99694499d332b65 Mon Sep 17 00:00:00 2001 From: darksun Date: Mon, 28 Jan 2019 15:09:16 +0800 Subject: [PATCH 172/243] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190124=20Unders?= =?UTF-8?q?tanding=20Angle=20Brackets=20in=20Bash=20sources/tech/20190124?= =?UTF-8?q?=20Understanding=20Angle=20Brackets=20in=20Bash.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...24 Understanding Angle Brackets in Bash.md | 154 ++++++++++++++++++ 1 file changed, 154 insertions(+) create mode 100644 sources/tech/20190124 Understanding Angle Brackets in Bash.md diff --git a/sources/tech/20190124 Understanding Angle Brackets in Bash.md b/sources/tech/20190124 Understanding Angle Brackets in Bash.md new file mode 100644 index 0000000000..bd9a3782fb --- /dev/null +++ b/sources/tech/20190124 Understanding Angle Brackets in Bash.md @@ -0,0 +1,154 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Understanding Angle Brackets in Bash) +[#]: via: (https://www.linux.com/blog/learn/2019/1/understanding-angle-brackets-bash) +[#]: author: (Paul Brown https://www.linux.com/users/bro66) + +Understanding Angle Brackets in Bash +====== + +![](https://www.linux.com/sites/lcom/files/styles/rendered_file/public/architecture-1839450_1920.jpg?itok=ra6XonD3) + +[Bash][1] provides many important built-in commands, like `ls`, `cd`, and `mv`, as well as regular tools such as `grep`, `awk,` and `sed`. But, it is equally important to know the punctuation marks -- [the glue in the shape of dots][2], commas, brackets. and quotes -- that allow you to transform and push data from one place to another. Take angle brackets (`< >`), for example. + +### Pushing Around + +If you are familiar with other programming and scripting languages, you may have used `<` and `>` as logical operators to check in a condition whether one value is larger or smaller than another. If you have ever written HTML, you have used angle brackets to enclose tags. + +In shell scripting, you can also use brackets to push data from place to place, for example, to a file: + +``` +ls > dir_content.txt +``` + +In this example, instead of showing the contents of the directory on the command line, `>` tells the shell to copy it into a file called _dir_content.txt_. If _dir_content.txt_ doesn't exist, Bash will create it for you, but if _dir_content.txt_ already exists and is not empty, you will overwrite whatever it contained, so be careful! + +You can avoid overwriting existing content by tacking the new stuff onto the end of the old stuff. For that you use `>>` (instead of `>`): + +``` +ls $HOME > dir_content.txt; wc -l dir_content.txt >> dir_content.txt +``` + +This line stores the list of contents of your home directory into _dir_content.txt_. You then count the number of lines in _dir_content.txt_ (which gives you the number of items in the directory) with [`wc -l`][3] and you tack that value onto the end of the file. + +After running the command line on my machine, this is what my _dir_content.txt_ file looks like: + +``` +Applications +bin +cloud +Desktop +Documents +Downloads +Games +ISOs +lib +logs +Music +OpenSCAD +Pictures +Public +Templates +test_dir +Videos +17 dir_content.txt +``` + +The mnemonic here is to look at `>` and `>>` as arrows. In fact, the arrows can point the other way, too. Say you have a file called _CBActors_ containing some names of actors and the number of films by the Coen brothers they have been in. Something like this: + +``` +John Goodman 5 +John Turturro 3 +George Clooney 2 +Frances McDormand 6 +Steve Buscemi 5 +Jon Polito 4 +Tony Shalhoub 3 +James Gandolfini 1 +``` + +Something like + +``` +sort < CBActors # Do this +Frances McDormand 6 # And you get this +George Clooney 2 +James Gandolfini 1 +John Goodman 5 +John Turturro 3 +Jon Polito 4 +Steve Buscemi 5 +Tony Shalhoub 3 +``` + +Will [sort][4] the list alphabetically. But then again, you don't need `<` here since `sort` already expects a file anyway, so `sort CBActors` will work just as well. + +However, if you need to see who is the Coens' favorite actor, you can check with : + +``` +while read name surname films; do echo $films $name $surname > filmsfirst.txt; done < CBActors +``` + +Or, to make that a bit more readable: + +``` +while read name surname films;\ + do + echo $films $name $surname >> filmsfirst;\ + done < CBActors +``` + +Let's break this down, shall we? + + * the [`while ...; do ... done`][5] structure is a loop. The instructions between `do` and `done` are repeatedly executed while a condition is met, in this case... + * ... the [`read`][6] instruction has lines to read. `read` reads from the standard input and will continue reading until there is nothing more to read... + * ... And as standard input is fed in via `<` and comes from _CBActors_ , that means the `while` loop will loop until the last line of _CBActors_ is piped into the loop. + * Getting back to `read` for a sec, the tool is clever enough to see that there are three distinct fields separated by spaces on each line of the file. That allows you to put the first field from each line in the `name` variable, the second in `surname` and the third in `films`. This comes in handy later, on the line that says `echo $films $name $surname >> filmsfirst;\`, allowing you to reorder the fields and push them into a file called _filmsfirst_. + + + +At the end of all that, you have a file called _filmsfirst_ that looks like this: + +``` +5 John Goodman +3 John Turturro +2 George Clooney +6 Frances McDormand +5 Steve Buscemi +4 Jon Polito +3 Tony Shalhoub +1 James Gandolfini +``` + +which you can now use with `sort`: + +``` +sort -r filmsfirst +``` + +to see who is the Coens' favorite actor. Yes, it is Frances McDormand. (The [`-r`][4] option reverses the sort, so McDormand ends up on top). + +We'll look at more angles on this topic next time! + +-------------------------------------------------------------------------------- + +via: https://www.linux.com/blog/learn/2019/1/understanding-angle-brackets-bash + +作者:[Paul Brown][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.linux.com/users/bro66 +[b]: https://github.com/lujun9972 +[1]: https://www.linux.com/blog/2019/1/bash-shell-utility-reaches-50-milestone +[2]: https://www.linux.com/blog/learn/2019/1/linux-tools-meaning-dot +[3]: https://linux.die.net/man/1/wc +[4]: https://linux.die.net/man/1/sort +[5]: http://tldp.org/HOWTO/Bash-Prog-Intro-HOWTO-7.html +[6]: https://linux.die.net/man/2/read From 8a3782fbf0fe5b0089e7d3fba50e458b198750e7 Mon Sep 17 00:00:00 2001 From: darksun Date: Mon, 28 Jan 2019 15:17:38 +0800 Subject: [PATCH 173/243] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190123=20Gettin?= =?UTF-8?q?g=20started=20with=20Isotope,=20an=20open=20source=20webmail=20?= =?UTF-8?q?client=20sources/tech/20190123=20Getting=20started=20with=20Iso?= =?UTF-8?q?tope,=20an=20open=20source=20webmail=20client.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ... Isotope, an open source webmail client.md | 60 +++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 sources/tech/20190123 Getting started with Isotope, an open source webmail client.md diff --git a/sources/tech/20190123 Getting started with Isotope, an open source webmail client.md b/sources/tech/20190123 Getting started with Isotope, an open source webmail client.md new file mode 100644 index 0000000000..e4a24a28a8 --- /dev/null +++ b/sources/tech/20190123 Getting started with Isotope, an open source webmail client.md @@ -0,0 +1,60 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Getting started with Isotope, an open source webmail client) +[#]: via: (https://opensource.com/article/19/1/productivity-tool-isotope) +[#]: author: (Kevin Sonney https://opensource.com/users/ksonney (Kevin Sonney)) + +Getting started with Isotope, an open source webmail client +====== +Read rich-text emails with Isotope, a lightweight email client and the 11th in our series on open source tools that will make you more productive in 2019. +![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/newsletter_email_mail_web_browser.jpg?itok=Lo91H9UH) + +There seems to be a mad rush at the beginning of every year to find ways to be more productive. New Year's resolutions, the itch to start the year off right, and of course, an "out with the old, in with the new" attitude all contribute to this. And the usual round of recommendations is heavily biased towards closed source and proprietary software. It doesn't have to be that way. + +Here's the 11th of my picks for 19 new (or new-to-you) open source tools to help you be more productive in 2019. + +### Isotope + +As we discussed in the [fourth article in this series][1] (about Cypht), we all spend a whole lot of time dealing with email. There are many options for dealing with it, and I've spent hours upon hours trying to find the best email client that works for me. I think that is an important distinction: What works for me doesn't always work for everyone else. And sometimes what works for me is a full client like [Thunderbird][2], sometimes it is a console client like [Mutt][3], and sometimes it's a web-based interface like [Gmail][4] or [RoundCube][5]. + +![](https://opensource.com/sites/default/files/uploads/isotope_1.png) + +[Isotope][6] is a locally hosted, web-based email client. It is exceptionally lightweight, uses IMAP exclusively, and takes up very little disk space. Unlike Cypht, Isotope has full HTML mail support, which means there are no issues displaying rich-text only emails. + +![](https://opensource.com/sites/default/files/uploads/isotope_2_0.png) + +Installing Isotope is very easy if you have [Docker][7] installed. You only need to copy the commands from the documentation into a console and press Enter. Point a browser at **localhost** to get the Isotope login screen, and entering your IMAP server, login name, and password will open the inbox view. + +![](https://opensource.com/sites/default/files/uploads/isotope_3.png) + +At this point, Isotope functions pretty much as you'd expect. Click a message to view it, click the pencil icon to create a new message, etc. You will note that the user interface (UI) is very minimalistic and doesn't have the typical buttons for things like "move to folder," "copy to folder," and "archive." You move messages around with drag and drop, so you don't really miss the buttons anyway. + +![](https://opensource.com/sites/default/files/uploads/isotope_4.png) + +Overall, Isotope is clean, fast, and works exceptionally well. Even better, it is under active development (the most recent commit was two hours before I wrote this article), so it is constantly getting improvements. You can check out the code and contribute to it on [GitHub][8]. + + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/1/productivity-tool-isotope + +作者:[Kevin Sonney][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/ksonney (Kevin Sonney) +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/article/19/1/productivity-tool-cypht-email +[2]: https://www.thunderbird.net/ +[3]: http://www.mutt.org/ +[4]: https://mail.google.com/ +[5]: https://roundcube.net/ +[6]: https://blog.marcnuri.com/isotope-mail-client-introduction/ +[7]: https://www.docker.com/ +[8]: https://github.com/manusa/isotope-mail From c07992967de7d87c66deed694d638f99b4ebf726 Mon Sep 17 00:00:00 2001 From: darksun Date: Mon, 28 Jan 2019 15:19:45 +0800 Subject: [PATCH 174/243] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190121=20How=20?= =?UTF-8?q?to=20Resize=20OpenStack=20Instance=20(Virtual=20Machine)=20from?= =?UTF-8?q?=20Command=20line=20sources/tech/20190121=20How=20to=20Resize?= =?UTF-8?q?=20OpenStack=20Instance=20(Virtual=20Machine)=20from=20Command?= =?UTF-8?q?=20line.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...nce (Virtual Machine) from Command line.md | 149 ++++++++++++++++++ 1 file changed, 149 insertions(+) create mode 100644 sources/tech/20190121 How to Resize OpenStack Instance (Virtual Machine) from Command line.md diff --git a/sources/tech/20190121 How to Resize OpenStack Instance (Virtual Machine) from Command line.md b/sources/tech/20190121 How to Resize OpenStack Instance (Virtual Machine) from Command line.md new file mode 100644 index 0000000000..e235cabdbf --- /dev/null +++ b/sources/tech/20190121 How to Resize OpenStack Instance (Virtual Machine) from Command line.md @@ -0,0 +1,149 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to Resize OpenStack Instance (Virtual Machine) from Command line) +[#]: via: (https://www.linuxtechi.com/resize-openstack-instance-command-line/) +[#]: author: (Pradeep Kumar http://www.linuxtechi.com/author/pradeep/) + +How to Resize OpenStack Instance (Virtual Machine) from Command line +====== + +Being a Cloud administrator, resizing or changing resources of an instance or virtual machine is one of the most common tasks. + +![](https://www.linuxtechi.com/wp-content/uploads/2019/01/Resize-openstack-instance.jpg) + +In Openstack environment, there are some scenarios where cloud user has spin a vm using some flavor( like m1.smalll) where root partition disk size is 20 GB, but at some point of time user wants to extends the root partition size to 40 GB. So resizing of vm’s root partition can be accomplished by using the resize option in nova command. During the resize, we need to specify the new flavor that will include disk size as 40 GB. + +**Note:** Once you extend the instance resources like RAM, CPU and disk using resize option in openstack then you can’t reduce it. + +**Read More on** : [**How to Create and Delete Virtual Machine(VM) from Command line in OpenStack**][1] + +In this tutorial I will demonstrate how to resize an openstack instance from command line. Let’s assume I have an existing instance named “ **test_resize_vm** ” and it’s associated flavor is “m1.small” and root partition disk size is 20 GB. + +Execute the below command from controller node to check on which compute host our vm “test_resize_vm” is provisioned and its flavor details + +``` +:~# openstack server show test_resize_vm | grep -E "flavor|hypervisor" +| OS-EXT-SRV-ATTR:hypervisor_hostname  | compute-57    | +| flavor                               | m1.small (2)  | +:~# +``` + +Login to VM as well and check the root partition size, + +``` +[[email protected] ~]# df -Th +Filesystem     Type      Size  Used Avail Use% Mounted on +/dev/vda1      xfs        20G  885M   20G   5% / +devtmpfs       devtmpfs  900M     0  900M   0% /dev +tmpfs          tmpfs     920M     0  920M   0% /dev/shm +tmpfs          tmpfs     920M  8.4M  912M   1% /run +tmpfs          tmpfs     920M     0  920M   0% /sys/fs/cgroup +tmpfs          tmpfs     184M     0  184M   0% /run/user/1000 +[[email protected] ~]# echo "test file for resize operation" > demofile +[[email protected] ~]# cat demofile +test file for resize operation +[[email protected] ~]# +``` + +Get the available flavor list using below command, + +``` +:~# openstack flavor list ++--------------------------------------|-----------------|-------|------|-----------|-------|-----------+ +| ID                                   | Name            |   RAM | Disk | Ephemeral | VCPUs | Is Public | ++--------------------------------------|-----------------|-------|------|-----------|-------|-----------+ +| 2                                    | m1.small        |  2048 |   20 |         0 |     1 | True      | +| 3                                    | m1.medium       |  4096 |   40 |         0 |     2 | True      | +| 4                                    | m1.large        |  8192 |   80 |         0 |     4 | True      | +| 5                                    | m1.xlarge       | 16384 |  160 |         0 |     8 | True      | ++--------------------------------------|-----------------|-------|------|-----------|-------|-----------+ +``` + +So we will be using the flavor “m1.medium” for resize operation, Run the beneath nova command to resize “test_resize_vm”, + +Syntax: # nova resize {VM_Name} {flavor_id} —poll + +``` +:~# nova resize test_resize_vm 3 --poll +Server resizing... 100% complete +Finished +:~# +``` + +Now confirm the resize operation using “ **openstack server –confirm”** command, + +``` +~# openstack server list | grep -i test_resize_vm +| 1d56f37f-94bd-4eef-9ff7-3dccb4682ce0 | test_resize_vm | VERIFY_RESIZE |private-net=10.20.10.51                                  | +:~# +``` + +As we can see in the above command output the current status of the vm is “ **verify_resize** “, execute below command to confirm resize, + +``` +~# openstack server resize --confirm 1d56f37f-94bd-4eef-9ff7-3dccb4682ce0 +~# +``` + +After the resize confirmation, status of VM will become active, now re-verify hypervisor and flavor details for the vm + +``` +:~# openstack server show test_resize_vm | grep -E "flavor|hypervisor" +| OS-EXT-SRV-ATTR:hypervisor_hostname  | compute-58   | +| flavor                               | m1.medium (3)| +``` + +Login to your VM now and verify the root partition size + +``` +[[email protected] ~]# df -Th +Filesystem     Type      Size  Used Avail Use% Mounted on +/dev/vda1      xfs        40G  887M   40G   3% / +devtmpfs       devtmpfs  1.9G     0  1.9G   0% /dev +tmpfs          tmpfs     1.9G     0  1.9G   0% /dev/shm +tmpfs          tmpfs     1.9G  8.4M  1.9G   1% /run +tmpfs          tmpfs     1.9G     0  1.9G   0% /sys/fs/cgroup +tmpfs          tmpfs     380M     0  380M   0% /run/user/1000 +[[email protected] ~]# cat demofile +test file for resize operation +[[email protected] ~]# +``` + +This confirm that VM root partition has been resized successfully. + +**Note:** Due to some reason if resize operation was not successful and you want to revert the vm back to previous state, then run the following command, + +``` +# openstack server resize --revert {instance_uuid} +``` + +If have noticed “ **openstack server show** ” commands output, VM is migrated from compute-57 to compute-58 after resize. This is the default behavior of “nova resize” command ( i.e nova resize command will migrate the instance to another compute & then resize it based on the flavor details) + +In case if you have only one compute node then nova resize will not work, but we can make it work by changing the below parameter in nova.conf file on compute node, + +Login to compute node, verify the parameter value + +If “ **allow_resize_to_same_host** ” is set as False then change it to True and restart the nova compute service. + +**Read More on** [**OpenStack Deployment using Devstack on CentOS 7 / RHEL 7 System**][2] + +That’s all from this tutorial, in case it helps you technically then please do share your feedback and comments. + +-------------------------------------------------------------------------------- + +via: https://www.linuxtechi.com/resize-openstack-instance-command-line/ + +作者:[Pradeep Kumar][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: http://www.linuxtechi.com/author/pradeep/ +[b]: https://github.com/lujun9972 +[1]: https://www.linuxtechi.com/create-delete-virtual-machine-command-line-openstack/ +[2]: https://www.linuxtechi.com/openstack-deployment-devstack-centos-7-rhel-7/ From 8a11dc4975795fabda7d3c63cdcf75ce8ff68ec3 Mon Sep 17 00:00:00 2001 From: darksun Date: Mon, 28 Jan 2019 15:23:20 +0800 Subject: [PATCH 175/243] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190124=20Orpie:?= =?UTF-8?q?=20A=20command-line=20reverse=20Polish=20notation=20calculator?= =?UTF-8?q?=20sources/tech/20190124=20Orpie-=20A=20command-line=20reverse?= =?UTF-8?q?=20Polish=20notation=20calculator.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...line reverse Polish notation calculator.md | 128 ++++++++++++++++++ 1 file changed, 128 insertions(+) create mode 100644 sources/tech/20190124 Orpie- A command-line reverse Polish notation calculator.md diff --git a/sources/tech/20190124 Orpie- A command-line reverse Polish notation calculator.md b/sources/tech/20190124 Orpie- A command-line reverse Polish notation calculator.md new file mode 100644 index 0000000000..10e666f625 --- /dev/null +++ b/sources/tech/20190124 Orpie- A command-line reverse Polish notation calculator.md @@ -0,0 +1,128 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Orpie: A command-line reverse Polish notation calculator) +[#]: via: (https://opensource.com/article/19/1/orpie) +[#]: author: (Peter Faller https://opensource.com/users/peterfaller) + +Orpie: A command-line reverse Polish notation calculator +====== +Orpie is a scientific calculator that functions much like early, well-loved HP calculators. +![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/calculator_money_currency_financial_tool.jpg?itok=2QMa1y8c) +Orpie is a text-mode [reverse Polish notation][1] (RPN) calculator for the Linux console. It works very much like the early, well-loved Hewlett-Packard calculators. + +### Installing Orpie + +RPM and DEB packages are available for most distributions, so installation is just a matter of using either: + +``` +$ sudo apt install orpie +``` + +or + +``` +$ sudo yum install orpie +``` + +Orpie has a comprehensive man page; new users may want to have it open in another terminal window as they get started. Orpie can be customized for each user by editing the **~/.orpierc** configuration file. The [orpierc(5)][2] man page describes the contents of this file, and **/etc/orpierc** describes the default configuration. + +### Starting up + +Start Orpie by typing **orpie** at the command line. The main screen shows context-sensitive help on the left and the stack on the right. The cursor, where you enter numbers you want to calculate, is at the bottom-right corner. + +![](https://opensource.com/sites/default/files/uploads/orpie_start.png) + +### Example calculation + +For a simple example, let's calculate the factorial of **5 (2 core.md Dict.md lctt2014.md lctt2016.md lctt2018.md LICENSE published README.md scripts sources translated 3 core.md Dict.md lctt2014.md lctt2016.md lctt2018.md LICENSE published README.md scripts sources translated 4 core.md Dict.md lctt2014.md lctt2016.md lctt2018.md LICENSE published README.md scripts sources translated 5)**. First the long way: + +| Keys | Result | +| --------- | --------- | +| 2 | Push 2 onto the stack | +| 3 | Push 3 onto the stack | +| * | Multiply to get 6 | +| 4 | Push 4 onto the stack | +| * | Multiply to get 24 | +| 5 | Push 5 onto the stack | +| * | Multiply to get 120 | + +Note that the multiplication happens as soon as you type *****. If you hit **< enter>** after ***** , Orpie will duplicate the value at position 1 on the stack. (If this happens, you can drop the duplicate with **\**.) + +Equivalent sequences are: + +| Keys | Result | +| ------------- | ------------- | +| 2 3 * 4 * 5 * | Faster! | +| 2 3 4 5 * * * | Same result | +| 5 ' fact | Fastest: Use the built-in function | + +Observe that when you enter **'** , the left pane changes to show matching functions as you type. In the example above, typing **fa** is enough to get the **fact** function. Orpie offers many functions—experiment by typing **'** and a few letters to see what's available. + +![](https://opensource.com/sites/default/files/uploads/orpie_functions.png) + +Note that each operation replaces one or more values on the stack. If you want to store the value at position 1 in the stack, key in (for example) **@factot ** and **S'**. To retrieve the value, key in (for example) **@factot ** then **;** (if you want to see it; otherwise just leave **@factot** as the value for the next calculation). + +### Constants and units + +Orpie understands units and predefines many useful scientific constants. For example, to calculate the energy in a blue light photon at 400nm, calculate **E=hc/(400nm)**. The key sequences are: + +| Keys | Result | +| -------------- | -------------- | +| C c | Get the speed of light in m/s | +| C h | Get Planck's constant in Js | +| * | Calculate h*c | +| 400 9 n _ m | Input 4 _ 10^-9 m | +| / | Do the division and get the result: 4.966 _ 10^-19 J | + +Like choosing functions after typing **'** , typing **C** shows matching constants based on what you type. + +![](https://opensource.com/sites/default/files/uploads/orpie_constants.png) + +### Matrices + +Orpie can also do operations with matrices. For example, to multiply two 2x2 matrices: + +| Keys | Result | +| -------- | -------- | +| [ 1 , 2 [ 3 , 4 | Stack contains the matrix [[ 1, 2 ][ 3, 4 ]] | +| [ 1 , 0 [ 1 , 1 | Push the multiplier matrix onto the stack | +| * | The result is: [[ 3, 2 ][ 7, 4 ]] | + +Note that the **]** characters are automatically inserted—entering **[** starts a new row. + +### Complex numbers + +Orpie can also calculate with complex numbers. They can be entered or displayed in either polar or rectangular form. You can toggle between the polar and rectangular display using the **p** key, and between degrees and radians using the **r** key. For example, to multiply **3 + 4i** by **4 + 4i** : + +| Keys | Result | +| -------- | -------- | +| ( 3 , 4 | The stack contains (3, 4) | +| ( 4 , 4 | Push (4, 4) | +| * | Get the result: (-4, 28) | + +Note that as you go, the results are kept on the stack so you can observe intermediate results in a lengthy calculation. + +![](https://opensource.com/sites/default/files/uploads/orpie_final.png) + +### Quitting Orpie + +You can exit from Orpie by typing **Q**. Your state is saved, so the next time you start Orpie, you'll find the stack as you left it. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/1/orpie + +作者:[Peter Faller][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/peterfaller +[b]: https://github.com/lujun9972 +[1]: https://en.wikipedia.org/wiki/Reverse_Polish_notation +[2]: https://github.com/pelzlpj/orpie/blob/master/doc/orpierc.5 From 3f48a7b6b7f58bc42c1cd386a393aaf0a63e8db9 Mon Sep 17 00:00:00 2001 From: darksun Date: Mon, 28 Jan 2019 15:24:50 +0800 Subject: [PATCH 176/243] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190123=20Dockte?= =?UTF-8?q?r:=20A=20container=20image=20builder=20for=20researchers=20sour?= =?UTF-8?q?ces/tech/20190123=20Dockter-=20A=20container=20image=20builder?= =?UTF-8?q?=20for=20researchers.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...container image builder for researchers.md | 121 ++++++++++++++++++ 1 file changed, 121 insertions(+) create mode 100644 sources/tech/20190123 Dockter- A container image builder for researchers.md diff --git a/sources/tech/20190123 Dockter- A container image builder for researchers.md b/sources/tech/20190123 Dockter- A container image builder for researchers.md new file mode 100644 index 0000000000..359d0c1d1e --- /dev/null +++ b/sources/tech/20190123 Dockter- A container image builder for researchers.md @@ -0,0 +1,121 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Dockter: A container image builder for researchers) +[#]: via: (https://opensource.com/article/19/1/dockter-image-builder-researchers) +[#]: author: (Nokome Bentley https://opensource.com/users/nokome) + +Dockter: A container image builder for researchers +====== +Dockter supports the specific requirements of researchers doing data analysis, including those using R. + +![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/building_skyscaper_organization.jpg?itok=Ir5epxm8) + +Dependency hell is ubiquitous in the world of software for research, and this affects research transparency and reproducibility. Containerization is one solution to this problem, but it creates new challenges for researchers. Docker is gaining popularity in the research community—but using it efficiently requires solid Dockerfile writing skills. + +As a part of the [Stencila][1] project, which is a platform for creating, collaborating on, and sharing data-driven content, we are developing [Dockter][2], an open source tool that makes it easier for researchers to create Docker images for their projects. Dockter scans a research project's source code, generates a Dockerfile, and builds a Docker image. It has a range of features that allow flexibility and can help researchers learn more about working with Docker. + +Dockter also generates a JSON file with information about the software environment (based on [CodeMeta][3] and [Schema.org][4]) to enable further processing and interoperability with other tools. + +Several other projects create Docker images from source code and/or requirements files, including: [alibaba/derrick][5], [jupyter/repo2docker][6], [Gueils/whales][7], [o2r-project/containerit][8]; [openshift/source-to-image][9], and [ViDA-NYU/reprozip][10]. Dockter is similar to repo2docker, containerit, and ReproZip in that it is aimed at researchers doing data analysis (and supports R), whereas most other tools are aimed at software developers (and don't support R). + +Dockter differs from these projects principally in that it: + + * Performs static code analysis for multiple languages to determine package requirements + * Uses package databases to determine package system dependencies and generate linked metadata (containerit does this for R) + * Installs language package dependencies quicker (which can be useful during research projects where dependencies often change) + * By default but optionally, installs Stencila packages so that Stencila client interfaces can execute code in the container + + + +### Dockter's features + +Following are some of the ways researchers can use Dockter. + +#### Generating Docker images from code + +Dockter scans a research project folder and builds a Docker image for it. If the folder already has a Dockerfile, Dockter will build the image from that. If not, Dockter will scan the source code files in the folder and generate one. Dockter currently handles R, Python, and Node.js source code. The .dockerfile (with the dot at the beginning) it generates is fully editable so users can take over from Dockter and carry on with editing the file as they see fit. + +If the folder contains an R package [DESCRIPTION][11] file, Dockter will install the R packages listed under Imports into the image. If the folder does not contain a DESCRIPTION file, Dockter will scan all the R files in the folder for package import or usage statements and create a .DESCRIPTION file. + +If the folder contains a [requirements.txt][12] file for Python, Dockter will copy it into the Docker image and use [pip][13] to install the specified packages. If the folder does not contain either of those files, Dockter will scan all the folder's .py files for import statements and create a .requirements.txt file. + +If the folder contains a [package.json][14] file, Dockter will copy it into the Docker image and use npm to install the specified packages. If the folder does not contain a package.json file, Dockter will scan all the folder's .js files for require calls and create a .package.json file. + +#### Capturing system requirements automatically + +One of the headaches researchers face when hand-writing Dockerfiles is figuring out which system dependencies their project needs. Often this involves a lot of trial and error. Dockter automatically checks if any dependencies (or dependencies of dependencies, or dependencies of…) require system packages and installs those into the image. No more trial and error cycles of build, fail, add dependency, repeat… + +#### Reinstalling language packages faster + +If you have ever built a Docker image, you know it can be frustrating waiting for all your project's dependencies to reinstall when you add or remove just one. + +This happens because of Docker's layered filesystem: When you update a requirements file, Docker throws away all the subsequent layers—including the one where you previously installed your dependencies. That means all the packages have to be reinstalled. + +Dockter takes a different approach. It leaves the installation of language packages to the language package managers: Python's pip, Node.js's npm, and R's install.packages. These package managers are good at the job they were designed for: checking which packages need to be updated and updating only them. The result is much faster rebuilds, especially for R packages, which often involve compilation. + +Dockter does this by looking for a special **# dockter** comment in a Dockerfile. Instead of throwing away layers, it executes all instructions after this comment in the same layer—thereby reusing packages that were previously installed. + +#### Generating structured metadata for a project + +Dockter uses [JSON-LD][15] as its internal data structure. When it parses a project's source code, it generates a JSON-LD tree using vocabularies from schema.org and CodeMeta. + +Dockter also fetches metadata on a project's dependencies, which could be used to generate a complete software citation for the project. + +### Easy to pick up, easy to throw away + +Dockter is designed to make it easier to get started creating Docker images for your project. But it's also designed to not get in your way or restrict you from using bare Docker. You can easily and individually override any of the steps Dockter takes to build an image. + + * **Code analysis:** To stop Dockter from doing code analysis and specify your project's package dependencies, just remove the leading **.** (dot) from the .DESCRIPTION, .requirements.txt, or .package.json files. + + * **Dockerfile generation:** Dockter aims to generate readable Dockerfiles that conform to best practices. They include comments on what each section does and are a good way to start learning how to write your own Dockerfiles. To stop Dockter from generating a .Dockerfile and start editing it yourself, just rename it Dockerfile (without the leading dot). + + + + +### Install Dockter + +[Dockter is available][16] as pre-compiled, standalone command line tool or as a Node.js package. Click [here][17] for a demo. + +We welcome and encourage all [contributions][18]! + +A longer version of this article is available on the project's [GitHub page][19]. + +Aleksandra Pawlik will present [Building reproducible computing environments: a workshop for non-experts][20] at [linux.conf.au][21], January 21-25 in Christchurch, New Zealand. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/1/dockter-image-builder-researchers + +作者:[Nokome Bentley][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/nokome +[b]: https://github.com/lujun9972 +[1]: https://stenci.la/ +[2]: https://stencila.github.io/dockter/ +[3]: https://codemeta.github.io/index.html +[4]: http://Schema.org +[5]: https://github.com/alibaba/derrick +[6]: https://github.com/jupyter/repo2docker +[7]: https://github.com/Gueils/whales +[8]: https://github.com/o2r-project/containerit +[9]: https://github.com/openshift/source-to-image +[10]: https://github.com/ViDA-NYU/reprozip +[11]: http://r-pkgs.had.co.nz/description.html +[12]: https://pip.readthedocs.io/en/1.1/requirements.html +[13]: https://pypi.org/project/pip/ +[14]: https://docs.npmjs.com/files/package.json +[15]: https://json-ld.org/ +[16]: https://github.com/stencila/dockter/releases/ +[17]: https://asciinema.org/a/pOHpxUqIVkGdA1dqu7bENyxZk?size=medium&cols=120&autoplay=1 +[18]: https://github.com/stencila/dockter/blob/master/CONTRIBUTING.md +[19]: https://github.com/stencila/dockter +[20]: https://2019.linux.conf.au/schedule/presentation/185/ +[21]: https://linux.conf.au/ From 4b4c6dc0ef1049df74f2db812c75ed521c9a5a55 Mon Sep 17 00:00:00 2001 From: darksun Date: Mon, 28 Jan 2019 15:26:29 +0800 Subject: [PATCH 177/243] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190122=20Get=20?= =?UTF-8?q?started=20with=20Go=20For=20It,=20a=20flexible=20to-do=20list?= =?UTF-8?q?=20application=20sources/tech/20190122=20Get=20started=20with?= =?UTF-8?q?=20Go=20For=20It,=20a=20flexible=20to-do=20list=20application.m?= =?UTF-8?q?d?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...r It, a flexible to-do list application.md | 60 +++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 sources/tech/20190122 Get started with Go For It, a flexible to-do list application.md diff --git a/sources/tech/20190122 Get started with Go For It, a flexible to-do list application.md b/sources/tech/20190122 Get started with Go For It, a flexible to-do list application.md new file mode 100644 index 0000000000..56dde41884 --- /dev/null +++ b/sources/tech/20190122 Get started with Go For It, a flexible to-do list application.md @@ -0,0 +1,60 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Get started with Go For It, a flexible to-do list application) +[#]: via: (https://opensource.com/article/19/1/productivity-tool-go-for-it) +[#]: author: (Kevin Sonney https://opensource.com/users/ksonney (Kevin Sonney)) + +Get started with Go For It, a flexible to-do list application +====== +Go For It, the tenth in our series on open source tools that will make you more productive in 2019, builds on the Todo.txt system to help you get more things done. +![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/coffee_cafe_brew_laptop_desktop.jpg?itok=G-n1o1-o) + +There seems to be a mad rush at the beginning of every year to find ways to be more productive. New Year's resolutions, the itch to start the year off right, and of course, an "out with the old, in with the new" attitude all contribute to this. And the usual round of recommendations is heavily biased towards closed source and proprietary software. It doesn't have to be that way. + +Here's the tenth of my picks for 19 new (or new-to-you) open source tools to help you be more productive in 2019. + +### Go For It + +Sometimes what a person needs to be productive isn't a fancy kanban board or a set of notes, but a simple, straightforward to-do list. Something that is as basic as "add item to list, check it off when done." And for that, the [plain-text Todo.txt system][1] is possibly one of the easiest to use, and it's supported on almost every system out there. + +![](https://opensource.com/sites/default/files/uploads/go-for-it_1_1.png) + +[Go For It][2] is a simple, easy-to-use graphical interface for Todo.txt. It can be used with an existing file, if you are already using Todo.txt, and will create both a to-do and a done file if you aren't. It allows drag-and-drop ordering of tasks, allowing users to organize to-do items in the order they want to execute them. It also supports priorities, projects, and contexts, as outlined in the [Todo.txt format guidelines][3]. And, it can filter tasks by context or project simply by clicking on the project or context in the task list. + +![](https://opensource.com/sites/default/files/uploads/go-for-it_2.png) + +At first, Go For It may look the same as just about any other Todo.txt program, but looks can be deceiving. The real feature that sets Go For It apart is that it includes a built-in [Pomodoro Technique][4] timer. Select the task you want to complete, switch to the Timer tab, and click Start. When the task is done, simply click Done, and it will automatically reset the timer and pick the next task on the list. You can pause and restart the timer as well as click Skip to jump to the next task (or break). It provides a warning when 60 seconds are left for the current task. The default time for tasks is set at 25 minutes, and the default time for breaks is set at five minutes. You can adjust this in the Settings screen, as well as the location of the directory containing your Todo.txt and done.txt files. + +![](https://opensource.com/sites/default/files/uploads/go-for-it_3.png) + +Go For It's third tab, Done, allows you to look at the tasks you've completed and clean them out when you want. Being able to look at what you've accomplished can be very motivating and a good way to get a feel for where you are in a longer process. + +![](https://opensource.com/sites/default/files/uploads/go-for-it_4.png) + +It also has all of Todo.txt's other advantages. Go For It's list is accessible by other programs that use the same format, including [Todo.txt's original command-line tool][5] and any [add-ons][6] you've installed. + +Go For It seeks to be a simple tool to help manage your to-do list and get those items done. If you already use Todo.txt, Go For It is a fantastic addition to your toolkit, and if you don't, it's a really good way to start using one of the simplest and most flexible systems available. + + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/1/productivity-tool-go-for-it + +作者:[Kevin Sonney][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/ksonney (Kevin Sonney) +[b]: https://github.com/lujun9972 +[1]: http://todotxt.org/ +[2]: http://manuel-kehl.de/projects/go-for-it/ +[3]: https://github.com/todotxt/todo.txt +[4]: https://en.wikipedia.org/wiki/Pomodoro_Technique +[5]: https://github.com/todotxt/todo.txt-cli +[6]: https://github.com/todotxt/todo.txt-cli/wiki/Todo.sh-Add-on-Directory From 2392636dbf30afe06682caebc7b41d35a8733514 Mon Sep 17 00:00:00 2001 From: darksun Date: Mon, 28 Jan 2019 17:11:35 +0800 Subject: [PATCH 178/243] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190123=20Mind?= =?UTF-8?q?=20map=20yourself=20using=20FreeMind=20and=20Fedora=20sources/t?= =?UTF-8?q?ech/20190123=20Mind=20map=20yourself=20using=20FreeMind=20and?= =?UTF-8?q?=20Fedora.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ... map yourself using FreeMind and Fedora.md | 81 +++++++++++++++++++ 1 file changed, 81 insertions(+) create mode 100644 sources/tech/20190123 Mind map yourself using FreeMind and Fedora.md diff --git a/sources/tech/20190123 Mind map yourself using FreeMind and Fedora.md b/sources/tech/20190123 Mind map yourself using FreeMind and Fedora.md new file mode 100644 index 0000000000..146f95752a --- /dev/null +++ b/sources/tech/20190123 Mind map yourself using FreeMind and Fedora.md @@ -0,0 +1,81 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Mind map yourself using FreeMind and Fedora) +[#]: via: (https://fedoramagazine.org/mind-map-yourself-using-freemind-and-fedora/) +[#]: author: (Paul W. Frields https://fedoramagazine.org/author/pfrields/) + +Mind map yourself using FreeMind and Fedora +====== +![](https://fedoramagazine.org/wp-content/uploads/2019/01/freemind-816x345.jpg) + +A mind map of yourself sounds a little far-fetched at first. Is this process about neural pathways? Or telepathic communication? Not at all. Instead, a mind map of yourself is a way to describe yourself to others visually. It also shows connections among the characteristics you use to describe yourself. It’s a useful way to share information with others in a clever but also controllable way. You can use any mind map application for this purpose. This article shows you how to get started using [FreeMind][1], available in Fedora. + +### Get the application + +The FreeMind application has been around a while. While the UI is a bit dated and could use a refresh, it’s a powerful app that offers many options for building mind maps. And of course it’s 100% open source. There are other mind mapping apps available for Fedora and Linux users, as well. Check out [this previous article that covers several mind map options][2]. + +Install FreeMind from the Fedora repositories using the Software app if you’re running Fedora Workstation. Or use this [sudo][3] command in a terminal: + +``` +$ sudo dnf install freemind +``` + +You can launch the app from the GNOME Shell Overview in Fedora Workstation. Or use the application start service your desktop environment provides. FreeMind shows you a new, blank map by default: + +![][4] +FreeMind initial (blank) mind map + +A map consists of linked items or descriptions — nodes. When you think of something related to a node you want to capture, simply create a new node connected to it. + +### Mapping yourself + +Click in the initial node. Replace it with your name by editing the text and hitting **Enter**. You’ve just started your mind map. + +What would you think of if you had to fully describe yourself to someone? There are probably many things to cover. How do you spend your time? What do you enjoy? What do you dislike? What do you value? Do you have a family? All of this can be captured in nodes. + +To add a node connection, select the existing node, and hit **Insert** , or use the “light bulb” icon for a new child node. To add another node at the same level as the new child, use **Enter**. + +Don’t worry if you make a mistake. You can use the **Delete** key to remove an unwanted node. There’s no rules about content. Short nodes are best, though. They allow your mind to move quickly when creating the map. Concise nodes also let viewers scan and understand the map easily later. + +This example uses nodes to explore each of these major categories: + +![][5] +Personal mind map, first level + +You could do another round of iteration for each of these areas. Let your mind freely connect ideas to generate the map. Don’t worry about “getting it right.” It’s better to get everything out of your head and onto the display. Here’s what a next-level map might look like. + +![][6] +Personal mind map, second level + +You could expand on any of these nodes in the same way. Notice how much information you can quickly understand about John Q. Public in the example. + +### How to use your personal mind map + +This is a great way to have team or project members introduce themselves to each other. You can apply all sorts of formatting and color to the map to give it personality. These are fun to do on paper, of course. But having one on your Fedora system means you can always fix mistakes, or even make changes as you change. + +Have fun exploring your personal mind map! + + + +-------------------------------------------------------------------------------- + +via: https://fedoramagazine.org/mind-map-yourself-using-freemind-and-fedora/ + +作者:[Paul W. Frields][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://fedoramagazine.org/author/pfrields/ +[b]: https://github.com/lujun9972 +[1]: http://freemind.sourceforge.net/wiki/index.php/Main_Page +[2]: https://fedoramagazine.org/three-mind-mapping-tools-fedora/ +[3]: https://fedoramagazine.org/howto-use-sudo/ +[4]: https://fedoramagazine.org/wp-content/uploads/2019/01/Screenshot-from-2019-01-19-15-17-04-1024x736.png +[5]: https://fedoramagazine.org/wp-content/uploads/2019/01/Screenshot-from-2019-01-19-15-32-38-1024x736.png +[6]: https://fedoramagazine.org/wp-content/uploads/2019/01/Screenshot-from-2019-01-19-15-38-00-1024x736.png From 257fd061a813a238dae0461e7d647619a708a887 Mon Sep 17 00:00:00 2001 From: darksun Date: Mon, 28 Jan 2019 17:15:21 +0800 Subject: [PATCH 179/243] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190124=20ffsend?= =?UTF-8?q?=20=E2=80=93=20Easily=20And=20Securely=20Share=20Files=20From?= =?UTF-8?q?=20Linux=20Command=20Line=20Using=20Firefox=20Send=20Client=20s?= =?UTF-8?q?ources/tech/20190124=20ffsend=20-=20Easily=20And=20Securely=20S?= =?UTF-8?q?hare=20Files=20From=20Linux=20Command=20Line=20Using=20Firefox?= =?UTF-8?q?=20Send=20Client.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ... Command Line Using Firefox Send Client.md | 330 ++++++++++++++++++ 1 file changed, 330 insertions(+) create mode 100644 sources/tech/20190124 ffsend - Easily And Securely Share Files From Linux Command Line Using Firefox Send Client.md diff --git a/sources/tech/20190124 ffsend - Easily And Securely Share Files From Linux Command Line Using Firefox Send Client.md b/sources/tech/20190124 ffsend - Easily And Securely Share Files From Linux Command Line Using Firefox Send Client.md new file mode 100644 index 0000000000..fcbdd3c5c7 --- /dev/null +++ b/sources/tech/20190124 ffsend - Easily And Securely Share Files From Linux Command Line Using Firefox Send Client.md @@ -0,0 +1,330 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (ffsend – Easily And Securely Share Files From Linux Command Line Using Firefox Send Client) +[#]: via: (https://www.2daygeek.com/ffsend-securely-share-files-folders-from-linux-command-line-using-firefox-send-client/) +[#]: author: (Vinoth Kumar https://www.2daygeek.com/author/vinoth/) + +ffsend – Easily And Securely Share Files From Linux Command Line Using Firefox Send Client +====== + +Linux users were preferred to go with scp or rsync for files or folders copy. + +However, so many new options are coming to Linux because it’s a opensource. + +Anyone can develop a secure software for Linux. + +We had written multiple articles in our site in the past about this topic. + +Even, today we are going to discuss the same kind of topic called ffsend. + +Those are **[OnionShare][1]** , **[Magic Wormhole][2]** , **[Transfer.sh][3]** and **[Dcp – Dat Copy][4]**. + +### What’s ffsend? + +[ffsend][5] is a command line Firefox Send client that allow users to transfer and receive files and folders through command line. + +It allow us to easily and securely share files and directories from the command line through a safe, private and encrypted link using a single simple command. + +Files are shared using the Send service and the allowed file size is up to 2GB. + +Others are able to download these files with this tool, or through their web browser. + +All files are always encrypted on the client, and secrets are never shared with the remote host. + +Additionally you can add a password for the file upload. + +The uploaded files will be removed after the download (default count is 1 up to 10) or after 24 hours. This will make sure that your files does not remain online forever. + +This tool is currently in the alpha phase. Use at your own risk. Also, only limited installation options are available right now. + +### ffsend Features: + + * Fully featured and friendly command line tool + * Upload and download files and directories securely + * Always encrypted on the client + * Additional password protection, generation and configurable download limits + * Built-in file and directory archiving and extraction + * History tracking your files for easy management + * Ability to use your own Send host + * Inspect or delete shared files + * Accurate error reporting + * Low memory footprint, due to encryption and download/upload streaming + * Intended to be used in scripts without interaction + + + +### How To Install ffsend in Linux? + +There is no package for each distributions except Debian and Arch Linux systems. However, we can easily get this utility by downloading the prebuilt appropriate binaries file based on the operating system and architecture. + +Run the below command to download the latest available version for your operating system. + +``` +$ wget https://github.com/timvisee/ffsend/releases/download/v0.1.2/ffsend-v0.1.2-linux-x64.tar.gz +``` + +Extract the tar archive using the following command. + +``` +$ tar -xvf ffsend-v0.1.2-linux-x64.tar.gz +``` + +Run the following command to identify your path variable. + +``` +$ echo $PATH +/home/daygeek/.cargo/bin:/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/lib/jvm/default/bin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl +``` + +As i told previously, just move the executable file to your path directory. + +``` +$ sudo mv ffsend /usr/local/sbin +``` + +Run the `ffsend` command alone to get the basic usage information. + +``` +$ ffsend +ffsend 0.1.2 +Usage: ffsend [FLAGS] ... + +Easily and securely share files from the command line. +A fully featured Firefox Send client. + +Missing subcommand. Here are the most used: + ffsend upload ... + ffsend download ... + +To show all subcommands, features and other help: + ffsend help [SUBCOMMAND] +``` + +For Arch Linux based users can easily install it with help of **[AUR Helper][6]** , as this package is available in AUR repository. + +``` +$ yay -S ffsend +``` + +For **`Debian/Ubuntu`** systems, use **[DPKG Command][7]** to install ffsend. + +``` +$ wget https://github.com/timvisee/ffsend/releases/download/v0.1.2/ffsend_0.1.2_amd64.deb +$ sudo dpkg -i ffsend_0.1.2_amd64.deb +``` + +### How To Send A File Using ffsend? + +It’s not complicated. We can easily send a file using simple syntax. + +**Syntax:** + +``` +$ ffsend upload [/Path/to/the/file/name] +``` + +In the following example, we are going to upload a file called `passwd-up1.sh`. Once you upload the file then you will be getting the unique URL. + +``` +$ ffsend upload passwd-up1.sh --copy +Upload complete +Share link: https://send.firefox.com/download/a4062553f4/#yy2_VyPaUMG5HwXZzYRmpQ +``` + +![][9] + +Just download the above unique URL to get the file in any remote system. + +**Syntax:** + +``` +$ ffsend download [Generated URL] +``` + +Output for the above command. + +``` +$ ffsend download https://send.firefox.com/download/a4062553f4/#yy2_VyPaUMG5HwXZzYRmpQ +Download complete +``` + +![][10] + +Use the following syntax format for directory upload. + +``` +$ ffsend upload [/Path/to/the/Directory] --copy +``` + +In this example, we are going to upload `2g` directory. + +``` +$ ffsend upload /home/daygeek/2g --copy +You've selected a directory, only a single file may be uploaded. +Archive the directory into a single file? [Y/n]: y +Archiving... +Upload complete +Share link: https://send.firefox.com/download/90aa5cfe67/#hrwu6oXZRG2DNh8vOc3BGg +``` + +Just download the above generated the unique URL to get a folder in any remote system. + +``` +$ ffsend download https://send.firefox.com/download/90aa5cfe67/#hrwu6oXZRG2DNh8vOc3BGg +You're downloading an archive, extract it into the selected directory? [Y/n]: y +Extracting... +Download complete +``` + +As this already send files through a safe, private, and encrypted link. However, if you would like to add a additional security at your level. Yes, you can add a password for a file. + +``` +$ ffsend upload file-copy-rsync.sh --copy --password +Password: +Upload complete +Share link: https://send.firefox.com/download/0742d24515/#P7gcNiwZJ87vF8cumU71zA +``` + +It will prompt you to update a password when you are trying to download a file in the remote system. + +``` +$ ffsend download https://send.firefox.com/download/0742d24515/#P7gcNiwZJ87vF8cumU71zA +This file is protected with a password. +Password: +Download complete +``` + +Alternatively you can limit a download speed by providing the download speed while uploading a file. + +``` +$ ffsend upload file-copy-scp.sh --copy --downloads 10 +Upload complete +Share link: https://send.firefox.com/download/23cb923c4e/#LVg6K0CIb7Y9KfJRNZDQGw +``` + +Just download the above unique URL to get a file in any remote system. + +``` +ffsend download https://send.firefox.com/download/23cb923c4e/#LVg6K0CIb7Y9KfJRNZDQGw +Download complete +``` + +If you want to see more details about the file, use the following format. It will shows you the file name, file size, Download counts and when it will going to expire. + +**Syntax:** + +``` +$ ffsend info [Generated URL] + +$ ffsend info https://send.firefox.com/download/23cb923c4e/#LVg6K0CIb7Y9KfJRNZDQGw +ID: 23cb923c4e +Name: file-copy-scp.sh +Size: 115 B +MIME: application/x-sh +Downloads: 3 of 10 +Expiry: 23h58m (86280s) +``` + +You can view your transaction history using the following format. + +``` +$ ffsend history +# LINK EXPIRY +1 https://send.firefox.com/download/23cb923c4e/#LVg6K0CIb7Y9KfJRNZDQGw 23h57m +2 https://send.firefox.com/download/0742d24515/#P7gcNiwZJ87vF8cumU71zA 23h55m +3 https://send.firefox.com/download/90aa5cfe67/#hrwu6oXZRG2DNh8vOc3BGg 23h52m +4 https://send.firefox.com/download/a4062553f4/#yy2_VyPaUMG5HwXZzYRmpQ 23h46m +5 https://send.firefox.com/download/74ff30e43e/#NYfDOUp_Ai-RKg5g0fCZXw 23h44m +6 https://send.firefox.com/download/69afaab1f9/#5z51_94jtxcUCJNNvf6RcA 23h43m +``` + +If you don’t want the link anymore then we can delete it. + +**Syntax:** + +``` +$ ffsend delete [Generated URL] + +$ ffsend delete https://send.firefox.com/download/69afaab1f9/#5z51_94jtxcUCJNNvf6RcA +File deleted +``` + +Alternatively this can be done using firefox browser by opening the page . + +Just drag and drop a file to upload it. +![][11] + +Once the file is downloaded, it will show you that 100% download completed. +![][12] + +To check other possible options, navigate to man page or help page. + +``` +$ ffsend --help +ffsend 0.1.2 +Tim Visee +Easily and securely share files from the command line. +A fully featured Firefox Send client. + +USAGE: + ffsend [FLAGS] [OPTIONS] [SUBCOMMAND] + +FLAGS: + -f, --force Force the action, ignore warnings + -h, --help Prints help information + -i, --incognito Don't update local history for actions + -I, --no-interact Not interactive, do not prompt + -q, --quiet Produce output suitable for logging and automation + -V, --version Prints version information + -v, --verbose Enable verbose information and logging + -y, --yes Assume yes for prompts + +OPTIONS: + -H, --history Use the specified history file [env: FFSEND_HISTORY] + -t, --timeout Request timeout (0 to disable) [env: FFSEND_TIMEOUT] + -T, --transfer-timeout Transfer timeout (0 to disable) [env: FFSEND_TRANSFER_TIMEOUT] + +SUBCOMMANDS: + upload Upload files [aliases: u, up] + download Download files [aliases: d, down] + debug View debug information [aliases: dbg] + delete Delete a shared file [aliases: del] + exists Check whether a remote file exists [aliases: e] + help Prints this message or the help of the given subcommand(s) + history View file history [aliases: h] + info Fetch info about a shared file [aliases: i] + parameters Change parameters of a shared file [aliases: params] + password Change the password of a shared file [aliases: pass, p] + +The public Send service that is used as default host is provided by Mozilla. +This application is not affiliated with Mozilla, Firefox or Firefox Send. +``` + +-------------------------------------------------------------------------------- + +via: https://www.2daygeek.com/ffsend-securely-share-files-folders-from-linux-command-line-using-firefox-send-client/ + +作者:[Vinoth Kumar][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.2daygeek.com/author/vinoth/ +[b]: https://github.com/lujun9972 +[1]: https://www.2daygeek.com/onionshare-secure-way-to-share-files-sharing-tool-linux/ +[2]: https://www.2daygeek.com/wormhole-securely-share-files-from-linux-command-line/ +[3]: https://www.2daygeek.com/transfer-sh-easy-fast-way-share-files-over-internet-from-command-line/ +[4]: https://www.2daygeek.com/dcp-dat-copy-secure-way-to-transfer-files-between-linux-systems/ +[5]: https://github.com/timvisee/ffsend +[6]: https://www.2daygeek.com/category/aur-helper/ +[7]: https://www.2daygeek.com/dpkg-command-to-manage-packages-on-debian-ubuntu-linux-mint-systems/ +[8]: data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7 +[9]: https://www.2daygeek.com/wp-content/uploads/2019/01/ffsend-easily-and-securely-share-files-from-linux-command-line-using-firefox-send-client-1.png +[10]: https://www.2daygeek.com/wp-content/uploads/2019/01/ffsend-easily-and-securely-share-files-from-linux-command-line-using-firefox-send-client-2.png +[11]: https://www.2daygeek.com/wp-content/uploads/2019/01/ffsend-easily-and-securely-share-files-from-linux-command-line-using-firefox-send-client-3.png +[12]: https://www.2daygeek.com/wp-content/uploads/2019/01/ffsend-easily-and-securely-share-files-from-linux-command-line-using-firefox-send-client-4.png From 80fd194842eda72d4832472b130b4b8513346468 Mon Sep 17 00:00:00 2001 From: darksun Date: Mon, 28 Jan 2019 17:18:01 +0800 Subject: [PATCH 180/243] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190123=20Book?= =?UTF-8?q?=20Review:=20Fundamentals=20of=20Linux=20sources/talk/20190123?= =?UTF-8?q?=20Book=20Review-=20Fundamentals=20of=20Linux.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...0123 Book Review- Fundamentals of Linux.md | 74 +++++++++++++++++++ 1 file changed, 74 insertions(+) create mode 100644 sources/talk/20190123 Book Review- Fundamentals of Linux.md diff --git a/sources/talk/20190123 Book Review- Fundamentals of Linux.md b/sources/talk/20190123 Book Review- Fundamentals of Linux.md new file mode 100644 index 0000000000..5e0cffd9bc --- /dev/null +++ b/sources/talk/20190123 Book Review- Fundamentals of Linux.md @@ -0,0 +1,74 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Book Review: Fundamentals of Linux) +[#]: via: (https://itsfoss.com/fundamentals-of-linux-book-review) +[#]: author: (John Paul https://itsfoss.com/author/john/) + +Book Review: Fundamentals of Linux +====== + +There are many great books that cover the basics of what Linux is and how it works. Today, I will be taking a look at one such book. Today, the subject of our discussion is [Fundamentals of Linux][1] by Oliver Pelz and is published by [PacktPub][2]. + +[Oliver Pelz][3] has over ten years of experience as a software developer and a system administrator. He holds a degree in bioinformatics. + +### What is the book ‘Fundamentals of Linux’ about? + +![Fundamental of Linux books][4] + +As can be guessed from the title, the goal of Fundamentals of Linux is to give the reader a strong foundation from which to learn about the Linux command line. The book is a little over two hundred pages long, so it only focuses on teaching the everyday tasks and problems that users commonly encounter. The book is designed for readers who want to become Linux administrators. + +The first chapter starts out by giving an overview of virtualization. From there the author instructs how to create a virtual instance of [CentOS][5] in [VirtualBox][6], how to clone it, and how to use snapshots. You will also learn how to connect to the virtual machines via SSH. + +The second chapter covers the basics of the Linux command line. This includes shell globbing, shell expansion, how to work with file names that contain spaces or special characters. It also explains how to interpret a command’s manual page, as well as, how to use `sed`, `awk`, and to navigate the Linux file system. + +The third chapter takes a more in-depth look at the Linux file system. You will learn how files are linked in Linux and how to search for them. You will also be given an overview of users, groups and file permissions. Since the chapter focuses on interacting with files, it tells how to read text files from the command line, as well as, an overview of how to use the VIM editor. + +Chapter four focuses on using the command line. It covers important commands, such as `cat`, `sort`, `awk`. `tee`, `tar`, `rsync`, `nmap`, `htop` and more. You will learn what processes are and how they communicate with each other. This chapter also includes an introduction to Bash shell scripting. + +The fifth and final chapter covers networking on Linux and other advanced command line concepts. The author discusses how Linux handles networking and gives examples using multiple virtual machines. He also covers how to install new programs and how to set up a firewall. + +### Thoughts on the book + +Fundamentals of Linux might seem short at five chapters and a little over two hundred pages. However, quite a bit of information is covered. You are given everything that you need to get going on the command line. + +The book’s sole focus on the command line is one thing to keep in mind. You won’t get any information on how to use a graphical user interface. That is partially because Linux has so many different desktop environments and so many similar system applications that it would be hard to write a book that could cover all of the variables. It is also partially because the book is aimed at potential Linux administrators. + +I was kinda surprised to see that the author used [CentOS][7] to teach Linux. I would have expected him to use a more common Linux distro, like Ubuntu, Debian, or Fedora. However, because it is a distro designed for servers very little changes over time, so it is a very stable basis for a course on Linux basics. + +I’ve used Linux for over half a decade. I spent most of that time using desktop Linux. I dove into the terminal when I needed to, but didn’t spend lots of time there. I have performed many of the actions covered in this book using a mouse. Now, I know how to do the same things via the terminal. It won’t change the way I do my tasks, but it will help me understand what goes on behind the curtain. + +If you have either just started using Linux or are planning to do so in the future, I would not recommend this book. It might be a little overwhelming. If you have already spent some time with Linux or can quickly grasp the technical language, this book may very well be for you. + +If you think this book is apt for your learning needs, you can get the book from the link below: + +We will be trying to review more Linux books in coming months so stay tuned with us. + +What is your favorite introductory book on Linux? Let us know in the comments below. + +If you found this article interesting, please take a minute to share it on social media, Hacker News or [Reddit][8]. + + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/fundamentals-of-linux-book-review + +作者:[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://www.packtpub.com/networking-and-servers/fundamentals-linux +[2]: https://www.packtpub.com/ +[3]: http://www.oliverpelz.de/index.html +[4]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/01/fundamentals-of-linux-book-review.jpeg?resize=800%2C450&ssl=1 +[5]: https://centos.org/ +[6]: https://www.virtualbox.org/ +[7]: https://www.centos.org/ +[8]: http://reddit.com/r/linuxusersgroup From adb460d03ae6ada6ad41c61e20c8d6c4ac0fbd97 Mon Sep 17 00:00:00 2001 From: darksun Date: Mon, 28 Jan 2019 17:22:08 +0800 Subject: [PATCH 181/243] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190119=20Get=20?= =?UTF-8?q?started=20with=20Roland,=20a=20random=20selection=20tool=20for?= =?UTF-8?q?=20the=20command=20line=20sources/tech/20190119=20Get=20started?= =?UTF-8?q?=20with=20Roland,=20a=20random=20selection=20tool=20for=20the?= =?UTF-8?q?=20command=20line.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...dom selection tool for the command line.md | 90 +++++++++++++++++++ 1 file changed, 90 insertions(+) create mode 100644 sources/tech/20190119 Get started with Roland, a random selection tool for the command line.md diff --git a/sources/tech/20190119 Get started with Roland, a random selection tool for the command line.md b/sources/tech/20190119 Get started with Roland, a random selection tool for the command line.md new file mode 100644 index 0000000000..1bfeb92c0c --- /dev/null +++ b/sources/tech/20190119 Get started with Roland, a random selection tool for the command line.md @@ -0,0 +1,90 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Get started with Roland, a random selection tool for the command line) +[#]: via: (https://opensource.com/article/19/1/productivity-tools-roland) +[#]: author: (Kevin Sonney https://opensource.com/users/ksonney (Kevin Sonney)) + +Get started with Roland, a random selection tool for the command line +====== + +Get help making hard choices with Roland, the seventh in our series on open source tools that will make you more productive in 2019. + +![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/dice_tabletop_board_gaming_game.jpg?itok=y93eW7HN) + +There seems to be a mad rush at the beginning of every year to find ways to be more productive. New Year's resolutions, the itch to start the year off right, and of course, an "out with the old, in with the new" attitude all contribute to this. And the usual round of recommendations is heavily biased towards closed source and proprietary software. It doesn't have to be that way. + +Here's the seventh of my picks for 19 new (or new-to-you) open source tools to help you be more productive in 2019. + +### Roland + +By the time the workday has ended, often the only thing I want to think about is hitting the couch and playing the video game of the week. But even though my professional obligations stop at the end of the workday, I still have to manage my household. Laundry, pet care, making sure my teenager has what he needs, and most important: deciding what to make for dinner. + +Like many people, I often suffer from [decision fatigue][1], and I make less-than-healthy choices for dinner based on speed, ease of preparation, and (quite frankly) whatever causes me the least stress. + +![](https://opensource.com/sites/default/files/uploads/roland-1.png) + +[Roland][2] makes planning my meals much easier. Roland is a Perl application designed for tabletop role-playing games. It picks randomly from a list of items, such as monsters and hirelings. In essence, Roland does the same thing at the command line that a game master does when rolling physical dice to look up things in a table from the Game Master's Big Book of Bad Things to Do to Players. + +With minor modifications, Roland can do so much more. For example, just by adding a table, I can enable Roland to help me choose what to cook for dinner. + +The first step is installing Roland and all its dependencies. + +``` +git clone git@github.com:rjbs/Roland.git +cpan install Getopt::Long::Descriptive Moose \ +   namespace::autoclean List:AllUtils Games::Dice \ +   Sort::ByExample Data::Bucketeer Text::Autoformat \ +   YAML::XS +cd oland +``` + +Next, I create a YAML document named **dinner** and enter all our meal options. + +``` +type: list +pick: 1 +items: + - "frozen pizza" + - "chipotle black beans" + - "huevos rancheros" + - "nachos" + - "pork roast" + - "15 bean soup" + - "roast chicken" + - "pot roast" + - "grilled cheese sandwiches" +``` + +Running the command **bin/roland dinner** will read the file and pick one of the options. + +![](https://opensource.com/sites/default/files/uploads/roland-2.png) + +I like to plan for the week ahead so I can shop for all my ingredients in advance. The **pick** command determines how many items from the list to chose, and right now, the **pick** option is set to 1. If I want to plan a full week's dinner menu, I can just change **pick: 1** to **pick: 7** and it will give me a week's worth of dinners. You can also use the **-m** command line option to manually enter the choices. + +![](https://opensource.com/sites/default/files/uploads/roland-3.png) + +You can also do fun things with Roland, like adding a file named **8ball** with some classic phrases. + +![](https://opensource.com/sites/default/files/uploads/roland-4.png) + +You can create all kinds of files to help with common decisions that seem so stressful after a long day of work. And even if you don't use it for that, you can still use it to decide which devious trap to set up for tonight's game. + + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/1/productivity-tools-roland + +作者:[Kevin Sonney][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/ksonney (Kevin Sonney) +[b]: https://github.com/lujun9972 +[1]: https://en.wikipedia.org/wiki/Decision_fatigue +[2]: https://github.com/rjbs/Roland From 441b66b06b1f9210858c441077f044afcd9d7a52 Mon Sep 17 00:00:00 2001 From: darksun Date: Mon, 28 Jan 2019 17:55:20 +0800 Subject: [PATCH 182/243] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190122=20Dcp=20?= =?UTF-8?q?(Dat=20Copy)=20=E2=80=93=20Easy=20And=20Secure=20Way=20To=20Tra?= =?UTF-8?q?nsfer=20Files=20Between=20Linux=20Systems=20sources/tech/201901?= =?UTF-8?q?22=20Dcp=20(Dat=20Copy)=20-=20Easy=20And=20Secure=20Way=20To=20?= =?UTF-8?q?Transfer=20Files=20Between=20Linux=20Systems.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...To Transfer Files Between Linux Systems.md | 177 ++++++++++++++++++ 1 file changed, 177 insertions(+) create mode 100644 sources/tech/20190122 Dcp (Dat Copy) - Easy And Secure Way To Transfer Files Between Linux Systems.md diff --git a/sources/tech/20190122 Dcp (Dat Copy) - Easy And Secure Way To Transfer Files Between Linux Systems.md b/sources/tech/20190122 Dcp (Dat Copy) - Easy And Secure Way To Transfer Files Between Linux Systems.md new file mode 100644 index 0000000000..b6499932ae --- /dev/null +++ b/sources/tech/20190122 Dcp (Dat Copy) - Easy And Secure Way To Transfer Files Between Linux Systems.md @@ -0,0 +1,177 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Dcp (Dat Copy) – Easy And Secure Way To Transfer Files Between Linux Systems) +[#]: via: (https://www.2daygeek.com/dcp-dat-copy-secure-way-to-transfer-files-between-linux-systems/) +[#]: author: (Vinoth Kumar https://www.2daygeek.com/author/vinoth/) + +Dcp (Dat Copy) – Easy And Secure Way To Transfer Files Between Linux Systems +====== + +Linux has native command to perform this task nicely using scp and rsync. However, we need to try new things. + +Also, we need to encourage the developers who is working new things with different concept and new technology. + +We also written few articles about these kind of topic, you can navigate those by clicking the below appropriate links. + +Those are **[OnionShare][1]** , **[Magic Wormhole][2]** , **[Transfer.sh][3]** and **ffsend**. + +### What’s Dcp? + +[dcp][4] copies files between hosts on a network using the peer-to-peer Dat network. + +dcp can be seen as an alternative to tools like scp, removing the need to configure SSH access between hosts. + +This lets you transfer files between two remote hosts, without you needing to worry about the specifics of how said hosts reach each other and regardless of whether hosts are behind NATs. + +dcp requires zero configuration and is secure, fast, and peer-to-peer. Also, this is not production-ready software. Use at your own risk. + +### What’s Dat Protocol? + +Dat is a peer-to-peer protocol. A community-driven project powering a next-generation Web. + +### How dcp works: + +dcp will create a dat archive for a specified set of files or directories and, using the generated public key, lets you download said archive from a second host. + +Any data shared over the network is encrypted using the public key of the archive, meaning data access is limited to those who have access to said key. + +### dcp Use cases: + + * Send files to multiple colleagues – just send the generated public key via chat and they can receive the files on their machine. + * Sync files between two physical computers on your local network, without needing to set up SSH access. + * Easily send files to a friend without needing to create a zip and upload it the cloud. + * Copy files to a remote server when you have shell access but not SSH, for example on a kubernetes pod. + * Share files between Linux/macOS and Windows, which isn’t exactly known for great SSH support. + + + +### How To Install NodeJS & npm in Linux? + +dcp package was written in JavaScript programming language so, we need to install NodeJS as a prerequisites to install dcp. Use the following command to install NodeJS in Linux. + +For **`Fedora`** system, use **[DNF Command][5]** to install NodeJS & npm. + +``` +$ sudo dnf install nodejs npm +``` + +For **`Debian/Ubuntu`** systems, use **[APT-GET Command][6]** or **[APT Command][7]** to install NodeJS & npm. + +``` +$ sudo apt install nodejs npm +``` + +For **`Arch Linux`** based systems, use **[Pacman Command][8]** to install NodeJS & npm. + +``` +$ sudo pacman -S nodejs npm +``` + +For **`RHEL/CentOS`** systems, use **[YUM Command][9]** to install NodeJS & npm. + +``` +$ sudo yum install epel-release +$ sudo yum install nodejs npm +``` + +For **`openSUSE Leap`** system, use **[Zypper Command][10]** to install NodeJS & npm. + +``` +$ sudo zypper nodejs6 +``` + +### How To Install dcp in Linux? + +Once you have installed the NodeJS, use the following npm command to install dcp. + +npm is a package manager for the JavaScript programming language. It is the default package manager for the JavaScript runtime environment Node.js. + +``` +# npm i -g dat-cp +``` + +### How to Send Files Through dcp? + +Enter the files or folders which you want to transfer to remote server followed by the dcp command, And no need to mention the destination machine name. + +``` +# dcp [File Name Which You Want To Transfer] +``` + +It will generate a dat archive for the given file when you ran the dcp command. Once it’s done then it will geerate a public key at the bottom of the page. + +### How To Receive Files Through dcp? + +Enter the generated the public key on remote server to receive the files or folders. + +``` +# dcp [Public Key] +``` + +To recursively copy directories. + +``` +# dcp [Folder Name Which You Want To Transfer] -r +``` + +In the following example, we are going to transfer a single file. +![][12] + +Output for the above file transfer. +![][13] + +If you want to send more than one file, use the following format. +![][14] + +Output for the above file transfer. +![][15] + +To recursively copy directories. +![][16] + +Output for the above folder transfer. +![][17] + +It won’t allow you to download the files or folders in second time. It means once you downloaded the files or folders then immediately the link will be expired. +![][18] + +Navigate to man page to know about other options. + +``` +# dcp --help +``` + +-------------------------------------------------------------------------------- + +via: https://www.2daygeek.com/dcp-dat-copy-secure-way-to-transfer-files-between-linux-systems/ + +作者:[Vinoth Kumar][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.2daygeek.com/author/vinoth/ +[b]: https://github.com/lujun9972 +[1]: https://www.2daygeek.com/onionshare-secure-way-to-share-files-sharing-tool-linux/ +[2]: https://www.2daygeek.com/wormhole-securely-share-files-from-linux-command-line/ +[3]: https://www.2daygeek.com/transfer-sh-easy-fast-way-share-files-over-internet-from-command-line/ +[4]: https://github.com/tom-james-watson/dat-cp +[5]: https://www.2daygeek.com/dnf-command-examples-manage-packages-fedora-system/ +[6]: https://www.2daygeek.com/apt-get-apt-cache-command-examples-manage-packages-debian-ubuntu-systems/ +[7]: https://www.2daygeek.com/apt-command-examples-manage-packages-debian-ubuntu-systems/ +[8]: https://www.2daygeek.com/pacman-command-examples-manage-packages-arch-linux-system/ +[9]: https://www.2daygeek.com/yum-command-examples-manage-packages-rhel-centos-systems/ +[10]: https://www.2daygeek.com/zypper-command-examples-manage-packages-opensuse-system/ +[11]: data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7 +[12]: https://www.2daygeek.com/wp-content/uploads/2019/01/Dcp-Dat-Copy-Easy-And-Secure-Way-To-Transfer-Files-Between-Linux-Systems-1.png +[13]: https://www.2daygeek.com/wp-content/uploads/2019/01/Dcp-Dat-Copy-Easy-And-Secure-Way-To-Transfer-Files-Between-Linux-Systems-2.png +[14]: https://www.2daygeek.com/wp-content/uploads/2019/01/Dcp-Dat-Copy-Easy-And-Secure-Way-To-Transfer-Files-Between-Linux-Systems-3.jpg +[15]: https://www.2daygeek.com/wp-content/uploads/2019/01/Dcp-Dat-Copy-Easy-And-Secure-Way-To-Transfer-Files-Between-Linux-Systems-4.jpg +[16]: https://www.2daygeek.com/wp-content/uploads/2019/01/Dcp-Dat-Copy-Easy-And-Secure-Way-To-Transfer-Files-Between-Linux-Systems-6.jpg +[17]: https://www.2daygeek.com/wp-content/uploads/2019/01/Dcp-Dat-Copy-Easy-And-Secure-Way-To-Transfer-Files-Between-Linux-Systems-7.jpg +[18]: https://www.2daygeek.com/wp-content/uploads/2019/01/Dcp-Dat-Copy-Easy-And-Secure-Way-To-Transfer-Files-Between-Linux-Systems-5.jpg From 7463be52e586bcddb6511eb951a30d3c2f1e3b0b Mon Sep 17 00:00:00 2001 From: darksun Date: Mon, 28 Jan 2019 17:57:11 +0800 Subject: [PATCH 183/243] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190121=20Get=20?= =?UTF-8?q?started=20with=20TaskBoard,=20a=20lightweight=20kanban=20board?= =?UTF-8?q?=20sources/tech/20190121=20Get=20started=20with=20TaskBoard,=20?= =?UTF-8?q?a=20lightweight=20kanban=20board.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...h TaskBoard, a lightweight kanban board.md | 59 +++++++++++++++++++ 1 file changed, 59 insertions(+) create mode 100644 sources/tech/20190121 Get started with TaskBoard, a lightweight kanban board.md diff --git a/sources/tech/20190121 Get started with TaskBoard, a lightweight kanban board.md b/sources/tech/20190121 Get started with TaskBoard, a lightweight kanban board.md new file mode 100644 index 0000000000..e77e5e3b1c --- /dev/null +++ b/sources/tech/20190121 Get started with TaskBoard, a lightweight kanban board.md @@ -0,0 +1,59 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Get started with TaskBoard, a lightweight kanban board) +[#]: via: (https://opensource.com/article/19/1/productivity-tool-taskboard) +[#]: author: (Kevin Sonney https://opensource.com/users/ksonney (Kevin Sonney)) + +Get started with TaskBoard, a lightweight kanban board +====== +Check out the ninth tool in our series on open source tools that will make you more productive in 2019. + +![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/checklist_hands_team_collaboration.png?itok=u82QepPk) + +There seems to be a mad rush at the beginning of every year to find ways to be more productive. New Year's resolutions, the itch to start the year off right, and of course, an "out with the old, in with the new" attitude all contribute to this. And the usual round of recommendations is heavily biased towards closed source and proprietary software. It doesn't have to be that way. + +Here's the ninth of my picks for 19 new (or new-to-you) open source tools to help you be more productive in 2019. + +### TaskBoard + +As I wrote in the [second article][1] in this series, [kanban boards][2] are pretty popular these days. And not all kanban boards are created equal. [TaskBoard][3] is a PHP application that is easy to set up on an existing web server and has a set of functions that make it easy to use and manage. + +![](https://opensource.com/sites/default/files/uploads/taskboard-1.png) + +[Installation][4] is as simple as unzipping the files on your web server, running a script or two, and making sure the correct directories are accessible. The first time you start it up, you're presented with a login form, and then it's time to start adding users and making boards. Board creation options include adding the columns you want to use and setting the default color of the cards. You can also assign users to boards so everyone sees only the boards they need to see. + +User management is lightweight, and all accounts are local to the server. You can set a default board for everyone on the server, and users can set their own default boards, too. These options can be useful when someone works on one board more than others. + +![](https://opensource.com/sites/default/files/uploads/taskboard-2.png) + +TaskBoard also allows you to create automatic actions, which are actions taken upon changes to user assignment, columns, or card categories. Although TaskBoard is not as powerful as some other kanban apps, you can set up automatic actions to make cards more visible for board users, clear due dates, and auto-assign new cards to people as needed. For example, in the screenshot below, if a card is assigned to the "admin" user, its color is changed to red, and when a card is assigned to my user, its color is changed to teal. I've also added an action to clear an item's due date if it's added to the "To-Do" column and to auto-assign cards to my user when that happens. + +![](https://opensource.com/sites/default/files/uploads/taskboard-3.png) + +The cards are very straightforward. While they don't have a start date, they do have end dates and a points field. Points can be used for estimating the time needed, effort required, or just general priority. Using points is optional, but if you are using TaskBoard for scrum planning or other agile techniques, it is a really handy feature. You can also filter the view by users and categories. This can be helpful on a team with multiple work streams going on, as it allows a team lead or manager to get status information about progress or a person's workload. + +![](https://opensource.com/sites/default/files/uploads/taskboard-4.png) + +If you need a reasonably lightweight kanban board, check out TaskBoard. It installs quickly, has some nice features, and is very, very easy to use. It's also flexible enough to be used for development teams, personal task tracking, and a whole lot more. + + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/1/productivity-tool-taskboard + +作者:[Kevin Sonney][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/ksonney (Kevin Sonney) +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/article/19/1/productivity-tool-wekan +[2]: https://en.wikipedia.org/wiki/Kanban +[3]: https://taskboard.matthewross.me/ +[4]: https://taskboard.matthewross.me/docs/ From c621b80f44d7288f94ba6f8f73ae305d34a72cbd Mon Sep 17 00:00:00 2001 From: MjSeven Date: Mon, 28 Jan 2019 19:31:26 +0800 Subject: [PATCH 184/243] Translating --- ...tting started with Isotope, an open source webmail client.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20190123 Getting started with Isotope, an open source webmail client.md b/sources/tech/20190123 Getting started with Isotope, an open source webmail client.md index e4a24a28a8..71307d1550 100644 --- a/sources/tech/20190123 Getting started with Isotope, an open source webmail client.md +++ b/sources/tech/20190123 Getting started with Isotope, an open source webmail client.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (MjSeven) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From ec3bd5b5881f5a08f1deebe8bc2108663f7e5141 Mon Sep 17 00:00:00 2001 From: jrg Date: Mon, 28 Jan 2019 20:36:13 +0800 Subject: [PATCH 185/243] Delete 20190114 Turn a Raspberry Pi 3B- into a PriTunl VPN.md --- ...n a Raspberry Pi 3B- into a PriTunl VPN.md | 113 ------------------ 1 file changed, 113 deletions(-) delete mode 100644 sources/tech/20190114 Turn a Raspberry Pi 3B- into a PriTunl VPN.md diff --git a/sources/tech/20190114 Turn a Raspberry Pi 3B- into a PriTunl VPN.md b/sources/tech/20190114 Turn a Raspberry Pi 3B- into a PriTunl VPN.md deleted file mode 100644 index 3d6d94cabf..0000000000 --- a/sources/tech/20190114 Turn a Raspberry Pi 3B- into a PriTunl VPN.md +++ /dev/null @@ -1,113 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (jrglinux) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Turn a Raspberry Pi 3B+ into a PriTunl VPN) -[#]: via: (https://opensource.com/article/19/1/pritunl-vpn-raspberry-pi) -[#]: author: (Stephen Bancroft https://opensource.com/users/stevereaver) - -Turn a Raspberry Pi 3B+ into a PriTunl VPN -====== -PriTunl is a VPN solution for small businesses and individuals who want private access to their network. - -![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/life-raspberrypi_0.png?itok=Kczz87J2) - -[PriTunl][1] is a fantastic VPN terminator solution that's perfect for small businesses and individuals who want a quick and simple way to access their network privately. It's open source, and the basic free version is more than enough to get you started and cover most simple use cases. There is also a paid enterprise version with advanced features like Active Directory integration. - -### Special considerations on Raspberry Pi 3B+ - -PriTunl is generally simple to install, but this project—turning a Raspberry Pi 3B+ into a PriTunl VPN appliance—adds some complexity. For one thing, PriTunl is supplied only as AMD64 and i386 binaries, but the 3B+ uses ARM architecture. This means you must compile your own binaries from source. That's nothing to be afraid of; it can be as simple as copying and pasting a few commands and watching the terminal for a short while. - -Another problem: PriTunl seems to require 64-bit architecture. I found this out when I got errors when I tried to compile PriTunl on my Raspberry Pi's 32-bit operating system. Fortunately, Ubuntu's beta version of 18.04 for ARM64 boots on the Raspberry Pi 3B+. - -Also, the Raspberry Pi 3B+ uses a different bootloader from other Raspberry Pi models. This required a complicated set of steps to install and update the necessary files to get a Raspberry Pi 3B+ to boot. - -### Installing PriTunl - -You can overcome these problems by installing a 64-bit operating system on the Raspberry Pi 3B+ before installing PriTunl. I'll assume you have basic knowledge of how to get around the Linux command line and a Raspberry Pi. - -Start by opening a terminal and downloading the Ubuntu 18.04 ARM64 beta release by entering: - -``` -$ wget http://cdimage.ubuntu.com/releases/18.04/beta/ubuntu-18.04-beta-preinstalled-server-arm64+raspi3.img.xz -``` - -Unpack the download: - -``` -$ xz -d ubuntu-18.04-beta-preinstalled-server-arm64+raspi3.xz -``` - -Insert the SD card you'll use with your Raspberry Pi into your desktop or laptop computer. Your computer will assign the SD card a drive letter—something like **/dev/sda** or **/dev/sdb**. Enter the **dmesg** command and examine the last lines of the output to find out the card's drive assignment. - -**Be VERY CAREFUL with the next step! I can't stress that enough; if you get the drive assignment wrong, you could destroy your system.** - -Write the image to your SD card with the following command, changing **< DRIVE>** to your SD card's drive assignment (obtained in the previous step): - -``` -$ dd if=ubuntu-18.04-beta-preinstalled-server-arm64+raspi3.img of= bs=8M -``` - -After it finishes, insert the SD card into your Pi and power it up. Make sure the Pi is connected to your network, then log in with username/password combination ubuntu/ubuntu. - -Enter the following commands on your Pi to install a few things to prepare to compile PriTunl: - -``` -$ sudo apt-get -y install build-essential git bzr python python-dev python-pip net-tools openvpn bridge-utils psmisc golang-go libffi-dev mongodb -``` - -There are a few changes from the standard PriTunl source [installation instructions on GitHub][2]. Make sure you are logged into your Pi and **sudo** to root: - -``` -$ sudo su - -``` - -This should leave you in root's home directory. To install PriTunl version 1.29.1914.98, enter (per GitHub): - -``` -export VERSION=1.29.1914.98 -tee -a ~/.bashrc << EOF -export GOPATH=\$HOME/go -export PATH=/usr/local/go/bin:\$PATH -EOF -source ~/.bashrc -mkdir pritunl && cd pritunl -go get -u github.com/pritunl/pritunl-dns -go get -u github.com/pritunl/pritunl-web -sudo ln -s ~/go/bin/pritunl-dns /usr/bin/pritunl-dns -sudo ln -s ~/go/bin/pritunl-web /usr/bin/pritunl-web -wget https://github.com/pritunl/pritunl/archive/$VERSION.tar.gz -tar -xf $VERSION.tar.gz -cd pritunl-$VERSION -python2 setup.py build -pip install -r requirements.txt -python2 setup.py install --prefix=/usr/local -``` - -Now the MongoDB and PriTunl systemd units should be ready to start up. Assuming you're still logged in as root, enter: - -``` -systemctl daemon-reload -systemctl start mongodb pritunl -systemctl enable mongodb pritunl -``` - -That's it! You're ready to hit PriTunl's browser user interface and configure it by following PriTunl's [installation and configuration instructions][3] on its website. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/19/1/pritunl-vpn-raspberry-pi - -作者:[Stephen Bancroft][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/stevereaver -[b]: https://github.com/lujun9972 -[1]: https://pritunl.com/ -[2]: https://github.com/pritunl/pritunl -[3]: https://docs.pritunl.com/docs/configuration-5 From 18d944a254382dd664069f1c2f83a5b3b6781fd6 Mon Sep 17 00:00:00 2001 From: jrg Date: Mon, 28 Jan 2019 20:36:58 +0800 Subject: [PATCH 186/243] Create 20190114 Turn a Raspberry Pi 3B- into a PriTunl VPN.md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 翻译完成 --- ...n a Raspberry Pi 3B- into a PriTunl VPN.md | 114 ++++++++++++++++++ 1 file changed, 114 insertions(+) create mode 100644 translated/tech/20190114 Turn a Raspberry Pi 3B- into a PriTunl VPN.md diff --git a/translated/tech/20190114 Turn a Raspberry Pi 3B- into a PriTunl VPN.md b/translated/tech/20190114 Turn a Raspberry Pi 3B- into a PriTunl VPN.md new file mode 100644 index 0000000000..a610a2cfbd --- /dev/null +++ b/translated/tech/20190114 Turn a Raspberry Pi 3B- into a PriTunl VPN.md @@ -0,0 +1,114 @@ +[#]: collector: (lujun9972) +[#]: translator: (jrglinux) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Turn a Raspberry Pi 3B+ into a PriTunl VPN) +[#]: via: (https://opensource.com/article/19/1/pritunl-vpn-raspberry-pi) +[#]: author: (Stephen Bancroft https://opensource.com/users/stevereaver) + +将树梅派3B+变为 PriTunl VPN +====== +PriTunl 是一种 VPN 解决方案,适用于希望私密的访问其网络的小型企业和个人。 + +![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/life-raspberrypi_0.png?itok=Kczz87J2) + +[PriTunl][1] 是一款出色的 VPN 终端解决方案,非常适合希望以简单快捷的方式私密的访问网络的小型企业和个人。 它是开源的,基本的免费版本涵盖最通用的简单的实例,足以让你快速入门。 也有集成 Active Directory 等高级功能的付费企业版 + +### 有关树梅派3B+的特别注意事项 + +PriTunl 的安装通常也很简单,但要在树梅派3B+上安装 PriTunl 有点小复杂。比如,PriTunl 只提供了 AMD64 和 i386 架构的二进制文件,但树梅派3B+是 ARM 架构的,这意味着需要从源码自行编译可用于树梅派3B+的 PriTunl 可执行文件。不过,无需担心,编译过程很简单,只需花一点时间执行几行命令即可。 + +另一个问题:PriTunl 好像必须要是64位处理器架构,当我在32位操作系统上尝试编译的时候报错了。但幸运的是,用于 ARM64 架构的 Ubuntu 18.04 测试版本可以安装在树梅派3B+上。 + +同样,树梅派3B+需要和其他树梅派不同的引导程序。需要一组小复杂的命令来安装更新树梅派3B+上必要的组件。 + + +### 安装 PriTunl + +你可以先在树梅派3B+上安装64位的操作系统来避免下面这些问题。此处需要一些必要的基础知识如在树梅派上执行命令行。 + +打开终端,用如下命令下载 Ubuntu 18.04 用于 ARM64 架构的测试版: + +``` +$ wget http://cdimage.ubuntu.com/releases/18.04/beta/ubuntu-18.04-beta-preinstalled-server-arm64+raspi3.img.xz +``` + +将下载的固件解压: + +``` +$ xz -d ubuntu-18.04-beta-preinstalled-server-arm64+raspi3.xz +``` + +将准备好的 SD 卡插入电脑读卡槽,电脑会为 SD 卡分配一个驱动分配器号,例如 **/dev/sda** 或者 **/dev/sdb**。 输入命令 **dmesg** 然后观察屏幕上的最后几行找到 SD 卡的驱动分配器。 + +**下一步小心操作,如果搞错了驱动分配器号,可能会破坏你的系统** + +用如下命令往 SD 卡中写入数据,将其中的 **** 替换成你的 SD 驱动器号。 + +``` +$ dd if=ubuntu-18.04-beta-preinstalled-server-arm64+raspi3.img of= bs=8M +``` + +完成上一步之后,将 SD 卡插入树梅派3B+,并启动它。确保树梅派3B+是连网的,然后登陆系统,用户名/密码:ubuntu/ubuntu。 + +在树梅派上输入以下命令以安装一些准备编译PriTunl的东西: + +``` +$ sudo apt-get -y install build-essential git bzr python python-dev python-pip net-tools openvpn bridge-utils psmisc golang-go libffi-dev mongodb +``` + +和 PriTunl 标准源码上的 [安装说明][2] 有一点不一样。确保已经登录进树梅派然后切换到管理员账户: + +``` +$ sudo su - +``` + +现在你应该在管理员账户的目录下,按如下命令来安装 PriTunl 1.29.1914.98 版本: + +``` +export VERSION=1.29.1914.98 +tee -a ~/.bashrc << EOF +export GOPATH=\$HOME/go +export PATH=/usr/local/go/bin:\$PATH +EOF +source ~/.bashrc +mkdir pritunl && cd pritunl +go get -u github.com/pritunl/pritunl-dns +go get -u github.com/pritunl/pritunl-web +sudo ln -s ~/go/bin/pritunl-dns /usr/bin/pritunl-dns +sudo ln -s ~/go/bin/pritunl-web /usr/bin/pritunl-web +wget https://github.com/pritunl/pritunl/archive/$VERSION.tar.gz +tar -xf $VERSION.tar.gz +cd pritunl-$VERSION +python2 setup.py build +pip install -r requirements.txt +python2 setup.py install --prefix=/usr/local +``` + +现在,不出意外的话应该可以启动 MongoDB 和 PriTunl 系统单元了。假如现在还是以管理员账户登录的话,输入: + +``` +systemctl daemon-reload +systemctl start mongodb pritunl +systemctl enable mongodb pritunl +``` + +大功告成!你现在可以登录 PriTunl 的用户界面并按照官网上的 [安装和配置手册][3] 来配置它了。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/1/pritunl-vpn-raspberry-pi + +作者:[Stephen Bancroft][a] +选题:[lujun9972][b] +译者:[jrg](https://github.com/jrglinux) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/stevereaver +[b]: https://github.com/lujun9972 +[1]: https://pritunl.com/ +[2]: https://github.com/pritunl/pritunl +[3]: https://docs.pritunl.com/docs/configuration-5 From e836ea817279f26be68718192c8d814fa212254f Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Mon, 28 Jan 2019 22:35:22 +0800 Subject: [PATCH 187/243] PRF:20150717 The History of Hello World.md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @zzzzzzmj 恭喜你完成了第一篇翻译! --- .../20150717 The History of Hello World.md | 61 +++++++++---------- 1 file changed, 29 insertions(+), 32 deletions(-) diff --git a/translated/tech/20150717 The History of Hello World.md b/translated/tech/20150717 The History of Hello World.md index 514f24d109..d896e03f16 100644 --- a/translated/tech/20150717 The History of Hello World.md +++ b/translated/tech/20150717 The History of Hello World.md @@ -1,53 +1,52 @@ [#]: collector: "lujun9972" [#]: translator: "zzzzzzmj" -[#]: reviewer: " " +[#]: reviewer: "wxy" [#]: publisher: " " [#]: url: " " [#]: subject: "The History of Hello World" [#]: via: "https://www.thesoftwareguild.com/blog/the-history-of-hello-world/" [#]: author: "thussong https://www.thesoftwareguild.com/blog/author/thussong/" +Hello World 的由来 +========= +资深软件开发人员都知道 [Hello World][2] 程序,这是一个能在设备显示器上输出某种变体的 “Hello, World!” 的程序,是学习编程的第一步。在这个编程中只涉及到一些最基本语法的程序,可以用大多数编程语言了来编写。事实上,路易斯安纳理工学院计算机协会(ACM)在最近统计[发现][3]这个程序至少有 204 个版本。 -# Hello World 的由来 +传统意义上,Hello World 程序是用于说明编码过程是如何工作的,以及确保编程语言或系统能正常运行。它们经常是新手程序员学习的第一个程序,因为即使是经验很少或者没有经验的人也能轻松正确的执行 Hello World。 -资深软件开发人员都知道[Hello world](2)程序,一个能被输出多种"Hello, World!"的程序,是学习编程的第一步。这个编程中只涉及到一些最基本语法的程序,可以被大多数语言输出在显示器上。事实上,路易斯安纳理工学院计算机协会(ACM)在最近统计[发现](3)这个项目至少有204个版本。 +首先,Hello World 简单,这就是为什么它经常被用做程序执行成功的晴雨表。如果 Hello World 在该框架中无法有效执行,那么其它更复杂的程序中也可能会失败。正如 [Win-Vector][4] 的一位专家所说,Hello World 实际上是一个对抗性程序。“该作者还说道,‘你的计算机系统能不能工作并不是一目了然,除非我能看到它至少能打印一行文字,否则我不会在上面浪费太多时间。’” Win-Vector 博主 John Mount 说。 -传统意义上,Hello World程序是用于说明编码过程是如何工作的,以及确保语言或系统能正常运行。它们经常是新手程序员学习的第一个程序,因为即使是经验很少或者没有经验的人也能轻松正确的执行Hello World。 - -首先,Hello World 简单,这就是为什么它经常被用做程序执行成功的晴雨表。如果Hello World在框架中无法有效执行,那么在其他更复杂的程序中也可能会失败。正如[Win-Vector](4)的一位专家所说,"Hello World实际上是一个对抗性程序"。该作者还说道,"你的计算机系统没有工作并不起眼,所有我们不会花很多时间在上面,不过我要看到它至少能打印一行文字"。 - -但是 这个两词短语在计算机科学领域有着重大的影响。以Hello World为基础,新手程序员可以轻松的去理解计算机科学原理,而拥有多年编码经验的程序员可以用它来学习编程语言的工作原理,特别是在结构与语言方面。这样的一个小程序,在任何难度和几乎所有的语言的应用程序中都有着悠久的历史。 +但是这个两词短语在计算机科学领域有着重大的影响。以 Hello World 为基础,新手程序员可以轻松的理解计算机科学原理或元素,而拥有多年编码经验的程序员可以用它来学习编程语言的工作原理,特别是在结构与语法方面。这样的一个小程序,在任何难度的应用程序和几乎所有语言中都有着悠久的历史。 ### 用途 -上文中一句话概括Hello World程序的主要用途:这是新手程序员熟悉新语言的一种方式。然而,这些程序不仅仅是对编码世界的介绍。例如,Hello World 可以作为测试,以确保语言的组件(编译器,开发和运行环境)安装正确。因为配置完整的编程工具链的过程复杂而漫长,所以像Hello World这样简单的程序通常用作新工具的首次运行测试。 +以上概括了 Hello World 程序的主要用途:这是新手程序员熟悉新语言的一种方式。然而,这些程序不仅仅是对编码世界的介绍。例如,Hello World 可以作为测试,以确保语言的组件(编译器、开发和运行环境)安装正确。因为配置完整的编程工具链的过程复杂而漫长,所以像 Hello World 这样简单的程序通常用作新工具链的首次运行测试。 -根据Cunningham & Cunningham (C2)的编程顾问所说, 黑客经常使用Hello World程序, 来证明猜想,因为任何代码都可以通过漏洞执行,而系统设计人员并不允许执行代码。事实上,它是在设备上使用自制内容或者“home brew”的第一步, 当[有经验的编码人员](5)正在配置环境或在学习新事物时,他们会Hello World 来验证动作是否正确。 +根据 Cunningham & Cunningham(C2)的编程顾问所说,在系统设计人员并不预期可以执行代码的地方,黑客经常使用 Hello World 程序作为一个可以通过漏洞执行任意代码的概念验证(POC)。事实上,它是在设备上使用自制内容或者“自酿”的第一步,当[有经验的编码人员][5]正在配置环境或在学习新事物时,他们会通过 Hello World 来验证其行为是否正确。 -它也是作为调试的一部分,允许程序员在程序运行时检查他么编辑修改了的地方是否正确,然后重新加载。 +它也作为调试过程的一部分,允许程序员检查他们是否正确地编辑了可在运行时修改的程序并重新加载。 -Hello World的一个更常用的用途是作为基础的比较。根据C2的wiki所讲,程序员可以比较语言生成的可执行文件的大小,以及程序背后必须存在多少支持基础结构才能执行。 +Hello World 的一个更常用的用途是作为基础比较。根据 C2 的 wiki 所讲,程序员可以“比较语言生成的可执行文件的大小,以及程序背后必须存在多少支持的基础设施才能执行。” ### 开端 -虽然Hello World 的起源还有些不太明了,不过人们普遍认为它是作为测试用语,最早出现在Brian Kernigham 在1972年发布的B语言教程简介中。在此文中,该程序的第一个已知版本用于说明外部变量。因为教程中的前一个例子在终端上打印了“hi!”,而需要更多字符常量来表达相对复杂的“hello,world!”,是学习过程的下一步。 +虽然 Hello World 的起源还有些不太明了,不过人们普遍认为它作为测试用语,最早出现在 Brian Kernigham 在 1972 年发布的《B 语言简介教程A Tutorial Introduction to the Language B》中。在此文中,该程序的第一个已知版本用于说明外部变量。因为该教程中的前一个例子在终端上打印了 “hi!”,而需要更多的字符常量来表达相对复杂的 “hello,world!”,这是学习过程的下一步。 -在那以后,它还被用于1974年的贝尔实验室备忘录,以及1987年的C语言程序设计。这两篇著名的文章是让Hello World闻名于世的主要原因。在书中的一个例子(第一个也是最著名的例子)打印了没有大写字母和感叹号的“hello,world”,此时的Hello World几乎只是用于说明语言的一些功能,而不是测试系统是否正常运行。 +在那以后,它还被用于 1974 年的贝尔实验室备忘录,以及 1987 年的《C 语言程序设计The C Programming Language》。这两篇著名的文字是让 Hello World 闻名于世的主要原因。在书中的一个例子(第一个,也是最著名的例子)打印了没有大写字母和感叹号的 “hello,world”。此时的 Hello World 几乎只是用于说明语言的一些功能,而不是测试系统是否正常运行。 -在Kernigham的关于B语言和C语言的开创性文章之前,没有真正意义上的第一个程序,甚至直到1974年,它也没被广泛使用。著名的BASIC教程“My Computer Likes Me,When I Speak BASIC”,从一个写一行文本的简单程序开始,不过那句话是“MY HUMAN UNDERSTANDS ME”,跟如今程序员侃侃而谈的双词问候语差的有点远。不过,当Hello World被发明后,它就迅速传播,并在20世纪70年代后从所周知。直到今天它也依然受欢迎。 +在 Kernigham 的关于 B 语言和 C 语言的开创性文章之前,没有真正意义上的第一个程序,甚至直到 1974 年,它也没被广泛使用。著名的 BASIC 教程 “我的电脑喜欢我用 BASIC 跟它讲话My Computer Likes Me,When I Speak BASIC”,从一个写一行文本的简单程序开始,不过那句话是 “MY HUMAN UNDERSTANDS ME”,跟如今程序员侃侃而谈的这个双词问候语差的有点远。不过,当 Hello World 被发明后,它就迅速传播,并在 20 世纪 70 年代后变成了众所周知。直到今天它也依然受欢迎。 -### 一个声明, 多种语言 +### 一个声明,多种语言 -以下是目前正在被使用的一些流行的编程语言中的Hello World 代码 +以下是目前正在被使用的一些流行的编程语言中的 Hello World 代码。 #### Java ``` class HelloWorld { -public static void main(String[] args) { -System.out.println("Hello, world!"); -} + public static void main(String[] args) { + System.out.println("Hello, world!"); + } } ``` @@ -57,10 +56,10 @@ System.out.println("Hello, world!"); using System; class Program { -public static void Main(string[] args) -{ -Console.WriteLine("Hello, world!"); -} + public static void Main(string[] args) + { + Console.WriteLine("Hello, world!"); + } } ``` @@ -80,7 +79,7 @@ puts "Hello, world!" ``` object HelloWorld extends App { -println("Hello, world!") + println("Hello, world!") } ``` @@ -115,17 +114,15 @@ main = putStrLn "Hello, world!" package main import "fmt" func main() { -fmt.Println("Hello, world!") + fmt.Println("Hello, world!") } ``` +### 如今的 Hello world:各种形式下的标准实践 +在现在的编程语言中,Hello World 有着不同的复杂程度。例如,Go 语言中引入一个多语言版的 Hello World 程序,XL 则会提供一个具有图形、可旋转的 3D 版本。一些编程语言,像 Ruby、Python,仅仅需要一个语句去打印“Hello World”,但是低级汇编语言则需要几个命令才能做到这样。现在的编程语言还引入对标点符号和大小写的变化,包括是否有逗号或者感叹号,以及两个词的大写形式。举个例子,当系统只支持大写字母,会呈现像“HELLO WORLD”的短语。值得纪念的第一个 Malbolge 程序打印出了“HEllO WORld”(LCTT 译注:Malbolge 是最难的编程语言之一。事实上,在它诞生后,花了 2 年时间才完成第一个 Malbolge 程序)。它的变体跨越了原本的字面意思。像 Lisp、Haskell 这样函数语言,用阶乘程序替代了 Hello World,从而注重递归技术。这与原来的示例不同,后者更强调 I/O 以及产生的副作用。 -### 如今的 Hello world: 各种形式下的标准实践 - -在现在的编程语言中,Hello world有着不同的复杂程度。例如,Go语言中引入一个多语言的Hello World程序,XL则会提供一个具有图形、可旋转的3D版本。一些编程语言,像Ruby,Python,仅仅需要一个声明去打印"Hello World",但是低级汇编语言则需要几个命令才能做到这样。现在的编程语言还引入对标点符号的支持,包括逗号或者感叹号是否存在,以及两个词的大写。举个例子,当系统只支持大写字母,会呈现像"HELLO WORLD"的短语。第一个不平凡的Malbolge程序打印出了"HEllO WORld",跨域了原本的字面意思。功能语言像Lisp、Haskell,阶乘程序替代了Hello World,从而注重递归技术。这与原来的示例不同,后者更强调I/O以及产生的副作用。 - -随着现在的编程语言越来越复杂,Hello World 比以往显得更加重要。同样作为测试和教学工具,它已经成为程序员测试配置的编程环境的标准方法。没有人能确切说出为什么Hello World能在快速创新著称的行业中经受住时间的考验,但是它又确实留下来了。 +随着现在的编程语言越来越复杂,Hello World 比以往显得更加重要。作为测试和教学工具,它已经成为程序员测试配置的编程环境的标准方法。没有人能确切说出为什么 Hello World 能在快速创新著称的行业中经受住时间的考验,但是它又确实留下来了。 -------------------------------------------------------------------------------- @@ -134,7 +131,7 @@ via: https://www.thesoftwareguild.com/blog/the-history-of-hello-world/ 作者:[thussong][a] 选题:[lujun9972][b] 译者:[zzzzzzmj](https://github.com/zzzzzzmj) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 8c3942968d69944577f72022941bee553c1fdb08 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Mon, 28 Jan 2019 22:36:41 +0800 Subject: [PATCH 188/243] PUB:20150717 The History of Hello World.md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @zzzzzzmj 本文首发地址: https://linux.cn/article-10485-1.html 您的 LCTT 专页地址: https://linux.cn/lctt/zzzzzzmj 请注册领取 LCCN: https://lctt.linux.cn/ --- .../tech => published}/20150717 The History of Hello World.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20150717 The History of Hello World.md (99%) diff --git a/translated/tech/20150717 The History of Hello World.md b/published/20150717 The History of Hello World.md similarity index 99% rename from translated/tech/20150717 The History of Hello World.md rename to published/20150717 The History of Hello World.md index d896e03f16..de2b3bb551 100644 --- a/translated/tech/20150717 The History of Hello World.md +++ b/published/20150717 The History of Hello World.md @@ -1,8 +1,8 @@ [#]: collector: "lujun9972" [#]: translator: "zzzzzzmj" [#]: reviewer: "wxy" -[#]: publisher: " " -[#]: url: " " +[#]: publisher: "wxy" +[#]: url: "https://linux.cn/article-10485-1.html" [#]: subject: "The History of Hello World" [#]: via: "https://www.thesoftwareguild.com/blog/the-history-of-hello-world/" [#]: author: "thussong https://www.thesoftwareguild.com/blog/author/thussong/" From eed786ab1d8b93a4a0f3c55ff2f9744e75df160f Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Mon, 28 Jan 2019 23:12:34 +0800 Subject: [PATCH 189/243] PRF:20181203 How to bring good fortune to your Linux terminal.md @MjSeven --- ...ing good fortune to your Linux terminal.md | 26 ++++++++++--------- 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/translated/tech/20181203 How to bring good fortune to your Linux terminal.md b/translated/tech/20181203 How to bring good fortune to your Linux terminal.md index 19d703afab..97def132e7 100644 --- a/translated/tech/20181203 How to bring good fortune to your Linux terminal.md +++ b/translated/tech/20181203 How to bring good fortune to your Linux terminal.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (MjSeven) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: subject: (How to bring good fortune to your Linux terminal) [#]: via: (https://opensource.com/article/18/12/linux-toy-fortune) @@ -9,20 +9,21 @@ 如何为你的 Linux 终端带来好运 ====== -使用 fortune 实用程序将引号和俏皮话带到命令行。 +> 使用 fortune 实用程序将名言和俏皮话带到命令行。 ![](https://opensource.com/sites/default/files/styles/image-full-size/public/uploads/linux-toy-fortune.png?itok=5PVVZVer) -这是 12 月,如果你还没有找到一款能激发你灵感的[科技降临节日历][1],那么,也许这个系列可以。从现在到 24 日,每天我们都会为你带来一个不同的 Linux 命令行玩具。你可能会问,什么是命令行玩具?它可能是一个游戏或任何简单的娱乐,为你的终端带来一点点快乐。 +这是 12 月,如果你还没有找到一款能激发你灵感的[科技降临节日历][1],那么,也许这个系列可以。从现在到 24 日,每天我们都会为你带来一个不同的 Linux 命令行玩具。你可能会问,什么是命令行玩具?它可能是一个游戏或任何简单的娱乐程序,为你的终端带来一点点快乐。 你可能之前已经看过其中的一些,我们希望你也能发现一些新的东西。不管怎样,我们都希望你在关注时保有乐趣。 -今天的玩具是 **fortune**,它很古老。它的版本可以追溯到 1980 年,当时它包含在 Unix 中。我在 Fedora 中安装的版本是在 BSD 许可下提供的,我可以使用以下命令获取它。 +今天的玩具是 `fortune`,它很古老。它的版本可以追溯到 1980 年,当时它包含在 Unix 中。我在 Fedora 中安装的版本是在 BSD 许可下提供的,我可以使用以下命令获取它。(LCTT 译注:fortune 这个命令得名于 fortune cookies,是流行于西方的中餐馆的一种脆饼干,里面包含格言、幸运数字等。) + ``` $ sudo dnf install fortune-mod -y ``` -你的发行版可能会有所不同。在某些情况下,你可能需要将 fortunes 独立于 **fortune** 本身安装(尝试在你的包管理器中搜索 "fortunes")。你还可以在 [GitHub][2] 上查看它的源代码,然后,只需运行 **fortune** 即可获得好运。 +你的发行版可能会有所不同。在某些情况下,你可能需要在 `fortune` 命令之外单独安装那些“幸运饼干”(尝试在你的包管理器中搜索 “fortunes”)。你还可以在 [GitHub][2] 上查看它的源代码,然后,只需运行 `fortune` 即可获得好运。 ``` $ fortune @@ -30,11 +31,11 @@ $ fortune -- Ford Prefect, _Hitchhiker's Guide to the Galaxy_ ``` -那么,你为什么会在终端上需要 fortune 呢?当然是为了好玩啦。也许你想将它们添加到系统上的每天消息中? +那么,你为什么会在终端上需要 `fortune` 呢?当然是为了好玩啦。也许你想将它们添加到系统上的每天消息(motd)中? -就我个人而言,当我使用终端来解析文本时,我喜欢使用 **fortune** 命令作为一段内置的虚拟数据,特别是使用[正则表达式][3]时,我想要一些简单的东西来尝试一下。 +就我个人而言,当我使用终端来解析文本时,我喜欢使用 `fortune` 命令作为一段内置的虚拟数据,特别是使用[正则表达式][3]时,我想要一些简单的东西来尝试一下。 -例如,假设我使用 **tr** 命令来测试转换,用数字 3 替换字母 e。 +例如,假设我使用 `tr` 命令来测试转换,用数字 3 替换字母 e。 ``` $ fortune | tr 'eE' '3' @@ -47,19 +48,20 @@ th3m all th3 sam3 nam3. Som3 pass3ng3rs actually r3ach th3ir d3stinations. All pass3ng3rs b3li3v3 th3y got th3r3. ``` -那么 fortunes 到底为你的发行版带来了什么呢?看看你的 **/usr/share/games/fortune** 目录,找到它们。以下我最喜欢的几个。 +那么你的发行版带来了什么幸运饼干呢?看看你的 `/usr/share/games/fortune` 目录,找到它们。以下我最喜欢的几个。 + ``` Never laugh at live dragons.                 -- Bilbo Baggins [J.R.R. Tolkien, "The Hobbit"] I dunno, I dream in Perl sometimes... -             -- Larry Wall in  <8538@jpl-devvax.JPL.NASA.GOV> +             -- Larry Wall in  <8538@jpl-devvax.JPL.NASA.GOV> I have an existential map.  It has "You are here" written all over it.                 -- Steven Wright ``` -想要了解更多关于 **fortune**?当然,你可以经常查看 man 页来了解更多选项,或者在[维基百科][4]上阅读更多关于此命令的历史信息。 +关于 `fortune` 想要了解更多?当然,你可以经常查看 man 页来了解更多选项,或者在[维基百科][4]上阅读更多关于此命令的历史信息。 你有特别喜欢的命令行小玩具需要我介绍的吗?这个系列要介绍的小玩具大部分已经有了落实,但还预留了几个空位置。请在评论区留言,我会查看的。如果还有空位置,我会考虑介绍它的。如果没有,但如果我得到了一些很好的意见,我会在最后做一些有价值的提及。 @@ -73,7 +75,7 @@ via: https://opensource.com/article/18/12/linux-toy-fortune 作者:[Jason Baker][a] 选题:[lujun9972][b] 译者:[MjSeven](https://github.com/MjSeven) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 37ed877a1ca89e11fed90ce48c08cc46f66c4cbd Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Mon, 28 Jan 2019 23:13:16 +0800 Subject: [PATCH 190/243] PUB:20181203 How to bring good fortune to your Linux terminal.md @MjSeven https://linux.cn/article-10486-1.html --- ...181203 How to bring good fortune to your Linux terminal.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20181203 How to bring good fortune to your Linux terminal.md (98%) diff --git a/translated/tech/20181203 How to bring good fortune to your Linux terminal.md b/published/20181203 How to bring good fortune to your Linux terminal.md similarity index 98% rename from translated/tech/20181203 How to bring good fortune to your Linux terminal.md rename to published/20181203 How to bring good fortune to your Linux terminal.md index 97def132e7..816ead368e 100644 --- a/translated/tech/20181203 How to bring good fortune to your Linux terminal.md +++ b/published/20181203 How to bring good fortune to your Linux terminal.md @@ -1,11 +1,11 @@ [#]: collector: (lujun9972) [#]: translator: (MjSeven) [#]: reviewer: (wxy) -[#]: publisher: ( ) +[#]: publisher: (wxy) [#]: subject: (How to bring good fortune to your Linux terminal) [#]: via: (https://opensource.com/article/18/12/linux-toy-fortune) [#]: author: (Jason Baker https://opensource.com/users/jason-baker) -[#]: url: ( ) +[#]: url: (https://linux.cn/article-10486-1.html) 如何为你的 Linux 终端带来好运 ====== From 590a7c58a515abac030ff061af7486cd0ed3d7d6 Mon Sep 17 00:00:00 2001 From: suncle Date: Mon, 28 Jan 2019 23:32:54 +0800 Subject: [PATCH 191/243] translating by Flowsnow --- ...4 An introduction to the Pyramid web framework for Python.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20180514 An introduction to the Pyramid web framework for Python.md b/sources/tech/20180514 An introduction to the Pyramid web framework for Python.md index a16e604774..03a6fa6494 100644 --- a/sources/tech/20180514 An introduction to the Pyramid web framework for Python.md +++ b/sources/tech/20180514 An introduction to the Pyramid web framework for Python.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (Flowsnow) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: subject: (An introduction to the Pyramid web framework for Python) From f957ca204b39a0aeb249201086fbec0da44374e4 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Mon, 28 Jan 2019 23:34:52 +0800 Subject: [PATCH 192/243] PRF:20150717 The History of Hello World.md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 避免转义 --- published/20150717 The History of Hello World.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/published/20150717 The History of Hello World.md b/published/20150717 The History of Hello World.md index de2b3bb551..5d2af398dd 100644 --- a/published/20150717 The History of Hello World.md +++ b/published/20150717 The History of Hello World.md @@ -50,7 +50,7 @@ class HelloWorld { } ``` -#### C# +#### C# ``` using System; From 8d5472c48f5cc4b8b5cd0638795ae41ccb5fb6d0 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Tue, 29 Jan 2019 00:32:37 +0800 Subject: [PATCH 193/243] PRF:20180809 Perform robust unit tests with PyHamcrest.md @MjSeven --- ...rform robust unit tests with PyHamcrest.md | 43 +++++++++++-------- 1 file changed, 24 insertions(+), 19 deletions(-) diff --git a/translated/tech/20180809 Perform robust unit tests with PyHamcrest.md b/translated/tech/20180809 Perform robust unit tests with PyHamcrest.md index 5d44d86bce..4911aec938 100644 --- a/translated/tech/20180809 Perform robust unit tests with PyHamcrest.md +++ b/translated/tech/20180809 Perform robust unit tests with PyHamcrest.md @@ -1,28 +1,26 @@ -Perform robust unit tests with PyHamcrest 使用 PyHamcrest 执行健壮的单元测试 ====== +> 使用此框架编写断言,提高开发测试的准确性。 ![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/web_browser_desktop_devlopment_design_system_computer.jpg?itok=pfqRrJgh) 在[测试金字塔][1]的底部是单元测试。单元测试每次只测试一个代码单元,通常是一个函数或方法。 -通常,设计单个单元测试是为了测试通过函数或特定分支选择的特定流,这使得失败的单元测试和导致失败的 bug 之间的映射变得容易。 +通常,设计单个单元测试是为了测试通过一个函数或特定分支的特定执行流程,这使得将失败的单元测试和导致失败的 bug 对应起来变得容易。 -理想情况下,单元测试使用很少或不使用外部资源,从而隔离它们并使它们更快。 +理想情况下,单元测试很少使用或不使用外部资源,从而隔离它们并使它们更快。 -_好_ 测试通过尽早发现 bug 并加快测试速度来提高开发人员的工作效率。_坏_ 测试降低了开发人员的工作效率。 +单元测试套件通过在开发过程的早期发现问题来帮助维护高质量的产品。有效的单元测试可以在代码离开开发人员机器之前捕获 bug,或者至少可以在特定分支上的持续集成环境中捕获 bug。这标志着好的和坏的单元测试之间的区别:*好的*测试通过尽早捕获 bug 并使测试更快来提高开发人员的生产力。*坏的*测试降低了开发人员的工作效率。 -单元测试套件通过在开发过程的早期发现问题来帮助维护高质量的产品。有效的单元测试在代码离开开发人员机器之前捕获 bug,或者至少在特定分支上的持续集成环境中捕获 bug。这标志着好的和坏的单元测试之间的区别:好的测试通过尽早捕获 bug 并使测试更快来提高开发人员的生产力。坏的测试降低了开发人员的工作效率。 - -当测试 _附带的特性_ 时,生产率通常会降低。当代码更改时测试失败,即时它仍然是正确的。发生这种情况是因为输出不同,但在某种程度上它不是函数契约的一部分。 +当测试*附带的特性*时,生产率通常会降低。当代码更改时测试会失败,即使它仍然是正确的。发生这种情况是因为输出的不同,但在某种程度上是因为它不是函数契约function's contract的一部分。 因此,一个好的单元测试可以帮助执行函数所提交的契约。 -如果单元测试中断,那意味着契约被违反了,应该明确修改(通过更改文档和测试),或者被修复(通过修复代码并保持测试不变)。 +如果单元测试中断,那意味着该契约被违反了,应该(通过更改文档和测试)明确修改,或者(通过修复代码并保持测试不变)来修复。 虽然将测试限制为只执行公共契约是一项需要学习的复杂技能,但有一些工具可以提供帮助。 -其中一个工具是 [Hamcrest][2],一个用于编写断言的框架。最初是为基于 Java 的单元测试而发明的,它现在支持多种语言,包括 [Python][3]。 +其中一个工具是 [Hamcrest][2],这是一个用于编写断言的框架。最初是为基于 Java 的单元测试而发明的,但它现在支持多种语言,包括 [Python][3]。 Hamcrest 旨在使测试断言更容易编写和更精确。 @@ -36,7 +34,8 @@ def test_add():     assert_that(add(2, 2), equal_to(4))   ``` -这是一个用于简单功能的断言。如果我们想要断言更复杂的怎么办? +这是一个用于简单函数的断言。如果我们想要断言更复杂的函数怎么办? + ``` def test_set_removal():     my_set = {1, 2, 3, 4} @@ -45,13 +44,14 @@ def test_set_removal():     assert_that(my_set, is_not(has_item(3))) ``` -注意,我们可以简单地断言结果的顺序为 `1`, `2` 和 `4`,因为集合不保证顺序。 +注意,我们可以简单地断言其结果是任何顺序的 `1`、`2` 和 `4`,因为集合不保证顺序。 -我们也可以很容易用 `is_not` 来否定断言。这有助于我们编写 _精确的断言_,使我们能够把自己限制在执行职能的公共契约方面。 +我们也可以很容易用 `is_not` 来否定断言。这有助于我们编写*精确的断言*,使我们能够把自己限制在执行函数的公共契约方面。 -然而,有时候,内置功能都不是我们 _真正_ 需要的。在这些情况下,Hamcrest 允许我们编写自己的匹配器。 +然而,有时候,内置的功能都不是我们*真正*需要的。在这些情况下,Hamcrest 允许我们编写自己的匹配器matchers。 想象一下以下功能: + ``` def scale_one(a, b):     scale = random.randint(0, 5) @@ -59,9 +59,10 @@ def scale_one(a, b):     return scale * pick ``` -我们可以自信地断言结果均匀地划分为至少一个输入。(to 校正:???什么意思) +我们可以自信地断言其结果均匀地分配到至少一个输入。 匹配器继承自 `hamcrest.core.base_matcher.BaseMatcher`,重写两个方法: + ``` class DivisibleBy(hamcrest.core.base_matcher.BaseMatcher):     def __init__(self, factor): @@ -76,12 +77,14 @@ class DivisibleBy(hamcrest.core.base_matcher.BaseMatcher): ``` 编写高质量的 `describe_to` 方法很重要,因为这是测试失败时显示的消息的一部分。 + ``` def divisible_by(num):     return DivisibleBy(num) ``` 按照惯例,我们将匹配器包装在一个函数中。有时这给了我们进一步处理输入的机会,但在这种情况下,我们不需要进一步处理。 + ``` def test_scale():     result = scale_one(3, 7) @@ -92,7 +95,8 @@ def test_scale(): 请注意,我们将 `divisible_by` 匹配器与内置的 `any_of` 匹配器结合起来,以确保我们只测试函数提交的内容。 -在编辑这篇文章时,我听到一个传言,“Hamcrest” 这个名字被认为是 “matches” 的字谜。人力资源管理... +在编辑这篇文章时,我听到一个传言,取 “Hamcrest” 这个名字是因为它是 “matches” 字母组成的字谜。嗯... + ``` >>> assert_that("matches", contains_inanyorder(*"hamcrest") Traceback (most recent call last): @@ -106,13 +110,14 @@ Expected: a sequence over ['h', 'a', 'm', 'c', 'r', 'e', 's', 't'] in any order       but: no item matches: 'r' in ['m', 'a', 't', 'c', 'h', 'e', 's'] ``` -经过进一步的研究,我找到了谣言的来源:它是 “matchers” 的字谜。 +经过进一步的研究,我找到了传言的来源:它是 “matchers” 字母组成的字谜。 + ``` >>> assert_that("matchers", contains_inanyorder(*"hamcrest")) >>> ``` -如果你还没有为你的 Python 代码编写单元测试,那么现在是开始的好时机。如果你正在为你的 Python 代码编写单元测试,那么使用 Hamcrest 将允许你使你的断言更加 _精确_,既不会比你想要测试的多也不会少。这将在修改代码时减少误报,并减少修改工作代码的测试所花费的时间。 +如果你还没有为你的 Python 代码编写单元测试,那么现在是开始的好时机。如果你正在为你的 Python 代码编写单元测试,那么使用 Hamcrest 将允许你使你的断言更加*精确*,既不会比你想要测试的多也不会少。这将在修改代码时减少误报,并减少修改工作代码的测试所花费的时间。 -------------------------------------------------------------------------------- @@ -121,8 +126,8 @@ via: https://opensource.com/article/18/8/robust-unit-tests-hamcrest 作者:[Moshe Zadka][a] 选题:[lujun9972](https://github.com/lujun9972) -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) +译者:[MjSeven](https://github.com/MjSeven) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 927408d535bf785513e99b52397570f050b4afb0 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Tue, 29 Jan 2019 00:32:56 +0800 Subject: [PATCH 194/243] PUB:20180809 Perform robust unit tests with PyHamcrest.md @MjSeven https://linux.cn/article-10487-1.html --- .../20180809 Perform robust unit tests with PyHamcrest.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {translated/tech => published}/20180809 Perform robust unit tests with PyHamcrest.md (100%) diff --git a/translated/tech/20180809 Perform robust unit tests with PyHamcrest.md b/published/20180809 Perform robust unit tests with PyHamcrest.md similarity index 100% rename from translated/tech/20180809 Perform robust unit tests with PyHamcrest.md rename to published/20180809 Perform robust unit tests with PyHamcrest.md From 0852a7f9c9a687f6407ee5337cb2164c247174f7 Mon Sep 17 00:00:00 2001 From: geekpi Date: Tue, 29 Jan 2019 08:51:45 +0800 Subject: [PATCH 195/243] translated --- ... How to open source your Python library.md | 114 ----------------- ... How to open source your Python library.md | 115 ++++++++++++++++++ 2 files changed, 115 insertions(+), 114 deletions(-) delete mode 100644 sources/tech/20181219 How to open source your Python library.md create mode 100644 translated/tech/20181219 How to open source your Python library.md diff --git a/sources/tech/20181219 How to open source your Python library.md b/sources/tech/20181219 How to open source your Python library.md deleted file mode 100644 index 79c25c9a00..0000000000 --- a/sources/tech/20181219 How to open source your Python library.md +++ /dev/null @@ -1,114 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (geekpi) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (How to open source your Python library) -[#]: via: (https://opensource.com/article/18/12/tips-open-sourcing-python-libraries) -[#]: author: (Moshe Zadka https://opensource.com/users/moshez) - -How to open source your Python library -====== -This 12-step checklist will ensure a successful launch. -![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/button_push_open_keyboard_file_organize.png?itok=KlAsk1gx) - -You wrote a Python library. I'm sure it's amazing! Wouldn't it be neat if it was easy for people to use it? Here is a checklist of things to think about and concrete steps to take when open sourcing your Python library. - -### 1\. Source - -Put the code up on [GitHub][1], where most open source projects happen and where it is easiest for people to submit pull requests. - -### 2\. License - -Choose an open source license. A good, permissive default is the [MIT License][2]. If you have specific requirements, Creative Common's [Choose a License][3] can guide you through the alternatives. Most importantly, there are three rules to keep in mind when choosing a license: - - * Don't create your own license. - * Don't create your own license. - * Don't create your own license. - - - -### 3\. README - -Put a file called README.rst, formatted with ReStructured Text, at the top of your tree. - -GitHub will render ReStructured Text just as well as Markdown, and ReST plays better with Python's documentation ecosystem. - -### 4\. Tests - -Write tests. This is not useful just for you: it is useful for people who want to make patches that avoid breaking related functionality. - -Tests help collaborators collaborate. - -Usually, it is best if they are runnable with [**pytest**][4]. There are other test runners—but very little reason to use them. - -### 5\. Style - -Enforce style with a linter: PyLint, Flake8, or Black with **\--check**. Unless you use Black, make sure to specify configuration options in a file checked into source control. - -### 6\. API documentation - -Use docstrings to document modules, functions, classes, and methods. - -There are a few styles you can use. I prefer the [Google-style docstrings][5], but [ReST docstrings][6] are an option. - -Both Google-style and ReST docstrings can be processed by Sphinx to integrate API documentation with prose documentation. - -### 7\. Prose documentation - -Use [Sphinx][7]. (Read [our article on it][8].) A tutorial is useful, but it is also important to specify what this thing is, what it is good for, what it is bad for, and any special considerations. - -### 8\. Building - -Use **tox** or **nox** to automatically run your tests and linter and build the documentation. These tools support a "dependency matrix." These matrices tend to explode fast, but try to test against a reasonable sample, such as Python versions, versions of dependencies, and possibly optional dependencies you install. - -### 9\. Packaging - -Use [setuptools][9]. Write a **setup.py** and a **setup.cfg**. If you support both Python 2 and 3, specify universal wheels in the **setup.cfg**. - -One thing **tox** or **nox** should do is build a wheel and run tests against the installed wheel. - -Avoid C extensions. If you absolutely need them for performance or binding reasons, put them in a separate package. Properly packaging C extensions deserves its own post. There are a lot of gotchas! - -### 10\. Continuous integration - -### 11\. Versions - -Use a public continuous integration runner. [TravisCI][10] and [CircleCI][11] offer free tiers for open source projects. Configure GitHub or other repo to require passing checks before merging pull requests, and you'll never have to worry about telling people to fix their tests or their style in code reviews. - -Use either [SemVer][12] or [CalVer][13]. There are many tools to help manage versions: [incremental][14], [bumpversion][15], and [setuptools_scm][16] are all packages on PyPI that help manage versions for you. - -### 12\. Release - -Release by running **tox** or **nox** and using **twine** to upload the artifacts to PyPI. You can do a "test upload" by running [DevPI][17]. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/18/12/tips-open-sourcing-python-libraries - -作者:[Moshe Zadka][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/moshez -[b]: https://github.com/lujun9972 -[1]: https://github.com/ -[2]: https://en.wikipedia.org/wiki/MIT_License -[3]: https://choosealicense.com/ -[4]: https://docs.pytest.org/en/latest/ -[5]: https://github.com/google/styleguide/blob/gh-pages/pyguide.md -[6]: https://www.python.org/dev/peps/pep-0287/ -[7]: http://www.sphinx-doc.org/en/master/ -[8]: https://opensource.com/article/18/11/building-custom-workflows-sphinx -[9]: https://pypi.org/project/setuptools/ -[10]: https://travis-ci.org/ -[11]: https://circleci.com/ -[12]: https://semver.org/ -[13]: https://calver.org/ -[14]: https://pypi.org/project/incremental/ -[15]: https://pypi.org/project/bumpversion/ -[16]: https://pypi.org/project/setuptools_scm/ -[17]: https://opensource.com/article/18/7/setting-devpi diff --git a/translated/tech/20181219 How to open source your Python library.md b/translated/tech/20181219 How to open source your Python library.md new file mode 100644 index 0000000000..7c4a2d3f25 --- /dev/null +++ b/translated/tech/20181219 How to open source your Python library.md @@ -0,0 +1,115 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to open source your Python library) +[#]: via: (https://opensource.com/article/18/12/tips-open-sourcing-python-libraries) +[#]: author: (Moshe Zadka https://opensource.com/users/moshez) + +如何开源你的 Python 库 +====== +这 12 个步骤能确保成功发布。 +![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/button_push_open_keyboard_file_organize.png?itok=KlAsk1gx) + +你写了一个 Python 库。我觉着这太棒了!如果让人们能够轻松使用它不是很优雅么?这有一个需要考虑的清单,以及在开源 Python 库时要采取的具体步骤。 + +### 1\. 源码 + +将代码放在 [GitHub][1] 上,这里有很多开源项目,并且人们很容易提交拉取请求。 + +### 2\. 许可证 + +选择一个开源许可证。默认的一个不错的,宽容的是 [MIT 许可][2]。如果你有特定要求,Creative Common 的[选择许可][3]可以指导你完成其他选择。最重要的是,在选择许可时要记住三条规则: + + + * 不要创建自己的许可证。 + * 不要创建自己的许可证。 + * 不要创建自己的许可证。 + + + +### 3\. README + +将一个名为 README.rst 的文件(使用 ReStructured Text 格式化)放在项目树的顶层。 + +GitHub 将像 Markdown 一样渲染 ReStructured Text,而 ReST 在 Python 的文档生态系统中的表现更好。 + +### 4\. 测试 + +写测试。这对你来说没有用处。但对于想要编写避免破坏相关功能的补丁的人来说,它非常有用。 + +测试可帮助协作者进行协作。 + +通常情况下,如果可以用 [**pytest**][4] 运行就最好了。还有其他测试工具 - 但很少有理由去使用它们。 + +### 5\. 样式 + +使用 linter 制定样式:PyLint、Flake8 或者带上 **\--check** 的 Black 。除非你使用Black,否则请确保在下载源代码文件中指定配置选项。 + +### 6\. API 文档 + +使用 docstrings 来记录模块、函数、类和方法。 + +你可以使用几种样式。我更喜欢 [Google 风格的 docstrings][5],但 [ReST docstrings][6] 也是一种选择。 + +Sphinx 可以同时处理 Google 风格和 ReST 的 docstrings,以将零散的文档集成为 API 文档。 + +### 7\. 零散文档 + +使用 [Sphinx][7]。(阅读[我们这篇文章][8]。)教程很有用,但同样重要的是要指明这是什么、它有什么好处、它有什么坏处、以及任何特殊的考虑因素。 + +### 8\. 构建 + +使用 **tox** 或 **nox** 自动运行测试、linter 并构建文档。这些工具支持“依赖矩阵”。这些矩阵往往会快速增长,但你可以尝试针对合理的样本进行测试,例如 Python 版本、依赖项版本以及可能安装的可选依赖项。 + +### 9\. 打包 + +使用 [setuptools][9] 工具。写一个 **setup.py** 和一个 **setup.cfg**。如果同时支持 Python 2 和 3,请在 **setup.cfg** 中指定 universal wheel。 + +**tox** 或 **nox** 应该做的一件事是构建 wheel 并对已安装的 wheel 进行测试。 + +避免使用 C 扩展。如果出于性能或绑定的原因一定需要它们,请将它们放在单独的包中。正确打包 C 扩展可以写一篇新的文章。这里有很多问题! + +### 10\. 持续集成 + +使用公共持续工具。[TravisCI][10] and [CircleCI][11] 为开源项目提供免费套餐。将 GitHub 或其他仓库配置为在合并拉请求之前需要先通过检查, 那么你就不必担心在代码评审中告知用户修复测试或样式。 + +### 11\. 版本 + +使用 [SemVer][12] 或 [CalVer][13]。有许多工具可以帮助你管理版本:[incremental][14]、[bumpversion][15] 和 [setuptools_scm][16] 等都是 PyPI 上的包,都可以帮助你管理版本。 + +### 12\. 发布 + +通过运行 **tox** 或 **nox** 并使用 **twine** 将文件上传到 PyPI 上发布。你可以通过在 [DevPI][17] 中“测试上传”。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/18/12/tips-open-sourcing-python-libraries + +作者:[Moshe Zadka][a] +选题:[lujun9972][b] +译者:[geekpi](https://github.com/geekpi) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/moshez +[b]: https://github.com/lujun9972 +[1]: https://github.com/ +[2]: https://en.wikipedia.org/wiki/MIT_License +[3]: https://choosealicense.com/ +[4]: https://docs.pytest.org/en/latest/ +[5]: https://github.com/google/styleguide/blob/gh-pages/pyguide.md +[6]: https://www.python.org/dev/peps/pep-0287/ +[7]: http://www.sphinx-doc.org/en/master/ +[8]: https://opensource.com/article/18/11/building-custom-workflows-sphinx +[9]: https://pypi.org/project/setuptools/ +[10]: https://travis-ci.org/ +[11]: https://circleci.com/ +[12]: https://semver.org/ +[13]: https://calver.org/ +[14]: https://pypi.org/project/incremental/ +[15]: https://pypi.org/project/bumpversion/ +[16]: https://pypi.org/project/setuptools_scm/ +[17]: https://opensource.com/article/18/7/setting-devpi From 6fd0b0a89749722fdd6824206c69af66642e71a0 Mon Sep 17 00:00:00 2001 From: geekpi Date: Tue, 29 Jan 2019 08:54:48 +0800 Subject: [PATCH 196/243] translating --- ... Get started with Tint2, an open source taskbar for Linux.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20190126 Get started with Tint2, an open source taskbar for Linux.md b/sources/tech/20190126 Get started with Tint2, an open source taskbar for Linux.md index 601b90370c..e8afdbb417 100644 --- a/sources/tech/20190126 Get started with Tint2, an open source taskbar for Linux.md +++ b/sources/tech/20190126 Get started with Tint2, an open source taskbar for Linux.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (geekpi) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 378f6364157fbbfcb921364d36a7af66ae3d3132 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=99=BD=E5=AE=A6=E6=88=90?= Date: Tue, 29 Jan 2019 08:57:11 +0800 Subject: [PATCH 197/243] =?UTF-8?q?=E7=94=B3=E9=A2=86=E7=BF=BB=E8=AF=91=20?= =?UTF-8?q?PyGame=20Zero-=20Games=20without=20boilerplate?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../tech/20190125 PyGame Zero- Games without boilerplate.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sources/tech/20190125 PyGame Zero- Games without boilerplate.md b/sources/tech/20190125 PyGame Zero- Games without boilerplate.md index bdc100973a..f60c2b3407 100644 --- a/sources/tech/20190125 PyGame Zero- Games without boilerplate.md +++ b/sources/tech/20190125 PyGame Zero- Games without boilerplate.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (xiqingongzi) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) @@ -88,7 +88,7 @@ via: https://opensource.com/article/19/1/pygame-zero 作者:[Moshe Zadka][a] 选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) +译者:[xiqingongzi](https://github.com/xiqingongzi) 校对:[校对者ID](https://github.com/校对者ID) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From b0eda2970907881f3b03188ae7fed413eaac748a Mon Sep 17 00:00:00 2001 From: dianbanjiu Date: Tue, 29 Jan 2019 12:14:31 +0800 Subject: [PATCH 198/243] translating --- ...ommands to help you monitor activity on your Linux server.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20190123 Commands to help you monitor activity on your Linux server.md b/sources/tech/20190123 Commands to help you monitor activity on your Linux server.md index 43f1c480ad..c2a95d7ec2 100644 --- a/sources/tech/20190123 Commands to help you monitor activity on your Linux server.md +++ b/sources/tech/20190123 Commands to help you monitor activity on your Linux server.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (dianbanjiu ) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From ce9dc3303ac2cc4b41c41edc5ae2d5b3521393d2 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Tue, 29 Jan 2019 20:18:35 +0800 Subject: [PATCH 199/243] PRF:20181214 The Linux terminal is no one-trick pony.md @geekpi --- ...14 The Linux terminal is no one-trick pony.md | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/translated/tech/20181214 The Linux terminal is no one-trick pony.md b/translated/tech/20181214 The Linux terminal is no one-trick pony.md index c33a8b0e85..b27a7d59e6 100644 --- a/translated/tech/20181214 The Linux terminal is no one-trick pony.md +++ b/translated/tech/20181214 The Linux terminal is no one-trick pony.md @@ -1,15 +1,17 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (The Linux terminal is no one-trick pony) [#]: via: (https://opensource.com/article/18/12/linux-toy-ponysay) [#]: author: (Jason Baker https://opensource.com/users/jason-baker) -Linux 终端能做其他事 +Linux 终端上的漂亮小马 ====== -将小马宝莉的魔力带到终端 + +> 将小马宝莉的魔力带到终端 + ![](https://opensource.com/sites/default/files/styles/image-full-size/public/uploads/linux-toy-ponysay.png?itok=ehl6pTr_) 欢迎再次来到 Linux 命令行玩具日历。如果这是你第一次访问该系列,你甚至可能会问自己什么是命令行玩具。我们正在思考中,但一般来说,它可能是一个游戏,或任何简单的消遣,可以帮助你在终端玩得开心。 @@ -22,11 +24,11 @@ Linux 终端能做其他事 我对此感到好奇,并去看了一下,发现没有让我失望。 -简而言之,**[ponysay][3]** 的 **cowsay**的重写,它包括了来自[小马宝莉][4]中的许多全彩色人物,你可以用它在 Linux 命令行输出短句。它实际上是一个非常完善的项目,拥有超过 400 个字符和字符组合,它还有让人难以置信的的[ 78 页的 PDF 文档][5]涵盖了了所有的用法。 +简而言之,[ponysay][3] 的 cowsay 的重写,它包括了来自[小马宝莉][4]中的许多全彩色人物,你可以用它在 Linux 命令行输出短句。它实际上是一个非常完善的项目,拥有超过 400 个字符和字符组合,它还有让人难以置信的的 [78 页的 PDF 文档][5]涵盖了所有的用法。 -要安装 **ponysay**,你需要查看项目的 [README][6] 来选择最适合你的发行版和情况的安装方法。由于 ponysay 似乎没有为我的 Fedora 发行版打包,我选择试用 Docker 容器镜像,但你可以选择最适合你的方法。从源码安装可能也适合你。 +要安装 `ponysay`,你需要查看项目的 [README][6] 来选择最适合你的发行版和情况的安装方法。由于 `ponysay` 似乎没有为我的 Fedora 发行版打包,我选择试用 Docker 容器镜像,但你可以选择最适合你的方法。从源码安装可能也适合你。 -作为一个业余容器用户,我很想试试 [**podman**][7] 来代替 **docker**。至少对于我而言,它可以正常工作。 +作为一个业余容器用户,我很想试试 [podman][7] 来代替 docker。至少对于我而言,它可以正常工作。 ``` $ podman run -ti --rm mpepping/ponysay 'Ponytastic' @@ -49,7 +51,7 @@ via: https://opensource.com/article/18/12/linux-toy-ponysay 作者:[Jason Baker][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/) 荣誉推出 From 3fe41b1cb7b10b41788e12782aecbee7c0757218 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Tue, 29 Jan 2019 20:19:15 +0800 Subject: [PATCH 200/243] PUB:20181214 The Linux terminal is no one-trick pony.md @geekpi https://linux.cn/article-10488-1.html --- .../20181214 The Linux terminal is no one-trick pony.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20181214 The Linux terminal is no one-trick pony.md (98%) diff --git a/translated/tech/20181214 The Linux terminal is no one-trick pony.md b/published/20181214 The Linux terminal is no one-trick pony.md similarity index 98% rename from translated/tech/20181214 The Linux terminal is no one-trick pony.md rename to published/20181214 The Linux terminal is no one-trick pony.md index b27a7d59e6..f7c76392f9 100644 --- a/translated/tech/20181214 The Linux terminal is no one-trick pony.md +++ b/published/20181214 The Linux terminal is no one-trick pony.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-10488-1.html) [#]: subject: (The Linux terminal is no one-trick pony) [#]: via: (https://opensource.com/article/18/12/linux-toy-ponysay) [#]: author: (Jason Baker https://opensource.com/users/jason-baker) From 26688ce9ba8ef73650403d8e1b24140119e0f60b Mon Sep 17 00:00:00 2001 From: MjSeven Date: Tue, 29 Jan 2019 21:03:44 +0800 Subject: [PATCH 201/243] =?UTF-8?q?=E7=BF=BB=E8=AF=91=E5=AE=8C=E6=88=90=20?= =?UTF-8?q?20190123=20Getting=20started=20with=20Isotope..?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ... Isotope, an open source webmail client.md | 60 ------------------ ... Isotope, an open source webmail client.md | 62 +++++++++++++++++++ 2 files changed, 62 insertions(+), 60 deletions(-) delete mode 100644 sources/tech/20190123 Getting started with Isotope, an open source webmail client.md create mode 100644 translated/tech/20190123 Getting started with Isotope, an open source webmail client.md diff --git a/sources/tech/20190123 Getting started with Isotope, an open source webmail client.md b/sources/tech/20190123 Getting started with Isotope, an open source webmail client.md deleted file mode 100644 index 71307d1550..0000000000 --- a/sources/tech/20190123 Getting started with Isotope, an open source webmail client.md +++ /dev/null @@ -1,60 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (MjSeven) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Getting started with Isotope, an open source webmail client) -[#]: via: (https://opensource.com/article/19/1/productivity-tool-isotope) -[#]: author: (Kevin Sonney https://opensource.com/users/ksonney (Kevin Sonney)) - -Getting started with Isotope, an open source webmail client -====== -Read rich-text emails with Isotope, a lightweight email client and the 11th in our series on open source tools that will make you more productive in 2019. -![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/newsletter_email_mail_web_browser.jpg?itok=Lo91H9UH) - -There seems to be a mad rush at the beginning of every year to find ways to be more productive. New Year's resolutions, the itch to start the year off right, and of course, an "out with the old, in with the new" attitude all contribute to this. And the usual round of recommendations is heavily biased towards closed source and proprietary software. It doesn't have to be that way. - -Here's the 11th of my picks for 19 new (or new-to-you) open source tools to help you be more productive in 2019. - -### Isotope - -As we discussed in the [fourth article in this series][1] (about Cypht), we all spend a whole lot of time dealing with email. There are many options for dealing with it, and I've spent hours upon hours trying to find the best email client that works for me. I think that is an important distinction: What works for me doesn't always work for everyone else. And sometimes what works for me is a full client like [Thunderbird][2], sometimes it is a console client like [Mutt][3], and sometimes it's a web-based interface like [Gmail][4] or [RoundCube][5]. - -![](https://opensource.com/sites/default/files/uploads/isotope_1.png) - -[Isotope][6] is a locally hosted, web-based email client. It is exceptionally lightweight, uses IMAP exclusively, and takes up very little disk space. Unlike Cypht, Isotope has full HTML mail support, which means there are no issues displaying rich-text only emails. - -![](https://opensource.com/sites/default/files/uploads/isotope_2_0.png) - -Installing Isotope is very easy if you have [Docker][7] installed. You only need to copy the commands from the documentation into a console and press Enter. Point a browser at **localhost** to get the Isotope login screen, and entering your IMAP server, login name, and password will open the inbox view. - -![](https://opensource.com/sites/default/files/uploads/isotope_3.png) - -At this point, Isotope functions pretty much as you'd expect. Click a message to view it, click the pencil icon to create a new message, etc. You will note that the user interface (UI) is very minimalistic and doesn't have the typical buttons for things like "move to folder," "copy to folder," and "archive." You move messages around with drag and drop, so you don't really miss the buttons anyway. - -![](https://opensource.com/sites/default/files/uploads/isotope_4.png) - -Overall, Isotope is clean, fast, and works exceptionally well. Even better, it is under active development (the most recent commit was two hours before I wrote this article), so it is constantly getting improvements. You can check out the code and contribute to it on [GitHub][8]. - - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/19/1/productivity-tool-isotope - -作者:[Kevin Sonney][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://opensource.com/users/ksonney (Kevin Sonney) -[b]: https://github.com/lujun9972 -[1]: https://opensource.com/article/19/1/productivity-tool-cypht-email -[2]: https://www.thunderbird.net/ -[3]: http://www.mutt.org/ -[4]: https://mail.google.com/ -[5]: https://roundcube.net/ -[6]: https://blog.marcnuri.com/isotope-mail-client-introduction/ -[7]: https://www.docker.com/ -[8]: https://github.com/manusa/isotope-mail diff --git a/translated/tech/20190123 Getting started with Isotope, an open source webmail client.md b/translated/tech/20190123 Getting started with Isotope, an open source webmail client.md new file mode 100644 index 0000000000..0598fc8963 --- /dev/null +++ b/translated/tech/20190123 Getting started with Isotope, an open source webmail client.md @@ -0,0 +1,62 @@ +[#]: collector: (lujun9972) +[#]: translator: (MjSeven) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Getting started with Isotope, an open source webmail client) +[#]: via: (https://opensource.com/article/19/1/productivity-tool-isotope) +[#]: author: (Kevin Sonney https://opensource.com/users/ksonney (Kevin Sonney)) + + +Isotope 入门:一个开源的 Web 邮件客户端 +====== +使用 Isotope(一个轻量级的电子邮件客户端)阅读富文本电子邮件,它是我们在开源工具系列的第 11 个,将使你在 2019 年更高效。 + +![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/newsletter_email_mail_web_browser.jpg?itok=Lo91H9UH) + +在每年的年初,似乎都有一股疯狂的寻找提高工作效率方法的冲动。新年决心,渴望以正确的方式开始新的一年。当然,“旧不去的,新的不来”的态度都会导致这种情况。一般的建议都偏向于私有和专业软件,然而并不是必须这样。 + +以下是我挑选的 19 个新的(或者对你来说是新的)开源工具中的第 11 个,它将帮助你在 2019 年提高工作效率。 + +### Isotope + +正如我们在[本系列的第四篇文章][1](关于 Cypht)中所讨论的那样,我们花了很多时间来处理电子邮件。有很多方法可以解决它,我已经花了很多时间来寻找最适合我的电子邮件客户端。我认为这是一个重要的区别:对我有效的方法并不总是对其它人有效。有时对我有用的是像 [Thunderbird][2] 这样的完整客户端,有时是像 [Mutt][3] 这样的控制台客户端,有时是像 [Gmail][4] 和 [RoundCube][5] 这样基于 Web 的界面。 + +![](https://opensource.com/sites/default/files/uploads/isotope_1.png) + +[Isotope][6] 是一个本地托管的,基于 Web 的电子邮件客户端。它非常轻巧,只使用 IMAP 协议,占用的磁盘空间非常小。与 Cypht 不同,Isotope 具有完整的 HTML 邮件支持,这意味着显示富文本电子邮件没有问题。 + +![](https://opensource.com/sites/default/files/uploads/isotope_2_0.png) + +如果你安装了 [Docker][7],那么安装 Isotope 非常容易。你只需将文档中的命令复制到控制台中,然后按下 Enter 键。在浏览器中输入 **localhost** 来获取 Isotope 登录界面,输入你的 IMAP 服务器,登录名和密码将打开收件箱视图。 + +![](https://opensource.com/sites/default/files/uploads/isotope_3.png) + +在这一点上,Isotope 的功能和你想象的差不多。单击消息进行查看,单击铅笔图标以创建新邮件等。你会注意到用户界面(UI)非常简单,没有“移动到文件夹”,“复制到文件夹”和“存档”等常规按钮。你可以通过拖动来移动消息,因此无论如何你都不会错过这些按钮。 + +![](https://opensource.com/sites/default/files/uploads/isotope_4.png) + +总的来说,Isotope 干净,速度快,工作得非常好。更棒的是,它正在积极开发中(最近一次的提交是在我撰写本文的两小时之前),所以它正在不断得到改进。你可以查看代码并在 [GitHub][8] 上为它做出贡献。 + + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/1/productivity-tool-isotope + +作者:[Kevin Sonney][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/ksonney (Kevin Sonney) +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/article/19/1/productivity-tool-cypht-email +[2]: https://www.thunderbird.net/ +[3]: http://www.mutt.org/ +[4]: https://mail.google.com/ +[5]: https://roundcube.net/ +[6]: https://blog.marcnuri.com/isotope-mail-client-introduction/ +[7]: https://www.docker.com/ +[8]: https://github.com/manusa/isotope-mail From eff9a28f2a3abfcb269facef3f7c68ece61dd75e Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Tue, 29 Jan 2019 21:53:17 +0800 Subject: [PATCH 202/243] PRF:20190118 Top 5 Linux Server Distributions.md @wxy --- .../tech/20190118 Top 5 Linux Server Distributions.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/translated/tech/20190118 Top 5 Linux Server Distributions.md b/translated/tech/20190118 Top 5 Linux Server Distributions.md index b263bb3b89..89f86ab016 100644 --- a/translated/tech/20190118 Top 5 Linux Server Distributions.md +++ b/translated/tech/20190118 Top 5 Linux Server Distributions.md @@ -1,13 +1,13 @@ [#]: collector: (lujun9972) [#]: translator: (wxy) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Top 5 Linux Server Distributions) [#]: via: (https://www.linux.com/blog/learn/2019/1/top-5-linux-server-distributions) [#]: author: (Jack Wallen https://www.linux.com/users/jlwallen) -另一种 5 个顶级 Linux 服务器发行版 +5 个用于 SOHO 的 Linux 服务器发行版 ====== > Jack Wallen 为 Linux 服务器发行版提供了一些可靠的选择,绝对值回票价。 @@ -166,7 +166,7 @@ via: https://www.linux.com/blog/learn/2019/1/top-5-linux-server-distributions 作者:[Jack Wallen][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/) 荣誉推出 From 6d3de7543e00804d3cab3c92ca7e4fc44640e3ba Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Tue, 29 Jan 2019 21:54:24 +0800 Subject: [PATCH 203/243] PUB:20190118 Top 5 Linux Server Distributions.md @wxy https://linux.cn/article-10490-1.html --- .../20190118 Top 5 Linux Server Distributions.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20190118 Top 5 Linux Server Distributions.md (99%) diff --git a/translated/tech/20190118 Top 5 Linux Server Distributions.md b/published/20190118 Top 5 Linux Server Distributions.md similarity index 99% rename from translated/tech/20190118 Top 5 Linux Server Distributions.md rename to published/20190118 Top 5 Linux Server Distributions.md index 89f86ab016..e1515510a3 100644 --- a/translated/tech/20190118 Top 5 Linux Server Distributions.md +++ b/published/20190118 Top 5 Linux Server Distributions.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (wxy) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-10490-1.html) [#]: subject: (Top 5 Linux Server Distributions) [#]: via: (https://www.linux.com/blog/learn/2019/1/top-5-linux-server-distributions) [#]: author: (Jack Wallen https://www.linux.com/users/jlwallen) From ba2842017d51ed3b2c52946f55bce7e9709214be Mon Sep 17 00:00:00 2001 From: XYenChi <466530436@qq.com> Date: Tue, 29 Jan 2019 22:54:16 +0800 Subject: [PATCH 204/243] Update 20171222 10 keys to quick game development.md --- ...71222 10 keys to quick game development.md | 69 +++++++++---------- 1 file changed, 34 insertions(+), 35 deletions(-) diff --git a/sources/talk/20171222 10 keys to quick game development.md b/sources/talk/20171222 10 keys to quick game development.md index 50c8164ae0..5897adaae8 100644 --- a/sources/talk/20171222 10 keys to quick game development.md +++ b/sources/talk/20171222 10 keys to quick game development.md @@ -1,78 +1,77 @@ -XYenChi is translating -10 keys to quick game development +快速开发游戏的十个关键 ====== ![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/computer_keyboard_laptop_development_code_woman.png?itok=vbYz6jjb) -In early October, the inaugural [Open Jam][1] sponsored by Opensource.com drew 45 entries from teams located around the world. The teams had just three days to create a game using open source software to enter into the competition, and [three teams came out on top][2]. +十月早些时候,Opensource.com赞助的 [Open Jam][1] 入职仪式为处于世界各地的团队设立了45个入口。这些队伍只有三天时间用开源软件制作出一个游戏来参与角逐,并 [取前三][2]。 -We hosted our own Open Jam event at our university for anyone who wanted to participate. We reserved a computer lab for the weekend and taught people how to use open source software--[Godot][3] for the game engine, [LMMS][4] for music creation, [GIMP][5] for 2D art, and [Blender][6] for 3D art--to create games and game art assets. Three games were submitted from our event: [Loathsome][7], [Lost Artist][8], and [Paint Rider][9] (which I created). +我们在大学为每一位愿意参与的人举办了我们自己的 Open Jam 活动。周末预留了计算机实验室教大家使用开源软件——游戏引擎:[Godot][3],音乐:[LMMS][4] ,2D画面: [GIMP][5] 和3D画面 [Blender][6] ——来创作游戏和相关组件。活动产出了三个游戏: [Loathsome][7], [Lost Artist][8], 和 [Paint Rider][9] (我做的)。 -From my experience with game jams and game development in general, here are 10 lessons I've learned about game engines, coding, and rapid game development. +总的说来,我从游戏创作和游戏开发中,学到了十课关于游戏引擎、代码和快速游戏开发。 -## 1\. Narrow your scope +## 1\. 限定规模 -It's easy to get carried away with ideas to make an expansive adventure game or something that compares to your favorite game. Pursuing that outside of a game jam can be awesome, once you have some experience, but don't overestimate what you have time for. What I love about game jams is they force you to focus on getting a game from the conceptual stage to a final product quickly, since you have such a limited amount of time. This is why narrowing your scope is so important. +很容易想要去做一个规模宏大的冒险游戏或者比拟你最喜欢的游戏的东西。追求高于游戏创作之外的东西可能很酷,如果你有体会,但不要高估自己拥有的时间。我欣赏游戏创作的一点是强制你快速将一个游戏从概念阶段变成最终产品,因为你的时间非常有限。这也就是限定规模如此重要。 -The theme for Open Jam was "Leave a Mark." As soon as it was announced, my friends and I started brainstorming games that could fit that theme. One idea was a 3D boxing game where the player left bruises on their enemy. I had very little experience making 3D games and, while I would have loved to get better at them, I probably would have spent too much time learning how to get all the textures situated and hit boxes working before I could even start to figure out what would make a fun game. +Open Jam 的主题是“留下痕迹”,题目一出来,我和朋友就开始讨论什么样的游戏合题意。有个想法就是做玩家能在敌人身上留下伤痕的3D拳击游戏。我几乎没有做3D游戏的经验,我想做好的话,在我甚至还没发掘出可玩性之前,就得花太多时间在学习如何让痕迹合理和打击有效。 -## 2\. Have something playable very early +## 2\. 尽早可玩 -This is my favorite advice for game jams. Try to come up with the core mechanics and code them to a working state quickly so you can test them and decide whether it's worthy of making a full game. You shouldn't be hours away from the deadline and still trying to get your game playable. For a three-day jam like Open Jam, it shouldn't take more than a few hours to have some sort of demo running. +对游戏创作我最中肯的建议就是这。试着做出核心部件,快速写出代码,这样你就可以测试并决定它是否值得做成一个完整的游戏。不应该只剩几个小时截止了,才让你的游戏可玩。像 Open Jam 这样的三天创作,最好少花时间在实现概念上。 -## 3\. Keep it simple +## 3\. 保持简单 -Every feature that you want to include extends your total development time. You never know if committing to a feature will lead to a major time sink because you just can't quite get it to work. Arcade-style high-score games typically work well for game jams because they're usually simple by nature. Once you've finished the core, you can start adding features and polish without having to worry whether you'll have a functioning game in the end. +你想加入的每个特性都会延长整个开发时间。因为你不能迅速使之运行,所以无从得知提交一个新特性是否会消耗大量时间。街机风格的高分作品往往会在游戏创作中表现良好,它们天生就很简单。一旦核心部分完成,你可以开始加入特性并润色,无需担心最后游戏是否功能强大。 -## 4\. Take inspiration from other games +## 4\. 从其他游戏获取灵感 -You may be tempted to create something totally original, but having models to base your work on is extremely helpful. It will decrease the time it takes to come up with the mechanics, since you'll already have an idea of what is fun. Remind yourself that the more experience you have under your belt, the easier it is to create that massive game you have so many ideas for, so you might as well practice by trying to recreate things other people have done. +可能你想做出完全原创的作品,但作品的原型极其有用。原型将节省重复劳动的时间,因为你已经知道什么有趣。告诉自己实践的经验越多,越容易做出包含自己想法的大型游戏,自然你也能从再创作其他人的作品中很好地练习。 -Considering Open Jam's "Leave a Mark" theme, I thought it would be fun to create a game where you leave a trail of paint as you played, so you could see the mark you left. I remembered the old Flash game [Line Rider 2 Beta][10] (hence the name Paint Rider), and about the secret feature where you could draw a track if you held the Control button down while you played. I simplified that concept even more by requiring only one button for vertical movement (much like old helicopter games). About an hour or two into the jam, I had a basic demo where you could move up or down with one button and leave a trail of little black circles. +考虑到 Open Jam 的“留下痕迹”主题,我觉得创作一个玩的时候可以留下颜料痕迹的游戏会很有趣,这样也可以看到你留下的标记。我记得这款老式动画游戏 [Line Rider 2 Beta][10] (后来叫 Paint Rider),而且知道玩的时候按住 Control 键可以画出痕迹的彩蛋。我简化了概念,甚至只需要一个按键来垂直移动。(更像老式飞机游戏)。大概一两个小时的创作,我有了基本模型,用一个按钮上下移动和留下小黑圈的痕迹。 -## 5\. Don't overlook accessibility +## 5\. 不要忽视可得性 -Make sure as many people as possible can play your game. One of the games submitted to Open Jam was a virtual-reality game. As cool as that was, hardly anyone was able to play it, because not many people have a VR device. Luckily, its developer didn't expect it would do well in the ratings, and instead considered it practice. But, if you want to share your game with lots of people (or win game jams), it's important to pay attention to accessibility. +确保尽可能多的人能玩你的游戏。某个提交到 Open Jam 的游戏是虚拟现实游戏。尽管那很酷,但几乎没有人可以玩,因为拥有VR设备的人不多。所幸它的开发者并不期望取得好名次,只是想练手。但如果你想和人们分享你的游戏(或者赢得游戏创作),注意可得性是很重要的。 -Godot (and most other game engines) allow you to export your game to all major platforms. When submitting a game specifically to [Itch.io][11], having an in-browser version will allow most people to play it. But always look into exporting to as many platforms and operating systems as you can. I even tried exporting Paint Rider to mobile, but technical difficulties got in the way. +Godot (和其他大多数游戏引擎)允许你在所有主流平台发布游戏。提交游戏时,特别是在 [Itch.io][11],有浏览器版本将支持大多数人玩。但尽你所能去发布在更多的平台和开放系统上。我甚至试着在移动端发布 Paint Rider ,但技术有限。 -## 6\. Don't make it too difficult +## 6\. 不要做得太难 -If your game takes too much effort to learn or play, you'll lose a portion of your audience. This aligns nicely with keeping your game simple and within scope, and it puts even more importance on the game planning phase. Again, it's easy to come up with an epic game idea you could spend weeks or months developing; it's harder to come up with a good, simple game. +如果游戏需要花费过多精力去学或者玩,你将失去一部分玩家。这照应了保持简单和限定规模,在游戏计划阶段非常重要。再次重申,想做一个宏大的游戏花上十天半个月开发很容易;难的是做出好玩、简单的游戏。 -I showed Paint Rider to my Mom and she was able to play it immediately. I don't think I need to say anything more about that. +给妈妈介绍了 Paint Rider 之后,她很快开始玩起来,我认为不需要跟她说明更多。 -## 7\. Don't be too neat +## 7\. 不用太整洁 -If you're used to taking your time applying design patterns everywhere and making sure that your code will be reusable and readable, try to loosen up a bit. If you spend too much time worrying about design, when you finally get to the point when you can play your game, you may find out it's not very fun. By then, it's too late to make changes. +如果你习惯于花时间在设计每处图案和确保代码可复用、可适应,试着放松一点。如果你花太多时间考虑设计,当你最后到了可以玩游戏的时候,你可能发现游戏不是很有趣,那时候就来不及修改了。 -This process is also used for prototyping more serious games: You quickly code up messy proof-of-concept demos until you find one that's worth making into a full game, then you dive into building a perfect code base to support it. Creating a game for a game jam is like quickly coding up a proof of concept. +这过程也适用于简化更严格的游戏:快速码出验证概念性展示模型直到找出值得做成完整游戏的,然后你潜心建立完美的代码基础来支持它。游戏创作的开发游戏就像快速码出可验证的理念。 -## 8\. But don't be too messy, either +## 8\. 但也不要太随意 -On the other hand, [spaghetti code][12] can easily get out of control, even if there's not a ton of code in a game. Luckily, most game engines are built with design patterns in mind. Take Godot's [Signals][13] functionality, which allows nodes to send messages with data to nodes they've been "connected" with--it's the [observer pattern][14] automatically baked into your design. As long as you know how to take advantage of the game engine's features, you should be able to code quickly without making your code too painful to look at. +另一方面, [意大利面式代码][12] 容易失控,即使游戏开发没有大量代码。还好大多是游戏引擎用脑中的设计图建成。Luckily, most game engines are built with design patterns in mind. 就拿 Godot 的[信号][13] 功能来说,节点可以发送数据信息给它们“连上了”的节点——这是你的设计自动成型的[观测图][14]。 只要你知道如何利用游戏引擎的特性,就可以快速写代码,你的代码也不会特别难读。 -## 9\. Get feedback +## 9\. 取得反馈 -Show people what you're working on. Have them try it out and see what they say about it. Watch how they play your game and see if they find something you didn't expect. If the game jam has a [Discord][15] channel or something similar, post your game there, or bounce your ideas off people. One of Paint Rider's defining features is that the canvas loops, so you see the paint you left before. I hadn't even considered that mechanic until someone asked me why the game didn't have it. +向人们展示你正在做的。让他们试一试并看看他们说些啥。看看他们如何玩你的游戏,找找他们有没有发现你期望之外的事。如果游戏创作有[争论][15] 频道或者类似的,把你的游戏放上去,人们会反馈你的想法。 Paint Rider 的定义功能之一是画布循环,所以你可以看到之前留下来的画。在有人问我为什么这个游戏没有之前,我甚至没有考虑那个设置。 -Working on a team will ensure that there are other people built into the process who can pass feedback around. +团队协作的话,确保有其他可以传递周围反馈的人参与这个开发。 -And don't forget to help other people out in the same way; it's a win-win if you realize something that could help your game while you're playing someone else's game. +而且不要忘了用相同的方式帮助其他人;如果你在玩其他人游戏的时候发现了有助于你游戏的东西,这就是双赢。 -## 10\. Know where to find resources +## 10\. 哪里找资源 -Creating all your own assets can really slow you down. During Open Jam, I noticed that Loathsome's developer was spending multiple hours drawing the main character while I was busy incorporating new features and fixing bugs. You could simplify your art style for the game and still come up with something that looks and sounds good, but there are other options. Try looking for assets in [Creative Commons][16] or on free music sites like [Anttis Instrumentals][17]. Or, if possible, form a team with a dedicated artist, writer, or musician. +做出所有你自己的组件真的会拖你后腿。 Open Jam 期间,当我忙于组装新特性和修漏洞时,我注意到 Loathsome 的开发者花了大量时间在绘制主要角色 developer was spending multiple hours drawing the main character while I was busy incorporating new features and fixing bugs. 你可以简化游戏的艺术风格创作并且用一些视听效果尚可的东西,这里有其他选择。试着在 [Creative Commons][16] 上寻找组件或者免费音乐站点,比如 [Anttis Instrumentals][17] 。或者,可行的话,组一个有专门艺术家、作家或者音乐家的团队。 -Other software you might find useful includes [Krita][18], an open source 2D image creator that's nice for digital painting, especially if you have a drawing tablet, and [sfxr][19], a game sound-effect creator that has a lot of parameters to play with, but as its creator says: "Basic usage involves hitting the randomize button." (All sound effects in Paint Rider were made with Sfxr.) You can also check out [Calinou][20]'s large and neatly organized list of open source game development software. +其他你可能觉得有用的软件有 [Krita][18] ,一款适合数字绘画的开源 2D 图像生成软件,特别是如果你有一块绘图板,还有 [sfxr][19] ,一款游戏音效生成软件,很多参数可以调,但正如它的开发者所说:“基本用法包括了按下随机按钮。”( Paint Rider 的所有音效都是用 Sfxr 做的。)你也可以试试 [Calinou][20] 的众多但有序的开源游戏开发软件列表。 -Have you participated in Open Jam or another a game jam and have other advice? Or do you have questions I didn't address? If so, please share them in the comments. +你参加 Open Jam 或者其他游戏创作并有别的建议吗?对我未提及的有问题吗?有的话,请在评论中分享。 -------------------------------------------------------------------------------- via: https://opensource.com/article/17/12/10-keys-rapid-open-source-game-development 作者:[Ryan Estes][a] -译者:[译者ID](https://github.com/译者ID) +译者:[XYenChi](https://github.com/XYenChi) 校对:[校对者ID](https://github.com/校对者ID) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 324999d2167cff2db5adf1c1d24a8f8334d18057 Mon Sep 17 00:00:00 2001 From: XYenChi <466530436@qq.com> Date: Tue, 29 Jan 2019 23:27:02 +0800 Subject: [PATCH 205/243] Create 20171222 10 keys to quick game development.md --- ...71222 10 keys to quick game development.md | 99 +++++++++++++++++++ 1 file changed, 99 insertions(+) create mode 100644 translated/talk/20171222 10 keys to quick game development.md diff --git a/translated/talk/20171222 10 keys to quick game development.md b/translated/talk/20171222 10 keys to quick game development.md new file mode 100644 index 0000000000..c41f66bfc7 --- /dev/null +++ b/translated/talk/20171222 10 keys to quick game development.md @@ -0,0 +1,99 @@ +快速开发游戏的十个关键 +====== +![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/computer_keyboard_laptop_development_code_woman.png?itok=vbYz6jjb) + +十月早些时候,Opensource.com赞助的 [Open Jam][1] 入职仪式为处于世界各地的团队设立了45个入口。这些队伍只有三天时间用开源软件制作出一个游戏来参与角逐,并 [取前三][2]。 + +我们在大学为每一位愿意参与的人举办了我们自己的 Open Jam 活动。周末预留了计算机实验室教大家使用开源软件——游戏引擎:[Godot][3],音乐:[LMMS][4] ,2D画面: [GIMP][5] 和3D画面 [Blender][6] ——来创作游戏和相关组件。活动产出了三个游戏: [Loathsome][7], [Lost Artist][8], 和 [Paint Rider][9] (我做的)。 + +总的说来,我从游戏创作和游戏开发中,学到了十课关于游戏引擎、代码和快速游戏开发。 + +## 1\. 限定规模 + +很容易想要去做一个规模宏大的冒险游戏或者比拟你最喜欢的游戏的东西。追求高于游戏创作之外的东西可能很酷,如果你有体会,但不要高估自己拥有的时间。我欣赏游戏创作的一点是强制你快速将一个游戏从概念阶段变成最终产品,因为你的时间非常有限。这也就是限定规模如此重要。 + +Open Jam 的主题是“留下痕迹”,题目一出来,我和朋友就开始讨论什么样的游戏合题意。有个想法就是做玩家能在敌人身上留下伤痕的3D拳击游戏。我几乎没有做3D游戏的经验,我想做好的话,在我甚至还没发掘出可玩性之前,就得花太多时间在学习如何让痕迹合理和打击有效。 + +## 2\. 尽早可玩 + +对游戏创作我最中肯的建议就是这。试着做出核心部件,快速写出代码,这样你就可以测试并决定它是否值得做成一个完整的游戏。不应该只剩几个小时截止了,才让你的游戏可玩。像 Open Jam 这样的三天创作,最好少花时间在实现概念上。 + +## 3\. 保持简单 + +你想加入的每个特性都会延长整个开发时间。因为你不能迅速使之运行,所以无从得知提交一个新特性是否会消耗大量时间。街机风格的高分作品往往会在游戏创作中表现良好,它们天生就很简单。一旦核心部分完成,你可以开始加入特性并润色,无需担心最后游戏是否功能强大。 + +## 4\. 从其他游戏获取灵感 + +可能你想做出完全原创的作品,但作品的原型极其有用。原型将节省重复劳动的时间,因为你已经知道什么有趣。告诉自己实践的经验越多,越容易做出包含自己想法的大型游戏,自然你也能从再创作其他人的作品中很好地练习。 + +考虑到 Open Jam 的“留下痕迹”主题,我觉得创作一个玩的时候可以留下颜料痕迹的游戏会很有趣,这样也可以看到你留下的标记。我记得这款老式动画游戏 [Line Rider 2 Beta][10] (后来叫 Paint Rider),而且知道玩的时候按住 Control 键可以画出痕迹的彩蛋。我简化了概念,甚至只需要一个按键来垂直移动。(更像老式飞机游戏)。大概一两个小时的创作,我有了基本模型,用一个按钮上下移动和留下小黑圈的痕迹。 + +## 5\. 不要忽视可得性 + +确保尽可能多的人能玩你的游戏。某个提交到 Open Jam 的游戏是虚拟现实游戏。尽管那很酷,但几乎没有人可以玩,因为拥有VR设备的人不多。所幸它的开发者并不期望取得好名次,只是想练手。但如果你想和人们分享你的游戏(或者赢得游戏创作),注意可得性是很重要的。 + +Godot (和其他大多数游戏引擎)允许你在所有主流平台发布游戏。提交游戏时,特别是在 [Itch.io][11],有浏览器版本将支持大多数人玩。但尽你所能去发布在更多的平台和开放系统上。我甚至试着在移动端发布 Paint Rider ,但技术有限。 + +## 6\. 不要做得太难 + +如果游戏需要花费过多精力去学或者玩,你将失去一部分玩家。这照应了保持简单和限定规模,在游戏计划阶段非常重要。再次重申,想做一个宏大的游戏花上十天半个月开发很容易;难的是做出好玩、简单的游戏。 + +给妈妈介绍了 Paint Rider 之后,她很快开始玩起来,我认为不需要跟她说明更多。 + +## 7\. 不用太整洁 + +如果你习惯于花时间在设计每处图案和确保代码可复用、可适应,试着放松一点。如果你花太多时间考虑设计,当你最后到了可以玩游戏的时候,你可能发现游戏不是很有趣,那时候就来不及修改了。 + +这过程也适用于简化更严格的游戏:快速码出验证概念性展示模型直到找出值得做成完整游戏的,然后你潜心建立完美的代码基础来支持它。游戏创作的开发游戏就像快速码出可验证的理念。 + +## 8\. 但也不要太随意 + +另一方面, [意大利面式代码][12] 容易失控,即使游戏开发没有大量代码。还好大多是游戏引擎用脑中的设计图建成。就拿 Godot 的[信号][13] 功能来说,节点可以发送数据信息给它们“连上了”的节点——这是你的设计自动成型的[观测图][14]。 只要你知道如何利用游戏引擎的特性,就可以快速写代码,你的代码也不会特别难读。 + +## 9\. 取得反馈 + +向人们展示你正在做的。让他们试一试并看看他们说些啥。看看他们如何玩你的游戏,找找他们有没有发现你期望之外的事。如果游戏创作有[争论][15] 频道或者类似的,把你的游戏放上去,人们会反馈你的想法。 Paint Rider 的定义功能之一是画布循环,所以你可以看到之前留下来的画。在有人问我为什么这个游戏没有之前,我甚至没有考虑那个设置。 + +团队协作的话,确保有其他可以传递周围反馈的人参与这个开发。 + +而且不要忘了用相同的方式帮助其他人;如果你在玩其他人游戏的时候发现了有助于你游戏的东西,这就是双赢。 + +## 10\. 哪里找资源 + +做出所有你自己的组件真的会拖你后腿。 Open Jam 期间,当我忙于组装新特性和修漏洞时,我注意到 Loathsome 的开发者花了大量时间在绘制主要角色上,你可以简化游戏的艺术风格创作并且用一些视听效果尚可的东西,这里有其他选择。试着在 [Creative Commons][16] 上寻找组件或者免费音乐站点,比如 [Anttis Instrumentals][17] 。或者,可行的话,组一个有专门艺术家、作家或者音乐家的团队。 + +其他你可能觉得有用的软件有 [Krita][18] ,一款适合数字绘画的开源 2D 图像生成软件,特别是如果你有一块绘图板,还有 [sfxr][19] ,一款游戏音效生成软件,很多参数可以调,但正如它的开发者所说:“基本用法包括了按下随机按钮。”( Paint Rider 的所有音效都是用 Sfxr 做的。)你也可以试试 [Calinou][20] 的众多但有序的开源游戏开发软件列表。 + +你参加 Open Jam 或者其他游戏创作并有别的建议吗?对我未提及的有问题吗?有的话,请在评论中分享。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/17/12/10-keys-rapid-open-source-game-development + +作者:[Ryan Estes][a] +译者:[XYenChi](https://github.com/XYenChi) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:https://opensource.com/users/figytuna +[1]:https://itch.io/jam/open-jam-1 +[2]:https://opensource.com/article/17/11/open-jam +[3]:https://godotengine.org/ +[4]:https://lmms.io/ +[5]:https://www.gimp.org/ +[6]:https://www.blender.org/ +[7]:https://astropippin.itch.io/loathsome +[8]:https://masonraus.itch.io/lost-artist +[9]:https://figytuna.itch.io/paint-rider +[10]:http://www.andkon.com/arcade/racing/lineriderbeta2/ +[11]:https://itch.io/ +[12]:https://en.wikipedia.org/wiki/Spaghetti_code +[13]:http://kidscancode.org/blog/2017/03/godot_101_07/ +[14]:https://en.wikipedia.org/wiki/Observer_pattern +[15]:https://discordapp.com/ +[16]:https://creativecommons.org/ +[17]:http://www.soundclick.com/bands/default.cfm?bandID=1277008 +[18]:https://krita.org/en/ +[19]:http://www.drpetter.se/project_sfxr.html +[20]:https://notabug.org/Calinou/awesome-gamedev/src/master/README.md From 088c6b86b70ea58aeaf5b34e071e5968f156c2af Mon Sep 17 00:00:00 2001 From: HankChow <280630620@qq.com> Date: Tue, 29 Jan 2019 23:31:44 +0800 Subject: [PATCH 206/243] hankchow translated --- ...12 Top 5 configuration management tools.md | 122 ------------------ ...12 Top 5 configuration management tools.md | 120 +++++++++++++++++ 2 files changed, 120 insertions(+), 122 deletions(-) delete mode 100644 sources/tech/20181212 Top 5 configuration management tools.md create mode 100644 translated/tech/20181212 Top 5 configuration management tools.md diff --git a/sources/tech/20181212 Top 5 configuration management tools.md b/sources/tech/20181212 Top 5 configuration management tools.md deleted file mode 100644 index f7e59bcf08..0000000000 --- a/sources/tech/20181212 Top 5 configuration management tools.md +++ /dev/null @@ -1,122 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (HankChow) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Top 5 configuration management tools) -[#]: via: (https://opensource.com/article/18/12/configuration-management-tools) -[#]: author: (Marco Bravo https://opensource.com/users/marcobravo) - -Top 5 configuration management tools -====== -Learn about configuration management tools and figure out which will work best for your DevOps organization. -![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/innovation_lightbulb_gears_devops_ansible.png?itok=TSbmp3_M) - -DevOps is evolving and gaining traction as organizations discover how it enables them to produce better applications and reduce their software products' time to market. - -[DevOps' core values][1] are Culture, Automation, Measurement, and Sharing (CAMS), and an organization's adherence to them influences how successful it is. - - * **Culture** brings people and processes together; - * **Automation** creates a fabric for DevOps; - * **Measurement** permits improvements; and - * **Sharing** enables the feedback loop in the CAMS cycle. - - - -Another DevOps concept is the idea that almost everything can be managed in code: servers, databases, networks, log files, application configurations, documentation, automated tests, deployment processes, and more. - -In this article, I'll focus on one aspect of automation: Configuration management. As part of [Infrastructure as Code][2] (IaC), configuration management tools enable the use of tested and proven software development practices for managing and provisioning data centers through plaintext definition files. - -By manipulating simple configuration files, a DevOps team can use application development best practices, such as version control, testing, small deployments, and design patterns. In short, this means code can be written to provision and manage an infrastructure as well as automate processes. - -### Why use configuration management tools? - -Configuration management tools enable changes and deployments to be faster, repeatable, scalable, predictable, and able to maintain the desired state, which brings controlled assets into an expected state. - -Some advantages of using configuration management tools include: - - * Adherence to coding conventions that make it easier to navigate code - * Idempotency, which means that the end state remains the same, no matter how many times the code is executed - * Distribution design to improve managing large numbers of remote servers - - - -Some configuration management tools use a pull model, in which an agent installed on the servers runs periodically to pull the latest definitions from a central repository and apply them to the server. Other tools use a push model, where a central server triggers updates to managed servers. - -### Top 5 configuration management tools - -There are a variety of configuration management tools available, and each has specific features that make it better for some situations than others. Yet the top five configuration management tools, presented below in alphabetical order, have several things in common that I believe are essential for DevOps success: all have an open source license, use externalized configuration definition files, run unattended, and are scriptable. All of the descriptions are based on information from the tools' software repositories and websites. - -#### Ansible - -"Ansible is a radically simple IT automation platform that makes your applications and systems easier to deploy. Avoid writing scripts or custom code to deploy and update your applications—automate in a language that approaches plain English, using SSH, with no agents to install on remote systems." —[GitHub repository][3] - -Ansible is one of my favorite tools; I started using it several years ago and fell in love with it. You can use Ansible to execute the same command for a list of servers from the command line. You can also use it to automate tasks using "playbooks" written into a YAML file, which facilitate communication between teams and non-technical people. Its main advantages are that it is simple, agentless, and easy to read (especially for non-programmers). - -Because agents are not required, there is less overhead on servers. An SSH connection is necessary when running in push mode (which is the default), but pull mode is available if needed. [Playbooks][4] can be written with a minimal set of commands or they can be scaled for more elaborate automation tasks that could include roles, variables, and modules written by other people. - -You can combine Ansible with other tools to create a central console to control processes. Those tools include Ansible Works (AWX), Jenkins, RunDeck, and [ARA][5], which offers [traceability when running playbooks][6]. - -### CFEngine - -"CFEngine 3 is a popular open source configuration management system. Its primary function is to provide automated configuration and maintenance of large-scale computer systems." —[GitHub repository][7] - -CFEngine was introduced by Mark Burgess in 1993 as a scientific approach to automated configuration management. The goal was to deal with the entropy in computer systems' configuration and resolve it with end-state "convergence." Convergence means a desired end-state and elaborates on idempotence as a capacity to reach the desired end-state. Burgess' research evolved in 2004 when he proposed the [Promise theory][8] as a model of voluntary cooperation between agents. - -The current version of CFEngine incorporates Promise theory and uses agents running on each server that pull the configuration from a central repository. It requires some expert knowledge to deal with configurations, so it's best suited for technical people. - -### Chef - -"A systems integration framework, built to bring the benefits of configuration management to your entire infrastructure." —[GitHub repository][9] - -Chef uses "recipes" written in Ruby to keep your infrastructure running up-to-date and compliant. The recipes describe a series of resources that should be in a particular state. Chef can run in client/server mode or in a standalone configuration named [chef-solo][10]. It has good integration with the major cloud providers to automatically provision and configure new machines. - -Chef has a solid user base and provides a full toolset to allow people with different technical backgrounds and skills to interact around the recipes. But, at its base, it is more technically oriented tool. - -### Puppet - -"Puppet, an automated administrative engine for your Linux, Unix, and Windows systems, performs administrative tasks (such as adding users, installing packages, and updating server configurations) based on a centralized specification." —[GitHub repository][11] - -Conceived as a tool oriented toward operations and sysadmins, Puppet has consolidated as a configuration management tool. It usually works in a client-server architecture, and an agent communicates with the server to fetch configuration instructions. - -Puppet uses a declarative language or Ruby to describe the system configuration. It is organized in modules, and manifest files contain the desired-state goals to keep everything as required. Puppet uses the push model by default, and the pull model can be configured. - -### Salt - -"Software to automate the management and configuration of any infrastructure or application at scale." — [GitHub repository][12] - -Salt was created for high-speed data collection and scale beyond tens of thousands of servers. It uses Python modules to handle configuration details and specific actions. These modules manage all of Salt's remote execution and state management behavior. Some level of technical skills are required to configure the modules. - -Salt uses a client-server topology (with the Salt master as server and Salt minions as clients). Configurations are kept in Salt state files, which describe everything required to keep a system in the desired state. - -### Conclusion - -The landscape of DevOps tools is evolving all the time, and it is important to keep an eye on the changes. I hope this article will encourage you to explore these concepts and tools further. If so, the Cloud Native Computing Foundation (CNCF) maintains a good reference in the [Cloud Native Landscape Project][13]. - - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/18/12/configuration-management-tools - -作者:[Marco Bravo][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/marcobravo -[b]: https://github.com/lujun9972 -[1]: https://www.oreilly.com/learning/why-use-terraform -[2]: https://www.oreilly.com/library/view/infrastructure-as-code/9781491924334/ch04.html -[3]: https://github.com/ansible/ansible -[4]: https://opensource.com/article/18/8/ansible-playbooks-you-should-try -[5]: https://github.com/openstack/ara -[6]: https://opensource.com/article/18/5/analyzing-ansible-runs-using-ara -[7]: https://github.com/cfengine/core -[8]: https://en.wikipedia.org/wiki/Promise_theory -[9]: https://github.com/chef/chef -[10]: https://docs.chef.io/chef_solo.html -[11]: https://github.com/puppetlabs/puppet -[12]: https://github.com/saltstack/salt -[13]: https://github.com/cncf/landscape diff --git a/translated/tech/20181212 Top 5 configuration management tools.md b/translated/tech/20181212 Top 5 configuration management tools.md new file mode 100644 index 0000000000..d618833492 --- /dev/null +++ b/translated/tech/20181212 Top 5 configuration management tools.md @@ -0,0 +1,120 @@ +[#]: collector: (lujun9972) +[#]: translator: (HankChow) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Top 5 configuration management tools) +[#]: via: (https://opensource.com/article/18/12/configuration-management-tools) +[#]: author: (Marco Bravo https://opensource.com/users/marcobravo) + +五大最流行的配置管理工具 +====== +在寻找合适的 DevOps 工具之前,你最好要对配置管理工具有一定的了解。 +![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/innovation_lightbulb_gears_devops_ansible.png?itok=TSbmp3_M) + +DevOps 正因为有提高产品质量、缩短产品开发时间等优势,目前备受业界关注,同时也在长足发展当中。 + +[DevOps 的核心价值观][1]是团队文化Culture自动化Automation评估Measurement分享Sharing(CAMS),同时,团队对 DevOps 的执行力也是 DevOps 能否成功的重要因素。 + + * **团队文化**让大家团结一致; + * **自动化**是 DevOps 的基础; + * **评估**保证了及时的改进; + * **分享**让 CAMS 成为一个完整的循环过程。 + + + +DevOps 的另一个思想是任何东西,包括服务器、数据库、网络、日志文件、应用配置、文档、自动化测试、部署流程等,都可以通过代码来管理。 + +在本文中,我主要介绍配置管理的自动化。配置管理工具作为[基础架构即代码Infrastructure as Code][2](IaC)的一部分,支持使用软件进行开发实践,以及通过明文定义的文件来管理数据中心。 + +DevOps 团队只需要通过操作简单的配置文件,就可以实现应用开发中包括版本控制、测试、小型部署、设计模式这些最佳实践。总而言是,配置管理工具实现了通过编写代码来使基础架构管理变得自动化。 + +### 为什么要使用配置管理工具? + +配置管理工具可以提高应用部署和变更的效率,还可以让这些流程变得可重用、可扩展、可预测,甚至让它们维持在期望的状态,从而让资产的可控性提高。 + +使用配置管理工具的优势还包括: + + * 让代码遵守编码规范,提高代码可读性; + * 具有幂等性Idempotency,也就是说,无论执行多少次重复的配置管理操作,得到的结果都是一致的; + * 可以方便地管理分布式系统和大量的远程服务器。 + +配置管理工具主要分为拉取pull模式和推送push模式。拉取模式是指安装在各台服务器上的代理agent定期从中央存储库central repository拉取最新的配置并应用到对应的服务器上;而推送模式则由中央服务器central server主动向其它服务器推送更新的配置。 + +### 五大最流行的配置管理工具 + +目前配置管理工具有很多,不同的配置管理工具都有自己最适合的使用场景。而对于下面五个我按照字母顺序列出的配置管理工具,都对 DevOps 有明显的帮助:具有开源许可证、使用外部配置文件、支持无人值守运行、可以通过脚本自定义运行。下面对它们的介绍都来源于它们的软件库和官网内容。 + +#### Ansible + +“Ansible 是一个极其简洁的 IT 自动化平台,可以让你的应用和系统以更简单的方式部署。不需要安装任何代理,只需要使用 SSH 的方式和简单的语言,就可以免去脚本或代码部署应用的过程。”——[GitHub Ansible 代码库][3] + +Ansible 是我最喜欢的工具之一,我在几年前就开始使用了。你可以使用 Ansible 在命令行中让多个服务器执行同一个命令,也可以使用 YAML 格式的 playbook 来让它自动执行特定的操作,这让技术团队和非技术团队之间的沟通变得更加明确。简洁、无代理、配置文件对非技术人员友好是它的几个主要优点。 + +由于 Ansible 不需要代理,因此对服务器的资源消耗会很少。在默认情况下,Ansible 使用的推送模式需要借助 SSH 连接,但 Ansible 也支持拉取模式。[playbook][4] 可以使用最少的命令集编写,当然也可以扩展为更加精细的自动化任务,包括引入其它角色、变量和模块。 + +你可以将 Ansible 和其它工具(包括 Ansible Works、Jenkins、RunDeck、[ARA][5] 等)结合起来使用,因为这些工具支持 [playbook 的回溯功能][6],这样就可以很方便地控制整个开发周期中的不同流程。 + +### CFEngine + +“CFEngine 3 是一个流行的开源配置管理系统,它可以为大规模的系统提供自动化配置和维护。”——[GitHub CFEngine 代码库][7] + +CFEngine 最早在 1993 年由 Mark Burgess 以自动配置管理的科学方法提出,目的是降低计算机系统配置中的熵,最终收敛到期望的配置状态,同时还阐述了幂等性是让系统达到期望状态的能力。Burgess 在 2004 年又提出了承诺理论Promise Theory,这个理论描述了代理之间自发合作的模型。 + +CFEngine 的最新版本已经用到了承诺理论,在各个服务器上的代理程序会从中央存储库拉取配置。CFEngine 的配置对专业技能要求较高,因此它比较适合技术团队使用。 + +### Chef + +“为整个基础架构在配置管理上带来便利的一个系统集成框架。”——[GitHub Chef 代码库][9] + +Chef 通过由 Ruby 编写的“菜谱recipe”来让你的基础架构保持在最新、最兼容的状态,这些“菜谱”描述了一系列资源的某种状态。Chef 既可以通过客户端-服务端的模式运行,也可以在 [chef-solo][10] 这种独立配置的模式下运行。大部分云提供商都很好地集成了 Chef,因此可以使用它为新机器做自动配置。 + +Chef 有广泛的用户基础,同时也提供了完备的工具包,让不同技术背景的团队可以通过“菜谱”进行沟通。尽管如此,它仍然算是一个技术导向的工具。 + +### Puppet + +“Puppet 是可以在 Linux、Unix 和 Windows 系统上运行的自动化管理引擎,它可以根据集中的规范来执行诸如添加用户、安装软件包、更新服务器配置等等管理任务。”——[GitHub Puppet 代码库][11] + +Puppet 作为一款面向运维工程师和系统管理员的工具,在更多情况下是作为配置管理工具来使用。它通过客户端-服务端的模式工作,使用代理从主服务器获取配置指令。 + +Puppet 使用声明式语言declarative language或 Ruby 来描述系统配置。它包含了不同的模块,并使用清单文件manifest files记录期望达到的目标状态。Puppet 默认使用推送模式,但也支持拉取模式。 + +### Salt + +“为大规模基础结构或应用程序实现自动化管理的软件。”——[GitHub Salt 代码库][12] + +Salt 的专长就是快速收集数据,即使是上万台服务器也能够轻松完成任务。它使用 Python 模块来管理配置信息和执行特定的操作,这些模块可以让 Salt 实现所有远程操作和状态管理。但配置 Salt 模块对技术水平有一定的要求。 + +Salt 使用客户端-服务端的结构(Salt minions 是客户端,而 Salt master 是服务端),并以 Salt 状态文件记录需要达到的目标状态。 + +### 总结 + +DevOps 工具领域一直在发展,因此必须时刻关注其中的最新动态。希望这篇文章能够鼓励读者进一步探索相关的概念和工具。为此,云原生计算基金会Cloud Native Computing Foundation(CNCF)在 [Cloud Native Landscape Project][13] 中也提供了很好的参考案例。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/18/12/configuration-management-tools + +作者:[Marco Bravo][a] +选题:[lujun9972][b] +译者:[HankChow](https://github.com/HankChow) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/marcobravo +[b]: https://github.com/lujun9972 +[1]: https://www.oreilly.com/learning/why-use-terraform +[2]: https://www.oreilly.com/library/view/infrastructure-as-code/9781491924334/ch04.html +[3]: https://github.com/ansible/ansible +[4]: https://opensource.com/article/18/8/ansible-playbooks-you-should-try +[5]: https://github.com/openstack/ara +[6]: https://opensource.com/article/18/5/analyzing-ansible-runs-using-ara +[7]: https://github.com/cfengine/core +[8]: https://en.wikipedia.org/wiki/Promise_theory +[9]: https://github.com/chef/chef +[10]: https://docs.chef.io/chef_solo.html +[11]: https://github.com/puppetlabs/puppet +[12]: https://github.com/saltstack/salt +[13]: https://github.com/cncf/landscape + From 76e0f3a6182312eac690a2a56684e39a28861518 Mon Sep 17 00:00:00 2001 From: XYenChi <466530436@qq.com> Date: Tue, 29 Jan 2019 23:56:09 +0800 Subject: [PATCH 207/243] Delete 20171222 10 keys to quick game development.md --- ...71222 10 keys to quick game development.md | 99 ------------------- 1 file changed, 99 deletions(-) delete mode 100644 sources/talk/20171222 10 keys to quick game development.md diff --git a/sources/talk/20171222 10 keys to quick game development.md b/sources/talk/20171222 10 keys to quick game development.md deleted file mode 100644 index 5897adaae8..0000000000 --- a/sources/talk/20171222 10 keys to quick game development.md +++ /dev/null @@ -1,99 +0,0 @@ -快速开发游戏的十个关键 -====== -![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/computer_keyboard_laptop_development_code_woman.png?itok=vbYz6jjb) - -十月早些时候,Opensource.com赞助的 [Open Jam][1] 入职仪式为处于世界各地的团队设立了45个入口。这些队伍只有三天时间用开源软件制作出一个游戏来参与角逐,并 [取前三][2]。 - -我们在大学为每一位愿意参与的人举办了我们自己的 Open Jam 活动。周末预留了计算机实验室教大家使用开源软件——游戏引擎:[Godot][3],音乐:[LMMS][4] ,2D画面: [GIMP][5] 和3D画面 [Blender][6] ——来创作游戏和相关组件。活动产出了三个游戏: [Loathsome][7], [Lost Artist][8], 和 [Paint Rider][9] (我做的)。 - -总的说来,我从游戏创作和游戏开发中,学到了十课关于游戏引擎、代码和快速游戏开发。 - -## 1\. 限定规模 - -很容易想要去做一个规模宏大的冒险游戏或者比拟你最喜欢的游戏的东西。追求高于游戏创作之外的东西可能很酷,如果你有体会,但不要高估自己拥有的时间。我欣赏游戏创作的一点是强制你快速将一个游戏从概念阶段变成最终产品,因为你的时间非常有限。这也就是限定规模如此重要。 - -Open Jam 的主题是“留下痕迹”,题目一出来,我和朋友就开始讨论什么样的游戏合题意。有个想法就是做玩家能在敌人身上留下伤痕的3D拳击游戏。我几乎没有做3D游戏的经验,我想做好的话,在我甚至还没发掘出可玩性之前,就得花太多时间在学习如何让痕迹合理和打击有效。 - -## 2\. 尽早可玩 - -对游戏创作我最中肯的建议就是这。试着做出核心部件,快速写出代码,这样你就可以测试并决定它是否值得做成一个完整的游戏。不应该只剩几个小时截止了,才让你的游戏可玩。像 Open Jam 这样的三天创作,最好少花时间在实现概念上。 - -## 3\. 保持简单 - -你想加入的每个特性都会延长整个开发时间。因为你不能迅速使之运行,所以无从得知提交一个新特性是否会消耗大量时间。街机风格的高分作品往往会在游戏创作中表现良好,它们天生就很简单。一旦核心部分完成,你可以开始加入特性并润色,无需担心最后游戏是否功能强大。 - -## 4\. 从其他游戏获取灵感 - -可能你想做出完全原创的作品,但作品的原型极其有用。原型将节省重复劳动的时间,因为你已经知道什么有趣。告诉自己实践的经验越多,越容易做出包含自己想法的大型游戏,自然你也能从再创作其他人的作品中很好地练习。 - -考虑到 Open Jam 的“留下痕迹”主题,我觉得创作一个玩的时候可以留下颜料痕迹的游戏会很有趣,这样也可以看到你留下的标记。我记得这款老式动画游戏 [Line Rider 2 Beta][10] (后来叫 Paint Rider),而且知道玩的时候按住 Control 键可以画出痕迹的彩蛋。我简化了概念,甚至只需要一个按键来垂直移动。(更像老式飞机游戏)。大概一两个小时的创作,我有了基本模型,用一个按钮上下移动和留下小黑圈的痕迹。 - -## 5\. 不要忽视可得性 - -确保尽可能多的人能玩你的游戏。某个提交到 Open Jam 的游戏是虚拟现实游戏。尽管那很酷,但几乎没有人可以玩,因为拥有VR设备的人不多。所幸它的开发者并不期望取得好名次,只是想练手。但如果你想和人们分享你的游戏(或者赢得游戏创作),注意可得性是很重要的。 - -Godot (和其他大多数游戏引擎)允许你在所有主流平台发布游戏。提交游戏时,特别是在 [Itch.io][11],有浏览器版本将支持大多数人玩。但尽你所能去发布在更多的平台和开放系统上。我甚至试着在移动端发布 Paint Rider ,但技术有限。 - -## 6\. 不要做得太难 - -如果游戏需要花费过多精力去学或者玩,你将失去一部分玩家。这照应了保持简单和限定规模,在游戏计划阶段非常重要。再次重申,想做一个宏大的游戏花上十天半个月开发很容易;难的是做出好玩、简单的游戏。 - -给妈妈介绍了 Paint Rider 之后,她很快开始玩起来,我认为不需要跟她说明更多。 - -## 7\. 不用太整洁 - -如果你习惯于花时间在设计每处图案和确保代码可复用、可适应,试着放松一点。如果你花太多时间考虑设计,当你最后到了可以玩游戏的时候,你可能发现游戏不是很有趣,那时候就来不及修改了。 - -这过程也适用于简化更严格的游戏:快速码出验证概念性展示模型直到找出值得做成完整游戏的,然后你潜心建立完美的代码基础来支持它。游戏创作的开发游戏就像快速码出可验证的理念。 - -## 8\. 但也不要太随意 - -另一方面, [意大利面式代码][12] 容易失控,即使游戏开发没有大量代码。还好大多是游戏引擎用脑中的设计图建成。Luckily, most game engines are built with design patterns in mind. 就拿 Godot 的[信号][13] 功能来说,节点可以发送数据信息给它们“连上了”的节点——这是你的设计自动成型的[观测图][14]。 只要你知道如何利用游戏引擎的特性,就可以快速写代码,你的代码也不会特别难读。 - -## 9\. 取得反馈 - -向人们展示你正在做的。让他们试一试并看看他们说些啥。看看他们如何玩你的游戏,找找他们有没有发现你期望之外的事。如果游戏创作有[争论][15] 频道或者类似的,把你的游戏放上去,人们会反馈你的想法。 Paint Rider 的定义功能之一是画布循环,所以你可以看到之前留下来的画。在有人问我为什么这个游戏没有之前,我甚至没有考虑那个设置。 - -团队协作的话,确保有其他可以传递周围反馈的人参与这个开发。 - -而且不要忘了用相同的方式帮助其他人;如果你在玩其他人游戏的时候发现了有助于你游戏的东西,这就是双赢。 - -## 10\. 哪里找资源 - -做出所有你自己的组件真的会拖你后腿。 Open Jam 期间,当我忙于组装新特性和修漏洞时,我注意到 Loathsome 的开发者花了大量时间在绘制主要角色 developer was spending multiple hours drawing the main character while I was busy incorporating new features and fixing bugs. 你可以简化游戏的艺术风格创作并且用一些视听效果尚可的东西,这里有其他选择。试着在 [Creative Commons][16] 上寻找组件或者免费音乐站点,比如 [Anttis Instrumentals][17] 。或者,可行的话,组一个有专门艺术家、作家或者音乐家的团队。 - -其他你可能觉得有用的软件有 [Krita][18] ,一款适合数字绘画的开源 2D 图像生成软件,特别是如果你有一块绘图板,还有 [sfxr][19] ,一款游戏音效生成软件,很多参数可以调,但正如它的开发者所说:“基本用法包括了按下随机按钮。”( Paint Rider 的所有音效都是用 Sfxr 做的。)你也可以试试 [Calinou][20] 的众多但有序的开源游戏开发软件列表。 - -你参加 Open Jam 或者其他游戏创作并有别的建议吗?对我未提及的有问题吗?有的话,请在评论中分享。 - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/17/12/10-keys-rapid-open-source-game-development - -作者:[Ryan Estes][a] -译者:[XYenChi](https://github.com/XYenChi) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]:https://opensource.com/users/figytuna -[1]:https://itch.io/jam/open-jam-1 -[2]:https://opensource.com/article/17/11/open-jam -[3]:https://godotengine.org/ -[4]:https://lmms.io/ -[5]:https://www.gimp.org/ -[6]:https://www.blender.org/ -[7]:https://astropippin.itch.io/loathsome -[8]:https://masonraus.itch.io/lost-artist -[9]:https://figytuna.itch.io/paint-rider -[10]:http://www.andkon.com/arcade/racing/lineriderbeta2/ -[11]:https://itch.io/ -[12]:https://en.wikipedia.org/wiki/Spaghetti_code -[13]:http://kidscancode.org/blog/2017/03/godot_101_07/ -[14]:https://en.wikipedia.org/wiki/Observer_pattern -[15]:https://discordapp.com/ -[16]:https://creativecommons.org/ -[17]:http://www.soundclick.com/bands/default.cfm?bandID=1277008 -[18]:https://krita.org/en/ -[19]:http://www.drpetter.se/project_sfxr.html -[20]:https://notabug.org/Calinou/awesome-gamedev/src/master/README.md From 8d1305203ca28ec1234a1fcc9f308d4e35f4c6bf Mon Sep 17 00:00:00 2001 From: MjSeven Date: Wed, 30 Jan 2019 00:09:52 +0800 Subject: [PATCH 208/243] Translating by MjSeven --- ... Plan your own holiday calendar at the Linux command line.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20181207 Plan your own holiday calendar at the Linux command line.md b/sources/tech/20181207 Plan your own holiday calendar at the Linux command line.md index b4d6f58b32..9188914bbb 100644 --- a/sources/tech/20181207 Plan your own holiday calendar at the Linux command line.md +++ b/sources/tech/20181207 Plan your own holiday calendar at the Linux command line.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (MjSeven) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 538c7b4a3e348548e3bffab157585010a2ba8eeb Mon Sep 17 00:00:00 2001 From: geekpi Date: Wed, 30 Jan 2019 08:54:24 +0800 Subject: [PATCH 209/243] translated --- ... And Hardware Monitoring Tool For Linux.md | 139 ------------------ 1 file changed, 139 deletions(-) delete mode 100644 sources/tech/20190114 Hegemon - A Modular System And Hardware Monitoring Tool For Linux.md diff --git a/sources/tech/20190114 Hegemon - A Modular System And Hardware Monitoring Tool For Linux.md b/sources/tech/20190114 Hegemon - A Modular System And Hardware Monitoring Tool For Linux.md deleted file mode 100644 index 24b5f93af7..0000000000 --- a/sources/tech/20190114 Hegemon - A Modular System And Hardware Monitoring Tool For Linux.md +++ /dev/null @@ -1,139 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (geekpi) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Hegemon – A Modular System And Hardware Monitoring Tool For Linux) -[#]: via: (https://www.2daygeek.com/hegemon-a-modular-system-and-hardware-monitoring-tool-for-linux/) -[#]: author: (Magesh Maruthamuthu https://www.2daygeek.com/author/magesh/) - -Hegemon – A Modular System And Hardware Monitoring Tool For Linux -====== - -I know that everybody is preferring for **[TOP Command][1]** to monitor system utilization. - -It’s one of the best and native command which used by vast of Linux administrators. - -In Linux there is an alternative for everything respective of packages. - -There are many utilities are available for this purpose in Linux and i prefer **[HTOP Command][2]**. - -If you want to know about other alternatives, i would suggest you to navigate to the each link to know more about it. - -Those are htop, CorFreq, glances, atop, Dstat, Gtop, Linux Dash, Netdata, Monit, etc. - -All these tools only allow us to monitor system utilization and not for the system hardware’s. - -But Hegemon is allow us to monitor both in the single dashboard. - -If you are looking for system hardware monitoring then i would suggest you to check **[lm_sensors][3]** and **[s-tui Stress Terminal UI][4]** utilities. - -### What’s Hegemon? - -Hegemon is a work-in-progress modular system monitor written in safe Rust. - -It allow users to monitor both utilization in a single dashboard. It’s system utilization and hardware temperatures. - -### Currently Available Features in Hegemon - - * Monitor CPU and memory usage, temperatures, and fan speeds - * Expand any data stream to reveal a more detailed graph and additional information - * Adjustable update interval - * Clean MVC architecture with good code quality - * Unit tests - - - -### Planned Features include - - * macOS and BSD support (only Linux is supported at the moment) - * Monitor disk and network I/O, GPU usage (maybe), and more - * Select and reorder data streams - * Mouse control - - - -### How to Install Hegemon in Linux? - -Hegemon is requires Rust 1.26 or later and the development files for libsensors. So, make sure these packages were installed before your perform Hegemon installation. - -libsensors library package is available in most of the distribution official repository so, use the following command to install it. - -For **`Debian/Ubuntu`** systems, use **[APT-GET Command][5]** or **[APT Command][6]** to install libsensors on your systems. - -``` -# apt install lm_sensors-devel -``` - -For **`Fedora`** system, use **[DNF Package Manager][7]** to install libsensors on your system. - -``` -# dnf install libsensors4-dev -``` - -Run the following command to install Rust programming language and follow the instruction. Navigate to the following URL if you want handy tutorials for **[Rust installation][8]**. - -``` -$ curl https://sh.rustup.rs -sSf | sh -``` - -If you have successfully installed Rust. Run the following command to install Hegemon. - -``` -$ cargo install hegemon -``` - -### How to Lunch Hegemon in Linux? - -Once you successfully install Hegemon package. Run run the below command to launch it. - -``` -$ hegemon -``` - -![][10] - -I was facing an issue when i was launching the “Hegemon” application due to libsensors.so.4 libraries issue. - -``` -$ hegemon -error while loading shared libraries: libsensors.so.4: cannot open shared object file: No such file or directory manjaro -``` - -I’m using Manjaro 18.04. It has the libsensors.so & libsensors.so.5 shared libraries and not for libsensors.so.4. So, i just created the following symlink to fix the issue. - -``` -$ sudo ln -s /usr/lib/libsensors.so /usr/lib/libsensors.so.4 -``` - -Here is the sample gif file which was taken from my Lenovo-Y700 laptop. -![][11] - -By default it shows only overall summary and if you would like to see the detailed output then you need to expand the each section. See the expanded output with Hegemon. -![][12] - --------------------------------------------------------------------------------- - -via: https://www.2daygeek.com/hegemon-a-modular-system-and-hardware-monitoring-tool-for-linux/ - -作者:[Magesh Maruthamuthu][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://www.2daygeek.com/author/magesh/ -[b]: https://github.com/lujun9972 -[1]: https://www.2daygeek.com/top-command-examples-to-monitor-server-performance/ -[2]: https://www.2daygeek.com/linux-htop-command-linux-system-performance-resource-monitoring-tool/ -[3]: https://www.2daygeek.com/view-check-cpu-hard-disk-temperature-linux/ -[4]: https://www.2daygeek.com/s-tui-stress-terminal-ui-monitor-linux-cpu-temperature-frequency/ -[5]: https://www.2daygeek.com/apt-get-apt-cache-command-examples-manage-packages-debian-ubuntu-systems/ -[6]: https://www.2daygeek.com/apt-command-examples-manage-packages-debian-ubuntu-systems/ -[7]: https://www.2daygeek.com/dnf-command-examples-manage-packages-fedora-system/ -[8]: https://www.2daygeek.com/how-to-install-rust-programming-language-in-linux/ -[9]: data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7 -[10]: https://www.2daygeek.com/wp-content/uploads/2019/01/hegemon-a-modular-system-and-hardware-monitoring-tool-for-linux-1.png -[11]: https://www.2daygeek.com/wp-content/uploads/2019/01/hegemon-a-modular-system-and-hardware-monitoring-tool-for-linux-2a.gif -[12]: https://www.2daygeek.com/wp-content/uploads/2019/01/hegemon-a-modular-system-and-hardware-monitoring-tool-for-linux-3.png From defbf592185ad54c5df00614109de4b448c3be72 Mon Sep 17 00:00:00 2001 From: geekpi Date: Wed, 30 Jan 2019 09:14:39 +0800 Subject: [PATCH 210/243] translated --- ... And Hardware Monitoring Tool For Linux.md | 139 ++++++++++++++++++ 1 file changed, 139 insertions(+) create mode 100644 translated/tech/20190114 Hegemon - A Modular System And Hardware Monitoring Tool For Linux.md diff --git a/translated/tech/20190114 Hegemon - A Modular System And Hardware Monitoring Tool For Linux.md b/translated/tech/20190114 Hegemon - A Modular System And Hardware Monitoring Tool For Linux.md new file mode 100644 index 0000000000..9dd255cb67 --- /dev/null +++ b/translated/tech/20190114 Hegemon - A Modular System And Hardware Monitoring Tool For Linux.md @@ -0,0 +1,139 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Hegemon – A Modular System And Hardware Monitoring Tool For Linux) +[#]: via: (https://www.2daygeek.com/hegemon-a-modular-system-and-hardware-monitoring-tool-for-linux/) +[#]: author: (Magesh Maruthamuthu https://www.2daygeek.com/author/magesh/) + +Hegemon - 一个 Linux 中的模块化系统和硬件监控工具 +====== + +我知道每个人都更喜欢使用 **[top 命令][1]**来监控系统利用率。 + +这是被 Linux 系统管理员大量使用的原生命令之一。 + +在 Linux 中,每个包都有一个替代品。 + +Linux 中有许多可用于此的工具,我更喜欢 **[htop 命令][2]**。 + +如果你想了解其他替代方案,我建议你浏览每个链接了解更多信息。 + +它们有 htop、CorFreq、glances、atop、Dstat、Gtop、Linux Dash、Netdata、Monit 等。 + +所有这些只允许我们监控系统利用率而不能监控系统硬件。 + +但是 Hegemon 允许我们在单个仪表板中监控两者。 + +如果你正在寻找系统硬件监控软件,那么我建议你看下 **[lm_sensors][3]** 和 **[s-tui 压力终端 UI][4]**。 + +### Hegemon 是什么? + +Hegemon 是一个正在开发中的模块化系统监视器, 以安全的 Rust 编写。 + +它允许用户在单个仪表板中监控两种使用情况。分别是系统利用率和硬件温度。 + +### Hegemon 目前的特性 + + * 监控 CPU 和内存使用情况、温度和风扇速度 +  * 展开任何数据流以显示更详细的图表和其他信息 +  * 可调整的更新间隔 +  * 干净的 MVC 架构,具有良好的代码质量 +  * 单元测试 + + + +### 计划的特性包括 + + * macOS 和 BSD 支持(目前仅支持 Linux) +  * 监控磁盘和网络 I/O、GPU使用情况(可能)等 +  * 选择并重新排序数据流 +  * 鼠标控制 + + + +### 如何在 Linux 中安装 Hegemon? + +Hegemon 需要 Rust 1.26 或更高版本以及 libsensors 的开发文件。因此,请确保在安装 Hegemon 之前安装了这些软件包。 + +libsensors 库在大多数发行版官方仓库中都有,因此,使用以下命令进行安装。 + +对于 **`Debian/Ubuntu`** 系统,使用 **[apt-get 命令][5]** 或 **[apt 命令][6]** 在你的系统上安装 libsensors。 + +``` +# apt install lm_sensors-devel +``` + +对于 **`Fedora`** 系统,使用 **[dnf 包管理器][7]**在你的系统上安装 libsensors。 + +``` +# dnf install libsensors4-dev +``` + +运行以下命令安装 Rust 语言,并按照指示来做。如果你想要看 **[Rust 安装][8]**的方便教程,请进入这个 URL。 + +``` +$ curl https://sh.rustup.rs -sSf | sh +``` + +如果你已成功安装 Rust。运行以下命令安装 Hegemon。 + +``` +$ cargo install hegemon +``` + +### 如何在 Linux 中启动 Hegemon? + +成功安装 Hegemon 包后,运行下面的命令启动。 + +``` +$ hegemon +``` + +![][10] + +由于 libsensors.so.4 库的问题,我在启动 “Hegemon” 时遇到了一个问题。 + +``` +$ hegemon +error while loading shared libraries: libsensors.so.4: cannot open shared object file: No such file or directory manjaro +``` + +我使用的是 Manjaro 18.04。它存在 libsensors.so 和 libsensors.so.5 共享库,而没有 libsensors.so.4。所以,我刚刚创建了以下符号链接来解决问题。 + +``` +$ sudo ln -s /usr/lib/libsensors.so /usr/lib/libsensors.so.4 +``` + +这是从我的 Lenovo-Y700 笔记本中截取的示例 gif。 +![][11] + +默认它仅显示总体摘要,如果你想查看详细输出,则需要展开每个部分。使用 Hegemon 查看展开内容。 +![][12] + +-------------------------------------------------------------------------------- + +via: https://www.2daygeek.com/hegemon-a-modular-system-and-hardware-monitoring-tool-for-linux/ + +作者:[Magesh Maruthamuthu][a] +选题:[lujun9972][b] +译者:[geekpi](https://github.com/geekpi) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.2daygeek.com/author/magesh/ +[b]: https://github.com/lujun9972 +[1]: https://www.2daygeek.com/top-command-examples-to-monitor-server-performance/ +[2]: https://www.2daygeek.com/linux-htop-command-linux-system-performance-resource-monitoring-tool/ +[3]: https://www.2daygeek.com/view-check-cpu-hard-disk-temperature-linux/ +[4]: https://www.2daygeek.com/s-tui-stress-terminal-ui-monitor-linux-cpu-temperature-frequency/ +[5]: https://www.2daygeek.com/apt-get-apt-cache-command-examples-manage-packages-debian-ubuntu-systems/ +[6]: https://www.2daygeek.com/apt-command-examples-manage-packages-debian-ubuntu-systems/ +[7]: https://www.2daygeek.com/dnf-command-examples-manage-packages-fedora-system/ +[8]: https://www.2daygeek.com/how-to-install-rust-programming-language-in-linux/ +[9]: data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7 +[10]: https://www.2daygeek.com/wp-content/uploads/2019/01/hegemon-a-modular-system-and-hardware-monitoring-tool-for-linux-1.png +[11]: https://www.2daygeek.com/wp-content/uploads/2019/01/hegemon-a-modular-system-and-hardware-monitoring-tool-for-linux-2a.gif +[12]: https://www.2daygeek.com/wp-content/uploads/2019/01/hegemon-a-modular-system-and-hardware-monitoring-tool-for-linux-3.png From 13b6b3f25df10c44bc5dcc8b8ec61fa76dead1c5 Mon Sep 17 00:00:00 2001 From: geekpi Date: Wed, 30 Jan 2019 09:20:35 +0800 Subject: [PATCH 211/243] translating --- ...Tron-influenced terminal program for tablets and desktops.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20190127 Get started with eDEX-UI, a Tron-influenced terminal program for tablets and desktops.md b/sources/tech/20190127 Get started with eDEX-UI, a Tron-influenced terminal program for tablets and desktops.md index f181f4ebd1..78f31a6b94 100644 --- a/sources/tech/20190127 Get started with eDEX-UI, a Tron-influenced terminal program for tablets and desktops.md +++ b/sources/tech/20190127 Get started with eDEX-UI, a Tron-influenced terminal program for tablets and desktops.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (geekpi) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 00deeb2367d702173592d8a3df52d041e08e203e Mon Sep 17 00:00:00 2001 From: HankChow <280630620@qq.com> Date: Wed, 30 Jan 2019 09:29:55 +0800 Subject: [PATCH 212/243] hankchow translating --- sources/tech/20190124 Understanding Angle Brackets in Bash.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20190124 Understanding Angle Brackets in Bash.md b/sources/tech/20190124 Understanding Angle Brackets in Bash.md index bd9a3782fb..063eec3fd0 100644 --- a/sources/tech/20190124 Understanding Angle Brackets in Bash.md +++ b/sources/tech/20190124 Understanding Angle Brackets in Bash.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (HankChow) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 0727e429656262101a842cfddcd00cf4fb80c16c Mon Sep 17 00:00:00 2001 From: dianbanjiu Date: Wed, 30 Jan 2019 15:01:30 +0800 Subject: [PATCH 213/243] translated --- ...u monitor activity on your Linux server.md | 156 ----------------- ...u monitor activity on your Linux server.md | 157 ++++++++++++++++++ 2 files changed, 157 insertions(+), 156 deletions(-) delete mode 100644 sources/tech/20190123 Commands to help you monitor activity on your Linux server.md create mode 100644 translated/tech/20190123 Commands to help you monitor activity on your Linux server.md diff --git a/sources/tech/20190123 Commands to help you monitor activity on your Linux server.md b/sources/tech/20190123 Commands to help you monitor activity on your Linux server.md deleted file mode 100644 index c2a95d7ec2..0000000000 --- a/sources/tech/20190123 Commands to help you monitor activity on your Linux server.md +++ /dev/null @@ -1,156 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (dianbanjiu ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Commands to help you monitor activity on your Linux server) -[#]: via: (https://www.networkworld.com/article/3335200/linux/how-to-monitor-activity-on-your-linux-server.html) -[#]: author: (Sandra Henry-Stocker https://www.networkworld.com/author/Sandra-Henry_Stocker/) - -Commands to help you monitor activity on your Linux server -====== -The watch, top, and ac commands provide some effective ways to oversee what is happening on your Linux servers. - -![](https://images.idgesg.net/images/article/2019/01/owl-face-100785829-large.jpg) - -Linux systems provide a number of commands that make it easy to report on system activity. In this post, we're going to look at several commands that are especially helpful. - -### The watch command - -The **watch** command is one that makes it easy to repeatedly examine a variety of data on your system — user activities, running processes, logins, memory usage, etc. All the command really does is run the command that you specify repeatedly, each time overwriting the previously displayed output, but this lends itself to a very convenient way of monitoring what's happening on your system. - -To start with a very basic and not particularly useful command, you could run **watch -n 5 date** and see a display with the current date and time that updates every 5 seconds. As you likely have guessed, the **-n 5** option specifies the number of seconds to wait between each run of the command. The default is 2 seconds. The command will run and update a display like this until you stop it with a ^c. - -``` -Every 5.0s: date butterfly: Wed Jan 23 15:59:14 2019 - -Wed Jan 23 15:59:14 EST 2019 -``` - -As a more interesting command example, you can watch an updated list of whoever is logging into the server. As written, this command will update every 10 seconds. Users who log out will disappear from the current display and those who log in will come into view. If no one is logging in or out, the display will remain the same except for the time displayed. - -``` -$ watch -n 10 who - -Every 10.0s: who butterfly: Tue Jan 23 16:02:03 2019 - -shs :0 2019-01-23 09:45 (:0) -dory pts/0 2019-01-23 15:50 (192.168.0.5) -nemo pts/1 2019-01-23 16:01 (192.168.0.15) -shark pts/3 2019-01-23 11:11 (192.168.0.27) -``` - -If you just want to see how many users are logged in, you can get a user count along with load averages showing you how hard the system is working by having watch call the **uptime** command. - -``` -$ watch uptime - -Every 2.0s: uptime butterfly: Tue Jan 23 16:25:48 2019 - - 16:25:48 up 22 days, 4:38, 3 users, load average: 1.15, 0.89, 1.02 -``` - -If you want to use watch to repeat a command that includes a pipe, you need to put the command between quote marks like this command that every 5 seconds shows you how many processes are running: - -``` -$ watch -n 5 'ps -ef | wc -l' - -Every 5.0s: ps -ef | wc -l butterfly: Tue Jan 23 16:11:54 2019 - -245 -``` - -To watch memory usage, you might try a command like this one: - -``` -$ watch -n 5 free -m - -Every 5.0s: free -m butterfly: Tue Jan 23 16:34:09 2019 - - total used free shared buff/cache available -Mem: 5959 776 3276 12 1906 4878 -Swap: 2047 0 2047 -``` - -You could watch processes being run by one particular user with **watch,** but the **top** command provides a much better option. - -### The top command - -If you want to watch one particular user's processes, top has an ideal option for you — the -u option: - -``` -$ top -u nemo -top - 16:14:33 up 2 days, 4:27, 3 users, load average: 0.00, 0.01, 0.02 -Tasks: 199 total, 1 running, 198 sleeping, 0 stopped, 0 zombie -%Cpu(s): 0.0 us, 0.2 sy, 0.0 ni, 99.8 id, 0.0 wa, 0.0 hi, 0.0 si, 0.0 st -MiB Mem : 5959.4 total, 3277.3 free, 776.4 used, 1905.8 buff/cache -MiB Swap: 2048.0 total, 2048.0 free, 0.0 used. 4878.4 avail Mem - - PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND -23026 nemo 20 0 46340 7820 6504 S 0.0 0.1 0:00.05 systemd -23033 nemo 20 0 149660 3140 72 S 0.0 0.1 0:00.00 (sd-pam) -23125 nemo 20 0 63396 5100 4092 S 0.0 0.1 0:00.00 sshd -23128 nemo 20 0 16836 5636 4284 S 0.0 0.1 0:00.03 zsh -``` - -You not only see what processes the user is running, but the resources (CPU time and memory) that the process is consuming and how hard the system is working overall. - -### The ac command - -If you'd like to see how much time each of your users is spending logged in, you can make use of the **ac** command. This requires installation of the **acct** (Debian) or **psacct** (RHEL, Centos, etc.) package. - -The **ac** command has a number of options, but it pulls its data from the current **wtmp** file. Here's an example showing the total number of hours users were logged in recently: - -``` -$ ac - total 1261.72 -``` - -This command shows total hours by user: - -``` -$ ac -p - shark 5.24 - nemo 5.52 - shs 1251.00 - total 1261.76 -``` - -This ac command shows daily counts of how many hours users were logged in: - -``` -$ ac -d | tail -10 - -Jan 11 total 0.05 -Jan 12 total 1.36 -Jan 13 total 16.39 -Jan 15 total 55.33 -Jan 16 total 38.02 -Jan 17 total 28.51 -Jan 19 total 48.66 -Jan 20 total 1.37 -Jan 22 total 23.48 -Today total 9.83 -``` - -### Wrap-up - -There are many commands for examining system activity. The **watch** command allows you to run just about any command in a repetitive way and watch how the output changes. The **top** command is a better option for focusing on user processes and also loops in a way that allows you to see the changes as they happen, while the **ac** command examines user connect time. - -Join the Network World communities on [Facebook][1] and [LinkedIn][2] to comment on topics that are top of mind. - --------------------------------------------------------------------------------- - -via: https://www.networkworld.com/article/3335200/linux/how-to-monitor-activity-on-your-linux-server.html - -作者:[Sandra Henry-Stocker][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://www.networkworld.com/author/Sandra-Henry_Stocker/ -[b]: https://github.com/lujun9972 -[1]: https://www.facebook.com/NetworkWorld/ -[2]: https://www.linkedin.com/company/network-world diff --git a/translated/tech/20190123 Commands to help you monitor activity on your Linux server.md b/translated/tech/20190123 Commands to help you monitor activity on your Linux server.md new file mode 100644 index 0000000000..3c0e44a946 --- /dev/null +++ b/translated/tech/20190123 Commands to help you monitor activity on your Linux server.md @@ -0,0 +1,157 @@ +[#]: collector: (lujun9972) +[#]: translator: (dianbanjiu ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Commands to help you monitor activity on your Linux server) +[#]: via: (https://www.networkworld.com/article/3335200/linux/how-to-monitor-activity-on-your-linux-server.html) +[#]: author: (Sandra Henry-Stocker https://www.networkworld.com/author/Sandra-Henry_Stocker/) + +帮你监控你的 Linux 服务器的命令 +====== + +watch、top 和 ac 命令为我们监视 Linux 服务器上的活动提供了一些十分高效的途径。 + +![](https://images.idgesg.net/images/article/2019/01/owl-face-100785829-large.jpg) + +为了在获取系统活动时更加轻松,Linux 系统提供了一系列相关的命令。在这篇文章中,我们就一起来看看这些对我们很有帮助的命令吧。 + +### watch 命令 + +**watch** 是一个使得重复检测 Linux 系统中一系列数据,例如用户活动、正在运行进程、登录、内存使用等更加容易的命令。这个命令实际上是重复地运行一个特定的命令,每次都会重写之前显示的输出,它提供了一个比较方便的方式用以监测在你的系统中发生的活动。 + +首先以一个基础且不是特别有用的命令开始,你可以运行 `watch -n 5 date`,然后你可以看到在终端中显示了当前的日期和时间,这些数据会每五秒更新一次。你可能已经猜到了,**-n 5** 选项指定了运行接下来一次命令需要等待的秒数。默认是 2 秒。这个命令将会一直运行并按照指定的时间更新显示,直到你使用 ^C 停下它。 + +``` +Every 5.0s: date butterfly: Wed Jan 23 15:59:14 2019 + +Wed Jan 23 15:59:14 EST 2019 +``` + +下面是一个很有趣的命令实例,你可以监控一个在服务器中登录用户的列表,该列表会按照指定的时间定时更新。就像下面写到的,这个命令会每 10 秒更新一次这个列表。登出的用户将会从当前显示的列表中消失,那些新登录的将会被添加到这个表格当中。如果没有用户再登录或者登出,这个表格跟之前显示的将不会有任何不同。 + +``` +$ watch -n 10 who + +Every 10.0s: who butterfly: Tue Jan 23 16:02:03 2019 + +shs :0 2019-01-23 09:45 (:0) +dory pts/0 2019-01-23 15:50 (192.168.0.5) +nemo pts/1 2019-01-23 16:01 (192.168.0.15) +shark pts/3 2019-01-23 11:11 (192.168.0.27) +``` + +如果你只是想看有多少用户登录过,可以通过 watch 调用 **uptime** 命令获取用户数和负载的平均水平,以及系统的工作状况。 + +``` +$ watch uptime + +Every 2.0s: uptime butterfly: Tue Jan 23 16:25:48 2019 + + 16:25:48 up 22 days, 4:38, 3 users, load average: 1.15, 0.89, 1.02 +``` + +如果你想使用 watch 重复一个包含了管道的命令,就需要将该命令用引号括起来,就比如下面这个每五秒显示一次有多少进程正在运行的命令。 + +``` +$ watch -n 5 'ps -ef | wc -l' + +Every 5.0s: ps -ef | wc -l butterfly: Tue Jan 23 16:11:54 2019 + +245 +``` + +要查看内存使用,你也许会想要试一下下面的这个命令组合: + +``` +$ watch -n 5 free -m + +Every 5.0s: free -m butterfly: Tue Jan 23 16:34:09 2019 + + total used free shared buff/cache available +Mem: 5959 776 3276 12 1906 4878 +Swap: 2047 0 2047 +``` + +你可以在 **watch** 后添加一些选项查看某个特定用户下运行的进程,不过 **top** 为此提供了更好的选择。 + +### top 命令 + +如果你想查看某个特定用户下的进程,top 命令的 `-u` 选项可以很轻松地帮你达到这个目的。 + +``` +$ top -u nemo +top - 16:14:33 up 2 days, 4:27, 3 users, load average: 0.00, 0.01, 0.02 +Tasks: 199 total, 1 running, 198 sleeping, 0 stopped, 0 zombie +%Cpu(s): 0.0 us, 0.2 sy, 0.0 ni, 99.8 id, 0.0 wa, 0.0 hi, 0.0 si, 0.0 st +MiB Mem : 5959.4 total, 3277.3 free, 776.4 used, 1905.8 buff/cache +MiB Swap: 2048.0 total, 2048.0 free, 0.0 used. 4878.4 avail Mem + + PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND +23026 nemo 20 0 46340 7820 6504 S 0.0 0.1 0:00.05 systemd +23033 nemo 20 0 149660 3140 72 S 0.0 0.1 0:00.00 (sd-pam) +23125 nemo 20 0 63396 5100 4092 S 0.0 0.1 0:00.00 sshd +23128 nemo 20 0 16836 5636 4284 S 0.0 0.1 0:00.03 zsh +``` + +你可能不仅可以看到某个用户下的进程,还可以查看每个进程所占用的资源,以及系统总的工作状况。 + +### ac 命令 + +如果你想查看系统中每个用户登录的时长,可以使用 **ac** 命令。运行该命令之前首先需要安装 **acct**(Debian 等) 或者 **psacct**(RHEL、Centos 等) 包。 + +**ac** 命令有一系列的选项,该命令从 **wtmp** 文件中拉取数据。这个例子展示的是最近用户登录的总小时数。 + +``` +$ ac + total 1261.72 +``` + +这个命令显示了用户登录的总的小时数: + +``` +$ ac -p + shark 5.24 + nemo 5.52 + shs 1251.00 + total 1261.76 +``` + +这个命令显示了用户每天登录的小时数: + +``` +$ ac -d | tail -10 + +Jan 11 total 0.05 +Jan 12 total 1.36 +Jan 13 total 16.39 +Jan 15 total 55.33 +Jan 16 total 38.02 +Jan 17 total 28.51 +Jan 19 total 48.66 +Jan 20 total 1.37 +Jan 22 total 23.48 +Today total 9.83 +``` + +### 总结 + +Linux 系统上有很多命令可以用于检查系统活动。**watch** 命令允许你以重复的方式运行任何命令,并观察输出有何变化。**top** 命令是一个专注于用户进程的最佳选项,以及允许你以动态方式查看进程的变化,还可以使用 **ac** 命令检查用户连接到系统的时间。 + +加入 [Facebook][1] 和 [LinkedIn][2] 上的 Network World 社区,来交流更多有用的主题。 + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3335200/linux/how-to-monitor-activity-on-your-linux-server.html + +作者:[Sandra Henry-Stocker][a] +选题:[lujun9972][b] +译者:[dianbanjiu](https://github.com/dianbanjiu) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.networkworld.com/author/Sandra-Henry_Stocker/ +[b]: https://github.com/lujun9972 +[1]: https://www.facebook.com/NetworkWorld/ +[2]: https://www.linkedin.com/company/network-world From fafa7cf025301f5bcae7cc5a38dc6399a597a06c Mon Sep 17 00:00:00 2001 From: dianbanjiu Date: Wed, 30 Jan 2019 15:07:14 +0800 Subject: [PATCH 214/243] translated --- ...ommands to help you monitor activity on your Linux server.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/translated/tech/20190123 Commands to help you monitor activity on your Linux server.md b/translated/tech/20190123 Commands to help you monitor activity on your Linux server.md index 3c0e44a946..394b553d13 100644 --- a/translated/tech/20190123 Commands to help you monitor activity on your Linux server.md +++ b/translated/tech/20190123 Commands to help you monitor activity on your Linux server.md @@ -7,7 +7,7 @@ [#]: via: (https://www.networkworld.com/article/3335200/linux/how-to-monitor-activity-on-your-linux-server.html) [#]: author: (Sandra Henry-Stocker https://www.networkworld.com/author/Sandra-Henry_Stocker/) -帮你监控你的 Linux 服务器的命令 +监控 Linux 服务器的几个常用命令 ====== watch、top 和 ac 命令为我们监视 Linux 服务器上的活动提供了一些十分高效的途径。 From d83e4d3970e055a7b2cf4ed555b90280c476863f Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Wed, 30 Jan 2019 17:51:37 +0800 Subject: [PATCH 215/243] PRF:20181219 How to open source your Python library.md @geekpi --- ... How to open source your Python library.md | 55 +++++++++---------- 1 file changed, 27 insertions(+), 28 deletions(-) diff --git a/translated/tech/20181219 How to open source your Python library.md b/translated/tech/20181219 How to open source your Python library.md index 7c4a2d3f25..8569db33c1 100644 --- a/translated/tech/20181219 How to open source your Python library.md +++ b/translated/tech/20181219 How to open source your Python library.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (How to open source your Python library) @@ -9,45 +9,44 @@ 如何开源你的 Python 库 ====== -这 12 个步骤能确保成功发布。 + +> 这 12 个步骤能确保成功发布。 + ![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/button_push_open_keyboard_file_organize.png?itok=KlAsk1gx) -你写了一个 Python 库。我觉着这太棒了!如果让人们能够轻松使用它不是很优雅么?这有一个需要考虑的清单,以及在开源 Python 库时要采取的具体步骤。 +你写了一个 Python 库。自己觉着这太棒了!如果让人们能够轻松使用它不是很优雅么?这有一个需要考虑的清单,以及在开源 Python 库时要采取的具体步骤。 -### 1\. 源码 +### 1、源码 将代码放在 [GitHub][1] 上,这里有很多开源项目,并且人们很容易提交拉取请求。 -### 2\. 许可证 - -选择一个开源许可证。默认的一个不错的,宽容的是 [MIT 许可][2]。如果你有特定要求,Creative Common 的[选择许可][3]可以指导你完成其他选择。最重要的是,在选择许可时要记住三条规则: +### 2、许可证 +选择一个开源许可证。一般来说 [MIT 许可证][2]是一个挺好的宽容许可证。如果你有特定要求,Creative Common 的[选择许可证][3]可以指导你完成其它选择。最重要的是,在选择许可证时要记住三条规则: * 不要创建自己的许可证。 * 不要创建自己的许可证。 * 不要创建自己的许可证。 +### 3、README - -### 3\. README - -将一个名为 README.rst 的文件(使用 ReStructured Text 格式化)放在项目树的顶层。 +将一个名为 `README.rst` 的文件(使用 ReStructured Text 格式化)放在项目树的顶层。 GitHub 将像 Markdown 一样渲染 ReStructured Text,而 ReST 在 Python 的文档生态系统中的表现更好。 -### 4\. 测试 +### 4、测试 写测试。这对你来说没有用处。但对于想要编写避免破坏相关功能的补丁的人来说,它非常有用。 测试可帮助协作者进行协作。 -通常情况下,如果可以用 [**pytest**][4] 运行就最好了。还有其他测试工具 - 但很少有理由去使用它们。 +通常情况下,如果可以用 [pytest][4] 运行就最好了。还有其他测试工具 —— 但很少有理由去使用它们。 -### 5\. 样式 +### 5、样式 -使用 linter 制定样式:PyLint、Flake8 或者带上 **\--check** 的 Black 。除非你使用Black,否则请确保在下载源代码文件中指定配置选项。 +使用 linter 制定样式:PyLint、Flake8 或者带上 `--check` 的 Black 。除非你使用 Black,否则请确保在一个文件中指定配置选项,并签入到版本控制系统中。 -### 6\. API 文档 +### 6、API 文档 使用 docstrings 来记录模块、函数、类和方法。 @@ -55,33 +54,33 @@ GitHub 将像 Markdown 一样渲染 ReStructured Text,而 ReST 在 Python 的 Sphinx 可以同时处理 Google 风格和 ReST 的 docstrings,以将零散的文档集成为 API 文档。 -### 7\. 零散文档 +### 7、零散文档 使用 [Sphinx][7]。(阅读[我们这篇文章][8]。)教程很有用,但同样重要的是要指明这是什么、它有什么好处、它有什么坏处、以及任何特殊的考虑因素。 -### 8\. 构建 +### 8、构建 -使用 **tox** 或 **nox** 自动运行测试、linter 并构建文档。这些工具支持“依赖矩阵”。这些矩阵往往会快速增长,但你可以尝试针对合理的样本进行测试,例如 Python 版本、依赖项版本以及可能安装的可选依赖项。 +使用 tox 或 nox 自动运行测试和 linter,并构建文档。这些工具支持“依赖矩阵”。这些矩阵往往会快速增长,但你可以尝试针对合理的样本进行测试,例如 Python 版本、依赖项版本以及可能安装的可选依赖项。 -### 9\. 打包 +### 9、打包 -使用 [setuptools][9] 工具。写一个 **setup.py** 和一个 **setup.cfg**。如果同时支持 Python 2 和 3,请在 **setup.cfg** 中指定 universal wheel。 +使用 [setuptools][9] 工具。写一个 `setup.py` 和一个 `setup.cfg`。如果同时支持 Python 2 和 3,请在 `setup.cfg` 中指定 universal 格式的 wheel。 -**tox** 或 **nox** 应该做的一件事是构建 wheel 并对已安装的 wheel 进行测试。 +tox 或 nox 应该做的一件事是构建 wheel 并对已安装的 wheel 进行测试。 避免使用 C 扩展。如果出于性能或绑定的原因一定需要它们,请将它们放在单独的包中。正确打包 C 扩展可以写一篇新的文章。这里有很多问题! -### 10\. 持续集成 +### 10、持续集成 -使用公共持续工具。[TravisCI][10] and [CircleCI][11] 为开源项目提供免费套餐。将 GitHub 或其他仓库配置为在合并拉请求之前需要先通过检查, 那么你就不必担心在代码评审中告知用户修复测试或样式。 +使用公共持续工具。[TravisCI][10] 和 [CircleCI][11] 为开源项目提供免费套餐。将 GitHub 或其他仓库配置为在合并拉请求之前需要先通过检查,那么你就不必担心在代码评审中告知用户修复测试或样式。 -### 11\. 版本 +### 11、版本 使用 [SemVer][12] 或 [CalVer][13]。有许多工具可以帮助你管理版本:[incremental][14]、[bumpversion][15] 和 [setuptools_scm][16] 等都是 PyPI 上的包,都可以帮助你管理版本。 -### 12\. 发布 +### 12、发布 -通过运行 **tox** 或 **nox** 并使用 **twine** 将文件上传到 PyPI 上发布。你可以通过在 [DevPI][17] 中“测试上传”。 +通过运行 tox 或 nox 并使用 twine 将文件上传到 PyPI 上发布。你可以通过在 [DevPI][17] 中“测试上传”。 -------------------------------------------------------------------------------- @@ -90,7 +89,7 @@ via: https://opensource.com/article/18/12/tips-open-sourcing-python-libraries 作者:[Moshe Zadka][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/) 荣誉推出 From a339e75ac9863a0e4c7cfacf7047d3a50dadb7ca Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Wed, 30 Jan 2019 17:53:24 +0800 Subject: [PATCH 216/243] PUB:20181219 How to open source your Python library.md @geekpi https://linux.cn/article-10491-1.html --- .../20181219 How to open source your Python library.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20181219 How to open source your Python library.md (98%) diff --git a/translated/tech/20181219 How to open source your Python library.md b/published/20181219 How to open source your Python library.md similarity index 98% rename from translated/tech/20181219 How to open source your Python library.md rename to published/20181219 How to open source your Python library.md index 8569db33c1..e21eaeedb8 100644 --- a/translated/tech/20181219 How to open source your Python library.md +++ b/published/20181219 How to open source your Python library.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-10491-1.html) [#]: subject: (How to open source your Python library) [#]: via: (https://opensource.com/article/18/12/tips-open-sourcing-python-libraries) [#]: author: (Moshe Zadka https://opensource.com/users/moshez) From c14d0eec4400351d1fdf836da8dbe5b802c6f11a Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Wed, 30 Jan 2019 18:40:16 +0800 Subject: [PATCH 217/243] PRF:20180814 5 open source strategy and simulation games for Linux.md @Scoutydren --- ...strategy and simulation games for Linux.md | 46 ++++++++----------- 1 file changed, 20 insertions(+), 26 deletions(-) diff --git a/translated/tech/20180814 5 open source strategy and simulation games for Linux.md b/translated/tech/20180814 5 open source strategy and simulation games for Linux.md index b7878dd1b6..9666e74c0f 100644 --- a/translated/tech/20180814 5 open source strategy and simulation games for Linux.md +++ b/translated/tech/20180814 5 open source strategy and simulation games for Linux.md @@ -1,73 +1,67 @@ -5款开源的Linux策略模拟游戏 +5 款开源的 Linux 策略模拟游戏 ====== +> 用这些开源游戏来挑战你的战略技能,探索新世界。 + ![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/arcade_game_gaming.jpg?itok=84Rjk_32) -长久以来,游戏都是 Linux 的软肋。近些年,Steam,GOG等游戏发布平台上不少商业游戏都开始支持 Linux,这对于 Linux 的游戏生态来说是件好事,但是我们能在这些平台上玩到的游戏通常是不开源的商业作品。当然,这些游戏在一个开源的操作系统上运行,但对于一个开源提倡者来说这似乎还不够纯粹。 +长久以来,游戏都是 Linux 的软肋。近些年,Steam、GOG 等游戏发布平台上不少商业游戏都开始支持 Linux,这对于 Linux 的游戏生态来说是件好事,但是我们能在这些平台上玩到的游戏通常是不开源的商业作品。当然,这些游戏在一个开源的操作系统上运行,但对于一个开源提倡者来说这似乎还不够纯粹。 -那么,我们能找到既免费开源又能给玩家带来完整游戏体验的优质游戏吗?当然!虽然绝大多数的开源游戏很难和3A 商业游戏大作竞争,但仍然有不少各种类型的开源游戏,不仅内容有趣而且直接可以通过几大 Linux 发行版本库中直接安装。就算某个游戏在不在某个发行版本的库中,我们也可以在这个游戏项目的网站上找到直接的安装方法。 +那么,我们能找到既自由开源又能给玩家带来完整游戏体验的优质游戏吗?当然!虽然绝大多数的开源游戏很难和 3A 商业游戏大作竞争,但仍然有不少各种类型的开源游戏,不仅内容有趣而且直接可以通过几大 Linux 发行版本库中直接安装。就算某个游戏在不在某个发行版本的库中,我们也可以在这个游戏项目的网站上找到直接的安装方法。 -本篇文章将会介绍策略和模拟类游戏。我已经写了街机游戏、桌面卡牌游戏、解谜游戏、竞速飞行游戏以及角色扮演游戏。 +本篇文章将会介绍策略和模拟类游戏。我已经写了[街机游戏][1]、[桌面卡牌游戏][2]、[解谜游戏][3]、[竞速飞行游戏][4]以及[角色扮演游戏][5]。 -### Freeciv 开源“文明” +### 开源版“文明”(Freeciv) ![](https://opensource.com/sites/default/files/uploads/freeciv.png) -[Freeciv][6] 可以被视为是文明系列游戏的开源版本。游戏玩法和文明系列最早期的游戏十分类似, Freeciv 可以让玩家选择选用文明 1 或者文明 2 中的游戏规则设置。Freeciv 中包含了很多元素,例如建造城市、探索世界地图、发展科技以及和其他扩张中的文明竞争。胜利条件包括打败所有其他的文明或建立一个外星殖民地,如果在前两者都没有达成的话,在游戏时间期限前存活下来也可以算作胜利。这个游戏可以和其他玩家联机也可以和 AI 对战,不同的地图集可以改变游戏的外观。 +[Freeciv][6] 可以被视为是[文明系列][7]游戏的开源版本。游戏玩法和文明系列最早期的游戏十分类似,Freeciv 可以让玩家选择选用文明 1 或者文明 2 中的游戏规则设置。Freeciv 中包含了很多元素,例如建造城市、探索世界地图、发展科技以及和其他扩张中的文明竞争。胜利条件包括打败所有其他的文明或建立一个外星殖民地,如果在前两者都没有达成的话,在游戏时间期限前存活下来也可以算作胜利。这个游戏可以和其他玩家联机也可以和 AI 对战,不同的地图集可以改变游戏的外观。 安装 Freeciv,你只需要在终端下运行以下指令。 * Fedora 用户: `dnf install freeciv` - * Debian/Ubuntu 用户:`apt install freeciv` - ### MegaGlest ![](https://opensource.com/sites/default/files/uploads/megaglest.png) -[MegaGlest][8] 是一个开源的实时战略游戏,类似暴雪公司制作的游戏魔兽世界和星际争霸。玩家控制不同派别的人员、建造新建筑、招募士兵、拓展领土并与敌人作战。在游戏比赛的最开始,玩家仅能建造最基础的建筑和招募最基础的士兵。为了建造更高级的建筑并招募级别更高的人员,玩家必须通过增加建筑和人员从而一路提高科技树、解锁更加高级的选项。当敌人进入国土领域之中,战斗单元必须迎战。但是最好的应对策略是,通过控制战斗单元直接操控每一场战斗。在管理新建筑的建立,新人员的招募的同时控制战斗局势听上去十分困难,但是这就是RTS(实时战略游戏)游戏的精华所在。MegaGlest 这个游戏提供了大量的人员派类,玩家可以不断尝试这些不同的技巧。 +[MegaGlest][8] 是一个开源的实时战略游戏,类似暴雪公司制作的游戏[魔兽世界][9]和[星际争霸][10]。玩家控制不同派别的人员、建造新建筑、招募士兵、拓展领土并与敌人作战。在游戏比赛的最开始,玩家仅能建造最基础的建筑和招募最基础的士兵。为了建造更高级的建筑并招募级别更高的人员,玩家必须通过增加建筑和人员从而一路提高科技树、解锁更加高级的选项。当敌人进入国土领域之中,战斗单元将会迎战。但是最好的应对策略是,通过控制战斗单元直接操控每一场战斗。在管理新建筑的建立,新人员的招募的同时控制战斗局势听上去十分困难,但是这就是 RTS(实时战略游戏)游戏的精华所在。MegaGlest 这个游戏提供了大量的人员派别,玩家可以不断尝试这些不同的技巧。 安装 MegaGlest,你只需要在终端下运行以下指令: * Fedora 用户: `dnf install megaglest` * Debian/Ubuntu 用户:`apt install megaglest` - - -### OpenTTD 开源版“运输大亨” +### 开源版“运输大亨”(OpenTTD) ![](https://opensource.com/sites/default/files/uploads/openttd.png) -[OpenTTD][11] (见我们的 [评测][12] )是一个开源实现的 [运输大亨][13] 。该游戏的目的在于创建一个交通运输网络并获得金钱,从而建立更加复杂的运输网络。这个运输网络包括了船只、巴士、火车、货车和飞机。默认的游戏时间在1950和2050之间,玩家的目标就是在规定时间内拿到最高的游戏分数。游戏的最终分数基于很多因素,例如货物运输的数量、玩家所拥有的汽车数量以及他们赚到的钱。 +[OpenTTD][11](见我们的 [评测][12] )是一个开源实现的 [运输大亨][13] 。该游戏的目的在于创建一个交通运输网络并获得金钱,从而建立更加复杂的运输网络。这个运输网络包括了船只、巴士、火车、货车和飞机。默认的游戏时间在 1950 和 2050 之间,玩家的目标就是在规定时间内拿到最高的游戏分数。游戏的最终分数基于很多因素,例如货物运输的数量、玩家所拥有的汽车数量以及他们赚到的钱。 安装 OpenTTD,你只需要在终端运行以下指令: * Fedora 用户: `dnf install openttd` * Debian/Ubuntu 用户 `apt install openttd` - - -### The Battle for Wesnoth 韦诺之战 +### 韦诺之战The Battle for Wesnoth ![](https://opensource.com/sites/default/files/uploads/the_battle_for_wesnoth.png) -[韦诺之战][14] 是目前最完善的开源游戏之一。这个回合制游戏在一个奇幻的故事设定下。游戏在一个六角形网格中进行,各个单元可以互相操作进行战斗。每个类型的单元都有它独特的能力和弱点,因此玩家需要根据这些特点来设计不同的行动。韦诺之战中有很多不同的行动分支,每个行动分支都有它特别的故事线和目标。The 韦诺之战同时也有一个地图编辑器,感兴趣的玩家可以创作自己的地图以及行动分支。 +[韦诺之战][14] 是目前最完善的开源游戏之一。这个回合制游戏在一个奇幻的故事设定下。游戏在一个六角形网格中进行,各个单元可以互相操作进行战斗。每个类型的单元都有它独特的能力和弱点,因此玩家需要根据这些特点来设计不同的行动。韦诺之战中有很多不同的行动分支,每个行动分支都有它特别的故事线和目标。韦诺之战同时也有一个地图编辑器,感兴趣的玩家可以创作自己的地图以及行动分支。 安装韦诺之战,你只需要在终端运行以下指令: - * Fedora 用户: `dnf install wesnoth ` + * Fedora 用户: `dnf install wesnoth` * Debian/Ubuntu 用户: `apt install wesnoth` - - -### UFO: Alien Invasion (UFO:外星入侵) +### UFO:外星入侵UFO: Alien Invasion ![](https://opensource.com/sites/default/files/uploads/ufo_alien_invasion.png) -[UFO: Alien Invasion][15] 是一个开源策略游戏,基于幽浮系列 [X-COM series][20]。 有两个不同的游戏模式: geoscape 和tactical。在 geoscape 模式下,玩家控制大局、管理基地、开发新技术以及掌控整体策略。 在tactical 游戏模式下,玩家控制一群士兵并且以回合制的形式直接迎战外星侵略者。两个游戏模式提供了不同的游戏玩法,两者都需要相当复杂的策略和战术。 +[UFO: Alien Invasion][15] 是一个开源策略游戏,基于 [幽浮系列][20]X-COM。 有两个不同的游戏模式: geoscape 和 tactical。在 geoscape 模式下,玩家控制大局、管理基地、开发新技术以及掌控整体策略。 在 tactical 游戏模式下,玩家控制一群士兵并且以回合制的形式直接迎战外星侵略者。两个游戏模式提供了不同的游戏玩法,两者都需要相当复杂的策略和战术。 -安装 UFO:外星入侵,你只需要在终端下运行以下指令: +安装这个游戏,你只需要在终端下运行以下指令: * Debian/Ubuntu 用户: `apt install ufoai` @@ -81,13 +75,13 @@ via: https://opensource.com/article/18/8/strategy-simulation-games-linux 作者:[Joshua Allen Holm][a] 选题:[lujun9972](https://github.com/lujun9972) -译者:[Scoutydren](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) +译者:[Scoutydren](https://github.com/Scoutydren) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 [a]:https://opensource.com/users/holmja -[1]:https://opensource.com/article/18/1/arcade-games-linux +[1]:https://linux.cn/article-10433-1.html [2]:https://opensource.com/article/18/3/card-board-games-linux [3]:https://opensource.com/article/18/6/puzzle-games-linux [4]:https://opensource.com/article/18/7/racing-flying-games-linux From 641d22173d1ce4db68ac635eb8dc1403f9d0d2d5 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Wed, 30 Jan 2019 18:40:53 +0800 Subject: [PATCH 218/243] PUB:20180814 5 open source strategy and simulation games for Linux.md @Scoutydren https://linux.cn/article-10492-1.html --- ...80814 5 open source strategy and simulation games for Linux.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {translated/tech => published}/20180814 5 open source strategy and simulation games for Linux.md (100%) diff --git a/translated/tech/20180814 5 open source strategy and simulation games for Linux.md b/published/20180814 5 open source strategy and simulation games for Linux.md similarity index 100% rename from translated/tech/20180814 5 open source strategy and simulation games for Linux.md rename to published/20180814 5 open source strategy and simulation games for Linux.md From 5a080a24807595f17608782ebbbb34e06a138af4 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Wed, 30 Jan 2019 21:53:10 +0800 Subject: [PATCH 219/243] PRF:20181016 Final JOS project.md --- published/20181016 Final JOS project.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/published/20181016 Final JOS project.md b/published/20181016 Final JOS project.md index 92b14d8f97..93358e622a 100644 --- a/published/20181016 Final JOS project.md +++ b/published/20181016 Final JOS project.md @@ -1,4 +1,4 @@ -Caffeinated 6.828:实验 6:最终的 JOS 项目 +Caffeinated 6.828:实验 7:最终的 JOS 项目 ====== ### 简介 From 3bca9d4cb3498e8708f7cae244aa50471637d9cc Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Wed, 30 Jan 2019 22:16:47 +0800 Subject: [PATCH 220/243] PRF:20190114 Turn a Raspberry Pi 3B- into a PriTunl VPN.md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @jrglinux 战战兢兢发这篇 @lujun9972 --- ...n a Raspberry Pi 3B- into a PriTunl VPN.md | 36 +++++++++---------- 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/translated/tech/20190114 Turn a Raspberry Pi 3B- into a PriTunl VPN.md b/translated/tech/20190114 Turn a Raspberry Pi 3B- into a PriTunl VPN.md index a610a2cfbd..c39d7ea46a 100644 --- a/translated/tech/20190114 Turn a Raspberry Pi 3B- into a PriTunl VPN.md +++ b/translated/tech/20190114 Turn a Raspberry Pi 3B- into a PriTunl VPN.md @@ -1,32 +1,32 @@ [#]: collector: (lujun9972) [#]: translator: (jrglinux) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Turn a Raspberry Pi 3B+ into a PriTunl VPN) [#]: via: (https://opensource.com/article/19/1/pritunl-vpn-raspberry-pi) [#]: author: (Stephen Bancroft https://opensource.com/users/stevereaver) -将树梅派3B+变为 PriTunl VPN +将树莓派 3B+ 变为 PriTunl VPN ====== -PriTunl 是一种 VPN 解决方案,适用于希望私密的访问其网络的小型企业和个人。 + +> PriTunl 是一种 VPN 解决方案,适用于希望私密的访问其网络的小型企业和个人。 ![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/life-raspberrypi_0.png?itok=Kczz87J2) -[PriTunl][1] 是一款出色的 VPN 终端解决方案,非常适合希望以简单快捷的方式私密的访问网络的小型企业和个人。 它是开源的,基本的免费版本涵盖最通用的简单的实例,足以让你快速入门。 也有集成 Active Directory 等高级功能的付费企业版 +[PriTunl][1] 是一款出色的 VPN 终端解决方案,非常适合希望以简单快捷的方式私密的访问网络的小型企业和个人。它是开源的,基本的免费版本涵盖最通用的简单的实例,足以让你快速入门。也有集成了活动目录等高级功能的付费企业版。 -### 有关树梅派3B+的特别注意事项 +### 有关树莓派 3B+ 的特别注意事项 -PriTunl 的安装通常也很简单,但要在树梅派3B+上安装 PriTunl 有点小复杂。比如,PriTunl 只提供了 AMD64 和 i386 架构的二进制文件,但树梅派3B+是 ARM 架构的,这意味着需要从源码自行编译可用于树梅派3B+的 PriTunl 可执行文件。不过,无需担心,编译过程很简单,只需花一点时间执行几行命令即可。 +PriTunl 的安装通常也很简单,但要在树莓派 3B+ 上安装 PriTunl 有点小复杂。比如,PriTunl 只提供了 AMD64 和 i386 架构的二进制文件,但树莓派 3B+ 是 ARM 架构的,这意味着需要从源码自行编译可用于树莓派 3B+ 的 PriTunl 可执行文件。不过,无需担心,编译过程很简单,只需花一点时间执行几行命令即可。 -另一个问题:PriTunl 好像必须要是64位处理器架构,当我在32位操作系统上尝试编译的时候报错了。但幸运的是,用于 ARM64 架构的 Ubuntu 18.04 测试版本可以安装在树梅派3B+上。 - -同样,树梅派3B+需要和其他树梅派不同的引导程序。需要一组小复杂的命令来安装更新树梅派3B+上必要的组件。 +另一个问题:PriTunl 好像必须要是 64 位处理器架构,当我在 32 位操作系统上尝试编译的时候报错了。但幸运的是,用于 ARM64 架构的 Ubuntu 18.04 测试版本可以安装在树莓派 3B+ 上。 +同样,树莓派 3B+ 需要和其他树莓派不同的引导程序。需要一组小复杂的命令来安装更新树莓派 3B+ 上必要的组件。 ### 安装 PriTunl -你可以先在树梅派3B+上安装64位的操作系统来避免下面这些问题。此处需要一些必要的基础知识如在树梅派上执行命令行。 +你可以先在树莓派 3B+ 上安装 64 位的操作系统来避免下面这些问题。此处需要一些必要的基础知识如在树莓派上执行命令行。 打开终端,用如下命令下载 Ubuntu 18.04 用于 ARM64 架构的测试版: @@ -40,25 +40,25 @@ $ wget http://cdimage.ubuntu.com/releases/18.04/beta/ubuntu-18.04-beta-preinstal $ xz -d ubuntu-18.04-beta-preinstalled-server-arm64+raspi3.xz ``` -将准备好的 SD 卡插入电脑读卡槽,电脑会为 SD 卡分配一个驱动分配器号,例如 **/dev/sda** 或者 **/dev/sdb**。 输入命令 **dmesg** 然后观察屏幕上的最后几行找到 SD 卡的驱动分配器。 +将准备好的 SD 卡插入电脑读卡槽,电脑会为 SD 卡分配一个驱动分配器号,例如 `/dev/sda` 或者 `/dev/sdb`。 输入命令 `dmesg` 然后观察屏幕上的最后几行找到 SD 卡的驱动分配器。 -**下一步小心操作,如果搞错了驱动分配器号,可能会破坏你的系统** +**下一步小心操作,如果搞错了驱动分配器号,可能会破坏你的系统。** -用如下命令往 SD 卡中写入数据,将其中的 **** 替换成你的 SD 驱动器号。 +用如下命令往 SD 卡中写入数据,将其中的 `` 替换成你的 SD 驱动器号。 ``` $ dd if=ubuntu-18.04-beta-preinstalled-server-arm64+raspi3.img of= bs=8M ``` -完成上一步之后,将 SD 卡插入树梅派3B+,并启动它。确保树梅派3B+是连网的,然后登陆系统,用户名/密码:ubuntu/ubuntu。 +完成上一步之后,将 SD 卡插入树莓派 3B+ ,并启动它。确保树莓派 3B+ 是连网的,然后登录系统,用户名/密码:`ubuntu` / `ubuntu`。 -在树梅派上输入以下命令以安装一些准备编译PriTunl的东西: +在树莓派上输入以下命令以安装一些编译 PriTunl 所需的包: ``` $ sudo apt-get -y install build-essential git bzr python python-dev python-pip net-tools openvpn bridge-utils psmisc golang-go libffi-dev mongodb ``` -和 PriTunl 标准源码上的 [安装说明][2] 有一点不一样。确保已经登录进树梅派然后切换到管理员账户: +和 PriTunl 标准源码上的 [安装说明][2] 有一点不一样。确保已经登录进树莓派然后切换到管理员账户: ``` $ sudo su - @@ -86,7 +86,7 @@ pip install -r requirements.txt python2 setup.py install --prefix=/usr/local ``` -现在,不出意外的话应该可以启动 MongoDB 和 PriTunl 系统单元了。假如现在还是以管理员账户登录的话,输入: +现在,不出意外的话应该可以启动 MongoDB 和 PriTunl 的 systemd 单元了。假如现在还是以管理员账户登录的话,输入: ``` systemctl daemon-reload @@ -103,7 +103,7 @@ via: https://opensource.com/article/19/1/pritunl-vpn-raspberry-pi 作者:[Stephen Bancroft][a] 选题:[lujun9972][b] 译者:[jrg](https://github.com/jrglinux) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 55f7e7609fb25f874b8b536388266e6fa7213c57 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Wed, 30 Jan 2019 22:17:20 +0800 Subject: [PATCH 221/243] PUB:20190114 Turn a Raspberry Pi 3B- into a PriTunl VPN.md @jrglinux https://linux.cn/article-10493-1.html --- .../20190114 Turn a Raspberry Pi 3B- into a PriTunl VPN.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20190114 Turn a Raspberry Pi 3B- into a PriTunl VPN.md (98%) diff --git a/translated/tech/20190114 Turn a Raspberry Pi 3B- into a PriTunl VPN.md b/published/20190114 Turn a Raspberry Pi 3B- into a PriTunl VPN.md similarity index 98% rename from translated/tech/20190114 Turn a Raspberry Pi 3B- into a PriTunl VPN.md rename to published/20190114 Turn a Raspberry Pi 3B- into a PriTunl VPN.md index c39d7ea46a..9baed49a1e 100644 --- a/translated/tech/20190114 Turn a Raspberry Pi 3B- into a PriTunl VPN.md +++ b/published/20190114 Turn a Raspberry Pi 3B- into a PriTunl VPN.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (jrglinux) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-10493-1.html) [#]: subject: (Turn a Raspberry Pi 3B+ into a PriTunl VPN) [#]: via: (https://opensource.com/article/19/1/pritunl-vpn-raspberry-pi) [#]: author: (Stephen Bancroft https://opensource.com/users/stevereaver) From ed682e17f3914a6d8e4e04fafc1da2219fd69a66 Mon Sep 17 00:00:00 2001 From: MjSeven Date: Wed, 30 Jan 2019 22:40:55 +0800 Subject: [PATCH 222/243] =?UTF-8?q?=E7=BF=BB=E8=AF=91=E5=AE=8C=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...iday calendar at the Linux command line.md | 35 ++++++++++--------- 1 file changed, 18 insertions(+), 17 deletions(-) rename {sources => translated}/tech/20181207 Plan your own holiday calendar at the Linux command line.md (62%) diff --git a/sources/tech/20181207 Plan your own holiday calendar at the Linux command line.md b/translated/tech/20181207 Plan your own holiday calendar at the Linux command line.md similarity index 62% rename from sources/tech/20181207 Plan your own holiday calendar at the Linux command line.md rename to translated/tech/20181207 Plan your own holiday calendar at the Linux command line.md index 9188914bbb..6d959d7339 100644 --- a/sources/tech/20181207 Plan your own holiday calendar at the Linux command line.md +++ b/translated/tech/20181207 Plan your own holiday calendar at the Linux command line.md @@ -7,18 +7,18 @@ [#]: via: (https://opensource.com/article/18/12/linux-toy-cal) [#]: author: (Jason Baker https://opensource.com/users/jason-baker) -Plan your own holiday calendar at the Linux command line +在 Linux 命令行中规划你的假期日历 ====== -Link commands together to build a colorful calendar, and then whisk it away in a snowstorm. +将命令链接在一起,构建一个彩色日历,然后在暴风雪中将其拂去。 ![](https://opensource.com/sites/default/files/styles/image-full-size/public/uploads/linux-toy-cal.png?itok=S0F8RY9k) -Welcome to today's installment of the Linux command-line toys advent calendar. If this is your first visit to the series, you might be asking yourself, what’s a command-line toy. Even I'm not quite sure, but generally, it could be a game or any simple diversion that helps you have fun at the terminal. +欢迎阅读今天推出的 Linux 命令行玩具降临日历。如果这是你第一次访问本系列,你可能会问:什么是命令行玩具。即使我不太确定,但一般来说,它可以是一个游戏或任何简单的娱乐,可以帮助你在终端玩得开心。 -It's quite possible that some of you will have seen various selections from our calendar before, but we hope there’s at least one new thing for everyone. +很可能你们中的一些人之前已经看过我们日历上的各种选择,但我们希望给每个人至少一件新东西。 -We've somehow made it to the seventh day of our series without creating an actual calendar to celebrate with, so let's use a command-line tool to do that today: **cal**. By itself, **cal** is perhaps not the most amazing of tools, but we can use a few other utilities to spice it up a bit. +我们在没有创建实际日历的情况下完成了本系列的第 7 天,所以今天让我们使用命令行工具来做到这一点:**cal**。就其本身而言,**cal** 可能不是最令人惊奇的工具,但我们可以使用其它一些实用程序来为它增添一些趣味。 -Chances are, **cal** is installed on your system already. To use it in this instance, just type **cal**. +很可能,你的系统上已经安装了 **cal**。要使用它,只需要输入 **cal** 即可。 ``` $ cal @@ -32,9 +32,10 @@ Su Mo Tu We Th Fr Sa 30 31           ``` -We aren't going to go into advanced usage in this article, so if you want to learn more about **cal** , go check out Opensource.com Community Moderator Don Watkin's excellent [overview of the date and cal commands][1]. +我们不打算在本文中深入介绍高级用法,因此如果你想了解有关 **cal** 的更多信息,查看 Opensouce.com 社区版主 Don Watkin 的优秀文章 [date 和 cal 命令概述][1]。 + +现在,让我们用一个漂亮的盒子来为它增添趣味,就像我们在上一篇 Linux 玩具文章中介绍的那样。我将使用钻石块,用一点内边距来对齐。 -Now, let's spice it up with a pretty box, as we covered in our previous Linux toy article. I'll use the diamonds box, and use a little bit of padding to get it nicely aligned. ``` $ cal | boxes -d diamonds -p a1l4t2  @@ -60,7 +61,7 @@ $ cal | boxes -d diamonds -p a1l4t2         \/          \/          \/ ``` -That looks nice, but for good measure, let's put the whole thing in a second box, just for fun. We'll use the scoll design this time. +看起来很不错,但是为了好的测量,让我们把整个东西放到另一个盒子里,为了好玩,这次我们将使用滚动设计。 ``` cal | boxes -d diamonds -p a1t2l3 | boxes -a c -d scroll         @@ -92,25 +93,25 @@ cal | boxes -d diamonds -p a1t2l3 | boxes -a c -d scroll            ~~~                                                ~~~ ``` -Perfect. Now, here's where things get a little crazy. I like our design, but, I'd like to go all out. So I'm going to colorize it. But here in the Raleigh, NC office where Opensource.com's staff are based, there's a good chance for snow this weekend. So let's enjoy our colorized advent calendar, and then wipe it out with snow. +完美。现在,事情变得有点疯狂了。我喜欢我们的设计,但我想全力以赴,所以我要给它上色。但是 Opensource.com 员工所在的北卡罗来版纳州罗利办公室,本周末很有可能下雪。所以,让我们享受彩色降临日历,然后用雪擦掉它。 -For the snow, I'm grabbing a nifty [snippet][2] of Bash and Gawk goodness I found over on CLIMagic. If you're not familiar with CLIMagic, go check out their [website][3] and follow them on [Twitter][4]. You'll be glad you did. +关于雪,我抓取了一些 Bash 和 Gawk 的漂亮[代码片段][2],幸亏我发现了 CLIMagic。如果你不熟悉 CLIMagic,去查看他们的[网站][3],在 [Twitter][4] 上关注他们。你会满意的。 -So here we go. Let's clear the screen, throw up our boxy calendar, colorize it, wait a few seconds, then snowstorm it away. All here at the terminal, in one line. +我们开始吧。让我们清除屏幕,扔掉四四方方的日历,给它上色,等几秒钟,然后用暴风雪把它吹走。这些在终端可以用一行命令完成。 ``` $ clear;cal|boxes -d diamonds -p a1t2l3|boxes -a c -d scroll|lolcat;sleep 3;while :;do echo $LINES $COLUMNS $(($RANDOM%$COLUMNS)) $(printf "\u2744\n");sleep 0.1;done|gawk '{a[$3]=0;for(x in a) {o=a[x];a[x]=a[x]+1;printf "\033[%s;%sH ",o,x;printf "\033[%s;%sH%s \033[0;0H",a[x],x,$4;}}' ``` -And there we go. +大功告成。 ![](https://opensource.com/sites/default/files/uploads/linux-toy-cal-animated.gif) -For this to work on your system, you'll need all of the referenced utilities (boxes, lolcat, cal, gawk, etc.), and you'll need to use a terminal emulator that supports Unicode. +要使它在你的系统上工作,你需要所有它引用的实用程序(box, lolcat, gawk 等),还需要使用支持 Unicode 的终端仿真器。 -Do you have a favorite command-line toy that you think I ought to profile? The calendar for this series is mostly filled out but I've got a few spots left. Let me know in the comments below, and I'll check it out. If there's space, I'll try to include it. If not, but I get some good submissions, I'll do a round-up of honorable mentions at the end. +你有特别喜欢的命令行小玩具需要我介绍的吗?这个系列要介绍的小玩具大部分已经有了落实,但还预留了几个空位置。请在评论区留言,我会查看的。如果还有空位置,我会考虑介绍它的。如果没有,但如果我得到了一些很好的意见,我会在最后做一些有价值的提及。 -Check out yesterday's toy, [Take a break at the Linux command line with Nyan Cat][5], and check back tomorrow for another! +看看昨天的玩具:[使用 Nyan Cat 在 Linux 命令行休息][5]。记得明天再来! -------------------------------------------------------------------------------- @@ -118,7 +119,7 @@ via: https://opensource.com/article/18/12/linux-toy-cal 作者:[Jason Baker][a] 选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) +译者:[MjSeven](https://github.com/MjSeven) 校对:[校对者ID](https://github.com/校对者ID) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From a5824262594760241113773520b088b1640b1646 Mon Sep 17 00:00:00 2001 From: lctt-bot Date: Wed, 30 Jan 2019 17:00:24 +0000 Subject: [PATCH 223/243] =?UTF-8?q?Revert=20"=E7=94=B3=E9=A2=86=E7=BF=BB?= =?UTF-8?q?=E8=AF=91"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit 102c89d8621e0d376c3fb053b53f3c6d5c0f5410. --- sources/tech/20180914 A day in the life of a log message.md | 1 - 1 file changed, 1 deletion(-) diff --git a/sources/tech/20180914 A day in the life of a log message.md b/sources/tech/20180914 A day in the life of a log message.md index cc6ebd0f5b..8d60ec9fe6 100644 --- a/sources/tech/20180914 A day in the life of a log message.md +++ b/sources/tech/20180914 A day in the life of a log message.md @@ -1,4 +1,3 @@ -Ryze-Borgia is translating A day in the life of a log message ====== From f9c3542ec172e24ba91bfb634b7a7ba8f538fa20 Mon Sep 17 00:00:00 2001 From: darksun Date: Thu, 31 Jan 2019 09:44:53 +0800 Subject: [PATCH 224/243] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020180129=20Tips?= =?UTF-8?q?=20and=20tricks=20for=20using=20CUPS=20for=20printing=20with=20?= =?UTF-8?q?Linux=20sources/tech/20180129=20Tips=20and=20tricks=20for=20usi?= =?UTF-8?q?ng=20CUPS=20for=20printing=20with=20Linux.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ... for using CUPS for printing with Linux.md | 101 ++++++++++++++++++ 1 file changed, 101 insertions(+) create mode 100644 sources/tech/20180129 Tips and tricks for using CUPS for printing with Linux.md diff --git a/sources/tech/20180129 Tips and tricks for using CUPS for printing with Linux.md b/sources/tech/20180129 Tips and tricks for using CUPS for printing with Linux.md new file mode 100644 index 0000000000..f676b0efb9 --- /dev/null +++ b/sources/tech/20180129 Tips and tricks for using CUPS for printing with Linux.md @@ -0,0 +1,101 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Tips and tricks for using CUPS for printing with Linux) +[#]: via: (https://opensource.com/article/19/1/cups-printing-linux) +[#]: author: (Antoine Thomas https://opensource.com/users/ttoine) + +Tips and tricks for using CUPS for printing with Linux +====== +One of Apple's most important contributions to GNU/Linux was adopting CUPS in Mac OS X. +![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/email_paper_envelope_document.png?itok=uPj_kouJ) + +Did you ever try to configure a printer on a GNU/Linux desktop distribution at the end of the '90s? Or even before? + +To make a long story short: That was fine if you worked at a large organization with an IT team to handle it and dedicated hardware or a printing server. There were many different standards and protocols to handle printers. And only a few big vendors (usually Unix vendors) provided specific support and drivers for their entire range of products. + +However, if open source enthusiasts wanted a home printer that would work with their favorite distribution, that was another story. They probably spent a fair amount of time on forums, newsgroups, or IRC (remember those ancestors of social networks and chats?) asking about printers with easy-to-install Linux drivers. + +In 1999, the first version of [CUPS][1] (the Common Unix Printing System) was released by Easy Software Products. Most of the most popular distributions at the time adopted CUPS as their default printing system. That was a huge success: one standard could handle many printers and protocols. + +But if the printer vendor didn't provide a CUPS driver, it was still tricky or impossible to make it work. Some smart people might do reverse engineering. And a few printers, with native support of PostScript and Internet Printing Protocol (IPP), worked "out of the box." + +### Then came Apple + +In the early 2000s, Apple was struggling to build a new printing system for its new Mac OS X. In March 2002, it decided to save time by adopting CUPS for its flagship operating system. + +No printer vendor could ignore Apple computers' market share, so a lot of new printer drivers for Mac OS X's CUPS became available, spanning most vendors and product ranges, including corporate, graphic arts, consumer, and photo printing. + +CUPS became so important for Apple that it bought the software from Easy Software Products in 2007; since then Apple has continued to maintain it and manage its intellectual property. + +### But what does that have to do with GNU/Linux? + +At the time Apple integrated CUPS in Mac OS X, it was already used by default in many distros and available for most others. But few dedicated drivers were available, meaning they were not packaged or listed as "for GNU/Linux." + +However, once CUPS drivers were available for Mac OS X, a simple hack became popular with GNU/Linux enthusiasts: download the Mac driver, extract the PPD files, and test them with your printer. I used this hack many times with my Epson printers. + +That's the CUPS magic: If a driver exists, it usually works with all operating systems that use CUPS for printing, as long as they use a supported protocol (like IPP). + +That's how printer drivers began to be available for GNU/Linux. + +### Nowadays + +Afterward, printer vendors realized it was quite easy to provide drivers for GNU/Linux since they already developed them for Mac. It's now easy to find a GNU/Linux driver for a printer, even a newer one. Some distributions include packages with a lot of drivers, and most vendors provide dedicated drivers—sometimes via a package, other times with PPD files in an archive. + +Advanced control applications are available too, some official, some not, which make it possible (for example) to look at ink levels or clean printing heads. + +In some cases, installing a printer on GNU/Linux is even easier than on other operating systems, particularly with distributions using [zero-configuration networking][2] (e.g., Bonjour, Avahi) to auto-discover and share network printers. + +### Tips and tricks + + * **Install a PDF printer:** Installing a PDF printer on GNU/Linux is very easy. Just look for the **cups-pdf** package in your favorite distribution and install it. If the package doesn't automatically create the PDF printer, you can add one using your system preferences to print in PDF from any application. + + * **Access the CUPS web interface:** If your usual interface for managing printers doesn't work or you don't like it, open a web browser and go to . You can manage all the printers installed on your computer, adjust their settings, and even add new ones—all from this web interface. Note that this might be available on other computers on your network; if so, replace "localhost" with the relevant hostname or IP address. + + * **Check ink level:** If you have an Epson, Canon, HP, or Sony printer, you can see its ink level with a simple application. Look for the "ink" package in your distribution repositories. + + * **Contribute to CUPS:** Like many open source project, CUPS is maintained on GitHub. Check the [CUPS website][1] and [GitHub issues][3] to find out how you can contribute to improving it. + + + + +### CUPS license + +Originally, CUPS was released under GPLv2. I'm not sure why; maybe to make it easier to distribute with GNU/Linux. Or maybe it was just what most open source projects did at the time. + +Apple decided to [change the license][4] in November 2017 to the Apache 2.0 license. Many observers commented that it was consistent with Apple's strategy to move the IP of its open source projects to more business-compliant licenses. + +While this change could create issues with shipping CUPS with GNU/Linux, it is still available in most distributions. + +### Happy 20th birthday, CUPS! + +CUPS was released in 1999, so, let's celebrate and thank all the people involved in this successful open source project, from the original authors to the driver developers to its current maintainers. + +The next time you print with your favorite GNU/Linux operating system, remind yourself to say "thank you" to Apple. + +The company isn't well known for its contributions to open source. But if you look carefully (at, for example, [Apple's Open Source Releases][5] and [Open Source Development][6] pages), you'll see how many open source components are in Apple's operating systems and applications. + +You'll also discover other important open source projects Apple kicked off. For example, it forked KHTML, the KDE browser, to create [WebKit][7] for the Safari Browser. Wait, THE WebKit? Yes, Apple initiated WebKit. But that is another story... + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/1/cups-printing-linux + +作者:[Antoine Thomas][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/ttoine +[b]: https://github.com/lujun9972 +[1]: https://www.cups.org/ +[2]: https://en.wikipedia.org/wiki/Zero-configuration_networking#Major_implementations +[3]: https://github.com/apple/cups/issues +[4]: https://www.cups.org/blog/2017-11-07-cups-license-change.html +[5]: https://opensource.apple.com/ +[6]: https://developer.apple.com/opensource/ +[7]: https://webkit.org/ From 3b2120ebef743c98d8312a0a4d0d70eebd900f05 Mon Sep 17 00:00:00 2001 From: darksun Date: Thu, 31 Jan 2019 09:47:37 +0800 Subject: [PATCH 225/243] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190129=207=20Me?= =?UTF-8?q?thods=20To=20Identify=20Disk=20Partition/FileSystem=20UUID=20On?= =?UTF-8?q?=20Linux=20sources/tech/20190129=207=20Methods=20To=20Identify?= =?UTF-8?q?=20Disk=20Partition-FileSystem=20UUID=20On=20Linux.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...Disk Partition-FileSystem UUID On Linux.md | 159 ++++++++++++++++++ 1 file changed, 159 insertions(+) create mode 100644 sources/tech/20190129 7 Methods To Identify Disk Partition-FileSystem UUID On Linux.md diff --git a/sources/tech/20190129 7 Methods To Identify Disk Partition-FileSystem UUID On Linux.md b/sources/tech/20190129 7 Methods To Identify Disk Partition-FileSystem UUID On Linux.md new file mode 100644 index 0000000000..366e75846d --- /dev/null +++ b/sources/tech/20190129 7 Methods To Identify Disk Partition-FileSystem UUID On Linux.md @@ -0,0 +1,159 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (7 Methods To Identify Disk Partition/FileSystem UUID On Linux) +[#]: via: (https://www.2daygeek.com/check-partitions-uuid-filesystem-uuid-universally-unique-identifier-linux/) +[#]: author: (Magesh Maruthamuthu https://www.2daygeek.com/author/magesh/) + +7 Methods To Identify Disk Partition/FileSystem UUID On Linux +====== + +As a Linux administrator you should aware of that how do you check partition UUID or filesystem UUID. + +Because most of the Linux systems are mount the partitions with UUID. The same has been verified in the `/etc/fstab` file. + +There are many utilities are available to check UUID. In this article we will show you how to check UUID in many ways and you can choose the one which is suitable for you. + +### What Is UUID? + +UUID stands for Universally Unique Identifier which helps Linux system to identify a hard drives partition instead of block device file. + +libuuid is part of the util-linux-ng package since kernel version 2.15.1 and it’s installed by default in Linux system. + +The UUIDs generated by this library can be reasonably expected to be unique within a system, and unique across all systems. + +It’s a 128 bit number used to identify information in computer systems. UUIDs were originally used in the Apollo Network Computing System (NCS) and later UUIDs are standardized by the Open Software Foundation (OSF) as part of the Distributed Computing Environment (DCE). + +UUIDs are represented as 32 hexadecimal (base 16) digits, displayed in five groups separated by hyphens, in the form 8-4-4-4-12 for a total of 36 characters (32 alphanumeric characters and four hyphens). + +For example: d92fa769-e00f-4fd7-b6ed-ecf7224af7fa + +Sample of my /etc/fstab file. + +``` +# cat /etc/fstab + +# /etc/fstab: static file system information. +# +# Use 'blkid' to print the universally unique identifier for a device; this may +# be used with UUID= as a more robust way to name devices that works even if +# disks are added and removed. See fstab(5). +# +# +UUID=69d9dd18-36be-4631-9ebb-78f05fe3217f / ext4 defaults,noatime 0 1 +UUID=a2092b92-af29-4760-8e68-7a201922573b swap swap defaults,noatime 0 2 +``` + +We can check this using the following seven commands. + + * **`blkid Command:`** locate/print block device attributes. + * **`lsblk Command:`** lsblk lists information about all available or the specified block devices. + * **`hwinfo Command:`** hwinfo stands for hardware information tool is another great utility that used to probe for the hardware present in the system. + * **`udevadm Command:`** udev management tool. + * **`tune2fs Command:`** adjust tunable filesystem parameters on ext2/ext3/ext4 filesystems. + * **`dumpe2fs Command:`** dump ext2/ext3/ext4 filesystem information. + * **`Using by-uuid Path:`** The directory contains UUID and real block device files, UUIDs were symlink with real block device files. + + + +### How To Check Disk Partition/FileSystem UUID In Linux Uusing blkid Command? + +blkid is a command-line utility to locate/print block device attributes. It uses libblkid library to get disk partition UUID in Linux system. + +``` +# blkid +/dev/sda1: UUID="d92fa769-e00f-4fd7-b6ed-ecf7224af7fa" TYPE="ext4" PARTUUID="eab59449-01" +/dev/sdc1: UUID="d17e3c31-e2c9-4f11-809c-94a549bc43b7" TYPE="ext2" PARTUUID="8cc8f9e5-01" +/dev/sdc3: UUID="ca307aa4-0866-49b1-8184-004025789e63" TYPE="ext4" PARTUUID="8cc8f9e5-03" +/dev/sdc5: PARTUUID="8cc8f9e5-05" +``` + +### How To Check Disk Partition/FileSystem UUID In Linux Uusing lsblk Command? + +lsblk lists information about all available or the specified block devices. The lsblk command reads the sysfs filesystem and udev db to gather information. + +If the udev db is not available or lsblk is compiled without udev support than it tries to read LABELs, UUIDs and filesystem types from the block device. In this case root permissions are necessary. The command prints all block devices (except RAM disks) in a tree-like format by default. + +``` +# lsblk -o name,mountpoint,size,uuid +NAME MOUNTPOINT SIZE UUID +sda 30G +└─sda1 / 20G d92fa769-e00f-4fd7-b6ed-ecf7224af7fa +sdb 10G +sdc 10G +├─sdc1 1G d17e3c31-e2c9-4f11-809c-94a549bc43b7 +├─sdc3 1G ca307aa4-0866-49b1-8184-004025789e63 +├─sdc4 1K +└─sdc5 1G +sdd 10G +sde 10G +sr0 1024M +``` + +### How To Check Disk Partition/FileSystem UUID In Linux Uusing by-uuid path? + +The directory contains UUID and real block device files, UUIDs were symlink with real block device files. + +``` +# ls -lh /dev/disk/by-uuid/ +total 0 +lrwxrwxrwx 1 root root 10 Jan 29 08:34 ca307aa4-0866-49b1-8184-004025789e63 -> ../../sdc3 +lrwxrwxrwx 1 root root 10 Jan 29 08:34 d17e3c31-e2c9-4f11-809c-94a549bc43b7 -> ../../sdc1 +lrwxrwxrwx 1 root root 10 Jan 29 08:34 d92fa769-e00f-4fd7-b6ed-ecf7224af7fa -> ../../sda1 +``` + +### How To Check Disk Partition/FileSystem UUID In Linux Uusing hwinfo Command? + +**[hwinfo][1]** stands for hardware information tool is another great utility that used to probe for the hardware present in the system and display detailed information about varies hardware components in human readable format. + +``` +# hwinfo --block | grep by-uuid | awk '{print $3,$7}' +/dev/sdc1, /dev/disk/by-uuid/d17e3c31-e2c9-4f11-809c-94a549bc43b7 +/dev/sdc3, /dev/disk/by-uuid/ca307aa4-0866-49b1-8184-004025789e63 +/dev/sda1, /dev/disk/by-uuid/d92fa769-e00f-4fd7-b6ed-ecf7224af7fa +``` + +### How To Check Disk Partition/FileSystem UUID In Linux Uusing udevadm Command? + +udevadm expects a command and command specific options. It controls the runtime behavior of systemd-udevd, requests kernel events, manages the event queue, and provides simple debugging mechanisms. + +``` +udevadm info -q all -n /dev/sdc1 | grep -i by-uuid | head -1 +S: disk/by-uuid/d17e3c31-e2c9-4f11-809c-94a549bc43b7 +``` + +### How To Check Disk Partition/FileSystem UUID In Linux Uusing tune2fs Command? + +tune2fs allows the system administrator to adjust various tunable filesystem parameters on Linux ext2, ext3, or ext4 filesystems. The current values of these options can be displayed by using the -l option. + +``` +# tune2fs -l /dev/sdc1 | grep UUID +Filesystem UUID: d17e3c31-e2c9-4f11-809c-94a549bc43b7 +``` + +### How To Check Disk Partition/FileSystem UUID In Linux Uusing dumpe2fs Command? + +dumpe2fs prints the super block and blocks group information for the filesystem present on device. + +``` +# dumpe2fs /dev/sdc1 | grep UUID +dumpe2fs 1.43.5 (04-Aug-2017) +Filesystem UUID: d17e3c31-e2c9-4f11-809c-94a549bc43b7 +``` + +-------------------------------------------------------------------------------- + +via: https://www.2daygeek.com/check-partitions-uuid-filesystem-uuid-universally-unique-identifier-linux/ + +作者:[Magesh Maruthamuthu][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.2daygeek.com/author/magesh/ +[b]: https://github.com/lujun9972 +[1]: https://www.2daygeek.com/hwinfo-check-display-detect-system-hardware-information-linux/ From ea5483292c08362ccef1faa70a224751cb253ae2 Mon Sep 17 00:00:00 2001 From: darksun Date: Thu, 31 Jan 2019 09:53:16 +0800 Subject: [PATCH 226/243] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190129=20How=20?= =?UTF-8?q?To=20Configure=20System-wide=20Proxy=20Settings=20Easily=20And?= =?UTF-8?q?=20Quickly=20sources/tech/20190129=20How=20To=20Configure=20Sys?= =?UTF-8?q?tem-wide=20Proxy=20Settings=20Easily=20And=20Quickly.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...-wide Proxy Settings Easily And Quickly.md | 309 ++++++++++++++++++ 1 file changed, 309 insertions(+) create mode 100644 sources/tech/20190129 How To Configure System-wide Proxy Settings Easily And Quickly.md diff --git a/sources/tech/20190129 How To Configure System-wide Proxy Settings Easily And Quickly.md b/sources/tech/20190129 How To Configure System-wide Proxy Settings Easily And Quickly.md new file mode 100644 index 0000000000..0848111d08 --- /dev/null +++ b/sources/tech/20190129 How To Configure System-wide Proxy Settings Easily And Quickly.md @@ -0,0 +1,309 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How To Configure System-wide Proxy Settings Easily And Quickly) +[#]: via: (https://www.ostechnix.com/how-to-configure-system-wide-proxy-settings-easily-and-quickly/) +[#]: author: (SK https://www.ostechnix.com/author/sk/) + +How To Configure System-wide Proxy Settings Easily And Quickly +====== + +![](https://www.ostechnix.com/wp-content/uploads/2019/01/ProxyMan-720x340.png) + +Today, we will be discussing a simple, yet useful command line utility named **“ProxyMan”**. As the name says, it helps you to apply and manage proxy settings on our system easily and quickly. Using ProxyMan, we can set or unset proxy settings automatically at multiple points, without having to configure them manually one by one. It also allows you to save the settings for later use. In a nutshell, ProxyMan simplifies the task of configuring system-wide proxy settings with a single command. It is free, open source utility written in **Bash** and standard POSIX tools, no dependency required. ProxyMan can be helpful if you’re behind a proxy server and you want to apply the proxy settings system-wide in one go. + +### Installing ProxyMan + +Download the latest ProxyMan version from the [**releases page**][1]. It is available as zip and tar file. I am going to download zip file. + +``` +$ wget https://github.com/himanshub16/ProxyMan/archive/v3.1.1.zip +``` + +Extract the downloaded zip file: + +``` +$ unzip v3.1.1.zip +``` + +The above command will extract the contents in a folder named “ **ProxyMan-3.1.1** ” in your current working directory. Cd to that folder and install ProxyMan as shown below: + +``` +$ cd ProxyMan-3.1.1/ + +$ ./install +``` + +If you see **“Installed successfully”** message as output, congratulations! ProxyMan has been installed. + +Let us go ahead and see how to configure proxy settings. + +### Configure System-wide Proxy Settings + +ProxyMan usage is pretty simple and straight forward. Like I already said, It allows us to set/unset proxy settings, list current proxy settings, list available configs, save settings in a profile and load profile later. Proxyman currently manages proxy settings for **GNOME gsettings** , **bash** , **apt** , **dnf** , **git** , **npm** and **Dropbox**. + +**Set proxy settings** + +To set proxy settings system-wide, simply run: + +``` +$ proxyman set +``` + +You will asked to answer a series of simple questions such as, + + 1. HTTP Proxy host IP address, + 2. HTTP port, + 3. Use username/password authentication, + 4. Use same settings for HTTPS and FTP, + 5. Save profile for later use, + 6. Finally, choose the list of targets to apply the proxy settings. You can choose all at once or separate multiple choices with space. + + + +Sample output for the above command: + +``` +Enter details to set proxy +HTTP Proxy Host 192.168.225.22 +HTTP Proxy Port 8080 +Use auth - userid/password (y/n)? n +Use same for HTTPS and FTP (y/n)? y +No Proxy (default localhost,127.0.0.1,192.168.1.1,::1,*.local) +Save profile for later use (y/n)? y +Enter profile name : proxy1 +Saved to /home/sk/.config/proxyman/proxy1. + +Select targets to modify +| 1 | All of them ... Don't bother me +| 2 | Terminal / bash / zsh (current user) +| 3 | /etc/environment +| 4 | apt/dnf (Package manager) +| 5 | Desktop settings (GNOME/Ubuntu) +| 6 | npm & yarn +| 7 | Dropbox +| 8 | Git +| 9 | Docker + +Separate multiple choices with space +? 1 +Setting proxy... +To activate in current terminal window +run source ~/.bashrc +[sudo] password for sk: +Done +``` + +**List proxy settings** + +To view the current proxy settings, run: + +``` +$ proxyman list +``` + +Sample output: + +``` +Hmm... listing it all + +Shell proxy settings : /home/sk/.bashrc +export http_proxy="http://192.168.225.22:8080/" +export ftp_proxy="ftp://192.168.225.22:8080/" +export rsync_proxy="rsync://192.168.225.22:8080/" +export no_proxy="localhost,127.0.0.1,192.168.1.1,::1,*.local" +export HTTP_PROXY="http://192.168.225.22:8080/" +export FTP_PROXY="ftp://192.168.225.22:8080/" +export RSYNC_PROXY="rsync://192.168.225.22:8080/" +export NO_PROXY="localhost,127.0.0.1,192.168.1.1,::1,*.local" +export https_proxy="/" +export HTTPS_PROXY="/" + +git proxy settings : +http http://192.168.225.22:8080/ +https https://192.168.225.22:8080/ + +APT proxy settings : +3 +Done +``` + +**Unset proxy settings** + +To unset proxy settings, the command would be: + +``` +$ proxyman unset +``` + +You can unset proxy settings for all targets at once by entering number **1** or enter any given number to unset proxy settings for the respective target. + +``` +Select targets to modify +| 1 | All of them ... Don't bother me +| 2 | Terminal / bash / zsh (current user) +| 3 | /etc/environment +| 4 | apt/dnf (Package manager) +| 5 | Desktop settings (GNOME/Ubuntu) +| 6 | npm & yarn +| 7 | Dropbox +| 8 | Git +| 9 | Docker + +Separate multiple choices with space +? 1 +Unset all proxy settings +To activate in current terminal window +run source ~/.bashrc +Done +``` + +To apply the changes, simply run: + +``` +$ source ~/.bashrc +``` + +On ZSH, use this command instead: + +``` +$ source ~/.zshrc +``` + +To verify if the proxy settings have been removed, simply run “proxyman list” command: + +``` +$ proxyman list +Hmm... listing it all + +Shell proxy settings : /home/sk/.bashrc +None + +git proxy settings : +http +https + +APT proxy settings : +None +Done +``` + +As you can see, there is no proxy settings for all targets. + +**View list of configs (profiles)** + +Remember we saved proxy settings as a profile in the “Set proxy settings” section? You can view the list of available profiles with command: + +``` +$ proxyman configs +``` + +Sample output: + +``` +Here are available configs! +proxy1 +Done +``` + +As you can see, we have only one profile i.e **proxy1**. + +**Load profiles** + +The profiles will be available until you delete them permanently, so you can load a profile (E.g proxy1) at any time using command: + +``` +$ proxyman load proxy1 +``` + +This command will list the proxy settings for proxy1 profile. You can apply these settings to all or multiple targets by entering the respective number with space-separated. + +``` +Loading profile : proxy1 +HTTP > 192.168.225.22 8080 +HTTPS > 192.168.225.22 8080 +FTP > 192.168.225.22 8080 +no_proxy > localhost,127.0.0.1,192.168.1.1,::1,*.local +Use auth > n +Use same > y +Config > +Targets > +Select targets to modify +| 1 | All of them ... Don't bother me +| 2 | Terminal / bash / zsh (current user) +| 3 | /etc/environment +| 4 | apt/dnf (Package manager) +| 5 | Desktop settings (GNOME/Ubuntu) +| 6 | npm & yarn +| 7 | Dropbox +| 8 | Git +| 9 | Docker + +Separate multiple choices with space +? 1 +Setting proxy... +To activate in current terminal window +run source ~/.bashrc +Done +``` + +Finally, activate the changes using command: + +``` +$ source ~/.bashrc +``` + +For ZSH: + +``` +$ source ~/.zshrc +``` + +**Deleting profiles** + +To delete a profile, run: + +``` +$ proxyman delete proxy1 +``` + +Output: + +``` +Deleting profile : proxy1 +Done +``` + +To display help, run: + +``` +$ proxyman help +``` + + +### Conclusion + +Before I came to know about Proxyman, I used to apply proxy settings manually at multiple places, for example package manager, web browser etc. Not anymore! ProxyMan did this job automatically in couple seconds. + +And, that’s all for now. Hope this was useful. More good stuffs to come. Stay tuned. + +Cheers! + + + +-------------------------------------------------------------------------------- + +via: https://www.ostechnix.com/how-to-configure-system-wide-proxy-settings-easily-and-quickly/ + +作者:[SK][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.ostechnix.com/author/sk/ +[b]: https://github.com/lujun9972 +[1]: https://github.com/himanshub16/ProxyMan/releases/ From 72f5dcccde89be61ce3bfadbd3f89678c0b4283b Mon Sep 17 00:00:00 2001 From: darksun Date: Thu, 31 Jan 2019 09:56:46 +0800 Subject: [PATCH 227/243] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020180128=20Get=20?= =?UTF-8?q?started=20with=20Org=20mode=20without=20Emacs=20sources/tech/20?= =?UTF-8?q?180128=20Get=20started=20with=20Org=20mode=20without=20Emacs.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...Get started with Org mode without Emacs.md | 78 +++++++++++++++++++ 1 file changed, 78 insertions(+) create mode 100644 sources/tech/20180128 Get started with Org mode without Emacs.md diff --git a/sources/tech/20180128 Get started with Org mode without Emacs.md b/sources/tech/20180128 Get started with Org mode without Emacs.md new file mode 100644 index 0000000000..75a5bcb092 --- /dev/null +++ b/sources/tech/20180128 Get started with Org mode without Emacs.md @@ -0,0 +1,78 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Get started with Org mode without Emacs) +[#]: via: (https://opensource.com/article/19/1/productivity-tool-org-mode) +[#]: author: (Kevin Sonney https://opensource.com/users/ksonney (Kevin Sonney)) + +Get started with Org mode without Emacs +====== +No, you don't need Emacs to use Org, the 16th in our series on open source tools that will make you more productive in 2019. + +![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/web_browser_desktop_devlopment_design_system_computer.jpg?itok=pfqRrJgh) + +There seems to be a mad rush at the beginning of every year to find ways to be more productive. New Year's resolutions, the itch to start the year off right, and of course, an "out with the old, in with the new" attitude all contribute to this. And the usual round of recommendations is heavily biased towards closed source and proprietary software. It doesn't have to be that way. + +Here's the 16th of my picks for 19 new (or new-to-you) open source tools to help you be more productive in 2019. + +### Org (without Emacs) + +[Org mode][1] (or just Org) is not in the least bit new, but there are still many people who have never used it. They would love to try it out to get a feel for how Org can help them be productive. But the biggest barrier is that Org is associated with Emacs, and many people think one requires the other. Not so! Org can be used with a variety of other tools and editors once you understand the basics. + +![](https://opensource.com/sites/default/files/uploads/org-1.png) + +Org, at its very heart, is a structured text file. It has headers, subheaders, and keywords that allow other tools to parse files into agendas and to-do lists. Org files can be edited with any flat-text editor (e.g., [Vim][2], [Atom][3], or [Visual Studio Code][4]), and many have plugins that help create and manage Org files. + +A basic Org file looks something like this: + +``` +* Task List +** TODO Write Article for Day 16 - Org w/out emacs +   DEADLINE: <2019-01-25 12:00> +*** DONE Write sample org snippet for article +    - Include at least one TODO and one DONE item +    - Show notes +    - Show SCHEDULED and DEADLINE +*** TODO Take Screenshots +** Dentist Appointment +   SCHEDULED: <2019-01-31 13:30-14:30> +``` + +Org uses an outline format that uses ***** as bullets to indicate an item's level. Any item that begins with the word TODO (yes, in all caps) is just that—a to-do item. The work DONE indicates it is completed. SCHEDULED and DEADLINE indicate dates and times relevant to the item. If there's no time in either field, the item is considered an all-day event. + +With the right plugins, your favorite text editor becomes a powerhouse of productivity and organization. For example, the [vim-orgmode][5] plugin's features include functions to create Org files, syntax highlighting, and key commands to generate agendas and comprehensive to-do lists across files. + +![](https://opensource.com/sites/default/files/uploads/org-2.png) + +The Atom [Organized][6] plugin adds a sidebar on the right side of the screen that shows the agenda and to-do items in Org files. It can read from multiple files by default with a path set up in the configuration options. The Todo sidebar allows you to click on a to-do item to mark it done, then automatically updates the source Org file. + +![](https://opensource.com/sites/default/files/uploads/org-3.png) + +There are also a whole host of tools that "speak Org" to help keep you productive. With libraries in Python, Perl, PHP, NodeJS, and more, you can develop your own scripts and tools. And, of course, there is also [Emacs][7], which has Org support within the core distribution. + +![](https://opensource.com/sites/default/files/uploads/org-4.png) + +Org mode is one of the best tools for keeping on track with what needs to be done and when. And, contrary to myth, it doesn't need Emacs, just a text editor. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/1/productivity-tool-org-mode + +作者:[Kevin Sonney][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/ksonney (Kevin Sonney) +[b]: https://github.com/lujun9972 +[1]: https://orgmode.org/ +[2]: https://www.vim.org/ +[3]: https://atom.io/ +[4]: https://code.visualstudio.com/ +[5]: https://github.com/jceb/vim-orgmode +[6]: https://atom.io/packages/organized +[7]: https://www.gnu.org/software/emacs/ From 7b675e456bf11a82362edd4b3ef1d511edc5d37f Mon Sep 17 00:00:00 2001 From: darksun Date: Thu, 31 Jan 2019 10:07:17 +0800 Subject: [PATCH 228/243] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190128=203=20si?= =?UTF-8?q?mple=20and=20useful=20GNOME=20Shell=20extensions=20sources/tech?= =?UTF-8?q?/20190128=203=20simple=20and=20useful=20GNOME=20Shell=20extensi?= =?UTF-8?q?ons.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...imple and useful GNOME Shell extensions.md | 73 +++++++++++++++++++ 1 file changed, 73 insertions(+) create mode 100644 sources/tech/20190128 3 simple and useful GNOME Shell extensions.md diff --git a/sources/tech/20190128 3 simple and useful GNOME Shell extensions.md b/sources/tech/20190128 3 simple and useful GNOME Shell extensions.md new file mode 100644 index 0000000000..c22feddf01 --- /dev/null +++ b/sources/tech/20190128 3 simple and useful GNOME Shell extensions.md @@ -0,0 +1,73 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (3 simple and useful GNOME Shell extensions) +[#]: via: (https://fedoramagazine.org/3-simple-and-useful-gnome-shell-extensions/) +[#]: author: (Ryan Lerch https://fedoramagazine.org/introducing-flatpak/) + +3 simple and useful GNOME Shell extensions +====== + +![](https://fedoramagazine.org/wp-content/uploads/2019/01/3simple-816x345.png) + +The default desktop of Fedora Workstation — GNOME Shell — is known and loved by many users for its minimal, clutter-free user interface. It is also known for the ability to add to the stock interface using extensions. In this article, we cover 3 simple, and useful extensions for GNOME Shell. These three extensions provide a simple extra behaviour to your desktop; simple tasks that you might do every day. + + +### Installing Extensions + +The quickest and easiest way to install GNOME Shell extensions is with the Software Application. Check out the previous post here on the Magazine for more details: + +![](https://fedoramagazine.org/wp-content/uploads/2018/11/installing-extensions-768x325.jpg) + +### Removable Drive Menu + +![][1] +Removable Drive Menu extension on Fedora 29 + +First up is the [Removable Drive Menu][2] extension. It is a simple tool that adds a small widget in the system tray if you have a removable drive inserted into your computer. This allows you easy access to open Files for your removable drive, or quickly and easily eject the drive for safe removal of the device. + +![][3] +Removable Drive Menu in the Software application + +### Extensions Extension. + +![][4] + +The [Extensions][5] extension is super useful if you are always installing and trying out new extensions. It provides a list of all the installed extensions, allowing you to enable or disable them. Additionally, if an extension has settings, it allows quick access to the settings dialog for each one. + +![][6] +the Extensions extension in the Software application + +### Frippery Move Clock + +![][7] + +Finally, there is the simplest extension in the list. [Frippery Move Clock][8], simply moves the position of the clock from the center of the top bar to the right, next to the status area. + +![][9] + + +-------------------------------------------------------------------------------- + +via: https://fedoramagazine.org/3-simple-and-useful-gnome-shell-extensions/ + +作者:[Ryan Lerch][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://fedoramagazine.org/introducing-flatpak/ +[b]: https://github.com/lujun9972 +[1]: https://fedoramagazine.org/wp-content/uploads/2019/01/removable-disk-1024x459.jpg +[2]: https://extensions.gnome.org/extension/7/removable-drive-menu/ +[3]: https://fedoramagazine.org/wp-content/uploads/2019/01/removable-software-1024x723.png +[4]: https://fedoramagazine.org/wp-content/uploads/2019/01/extensions-extension-1024x459.jpg +[5]: https://extensions.gnome.org/extension/1036/extensions/ +[6]: https://fedoramagazine.org/wp-content/uploads/2019/01/extensions-software-1024x723.png +[7]: https://fedoramagazine.org/wp-content/uploads/2019/01/move_clock-1024x189.jpg +[8]: https://extensions.gnome.org/extension/2/move-clock/ +[9]: https://fedoramagazine.org/wp-content/uploads/2019/01/Screenshot-from-2019-01-28-21-53-18-1024x723.png From 96a36a45bf938f64920bb579be1495552a55039c Mon Sep 17 00:00:00 2001 From: darksun Date: Thu, 31 Jan 2019 10:08:56 +0800 Subject: [PATCH 229/243] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190128=20fdisk?= =?UTF-8?q?=20=E2=80=93=20Easy=20Way=20To=20Manage=20Disk=20Partitions=20I?= =?UTF-8?q?n=20Linux=20sources/tech/20190128=20fdisk=20-=20Easy=20Way=20To?= =?UTF-8?q?=20Manage=20Disk=20Partitions=20In=20Linux.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ... Way To Manage Disk Partitions In Linux.md | 524 ++++++++++++++++++ 1 file changed, 524 insertions(+) create mode 100644 sources/tech/20190128 fdisk - Easy Way To Manage Disk Partitions In Linux.md diff --git a/sources/tech/20190128 fdisk - Easy Way To Manage Disk Partitions In Linux.md b/sources/tech/20190128 fdisk - Easy Way To Manage Disk Partitions In Linux.md new file mode 100644 index 0000000000..cc89e8c7f1 --- /dev/null +++ b/sources/tech/20190128 fdisk - Easy Way To Manage Disk Partitions In Linux.md @@ -0,0 +1,524 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (fdisk – Easy Way To Manage Disk Partitions In Linux) +[#]: via: (https://www.2daygeek.com/linux-fdisk-command-to-manage-disk-partitions/) +[#]: author: (Magesh Maruthamuthu https://www.2daygeek.com/author/magesh/) + +fdisk – Easy Way To Manage Disk Partitions In Linux +====== + +Hard disks can be divided into one or more logical disks called partitions. + +This division is described in the partition table (MBR or GPT) found in sector 0 of the disk. + +Linux needs at least one partition, namely for its root file system and we can’t install Linux OS without partitions. + +Once created, a partition must be formatted with an appropriate file system before files can be written to it. + +To do so, we need some utility to perform this in Linux. + +There are many utilities are available for that in Linux. We had written about **[Parted Command][1]** in the past and today we are going to discuss about fdisk. + +fdisk command is one of the the best tool to manage disk partitions in Linux. + +It supports maximum `2 TB`, and everyone prefer to go with fdisk. + +This tool is used by vast of Linux admin because we don’t use more than 2TB now a days due to LVM and SAN. It’s used in most of the infra structure around the world. + +Still if you want to create a large partitions, like more than 2TB then you have to go either **Parted Command** or **cfdisk Command**. + +Disk partition and file system creations is one of the routine task for Linux admin. + +If you are working on vast environment then you have to perform this task multiple times in a day. + +### How Linux Kernel Understand Hard Disks? + +As a human we can easily understand things but computer needs the proper naming conversion to understand each and everything. + +In Linux, devices are located on `/dev` partition and Kernel understand the hard disk in the following format. + + * **`/dev/hdX[a-z]:`** IDE Disk is named hdX in Linux + * **`/dev/sdX[a-z]:`** SCSI Disk is named sdX in Linux + * **`/dev/xdX[a-z]:`** XT Disk is named sdX in Linux + * **`/dev/vdX[a-z]:`** Virtual Hard Disk is named vdX in Linux + * **`/dev/fdN:`** Floppy Drive is named fdN in Linux + * **`/dev/scdN or /dev/srN:`** CD-ROM is named /dev/scdN or /dev/srN in Linux + + + +### What Is fdisk Command? + +fdisk stands for fixed disk or format disk is a cli utility that allow users to perform following actions on disks. It allows us to view, create, resize, delete, move and copy the partitions. + +It understands MBR, Sun, SGI and BSD partition tables and it doesn’t understand GUID Partition Table (GPT) and it is not designed for large partitions. + +fdisk allows us to create a maximum of four primary partitions per disk. One of these may be an extended partition and it holds multiple logical partitions. + +1-4 is reserved for four primary partitions and Logical partitions start numbering from 5. +![][3] + +### How To Install fdisk On Linux + +You don’t need to install fdisk in Linux system because it has installed by default as part of core utility. + +### How To List Available Disks Using fdisk Command + +First we have to know what are the disks were added in the system before performing any action. To list all available disks on your system run the following command. + +It lists possible information about the disks such as disk name, how many partitions are created in it, Disk Size, Disklabel type, Disk Identifier, Partition ID and Partition Type. + +``` +$ sudo fdisk -l +Disk /dev/sda: 30 GiB, 32212254720 bytes, 62914560 sectors +Units: sectors of 1 core.md Dict.md lctt2014.md lctt2016.md lctt2018.md LICENSE published README.md scripts sources translated 512 = 512 bytes +Sector size (logical/physical): 512 bytes / 512 bytes +I/O size (minimum/optimal): 512 bytes / 512 bytes +Disklabel type: dos +Disk identifier: 0xeab59449 + +Device Boot Start End Sectors Size Id Type +/dev/sda1 core.md Dict.md lctt2014.md lctt2016.md lctt2018.md LICENSE published README.md scripts sources translated 20973568 62914559 41940992 20G 83 Linux + + +Disk /dev/sdb: 10 GiB, 10737418240 bytes, 20971520 sectors +Units: sectors of 1 core.md Dict.md lctt2014.md lctt2016.md lctt2018.md LICENSE published README.md scripts sources translated 512 = 512 bytes +Sector size (logical/physical): 512 bytes / 512 bytes +I/O size (minimum/optimal): 512 bytes / 512 bytes + + +Disk /dev/sdc: 10 GiB, 10737418240 bytes, 20971520 sectors +Units: sectors of 1 core.md Dict.md lctt2014.md lctt2016.md lctt2018.md LICENSE published README.md scripts sources translated 512 = 512 bytes +Sector size (logical/physical): 512 bytes / 512 bytes +I/O size (minimum/optimal): 512 bytes / 512 bytes + + +Disk /dev/sdd: 10 GiB, 10737418240 bytes, 20971520 sectors +Units: sectors of 1 core.md Dict.md lctt2014.md lctt2016.md lctt2018.md LICENSE published README.md scripts sources translated 512 = 512 bytes +Sector size (logical/physical): 512 bytes / 512 bytes +I/O size (minimum/optimal): 512 bytes / 512 bytes + + +Disk /dev/sde: 10 GiB, 10737418240 bytes, 20971520 sectors +Units: sectors of 1 core.md Dict.md lctt2014.md lctt2016.md lctt2018.md LICENSE published README.md scripts sources translated 512 = 512 bytes +Sector size (logical/physical): 512 bytes / 512 bytes +I/O size (minimum/optimal): 512 bytes / 512 bytes +``` + +### How To List A Specific Disk Partitions Using fdisk Command + +If you would like to see a specific disk and it’s partitions, use the following format. + +``` +$ sudo fdisk -l /dev/sda +Disk /dev/sda: 30 GiB, 32212254720 bytes, 62914560 sectors +Units: sectors of 1 core.md Dict.md lctt2014.md lctt2016.md lctt2018.md LICENSE published README.md scripts sources translated 512 = 512 bytes +Sector size (logical/physical): 512 bytes / 512 bytes +I/O size (minimum/optimal): 512 bytes / 512 bytes +Disklabel type: dos +Disk identifier: 0xeab59449 + +Device Boot Start End Sectors Size Id Type +/dev/sda1 core.md Dict.md lctt2014.md lctt2016.md lctt2018.md LICENSE published README.md scripts sources translated 20973568 62914559 41940992 20G 83 Linux +``` + +### How To List Available Actions For fdisk Command + +When you hit `m` in the fdisk command that will show you available actions for fdisk command. + +``` +$ sudo fdisk /dev/sdc + +Welcome to fdisk (util-linux 2.30.1). +Changes will remain in memory only, until you decide to write them. +Be careful before using the write command. + +Device does not contain a recognized partition table. +Created a new DOS disklabel with disk identifier 0xe944b373. + +Command (m for help): m + +Help: + + DOS (MBR) + a toggle a bootable flag + b edit nested BSD disklabel + c toggle the dos compatibility flag + + Generic + d delete a partition + F list free unpartitioned space + l list known partition types + n add a new partition + p print the partition table + t change a partition type + v verify the partition table + i print information about a partition + + Misc + m print this menu + u change display/entry units + x extra functionality (experts only) + + Script + I load disk layout from sfdisk script file + O dump disk layout to sfdisk script file + + Save & Exit + w write table to disk and exit + q quit without saving changes + + Create a new label + g create a new empty GPT partition table + G create a new empty SGI (IRIX) partition table + o create a new empty DOS partition table + s create a new empty Sun partition table +``` + +### How To List Partitions Types Using fdisk Command + +When you hit `l` in the fdisk command that will show you an available partitions type for fdisk command. + +``` +$ sudo fdisk /dev/sdc + +Welcome to fdisk (util-linux 2.30.1). +Changes will remain in memory only, until you decide to write them. +Be careful before using the write command. + +Device does not contain a recognized partition table. +Created a new DOS disklabel with disk identifier 0x9ffd00db. + +Command (m for help): l + + 0 Empty 24 NEC DOS 81 Minix / old Lin bf Solaris + 1 FAT12 27 Hidden NTFS Win 82 Linux swap / So c1 DRDOS/sec (FAT- + 2 XENIX root 39 Plan 9 83 Linux c4 DRDOS/sec (FAT- + 3 XENIX usr 3c PartitionMagic 84 OS/2 hidden or c6 DRDOS/sec (FAT- + 4 FAT16 <32M 40 Venix 80286 85 Linux extended c7 Syrinx + 5 Extended 41 PPC PReP Boot 86 NTFS volume set da Non-FS data + 6 FAT16 42 SFS 87 NTFS volume set db CP/M / CTOS / . + 7 HPFS/NTFS/exFAT 4d QNX4.x 88 Linux plaintext de Dell Utility + 8 AIX 4e QNX4.x 2nd part 8e Linux LVM df BootIt + 9 AIX bootable 4f QNX4.x 3rd part 93 Amoeba e1 DOS access + a OS/2 Boot Manag 50 OnTrack DM 94 Amoeba BBT e3 DOS R/O + b W95 FAT32 51 OnTrack DM6 Aux 9f BSD/OS e4 SpeedStor + c W95 FAT32 (LBA) 52 CP/M a0 IBM Thinkpad hi ea Rufus alignment + e W95 FAT16 (LBA) 53 OnTrack DM6 Aux a5 FreeBSD eb BeOS fs + f W95 Ext'd (LBA) 54 OnTrackDM6 a6 OpenBSD ee GPT +10 OPUS 55 EZ-Drive a7 NeXTSTEP ef EFI (FAT-12/16/ +11 Hidden FAT12 56 Golden Bow a8 Darwin UFS f0 Linux/PA-RISC b +12 Compaq diagnost 5c Priam Edisk a9 NetBSD f1 SpeedStor +14 Hidden FAT16 <3 61 SpeedStor ab Darwin boot f4 SpeedStor +16 Hidden FAT16 63 GNU HURD or Sys af HFS / HFS+ f2 DOS secondary +17 Hidden HPFS/NTF 64 Novell Netware b7 BSDI fs fb VMware VMFS +18 AST SmartSleep 65 Novell Netware b8 BSDI swap fc VMware VMKCORE +1b Hidden W95 FAT3 70 DiskSecure Mult bb Boot Wizard hid fd Linux raid auto +1c Hidden W95 FAT3 75 PC/IX bc Acronis FAT32 L fe LANstep +1e Hidden W95 FAT1 80 Old Minix be Solaris boot ff BBT +``` + +### How To Create A Disk Partition Using fdisk Command + +If you would like to create a new partition use the following steps. In my case, i'm going to create 4 partitions (3 Primary and 1 Extended) on `/dev/sdc` disk. To the same for other partitions too. + +As this takes value from partition table so, hit `Enter` for first sector. Enter the size which you want to set for the partition (We can add a partition size using KB,MB,G and TB) for last sector. + +For example, if you would like to add 1GB partition then the last sector value should be `+1G`. Once you have created 3 partitions, it will automatically change the partition type to extended as a default. If you still want to create a fourth primary partitions then hit `p` instead of default value `e`. + +``` +$ sudo fdisk /dev/sdc + +Welcome to fdisk (util-linux 2.30.1). +Changes will remain in memory only, until you decide to write them. +Be careful before using the write command. + + +Command (m for help): n +Partition type + p primary (0 primary, 0 extended, 4 free) + e extended (container for logical partitions) +Select (default p): Enter + +Using default response p. +Partition number (1-4, default 1): Enter +First sector (2048-20971519, default 2048): Enter +Last sector, +sectors or +size{K,M,G,T,P} (2048-20971519, default 20971519): +1G + +Created a new partition 1 of type 'Linux' and of size 1 GiB. + +Command (m for help): p +Disk /dev/sdc: 10 GiB, 10737418240 bytes, 20971520 sectors +Units: sectors of 1 core.md Dict.md lctt2014.md lctt2016.md lctt2018.md LICENSE published README.md scripts sources translated 512 = 512 bytes +Sector size (logical/physical): 512 bytes / 512 bytes +I/O size (minimum/optimal): 512 bytes / 512 bytes +Disklabel type: dos +Disk identifier: 0x8cc8f9e5 + +Device Boot Start End Sectors Size Id Type +/dev/sdc1 2048 2099199 2097152 1G 83 Linux + +Command (m for help): w +The partition table has been altered. +Calling ioctl() to re-read partition table. +Syncing disks. +``` + +### How To Create A Extended Disk Partition Using fdisk Command + +Make a note, you have to use remaining all space when you create a extended partition because again you can able to create multiple logical partition in that. + +``` +$ sudo fdisk /dev/sdc + +Welcome to fdisk (util-linux 2.30.1). +Changes will remain in memory only, until you decide to write them. +Be careful before using the write command. + + +Command (m for help): n +Partition type + p primary (3 primary, 0 extended, 1 free) + e extended (container for logical partitions) +Select (default e): Enter + +Using default response e. +Selected partition 4 +First sector (6293504-20971519, default 6293504): Enter +Last sector, +sectors or +size{K,M,G,T,P} (6293504-20971519, default 20971519): Enter + +Created a new partition 4 of type 'Extended' and of size 7 GiB. + +Command (m for help): p +Disk /dev/sdc: 10 GiB, 10737418240 bytes, 20971520 sectors +Units: sectors of 1 core.md Dict.md lctt2014.md lctt2016.md lctt2018.md LICENSE published README.md scripts sources translated 512 = 512 bytes +Sector size (logical/physical): 512 bytes / 512 bytes +I/O size (minimum/optimal): 512 bytes / 512 bytes +Disklabel type: dos +Disk identifier: 0x8cc8f9e5 + +Device Boot Start End Sectors Size Id Type +/dev/sdc1 2048 2099199 2097152 1G 83 Linux +/dev/sdc2 2099200 4196351 2097152 1G 83 Linux +/dev/sdc3 4196352 6293503 2097152 1G 83 Linux +/dev/sdc4 6293504 20971519 14678016 7G 5 Extended + +Command (m for help): w +The partition table has been altered. +Calling ioctl() to re-read partition table. +Syncing disks. +``` + +### How To View Unpartitioned Disk Space Using fdisk Command + +As described in the above section, we have totally created 4 partitions (3 Primary and 1 Extended). Extended partition disk space will show unpartitioned until you create a logical partitions in that. + +Use the following command to view the unpartitioned space for a disk. As per the below output we have `7GB` unpartitioned disk. + +``` +$ sudo fdisk /dev/sdc + +Welcome to fdisk (util-linux 2.30.1). +Changes will remain in memory only, until you decide to write them. +Be careful before using the write command. + + +Command (m for help): F +Unpartitioned space /dev/sdc: 7 GiB, 7515144192 bytes, 14678016 sectors +Units: sectors of 1 core.md Dict.md lctt2014.md lctt2016.md lctt2018.md LICENSE published README.md scripts sources translated 512 = 512 bytes +Sector size (logical/physical): 512 bytes / 512 bytes + + Start End Sectors Size +6293504 20971519 14678016 7G + +Command (m for help): q +``` + +### How To Create A Logical Partition Using fdisk Command + +Follow the same above procedure to create a logical partition once you have created the extended partition. +Here, i have created `1GB` of logical partition called `/dev/sdc5`, you can double confirm this by checking the partition table value. + +``` +$ sudo fdisk /dev/sdc + +Welcome to fdisk (util-linux 2.30.1). +Changes will remain in memory only, until you decide to write them. +Be careful before using the write command. + +Command (m for help): n +All primary partitions are in use. +Adding logical partition 5 +First sector (6295552-20971519, default 6295552): Enter +Last sector, +sectors or +size{K,M,G,T,P} (6295552-20971519, default 20971519): +1G + +Created a new partition 5 of type 'Linux' and of size 1 GiB. + +Command (m for help): p +Disk /dev/sdc: 10 GiB, 10737418240 bytes, 20971520 sectors +Units: sectors of 1 core.md Dict.md lctt2014.md lctt2016.md lctt2018.md LICENSE published README.md scripts sources translated 512 = 512 bytes +Sector size (logical/physical): 512 bytes / 512 bytes +I/O size (minimum/optimal): 512 bytes / 512 bytes +Disklabel type: dos +Disk identifier: 0x8cc8f9e5 + +Device Boot Start End Sectors Size Id Type +/dev/sdc1 2048 2099199 2097152 1G 83 Linux +/dev/sdc2 2099200 4196351 2097152 1G 83 Linux +/dev/sdc3 4196352 6293503 2097152 1G 83 Linux +/dev/sdc4 6293504 20971519 14678016 7G 5 Extended +/dev/sdc5 6295552 8392703 2097152 1G 83 Linux + +Command (m for help): w +The partition table has been altered. +Calling ioctl() to re-read partition table. +Syncing disks. +``` + +### How To Delete A Partition Using fdisk Command + +If the partition is no more used in the system than we can remove it by using the below steps. + +Make sure you have to enter the correct partition number to delete it. In this case, i'm going to remove `/dev/sdc2` partition. + +``` +$ sudo fdisk /dev/sdc + +Welcome to fdisk (util-linux 2.30.1). +Changes will remain in memory only, until you decide to write them. +Be careful before using the write command. + + +Command (m for help): d +Partition number (1-5, default 5): 2 + +Partition 2 has been deleted. + +Command (m for help): p +Disk /dev/sdc: 10 GiB, 10737418240 bytes, 20971520 sectors +Units: sectors of 1 core.md Dict.md lctt2014.md lctt2016.md lctt2018.md LICENSE published README.md scripts sources translated 512 = 512 bytes +Sector size (logical/physical): 512 bytes / 512 bytes +I/O size (minimum/optimal): 512 bytes / 512 bytes +Disklabel type: dos +Disk identifier: 0x8cc8f9e5 + +Device Boot Start End Sectors Size Id Type +/dev/sdc1 2048 2099199 2097152 1G 83 Linux +/dev/sdc3 4196352 6293503 2097152 1G 83 Linux +/dev/sdc4 6293504 20971519 14678016 7G 5 Extended +/dev/sdc5 6295552 8392703 2097152 1G 83 Linux + +Command (m for help): w +The partition table has been altered. +Calling ioctl() to re-read partition table. +Syncing disks. +``` + +### How To Format A Partition Or Create A FileSystem On The Partition + +In computing, a file system or filesystem controls how data is stored and retrieved through inode tables. + +Without a file system, the system can't find where the information is stored on the partition. Filesystem can be created in three ways. Here, i'm going to create a filesystem on `/dev/sdc1` partition. + +``` +$ sudo mkfs.ext4 /dev/sdc1 +or +$ sudo mkfs -t ext4 /dev/sdc1 +or +$ sudo mke2fs /dev/sdc1 + +mke2fs 1.43.5 (04-Aug-2017) +Creating filesystem with 262144 4k blocks and 65536 inodes +Filesystem UUID: c0a99b51-2b61-4f6a-b960-eb60915faab0 +Superblock backups stored on blocks: + 32768, 98304, 163840, 229376 + +Allocating group tables: done +Writing inode tables: done +Creating journal (8192 blocks): done +Writing superblocks and filesystem accounting information: done +``` + +When you creating a filesystem on tha partition that will create the following important things on it. + + * **`Filesystem UUID:`** UUID stands for Universally Unique Identifier, UUIDs are used to identify block devices in Linux. It's 128 bit long numbers represented by 32 hexadecimal digits. + * **`Superblock:`** Superblock stores metadata of the file system. If the superblock of a file system is corrupted, then the filesystem cannot be mounted and thus files cannot be accessed. + * **`Inode:`** An inode is a data structure on a filesystem on a Unix-like operating system that stores all the information about a file except its name and its actual data. + * **`Journal:`** A journaling filesystem is a filesystem that maintains a special file called a journal that is used to repair any inconsistencies that occur as the result of an improper shutdown of a computer. + + + +### How To Mount A Partition In Linux + +Once you have created the partition and filesystem then we need to mount the partition to use. + +To do so, we need to create a mountpoint to mount the partition. Use mkdir command to create a mountpoint. + +``` +$ sudo mkdir -p /mnt/2g-new +``` + +For temporary mount, use the following command. You will be lose this mountpoint after rebooting your system. + +``` +$ sudo mount /dev/sdc1 /mnt/2g-new +``` + +For permanent mount, add the partition details in the fstab file. It can be done in two ways either adding device name or UUID value. + +Permanent mount using Device Name: + +``` +# vi /etc/fstab + +/dev/sdc1 /mnt/2g-new ext4 defaults 0 0 +``` + +Permanent mount using UUID Value. To get a UUID of the partition use blkid command. + +``` +$ sudo blkid +/dev/sdc1: UUID="d17e3c31-e2c9-4f11-809c-94a549bc43b7" TYPE="ext2" PARTUUID="8cc8f9e5-01" +/dev/sda1: UUID="d92fa769-e00f-4fd7-b6ed-ecf7224af7fa" TYPE="ext4" PARTUUID="eab59449-01" +/dev/sdc3: UUID="ca307aa4-0866-49b1-8184-004025789e63" TYPE="ext4" PARTUUID="8cc8f9e5-03" +/dev/sdc5: PARTUUID="8cc8f9e5-05" + +# vi /etc/fstab + +UUID=d17e3c31-e2c9-4f11-809c-94a549bc43b7 /mnt/2g-new ext4 defaults 0 0 +``` + +The same has been verified using df Command. + +``` +$ df -h +Filesystem Size Used Avail Use% Mounted on +udev 969M 0 969M 0% /dev +tmpfs 200M 7.0M 193M 4% /run +/dev/sda1 20G 16G 3.0G 85% / +tmpfs 997M 0 997M 0% /dev/shm +tmpfs 5.0M 4.0K 5.0M 1% /run/lock +tmpfs 997M 0 997M 0% /sys/fs/cgroup +tmpfs 200M 28K 200M 1% /run/user/121 +tmpfs 200M 25M 176M 13% /run/user/1000 +/dev/sdc1 1008M 1.3M 956M 1% /mnt/2g-new +``` + +-------------------------------------------------------------------------------- + +via: https://www.2daygeek.com/linux-fdisk-command-to-manage-disk-partitions/ + +作者:[Magesh Maruthamuthu][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.2daygeek.com/author/magesh/ +[b]: https://github.com/lujun9972 +[1]: https://www.2daygeek.com/how-to-manage-disk-partitions-using-parted-command/ +[2]: data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7 +[3]: https://www.2daygeek.com/wp-content/uploads/2019/01/linux-fdisk-command-to-manage-disk-partitions-1a.png From 8e85962146fbdc9eb5a21ff0d910ef237a6e5043 Mon Sep 17 00:00:00 2001 From: darksun Date: Thu, 31 Jan 2019 10:17:20 +0800 Subject: [PATCH 230/243] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190128=20Top=20?= =?UTF-8?q?Hex=20Editors=20for=20Linux=20sources/tech/20190128=20Top=20Hex?= =?UTF-8?q?=20Editors=20for=20Linux.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../20190128 Top Hex Editors for Linux.md | 146 ++++++++++++++++++ 1 file changed, 146 insertions(+) create mode 100644 sources/tech/20190128 Top Hex Editors for Linux.md diff --git a/sources/tech/20190128 Top Hex Editors for Linux.md b/sources/tech/20190128 Top Hex Editors for Linux.md new file mode 100644 index 0000000000..5cd47704b4 --- /dev/null +++ b/sources/tech/20190128 Top Hex Editors for Linux.md @@ -0,0 +1,146 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Top Hex Editors for Linux) +[#]: via: (https://itsfoss.com/hex-editors-linux) +[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) + +Top Hex Editors for Linux +====== + +Hex editor lets you view/edit the binary data of a file – which is in the form of “hexadecimal” values and hence the name “Hex” editor. Let’s be frank, not everyone needs it. Only a specific group of users who have to deal with the binary data use it. + +If you have no idea, what it is, let me give you an example. Suppose, you have the configuration files of a game, you can open them using a hex editor and change certain values to have more ammo/score and so on. To know more about Hex editors, you should start with the [Wikipedia page][1]. + +In case you already know what’s it used for – let us take a look at the best Hex editors available for Linux. + +### 5 Best Hex Editors Available + +![Best Hex Editors for Linux][2] + +**Note:** The hex editors mentioned are in no particular order of ranking. + +#### 1\. Bless Hex Editor + +![bless hex editor][3] + +**Key Features** : + + * Raw disk editing + * Multilevel undo/redo operations. + * Multiple tabs + * Conversion table + * Plugin support to extend the functionality + + + +Bless is one of the most popular Hex editor available for Linux. You can find it listed in your AppCenter or Software Center. If that is not the case, you can check out their [GitHub page][4] for the build and the instructions associated. + +It can easily handle editing big files without slowing down – so it’s a fast hex editor. + +#### 2\. GNOME Hex Editor + +![gnome hex editor][5] + +**Key Features:** + + * View/Edit in either Hex/Ascii + + * Edit large files + + * + + +Yet another amazing Hex editor – specifically tailored for GNOME. Well, I personally use Elementary OS, so I find it listed in the App Center. You should find it in the Software Center as well. If not, refer to the [GitHub page][6] for the source. + +You can use this editor to view/edit in either hex or ASCII. The user interface is quite simple – as you can see in the image above. + +#### 3\. Okteta + +![okteta][7] + +**Key Features:** + + * Customizable data views + * Multiple tabs + * Character encodings: All 8-bit encodings as supplied by Qt, EBCDIC + * Decoding table listing common simple data types. + + + +Okteta is a simple hex editor with not so fancy features. Although it can handle most of the tasks. There’s a separate module of it which you can use to embed this in other programs to view/edit files. + +Similar to all the above-mentioned editors, you can find this listed on your AppCenter and Software center as well. + +#### 4\. wxHexEditor + +![wxhexeditor][8] + +**Key Features:** + + * Easily handle big files + * Has x86 disassembly support + * **** Sector Indication **** on Disk devices + * Supports customizable hex panel formatting and colors. + + + +This is something interesting. It is primarily a Hex editor but you can also use it as a low level disk editor. For example, if you have a problem with your HDD, you can use this editor to edit the the sectors in raw hex and fix it. + +You can find it listed on your App Center and Software Center. If not, [Sourceforge][9] is the way to go. + +#### 5\. Hexedit (Command Line) + +![hexedit][10] + +**Key Features** : + + * Works via terminal + * It’s fast and simple + + + +If you want something to work on your terminal, you can go ahead and install Hexedit via the console. It’s my favorite Linux hex editor in command line. + +When you launch it, you will have to specify the location of the file, and it’ll then open it for you. + +To install it, just type in: + +``` +sudo apt install hexedit +``` + +### Wrapping Up + +Hex editors could come in handy to experiment and learn. If you are someone experienced, you should opt for the one with more feature – with a GUI. Although, it all comes down to personal preferences. + +What do you think about the usefulness of Hex editors? Which one do you use? Did we miss listing your favorite? Let us know in the comments! + +![][11] + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/hex-editors-linux + +作者:[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://en.wikipedia.org/wiki/Hex_editor +[2]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/01/Linux-hex-editors-800x450.jpeg?resize=800%2C450&ssl=1 +[3]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/01/bless-hex-editor.jpg?ssl=1 +[4]: https://github.com/bwrsandman/Bless +[5]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/01/ghex-hex-editor.jpg?ssl=1 +[6]: https://github.com/GNOME/ghex +[7]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/01/okteta-hex-editor-800x466.jpg?resize=800%2C466&ssl=1 +[8]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/01/wxhexeditor.jpg?ssl=1 +[9]: https://sourceforge.net/projects/wxhexeditor/ +[10]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/01/hexedit-console.jpg?resize=800%2C566&ssl=1 +[11]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/01/Linux-hex-editors.jpeg?fit=800%2C450&ssl=1 From 6f30e87f847856c8406df4094ce16a62149c2e0e Mon Sep 17 00:00:00 2001 From: geekpi Date: Thu, 31 Jan 2019 10:24:24 +0800 Subject: [PATCH 231/243] translated --- ...nk, an open source personal finance app.md | 61 ------------------- ...nk, an open source personal finance app.md | 61 +++++++++++++++++++ 2 files changed, 61 insertions(+), 61 deletions(-) delete mode 100644 sources/tech/20190120 Get started with HomeBank, an open source personal finance app.md create mode 100644 translated/tech/20190120 Get started with HomeBank, an open source personal finance app.md diff --git a/sources/tech/20190120 Get started with HomeBank, an open source personal finance app.md b/sources/tech/20190120 Get started with HomeBank, an open source personal finance app.md deleted file mode 100644 index a925448cfb..0000000000 --- a/sources/tech/20190120 Get started with HomeBank, an open source personal finance app.md +++ /dev/null @@ -1,61 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (geekpi) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Get started with HomeBank, an open source personal finance app) -[#]: via: (https://opensource.com/article/19/1/productivity-tools-homebank) -[#]: author: (Kevin Sonney https://opensource.com/users/ksonney (Kevin Sonney)) - -Get started with HomeBank, an open source personal finance app -====== -Keep track of where your money is going with HomeBank, the eighth in our series on open source tools that will make you more productive in 2019. -![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/math_money_financial_calculator_colors.jpg?itok=_yEVTST1) - -There seems to be a mad rush at the beginning of every year to find ways to be more productive. New Year's resolutions, the itch to start the year off right, and of course, an "out with the old, in with the new" attitude all contribute to this. And the usual round of recommendations is heavily biased towards closed source and proprietary software. It doesn't have to be that way. - -Here's the eighth of my picks for 19 new (or new-to-you) open source tools to help you be more productive in 2019. - -### HomeBank - -Managing my finances can be really stressful. I don't look at my bank balance every day and sometimes have trouble keeping track of where my money is going. I often spend more time managing my finances than I need to, digging into accounts and payment histories to figure out where my money went. Knowing my finances are OK helps keep me calm and allows me to focus on other things. - -![](https://opensource.com/sites/default/files/uploads/homebank-1.png) - -[HomeBank][1] is a personal finance desktop application that helps decrease this type of stress by making it fairly easy to keep track of your finances. It has some nice reports to help you figure out where you're spending your money, allows you to set up rules for importing transactions, and supports most modern formats. - -HomeBank is available on most distributions by default, so installation is very easy. When you start it up for the first time, it will walk you through setup and allow you to create an account. From there, you can either import one of the supported file formats or start entering transactions. The transaction register itself is just that—a list of transactions. [Unlike some other apps][2], you don't have to learn [double-entry bookkeeping][3] to use HomeBank. - -![](https://opensource.com/sites/default/files/uploads/homebank-2.png) - -Importing files from your bank is handled with another step-by-step wizard, with options to create a new account or populate an existing one. Importing into a new account saves a little time since you don't have to pre-create all the accounts before starting the import. You can also import multiple files into an account at once, so you don't need to repeat the same steps for every file in every account. - -![](https://opensource.com/sites/default/files/uploads/homebank-3.png) - -The one pain point I've had with importing and managing accounts is category assignment. Categories are what allow you to break down your spending and see what you are spending money on, in general terms. HomeBank, unlike commercial services (and some commercial programs), requires you to manually set up all the assignments. But this is generally a one-time thing, and then the categories can be auto-applied as transactions are added/imported. There is also a button to analyze the account and auto-apply things that already exist, which speeds up categorizing a large import (like I did the first time). HomeBank comes with a large number of categories you can start with, and you can add your own as well. - -HomeBank also has budgeting features, allowing you to plan for the months ahead. - -![](https://opensource.com/sites/default/files/uploads/homebank-4.png) - -The big win, for me, is HomeBank's reports feature. Not only is there a chart on the main screen showing where you are spending your money, but there are a whole host of other reports you can look at. If you use the budget feature, there is a report that tracks your spending against your budget. You can also view those reports as pie and bar charts. There is also a trend report and a balance report, so you can look back and see changes or patterns over time. - -Overall, HomeBank is a very friendly, useful application to help you keep your finances in order. It is simple to use and really helpful if keeping track of your money is a major stress point in your life. - - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/19/1/productivity-tools-homebank - -作者:[Kevin Sonney][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://opensource.com/users/ksonney (Kevin Sonney) -[b]: https://github.com/lujun9972 -[1]: http://homebank.free.fr/en/index.php -[2]: https://www.gnucash.org/ -[3]: https://en.wikipedia.org/wiki/Double-entry_bookkeeping_system diff --git a/translated/tech/20190120 Get started with HomeBank, an open source personal finance app.md b/translated/tech/20190120 Get started with HomeBank, an open source personal finance app.md new file mode 100644 index 0000000000..d124db94c0 --- /dev/null +++ b/translated/tech/20190120 Get started with HomeBank, an open source personal finance app.md @@ -0,0 +1,61 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Get started with HomeBank, an open source personal finance app) +[#]: via: (https://opensource.com/article/19/1/productivity-tools-homebank) +[#]: author: (Kevin Sonney https://opensource.com/users/ksonney (Kevin Sonney)) + +开始使用 HomeBank,一个开源个人财务应用 +====== +使用 HomeBank 跟踪你的资金流向,这是我们开源工具系列中的第八个工具,它将在 2019 年提高你的工作效率。 +![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/math_money_financial_calculator_colors.jpg?itok=_yEVTST1) + +每年年初似乎都有疯狂的冲动想提高工作效率。新年的决心,渴望开启新的一年,当然,“抛弃旧的,拥抱新的”的态度促成了这一切。通常这时的建议严重偏向闭源和专有软件,但事实上并不用这样。 + +这是我挑选出的 19 个新的(或者对你而言新的)开源项目来帮助你在 2019 年更有效率。 + +### HomeBank + +管理我的财务可能会很有压力。我不会每天查看我的银行余额,有时也很难跟踪我的钱流向哪里。我经常会花更多的时间来管理我的财务,挖掘账户和付款历史并找出我的钱去了哪里。了解我的财务状况可以帮助我保持冷静,并让我专注于其他事情。 + +![](https://opensource.com/sites/default/files/uploads/homebank-1.png) + +[HomeBank][1] 是一款个人财务桌面应用,帮助你轻松跟踪你的财务状况,来帮助减少此类压力。它有很好的报告可以帮助你找出你花钱的地方,允许你设置导入交易的规则,并支持大多数现代格式。 + +HomeBank 默认可在大多数发行版上可用,因此安装它非常简单。当你第一次启动它时,它将引导你完成设置并让你创建一个帐户。之后,你可以导入任意一种支持的文件格式或开始输入交易。交易簿本身就是一个交易列表。 [与其他一些应用不同][2],你不必学习[复式簿记][3]来使用 HomeBank。 + +![](https://opensource.com/sites/default/files/uploads/homebank-2.png) + +从银行导入文件将使用另一个分步向导进行处理,该向导提供了创建新帐户或填充现有帐户的选项。导入新帐户可节省一点时间,因为你无需在开始导入之前预先创建所有帐户。你还可以一次将多个文件导入帐户,因此不需要对每个帐户中的每个文件重复相同的步骤。 + +![](https://opensource.com/sites/default/files/uploads/homebank-3.png) + +我在导入和管理帐户时遇到的一个痛点是指定类别。一般而言,类别可以让你分解你的支出,看看你花钱的方式。HomeBank 与一些商业服务(以及一些商业程序)不同,它要求你手动设置所有类别。但这通常是一次性的事情,它可以在添加/导入交易时自动添加类别。还有一个按钮来分析帐户并跳过已存在的内容,这样可以加快对大量导入的分类(就像我第一次做的那样)。HomeBank 提供了大量可用的类别,你也可以添加自己的类别。 + +HomeBank 还有预算功能,允许你计划未来几个月的开销。 + +![](https://opensource.com/sites/default/files/uploads/homebank-4.png) + +对我来说,最棒的功能是 HomeBank 的报告。主页面上不仅有一个图表显示你花钱的地方,而且还有许多其他报告可供你查看。如果你使用预算功能,还会有一份报告会根据预算跟踪你的支出情况。你还可以以饼图和条形图的方式查看报告。它还有趋势报告和余额报告,因此你可以回顾并查看一段时间内的变化或模式。 + +总的来说,HomeBank 是一个非常友好,有用的程序,可以帮助你保持良好的财务。如果跟踪你的钱是你生活中的一件麻烦事,它使用起来很简单并且非常有用。 + + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/1/productivity-tools-homebank + +作者:[Kevin Sonney][a] +选题:[lujun9972][b] +译者:[geekpi](https://github.com/geekpi) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/ksonney (Kevin Sonney) +[b]: https://github.com/lujun9972 +[1]: http://homebank.free.fr/en/index.php +[2]: https://www.gnucash.org/ +[3]: https://en.wikipedia.org/wiki/Double-entry_bookkeeping_system \ No newline at end of file From 1bca7924f63db7f1d5b1d87fac3fba4e75442434 Mon Sep 17 00:00:00 2001 From: geekpi Date: Thu, 31 Jan 2019 10:28:41 +0800 Subject: [PATCH 232/243] translating --- ...with Roland, a random selection tool for the command line.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20190119 Get started with Roland, a random selection tool for the command line.md b/sources/tech/20190119 Get started with Roland, a random selection tool for the command line.md index 1bfeb92c0c..edf787447b 100644 --- a/sources/tech/20190119 Get started with Roland, a random selection tool for the command line.md +++ b/sources/tech/20190119 Get started with Roland, a random selection tool for the command line.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (geekpi) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From b0aad8e5b3517b64ecc339dc61760cc684f53b1b Mon Sep 17 00:00:00 2001 From: HankChow <280630620@qq.com> Date: Thu, 31 Jan 2019 14:32:48 +0800 Subject: [PATCH 233/243] hankchow translated --- ...24 Understanding Angle Brackets in Bash.md | 154 ------------------ ...24 Understanding Angle Brackets in Bash.md | 151 +++++++++++++++++ 2 files changed, 151 insertions(+), 154 deletions(-) delete mode 100644 sources/tech/20190124 Understanding Angle Brackets in Bash.md create mode 100644 translated/tech/20190124 Understanding Angle Brackets in Bash.md diff --git a/sources/tech/20190124 Understanding Angle Brackets in Bash.md b/sources/tech/20190124 Understanding Angle Brackets in Bash.md deleted file mode 100644 index 063eec3fd0..0000000000 --- a/sources/tech/20190124 Understanding Angle Brackets in Bash.md +++ /dev/null @@ -1,154 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (HankChow) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Understanding Angle Brackets in Bash) -[#]: via: (https://www.linux.com/blog/learn/2019/1/understanding-angle-brackets-bash) -[#]: author: (Paul Brown https://www.linux.com/users/bro66) - -Understanding Angle Brackets in Bash -====== - -![](https://www.linux.com/sites/lcom/files/styles/rendered_file/public/architecture-1839450_1920.jpg?itok=ra6XonD3) - -[Bash][1] provides many important built-in commands, like `ls`, `cd`, and `mv`, as well as regular tools such as `grep`, `awk,` and `sed`. But, it is equally important to know the punctuation marks -- [the glue in the shape of dots][2], commas, brackets. and quotes -- that allow you to transform and push data from one place to another. Take angle brackets (`< >`), for example. - -### Pushing Around - -If you are familiar with other programming and scripting languages, you may have used `<` and `>` as logical operators to check in a condition whether one value is larger or smaller than another. If you have ever written HTML, you have used angle brackets to enclose tags. - -In shell scripting, you can also use brackets to push data from place to place, for example, to a file: - -``` -ls > dir_content.txt -``` - -In this example, instead of showing the contents of the directory on the command line, `>` tells the shell to copy it into a file called _dir_content.txt_. If _dir_content.txt_ doesn't exist, Bash will create it for you, but if _dir_content.txt_ already exists and is not empty, you will overwrite whatever it contained, so be careful! - -You can avoid overwriting existing content by tacking the new stuff onto the end of the old stuff. For that you use `>>` (instead of `>`): - -``` -ls $HOME > dir_content.txt; wc -l dir_content.txt >> dir_content.txt -``` - -This line stores the list of contents of your home directory into _dir_content.txt_. You then count the number of lines in _dir_content.txt_ (which gives you the number of items in the directory) with [`wc -l`][3] and you tack that value onto the end of the file. - -After running the command line on my machine, this is what my _dir_content.txt_ file looks like: - -``` -Applications -bin -cloud -Desktop -Documents -Downloads -Games -ISOs -lib -logs -Music -OpenSCAD -Pictures -Public -Templates -test_dir -Videos -17 dir_content.txt -``` - -The mnemonic here is to look at `>` and `>>` as arrows. In fact, the arrows can point the other way, too. Say you have a file called _CBActors_ containing some names of actors and the number of films by the Coen brothers they have been in. Something like this: - -``` -John Goodman 5 -John Turturro 3 -George Clooney 2 -Frances McDormand 6 -Steve Buscemi 5 -Jon Polito 4 -Tony Shalhoub 3 -James Gandolfini 1 -``` - -Something like - -``` -sort < CBActors # Do this -Frances McDormand 6 # And you get this -George Clooney 2 -James Gandolfini 1 -John Goodman 5 -John Turturro 3 -Jon Polito 4 -Steve Buscemi 5 -Tony Shalhoub 3 -``` - -Will [sort][4] the list alphabetically. But then again, you don't need `<` here since `sort` already expects a file anyway, so `sort CBActors` will work just as well. - -However, if you need to see who is the Coens' favorite actor, you can check with : - -``` -while read name surname films; do echo $films $name $surname > filmsfirst.txt; done < CBActors -``` - -Or, to make that a bit more readable: - -``` -while read name surname films;\ - do - echo $films $name $surname >> filmsfirst;\ - done < CBActors -``` - -Let's break this down, shall we? - - * the [`while ...; do ... done`][5] structure is a loop. The instructions between `do` and `done` are repeatedly executed while a condition is met, in this case... - * ... the [`read`][6] instruction has lines to read. `read` reads from the standard input and will continue reading until there is nothing more to read... - * ... And as standard input is fed in via `<` and comes from _CBActors_ , that means the `while` loop will loop until the last line of _CBActors_ is piped into the loop. - * Getting back to `read` for a sec, the tool is clever enough to see that there are three distinct fields separated by spaces on each line of the file. That allows you to put the first field from each line in the `name` variable, the second in `surname` and the third in `films`. This comes in handy later, on the line that says `echo $films $name $surname >> filmsfirst;\`, allowing you to reorder the fields and push them into a file called _filmsfirst_. - - - -At the end of all that, you have a file called _filmsfirst_ that looks like this: - -``` -5 John Goodman -3 John Turturro -2 George Clooney -6 Frances McDormand -5 Steve Buscemi -4 Jon Polito -3 Tony Shalhoub -1 James Gandolfini -``` - -which you can now use with `sort`: - -``` -sort -r filmsfirst -``` - -to see who is the Coens' favorite actor. Yes, it is Frances McDormand. (The [`-r`][4] option reverses the sort, so McDormand ends up on top). - -We'll look at more angles on this topic next time! - --------------------------------------------------------------------------------- - -via: https://www.linux.com/blog/learn/2019/1/understanding-angle-brackets-bash - -作者:[Paul Brown][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://www.linux.com/users/bro66 -[b]: https://github.com/lujun9972 -[1]: https://www.linux.com/blog/2019/1/bash-shell-utility-reaches-50-milestone -[2]: https://www.linux.com/blog/learn/2019/1/linux-tools-meaning-dot -[3]: https://linux.die.net/man/1/wc -[4]: https://linux.die.net/man/1/sort -[5]: http://tldp.org/HOWTO/Bash-Prog-Intro-HOWTO-7.html -[6]: https://linux.die.net/man/2/read diff --git a/translated/tech/20190124 Understanding Angle Brackets in Bash.md b/translated/tech/20190124 Understanding Angle Brackets in Bash.md new file mode 100644 index 0000000000..7e2ed95182 --- /dev/null +++ b/translated/tech/20190124 Understanding Angle Brackets in Bash.md @@ -0,0 +1,151 @@ +[#]: collector: (lujun9972) +[#]: translator: (HankChow) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Understanding Angle Brackets in Bash) +[#]: via: (https://www.linux.com/blog/learn/2019/1/understanding-angle-brackets-bash) +[#]: author: (Paul Brown https://www.linux.com/users/bro66) + +理解 Bash 中的尖括号 +====== + +![](https://www.linux.com/sites/lcom/files/styles/rendered_file/public/architecture-1839450_1920.jpg?itok=ra6XonD3) + +[Bash][1] 内置了很多诸如 `ls`、`cd`、`mv` 这样的重要的命令,也有很多诸如 `grep`、`awk`、`sed` 这些有用的工具。但除此之外,其实 [Bash][1] 中还有很多可以[起到胶水作用][2]的标点符号,例如点号(`.`)、逗号(`,`)、括号(`<>`)、引号(`"`)之类。下面我们就来看一下可以用来进行数据转换和转移的尖括号()。 + +### 转移数据 + +如果你对其它编程语言有所了解,你会知道尖括号 `<` 和 `>` 一般是作为逻辑运算符,用来比较两个值之间的大小关系。如果你还编写 HTML,尖括号作为各种标签的一部分,就更不会让你感到陌生了。 + +在 shell 脚本语言中,尖括号可以将数据从一个地方转移到另一个地方。例如可以这样把数据存放到一个文件当中: + +``` +ls > dir_content.txt +``` + +在上面的例子中,`>` 符号让 shell 将 `ls` 命令的输出结果写入到 `dir_content.txt` 里,而不是直接显示在命令行中。需要注意的是,如果 `dir_content.txt` 这个文件不存在,Bash 会为你创建出来;但是如果 `dir_content.txt` 是一个已有得非空文件,它的内容就会被覆盖掉。所以执行类似的操作之前务必谨慎。 + +你也可以不使用 `>` 而使用 `>>`,这样就可以把新的数据追加到文件的末端而不会覆盖掉文件中已有的数据了。例如: + +``` +ls $HOME > dir_content.txt; wc -l dir_content.txt >> dir_content.txt +``` + +在这串命令里,首先将 home 目录的内容写入到 `dir_content.txt` 文件中,然后使用 `wc -l` 计算出 `dir_content.txt` 文件的行数(也就是 home 目录中的文件数)并追加到 `dir_content.txt` 的末尾。 + +在我的机器上执行上述命令之后,`dir_content.txt` 的内容会是以下这样: + +``` +Applications +bin +cloud +Desktop +Documents +Downloads +Games +ISOs +lib +logs +Music +OpenSCAD +Pictures +Public +Templates +test_dir +Videos +17 dir_content.txt +``` + +你可以将 `>` 和 `>>` 作为箭头来理解。当然,这个箭头的指向也可以反过来。例如,Coen brothers 的一些演员以及他们出演电影的次数保存在 `CBActors` 文件中,就像这样: + +``` +John Goodman 5 +John Turturro 3 +George Clooney 2 +Frances McDormand 6 +Steve Buscemi 5 +Jon Polito 4 +Tony Shalhoub 3 +James Gandolfini 1 +``` + +你可以执行这样的命令: + +``` +sort < CBActors +Frances McDormand 6 # 你会得到这样的输出 +George Clooney 2 +James Gandolfini 1 +John Goodman 5 +John Turturro 3 +Jon Polito 4 +Steve Buscemi 5 +Tony Shalhoub 3 +``` + +就可以使用 [`sort`][4] 命令将这个列表按照字母顺序输出。但是,`sort` 命令本来就可以接受传入一个文件,因此在这里使用 `<` 会略显多余,直接执行 `sort CBActors` 就可以得到期望的结果。 + +如果你想知道 Coens 最喜欢的演员是谁,你可以这样操作。首先: + +``` +while read name surname films; do echo $films $name $surname > filmsfirst.txt; done < CBActors +``` + +上面这串命令写在多行中可能会比较易读: + +``` +while read name surname films;\ + do + echo $films $name $surname >> filmsfirst;\ + done < CBActors +``` + +下面来分析一下这些命令做了什么: + + * [`while ...; do ... done`][5] 是一个循环结构。当 `while` 后面的条件成立时,`do` 和 `done` 之间的部分会一直重复执行; + * [`read`][6] 语句会按行读入内容。`read` 会从标准输入中持续读入,直到没有内容可读入; + * `CBActors` 文件的内容会通过 `<` 从标准输入中读入,因此 `while` 循环会将 `CBActors` 文件逐行完整读入; + * `read` 命令可以按照空格将每一行内容划分为三个字段,然后分别将这三个字段赋值给 `name`、`surname` 和 `films` 三个变量,这样就可以很方便地通过 `echo $films $name $surname >> filmsfirst;\` 来重新排列几个字段的放置顺序并存放到 `filmfirst` 文件里面了。 + +执行完以后,查看 `filmsfirst` 文件,内容会是这样的: + +``` +5 John Goodman +3 John Turturro +2 George Clooney +6 Frances McDormand +5 Steve Buscemi +4 Jon Polito +3 Tony Shalhoub +1 James Gandolfini +``` + +这时候再使用 `sort` 命令: + +``` +sort -r filmsfirst +``` + +就可以看到 Coens 最喜欢的演员是 Frances McDormand 了。(`-r` 参数表示降序排列,因此 McDormand 会排在最前面) + +-------------------------------------------------------------------------------- + +via: https://www.linux.com/blog/learn/2019/1/understanding-angle-brackets-bash + +作者:[Paul Brown][a] +选题:[lujun9972][b] +译者:[HankChow](https://github.com/HankChow) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.linux.com/users/bro66 +[b]: https://github.com/lujun9972 +[1]: https://www.linux.com/blog/2019/1/bash-shell-utility-reaches-50-milestone +[2]: https://www.linux.com/blog/learn/2019/1/linux-tools-meaning-dot +[3]: https://linux.die.net/man/1/wc +[4]: https://linux.die.net/man/1/sort +[5]: http://tldp.org/HOWTO/Bash-Prog-Intro-HOWTO-7.html +[6]: https://linux.die.net/man/2/read + From 6bf9dcc001232dd10c0ebb44d88247a00c5bf56f Mon Sep 17 00:00:00 2001 From: MjSeven Date: Wed, 30 Jan 2019 23:48:30 +0800 Subject: [PATCH 234/243] Translating by MjSeven --- ... A Package Is Available On Your Linux Distribution Or Not.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sources/tech/20180626 How To Search If A Package Is Available On Your Linux Distribution Or Not.md b/sources/tech/20180626 How To Search If A Package Is Available On Your Linux Distribution Or Not.md index b731465a55..f1390faab0 100644 --- a/sources/tech/20180626 How To Search If A Package Is Available On Your Linux Distribution Or Not.md +++ b/sources/tech/20180626 How To Search If A Package Is Available On Your Linux Distribution Or Not.md @@ -1,3 +1,5 @@ +Translating by MjSeven + How To Search If A Package Is Available On Your Linux Distribution Or Not ====== You can directly install the require package which you want if you know the package name. From f142e62ae4baff70dd01eaea01077dbd728fa5aa Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Thu, 31 Jan 2019 21:42:35 +0800 Subject: [PATCH 235/243] PRF:20190123 Getting started with Isotope, an open source webmail client.md @MjSeven --- ... Isotope, an open source webmail client.md | 25 +++++++++---------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/translated/tech/20190123 Getting started with Isotope, an open source webmail client.md b/translated/tech/20190123 Getting started with Isotope, an open source webmail client.md index 0598fc8963..2f8be92851 100644 --- a/translated/tech/20190123 Getting started with Isotope, an open source webmail client.md +++ b/translated/tech/20190123 Getting started with Isotope, an open source webmail client.md @@ -1,43 +1,42 @@ [#]: collector: (lujun9972) [#]: translator: (MjSeven) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Getting started with Isotope, an open source webmail client) [#]: via: (https://opensource.com/article/19/1/productivity-tool-isotope) [#]: author: (Kevin Sonney https://opensource.com/users/ksonney (Kevin Sonney)) - -Isotope 入门:一个开源的 Web 邮件客户端 +开始使用 Isotope 吧,一款开源的 Web 邮件客户端 ====== -使用 Isotope(一个轻量级的电子邮件客户端)阅读富文本电子邮件,它是我们在开源工具系列的第 11 个,将使你在 2019 年更高效。 + +> 使用轻量级的电子邮件客户端 Isotope 阅读富文本电子邮件,这个开源工具系列的第十一个工具将使你在 2019 年更高效。 ![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/newsletter_email_mail_web_browser.jpg?itok=Lo91H9UH) -在每年的年初,似乎都有一股疯狂的寻找提高工作效率方法的冲动。新年决心,渴望以正确的方式开始新的一年。当然,“旧不去的,新的不来”的态度都会导致这种情况。一般的建议都偏向于私有和专业软件,然而并不是必须这样。 +在每年的年初,似乎都有一股疯狂的寻找提高工作效率方法的冲动。新年决心,渴望以正确的方式开始新的一年。当然,“旧不去的,新的不来”的态度都会导致这种情况。一般的建议都偏向于闭源和专有软件,然而并不是必须这样。 以下是我挑选的 19 个新的(或者对你来说是新的)开源工具中的第 11 个,它将帮助你在 2019 年提高工作效率。 ### Isotope -正如我们在[本系列的第四篇文章][1](关于 Cypht)中所讨论的那样,我们花了很多时间来处理电子邮件。有很多方法可以解决它,我已经花了很多时间来寻找最适合我的电子邮件客户端。我认为这是一个重要的区别:对我有效的方法并不总是对其它人有效。有时对我有用的是像 [Thunderbird][2] 这样的完整客户端,有时是像 [Mutt][3] 这样的控制台客户端,有时是像 [Gmail][4] 和 [RoundCube][5] 这样基于 Web 的界面。 +正如我们在[本系列的第四篇文章][1](Cypht)中所讨论的那样,我们花了很多时间来处理电子邮件。有很多方法可以解决它,我已经花了很多时间来寻找最适合我的电子邮件客户端。我认为这是一个重要的区别:对我有效的方法并不总是对其它人有效。有时对我有用的是像 [Thunderbird][2] 这样的完整客户端,有时是像 [Mutt][3] 这样的控制台客户端,有时是像 [Gmail][4] 和 [RoundCube][5] 这样基于 Web 的界面。 ![](https://opensource.com/sites/default/files/uploads/isotope_1.png) -[Isotope][6] 是一个本地托管的,基于 Web 的电子邮件客户端。它非常轻巧,只使用 IMAP 协议,占用的磁盘空间非常小。与 Cypht 不同,Isotope 具有完整的 HTML 邮件支持,这意味着显示富文本电子邮件没有问题。 +[Isotope][6] 是一个本地托管的、基于 Web 的电子邮件客户端。它非常轻巧,只使用 IMAP 协议,占用的磁盘空间非常小。与 Cypht 不同,Isotope 具有完整的 HTML 邮件支持,这意味着显示富文本电子邮件没有问题。 ![](https://opensource.com/sites/default/files/uploads/isotope_2_0.png) -如果你安装了 [Docker][7],那么安装 Isotope 非常容易。你只需将文档中的命令复制到控制台中,然后按下 Enter 键。在浏览器中输入 **localhost** 来获取 Isotope 登录界面,输入你的 IMAP 服务器,登录名和密码将打开收件箱视图。 +如果你安装了 [Docker][7],那么安装 Isotope 非常容易。你只需将文档中的命令复制到控制台中,然后按下回车键。在浏览器中输入 `localhost` 来访问 Isotope 登录界面,输入你的 IMAP 服务器,登录名和密码将打开收件箱视图。 ![](https://opensource.com/sites/default/files/uploads/isotope_3.png) -在这一点上,Isotope 的功能和你想象的差不多。单击消息进行查看,单击铅笔图标以创建新邮件等。你会注意到用户界面(UI)非常简单,没有“移动到文件夹”,“复制到文件夹”和“存档”等常规按钮。你可以通过拖动来移动消息,因此无论如何你都不会错过这些按钮。 +在这一点上,Isotope 的功能和你想象的差不多。单击消息进行查看,单击铅笔图标以创建新邮件等。你会注意到用户界面(UI)非常简单,没有“移动到文件夹”、“复制到文件夹”和“存档”等常规按钮。你可以通过拖动来移动消息,因此其实你并不太需要这些按钮。 ![](https://opensource.com/sites/default/files/uploads/isotope_4.png) -总的来说,Isotope 干净,速度快,工作得非常好。更棒的是,它正在积极开发中(最近一次的提交是在我撰写本文的两小时之前),所以它正在不断得到改进。你可以查看代码并在 [GitHub][8] 上为它做出贡献。 - +总的来说,Isotope 干净、速度快、工作得非常好。更棒的是,它正在积极开发中(最近一次的提交是在我撰写本文的两小时之前),所以它正在不断得到改进。你可以查看代码并在 [GitHub][8] 上为它做出贡献。 -------------------------------------------------------------------------------- @@ -45,8 +44,8 @@ via: https://opensource.com/article/19/1/productivity-tool-isotope 作者:[Kevin Sonney][a] 选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) +译者:[MjSeven](https://github.com/MjSeven) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 705dee23094348ce14f54628dd207d43272703d5 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Thu, 31 Jan 2019 21:43:11 +0800 Subject: [PATCH 236/243] PUB:20190123 Getting started with Isotope, an open source webmail client.md @MjSeven https://linux.cn/article-10494-1.html --- ...ing started with Isotope, an open source webmail client.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20190123 Getting started with Isotope, an open source webmail client.md (98%) diff --git a/translated/tech/20190123 Getting started with Isotope, an open source webmail client.md b/published/20190123 Getting started with Isotope, an open source webmail client.md similarity index 98% rename from translated/tech/20190123 Getting started with Isotope, an open source webmail client.md rename to published/20190123 Getting started with Isotope, an open source webmail client.md index 2f8be92851..5397aad573 100644 --- a/translated/tech/20190123 Getting started with Isotope, an open source webmail client.md +++ b/published/20190123 Getting started with Isotope, an open source webmail client.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (MjSeven) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-10494-1.html) [#]: subject: (Getting started with Isotope, an open source webmail client) [#]: via: (https://opensource.com/article/19/1/productivity-tool-isotope) [#]: author: (Kevin Sonney https://opensource.com/users/ksonney (Kevin Sonney)) From 9251382368ae0507c909f6bf0f3f04bd8693b4d8 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Thu, 31 Jan 2019 21:52:08 +0800 Subject: [PATCH 237/243] PRF:20181207 Plan your own holiday calendar at the Linux command line.md @MjSeven --- ...iday calendar at the Linux command line.md | 20 ++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/translated/tech/20181207 Plan your own holiday calendar at the Linux command line.md b/translated/tech/20181207 Plan your own holiday calendar at the Linux command line.md index 6d959d7339..30a529a1d3 100644 --- a/translated/tech/20181207 Plan your own holiday calendar at the Linux command line.md +++ b/translated/tech/20181207 Plan your own holiday calendar at the Linux command line.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (MjSeven) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Plan your own holiday calendar at the Linux command line) @@ -9,16 +9,18 @@ 在 Linux 命令行中规划你的假期日历 ====== -将命令链接在一起,构建一个彩色日历,然后在暴风雪中将其拂去。 + +> 将命令链接在一起,构建一个彩色日历,然后在暴风雪中将其拂去。 + ![](https://opensource.com/sites/default/files/styles/image-full-size/public/uploads/linux-toy-cal.png?itok=S0F8RY9k) 欢迎阅读今天推出的 Linux 命令行玩具降临日历。如果这是你第一次访问本系列,你可能会问:什么是命令行玩具。即使我不太确定,但一般来说,它可以是一个游戏或任何简单的娱乐,可以帮助你在终端玩得开心。 很可能你们中的一些人之前已经看过我们日历上的各种选择,但我们希望给每个人至少一件新东西。 -我们在没有创建实际日历的情况下完成了本系列的第 7 天,所以今天让我们使用命令行工具来做到这一点:**cal**。就其本身而言,**cal** 可能不是最令人惊奇的工具,但我们可以使用其它一些实用程序来为它增添一些趣味。 +我们在没有创建实际日历的情况下完成了本系列的第 7 天,所以今天让我们使用命令行工具来做到这一点:`cal`。就其本身而言,`cal` 可能不是最令人惊奇的工具,但我们可以使用其它一些实用程序来为它增添一些趣味。 -很可能,你的系统上已经安装了 **cal**。要使用它,只需要输入 **cal** 即可。 +很可能,你的系统上已经安装了 `cal`。要使用它,只需要输入 `cal` 即可。 ``` $ cal @@ -32,7 +34,7 @@ Su Mo Tu We Th Fr Sa 30 31           ``` -我们不打算在本文中深入介绍高级用法,因此如果你想了解有关 **cal** 的更多信息,查看 Opensouce.com 社区版主 Don Watkin 的优秀文章 [date 和 cal 命令概述][1]。 +我们不打算在本文中深入介绍高级用法,因此如果你想了解有关 `cal` 的更多信息,查看 Opensouce.com 社区版主 Don Watkin 的优秀文章 [date 和 cal 命令概述][1]。 现在,让我们用一个漂亮的盒子来为它增添趣味,就像我们在上一篇 Linux 玩具文章中介绍的那样。我将使用钻石块,用一点内边距来对齐。 @@ -61,7 +63,7 @@ $ cal | boxes -d diamonds -p a1l4t2         \/          \/          \/ ``` -看起来很不错,但是为了好的测量,让我们把整个东西放到另一个盒子里,为了好玩,这次我们将使用滚动设计。 +看起来很不错,但是为了更规整,让我们把整个东西放到另一个盒子里,为了好玩,这次我们将使用卷轴式设计。 ``` cal | boxes -d diamonds -p a1t2l3 | boxes -a c -d scroll         @@ -93,7 +95,7 @@ cal | boxes -d diamonds -p a1t2l3 | boxes -a c -d scroll            ~~~                                                ~~~ ``` -完美。现在,事情变得有点疯狂了。我喜欢我们的设计,但我想全力以赴,所以我要给它上色。但是 Opensource.com 员工所在的北卡罗来版纳州罗利办公室,本周末很有可能下雪。所以,让我们享受彩色降临日历,然后用雪擦掉它。 +完美。现在,这事有点小激动了。我喜欢我们的设计,但我想更妙一些,所以我要给它上色。但是 Opensource.com 员工所在的北卡罗来版纳州罗利办公室,本周末很有可能下雪。所以,让我们享受彩色降临日历,然后用雪擦掉它。 关于雪,我抓取了一些 Bash 和 Gawk 的漂亮[代码片段][2],幸亏我发现了 CLIMagic。如果你不熟悉 CLIMagic,去查看他们的[网站][3],在 [Twitter][4] 上关注他们。你会满意的。 @@ -107,7 +109,7 @@ $ clear;cal|boxes -d diamonds -p a1t2l3|boxes -a c -d scroll|lolcat;sleep 3;whil ![](https://opensource.com/sites/default/files/uploads/linux-toy-cal-animated.gif) -要使它在你的系统上工作,你需要所有它引用的实用程序(box, lolcat, gawk 等),还需要使用支持 Unicode 的终端仿真器。 +要使它在你的系统上工作,你需要所有它引用的实用程序(`box`、`lolcat`、`gawk` 等),还需要使用支持 Unicode 的终端仿真器。 你有特别喜欢的命令行小玩具需要我介绍的吗?这个系列要介绍的小玩具大部分已经有了落实,但还预留了几个空位置。请在评论区留言,我会查看的。如果还有空位置,我会考虑介绍它的。如果没有,但如果我得到了一些很好的意见,我会在最后做一些有价值的提及。 @@ -120,7 +122,7 @@ via: https://opensource.com/article/18/12/linux-toy-cal 作者:[Jason Baker][a] 选题:[lujun9972][b] 译者:[MjSeven](https://github.com/MjSeven) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From ad03e06bc4b7c85a0588106f559ccd91f9cd689e Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Thu, 31 Jan 2019 21:53:07 +0800 Subject: [PATCH 238/243] PUB:20181207 Plan your own holiday calendar at the Linux command line.md @MjSeven https://linux.cn/article-10495-1.html --- ...lan your own holiday calendar at the Linux command line.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20181207 Plan your own holiday calendar at the Linux command line.md (99%) diff --git a/translated/tech/20181207 Plan your own holiday calendar at the Linux command line.md b/published/20181207 Plan your own holiday calendar at the Linux command line.md similarity index 99% rename from translated/tech/20181207 Plan your own holiday calendar at the Linux command line.md rename to published/20181207 Plan your own holiday calendar at the Linux command line.md index 30a529a1d3..0a216f0d7b 100644 --- a/translated/tech/20181207 Plan your own holiday calendar at the Linux command line.md +++ b/published/20181207 Plan your own holiday calendar at the Linux command line.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (MjSeven) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-10495-1.html) [#]: subject: (Plan your own holiday calendar at the Linux command line) [#]: via: (https://opensource.com/article/18/12/linux-toy-cal) [#]: author: (Jason Baker https://opensource.com/users/jason-baker) From afd552fab296606cf2ee915b2c2a7e86bdddb53b Mon Sep 17 00:00:00 2001 From: MjSeven Date: Thu, 31 Jan 2019 23:23:03 +0800 Subject: [PATCH 239/243] =?UTF-8?q?=E7=BF=BB=E8=AF=91=E5=AE=8C=E6=88=90=20?= =?UTF-8?q?20180626?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...lable On Your Linux Distribution Or Not.md | 101 ++++++++---------- 1 file changed, 44 insertions(+), 57 deletions(-) rename {sources => translated}/tech/20180626 How To Search If A Package Is Available On Your Linux Distribution Or Not.md (68%) diff --git a/sources/tech/20180626 How To Search If A Package Is Available On Your Linux Distribution Or Not.md b/translated/tech/20180626 How To Search If A Package Is Available On Your Linux Distribution Or Not.md similarity index 68% rename from sources/tech/20180626 How To Search If A Package Is Available On Your Linux Distribution Or Not.md rename to translated/tech/20180626 How To Search If A Package Is Available On Your Linux Distribution Or Not.md index f1390faab0..4f6a2dbe35 100644 --- a/sources/tech/20180626 How To Search If A Package Is Available On Your Linux Distribution Or Not.md +++ b/translated/tech/20180626 How To Search If A Package Is Available On Your Linux Distribution Or Not.md @@ -1,51 +1,46 @@ -Translating by MjSeven - -How To Search If A Package Is Available On Your Linux Distribution Or Not +如何搜索一个包是否在你的 Linux 发行版中 ====== -You can directly install the require package which you want if you know the package name. +如果你知道包名称,那么你可以直接安装所需的包。 -In some cases, if you don’t know the exact package name or you want to search some packages then you can easily search that package with help of distribution package manager. +在某些情况下,如果你不知道确切的包名称或者你想搜索某些包,那么你可以在分发包管理器的帮助下轻松搜索该包。 -Searches automatically include both installed and available packages. +自动搜索包括已安装和可用的包。 -The format of the results depends upon the option. If the query produces no information, there are no packages matching the criteria. +结果的格式取决于选项。如果查询没有生成任何信息,那么意味着没有匹配条件的包。 -This can be done through distribution package managers with variety of options. +这可以通过具有各种选项的分发包管理器来完成。 -I had added all the possible options in this article and you can select which is the best and suitable for you. +我已经在本文中添加了所有可能的选项,你可以选择最好的和最合适你的选项。 -Alternatively we can achieve this through **whohas** command. This will search the given package to all the major distributions (such as Debian, Ubuntu, Fedora, etc.,) not only your own system distribution. +或者,我们可以通过 **whohas** 命令实现这一点。它会从所有的主流发行版(例如 Debian, Ubuntu, Fedora 等)中搜索,而不仅仅是你自己的系统发行版。 -**Suggested Read :** -**(#)** [List of Command line Package Managers For Linux & Usage][1] -**(#)** [A Graphical frontend tool for Linux Package Manager][2] +**建议阅读:** +**(#)** [适用于 Linux 的命令行包管理器列表以及用法][1] +**(#)** [Linux 包管理器的图形前端工具][2] -### How to Search a Package in Debian/Ubuntu +### 如何在 Debian/Ubuntu 中搜索一个包 -We can use apt, apt-cache and aptitude package managers to find a given package on Debian based distributions. I had included vast of options with this package managers. +我们可以使用 apt, apt-cache 和 aptitude 包管理器在基于 Debian 的发行版上查找给定的包。我为这个包管理器中包括了大量的选项。 -We can done this on three ways in Debian based systems. +我们可以在基于 Debian 的系统中使用三种方式完成此操作。 - * apt command - * apt-cache command - * aptitude command + * apt 命令 + * apt-cache 命令 + * aptitude 命令 +### 如何使用 apt 命令搜索一个包 +APT 代表高级包管理工具 Advanced Packaging Tool(APT),它取代了 apt-get。它有功能丰富的命令行工具,包括所有功能包含在一个命令(APT)里,包括 apt-cache, apt-search, dpkg, apt-cdrom, apt-config, apt-key 等,还有其他几个独特的功能。 -### How to search a package using apt command - -APT stands for Advanced Packaging Tool (APT) which is replacement for apt-get. It’s feature rich command-line tools with included all the futures in one command (APT) such as apt-cache, apt-search, dpkg, apt-cdrom, apt-config, apt-key, etc..,. and several other unique features. - -APT is a powerful command-line tool for installing, downloading, removing, searching and managing as well as querying information about packages as a low-level access to all features of the libapt-pkg library. It’s contains some less used command-line utilities related to package management. +APT 是一个强大的命令行工具,它可以访问 libapt-pkg 底层库的所有特性,它可以用于安装,下载,删除,搜索和管理以及查询关于包的信息,另外它还包含一些较少使用的与包管理相关的命令行实用程序。 ``` $ apt -q list nano vlc Listing... nano/artful,now 2.8.6-3 amd64 [installed] vlc/artful 2.2.6-6 amd64 - ``` -Alternatively we can search a given package using below format. +或者,我们可以使用以下格式搜索指定的包。 ``` $ apt search ^vlc Sorting... Done @@ -70,9 +65,9 @@ vlc-plugin-base/artful 2.2.6-6 amd64 ``` -### How to search a package using apt-cache command +### 如何使用 apt-cache 命令搜索一个包 -apt-cache performs a variety of operations on APT’s package cache. Displays information about the given packages. apt-cache does not manipulate the state of the system but does provide operations to search and generate interesting output from the package metadata. +apt-cache 会在 APT 的包缓存上执行各种操作。它会显示有关指定包的信息。apt-cache 不会操纵系统的状态,但提供了从包的元数据中搜索和生成有趣输出的操作。 ``` $ apt-cache search nano | grep ^nano nano - small, friendly text editor inspired by Pico @@ -86,7 +81,7 @@ nanopolish - consensus caller for nanopore sequencing data ``` -Alternatively we can search a given package using below format. +或者,我们可以使用以下格式搜索指定的包。 ``` $ apt-cache policy vlc vlc: @@ -98,7 +93,7 @@ vlc: ``` -Alternatively we can search a given package using below format. +或者,我们可以使用以下格式搜索给定的包。 ``` $ apt-cache pkgnames vlc vlc-bin @@ -123,9 +118,9 @@ vlc-plugin-base ``` -### How to search a package using aptitude command +### 如何使用 aptitude 命令搜索一个包 -aptitude is a text-based interface to the Debian GNU/Linux package system. It allows the user to view the list of packages and to perform package management tasks such as installing, upgrading, and removing packages. Actions may be performed from a visual interface or from the command-line. +aptitude 一个基于文本的 Debian GNU/Linux 软件包系统的接口。它允许用户查看包列表,并执行包管理任务,例如安装,升级和删除包,它可以从可视化界面或命令行执行操作。 ``` $ aptitude search ^vlc p vlc - multimedia player and streamer @@ -168,9 +163,9 @@ p vlc-plugin-zvbi:i386 ``` -### How to Search a Package in RHEL/CentOS +### 如何在 RHEL/CentOS 中搜索一个包 -Yum (Yellowdog Updater Modified) is one of the package manager utility in Linux operating system. Yum command is used to install, update, search & remove packages on some Linux distributions based on RedHat. +Yum(Yellowdog Updater Modified)是 Linux 操作系统中的包管理器实用程序之一。Yum 命令用于在一些基于 RedHat 的 Linux 发行版上,它用来安装,更新,搜索和删除软件包。 ``` # yum search ftpd Loaded plugins: fastestmirror, refresh-packagekit, security @@ -189,15 +184,14 @@ vsftpd.x86_64 : Very Secure Ftp Daemon ``` -Alternatively we can search the same using below command. +或者,我们可以使用以下命令搜索相同内容。 ``` # yum list ftpd - ``` -### How to Search a Package in Fedora +### 如何在 Fedora 中搜索一个包 -DNF stands for Dandified yum. We can tell DNF, the next generation of yum package manager (Fork of Yum) using hawkey/libsolv library for backend. Aleš Kozumplík started working on DNF since Fedora 18 and its implemented/launched in Fedora 22 finally. +DNF 代表 Dandified yum。我们可以说 DNF 是下一代 yum 包管理器(Yum 的衍生),它使用 hawkey/libsolv 库作为底层。自从 Fedora 18 开始以及它最终在 Fedora 22 中实施以来,Aleš Kozumplík 就在开始研究 DNF。 ``` # dnf search ftpd Last metadata expiration check performed 0:42:28 ago on Tue Jun 9 22:52:44 2018. @@ -217,24 +211,22 @@ perl-ftpd.noarch : Secure, extensible and configurable Perl FTP server pure-ftpd.x86_64 : Lightweight, fast and secure FTP server pyftpdlib.noarch : Python FTP server library nordugrid-arc-gridftpd.x86_64 : ARC gridftp server - ``` -Alternatively we can search the same using below command. +或者,我们可以使用以下命令搜索相同的内容。 ``` # dnf list proftpd Failed to synchronize cache for repo 'heikoada-terminix', disabling. Last metadata expiration check: 0:08:02 ago on Tue 26 Jun 2018 04:30:05 PM IST. Available Packages proftpd.x86_64 - ``` -### How to Search a Package in Arch Linux +### 如何在 Arch Linux 中搜索一个包 -pacman stands for package manager utility (pacman). pacman is a command-line utility to install, build, remove and manage Arch Linux packages. pacman uses libalpm (Arch Linux Package Management (ALPM) library) as a back-end to perform all the actions. +pacman 代表包管理实用程序(pacman)。它是一个用于安装,构建,删除和管理 Arch Linux 软件包的命令行实用程序。pacman 使用 libalpm(Arch Linux Package Management(ALPM)库)作为底层来执行所有操作。 -In my case, i’m going to search chromium package. +在本例中,我将要搜索 chromium 包。 ``` # pacman -Ss chromium extra/chromium 48.0.2564.116-1 @@ -249,24 +241,22 @@ community/chromium-chromevox latest-1 community/fcitx-mozc 2.17.2313.102-1 Fcitx Module of A Japanese Input Method for Chromium OS, Windows, Mac and Linux (the Open Source Edition of Google Japanese Input) - ``` -By default `-s`‘s builtin ERE (Extended Regular Expressions) can cause a lot of unwanted results. Use the following format to match the package name only. +默认情况下,`-s` 选项内置 ERE(扩展正则表达式)会导致很多不需要的结果。使用以下格式会仅匹配包名称。 ``` # pacman -Ss '^chromium-' ``` -pkgfile is a tool for searching files from packages in the Arch Linux official repositories. +pkgfile 是一个用于在 Arch Linux 官方仓库的包中搜索文件的工具。 ``` # pkgfile chromium - ``` -### How to Search a Package in openSUSE +### 如何在 openSUSE 中搜索一个包 -Zypper is a command line package manager for suse & openSUSE distributions. It’s used to install, update, search & remove packages & manage repositories, perform various queries, and more. Zypper command-line interface to ZYpp system management library (libzypp). +Zypper 是 SUSE 和 openSUSE 发行版的命令行包管理器。它用于安装,更新,搜索和删除包以及管理仓库,执行各种查询等。Zypper 命令行接口到 ZYpp 系统管理库(libzypp)。 ``` # zypper search ftp or @@ -286,12 +276,11 @@ S | Name | Summary | Type | proftpd-sqlite | SQLite Module for ProFTPD | package | pure-ftpd | A Lightweight, Fast, and Secure FTP S-> | package | vsftpd | Very Secure FTP Daemon - Written from-> | package - ``` -### How to Search a Package using whohas command +### 如何使用 whohas 命令搜索一个包 -whohas command such a intelligent tools which search a given package to all the major distributions such as Debian, Ubuntu, Gentoo, Arch, AUR, Mandriva, Fedora, Fink, FreeBSD, NetBSD. +whohas 命令是一个智能工具,从所有主流发行版中搜索指定包,如 Debian, Ubuntu, Gentoo, Arch, AUR, Mandriva, Fedora, Fink, FreeBSD 和 NetBSD。 ``` $ whohas nano Mandriva nano-debug 2.3.1-1mdv2010.2.x http://sophie.zarb.org/rpms/0b33dc73bca710749ad14bbc3a67e15a @@ -308,10 +297,9 @@ Gentoo nano 9999 http://packages.gentoo.org/package/app-editors/nano Gentoo nano 9999 http://packages.gentoo.org/package/app-editors/nano Gentoo nano 2.9.8 http://packages.gentoo.org/package/app-editors/nano Gentoo nano 2.9.7 http://packages.gentoo.org/package/app-editors/nano - ``` -If you want to search a given package to only current distribution repository, use the below format. +如果你希望只从当前发行版仓库中搜索指定包,使用以下格式: ``` $ whohas -d Ubuntu vlc Ubuntu vlc 2.1.6-0ubuntu14.04 1M all http://packages.ubuntu.com/trusty/vlc @@ -330,7 +318,6 @@ Ubuntu browser-plugin-vlc 2.0.6-4 47K all http://packages.ubuntu.com/cosmic/brow Ubuntu libvlc-bin 2.2.6-6 27K all http://packages.ubuntu.com/artful/libvlc-bin Ubuntu libvlc-bin 3.0.1-3build1 17K all http://packages.ubuntu.com/bionic/libvlc-bin Ubuntu libvlc-bin 3.0.2-0ubuntu0.1 17K all http://packages.ubuntu.com/bionic-updates/libvlc-bin - ``` -------------------------------------------------------------------------------- @@ -339,7 +326,7 @@ via: https://www.2daygeek.com/how-to-search-if-a-package-is-available-on-your-li 作者:[Prakash Subramanian][a] 选题:[lujun9972](https://github.com/lujun9972) -译者:[译者ID](https://github.com/译者ID) +译者:[MjSeven](https://github.com/MjSeven) 校对:[校对者ID](https://github.com/校对者ID) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 2568015e470d4c92622ae773c963d54bd02d7292 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Thu, 31 Jan 2019 23:27:17 +0800 Subject: [PATCH 240/243] PRF:20171222 10 keys to quick game development.md @XYenChi --- ...71222 10 keys to quick game development.md | 65 ++++++++++--------- 1 file changed, 33 insertions(+), 32 deletions(-) diff --git a/translated/talk/20171222 10 keys to quick game development.md b/translated/talk/20171222 10 keys to quick game development.md index c41f66bfc7..54dbd9fb99 100644 --- a/translated/talk/20171222 10 keys to quick game development.md +++ b/translated/talk/20171222 10 keys to quick game development.md @@ -1,70 +1,71 @@ 快速开发游戏的十个关键 ====== + ![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/computer_keyboard_laptop_development_code_woman.png?itok=vbYz6jjb) -十月早些时候,Opensource.com赞助的 [Open Jam][1] 入职仪式为处于世界各地的团队设立了45个入口。这些队伍只有三天时间用开源软件制作出一个游戏来参与角逐,并 [取前三][2]。 +十月初,由 Opensource.com 赞助的首届 [Open Jam][1] 吸引了来自世界各地的团队的 45 个参赛项目。这些队伍只用了三天时间就用开源软件制作出一个游戏来参与角逐,[有三支队伍取得了胜利][2]。 -我们在大学为每一位愿意参与的人举办了我们自己的 Open Jam 活动。周末预留了计算机实验室教大家使用开源软件——游戏引擎:[Godot][3],音乐:[LMMS][4] ,2D画面: [GIMP][5] 和3D画面 [Blender][6] ——来创作游戏和相关组件。活动产出了三个游戏: [Loathsome][7], [Lost Artist][8], 和 [Paint Rider][9] (我做的)。 +我们在我们的大学为每一位愿意参与的人举办了我们自己的 Open Jam 活动。我们预留了周末的计算机实验室,并教大家使用开源软件来创建游戏和游戏素材:游戏引擎:[Godot][3]、音乐:[LMMS][4]、2D 素材:[GIMP][5]、3D 素材:[Blender][6]。我们的活动产出了三个游戏:[Loathsome][7]、[Lost Artist][8] 和 [Paint Rider][9](我做的)。 -总的说来,我从游戏创作和游戏开发中,学到了十课关于游戏引擎、代码和快速游戏开发。 +根据我在游戏开发和游戏开发方面的经验,这里有 10 条关于游戏引擎、编码和快速游戏开发的经验教训。 -## 1\. 限定规模 +## 1、限定规模 -很容易想要去做一个规模宏大的冒险游戏或者比拟你最喜欢的游戏的东西。追求高于游戏创作之外的东西可能很酷,如果你有体会,但不要高估自己拥有的时间。我欣赏游戏创作的一点是强制你快速将一个游戏从概念阶段变成最终产品,因为你的时间非常有限。这也就是限定规模如此重要。 +很容易想要去做一个规模宏大的冒险游戏或者可以比拟你最喜欢的游戏的东西。如果你有一些经验,追求超乎游戏 Jam 活动的东西可能很酷,但不要高估自己拥有的时间。我欣赏游戏 Jam 活动的一点是它强制你快速将一个游戏从概念阶段变成最终产品,因为你的时间非常有限。这也就是限定规模如此重要的原因。 -Open Jam 的主题是“留下痕迹”,题目一出来,我和朋友就开始讨论什么样的游戏合题意。有个想法就是做玩家能在敌人身上留下伤痕的3D拳击游戏。我几乎没有做3D游戏的经验,我想做好的话,在我甚至还没发掘出可玩性之前,就得花太多时间在学习如何让痕迹合理和打击有效。 +这个 Open Jam 的主题是“留下痕迹”,题目一出来,我和朋友就开始讨论什么样的游戏适合该主题。一个想法就是做玩家能在敌人身上留下伤痕的 3D 拳击游戏。我几乎没有做 3D 游戏的经验,我想做好的话,在我甚至还没发掘出可玩性之前,就得花太多时间在学习如何让痕迹合理和打击有效。 -## 2\. 尽早可玩 +## 2、尽早可玩 -对游戏创作我最中肯的建议就是这。试着做出核心部件,快速写出代码,这样你就可以测试并决定它是否值得做成一个完整的游戏。不应该只剩几个小时截止了,才让你的游戏可玩。像 Open Jam 这样的三天创作,最好少花时间在实现概念上。 +这是我对游戏 Jam 活动最中肯的建议。试着做出核心机制,快速写出代码,这样你就可以测试并决定它是否值得做成一个完整的游戏。不应该只剩几个小时截止了,你的游戏才可玩。像 Open Jam 这样的三天的活动,不应该花费几个小时以上来做一个可以运行的演示。 -## 3\. 保持简单 +## 3、保持简单 -你想加入的每个特性都会延长整个开发时间。因为你不能迅速使之运行,所以无从得知提交一个新特性是否会消耗大量时间。街机风格的高分作品往往会在游戏创作中表现良好,它们天生就很简单。一旦核心部分完成,你可以开始加入特性并润色,无需担心最后游戏是否功能强大。 +你想加入的每个特性都会延长整个开发时间。因为你不能迅速使之运行,所以无从得知提交一个新特性是否会消耗大量时间。街机风格的高分作品往往会在游戏 Jam 活动中表现良好,它们天生就很简单。一旦核心部分完成,你可以开始加入特性并润色,无需担心最后游戏是否功能正常。 -## 4\. 从其他游戏获取灵感 +## 4、从其他游戏获取灵感 -可能你想做出完全原创的作品,但作品的原型极其有用。原型将节省重复劳动的时间,因为你已经知道什么有趣。告诉自己实践的经验越多,越容易做出包含自己想法的大型游戏,自然你也能从再创作其他人的作品中很好地练习。 +可能你想做出完全原创的作品,但有个可以基于它开发的原型极其有用。这将节省重复劳动的时间,因为你已经知道什么有趣。告诉自己实践的经验越多,越容易做出包含自己想法的大型游戏,所以你也能从再创作其他人的作品中得到很好地练习。 -考虑到 Open Jam 的“留下痕迹”主题,我觉得创作一个玩的时候可以留下颜料痕迹的游戏会很有趣,这样也可以看到你留下的标记。我记得这款老式动画游戏 [Line Rider 2 Beta][10] (后来叫 Paint Rider),而且知道玩的时候按住 Control 键可以画出痕迹的彩蛋。我简化了概念,甚至只需要一个按键来垂直移动。(更像老式飞机游戏)。大概一两个小时的创作,我有了基本模型,用一个按钮上下移动和留下小黑圈的痕迹。 +考虑到 Open Jam 的“留下痕迹”主题,我觉得创作一个玩的时候可以留下颜料痕迹的游戏会很有趣,这样也可以看到你留下的标记。我记得有款老式动画游戏 [Line Rider 2 Beta][10] (后来叫 Paint Rider),而且知道玩的时候按住 Control 键可以画出痕迹的彩蛋。我简化了这个概念,甚至只需要一个按键来垂直移动。(更像老式飞机游戏)。进入到 Jam 活动大概一两个小时后,我就有了基本模型,可以用一个按钮上下移动和留下小黑圈的痕迹。 -## 5\. 不要忽视可得性 +## 5、不要忽视可得性 -确保尽可能多的人能玩你的游戏。某个提交到 Open Jam 的游戏是虚拟现实游戏。尽管那很酷,但几乎没有人可以玩,因为拥有VR设备的人不多。所幸它的开发者并不期望取得好名次,只是想练手。但如果你想和人们分享你的游戏(或者赢得游戏创作),注意可得性是很重要的。 +确保尽可能多的人能玩你的游戏。某个提交到 Open Jam 的游戏是虚拟现实游戏。尽管那很酷,但几乎没有人可以玩,因为拥有 VR 设备的人不多。所幸它的开发者并不期望取得好名次,只是想练手。但如果你想和人们分享你的游戏(或者赢得游戏 Jam 活动),注意可得性是很重要的。 -Godot (和其他大多数游戏引擎)允许你在所有主流平台发布游戏。提交游戏时,特别是在 [Itch.io][11],有浏览器版本将支持大多数人玩。但尽你所能去发布在更多的平台和开放系统上。我甚至试着在移动端发布 Paint Rider ,但技术有限。 +Godot (和其他大多数游戏引擎)允许你在所有主流平台发布游戏。提交游戏时,特别是在 [Itch.io][11],有个浏览器版本就可以支持大多数人玩。但尽你所能去发布在更多的平台和操作系统上。我甚至试着在移动端发布 Paint Rider,但技术有限。 -## 6\. 不要做得太难 +## 6、不要做得太难 -如果游戏需要花费过多精力去学或者玩,你将失去一部分玩家。这照应了保持简单和限定规模,在游戏计划阶段非常重要。再次重申,想做一个宏大的游戏花上十天半个月开发很容易;难的是做出好玩、简单的游戏。 +如果游戏需要花费过多精力去学或者玩,你将失去一部分玩家。要保持简单和限定规模,这在游戏计划阶段非常重要。再次重申,想出一个需要花上十天半个月开发的宏大的游戏创意很容易;难的是做出好玩、简单的游戏。 -给妈妈介绍了 Paint Rider 之后,她很快开始玩起来,我认为不需要跟她说明更多。 +给我的妈妈介绍了 Paint Rider 之后,她很快开始玩起来,我认为不需要跟她说明更多。 -## 7\. 不用太整洁 +## 7、不用太整洁 -如果你习惯于花时间在设计每处图案和确保代码可复用、可适应,试着放松一点。如果你花太多时间考虑设计,当你最后到了可以玩游戏的时候,你可能发现游戏不是很有趣,那时候就来不及修改了。 +如果你习惯于花时间在设计模式上和确保代码可复用、可适应,试着放松一点。如果你花太多时间考虑设计,当你最后到了可以玩游戏的时候,你可能发现游戏不是很有趣,那时候就来不及修改了。 -这过程也适用于简化更严格的游戏:快速码出验证概念性展示模型直到找出值得做成完整游戏的,然后你潜心建立完美的代码基础来支持它。游戏创作的开发游戏就像快速码出可验证的理念。 +这过程也适用于简化更严格的游戏:快速码出验证概念性展示模型,直到找出值得做成完整游戏的,然后你可以潜心建立完美的代码来支持它。为游戏 Jame 活动创作的游戏就像是个快速开发一个可验证的模型一样。 -## 8\. 但也不要太随意 +## 8、但也不要太随意 -另一方面, [意大利面式代码][12] 容易失控,即使游戏开发没有大量代码。还好大多是游戏引擎用脑中的设计图建成。就拿 Godot 的[信号][13] 功能来说,节点可以发送数据信息给它们“连上了”的节点——这是你的设计自动成型的[观测图][14]。 只要你知道如何利用游戏引擎的特性,就可以快速写代码,你的代码也不会特别难读。 +另一方面, [意大利面式代码][12] 容易失控,即使游戏开发没有大量代码。还好大多是游戏引擎都考虑到了设计模式。就拿 Godot 的[信号][13] 功能来说,节点可以发送数据信息给它们“连上了”的节点 —— 这是你的设计自动成型的[观察者模式][14]。只要你知道如何利用这种游戏引擎的特性的优势,就可以快速写代码,你的代码也不会特别难读。 -## 9\. 取得反馈 +## 9、取得反馈 -向人们展示你正在做的。让他们试一试并看看他们说些啥。看看他们如何玩你的游戏,找找他们有没有发现你期望之外的事。如果游戏创作有[争论][15] 频道或者类似的,把你的游戏放上去,人们会反馈你的想法。 Paint Rider 的定义功能之一是画布循环,所以你可以看到之前留下来的画。在有人问我为什么这个游戏没有之前,我甚至没有考虑那个设置。 +向人们展示你正在做的。让他们试一试并看看他们说些啥。看看他们如何玩你的游戏,找找他们有没有发现你预料之外的事。如果游戏 Jam 活动有 [Discord][15] 频道或者类似的,把你的游戏放上去,人们会反馈给你想法。Paint Rider 的一个确定的功能是画布循环,所以你可以看到之前留下来的画。在有人问我为什么这个游戏没有之前,我甚至没有考虑那个机制。 -团队协作的话,确保有其他可以传递周围反馈的人参与这个开发。 +团队协作的话,确保有可以传递周围反馈的人参与这个开发。 而且不要忘了用相同的方式帮助其他人;如果你在玩其他人游戏的时候发现了有助于你游戏的东西,这就是双赢。 -## 10\. 哪里找资源 +## 10、哪里找资源 -做出所有你自己的组件真的会拖你后腿。 Open Jam 期间,当我忙于组装新特性和修漏洞时,我注意到 Loathsome 的开发者花了大量时间在绘制主要角色上,你可以简化游戏的艺术风格创作并且用一些视听效果尚可的东西,这里有其他选择。试着在 [Creative Commons][16] 上寻找组件或者免费音乐站点,比如 [Anttis Instrumentals][17] 。或者,可行的话,组一个有专门艺术家、作家或者音乐家的团队。 +做出所有你自己的资源真的会拖你后腿。Open Jam 期间,当我忙于组装新特性和修漏洞时,我注意到 Loathsome 的开发者花了大量时间在绘制主要角色上。你可以简化游戏的艺术风格创作并且用一些视听效果尚可的东西,但这里还有其他选择。试着寻找 [Creative Commons][16] 许可的或免费音乐站点(比如 [Anttis Instrumentals][17])的资源。或者,可行的话,组建一个有专门艺术家、作家或者音乐家的团队。 -其他你可能觉得有用的软件有 [Krita][18] ,一款适合数字绘画的开源 2D 图像生成软件,特别是如果你有一块绘图板,还有 [sfxr][19] ,一款游戏音效生成软件,很多参数可以调,但正如它的开发者所说:“基本用法包括了按下随机按钮。”( Paint Rider 的所有音效都是用 Sfxr 做的。)你也可以试试 [Calinou][20] 的众多但有序的开源游戏开发软件列表。 +其他你可能觉得有用的软件有 [Krita][18],这是一款适合数字绘画的开源 2D 图像生成软件,特别是如果你有一块绘图板的话;还有 [sfxr][19],这是一款游戏音效生成软件,很多参数可以调,但正如它的开发者所说:“它的基本用法包括了按下随机按钮。”(Paint Rider 的所有音效都是用 Sfxr 做的。)你也可以试试 [Calinou][20] 的众多但有序的开源游戏开发软件列表。 -你参加 Open Jam 或者其他游戏创作并有别的建议吗?对我未提及的有问题吗?有的话,请在评论中分享。 +你参加 Open Jam 或者其他游戏 Jam 并有别的建议吗?对我未提及的有问题吗?有的话,请在评论中分享。 -------------------------------------------------------------------------------- @@ -72,7 +73,7 @@ via: https://opensource.com/article/17/12/10-keys-rapid-open-source-game-develop 作者:[Ryan Estes][a] 译者:[XYenChi](https://github.com/XYenChi) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 7736dd12f577ebe92883f5447abe955189e0d4e4 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Thu, 31 Jan 2019 23:27:58 +0800 Subject: [PATCH 241/243] PUB:20171222 10 keys to quick game development.md @XYenChi https://linux.cn/article-10496-1.html --- .../20171222 10 keys to quick game development.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {translated/talk => published}/20171222 10 keys to quick game development.md (100%) diff --git a/translated/talk/20171222 10 keys to quick game development.md b/published/20171222 10 keys to quick game development.md similarity index 100% rename from translated/talk/20171222 10 keys to quick game development.md rename to published/20171222 10 keys to quick game development.md From 35d521d1c9c4f0b50ee4cf0a795054dc369bbdce Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Thu, 31 Jan 2019 23:29:57 +0800 Subject: [PATCH 242/243] PRF:20171222 10 keys to quick game development.md --- ...71222 10 keys to quick game development.md | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/published/20171222 10 keys to quick game development.md b/published/20171222 10 keys to quick game development.md index 54dbd9fb99..34a63f44dc 100644 --- a/published/20171222 10 keys to quick game development.md +++ b/published/20171222 10 keys to quick game development.md @@ -9,49 +9,49 @@ 根据我在游戏开发和游戏开发方面的经验,这里有 10 条关于游戏引擎、编码和快速游戏开发的经验教训。 -## 1、限定规模 +### 1、限定规模 很容易想要去做一个规模宏大的冒险游戏或者可以比拟你最喜欢的游戏的东西。如果你有一些经验,追求超乎游戏 Jam 活动的东西可能很酷,但不要高估自己拥有的时间。我欣赏游戏 Jam 活动的一点是它强制你快速将一个游戏从概念阶段变成最终产品,因为你的时间非常有限。这也就是限定规模如此重要的原因。 这个 Open Jam 的主题是“留下痕迹”,题目一出来,我和朋友就开始讨论什么样的游戏适合该主题。一个想法就是做玩家能在敌人身上留下伤痕的 3D 拳击游戏。我几乎没有做 3D 游戏的经验,我想做好的话,在我甚至还没发掘出可玩性之前,就得花太多时间在学习如何让痕迹合理和打击有效。 -## 2、尽早可玩 +### 2、尽早可玩 这是我对游戏 Jam 活动最中肯的建议。试着做出核心机制,快速写出代码,这样你就可以测试并决定它是否值得做成一个完整的游戏。不应该只剩几个小时截止了,你的游戏才可玩。像 Open Jam 这样的三天的活动,不应该花费几个小时以上来做一个可以运行的演示。 -## 3、保持简单 +### 3、保持简单 你想加入的每个特性都会延长整个开发时间。因为你不能迅速使之运行,所以无从得知提交一个新特性是否会消耗大量时间。街机风格的高分作品往往会在游戏 Jam 活动中表现良好,它们天生就很简单。一旦核心部分完成,你可以开始加入特性并润色,无需担心最后游戏是否功能正常。 -## 4、从其他游戏获取灵感 +### 4、从其他游戏获取灵感 可能你想做出完全原创的作品,但有个可以基于它开发的原型极其有用。这将节省重复劳动的时间,因为你已经知道什么有趣。告诉自己实践的经验越多,越容易做出包含自己想法的大型游戏,所以你也能从再创作其他人的作品中得到很好地练习。 考虑到 Open Jam 的“留下痕迹”主题,我觉得创作一个玩的时候可以留下颜料痕迹的游戏会很有趣,这样也可以看到你留下的标记。我记得有款老式动画游戏 [Line Rider 2 Beta][10] (后来叫 Paint Rider),而且知道玩的时候按住 Control 键可以画出痕迹的彩蛋。我简化了这个概念,甚至只需要一个按键来垂直移动。(更像老式飞机游戏)。进入到 Jam 活动大概一两个小时后,我就有了基本模型,可以用一个按钮上下移动和留下小黑圈的痕迹。 -## 5、不要忽视可得性 +### 5、不要忽视可得性 确保尽可能多的人能玩你的游戏。某个提交到 Open Jam 的游戏是虚拟现实游戏。尽管那很酷,但几乎没有人可以玩,因为拥有 VR 设备的人不多。所幸它的开发者并不期望取得好名次,只是想练手。但如果你想和人们分享你的游戏(或者赢得游戏 Jam 活动),注意可得性是很重要的。 Godot (和其他大多数游戏引擎)允许你在所有主流平台发布游戏。提交游戏时,特别是在 [Itch.io][11],有个浏览器版本就可以支持大多数人玩。但尽你所能去发布在更多的平台和操作系统上。我甚至试着在移动端发布 Paint Rider,但技术有限。 -## 6、不要做得太难 +### 6、不要做得太难 如果游戏需要花费过多精力去学或者玩,你将失去一部分玩家。要保持简单和限定规模,这在游戏计划阶段非常重要。再次重申,想出一个需要花上十天半个月开发的宏大的游戏创意很容易;难的是做出好玩、简单的游戏。 给我的妈妈介绍了 Paint Rider 之后,她很快开始玩起来,我认为不需要跟她说明更多。 -## 7、不用太整洁 +### 7、不用太整洁 如果你习惯于花时间在设计模式上和确保代码可复用、可适应,试着放松一点。如果你花太多时间考虑设计,当你最后到了可以玩游戏的时候,你可能发现游戏不是很有趣,那时候就来不及修改了。 这过程也适用于简化更严格的游戏:快速码出验证概念性展示模型,直到找出值得做成完整游戏的,然后你可以潜心建立完美的代码来支持它。为游戏 Jame 活动创作的游戏就像是个快速开发一个可验证的模型一样。 -## 8、但也不要太随意 +### 8、但也不要太随意 另一方面, [意大利面式代码][12] 容易失控,即使游戏开发没有大量代码。还好大多是游戏引擎都考虑到了设计模式。就拿 Godot 的[信号][13] 功能来说,节点可以发送数据信息给它们“连上了”的节点 —— 这是你的设计自动成型的[观察者模式][14]。只要你知道如何利用这种游戏引擎的特性的优势,就可以快速写代码,你的代码也不会特别难读。 -## 9、取得反馈 +### 9、取得反馈 向人们展示你正在做的。让他们试一试并看看他们说些啥。看看他们如何玩你的游戏,找找他们有没有发现你预料之外的事。如果游戏 Jam 活动有 [Discord][15] 频道或者类似的,把你的游戏放上去,人们会反馈给你想法。Paint Rider 的一个确定的功能是画布循环,所以你可以看到之前留下来的画。在有人问我为什么这个游戏没有之前,我甚至没有考虑那个机制。 @@ -59,7 +59,7 @@ Godot (和其他大多数游戏引擎)允许你在所有主流平台发布 而且不要忘了用相同的方式帮助其他人;如果你在玩其他人游戏的时候发现了有助于你游戏的东西,这就是双赢。 -## 10、哪里找资源 +### 10、哪里找资源 做出所有你自己的资源真的会拖你后腿。Open Jam 期间,当我忙于组装新特性和修漏洞时,我注意到 Loathsome 的开发者花了大量时间在绘制主要角色上。你可以简化游戏的艺术风格创作并且用一些视听效果尚可的东西,但这里还有其他选择。试着寻找 [Creative Commons][16] 许可的或免费音乐站点(比如 [Anttis Instrumentals][17])的资源。或者,可行的话,组建一个有专门艺术家、作家或者音乐家的团队。 From f2960461cc678238c7c118419abb63c8685c3352 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Thu, 31 Jan 2019 23:43:07 +0800 Subject: [PATCH 243/243] =?UTF-8?q?=E5=BD=92=E6=A1=A3=20201901?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...4 Computer Laboratory - Raspberry Pi- Lesson 0 Introduction.md | 0 .../20120201 Computer Laboratory - Raspberry Pi- Lesson 1 OK01.md | 0 .../20120202 Computer Laboratory - Raspberry Pi- Lesson 2 OK02.md | 0 published/{ => 201901}/20150717 The History of Hello World.md | 0 .../20170523 Best Websites to Download Linux Games.md | 0 published/{ => 201901}/20170921 The Rise and Rise of JSON.md | 0 ...928 How to create a free baby monitoring system with Gonimo.md | 0 published/{ => 201901}/20171119 The Ruby Story.md | 0 ... started with Turtl, an open source alternative to Evernote.md | 0 .../{ => 201901}/20171222 10 keys to quick game development.md | 0 .../20171227 YAML- probably not so great after all.md | 0 .../20180108 5 arcade-style games in your Linux repository.md | 0 ...rful Terminal Multiplexer For Heavy Command-Line Linux User.md | 0 ...2 How to manage your workstation configuration with Ansible.md | 0 ...ith PGP - Part 4- Moving Your Master Key to Offline Storage.md | 0 ...rity with PGP - Part 5- Moving Subkeys to a Hardware Device.md | 0 ...ommon questions about agile development practices for teams.md | 0 ...ecting Code Integrity with PGP - Part 6- Using PGP with Git.md | 0 ...age your workstation with Ansible- Automating configuration.md | 0 ...ode Integrity with PGP - Part 7- Protecting Online Accounts.md | 0 .../20180411 How To Setup Static File Server Instantly.md | 0 ...principles you should know before you design a microservice.md | 0 published/{ => 201901}/20180428 A Beginners Guide To Flatpak.md | 0 .../20180503 11 Methods To Find System-Server Uptime In Linux.md | 0 .../20180507 Modularity in Fedora 28 Server Edition.md | 0 .../20180604 4 Firefox extensions worth checking out.md | 0 .../{ => 201901}/20180606 Working with modules in Fedora 28.md | 0 ...0180625 8 reasons to use the Xfce Linux desktop environment.md | 0 .../{ => 201901}/20180625 The life cycle of a software bug.md | 0 .../20180703 10 killer tools for the admin in a hurry.md | 0 .../20180722 Dawn of the Microcomputer- The Altair 8800.md | 0 .../20180725 Build an interactive CLI with Node.js.md | 0 published/{ => 201901}/20180731 How to be the lazy sysadmin.md | 0 .../20180809 Perform robust unit tests with PyHamcrest.md | 0 ...80814 5 open source strategy and simulation games for Linux.md | 0 .../{ => 201901}/20180919 5 ways DevSecOps changes security.md | 0 ...ount Dropbox Folder Locally As Virtual File System In Linux.md | 0 published/{ => 201901}/20181016 Final JOS project.md | 0 published/{ => 201901}/20181016 Lab 6- Network Driver.md | 0 ...20181029 How I organize my knowledge as a Software Engineer.md | 0 ...h-Audit - A Tool To Check Vulnerable Packages In Arch Linux.md | 0 ...20181128 Turn an old Linux desktop into a home media center.md | 0 .../20181203 How to bring good fortune to your Linux terminal.md | 0 ... To Boot Into Rescue Mode Or Emergency Mode In Ubuntu 18.04.md | 0 ...07 Plan your own holiday calendar at the Linux command line.md | 0 ...09 Powers of two, powers of Linux- 2048 at the command line.md | 0 ...210 How to Update Ubuntu -Terminal - GUI Methods- It-s FOSS.md | 0 ...Fly - A Replacement To ‘Ctrl-R- Bash History Search Feature.md | 0 .../20181210 Snake your way across your Linux terminal.md | 0 .../{ => 201901}/20181211 Winterize your Bash prompt in Linux.md | 0 .../20181212 5 resolutions for open source project maintainers.md | 0 ...What is PPA- Everything You Need to Know About PPA in Linux.md | 0 .../20181214 The Linux terminal is no one-trick pony.md | 0 ...o the arcade in your Linux terminal with this Pac-man clone.md | 0 ...181217 4 cool new projects to try in COPR for December 2018.md | 0 published/{ => 201901}/20181217 Working with tarballs on Linux.md | 0 ... - Record Your Terminal Sessions As SVG Animations In Linux.md | 0 ...20181218 Use your Linux terminal to celebrate a banner year.md | 0 .../20181219 How to open source your Python library.md | 0 ...181219 Solve a puzzle at the Linux command line with nudoku.md | 0 .../20181220 How To Install Microsoft .NET Core SDK On Linux.md | 0 .../20181220 Let your Linux terminal speak its mind.md | 0 ... Easy Way To Remove Programs Installed From Source In Linux.md | 0 .../20181221 How to Build a Netboot Server, Part 3.md | 0 published/{ => 201901}/20181222 A Tale of HTTP-2.md | 0 ...0181222 Top 11 best Image Viewer for Ubuntu and other Linux.md | 0 .../20181222 Watch YouTube videos at the Linux terminal.md | 0 .../20181223 The Linux command line can fetch fun from afar.md | 0 .../20190103 How to create presentations with Beamer.md | 0 ... CPU Temperature, Frequency, Power And Utilization In Linux.md | 0 published/{ => 201901}/20190104 Managing dotfiles with rcm.md | 0 ... started with Pelican- A Python-based static site generator.md | 0 .../{ => 201901}/20190109 Bash 5.0 Released with New Features.md | 0 .../20190109 Understanding -etc-services file in Linux.md | 0 .../20190113 Get started with Joplin, a note-taking app.md | 0 ...0190114 Get started with Wekan, an open source kanban board.md | 0 ...To Move Multiple File Types Simultaneously From Commandline.md | 0 .../20190114 How to Build a Netboot Server, Part 4.md | 0 .../20190114 Turn a Raspberry Pi 3B- into a PriTunl VPN.md | 0 .../{ => 201901}/20190114 You (probably) don-t need Kubernetes.md | 0 .../{ => 201901}/20190115 Linux Tools- The Meaning of Dot.md | 0 ...20190118 Get started with WTF, a dashboard for the terminal.md | 0 .../{ => 201901}/20190118 Top 5 Linux Server Distributions.md | 0 ...Getting started with Isotope, an open source webmail client.md | 0 84 files changed, 0 insertions(+), 0 deletions(-) rename published/{ => 201901}/20120104 Computer Laboratory - Raspberry Pi- Lesson 0 Introduction.md (100%) rename published/{ => 201901}/20120201 Computer Laboratory - Raspberry Pi- Lesson 1 OK01.md (100%) rename published/{ => 201901}/20120202 Computer Laboratory - Raspberry Pi- Lesson 2 OK02.md (100%) rename published/{ => 201901}/20150717 The History of Hello World.md (100%) rename published/{ => 201901}/20170523 Best Websites to Download Linux Games.md (100%) rename published/{ => 201901}/20170921 The Rise and Rise of JSON.md (100%) rename published/{ => 201901}/20170928 How to create a free baby monitoring system with Gonimo.md (100%) rename published/{ => 201901}/20171119 The Ruby Story.md (100%) rename published/{ => 201901}/20171206 Getting started with Turtl, an open source alternative to Evernote.md (100%) rename published/{ => 201901}/20171222 10 keys to quick game development.md (100%) rename published/{ => 201901}/20171227 YAML- probably not so great after all.md (100%) rename published/{ => 201901}/20180108 5 arcade-style games in your Linux repository.md (100%) rename published/{ => 201901}/20180130 tmux - A Powerful Terminal Multiplexer For Heavy Command-Line Linux User.md (100%) rename published/{ => 201901}/20180302 How to manage your workstation configuration with Ansible.md (100%) rename published/{ => 201901}/20180307 Protecting Code Integrity with PGP - Part 4- Moving Your Master Key to Offline Storage.md (100%) rename published/{ => 201901}/20180314 Protecting Code Integrity with PGP - Part 5- Moving Subkeys to a Hardware Device.md (100%) rename published/{ => 201901}/20180319 6 common questions about agile development practices for teams.md (100%) rename published/{ => 201901}/20180321 Protecting Code Integrity with PGP - Part 6- Using PGP with Git.md (100%) rename published/{ => 201901}/20180326 Manage your workstation with Ansible- Automating configuration.md (100%) rename published/{ => 201901}/20180327 Protecting Code Integrity with PGP - Part 7- Protecting Online Accounts.md (100%) rename published/{ => 201901}/20180411 How To Setup Static File Server Instantly.md (100%) rename published/{ => 201901}/20180419 5 guiding principles you should know before you design a microservice.md (100%) rename published/{ => 201901}/20180428 A Beginners Guide To Flatpak.md (100%) rename published/{ => 201901}/20180503 11 Methods To Find System-Server Uptime In Linux.md (100%) rename published/{ => 201901}/20180507 Modularity in Fedora 28 Server Edition.md (100%) rename published/{ => 201901}/20180604 4 Firefox extensions worth checking out.md (100%) rename published/{ => 201901}/20180606 Working with modules in Fedora 28.md (100%) rename published/{ => 201901}/20180625 8 reasons to use the Xfce Linux desktop environment.md (100%) rename published/{ => 201901}/20180625 The life cycle of a software bug.md (100%) rename published/{ => 201901}/20180703 10 killer tools for the admin in a hurry.md (100%) rename published/{ => 201901}/20180722 Dawn of the Microcomputer- The Altair 8800.md (100%) rename published/{ => 201901}/20180725 Build an interactive CLI with Node.js.md (100%) rename published/{ => 201901}/20180731 How to be the lazy sysadmin.md (100%) rename published/{ => 201901}/20180809 Perform robust unit tests with PyHamcrest.md (100%) rename published/{ => 201901}/20180814 5 open source strategy and simulation games for Linux.md (100%) rename published/{ => 201901}/20180919 5 ways DevSecOps changes security.md (100%) rename published/{ => 201901}/20181005 Dbxfs - Mount Dropbox Folder Locally As Virtual File System In Linux.md (100%) rename published/{ => 201901}/20181016 Final JOS project.md (100%) rename published/{ => 201901}/20181016 Lab 6- Network Driver.md (100%) rename published/{ => 201901}/20181029 How I organize my knowledge as a Software Engineer.md (100%) rename published/{ => 201901}/20181128 Arch-Audit - A Tool To Check Vulnerable Packages In Arch Linux.md (100%) rename published/{ => 201901}/20181128 Turn an old Linux desktop into a home media center.md (100%) rename published/{ => 201901}/20181203 How to bring good fortune to your Linux terminal.md (100%) rename published/{ => 201901}/20181206 How To Boot Into Rescue Mode Or Emergency Mode In Ubuntu 18.04.md (100%) rename published/{ => 201901}/20181207 Plan your own holiday calendar at the Linux command line.md (100%) rename published/{ => 201901}/20181209 Powers of two, powers of Linux- 2048 at the command line.md (100%) rename published/{ => 201901}/20181210 How to Update Ubuntu -Terminal - GUI Methods- It-s FOSS.md (100%) rename published/{ => 201901}/20181210 McFly - A Replacement To ‘Ctrl-R- Bash History Search Feature.md (100%) rename published/{ => 201901}/20181210 Snake your way across your Linux terminal.md (100%) rename published/{ => 201901}/20181211 Winterize your Bash prompt in Linux.md (100%) rename published/{ => 201901}/20181212 5 resolutions for open source project maintainers.md (100%) rename published/{ => 201901}/20181213 What is PPA- Everything You Need to Know About PPA in Linux.md (100%) rename published/{ => 201901}/20181214 The Linux terminal is no one-trick pony.md (100%) rename published/{ => 201901}/20181215 Head to the arcade in your Linux terminal with this Pac-man clone.md (100%) rename published/{ => 201901}/20181217 4 cool new projects to try in COPR for December 2018.md (100%) rename published/{ => 201901}/20181217 Working with tarballs on Linux.md (100%) rename published/{ => 201901}/20181218 Termtosvg - Record Your Terminal Sessions As SVG Animations In Linux.md (100%) rename published/{ => 201901}/20181218 Use your Linux terminal to celebrate a banner year.md (100%) rename published/{ => 201901}/20181219 How to open source your Python library.md (100%) rename published/{ => 201901}/20181219 Solve a puzzle at the Linux command line with nudoku.md (100%) rename published/{ => 201901}/20181220 How To Install Microsoft .NET Core SDK On Linux.md (100%) rename published/{ => 201901}/20181220 Let your Linux terminal speak its mind.md (100%) rename published/{ => 201901}/20181221 An Easy Way To Remove Programs Installed From Source In Linux.md (100%) rename published/{ => 201901}/20181221 How to Build a Netboot Server, Part 3.md (100%) rename published/{ => 201901}/20181222 A Tale of HTTP-2.md (100%) rename published/{ => 201901}/20181222 Top 11 best Image Viewer for Ubuntu and other Linux.md (100%) rename published/{ => 201901}/20181222 Watch YouTube videos at the Linux terminal.md (100%) rename published/{ => 201901}/20181223 The Linux command line can fetch fun from afar.md (100%) rename published/{ => 201901}/20190103 How to create presentations with Beamer.md (100%) rename published/{ => 201901}/20190103 s-tui- A Terminal Tool To Monitor CPU Temperature, Frequency, Power And Utilization In Linux.md (100%) rename published/{ => 201901}/20190104 Managing dotfiles with rcm.md (100%) rename published/{ => 201901}/20190107 Getting started with Pelican- A Python-based static site generator.md (100%) rename published/{ => 201901}/20190109 Bash 5.0 Released with New Features.md (100%) rename published/{ => 201901}/20190109 Understanding -etc-services file in Linux.md (100%) rename published/{ => 201901}/20190113 Get started with Joplin, a note-taking app.md (100%) rename published/{ => 201901}/20190114 Get started with Wekan, an open source kanban board.md (100%) rename published/{ => 201901}/20190114 How To Move Multiple File Types Simultaneously From Commandline.md (100%) rename published/{ => 201901}/20190114 How to Build a Netboot Server, Part 4.md (100%) rename published/{ => 201901}/20190114 Turn a Raspberry Pi 3B- into a PriTunl VPN.md (100%) rename published/{ => 201901}/20190114 You (probably) don-t need Kubernetes.md (100%) rename published/{ => 201901}/20190115 Linux Tools- The Meaning of Dot.md (100%) rename published/{ => 201901}/20190118 Get started with WTF, a dashboard for the terminal.md (100%) rename published/{ => 201901}/20190118 Top 5 Linux Server Distributions.md (100%) rename published/{ => 201901}/20190123 Getting started with Isotope, an open source webmail client.md (100%) diff --git a/published/20120104 Computer Laboratory - Raspberry Pi- Lesson 0 Introduction.md b/published/201901/20120104 Computer Laboratory - Raspberry Pi- Lesson 0 Introduction.md similarity index 100% rename from published/20120104 Computer Laboratory - Raspberry Pi- Lesson 0 Introduction.md rename to published/201901/20120104 Computer Laboratory - Raspberry Pi- Lesson 0 Introduction.md diff --git a/published/20120201 Computer Laboratory - Raspberry Pi- Lesson 1 OK01.md b/published/201901/20120201 Computer Laboratory - Raspberry Pi- Lesson 1 OK01.md similarity index 100% rename from published/20120201 Computer Laboratory - Raspberry Pi- Lesson 1 OK01.md rename to published/201901/20120201 Computer Laboratory - Raspberry Pi- Lesson 1 OK01.md diff --git a/published/20120202 Computer Laboratory - Raspberry Pi- Lesson 2 OK02.md b/published/201901/20120202 Computer Laboratory - Raspberry Pi- Lesson 2 OK02.md similarity index 100% rename from published/20120202 Computer Laboratory - Raspberry Pi- Lesson 2 OK02.md rename to published/201901/20120202 Computer Laboratory - Raspberry Pi- Lesson 2 OK02.md diff --git a/published/20150717 The History of Hello World.md b/published/201901/20150717 The History of Hello World.md similarity index 100% rename from published/20150717 The History of Hello World.md rename to published/201901/20150717 The History of Hello World.md diff --git a/published/20170523 Best Websites to Download Linux Games.md b/published/201901/20170523 Best Websites to Download Linux Games.md similarity index 100% rename from published/20170523 Best Websites to Download Linux Games.md rename to published/201901/20170523 Best Websites to Download Linux Games.md diff --git a/published/20170921 The Rise and Rise of JSON.md b/published/201901/20170921 The Rise and Rise of JSON.md similarity index 100% rename from published/20170921 The Rise and Rise of JSON.md rename to published/201901/20170921 The Rise and Rise of JSON.md diff --git a/published/20170928 How to create a free baby monitoring system with Gonimo.md b/published/201901/20170928 How to create a free baby monitoring system with Gonimo.md similarity index 100% rename from published/20170928 How to create a free baby monitoring system with Gonimo.md rename to published/201901/20170928 How to create a free baby monitoring system with Gonimo.md diff --git a/published/20171119 The Ruby Story.md b/published/201901/20171119 The Ruby Story.md similarity index 100% rename from published/20171119 The Ruby Story.md rename to published/201901/20171119 The Ruby Story.md diff --git a/published/20171206 Getting started with Turtl, an open source alternative to Evernote.md b/published/201901/20171206 Getting started with Turtl, an open source alternative to Evernote.md similarity index 100% rename from published/20171206 Getting started with Turtl, an open source alternative to Evernote.md rename to published/201901/20171206 Getting started with Turtl, an open source alternative to Evernote.md diff --git a/published/20171222 10 keys to quick game development.md b/published/201901/20171222 10 keys to quick game development.md similarity index 100% rename from published/20171222 10 keys to quick game development.md rename to published/201901/20171222 10 keys to quick game development.md diff --git a/published/20171227 YAML- probably not so great after all.md b/published/201901/20171227 YAML- probably not so great after all.md similarity index 100% rename from published/20171227 YAML- probably not so great after all.md rename to published/201901/20171227 YAML- probably not so great after all.md diff --git a/published/20180108 5 arcade-style games in your Linux repository.md b/published/201901/20180108 5 arcade-style games in your Linux repository.md similarity index 100% rename from published/20180108 5 arcade-style games in your Linux repository.md rename to published/201901/20180108 5 arcade-style games in your Linux repository.md diff --git a/published/20180130 tmux - A Powerful Terminal Multiplexer For Heavy Command-Line Linux User.md b/published/201901/20180130 tmux - A Powerful Terminal Multiplexer For Heavy Command-Line Linux User.md similarity index 100% rename from published/20180130 tmux - A Powerful Terminal Multiplexer For Heavy Command-Line Linux User.md rename to published/201901/20180130 tmux - A Powerful Terminal Multiplexer For Heavy Command-Line Linux User.md diff --git a/published/20180302 How to manage your workstation configuration with Ansible.md b/published/201901/20180302 How to manage your workstation configuration with Ansible.md similarity index 100% rename from published/20180302 How to manage your workstation configuration with Ansible.md rename to published/201901/20180302 How to manage your workstation configuration with Ansible.md diff --git a/published/20180307 Protecting Code Integrity with PGP - Part 4- Moving Your Master Key to Offline Storage.md b/published/201901/20180307 Protecting Code Integrity with PGP - Part 4- Moving Your Master Key to Offline Storage.md similarity index 100% rename from published/20180307 Protecting Code Integrity with PGP - Part 4- Moving Your Master Key to Offline Storage.md rename to published/201901/20180307 Protecting Code Integrity with PGP - Part 4- Moving Your Master Key to Offline Storage.md diff --git a/published/20180314 Protecting Code Integrity with PGP - Part 5- Moving Subkeys to a Hardware Device.md b/published/201901/20180314 Protecting Code Integrity with PGP - Part 5- Moving Subkeys to a Hardware Device.md similarity index 100% rename from published/20180314 Protecting Code Integrity with PGP - Part 5- Moving Subkeys to a Hardware Device.md rename to published/201901/20180314 Protecting Code Integrity with PGP - Part 5- Moving Subkeys to a Hardware Device.md diff --git a/published/20180319 6 common questions about agile development practices for teams.md b/published/201901/20180319 6 common questions about agile development practices for teams.md similarity index 100% rename from published/20180319 6 common questions about agile development practices for teams.md rename to published/201901/20180319 6 common questions about agile development practices for teams.md diff --git a/published/20180321 Protecting Code Integrity with PGP - Part 6- Using PGP with Git.md b/published/201901/20180321 Protecting Code Integrity with PGP - Part 6- Using PGP with Git.md similarity index 100% rename from published/20180321 Protecting Code Integrity with PGP - Part 6- Using PGP with Git.md rename to published/201901/20180321 Protecting Code Integrity with PGP - Part 6- Using PGP with Git.md diff --git a/published/20180326 Manage your workstation with Ansible- Automating configuration.md b/published/201901/20180326 Manage your workstation with Ansible- Automating configuration.md similarity index 100% rename from published/20180326 Manage your workstation with Ansible- Automating configuration.md rename to published/201901/20180326 Manage your workstation with Ansible- Automating configuration.md diff --git a/published/20180327 Protecting Code Integrity with PGP - Part 7- Protecting Online Accounts.md b/published/201901/20180327 Protecting Code Integrity with PGP - Part 7- Protecting Online Accounts.md similarity index 100% rename from published/20180327 Protecting Code Integrity with PGP - Part 7- Protecting Online Accounts.md rename to published/201901/20180327 Protecting Code Integrity with PGP - Part 7- Protecting Online Accounts.md diff --git a/published/20180411 How To Setup Static File Server Instantly.md b/published/201901/20180411 How To Setup Static File Server Instantly.md similarity index 100% rename from published/20180411 How To Setup Static File Server Instantly.md rename to published/201901/20180411 How To Setup Static File Server Instantly.md diff --git a/published/20180419 5 guiding principles you should know before you design a microservice.md b/published/201901/20180419 5 guiding principles you should know before you design a microservice.md similarity index 100% rename from published/20180419 5 guiding principles you should know before you design a microservice.md rename to published/201901/20180419 5 guiding principles you should know before you design a microservice.md diff --git a/published/20180428 A Beginners Guide To Flatpak.md b/published/201901/20180428 A Beginners Guide To Flatpak.md similarity index 100% rename from published/20180428 A Beginners Guide To Flatpak.md rename to published/201901/20180428 A Beginners Guide To Flatpak.md diff --git a/published/20180503 11 Methods To Find System-Server Uptime In Linux.md b/published/201901/20180503 11 Methods To Find System-Server Uptime In Linux.md similarity index 100% rename from published/20180503 11 Methods To Find System-Server Uptime In Linux.md rename to published/201901/20180503 11 Methods To Find System-Server Uptime In Linux.md diff --git a/published/20180507 Modularity in Fedora 28 Server Edition.md b/published/201901/20180507 Modularity in Fedora 28 Server Edition.md similarity index 100% rename from published/20180507 Modularity in Fedora 28 Server Edition.md rename to published/201901/20180507 Modularity in Fedora 28 Server Edition.md diff --git a/published/20180604 4 Firefox extensions worth checking out.md b/published/201901/20180604 4 Firefox extensions worth checking out.md similarity index 100% rename from published/20180604 4 Firefox extensions worth checking out.md rename to published/201901/20180604 4 Firefox extensions worth checking out.md diff --git a/published/20180606 Working with modules in Fedora 28.md b/published/201901/20180606 Working with modules in Fedora 28.md similarity index 100% rename from published/20180606 Working with modules in Fedora 28.md rename to published/201901/20180606 Working with modules in Fedora 28.md diff --git a/published/20180625 8 reasons to use the Xfce Linux desktop environment.md b/published/201901/20180625 8 reasons to use the Xfce Linux desktop environment.md similarity index 100% rename from published/20180625 8 reasons to use the Xfce Linux desktop environment.md rename to published/201901/20180625 8 reasons to use the Xfce Linux desktop environment.md diff --git a/published/20180625 The life cycle of a software bug.md b/published/201901/20180625 The life cycle of a software bug.md similarity index 100% rename from published/20180625 The life cycle of a software bug.md rename to published/201901/20180625 The life cycle of a software bug.md diff --git a/published/20180703 10 killer tools for the admin in a hurry.md b/published/201901/20180703 10 killer tools for the admin in a hurry.md similarity index 100% rename from published/20180703 10 killer tools for the admin in a hurry.md rename to published/201901/20180703 10 killer tools for the admin in a hurry.md diff --git a/published/20180722 Dawn of the Microcomputer- The Altair 8800.md b/published/201901/20180722 Dawn of the Microcomputer- The Altair 8800.md similarity index 100% rename from published/20180722 Dawn of the Microcomputer- The Altair 8800.md rename to published/201901/20180722 Dawn of the Microcomputer- The Altair 8800.md diff --git a/published/20180725 Build an interactive CLI with Node.js.md b/published/201901/20180725 Build an interactive CLI with Node.js.md similarity index 100% rename from published/20180725 Build an interactive CLI with Node.js.md rename to published/201901/20180725 Build an interactive CLI with Node.js.md diff --git a/published/20180731 How to be the lazy sysadmin.md b/published/201901/20180731 How to be the lazy sysadmin.md similarity index 100% rename from published/20180731 How to be the lazy sysadmin.md rename to published/201901/20180731 How to be the lazy sysadmin.md diff --git a/published/20180809 Perform robust unit tests with PyHamcrest.md b/published/201901/20180809 Perform robust unit tests with PyHamcrest.md similarity index 100% rename from published/20180809 Perform robust unit tests with PyHamcrest.md rename to published/201901/20180809 Perform robust unit tests with PyHamcrest.md diff --git a/published/20180814 5 open source strategy and simulation games for Linux.md b/published/201901/20180814 5 open source strategy and simulation games for Linux.md similarity index 100% rename from published/20180814 5 open source strategy and simulation games for Linux.md rename to published/201901/20180814 5 open source strategy and simulation games for Linux.md diff --git a/published/20180919 5 ways DevSecOps changes security.md b/published/201901/20180919 5 ways DevSecOps changes security.md similarity index 100% rename from published/20180919 5 ways DevSecOps changes security.md rename to published/201901/20180919 5 ways DevSecOps changes security.md diff --git a/published/20181005 Dbxfs - Mount Dropbox Folder Locally As Virtual File System In Linux.md b/published/201901/20181005 Dbxfs - Mount Dropbox Folder Locally As Virtual File System In Linux.md similarity index 100% rename from published/20181005 Dbxfs - Mount Dropbox Folder Locally As Virtual File System In Linux.md rename to published/201901/20181005 Dbxfs - Mount Dropbox Folder Locally As Virtual File System In Linux.md diff --git a/published/20181016 Final JOS project.md b/published/201901/20181016 Final JOS project.md similarity index 100% rename from published/20181016 Final JOS project.md rename to published/201901/20181016 Final JOS project.md diff --git a/published/20181016 Lab 6- Network Driver.md b/published/201901/20181016 Lab 6- Network Driver.md similarity index 100% rename from published/20181016 Lab 6- Network Driver.md rename to published/201901/20181016 Lab 6- Network Driver.md diff --git a/published/20181029 How I organize my knowledge as a Software Engineer.md b/published/201901/20181029 How I organize my knowledge as a Software Engineer.md similarity index 100% rename from published/20181029 How I organize my knowledge as a Software Engineer.md rename to published/201901/20181029 How I organize my knowledge as a Software Engineer.md diff --git a/published/20181128 Arch-Audit - A Tool To Check Vulnerable Packages In Arch Linux.md b/published/201901/20181128 Arch-Audit - A Tool To Check Vulnerable Packages In Arch Linux.md similarity index 100% rename from published/20181128 Arch-Audit - A Tool To Check Vulnerable Packages In Arch Linux.md rename to published/201901/20181128 Arch-Audit - A Tool To Check Vulnerable Packages In Arch Linux.md diff --git a/published/20181128 Turn an old Linux desktop into a home media center.md b/published/201901/20181128 Turn an old Linux desktop into a home media center.md similarity index 100% rename from published/20181128 Turn an old Linux desktop into a home media center.md rename to published/201901/20181128 Turn an old Linux desktop into a home media center.md diff --git a/published/20181203 How to bring good fortune to your Linux terminal.md b/published/201901/20181203 How to bring good fortune to your Linux terminal.md similarity index 100% rename from published/20181203 How to bring good fortune to your Linux terminal.md rename to published/201901/20181203 How to bring good fortune to your Linux terminal.md diff --git a/published/20181206 How To Boot Into Rescue Mode Or Emergency Mode In Ubuntu 18.04.md b/published/201901/20181206 How To Boot Into Rescue Mode Or Emergency Mode In Ubuntu 18.04.md similarity index 100% rename from published/20181206 How To Boot Into Rescue Mode Or Emergency Mode In Ubuntu 18.04.md rename to published/201901/20181206 How To Boot Into Rescue Mode Or Emergency Mode In Ubuntu 18.04.md diff --git a/published/20181207 Plan your own holiday calendar at the Linux command line.md b/published/201901/20181207 Plan your own holiday calendar at the Linux command line.md similarity index 100% rename from published/20181207 Plan your own holiday calendar at the Linux command line.md rename to published/201901/20181207 Plan your own holiday calendar at the Linux command line.md diff --git a/published/20181209 Powers of two, powers of Linux- 2048 at the command line.md b/published/201901/20181209 Powers of two, powers of Linux- 2048 at the command line.md similarity index 100% rename from published/20181209 Powers of two, powers of Linux- 2048 at the command line.md rename to published/201901/20181209 Powers of two, powers of Linux- 2048 at the command line.md diff --git a/published/20181210 How to Update Ubuntu -Terminal - GUI Methods- It-s FOSS.md b/published/201901/20181210 How to Update Ubuntu -Terminal - GUI Methods- It-s FOSS.md similarity index 100% rename from published/20181210 How to Update Ubuntu -Terminal - GUI Methods- It-s FOSS.md rename to published/201901/20181210 How to Update Ubuntu -Terminal - GUI Methods- It-s FOSS.md diff --git a/published/20181210 McFly - A Replacement To ‘Ctrl-R- Bash History Search Feature.md b/published/201901/20181210 McFly - A Replacement To ‘Ctrl-R- Bash History Search Feature.md similarity index 100% rename from published/20181210 McFly - A Replacement To ‘Ctrl-R- Bash History Search Feature.md rename to published/201901/20181210 McFly - A Replacement To ‘Ctrl-R- Bash History Search Feature.md diff --git a/published/20181210 Snake your way across your Linux terminal.md b/published/201901/20181210 Snake your way across your Linux terminal.md similarity index 100% rename from published/20181210 Snake your way across your Linux terminal.md rename to published/201901/20181210 Snake your way across your Linux terminal.md diff --git a/published/20181211 Winterize your Bash prompt in Linux.md b/published/201901/20181211 Winterize your Bash prompt in Linux.md similarity index 100% rename from published/20181211 Winterize your Bash prompt in Linux.md rename to published/201901/20181211 Winterize your Bash prompt in Linux.md diff --git a/published/20181212 5 resolutions for open source project maintainers.md b/published/201901/20181212 5 resolutions for open source project maintainers.md similarity index 100% rename from published/20181212 5 resolutions for open source project maintainers.md rename to published/201901/20181212 5 resolutions for open source project maintainers.md diff --git a/published/20181213 What is PPA- Everything You Need to Know About PPA in Linux.md b/published/201901/20181213 What is PPA- Everything You Need to Know About PPA in Linux.md similarity index 100% rename from published/20181213 What is PPA- Everything You Need to Know About PPA in Linux.md rename to published/201901/20181213 What is PPA- Everything You Need to Know About PPA in Linux.md diff --git a/published/20181214 The Linux terminal is no one-trick pony.md b/published/201901/20181214 The Linux terminal is no one-trick pony.md similarity index 100% rename from published/20181214 The Linux terminal is no one-trick pony.md rename to published/201901/20181214 The Linux terminal is no one-trick pony.md diff --git a/published/20181215 Head to the arcade in your Linux terminal with this Pac-man clone.md b/published/201901/20181215 Head to the arcade in your Linux terminal with this Pac-man clone.md similarity index 100% rename from published/20181215 Head to the arcade in your Linux terminal with this Pac-man clone.md rename to published/201901/20181215 Head to the arcade in your Linux terminal with this Pac-man clone.md diff --git a/published/20181217 4 cool new projects to try in COPR for December 2018.md b/published/201901/20181217 4 cool new projects to try in COPR for December 2018.md similarity index 100% rename from published/20181217 4 cool new projects to try in COPR for December 2018.md rename to published/201901/20181217 4 cool new projects to try in COPR for December 2018.md diff --git a/published/20181217 Working with tarballs on Linux.md b/published/201901/20181217 Working with tarballs on Linux.md similarity index 100% rename from published/20181217 Working with tarballs on Linux.md rename to published/201901/20181217 Working with tarballs on Linux.md diff --git a/published/20181218 Termtosvg - Record Your Terminal Sessions As SVG Animations In Linux.md b/published/201901/20181218 Termtosvg - Record Your Terminal Sessions As SVG Animations In Linux.md similarity index 100% rename from published/20181218 Termtosvg - Record Your Terminal Sessions As SVG Animations In Linux.md rename to published/201901/20181218 Termtosvg - Record Your Terminal Sessions As SVG Animations In Linux.md diff --git a/published/20181218 Use your Linux terminal to celebrate a banner year.md b/published/201901/20181218 Use your Linux terminal to celebrate a banner year.md similarity index 100% rename from published/20181218 Use your Linux terminal to celebrate a banner year.md rename to published/201901/20181218 Use your Linux terminal to celebrate a banner year.md diff --git a/published/20181219 How to open source your Python library.md b/published/201901/20181219 How to open source your Python library.md similarity index 100% rename from published/20181219 How to open source your Python library.md rename to published/201901/20181219 How to open source your Python library.md diff --git a/published/20181219 Solve a puzzle at the Linux command line with nudoku.md b/published/201901/20181219 Solve a puzzle at the Linux command line with nudoku.md similarity index 100% rename from published/20181219 Solve a puzzle at the Linux command line with nudoku.md rename to published/201901/20181219 Solve a puzzle at the Linux command line with nudoku.md diff --git a/published/20181220 How To Install Microsoft .NET Core SDK On Linux.md b/published/201901/20181220 How To Install Microsoft .NET Core SDK On Linux.md similarity index 100% rename from published/20181220 How To Install Microsoft .NET Core SDK On Linux.md rename to published/201901/20181220 How To Install Microsoft .NET Core SDK On Linux.md diff --git a/published/20181220 Let your Linux terminal speak its mind.md b/published/201901/20181220 Let your Linux terminal speak its mind.md similarity index 100% rename from published/20181220 Let your Linux terminal speak its mind.md rename to published/201901/20181220 Let your Linux terminal speak its mind.md diff --git a/published/20181221 An Easy Way To Remove Programs Installed From Source In Linux.md b/published/201901/20181221 An Easy Way To Remove Programs Installed From Source In Linux.md similarity index 100% rename from published/20181221 An Easy Way To Remove Programs Installed From Source In Linux.md rename to published/201901/20181221 An Easy Way To Remove Programs Installed From Source In Linux.md diff --git a/published/20181221 How to Build a Netboot Server, Part 3.md b/published/201901/20181221 How to Build a Netboot Server, Part 3.md similarity index 100% rename from published/20181221 How to Build a Netboot Server, Part 3.md rename to published/201901/20181221 How to Build a Netboot Server, Part 3.md diff --git a/published/20181222 A Tale of HTTP-2.md b/published/201901/20181222 A Tale of HTTP-2.md similarity index 100% rename from published/20181222 A Tale of HTTP-2.md rename to published/201901/20181222 A Tale of HTTP-2.md diff --git a/published/20181222 Top 11 best Image Viewer for Ubuntu and other Linux.md b/published/201901/20181222 Top 11 best Image Viewer for Ubuntu and other Linux.md similarity index 100% rename from published/20181222 Top 11 best Image Viewer for Ubuntu and other Linux.md rename to published/201901/20181222 Top 11 best Image Viewer for Ubuntu and other Linux.md diff --git a/published/20181222 Watch YouTube videos at the Linux terminal.md b/published/201901/20181222 Watch YouTube videos at the Linux terminal.md similarity index 100% rename from published/20181222 Watch YouTube videos at the Linux terminal.md rename to published/201901/20181222 Watch YouTube videos at the Linux terminal.md diff --git a/published/20181223 The Linux command line can fetch fun from afar.md b/published/201901/20181223 The Linux command line can fetch fun from afar.md similarity index 100% rename from published/20181223 The Linux command line can fetch fun from afar.md rename to published/201901/20181223 The Linux command line can fetch fun from afar.md diff --git a/published/20190103 How to create presentations with Beamer.md b/published/201901/20190103 How to create presentations with Beamer.md similarity index 100% rename from published/20190103 How to create presentations with Beamer.md rename to published/201901/20190103 How to create presentations with Beamer.md diff --git a/published/20190103 s-tui- A Terminal Tool To Monitor CPU Temperature, Frequency, Power And Utilization In Linux.md b/published/201901/20190103 s-tui- A Terminal Tool To Monitor CPU Temperature, Frequency, Power And Utilization In Linux.md similarity index 100% rename from published/20190103 s-tui- A Terminal Tool To Monitor CPU Temperature, Frequency, Power And Utilization In Linux.md rename to published/201901/20190103 s-tui- A Terminal Tool To Monitor CPU Temperature, Frequency, Power And Utilization In Linux.md diff --git a/published/20190104 Managing dotfiles with rcm.md b/published/201901/20190104 Managing dotfiles with rcm.md similarity index 100% rename from published/20190104 Managing dotfiles with rcm.md rename to published/201901/20190104 Managing dotfiles with rcm.md diff --git a/published/20190107 Getting started with Pelican- A Python-based static site generator.md b/published/201901/20190107 Getting started with Pelican- A Python-based static site generator.md similarity index 100% rename from published/20190107 Getting started with Pelican- A Python-based static site generator.md rename to published/201901/20190107 Getting started with Pelican- A Python-based static site generator.md diff --git a/published/20190109 Bash 5.0 Released with New Features.md b/published/201901/20190109 Bash 5.0 Released with New Features.md similarity index 100% rename from published/20190109 Bash 5.0 Released with New Features.md rename to published/201901/20190109 Bash 5.0 Released with New Features.md diff --git a/published/20190109 Understanding -etc-services file in Linux.md b/published/201901/20190109 Understanding -etc-services file in Linux.md similarity index 100% rename from published/20190109 Understanding -etc-services file in Linux.md rename to published/201901/20190109 Understanding -etc-services file in Linux.md diff --git a/published/20190113 Get started with Joplin, a note-taking app.md b/published/201901/20190113 Get started with Joplin, a note-taking app.md similarity index 100% rename from published/20190113 Get started with Joplin, a note-taking app.md rename to published/201901/20190113 Get started with Joplin, a note-taking app.md diff --git a/published/20190114 Get started with Wekan, an open source kanban board.md b/published/201901/20190114 Get started with Wekan, an open source kanban board.md similarity index 100% rename from published/20190114 Get started with Wekan, an open source kanban board.md rename to published/201901/20190114 Get started with Wekan, an open source kanban board.md diff --git a/published/20190114 How To Move Multiple File Types Simultaneously From Commandline.md b/published/201901/20190114 How To Move Multiple File Types Simultaneously From Commandline.md similarity index 100% rename from published/20190114 How To Move Multiple File Types Simultaneously From Commandline.md rename to published/201901/20190114 How To Move Multiple File Types Simultaneously From Commandline.md diff --git a/published/20190114 How to Build a Netboot Server, Part 4.md b/published/201901/20190114 How to Build a Netboot Server, Part 4.md similarity index 100% rename from published/20190114 How to Build a Netboot Server, Part 4.md rename to published/201901/20190114 How to Build a Netboot Server, Part 4.md diff --git a/published/20190114 Turn a Raspberry Pi 3B- into a PriTunl VPN.md b/published/201901/20190114 Turn a Raspberry Pi 3B- into a PriTunl VPN.md similarity index 100% rename from published/20190114 Turn a Raspberry Pi 3B- into a PriTunl VPN.md rename to published/201901/20190114 Turn a Raspberry Pi 3B- into a PriTunl VPN.md diff --git a/published/20190114 You (probably) don-t need Kubernetes.md b/published/201901/20190114 You (probably) don-t need Kubernetes.md similarity index 100% rename from published/20190114 You (probably) don-t need Kubernetes.md rename to published/201901/20190114 You (probably) don-t need Kubernetes.md diff --git a/published/20190115 Linux Tools- The Meaning of Dot.md b/published/201901/20190115 Linux Tools- The Meaning of Dot.md similarity index 100% rename from published/20190115 Linux Tools- The Meaning of Dot.md rename to published/201901/20190115 Linux Tools- The Meaning of Dot.md diff --git a/published/20190118 Get started with WTF, a dashboard for the terminal.md b/published/201901/20190118 Get started with WTF, a dashboard for the terminal.md similarity index 100% rename from published/20190118 Get started with WTF, a dashboard for the terminal.md rename to published/201901/20190118 Get started with WTF, a dashboard for the terminal.md diff --git a/published/20190118 Top 5 Linux Server Distributions.md b/published/201901/20190118 Top 5 Linux Server Distributions.md similarity index 100% rename from published/20190118 Top 5 Linux Server Distributions.md rename to published/201901/20190118 Top 5 Linux Server Distributions.md diff --git a/published/20190123 Getting started with Isotope, an open source webmail client.md b/published/201901/20190123 Getting started with Isotope, an open source webmail client.md similarity index 100% rename from published/20190123 Getting started with Isotope, an open source webmail client.md rename to published/201901/20190123 Getting started with Isotope, an open source webmail client.md